8 #ifndef COFFLOWSTATS_H_
9 #define COFFLOWSTATS_H_ 1
11 #include "rofl/common/cmemory.h"
12 #include "rofl/common/openflow/cofmatch.h"
13 #include "rofl/common/openflow/cofactions.h"
14 #include "rofl/common/openflow/cofinstructions.h"
15 #include "rofl/common/openflow/openflow.h"
16 #include "rofl/common/openflow/openflow_rofl_exceptions.h"
17 #include "rofl/common/croflexception.h"
46 uint8_t of_version = 0,
47 uint8_t *buf = (uint8_t*)0,
70 uint64_t cookie_mask);
98 pack(uint8_t *buf,
size_t buflen);
105 unpack(uint8_t *buf,
size_t buflen);
119 set_version(uint8_t of_version);
131 set_table_id(uint8_t table_id);
137 get_table_id()
const;
143 set_out_port(uint32_t out_port);
149 get_out_port()
const;
155 set_out_group(uint32_t out_group);
161 get_out_group()
const;
167 set_cookie(uint64_t cookie);
179 set_cookie_mask(uint64_t cookie_mask);
185 get_cookie_mask()
const;
209 switch (flow_stats_request.of_version) {
210 case openflow10::OFP_VERSION: {
211 os <<
indent(0) <<
"<cofflow_stats_request >" << std::endl;
212 os <<
indent(2) <<
"<table-id:" << (int)flow_stats_request.get_table_id() <<
" >" << std::endl;
213 os <<
indent(2) <<
"<out-port:0x" << std::hex << (int)flow_stats_request.get_out_port() << std::dec <<
" >" << std::endl;
215 os << flow_stats_request.match;
218 case openflow12::OFP_VERSION:
219 case openflow13::OFP_VERSION: {
220 os <<
indent(0) <<
"<cofflow_stats_request >" << std::endl;
221 os <<
indent(2) <<
"<table-id:" << (int)flow_stats_request.get_table_id() <<
" >" << std::endl;
222 os <<
indent(2) <<
"<out-port:0x" << std::hex << (int)flow_stats_request.get_out_port() << std::dec <<
" >" << std::endl;
223 os <<
indent(2) <<
"<out-group:0x" << std::hex << (int)flow_stats_request.get_out_group() << std::dec <<
" >" << std::endl;
224 os <<
indent(2) <<
"<cookie:0x" << std::hex << (
unsigned long long)flow_stats_request.get_cookie() << std::dec <<
" >" << std::endl;
225 os <<
indent(2) <<
"<cookie-mask:0x" << std::hex << (
unsigned long long)flow_stats_request.get_cookie_mask() << std::dec <<
" >" << std::endl;
227 os << flow_stats_request.match;
231 os <<
"<cofflow_stats_request unknown OFP version >" << std::endl;
246 uint32_t duration_sec;
247 uint32_t duration_nsec;
249 uint16_t idle_timeout;
250 uint16_t hard_timeout;
253 uint64_t packet_count;
259 #define OFP12_FLOW_STATS_REPLY_STATIC_HDR_LEN 48 // bytes
269 uint8_t of_version = 0,
270 uint8_t *buf = (uint8_t*)0,
280 uint32_t duration_sec,
281 uint32_t duration_nsec,
283 uint16_t idle_timeout,
284 uint16_t hard_timeout,
286 uint64_t packet_count,
298 uint32_t duration_sec,
299 uint32_t duration_nsec,
301 uint16_t idle_timeout,
302 uint16_t hard_timeout,
305 uint64_t packet_count,
345 pack(uint8_t *buf,
size_t buflen);
352 unpack(uint8_t *buf,
size_t buflen);
366 set_version(uint8_t of_version);
380 get_table_id()
const;
386 get_duration_sec()
const;
392 get_duration_nsec()
const;
398 get_priority()
const;
404 get_idle_timeout()
const;
410 get_hard_timeout()
const;
428 get_packet_count()
const;
434 get_byte_count()
const;
446 set_table_id(uint8_t table_id);
452 set_duration_sec(uint32_t duration_sec);
458 set_duration_nsec(uint32_t duration_nsec);
464 set_priority(uint16_t priority);
470 set_idle_timeout(uint16_t idle_timeout);
476 set_hard_timeout(uint16_t hard_timeout);
482 set_flags(uint16_t flags);
488 set_cookie(uint64_t cookie);
494 set_packet_count(uint64_t packet_count);
500 set_byte_count(uint64_t byte_count);
511 set_match() {
return match; };
517 set_actions() {
return actions; };
523 set_instructions() {
return instructions; };
530 get_match()
const {
return match; };
536 get_actions()
const {
return actions; };
542 get_instructions()
const {
return instructions; };
549 switch (flow_stats_reply.of_version) {
550 case rofl::openflow10::OFP_VERSION:
551 case rofl::openflow12::OFP_VERSION:
552 case rofl::openflow13::OFP_VERSION: {
553 os <<
indent(0) <<
"<cofflow_stats_reply >" << std::endl;
554 os <<
indent(2) <<
"<table-id: " << (int)flow_stats_reply.get_table_id() <<
" >" << std::endl;
555 os <<
indent(2) <<
"<duration-sec: " << (int)flow_stats_reply.get_duration_sec() <<
" >" << std::endl;
556 os <<
indent(2) <<
"<duration-nsec: " << (int)flow_stats_reply.get_duration_nsec() <<
" >" << std::endl;
557 os <<
indent(2) <<
"<priority: 0x" << std::hex << (int)flow_stats_reply.get_priority() << std::dec <<
" >" << std::endl;
558 os <<
indent(2) <<
"<idle-timeout: " << (int)flow_stats_reply.get_idle_timeout() <<
" >" << std::endl;
559 os <<
indent(2) <<
"<hard-timeout: " << (int)flow_stats_reply.get_hard_timeout() <<
" >" << std::endl;
560 os <<
indent(2) <<
"<cookie: 0x" << std::hex << (
unsigned long long)flow_stats_reply.get_cookie() << std::dec <<
" >" << std::endl;
561 os <<
indent(2) <<
"<packet-count: " << (int)flow_stats_reply.get_packet_count() <<
" >" << std::endl;
562 os <<
indent(2) <<
"<byte-count: " << (int)flow_stats_reply.get_byte_count() <<
" >" << std::endl;
563 os <<
indent(2) <<
"<flags: " << (int)flow_stats_reply.get_flags() <<
" >" << std::endl;
565 os << flow_stats_reply.match;
572 switch (flow_stats_reply.of_version) {
573 case openflow10::OFP_VERSION: os << flow_stats_reply.actions;
break;
574 case openflow12::OFP_VERSION: os << flow_stats_reply.instructions;
break;
575 case openflow13::OFP_VERSION: os << flow_stats_reply.instructions;
break;
576 default: os <<
"<unknown OFP version >" << std::endl;
Definition: cofflowstats.h:24
Definition: cofactions.h:22
Definition: cofinstructions.h:24
Definition: cofflowstats.h:23
Definition: cofmatch.h:35
Definition: cofflowstats.h:22
Definition: cofflowstats.h:240
Definition: croflexception.h:27
Definition: cofflowstats.h:26