14 #include "../endian_conversion.h"
17 #include "rofl/common/openflow/openflow.h"
18 #include "rofl/common/cmemory.h"
19 #include "rofl/common/croflexception.h"
20 #include "rofl/common/thread_helper.h"
21 #include "rofl/common/openflow/cofactions.h"
45 uint8_t ofp_version = openflow::OFP_VERSION_UNKNOWN,
90 uint8_t* buf,
size_t buflen);
97 uint8_t* buf,
size_t buflen);
103 check_prerequisites()
const {};
111 set_version(uint8_t ofp_version) { this->ofp_version = ofp_version; };
117 get_version()
const {
return ofp_version; };
123 set_type(uint16_t type) { this->type = type; };
129 get_type()
const {
return type; };
136 set_length(uint16_t len) { this->len = len; };
142 get_length()
const {
return len; };
148 set_body() {
return body; };
154 get_body()
const {
return body; };
161 os <<
"type: 0x" << std::hex << (int)inst.get_type() << std::dec <<
" ";
162 os <<
"length: " << (int)inst.length() <<
" ";
163 os <<
">" << std::endl;
164 if (not inst.get_body().
empty()) {
176 return (inst.get_type() == type);
179 bool operator() (std::pair<uint16_t, cofinstruction*>
const& p) {
180 return (p.second->get_type() == type);
191 mutable uint16_t len;
205 uint8_t ofp_version = rofl::openflow::OFP_VERSION_UNKNOWN,
210 this->actions.set_version(ofp_version);
236 cofinstruction::operator= (inst);
237 actions = inst.actions;
248 set_actions() {
return actions; };
254 get_actions()
const {
return actions; };
269 uint8_t* buf,
size_t buflen);
276 uint8_t* buf,
size_t buflen);
282 check_prerequisites()
const {
283 actions.check_prerequisites();
289 os <<
rofl::indent(0) <<
"<cofinstruction_actions >" << std::endl;
290 {
rofl::indent i(2); os << dynamic_cast<cofinstruction const&>( inst ); }
309 uint8_t ofp_version = rofl::openflow::OFP_VERSION_UNKNOWN,
335 cofinstruction_actions::operator= (inst);
343 os <<
rofl::indent(0) <<
"<cofinstruction_apply_actions >" << std::endl;
344 {
rofl::indent i(2); os << dynamic_cast<const cofinstruction_actions&>( inst ); }
358 uint8_t ofp_version = rofl::openflow::OFP_VERSION_UNKNOWN,
384 cofinstruction_actions::operator= (inst);
392 os <<
rofl::indent(0) <<
"<cofinstruction_write_actions >" << std::endl;
393 {
rofl::indent i(2); os << dynamic_cast<const cofinstruction_actions&>( inst ); }
407 uint8_t ofp_version = rofl::openflow::OFP_VERSION_UNKNOWN,
433 cofinstruction_actions::operator= (inst);
441 os <<
rofl::indent(0) <<
"<cofinstruction_clear_actions >" << std::endl;
442 {
rofl::indent i(2); os << dynamic_cast<const cofinstruction_actions&>( inst ); }
456 uint8_t ofp_version = rofl::openflow::OFP_VERSION_UNKNOWN,
457 uint8_t table_id = 0) :
459 table_id(table_id) {};
484 cofinstruction::operator= (inst);
485 table_id = inst.table_id;
496 get_table_id()
const {
return table_id; };
502 set_table_id(uint8_t table_id) { this->table_id = table_id; };
517 uint8_t* buf,
size_t buflen);
524 uint8_t* buf,
size_t buflen);
530 check_prerequisites()
const;
535 os <<
rofl::indent(0) <<
"<cofinstruction_goto_table >" << std::endl;
536 {
rofl::indent i(2); os << dynamic_cast<const cofinstruction&>( inst ); }
537 os <<
rofl::indent(4) <<
"<table-id:" << (int)inst.get_table_id() <<
" >" << std::endl;
554 uint8_t ofp_version = rofl::openflow::OFP_VERSION_UNKNOWN,
555 uint64_t metadata = 0,
556 uint64_t metadata_mask = 0) :
557 cofinstruction(ofp_version, rofl::openflow13::OFPIT_WRITE_METADATA),
559 metadata_mask(metadata_mask) {};
584 cofinstruction::operator= (inst);
585 metadata = inst.metadata;
586 metadata_mask = inst.metadata_mask;
597 get_metadata()
const {
return metadata; };
603 set_metadata(uint64_t metadata) { this->metadata = metadata; };
609 get_metadata_mask()
const {
return metadata_mask; };
615 set_metadata_mask(uint64_t metadata_mask) { this->metadata_mask = metadata_mask; };
630 uint8_t* buf,
size_t buflen);
637 uint8_t* buf,
size_t buflen);
643 os <<
rofl::indent(0) <<
"<cofinstruction_write_metadata >" << std::endl;
644 {
rofl::indent i(2); os << dynamic_cast<const cofinstruction&>( inst ); }
646 os <<
indent(4) <<
"<metadata: 0x" << (
unsigned long long)inst.get_metadata() <<
" >" << std::endl;
647 os <<
indent(4) <<
"<metadata-mask: 0x" << (
unsigned long long)inst.get_metadata_mask() <<
" >" << std::endl;
655 uint64_t metadata_mask;
670 uint8_t ofp_version = rofl::openflow::OFP_VERSION_UNKNOWN,
673 cofinstruction(ofp_version, rofl::openflow13::OFPIT_EXPERIMENTER),
675 exp_body(exp_body) {};
700 cofinstruction::operator= (inst);
701 exp_id = inst.exp_id;
702 exp_body = inst.exp_body;
713 get_exp_id()
const {
return exp_id; };
719 set_exp_id(uint32_t exp_id) { this->exp_id = exp_id; };
725 get_exp_body()
const {
return exp_body; };
731 set_exp_body() {
return exp_body; };
759 uint8_t* buf,
size_t buflen);
766 uint8_t* buf,
size_t buflen);
772 os <<
rofl::indent(0) <<
"<cofinstruction_experimenter >" << std::endl;
773 {
rofl::indent i(2); os << dynamic_cast<const cofinstruction&>( inst ); }
774 os <<
rofl::indent(4) <<
"<exp-id: 0x" << std::hex << inst.get_exp_id() << std::dec <<
" >" << std::endl;
796 uint8_t ofp_version = rofl::openflow::OFP_VERSION_UNKNOWN,
797 uint32_t meter_id = 0) :
799 meter_id(meter_id) {};
824 cofinstruction::operator= (inst);
825 meter_id = inst.meter_id;
836 set_meter_id(uint32_t meter_id) { this->meter_id = meter_id; };
842 get_meter_id()
const {
return meter_id; };
857 uint8_t* buf,
size_t buflen);
864 uint8_t* buf,
size_t buflen);
870 os <<
"<cofinstruction_meter >" << std::endl;
871 {
rofl::indent i(2); os << dynamic_cast<cofinstruction const&>( inst ); }
872 os <<
rofl::indent(4) <<
"<meter-id: 0x" << std::hex << inst.get_meter_id() <<
" >" << std::endl;
rofl::cmemory & set_body()
Shadows cofinst::set_body() intentionally.
Definition: cofinstruction.h:744
Definition: cofinstruction.h:35
const rofl::cmemory & get_body() const
Shadows cofinst::get_body() intentionally.
Definition: cofinstruction.h:738
Definition: cofinstruction.h:788
Definition: cofinstruction.h:449
Definition: cofactions.h:22
Definition: cofinstruction.h:302
Definition: cofinstruction.h:32
Definition: cofinstruction.h:31
Definition: cofinstruction.h:34
Definition: cofinstruction.h:38
Definition: cofinstruction.h:663
C++ abstraction for malloc'ed memory areas.
Definition: cmemory.h:44
Definition: cofinstruction.h:198
Definition: cofinstruction.h:170
Definition: cofinstruction.h:30
Definition: cofinstruction.h:28
Definition: cofinstruction.h:29
Definition: cofinstruction.h:400
Definition: cofinstruction.h:351
virtual bool empty() const
Returns boolean value empty/non empty.
Definition: cmemory.h:372
Definition: croflexception.h:27