Revised OpenFlow Library  v0.6.0dev
 All Classes Files Functions Variables Friends Groups Pages
cofqueuestats.h
1 /*
2  * cofqueuestats.h
3  *
4  * Created on: 14.03.2013
5  * Author: andi
6  */
7 
8 #ifndef COFQUEUESTATS_H_
9 #define COFQUEUESTATS_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 
15 namespace rofl {
16 namespace openflow {
17 
18 class eQueueStatsBase : public RoflException {};
21 
23 {
24 private: // data structures
25 
26  uint8_t of_version;
27  uint32_t port_no;
28  uint32_t queue_id;
29 
30 public: // data structures
31 
32 
33 public:
38  uint8_t of_version = 0);
39 
44  uint8_t of_version,
45  uint32_t port_no,
46  uint32_t queue_id);
47 
51  virtual
53 
54 
59  cofqueue_stats_request const& stats);
60 
65  operator= (
66  cofqueue_stats_request const& stats);
67 
68 
72  void
73  pack(uint8_t *buf, size_t buflen) const;
74 
78  void
79  unpack(uint8_t *buf, size_t buflen);
80 
81 
85  size_t
86  length() const;
87 
88 
89 public:
90 
91 
95  void
96  set_version(uint8_t of_version) { this->of_version = of_version; };
97 
98 
102  uint8_t
103  get_version() const { return of_version; };
104 
105 
109  uint32_t
110  get_port_no() const { return port_no; };
111 
112 
116  uint32_t
117  get_queue_id() const { return queue_id; };
118 
119 
123  void
124  set_port_no(uint32_t port_no) { this->port_no = port_no; };
125 
126 
130  void
131  set_queue_id(uint32_t queue_id) { this->queue_id = queue_id; };
132 
133 public:
134 
135  friend std::ostream&
136  operator<< (std::ostream& os, cofqueue_stats_request const& r) {
137  os << indent(0) << "<cofqueue_stats_request >" << std::endl;
138  os << indent(2) << "<port-no: 0x" << std::hex << (int)r.get_port_no() << std::dec << " >" << std::endl;
139  os << indent(2) << "<queue-id: " << (int)r.get_queue_id() << " >" << std::endl;
140  return os;
141  };
142 };
143 
144 
145 
147 {
148 private: // data structures
149 
150  uint8_t of_version;
151  uint32_t port_no;
152  uint32_t queue_id;
153  uint64_t tx_bytes;
154  uint64_t tx_packets;
155  uint64_t tx_errors;
156  uint32_t duration_sec;
157  uint32_t duration_nsec;
158 
159 public: // data structures
160 
161 
162 public:
167  uint8_t of_version = 0);
168 
173  uint8_t of_version,
174  uint32_t port_no,
175  uint32_t queue_id,
176  uint64_t tx_bytes,
177  uint64_t tx_packets,
178  uint64_t tx_errors,
179  uint32_t duration_sec,
180  uint32_t duration_nsec);
181 
185  virtual
187 
188 
193  cofqueue_stats_reply const& stats);
194 
199  operator= (
200  cofqueue_stats_reply const& stats);
201 
202 
206  bool
207  operator== (
208  cofqueue_stats_reply const& stats);
209 
213  void
214  pack(uint8_t *buf, size_t buflen) const;
215 
219  void
220  unpack(uint8_t *buf, size_t buflen);
221 
222 
226  size_t
227  length() const;
228 
229 
230 public:
231 
232 
236  void
237  set_version(uint8_t of_version) { this->of_version = of_version; };
238 
239 
243  uint8_t
244  get_version() const { return of_version; };
245 
246 
250  uint32_t
251  get_port_no() const { return port_no; };
252 
256  uint32_t
257  get_queue_id() const { return queue_id; };
258 
262  uint64_t
263  get_tx_bytes() const { return tx_bytes; };
264 
268  uint64_t
269  get_tx_packets() const { return tx_packets; };
270 
274  uint64_t
275  get_tx_errors() const { return tx_errors; };
276 
280  uint32_t
281  get_duration_sec() const { return duration_sec; };
282 
286  uint32_t
287  get_duration_nsec() const { return duration_nsec; };
288 
292  void
293  set_port_no(uint32_t port_no) { this->port_no = port_no; };
294 
298  void
299  set_queue_id(uint32_t queue_id) { this->queue_id = queue_id; };
300 
304  void
305  set_tx_bytes(uint64_t tx_bytes) { this->tx_bytes = tx_bytes; };
306 
310  void
311  set_tx_packets(uint64_t tx_packets) { this->tx_packets = tx_packets; };
312 
316  void
317  set_tx_errors(uint64_t tx_errors) { this->tx_errors = tx_errors; };
318 
322  void
323  set_duration_sec(uint32_t duration_sec) { this->duration_sec = duration_sec; };
324 
328  void
329  set_duration_nsec(uint32_t duration_nsec) { this->duration_nsec = duration_nsec; };
330 
331 public:
332 
333  friend std::ostream&
334  operator<< (std::ostream& os, cofqueue_stats_reply const& r) {
335  os << indent(0) << "<cofqueue_stats_reply >" << std::endl;
336  os << std::hex;
337  os << indent(2) << "<port-no: 0x" << (int)r.get_port_no() << " >" << std::endl;
338  os << indent(2) << "<queue-id: 0x" << (int)r.get_queue_id() << " >" << std::endl;
339  os << indent(2) << "<tx-packets: 0x" << (unsigned long long)r.get_tx_packets() << " >" << std::endl;
340  os << indent(2) << "<tx-bytes: 0x" << (unsigned long long)r.get_tx_bytes() << " >" << std::endl;
341  os << indent(2) << "<tx-errors: 0x" << (unsigned long long)r.get_tx_errors() << " >" << std::endl;
342  os << std::dec;
343  switch (r.get_version()) {
344  case rofl::openflow13::OFP_VERSION: {
345  os << indent(2) << "<duration-sec: " << (unsigned long long)r.get_duration_sec() << " >" << std::endl;
346  os << indent(2) << "<duration-nsec: " << (unsigned long long)r.get_duration_nsec() << " >" << std::endl;
347  } break;
348  default: {
349  };
350  }
351  return os;
352  };
353 };
354 
355 }
356 }
357 
358 #endif /* COFQUEUESTATS_H_ */
Definition: cofqueuestats.h:146
Definition: cofqueuestats.h:20
Definition: cofqueuestats.h:19
Definition: cofqueuestats.h:18
Definition: logging.h:76
Definition: cofqueuestats.h:22
Definition: croflexception.h:27