|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
19 #ifndef POINT_TO_POINT_NET_DEVICE_H
20 #define POINT_TO_POINT_NET_DEVICE_H
23 #include "ns3/address.h"
25 #include "ns3/net-device.h"
26 #include "ns3/callback.h"
27 #include "ns3/packet.h"
28 #include "ns3/traced-callback.h"
29 #include "ns3/nstime.h"
30 #include "ns3/data-rate.h"
32 #include "ns3/mac48-address.h"
36 template <
typename Item>
class Queue;
37 class PointToPointChannel;
154 virtual void SetIfIndex (
const uint32_t index);
162 virtual bool SetMtu (
const uint16_t mtu);
163 virtual uint16_t
GetMtu (
void)
const;
465 static uint16_t
PppToEther (uint16_t protocol);
472 static uint16_t
EtherToPpp (uint16_t protocol);
a unique identifier for an interface.
static uint16_t PppToEther(uint16_t protocol)
PPP to Ethernet protocol number mapping.
TracedCallback< Ptr< const Packet > > m_snifferTrace
A trace source that emulates a non-promiscuous protocol sniffer connected to the device.
NetDevice::PromiscReceiveCallback m_promiscCallback
Receive callback.
static const uint16_t DEFAULT_MTU
Default MTU.
virtual bool IsPointToPoint(void) const
Return true if the net device is on a point-to-point link.
TracedCallback< Ptr< const Packet > > m_phyTxEndTrace
The trace source fired when a packet ends the transmission process on the medium.
PointToPointNetDevice(const PointToPointNetDevice &o)
Copy constructor.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static uint16_t EtherToPpp(uint16_t protocol)
Ethernet to PPP protocol number mapping.
Address GetRemote(void) const
@ READY
The transmitter is ready to begin transmission of a packet.
PointToPointNetDevice()
Construct a PointToPointNetDevice.
virtual bool SendFrom(Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber)
uint32_t m_mtu
The Maximum Transmission Unit.
Ipv4 addresses are stored in host order in this class.
Describes an IPv6 address.
TracedCallback< Ptr< const Packet > > m_phyRxEndTrace
The trace source fired when a packet ends the reception process from the medium.
virtual bool IsBridge(void) const
Return true if the net device is acting as a bridge.
TracedCallback< Ptr< const Packet > > m_phyTxDropTrace
The trace source fired when the phy layer drops a packet before it tries to transmit it.
virtual void DoDispose(void)
Dispose of the object.
TxMachineState m_txMachineState
The state of the Net Device transmit state machine.
PointToPointNetDevice & operator=(const PointToPointNetDevice &o)
Assign operator.
Time m_tInterframeGap
The interframe gap that the Net Device uses to throttle packet transmission.
virtual bool NeedsArp(void) const
void TransmitComplete(void)
Stop Sending a Packet Down the Wire and Begin the Interframe Gap.
Ptr< Queue< Packet > > m_queue
The Queue which this PointToPointNetDevice uses as a packet source.
TracedCallback< Ptr< const Packet > > m_phyRxDropTrace
The trace source fired when the phy layer drops a packet it has received.
bool m_linkUp
Identify if the link is up or not.
@ BUSY
The transmitter is busy transmitting a packet.
Smart pointer class similar to boost::intrusive_ptr.
Class for representing data rates.
void SetInterframeGap(Time t)
Set the interframe gap used to separate packets.
a polymophic address class
virtual Address GetMulticast(Ipv4Address multicastGroup) const
Make and return a MAC multicast address using the provided multicast group.
TracedCallback< Ptr< const Packet > > m_phyRxBeginTrace
The trace source fired when a packet begins the reception process from the medium – when the simulate...
virtual bool IsLinkUp(void) const
NetDevice::ReceiveCallback m_rxCallback
Receive callback.
Simulation virtual time values and global simulation resolution.
virtual void AddLinkChangeCallback(Callback< void > callback)
Mac48Address m_address
Mac48Address of this NetDevice.
Ptr< Packet > m_currentPkt
Current packet processed.
bool Attach(Ptr< PointToPointChannel > ch)
Attach the device to a channel.
void SetReceiveErrorModel(Ptr< ErrorModel > em)
Attach a receive ErrorModel to the PointToPointNetDevice.
TracedCallback< Ptr< const Packet > > m_macTxTrace
The trace source fired when packets come into the "top" of the device at the L3/L2 transition,...
void Receive(Ptr< Packet > p)
Receive a packet from a connected PointToPointChannel.
static TypeId GetTypeId(void)
Get the TypeId.
virtual bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)
virtual Address GetBroadcast(void) const
virtual void SetPromiscReceiveCallback(PromiscReceiveCallback cb)
Ptr< Queue< Packet > > GetQueue(void) const
Get a copy of the attached Queue.
TracedCallback< Ptr< const Packet > > m_macRxTrace
The trace source fired for packets successfully received by the device immediately before being forwa...
TracedCallback< Ptr< const Packet > > m_macRxDropTrace
The trace source fired for packets successfully received by the device but are dropped before being f...
virtual bool SetMtu(const uint16_t mtu)
virtual uint16_t GetMtu(void) const
TracedCallback< Ptr< const Packet > > m_phyTxBeginTrace
The trace source fired when a packet begins the transmission process on the medium.
virtual bool IsMulticast(void) const
virtual uint32_t GetIfIndex(void) const
TracedCallback< Ptr< const Packet > > m_macPromiscRxTrace
The trace source fired for packets successfully received by the device immediately before being forwa...
DataRate m_bps
The data rate that the Net Device uses to simulate packet transmission timing.
virtual void SetAddress(Address address)
Set the address of this interface.
virtual void SetNode(Ptr< Node > node)
A Device for a Point to Point Network Link.
TracedCallback< Ptr< const Packet > > m_promiscSnifferTrace
A trace source that emulates a promiscuous mode protocol sniffer connected to the device.
uint32_t m_ifIndex
Index of the interface.
virtual bool IsBroadcast(void) const
void SetQueue(Ptr< Queue< Packet > > queue)
Attach a queue to the PointToPointNetDevice.
void DoMpiReceive(Ptr< Packet > p)
Handler for MPI receive event.
void AddHeader(Ptr< Packet > p, uint16_t protocolNumber)
Adds the necessary headers and trailers to a packet of data in order to respect the protocol implemen...
Ptr< Node > m_node
Node owning this NetDevice.
Forward calls to a chain of Callback.
virtual Address GetAddress(void) const
virtual void SetIfIndex(const uint32_t index)
TracedCallback m_linkChangeCallbacks
Callback for the link change event.
Ptr< ErrorModel > m_receiveErrorModel
Error model for receive packet events.
virtual void SetReceiveCallback(NetDevice::ReceiveCallback cb)
virtual ~PointToPointNetDevice()
Destroy a PointToPointNetDevice.
void NotifyLinkUp(void)
Make the link up and running.
Ptr< PointToPointChannel > m_channel
The PointToPointChannel to which this PointToPointNetDevice has been attached.
bool TransmitStart(Ptr< Packet > p)
Start Sending a Packet Down the Wire.
TxMachineState
Enumeration of the states of the transmit machine of the net device.
virtual Ptr< Node > GetNode(void) const
virtual bool SupportsSendFrom(void) const
virtual Ptr< Channel > GetChannel(void) const
bool ProcessHeader(Ptr< Packet > p, uint16_t ¶m)
Removes, from a packet of data, all headers and trailers that relate to the protocol implemented by t...
void SetDataRate(DataRate bps)
Set the Data Rate used for transmission of packets.
Network layer to device interface.
TracedCallback< Ptr< const Packet > > m_macTxDropTrace
The trace source fired when packets coming into the "top" of the device at the L3/L2 transition are d...