Revised OpenFlow Library  v0.6.0dev
 All Classes Files Functions Variables Friends Groups Pages
cofpacketqueues.h
1 /*
2  * cofpacketqueuelist.h
3  *
4  * Created on: 30.04.2013
5  * Author: andi
6  */
7 
8 #ifndef COFPACKETQUEUELIST_H_
9 #define COFPACKETQUEUELIST_H_ 1
10 
11 #include <map>
12 #include <ostream>
13 
14 #include "rofl/common/openflow/cofpacketqueue.h"
15 
16 namespace rofl {
17 namespace openflow {
18 
20 public:
21 
26  uint8_t of_version = rofl::openflow::OFP_VERSION_UNKNOWN);
27 
31  virtual
33 
38  const cofpacket_queues& queues);
39 
43  operator= (
44  const cofpacket_queues& queues);
45 
46 public:
47 
51  uint8_t
52  get_version() const { return ofp_version; };
53 
57  void
58  set_version(uint8_t ofp_version) { this->ofp_version = ofp_version; };
59 
63  const std::map<uint32_t, std::map<uint32_t, cofpacket_queue> >&
64  get_packet_queues() const { return pqueues; };
65 
69  std::map<uint32_t, std::map<uint32_t, cofpacket_queue> >&
70  set_packet_queues() { return pqueues; };
71 
72 public:
73 
77  void
78  clear();
79 
84  add_pqueue(uint32_t port_no, uint32_t queue_id);
85 
90  set_pqueue(uint32_t port_no, uint32_t queue_id);
91 
95  const cofpacket_queue&
96  get_pqueue(uint32_t port_no, uint32_t queue_id) const;
97 
101  void
102  drop_pqueue(uint32_t port_no, uint32_t queue_id);
103 
107  bool
108  has_pqueue(uint32_t port_no, uint32_t queue_id) const;
109 
110 public:
111 
115  virtual size_t
116  length() const;
117 
121  virtual void
122  unpack(
123  uint8_t *buf, size_t buflen);
124 
128  virtual void
129  pack(
130  uint8_t *buf, size_t buflen);
131 
132 public:
133 
137  friend std::ostream&
138  operator<< (std::ostream& os, cofpacket_queues const& pql) {
139  unsigned int count = 0;
140  for (std::map<uint32_t, std::map<uint32_t, cofpacket_queue> >::const_iterator
141  it = pql.pqueues.begin(); it != pql.pqueues.end(); ++it) {
142  count += it->second.size();
143  }
144  os << rofl::indent(0) << "<cofpacket_queues #queues: " << count << " >" << std::endl;
145  for (std::map<uint32_t, std::map<uint32_t, cofpacket_queue> >::const_iterator
146  it = pql.pqueues.begin(); it != pql.pqueues.end(); ++it) {
147  for (std::map<uint32_t, cofpacket_queue>::const_iterator
148  jt = it->second.begin(); jt != it->second.end(); ++jt) {
149  rofl::indent i(2); os << (jt->second);
150  }
151  }
152  return os;
153  };
154 
155 private:
156 
157  uint8_t ofp_version;
158  std::map<uint32_t, std::map<uint32_t, cofpacket_queue> > pqueues; // port_no/queue_id => cofpacket_queue
159 };
160 
161 }; // end of namespace openflow
162 }; // end of namespace rofl
163 
164 #endif /* COFPACKETQUEUELIST_H_ */
Definition: cofpacketqueue.h:27
Definition: logging.h:76
Definition: cofpacketqueues.h:19