diff options
Diffstat (limited to 'include/linux/netlink.h')
-rw-r--r-- | include/linux/netlink.h | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/include/linux/netlink.h b/include/linux/netlink.h index ba25ca874c20..6a2ccf78a356 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h | |||
@@ -71,7 +71,8 @@ struct nlmsghdr | |||
71 | 71 | ||
72 | #define NLMSG_ALIGNTO 4 | 72 | #define NLMSG_ALIGNTO 4 |
73 | #define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) ) | 73 | #define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) ) |
74 | #define NLMSG_LENGTH(len) ((len)+NLMSG_ALIGN(sizeof(struct nlmsghdr))) | 74 | #define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr))) |
75 | #define NLMSG_LENGTH(len) ((len)+NLMSG_ALIGN(NLMSG_HDRLEN)) | ||
75 | #define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len)) | 76 | #define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len)) |
76 | #define NLMSG_DATA(nlh) ((void*)(((char*)nlh) + NLMSG_LENGTH(0))) | 77 | #define NLMSG_DATA(nlh) ((void*)(((char*)nlh) + NLMSG_LENGTH(0))) |
77 | #define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \ | 78 | #define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \ |
@@ -86,6 +87,8 @@ struct nlmsghdr | |||
86 | #define NLMSG_DONE 0x3 /* End of a dump */ | 87 | #define NLMSG_DONE 0x3 /* End of a dump */ |
87 | #define NLMSG_OVERRUN 0x4 /* Data lost */ | 88 | #define NLMSG_OVERRUN 0x4 /* Data lost */ |
88 | 89 | ||
90 | #define NLMSG_MIN_TYPE 0x10 /* < 0x10: reserved control messages */ | ||
91 | |||
89 | struct nlmsgerr | 92 | struct nlmsgerr |
90 | { | 93 | { |
91 | int error; | 94 | int error; |
@@ -108,6 +111,25 @@ enum { | |||
108 | NETLINK_CONNECTED, | 111 | NETLINK_CONNECTED, |
109 | }; | 112 | }; |
110 | 113 | ||
114 | /* | ||
115 | * <------- NLA_HDRLEN ------> <-- NLA_ALIGN(payload)--> | ||
116 | * +---------------------+- - -+- - - - - - - - - -+- - -+ | ||
117 | * | Header | Pad | Payload | Pad | | ||
118 | * | (struct nlattr) | ing | | ing | | ||
119 | * +---------------------+- - -+- - - - - - - - - -+- - -+ | ||
120 | * <-------------- nlattr->nla_len --------------> | ||
121 | */ | ||
122 | |||
123 | struct nlattr | ||
124 | { | ||
125 | __u16 nla_len; | ||
126 | __u16 nla_type; | ||
127 | }; | ||
128 | |||
129 | #define NLA_ALIGNTO 4 | ||
130 | #define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1)) | ||
131 | #define NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr))) | ||
132 | |||
111 | #ifdef __KERNEL__ | 133 | #ifdef __KERNEL__ |
112 | 134 | ||
113 | #include <linux/capability.h> | 135 | #include <linux/capability.h> |