api acl: breakout acl_types.api for reuse by others
[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
18  
19 /** \brief Access List Rule entry
20     @param is_permit - deny (0), permit (1), or permit+reflect(2) action on this rule.
21     @param is_ipv6   - IP addresses in this rule are IPv6 (1) or IPv4 (0)
22     @param src_ip_addr - Source prefix value
23     @param src_ip_prefix_len - Source prefix length
24     @param dst_ip_addr - Destination prefix value
25     @param dst_ip_prefix_len - Destination prefix length
26     @param proto - L4 protocol (http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml)
27     @param srcport_or_icmptype_first - beginning of source port or ICMP4/6 type range
28     @param srcport_or_icmptype_last - end of source port or ICMP4/6 type range
29     @param dstport_or_icmpcode_first - beginning of destination port or ICMP4/6 code range
30     @param dstport_or_icmpcode_last - end of destination port or ICMP4/6 code range
31     @param tcp_flags_mask - if proto==6, match masked TCP flags with this value
32     @param tcp_flags_value - if proto==6, mask to AND the TCP flags in the packet with
33 */
34
35 typeonly manual_print define acl_rule
36 {
37   u8 is_permit;
38   u8 is_ipv6;
39   u8 src_ip_addr[16];
40   u8 src_ip_prefix_len;
41   u8 dst_ip_addr[16];
42   u8 dst_ip_prefix_len;
43 /*
44  * L4 protocol. IANA number. 1 = ICMP, 58 = ICMPv6, 6 = TCP, 17 = UDP.
45  * 0 => ignore L4 and ignore the ports/tcpflags when matching.
46  */
47   u8 proto;
48 /*
49  * If the L4 protocol is TCP or UDP, the below
50  * hold ranges of ports, else if the L4 is ICMP/ICMPv6
51  * they hold ranges of ICMP(v6) types/codes.
52  *
53  * Ranges are inclusive, i.e. to match "any" TCP/UDP port,
54  * use first=0,last=65535. For ICMP(v6),
55  * use first=0,last=255.
56  */
57   u16 srcport_or_icmptype_first;
58   u16 srcport_or_icmptype_last;
59   u16 dstport_or_icmpcode_first;
60   u16 dstport_or_icmpcode_last;
61 /*
62  * for proto = 6, this matches if the
63  * TCP flags in the packet, ANDed with tcp_flags_mask,
64  * is equal to tcp_flags_value.
65  */
66   u8 tcp_flags_mask;
67   u8 tcp_flags_value;
68 };
69
70
71 /** \brief MACIP Access List Rule entry
72     @param is_permit - deny (0), permit (1) action on this rule.
73     @param is_ipv6   - IP addresses in this rule are IPv6 (1) or IPv4 (0)
74     @param src_mac - match masked source MAC address against this value
75     @param src_mac_mask - AND source MAC address with this value before matching
76     @param src_ip_addr - Source prefix value
77     @param src_ip_prefix_len - Source prefix length
78 */
79
80 typeonly manual_print define macip_acl_rule
81 {
82   u8 is_permit;
83   u8 is_ipv6;
84 /*
85  * The source mac of the packet ANDed with src_mac_mask.
86  * The source ip[46] address in the packet is matched
87  * against src_ip_addr, with src_ip_prefix_len set to 0.
88  *
89  * For better performance, minimize the number of
90  * (src_mac_mask, src_ip_prefix_len) combinations
91  * in a MACIP ACL.
92  */
93   u8 src_mac[6];
94   u8 src_mac_mask[6];
95   u8 src_ip_addr[16];
96   u8 src_ip_prefix_len;
97 };
98
99