/build/buildd/libnl-1.0~pre6/include/netlink/netlink-kernel.h

00001 #ifndef __LINUX_NETLINK_H
00002 #define __LINUX_NETLINK_H
00003 
00004 #define NETLINK_ROUTE           0       /* Routing/device hook */
00005 #define NETLINK_W1              1       /* 1-wire subsystem */
00006 #define NETLINK_USERSOCK        2       /* Reserved for user mode socket protocols      */
00007 #define NETLINK_FIREWALL        3       /* Firewalling hook             */
00008 #define NETLINK_INET_DIAG       4       /* INET socket monitoring */
00009 #define NETLINK_TCPDIAG         NETLINK_INET_DIAG
00010 #define NETLINK_NFLOG           5       /* netfilter/iptables ULOG */
00011 #define NETLINK_XFRM            6       /* ipsec */
00012 #define NETLINK_SELINUX         7       /* SELinux event notifications */
00013 #define NETLINK_ISCSI           8       /* Open-iSCSI */
00014 #define NETLINK_AUDIT           9       /* auditing */
00015 #define NETLINK_FIB_LOOKUP      10
00016 #define NETLINK_CONNECTOR       11
00017 #define NETLINK_NETFILTER       12
00018 #define NETLINK_IP6_FW          13
00019 #define NETLINK_DNRTMSG         14      /* DECnet routing messages */
00020 #define NETLINK_KOBJECT_UEVENT  15      /* Kernel messages to userspace */
00021 #define NETLINK_GENERIC         16
00022 
00023 #define MAX_LINKS 32            
00024 
00025 /**
00026  * Netlink socket address
00027  * @ingroup nl
00028  */
00029 struct sockaddr_nl
00030 {
00031         /** socket family (AF_NETLINK) */
00032         sa_family_t     nl_family;
00033 
00034         /** Padding (unused) */
00035         unsigned short  nl_pad;
00036 
00037         /** Unique process ID  */
00038         uint32_t        nl_pid;
00039 
00040         /** Multicast group subscriptions */
00041         uint32_t        nl_groups;
00042 };
00043 
00044 /**
00045  * Netlink message header
00046  * @ingroup msg
00047  */
00048 struct nlmsghdr
00049 {
00050         /**
00051          * Length of message including header.
00052          */
00053         uint32_t        nlmsg_len;
00054 
00055         /**
00056          * Message type (content type)
00057          */
00058         uint16_t        nlmsg_type;
00059 
00060         /**
00061          * Message flags
00062          */
00063         uint16_t        nlmsg_flags;
00064 
00065         /**
00066          * Sequence number
00067          */
00068         uint32_t        nlmsg_seq;
00069 
00070         /**
00071          * Netlink PID of the proccess sending the message.
00072          */
00073         uint32_t        nlmsg_pid;
00074 };
00075 
00076 /**
00077  * @name Standard message flags
00078  * @{
00079  */
00080 
00081 /**
00082  * Must be set on all request messages (typically from user space to
00083  * kernel space).
00084  * @ingroup msg
00085  */
00086 #define NLM_F_REQUEST           1
00087 
00088 /**
00089  * Indicates the message is part of a multipart message terminated
00090  * by NLMSG_DONE.
00091  */
00092 #define NLM_F_MULTI             2
00093 
00094 /**
00095  * Request for an acknowledgment on success.
00096  */
00097 #define NLM_F_ACK               4
00098 
00099 /**
00100  * Echo this request
00101  */
00102 #define NLM_F_ECHO              8
00103 
00104 /** @} */
00105 
00106 /**
00107  * @name Additional message flags for GET requests
00108  * @{
00109  */
00110 
00111 /**
00112  * Return the complete table instead of a single entry.
00113  * @ingroup msg
00114  */
00115 #define NLM_F_ROOT      0x100
00116 
00117 /**
00118  * Return all entries matching criteria passed in message content.
00119  */
00120 #define NLM_F_MATCH     0x200
00121 
00122 /**
00123  * Return an atomic snapshot of the table being referenced. This
00124  * may require special privileges because it has the potential to
00125  * interrupt service in the FE for a longer time.
00126  */
00127 #define NLM_F_ATOMIC    0x400
00128 
00129 /**
00130  * Dump all entries
00131  */
00132 #define NLM_F_DUMP      (NLM_F_ROOT|NLM_F_MATCH)
00133 
00134 /** @} */
00135 
00136 /**
00137  * @name Additional messsage flags for NEW requests
00138  * @{
00139  */
00140 
00141 /**
00142  * Replace existing matching config object with this request.
00143  * @ingroup msg
00144  */
00145 #define NLM_F_REPLACE   0x100
00146 
00147 /**
00148  * Don't replace the config object if it already exists.
00149  */
00150 #define NLM_F_EXCL      0x200
00151 
00152 /**
00153  * Create config object if it doesn't already exist.
00154  */
00155 #define NLM_F_CREATE    0x400
00156 
00157 /**
00158  * Add to the end of the object list.
00159  */
00160 #define NLM_F_APPEND    0x800
00161 
00162 /** @} */
00163 
00164 #define NLMSG_ALIGNTO   4
00165 #define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) )
00166 #define NLMSG_HDRLEN     ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr)))
00167 
00168 /**
00169  * @name Standard Message types
00170  * @{
00171  */
00172 
00173 /**
00174  * No operation, message must be ignored
00175  * @ingroup msg
00176  */
00177 #define NLMSG_NOOP              0x1
00178 
00179 /**
00180  * The message signals an error and the payload contains a nlmsgerr
00181  * structure. This can be looked at as a NACK and typically it is
00182  * from FEC to CPC.
00183  */
00184 #define NLMSG_ERROR             0x2
00185 
00186 /**
00187  * Message terminates a multipart message.
00188  */
00189 #define NLMSG_DONE              0x3
00190 
00191 /**
00192  * The message signals that data got lost
00193  */
00194 #define NLMSG_OVERRUN           0x4
00195 
00196 /**
00197  * Lower limit of reserved message types
00198  */
00199 #define NLMSG_MIN_TYPE          0x10
00200 
00201 /** @} */
00202 
00203 /**
00204  * Netlink error message
00205  * @ingroup msg
00206  */
00207 struct nlmsgerr
00208 {
00209         /** Error code (errno number) */
00210         int             error;
00211 
00212         /** Original netlink message causing the error */
00213         struct nlmsghdr msg;
00214 };
00215 
00216 #define NETLINK_ADD_MEMBERSHIP  1
00217 #define NETLINK_DROP_MEMBERSHIP 2
00218 #define NETLINK_PKTINFO         3
00219 
00220 struct nl_pktinfo
00221 {
00222         __u32   group;
00223 };
00224 
00225 /**
00226  * Netlink Attribute
00227  * @ingroup attr
00228  */
00229 struct nlattr
00230 {
00231         /** Attribute length */
00232         __u16           nla_len;
00233 
00234         /** Attribute type */
00235         __u16           nla_type;
00236 };
00237 
00238 #define NLA_ALIGNTO             4
00239 #define NLA_ALIGN(len)          (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1))
00240 #define NLA_HDRLEN              ((int) NLA_ALIGN(sizeof(struct nlattr)))
00241 
00242 #endif  /* __LINUX_NETLINK_H */

Generated on Fri Apr 27 14:14:07 2007 for libnl by  doxygen 1.5.1