netlink.h (d387f6ad10764fc2174373b4a1cca443adee36e3) | netlink.h (97676b6b5538b3e059d33b8338e7d5cc41c5f1f1) |
---|---|
1#ifndef __NET_NETLINK_H 2#define __NET_NETLINK_H 3 4#include <linux/types.h> 5#include <linux/netlink.h> 6 7/* ======================================================================== 8 * Netlink Messages and Attributes Interface (As Seen On TV) --- 51 unchanged lines hidden (view full) --- 60 * nlmsg_ok(nlh, remaining) does nlh fit into remaining bytes? 61 * nlmsg_next(nlh, remaining) get next netlink message 62 * nlmsg_parse() parse attributes of a message 63 * nlmsg_find_attr() find an attribute in a message 64 * nlmsg_for_each_msg() loop over all messages 65 * nlmsg_validate() validate netlink message incl. attrs 66 * nlmsg_for_each_attr() loop over all attributes 67 * | 1#ifndef __NET_NETLINK_H 2#define __NET_NETLINK_H 3 4#include <linux/types.h> 5#include <linux/netlink.h> 6 7/* ======================================================================== 8 * Netlink Messages and Attributes Interface (As Seen On TV) --- 51 unchanged lines hidden (view full) --- 60 * nlmsg_ok(nlh, remaining) does nlh fit into remaining bytes? 61 * nlmsg_next(nlh, remaining) get next netlink message 62 * nlmsg_parse() parse attributes of a message 63 * nlmsg_find_attr() find an attribute in a message 64 * nlmsg_for_each_msg() loop over all messages 65 * nlmsg_validate() validate netlink message incl. attrs 66 * nlmsg_for_each_attr() loop over all attributes 67 * |
68 * Misc: 69 * nlmsg_report() report back to application? 70 * |
|
68 * ------------------------------------------------------------------------ 69 * Attributes Interface 70 * ------------------------------------------------------------------------ 71 * 72 * Attribute Format: 73 * <------- nla_total_size(payload) -------> 74 * <---- nla_attr_size(payload) -----> 75 * +----------+- - -+- - - - - - - - - +- - -+-------- - - --- 113 unchanged lines hidden (view full) --- 189 u16 minlen; 190}; 191 192extern void netlink_run_queue(struct sock *sk, unsigned int *qlen, 193 int (*cb)(struct sk_buff *, 194 struct nlmsghdr *, int *)); 195extern void netlink_queue_skip(struct nlmsghdr *nlh, 196 struct sk_buff *skb); | 71 * ------------------------------------------------------------------------ 72 * Attributes Interface 73 * ------------------------------------------------------------------------ 74 * 75 * Attribute Format: 76 * <------- nla_total_size(payload) -------> 77 * <---- nla_attr_size(payload) -----> 78 * +----------+- - -+- - - - - - - - - +- - -+-------- - - --- 113 unchanged lines hidden (view full) --- 192 u16 minlen; 193}; 194 195extern void netlink_run_queue(struct sock *sk, unsigned int *qlen, 196 int (*cb)(struct sk_buff *, 197 struct nlmsghdr *, int *)); 198extern void netlink_queue_skip(struct nlmsghdr *nlh, 199 struct sk_buff *skb); |
200extern int nlmsg_notify(struct sock *sk, struct sk_buff *skb, 201 u32 pid, unsigned int group, int report, 202 gfp_t flags); |
|
197 198extern int nla_validate(struct nlattr *head, int len, int maxtype, 199 struct nla_policy *policy); 200extern int nla_parse(struct nlattr *tb[], int maxtype, 201 struct nlattr *head, int len, 202 struct nla_policy *policy); 203extern struct nlattr * nla_find(struct nlattr *head, int len, int attrtype); 204extern size_t nla_strlcpy(char *dst, const struct nlattr *nla, --- 166 unchanged lines hidden (view full) --- 371 if (nlh->nlmsg_len < nlmsg_msg_size(hdrlen)) 372 return -EINVAL; 373 374 return nla_validate(nlmsg_attrdata(nlh, hdrlen), 375 nlmsg_attrlen(nlh, hdrlen), maxtype, policy); 376} 377 378/** | 203 204extern int nla_validate(struct nlattr *head, int len, int maxtype, 205 struct nla_policy *policy); 206extern int nla_parse(struct nlattr *tb[], int maxtype, 207 struct nlattr *head, int len, 208 struct nla_policy *policy); 209extern struct nlattr * nla_find(struct nlattr *head, int len, int attrtype); 210extern size_t nla_strlcpy(char *dst, const struct nlattr *nla, --- 166 unchanged lines hidden (view full) --- 377 if (nlh->nlmsg_len < nlmsg_msg_size(hdrlen)) 378 return -EINVAL; 379 380 return nla_validate(nlmsg_attrdata(nlh, hdrlen), 381 nlmsg_attrlen(nlh, hdrlen), maxtype, policy); 382} 383 384/** |
385 * nlmsg_report - need to report back to application? 386 * @nlh: netlink message header 387 * 388 * Returns 1 if a report back to the application is requested. 389 */ 390static inline int nlmsg_report(struct nlmsghdr *nlh) 391{ 392 return !!(nlh->nlmsg_flags & NLM_F_ECHO); 393} 394 395/** |
|
379 * nlmsg_for_each_attr - iterate over a stream of attributes 380 * @pos: loop counter, set to current attribute 381 * @nlh: netlink message header 382 * @hdrlen: length of familiy specific header 383 * @rem: initialized to len, holds bytes currently remaining in stream 384 */ 385#define nlmsg_for_each_attr(pos, nlh, hdrlen, rem) \ 386 nla_for_each_attr(pos, nlmsg_attrdata(nlh, hdrlen), \ --- 553 unchanged lines hidden --- | 396 * nlmsg_for_each_attr - iterate over a stream of attributes 397 * @pos: loop counter, set to current attribute 398 * @nlh: netlink message header 399 * @hdrlen: length of familiy specific header 400 * @rem: initialized to len, holds bytes currently remaining in stream 401 */ 402#define nlmsg_for_each_attr(pos, nlh, hdrlen, rem) \ 403 nla_for_each_attr(pos, nlmsg_attrdata(nlh, hdrlen), \ --- 553 unchanged lines hidden --- |