Add more logging when creating ADJs and when binding them to
[mpls-ldp-portable.git] / common / mpls_struct.h
blob4474eb629e648365725c9118099bde62d28d2560
2 /*
3 * Copyright (C) James R. Leu 2002
4 * jleu@mindspring.com
6 * This software is covered under the LGPL, for more
7 * info check out http://www.gnu.org/copyleft/lgpl.html
8 */
10 #ifndef _MPLS_STRUCT_H_
11 #define _MPLS_STRUCT_H_
13 #define MPLS_MAX_IF_NAME 16
14 #define MPLS_MAX_LABELSTACK 4
16 #include "mpls_handle_type.h"
18 typedef enum {
19 MPLS_SUCCESS = 1,
20 MPLS_FAILURE,
21 MPLS_FATAL,
22 MPLS_CLOSED,
23 MPLS_NON_BLOCKING,
24 MPLS_END_OF_LIST,
25 MPLS_NO_ROUTE,
26 } mpls_return_enum;
28 typedef enum {
29 MPLS_UPDATE_ADD,
30 MPLS_UPDATE_DEL,
31 MPLS_UPDATE_MODIFY
32 } mpls_update_enum;
34 typedef enum {
35 MPLS_OPER_UP = 1,
36 MPLS_OPER_DOWN,
37 } mpls_oper_state_enum;
39 typedef enum {
40 MPLS_TIMER_ONESHOT = 1,
41 MPLS_TIMER_REOCCURRING,
42 } mpls_timer_type_enum;
44 typedef enum {
45 MPLS_UNIT_MICRO = 1,
46 MPLS_UNIT_SEC,
47 MPLS_UNIT_MIN,
48 MPLS_UNIT_HOUR
49 } mpls_time_unit_enum;
51 typedef enum {
52 MPLS_ADMIN_ENABLE = 1,
53 MPLS_ADMIN_DISABLE
54 } mpls_admin_state_enum;
56 typedef enum {
57 MPLS_LABEL_RANGE_GENERIC = 1,
58 MPLS_LABEL_RANGE_ATM_VP,
59 MPLS_LABEL_RANGE_ATM_VC,
60 MPLS_LABEL_RANGE_ATM_VP_VC,
61 MPLS_LABEL_RANGE_FR_10,
62 MPLS_LABEL_RANGE_FR_24
63 } mpls_label_range_type;
65 typedef enum {
66 MPLS_LABEL_TYPE_NONE,
67 MPLS_LABEL_TYPE_GENERIC,
68 MPLS_LABEL_TYPE_ATM,
69 MPLS_LABEL_TYPE_FR
70 } mpls_label_type;
72 typedef enum {
73 MPLS_BOOL_FALSE = 0,
74 MPLS_BOOL_TRUE = 1
75 } mpls_bool;
77 typedef enum {
78 MPLS_SOCKET_UDP_DATA = 1,
79 MPLS_SOCKET_TCP_LISTEN,
80 MPLS_SOCKET_TCP_CONNECT,
81 MPLS_SOCKET_TCP_DATA,
82 MPLS_SOCKET_ROUTE_UPDATE,
83 } mpls_socket_enum;
85 typedef enum {
86 MPLS_SOCKOP_NONBLOCK = 0x1,
87 MPLS_SOCKOP_REUSE = 0x2,
88 } mpls_socket_option_type;
90 typedef enum {
91 MPLS_TRACE_STATE_SEND,
92 MPLS_TRACE_STATE_RECV,
93 MPLS_TRACE_STATE_ALL
94 } mpls_trace_states;
96 typedef enum {
97 MPLS_OWNER_LDP,
98 MPLS_OWNER_CRLDP,
99 MPLS_OWNER_STATIC,
100 MPLS_OWNER_RSVP_TE
101 } mpls_owners_enum;
103 typedef struct mpls_label_struct {
104 mpls_label_type type;
105 union {
106 int gen;
107 struct {
108 int vpi;
109 int vci;
110 } atm;
111 struct {
112 int len;
113 int dlci;
114 } fr;
115 } u;
116 } mpls_label_struct;
118 typedef enum mpls_family_enum {
119 MPLS_FAMILY_NONE,
120 MPLS_FAMILY_IPV4,
121 MPLS_FAMILY_IPV6,
122 } mpls_family_enum;
124 typedef struct mpls_inet_addr {
125 enum mpls_family_enum type;
126 union {
127 uint8_t ipv6[16];
128 uint32_t ipv4;
129 } u;
130 } mpls_inet_addr;
132 typedef struct mpls_dest {
133 struct mpls_inet_addr addr;
134 uint16_t port;
135 mpls_if_handle if_handle;
136 } mpls_dest;
138 typedef struct mpls_range {
139 int label_space;
140 mpls_label_range_type type;
141 struct mpls_label_struct min, max;
142 } mpls_range;
144 typedef enum mpls_nexthop_enum {
145 MPLS_NH_NONE = 0x0,
146 MPLS_NH_IP = 0x1,
147 MPLS_NH_IF = 0x2,
148 MPLS_NH_OUTSEGMENT = 0x4
149 } mpls_nexthop_enum;
151 typedef enum mpls_fec_enum {
152 MPLS_FEC_NONE,
153 MPLS_FEC_PREFIX,
154 MPLS_FEC_HOST,
155 MPLS_FEC_L2CC,
156 } mpls_fec_enum;
158 typedef struct mpls_nexthop {
159 unsigned char type;
160 int distance;
161 int metric;
162 mpls_bool attached;
163 struct mpls_inet_addr ip;
164 mpls_if_handle if_handle;
165 mpls_outsegment_handle outsegment_handle;
166 } mpls_nexthop;
168 typedef struct mpls_fec {
169 enum mpls_fec_enum type;
170 union {
171 struct {
172 struct mpls_inet_addr network;
173 uint8_t length;
174 } prefix;
175 struct mpls_inet_addr host;
176 struct {
177 uint32_t connection_id;
178 uint32_t group_id;
179 uint8_t type;
180 } l2cc;
181 } u;
182 struct mpls_nexthop nh;
183 } mpls_fec;
185 typedef struct mpls_insegment {
186 struct mpls_label_struct label;
187 uint32_t npop;
188 uint32_t labelspace;
189 uint16_t family;
190 mpls_insegment_handle handle;
191 mpls_owners_enum owner;
192 } mpls_insegment;
194 typedef struct mpls_outsegment {
195 struct mpls_label_struct label;
196 mpls_bool push_label;
197 struct mpls_nexthop nexthop;
198 mpls_outsegment_handle handle;
199 mpls_owners_enum owner;
200 } mpls_outsegment;
202 typedef struct mpls_xconnect {
203 uint32_t lspid;
204 uint8_t stack_size;
205 struct mpls_label_struct stack[MPLS_MAX_LABELSTACK];
206 mpls_bool is_persistent;
207 mpls_xconnect_handle handle;
208 mpls_owners_enum owner;
209 } mpls_xconnect;
211 typedef void *mpls_cfg_handle;
213 #endif