libnl 1.1
|
00001 #ifndef __LINUX_NETLINK_H 00002 #define __LINUX_NETLINK_H 00003 00004 /** 00005 * Netlink socket address 00006 * @ingroup nl 00007 */ 00008 struct sockaddr_nl 00009 { 00010 /** socket family (AF_NETLINK) */ 00011 sa_family_t nl_family; 00012 00013 /** Padding (unused) */ 00014 unsigned short nl_pad; 00015 00016 /** Unique process ID */ 00017 uint32_t nl_pid; 00018 00019 /** Multicast group subscriptions */ 00020 uint32_t nl_groups; 00021 }; 00022 00023 /** 00024 * Netlink message header 00025 * @ingroup msg 00026 */ 00027 struct nlmsghdr 00028 { 00029 /** 00030 * Length of message including header. 00031 */ 00032 uint32_t nlmsg_len; 00033 00034 /** 00035 * Message type (content type) 00036 */ 00037 uint16_t nlmsg_type; 00038 00039 /** 00040 * Message flags 00041 */ 00042 uint16_t nlmsg_flags; 00043 00044 /** 00045 * Sequence number 00046 */ 00047 uint32_t nlmsg_seq; 00048 00049 /** 00050 * Netlink PID of the proccess sending the message. 00051 */ 00052 uint32_t nlmsg_pid; 00053 }; 00054 00055 /** 00056 * @name Standard message flags 00057 * @{ 00058 */ 00059 00060 /** 00061 * Must be set on all request messages (typically from user space to 00062 * kernel space). 00063 * @ingroup msg 00064 */ 00065 #define NLM_F_REQUEST 1 00066 00067 /** 00068 * Indicates the message is part of a multipart message terminated 00069 * by NLMSG_DONE. 00070 */ 00071 #define NLM_F_MULTI 2 00072 00073 /** 00074 * Request for an acknowledgment on success. 00075 */ 00076 #define NLM_F_ACK 4 00077 00078 /** 00079 * Echo this request 00080 */ 00081 #define NLM_F_ECHO 8 00082 00083 /** @} */ 00084 00085 /** 00086 * @name Additional message flags for GET requests 00087 * @{ 00088 */ 00089 00090 /** 00091 * Return the complete table instead of a single entry. 00092 * @ingroup msg 00093 */ 00094 #define NLM_F_ROOT 0x100 00095 00096 /** 00097 * Return all entries matching criteria passed in message content. 00098 */ 00099 #define NLM_F_MATCH 0x200 00100 00101 /** 00102 * Return an atomic snapshot of the table being referenced. This 00103 * may require special privileges because it has the potential to 00104 * interrupt service in the FE for a longer time. 00105 */ 00106 #define NLM_F_ATOMIC 0x400 00107 00108 /** 00109 * Dump all entries 00110 */ 00111 #define NLM_F_DUMP (NLM_F_ROOT|NLM_F_MATCH) 00112 00113 /** @} */ 00114 00115 /** 00116 * @name Additional messsage flags for NEW requests 00117 * @{ 00118 */ 00119 00120 /** 00121 * Replace existing matching config object with this request. 00122 * @ingroup msg 00123 */ 00124 #define NLM_F_REPLACE 0x100 00125 00126 /** 00127 * Don't replace the config object if it already exists. 00128 */ 00129 #define NLM_F_EXCL 0x200 00130 00131 /** 00132 * Create config object if it doesn't already exist. 00133 */ 00134 #define NLM_F_CREATE 0x400 00135 00136 /** 00137 * Add to the end of the object list. 00138 */ 00139 #define NLM_F_APPEND 0x800 00140 00141 /** @} */ 00142 00143 /** 00144 * @name Standard Message types 00145 * @{ 00146 */ 00147 00148 /** 00149 * No operation, message must be ignored 00150 * @ingroup msg 00151 */ 00152 #define NLMSG_NOOP 0x1 00153 00154 /** 00155 * The message signals an error and the payload contains a nlmsgerr 00156 * structure. This can be looked at as a NACK and typically it is 00157 * from FEC to CPC. 00158 */ 00159 #define NLMSG_ERROR 0x2 00160 00161 /** 00162 * Message terminates a multipart message. 00163 */ 00164 #define NLMSG_DONE 0x3 00165 00166 /** 00167 * The message signals that data got lost 00168 */ 00169 #define NLMSG_OVERRUN 0x4 00170 00171 /** 00172 * Lower limit of reserved message types 00173 */ 00174 #define NLMSG_MIN_TYPE 0x10 00175 00176 /** @} */ 00177 00178 /** 00179 * Netlink error message 00180 * @ingroup msg 00181 */ 00182 struct nlmsgerr 00183 { 00184 /** Error code (errno number) */ 00185 int error; 00186 00187 /** Original netlink message causing the error */ 00188 struct nlmsghdr msg; 00189 }; 00190 00191 struct nl_pktinfo 00192 { 00193 __u32 group; 00194 }; 00195 00196 #endif /* __LINUX_NETLINK_H */