Main Page | Class List | File List | Class Members | File Members

netlink.h File Reference

Go to the source code of this file.

Classes

struct  sockaddr_nl
struct  nlmsghdr
struct  nlmsgerr
struct  netlink_skb_parms
struct  netlink_callback
struct  netlink_notify

Defines

#define NETLINK_ROUTE   0
#define NETLINK_SKIP   1
#define NETLINK_USERSOCK   2
#define NETLINK_FIREWALL   3
#define NETLINK_TCPDIAG   4
#define NETLINK_NFLOG   5
#define NETLINK_ARPD   8
#define NETLINK_ROUTE6   11
#define NETLINK_IP6_FW   13
#define NETLINK_DNRTMSG   14
#define NETLINK_TAPBASE   16
#define MAX_LINKS   32
#define NLM_F_REQUEST   1
#define NLM_F_MULTI   2
#define NLM_F_ACK   4
#define NLM_F_ECHO   8
#define NLM_F_ROOT   0x100
#define NLM_F_MATCH   0x200
#define NLM_F_ATOMIC   0x400
#define NLM_F_DUMP   (NLM_F_ROOT|NLM_F_MATCH)
#define NLM_F_REPLACE   0x100
#define NLM_F_EXCL   0x200
#define NLM_F_CREATE   0x400
#define NLM_F_APPEND   0x800
#define NLMSG_ALIGNTO   4
#define NLMSG_ALIGN(len)   ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) )
#define NLMSG_LENGTH(len)   ((len)+NLMSG_ALIGN(sizeof(struct nlmsghdr)))
#define NLMSG_SPACE(len)   NLMSG_ALIGN(NLMSG_LENGTH(len))
#define NLMSG_DATA(nlh)   ((void*)(((char*)nlh) + NLMSG_LENGTH(0)))
#define NLMSG_NEXT(nlh, len)
#define NLMSG_OK(nlh, len)
#define NLMSG_PAYLOAD(nlh, len)   ((nlh)->nlmsg_len - NLMSG_SPACE((len)))
#define NLMSG_NOOP   0x1
#define NLMSG_ERROR   0x2
#define NLMSG_DONE   0x3
#define NLMSG_OVERRUN   0x4
#define NET_MAJOR   36
#define NETLINK_CB(skb)   (*(struct netlink_skb_parms*)&((skb)->cb))
#define NETLINK_CREDS(skb)   (&NETLINK_CB((skb)).creds)
#define NLMSG_GOODSIZE   (PAGE_SIZE - ((sizeof(struct sk_buff)+0xF)&~0xF))
#define NLMSG_PUT(skb, pid, seq, type, len)
#define NL_NONROOT_RECV   0x1
#define NL_NONROOT_SEND   0x2

Functions

int netlink_attach (int unit, int(*function)(int, struct sk_buff *skb))
void netlink_detach (int unit)
int netlink_post (int unit, struct sk_buff *skb)
int init_netlink (void)
socknetlink_kernel_create (int unit, void(*input)(struct sock *sk, int len))
void netlink_ack (struct sk_buff *in_skb, struct nlmsghdr *nlh, int err)
int netlink_unicast (struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock)
void netlink_broadcast (struct sock *ssk, struct sk_buff *skb, __u32 pid, __u32 group, int allocation)
void netlink_set_err (struct sock *ssk, __u32 pid, __u32 group, int code)
int netlink_register_notifier (struct notifier_block *nb)
int netlink_unregister_notifier (struct notifier_block *nb)
__inline__ struct nlmsghdr__nlmsg_put (struct sk_buff *skb, u32 pid, u32 seq, int type, int len)
int netlink_dump_start (struct sock *ssk, struct sk_buff *skb, struct nlmsghdr *nlh, int(*dump)(struct sk_buff *skb, struct netlink_callback *), int(*done)(struct netlink_callback *))
void netlink_set_nonroot (int protocol, unsigned flag)


Define Documentation

#define MAX_LINKS   32
 

