api: add missing version info
[vpp.git] / src / plugins / acl / acl_types.api
1 /* Hey Emacs use -*- mode: C -*- */
2 /*
3  * Copyright (c) 2016 Cisco and/or its affiliates.
4  * Copyright 2019 Vinci Consulting Corp.  All Rights Reserved.
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at:
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 option version = "1.0.0";
18
19 import "vnet/ip/ip_types.api";
20 import "vnet/ethernet/ethernet_types.api";
21
22 enum acl_action : u8
23 {
24   ACL_ACTION_API_DENY = 0,
25   ACL_ACTION_API_PERMIT = 1,
26   ACL_ACTION_API_PERMIT_REFLECT = 2,
27 };
28
29 /** \brief Access List Rule entry
30     @param is_permit - deny (0), permit (1), or permit+reflect(2) action on this rule.
31     @param src_prefix - Source prefix
32     @param dst_prefix - Destination prefix
33     @param proto - L4 protocol (http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml)
34     @param srcport_or_icmptype_first - beginning of source port or ICMP4/6 type range
35     @param srcport_or_icmptype_last - end of source port or ICMP4/6 type range
36     @param dstport_or_icmpcode_first - beginning of destination port or ICMP4/6 code range
37     @param dstport_or_icmpcode_last - end of destination port or ICMP4/6 code range
38     @param tcp_flags_mask - if proto==6, match masked TCP flags with this value
39     @param tcp_flags_value - if proto==6, mask to AND the TCP flags in the packet with
40 */
41
42 typedef acl_rule
43 {
44   vl_api_acl_action_t is_permit;
45   vl_api_prefix_t src_prefix;
46   vl_api_prefix_t dst_prefix;
47 /*
48  * L4 protocol. IANA number. 1 = ICMP, 58 = ICMPv6, 6 = TCP, 17 = UDP.
49  * 0 => ignore L4 and ignore the ports/tcpflags when matching.
50  */
51   vl_api_ip_proto_t proto;
52 /*
53  * If the L4 protocol is TCP or UDP, the below
54  * hold ranges of ports, else if the L4 is ICMP/ICMPv6
55  * they hold ranges of ICMP(v6) types/codes.
56  *
57  * Ranges are inclusive, i.e. to match "any" TCP/UDP port,
58  * use first=0,last=65535. For ICMP(v6),
59  * use first=0,last=255.
60  */
61   u16 srcport_or_icmptype_first;
62   u16 srcport_or_icmptype_last;
63   u16 dstport_or_icmpcode_first;
64   u16 dstport_or_icmpcode_last;
65 /*
66  * for proto = 6, this matches if the
67  * TCP flags in the packet, ANDed with tcp_flags_mask,
68  * is equal to tcp_flags_value.
69  */
70   u8 tcp_flags_mask;
71   u8 tcp_flags_value;
72 };
73
74
75 /** \brief MACIP Access List Rule entry
76     @param is_permit - deny (0), permit (1) action on this rule.
77     @param src_mac - match masked source MAC address against this value
78     @param src_mac_mask - AND source MAC address with this value before matching
79     @param src_prefix - Source prefix value
80 */
81
82 typedef macip_acl_rule
83 {
84   vl_api_acl_action_t is_permit;
85 /*
86  * The source mac of the packet ANDed with src_mac_mask.
87  * The source ip[46] address in the packet is matched
88  * against src_prefix set to 0.
89  *
90  * For better performance, minimize the number of
91  * (src_mac_mask, src_prefix.len) combinations
92  * in a MACIP ACL.
93  */
94   vl_api_mac_address_t src_mac;
95   vl_api_mac_address_t src_mac_mask;
96   vl_api_prefix_t src_prefix;
97 };