A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
openflow-switch-net-device.h
Go to the documentation of this file.
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License version 2 as
4 * published by the Free Software Foundation;
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
14 *
15 * Author: Blake Hurd <naimorai@gmail.com>
16 */
17
18/**
19 * \defgroup openflow OpenFlow Switch Device
20 * This section documents the API of the ns-3 OpenFlow module. For a generic functional description,
21 * please refer to the ns-3 manual.
22 */
23
24#ifndef OPENFLOW_SWITCH_NET_DEVICE_H
25#define OPENFLOW_SWITCH_NET_DEVICE_H
26
27#include "openflow-interface.h"
28
29#include "ns3/arp-header.h"
30#include "ns3/arp-l3-protocol.h"
31#include "ns3/bridge-channel.h"
32#include "ns3/enum.h"
33#include "ns3/ethernet-header.h"
34#include "ns3/integer.h"
35#include "ns3/ipv4-l3-protocol.h"
36#include "ns3/log.h"
37#include "ns3/mac48-address.h"
38#include "ns3/node.h"
39#include "ns3/simulator.h"
40#include "ns3/string.h"
41#include "ns3/tcp-header.h"
42#include "ns3/udp-header.h"
43#include "ns3/uinteger.h"
44
45#include <map>
46#include <set>
47
48namespace ns3
49{
50
51/**
52 * \ingroup openflow
53 * \brief A net device that switches multiple LAN segments via an OpenFlow-compatible flow table
54 *
55 * The OpenFlowSwitchNetDevice object aggregates multiple netdevices as ports
56 * and acts like a switch. It implements OpenFlow-compatibility,
57 * according to the OpenFlow Switch Specification v0.8.9
58 * <www.openflowswitch.org/documents/openflow-spec-v0.8.9.pdf>.
59 * It implements a flow table that all received packets are run through.
60 * It implements a connection to a controller via a subclass of the Controller class,
61 * which can send messages to manipulate the flow table, thereby manipulating
62 * how the OpenFlow switch behaves.
63 *
64 * There are two controllers available in the original package. DropController
65 * builds a flow for each received packet to drop all packets it matches (this
66 * demonstrates the flow table's basic implementation), and the LearningController
67 * implements a "learning switch" algorithm (see 802.1D), where incoming unicast
68 * frames from one port may occasionally be forwarded throughout all other ports,
69 * but usually they are forwarded only to a single correct output port.
70 *
71 * \attention The Spanning Tree Protocol part of 802.1D is not
72 * implemented. Therefore, you have to be careful not to create
73 * bridging loops, or else the network will collapse.
74 *
75 * \attention Each NetDevice used must only be assigned a Mac Address, adding it
76 * to an Ipv4 or Ipv6 layer will cause an error. It also must support a SendFrom
77 * call.
78 */
79
80/**
81 * \ingroup openflow
82 * \ingroup tests
83 * \defgroup openflow-tests OpenFlow module tests
84 */
85
86/**
87 * \ingroup openflow
88 * \brief A net device that switches multiple LAN segments via an OpenFlow-compatible flow table
89 */
91{
92 public:
93 /**
94 * Register this type.
95 * \return The TypeId.
96 */
97 static TypeId GetTypeId();
98
99 /**
100 * \name Descriptive Data
101 * \brief OpenFlowSwitchNetDevice Description Data
102 *
103 * These four data describe the OpenFlowSwitchNetDevice as if it were
104 * a real OpenFlow switch.
105 *
106 * There is a type of stats request that OpenFlow switches are supposed
107 * to handle that returns the description of the OpenFlow switch. Currently
108 * manufactured by "The ns-3 team", software description is "Simulated
109 * OpenFlow Switch", and the other two are "N/A".
110 * @{
111 */
112 /** \returns The descriptive string. */
113 static const char* GetManufacturerDescription();
114 static const char* GetHardwareDescription();
115 static const char* GetSoftwareDescription();
116 static const char* GetSerialNumber();
117 /**@}*/
118
120 ~OpenFlowSwitchNetDevice() override;
121
122 /**
123 * \brief Set up the Switch's controller connection.
124 *
125 * \param c Pointer to a Controller.
126 */
128
129 /**
130 * \brief Add a 'port' to a switch device
131 *
132 * This method adds a new switch port to a OpenFlowSwitchNetDevice, so that
133 * the new switch port NetDevice becomes part of the switch and L2
134 * frames start being forwarded to/from this NetDevice.
135 *
136 * \note The netdevice that is being added as switch port must
137 * _not_ have an IP address. In order to add IP connectivity to a
138 * bridging node you must enable IP on the OpenFlowSwitchNetDevice itself,
139 * never on its port netdevices.
140 *
141 * \param switchPort The port to add.
142 * \return 0 if everything's ok, otherwise an error number.
143 * Possible error numbers: EXFULL
144 */
145 int AddSwitchPort(Ptr<NetDevice> switchPort);
146
147 /**
148 * \brief Add a virtual port to a switch device
149 *
150 * The Ericsson OFSID has the concept of virtual ports and virtual
151 * port tables. These are implemented in the OpenFlowSwitchNetDevice, but
152 * don't have an understood use [perhaps it may have to do with
153 * MPLS integration].
154 *
155 * Possible error numbers: EINVAL
156 *
157 * \param ovpm The data for adding a virtual port.
158 * \return 0 if everything's ok, otherwise an error number.
159 */
160 int AddVPort(const ofp_vport_mod* ovpm);
161
162 /**
163 * \brief Stats callback is ready for a dump.
164 *
165 * Controllers have a callback system for status requests which calls this function.
166 *
167 * \param cb_ The callback data.
168 * \return 0 if everything's ok, otherwise an error number.
169 */
171
172 /**
173 * \brief Stats callback is done.
174 *
175 * Controllers have a callback system for status requests which calls this function.
176 *
177 * \param cb_ The callback data.
178 */
180
181 /**
182 * \brief Called from the OpenFlow Interface to output the Packet on either a Port or the
183 * Controller
184 *
185 * \param packet_uid Packet UID; used to fetch the packet and its metadata.
186 * \param in_port The index of the port the Packet was initially received on.
187 * \param max_len The maximum number of bytes the caller wants to be sent; a value of 0
188 * indicates the entire packet should be sent. Used when outputting to controller.
189 * \param out_port The port we want to output on.
190 * \param ignore_no_fwd If true, Ports that are set to not forward are forced to forward.
191 */
192 void DoOutput(uint32_t packet_uid,
193 int in_port,
194 size_t max_len,
195 int out_port,
196 bool ignore_no_fwd);
197
198 /**
199 * \brief The registered controller calls this method when sending a message to the switch.
200 *
201 * \param msg The message received from the controller.
202 * \param length Length of the message.
203 * \return 0 if everything's ok, otherwise an error number.
204 */
205 int ForwardControlInput(const void* msg, size_t length);
206
207 /**
208 * \return The flow table chain.
209 */
210 sw_chain* GetChain();
211
212 /**
213 * \return Number of switch ports attached to this switch.
214 */
216
217 /**
218 * \param p The Port to get the index of.
219 * \return The index of the provided Port.
220 */
222
223 /**
224 * \param n index of the Port.
225 * \return The Port.
226 */
228
229 /**
230 * \return The virtual port table.
231 */
232 vport_table_t GetVPortTable();
233
234 // From NetDevice
235 void SetIfIndex(const uint32_t index) override;
236 uint32_t GetIfIndex() const override;
237 Ptr<Channel> GetChannel() const override;
238 void SetAddress(Address address) override;
239 Address GetAddress() const override;
240 bool SetMtu(const uint16_t mtu) override;
241 uint16_t GetMtu() const override;
242 bool IsLinkUp() const override;
243 void AddLinkChangeCallback(Callback<void> callback) override;
244 bool IsBroadcast() const override;
245 Address GetBroadcast() const override;
246 bool IsMulticast() const override;
247 Address GetMulticast(Ipv4Address multicastGroup) const override;
248 bool IsPointToPoint() const override;
249 bool IsBridge() const override;
250 bool Send(Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber) override;
251 bool SendFrom(Ptr<Packet> packet,
252 const Address& source,
253 const Address& dest,
254 uint16_t protocolNumber) override;
255 Ptr<Node> GetNode() const override;
256 void SetNode(Ptr<Node> node) override;
257 bool NeedsArp() const override;
260 bool SupportsSendFrom() const override;
261 Address GetMulticast(Ipv6Address addr) const override;
262
263 protected:
264 void DoDispose() override;
265
266 /**
267 * Called when a packet is received on one of the switch's ports.
268 *
269 * \param netdev The port the packet was received on.
270 * \param packet The Packet itself.
271 * \param protocol The protocol defining the Packet.
272 * \param src The source address of the Packet.
273 * \param dst The destination address of the Packet.
274 * \param packetType Type of the packet.
275 */
277 Ptr<const Packet> packet,
278 uint16_t protocol,
279 const Address& src,
280 const Address& dst,
281 PacketType packetType);
282
283 /**
284 * Takes a packet and generates an OpenFlow buffer from it, loading the packet data as well as
285 * its headers.
286 *
287 * \param packet The packet.
288 * \param src The source address.
289 * \param dst The destination address.
290 * \param mtu The Maximum Transmission Unit.
291 * \param protocol The protocol defining the packet.
292 * \return The OpenFlow Buffer created from the packet.
293 */
294 ofpbuf* BufferFromPacket(Ptr<const Packet> packet,
295 Address src,
296 Address dst,
297 int mtu,
298 uint16_t protocol);
299
300 private:
301 /**
302 * Add a flow.
303 *
304 * Possible error numbers: ENOMEM, ENOBUFS, ESRCH
305 *
306 * \param ofm The flow data to add.
307 * \return 0 if everything's ok, otherwise an error number.
308 */
309 int AddFlow(const ofp_flow_mod* ofm);
310
311 /**
312 * Modify a flow.
313 *
314 * \param ofm The flow data to modify.
315 * \return 0 if everything's ok, otherwise an error number.
316 */
317 int ModFlow(const ofp_flow_mod* ofm);
318
319 /**
320 * Send packets out all the ports except the originating one
321 *
322 * \param packet_uid Packet UID; used to fetch the packet and its metadata.
323 * \param in_port The index of the port the Packet was initially received on. This port doesn't
324 * forward when flooding.
325 * \param flood If true, don't send out on the ports with flooding disabled.
326 * \return 0 if everything's ok, otherwise an error number.
327 */
328 int OutputAll(uint32_t packet_uid, int in_port, bool flood);
329
330 /**
331 * Sends a copy of the Packet over the provided output port
332 *
333 * \param packet_uid Packet UID; used to fetch the packet and its metadata.
334 * \param out_port Output port.
335 */
336 void OutputPacket(uint32_t packet_uid, int out_port);
337
338 /**
339 * Seeks to send out a Packet over the provided output port. This is called generically
340 * when we may or may not know the specific port we're outputting on. There are many
341 * pre-set types of port options besides a Port that's hooked to our OpenFlowSwitchNetDevice.
342 * For example, it could be outputting as a flood, or seeking to output to the controller.
343 *
344 * \param packet_uid Packet UID; used to fetch the packet and its metadata.
345 * \param in_port The index of the port the Packet was initially received on.
346 * \param out_port The port we want to output on.
347 * \param ignore_no_fwd If true, Ports that are set to not forward are forced to forward.
348 */
349 void OutputPort(uint32_t packet_uid, int in_port, int out_port, bool ignore_no_fwd);
350
351 /**
352 * Sends a copy of the Packet to the controller. If the packet can be saved
353 * in an OpenFlow buffer, then only the first 'max_len' bytes of the packet
354 * are sent; otherwise, all of the packet is sent.
355 *
356 * \param packet_uid Packet UID; used to fetch the packet and its metadata.
357 * \param in_port The index of the port the Packet was initially received on.
358 * \param max_len The maximum number of bytes that the caller wants to be sent; a value of 0
359 * indicates the entire packet should be sent.
360 * \param reason Why the packet is being sent.
361 */
362 void OutputControl(uint32_t packet_uid, int in_port, size_t max_len, int reason);
363
364 /**
365 * If an error message happened during the controller's request, send it to the controller.
366 *
367 * \param type The type of error.
368 * \param code The error code.
369 * \param data The faulty data that lead to the error.
370 * \param len The length of the faulty data.
371 */
372 void SendErrorMsg(uint16_t type, uint16_t code, const void* data, size_t len);
373
374 /**
375 * Send a reply about this OpenFlow switch's features to the controller.
376 *
377 * List of capabilities and actions to support are found in the specification
378 * <www.openflowswitch.org/documents/openflow-spec-v0.8.9.pdf>.
379 *
380 * Supported capabilities and actions are defined in the openflow interface.
381 * To recap, flow status, flow table status, port status, virtual port table
382 * status can all be requested. It can also transmit over multiple physical
383 * interfaces.
384 *
385 * It supports every action: outputting over a port, and all of the flow table
386 * manipulation actions: setting the 802.1q VLAN ID, the 802.1q priority,
387 * stripping the 802.1 header, setting the Ethernet source address and destination,
388 * setting the IP source address and destination, setting the TCP/UDP source address
389 * and destination, and setting the MPLS label and EXP bits.
390 *
391 * \attention Capabilities STP (Spanning Tree Protocol) and IP packet
392 * reassembly are not currently supported.
393 *
394 */
395 void SendFeaturesReply();
396
397 /**
398 * Send a reply to the controller that a specific flow has expired.
399 *
400 * \param flow The flow that expired.
401 * \param reason The reason for sending this expiration notification.
402 */
403 void SendFlowExpired(sw_flow* flow, ofp_flow_expired_reason reason);
404
405 /**
406 * Send a reply about a Port's status to the controller.
407 *
408 * \param p The port to get status from.
409 * \param status The reason for sending this reply.
410 */
411 void SendPortStatus(ofi::Port p, uint8_t status);
412
413 /**
414 * Send a reply about this OpenFlow switch's virtual port table features to the controller.
415 */
417
418 /**
419 * Send a message to the controller. This method is the key
420 * to communicating with the controller, it does the actual
421 * sending. The other Send methods call this one when they
422 * are ready to send a message.
423 *
424 * \param buffer Buffer of the message to send out.
425 * \return 0 if successful, otherwise an error number.
426 */
427 int SendOpenflowBuffer(ofpbuf* buffer);
428
429 /**
430 * Run the packet through the flow table. Looks up in the flow table for a match.
431 * If it doesn't match, it forwards the packet to the registered controller, if the flag is set.
432 *
433 * \param packet_uid Packet UID; used to fetch the packet and its metadata.
434 * \param port The port this packet was received over.
435 * \param send_to_controller If set, sends to the controller if the packet isn't matched.
436 */
437 void RunThroughFlowTable(uint32_t packet_uid, int port, bool send_to_controller = true);
438
439 /**
440 * Run the packet through the vport table. As with AddVPort,
441 * this doesn't have an understood use yet.
442 *
443 * \param packet_uid Packet UID; used to fetch the packet and its metadata.
444 * \param port The port this packet was received over.
445 * \param vport The virtual port this packet identifies itself by.
446 * \return 0 if everything's ok, otherwise an error number.
447 */
448 int RunThroughVPortTable(uint32_t packet_uid, int port, uint32_t vport);
449
450 /**
451 * Called by RunThroughFlowTable on a scheduled delay
452 * to account for the flow table lookup overhead.
453 *
454 * \param key Matching key to look up in the flow table.
455 * \param buffer Buffer of the packet received.
456 * \param packet_uid Packet UID; used to fetch the packet and its metadata.
457 * \param port The port the packet was received over.
458 * \param send_to_controller
459 */
460 void FlowTableLookup(sw_flow_key key,
461 ofpbuf* buffer,
462 uint32_t packet_uid,
463 int port,
464 bool send_to_controller);
465
466 /**
467 * Update the port status field of the switch port.
468 * A non-zero return value indicates some field has changed.
469 *
470 * \param p A reference to a Port; used to change its config and flag fields.
471 * \return true if the status of the Port is changed, false if unchanged (was already the right
472 * status).
473 */
475
476 /**
477 * Fill out a description of the switch port.
478 *
479 * \param p The port to get the description from.
480 * \param desc A pointer to the description message; used to fill the description message with
481 * the data from the port.
482 */
483 void FillPortDesc(ofi::Port p, ofp_phy_port* desc);
484
485 /**
486 * Generates an OpenFlow reply message based on the type.
487 *
488 * \param openflow_len Length of the reply to make.
489 * \param type Type of reply message to make.
490 * \param bufferp Message buffer; used to make the reply.
491 * \return The OpenFlow reply message.
492 */
493 void* MakeOpenflowReply(size_t openflow_len, uint8_t type, ofpbuf** bufferp);
494
495 /**
496 * \name Receive Methods
497 *
498 * Actions to do when a specific OpenFlow message/packet is received
499 *
500 * @{
501 */
502 /**
503 * \param msg The OpenFlow message received.
504 * \return 0 if everything's ok, otherwise an error number.
505 */
506 int ReceivePortMod(const void* msg);
507 int ReceiveFeaturesRequest(const void* msg);
508 int ReceiveGetConfigRequest(const void* msg);
509 int ReceiveSetConfig(const void* msg);
510 int ReceivePacketOut(const void* msg);
511 int ReceiveFlow(const void* msg);
512 int ReceiveStatsRequest(const void* msg);
513 int ReceiveEchoRequest(const void* msg);
514 int ReceiveEchoReply(const void* msg);
515 int ReceiveVPortMod(const void* msg);
516 int ReceiveVPortTableFeaturesRequest(const void* msg);
517 /**@}*/
518
519 /// Rx Callback
521 /// Promiscuous Rx Callback
523
524 Mac48Address m_address; ///< Address of this device.
525 Ptr<Node> m_node; ///< Node this device is installed on.
526 Ptr<BridgeChannel> m_channel; ///< Collection of port channels into the Switch Channel.
527 uint32_t m_ifIndex; ///< Interface Index
528 uint16_t m_mtu; ///< Maximum Transmission Unit
529
530 /// PacketData type
531 typedef std::map<uint32_t, ofi::SwitchPacketMetadata> PacketData_t;
532 PacketData_t m_packetData; ///< Packet data
533
534 /// Switch's port type
535 typedef std::vector<ofi::Port> Ports_t;
536 Ports_t m_ports; ///< Switch's ports
537
538 Ptr<ofi::Controller> m_controller; ///< Connection to controller.
539
540 uint64_t m_id; ///< Unique identifier for this switch, needed for OpenFlow
541 Time m_lookupDelay; ///< Flow Table Lookup Delay [overhead].
542
543 Time m_lastExecute; ///< Last time the periodic execution occurred.
544 uint16_t m_flags; ///< Flags; configurable by the controller.
545 uint16_t m_missSendLen; ///< Flow Table Miss Send Length; configurable by the controller.
546
547 sw_chain* m_chain; ///< Flow Table; forwarding rules.
548 vport_table_t m_vportTable; ///< Virtual Port Table
549};
550
551} // namespace ns3
552
553#endif /* OPENFLOW_SWITCH_NET_DEVICE_H */
a polymophic address class
Definition: address.h:101
Callback template class.
Definition: callback.h:438
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:42
Describes an IPv6 address.
Definition: ipv6-address.h:49
an EUI-48 address
Definition: mac48-address.h:46
Network layer to device interface.
Definition: net-device.h:98
PacketType
Packet types are used as they are in Linux.
Definition: net-device.h:300
A net device that switches multiple LAN segments via an OpenFlow-compatible flow table.
void OutputControl(uint32_t packet_uid, int in_port, size_t max_len, int reason)
Sends a copy of the Packet to the controller.
Mac48Address m_address
Address of this device.
ofi::Port GetSwitchPort(uint32_t n) const
Ptr< Node > m_node
Node this device is installed on.
uint64_t m_id
Unique identifier for this switch, needed for OpenFlow.
bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber) override
void * MakeOpenflowReply(size_t openflow_len, uint8_t type, ofpbuf **bufferp)
Generates an OpenFlow reply message based on the type.
Ptr< Channel > GetChannel() const override
void SendFlowExpired(sw_flow *flow, ofp_flow_expired_reason reason)
Send a reply to the controller that a specific flow has expired.
Ptr< BridgeChannel > m_channel
Collection of port channels into the Switch Channel.
void SetNode(Ptr< Node > node) override
void SendPortStatus(ofi::Port p, uint8_t status)
Send a reply about a Port's status to the controller.
Ptr< Node > GetNode() const override
uint16_t m_mtu
Maximum Transmission Unit.
void DoOutput(uint32_t packet_uid, int in_port, size_t max_len, int out_port, bool ignore_no_fwd)
Called from the OpenFlow Interface to output the Packet on either a Port or the Controller.
void RunThroughFlowTable(uint32_t packet_uid, int port, bool send_to_controller=true)
Run the packet through the flow table.
void ReceiveFromDevice(Ptr< NetDevice > netdev, Ptr< const Packet > packet, uint16_t protocol, const Address &src, const Address &dst, PacketType packetType)
Called when a packet is received on one of the switch's ports.
int ModFlow(const ofp_flow_mod *ofm)
Modify a flow.
static const char * GetManufacturerDescription()
vport_table_t m_vportTable
Virtual Port Table.
bool IsBridge() const override
Return true if the net device is acting as a bridge.
void SendFeaturesReply()
Send a reply about this OpenFlow switch's features to the controller.
void SendVPortTableFeatures()
Send a reply about this OpenFlow switch's virtual port table features to the controller.
Time m_lastExecute
Last time the periodic execution occurred.
int ForwardControlInput(const void *msg, size_t length)
The registered controller calls this method when sending a message to the switch.
bool SetMtu(const uint16_t mtu) override
int UpdatePortStatus(ofi::Port &p)
Update the port status field of the switch port.
uint16_t m_flags
Flags; configurable by the controller.
void SetAddress(Address address) override
Set the address of this interface.
void FlowTableLookup(sw_flow_key key, ofpbuf *buffer, uint32_t packet_uid, int port, bool send_to_controller)
Called by RunThroughFlowTable on a scheduled delay to account for the flow table lookup overhead.
void AddLinkChangeCallback(Callback< void > callback) override
uint16_t m_missSendLen
Flow Table Miss Send Length; configurable by the controller.
void SetReceiveCallback(NetDevice::ReceiveCallback cb) override
void OutputPort(uint32_t packet_uid, int in_port, int out_port, bool ignore_no_fwd)
Seeks to send out a Packet over the provided output port.
void StatsDone(ofi::StatsDumpCallback *cb_)
Stats callback is done.
void SendErrorMsg(uint16_t type, uint16_t code, const void *data, size_t len)
If an error message happened during the controller's request, send it to the controller.
void OutputPacket(uint32_t packet_uid, int out_port)
Sends a copy of the Packet over the provided output port.
std::map< uint32_t, ofi::SwitchPacketMetadata > PacketData_t
PacketData type.
int AddSwitchPort(Ptr< NetDevice > switchPort)
Add a 'port' to a switch device.
int SendOpenflowBuffer(ofpbuf *buffer)
Send a message to the controller.
void SetController(Ptr< ofi::Controller > c)
Set up the Switch's controller connection.
NetDevice::PromiscReceiveCallback m_promiscRxCallback
Promiscuous Rx Callback.
void DoDispose() override
Destructor implementation.
int StatsDump(ofi::StatsDumpCallback *cb_)
Stats callback is ready for a dump.
Time m_lookupDelay
Flow Table Lookup Delay [overhead].
int AddFlow(const ofp_flow_mod *ofm)
Add a flow.
int RunThroughVPortTable(uint32_t packet_uid, int port, uint32_t vport)
Run the packet through the vport table.
static TypeId GetTypeId()
Register this type.
NetDevice::ReceiveCallback m_rxCallback
Rx Callback.
void SetIfIndex(const uint32_t index) override
void SetPromiscReceiveCallback(NetDevice::PromiscReceiveCallback cb) override
static const char * GetSoftwareDescription()
int OutputAll(uint32_t packet_uid, int in_port, bool flood)
Send packets out all the ports except the originating one.
int AddVPort(const ofp_vport_mod *ovpm)
Add a virtual port to a switch device.
static const char * GetHardwareDescription()
ofpbuf * BufferFromPacket(Ptr< const Packet > packet, Address src, Address dst, int mtu, uint16_t protocol)
Takes a packet and generates an OpenFlow buffer from it, loading the packet data as well as its heade...
Address GetMulticast(Ipv4Address multicastGroup) const override
Make and return a MAC multicast address using the provided multicast group.
Ptr< ofi::Controller > m_controller
Connection to controller.
std::vector< ofi::Port > Ports_t
Switch's port type.
void FillPortDesc(ofi::Port p, ofp_phy_port *desc)
Fill out a description of the switch port.
int ReceiveVPortTableFeaturesRequest(const void *msg)
sw_chain * m_chain
Flow Table; forwarding rules.
bool SendFrom(Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber) override
bool IsPointToPoint() const override
Return true if the net device is on a point-to-point link.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
a unique identifier for an interface.
Definition: type-id.h:59
uint16_t port
Definition: dsdv-manet.cc:44
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint8_t data[writeSize]
Port and its metadata.
Callback for a stats dump request.