FD.io VPP  v19.04.4-rc0-5-ge88582fac
Vector Packet Processing
exported_types.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 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_acl_exported_types_h
17 #define included_acl_exported_types_h
18 
19 /*
20  * The overlay struct matching an internal type. Contents/size may change.
21  * During the compile of the ACL plugin it is checked to have the same size
22  * as the internal structure.
23  */
24 
25 typedef struct {
26  u64 opaque[6];
28 
29 /*
30  * Use to check if a given acl# exists.
31  */
32 
34 
35 /*
36  * If you are using ACL plugin, get this unique ID first,
37  * so you can identify yourself when creating the lookup contexts.
38  */
39 
40 typedef u32 (*acl_plugin_register_user_module_fn_t) (char *caller_module_string, char *val1_label, char *val2_label);
41 
42 
43 /*
44  * Allocate a new lookup context index.
45  * Supply the id assigned to your module during registration,
46  * and two values of your choice identifying instances
47  * of use within your module. They are useful for debugging.
48  */
49 
50 typedef int (*acl_plugin_get_lookup_context_index_fn_t) (u32 acl_user_id, u32 val1, u32 val2);
51 
52 /*
53  * Release the lookup context index and destroy
54  * any associated data structures.
55  */
56 
57 typedef void (*acl_plugin_put_lookup_context_index_fn_t) (u32 lc_index);
58 
59 /*
60  * Prepare the sequential vector of ACL#s to lookup within a given context.
61  * Any existing list will be overwritten. acl_list is a vector.
62  */
63 
64 typedef int (*acl_plugin_set_acl_vec_for_context_fn_t) (u32 lc_index, u32 *acl_list);
65 
66 typedef void (*acl_plugin_fill_5tuple_fn_t) (u32 lc_index, vlib_buffer_t * b0, int is_ip6, int is_input,
67  int is_l2_path, fa_5tuple_opaque_t * p5tuple_pkt);
68 
69 typedef int (*acl_plugin_match_5tuple_fn_t) (u32 lc_index,
70  fa_5tuple_opaque_t * pkt_5tuple,
71  int is_ip6, u8 * r_action,
72  u32 * r_acl_pos_p,
73  u32 * r_acl_match_p,
74  u32 * r_rule_match_p,
75  u32 * trace_bitmap);
76 
77 
78 #define foreach_acl_plugin_exported_method_name \
79 _(acl_exists) \
80 _(register_user_module) \
81 _(get_lookup_context_index) \
82 _(put_lookup_context_index) \
83 _(set_acl_vec_for_context) \
84 _(fill_5tuple) \
85 _(match_5tuple)
86 
87 #define _(name) acl_plugin_ ## name ## _fn_t name;
88 typedef struct {
89  void *p_acl_main; /* a local copy of a pointer to acl_main */
92 #undef _
93 
94 /*
95  * An internally used function to fill in the ACL plugin vtable.
96  * The users should call this one:
97  * static inline clib_error_t * acl_plugin_exports_init (acl_plugin_methods_t *m);
98  */
99 
100 typedef clib_error_t * (*acl_plugin_methods_vtable_init_fn_t) (acl_plugin_methods_t *m);
101 
102 #endif
103 
u32 acl_index
Definition: gbp.api:304
int(* acl_plugin_set_acl_vec_for_context_fn_t)(u32 lc_index, u32 *acl_list)
u32(* acl_plugin_register_user_module_fn_t)(char *caller_module_string, char *val1_label, char *val2_label)
unsigned long u64
Definition: types.h:89
void(* acl_plugin_fill_5tuple_fn_t)(u32 lc_index, vlib_buffer_t *b0, int is_ip6, int is_input, int is_l2_path, fa_5tuple_opaque_t *p5tuple_pkt)
unsigned char u8
Definition: types.h:56
unsigned int u32
Definition: types.h:88
void(* acl_plugin_put_lookup_context_index_fn_t)(u32 lc_index)
u8(* acl_plugin_acl_exists_fn_t)(u32 acl_index)
int(* acl_plugin_get_lookup_context_index_fn_t)(u32 acl_user_id, u32 val1, u32 val2)
#define foreach_acl_plugin_exported_method_name
int(* acl_plugin_match_5tuple_fn_t)(u32 lc_index, fa_5tuple_opaque_t *pkt_5tuple, int is_ip6, u8 *r_action, u32 *r_acl_pos_p, u32 *r_acl_match_p, u32 *r_rule_match_p, u32 *trace_bitmap)
VLIB buffer representation.
Definition: buffer.h:102