Revised OpenFlow Library  v0.6.0dev
 All Classes Files Functions Variables Friends Groups Pages
cofmsg_flow_stats.h
1 /*
2  * cofmsg_flow_stats.h
3  *
4  * Created on: 18.03.2013
5  * Author: andi
6  */
7 
8 #ifndef COFMSG_FLOW_STATS_H_
9 #define COFMSG_FLOW_STATS_H_ 1
10 
11 #include <vector>
12 
13 #include "rofl/common/openflow/messages/cofmsg_stats.h"
14 #include "rofl/common/openflow/cofflowstats.h"
15 #include "rofl/common/openflow/cofflowstatsarray.h"
16 
17 
18 namespace rofl {
19 namespace openflow {
20 
21 //
22 // TODO: arrays of flow-stats !!!
23 //
24 
25 
31 {
32 private:
33 
34  cofflow_stats_request flow_stats;
35 
36  union {
37  uint8_t* ofhu_flow_stats;
38  struct rofl::openflow10::ofp_flow_stats* ofhu10_flow_stats;
39  struct rofl::openflow12::ofp_flow_stats* ofhu12_flow_stats;
40  struct rofl::openflow13::ofp_flow_stats* ofhu13_flow_stats;
41  } ofhu;
42 
43 #define ofh_flow_stats ofhu.ofhu_flow_stats
44 #define ofh10_flow_stats ofhu.ofhu10_flow_stats
45 #define ofh12_flow_stats ofhu.ofhu12_flow_stats
46 #define ofh13_flow_stats ofhu.ofhu13_flow_stats
47 
48 public:
49 
50 
55  uint8_t of_version = 0,
56  uint32_t xid = 0,
57  uint16_t flags = 0,
58  cofflow_stats_request const& flow_stats = cofflow_stats_request());
59 
60 
65  cofmsg_flow_stats_request const& stats);
66 
67 
72  operator= (
73  cofmsg_flow_stats_request const& stats);
74 
75 
79  virtual
81 
82 
87 
88 
92  virtual void
93  reset();
94 
95 
99  virtual uint8_t*
100  resize(size_t len);
101 
102 
106  virtual size_t
107  length() const;
108 
109 
113  virtual void
114  pack(uint8_t *buf = (uint8_t*)0, size_t buflen = 0);
115 
116 
120  virtual void
121  unpack(uint8_t *buf, size_t buflen);
122 
123 
126  virtual void
127  validate();
128 
129 
130 public:
131 
132 
137  set_flow_stats();
138 
139 
143  cofflow_stats_request const&
144  get_flow_stats() const;
145 
146 
147 public:
148 
149  friend std::ostream&
150  operator<< (std::ostream& os, cofmsg_flow_stats_request const& msg) {
151  os << dynamic_cast<cofmsg const&>( msg );
152  os << indent(2) << "<cofmsg_flow_stats_request >" << std::endl;
153  indent i(4);
154  os << msg.flow_stats;
155  return os;
156  };
157 };
158 
159 
160 
165  public cofmsg_stats_reply
166 {
167 private:
168 
169  rofl::openflow::cofflowstatsarray flowstatsarray;
170 
171  union {
172  uint8_t* ofhu_flow_stats;
173  struct rofl::openflow10::ofp_flow_stats* ofhu10_flow_stats;
174  struct rofl::openflow12::ofp_flow_stats* ofhu12_flow_stats;
175  struct rofl::openflow13::ofp_flow_stats* ofhu13_flow_stats;
176  } ofhu;
177 
178 #define ofh_flow_stats ofhu.ofhu_flow_stats
179 #define ofh10_flow_stats ofhu.ofhu10_flow_stats
180 #define ofh12_flow_stats ofhu.ofhu12_flow_stats
181 #define ofh13_flow_stats ofhu.ofhu13_flow_stats
182 
183 public:
184 
185 
190  uint8_t of_version = 0,
191  uint32_t xid = 0,
192  uint16_t flags = 0,
194 
195 
200  cofmsg_flow_stats_reply const& stats);
201 
202 
207  operator= (
208  cofmsg_flow_stats_reply const& stats);
209 
210 
214  virtual
216 
217 
222 
223 
227  virtual void
228  reset();
229 
230 
234  virtual uint8_t*
235  resize(size_t len);
236 
237 
241  virtual size_t
242  length() const;
243 
244 
248  virtual void
249  pack(uint8_t *buf = (uint8_t*)0, size_t buflen = 0);
250 
251 
255  virtual void
256  unpack(uint8_t *buf, size_t buflen);
257 
258 
261  virtual void
262  validate();
263 
264 
265 public:
266 
271  set_flow_stats_array() { return flowstatsarray; };
272 
273 
278  get_flow_stats_array() const { return flowstatsarray; };
279 
280 
281 public:
282 
283  friend std::ostream&
284  operator<< (std::ostream& os, cofmsg_flow_stats_reply const& msg) {
285  os << dynamic_cast<cofmsg const&>( msg );
286  os << indent(2) << "<cofmsg_flow_stats_reply >" << std::endl;
287  indent i(4);
288  os << msg.flowstatsarray;
289  return os;
290  };
291 };
292 
293 } // end of namespace rofl
294 } // end of namespace rofl
295 
296 #endif /* COFMSG_FLOW_STATS_H_ */
virtual ~cofmsg_flow_stats_request()
Definition: cofmsg_flow_stats.cc:72
Definition: cofmsg_flow_stats.h:164
Definition: cofmsg_stats.h:264
virtual void reset()
Definition: cofmsg_flow_stats.cc:80
Definition: cofflowstatsarray.h:19
virtual size_t length() const
Definition: cofmsg_flow_stats.cc:110
virtual void unpack(uint8_t *buf, size_t buflen)
Definition: cofmsg_flow_stats.cc:165
Definition: cofmsg_stats.h:187
virtual void unpack(uint8_t *buf, size_t buflen)
Definition: cofmsg_flow_stats.cc:401
virtual void validate()
Definition: cofmsg_flow_stats.cc:175
cofmsg_flow_stats_request(uint8_t of_version=0, uint32_t xid=0, uint16_t flags=0, cofflow_stats_request const &flow_stats=cofflow_stats_request())
Definition: cofmsg_flow_stats.cc:5
virtual size_t length() const
Definition: cofmsg_flow_stats.cc:346
virtual void pack(uint8_t *buf=(uint8_t *) 0, size_t buflen=0)
Definition: cofmsg_flow_stats.cc:131
Definition: openflow13.h:1194
Definition: openflow12.h:1349
Definition: openflow10.h:805
C++ abstraction for malloc'ed memory areas.
Definition: cmemory.h:44
virtual void validate()
Definition: cofmsg_flow_stats.cc:411
Definition: cofmsg_flow_stats.h:29
virtual ~cofmsg_flow_stats_reply()
Definition: cofmsg_flow_stats.cc:308
virtual void pack(uint8_t *buf=(uint8_t *) 0, size_t buflen=0)
Definition: cofmsg_flow_stats.cc:367
Definition: logging.h:76
virtual void reset()
Definition: cofmsg_flow_stats.cc:316
cofmsg_flow_stats_reply(uint8_t of_version=0, uint32_t xid=0, uint16_t flags=0, rofl::openflow::cofflowstatsarray const &flow_stats=rofl::openflow::cofflowstatsarray())
Definition: cofmsg_flow_stats.cc:224
Definition: cofflowstats.h:26