00001 #ifndef __LINUX_NETLINK_H
00002 #define __LINUX_NETLINK_H
00003
00004 #define NETLINK_ROUTE 0
00005 #define NETLINK_SKIP 1
00006 #define NETLINK_USERSOCK 2
00007 #define NETLINK_FIREWALL 3
00008 #define NETLINK_TCPDIAG 4
00009 #define NETLINK_NFLOG 5
00010 #define NETLINK_ARPD 8
00011 #define NETLINK_ROUTE6 11
00012 #define NETLINK_IP6_FW 13
00013 #define NETLINK_DNRTMSG 14
00014 #define NETLINK_TAPBASE 16
00015
00016 #define MAX_LINKS 32
00017
00018 #ifdef __WIN32__
00019 typedef unsigned char sa_family_t;
00020 #endif
00021
00022 struct sockaddr_nl
00023 {
00024 sa_family_t nl_family;
00025 unsigned short nl_pad;
00026 __u32 nl_pid;
00027 __u32 nl_groups;
00028 };
00029
00030 struct nlmsghdr
00031 {
00032 __u32 nlmsg_len;
00033 __u16 nlmsg_type;
00034 __u16 nlmsg_flags;
00035 __u32 nlmsg_seq;
00036 __u32 nlmsg_pid;
00037 };
00038
00039
00040
00041 #define NLM_F_REQUEST 1
00042 #define NLM_F_MULTI 2
00043 #define NLM_F_ACK 4
00044 #define NLM_F_ECHO 8
00045
00046
00047 #define NLM_F_ROOT 0x100
00048 #define NLM_F_MATCH 0x200
00049 #define NLM_F_ATOMIC 0x400
00050 #define NLM_F_DUMP (NLM_F_ROOT|NLM_F_MATCH)
00051
00052
00053 #define NLM_F_REPLACE 0x100
00054 #define NLM_F_EXCL 0x200
00055 #define NLM_F_CREATE 0x400
00056 #define NLM_F_APPEND 0x800
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067 #define NLMSG_ALIGNTO 4
00068 #define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) )
00069 #define NLMSG_LENGTH(len) ((len)+NLMSG_ALIGN(sizeof(struct nlmsghdr)))
00070 #define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len))
00071 #define NLMSG_DATA(nlh) ((void*)(((char*)nlh) + NLMSG_LENGTH(0)))
00072 #define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \
00073 (struct nlmsghdr*)(((char*)(nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len)))
00074 #define NLMSG_OK(nlh,len) ((len) > 0 && (nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && \
00075 (nlh)->nlmsg_len <= (len))
00076 #define NLMSG_PAYLOAD(nlh,len) ((nlh)->nlmsg_len - NLMSG_SPACE((len)))
00077
00078 #define NLMSG_NOOP 0x1
00079 #define NLMSG_ERROR 0x2
00080 #define NLMSG_DONE 0x3
00081 #define NLMSG_OVERRUN 0x4
00082
00083 struct nlmsgerr
00084 {
00085 int error;
00086 struct nlmsghdr msg;
00087 };
00088
00089 #define NET_MAJOR 36
00090
00091
00092 #endif