update userguide alignment
[samplevnf.git] / VNFs / vACL / pipeline / pipeline_acl.h
1 /*
2 // Copyright (c) 2017 Intel Corporation
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //      http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 */
16
17 #ifndef __INCLUDE_PIPELINE_ACL_H__
18 #define __INCLUDE_PIPELINE_ACL_H__
19
20 /**
21  * @file
22  * Pipeline ACL FE.
23  *
24  * Pipeline ACL Front End (FE).
25  * Runs on the Master pipeline, responsible for CLI commands.
26  *
27  */
28
29 #include "pipeline.h"
30 #include "pipeline_acl_be.h"
31
32 /* ACL IPV4 and IPV6 enable flags for debugging (Default both on) */
33 extern int acl_ipv4_enabled;
34 extern int acl_ipv6_enabled;
35
36 /* Number of ACL Rules, default 4 * 1024 */
37 extern uint32_t acl_n_rules;
38 /* ACL Rule Table TRIE - 2 (Active, Standby Global table per ipv4, ipv6 */
39 extern void *acl_rule_table_ipv4_active;
40 extern void *acl_rule_table_ipv4_standby;
41 extern void *acl_rule_table_ipv6_active;
42 extern void *acl_rule_table_ipv6_standby;
43
44 #define active_rule_table       0
45 #define standby_rule_table      1
46 #define acl_add_command         0
47 #define acl_delete_command      1
48 #define IPV6_32BIT_LENGTH       4
49
50 /**
51  * Add ACL rule to the ACL rule table.
52  * Rules are added standby table.
53  * Applyruleset command will activate the change.
54  * Both IPv4 and IPv6 rules can be added.
55  *
56  * @param app
57  *  A pointer to the ACL pipeline parameters.
58  * @param key
59  *  A pointer to the ACL rule to add.
60  * @param priority
61  *  Priority of the ACL rule.
62  * @param port_id
63  *  Port ID of the ACL rule.
64  * @param action_id
65  *  Action ID of the ACL rule. Defined in Action Table.
66  *
67  * @return
68  *  0 on success, negative on error.
69  */
70 int
71 app_pipeline_acl_add_rule(struct app_params *app,
72                           struct pipeline_acl_key *key,
73                           uint32_t priority,
74                           uint32_t port_id, uint32_t action_id);
75
76 /**
77  * Delete ACL rule from the ACL rule table.
78  * Rules deleted from standby tables.
79  * Applyruleset command will activate the change.
80  * Both IPv4 and IPv6 rules can be deleted.
81  *
82  * @param app
83  *  A pointer to the ACL pipeline parameters.
84  * @param key
85  *  A pointer to the ACL rule to delete.
86  *
87  * @return
88  *  0 on success, negative on error.
89  */
90 int
91 app_pipeline_acl_delete_rule(struct app_params *app,
92                              struct pipeline_acl_key *key);
93
94 /**
95  * Clear all ACL rules from the ACL rule table.
96  * Rules cleared from standby tables.
97  * Applyruleset command will activate the change.
98  * Both IPv4 and IPv6 rules will be cleared.
99  *
100  * @param app
101  *  A pointer to the ACL pipeline parameters.
102  *
103  * @return
104  *  0 on success, negative on error.
105  */
106 int app_pipeline_acl_clearrules(struct app_params *app);
107
108 /**
109  * Add Action to the Action table.
110  * Actions are added standby table.
111  * Applyruleset command will activate the change.
112  *
113  * @param app
114  *  A pointer to the ACL pipeline parameters.
115  * @param key
116  *  A pointer to the Action to add.
117  *
118  * @return
119  *  0 on success, negative on error.
120  */
121 int
122 app_pipeline_action_add(struct app_params *app,
123                         struct pipeline_action_key *key);
124
125 /**
126  * Delete Action from the Action table.
127  * Actions are deleted from the standby table.
128  * Applyruleset command will activate the change.
129  *
130  * @param app
131  *  A pointer to the ACL pipeline parameters.
132  * @param key
133  *  A pointer to the Action to delete.
134  *
135  * @return
136  *  0 on success, negative on error.
137  */
138 int
139 app_pipeline_action_delete(struct app_params *app,
140                            struct pipeline_action_key *key);
141
142 extern struct pipeline_type pipeline_acl;
143
144 #endif