2 * Copyright (c) 2018 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_BOND_MEMBER_H__
17 #define __VOM_BOND_MEMBER_H__
19 #include "vom/interface.hpp"
20 #include <vapi/bond.api.vapi.hpp>
24 * A bond-member. e.g. a bond_member interface
30 * A member interface mode
32 struct mode_t : enum_base<mode_t>
35 * Active member interface mode
37 const static mode_t ACTIVE;
39 * Passive member interface mode
41 const static mode_t PASSIVE;
44 * Convert VPP's value of the bond to a mode
46 static const mode_t from_numeric_val(uint8_t v);
50 * Private constructor taking the value and the string name
52 mode_t(int v, const std::string& s);
56 * A member interface rate
58 struct rate_t : enum_base<rate_t>
61 * Fast member interface rate
63 const static rate_t FAST;
65 * SLOW member interface rate
67 const static rate_t SLOW;
70 * Convert VPP's value of the bond to a mode
72 static const rate_t from_numeric_val(uint8_t v);
76 * Private constructor taking the value and the string name
78 rate_t(int v, const std::string& s);
81 bond_member(const interface& itf, mode_t mode, rate_t rate);
84 bond_member(const bond_member& o);
89 void to_vpp(vapi_payload_bond_enslave& bond_enslave) const;
94 void set(mode_t mode);
99 void set(rate_t rate);
104 std::string to_string(void) const;
109 bool operator<(const bond_member& mem_itf) const;
112 * Get the interface handle
114 const handle_t hdl(void) const;
119 bool operator==(const bond_member& i) const;
123 * Refernece conter lock on the parent
125 const std::shared_ptr<interface> m_itf;
128 * passive vs active member
133 * slow 90sec. vs. fast 3sec timeout
140 * fd.io coding-style-patch-verification: ON
143 * eval: (c-set-style "mozilla")