Revised OpenFlow Library  v0.6.0dev
 All Classes Files Functions Variables Friends Groups Pages
coftablestats.h
1 /*
2  * coftablestats.h
3  *
4  * Created on: 14.03.2013
5  * Author: andi
6  */
7 
8 #ifndef COFTABLESTATS_H_
9 #define COFTABLESTATS_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 eTableStatsBase : public RoflException {};
21 
23 {
24 private: // data structures
25 
26  std::string info;
27  uint8_t of_version;
28  uint8_t table_id;
29  std::string name;
30  uint64_t match;
31  uint64_t wildcards;
32  uint32_t write_actions;
33  uint32_t apply_actions;
34  uint64_t write_setfields;
35  uint64_t apply_setfields;
36  uint64_t metadata_match;
37  uint64_t metadata_write;
38  uint32_t instructions;
39  uint32_t config;
40  uint32_t max_entries;
41  uint32_t active_count;
42  uint64_t lookup_count;
43  uint64_t matched_count;
44 
45 
46 public:
51  uint8_t of_version = 0);
52 
57  uint8_t of_version,
58  uint8_t table_id,
59  std::string name,
60  uint32_t wildcards,
61  uint32_t max_entries,
62  uint32_t active_count,
63  uint64_t lookup_count,
64  uint64_t matched_count);
65 
70  uint8_t of_version,
71  uint8_t table_id,
72  std::string name,
73  uint64_t match,
74  uint64_t wildcards,
75  uint32_t write_actions,
76  uint32_t apply_actions,
77  uint64_t write_setfields,
78  uint64_t apply_setfields,
79  uint64_t metadata_match,
80  uint64_t metadata_write,
81  uint32_t instructions,
82  uint32_t config,
83  uint32_t max_entries,
84  uint32_t active_count,
85  uint64_t lookup_count,
86  uint64_t matched_count);
87 
92  uint8_t of_version,
93  uint8_t table_id,
94  uint32_t active_count,
95  uint64_t lookup_count,
96  uint64_t matched_count);
97 
101  virtual
103 
104 
109  coftable_stats_reply const& table_stats);
110 
115  operator= (
116  coftable_stats_reply const& table_stats);
117 
121  bool
122  operator== (
123  coftable_stats_reply const& table_stats) const;
124 
128  size_t
129  length() const;
130 
131 
135  void
136  set_version(uint8_t of_version);
137 
138 
142  uint8_t
143  get_version() const;
144 
145 
149  uint8_t
150  get_table_id() const;
151 
155  void
156  set_table_id(uint8_t table_id);
157 
161  std::string const&
162  get_name() const;
163 
167  void
168  set_name(std::string const& name);
169 
173  uint64_t
174  get_match() const;
175 
179  void
180  set_match(uint64_t match);
181 
185  uint64_t
186  get_wildcards() const;
187 
191  void
192  set_wildcards(uint64_t wildcards);
193 
197  uint32_t
198  get_write_actions() const;
199 
203  void
204  set_write_actions(uint32_t write_actions);
205 
209  uint32_t
210  get_apply_actions() const;
211 
215  void
216  set_apply_actions(uint32_t apply_actions);
217 
221  uint64_t
222  get_write_setfields() const;
223 
227  void
228  set_write_setfields(uint64_t write_setfields);
229 
233  uint64_t
234  get_apply_setfields() const;
235 
239  void
240  set_apply_setfields(uint64_t apply_setfields);
241 
245  uint64_t
246  get_metadata_match() const;
247 
251  void
252  set_metadata_match(uint64_t metadata_match);
253 
257  uint64_t
258  get_metadata_write() const;
259 
263  void
264  set_metadata_write(uint64_t metadata_write);
265 
269  uint32_t
270  get_instructions() const;
271 
275  void
276  set_instructions(uint32_t instructions);
277 
281  void
282  set_config(uint32_t config);
283 
287  uint32_t
288  get_config() const;
289 
293  void
294  set_max_entries(uint32_t max_entries);
295 
299  uint32_t
300  get_max_entries() const;
301 
305  void
306  set_active_count(uint32_t active_count);
307 
311  uint32_t
312  get_active_count() const;
313 
317  void
318  set_lookup_count(uint64_t lookup_count);
319 
323  uint64_t
324  get_lookup_count() const;
325 
329  void
330  set_matched_count(uint64_t matched_count);
331 
335  uint64_t
336  get_matched_count() const;
337 
341  void
342  pack(uint8_t *buf, size_t buflen) const;
343 
347  void
348  unpack(uint8_t *buf, size_t buflen);
349 
350 public:
351 
352  friend std::ostream&
353  operator<< (std::ostream& os, coftable_stats_reply const& tsr) {
354  switch (tsr.of_version) {
355  case rofl::openflow10::OFP_VERSION: {
356  os << indent(0) << "<coftable_stats_reply ";
357  os << "table-id:" << (int)(tsr.table_id) << " ";
358  os << "name:" << tsr.name << " ";
359  os << std::hex;
360  os << "match: 0x" << (unsigned long long)tsr.match << " ";
361  os << "wildcards: 0x" << (unsigned long long)tsr.wildcards << " >" << std::endl;
362 
363  os << indent(2) << "<max_entries: 0x" << (unsigned int)tsr.max_entries << " ";
364  os << "active-count: 0x" << (unsigned int)tsr.active_count << " ";
365  os << "lookup-count: 0x" << (unsigned long long)tsr.lookup_count << " ";
366  os << "matched-count: 0x" << (unsigned long long)tsr.matched_count << " ";
367  os << std::dec;
368  os << ">" << std::endl;
369  } break;
370  case rofl::openflow12::OFP_VERSION: {
371  os << indent(0) << "<coftable_stats_reply ";
372  os << "table-id:" << (int)(tsr.table_id) << " ";
373  os << "name:" << tsr.name << " ";
374  os << std::hex;
375  os << "match: 0x" << (unsigned long long)tsr.match << " ";
376  os << "wildcards: 0x" << (unsigned long long)tsr.wildcards << " >" << std::endl;
377  os << indent(2) << "<write-actions: 0x" << (unsigned int)tsr.write_actions << " ";
378  os << "apply-actions: 0x" << (unsigned int)tsr.apply_actions << " ";
379  os << "write-setfields: 0x" << (unsigned long long)tsr.write_setfields << " ";
380  os << "apply-setfields: 0x" << (unsigned long long)tsr.apply_setfields << " >" << std::endl;;
381  os << indent(2) << "<metadata-match: 0x" << (unsigned long long)tsr.metadata_match << " ";
382  os << "metadata-write: 0x" << (unsigned long long)tsr.metadata_write << " ";
383  os << "instructions: 0x" << (unsigned int)tsr.instructions << " ";
384  os << std::dec;
385  os << "config:" << (unsigned int)tsr.config << " >" << std::endl;;
386  os << indent(2) << "<max_entries:" << (unsigned int)tsr.max_entries << " ";
387  os << "active-count:" << (unsigned int)tsr.active_count << " ";
388  os << "lookup-count:" << (unsigned long long)tsr.lookup_count << " ";
389  os << "matched-count:" << (unsigned long long)tsr.matched_count << " >" << std::endl;
390  } break;
391  case rofl::openflow13::OFP_VERSION: {
392  os << indent(0) << "<coftable_stats_reply ofp-version:" << (int)tsr.of_version << " >" << std::endl;
393  os << std::hex;
394  os << indent(2) << "<table-id: 0x" << (int)(tsr.table_id) << " >" << std::endl;
395  os << indent(2) << "<active-count: 0x" << (unsigned int)tsr.active_count << " >" << std::endl;
396  os << indent(2) << "<lookup-count: 0x" << (unsigned long long)tsr.lookup_count << " >" << std::endl;
397  os << indent(2) << "<matched-count: 0x" << (unsigned long long)tsr.matched_count << " >" << std::endl;
398  os << std::dec;
399  } break;
400  default: {
401  os << indent(0) << "<coftable_stats_reply >";
402  };
403  }
404  return os;
405  };
406 };
407 
408 }
409 }
410 
411 #endif /* COFTABLESTATS_H_ */
Definition: coftablestats.h:19
Definition: coftablestats.h:18
Definition: logging.h:76
Definition: coftablestats.h:20
Definition: coftablestats.h:22
Definition: croflexception.h:27