Revised OpenFlow Library  v0.6.0dev
 All Classes Files Functions Variables Friends Groups Pages
cofmsg_experimenter_stats.h
1 /*
2  * cofmsg_experimenter_stats.h
3  *
4  * Created on: 18.03.2013
5  * Author: andi
6  */
7 
8 #ifndef COFMSG_EXPERIMENTER_STATS_H_
9 #define COFMSG_EXPERIMENTER_STATS_H_ 1
10 
11 #include "rofl/common/openflow/messages/cofmsg_stats.h"
12 #include "rofl/common/openflow/cofgroupfeaturesstats.h"
13 #include "rofl/common/cmemory.h"
14 
15 namespace rofl {
16 namespace openflow {
17 
23 {
24 private:
25 
26  cmemory body;
27 
28  union {
29  uint8_t* ofhu_exp_stats;
30  struct openflow10::ofp_vendor_stats_header* ofhu10_exp_stats;
31  struct openflow12::ofp_experimenter_stats_header* ofhu12_exp_stats;
32  // TODO: OF1.3
33  } ofhu;
34 
35 #define ofh_exp_stats ofhu.ofhu_exp_stats
36 #define ofh10_exp_stats ofhu.ofhu10_exp_stats
37 #define ofh12_exp_stats ofhu.ofhu12_exp_stats
38 // TODO OF1.3
39 
40 public:
41 
42 
47  uint8_t of_version = 0,
48  uint32_t xid = 0,
49  uint16_t flags = 0,
50  uint32_t exp_id = 0,
51  uint32_t exp_type = 0,
52  cmemory const& body = cmemory(0));
53 
54 
60 
61 
66  operator= (
68 
69 
73  virtual
75 
76 
81 
82 
86  virtual void
87  reset();
88 
89 
93  virtual uint8_t*
94  resize(size_t len);
95 
96 
100  virtual size_t
101  length() const;
102 
103 
107  virtual void
108  pack(uint8_t *buf = (uint8_t*)0, size_t buflen = 0);
109 
110 
114  virtual void
115  unpack(uint8_t *buf, size_t buflen);
116 
117 
120  virtual void
121  validate();
122 
123 
124 public:
125 
126 
130  void
131  set_exp_id(uint32_t exp_id);
132 
133 
137  uint32_t
138  get_exp_id() const;
139 
140 
144  void
145  set_exp_type(uint32_t exp_type);
146 
147 
151  uint32_t
152  get_exp_type() const;
153 
154 
158  cmemory&
159  get_body();
160 
161 public:
162 
163  friend std::ostream&
164  operator<< (std::ostream& os, cofmsg_experimenter_stats_request const& msg) {
165  os << dynamic_cast<cofmsg const&>( msg );
166  os << indent(2) << "<cofmsg_experimenter_stats_request >" << std::endl;
167  os << indent(4) << "<exp-id:" << (int)msg.get_exp_id() << " >" << std::endl;
168  os << indent(4) << "<exp-type:" << (int)msg.get_exp_type() << " >" << std::endl;
169  indent i(4);
170  os << msg.body;
171  return os;
172  };
173 };
174 
175 
176 
185  public cofmsg_stats_reply
186 {
187 private:
188 
189  cmemory body;
190 
191  union {
192  uint8_t* ofhu_exp_stats;
193  struct openflow10::ofp_vendor_stats_header* ofhu10_exp_stats;
194  struct openflow12::ofp_experimenter_stats_header* ofhu12_exp_stats;
195  // TODO: OF1.3
196  } ofhu;
197 
198 #define ofh_exp_stats ofhu.ofhu_exp_stats
199 #define ofh10_exp_stats ofhu.ofhu10_exp_stats
200 #define ofh12_exp_stats ofhu.ofhu12_exp_stats
201 // TODO OF1.3
202 
203 public:
204 
205 
210  uint8_t of_version = 0,
211  uint32_t xid = 0,
212  uint16_t flags = 0,
213  uint32_t exp_id = 0,
214  uint32_t exp_type = 0,
215  cmemory const& body = cmemory(0));
216 
217 
222  cofmsg_experimenter_stats_reply const& stats);
223 
224 
229  operator= (
230  cofmsg_experimenter_stats_reply const& stats);
231 
232 
236  virtual
238 
239 
244 
245 
249  virtual void
250  reset();
251 
252 
256  virtual uint8_t*
257  resize(size_t len);
258 
259 
263  virtual size_t
264  length() const;
265 
266 
270  virtual void
271  pack(uint8_t *buf = (uint8_t*)0, size_t buflen = 0);
272 
273 
277  virtual void
278  unpack(uint8_t *buf, size_t buflen);
279 
280 
283  virtual void
284  validate();
285 
286 
287 public:
288 
289 
293  void
294  set_exp_id(uint32_t exp_id);
295 
296 
300  uint32_t
301  get_exp_id() const;
302 
303 
307  void
308  set_exp_type(uint32_t exp_type);
309 
310 
314  uint32_t
315  get_exp_type() const;
316 
317 
321  cmemory&
322  get_body();
323 
324 public:
325 
326  friend std::ostream&
327  operator<< (std::ostream& os, cofmsg_experimenter_stats_reply const& msg) {
328  os << dynamic_cast<cofmsg const&>( msg );
329  os << indent(2) << "<cofmsg_experimenter_stats_request >" << std::endl;
330  os << indent(4) << "<exp-id:" << (int)msg.get_exp_id() << " >" << std::endl;
331  os << indent(4) << "<exp-type:" << (int)msg.get_exp_type() << " >" << std::endl;
332  indent i(4);
333  os << msg.body;
334  return os;
335  };
336 };
337 
338 } // end of namespace openflow
339 } // end of namespace rofl
340 
341 #endif /* COFMSG_GROUP_FEATURES_STATS_H_ */
virtual void reset()
Definition: cofmsg_experimenter_stats.cc:79
virtual void unpack(uint8_t *buf, size_t buflen)
Definition: cofmsg_experimenter_stats.cc:168
Definition: cofmsg_stats.h:264
virtual void validate()
Definition: cofmsg_experimenter_stats.cc:178
cofmsg_experimenter_stats_request(uint8_t of_version=0, uint32_t xid=0, uint16_t flags=0, uint32_t exp_id=0, uint32_t exp_type=0, cmemory const &body=cmemory(0))
Definition: cofmsg_experimenter_stats.cc:5
virtual size_t length() const
Definition: cofmsg_experimenter_stats.cc:400
Definition: cofmsg_stats.h:187
virtual ~cofmsg_experimenter_stats_reply()
Definition: cofmsg_experimenter_stats.cc:360
virtual void validate()
Definition: cofmsg_experimenter_stats.cc:467
virtual ~cofmsg_experimenter_stats_request()
Definition: cofmsg_experimenter_stats.cc:71
virtual size_t length() const
Definition: cofmsg_experimenter_stats.cc:111
virtual void reset()
Definition: cofmsg_experimenter_stats.cc:368
C++ abstraction for malloc'ed memory areas.
Definition: cmemory.h:44
Definition: openflow10.h:898
virtual void pack(uint8_t *buf=(uint8_t *) 0, size_t buflen=0)
Definition: cofmsg_experimenter_stats.cc:422
virtual void pack(uint8_t *buf=(uint8_t *) 0, size_t buflen=0)
Definition: cofmsg_experimenter_stats.cc:133
Definition: logging.h:76
Definition: cofmsg_experimenter_stats.h:21
virtual void unpack(uint8_t *buf, size_t buflen)
Definition: cofmsg_experimenter_stats.cc:457
cofmsg_experimenter_stats_reply(uint8_t of_version=0, uint32_t xid=0, uint16_t flags=0, uint32_t exp_id=0, uint32_t exp_type=0, cmemory const &body=cmemory(0))
Definition: cofmsg_experimenter_stats.cc:294
Definition: cofmsg_experimenter_stats.h:184