FD.io VPP  v17.01-9-ge7dcee4
Vector Packet Processing
acl_all_api_h.h
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 /* Include the generated file, see BUILT_SOURCES in Makefile.am */
16 #include <acl/acl.api.h>
17 
18 #ifdef vl_printfun
19 
20 #ifdef LP64
21 #define _uword_fmt "%lld"
22 #define _uword_cast (long long)
23 #else
24 #define _uword_fmt "%ld"
25 #define _uword_cast long
26 #endif
27 
28 static inline void *
29 vl_api_acl_rule_t_print (vl_api_acl_rule_t * a, void *handle)
30 {
31  vl_print (handle, "vl_api_acl_rule_t:\n");
32  vl_print (handle, "is_permit: %u\n", (unsigned) a->is_permit);
33  vl_print (handle, "is_ipv6: %u\n", (unsigned) a->is_ipv6);
34  {
35  int _i;
36  for (_i = 0; _i < 16; _i++)
37  {
38  vl_print (handle, "src_ip_addr[%d]: %u\n", _i, a->src_ip_addr[_i]);
39  }
40  }
41  vl_print (handle, "src_ip_prefix_len: %u\n",
42  (unsigned) a->src_ip_prefix_len);
43  {
44  int _i;
45  for (_i = 0; _i < 16; _i++)
46  {
47  vl_print (handle, "dst_ip_addr[%d]: %u\n", _i, a->dst_ip_addr[_i]);
48  }
49  }
50  vl_print (handle, "dst_ip_prefix_len: %u\n",
51  (unsigned) a->dst_ip_prefix_len);
52  vl_print (handle, "proto: %u\n", (unsigned) a->proto);
53  vl_print (handle, "srcport_or_icmptype_first: %u\n",
54  (unsigned) a->srcport_or_icmptype_first);
55  vl_print (handle, "srcport_or_icmptype_last: %u\n",
56  (unsigned) a->srcport_or_icmptype_last);
57  vl_print (handle, "dstport_or_icmpcode_first: %u\n",
58  (unsigned) a->dstport_or_icmpcode_first);
59  vl_print (handle, "dstport_or_icmpcode_last: %u\n",
60  (unsigned) a->dstport_or_icmpcode_last);
61  vl_print (handle, "tcp_flags_mask: %u\n", (unsigned) a->tcp_flags_mask);
62  vl_print (handle, "tcp_flags_value: %u\n", (unsigned) a->tcp_flags_value);
63  return handle;
64 }
65 
66 static inline void *
67 vl_api_acl_add_replace_t_print (vl_api_acl_add_replace_t * a, void *handle)
68 {
69  int i;
70  vl_print (handle, "vl_api_acl_add_replace_t:\n");
71  vl_print (handle, "_vl_msg_id: %u\n", (unsigned) a->_vl_msg_id);
72  vl_print (handle, "client_index: %u\n", (unsigned) a->client_index);
73  vl_print (handle, "context: %u\n", (unsigned) a->context);
74  vl_print (handle, "acl_index: %u\n", (unsigned) a->acl_index);
75  vl_print (handle, "count: %u\n", (unsigned) a->count);
76  vl_print (handle, "r ----- \n");
77  for (i = 0; i < a->count; i++)
78  {
79  vl_print (handle, " r[%d]:\n", i);
80  vl_api_acl_rule_t_print (&a->r[i], handle);
81  }
82  vl_print (handle, "r ----- END \n");
83  return handle;
84 }
85 
86 
87 static inline void *vl_api_acl_details_t_print (vl_api_acl_details_t *a,void *handle)
88 {
89  vl_print(handle, "vl_api_acl_details_t:\n");
90  vl_print(handle, "_vl_msg_id: %u\n", (unsigned) a->_vl_msg_id);
91  vl_print(handle, "context: %u\n", (unsigned) a->context);
92  vl_print(handle, "acl_index: %u\n", (unsigned) a->acl_index);
93  {
94  int _i;
95  for (_i = 0; _i < 64; _i++) {
96  vl_print(handle, "tag[%d]: %u\n", _i, a->tag[_i]);
97  }
98  }
99  vl_print(handle, "count: %u\n", (unsigned) a->count);
100  vl_print(handle, "r ----- \n");
101  // FIXME vl_api_acl_rule_t_print(&a->r, handle);
102  vl_print(handle, "r ----- END \n");
103  return handle;
104 }
105 
106 static inline void *
107 vl_api_macip_acl_rule_t_print (vl_api_macip_acl_rule_t * a, void *handle)
108 {
109  vl_print (handle, "vl_api_macip_acl_rule_t:\n");
110  vl_print (handle, "is_permit: %u\n", (unsigned) a->is_permit);
111  vl_print (handle, "is_ipv6: %u\n", (unsigned) a->is_ipv6);
112  {
113  int _i;
114  for (_i = 0; _i < 6; _i++)
115  {
116  vl_print (handle, "src_mac[%d]: %u\n", _i, a->src_mac[_i]);
117  }
118  }
119  {
120  int _i;
121  for (_i = 0; _i < 6; _i++)
122  {
123  vl_print (handle, "src_mac_mask[%d]: %u\n", _i, a->src_mac_mask[_i]);
124  }
125  }
126  {
127  int _i;
128  for (_i = 0; _i < 16; _i++)
129  {
130  vl_print (handle, "src_ip_addr[%d]: %u\n", _i, a->src_ip_addr[_i]);
131  }
132  }
133  vl_print (handle, "src_ip_prefix_len: %u\n",
134  (unsigned) a->src_ip_prefix_len);
135  return handle;
136 }
137 
138 static inline void *
139 vl_api_macip_acl_add_t_print (vl_api_macip_acl_add_t * a, void *handle)
140 {
141  int i;
142  vl_print (handle, "vl_api_macip_acl_add_t:\n");
143  vl_print (handle, "_vl_msg_id: %u\n", (unsigned) a->_vl_msg_id);
144  vl_print (handle, "client_index: %u\n", (unsigned) a->client_index);
145  vl_print (handle, "context: %u\n", (unsigned) a->context);
146  vl_print (handle, "count: %u\n", (unsigned) a->count);
147  vl_print (handle, "r ----- \n");
148  for (i = 0; i < a->count; i++)
149  {
150  vl_print (handle, " r[%d]:\n", i);
151  vl_api_macip_acl_rule_t_print (&a->r[i], handle);
152  }
153  vl_print (handle, "r ----- END \n");
154  return handle;
155 }
156 
157 static inline void *vl_api_macip_acl_details_t_print (vl_api_macip_acl_details_t *a,void *handle)
158 {
159  int i;
160  vl_print(handle, "vl_api_macip_acl_details_t:\n");
161  vl_print(handle, "_vl_msg_id: %u\n", (unsigned) a->_vl_msg_id);
162  vl_print(handle, "context: %u\n", (unsigned) a->context);
163  vl_print(handle, "acl_index: %u\n", (unsigned) a->acl_index);
164  {
165  int _i;
166  for (_i = 0; _i < 64; _i++) {
167  vl_print(handle, "tag[%d]: %u\n", _i, a->tag[_i]);
168  }
169  }
170  vl_print(handle, "count: %u\n", (unsigned) a->count);
171  vl_print(handle, "r ----- \n");
172  for (i = 0; i < a->count; i++)
173  {
174  vl_print (handle, " r[%d]:\n", i);
175  vl_api_macip_acl_rule_t_print (&a->r[i], handle);
176  }
177  vl_print(handle, "r ----- END \n");
178  return handle;
179 }
180 
181 #endif /* vl_printfun */
182 
183 
184 #ifdef vl_endianfun
185 
186 #undef clib_net_to_host_uword
187 #ifdef LP64
188 #define clib_net_to_host_uword clib_net_to_host_u64
189 #else
190 #define clib_net_to_host_uword clib_net_to_host_u32
191 #endif
192 
193 /*
194  * Manual endian/print functions created by copypasting the automatically
195  * generated ones with small required adjustments. Appears the codegen
196  * can't make code to print the contents of custom-type array.
197  */
198 
199 static inline void
200 vl_api_acl_rule_t_endian (vl_api_acl_rule_t * a)
201 {
202  /* a->is_permit = a->is_permit (no-op) */
203  /* a->is_ipv6 = a->is_ipv6 (no-op) */
204  /* a->src_ip_addr[0..15] = a->src_ip_addr[0..15] (no-op) */
205  /* a->src_ip_prefix_len = a->src_ip_prefix_len (no-op) */
206  /* a->dst_ip_addr[0..15] = a->dst_ip_addr[0..15] (no-op) */
207  /* a->dst_ip_prefix_len = a->dst_ip_prefix_len (no-op) */
208  /* a->proto = a->proto (no-op) */
210  clib_net_to_host_u16 (a->srcport_or_icmptype_first);
212  clib_net_to_host_u16 (a->srcport_or_icmptype_last);
214  clib_net_to_host_u16 (a->dstport_or_icmpcode_first);
216  clib_net_to_host_u16 (a->dstport_or_icmpcode_last);
217  /* a->tcp_flags_mask = a->tcp_flags_mask (no-op) */
218  /* a->tcp_flags_value = a->tcp_flags_value (no-op) */
219 }
220 
221 static inline void
222 vl_api_acl_add_replace_t_endian (vl_api_acl_add_replace_t * a)
223 {
224  int i;
225  a->_vl_msg_id = clib_net_to_host_u16 (a->_vl_msg_id);
226  a->client_index = clib_net_to_host_u32 (a->client_index);
227  a->context = clib_net_to_host_u32 (a->context);
228  a->acl_index = clib_net_to_host_u32 (a->acl_index);
229  a->count = clib_net_to_host_u32 (a->count);
230  for (i = 0; i < a->count; i++)
231  {
232  vl_api_acl_rule_t_endian (&a->r[i]);
233  }
234 }
235 
236 static inline void vl_api_acl_details_t_endian (vl_api_acl_details_t *a)
237 {
238  int i;
239  a->_vl_msg_id = clib_net_to_host_u16(a->_vl_msg_id);
240  a->context = clib_net_to_host_u32(a->context);
241  a->acl_index = clib_net_to_host_u32(a->acl_index);
242  /* a->tag[0..63] = a->tag[0..63] (no-op) */
243  a->count = clib_net_to_host_u32(a->count);
244  for (i = 0; i < a->count; i++)
245  {
246  vl_api_acl_rule_t_endian (&a->r[i]);
247  }
248 }
249 
250 static inline void vl_api_acl_interface_list_details_t_endian (vl_api_acl_interface_list_details_t *a)
251 {
252  int i;
253  a->_vl_msg_id = clib_net_to_host_u16(a->_vl_msg_id);
254  a->context = clib_net_to_host_u32(a->context);
255  a->sw_if_index = clib_net_to_host_u32(a->sw_if_index);
256  /* a->count = a->count (no-op) */
257  /* a->n_input = a->n_input (no-op) */
258  for(i=0; i<a->count; i++) {
259  a->acls[i] = clib_net_to_host_u32(a->acls[i]);
260  }
261 }
262 
263 static inline void vl_api_acl_interface_set_acl_list_t_endian (vl_api_acl_interface_set_acl_list_t *a)
264 {
265  int i;
266  a->_vl_msg_id = clib_net_to_host_u16(a->_vl_msg_id);
267  a->client_index = clib_net_to_host_u32(a->client_index);
268  a->context = clib_net_to_host_u32(a->context);
269  a->sw_if_index = clib_net_to_host_u32(a->sw_if_index);
270  /* a->count = a->count (no-op) */
271  /* a->n_input = a->n_input (no-op) */
272  for(i=0; i<a->count; i++) {
273  a->acls[i] = clib_net_to_host_u32(a->acls[i]);
274  }
275 }
276 
277 static inline void
278 vl_api_macip_acl_rule_t_endian (vl_api_macip_acl_rule_t * a)
279 {
280  /* a->is_permit = a->is_permit (no-op) */
281  /* a->is_ipv6 = a->is_ipv6 (no-op) */
282  /* a->src_mac[0..5] = a->src_mac[0..5] (no-op) */
283  /* a->src_mac_mask[0..5] = a->src_mac_mask[0..5] (no-op) */
284  /* a->src_ip_addr[0..15] = a->src_ip_addr[0..15] (no-op) */
285  /* a->src_ip_prefix_len = a->src_ip_prefix_len (no-op) */
286 }
287 
288 static inline void
289 vl_api_macip_acl_add_t_endian (vl_api_macip_acl_add_t * a)
290 {
291  int i;
292  a->_vl_msg_id = clib_net_to_host_u16 (a->_vl_msg_id);
293  a->client_index = clib_net_to_host_u32 (a->client_index);
294  a->context = clib_net_to_host_u32 (a->context);
295  a->count = clib_net_to_host_u32 (a->count);
296  for (i = 0; i < a->count; i++)
297  {
298  vl_api_macip_acl_rule_t_endian (&a->r[i]);
299  }
300 }
301 
302 static inline void vl_api_macip_acl_details_t_endian (vl_api_macip_acl_details_t *a)
303 {
304  int i;
305  a->_vl_msg_id = clib_net_to_host_u16(a->_vl_msg_id);
306  a->context = clib_net_to_host_u32(a->context);
307  a->acl_index = clib_net_to_host_u32(a->acl_index);
308  /* a->tag[0..63] = a->tag[0..63] (no-op) */
309  a->count = clib_net_to_host_u32(a->count);
310  for (i = 0; i < a->count; i++)
311  {
312  vl_api_macip_acl_rule_t_endian (&a->r[i]);
313  }
314 }
315 
316 
317 
318 
319 #endif /* vl_printfun */
320 
321 
sll srl srl sll sra u16x4 i
Definition: vector_sse2.h:343
Set the vector of input/output ACLs checked for an interface.
Definition: acl.api:227
u8 tcp_flags_mask
Definition: acl.api:94
vl_api_macip_acl_rule_t r[count]
Definition: acl.api:322
u8 src_ip_addr[16]
Definition: acl.api:67
Access List Rule entry.
Definition: acl.api:63
u16 dstport_or_icmpcode_last
Definition: acl.api:88
Details about one MACIP ACL.
Definition: acl.api:412
u16 dstport_or_icmpcode_first
Definition: acl.api:87
u8 src_ip_prefix_len
Definition: acl.api:68
u8 tcp_flags_value
Definition: acl.api:95
Replace an existing ACL in-place or create a new ACL.
Definition: acl.api:135
Details about a single ACL contents.
Definition: acl.api:299
vl_api_acl_rule_t r[count]
Definition: acl.api:142
u8 dst_ip_addr[16]
Definition: acl.api:69
vl_api_acl_rule_t r[count]
Definition: acl.api:275
u16 srcport_or_icmptype_first
Definition: acl.api:85
u16 srcport_or_icmptype_last
Definition: acl.api:86
MACIP Access List Rule entry.
Definition: acl.api:107
u8 dst_ip_prefix_len
Definition: acl.api:70
vl_api_macip_acl_rule_t r[count]
Definition: acl.api:418
Details about a single ACL contents.
Definition: acl.api:269
#define vl_print(handle,...)
Definition: memory_client.c:59
Add a MACIP ACL.
Definition: acl.api:316