VSF Documented
rtnetlink.h
Go to the documentation of this file.
1#ifndef __VSF_LINUX_RTNETLINK_H__
2#define __VSF_LINUX_RTNETLINK_H__
3
4#if VSF_LINUX_CFG_RELATIVE_PATH == ENABLED
5# include "../sys/types.h"
6#else
7# include <sys/types.h>
8#endif
9
10#define RTMGRP_LINK 1
11#define RTMGRP_IPV4_IFADDR 0x10
12
13struct ifinfomsg {
14 unsigned char ifi_family;
15 unsigned char __ifi_pad;
16 unsigned short ifi_type;
18 unsigned ifi_flags;
19 unsigned ifi_change;
20};
21
22enum {
24#define RTM_NEWLINK RTM_NEWLINK
26#define RTM_DELLINK RTM_DELLINK
28#define RTM_NEWADDR RTM_NEWADDR
30#define RTM_DELADDR RTM_DELADDR
31};
32
33struct rtattr {
34 unsigned short rta_len;
35 unsigned short rta_type;
36};
37
38#define RTA_ALIGNTO 4U
39#define RTA_ALIGN(len) (((len) + RTA_ALIGNTO - 1) & ~(RTA_ALIGNTO- 1 ))
40#define RTA_OK(rta,len) ((len) >= (int)sizeof(struct rtattr) && \
41 (rta)->rta_len >= sizeof(struct rtattr) && \
42 (rta)->rta_len <= (len))
43#define RTA_NEXT(rta,attrlen) ((attrlen) -= RTA_ALIGN((rta)->rta_len), \
44 (struct rtattr*)(((char*)(rta)) + RTA_ALIGN((rta)->rta_len)))
45#define RTA_LENGTH(len) (RTA_ALIGN(sizeof(struct rtattr)) + (len))
46#define RTA_SPACE(len) RTA_ALIGN(RTA_LENGTH(len))
47#define RTA_DATA(rta) ((void*)(((char*)(rta)) + RTA_LENGTH(0)))
48#define RTA_PAYLOAD(rta) ((int)((rta)->rta_len) - RTA_LENGTH(0))
49
50#endif // __VSF_LINUX_RTNETLINK_H__
Definition rtnetlink.h:13
int ifi_index
Definition rtnetlink.h:17
unsigned char ifi_family
Definition rtnetlink.h:14
unsigned char __ifi_pad
Definition rtnetlink.h:15
unsigned ifi_change
Definition rtnetlink.h:19
unsigned short ifi_type
Definition rtnetlink.h:16
unsigned ifi_flags
Definition rtnetlink.h:18
Definition rtnetlink.h:33
unsigned short rta_len
Definition rtnetlink.h:34
unsigned short rta_type
Definition rtnetlink.h:35