Revised OpenFlow Library  v0.6.0dev
 All Classes Files Functions Variables Friends Groups Pages
cofmeterstats.h
1 /*
2  * cofmeterstats.h
3  *
4  * Created on: 26.05.2014
5  * Author: andi
6  */
7 
8 #ifndef COFMETERSTATS_H_
9 #define COFMETERSTATS_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/cofmeterbandstatsarray.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_stats_request& meter_stats_request);
54 
59  operator= (
60  const cofmeter_stats_request& meter_stats_request);
61 
65  const bool
66  operator== (
67  const cofmeter_stats_request& meter_stats_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_stats_request const& r) {
123  os << indent(0) << "<cofmeter_stats_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  uint32_t meter_id,
154  uint32_t flow_count,
155  uint64_t packet_in_count,
156  uint64_t byte_in_count,
157  uint32_t durarion_sec,
158  uint32_t duration_nsec,
160 
161 
162 
166  virtual
168 
169 
174  const cofmeter_stats_reply& meter_stats_reply);
175 
180  operator= (
181  const cofmeter_stats_reply& meter_stats_reply);
182 
186  bool
187  operator== (
188  const cofmeter_stats_reply& meter_stats_reply);
189 
190 public:
191 
195  void
196  clear();
197 
201  size_t
202  length() const;
203 
207  void
208  pack(uint8_t *buf, size_t buflen);
209 
213  void
214  unpack(uint8_t *buf, size_t buflen);
215 
216 public:
217 
222  set_meter_band_stats() { return mbstats; };
223 
228  get_meter_band_stats() const { return mbstats; };
229 
233  void
234  set_version(uint8_t of_version) { this->of_version = of_version; };
235 
239  uint8_t
240  get_version() const { return of_version; };
241 
245  void
246  set_meter_id(uint32_t meter_id) { this->meter_id = meter_id; };
247 
251  uint32_t
252  get_meter_id() const { return meter_id; };
253 
257  void
258  set_flow_count(uint32_t flow_count) { this->flow_count = flow_count; };
259 
263  uint32_t
264  get_flow_count() const { return flow_count; };
265 
269  void
270  set_packet_in_count(uint64_t packet_in_count) { this->packet_in_count = packet_in_count; };
271 
275  uint64_t
276  get_packet_in_count() const { return packet_in_count; };
277 
281  void
282  set_byte_in_count(uint64_t byte_in_count) { this->byte_in_count = byte_in_count; };
283 
287  uint64_t
288  get_byte_in_count() const { return byte_in_count; };
289 
293  void
294  set_duration_sec(uint32_t duration_sec) { this->duration_sec = duration_sec; };
295 
299  uint32_t
300  get_duration_sec() const { return duration_sec; };
301 
305  void
306  set_duration_nsec(uint32_t duration_nsec) { this->duration_nsec = duration_nsec; };
307 
311  uint32_t
312  get_duration_nsec() const { return duration_nsec; };
313 
314 public:
315 
316  friend std::ostream&
317  operator<< (std::ostream& os, cofmeter_stats_reply const& r) {
318  os << indent(0) << "<cofmeter_stats_reply >" << std::endl;
319  os << std::hex;
320  os << indent(2) << "<meter-id: 0x" << (unsigned int)r.get_meter_id() << " >" << std::endl;
321  os << indent(2) << "<flow-count: 0x" << (unsigned int)r.get_flow_count() << " >" << std::endl;
322  os << indent(2) << "<packet-in-count: 0x" << (unsigned long long)r.get_packet_in_count() << " >" << std::endl;
323  os << indent(2) << "<byte-in-count: 0x" << (unsigned long long)r.get_byte_in_count() << " >" << std::endl;
324  os << indent(2) << "<duration-sec: 0x" << (unsigned long long)r.get_duration_sec() << " >" << std::endl;
325  os << indent(2) << "<duration-nsec: 0x" << (unsigned long long)r.get_duration_nsec() << " >" << std::endl;
326  os << std::dec;
327  { rofl::indent i(2); os << r.get_meter_band_stats(); }
328  return os;
329  };
330 
331 private: // data structures
332 
333  uint8_t of_version;
334  uint32_t meter_id;
335  uint32_t flow_count;
336  uint64_t packet_in_count;
337  uint64_t byte_in_count;
338  uint32_t duration_sec;
339  uint32_t duration_nsec;
341 };
342 
344 
345 } /* end of namespace openflow */
346 } /* end of namespace rofl */
347 
348 #endif /* COFMETERSTATS_H_ */
Definition: cofmeterstats.h:19
Definition: cofmeterbandstatsarray.h:23
Definition: cofmeterstats.h:136
Definition: logging.h:76
Definition: cofmeterstats.h:20
Definition: croflexception.h:27
Definition: cofmeterstats.h:23
Definition: cofmeterstats.h:21