41 min_body = max_body =
sizeof(ofp_flow_stats_request);
44 min_body = max_body =
sizeof(ofp_aggregate_stats_request);
54 case OFPST_PORT_TABLE:
61 if ((min_body != 0 || max_body != 0) && (body_len < min_body || body_len > max_body))
63 NS_LOG_ERROR(
"stats request type " <<
type <<
" with bad body length " << body_len);
83 case OFPST_PORT_TABLE:
101 case OFPST_AGGREGATE:
107 case OFPST_PORT_TABLE:
126 case OFPST_AGGREGATE:
127 free((ofp_aggregate_stats_request*)state);
135 case OFPST_PORT_TABLE:
145 ofp_desc_stats* ods = (ofp_desc_stats*)ofpbuf_put_zeros(buffer,
sizeof *ods);
146 strncpy(ods->mfr_desc,
148 sizeof ods->mfr_desc);
155 #define MAX_FLOW_STATS_BYTES 4096
160 const ofp_flow_stats_request* fsr = (ofp_flow_stats_request*)body;
163 s->table_idx = fsr->table_id == 0xff ? 0 : fsr->table_id;
164 memset(&s->position, 0,
sizeof s->position);
177 int length =
sizeof *ofs + flow->sf_acts->actions_len;
178 ofs = (ofp_flow_stats*)ofpbuf_put_zeros(s->buffer, length);
179 ofs->length = htons(length);
180 ofs->table_id = s->table_idx;
181 ofs->match.wildcards = htonl(flow->key.wildcards);
182 ofs->match.in_port = flow->key.flow.in_port;
183 memcpy(ofs->match.dl_src, flow->key.flow.dl_src, ETH_ADDR_LEN);
184 memcpy(ofs->match.dl_dst, flow->key.flow.dl_dst, ETH_ADDR_LEN);
185 ofs->match.dl_vlan = flow->key.flow.dl_vlan;
186 ofs->match.dl_type = flow->key.flow.dl_type;
187 ofs->match.nw_src = flow->key.flow.nw_src;
188 ofs->match.nw_dst = flow->key.flow.nw_dst;
189 ofs->match.nw_proto = flow->key.flow.nw_proto;
190 ofs->match.tp_src = flow->key.flow.tp_src;
191 ofs->match.tp_dst = flow->key.flow.tp_dst;
192 ofs->duration = htonl(s->now - flow->created);
193 ofs->priority = htons(flow->priority);
194 ofs->idle_timeout = htons(flow->idle_timeout);
195 ofs->hard_timeout = htons(flow->hard_timeout);
196 ofs->packet_count = htonll(flow->packet_count);
197 ofs->byte_count = htonll(flow->byte_count);
198 memcpy(ofs->actions, flow->sf_acts->actions, flow->sf_acts->actions_len);
206 sw_flow_key match_key;
208 flow_extract_match(&match_key, &s->
rq.match);
217 if (table->iterate(table,
237 *state = (ofp_aggregate_stats_request*)body;
244 ofp_aggregate_stats_reply* s = (ofp_aggregate_stats_reply*)state;
245 s->packet_count += flow->packet_count;
246 s->byte_count += flow->byte_count;
253 ofp_aggregate_stats_request* s,
256 ofp_aggregate_stats_request* rq = s;
257 ofp_aggregate_stats_reply* rpy =
258 (ofp_aggregate_stats_reply*)ofpbuf_put_zeros(buffer,
sizeof *rpy);
259 sw_flow_key match_key;
260 flow_extract_match(&match_key, &rq->match);
261 int table_idx = rq->table_id == 0xff ? 0 : rq->table_id;
263 sw_table_position position;
264 memset(&position, 0,
sizeof position);
266 while (table_idx < swtch->GetChain()->n_tables &&
267 (rq->table_id == 0xff || rq->table_id == table_idx))
269 sw_table* table =
swtch->GetChain()->tables[table_idx];
270 int error = table->iterate(table,
282 memset(&position, 0,
sizeof position);
285 rpy->packet_count = htonll(rpy->packet_count);
286 rpy->byte_count = htonll(rpy->byte_count);
287 rpy->flow_count = htonl(rpy->flow_count);
294 sw_chain* ft =
swtch->GetChain();
295 for (
int i = 0; i < ft->n_tables; i++)
297 ofp_table_stats* ots = (ofp_table_stats*)ofpbuf_put_zeros(buffer,
sizeof *ots);
298 sw_table_stats stats;
299 ft->tables[i]->stats(ft->tables[i], &stats);
300 strncpy(ots->name, stats.name,
sizeof ots->name);
302 ots->wildcards = htonl(stats.wildcards);
303 ots->max_entries = htonl(stats.max_flows);
304 ots->active_count = htonl(stats.n_flows);
305 ots->lookup_count = htonll(stats.n_lookup);
306 ots->matched_count = htonll(stats.n_matched);
315 ofp_vport_table_stats* opts = (ofp_vport_table_stats*)ofpbuf_put_zeros(buffer,
sizeof *opts);
316 opts->max_vports = htonl(
swtch->GetVPortTable().max_vports);
317 opts->active_vports = htonl(
swtch->GetVPortTable().active_vports);
318 opts->lookup_count = htonll(
swtch->GetVPortTable().lookup_count);
319 opts->port_match_count = htonll(
swtch->GetVPortTable().port_match_count);
320 opts->chain_match_count = htonll(
swtch->GetVPortTable().chain_match_count);
331 s->ports = (uint32_t*)xmalloc(body_len);
332 memcpy(s->ports, body, body_len);
333 s->num_ports = body_len /
sizeof(uint32_t);
346 for (
size_t i = 0; i < s->
num_ports; i++)
350 if (
port <= OFPP_MAX)
359 ops = (ofp_port_stats*)ofpbuf_put_zeros(buffer,
sizeof *ops);
360 ops->port_no = htonl(
swtch->GetSwitchPortIndex(p));
365 ops->rx_dropped = htonll(-1);
367 ops->rx_errors = htonll(-1);
368 ops->tx_errors = htonll(-1);
369 ops->rx_frame_err = htonll(-1);
370 ops->rx_over_err = htonll(-1);
371 ops->rx_crc_err = htonll(-1);
372 ops->collisions = htonll(-1);
376 else if (
port >= OFPP_VP_START &&
port <= OFPP_VP_END)
379 vport_table_t vt =
swtch->GetVPortTable();
380 vport_table_entry* vpe = vport_table_lookup(&vt,
port);
387 ops = (ofp_port_stats*)ofpbuf_put_zeros(buffer,
sizeof *ops);
388 ops->port_no = htonl(vpe->vport);
389 ops->rx_packets = htonll(-1);
390 ops->tx_packets = htonll(vpe->packet_count);
391 ops->rx_bytes = htonll(-1);
392 ops->tx_bytes = htonll(vpe->byte_count);
393 ops->rx_dropped = htonll(-1);
394 ops->tx_dropped = htonll(-1);
395 ops->rx_errors = htonll(-1);
396 ops->tx_errors = htonll(-1);
397 ops->rx_frame_err = htonll(-1);
398 ops->rx_over_err = htonll(-1);
399 ops->rx_crc_err = htonll(-1);
400 ops->collisions = htonll(-1);
401 ops->mpls_ttl0_dropped = htonll(-1);
414 case OFPAT_SET_VLAN_VID:
415 case OFPAT_SET_VLAN_PCP:
416 case OFPAT_STRIP_VLAN:
417 case OFPAT_SET_DL_SRC:
418 case OFPAT_SET_DL_DST:
419 case OFPAT_SET_NW_SRC:
420 case OFPAT_SET_NW_DST:
421 case OFPAT_SET_TP_SRC:
422 case OFPAT_SET_TP_DST:
423 case OFPAT_SET_MPLS_LABEL:
424 case OFPAT_SET_MPLS_EXP:
434 const sw_flow_key* key,
435 const ofp_action_header* ah)
442 if (len !=
sizeof(ofp_action_output))
444 return OFPBAC_BAD_LEN;
447 ofp_action_output* oa = (ofp_action_output*)ah;
452 if (oa->port == OFPP_NONE || oa->port == key->flow.in_port)
454 return OFPBAC_BAD_OUT_PORT;
457 return ACT_VALIDATION_OK;
459 case OFPAT_SET_VLAN_VID:
460 size =
sizeof(ofp_action_vlan_vid);
462 case OFPAT_SET_VLAN_PCP:
463 size =
sizeof(ofp_action_vlan_pcp);
465 case OFPAT_STRIP_VLAN:
466 size =
sizeof(ofp_action_header);
468 case OFPAT_SET_DL_SRC:
469 case OFPAT_SET_DL_DST:
470 size =
sizeof(ofp_action_dl_addr);
472 case OFPAT_SET_NW_SRC:
473 case OFPAT_SET_NW_DST:
474 size =
sizeof(ofp_action_nw_addr);
476 case OFPAT_SET_TP_SRC:
477 case OFPAT_SET_TP_DST:
478 size =
sizeof(ofp_action_tp_port);
480 case OFPAT_SET_MPLS_LABEL:
481 size =
sizeof(ofp_action_mpls_label);
483 case OFPAT_SET_MPLS_EXP:
484 size =
sizeof(ofp_action_mpls_exp);
492 return OFPBAC_BAD_LEN;
494 return ACT_VALIDATION_OK;
504 case OFPAT_SET_VLAN_VID:
507 case OFPAT_SET_VLAN_PCP:
510 case OFPAT_STRIP_VLAN:
513 case OFPAT_SET_DL_SRC:
514 case OFPAT_SET_DL_DST:
517 case OFPAT_SET_NW_SRC:
518 case OFPAT_SET_NW_DST:
521 case OFPAT_SET_TP_SRC:
522 case OFPAT_SET_TP_DST:
525 case OFPAT_SET_MPLS_LABEL:
528 case OFPAT_SET_MPLS_EXP:
541 case OFPPAT_POP_MPLS:
542 case OFPPAT_PUSH_MPLS:
543 case OFPPAT_SET_MPLS_LABEL:
544 case OFPPAT_SET_MPLS_EXP:
558 case OFPPAT_POP_MPLS:
559 size =
sizeof(ofp_vport_action_pop_mpls);
561 case OFPPAT_PUSH_MPLS:
562 size =
sizeof(ofp_vport_action_push_mpls);
564 case OFPPAT_SET_MPLS_LABEL:
565 size =
sizeof(ofp_vport_action_set_mpls_label);
567 case OFPPAT_SET_MPLS_EXP:
568 size =
sizeof(ofp_vport_action_set_mpls_exp);
576 return OFPBAC_BAD_LEN;
578 return ACT_VALIDATION_OK;
584 const sw_flow_key* key,
585 const ofp_action_header* ah)
589 case OFPPAT_POP_MPLS: {
590 ofp_vport_action_pop_mpls* opapm = (ofp_vport_action_pop_mpls*)ah;
591 pop_mpls_act(
nullptr, buffer, key, &opapm->apm);
594 case OFPPAT_PUSH_MPLS: {
595 ofp_vport_action_push_mpls* opapm = (ofp_vport_action_push_mpls*)ah;
596 push_mpls_act(
nullptr, buffer, key, &opapm->apm);
599 case OFPPAT_SET_MPLS_LABEL: {
600 ofp_vport_action_set_mpls_label* oparml = (ofp_vport_action_set_mpls_label*)ah;
601 set_mpls_label_act(buffer, key, oparml->label_out);
604 case OFPPAT_SET_MPLS_EXP: {
605 ofp_vport_action_set_mpls_exp* oparme = (ofp_vport_action_set_mpls_exp*)ah;
606 set_mpls_exp_act(buffer, key, oparme->exp);
635 size =
sizeof(er_action_pop_mpls);
638 size =
sizeof(er_action_push_mpls);
646 return OFPBAC_BAD_LEN;
648 return ACT_VALIDATION_OK;
654 const sw_flow_key* key,
655 const er_action_header* ah)
659 case ERXT_POP_MPLS: {
660 er_action_pop_mpls* erapm = (er_action_pop_mpls*)ah;
661 pop_mpls_act(
nullptr, buffer, key, &erapm->apm);
664 case ERXT_PUSH_MPLS: {
665 er_action_push_mpls* erapm = (er_action_push_mpls*)ah;
666 push_mpls_act(
nullptr, buffer, key, &erapm->apm);
680 .SetGroupName(
"OpenFlow")
695 NS_LOG_INFO(
"This Controller has already registered this switch!");
708 NS_LOG_ERROR(
"Can't send to this switch, not registered to the Controller.");
712 swtch->ForwardControlInput(msg, length);
724 ofp_flow_mod* ofm = (ofp_flow_mod*)malloc(
sizeof(ofp_flow_mod) + actions_len);
725 ofm->header.version = OFP_VERSION;
726 ofm->header.type = OFPT_FLOW_MOD;
727 ofm->header.length = htons(
sizeof(ofp_flow_mod) + actions_len);
728 ofm->command = htons(command);
729 ofm->idle_timeout = htons(idle_timeout);
730 ofm->hard_timeout = htons(hard_timeout);
731 ofm->buffer_id = htonl(buffer_id);
732 ofm->priority = OFP_DEFAULT_PRIORITY;
733 memcpy(ofm->actions, acts, actions_len);
735 ofm->match.wildcards = key.wildcards;
736 ofm->match.in_port = key.flow.in_port;
737 memcpy(ofm->match.dl_src,
739 sizeof ofm->match.dl_src);
740 memcpy(ofm->match.dl_dst,
742 sizeof ofm->match.dl_dst);
743 ofm->match.dl_vlan = key.flow.dl_vlan;
744 ofm->match.dl_type = key.flow.dl_type;
745 ofm->match.nw_proto = key.flow.nw_proto;
746 ofm->match.nw_src = key.flow.nw_src;
747 ofm->match.nw_dst = key.flow.nw_dst;
748 ofm->match.tp_src = key.flow.tp_src;
749 ofm->match.tp_dst = key.flow.tp_dst;
750 ofm->match.mpls_label1 = key.flow.mpls_label1;
751 ofm->match.mpls_label2 =
752 key.flow.mpls_label1;
760 ofp_header* hdr = (ofp_header*)ofpbuf_try_pull(buffer,
sizeof(ofp_header));
761 uint8_t
type = hdr->type;
762 ofpbuf_push_uninit(buffer,
sizeof(ofp_header));
779 NS_LOG_WARN(
"Dump Callback Error: " << strerror(-error));
793 .SetGroupName(
"OpenFlow")
803 NS_LOG_ERROR(
"Can't receive from this switch, not registered to the Controller.");
811 if (
type == OFPT_PACKET_IN)
814 ofp_packet_in* opi = (ofp_packet_in*)ofpbuf_try_pull(buffer, offsetof(ofp_packet_in,
data));
815 int port = ntohs(opi->in_port);
820 flow_extract(buffer,
port != -1 ?
port : OFPP_NONE, &key.flow);
837 TypeId(
"ns3::ofi::LearningController")
839 .SetGroupName(
"Openflow")
841 .AddAttribute(
"ExpirationTime",
842 "Time it takes for learned MAC state entry/created flow to expire.",
854 NS_LOG_ERROR(
"Can't receive from this switch, not registered to the Controller.");
862 if (
type == OFPT_PACKET_IN)
865 ofp_packet_in* opi = (ofp_packet_in*)ofpbuf_try_pull(buffer, offsetof(ofp_packet_in,
data));
866 int port = ntohs(opi->in_port);
871 flow_extract(buffer,
port != -1 ?
port : OFPP_NONE, &key.flow);
873 uint16_t out_port = OFPP_FLOOD;
874 uint16_t in_port = ntohs(key.flow.in_port);
884 out_port = st->second.port;
888 NS_LOG_INFO(
"Setting to flood; don't know yet what port " << dst_addr
889 <<
" is connected to");
894 NS_LOG_INFO(
"Setting to flood; this packet is a broadcast");
898 ofp_action_output
x[1];
899 x[0].type = htons(OFPAT_OUTPUT);
900 x[0].len = htons(
sizeof(ofp_action_output));
901 x[0].port = out_port;
924 NS_LOG_INFO(
"Learned that " << src_addr <<
" can be found over port " << in_port);
927 ofp_action_output x2[1];
928 x2[0].type = htons(OFPAT_OUTPUT);
929 x2[0].len = htons(
sizeof(ofp_action_output));
930 x2[0].port = in_port;
933 src_addr.
CopyTo(key.flow.dl_dst);
934 dst_addr.
CopyTo(key.flow.dl_src);
935 key.flow.in_port = out_port;
954 const ofp_action_header* actions,
965 uint16_t in_port = key->flow.in_port;
966 auto p = (uint8_t*)actions;
970 if (actions_len == 0)
972 NS_LOG_INFO(
"No actions set to this flow. Dropping packet.");
978 while (actions_len > 0)
980 ofp_action_header* ah = (ofp_action_header*)p;
981 size_t len = htons(ah->len);
985 swtch->DoOutput(packet_uid, in_port, max_len, prev_port, ignore_no_fwd);
989 if (ah->type == htons(OFPAT_OUTPUT))
991 ofp_action_output* oa = (ofp_action_output*)p;
994 prev_port = oa->port;
996 max_len = ntohs(oa->max_len);
1000 uint16_t
type = ntohs(ah->type);
1002 (ofp_action_type)
type))
1006 else if (
type == OFPAT_VENDOR)
1016 if (prev_port != -1)
1018 swtch->DoOutput(packet_uid, in_port, max_len, prev_port, ignore_no_fwd);
1023 ValidateActions(
const sw_flow_key* key,
const ofp_action_header* actions,
size_t actions_len)
1025 auto p = (uint8_t*)actions;
1028 while (actions_len >=
sizeof(ofp_action_header))
1030 ofp_action_header* ah = (ofp_action_header*)p;
1031 size_t len = ntohs(ah->len);
1036 if ((actions_len < len) || (len % 8) != 0)
1038 return OFPBAC_BAD_LEN;
1041 type = ntohs(ah->type);
1045 if (err != ACT_VALIDATION_OK)
1050 else if (
type == OFPAT_VENDOR)
1053 if (err != ACT_VALIDATION_OK)
1060 return OFPBAC_BAD_TYPE;
1068 if (actions_len != 0)
1070 return OFPBAC_BAD_LEN;
1073 return ACT_VALIDATION_OK;
1078 uint64_t packet_uid,
1081 const ofp_action_header* actions,
1090 uint16_t in_port = ntohs(key->flow.in_port);
1091 auto p = (uint8_t*)actions;
1093 ofp_action_output* oa;
1098 while (actions_len > 0)
1100 ofp_action_header* ah = (ofp_action_header*)p;
1101 size_t len = htons(ah->len);
1102 if (prev_port != -1)
1104 swtch->DoOutput(packet_uid, in_port, max_len, prev_port,
false);
1108 if (ah->type == htons(OFPAT_OUTPUT))
1110 oa = (ofp_action_output*)p;
1111 prev_port = ntohl(oa->port);
1112 max_len = ntohs(oa->max_len);
1124 if (prev_port != -1)
1126 swtch->DoOutput(packet_uid, in_port, max_len, prev_port,
false);
1133 auto p = (uint8_t*)actions;
1136 while (actions_len >=
sizeof(ofp_action_header))
1138 ofp_action_header* ah = (ofp_action_header*)p;
1139 size_t len = ntohs(ah->len);
1144 if ((actions_len < len) || (len % 8) != 0)
1146 return OFPBAC_BAD_LEN;
1149 type = ntohs(ah->type);
1151 (ofp_vport_action_type)
type))
1154 if (err != ACT_VALIDATION_OK)
1161 return OFPBAC_BAD_TYPE;
1169 if (actions_len != 0)
1171 return OFPBAC_BAD_LEN;
1174 return ACT_VALIDATION_OK;
1178 ExecuteVendor(ofpbuf* buffer,
const sw_flow_key* key,
const ofp_action_header* ah)
1180 ofp_action_vendor_header* avh = (ofp_action_vendor_header*)ah;
1182 switch (ntohl(avh->vendor))
1187 case ER_VENDOR_ID: {
1188 const er_action_header* erah = (
const er_action_header*)avh;
1194 NS_LOG_INFO(
"attempt to execute action with unknown vendor: " << ntohl(avh->vendor));
1202 ofp_action_vendor_header* avh;
1203 int ret = ACT_VALIDATION_OK;
1205 if (len <
sizeof(ofp_action_vendor_header))
1207 return OFPBAC_BAD_LEN;
1210 avh = (ofp_action_vendor_header*)ah;
1212 switch (ntohl(avh->vendor))
1215 ret = OFPBAC_BAD_VENDOR_TYPE;
1219 const er_action_header* erah = (
const er_action_header*)avh;
1224 return OFPBAC_BAD_VENDOR;
void CopyFrom(const uint8_t buffer[6])
void CopyTo(uint8_t buffer[6]) const
A base class which provides memory management and object aggregation.
static const char * GetManufacturerDescription()
void StatsDone(ofi::StatsDumpCallback *cb_)
Stats callback is done.
int StatsDump(ofi::StatsDumpCallback *cb_)
Stats callback is ready for a dump.
static const char * GetSoftwareDescription()
static const char * GetHardwareDescription()
static const char * GetSerialNumber()
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
bool IsZero() const
Exactly equivalent to t == 0.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
An interface for a Controller of OpenFlowSwitchNetDevices.
virtual void SendToSwitch(Ptr< OpenFlowSwitchNetDevice > swtch, void *msg, size_t length)
However the controller is implemented, this method is to be used to pass a message on to a switch.
uint8_t GetPacketType(ofpbuf *buffer)
Get the packet type on the buffer, which can then be used to determine how to handle the buffer.
Switches_t m_switches
The collection of switches registered to this controller.
~Controller() override
Destructor.
static TypeId GetTypeId()
Register this type.
ofp_flow_mod * BuildFlow(sw_flow_key key, uint32_t buffer_id, uint16_t command, void *acts, size_t actions_len, int idle_timeout, int hard_timeout)
Construct flow data from a matching key to build a flow entry for adding, modifying,...
void StartDump(StatsDumpCallback *cb)
Starts a callback-based, reliable, possibly multi-message reply to a request made by the controller.
virtual void AddSwitch(Ptr< OpenFlowSwitchNetDevice > swtch)
Adds a switch to the controller.
Demonstration of a Drop controller.
void ReceiveFromSwitch(Ptr< OpenFlowSwitchNetDevice > swtch, ofpbuf *buffer) override
A switch calls this method to pass a message on to the Controller.
static TypeId GetTypeId()
Register this type.
Demonstration of a Learning controller.
static TypeId GetTypeId()
Register this type.
void ReceiveFromSwitch(Ptr< OpenFlowSwitchNetDevice > swtch, ofpbuf *buffer) override
A switch calls this method to pass a message on to the Controller.
Time m_expirationTime
Time it takes for learned MAC state entry/created flow to expire.
LearnState_t m_learnState
Learned state data.
int PortStatsInit(const void *body, int body_len, void **state)
Initialize the stats.
int PortTableStatsDump(Ptr< OpenFlowSwitchNetDevice > dp, void *state, ofpbuf *buffer)
Dump the stats.
int FlowStatsDump(Ptr< OpenFlowSwitchNetDevice > dp, FlowStatsState *state, ofpbuf *buffer)
Dump the stats.
int(* AggregateDumpCallback)(sw_flow *flow, void *state)
Aggregate dump callback functor.
Stats(ofp_stats_types _type, size_t body_len)
Constructor.
void DoCleanup(void *state)
Cleans any state created by the init or dump functions.
int AggregateStatsInit(const void *body, int body_len, void **state)
Initialize the stats.
int DoDump(Ptr< OpenFlowSwitchNetDevice > swtch, void *state, ofpbuf *buffer)
Appends statistics for OpenFlowSwitchNetDevice to 'buffer'.
int DoInit(const void *body, int body_len, void **state)
Prepares to dump some kind of statistics on the connected OpenFlowSwitchNetDevice.
int AggregateStatsDump(Ptr< OpenFlowSwitchNetDevice > dp, ofp_aggregate_stats_request *state, ofpbuf *buffer)
Dump the stats.
int TableStatsDump(Ptr< OpenFlowSwitchNetDevice > dp, void *state, ofpbuf *buffer)
Dump the stats.
int PortStatsDump(Ptr< OpenFlowSwitchNetDevice > dp, PortStatsState *state, ofpbuf *buffer)
Dump the stats.
ofp_stats_types type
Status type.
int FlowStatsInit(const void *body, int body_len, void **state)
Initialize the stats.
int DescStatsDump(void *state, ofpbuf *buffer)
Dumps the stats description.
int(* FlowDumpCallback)(sw_flow *flow, void *state)
Flow dump callback functor.
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Time Seconds(double value)
Construct a Time in the indicated unit.
void ExecuteVPortActions(Ptr< OpenFlowSwitchNetDevice > swtch, uint64_t packet_uid, ofpbuf *buffer, sw_flow_key *key, const ofp_action_header *actions, size_t actions_len)
Executes a list of virtual port table entry actions.
void ExecuteActions(Ptr< OpenFlowSwitchNetDevice > swtch, uint64_t packet_uid, ofpbuf *buffer, sw_flow_key *key, const ofp_action_header *actions, size_t actions_len, int ignore_no_fwd)
Executes a list of flow table actions.
uint16_t ValidateVendor(const sw_flow_key *key, const ofp_action_header *ah, uint16_t len)
Validates a vendor-defined action.
void ExecuteVendor(ofpbuf *buffer, const sw_flow_key *key, const ofp_action_header *ah)
Executes a vendor-defined action.
uint16_t ValidateActions(const sw_flow_key *key, const ofp_action_header *actions, size_t actions_len)
Validates a list of flow table actions.
int Stats_AggregateDumpCallback(sw_flow *flow, void *state)
int Stats_FlowDumpCallback(sw_flow *flow, void *state)
uint16_t ValidateVPortActions(const ofp_action_header *actions, size_t actions_len)
Validates a list of virtual port table entry actions.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
#define MAX_FLOW_STATS_BYTES
void strip_vlan(ofpbuf *buffer, sw_flow_key *key, const ofp_action_header *ah)
void set_mpls_label(ofpbuf *buffer, sw_flow_key *key, const ofp_action_header *ah)
void set_dl_addr(ofpbuf *buffer, sw_flow_key *key, const ofp_action_header *ah)
void set_nw_addr(ofpbuf *buffer, sw_flow_key *key, const ofp_action_header *ah)
void set_vlan_pcp(ofpbuf *buffer, sw_flow_key *key, const ofp_action_header *ah)
void set_tp_port(ofpbuf *buffer, sw_flow_key *key, const ofp_action_header *ah)
void set_mpls_exp(ofpbuf *buffer, sw_flow_key *key, const ofp_action_header *ah)
void set_vlan_vid(ofpbuf *buffer, sw_flow_key *key, const ofp_action_header *ah)
static bool IsValidType(ofp_action_type type)
static void Execute(ofp_action_type type, ofpbuf *buffer, sw_flow_key *key, const ofp_action_header *ah)
Executes the action.
static uint16_t Validate(ofp_action_type type, size_t len, const sw_flow_key *key, const ofp_action_header *ah)
Validates the action on whether its data is valid or not.
static bool IsValidType(er_action_type type)
static void Execute(er_action_type type, ofpbuf *buffer, const sw_flow_key *key, const er_action_header *ah)
Executes the action.
static uint16_t Validate(er_action_type type, size_t len)
Validates the action on whether its data is valid or not.
uint32_t port
Learned port.
Ptr< NetDevice > netdev
NetDevice pointer.
unsigned long long int mpls_ttl0_dropped
Counter of packets dropped due to MPLS TTL.
unsigned long long int tx_packets
Counter of Tx packets.
unsigned long long int tx_bytes
Counter of Tx bytes.
unsigned long long int rx_packets
Counter of Rx packets.
unsigned long long int rx_bytes
Counter of Rx bytes.
unsigned long long int tx_dropped
Counter of Tx dropped packets.
State of the FlowStats request/reply.
ofp_flow_stats_request rq
Stats requests.
sw_table_position position
Table position.
int table_idx
Table index.
State of the PortStats request/reply.
uint32_t * ports
Array of ports in network byte order.
uint32_t num_ports
Number of ports in host byte order.
Callback for a stats dump request.
Ptr< OpenFlowSwitchNetDevice > swtch
The switch that we're requesting data from.
static uint16_t Validate(ofp_vport_action_type type, size_t len, const ofp_action_header *ah)
Validates the action on whether its data is valid or not.
static void Execute(ofp_vport_action_type type, ofpbuf *buffer, const sw_flow_key *key, const ofp_action_header *ah)
Executes the action.
static bool IsValidType(ofp_vport_action_type type)