Revised OpenFlow Library  v0.6.0dev
 All Classes Files Functions Variables Friends Groups Pages
cofpacketqueue.h
1 /*
2  * cofpacketqueue.h
3  *
4  * Created on: 29.04.2013
5  * Author: andi
6  */
7 
8 #ifndef COFPACKETQUEUE_H_
9 #define COFPACKETQUEUE_H_ 1
10 
11 #include <ostream>
12 
13 #include "rofl/common/cmemory.h"
14 #include "rofl/common/croflexception.h"
15 #include "rofl/common/openflow/openflow.h"
16 #include "rofl/common/openflow/openflow_rofl_exceptions.h"
17 #include "rofl/common/openflow/cofqueueprops.h"
18 
19 namespace rofl {
20 namespace openflow {
21 
22 
23 class ePacketQueueBase : public RoflException {};
25 
26 
28 public:
29 
34  uint8_t of_version = rofl::openflow::OFP_VERSION_UNKNOWN,
35  uint32_t port_no = 0,
36  uint32_t queue_id = 0,
37  const cofqueue_props& props = cofqueue_props());
38 
39 
43  virtual
44  ~cofpacket_queue();
45 
46 
51  const cofpacket_queue& pq);
52 
53 
58  operator= (
59  const cofpacket_queue& pq);
60 
61 
62 public:
63 
64 
68  virtual size_t
69  length() const;
70 
71 
75  virtual void
76  pack(
77  uint8_t *buf, size_t buflen);
78 
79 
83  virtual void
84  unpack(
85  uint8_t *buf, size_t buflen);
86 
87 
88 public:
89 
93  uint8_t
94  get_version() const { return ofp_version; };
95 
99  void
100  set_version(uint8_t ofp_version) {
101  this->ofp_version = ofp_version;
102  queue_props.set_version(ofp_version);
103  };
104 
108  uint32_t
109  get_queue_id() const { return queue_id; };
110 
111 
115  void
116  set_queue_id(
117  uint32_t queue_id) { this->queue_id = queue_id; };
118 
119 
123  uint32_t
124  get_port_no() const { return port_no; };
125 
126 
130  void
131  set_port_no(
132  uint32_t port_no) { this->port_no = port_no; };
133 
137  const cofqueue_props&
138  get_queue_props() const { return queue_props; };
139 
144  set_queue_props() { return queue_props; };
145 
146 public:
147 
148  friend std::ostream&
149  operator<< (std::ostream& os, cofpacket_queue const& pq) {
150  os << rofl::indent(0) << "<cofpacket_queue version: " << (int)pq.get_version() << " "
151  << "length: " << pq.length() << " "
152  << ">" << std::endl;
153  os << std::hex;
154  os << rofl::indent(2) << "<port-no: 0x" << (unsigned int)pq.get_port_no() << " >" << std::endl;
155  os << rofl::indent(2) << "<queue-id: 0x" << (unsigned int)pq.get_queue_id() << " >" << std::endl;
156  os << std::dec;
157  indent i(2);
158  os << pq.queue_props;
159  return os;
160  };
161 
162 private:
163 
164  uint8_t ofp_version;
165  uint32_t port_no;
166  uint32_t queue_id;
167  mutable uint16_t len;
168  cofqueue_props queue_props;
169 
170 };
171 
172 }; // end of namespace openflow
173 }; // end of namespace rofl
174 
175 #endif /* COFPACKETQUEUE_H_ */
Definition: cofpacketqueue.h:24
Definition: cofpacketqueue.h:27
Definition: cofpacketqueue.h:23
Definition: logging.h:76
Definition: cofqueueprops.h:20
Definition: croflexception.h:27