24 #include <ns3/object-vector.h>
26 #undef NS_LOG_APPEND_CONTEXT
27 #define NS_LOG_APPEND_CONTEXT \
30 std::clog << "[dp " << m_dpId << "] "; \
73 TypeId(
"ns3::OFSwitch13Device")
75 .SetGroupName(
"OFSwitch13")
79 "CPU processing capacity (in terms of throughput).",
82 MakeDataRateChecker())
83 .AddAttribute(
"DatapathId",
84 "The unique identification of this OpenFlow switch.",
88 MakeUintegerChecker<uint64_t>())
91 "The maximum number of entries allowed on each flow table.",
95 MakeUintegerChecker<uint32_t>(0, FLOW_TABLE_MAX_ENTRIES))
98 "The maximum number of entries allowed on group table.",
102 MakeUintegerChecker<uint32_t>(0, GROUP_TABLE_MAX_ENTRIES))
105 "The maximum number of entries allowed on meter table.",
109 MakeUintegerChecker<uint32_t>(0, METER_TABLE_MAX_ENTRIES))
112 "The number of pipeline flow tables.",
116 MakeUintegerChecker<uint32_t>(1, (OFPTT_MAX + 1)))
117 .AddAttribute(
"PortList",
118 "The list of ports associated to this switch.",
121 MakeObjectVectorChecker<OFSwitch13Port>())
124 "Average time to perform a TCAM operation in pipeline.",
130 "The interval between timeout operations on datapath.",
137 "Trace source indicating an expired packet in buffer.",
139 "ns3::Packet::TracedCallback")
142 "Trace source indicating a packet retrieved from buffer.",
145 "ns3::Packet::TracedCallback")
148 "Trace source indicating a packet saved into buffer.",
150 "ns3::Packet::TracedCallback")
153 "Trace source indicating a packet dropped by meter band.",
155 "ns3::OFSwitch13Device::MeterDropTracedCallback")
158 "Trace source indicating a packet dropped by CPU "
159 "overloaded processing capacity.",
161 "ns3::Packet::TracedCallback")
164 "Trace source indicating an unmatched packet dropped by "
165 "a flow table without a table-miss entry.",
167 "ns3::OFSwitch13Device::TableDropTracedCallback")
170 "Trace source indicating a packet sent to pipeline.",
172 "ns3::Packet::TracedCallback")
175 "Trace source indicating a datapath timeout operation.",
178 "ns3::OFSwitch13Device::DeviceTracedCallback")
182 "Traced value indicating the avg CPU processing load"
183 " (periodically updated on datapath timeout operation).",
185 "ns3::TracedValueCallback::DataRate")
188 "Traced value indicating the number of group entries"
189 " (periodically updated on datapath timeout operation).",
191 "ns3::TracedValueCallback::Uint32")
194 "Traced value indicating the number of meter entries"
195 " (periodically updated on datapath timeout operation).",
197 "ns3::TracedValueCallback::Uint32")
200 "Traced value indicating the avg pipeline lookup delay"
201 " (periodically updated on datapath timeout operation).",
203 "ns3::TracedValueCallback::Time")
206 "Traced value indicating the total number of flow entries"
207 " (periodically updated on datapath timeout operation).",
209 "ns3::TracedValueCallback::Uint32");
318 return m_datapath->pipeline->tables[tableId]->stats->active_count;
326 return m_datapath->pipeline->tables[tableId]->features->max_entries;
415 uint32_t flowEntries = 0;
434 NS_LOG_INFO(
"Adding port addr " << portDevice->GetAddress());
436 "No more ports allowed.");
440 ofPort = CreateObject<OFSwitch13Port>(
m_datapath, portDevice,
this);
468 uint32_t pktSizeBits = packet->
GetSize() * 8;
472 NS_LOG_DEBUG(
"Drop packet due to CPU overloaded capacity.");
497 "Invalid address type (only IPv4 supported by now).");
499 "Controller address already in use.");
507 error = ctrlSocket->
Bind();
527 remoteCtrl->m_address = ctrlAddr;
528 remoteCtrl->m_socket = ctrlSocket;
540 dev->SendPacketInMessage(pkt,
543 dev->m_datapath->config.miss_send_len);
548 struct remote* remote)
554 ofpbuf_delete(buffer);
555 return dev->SendToController(packet, remoteCtrl);
574 struct packet* pkt_copy = packet_clone(pkt);
575 pkt_copy->packet_out =
false;
576 pipeline_process_packet(pkt_copy->dp->pipeline, pkt_copy);
580 case (OFPP_IN_PORT): {
581 dev->SendToSwitchPort(pkt, pkt->in_port, outQueue);
584 case (OFPP_CONTROLLER): {
585 dev->SendPacketInMessage(pkt,
587 pkt->handle_std->table_miss ? OFPR_NO_MATCH
596 LIST_FOR_EACH(p,
struct sw_port, node, &pkt->dp->port_list)
598 if ((p->stats->port_no == pkt->in_port) ||
599 (outPort == OFPP_FLOOD && p->conf->config & OFPPC_NO_FWD))
603 dev->SendToSwitchPort(pkt, p->stats->port_no);
610 if (pkt->in_port != outPort)
612 dev->SendToSwitchPort(pkt, outPort, outQueue);
622 dev->NotifyMeterEntryCreated(entry);
627 struct meter_entry* entry)
630 dev->NotifyPacketDroppedByMeter(pkt, entry);
635 struct flow_table* table)
638 dev->NotifyPacketDroppedByTable(pkt, table);
645 dev->NotifyPacketCloned(pkt, clone);
652 dev->NotifyPacketDestroyed(pkt);
659 dev->BufferPacketSave(pkt->ns3_uid,
timeout);
666 dev->BufferPacketRetrieve(pkt->ns3_uid);
696 free(ctrl->m_remote);
743 struct datapath* dp = (
struct datapath*)xmalloc(
sizeof(
struct datapath));
745 dp->mfr_desc = (
char*)xmalloc(DESC_STR_LEN);
746 dp->hw_desc = (
char*)xmalloc(DESC_STR_LEN);
747 dp->sw_desc = (
char*)xmalloc(DESC_STR_LEN);
748 dp->dp_desc = (
char*)xmalloc(DESC_STR_LEN);
749 dp->serial_num = (
char*)xmalloc(DESC_STR_LEN);
750 strncpy(dp->mfr_desc,
"The ns-3 team", DESC_STR_LEN);
751 strncpy(dp->hw_desc,
"N/A", DESC_STR_LEN);
752 strncpy(dp->sw_desc,
"The ns-3 OFSwitch13 module", DESC_STR_LEN);
753 strncpy(dp->dp_desc,
"Using BOFUSS (from CPqD)", DESC_STR_LEN);
754 strncpy(dp->serial_num,
"3.1.0", DESC_STR_LEN);
759 list_init(&dp->remotes);
762 dp->generation_id = -1;
764 memset(dp->ports, 0x00,
sizeof(dp->ports));
765 dp->local_port =
nullptr;
770 dp->buffers = dp_buffers_create(dp);
771 dp->pipeline = pipeline_create(dp);
772 dp->groups = group_table_create(dp);
773 dp->meters = meter_table_create(dp);
777 list_init(&dp->port_list);
779 dp->max_queues = PORT_MAX_QUEUES;
784 dp->config.miss_send_len = OFP_DEFAULT_MISS_SEND_LEN;
805 "Can't reduce table size to this value.");
833 "Can't reduce table size to this value.");
834 for (
size_t i = 0; i < 4; i++)
850 "Can't reduce table size to this value.");
858 meter_table_add_tokens(dp->meters);
859 pipeline_timeout(dp->pipeline);
864 port->PortUpdateState();
912 struct ofl_msg_packet_in msg;
913 msg.header.type = OFPT_PACKET_IN;
914 msg.total_len = pkt->buffer->size;
915 msg.reason = (
enum ofp_packet_in_reason)reason;
916 msg.table_id = tableId;
918 msg.data = (uint8_t*)pkt->buffer->data;
925 dp_buffers_save(pkt->dp->buffers, pkt);
926 msg.buffer_id = pkt->buffer_id;
927 msg.data_length = MIN(maxLength, pkt->buffer->size);
929 if (!pkt->handle_std->valid)
931 packet_handle_std_validate(pkt->handle_std);
933 msg.match = (
struct ofl_match_header*)&pkt->handle_std->match;
937 return dp_send_message(pkt->dp, (
struct ofl_msg_header*)&msg,
nullptr);
971 NS_LOG_DEBUG(
"Packet " << pkt->ns3_uid <<
" modified by switch.");
986 NS_LOG_DEBUG(
"Creating new ns-3 packet from OpenFlow buffer.");
991 return port->Send(packet, queueNo, pkt->tunnel_id);
1005 uint32_t headRoom = 128 + 2;
1006 uint32_t bodyRoom = packet->
GetSize() + VLAN_ETH_HEADER_LEN;
1008 struct packet* pkt =
1009 packet_create(
m_datapath, portNo, buffer, tunnelId,
false);
1017 pipeline_process_packet(
m_datapath->pipeline, pkt);
1024 if (!remoteCtrl->m_socket)
1026 NS_LOG_ERROR(
"No controller connection. Discarding message.");
1031 return remoteCtrl->m_handler->SendMessage(packet);
1039 struct ofl_msg_header* msg;
1043 NS_ASSERT_MSG(remoteCtrl,
"Error returning controller for this address.");
1045 struct sender senderCtrl;
1046 senderCtrl.remote = remoteCtrl->m_remote;
1047 senderCtrl.conn_id = 0;
1051 error = ofl_msg_unpack((uint8_t*)buffer->data,
1071 struct ofp_header* header = (
struct ofp_header*)buffer->data;
1072 if (header->type != OFPT_HELLO || header->version <= OFP_VERSION)
1077 ofpbuf_delete(buffer);
1085 header->version = OFP_VERSION;
1086 error = ofl_msg_unpack((uint8_t*)buffer->data,
1097 ofpbuf_delete(buffer);
1104 char* msgStr = ofl_msg_to_string(msg,
m_datapath->exp);
1106 NS_LOG_DEBUG(
"RX from controller " << ctrlIp <<
": " << msgStr);
1112 case (OFPT_PACKET_OUT): {
1116 case (OFPT_FLOW_MOD): {
1120 case (OFPT_METER_MOD): {
1124 case (OFPT_GROUP_MOD): {
1133 error = handle_control_msg(
m_datapath, msg, &senderCtrl);
1145 ofpbuf_delete(buffer);
1150 struct ofpbuf* buffer,
1151 struct sender* senderCtrl)
1155 struct ofl_msg_error err;
1156 err.header.type = OFPT_ERROR;
1157 err.type = (
enum ofp_error_type)ofl_error_type(error);
1158 err.code = ofl_error_code(error);
1159 err.data_length = buffer->size;
1160 err.data = (uint8_t*)buffer->data;
1162 char* msgStr = ofl_msg_to_string((
struct ofl_msg_header*)&err,
nullptr);
1163 NS_LOG_ERROR(
"Error processing OpenFlow message. Reply with " << msgStr);
1167 (
struct ofl_msg_header*)&err,
1176 NS_LOG_INFO(
"Controller accepted connection request!");
1178 remoteCtrl->m_remote = remote_create(
m_datapath);
1184 remoteCtrl->m_handler = CreateObject<OFSwitch13SocketHandler>(socket);
1185 remoteCtrl->m_handler->SetReceiveCallback(
1189 struct ofl_msg_header msg;
1190 msg.type = OFPT_HELLO;
1192 struct sender senderCtrl;
1193 senderCtrl.remote = remoteCtrl->m_remote;
1194 senderCtrl.conn_id = 0;
1196 dp_send_message(
m_datapath, &msg, &senderCtrl);
1204 NS_LOG_ERROR(
"Controller did not accepted connection request!");
1211 if (remoteCtrl->m_socket == socket)
1226 for (
size_t i = 0; i < entry->config->meter_bands_num; i++)
1228 entry->stats->band_stats[i]->last_fill =
1231 refill_bucket(entry);
1255 NS_LOG_DEBUG(
"Packet " << pkt->ns3_uid <<
" done at this switch.");
1263 if (pkt->ns3_uid == 0)
1265 NS_LOG_DEBUG(
"Deleting lib packet with no corresponding ns-3 packet.");
1272 "Packet still valid in pipeline.");
1279 NS_LOG_DEBUG(
"Packet " << pkt->ns3_uid <<
" done at this switch.");
1284 struct meter_entry* entry)
1288 uint32_t meterId = entry->stats->meter_id;
1290 NS_LOG_DEBUG(
"OpenFlow meter id " << meterId <<
" dropped packet "
1299 struct flow_table* table)
1303 uint8_t tableId = table->stats->table_id;
1306 << +tableId <<
" dropped unmatched packet " << pkt->ns3_uid);
1322 if (ret.second ==
true)
1324 NS_LOG_DEBUG(
"Packet " << packetId <<
" saved into buffer.");
1329 NS_LOG_WARN(
"Packet " << packetId <<
" already in buffer.");
1359 NS_LOG_DEBUG(
"Packet " << packetId <<
" removed from buffer.");
1372 NS_LOG_DEBUG(
"Expired packet " << packetId <<
" deleted from buffer.");
1385 if (ctrl->m_socket == socket)
1390 NS_ABORT_MSG(
"Error returning controller for this socket.");
1400 if (ctrl->m_address ==
address)
1415 if (ctrl->m_remote == remote)
1420 NS_ABORT_MSG(
"Error returning controller for this remote pointer.");
1438 Tag* tag =
dynamic_cast<Tag*
>(constructor());
1450 Tag* tag =
dynamic_cast<Tag*
>(constructor());
1462 std::pair<uint64_t, Ptr<OFSwitch13Device>> entry(
id, dev);
1464 NS_ABORT_MSG_IF(ret.second ==
false,
"Error when registering datapath.");
1480 : m_socket(nullptr),
1496 NS_ASSERT_MSG(
id && packet,
"Invalid packet metadata values.");
1499 m_ids.emplace_back(
id);
1527 m_ids.emplace_back(
id);
1535 for (
auto it = m_ids.begin(); it != m_ids.end(); it++)
1543 if (m_ids.size() == 0)
1555 for (
auto it = m_ids.begin(); it != m_ids.end(); it++)
a polymophic address class
Identifies a byte tag and a set of bytes within a packet to which the tag applies.
void GetTag(Tag &tag) const
Read the requested tag and store it in the user-provided tag instance.
Iterator over the set of byte tags in a packet.
Class for representing data rates.
uint64_t GetBitRate() const
Get the underlying bitrate.
AttributeValue implementation for DataRate.
static bool IsMatchingType(const Address &address)
Ipv4Address GetIpv4() const
static InetSocketAddress ConvertFrom(const Address &address)
Returns an InetSocketAddress which corresponds to the input Address.
Ipv4 addresses are stored in host order in this class.
RemoteController()
Default (empty) constructor.
Address m_address
Controller address.
An OpenFlow 1.3 device that switches multiple CSMA segments via OpenFlow protocol.
CtrlList_t m_controllers
Collection of active controllers.
struct datapath * GetDatapathStruct()
Get a pointer to the internal BOFUSS datapath structure.
Ptr< OFSwitch13Port > GetSwitchPort(uint32_t no) const
Get the OFSwitch13Port pointer from its number.
static void BufferSaveCallback(struct packet *pkt, time_t timeout)
Callback fired when a packet is saved into buffer.
void SocketCtrlFailed(Ptr< Socket > socket)
Socket callback fired when a TCP connection to controller fail.
double GetCpuUsage() const
TracedCallback signature for packets dropped by meter bands.
uint32_t GetBufferEntries() const
TracedCallback signature for packets dropped by meter bands.
uint32_t m_numPipeTabs
Number of pipeline flow tables.
uint64_t m_cpuConsumed
CPU processing tokens consumed.
uint32_t GetGroupTableSize() const
TracedCallback signature for packets dropped by meter bands.
IdPacketMap_t m_bufferPkts
Packets saved in switch buffer.
TracedCallback< Ptr< const Packet > > m_pipePacketTrace
Trace source fired when a packet is sent to pipeline.
uint32_t GetFlowTableEntries(uint8_t tableId) const
TracedCallback signature for packets dropped by meter bands.
TracedValue< DataRate > m_cpuLoad
Average CPU processing load.
uint32_t GetMeterTableSize() const
TracedCallback signature for packets dropped by meter bands.
void SetFlowTableSize(uint8_t tableId, uint32_t value)
Structure to save the list of ports in this datapath.
void DoDispose() override
TracedCallback signature for packets dropped by meter bands.
uint32_t GetNSwitchPorts() const
TracedCallback signature for packets dropped by meter bands.
static void PacketDestroyCallback(struct packet *pkt)
Callback fired when a packet is destroyed.
double GetBufferUsage() const
TracedCallback signature for packets dropped by meter bands.
PipelinePacket m_pipePkt
Packet under switch pipeline.
Ptr< OFSwitch13Device::RemoteController > GetRemoteController(Ptr< Socket > socket)
Get the remote controller for this socket.
void SendToPipeline(Ptr< Packet > packet, uint32_t portNo, uint64_t tunnelId=0)
Send the packet to the OpenFlow BOFUSS pipeline.
void NotifyPacketDroppedByMeter(struct packet *pkt, struct meter_entry *entry)
Notify this device of a packet dropped by OpenFlow meter band.
double GetFlowTableUsage(uint8_t tableId) const
TracedCallback signature for packets dropped by meter bands.
void DatapathTimeout(struct datapath *dp)
Check if any flow in any table is timed out and update port status.
void SocketCtrlSucceeded(Ptr< Socket > socket)
Socket callback fired when a TCP connection to controller succeed.
uint64_t GetFlowModCounter() const
TracedCallback< Ptr< const OFSwitch13Device > > m_datapathTimeoutTrace
Trace source fired when the datapath timeout operation is completed.
Time GetDatapathTimeout() const
TracedCallback signature for packets dropped by meter bands.
void ReceiveFromSwitchPort(Ptr< Packet > packet, uint32_t portNo, uint64_t tunnelId=0)
Called when a packet is received on one of the switch's ports.
void ReceiveFromController(Ptr< Packet > packet, Address from)
Receive an OpenFlow packet from controller.
uint32_t GetNControllers() const
TracedCallback signature for packets dropped by meter bands.
static Ptr< OFSwitch13Device > GetDevice(uint64_t id)
Retrieve and existing OpenFlow device object by its datapath ID.
TracedCallback< Ptr< const Packet >, uint8_t > m_tableDropTrace
Trace source fired when an unmatched packet is dropped by flow table.
static void MeterCreatedCallback(struct meter_entry *entry)
Callback fired when a new meter entry is created at meter table.
OFSwitch13Device()
Default constructor.
double GetMeterTableUsage() const
TracedCallback signature for packets dropped by meter bands.
PortList_t m_ports
List of switch ports.
double GetGroupTableUsage() const
TracedCallback signature for packets dropped by meter bands.
void BufferPacketSave(uint64_t packetId, time_t timeout)
Notify this device of a packet saved into buffer.
void NotifyMeterEntryCreated(struct meter_entry *entry)
Notify this device of a new meter entry created at meter table.
void NotifyPacketCloned(struct packet *pkt, struct packet *clone)
Notify this device of a packet cloned by the OpenFlow pipeline.
static void RegisterDatapath(uint64_t id, Ptr< OFSwitch13Device > dev)
Insert a new OpenFlow device in global map.
uint32_t GetGroupTableEntries() const
TracedCallback signature for packets dropped by meter bands.
Time m_timeout
Datapath timeout interval.
static uint64_t m_globalDpId
Global counter for datapath IDs.
DataRate GetCpuLoad() const
TracedCallback signature for packets dropped by meter bands.
TracedValue< uint32_t > m_groupEntries
Number of entries in group table.
TracedCallback< Ptr< const Packet > > m_bufferSaveTrace
Trace source fired when a packet is saved into buffer.
void StartControllerConnection(Address ctrlAddr)
Starts the TCP connection between this switch and the target controller indicated by the address para...
void NotifyPacketDestroyed(struct packet *pkt)
Notify this device of a packet destroyed by the OpenFlow pipeline.
TracedCallback< Ptr< const Packet > > m_loadDropTrace
Trace source fired when a packet is dropped due to overloaded switch.
void BufferPacketRetrieve(uint64_t packetId)
Notify this device of a packet retrieved from buffer.
Ptr< OFSwitch13Port > AddSwitchPort(Ptr< NetDevice > portDevice)
Add a 'port' to the switch device.
uint64_t m_cGroupMod
Pipeline group mod counter.
static uint64_t m_globalPktId
Global counter for packets IDs.
uint64_t m_cPacketIn
Pipeline packet in counter.
DataRate GetCpuCapacity() const
TracedCallback signature for packets dropped by meter bands.
Time m_tcamDelay
Flow Table TCAM lookup delay.
uint32_t m_meterTabSize
Meter table maximum entries.
int SendPacketInMessage(struct packet *pkt, uint8_t tableId, uint8_t reason, uint16_t maxLength, uint64_t cookie=0)
Create an OpenFlow packet in message and send the packet to all controllers with open connections.
void SetGroupTableSize(uint32_t value)
Structure to save the list of ports in this datapath.
static void BufferRetrieveCallback(struct packet *pkt)
Callback fired when a packet is retrieved from buffer.
TracedValue< uint32_t > m_sumFlowEntries
Sum of entries in all flow tables.
uint32_t GetMeterTableEntries() const
TracedCallback signature for packets dropped by meter bands.
void NotifyPacketDroppedByTable(struct packet *pkt, struct flow_table *table)
Notify this device of an unmatched packet dropped by OpenFlow flow table without a table-miss entry.
struct datapath * DatapathNew()
Creates a new datapath.
static void MeterDropCallback(struct packet *pkt, struct meter_entry *entry)
Callback fired when a packet is dropped by meter band.
static void UnregisterDatapath(uint64_t id)
Remove an existing OpenFlow device from global map.
static void TableDropCallback(struct packet *pkt, struct flow_table *table)
Callback fired when an unmatched packet is dropped by a flow table without a table-miss entry.
struct datapath * m_datapath
BOFUSS datapath structure.
uint64_t m_cMeterMod
Pipeline meter mod counter.
static uint64_t GetNewPacketId()
Increase the global packet ID counter and return a new packet ID.
~OFSwitch13Device() override
Dummy destructor, see DoDispose.
uint64_t GetPacketInCounter() const
TracedValue< Time > m_pipeDelay
Average delay for pipeline packet processing.
uint64_t GetDatapathId() const
Get the OpenFlow datapath ID.
void NotifyConstructionCompleted() override
TracedCallback signature for packets dropped by meter bands.
uint64_t m_cFlowMod
Pipeline flow mod counter.
int ReplyWithErrorMessage(ofl_err error, struct ofpbuf *buffer, struct sender *senderCtrl)
Create an OpenFlow error message and send it back to the sender controller.
uint32_t m_flowTabSize
Flow table maximum entries.
uint64_t GetPacketOutCounter() const
uint32_t m_groupTabSize
Group table maximum entries.
static bool CopyTags(Ptr< const Packet > srcPkt, Ptr< const Packet > dstPkt)
Copy all tags (packet and byte) from srcPkt packet to dstPkt packet.
static void DpActionsOutputPort(struct packet *pkt, uint32_t outPort, uint32_t outQueue, uint16_t maxLength, uint64_t cookie)
Overriding BOFUSS dp_actions_output_port weak function from udatapath/dp_actions.c.
static int SendOpenflowBufferToRemote(struct ofpbuf *buffer, struct remote *remote)
Overriding BOFUSS send_openflow_buffer_to_remote weak function from udatapath/datapath....
std::map< uint64_t, Ptr< OFSwitch13Device > > DpIdDevMap_t
Structure to map datapath id to OpenFlow device.
uint32_t m_bufferSize
Buffer size in terms of packets.
static TypeId GetTypeId()
Register this type.
void BufferPacketDelete(uint64_t packetId)
Delete the ns-3 packet from buffer map.
uint64_t m_cPacketOut
Pipeline packet out counter.
void SetMeterTableSize(uint32_t value)
Structure to save the list of ports in this datapath.
uint64_t GetDpId() const
Alias for the GetDatapathId () method.
uint64_t m_cpuTokens
CPU processing tokens available.
int SendToController(Ptr< Packet > packet, Ptr< OFSwitch13Device::RemoteController > remoteCtrl)
Send a packet to the controller node.
Time m_lastTimeout
Datapath last timeout.
bool SendToSwitchPort(struct packet *pkt, uint32_t portNo, uint32_t queueNo=0)
Send a message over a specific switch port.
TracedCallback< Ptr< const Packet > > m_bufferRetrieveTrace
Trace source fired when a packet is retrieved from buffer.
uint64_t GetGroupModCounter() const
TracedCallback< Ptr< const Packet > > m_bufferExpireTrace
Trace source fired when a packet in buffer expires.
static void SendPacketToController(struct pipeline *pl, struct packet *pkt, uint8_t tableId, uint8_t reason)
Overriding BOFUSS send_packet_to_controller weak function from udatapath/pipeline....
uint32_t GetNPipelineTables() const
TracedCallback signature for packets dropped by meter bands.
uint32_t GetSumFlowEntries() const
TracedCallback signature for packets dropped by meter bands.
static DpIdDevMap_t m_globalSwitchMap
As the integration of BOFUSS and ns-3 involve overriding some C functions, we are using a global map ...
TracedCallback< Ptr< const Packet >, uint32_t > m_meterDropTrace
Trace source fired when a packet is dropped by a meter band.
uint64_t m_dpId
This datapath id.
uint32_t GetDftFlowTableSize() const
TracedCallback signature for packets dropped by meter bands.
static void PacketCloneCallback(struct packet *pkt, struct packet *clone)
Callback fired when a packet is cloned.
uint32_t GetBufferSize() const
TracedCallback signature for packets dropped by meter bands.
TracedValue< uint32_t > m_meterEntries
Number of entries in meter table.
uint64_t GetMeterModCounter() const
uint32_t GetFlowTableSize(uint8_t tableId) const
TracedCallback signature for packets dropped by meter bands.
Time GetPipelineDelay() const
TracedCallback signature for packets dropped by meter bands.
void SetDftFlowTableSize(uint32_t value)
Structure to save the list of ports in this datapath.
DataRate m_cpuCapacity
CPU processing capacity.
uint32_t GetPortNo() const
Get the OpenFlow port number for this port.
virtual void NotifyConstructionCompleted()
Notifier called once the ObjectBase is fully constructed.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
A base class which provides memory management and object aggregation.
virtual void DoDispose()
Destructor implementation.
PacketTagIterator GetPacketTagIterator() const
Returns an object which can be used to iterate over the list of packet tags.
uint32_t GetSize() const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
void AddPacketTag(const Tag &tag) const
Add a packet tag.
void AddByteTag(const Tag &tag) const
Tag each byte included in this packet with a new byte tag.
ByteTagIterator GetByteTagIterator() const
Returns an iterator over the set of byte tags included in this packet.
Identifies a packet tag within a packet.
void GetTag(Tag &tag) const
Read the requested tag and store it in the user-provided tag instance.
Iterator over the set of packet tags in a packet.
Smart pointer class similar to boost::intrusive_ptr.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static Time Now()
Return the current simulation virtual time.
virtual int Connect(const Address &address)=0
Initiate a connection to a remote host.
static Ptr< Socket > CreateSocket(Ptr< Node > node, TypeId tid)
This method wraps the creation of sockets that is performed on a given node by a SocketFactory specif...
virtual int Bind(const Address &address)=0
Allocate a local endpoint for this socket.
void SetConnectCallback(Callback< void, Ptr< Socket >> connectionSucceeded, Callback< void, Ptr< Socket >> connectionFailed)
Specify callbacks to allow the caller to determine if the connection succeeds of fails.
tag a set of bytes in a packet
Simulation virtual time values and global simulation resolution.
int64_t GetMilliSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
static Time FromInteger(uint64_t value, Unit unit)
Create a Time equal to value in unit unit.
AttributeValue implementation for Time.
a unique identifier for an interface.
static TypeId LookupByName(std::string name)
Get a TypeId by name.
@ ATTR_GET
The attribute can be read.
@ ATTR_CONSTRUCT
The attribute can be written at construction-time.
Callback< ObjectBase * > GetConstructor() const
Get the constructor callback.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Hold an unsigned integer type.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
ObjectPtrContainerValue ObjectVectorValue
ObjectVectorValue is an alias for ObjectPtrContainerValue.
Ptr< const AttributeAccessor > MakeObjectVectorAccessor(U T::*memberVariable)
MakeAccessorHelper implementation for ObjectVector.
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
#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_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#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.
void(* DataRate)(DataRate oldValue, DataRate newValue)
TracedValue callback signature for DataRate.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Ptr< Packet > PacketFromBuffer(struct ofpbuf *buffer)
Create a new ns3::Packet from internal BOFUSS buffer.
struct ofpbuf * BufferFromPacket(Ptr< const Packet > packet, size_t bodyRoom, size_t headRoom)
Create an internal BOFUSS buffer from ns3::Packet.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
void(* Time)(Time oldValue, Time newValue)
TracedValue callback signature for Time.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
time_t time_now(void)
Overriding BOFUSS time_now weak function from timeval.c.
void SetPacket(uint64_t id, Ptr< Packet > packet)
Save packet metadata.
bool DelCopy(uint64_t id)
Delete an existing copy for this packet.
Ptr< Packet > GetPacket() const
PipelinePacket()
Default (empty) constructor.
bool HasId(uint64_t id)
Check for packet id in the internal list of IDs for this packet.
void Invalidate()
Invalidate packet metatada.
bool IsValid() const
Check for valid packet metadata.
void NewCopy(uint64_t id)
Notify a new copy for this packet, with a new unique ID.