FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
nsh_md2_ioam_api.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 /*
16  *-----------------------------------------------------------------------
17  * nsh_md2_ioam_api.c - iOAM for NSH/LISP-GPE related APIs to create
18  * and maintain profiles
19  *-----------------------------------------------------------------------
20  */
21 
22 #include <vnet/vnet.h>
23 #include <vlib/unix/plugin.h>
24 #include <vnet/plugin/plugin.h>
26 
27 #include <vlibapi/api.h>
28 #include <vlibmemory/api.h>
29 
30 /* define message structures */
31 #define vl_typedefs
32 #include <nsh/nsh.api.h>
33 #undef vl_typedefs
34 
35 /* define generated endian-swappers */
36 #define vl_endianfun
37 #include <nsh/nsh.api.h>
38 #undef vl_endianfun
39 
40 /* instantiate all the print functions we know about */
41 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
42 #define vl_printfun
43 #include <nsh/nsh.api.h>
44 #undef vl_printfun
45 
47 static clib_error_t *
49 {
51  clib_error_t *error = 0;
52 
54  (u8 *) vlib_get_plugin_symbol ("ioam_plugin.so", "trace_main");
55 
56  if (!nsh_trace_main)
57  return error;
58 
60  sm->dst_by_ip4 = hash_create_mem (0, sizeof (fib_prefix_t), sizeof (uword));
61 
62  sm->dst_by_ip6 = hash_create_mem (0, sizeof (fib_prefix_t), sizeof (uword));
63 
65 
66  return error;
67 }
68 
70 
71 /*
72  * fd.io coding-style-patch-verification: ON
73  *
74  * Local Variables:
75  * eval: (c-set-style "gnu")
76  * End:
77  */
api.h
nsh_md2_ioam_main_::dst_by_ip6
uword * dst_by_ip6
Definition: nsh_md2_ioam.h:85
vec_new
#define vec_new(T, N)
Create new vector of given type and length (unspecified alignment, no header).
Definition: vec.h:365
nsh_trace_main
u8 * nsh_trace_main
Definition: nsh_md2_ioam_api.c:46
nsh_md2_ioam.h
nsh_md2_ioam_sw_interface_
Definition: nsh_md2_ioam.h:25
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
api.h
nsh_md2_ioam_main_::dst_by_ip4
uword * dst_by_ip4
Definition: nsh_md2_ioam.h:84
plugin.h
error
Definition: cJSON.c:88
hash_create_mem
#define hash_create_mem(elts, key_bytes, value_bytes)
Definition: hash.h:660
nsh_md2_ioam_main
nsh_md2_ioam_main_t nsh_md2_ioam_main
Definition: nsh_md2_ioam.c:42
nsh_md2_ioam_main_
Definition: nsh_md2_ioam.h:39
uword
u64 uword
Definition: types.h:112
nsh_md2_ioam_interface_init
void nsh_md2_ioam_interface_init(void)
Definition: nsh_md2_ioam.c:500
plugin.h
nsh_md2_ioam_main_::sw_interfaces
nsh_md2_ioam_sw_interface_t * sw_interfaces
Definition: nsh_md2_ioam.h:80
VLIB_INIT_FUNCTION
#define VLIB_INIT_FUNCTION(x)
Definition: init.h:172
pool_elts
static uword pool_elts(void *v)
Number of active elements in a pool.
Definition: pool.h:127
vlib_main_t
Definition: main.h:102
u8
unsigned char u8
Definition: types.h:56
clib_error_t
Definition: clib_error.h:21
vlib_init_function_t
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
Definition: init.h:51
vnet.h
fib_prefix_t_
Aggregate type for a prefix.
Definition: fib_types.h:202
vlib_get_plugin_symbol
void * vlib_get_plugin_symbol(char *plugin_name, char *symbol_name)
Definition: plugin.c:38
nsh_md2_ioam_init
static clib_error_t * nsh_md2_ioam_init(vlib_main_t *vm)
Definition: nsh_md2_ioam_api.c:48