Definition at line 16 of file netlink.h.

#define NET_MAJOR   36
 

Definition at line 85 of file netlink.h.

#define NETLINK_ARPD   8
 

Definition at line 10 of file netlink.h.

#define NETLINK_CB skb   )     (*(struct netlink_skb_parms*)&((skb)->cb))
 

Definition at line 99 of file netlink.h.

Referenced by fn_hash_dump_bucket(), inet_dump_ifaddr(), inet_rtm_delroute(), inet_rtm_getroute(), inet_rtm_newroute(), ip_rt_dump(), ipmr_cache_resolve(), ipmr_destroy_unres(), ipq_rcv_skb(), neigh_dump_table(), rtmsg_fib(), rtmsg_ifa(), rtmsg_ifinfo(), rtmsg_iwinfo(), rtnetlink_dump_ifinfo(), rtnetlink_rcv_msg(), rtnetlink_send(), tcpdiag_dump(), tcpdiag_get_exact(), and ulog_send().

#define NETLINK_CREDS skb   )     (&NETLINK_CB((skb)).creds)
 

Definition at line 100 of file netlink.h.

Referenced by inet_fill_rule().

#define NETLINK_DNRTMSG   14
 

Definition at line 13 of file netlink.h.

#define NETLINK_FIREWALL   3
 

Definition at line 7 of file netlink.h.

Referenced by init_or_cleanup(), ip_fw_chk(), ipfw_init_or_cleanup(), and ipq_rcv_nl_event().

#define NETLINK_IP6_FW   13
 

Definition at line 12 of file netlink.h.

#define NETLINK_NFLOG   5
 

Definition at line 9 of file netlink.h.

Referenced by init().

#define NETLINK_ROUTE   0
 

Definition at line 4 of file netlink.h.

Referenced by rtnetlink_init().

#define NETLINK_ROUTE6   11
 

Definition at line 11 of file netlink.h.

#define NETLINK_SKIP   1
 

Definition at line 5 of file netlink.h.

#define NETLINK_TAPBASE   16
 

Definition at line 14 of file netlink.h.

#define NETLINK_TCPDIAG   4
 

Definition at line 8 of file netlink.h.

Referenced by tcpdiag_init().

#define NETLINK_USERSOCK   2
 

Definition at line 6 of file netlink.h.

#define NL_NONROOT_RECV   0x1
 

Definition at line 164 of file netlink.h.

Referenced by rtnetlink_init().

#define NL_NONROOT_SEND   0x2
 

Definition at line 165 of file netlink.h.

#define NLM_F_ACK   4
 

Definition at line 39 of file netlink.h.

Referenced by ipq_rcv_skb(), rtnetlink_rcv_skb(), and tcpdiag_rcv_skb().

#define NLM_F_APPEND   0x800
 

Definition at line 52 of file netlink.h.

Referenced by fib_magic(), and fn_hash_insert().

#define NLM_F_ATOMIC   0x400
 

Definition at line 45 of file netlink.h.

#define NLM_F_CREATE   0x400
 

Definition at line 51 of file netlink.h.

Referenced by fib_convert_rtentry(), fib_magic(), fn_hash_insert(), and neigh_add().

#define NLM_F_DUMP   (NLM_F_ROOT|NLM_F_MATCH)
 

Definition at line 46 of file netlink.h.

Referenced by rtnetlink_rcv_msg(), and tcpdiag_rcv_msg().

#define NLM_F_ECHO   8
 

Definition at line 40 of file netlink.h.

Referenced by rtmsg_fib().

#define NLM_F_EXCL   0x200
 

Definition at line 50 of file netlink.h.

Referenced by fn_hash_insert(), and neigh_add().

#define NLM_F_MATCH   0x200
 

Definition at line 44 of file netlink.h.

#define NLM_F_MULTI   2
 

Definition at line 38 of file netlink.h.

Referenced by inet_fill_ifaddr(), ipq_rcv_skb(), ipt_ulog_target(), rt_fill_info(), and rtnetlink_fill_ifinfo().

