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"
25 * An ACL rule is the building block of an ACL. An ACL, which is
26 * the object applied to an interface, is comprised of an ordersed
27 * sequence of ACL rules.
28 * This class is a wrapper around the VAPI generated struct and exports
29 * an API with better types.
35 * Construct a new object matching the desried state
37 l2_rule(uint32_t priority,
38 const action_t& action,
39 const route::prefix_t& ip,
40 const mac_address_t& mac,
41 const mac_address_t& mac_mask);
46 l2_rule(const l2_rule& o) = default;
54 * convert to string format for debug purposes
56 std::string to_string() const;
61 bool operator<(const l2_rule& rule) const;
64 * comparison operator (for testing)
66 bool operator==(const l2_rule& rule) const;
71 uint32_t priority() const;
72 const action_t& action() const;
73 const route::prefix_t& src_ip() const;
74 const mac_address_t& mac() const;
75 const mac_address_t& mac_mask() const;
79 * Priority. Used to sort the rules in a list in the order
80 * in which they are applied
92 route::prefix_t m_src_ip;
102 mac_address_t m_mac_mask;
108 * fd.io coding-style-patch-verification: ON
111 * eval: (c-set-style "mozilla")