Revised OpenFlow Library  v0.6.0dev
 All Classes Files Functions Variables Friends Groups Pages
cofqueueprops.h
1 /*
2  * cofqueueprops.h
3  *
4  * Created on: 30.04.2013
5  * Author: andi
6  */
7 
8 #ifndef COFQUEUEPROPS_H_
9 #define COFQUEUEPROPS_H_ 1
10 
11 #include <map>
12 
13 #include "rofl/common/croflexception.h"
14 #include "rofl/common/openflow/openflow.h"
15 #include "rofl/common/openflow/cofqueueprop.h"
16 
17 namespace rofl {
18 namespace openflow {
19 
21 public:
22 
27  uint8_t ofp_version = rofl::openflow::OFP_VERSION_UNKNOWN);
28 
32  virtual
33  ~cofqueue_props();
34 
39  const cofqueue_props& props);
40 
44  operator= (
45  const cofqueue_props& props);
46 
47 public:
48 
52  uint8_t
53  get_version() const { return ofp_version; };
54 
58  void
59  set_version(uint8_t ofp_version) {
60  this->ofp_version = ofp_version;
61  for (std::map<uint16_t, cofqueue_prop*>::iterator
62  it = properties.begin(); it != properties.end(); ++it) {
63  it->second->set_version(ofp_version);
64  }
65  };
66 
70  const std::map<uint16_t, cofqueue_prop*>&
71  get_properties() const { return properties; };
72 
76  std::map<uint16_t, cofqueue_prop*>&
77  set_properties() { return properties; };
78 
79 public:
80 
84  void
85  clear();
86 
91  add_queue_prop_min_rate();
92 
97  set_queue_prop_min_rate();
98 
103  get_queue_prop_min_rate() const;
104 
108  void
109  drop_queue_prop_min_rate();
110 
114  bool
115  has_queue_prop_min_rate() const;
116 
121  add_queue_prop_max_rate();
122 
127  set_queue_prop_max_rate();
128 
133  get_queue_prop_max_rate() const;
134 
138  void
139  drop_queue_prop_max_rate();
140 
144  bool
145  has_queue_prop_max_rate() const;
146 
151  add_queue_prop_experimenter();
152 
157  set_queue_prop_experimenter();
158 
163  get_queue_prop_experimenter() const;
164 
168  void
169  drop_queue_prop_experimenter();
170 
174  bool
175  has_queue_prop_experimenter() const;
176 
177 public:
178 
182  virtual size_t
183  length() const;
184 
185 
186 
190  virtual void
191  unpack(
192  uint8_t *buf, size_t buflen);
193 
194 
195 
199  virtual void
200  pack(
201  uint8_t *buf,
202  size_t buflen);
203 
204 public:
205 
209  friend std::ostream&
210  operator<< (std::ostream& os, cofqueue_props const& props) {
211  os << rofl::indent(0) << "<cofqueue_props version: " << (unsigned int)props.get_version()
212  << " #props: " << props.get_properties().size() << " >" << std::endl;
213  rofl::indent i(2);
214  for (std::map<uint16_t, cofqueue_prop*>::const_iterator
215  it = props.properties.begin(); it != props.properties.end(); ++it) {
216  switch (it->second->get_property()) {
217  case rofl::openflow13::OFPQT_MIN_RATE: {
218  os << dynamic_cast<const cofqueue_prop_min_rate&>( *(it->second) );
219  } break;
220  case rofl::openflow13::OFPQT_MAX_RATE: {
221  os << dynamic_cast<const cofqueue_prop_max_rate&>( *(it->second) );
222  } break;
223  case rofl::openflow13::OFPQT_EXPERIMENTER: {
224  os << dynamic_cast<const cofqueue_prop_experimenter&>( *(it->second) );
225  } break;
226  default: {
227  os << (*(it->second));
228  }
229  }
230  }
231  return os;
232  };
233 
234 private:
235 
236  uint8_t ofp_version;
237  std::map<uint16_t, cofqueue_prop*> properties;
238 };
239 
240 }; // end of namespace openflow
241 }; // end of namespace rofl
242 
243 #endif /* COFQUEUEPROPLIST_H_ */
Definition: cofqueueprop.h:172
Definition: cofqueueprop.h:268
Definition: logging.h:76
Definition: cofqueueprop.h:364
Definition: cofqueueprops.h:20