#define NLM_F_REPLACE   0x100
 

Definition at line 49 of file netlink.h.

Referenced by fn_hash_insert(), and neigh_add().

#define NLM_F_REQUEST   1
 

Definition at line 37 of file netlink.h.

Referenced by fib_convert_rtentry(), fib_magic(), ipq_rcv_skb(), rtnetlink_rcv_msg(), and tcpdiag_rcv_msg().

#define NLM_F_ROOT   0x100
 

Definition at line 43 of file netlink.h.

#define NLMSG_ALIGN len   )     ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) )
 

Definition at line 64 of file netlink.h.

Referenced by __nlmsg_put(), rtnetlink_rcv_msg(), and rtnetlink_rcv_skb().

#define NLMSG_ALIGNTO   4
 

Definition at line 63 of file netlink.h.

#define NLMSG_DATA nlh   )     ((void*)(((char*)nlh) + NLMSG_LENGTH(0)))
 

Definition at line 67 of file netlink.h.

Referenced by fib_dump_info(), inet_dump_fib(), inet_fill_ifaddr(), inet_fill_rule(), inet_rtm_deladdr(), inet_rtm_delroute(), inet_rtm_delrule(), inet_rtm_getroute(), inet_rtm_newaddr(), inet_rtm_newroute(), inet_rtm_newrule(), ipmr_cache_resolve(), ipmr_destroy_unres(), ipq_build_packet_message(), ipq_rcv_skb(), ipt_ulog_target(), neigh_add(), neigh_delete(), neigh_dump_info(), neigh_fill_info(), rt_fill_info(), rtnetlink_fill_ifinfo(), rtnetlink_fill_iwinfo(), rtnetlink_rcv_msg(), tcpdiag_dump(), tcpdiag_fill(), tcpdiag_get_exact(), and tcpdiag_rcv_msg().

#define NLMSG_DONE   0x3
 

Definition at line 76 of file netlink.h.

Referenced by ipt_ulog_target(), and ulog_send().

#define NLMSG_ERROR   0x2
 

Definition at line 75 of file netlink.h.

Referenced by ipmr_cache_resolve(), and ipmr_destroy_unres().

#define NLMSG_GOODSIZE   (PAGE_SIZE - ((sizeof(struct sk_buff)+0xF)&~0xF))
 

Definition at line 121 of file netlink.h.

Referenced by inet_rtm_getroute(), rtmsg_ifinfo(), and rtmsg_iwinfo().

#define NLMSG_LENGTH len   )     ((len)+NLMSG_ALIGN(sizeof(struct nlmsghdr)))
 

Definition at line 65 of file netlink.h.

Referenced by __nlmsg_put(), fib_convert_rtentry(), ipmr_cache_resolve(), ipmr_destroy_unres(), ipq_rcv_skb(), rtnetlink_rcv_msg(), and tcpdiag_rcv_msg().

#define NLMSG_NEXT nlh,
len   ) 
 

Value:

((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \ (struct nlmsghdr*)(((char*)(nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len)))
Definition at line 68 of file netlink.h.

#define NLMSG_NOOP   0x1
 

Definition at line 74 of file netlink.h.

#define NLMSG_OK nlh,
len   ) 
 

Value:

((len) > 0 && (nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && \ (nlh)->nlmsg_len <= (len))
Definition at line 70 of file netlink.h.

#define NLMSG_OVERRUN   0x4
 

Definition at line 77 of file netlink.h.

#define NLMSG_PAYLOAD nlh,
len   )     ((nlh)->nlmsg_len - NLMSG_SPACE((len)))
 

Definition at line 72 of file netlink.h.

Referenced by inet_dump_fib().

#define NLMSG_PUT skb,
pid,
seq,
type,
len   ) 
 

Value:

({ if (skb_tailroom(skb) < (int)NLMSG_SPACE(len)) goto nlmsg_failure; \ __nlmsg_put(skb, pid, seq, type, len); })
Definition at line 155 of file netlink.h.

