Revised OpenFlow Library  v0.6.0dev
 All Classes Files Functions Variables Friends Groups Pages
cofmsg_packet_out.h
1 /*
2  * cofmsg_packet_out.h
3  *
4  * Created on: 18.03.2013
5  * Author: andi
6  */
7 
8 #ifndef COFMSG_PACKET_OUT_H_
9 #define COFMSG_PACKET_OUT_H_ 1
10 
11 #include "rofl/common/openflow/messages/cofmsg.h"
12 #include "rofl/common/openflow/cofactions.h"
13 #include "rofl/common/cpacket.h"
14 
15 namespace rofl {
16 namespace openflow {
17 
22  public cofmsg
23 {
24 private:
25 
26  cofactions actions;
27  cpacket packet;
28 
29  union {
30  uint8_t* ofhu_packet_out;
31  struct openflow10::ofp_packet_out* ofhu10_packet_out;
32  struct openflow12::ofp_packet_out* ofhu12_packet_out;
33  struct openflow13::ofp_packet_out* ofhu13_packet_out;
34  } ofhu;
35 
36 #define ofh_packet_out ofhu.ofhu_packet_out
37 #define ofh10_packet_out ofhu.ofhu10_packet_out
38 #define ofh12_packet_out ofhu.ofhu12_packet_out
39 #define ofh13_packet_out ofhu.ofhu13_packet_out
40 
41 public:
42 
43 
48  uint8_t of_version = 0,
49  uint32_t xid = 0,
50  uint32_t buffer_id = 0,
51  uint32_t in_port = 0,
52  cofactions const& actions = cofactions(),
53  uint8_t *data = (uint8_t*)0,
54  size_t datalen = 0);
55 
56 
61  cofmsg_packet_out const& packet_out);
62 
63 
68  operator= (
69  cofmsg_packet_out const& packet_out);
70 
71 
75  virtual
77 
78 
82  cofmsg_packet_out(cmemory *memarea);
83 
84 
88  virtual void
89  reset();
90 
91 
95  virtual uint8_t*
96  resize(size_t len);
97 
98 
102  virtual size_t
103  length() const;
104 
105 
109  virtual void
110  pack(uint8_t *buf = (uint8_t*)0, size_t buflen = 0);
111 
112 
116  virtual void
117  unpack(uint8_t *buf, size_t buflen);
118 
119 
122  virtual void
123  validate();
124 
125 
126 public:
127 
128 
132  uint32_t
133  get_buffer_id() const;
134 
138  void
139  set_buffer_id(uint32_t buffer_id);
140 
144  uint32_t
145  get_in_port() const;
146 
150  void
151  set_in_port(uint32_t in_port);
152 
156  cofactions&
157  set_actions();
158 
162  cofactions const&
163  get_actions() const;
164 
168  cpacket&
169  set_packet();
170 
174  cpacket const&
175  get_packet() const;
176 
177 public:
178 
179  friend std::ostream&
180  operator<< (std::ostream& os, cofmsg_packet_out const& msg) {
181  os << dynamic_cast<cofmsg const&>( msg );
182  os << indent(0) << "<cofmsg_packet_out >" << std::endl;
183  os << std::hex;
184  os << indent(2) << "<buffer-id: 0x" << (unsigned int)msg.get_buffer_id() << " >" << std::endl;
185  os << indent(2) << "<in-port: 0x" << (unsigned int)msg.get_in_port() << " >" << std::endl;
186  os << std::dec;
187  os << indent(2) << msg.actions;
188  os << indent(2) << msg.packet;
189  return os;
190  };
191 };
192 
193 } // end of namespace openflow
194 } // end of namespace rofl
195 
196 #endif /* COFMSG_PACKET_OUT_H_ */
virtual void reset()
Definition: cofmsg_packet_out.cc:106
virtual size_t length() const
Definition: cofmsg_packet_out.cc:124
Definition: cofactions.h:22
virtual void pack(uint8_t *buf=(uint8_t *) 0, size_t buflen=0)
Definition: cofmsg_packet_out.cc:144
virtual ~cofmsg_packet_out()
Definition: cofmsg_packet_out.cc:98
cofmsg_packet_out(uint8_t of_version=0, uint32_t xid=0, uint32_t buffer_id=0, uint32_t in_port=0, cofactions const &actions=cofactions(), uint8_t *data=(uint8_t *) 0, size_t datalen=0)
Definition: cofmsg_packet_out.cc:5
Definition: openflow13.h:1616
Definition: openflow12.h:749
Definition: cofmsg_packet_out.h:21
C++ abstraction for malloc'ed memory areas.
Definition: cmemory.h:44
Definition: cpacket.h:56
Definition: openflow10.h:476
Definition: logging.h:76
virtual void validate()
Definition: cofmsg_packet_out.cc:202
virtual void unpack(uint8_t *buf, size_t buflen)
Definition: cofmsg_packet_out.cc:192
Definition: cofmsg.h:62