A Discrete-Event Network Simulator
API
ofswitch13-port.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 University of Campinas (Unicamp)
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Author: Luciano Jerez Chaves <ljerezchaves@gmail.com>
18  */
19 
20 #ifndef OFSWITCH13_PORT_H
21 #define OFSWITCH13_PORT_H
22 
23 #include "ofswitch13-interface.h"
24 #include "ofswitch13-queue.h"
25 
26 #include <ns3/net-device.h>
27 #include <ns3/object.h>
28 #include <ns3/packet.h>
29 #include <ns3/traced-callback.h>
30 
31 namespace ns3
32 {
33 
34 // The following explicit template instantiation declaration prevents modules
35 // including this header file from implicitly instantiating Queue<Packet>.
36 extern template class Queue<Packet>;
37 
38 class OFSwitch13Device;
39 
50 class OFSwitch13Port : public Object
51 {
52  public:
53  OFSwitch13Port();
54  ~OFSwitch13Port() override;
55 
64  OFSwitch13Port(struct datapath* dp,
65  Ptr<NetDevice> netDev,
66  Ptr<OFSwitch13Device> openflowDev);
67 
72  static TypeId GetTypeId();
73 
78  Ptr<NetDevice> GetPortDevice() const;
79 
84  uint32_t GetPortNo() const;
85 
90  Ptr<OFSwitch13Queue> GetPortQueue() const;
91 
96  struct sw_port* GetPortStruct();
97 
102  Ptr<OFSwitch13Device> GetSwitchDevice() const;
103 
109  bool PortUpdateState();
110 
121  bool Send(Ptr<const Packet> packet,
122  uint32_t queueNo = 0,
123  uint64_t tunnelId = 0);
124 
125  protected:
127  void DoDispose() override;
128 
129  // Inherited from ObjectBase.
130  void NotifyConstructionCompleted() override;
131 
132  private:
138  uint32_t GetPortFeatures();
139 
153  bool Receive(Ptr<NetDevice> device,
154  Ptr<const Packet> packet,
155  uint16_t protocol,
156  const Address& from,
157  const Address& to,
158  NetDevice::PacketType packetType);
159 
162 
165 
166  uint64_t m_dpId;
167  uint32_t m_portNo;
168  struct sw_port* m_swPort;
173 };
174 
175 } // namespace ns3
176 #endif /* OFSWITCH13_PORT_H */
a polymophic address class
Definition: address.h:100
PacketType
Packet types are used as they are in Linux.
Definition: net-device.h:300
A OpenFlow switch port, interconnecting the underlying NetDevice to the OpenFlow device through the O...
uint32_t m_portNo
Port number.
struct sw_port * m_swPort
BOFUSS port structure.
TracedCallback< Ptr< const Packet > > m_rxTrace
Trace source fired when a packet arrives at this switch port.
Ptr< OFSwitch13Queue > m_portQueue
OpenFlow port Queue.
Ptr< OFSwitch13Device > m_openflowDev
OpenFlow device.
ObjectFactory m_factQueue
Factory for port queue.
TracedCallback< Ptr< const Packet > > m_txTrace
Trace source fired when a packet will be sent over this switch port.
uint64_t m_dpId
OpenFlow datapath ID.
Ptr< NetDevice > m_netDev
Underlying NetDevice.
Instantiate subclasses of ns3::Object.
A base class which provides memory management and object aggregation.
Definition: object.h:89
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition: type-id.h:60
static void Send(Ptr< NetDevice > dev, int level, std::string emuMode)
Definition: fd-emu-send.cc:54
Every class exported by the ns3 library is enclosed in the ns3 namespace.