35 #include <hicn/util/ip_address.h>
43 #define foreach_netdevice_type \
52 #define MAXSZ_NETDEVICE_TYPE_ 9
53 #define MAXSZ_NETDEVICE_TYPE MAXSZ_NETDEVICE_TYPE_ + NULLTERM
56 #define _(x) NETDEVICE_TYPE_ ## x,
57 foreach_netdevice_type
61 extern const char * netdevice_type_str[];
78 #define NETDEVICE_EMPTY (netdevice_t) { \
83 netdevice_t * netdevice_create_from_index(u32 index);
84 netdevice_t * netdevice_create_from_name(
const char * name);
85 #define netdevice_initialize_from_index netdevice_set_index
86 #define netdevice_initialize_from_name netdevice_set_name
88 int netdevice_get_index(
const netdevice_t * netdevice, u32 * index);
89 int netdevice_set_index(
netdevice_t * netdevice, u32 index);
90 int netdevice_get_name(
const netdevice_t * netdevice,
const char ** name);
91 int netdevice_set_name(
netdevice_t * netdevice,
const char * name);
92 int netdevice_update_index(
netdevice_t * netdevice);
96 #define NETDEVICE_UNDEFINED_INDEX 0
100 #define foreach_face_state \
107 #define MAXSZ_FACE_STATE_ 9
108 #define MAXSZ_FACE_STATE MAXSZ_FACE_STATE_ + 1
111 #define _(x) FACE_STATE_ ## x,
116 extern const char * face_state_str[];
121 #define foreach_face_type \
131 #define MAXSZ_FACE_TYPE_ 13
132 #define MAXSZ_FACE_TYPE MAXSZ_FACE_TYPE_ + 1
135 #define _(x) FACE_TYPE_ ## x,
140 extern const char * face_type_str[];
143 #define MAXSZ_FACE_ MAXSZ_FACE_TYPE_ + 2 * MAXSZ_URL_ + 2 * MAXSZ_FACE_STATE_ + MAXSZ_POLICY_TAGS_ + 7
145 #define MAXSZ_FACE_ MAXSZ_FACE_TYPE_ + 2 * MAXSZ_URL_ + 2 * MAXSZ_FACE_STATE_ + 4
147 #define MAXSZ_FACE MAXSZ_FACE_ + 1
151 typedef u32 face_id_t;
155 face_state_t admin_state;
173 int face_initialize(
face_t * face);
174 int face_initialize_udp(
face_t * face,
const char * interface_name,
178 int face_initialize_udp_sa(
face_t * face,
179 const char * interface_name,
180 const struct sockaddr * local_addr,
const struct sockaddr * remote_addr);
183 face_t * face_create_udp(
const char * interface_name,
185 const ip_address_t * remote_addr, u16 remote_port,
int family);
186 face_t * face_create_udp_sa(
const char * interface_name,
187 const struct sockaddr * local_addr,
188 const struct sockaddr * remote_addr);
190 int face_finalize(
face_t * face);
192 void face_free(
face_t * face);
194 typedef int (*face_cmp_t)(
const face_t * f1,
const face_t * f2);
197 unsigned int face_hash(
const face_t * face);
200 face_snprintf(
char * s,
size_t size,
const face_t * face);
202 policy_tags_t face_get_tags(
const face_t * face);
203 int face_set_tags(
face_t * face, policy_tags_t tags);