|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
23 #include "ns3/address.h"
24 #include "ns3/net-device.h"
26 #include "ns3/callback.h"
27 #include "ns3/packet.h"
28 #include "ns3/traced-callback.h"
29 #include "ns3/event-id.h"
30 #include "ns3/nstime.h"
31 #include "ns3/data-rate.h"
33 #include "ns3/mac48-address.h"
34 #include "ns3/unix-fd-reader.h"
194 virtual void SetIfIndex (
const uint32_t index);
199 virtual bool SetMtu (
const uint16_t mtu);
200 virtual uint16_t
GetMtu (
void)
const;
@ USE_LOCAL
ns-3 uses a pre-created tap, without configuring it
a unique identifier for an interface.
Ptr< NetDevice > GetBridgedNetDevice(void)
Get the bridged net device.
bool m_linkUp
Flag indicating whether or not the link is up.
Ptr< Node > m_node
Pointer to the (ghost) Node to which we are connected.
Mac48Address m_tapMac
The MAC address to use as the hardware address on the host; only used in UseLocal mode.
void StartTapDevice(void)
Spin up the device.
virtual Ptr< Channel > GetChannel(void) const
uint16_t m_mtu
The common mtu to use for the net devices.
virtual bool IsLinkUp(void) const
An identifier for simulation events.
NetDevice::ReceiveCallback m_rxCallback
Callback used to hook the standard packet receive callback of the TapBridge ns-3 net device.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void ForwardToBridgedDevice(uint8_t *buf, ssize_t len)
Forward a packet received from the tap device to the bridged ns-3 device.
std::string m_tapDeviceName
The name of the device to create on the host.
TapBridge::Mode GetMode(void)
Get the operating mode of this device.
virtual bool IsMulticast(void) const
virtual void SetReceiveCallback(NetDevice::ReceiveCallback cb)
uint32_t m_nodeId
a copy of the node id so the read thread doesn't have to GetNode() in in order to find the node ID.
FdReader::Data DoRead(void)
The read implementation.
bool ReceiveFromBridgedDevice(Ptr< NetDevice > device, Ptr< const Packet > packet, uint16_t protocol, Address const &src, Address const &dst, PacketType packetType)
Receives a packet from a bridged Device.
Ipv4 addresses are stored in host order in this class.
void Stop(Time tStop)
Set a stop time for the device.
Describes an IPv6 address.
Mode
Enumeration of the operating modes supported in the class.
virtual void SetAddress(Address address)
Set the address of this interface.
Mode m_mode
The operating mode of the bridge.
@ USE_BRIDGE
ns-3 uses a pre-created tap, and bridges to a bridging net device
virtual void SetIfIndex(const uint32_t index)
EventId m_stopEvent
The ID of the ns-3 event used to schedule the tear down of the underlying host Tap device and ns-3 re...
virtual void DoDispose(void)
Call out to a separate process running as suid root in order to get our tap device created.
virtual uint16_t GetMtu(void) const
Mac48Address m_address
The (unused) MAC address of the TapBridge net device.
virtual Address GetMulticast(Ipv4Address multicastGroup) const
Make and return a MAC multicast address using the provided multicast group.
Ptr< TapBridgeFdReader > m_fdReader
Includes the ns-3 read thread used to do blocking reads on the fd corresponding to the host device.
Time m_tStop
Time to start tearing down the device.
virtual Address GetBroadcast(void) const
uint8_t * m_packetBuffer
A 64K buffer to hold packet data while it is being sent.
virtual bool IsBroadcast(void) const
virtual void AddLinkChangeCallback(Callback< void > callback)
Ptr< NetDevice > m_bridgedDevice
The ns-3 net device to which we are bridging.
Ipv4Address m_tapGateway
The IP address to use as the device default gateway on the host.
Ipv4Mask m_tapNetmask
The network mask to assign to the device created on the host.
void SetBridgedNetDevice(Ptr< NetDevice > bridgedDevice)
Set the ns-3 net device to bridge.
a polymophic address class
virtual void SetNode(Ptr< Node > node)
static TypeId GetTypeId(void)
Get the type ID.
void ReadCallback(uint8_t *buf, ssize_t len)
Callback to process packets that are read.
void StopTapDevice(void)
Tear down the device.
TracedCallback m_linkChangeCallbacks
Callbacks to fire if the link changes state (up or down).
virtual bool IsBridge(void) const
Return true if the net device is acting as a bridge.
Simulation virtual time values and global simulation resolution.
void CreateTap(void)
Call out to a separate process running as suid root in order to get our tap device created.
virtual uint32_t GetIfIndex(void) const
EventId m_startEvent
The ID of the ns-3 event used to schedule the start up of the underlying host Tap device and ns-3 rea...
virtual bool SendFrom(Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber)
uint32_t m_ifIndex
The ns-3 interface index of this TapBridge net device.
bool m_verbose
Flag indicating whether or not the link is up.
virtual bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)
virtual void SetPromiscReceiveCallback(NetDevice::PromiscReceiveCallback cb)
Ipv4Address m_tapIp
The IP address to use as the device IP on the host.
virtual bool SetMtu(const uint16_t mtu)
virtual bool IsPointToPoint(void) const
Return true if the net device is on a point-to-point link.
void NotifyLinkUp(void)
Notifies that the link is up and ready.
A class that asynchronously reads from a file descriptor.
virtual Ptr< Node > GetNode(void) const
Time m_tStart
Time to start spinning up the device.
bool m_ns3AddressRewritten
Whether the MAC address of the underlying ns-3 device has already been rewritten is stored in this va...
virtual Address GetAddress(void) const
bool DiscardFromBridgedDevice(Ptr< NetDevice > device, Ptr< const Packet > packet, uint16_t protocol, Address const &src)
Receives a packet from a bridged Device.
a class to represent an Ipv4 address mask
virtual bool SupportsSendFrom() const
virtual bool NeedsArp(void) const
NetDevice::PromiscReceiveCallback m_promiscRxCallback
Callback used to hook the promiscuous packet receive callback of the TapBridge ns-3 net device.
PacketType
Packet types are used as they are in Linux.
@ CONFIGURE_LOCAL
ns-3 creates and configures tap device
Forward calls to a chain of Callback.
Class to perform the actual reading from a socket.
void SetMode(TapBridge::Mode mode)
Set the operating mode of this device.
Ptr< Packet > Filter(Ptr< Packet > packet, Address *src, Address *dst, uint16_t *type)
The host we are bridged to is in the evil real world.
int m_sock
The socket (actually interpreted as fd) to use to talk to the Tap device on the real internet host.
A bridge to make it appear that a real host process is connected to an ns-3 net device.
void Start(Time tStart)
Set a start time for the device.
Network layer to device interface.
A structure representing data read.