Revised OpenFlow Library  v0.6.0dev
 All Classes Files Functions Variables Friends Groups Pages
cofasyncconfig.h
1 /*
2  * cofasyncconfig.h
3  *
4  * Created on: 18.03.2014
5  * Author: andreas
6  */
7 
8 #ifndef COFASYNCCONFIG_H_
9 #define COFASYNCCONFIG_H_
10 
11 #include <inttypes.h>
12 
13 #include <map>
14 #include <iostream>
15 
16 #include "rofl/common/logging.h"
17 #include "rofl/common/croflexception.h"
18 #include "rofl/common/openflow/openflow.h"
19 #include "rofl/common/openflow/openflow_rofl_exceptions.h"
20 
21 namespace rofl {
22 namespace openflow {
23 
25 
26  uint8_t ofp_version;
27  std::map<uint8_t, uint32_t> packet_in_mask;
28  std::map<uint8_t, uint32_t> port_status_mask;
29  std::map<uint8_t, uint32_t> flow_removed_mask;
30 
31 public:
32 
33  struct async_config_t {
34  uint32_t packet_in_mask[2]; /* Bitmasks of OFPR_* values. */
35  uint32_t port_status_mask[2]; /* Bitmasks of OFPPR_* values. */
36  uint32_t flow_removed_mask[2]; /* Bitmasks of OFPRR_* values. */
37  };
38 
39 public:
40 
45  uint8_t ofp_version = rofl::openflow::OFP_VERSION_UNKNOWN);
46 
50  virtual
51  ~cofasync_config();
52 
57  cofasync_config const& async_config);
58 
63  operator= (
64  cofasync_config const& async_config);
65 
66 
67 public:
68 
72  void
73  clear();
74 
78  virtual size_t
79  length() const;
80 
84  virtual void
85  pack(uint8_t* buf, size_t buflen);
86 
90  virtual void
91  unpack(uint8_t* buf, size_t buflen);
92 
93 public:
94 
98  uint8_t
99  get_version() const { return ofp_version; };
100 
104  void
105  set_version(uint8_t ofp_version) { this->ofp_version = ofp_version; };
106 
110  uint32_t const&
111  get_packet_in_mask_master() const;
112 
116  void
117  set_packet_in_mask_master(uint32_t packet_in_mask_master);
118 
122  uint32_t&
123  set_packet_in_mask_master();
124 
128  uint32_t const&
129  get_packet_in_mask_slave() const;
130 
134  void
135  set_packet_in_mask_slave(uint32_t packet_in_mask_slave);
136 
140  uint32_t&
141  set_packet_in_mask_slave();
142 
143 
147  uint32_t const&
148  get_port_status_mask_master() const;
149 
153  void
154  set_port_status_mask_master(uint32_t port_status_mask_master);
155 
159  uint32_t&
160  set_port_status_mask_master();
161 
165  uint32_t const&
166  get_port_status_mask_slave() const;
167 
171  void
172  set_port_status_mask_slave(uint32_t port_status_mask_slave);
173 
177  uint32_t&
178  set_port_status_mask_slave();
179 
180 
184  uint32_t const&
185  get_flow_removed_mask_master() const;
186 
190  void
191  set_flow_removed_mask_master(uint32_t flow_removed_mask_master);
192 
196  uint32_t&
197  set_flow_removed_mask_master();
198 
202  uint32_t const&
203  get_flow_removed_mask_slave() const;
204 
208  void
209  set_flow_removed_mask_slave(uint32_t flow_removed_mask_slave);
210 
214  uint32_t&
215  set_flow_removed_mask_slave();
216 
217 
218 public:
219 
223  friend std::ostream&
224  operator<< (std::ostream& os, cofasync_config const& async_config) {
225  os << rofl::indent(0) << "<cofasync_config ofp-version:" << (int)async_config.get_version() << " >" << std::endl;
226  os << std::hex;
227  os << rofl::indent(2) << "<packet-in-mask[EQUAL|MASTER]: 0x" <<
228  (int)async_config.get_packet_in_mask_master() << " >" << std::endl;
229  os << rofl::indent(2) << "<packet-in-mask[SLAVE]: 0x" <<
230  (int)async_config.get_packet_in_mask_slave() << " >" << std::endl;
231  os << rofl::indent(2) << "<port-status-mask[EQUAL|MASTER]: 0x" <<
232  (int)async_config.get_port_status_mask_master() << " >" << std::endl;
233  os << rofl::indent(2) << "<port-status-mask[SLAVE]: 0x" <<
234  (int)async_config.get_port_status_mask_slave() << " >" << std::endl;
235  os << rofl::indent(2) << "<flow-removed-mask[EQUAL|MASTER]: 0x" <<
236  (int)async_config.get_flow_removed_mask_master() << " >" << std::endl;
237  os << rofl::indent(2) << "<flow-removed-mask[SLAVE]: 0x" <<
238  (int)async_config.get_flow_removed_mask_slave() << " >" << std::endl;
239  os << std::dec;
240  return os;
241  };
242 };
243 
244 }; // end of namespace openflow
245 }; // end of namespace rofl
246 
247 
248 
249 
250 #endif /* COFASYNCCONFIG_H_ */
Definition: cofasyncconfig.h:24
Definition: logging.h:76