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"
37 class PointToPointChannel;
149 virtual void SetIfIndex (
const uint32_t index);
157 virtual bool SetMtu (
const uint16_t mtu);
158 virtual uint16_t
GetMtu (
void)
const;
459 static uint16_t
PppToEther (uint16_t protocol);
466 static uint16_t
EtherToPpp (uint16_t protocol);
void SetReceiveErrorModel(Ptr< ErrorModel > em)
Attach a receive ErrorModel to the PointToPointNetDevice.
PointToPointNetDevice()
Construct a PointToPointNetDevice.
keep track of time values and allow control of global simulation resolution
NetDevice::ReceiveCallback m_rxCallback
virtual bool IsLinkUp(void) const
smart pointer class similar to boost::intrusive_ptr
static TypeId GetTypeId(void)
Ptr< Queue > GetQueue(void) const
Get a copy of the attached Queue.
The transmitter is busy transmitting a packet.
TracedCallback< Ptr< const Packet > > m_phyTxDropTrace
The trace source fired when the phy layer drops a packet before it tries to transmit it...
uint32_t m_mtu
The Maximum Transmission Unit.
Address GetRemote(void) const
virtual bool SupportsSendFrom(void) const
virtual ~PointToPointNetDevice()
Destroy a PointToPointNetDevice.
static const uint16_t DEFAULT_MTU
TracedCallback< Ptr< const Packet > > m_phyRxEndTrace
The trace source fired when a packet ends the reception process from the medium.
TracedCallback< Ptr< const Packet > > m_phyRxDropTrace
The trace source fired when the phy layer drops a packet it has received.
forward calls to a chain of CallbackAn ns3::TracedCallback has almost exactly the same API as a norma...
TracedCallback< Ptr< const Packet > > m_phyTxBeginTrace
The trace source fired when a packet begins the transmission process on the medium.
Ptr< Packet > m_currentPkt
static uint16_t EtherToPpp(uint16_t protocol)
Ethernet to PPP protocol number mapping.
virtual Ptr< Node > GetNode(void) const
TracedCallback< Ptr< const Packet > > m_macRxTrace
The trace source fired for packets successfully received by the device immediately before being forwa...
The transmitter is ready to begin transmission of a packet.
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...
a polymophic address class
virtual Address GetMulticast(Ipv4Address multicastGroup) const
Make and return a MAC multicast address using the provided multicast group.
static uint16_t PppToEther(uint16_t protocol)
PPP to Ethernet protocol number mapping.
Class for representing data rates.
virtual bool IsPointToPoint(void) const
Return true if the net device is on a point-to-point link.
virtual void SetPromiscReceiveCallback(PromiscReceiveCallback cb)
virtual void SetAddress(Address address)
Set the address of this interface.
void TransmitComplete(void)
Stop Sending a Packet Down the Wire and Begin the Interframe Gap.
TracedCallback m_linkChangeCallbacks
TracedCallback< Ptr< const Packet > > m_snifferTrace
A trace source that emulates a non-promiscuous protocol sniffer connected to the device.
bool TransmitStart(Ptr< Packet > p)
Start Sending a Packet Down the Wire.
void SetInterframeGap(Time t)
Set the interframe gap used to separate packets.
A Device for a Point to Point Network Link.
NetDevice::PromiscReceiveCallback m_promiscCallback
Time m_tInterframeGap
The interframe gap that the Net Device uses to throttle packet transmission.
virtual void AddLinkChangeCallback(Callback< void > callback)
virtual bool NeedsArp(void) const
virtual void SetReceiveCallback(NetDevice::ReceiveCallback cb)
TxMachineState
Enumeration of the states of the transmit machine of the net device.
virtual uint32_t GetIfIndex(void) const
virtual Ptr< Channel > GetChannel(void) const
virtual Address GetAddress(void) const
virtual bool IsBridge(void) const
Return true if the net device is acting as a bridge.
void DoMpiReceive(Ptr< Packet > p)
DataRate m_bps
The data rate that the Net Device uses to simulate packet transmission timing.
Ptr< PointToPointChannel > m_channel
The PointToPointChannel to which this PointToPointNetDevice has been attached.
TracedCallback< Ptr< const Packet > > m_promiscSnifferTrace
A trace source that emulates a promiscuous mode protocol sniffer connected to the device...
Ptr< ErrorModel > m_receiveErrorModel
Error model for receive packet events.
virtual bool SendFrom(Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber)
virtual bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)
Describes an IPv6 address.
Ipv4 addresses are stored in host order in this class.
TracedCallback< Ptr< const Packet > > m_macPromiscRxTrace
The trace source fired for packets successfully received by the device immediately before being forwa...
TracedCallback< Ptr< const Packet > > m_phyRxBeginTrace
The trace source fired when a packet begins the reception process from the medium – when the simulat...
TxMachineState m_txMachineState
The state of the Net Device transmit state machine.
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...
Network layer to device interface.
virtual bool SetMtu(const uint16_t mtu)
virtual void SetIfIndex(const uint32_t index)
void SetDataRate(DataRate bps)
Set the Data Rate used for transmission of packets.
TracedCallback< Ptr< const Packet > > m_macRxDropTrace
The trace source fired for packets successfully received by the device but are dropped before being f...
void Receive(Ptr< Packet > p)
Receive a packet from a connected PointToPointChannel.
PointToPointNetDevice & operator=(const PointToPointNetDevice &)
virtual bool IsBroadcast(void) const
bool Attach(Ptr< PointToPointChannel > ch)
Attach the device to a channel.
Ptr< Queue > m_queue
The Queue which this PointToPointNetDevice uses as a packet source.
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
virtual void SetNode(Ptr< Node > node)
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...
virtual uint16_t GetMtu(void) const
virtual bool IsMulticast(void) const
a unique identifier for an interface.
TracedCallback< Ptr< const Packet > > m_macTxTrace
The trace source fired when packets come into the "top" of the device at the L3/L2 transition...
virtual Address GetBroadcast(void) const
void SetQueue(Ptr< Queue > queue)
Attach a queue to the PointToPointNetDevice.
TracedCallback< Ptr< const Packet > > m_phyTxEndTrace
The trace source fired when a packet ends the transmission process on the medium. ...