wpa_supplicant / hostapd 2.0

priv_netlink.h

Go to the documentation of this file.
00001 
00010 #ifndef PRIV_NETLINK_H
00011 #define PRIV_NETLINK_H
00012 
00013 /*
00014  * This should be replaced with user space header once one is available with C
00015  * library, etc..
00016  */
00017 
00018 #ifndef IFF_LOWER_UP
00019 #define IFF_LOWER_UP   0x10000         /* driver signals L1 up         */
00020 #endif
00021 #ifndef IFF_DORMANT
00022 #define IFF_DORMANT    0x20000         /* driver signals dormant       */
00023 #endif
00024 
00025 #ifndef IFLA_IFNAME
00026 #define IFLA_IFNAME 3
00027 #endif
00028 #ifndef IFLA_WIRELESS
00029 #define IFLA_WIRELESS 11
00030 #endif
00031 #ifndef IFLA_OPERSTATE
00032 #define IFLA_OPERSTATE 16
00033 #endif
00034 #ifndef IFLA_LINKMODE
00035 #define IFLA_LINKMODE 17
00036 #define IF_OPER_DORMANT 5
00037 #define IF_OPER_UP 6
00038 #endif
00039 
00040 #define NLM_F_REQUEST 1
00041 
00042 #define NETLINK_ROUTE 0
00043 #define RTMGRP_LINK 1
00044 #define RTM_BASE 0x10
00045 #define RTM_NEWLINK (RTM_BASE + 0)
00046 #define RTM_DELLINK (RTM_BASE + 1)
00047 #define RTM_SETLINK (RTM_BASE + 3)
00048 
00049 #define NLMSG_ALIGNTO 4
00050 #define NLMSG_ALIGN(len) (((len) + NLMSG_ALIGNTO - 1) & ~(NLMSG_ALIGNTO - 1))
00051 #define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr)))
00052 #define NLMSG_LENGTH(len) ((len) + NLMSG_ALIGN(sizeof(struct nlmsghdr)))
00053 #define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len))
00054 #define NLMSG_DATA(nlh) ((void*) (((char*) nlh) + NLMSG_LENGTH(0)))
00055 #define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \
00056                              (struct nlmsghdr *) \
00057                              (((char *)(nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len)))
00058 #define NLMSG_OK(nlh,len) ((len) >= (int) sizeof(struct nlmsghdr) && \
00059                            (nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && \
00060                            (int) (nlh)->nlmsg_len <= (len))
00061 #define NLMSG_PAYLOAD(nlh,len) ((nlh)->nlmsg_len - NLMSG_SPACE((len)))
00062 
00063 #define RTA_ALIGNTO 4
00064 #define RTA_ALIGN(len) (((len) + RTA_ALIGNTO - 1) & ~(RTA_ALIGNTO - 1))
00065 #define RTA_OK(rta,len) \
00066 ((len) > 0 && (rta)->rta_len >= sizeof(struct rtattr) && \
00067 (rta)->rta_len <= (len))
00068 #define RTA_NEXT(rta,attrlen) \
00069 ((attrlen) -= RTA_ALIGN((rta)->rta_len), \
00070 (struct rtattr *) (((char *)(rta)) + RTA_ALIGN((rta)->rta_len)))
00071 #define RTA_LENGTH(len) (RTA_ALIGN(sizeof(struct rtattr)) + (len))
00072 #define RTA_DATA(rta) ((void *) (((char *) (rta)) + RTA_LENGTH(0)))
00073 
00074 
00075 struct sockaddr_nl
00076 {
00077         sa_family_t nl_family;
00078         unsigned short nl_pad;
00079         u32 nl_pid;
00080         u32 nl_groups;
00081 };
00082 
00083 struct nlmsghdr
00084 {
00085         u32 nlmsg_len;
00086         u16 nlmsg_type;
00087         u16 nlmsg_flags;
00088         u32 nlmsg_seq;
00089         u32 nlmsg_pid;
00090 };
00091 
00092 struct ifinfomsg
00093 {
00094         unsigned char ifi_family;
00095         unsigned char __ifi_pad;
00096         unsigned short ifi_type;
00097         int ifi_index;
00098         unsigned ifi_flags;
00099         unsigned ifi_change;
00100 };
00101 
00102 struct rtattr
00103 {
00104         unsigned short rta_len;
00105         unsigned short rta_type;
00106 };
00107 
00108 #endif /* PRIV_NETLINK_H */
00109 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines