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:
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 #ifndef included_acl_exported_types_h
17 #define included_acl_exported_types_h
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.
30 * Use to check if a given acl# exists.
33 typedef u8 (*acl_plugin_acl_exists_fn_t) (u32 acl_index);
36 * If you are using ACL plugin, get this unique ID first,
37 * so you can identify yourself when creating the lookup contexts.
40 typedef u32 (*acl_plugin_register_user_module_fn_t) (char *caller_module_string, char *val1_label, char *val2_label);
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.
50 typedef int (*acl_plugin_get_lookup_context_index_fn_t) (u32 acl_user_id, u32 val1, u32 val2);
53 * Release the lookup context index and destroy
54 * any associated data structures.
57 typedef void (*acl_plugin_put_lookup_context_index_fn_t) (u32 lc_index);
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.
64 typedef int (*acl_plugin_set_acl_vec_for_context_fn_t) (u32 lc_index, u32 *acl_list);
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);
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,
78 #define foreach_acl_plugin_exported_method_name \
80 _(register_user_module) \
81 _(get_lookup_context_index) \
82 _(put_lookup_context_index) \
83 _(set_acl_vec_for_context) \
87 #define _(name) acl_plugin_ ## name ## _fn_t name;
89 void *p_acl_main; /* a local copy of a pointer to acl_main */
90 foreach_acl_plugin_exported_method_name
91 } acl_plugin_methods_t;
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);
100 typedef clib_error_t * (*acl_plugin_methods_vtable_init_fn_t) (acl_plugin_methods_t *m);