14 #include "rofl/common/croflexception.h"
15 #include "rofl/common/cmemory.h"
16 #include "rofl/common/caddress.h"
17 #include "rofl/common/openflow/cofmatch.h"
18 #include "rofl/common/openflow/cofaction.h"
19 #include "rofl/common/openflow/cofinstruction.h"
20 #include "rofl/common/openflow/cofinstructions.h"
21 #include "rofl/common/openflow/coxmatch.h"
38 uint8_t ofp_version = rofl::openflow::OFP_VERSION_UNKNOWN);
69 check_prerequisites()
const;
77 set_version(uint8_t ofp_version) {
78 this->ofp_version = ofp_version;
79 match.set_version(ofp_version);
80 actions.set_version(ofp_version);
81 instructions.set_version(ofp_version);
88 get_version()
const {
return ofp_version; };
94 set_match() {
return match; };
100 get_match()
const {
return match; };
106 set_actions() {
return actions; };
112 get_actions()
const {
return actions; };
118 set_instructions() {
return instructions; };
124 get_instructions()
const {
return instructions; };
130 set_command(uint8_t command) { this->command = command; };
136 get_command()
const {
return command; };
142 set_table_id(uint8_t table_id) { this->table_id = table_id; }
147 get_table_id()
const {
return table_id; };
153 set_idle_timeout(uint16_t idle_timeout) { this->idle_timeout = idle_timeout; };
159 get_idle_timeout()
const {
return idle_timeout; };
165 set_hard_timeout(uint16_t hard_timeout) { this->hard_timeout = hard_timeout; };
170 get_hard_timeout()
const {
return hard_timeout; };
176 set_cookie(uint64_t cookie) { this->cookie = cookie; };
182 get_cookie()
const {
return cookie; };
188 set_cookie_mask(uint64_t cookie_mask) { this->cookie_mask = cookie_mask; };
194 get_cookie_mask()
const {
return cookie_mask; };
200 set_priority(uint16_t priority) { this->priority = priority; };
206 get_priority()
const {
return priority; };
212 set_buffer_id(uint32_t buffer_id) { this->buffer_id = buffer_id; };
218 get_buffer_id()
const {
return buffer_id; };
224 set_out_port(uint32_t out_port) { this->out_port = out_port; };
230 get_out_port()
const {
return out_port; };
236 set_out_group(uint32_t out_group) { this->out_group = out_group; };
242 get_out_group()
const {
return out_group; };
248 set_flags(uint16_t flags) { this->flags = flags; };
254 get_flags()
const {
return flags; };
269 uint8_t *buf,
size_t buflen);
276 uint8_t *buf,
size_t buflen);
282 operator<< (std::ostream& os,
cofflowmod const& fe) {
283 os <<
rofl::indent(0) <<
"<cofflowmod ofp-version:" << (int)fe.get_version() <<
" >" << std::endl;
285 switch (fe.get_command()) {
286 case rofl::openflow::OFPFC_ADD:
287 os <<
rofl::indent(2) <<
"<command: ADD >" << std::endl;
break;
288 case rofl::openflow::OFPFC_DELETE:
289 os <<
rofl::indent(2) <<
"<command: DELETE >" << std::endl;
break;
290 case rofl::openflow::OFPFC_DELETE_STRICT:
291 os <<
rofl::indent(2) <<
"<command: DELETE-STRICT >"<< std::endl;
break;
292 case rofl::openflow::OFPFC_MODIFY:
293 os <<
rofl::indent(2) <<
"<command: MODIFY >" << std::endl;
break;
294 case rofl::openflow::OFPFC_MODIFY_STRICT:
295 os <<
rofl::indent(2) <<
"<command: MODIFY-STRICT >"<< std::endl;
break;
297 os <<
rofl::indent(2) <<
"<command: UNKNOWN >" << std::endl;
break;
301 os <<
rofl::indent(2) <<
"<cookie: 0x" << (
unsigned long long)fe.get_cookie() <<
" >" << std::endl;
302 os <<
rofl::indent(2) <<
"<cookie-mask: 0x" << (
unsigned long long)fe.get_cookie_mask() <<
" >" << std::endl;
304 os <<
rofl::indent(2) <<
"<table-id: " << (
unsigned int)fe.get_table_id() <<
" >" << std::endl;
305 os <<
rofl::indent(2) <<
"<idle-timeout: " << (
unsigned int)fe.get_idle_timeout() <<
" >" << std::endl;
306 os <<
rofl::indent(2) <<
"<hard-timeout: " << (
unsigned int)fe.get_hard_timeout() <<
" >" << std::endl;
309 os <<
rofl::indent(2) <<
"<priority: 0x" << (
unsigned int)fe.get_priority() <<
" >" << std::endl;
310 os <<
rofl::indent(2) <<
"<buffer-id: 0x" << (
unsigned int)fe.get_buffer_id() <<
" >" << std::endl;
311 os <<
rofl::indent(2) <<
"<out-port: 0x" << (
unsigned int)fe.get_out_port() <<
" >" << std::endl;
312 os <<
rofl::indent(2) <<
"<out-group: 0x" << (
unsigned int)fe.get_out_group() <<
" >" << std::endl;
313 os <<
rofl::indent(2) <<
"<flags: 0x" << (
unsigned int)fe.get_flags() <<
" >" << std::endl;
317 os << fe.get_match();
319 switch (fe.get_version()) {
320 case rofl::openflow10::OFP_VERSION: {
321 os << fe.get_actions();
323 case rofl::openflow12::OFP_VERSION:
324 case rofl::openflow13::OFP_VERSION: {
325 os << fe.get_instructions();
342 uint16_t idle_timeout;
343 uint16_t hard_timeout;
345 uint64_t cookie_mask;
352 struct ofp10_flow_mod {
356 uint16_t idle_timeout;
357 uint16_t hard_timeout;
363 } __attribute__((packed));
365 struct ofp13_flow_mod {
367 uint64_t cookie_mask;
370 uint16_t idle_timeout;
371 uint16_t hard_timeout;
380 } __attribute__((packed));
Definition: cofflowmod.h:26
Definition: cofactions.h:22
Definition: cofinstructions.h:24
Definition: cofmatch.h:35
Definition: openflow10.h:551
Definition: cofflowmod.h:27
Definition: cofflowmod.h:31
Definition: cofflowmod.h:28
Definition: croflexception.h:27