summaryrefslogtreecommitdiffstats
path: root/vnet/Makefile.am
blob: 84ee79e91782529627945151bb1026fe3acf3f4c (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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369

@media only all and (prefers-color-scheme: dark) {
.highlight .hll { background-color: #49483e }
.highlight .c { color: #75715e } /* Comment */
.highlight .err { color: #960050; background-color: #1e0010 } /* Error */
.highlight .k { color: #66d9ef } /* Keyword */
.highlight .l { color: #ae81ff } /* Literal */
.highlight .n { color: #f8f8f2 } /* Name */
.highlight .o { color: #f92672 } /* Operator */
.highlight .p { color: #f8f8f2 } /* Punctuation */
.highlight .ch { color: #75715e } /* Comment.Hashbang */
.highlight .cm { color: #75715e } /* Comment.Multiline */
.highlight .cp { color: #75715e } /* Comment.Preproc */
.highlight .cpf { color: #75715e } /* Comment.PreprocFile */
.highlight .c1 { color: #75715e } /* Comment.Single */
.highlight .cs { color: #75715e } /* Comment.Special */
.highlight .gd { color: #f92672 } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gi { color: #a6e22e } /* Generic.Inserted */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #75715e } /* Generic.Subheading */
.highlight .kc { color: #66d9ef } /* Keyword.Constant */
.highlight .kd { color: #66d9ef } /* Keyword.Declaration */
.highlight .kn { color: #f92672 } /* Keyword.Namespace */
.highlight .kp { color: #66d9ef } /* Keyword.Pseudo */
.highlight .kr { color: #66d9ef } /* Keyword.Reserved */
.highlight .kt { color: #66d9ef } /* Keyword.Type */
.highlight .ld { color: #e6db74 } /* Literal.Date */
.highlight .m { color: #ae81ff } /* Literal.Number */
.highlight .s { color: #e6db74 } /* Literal.String */
.highlight .na { color: #a6e22e } /* Name.Attribute */
.highlight .nb { color: #f8f8f2 } /* Name.Builtin */
.highlight .nc { color: #a6e22e } /* Name.Class */
.highlight .no { color: #66d9ef } /* Name.Constant */
.highlight .nd { color: #a6e22e } /* Name.Decorator */
.highlight .ni { color: #f8f8f2 } /* Name.Entity */
.highlight .ne { color: #a6e22e } /* Name.Exception */
.highlight .nf { color: #a6e22e } /* Name.Function */
.highlight .nl { color: #f8f8f2 } /* Name.Label */
.highlight .nn { color: #f8f8f2 } /* Name.Namespace */
.highlight .nx { color: #a6e22e } /* Name.Other */
.highlight .py { color: #f8f8f2 } /* Name.Property */
.highlight .nt { color: #f92672 } /* Name.Tag */
.highlight .nv { color: #f8f8f2 } /* Name.Variable */
.highlight .ow { color: #f92672 } /* Operator.Word */
.highlight .w { color: #f8f8f2 } /* Text.Whitespace */
.highlight .mb { color: #ae81ff } /* Literal.Number.Bin */
.highlight .mf { color: #ae81ff } /* Literal.Number.Float */
.highlight .mh { color: #ae81ff } /* Literal.Number.Hex */
.highlight .mi { color: #ae81ff } /* Literal.Number.Integer */
.highlight .mo { color: #ae81ff } /* Literal.Number.Oct */
.highlight .sa { color: #e6db74 } /* Literal.String.Affix */
.highlight .sb { color: #e6db74 } /* Literal.String.Backtick */
.highlight .sc { color: #e6db74 } /* Literal.String.Char */
.highlight .dl { color: #e6db74 } /* Literal.String.Delimiter */
.highlight .sd { color: #e6db74 } /* Literal.String.Doc */
.highlight .s2 { color: #e6db74 } /* Literal.String.Double */
.highlight .se { color: #ae81ff } /* Literal.String.Escape */
.highlight .sh { color: #e6db74 } /* Literal.String.Heredoc */
.highlight .si { color: #e6db74 } /* Literal.String.Interpol */
.highlight .sx { color: #e6db74 } /* Literal.String.Other */
.highlight .sr { color: #e6db74 } /* Literal.String.Regex */
.highlight .s1 { color: #e6db74 } /* Literal.String.Single */
.highlight .ss { color: #e6db74 } /* Literal.String.Symbol */
.highlight .bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #a6e22e } /* Name.Function.Magic */
.highlight .vc { color: #f8f8f2 } /* Name.Variable.Class */
.highlight .vg { color: #f8f8f2 } /* Name.Variable.Global */
.highlight .vi { color: #f8f8f2 } /* Name.Variable.Instance */
.highlight .vm { color: #f8f8f2 } /* Name.Variable.Magic */
.highlight .il { color: #ae81ff } /* Literal.Number.Integer.Long */
}
@media (prefers-color-scheme: light) {
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */
.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */
.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */
.highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */
.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */
.highlight .vc { color: #336699 } /* Name.Variable.Class */
.highlight .vg { color: #dd7700 } /* Name.Variable.Global */
.highlight .vi { color: #3333bb } /* Name.Variable.Instance */
.highlight .vm { color: #336699 } /* Name.Variable.Magic */
.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
}
# IPFIX support {#ipfix_doc}

VPP includes a high-performance IPFIX record exporter. This note
explains how to use the internal APIs to export IPFIX data, and how to
configure and send the required IPFIX templates.

As you'll see, a bit of typing is required. 

## First: create an ipfix "report"

Include the flow report header file, fill out a @ref
vnet_flow_report_add_del_args_t structure, and call vnet_flow_report_add_del.

```{.c}
   #include <vnet/ipfix-export/flow_report.h>
   /* Defined in flow_report.h, of interest when constructing reports */

   /* ipfix field definitions for a particular report */
   typedef struct
   {
     u32 info_element;
     u32 size;
   } ipfix_report_element_t;

   /* Report add/del argument structure */
   typedef struct
   {
     /* Callback to flush current ipfix packet / frame */
     vnet_flow_data_callback_t *flow_data_callback;

     /* Callback to build the template packet rewrite string */
     vnet_flow_rewrite_callback_t *rewrite_callback;

     /* List of ipfix elements in the report */
     ipfix_report_element_t *report_elements;
     u32 n_report_elements;
     /* Kept in flow report, used e.g. by flow classifier */
     opaque_t opaque;
     /* Add / delete a report */
     int is_add;
     /* Ipfix "domain-ID", see RFC, set as desired */
     u32 domain_id;
     /* ipfix packet source port, often set to UDP_DST_PORT_ipfix */
     u16 src_port;
     /* Set by ipfix infra, needed to send data packets */
     u32 *stream_indexp;
   } vnet_flow_report_add_del_args_t;

   /* Private header file contents */

   /* Report ipfix element definition */
   #define foreach_simple_report_ipfix_element     \
   _(sourceIPv4Address, 4)                         \
   _(destinationIPv4Address, 4)                    \
   _(sourceTransportPort, 2)                       \
   _(destinationTransportPort, 2)                  \
   _(protocolIdentifier, 1)                        \
   _(flowStartMicroseconds, 8)                     \
   _(flowEndMicroseconds, 8)

   static ipfix_report_element_t simple_report_elements[] = {
   #define _(a,b) {a,b},
     foreach_simple_report_ipfix_element
   #undef _
   };

   typedef struct
   {
     /** Buffers and frames, per thread */
     vlib_buffer_t **buffers_by_thread;
     vlib_frame_t **frames_by_thread;
     u32 *next_record_offset_by_thread;

     /** Template ID's */
     u16 *template_ids;

     /** Time reference pair */
     u64 usec_time_0;
     f64 vlib_time_0;

     /** Stream index */
     u32 stream_index;

     /* Convenience */
     flow_report_main_t *flow_report_main;
     vlib_main_t *vlib_main;
     vnet_main_t *vnet_main;
   } my_logging_main_t;
   
   extern my_logging_main_t my_logging_main;

   ...

   /* Recitations */
   flow_report_main_t *frm = &flow_report_main;
   my_logging_main_t *mlm = &my_logging_main;
   vnet_flow_report_add_del_args_t a;
   int rv;
   u16 template_id;

   ... 

   /* Init function: set up time reference pair */
   mlm->vlib_time_0 = vlib_time_now (vm);
   mlm->milisecond_time_0 = unix_time_now_nsec () * 1e-6;

   ...

   /* Create a report */
   memset (&a, 0, sizeof (a));
   a.is_add = 1 /* to enable t
# 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.

AUTOMAKE_OPTIONS = foreign subdir-objects

AM_CFLAGS = -Wall @DPDK@ @VIRL@ @IPSEC@ @VCGN@ @IPV6SR@

libvnet_la_SOURCES =
libvnetplugin_la_SOURCES =
nobase_include_HEADERS =
noinst_PROGRAMS =
TESTS =

########################################
# Generic stuff
########################################
libvnet_la_SOURCES +=					\
  vnet/config.c						\
  vnet/interface.c					\
  vnet/interface_cli.c					\
  vnet/interface_format.c				\
  vnet/interface_output.c				\
  vnet/misc.c						\
  vnet/replication.c                                    \
  vnet/rewrite.c				

nobase_include_HEADERS +=			\
  vnet/api_errno.h				\
  vnet/buffer.h					\
  vnet/config.h					\
  vnet/global_funcs.h				\
  vnet/interface.h				\
  vnet/interface_funcs.h			\
  vnet/l3_types.h				\
  vnet/pipeline.h				\
  vnet/replication.h				\
  vnet/rewrite.h				\
  vnet/vnet.h

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

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

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

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

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

nobase_include_HEADERS +=			\
  vnet/cop/cop.h

########################################
# 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

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

########################################
# Layer 2 protocol: Ethernet bridging
########################################
libvnet_la_SOURCES +=				\
 vnet/l2/feat_bitmap.c				\
 vnet/l2/l2_bd.c				\
 vnet/l2/l2_bvi.c				\
 vnet/l2/l2_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_acl.c				\
 vnet/l2/l2_input.c				\
 vnet/l2/l2_input_vtr.c				\
 vnet/l2/l2_learn.c				\
 vnet/l2/l2_output_acl.c			\
 vnet/l2/l2_output.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

########################################
# 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	

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

########################################
# Layer 2 / CDP
########################################
libvnet_la_SOURCES +=				\
  vnet/cdp/cdp_input.c				\
  vnet/cdp/cdp_node.c				\
  vnet/cdp/cdp_periodic.c	

nobase_include_HEADERS +=			\
  vnet/cdp/cdp_protocol.h

########################################
# Layer 2/3 "classify"
########################################
libvnet_la_SOURCES +=				\
  vnet/classify/vnet_classify.c			\
  vnet/classify/ip_classify.c			\
  vnet/classify/input_acl.c			\
  vnet/classify/vnet_classify.h

nobase_include_HEADERS +=			\
  vnet/classify/vnet_classify.h	                \
  vnet/classify/input_acl.h

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

########################################
# Layer 3 protocol: IP v4/v6
########################################
libvnet_la_SOURCES +=				\
 vnet/ip/adj_alloc.c				\
 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_hop_by_hop.c			\
 vnet/ip/ip4_input.c				\
 vnet/ip/ip4_mtrie.c				\
 vnet/ip/ip4_pg.c				\
 vnet/ip/ip4_source_check.c			\
 vnet/ip/ip6_format.c				\
 vnet/ip/ip6_forward.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/ip_checksum.c				\
 vnet/ip/ip.h					\
 vnet/ip/ip_init.c				\
 vnet/ip/lookup.c				\
 vnet/ip/udp_format.c				\
 vnet/ip/udp_init.c				\
 vnet/ip/udp_local.c				\
 vnet/ip/udp_pg.c                               \
 vnet/ip/ip_input_acl.c                         \
 vnet/ip/ip_frag.c

nobase_include_HEADERS +=			\
 vnet/ip/adj_alloc.h				\
 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.h					\
 vnet/ip/ip4.h					\
 vnet/ip/ip4_mtrie.h				\
 vnet/ip/ip4_error.h				\
 vnet/ip/ip4_packet.h				\
 vnet/ip/ip6.h					\
 vnet/ip/ip6_error.h				\
 vnet/ip/ip6_hop_by_hop.h			\
 vnet/ip/ip6_hop_by_hop_packet.h		\
 vnet/ip/ip6_packet.h				\
 vnet/ip/lookup.h				\
 vnet/ip/ip_packet.h				\
 vnet/ip/ports.def				\
 vnet/ip/protocols.def				\
 vnet/ip/tcp_packet.h				\
 vnet/ip/udp.h					\
 vnet/ip/udp_error.def				\
 vnet/ip/udp_packet.h

########################################
# Layer 3 protocol: IPSec
########################################
if WITH_IPSEC
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_encrypt.c			\
 vnet/ipsec/esp_decrypt.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
endif 

libvnet_la_SOURCES +=       			\
 vnet/ipsec/ipsec_output.c

nobase_include_HEADERS +=     		        \
 vnet/ipsec/ipsec.h                             \
 vnet/ipsec/esp.h				\
 vnet/ipsec/ikev2.h                             \
 vnet/ipsec/ikev2_priv.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/ip4_map.c                             \
 vnet/map/ip6_map.c                             \
 vnet/map/sixrd.c                               \
 vnet/map/ip4_sixrd.c                           \
 vnet/map/ip6_sixrd.c                           \
 vnet/map/ip4_map_t.c                           \
 vnet/map/ip6_map_t.c

nobase_include_HEADERS +=                       \
 vnet/map/map.h                                 \
 vnet/map/sixrd.h

########################################
# Tunnel protocol: gre
########################################
libvnet_la_SOURCES +=				\
 vnet/gre/gre.c					\
 vnet/gre/node.c				\
 vnet/gre/interface.c				\
 vnet/gre/pg.c
 
nobase_include_HEADERS +=			\
 vnet/gre/gre.h					\
 vnet/gre/packet.h				\
 vnet/gre/error.def

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

########################################
# Tunnel protocol: gre+mpls
########################################
libvnet_la_SOURCES +=				\
 vnet/mpls-gre/mpls.c				\
 vnet/mpls-gre/node.c				\
 vnet/mpls-gre/interface.c			\
 vnet/mpls-gre/policy_encap.c			\
 vnet/mpls-gre/pg.c
 
nobase_include_HEADERS +=			\
 vnet/mpls-gre/mpls.h				\
 vnet/mpls-gre/packet.h				\
 vnet/mpls-gre/error.def


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

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

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

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

libvnet_la_SOURCES +=				\
 vnet/lisp-cp/lisp_types.c			\
 vnet/lisp-cp/control.c				\
 vnet/lisp-cp/gid_dictionary.c			\
 vnet/lisp-cp/lisp_msg_serdes.c			\
 vnet/lisp-cp/packets.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				


if ENABLE_TESTS
LDS = -lvppinfra -l:libvlib.a -l:libdpdk.a -l:libvlibmemory.a \
	-l:libvlibapi.a -l:libsvm.a -lpthread -ldl -lrt -lm -l:libvlib_unix.a

TESTS += test_cp_serdes test_lisp_types

test_cp_serdes_SOURCES =			\
 test/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 =			\
 test/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 = libvnet.la $(LDS)
test_lisp_types_LDADD = libvnet.la $(LDS)

test_cp_serdes_LDFLAGS = -static
test_lisp_types_LDFLAGS = -static
endif

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

libvnet_la_SOURCES +=				\
 vnet/lisp-gpe/lisp_gpe.c			\
 vnet/lisp-gpe/interface.c			\
 vnet/lisp-gpe/ip_forward.c			\
 vnet/lisp-gpe/decap.c				

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

if ENABLE_TESTS
TESTS += test_test

test_test_SOURCES = test/lisp-gpe/test.c

test_test_CPPFLAGS = $(AM_CPPFLAGS) -DCLIB_DEBUG

test_test_LDADD = $(LIBOBJS)

noinst_PROGRAMS += $(TESTS)
check_PROGRAMS = $(TESTS)
endif

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

nobase_include_HEADERS +=			\
 vnet/dhcp/client.h	

########################################
# DHCP proxy
########################################
libvnet_la_SOURCES +=				\
 vnet/dhcp/proxy_node.c				\
 vnet/dhcp/proxy.h
 
nobase_include_HEADERS +=			\
 vnet/dhcp/packet.h				\
 vnet/dhcp/proxy.h				\
 vnet/dhcp/proxy_error.def

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

if WITH_IPV6SR
libvnet_la_SOURCES +=				\
 vnet/sr/sr.c					\
 vnet/sr/sr_replicate.c
endif
 
nobase_include_HEADERS +=			\
 vnet/sr/sr_packet.h				\
 vnet/sr/sr_error.def				\
 vnet/sr/sr.h

########################################
# CGN
#########################################

if WITH_VCGN
libvnet_la_SOURCES +=						\
 vnet/vcgn/cnat_bulk_port.c					\
 vnet/vcgn/cnat_config.c					\
 vnet/vcgn/cnat_db_scanner.c					\
 vnet/vcgn/cnat_db_v2.c						\
 vnet/vcgn/cnat_debug_msg_handler.c				\
 vnet/vcgn/cnat_cli_handler.c					\
 vnet/vcgn/cnat_global.c					\
 vnet/vcgn/cnat_ipv4_udp_inside_input.c				\
 vnet/vcgn/cnat_ipv4_udp_inside_input_exceptions.c		\
 vnet/vcgn/cnat_ipv4_udp_outside_input.c			\
 vnet/vcgn/cnat_ipv4_tcp_inside_input.c				\
 vnet/vcgn/cnat_ipv4_tcp_inside_input_exceptions.c		\
 vnet/vcgn/cnat_ipv4_tcp_outside_input.c			\
 vnet/vcgn/cnat_ipv4_icmp_query_inside_input.c			\
 vnet/vcgn/cnat_ipv4_icmp_query_inside_input_exception.c	\
 vnet/vcgn/cnat_ipv4_icmp_query_outside_input.c			\
 vnet/vcgn/cnat_ipv4_icmp_error_inside_input.c			\
 vnet/vcgn/cnat_ipv4_icmp_error_outside_input.c			\
 vnet/vcgn/cnat_logging.c					\
 vnet/vcgn/cnat_ports.c						\
 vnet/vcgn/cnat_util.c						\
 vnet/vcgn/cnat_show.c						\
 vnet/vcgn/cnat_syslog.c					\
 vnet/vcgn/cnat_v4_functions.c					\
 vnet/vcgn/index_list.c						\
 vnet/vcgn/spp_platform_trace_log.c				\
 vnet/vcgn/vcgn_classify.c
endif

########################################
# DHCPv6 proxy
########################################
libvnet_la_SOURCES +=				\
 vnet/dhcpv6/proxy_node.c
 
nobase_include_HEADERS +=			\
 vnet/dhcpv6/packet.h				\
 vnet/dhcpv6/proxy.h				\
 vnet/dhcpv6/proxy_error.def

########################################
# IPFIX / netflow v10 
########################################
libvnet_la_SOURCES +=				\
 vnet/flow/flow_report.c

nobase_include_HEADERS +=			\
 vnet/flow/flow_report.h			\
 vnet/flow/ipfix_info_elements.h		\
 vnet/flow/ipfix_packet.h

########################################
# IPFIX sample code
########################################

libvnet_la_SOURCES +=				\
  vnet/flow/flow_report_sample.c

nobase_include_HEADERS +=			\
  vnet/flow/flow_report_sample.h

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

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

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

########################################
# 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

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

########################################
# Intel DPDK
########################################
if WITH_DPDK
libvnet_la_SOURCES +=				\
  vnet/devices/dpdk/dpdk_priv.h		\
  vnet/devices/dpdk/device.c		\
  vnet/devices/dpdk/format.c		\
  vnet/devices/dpdk/init.c			\
  vnet/devices/dpdk/node.c			\
  vnet/devices/dpdk/threads.c       \
  vnet/devices/dpdk/vhost_user.c    \
  vnet/devices/dpdk/cli.c

nobase_include_HEADERS +=			\
  vnet/devices/dpdk/dpdk.h			\
  vnet/devices/dpdk/threads.h
endif

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

if WITH_DPDK
libvnet_la_SOURCES +=       \
  vnet/devices/virtio/vhost-user.c

nobase_include_HEADERS +=     \
  vnet/devices/virtio/vhost-user.h
endif WITH_DPDK

########################################
# ssvm ethernet
########################################
libvnet_la_SOURCES +=				\
  vnet/devices/ssvm/ssvm_eth.c			\
  vnet/devices/ssvm/node.c

nobase_include_HEADERS +=			\
  vnet/devices/ssvm/ssvm_eth.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

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

########################################
# 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

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


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

# FIXME: vnet/unix/hgshm.c 

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

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

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

libvnetplugin_la_SOURCES +=                    \
  vnet/plugin/p1.c

nobase_include_HEADERS +=                      \
  vnet/plugin/plugin.h

########################################
# Service Chain verification util
########################################
libvnet_la_SOURCES +=       \
 vnet/lib-scv/scv_util.c

nobase_include_HEADERS +=                       \
 vnet/lib-scv/scv_util.h                        \
 vnet/lib-scv/math64.h

lib_LTLIBRARIES = libvnet.la libvnetplugin.la

dpdk_libs = 

if WITH_DPDK
dpdk_libs += -l:libdpdk.a
endif

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

pcap2pg_LDFLAGS = -static
pcap2pg_LDADD = libvnet.la -l:libvppinfra.a -lpthread -lm -ldl

noinst_PROGRAMS += pcap2pg