Revised OpenFlow Library  v0.6.0dev
 All Classes Files Functions Variables Friends Groups Pages
cofmsg_port_mod.h
1 /*
2  * cofmsg_port_mod.h
3  *
4  * Created on: 18.03.2013
5  * Author: andi
6  */
7 
8 #ifndef COFMSG_PORT_MOD_H_
9 #define COFMSG_PORT_MOD_H_ 1
10 
11 #include "rofl/common/openflow/messages/cofmsg.h"
12 #include "rofl/common/caddress.h"
13 
14 namespace rofl {
15 namespace openflow {
16 
21  public cofmsg
22 {
23 private:
24 
25  union {
26  uint8_t* ofhu_port_mod;
27  struct openflow10::ofp_port_mod* ofhu10_port_mod;
28  struct openflow12::ofp_port_mod* ofhu12_port_mod;
29  struct openflow13::ofp_port_mod* ofhu13_port_mod;
30  } ofhu;
31 
32 #define ofh_port_mod ofhu.ofhu_port_mod
33 #define ofh10_port_mod ofhu.ofhu10_port_mod
34 #define ofh12_port_mod ofhu.ofhu12_port_mod
35 #define ofh13_port_mod ofhu.ofhu13_port_mod
36 
37 public:
38 
39 
44  uint8_t of_version = 0,
45  uint32_t xid = 0,
46  uint32_t port_no = 0,
47  cmacaddr const& hwaddr = cmacaddr("00:00:00:00:00:00"),
48  uint32_t config = 0,
49  uint32_t mask = 0,
50  uint32_t advertise = 0);
51 
52 
57  cofmsg_port_mod const& port_mod);
58 
59 
64  operator= (
65  cofmsg_port_mod const& port_mod);
66 
67 
71  virtual
73 
74 
78  cofmsg_port_mod(cmemory *memarea);
79 
80 
84  virtual void
85  reset();
86 
87 
91  virtual uint8_t*
92  resize(size_t len);
93 
94 
98  virtual size_t
99  length() const;
100 
101 
105  virtual void
106  pack(uint8_t *buf = (uint8_t*)0, size_t buflen = 0);
107 
108 
112  virtual void
113  unpack(uint8_t *buf, size_t buflen);
114 
115 
118  virtual void
119  validate();
120 
121 
122 public:
123 
124 
128  uint32_t
129  get_port_no() const;
130 
134  void
135  set_port_no(uint32_t port_no);
136 
140  cmacaddr
141  get_hwaddr() const;
142 
146  void
147  set_hwaddr(cmacaddr const& hwaddr);
148 
152  uint32_t
153  get_config() const;
154 
158  void
159  set_config(uint32_t config);
160 
164  uint32_t
165  get_mask() const;
166 
170  void
171  set_mask(uint32_t mask);
172 
176  uint32_t
177  get_advertise() const;
178 
182  void
183  set_advertise(uint32_t advertise);
184 
185 public:
186 
187  friend std::ostream&
188  operator<< (std::ostream& os, cofmsg_port_mod const& msg) {
189  os << dynamic_cast<cofmsg const&>( msg );
190  os << indent(2) << "<cofmsg_port_mod >" << std::endl;
191  os << indent(2) << "<port-no:" << (int)msg.get_port_no() << " >" << std::endl;
192  os << indent(2) << "<hw-addr:" << msg.get_hwaddr() << " >" << std::endl;
193  os << indent(2) << "<config:" << std::hex << (int)msg.get_config() << std::dec << " >" << std::endl;
194  os << indent(2) << "<mask:" << std::hex << (int)msg.get_mask() << std::dec << " >" << std::endl;
195  os << indent(2) << "<advertise:" << std::hex << (int)msg.get_advertise() << std::dec << " >" << std::endl;
196  return os;
197  };
198 };
199 
200 } // end of namespace openflow
201 } // end of namespace rofl
202 
203 #endif /* COFMSG_PORT_MOD_H_ */
Definition: caddress.h:152
virtual void pack(uint8_t *buf=(uint8_t *) 0, size_t buflen=0)
Definition: cofmsg_port_mod.cc:136
virtual size_t length() const
Definition: cofmsg_port_mod.cc:115
virtual void unpack(uint8_t *buf, size_t buflen)
Definition: cofmsg_port_mod.cc:170
virtual ~cofmsg_port_mod()
Definition: cofmsg_port_mod.cc:91
Definition: cofmsg_port_mod.h:20
Definition: openflow10.h:300
Definition: openflow13.h:905
virtual void validate()
Definition: cofmsg_port_mod.cc:180
C++ abstraction for malloc'ed memory areas.
Definition: cmemory.h:44
Definition: logging.h:76
cofmsg_port_mod(uint8_t of_version=0, uint32_t xid=0, uint32_t port_no=0, cmacaddr const &hwaddr=cmacaddr("00:00:00:00:00:00"), uint32_t config=0, uint32_t mask=0, uint32_t advertise=0)
Definition: cofmsg_port_mod.cc:5
Definition: openflow12.h:350
virtual void reset()
Definition: cofmsg_port_mod.cc:99
Definition: cofmsg.h:62