2 * Copyright (c) 2017 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 __VOM_L2_ACL_RULE_H__
17 #define __VOM_L2_ACL_RULE_H__
19 #include "vom/acl_types.hpp"
20 #include "vom/prefix.hpp"
22 #include <vapi/acl.api.vapi.hpp>
27 * An ACL rule is the building block of an ACL. An ACL, which is
28 * the object applied to an interface, is comprised of an ordersed
29 * sequence of ACL rules.
30 * This class is a wrapper around the VAPI generated struct and exports
31 * an API with better types.
37 * Construct a new object matching the desried state
39 l2_rule(uint32_t priority,
40 const action_t& action,
41 const route::prefix_t& ip,
42 const mac_address_t& mac,
43 const mac_address_t& mac_mask);
48 l2_rule(const l2_rule& o) = default;
56 * convert to string format for debug purposes
58 std::string to_string() const;
63 bool operator<(const l2_rule& rule) const;
66 * comparison operator (for testing)
68 bool operator==(const l2_rule& rule) const;
71 * Convert to VPP API fromat
73 void to_vpp(vapi_type_macip_acl_rule& rule) const;
77 * Priority. Used to sort the rules in a list in the order
78 * in which they are applied
90 route::prefix_t m_src_ip;
100 mac_address_t m_mac_mask;
106 * fd.io coding-style-patch-verification: ON
109 * eval: (c-set-style "mozilla")