13 #include <arpa/inet.h>
16 #include "../../endian_conversion.h"
19 #include "rofl/common/croflexception.h"
20 #include "rofl/common/openflow/openflow_rofl_exceptions.h"
21 #include "rofl/common/fframe.h"
22 #include "rofl/common/cpacket.h"
24 #include "rofl/common/openflow/openflow.h"
26 #include "rofl/common/openflow/cofmatch.h"
27 #include "rofl/common/openflow/cofinstructions.h"
28 #include "rofl/common/openflow/cofactions.h"
29 #include "rofl/common/openflow/cofbuckets.h"
30 #include "rofl/common/openflow/cofports.h"
31 #include "rofl/common/openflow/cofport.h"
32 #include "rofl/common/openflow/cofdescstats.h"
33 #include "rofl/common/openflow/cofflowstats.h"
34 #include "rofl/common/openflow/cofaggrstats.h"
35 #include "rofl/common/openflow/coftablestats.h"
36 #include "rofl/common/openflow/cofportstats.h"
37 #include "rofl/common/openflow/cofqueuestats.h"
38 #include "rofl/common/openflow/cofgroupstats.h"
39 #include "rofl/common/openflow/cofgroupdescstats.h"
66 static std::set<cofmsg*> cofpacket_list;
70 static std::string pinfo;
83 type2desc(uint8_t ofp_version, uint8_t type);
96 uint8_t* ofhu_generic;
100 #define ofh_generic ofh_ofhu.ofhu_generic
101 #define ofh_header ofh_ofhu.ofhu_header
109 uint8_t ofp_version, uint32_t xid, uint8_t type);
165 pack(uint8_t *buf = (uint8_t*)0,
size_t buflen = 0);
172 unpack(uint8_t *buf,
size_t buflen);
231 set_version(uint8_t ofp_version);
245 set_length(uint16_t len);
259 set_type(uint8_t type);
278 operator<< (std::ostream& os,
cofmsg const& msg) {
279 os <<
indent(0) <<
"<cofmsg ";
280 os <<
"version: " << (int)msg.get_version() <<
" ";
281 os <<
"type: " << std::dec << (int)msg.get_type() <<
" ";
282 os <<
"length: " << (int)msg.get_length() <<
" ";
283 os <<
"xid: 0x" << std::hex << (
unsigned int)msg.
get_xid() << std::dec <<
" ";
284 os <<
">" << std::endl;
290 std::stringstream ss;
292 switch (get_version()) {
293 case rofl::openflow::OFP_VERSION_UNKNOWN: {
294 ss <<
"version: unknown, ";
296 case rofl::openflow10::OFP_VERSION: {
297 ss <<
"version: 1.0, ";
299 case rofl::openflow12::OFP_VERSION: {
300 ss <<
"version: 1.2, ";
302 case rofl::openflow13::OFP_VERSION: {
303 ss <<
"version: 1.3, ";
306 ss <<
"type: " << (int)get_type() <<
", ";
307 ss <<
"len: " << (int)get_length() <<
", ";
308 ss <<
"xid: 0x" << std::hex << (
unsigned int)
get_xid() << std::dec;
size_t bodylen() const
Definition: cofmsg.h:212
static const char * type2desc(uint8_t ofp_version, uint8_t type)
Definition: cofmsg.cc:123
size_t memlen() const
Returns length of allocated memory area.
Definition: cmemory.cc:109
size_t framelen() const
Definition: cofmsg.h:198
virtual void pack(uint8_t *buf=(uint8_t *) 0, size_t buflen=0)
Definition: cofmsg.cc:236
cofmsg & operator=(cofmsg const &p)
Definition: cofmsg.cc:201
uint8_t * somem() const
Returns pointer to start of allocated memory area.
Definition: cmemory.cc:101
static const char * packet_info(uint8_t ofp_version)
Definition: cofmsg.cc:85
uint8_t * sobody() const
Definition: cofmsg.h:205
uint8_t * soframe() const
Definition: cofmsg.h:191
uint32_t get_xid() const
Definition: cofmsg.cc:291
virtual void unpack(uint8_t *buf, size_t buflen)
Definition: cofmsg.cc:250
virtual void reset()
Definition: cofmsg.cc:218
C++ abstraction for malloc'ed memory areas.
Definition: cmemory.h:44
virtual size_t length() const
Definition: cofmsg.cc:228
virtual ~cofmsg()
Definition: cofmsg.cc:191
virtual void validate()
Definition: cofmsg.cc:268
void set_xid(uint32_t xid)
Definition: cofmsg.cc:301
Definition: croflexception.h:27