Revised OpenFlow Library  v0.6.0dev
 All Classes Files Functions Variables Friends Groups Pages
cofaggrstats.h
1 /*
2  * cofflowstatsrequest.h
3  *
4  * Created on: 14.03.2013
5  * Author: andi
6  */
7 
8 #ifndef COFAGGRSTATS_H_
9 #define COFAGGRSTATS_H_ 1
10 
11 #include "rofl/common/cmemory.h"
12 #include "rofl/common/openflow/cofmatch.h"
13 #include "rofl/common/openflow/cofactions.h"
14 #include "rofl/common/openflow/cofinstructions.h"
15 #include "rofl/common/openflow/openflow.h"
16 #include "rofl/common/openflow/openflow_rofl_exceptions.h"
17 
18 namespace rofl {
19 namespace openflow {
20 
22 {
23 private: // data structures
24 
25  uint8_t of_version;
26  cofmatch match;
27  uint8_t table_id;
28  uint32_t out_port;
29  uint32_t out_group;
30  uint64_t cookie;
31  uint64_t cookie_mask;
32 
33  std::string info;
34 
35 public: // data structures
36 
37 
38 public:
43  uint8_t of_version = openflow::OFP_VERSION_UNKNOWN,
44  uint8_t *buf = (uint8_t*)0,
45  size_t buflen = 0);
46 
51  uint8_t of_version,
52  cofmatch const& match,
53  uint8_t table_id,
54  uint16_t out_port);
55 
56 
61  uint8_t of_version,
62  cofmatch const& match,
63  uint8_t table_id,
64  uint32_t out_port,
65  uint32_t out_group,
66  uint64_t cookie,
67  uint64_t cookie_mask);
68 
69 
73  virtual
75 
76 
81  cofaggr_stats_request const& flowstatsrequest);
82 
87  operator= (
88  cofaggr_stats_request const& flowstatsrequest);
89 
90 
94  void
95  pack(uint8_t *buf, size_t buflen);
96 
97 
101  void
102  unpack(uint8_t *buf, size_t buflen);
103 
104 
108  size_t
109  length() const;
110 
111 
115  void
116  set_version(uint8_t of_version);
117 
118 
122  uint8_t
123  get_version() const;
124 
125 
129  void
130  set_table_id(uint8_t table_id);
131 
132 
136  uint8_t
137  get_table_id() const;
138 
139 
143  void
144  set_out_port(uint32_t out_port);
145 
146 
150  uint32_t
151  get_out_port() const;
152 
153 
157  void
158  set_out_group(uint32_t out_group);
159 
160 
164  uint32_t
165  get_out_group() const;
166 
167 
168 
172  void
173  set_cookie(uint64_t cookie);
174 
175 
179  uint64_t
180  get_cookie() const;
181 
182 
186  void
187  set_cookie_mask(uint64_t cookie_mask);
188 
189 
193  uint64_t
194  get_cookie_mask() const;
195 
196 
200  cofmatch&
201  get_match();
202 
203 public:
204 
205  friend std::ostream&
206  operator<< (std::ostream& os, cofaggr_stats_request const& aggr_stats_request) {
207  switch (aggr_stats_request.get_version()) {
208  case rofl::openflow::OFP_VERSION_UNKNOWN: {
209  os << indent(0) << "<cofaggr_stats_request >" << std::endl;
210  } break;
211  case rofl::openflow10::OFP_VERSION: {
212  os << indent(0) << "<cofaggr_stats_request >" << std::endl;
213  os << indent(2) << "<table-id:" << (int)aggr_stats_request.get_table_id() << " >" << std::endl;
214  os << indent(2) << "<out-port:0x" << std::hex << (int)aggr_stats_request.get_out_port() << std::dec << " >" << std::endl;
215  indent i(2);
216  os << aggr_stats_request.match;
217 
218  } break;
219  case rofl::openflow12::OFP_VERSION: {
220  os << indent(0) << "<cofaggr_stats_request >" << std::endl;
221  os << indent(2) << "<table-id:" << (int)aggr_stats_request.get_table_id() << " >" << std::endl;
222  os << indent(2) << "<out-port:0x" << std::hex << (int)aggr_stats_request.get_out_port() << std::dec << " >" << std::endl;
223  os << indent(2) << "<out-group:0x" << std::hex << (int)aggr_stats_request.get_out_group() << std::dec << " >" << std::endl;
224  os << indent(2) << "<cookie:0x" << std::hex << (unsigned long long)aggr_stats_request.get_cookie() << std::dec << " >" << std::endl;
225  os << indent(2) << "<cookie-mask:0x" << std::hex << (unsigned long long)aggr_stats_request.get_cookie_mask() << std::dec << " >" << std::endl;
226  indent i(2);
227  os << aggr_stats_request.match;
228 
229  } break;
230  case rofl::openflow13::OFP_VERSION: {
231  os << indent(0) << "<cofaggr_stats_request >" << std::endl;
232  os << indent(2) << "<table-id:" << (int)aggr_stats_request.get_table_id() << " >" << std::endl;
233  os << indent(2) << "<out-port:0x" << std::hex << (int)aggr_stats_request.get_out_port() << std::dec << " >" << std::endl;
234  os << indent(2) << "<out-group:0x" << std::hex << (int)aggr_stats_request.get_out_group() << std::dec << " >" << std::endl;
235  os << indent(2) << "<cookie:0x" << std::hex << (unsigned long long)aggr_stats_request.get_cookie() << std::dec << " >" << std::endl;
236  os << indent(2) << "<cookie-mask:0x" << std::hex << (unsigned long long)aggr_stats_request.get_cookie_mask() << std::dec << " >" << std::endl;
237  indent i(2);
238  os << aggr_stats_request.match;
239 
240  } break;
241  default: {
242  throw eBadVersion();
243  };
244  }
245  return os;
246  };
247 };
248 
249 
250 
252 {
253 private: // data structures
254 
255  uint8_t of_version;
256  uint64_t packet_count;
257  uint64_t byte_count;
258  uint32_t flow_count;
259 
260 public: // data structures
261 
262 
263 public:
268  uint8_t of_version = 0,
269  uint8_t *buf = (uint8_t*)0,
270  size_t buflen = 0);
271 
272 
277  uint8_t of_version,
278  uint64_t packet_count,
279  uint64_t byte_count,
280  uint32_t flow_count);
281 
282 
286  virtual
288 
289 
294  cofaggr_stats_reply const& aggrstats);
295 
300  operator= (
301  cofaggr_stats_reply const& aggrstats);
302 
303 
307  void
308  pack(uint8_t *buf, size_t buflen);
309 
310 
314  void
315  unpack(uint8_t *buf, size_t buflen);
316 
317 
321  size_t
322  length() const;
323 
324 
328  void
329  set_version(uint8_t of_version);
330 
331 
335  uint8_t
336  get_version() const;
337 
338 
342  uint64_t
343  get_packet_count() const;
344 
345 
349  uint64_t
350  get_byte_count() const;
351 
352 
356  uint32_t
357  get_flow_count() const;
358 
359 
363  void
364  set_packet_count(uint64_t packet_count);
365 
366 
370  void
371  set_byte_count(uint64_t byte_count);
372 
373 
377  void
378  set_flow_count(uint32_t flow_count);
379 
380 public:
381 
382  friend std::ostream&
383  operator<< (std::ostream& os, cofaggr_stats_reply const& reply) {
384  switch (reply.get_version()) {
385  case rofl::openflow::OFP_VERSION_UNKNOWN: {
386  os << indent(0) << "<cofaggr_stats_reply >" << std::endl;
387  } break;
388  case rofl::openflow10::OFP_VERSION:
389  case rofl::openflow12::OFP_VERSION:
390  case rofl::openflow13::OFP_VERSION: {
391  os << indent(0) << "<cofaggr_stats_reply >" << std::endl;
392  os << indent(2) << "<packet-count:" << (int)reply.get_packet_count() << " >" << std::endl;
393  os << indent(2) << "<byte-count:" << (int)reply.get_byte_count() << " >" << std::endl;
394  os << indent(2) << "<flow-count:" << (int)reply.get_flow_count() << " >" << std::endl;
395  } break;
396  default: {
397  throw eBadVersion();
398  };
399  }
400  return os;
401  };
402 };
403 
404 
405 } /* end of namespace openflow */
406 } /* end of namespace rofl */
407 
408 #endif /* COFAGGRSTATS_H_ */
Definition: croflexception.h:73
Definition: cofmatch.h:35
Definition: logging.h:76
Definition: cofaggrstats.h:251
Definition: cofaggrstats.h:21