Revised OpenFlow Library  v0.6.0dev
 All Classes Files Functions Variables Friends Groups Pages
cofmeterconfig.h
1 /*
2  * cofmeterconfig.h
3  *
4  * Created on: 26.05.2014
5  * Author: andi
6  */
7 
8 #ifndef COFMETERCONFIG_H_
9 #define COFMETERCONFIG_H_ 1
10 
11 #include "rofl/common/cmemory.h"
12 #include "rofl/common/openflow/openflow.h"
13 #include "rofl/common/openflow/openflow_rofl_exceptions.h"
14 #include "rofl/common/openflow/cofmeterbands.h"
15 
16 namespace rofl {
17 namespace openflow {
18 
22 
24 {
25 public:
30  uint8_t of_version = 0,
31  uint8_t *buf = (uint8_t*)0,
32  size_t buflen = 0);
33 
38  uint8_t of_version,
39  uint32_t port_no);
40 
41 
45  virtual
47 
48 
53  const cofmeter_config_request& meter_config_request);
54 
59  operator= (
60  const cofmeter_config_request& meter_config_request);
61 
65  const bool
66  operator== (
67  const cofmeter_config_request& meter_config_request) const;
68 
69 public:
70 
74  void
75  pack(uint8_t *buf, size_t buflen);
76 
77 
81  void
82  unpack(uint8_t *buf, size_t buflen);
83 
84 
88  size_t
89  length() const;
90 
91 public:
92 
96  void
97  set_version(uint8_t of_version) { this->of_version = of_version; };
98 
99 
103  uint8_t
104  get_version() const { return of_version; };
105 
106 
110  void
111  set_meter_id(uint32_t meter_id) { this->meter_id = meter_id; };
112 
116  uint32_t
117  get_meter_id() const { return meter_id; };
118 
119 public:
120 
121  friend std::ostream&
122  operator<< (std::ostream& os, cofmeter_config_request const& r) {
123  os << indent(0) << "<cofmeter_config_request >" << std::endl;
124  os << indent(2) << "<meter-id: 0x" << std::hex << (int)r.get_meter_id() << std::dec << " >" << std::endl;
125  return os;
126  };
127 
128 private: // data structures
129 
130  uint8_t of_version;
131  uint32_t meter_id;
132 };
133 
134 
135 
137 {
138 public:
143  uint8_t of_version = 0,
144  uint8_t *buf = (uint8_t*)0,
145  size_t buflen = 0);
146 
147 
152  uint8_t of_version,
153  uint16_t flags,
154  uint32_t meter_id,
155  const rofl::openflow::cofmeter_bands& mbands);
156 
157 
158 
162  virtual
164 
165 
170  const cofmeter_config_reply& meter_config_reply);
171 
176  operator= (
177  const cofmeter_config_reply& meter_config_reply);
178 
182  bool
183  operator== (
184  const cofmeter_config_reply& meter_config_reply);
185 
186 public:
187 
191  void
192  clear();
193 
197  size_t
198  length() const;
199 
203  void
204  pack(uint8_t *buf, size_t buflen);
205 
209  void
210  unpack(uint8_t *buf, size_t buflen);
211 
212 public:
213 
217  void
218  set_version(uint8_t of_version) { this->of_version = of_version; };
219 
223  uint8_t
224  get_version() const { return of_version; };
225 
229  void
230  set_flags(uint16_t flags) { this->flags = flags; };
231 
235  uint16_t
236  get_flags() const { return flags; };
237 
241  void
242  set_meter_id(uint32_t meter_id) { this->meter_id = meter_id; };
243 
247  uint32_t
248  get_meter_id() const { return meter_id; };
249 
254  set_meter_bands() { return mbands; };
255 
260  get_meter_bands() const { return mbands; };
261 
262 public:
263 
264  friend std::ostream&
265  operator<< (std::ostream& os, cofmeter_config_reply const& r) {
266  os << indent(0) << "<cofmeter_config_reply >" << std::endl;
267  os << std::hex;
268  os << indent(2) << "<flags: 0x" << (unsigned int)r.get_flags() << " >" << std::endl;
269  os << indent(2) << "<meter-id: 0x" << (unsigned int)r.get_meter_id() << " >" << std::endl;
270  os << std::dec;
271  { rofl::indent i(2); os << r.get_meter_bands(); }
272  return os;
273  };
274 
275 private: // data structures
276 
277  uint8_t of_version;
278  uint16_t flags;
279  uint32_t meter_id;
281 };
282 
284 
285 } /* end of namespace openflow */
286 } /* end of namespace rofl */
287 
288 #endif /* COFMETERCONFIG_H_ */
Definition: cofmeterbands.h:24
Definition: cofmeterconfig.h:136
Definition: cofmeterconfig.h:20
Definition: logging.h:76
Definition: cofmeterconfig.h:21
Definition: cofmeterconfig.h:23
Definition: cofmeterconfig.h:19
Definition: croflexception.h:27