Revised OpenFlow Library  v0.6.0dev
 All Classes Files Functions Variables Friends Groups Pages
cofdescstats.h
1 /*
2  * cofdescstats.h
3  *
4  * Created on: 14.03.2013
5  * Author: andi
6  */
7 
8 #ifndef COFDESCSTATS_H_
9 #define COFDESCSTATS_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 
19 {
20 private: // data structures
21 
22  uint8_t of_version;
23  std::string mfr_desc;
24  std::string hw_desc;
25  std::string sw_desc;
26  std::string serial_num;
27  std::string dp_desc;
28 
29 public: // data structures
30 
31 
32 public:
33 
38  uint8_t of_version = rofl::openflow::OFP_VERSION_UNKNOWN,
39  std::string const& mfr_desc = std::string(""),
40  std::string const& hw_desc = std::string(""),
41  std::string const& sw_desc = std::string(""),
42  std::string const& serial_num = std::string(""),
43  std::string const& dp_desc = std::string(""));
44 
48  virtual
50 
51 
56  cofdesc_stats_reply const& descstats);
57 
62  operator= (
63  cofdesc_stats_reply const& descstats);
64 
65 
69  size_t
70  length() const;
71 
72 
76  void
77  clear();
78 
79 
83  void
84  set_version(uint8_t of_version);
85 
86 
90  uint8_t
91  get_version() const;
92 
93 
97  std::string
98  get_mfr_desc() const;
99 
103  std::string
104  get_hw_desc() const;
105 
109  std::string
110  get_sw_desc() const;
111 
115  std::string
116  get_serial_num() const;
117 
121  std::string
122  get_dp_desc() const;
123 
127  void
128  pack(uint8_t *buf, size_t buflen) const;
129 
133  void
134  unpack(uint8_t *buf, size_t buflen);
135 
136 public:
137 
138  friend std::ostream&
139  operator<< (std::ostream& os, cofdesc_stats_reply const& reply) {
140  switch (reply.get_version()) {
141  case rofl::openflow::OFP_VERSION_UNKNOWN: {
142  os << indent(0) << "<cofdesc_stats_reply ofp-version:" << (int)reply.get_version() << " >" << std::endl;
143 
144  } break;
145  case rofl::openflow10::OFP_VERSION: {
146  os << indent(0) << "<cofdesc_stats_reply ofp-version:" << (int)reply.get_version() << " >" << std::endl;
147  os << indent(2) << "<mfr-desc: " << reply.mfr_desc << " >" << std::endl;
148  os << indent(2) << "<hw-desc: " << reply.hw_desc << " >" << std::endl;
149  os << indent(2) << "<sw-desc: " << reply.sw_desc << " >" << std::endl;
150  os << indent(2) << "<serial-num: " << reply.serial_num << " >" << std::endl;
151  os << indent(2) << "<dp-desc: " << reply.dp_desc << " >" << std::endl;
152 
153  } break;
154  case rofl::openflow12::OFP_VERSION:
155  case rofl::openflow13::OFP_VERSION: {
156  os << indent(0) << "<cofdesc_stats_reply ofp-version:" << (int)reply.get_version() << " >" << std::endl;
157  os << indent(2) << "<mfr-desc: " << reply.mfr_desc << " >" << std::endl;
158  os << indent(2) << "<hw-desc: " << reply.hw_desc << " >" << std::endl;
159  os << indent(2) << "<sw-desc: " << reply.sw_desc << " >" << std::endl;
160  os << indent(2) << "<serial-num: " << reply.serial_num << " >" << std::endl;
161  os << indent(2) << "<dp-desc: " << reply.dp_desc << " >" << std::endl;
162 
163  } break;
164  default: {
165  throw eBadVersion();
166  };
167  }
168  return os;
169  };
170 };
171 
172 } // end of namespace openflow
173 } // end of namespace rofl
174 
175 #endif /* COFDESCSTATS_H_ */
Definition: croflexception.h:73
Definition: cofdescstats.h:18
Definition: logging.h:76