Referenced by fib_dump_info(), inet_fill_ifaddr(), inet_fill_rule(), ipq_build_packet_message(), ipt_ulog_target(), neigh_fill_info(), rt_fill_info(), rtnetlink_fill_ifinfo(), rtnetlink_fill_iwinfo(), and tcpdiag_fill().

#define NLMSG_SPACE len   )     NLMSG_ALIGN(NLMSG_LENGTH(len))
 

Definition at line 66 of file netlink.h.

Referenced by ipq_build_packet_message(), ipt_ulog_target(), rtmsg_fib(), rtmsg_ifa(), rtnetlink_rcv_skb(), tcpdiag_dump(), tcpdiag_get_exact(), tcpdiag_rcv_msg(), and tcpdiag_rcv_skb().


Function Documentation

__inline__ struct nlmsghdr* __nlmsg_put struct sk_buff skb,
u32  pid,
u32  seq,
int  type,
int  len
[static]
 

Definition at line 141 of file netlink.h.

References NLMSG_ALIGN, NLMSG_LENGTH, and skb_put().

00142 { 00143 struct nlmsghdr *nlh; 00144 int size = NLMSG_LENGTH(len); 00145 00146 nlh = (struct nlmsghdr*)skb_put(skb, NLMSG_ALIGN(size)); 00147 nlh->nlmsg_type = type; 00148 nlh->nlmsg_len = size; 00149 nlh->nlmsg_flags = 0; 00150 nlh->nlmsg_pid = pid; 00151 nlh->nlmsg_seq = seq; 00152 return nlh; 00153 }

int init_netlink void   ) 
 

Referenced by sock_init().

void netlink_ack struct sk_buff in_skb,
struct nlmsghdr nlh,
int  err
 

Referenced by ipq_rcv_skb(), rtnetlink_rcv_skb(), and tcpdiag_rcv_skb().

int netlink_attach int  unit,
int(*  function)(int, struct sk_buff *skb)
 

void netlink_broadcast struct sock ssk,
struct sk_buff skb,
__u32  pid,
__u32  group,
int  allocation
 

Referenced by ip_fw_domatch(), rtmsg_fib(), rtmsg_ifa(), rtmsg_ifinfo(), rtmsg_iwinfo(), rtnetlink_send(), and ulog_send().

void netlink_detach int  unit  ) 
 

int netlink_dump_start struct sock ssk,
struct sk_buff skb,
struct nlmsghdr nlh,
int(*  dump)(struct sk_buff *skb, struct netlink_callback *),
int(*  done)(struct netlink_callback *)
 

Referenced by rtnetlink_rcv_msg(), and tcpdiag_rcv_msg().

struct sock* netlink_kernel_create int  unit,
void(*  input)(struct sock *sk, int len)
 

Referenced by init(), init_or_cleanup(), ipfw_init_or_cleanup(), rtnetlink_init(), and tcpdiag_init().

int netlink_post int  unit,
struct sk_buff skb
 

Referenced by ip_fw_chk().

int netlink_register_notifier struct notifier_block *  nb  ) 
 

Referenced by init_or_cleanup().

void netlink_set_err struct sock ssk,
__u32  pid,
__u32  group,
int  code
 

Referenced by rtmsg_ifa().

void netlink_set_nonroot int  protocol,
unsigned  flag
 

Referenced by rtnetlink_init().

int netlink_unicast struct sock ssk,
struct sk_buff skb,
__u32  pid,
int  nonblock
 

Referenced by inet_rtm_getroute(), ipmr_cache_resolve(), ipmr_destroy_unres(), ipq_enqueue_packet(), rtmsg_fib(), rtnetlink_send(), and tcpdiag_get_exact().

int netlink_unregister_notifier struct notifier_block *  nb  ) 
 

Referenced by init_or_cleanup().


Generated on Wed Dec 1 21:25:38 2004 for Linux 2.4.23 Networking by doxygen 1.3.8