FD.io VPP  v19.08.3-2-gbabecb413
Vector Packet Processing
igmp_listen_cmds.hpp
Go to the documentation of this file.
1 /*
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:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
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.
14  */
15 
16 #ifndef __VOM_IGMP_LISTEN_CMDS_H__
17 #define __VOM_IGMP_LISTEN_CMDS_H__
18 
19 #include "vom/dump_cmd.hpp"
20 #include "vom/igmp_listen.hpp"
21 #include "vom/rpc_cmd.hpp"
22 
23 #include <vapi/igmp.api.vapi.hpp>
24 
25 namespace VOM {
26 namespace igmp_listen_cmds {
27 
28 /**
29  * A functor class that binds the igmp group to the interface
30  */
31 class listen_cmd : public rpc_cmd<HW::item<bool>, vapi::Igmp_listen>
32 {
33 public:
34  /**
35  * Constructor
36  */
38  const handle_t& itf,
39  const boost::asio::ip::address_v4& gaddr,
40  const igmp_listen::src_addrs_t& saddrs);
41 
42  /**
43  * Issue the command to VPP/HW
44  */
45  rc_t issue(connection& con);
46  /**
47  * convert to string format for debug purposes
48  */
49  std::string to_string() const;
50 
51  /**
52  * Comparison operator - only used for UT
53  */
54  bool operator==(const listen_cmd& i) const;
55 
56 private:
57  /**
58  * Reference to the interface to bind to
59  */
60  const handle_t& m_itf;
61 
62  /**
63  * The igmp group to bind
64  */
65  const boost::asio::ip::address_v4& m_gaddr;
66 
67  /**
68  * The igmp srouce specific addresses to listen them
69  */
70  const igmp_listen::src_addrs_t& m_saddrs;
71 };
72 
73 /**
74  * A cmd class that Unbinds igmp group from an interface
75  */
76 class unlisten_cmd : public rpc_cmd<HW::item<bool>, vapi::Igmp_listen>
77 {
78 public:
79  /**
80  * Constructor
81  */
83  const handle_t& itf,
84  const boost::asio::ip::address_v4& gaddr);
85 
86  /**
87  * Issue the command to VPP/HW
88  */
89  rc_t issue(connection& con);
90 
91  /**
92  * convert to string format for debug purposes
93  */
94  std::string to_string() const;
95 
96  /**
97  * Comparison operator - only used for UT
98  */
99  bool operator==(const unlisten_cmd& i) const;
100 
101 private:
102  /**
103  * Reference to the interface to unbind
104  */
105  const handle_t& m_itf;
106 
107  /**
108  * The igmp group to unlisten
109  */
110  const boost::asio::ip::address_v4& m_gaddr;
111 };
112 
113 /**
114  * A cmd class that Dumps all the igmp configs
115  */
116 class dump_cmd : public VOM::dump_cmd<vapi::Igmp_dump>
117 {
118 public:
119  /**
120  * Constructor
121  */
122  dump_cmd(const handle_t& itf);
123  dump_cmd(const dump_cmd& d);
124 
125  /**
126  * Issue the command to VPP/HW
127  */
128  rc_t issue(connection& con);
129  /**
130  * convert to string format for debug purposes
131  */
132  std::string to_string() const;
133 
134  /**
135  * Comparison operator - only used for UT
136  */
137  bool operator==(const dump_cmd& i) const;
138 
139 private:
140  /**
141  * HW reutrn code
142  */
144 
145  /**
146  * The interface to get the igmp config for
147  */
148  const handle_t& m_itf;
149 };
150 
151 }; // namespace igmp_listen_cmds
152 }; // namespace VOM
153 
154 /*
155  * fd.io coding-style-patch-verification: ON
156  *
157  * Local Variables:
158  * eval: (c-set-style "mozilla")
159  * End:
160  */
161 
162 #endif
int i
Error codes that VPP will return during a HW write.
Definition: types.hpp:89
A functor class that binds the igmp group to the interface.
A representation of the connection to VPP.
Definition: connection.hpp:33
listen_cmd(HW::item< bool > &item, const handle_t &itf, const boost::asio::ip::address_v4 &gaddr, const igmp_listen::src_addrs_t &saddrs)
Constructor.
A base class for all RPC commands to VPP.
Definition: rpc_cmd.hpp:40
A cmd class that Unbinds igmp group from an interface.
std::set< boost::asio::ip::address_v4 > src_addrs_t
Definition: igmp_listen.hpp:34
A type declaration of an interface handle in VPP.
Definition: types.hpp:233
A cmd class that Dumps all the igmp configs.
rc_t issue(connection &con)
Issue the command to VPP/HW.
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
bool operator==(const listen_cmd &i) const
Comparison operator - only used for UT.
A base class for VPP dump commands.
Definition: dump_cmd.hpp:43
std::string to_string() const
convert to string format for debug purposes
HW::item< bool > & item()
return the HW item the command updates
Definition: rpc_cmd.hpp:66