Revised OpenFlow Library  v0.6.0dev
 All Classes Files Functions Variables Friends Groups Pages
cofmsg_port_stats.h
1 /*
2  * cofmsg_port_stats.h
3  *
4  * Created on: 18.03.2013
5  * Author: andi
6  */
7 
8 #ifndef COFMSG_PORT_STATS_H_
9 #define COFMSG_PORT_STATS_H_ 1
10 
11 #include <vector>
12 
13 #include "rofl/common/openflow/messages/cofmsg_stats.h"
14 #include "rofl/common/openflow/cofportstatsarray.h"
15 #include "rofl/common/openflow/cofportstats.h"
16 
17 namespace rofl {
18 namespace openflow {
19 
25 {
26 private:
27 
29 
30  union {
31  uint8_t* ofhu_port_stats;
32  struct rofl::openflow10::ofp_port_stats* ofhu10_port_stats;
33  struct rofl::openflow12::ofp_port_stats* ofhu12_port_stats;
34  struct rofl::openflow13::ofp_port_stats* ofhu13_port_stats;
35  } ofhu;
36 
37 #define ofh_port_stats ofhu.ofhu_port_stats
38 #define ofh10_port_stats ofhu.ofhu10_port_stats
39 #define ofh12_port_stats ofhu.ofhu12_port_stats
40 #define ofh13_port_stats ofhu.ofhu13_port_stats
41 
42 public:
43 
44 
49  uint8_t of_version = 0,
50  uint32_t xid = 0,
51  uint16_t flags = 0,
53 
54 
59  cofmsg_port_stats_request const& stats);
60 
61 
66  operator= (
67  cofmsg_port_stats_request const& stats);
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 
131  set_port_stats();
132 
137  get_port_stats() const;
138 
139 public:
140 
141  friend std::ostream&
142  operator<< (std::ostream& os, cofmsg_port_stats_request const& msg) {
143  os << dynamic_cast<cofmsg const&>( msg );
144  os << indent(2) << "<cofmsg_port_stats_request >" << std::endl;
145  indent i(4);
146  os << msg.port_stats;
147  return os;
148  };
149 };
150 
151 
152 
157  public cofmsg_stats_reply
158 {
159 private:
160 
161  rofl::openflow::cofportstatsarray portstatsarray;
162 
163  union {
164  uint8_t* ofhu_port_stats;
165  struct rofl::openflow10::ofp_port_stats* ofhu10_port_stats;
166  struct rofl::openflow12::ofp_port_stats* ofhu12_port_stats;
167  struct rofl::openflow13::ofp_port_stats* ofhu13_port_stats;
168  } ofhu;
169 
170 #define ofh_port_stats ofhu.ofhu_port_stats
171 #define ofh10_port_stats ofhu.ofhu10_port_stats
172 #define ofh12_port_stats ofhu.ofhu12_port_stats
173 #define ofh13_port_stats ofhu.ofhu13_port_stats
174 
175 public:
176 
177 
182  uint8_t of_version = 0,
183  uint32_t xid = 0,
184  uint16_t flags = 0,
186 
187 
192  cofmsg_port_stats_reply const& stats);
193 
194 
199  operator= (
200  cofmsg_port_stats_reply const& stats);
201 
202 
206  virtual
208 
209 
214 
215 
219  virtual void
220  reset();
221 
222 
226  virtual uint8_t*
227  resize(size_t len);
228 
229 
233  virtual size_t
234  length() const;
235 
236 
240  virtual void
241  pack(uint8_t *buf = (uint8_t*)0, size_t buflen = 0);
242 
243 
247  virtual void
248  unpack(uint8_t *buf, size_t buflen);
249 
250 
253  virtual void
254  validate();
255 
256 
257 public:
258 
263  set_port_stats_array() { return portstatsarray; };
264 
269  get_port_stats_array() const { return portstatsarray; };
270 
271 public:
272 
273  friend std::ostream&
274  operator<< (std::ostream& os, cofmsg_port_stats_reply const& msg) {
275  os << dynamic_cast<cofmsg const&>( msg );
276  os << indent(2) << "<cofmsg_port_stats_reply >" << std::endl;
277  indent i(4);
278  os << msg.portstatsarray;
279  return os;
280  };
281 };
282 
283 } // end of namespace openflow
284 } // end of namespace rofl
285 
286 #endif /* COFMSG_PORT_STATS_H_ */
Definition: openflow10.h:873
Definition: openflow12.h:1466
Definition: openflow13.h:1392
virtual void unpack(uint8_t *buf, size_t buflen)
Definition: cofmsg_port_stats.cc:183
Definition: cofmsg_port_stats.h:156
Definition: cofmsg_stats.h:264
virtual void validate()
Definition: cofmsg_port_stats.cc:193
virtual ~cofmsg_port_stats_reply()
Definition: cofmsg_port_stats.cc:321
virtual void pack(uint8_t *buf=(uint8_t *) 0, size_t buflen=0)
Definition: cofmsg_port_stats.cc:147
Definition: cofmsg_stats.h:187
virtual size_t length() const
Definition: cofmsg_port_stats.cc:126
virtual void pack(uint8_t *buf=(uint8_t *) 0, size_t buflen=0)
Definition: cofmsg_port_stats.cc:380
virtual ~cofmsg_port_stats_request()
Definition: cofmsg_port_stats.cc:88
Definition: cofportstatsarray.h:19
Definition: cofmsg_port_stats.h:23
virtual void reset()
Definition: cofmsg_port_stats.cc:329
C++ abstraction for malloc'ed memory areas.
Definition: cmemory.h:44
virtual void reset()
Definition: cofmsg_port_stats.cc:96
Definition: cofportstats.h:24
cofmsg_port_stats_reply(uint8_t of_version=0, uint32_t xid=0, uint16_t flags=0, rofl::openflow::cofportstatsarray const &portstatsarray=rofl::openflow::cofportstatsarray())
Definition: cofmsg_port_stats.cc:238
cofmsg_port_stats_request(uint8_t of_version=0, uint32_t xid=0, uint16_t flags=0, rofl::openflow::cofport_stats_request const &port_stats=rofl::openflow::cofport_stats_request())
Definition: cofmsg_port_stats.cc:5
virtual void unpack(uint8_t *buf, size_t buflen)
Definition: cofmsg_port_stats.cc:414
Definition: logging.h:76
virtual size_t length() const
Definition: cofmsg_port_stats.cc:359
virtual void validate()
Definition: cofmsg_port_stats.cc:424