blob: e6d964aa5de6b0767b1ec8e6c4973df85152e1fb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
|
/*
* route data access header
*
* $Id: route.h 15220 2006-09-15 00:48:50Z tanders $
*/
#ifndef NETSNMP_ACCESS_ROUTE_H
#define NETSNMP_ACCESS_ROUTE_H
# ifdef __cplusplus
extern "C" {
#endif
/**---------------------------------------------------------------------*/
/*
* structure definitions
*/
#if defined( NETSNMP_ENABLE_IPV6 )
# define NETSNMP_ACCESS_ROUTE_ADDR_BUF_SIZE 16
#else
# define NETSNMP_ACCESS_ROUTE_ADDR_BUF_SIZE 4
#endif
/*
* netsnmp_route_entry
* - primary route structure for both ipv4 & ipv6
*/
typedef struct netsnmp_route_s {
netsnmp_index oid_index; /* MUST BE FIRST!! for container use */
oid ns_rt_index; /* arbitrary index */
int flags; /* for net-snmp use */
oid if_index;
/*
* addresses, in network byte order
*/
u_char rt_dest[NETSNMP_ACCESS_ROUTE_ADDR_BUF_SIZE];
u_char rt_nexthop[NETSNMP_ACCESS_ROUTE_ADDR_BUF_SIZE];
#ifdef USING_IP_FORWARD_MIB_INETCIDRROUTETABLE_INETCIDRROUTETABLE_MODULE
/*
* define the maximum oid length for a policy, for use by the
* inetCidrRouteTable. Must be at least 2, for default nullOid case.
*/
#define NETSNMP_POLICY_OID_MAX_LEN 2
oid *rt_policy; /* NULL should be interpreted as { 0, 0 } */
u_char rt_policy_len; /* 0-128 oids */
#endif
u_char rt_dest_len; /* 4 | 16 since we only do ipv4|ipv6 */
u_char rt_dest_type; /* InetAddressType 0-16 */
u_char rt_nexthop_len; /* 4 | 16 since we only do ipv4|ipv6*/
u_char rt_nexthop_type;/* InetAddressType 0-16 */
u_char rt_pfx_len; /* 0-128 bits */
u_char rt_type; /* ip(1-4) != inet(1-5) */
u_char rt_proto; /* ip(enum 1-16) ?= inet(IANAipRouteProtocol 1-17) */
#ifdef USING_IP_FORWARD_MIB_IPCIDRROUTETABLE_IPCIDRROUTETABLE_MODULE
/** rt_info != inet_policy, because that would have made sense */
uint8_t rt_info_len; /* 0-128 oids */
oid *rt_info; /* NULL should be interpreted as { 0, 0 } */
uint32_t rt_mask; /* ipv4 only */
uint32_t rt_tos; /* Integer32 (0..2147483647) */
#endif
uint32_t rt_age; /* seconds (ip == inet) */
int32_t rt_nexthop_as; /* ip(int32) == inet(InetAutonomousSystemNumber) */
int32_t rt_metric1;
int32_t rt_metric2;
int32_t rt_metric3;
int32_t rt_metric4;
int32_t rt_metric5;
} netsnmp_route_entry;
/**---------------------------------------------------------------------*/
/*
* ACCESS function prototypes
*/
/*
* ifcontainer init
*/
netsnmp_container * netsnmp_access_route_container_init(u_int init_flags);
#define NETSNMP_ACCESS_ROUTE_INIT_NOFLAGS 0x0000
#define NETSNMP_ACCESS_ROUTE_INIT_ADDL_IDX_BY_NAME 0x0001
/*
* ifcontainer load and free
*/
netsnmp_container*
netsnmp_access_route_container_load(netsnmp_container* container,
u_int load_flags);
#define NETSNMP_ACCESS_ROUTE_LOAD_NOFLAGS 0x0000
#define NETSNMP_ACCESS_ROUTE_LOAD_IPV4_ONLY 0x0001
void netsnmp_access_route_container_free(netsnmp_container *container,
u_int free_flags);
#define NETSNMP_ACCESS_ROUTE_FREE_NOFLAGS 0x0000
#define NETSNMP_ACCESS_ROUTE_FREE_DONT_CLEAR 0x0001
#define NETSNMP_ACCESS_ROUTE_FREE_KEEP_CONTAINER 0x0002
/*
* create/copy/free a route entry
*/
netsnmp_route_entry *
netsnmp_access_route_entry_create(void);
void netsnmp_access_route_entry_free(netsnmp_route_entry * entry);
int
netsnmp_access_route_entry_copy(netsnmp_route_entry *lhs,
netsnmp_route_entry *rhs);
/*
* find entry in container
*/
/** not yet */
/*
* create/change/delete
*/
int
netsnmp_access_route_entry_set(netsnmp_route_entry * entry);
/*
* route flags
* upper bits for internal use
* lower bits indicate changed fields. see FLAG_INETCIDRROUTE* definitions in
* inetCidrRouteTable_constants.h
*/
#define NETSNMP_ACCESS_ROUTE_CREATE 0x80000000
#define NETSNMP_ACCESS_ROUTE_DELETE 0x40000000
#define NETSNMP_ACCESS_ROUTE_CHANGE 0x20000000
#define NETSNMP_ACCESS_ROUTE_POLICY_STATIC 0x10000000
#define NETSNMP_ACCESS_ROUTE_POLICY_DEEP_COPY 0x08000000
/*
* mask for change flag bits
*/
#define NETSNMP_ACCESS_ROUTE_RESERVED_BITS 0x000001ff
/**---------------------------------------------------------------------*/
# ifdef __cplusplus
}
#endif
#endif /* NETSNMP_ACCESS_ROUTE_H */
|