summaryrefslogtreecommitdiffstats
path: root/src/vnet.am
blob: 86f3ad00f33b17039e17233d82b905f3730f597d (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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
/*
 * Copyright (c) 2015 Cisco and/or its affiliates.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/*
 * ip/ip4_fib.h: ip4 mtrie fib
 *
 * Copyright (c) 2012 Eliot Dresselhaus
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
 *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
 *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

#ifndef included_ip_ip4_fib_h
#define included_ip_ip4_fib_h

#include <vppinfra/cache.h>
#include <vppinfra/vector.h>
#include <vnet/ip/lookup.h>
#include <vnet/ip/ip4_packet.h>	/* for ip4_address_t */

/* ip4 fib leafs: 4 ply 8-8-8-8 mtrie.
   1 + 2*adj_index for terminal leaves.
   0 + 2*next_ply_index for non-terminals, i.e. PLYs
   1 => empty (adjacency index of zero is special miss adjacency). */
typedef u32 ip4_fib_mtrie_leaf_t;

#define IP4_FIB_MTRIE_LEAF_EMPTY (1 + 2*0)

/**
 * @brief the 16 way stride that is the top PLY of the mtrie
 * We do not maintain the count of 'real' leaves in this PLY, since
 * it is never removed. The FIB will destroy the mtrie and the ply once
 * the FIB is destroyed.
 */
#define PLY_16_SIZE (1<<16)
typedef struct ip4_fib_mtrie_16_ply_t_
{
  /**
   * The leaves/slots/buckets to be filed with leafs
   */
  union
  {
    ip4_fib_mtrie_leaf_t leaves[PLY_16_SIZE];

#ifdef CLIB_HAVE_VEC128
    u32x4 leaves_as_u32x4[PLY_16_SIZE / 4];
#endif
  };

  /**
   * Prefix length for terminal leaves.
   */
  u8 dst_address_bits_of_leaves[PLY_16_SIZE];
} ip4_fib_mtrie_16_ply_t;

/**
 * @brief One ply of the 4 ply mtrie fib.
 */
typedef struct ip4_fib_mtrie_8_ply_t_
{
  /**
   * The leaves/slots/buckets to be filed with leafs
   */
  union
  {
    ip4_fib_mtrie_leaf_t leaves[256];

#ifdef CLIB_HAVE_VEC128
    u32x4 leaves_as_u32x4[256 / 4];
#endif
  };

  /**
   * Prefix length for leaves/ply.
   */
  u8 dst_address_bits_of_leaves[256];

  /**
   * Number of non-empty leafs (whether terminal or not).
   */
  i32 n_non_empty_leafs;

  /**
   * The length of the ply's coviering prefix. Also a measure of its depth
   * If a leaf in a slot has a mask length longer than this then it is
   * 'non-empty'. Otherwise it is the value of the cover.
   */
  i32 dst_address_bits_base;

  /* Pad to cache line boundary. */
  u8 pad[CLIB_CACHE_LINE_BYTES - 2 * sizeof (i32)];
}
ip4_fib_mtrie_8_ply_t;

STATIC_ASSERT (0 == sizeof (ip4_fib_mtrie_8_ply_t) % CLIB_CACHE_LINE_BYTES,
	       "IP4 Mtrie ply cache line");

/**
 * @brief The mutiway-TRIE.
 * There is no data associated with the mtrie apart from the top PLY
 */
typedef struct
{
  /**
   * Embed the PLY with the mtrie struct. This means that the Data-plane
   * 'get me the mtrie' returns the first ply, and not an indirect 'pointer'
   * to it. therefore no cachline misses in the data-path.
   */
  ip4_fib_mtrie_16_ply_t root_ply;
} ip4_fib_mtrie_t;

/**
 * @brief Initialise an mtrie
 */
void ip4_mtrie_init (ip4_fib_mtrie_t * m);

/**
 * @brief Free an mtrie, It must be emty when free'd
 */
void ip4_mtrie_free (ip4_fib_mtrie_t * m);

/**
 * @brief Add a route/rntry to the mtrie
 */
void ip4_fib_mtrie_route_add (ip4_fib_mtrie_t * m,
			      const ip4_address_t * dst_address,
			      u32 dst_address_length, u32 adj_index);
/**
 * @brief remove a route/rntry to the mtrie
 */
void ip4_fib_mtrie_route_del (ip4_fib_mtrie_t * m,
			      const ip4_address_t * dst_address,
			      u32 dst_address_length,
			      u32 adj_index,
			      u32 cover_address_length, u32 cover_adj_index);

/**
 * @brief return the memory used by the table
 */
uword ip4_fib_mtrie_memory_usage (ip4_fib_mtrie_t * m);

/**
 * @brief Format/display the contents of the mtrie
 */
format_function_t format_ip4_fib_mtrie;

/**
 * @brief A global pool of 8bit stride plys
 */
extern ip4_fib_mtrie_8_ply_t *ip4_ply_pool;

/**
 * Is the leaf terminal (i.e. an LB index) or non-terminak (i.e. a PLY index)
 */
always_inline u32
ip4_fib_mtrie_leaf_is_terminal (ip4_fib_mtrie_leaf_t n)
{
  return n & 1;
}

/**
 * From the stored slot value extract the LB index value
 */
always_inline u32
ip4_fib_mtrie_leaf_get_adj_index (ip4_fib_mtrie_leaf_t n)
{
  ASSERT (ip4_fib_mtrie_leaf_is_terminal (n));
  return n >> 1;
}

/**
 * @brief Lookup step.  Processes 1 byte of 4 byte ip4 address.
 */
always_inline ip4_fib_mtrie_leaf_t
ip4_fib_mtrie_lookup_step (const ip4_fib_mtrie_t * m,
			   ip4_fib_mtrie_leaf_t current_leaf,
			   const ip4_address_t * dst_address,
			   u32 dst_address_byte_index)
{
  ip4_fib_mtrie_8_ply_t *ply;

  uword current_is_terminal = ip4_fib_mtrie_leaf_is_terminal (current_leaf);

  if (!current_is_terminal)
    {
      ply = ip4_ply_pool + (current_leaf >> 1);
      return (ply->leaves[dst_address->as_u8[dst_address_byte_index]]);
    }

  return current_leaf;
}

/**
 * @brief Lookup step number 1.  Processes 2 bytes of 4 byte ip4 address.
 */
always_inline ip4_fib_mtrie_leaf_t
ip4_fib_mtrie_lookup_step_one (const ip4_fib_mtrie_t * m,
			       const ip4_address_t * dst_address)
{
  ip4_fib_mtrie_leaf_t next_leaf;

  next_leaf = m->root_ply.leaves[dst_address->as_u16[0]];

  return next_leaf;
}

#endif /* included_ip_ip4_fib_h */

/*
 * fd.io coding-style-patch-verification: ON
 *
 * Local Variables:
 * eval: (c-set-style "gnu")
 * End:
 */
5' href='#n1045'>1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348
# Copyright (c) 2015 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

lib_LTLIBRARIES += libvnet.la
noinst_LTLIBRARIES =

libvnet_la_SOURCES =
libvnet_la_DEPENDENCIES = \
	libvppinfra.la		\
	libvlib.la		\
	libsvmdb.la		\
	libsvm.la 		\
	libvlibmemory.la
libvnet_multiversioning_sources =

libvnet_la_LIBADD = $(libvnet_la_DEPENDENCIES) -lm -lpthread -ldl -lrt

if WITH_LIBSSL
libvnet_la_LIBADD += -lcrypto
endif

########################################
# Generic stuff
########################################
libvnet_la_SOURCES +=				\
  vnet/buffer.c					\
  vnet/config.c					\
  vnet/devices/devices.c			\
  vnet/devices/netlink.c			\
  vnet/flow/flow.c				\
  vnet/flow/flow_cli.c				\
  vnet/handoff.c				\
  vnet/interface.c				\
  vnet/interface_api.c				\
  vnet/interface_cli.c				\
  vnet/interface_format.c			\
  vnet/interface_output.c			\
  vnet/interface_stats.c			\
  vnet/misc.c					\
  vnet/replication.c

nobase_include_HEADERS +=			\
  vnet/api_errno.h				\
  vnet/buffer.h					\
  vnet/config.h					\
  vnet/devices/devices.h			\
  vnet/devices/netlink.h			\
  vnet/flow/flow.h				\
  vnet/global_funcs.h				\
  vnet/handoff.h				\
  vnet/interface.h				\
  vnet/interface.api.h				\
  vnet/interface_funcs.h			\
  vnet/ip/ip4_to_ip6.h   			\
  vnet/ip/ip6_to_ip4.h   			\
  vnet/l3_types.h				\
  vnet/pipeline.h				\
  vnet/replication.h				\
  vnet/vnet.h					\
  vnet/vnet_all_api_h.h				\
  vnet/vnet_msg_enum.h				\
  vnet/util/radix.h                 \
  vnet/util/refcount.h

API_FILES += vnet/interface.api

########################################
# Policer infra
########################################

libvnet_la_SOURCES +=				\
  vnet/policer/node_funcs.c			\
  vnet/policer/policer.c			\
  vnet/policer/xlate.c				\
  vnet/policer/policer_api.c

nobase_include_HEADERS +=			\
  vnet/policer/police.h				\
  vnet/policer/policer.h			\
  vnet/policer/xlate.h				\
  vnet/policer/policer.api.h

API_FILES += vnet/policer/policer.api

########################################
# Cop - junk filter
########################################

libvnet_la_SOURCES +=				\
  vnet/cop/cop.c				\
  vnet/cop/node1.c				\
  vnet/cop/ip4_whitelist.c			\
  vnet/cop/ip6_whitelist.c			\
  vnet/cop/cop_api.c

nobase_include_HEADERS +=			\
  vnet/cop/cop.h					\
  vnet/cop/cop.api.h

API_FILES += vnet/cop/cop.api

########################################
# Layer 2 protocols go here
########################################

########################################
# Layer 2 protocol: Ethernet
########################################
libvnet_la_SOURCES +=				\
 vnet/ethernet/arp.c				\
 vnet/ethernet/format.c				\
 vnet/ethernet/init.c				\
 vnet/ethernet/interface.c			\
 vnet/ethernet/node.c				\
 vnet/ethernet/pg.c				\
 vnet/ethernet/sfp.c				\
 vnet/ethernet/p2p_ethernet.c			\
 vnet/ethernet/p2p_ethernet_input.c		\
 vnet/ethernet/p2p_ethernet_api.c

libvnet_multiversioning_sources +=		\
 vnet/l2/l2_output.c

nobase_include_HEADERS +=			\
 vnet/ethernet/arp_packet.h			\
 vnet/ethernet/error.def			\
 vnet/ethernet/ethernet.h			\
 vnet/ethernet/packet.h				\
 vnet/ethernet/types.def			\
 vnet/ethernet/sfp.h				\
 vnet/ethernet/p2p_ethernet.api.h		\
 vnet/ethernet/p2p_ethernet.h

API_FILES += vnet/ethernet/p2p_ethernet.api

########################################
# Layer 2 protocol: Ethernet bridging
########################################
libvnet_la_SOURCES +=				\
 vnet/l2/feat_bitmap.c				\
 vnet/l2/l2_api.c				\
 vnet/l2/l2_bd.c				\
 vnet/l2/l2_bvi.c				\
 vnet/l2/l2_input_classify.c			\
 vnet/l2/l2_output_classify.c			\
 vnet/l2/l2_efp_filter.c			\
 vnet/l2/l2_fib.c				\
 vnet/l2/l2_flood.c				\
 vnet/l2/l2_fwd.c				\
 vnet/l2/l2_input.c				\
 vnet/l2/l2_input_vtr.c				\
 vnet/l2/l2_learn.c				\
 vnet/l2/l2_output.c				\
 vnet/l2/l2_in_out_acl.c			\
 vnet/l2/l2_patch.c				\
 vnet/l2/l2_rw.c				\
 vnet/l2/l2_vtr.c				\
 vnet/l2/l2_xcrw.c

nobase_include_HEADERS +=			\
 vnet/l2/feat_bitmap.h				\
 vnet/l2/l2_input.h				\
 vnet/l2/l2_output.h				\
 vnet/l2/l2_vtr.h				\
 vnet/l2/l2_input_vtr.h				\
 vnet/l2/l2_efp_filter.h			\
 vnet/l2/l2_fwd.h				\
 vnet/l2/l2_bd.h				\
 vnet/l2/l2_bvi.h				\
 vnet/l2/l2_flood.h				\
 vnet/l2/l2_fib.h				\
 vnet/l2/l2_rw.h				\
 vnet/l2/l2_xcrw.h				\
 vnet/l2/l2_classify.h				\
 vnet/l2/l2.api.h

API_FILES += vnet/l2/l2.api

########################################
# Layer 2 protocol: SRP
########################################
libvnet_la_SOURCES +=				\
 vnet/srp/format.c				\
 vnet/srp/interface.c				\
 vnet/srp/node.c				\
 vnet/srp/pg.c

nobase_include_HEADERS +=			\
 vnet/srp/packet.h				\
 vnet/srp/srp.h

########################################
# Layer 2 protocol: PPP
########################################
libvnet_la_SOURCES +=				\
  vnet/ppp/node.c				\
  vnet/ppp/pg.c					\
  vnet/ppp/ppp.c

nobase_include_HEADERS +=			\
 vnet/ppp/error.def				\
 vnet/ppp/ppp.h					\
 vnet/ppp/packet.h

########################################
# Layer 2 protocol: HDLC
########################################
libvnet_la_SOURCES +=				\
  vnet/hdlc/node.c				\
  vnet/hdlc/pg.c				\
  vnet/hdlc/hdlc.c

nobase_include_HEADERS +=			\
 vnet/hdlc/error.def				\
 vnet/hdlc/hdlc.h				\
 vnet/hdlc/packet.h

########################################
# Layer 2 protocol: LLC
########################################
libvnet_la_SOURCES +=				\
  vnet/llc/llc.c				\
  vnet/llc/node.c				\
  vnet/llc/pg.c

nobase_include_HEADERS +=			\
 vnet/llc/llc.h

########################################
# Layer 2 protocol: SNAP
########################################
libvnet_la_SOURCES +=				\
  vnet/snap/snap.c				\
  vnet/snap/node.c				\
  vnet/snap/pg.c

nobase_include_HEADERS +=			\
 vnet/snap/snap.h

########################################
# Layer 2 / vxlan
########################################
libvnet_la_SOURCES +=				\
  vnet/vxlan/vxlan.c				\
  vnet/vxlan/encap.c				\
  vnet/vxlan/decap.c				\
  vnet/vxlan/vxlan_api.c

nobase_include_HEADERS +=			\
  vnet/vxlan/vxlan.h				\
  vnet/vxlan/vxlan_packet.h			\
  vnet/vxlan/vxlan_error.def			\
  vnet/vxlan/vxlan.api.h

API_FILES += vnet/vxlan/vxlan.api

########################################
# Layer 2 / Geneve
########################################
libvnet_la_SOURCES +=				\
  vnet/geneve/geneve.c				\
  vnet/geneve/encap.c				\
  vnet/geneve/decap.c				\
  vnet/geneve/geneve_api.c

nobase_include_HEADERS +=			\
  vnet/geneve/geneve.h				\
  vnet/geneve/geneve_packet.h			\
  vnet/geneve/geneve_error.def			\
  vnet/geneve/geneve.api.h

API_FILES += vnet/geneve/geneve.api

########################################
# Layer 2 / Bonding
########################################
libvnet_la_SOURCES +=				\
  vnet/bonding/cli.c    			\
  vnet/bonding/node.c    			\
  vnet/bonding/device.c    			\
  vnet/bonding/bond_api.c

nobase_include_HEADERS +=			\
  vnet/bonding/node.h                           \
  vnet/bonding/bond.api.h

libvnet_multiversioning_sources +=		\
  vnet/bonding/node.c

API_FILES += vnet/bonding/bond.api

########################################
# Layer 2 / LLDP
########################################
libvnet_la_SOURCES +=				\
  vnet/lldp/lldp_input.c			\
  vnet/lldp/lldp_node.c				\
  vnet/lldp/lldp_output.c			\
  vnet/lldp/lldp_cli.c                          \
  vnet/lldp/lldp_api.c

nobase_include_HEADERS +=			\
  vnet/lldp/lldp_protocol.h                     \
  vnet/lldp/lldp.h                              \
  vnet/lldp/lldp.api.h

API_FILES += vnet/lldp/lldp.api

########################################
# Layer 2/3 "classify"
########################################
libvnet_la_SOURCES +=				\
  vnet/classify/vnet_classify.c			\
  vnet/classify/ip_classify.c			\
  vnet/classify/in_out_acl.c			\
  vnet/classify/policer_classify.c		\
  vnet/classify/flow_classify.c                 \
  vnet/classify/flow_classify_node.c            \
  vnet/classify/vnet_classify.h			\
  vnet/classify/classify_api.c

nobase_include_HEADERS +=			\
  vnet/classify/vnet_classify.h	                \
  vnet/classify/in_out_acl.h                     \
  vnet/classify/policer_classify.h              \
  vnet/classify/flow_classify.h					\
  vnet/classify/classify.api.h

API_FILES += vnet/classify/classify.api

########################################
# Layer 3 protocols go here
########################################

########################################
# Layer 3 protocol: IP v4/v6
########################################
libvnet_la_SOURCES +=				\
 vnet/ip/format.c				\
 vnet/ip/icmp4.c				\
 vnet/ip/icmp6.c				\
 vnet/ip/ip46_cli.c				\
 vnet/ip/ip4_format.c				\
 vnet/ip/ip4_forward.c				\
 vnet/ip/ip4_punt_drop.c			\
 vnet/ip/ip4_input.c				\
 vnet/ip/ip4_mtrie.c				\
 vnet/ip/ip4_pg.c				\
 vnet/ip/ip4_source_and_port_range_check.c	\
 vnet/ip/ip4_source_check.c			\
 vnet/ip/ip4_reassembly.c                       \
 vnet/ip/ip6_format.c				\
 vnet/ip/ip6_forward.c				\
 vnet/ip/ip6_ll_table.c				\
 vnet/ip/ip6_ll_types.c				\
 vnet/ip/ip6_punt_drop.c			\
 vnet/ip/ip6_hop_by_hop.c			\
 vnet/ip/ip6_input.c				\
 vnet/ip/ip6_neighbor.c				\
 vnet/ip/ip6_pg.c				\
 vnet/ip/ip6_reassembly.c                       \
 vnet/ip/rd_cp.c                                \
 vnet/ip/ip_neighbor.c				\
 vnet/ip/ip_api.c				\
 vnet/ip/ip_checksum.c				\
 vnet/ip/ip_frag.c				\
 vnet/ip/ip.c					\
 vnet/ip/ip_init.c				\
 vnet/ip/ip_in_out_acl.c			\
 vnet/ip/lookup.c				\
 vnet/ip/ping.c					\
 vnet/ip/punt_api.c				\
 vnet/ip/punt.c

nobase_include_HEADERS +=			\
 vnet/ip/format.h				\
 vnet/ip/icmp46_packet.h			\
 vnet/ip/icmp4.h				\
 vnet/ip/icmp6.h				\
 vnet/ip/igmp_packet.h				\
 vnet/ip/ip.api.h				\
 vnet/ip/rd_cp.api.h                            \
 vnet/ip/ip4_error.h				\
 vnet/ip/ip4.h					\
 vnet/ip/ip4_mtrie.h				\
 vnet/ip/ip4_packet.h				\
 vnet/ip/ip6_error.h				\
 vnet/ip/ip6.h					\
 vnet/ip/ip6_hop_by_hop.h			\
 vnet/ip/ip6_hop_by_hop_packet.h		\
 vnet/ip/ip6_packet.h				\
 vnet/ip/ip6_neighbor.h				\
 vnet/ip/ip.h					\
 vnet/ip/ip_packet.h				\
 vnet/ip/ip_source_and_port_range_check.h	\
 vnet/ip/ip_neighbor.h				\
 vnet/ip/lookup.h				\
 vnet/ip/ports.def				\
 vnet/ip/protocols.def				\
 vnet/ip/punt_error.def				\
 vnet/ip/punt.api.h				\
 vnet/ip/punt.h

API_FILES += 					\
 vnet/ip/ip.api 				\
 vnet/ip/rd_cp.api                              \
 vnet/ip/punt.api

libvnet_multiversioning_sources +=		\
 vnet/ip/ip4_input.c

########################################
# Bidirectional Forwarding Detection
########################################

nobase_include_HEADERS +=			\
 vnet/bfd/bfd_protocol.h			\
 vnet/bfd/bfd_main.h				\
 vnet/bfd/bfd_api.h				\
 vnet/bfd/bfd_udp.h				\
 vnet/bfd/bfd.api.h

libvnet_la_SOURCES +=				\
 vnet/bfd/bfd_api.h				\
 vnet/bfd/bfd_udp.c				\
 vnet/bfd/bfd_main.c				\
 vnet/bfd/bfd_protocol.c			\
 vnet/bfd/bfd_cli.c                             \
 vnet/bfd/bfd_api.c

API_FILES += vnet/bfd/bfd.api

########################################
# Layer 3 protocol: IPSec
########################################
if WITH_LIBSSL
libvnet_la_SOURCES +=				\
 vnet/ipsec/ipsec.c				\
 vnet/ipsec/ipsec_cli.c				\
 vnet/ipsec/ipsec_format.c			\
 vnet/ipsec/ipsec_input.c			\
 vnet/ipsec/ipsec_if.c				\
 vnet/ipsec/ipsec_if_in.c			\
 vnet/ipsec/ipsec_if_out.c			\
 vnet/ipsec/esp_format.c			\
 vnet/ipsec/esp_encrypt.c			\
 vnet/ipsec/esp_decrypt.c			\
 vnet/ipsec/ah_decrypt.c			\
 vnet/ipsec/ah_encrypt.c			\
 vnet/ipsec/ikev2.c				\
 vnet/ipsec/ikev2_crypto.c			\
 vnet/ipsec/ikev2_cli.c				\
 vnet/ipsec/ikev2_payload.c			\
 vnet/ipsec/ikev2_format.c			\
 vnet/ipsec/ipsec_api.c

API_FILES += vnet/ipsec/ipsec.api
endif

libvnet_la_SOURCES +=				\
 vnet/ipsec/ipsec_output.c

nobase_include_HEADERS +=			\
 vnet/ipsec/ipsec.h				\
 vnet/ipsec/esp.h				\
 vnet/ipsec/ah.h				\
 vnet/ipsec/ikev2.h				\
 vnet/ipsec/ikev2_priv.h			\
 vnet/ipsec/ipsec.api.h

########################################
# Layer 3 protocol: osi
########################################
libvnet_la_SOURCES +=				\
 vnet/osi/node.c				\
 vnet/osi/osi.c					\
 vnet/osi/pg.c

nobase_include_HEADERS +=			\
 vnet/osi/osi.h

########################################
# Layer 3 protocol: MAP
########################################
libvnet_la_SOURCES +=				\
 vnet/map/map.c					\
 vnet/map/map_dpo.c				\
 vnet/map/ip4_map.c				\
 vnet/map/ip6_map.c				\
 vnet/map/ip4_map_t.c				\
 vnet/map/ip6_map_t.c				\
 vnet/map/map_api.c

nobase_include_HEADERS +=			\
 vnet/map/map.h					\
 vnet/map/map_dpo.h				\
 vnet/map/map.api.h

API_FILES += vnet/map/map.api

if ENABLE_TESTS
TESTS += test_map
test_map_SOURCES =                             \
 vnet/map/test.c
test_map_CPPFLAGS = $(AM_CPPFLAGS) -DCLIB_DEBUG

test_map_LDADD = libvnet.la libvppinfra.la libvlib.la	\
  -lpthread -lvlibmemory -ldl -lsvm -lrt

test_map_LDFLAGS = -static
endif

########################################
# Layer 4 protocol: tcp
########################################
libvnet_la_SOURCES +=				\
 vnet/tcp/tcp_api.c				\
 vnet/tcp/tcp_format.c				\
 vnet/tcp/tcp_pg.c				\
 vnet/tcp/tcp_syn_filter4.c			\
 vnet/tcp/tcp_output.c				\
 vnet/tcp/tcp_input.c				\
 vnet/tcp/tcp_newreno.c				\
 vnet/tcp/tcp_test.c				\
 vnet/tcp/tcp.c

nobase_include_HEADERS +=			\
 vnet/tcp/tcp_packet.h				\
 vnet/tcp/tcp_timer.h				\
 vnet/tcp/tcp_debug.h				\
 vnet/tcp/tcp.h					\
 vnet/tcp/tcp.api.h

API_FILES += vnet/tcp/tcp.api

########################################
# Layer 4 protocol: udp
########################################
libvnet_la_SOURCES +=				\
 vnet/udp/udp.c					\
 vnet/udp/udp_input.c				\
 vnet/udp/udp_format.c				\
 vnet/udp/udp_local.c				\
 vnet/udp/udp_pg.c				\
 vnet/udp/udp_encap_node.c			\
 vnet/udp/udp_encap.c				\
 vnet/udp/udp_api.c

nobase_include_HEADERS +=			\
  vnet/udp/udp_error.def                       	\
  vnet/udp/udp.h                               	\
  vnet/udp/udp_packet.h				\
  vnet/udp/udp.api.h

API_FILES += vnet/udp/udp.api

########################################
# Layer 4 protocol: sctp
########################################
libvnet_la_SOURCES +=				\
  vnet/sctp/sctp_api.c				\
  vnet/sctp/sctp.c				\
  vnet/sctp/sctp_pg.c				\
  vnet/sctp/sctp_input.c			\
  vnet/sctp/sctp_output.c			\
  vnet/sctp/sctp_format.c

nobase_include_HEADERS +=			\
  vnet/sctp/sctp_error.def                    	\
  vnet/sctp/sctp_packet.h			\
  vnet/sctp/sctp_timer.h			\
  vnet/sctp/sctp.h				\
  vnet/sctp/sctp.api.h

API_FILES += vnet/sctp/sctp.api

########################################
# Tunnel protocol: gre
########################################
libvnet_la_SOURCES +=				\
 vnet/gre/gre.c					\
 vnet/gre/node.c				\
 vnet/gre/interface.c				\
 vnet/gre/pg.c					\
 vnet/gre/gre_api.c

nobase_include_HEADERS +=			\
 vnet/gre/gre.h					\
 vnet/gre/packet.h				\
 vnet/gre/error.def				\
 vnet/gre/gre.api.h

API_FILES += vnet/gre/gre.api

########################################
# Tunnel protocol: ipip
########################################
libvnet_la_SOURCES +=				\
 vnet/ipip/ipip.c				\
 vnet/ipip/node.c				\
 vnet/ipip/sixrd.c				\
 vnet/ipip/ipip_api.c				\
 vnet/ipip/ipip_cli.c

nobase_include_HEADERS +=			\
 vnet/ipip/ipip.api.h				\
 vnet/ipip/ipip.h

API_FILES += vnet/ipip/ipip.api

########################################
# Tunnel protocol: l2tpv3
########################################
libvnet_la_SOURCES +=				\
 vnet/l2tp/l2tp.c				\
 vnet/l2tp/encap.c 				\
 vnet/l2tp/decap.c  				\
 vnet/l2tp/pg.c					\
 vnet/l2tp/l2tp_api.c

nobase_include_HEADERS +=			\
 vnet/l2tp/l2tp.h				\
 vnet/l2tp/packet.h				\
 vnet/l2tp/l2tp.api.h

API_FILES += vnet/l2tp/l2tp.api

########################################
# Tunnel protocol: gre+mpls
########################################
libvnet_la_SOURCES +=				\
 vnet/mpls/mpls.c				\
 vnet/mpls/mpls_lookup.c			\
 vnet/mpls/mpls_output.c			\
 vnet/mpls/mpls_features.c			\
 vnet/mpls/mpls_input.c				\
 vnet/mpls/interface.c			        \
 vnet/mpls/mpls_tunnel.c		        \
 vnet/mpls/pg.c			        \
 vnet/mpls/mpls_api.c

nobase_include_HEADERS +=			\
 vnet/mpls/mpls.h				\
 vnet/mpls/mpls_types.h				\
 vnet/mpls/mpls_tunnel.h			\
 vnet/mpls/packet.h				\
 vnet/mpls/error.def			\
 vnet/mpls/mpls.api.h

API_FILES += vnet/mpls/mpls.api

########################################
# Tunnel protocol: vxlan-gpe
########################################

libvnet_la_SOURCES +=				\
 vnet/vxlan-gpe/vxlan_gpe.c			\
 vnet/vxlan-gpe/encap.c				\
 vnet/vxlan-gpe/decap.c				\
 vnet/vxlan-gpe/vxlan_gpe_api.c

nobase_include_HEADERS +=			\
 vnet/vxlan-gpe/vxlan_gpe.h			\
 vnet/vxlan-gpe/vxlan_gpe_packet.h		\
 vnet/vxlan-gpe/vxlan_gpe_error.def		\
 vnet/vxlan-gpe/vxlan_gpe.api.h

API_FILES += vnet/vxlan-gpe/vxlan_gpe.api

########################################
# Tunnel protocol: ipsec+gre
########################################
libvnet_la_SOURCES +=				\
 vnet/ipsec-gre/ipsec_gre.c			\
 vnet/ipsec-gre/node.c				\
 vnet/ipsec-gre/interface.c			\
 vnet/ipsec-gre/ipsec_gre_api.c

nobase_include_HEADERS +=			\
 vnet/ipsec-gre/ipsec_gre.h			\
 vnet/ipsec-gre/error.def			\
 vnet/ipsec-gre/ipsec_gre.api.h

API_FILES += vnet/ipsec-gre/ipsec_gre.api

########################################
# LISP control plane: lisp-cp
########################################

libvnet_la_SOURCES +=				\
 vnet/lisp-cp/lisp_types.c			\
 vnet/lisp-cp/lisp_cp_dpo.c			\
 vnet/lisp-cp/control.c				\
 vnet/lisp-cp/gid_dictionary.c			\
 vnet/lisp-cp/lisp_msg_serdes.c			\
 vnet/lisp-cp/packets.c				\
 vnet/lisp-cp/one_cli.c				\
 vnet/lisp-cp/lisp_cli.c			\
 vnet/lisp-cp/one_api.c				\
 vnet/lisp-cp/lisp_api.c

nobase_include_HEADERS +=			\
 vnet/lisp-cp/lisp_types.h			\
 vnet/lisp-cp/packets.h				\
 vnet/lisp-cp/gid_dictionary.h			\
 vnet/lisp-cp/lisp_cp_messages.h		\
 vnet/lisp-cp/lisp_msg_serdes.h			\
 vnet/lisp-cp/control.h				\
 vnet/lisp-cp/one.api.h				\
 vnet/lisp-cp/lisp.api.h

API_FILES += vnet/lisp-cp/lisp.api
API_FILES += vnet/lisp-cp/one.api

if ENABLE_TESTS
LDS = \
  libvppinfra.la \
  libvnet.la \
  libvlib.la  \
  libsvm.la \
  libsvmdb.la \
  libvlibmemory.la \
  -lpthread -ldl -lrt -lm

TESTS += test_cp_serdes test_lisp_types

test_cp_serdes_SOURCES =			\
 tests/vnet/lisp-cp/test_cp_serdes.c		\
 vnet/lisp-cp/lisp_msg_serdes.c			\
 vnet/lisp-cp/lisp_types.c			\
 vnet/lisp-cp/packets.c				\
 vnet/ip/ip_checksum.c

test_lisp_types_SOURCES =			\
 tests/vnet/lisp-cp/test_lisp_types.c		\
 vnet/lisp-cp/lisp_types.c

test_cp_serdes_CPPFLAGS = $(AM_CPPFLAGS) -DCLIB_DEBUG
test_lisp_types_CPPFLAGS = $(AM_CPPFLAGS) -DCLIB_DEBUG

test_cp_serdes_LDADD = $(LDS)
test_lisp_types_LDADD = $(LDS)
endif

########################################
# Tunnel protocol: lisp-gpe
########################################

libvnet_la_SOURCES +=				\
 vnet/lisp-gpe/lisp_gpe.c			\
 vnet/lisp-gpe/lisp_gpe_sub_interface.c		\
 vnet/lisp-gpe/lisp_gpe_adjacency.c		\
 vnet/lisp-gpe/lisp_gpe_tunnel.c		\
 vnet/lisp-gpe/lisp_gpe_fwd_entry.c		\
 vnet/lisp-gpe/lisp_gpe_tenant.c		\
 vnet/lisp-gpe/interface.c			\
 vnet/lisp-gpe/decap.c				\
 vnet/lisp-gpe/lisp_gpe_api.c

nobase_include_HEADERS +=			\
 vnet/lisp-gpe/lisp_gpe.h			\
 vnet/lisp-gpe/lisp_gpe_fwd_entry.h		\
 vnet/lisp-gpe/lisp_gpe_tenant.h		\
 vnet/lisp-gpe/lisp_gpe_packet.h		\
 vnet/lisp-gpe/lisp_gpe_error.def		\
 vnet/lisp-gpe/lisp_gpe.api.h

API_FILES += vnet/lisp-gpe/lisp_gpe.api

########################################
# DHCP client
########################################
libvnet_la_SOURCES +=				\
 vnet/dhcp/client.c				\
 vnet/dhcp/dhcp_client_detect.c			\
 vnet/dhcp/dhcp_api.c

nobase_include_HEADERS +=			\
 vnet/dhcp/client.h				\
 vnet/dhcp/dhcp.api.h

API_FILES += vnet/dhcp/dhcp.api

########################################
# DHCP proxy
########################################
libvnet_la_SOURCES +=				\
 vnet/dhcp/dhcp6_proxy_node.c                   \
 vnet/dhcp/dhcp4_proxy_node.c			\
 vnet/dhcp/dhcp_proxy.c

nobase_include_HEADERS +=			\
 vnet/dhcp/dhcp4_packet.h		        \
 vnet/dhcp/dhcp6_packet.h		        \
 vnet/dhcp/dhcp_proxy.h				\
 vnet/dhcp/dhcp6_proxy_error.def                \
 vnet/dhcp/dhcp4_proxy_error.def

########################################
# ipv6 segment routing
########################################

libvnet_la_SOURCES +=				\
 vnet/srv6/sr.c						\
 vnet/srv6/sr_localsid.c			\
 vnet/srv6/sr_policy_rewrite.c		\
 vnet/srv6/sr_steering.c			\
 vnet/srv6/sr_api.c

nobase_include_HEADERS +=			\
 vnet/srv6/sr_packet.h				\
 vnet/srv6/sr.h 					\
 vnet/srv6/sr.api.h

API_FILES += vnet/srv6/sr.api

########################################
# mpls segment routing
########################################

libvnet_la_SOURCES +=				\
 vnet/srmpls/sr_mpls_policy.c		\
 vnet/srmpls/sr_mpls_steering.c   \
 vnet/srmpls/sr_mpls_api.c


nobase_include_HEADERS +=			\
 vnet/srmpls/sr_mpls.h      \
 vnet/srmpls/sr_mpls.api.h

API_FILES += vnet/srmpls/sr_mpls.api

########################################
# IPFIX / netflow v10
########################################
libvnet_la_SOURCES +=				\
 vnet/ipfix-export/flow_report.c			\
 vnet/ipfix-export/flow_api.c

nobase_include_HEADERS +=			\
 vnet/ipfix-export/flow_report.h			\
 vnet/ipfix-export/ipfix_info_elements.h		\
 vnet/ipfix-export/ipfix_packet.h			\
 vnet/ipfix-export/ipfix_export.api.h

API_FILES += vnet/ipfix-export/ipfix_export.api

########################################
# IPFIX classify code
########################################

libvnet_la_SOURCES +=				\
  vnet/ipfix-export/flow_report_classify.c

nobase_include_HEADERS +=			\
  vnet/ipfix-export/flow_report_classify.h

########################################
# lawful intercept
########################################

libvnet_la_SOURCES +=				\
  vnet/lawful-intercept/lawful_intercept.c	\
  vnet/lawful-intercept/node.c

nobase_include_HEADERS += 			\
  vnet/lawful-intercept/lawful_intercept.h

########################################
# SPAN (port mirroring)
########################################

libvnet_la_SOURCES +=				\
  vnet/span/span_api.c  \
  vnet/span/span.c	    \
  vnet/span/node.c

nobase_include_HEADERS += 			\
  vnet/span/span.api.h  \
  vnet/span/span.h

API_FILES += vnet/span/span.api

########################################
# DNS proxy, API
########################################
libvnet_la_SOURCES +=				\
 vnet/dns/dns.c					\
 vnet/dns/dns.h					\
 vnet/dns/dns_packet.h				\
 vnet/dns/reply_node.c				\
 vnet/dns/request_node.c			\
 vnet/dns/resolver_process.c

nobase_include_HEADERS +=			\
 vnet/dns/dns.api.h				\
 vnet/dns/dns.h

API_FILES += vnet/dns/dns.api

########################################
# Packet generator
########################################

libvnet_la_SOURCES +=				\
  vnet/pg/cli.c					\
  vnet/pg/edit.c				\
  vnet/pg/init.c				\
  vnet/pg/input.c				\
  vnet/pg/output.c				\
  vnet/pg/stream.c				\
  vnet/pg/pg_api.c

nobase_include_HEADERS +=			\
  vnet/pg/pg.h					\
  vnet/pg/edit.h				\
  vnet/pg/pg.api.h

API_FILES += vnet/pg/pg.api

########################################
# virtio
########################################

libvnet_la_SOURCES +=				\
  vnet/devices/virtio/device.c			\
  vnet/devices/virtio/node.c			\
  vnet/devices/virtio/vhost-user.c		\
  vnet/devices/virtio/vhost_user_api.c		\
  vnet/devices/virtio/virtio.c


nobase_include_HEADERS +=			\
  vnet/devices/virtio/virtio.h			\
  vnet/devices/virtio/vhost-user.h		\
  vnet/devices/virtio/vhost_user.api.h

API_FILES += vnet/devices/virtio/vhost_user.api

########################################
# tap interface (with virtio backend)
########################################

libvnet_la_SOURCES += 				\
  vnet/devices/tap/cli.c			\
  vnet/devices/tap/tap.c			\
  vnet/devices/tap/tapv2_api.c

nobase_include_HEADERS += 			\
  vnet/devices/tap/tap.h			\
  vnet/devices/tap/tapv2.api.h

API_FILES += vnet/devices/tap/tapv2.api

########################################
# session managmeent
########################################

libvnet_la_SOURCES +=				\
  vnet/session/session.c			\
  vnet/session/session_table.c			\
  vnet/session/session_rules_table.c		\
  vnet/session/session_lookup.c			\
  vnet/session/session_node.c			\
  vnet/session/transport.c			\
  vnet/session/application.c			\
  vnet/session/session_cli.c			\
  vnet/session/application_interface.c		\
  vnet/session/application_namespace.c		\
  vnet/session/segment_manager.c		\
  vnet/session/session_test.c			\
  vnet/session/session_api.c

nobase_include_HEADERS +=			\
  vnet/session/session.h			\
  vnet/session/session_table.h			\
  vnet/session/session_rules_table.h		\
  vnet/session/stream_session.h			\
  vnet/session/session_lookup.h			\
  vnet/session/application.h			\
  vnet/session/transport.h			\
  vnet/session/transport_interface.h		\
  vnet/session/application_interface.h		\
  vnet/session/application_namespace.h		\
  vnet/session/session_debug.h			\
  vnet/session/segment_manager.h		\
  vnet/session/mma_template.h			\
  vnet/session/mma_template.c			\
  vnet/session/mma_16.h				\
  vnet/session/mma_40.h				\
  vnet/session/session.api.h

API_FILES += vnet/session/session.api

########################################
# session layer applications
########################################

libvnet_la_SOURCES +=				\
  vnet/session-apps/echo_client.c		\
  vnet/session-apps/echo_server.c		\
  vnet/session-apps/http_server.c		\
  vnet/session-apps/proxy.c

nobase_include_HEADERS +=			\
  vnet/session-apps/echo_client.h		\
  vnet/session-apps/proxy.h

########################################
# TLS protocol
########################################

libvnet_la_SOURCES += vnet/tls/tls.c

nobase_include_HEADERS +=			\
  vnet/tls/tls.h

########################################
# Linux packet interface
########################################

libvnet_la_SOURCES +=				\
  vnet/devices/af_packet/af_packet.c		\
  vnet/devices/af_packet/device.c		\
  vnet/devices/af_packet/node.c			\
  vnet/devices/af_packet/cli.c			\
  vnet/devices/af_packet/af_packet_api.c

nobase_include_HEADERS +=			\
  vnet/devices/af_packet/af_packet.h	\
  vnet/devices/af_packet/af_packet.api.h

API_FILES += vnet/devices/af_packet/af_packet.api

########################################
# NETMAP interface
########################################

libvnet_la_SOURCES +=				\
  vnet/devices/netmap/netmap.c			\
  vnet/devices/netmap/device.c			\
  vnet/devices/netmap/node.c			\
  vnet/devices/netmap/cli.c			\
  vnet/devices/netmap/netmap_api.c

nobase_include_HEADERS +=			\
  vnet/devices/netmap/netmap.h		\
  vnet/devices/netmap/netmap.api.h

API_FILES += vnet/devices/netmap/netmap.api

########################################
# Driver feature graph arc support
########################################

libvnet_la_SOURCES +=				\
  vnet/feature/feature.c			\
  vnet/feature/feature_api.c			\
  vnet/feature/registration.c

nobase_include_HEADERS +=			\
  vnet/feature/feature.h			\
  vnet/feature/feature.api.h

API_FILES += vnet/feature/feature.api

########################################
# Unix kernel related
########################################

# FIXME: vnet/unix/hgshm.c

libvnet_la_SOURCES +=				\
  vnet/unix/gdb_funcs.c				\
  vnet/unix/pcap.c				\
  vnet/unix/tap_api.c				\
  vnet/unix/tapcli.c				\
  vnet/unix/tuntap.c

nobase_include_HEADERS +=			\
  vnet/unix/pcap.h				\
  vnet/unix/tuntap.h				\
  vnet/unix/tap.api.h				\
  vnet/unix/tapcli.h

API_FILES += vnet/unix/tap.api

########################################
# FIB
########################################

libvnet_la_SOURCES +=				\
  vnet/fib/fib.c                                \
  vnet/fib/fib_test.c                           \
  vnet/fib/ip4_fib.c                            \
  vnet/fib/ip6_fib.c                            \
  vnet/fib/mpls_fib.c                           \
  vnet/fib/fib_table.c                          \
  vnet/fib/fib_walk.c                           \
  vnet/fib/fib_types.c                          \
  vnet/fib/fib_node.c                           \
  vnet/fib/fib_node_list.c                      \
  vnet/fib/fib_entry.c                          \
  vnet/fib/fib_entry_src.c                      \
  vnet/fib/fib_entry_src_rr.c                   \
  vnet/fib/fib_entry_src_interface.c            \
  vnet/fib/fib_entry_src_interpose.c            \
  vnet/fib/fib_entry_src_default_route.c        \
  vnet/fib/fib_entry_src_special.c              \
  vnet/fib/fib_entry_src_api.c                  \
  vnet/fib/fib_entry_src_adj.c                  \
  vnet/fib/fib_entry_src_mpls.c                 \
  vnet/fib/fib_entry_src_lisp.c                 \
  vnet/fib/fib_entry_cover.c                    \
  vnet/fib/fib_entry_delegate.c                 \
  vnet/fib/fib_path_list.c                      \
  vnet/fib/fib_path.c				\
  vnet/fib/fib_path_ext.c			\
  vnet/fib/fib_urpf_list.c			\
  vnet/fib/fib_attached_export.c		\
  vnet/fib/fib_api.c				\
  vnet/fib/fib_bfd.c

nobase_include_HEADERS +=			\
  vnet/fib/fib.h				\
  vnet/fib/fib_api.h				\
  vnet/fib/ip4_fib.h				\
  vnet/fib/ip6_fib.h				\
  vnet/fib/fib_types.h				\
  vnet/fib/fib_table.h				\
  vnet/fib/fib_node.h				\
  vnet/fib/fib_node_list.h			\
  vnet/fib/fib_entry.h				\
  vnet/fib/fib_entry_delegate.h

########################################
# ADJ
########################################

libvnet_la_SOURCES +=				\
  vnet/adj/adj_nbr.c				\
  vnet/adj/adj_glean.c   			\
  vnet/adj/adj_midchain.c   			\
  vnet/adj/adj_mcast.c   			\
  vnet/adj/adj_l2.c      			\
  vnet/adj/adj_nsh.c      			\
  vnet/adj/adj.c		                \
  vnet/adj/rewrite.c				\
  vnet/adj/adj_bfd.c				\
  vnet/adj/adj_delegate.c

nobase_include_HEADERS +=			\
  vnet/adj/adj.h				\
  vnet/adj/adj_types.h				\
  vnet/adj/adj_glean.h  			\
  vnet/adj/adj_nsh.h  				\
  vnet/adj/adj_nbr.h 				\
  vnet/adj/rewrite.h

########################################
# Data-Plane Objects
########################################

libvnet_la_SOURCES +=				\
  vnet/dpo/dpo.c				\
  vnet/dpo/drop_dpo.c				\
  vnet/dpo/ip_null_dpo.c			\
  vnet/dpo/ip6_ll_dpo.c				\
  vnet/dpo/punt_dpo.c				\
  vnet/dpo/receive_dpo.c			\
  vnet/dpo/load_balance.c			\
  vnet/dpo/load_balance_map.c			\
  vnet/dpo/lookup_dpo.c   			\
  vnet/dpo/classify_dpo.c   			\
  vnet/dpo/replicate_dpo.c   			\
  vnet/dpo/interface_rx_dpo.c  			\
  vnet/dpo/interface_tx_dpo.c  			\
  vnet/dpo/mpls_disposition.c   		\
  vnet/dpo/mpls_label_dpo.c			\
  vnet/dpo/l3_proxy_dpo.c			\
  vnet/dpo/dvr_dpo.c

nobase_include_HEADERS +=			\
  vnet/dpo/load_balance.h			\
  vnet/dpo/drop_dpo.h				\
  vnet/dpo/lookup_dpo.h				\
  vnet/dpo/punt_dpo.h				\
  vnet/dpo/classify_dpo.h			\
  vnet/dpo/receive_dpo.h			\
  vnet/dpo/ip_null_dpo.h			\
  vnet/dpo/replicate_dpo.h   			\
  vnet/dpo/dpo.h

########################################
# Multicast FIB
########################################

libvnet_la_SOURCES +=				\
  vnet/mfib/mfib_test.c                         \
  vnet/mfib/mfib_forward.c                      \
  vnet/mfib/ip4_mfib.c                          \
  vnet/mfib/ip6_mfib.c                          \
  vnet/mfib/mfib_types.c                        \
  vnet/mfib/mfib_signal.c                       \
  vnet/mfib/mfib_itf.c                          \
  vnet/mfib/mfib_entry.c                        \
  vnet/mfib/mfib_table.c

nobase_include_HEADERS +=			\
  vnet/mfib/ip4_mfib.h                          \
  vnet/mfib/mfib_types.h                        \
  vnet/mfib/mfib_table.h

########################################
# Utilities
########################################

libvnet_la_SOURCES +=                    \
  vnet/util/radix.c			     \
  vnet/util/refcount.c			 \
  vnet/util/trajectory.c

########################################
# QoS
########################################

libvnet_la_SOURCES +=      	                \
  vnet/qos/qos_types.c				\
  vnet/qos/qos_api.c				\
  vnet/qos/qos_egress_map.c			\
  vnet/qos/qos_record.c				\
  vnet/qos/qos_mark.c

API_FILES += vnet/qos/qos.api

nobase_include_HEADERS +=                       \
 vnet/qos/qos.api.h

########################################
# BIER
########################################

libvnet_la_SOURCES +=                           \
  vnet/bier/bier_bit_string.c                   \
  vnet/bier/bier_entry.c                        \
  vnet/bier/bier_fmask.c                        \
  vnet/bier/bier_fmask_db.c                     \
  vnet/bier/bier_input.c                   	\
  vnet/bier/bier_lookup.c                  	\
  vnet/bier/bier_output.c                  	\
  vnet/bier/bier_table.c                        \
  vnet/bier/bier_types.c                        \
  vnet/bier/bier_test.c                         \
  vnet/bier/bier_api.c                          \
  vnet/bier/bier_drop.c                         \
  vnet/bier/bier_update.c			\
  vnet/bier/bier_imp_node.c			\
  vnet/bier/bier_imp.c				\
  vnet/bier/bier_disp_entry.c			\
  vnet/bier/bier_disp_lookup_node.c		\
  vnet/bier/bier_disp_dispatch_node.c		\
  vnet/bier/bier_disp_table.c			\
  vnet/bier/bier_bift_table.c

nobase_include_HEADERS +=			\
  vnet/bier/bier_types.h                        \
  vnet/bier/bier_entry.h                        \
  vnet/bier/bier_update.h                       \
  vnet/bier/bier.api.h                          \
  vnet/bier/bier_table.h

API_FILES += vnet/bier/bier.api

if CPU_X86_64
if CC_SUPPORTS_AVX2
###############################################################
# AVX2
###############################################################
libvnet_avx2_la_SOURCES = $(libvnet_multiversioning_sources)
libvnet_avx2_la_CFLAGS =			\
	$(AM_CFLAGS)  @CPU_AVX2_FLAGS@		\
	-DCLIB_MARCH_VARIANT=avx2
noinst_LTLIBRARIES += libvnet_avx2.la
libvnet_la_LIBADD += libvnet_avx2.la
endif

if CC_SUPPORTS_AVX512
###############################################################
# AVX512
###############################################################
libvnet_avx512_la_SOURCES = $(libvnet_multiversioning_sources)
libvnet_avx512_la_CFLAGS =			\
	$(AM_CFLAGS) @CPU_AVX512_FLAGS@		\
	-DCLIB_MARCH_VARIANT=avx512
noinst_LTLIBRARIES += libvnet_avx512.la
libvnet_la_LIBADD += libvnet_avx512.la
endif
endif

########################################
# Test apps
########################################

noinst_PROGRAMS += tcp_echo udp_echo

TEST_APPS_LDADD = libvlibmemoryclient.la libsvm.la libvppinfra.la
TEST_APPS_LDADD += -lpthread -lm -lrt

tcp_echo_SOURCES = tests/vnet/session/tcp_echo.c
tcp_echo_LDADD = $(TEST_APPS_LDADD)

udp_echo_SOURCES = tests/vnet/session/udp_echo.c
udp_echo_LDADD = $(TEST_APPS_LDADD)

########################################
# Plugin client library
########################################

nobase_include_HEADERS +=                      \
  vnet/plugin/plugin.h

pcap2pg_SOURCES = 				\
  vnet/unix/pcap2pg.c				\
  vnet/unix/pcap.h

pcap2pg_LDFLAGS = -static
pcap2pg_LDADD = libvnet.la libvppinfra.la -lpthread libvlibmemory.la -lm -ldl

pcap2cinit_SOURCES = 				\
  vnet/unix/pcap2cinit.c			\
  vnet/unix/pcap.h

pcap2cinit_LDFLAGS = -static
pcap2cinit_LDADD = libvnet.la libvppinfra.la -lpthread libvlibmemory.la -lm -ldl

noinst_PROGRAMS += pcap2pg pcap2cinit

# vi:syntax=automake