1 #ifndef _NET_ROUTE_H 2 #define _NET_ROUTE_H 3 4 #ifdef __cplusplus 5 extern "C" { 6 #endif 7 8 #include <stdint.h> 9 #include <sys/socket.h> 10 #include <sys/types.h> 11 #include <netinet/in.h> 12 13 14 struct rtentry { 15 unsigned long int rt_pad1; 16 struct sockaddr rt_dst; 17 struct sockaddr rt_gateway; 18 struct sockaddr rt_genmask; 19 unsigned short int rt_flags; 20 short int rt_pad2; 21 unsigned long int rt_pad3; 22 unsigned char rt_tos; 23 unsigned char rt_class; 24 short int rt_pad4[sizeof(long)/2-1]; 25 short int rt_metric; 26 char *rt_dev; 27 unsigned long int rt_mtu; 28 unsigned long int rt_window; 29 unsigned short int rt_irtt; 30 }; 31 32 #define rt_mss rt_mtu 33 34 35 struct in6_rtmsg { 36 struct in6_addr rtmsg_dst; 37 struct in6_addr rtmsg_src; 38 struct in6_addr rtmsg_gateway; 39 uint32_t rtmsg_type; 40 uint16_t rtmsg_dst_len; 41 uint16_t rtmsg_src_len; 42 uint32_t rtmsg_metric; 43 unsigned long int rtmsg_info; 44 uint32_t rtmsg_flags; 45 int rtmsg_ifindex; 46 }; 47 48 49 #define RTF_UP 0x0001 50 #define RTF_GATEWAY 0x0002 51 52 #define RTF_HOST 0x0004 53 #define RTF_REINSTATE 0x0008 54 #define RTF_DYNAMIC 0x0010 55 #define RTF_MODIFIED 0x0020 56 #define RTF_MTU 0x0040 57 #define RTF_MSS RTF_MTU 58 #define RTF_WINDOW 0x0080 59 #define RTF_IRTT 0x0100 60 #define RTF_REJECT 0x0200 61 #define RTF_STATIC 0x0400 62 #define RTF_XRESOLVE 0x0800 63 #define RTF_NOFORWARD 0x1000 64 #define RTF_THROW 0x2000 65 #define RTF_NOPMTUDISC 0x4000 66 67 #define RTF_DEFAULT 0x00010000 68 #define RTF_ALLONLINK 0x00020000 69 #define RTF_ADDRCONF 0x00040000 70 71 #define RTF_LINKRT 0x00100000 72 #define RTF_NONEXTHOP 0x00200000 73 74 #define RTF_CACHE 0x01000000 75 #define RTF_FLOW 0x02000000 76 #define RTF_POLICY 0x04000000 77 78 #define RTCF_VALVE 0x00200000 79 #define RTCF_MASQ 0x00400000 80 #define RTCF_NAT 0x00800000 81 #define RTCF_DOREDIRECT 0x01000000 82 #define RTCF_LOG 0x02000000 83 #define RTCF_DIRECTSRC 0x04000000 84 85 #define RTF_LOCAL 0x80000000 86 #define RTF_INTERFACE 0x40000000 87 #define RTF_MULTICAST 0x20000000 88 #define RTF_BROADCAST 0x10000000 89 #define RTF_NAT 0x08000000 90 91 #define RTF_ADDRCLASSMASK 0xF8000000 92 #define RT_ADDRCLASS(flags) ((uint32_t) flags >> 23) 93 94 #define RT_TOS(tos) ((tos) & IPTOS_TOS_MASK) 95 96 #define RT_LOCALADDR(flags) ((flags & RTF_ADDRCLASSMASK) \ 97 == (RTF_LOCAL|RTF_INTERFACE)) 98 99 #define RT_CLASS_UNSPEC 0 100 #define RT_CLASS_DEFAULT 253 101 102 #define RT_CLASS_MAIN 254 103 #define RT_CLASS_LOCAL 255 104 #define RT_CLASS_MAX 255 105 106 107 #define RTMSG_ACK NLMSG_ACK 108 #define RTMSG_OVERRUN NLMSG_OVERRUN 109 110 #define RTMSG_NEWDEVICE 0x11 111 #define RTMSG_DELDEVICE 0x12 112 #define RTMSG_NEWROUTE 0x21 113 #define RTMSG_DELROUTE 0x22 114 #define RTMSG_NEWRULE 0x31 115 #define RTMSG_DELRULE 0x32 116 #define RTMSG_CONTROL 0x40 117 118 #define RTMSG_AR_FAILED 0x51 119 120 #ifdef __cplusplus 121 } 122 #endif 123 124 #endif 125