]> rtime.felk.cvut.cz Git - lisovros/iproute2_canprio.git/blob - include/linux/netlink.h
don't need sa_family
[lisovros/iproute2_canprio.git] / include / linux / netlink.h
1 #ifndef __LINUX_NETLINK_H
2 #define __LINUX_NETLINK_H
3
4 #include <linux/types.h>
5
6 #define NETLINK_ROUTE           0       /* Routing/device hook                          */
7 #define NETLINK_SKIP            1       /* Reserved for ENskip                          */
8 #define NETLINK_USERSOCK        2       /* Reserved for user mode socket protocols      */
9 #define NETLINK_FIREWALL        3       /* Firewalling hook                             */
10 #define NETLINK_TCPDIAG         4       /* TCP socket monitoring                        */
11 #define NETLINK_NFLOG           5       /* netfilter/iptables ULOG */
12 #define NETLINK_XFRM            6       /* ipsec */
13 #define NETLINK_SELINUX         7       /* SELinux event notifications */
14 #define NETLINK_ARPD            8
15 #define NETLINK_AUDIT           9       /* auditing */
16 #define NETLINK_ROUTE6          11      /* af_inet6 route comm channel */
17 #define NETLINK_IP6_FW          13
18 #define NETLINK_DNRTMSG         14      /* DECnet routing messages */
19 #define NETLINK_TAPBASE         16      /* 16 to 31 are ethertap */
20
21 #define MAX_LINKS 32            
22
23 struct sockaddr_nl
24 {
25         sa_family_t     nl_family;      /* AF_NETLINK   */
26         unsigned short  nl_pad;         /* zero         */
27         __u32           nl_pid;         /* process pid  */
28         __u32           nl_groups;      /* multicast groups mask */
29 };
30
31 struct nlmsghdr
32 {
33         __u32           nlmsg_len;      /* Length of message including header */
34         __u16           nlmsg_type;     /* Message content */
35         __u16           nlmsg_flags;    /* Additional flags */
36         __u32           nlmsg_seq;      /* Sequence number */
37         __u32           nlmsg_pid;      /* Sending process PID */
38 };
39
40 /* Flags values */
41
42 #define NLM_F_REQUEST           1       /* It is request message.       */
43 #define NLM_F_MULTI             2       /* Multipart message, terminated by NLMSG_DONE */
44 #define NLM_F_ACK               4       /* Reply with ack, with zero or error code */
45 #define NLM_F_ECHO              8       /* Echo this request            */
46
47 /* Modifiers to GET request */
48 #define NLM_F_ROOT      0x100   /* specify tree root    */
49 #define NLM_F_MATCH     0x200   /* return all matching  */
50 #define NLM_F_ATOMIC    0x400   /* atomic GET           */
51 #define NLM_F_DUMP      (NLM_F_ROOT|NLM_F_MATCH)
52
53 /* Modifiers to NEW request */
54 #define NLM_F_REPLACE   0x100   /* Override existing            */
55 #define NLM_F_EXCL      0x200   /* Do not touch, if it exists   */
56 #define NLM_F_CREATE    0x400   /* Create, if it does not exist */
57 #define NLM_F_APPEND    0x800   /* Add to end of list           */
58
59 /*
60    4.4BSD ADD           NLM_F_CREATE|NLM_F_EXCL
61    4.4BSD CHANGE        NLM_F_REPLACE
62
63    True CHANGE          NLM_F_CREATE|NLM_F_REPLACE
64    Append               NLM_F_CREATE
65    Check                NLM_F_EXCL
66  */
67
68 #define NLMSG_ALIGNTO   4
69 #define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) )
70 #define NLMSG_LENGTH(len) ((len)+NLMSG_ALIGN(sizeof(struct nlmsghdr)))
71 #define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len))
72 #define NLMSG_DATA(nlh)  ((void*)(((char*)nlh) + NLMSG_LENGTH(0)))
73 #define NLMSG_NEXT(nlh,len)      ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \
74                                   (struct nlmsghdr*)(((char*)(nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len)))
75 #define NLMSG_OK(nlh,len) ((len) >= (int)sizeof(struct nlmsghdr) && \
76                            (nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && \
77                            (nlh)->nlmsg_len <= (len))
78 #define NLMSG_PAYLOAD(nlh,len) ((nlh)->nlmsg_len - NLMSG_SPACE((len)))
79
80 #define NLMSG_NOOP              0x1     /* Nothing.             */
81 #define NLMSG_ERROR             0x2     /* Error                */
82 #define NLMSG_DONE              0x3     /* End of a dump        */
83 #define NLMSG_OVERRUN           0x4     /* Data lost            */
84
85 struct nlmsgerr
86 {
87         int             error;
88         struct nlmsghdr msg;
89 };
90
91 #define NET_MAJOR 36            /* Major 36 is reserved for networking                                          */
92
93 enum {
94         NETLINK_UNCONNECTED = 0,
95         NETLINK_CONNECTED,
96 };
97
98
99 #endif  /* __LINUX_NETLINK_H */