FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
ip_table.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2020 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
#ifndef included_ip_table_h
17
#define included_ip_table_h
18
19
#include <
vnet/vnet.h
>
20
21
typedef
enum
vnet_ip_table_function_priority_t_
22
{
23
VNET_IP_TABLE_FUNC_PRIORITY_LOW
,
24
VNET_IP_TABLE_FUNC_PRIORITY_HIGH
,
25
}
vnet_ip_table_function_priority_t
;
26
#define VNET_IP_TABLE_FUNC_N_PRIO ((vnet_ip_table_function_priority_t)VNET_IP_TABLE_FUNC_PRIORITY_HIGH+1)
27
28
#ifndef CLIB_MARCH_VARIANT
29
#define _VNET_IP_TABLE_FUNCTION_DECL_PRIO(f,tag,p) \
30
\
31
static void __vnet_ip_table_function_init_##tag##_##f (void) \
32
__attribute__((__constructor__)) ; \
33
\
34
static void __vnet_ip_table_function_init_##tag##_##f (void) \
35
{ \
36
vnet_main_t * vnm = vnet_get_main(); \
37
static _vnet_ip_table_function_list_elt_t init_function; \
38
init_function.next_ip_table_function = vnm->tag##_functions[p]; \
39
vnm->tag##_functions[p] = &init_function; \
40
init_function.fp = (void *) &f; \
41
} \
42
static void __vnet_ip_table_function_deinit_##tag##_##f (void) \
43
__attribute__((__destructor__)) ; \
44
\
45
static void __vnet_ip_table_function_deinit_##tag##_##f (void) \
46
{ \
47
vnet_main_t * vnm = vnet_get_main(); \
48
_vnet_ip_table_function_list_elt_t *next; \
49
if (vnm->tag##_functions[p]->fp == f) \
50
{ \
51
vnm->tag##_functions[p] = \
52
vnm->tag##_functions[p]->next_ip_table_function; \
53
return; \
54
} \
55
next = vnm->tag##_functions[p]; \
56
while (next->next_ip_table_function) \
57
{ \
58
if (next->next_ip_table_function->fp == f) \
59
{ \
60
next->next_ip_table_function = \
61
next->next_ip_table_function->next_ip_table_function; \
62
return; \
63
} \
64
next = next->next_ip_table_function; \
65
} \
66
}
67
#else
68
/* create unused pointer to silence compiler warnings and get whole
69
function optimized out */
70
#define _VNET_IP_TABLE_FUNCTION_DECL_PRIO(f,tag,p) \
71
static __clib_unused void * __clib_unused_##f = f;
72
#endif
73
74
#define _VNET_IP_TABLE_FUNCTION_DECL(f,tag) \
75
_VNET_IP_TABLE_FUNCTION_DECL_PRIO(f,tag,VNET_ITF_FUNC_PRIORITY_LOW)
76
77
#define VNET_IP_TABLE_ADD_DEL_FUNCTION(f) \
78
_VNET_IP_TABLE_FUNCTION_DECL(f,ip_table_add_del)
79
80
#endif
/* included_ip_table_h */
81
82
/*
83
* fd.io coding-style-patch-verification: ON
84
*
85
* Local Variables:
86
* eval: (c-set-style "gnu")
87
* End:
88
*/
VNET_IP_TABLE_FUNC_PRIORITY_HIGH
@ VNET_IP_TABLE_FUNC_PRIORITY_HIGH
Definition:
ip_table.h:24
vnet_ip_table_function_priority_t_
vnet_ip_table_function_priority_t_
Definition:
ip_table.h:21
vnet_ip_table_function_priority_t
enum vnet_ip_table_function_priority_t_ vnet_ip_table_function_priority_t
VNET_IP_TABLE_FUNC_PRIORITY_LOW
@ VNET_IP_TABLE_FUNC_PRIORITY_LOW
Definition:
ip_table.h:23
vnet.h
src
vnet
ip
ip_table.h
Generated on Sat Jan 8 2022 10:05:09 for FD.io VPP by
1.8.17