A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ns3::PointToPointNetDevice Class Reference

A Device for a Point to Point Network Link. More...

#include <point-to-point-net-device.h>

+ Inheritance diagram for ns3::PointToPointNetDevice:
+ Collaboration diagram for ns3::PointToPointNetDevice:

Public Member Functions

 PointToPointNetDevice ()
 Construct a PointToPointNetDevice. More...
 
virtual ~PointToPointNetDevice ()
 Destroy a PointToPointNetDevice. More...
 
virtual void AddLinkChangeCallback (Callback< void > callback)
 
bool Attach (Ptr< PointToPointChannel > ch)
 Attach the device to a channel. More...
 
virtual Address GetAddress (void) const
 
virtual Address GetBroadcast (void) const
 
virtual Ptr< ChannelGetChannel (void) const
 
virtual uint32_t GetIfIndex (void) const
 
virtual uint16_t GetMtu (void) const
 
virtual Address GetMulticast (Ipv4Address multicastGroup) const
 Make and return a MAC multicast address using the provided multicast group. More...
 
virtual Address GetMulticast (Ipv6Address addr) const
 Get the MAC multicast address corresponding to the IPv6 address provided. More...
 
virtual Ptr< NodeGetNode (void) const
 
Ptr< QueueGetQueue (void) const
 Get a copy of the attached Queue. More...
 
virtual bool IsBridge (void) const
 Return true if the net device is acting as a bridge. More...
 
virtual bool IsBroadcast (void) const
 
virtual bool IsLinkUp (void) const
 
virtual bool IsMulticast (void) const
 
virtual bool IsPointToPoint (void) const
 Return true if the net device is on a point-to-point link. More...
 
virtual bool NeedsArp (void) const
 
void Receive (Ptr< Packet > p)
 Receive a packet from a connected PointToPointChannel. More...
 
virtual bool Send (Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)
 
virtual bool SendFrom (Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber)
 
virtual void SetAddress (Address address)
 Set the address of this interface. More...
 
void SetDataRate (DataRate bps)
 Set the Data Rate used for transmission of packets. More...
 
virtual void SetIfIndex (const uint32_t index)
 
void SetInterframeGap (Time t)
 Set the interframe gap used to separate packets. More...
 
virtual bool SetMtu (const uint16_t mtu)
 
virtual void SetNode (Ptr< Node > node)
 
virtual void SetPromiscReceiveCallback (PromiscReceiveCallback cb)
 
void SetQueue (Ptr< Queue > queue)
 Attach a queue to the PointToPointNetDevice. More...
 
virtual void SetReceiveCallback (NetDevice::ReceiveCallback cb)
 
void SetReceiveErrorModel (Ptr< ErrorModel > em)
 Attach a receive ErrorModel to the PointToPointNetDevice. More...
 
virtual bool SupportsSendFrom (void) const
 
- Public Member Functions inherited from ns3::NetDevice
virtual ~NetDevice ()
 
- Public Member Functions inherited from ns3::Object
 Object ()
 
virtual ~Object ()
 
void AggregateObject (Ptr< Object > other)
 
void Dispose (void)
 Run the DoDispose methods of this object and all the objects aggregated to it. More...
 
AggregateIterator GetAggregateIterator (void) const
 
virtual TypeId GetInstanceTypeId (void) const
 
template<typename T >
Ptr< T > GetObject (void) const
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 
void Initialize (void)
 This method calls the virtual DoInitialize method on all the objects aggregated to this object. More...
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 Constructor. More...
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor. More...
 
uint32_t GetReferenceCount (void) const
 Get the reference count of the object. More...
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment. More...
 
void Ref (void) const
 Increment the reference count. More...
 
void Unref (void) const
 Decrement the reference count. More...
 
- Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
 Virtual destructor. More...
 
void GetAttribute (std::string name, AttributeValue &value) const
 
bool GetAttributeFailSafe (std::string name, AttributeValue &attribute) const
 
void SetAttribute (std::string name, const AttributeValue &value)
 
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 

Static Public Member Functions

static TypeId GetTypeId (void)
 
- Static Public Member Functions inherited from ns3::NetDevice
static TypeId GetTypeId (void)
 
- Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId (void)
 Register this type. More...
 
- Static Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
static void Cleanup (void)
 Noop. More...
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId (void)
 Get the type ID. More...
 

Protected Member Functions

void DoMpiReceive (Ptr< Packet > p)
 
- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 
virtual void DoInitialize (void)
 This method is called only once by Object::Initialize. More...
 
virtual void NotifyNewAggregate (void)
 This method is invoked whenever two sets of objects are aggregated together. More...
 
- Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
 
virtual void NotifyConstructionCompleted (void)
 This method is invoked once all member attributes have been initialized. More...
 

Private Types

enum  TxMachineState { READY, BUSY }
 Enumeration of the states of the transmit machine of the net device. More...
 

Private Member Functions

 PointToPointNetDevice (const PointToPointNetDevice &)
 
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 implemented by the agent. More...
 
virtual void DoDispose (void)
 This method is called by Object::Dispose or by the object's destructor, whichever comes first. More...
 
Address GetRemote (void) const
 
void NotifyLinkUp (void)
 
PointToPointNetDeviceoperator= (const PointToPointNetDevice &)
 
bool ProcessHeader (Ptr< Packet > p, uint16_t &param)
 Removes, from a packet of data, all headers and trailers that relate to the protocol implemented by the agent. More...
 
void TransmitComplete (void)
 Stop Sending a Packet Down the Wire and Begin the Interframe Gap. More...
 
bool TransmitStart (Ptr< Packet > p)
 Start Sending a Packet Down the Wire. More...
 

Static Private Member Functions

static uint16_t EtherToPpp (uint16_t protocol)
 Ethernet to PPP protocol number mapping. More...
 
static uint16_t PppToEther (uint16_t protocol)
 PPP to Ethernet protocol number mapping. More...
 

Private Attributes

Mac48Address m_address
 
DataRate m_bps
 The data rate that the Net Device uses to simulate packet transmission timing. More...
 
Ptr< PointToPointChannelm_channel
 The PointToPointChannel to which this PointToPointNetDevice has been attached. More...
 
Ptr< Packetm_currentPkt
 
uint32_t m_ifIndex
 
TracedCallback m_linkChangeCallbacks
 
bool m_linkUp
 
TracedCallback< Ptr< const
Packet > > 
m_macPromiscRxTrace
 The trace source fired for packets successfully received by the device immediately before being forwarded up to higher layers (at the L2/L3 transition). More...
 
TracedCallback< Ptr< const
Packet > > 
m_macRxDropTrace
 The trace source fired for packets successfully received by the device but are dropped before being forwarded up to higher layers (at the L2/L3 transition). More...
 
TracedCallback< Ptr< const
Packet > > 
m_macRxTrace
 The trace source fired for packets successfully received by the device immediately before being forwarded up to higher layers (at the L2/L3 transition). More...
 
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 dropped before being queued for transmission. More...
 
TracedCallback< Ptr< const
Packet > > 
m_macTxTrace
 The trace source fired when packets come into the "top" of the device at the L3/L2 transition, before being queued for transmission. More...
 
uint32_t m_mtu
 The Maximum Transmission Unit. More...
 
Ptr< Nodem_node
 
TracedCallback< Ptr< const
Packet > > 
m_phyRxBeginTrace
 The trace source fired when a packet begins the reception process from the medium – when the simulated first bit(s) arrive. More...
 
TracedCallback< Ptr< const
Packet > > 
m_phyRxDropTrace
 The trace source fired when the phy layer drops a packet it has received. More...
 
TracedCallback< Ptr< const
Packet > > 
m_phyRxEndTrace
 The trace source fired when a packet ends the reception process from the medium. More...
 
TracedCallback< Ptr< const
Packet > > 
m_phyTxBeginTrace
 The trace source fired when a packet begins the transmission process on the medium. More...
 
TracedCallback< Ptr< const
Packet > > 
m_phyTxDropTrace
 The trace source fired when the phy layer drops a packet before it tries to transmit it. More...
 
TracedCallback< Ptr< const
Packet > > 
m_phyTxEndTrace
 The trace source fired when a packet ends the transmission process on the medium. More...
 
NetDevice::PromiscReceiveCallback m_promiscCallback
 
TracedCallback< Ptr< const
Packet > > 
m_promiscSnifferTrace
 A trace source that emulates a promiscuous mode protocol sniffer connected to the device. More...
 
Ptr< Queuem_queue
 The Queue which this PointToPointNetDevice uses as a packet source. More...
 
Ptr< ErrorModelm_receiveErrorModel
 Error model for receive packet events. More...
 
NetDevice::ReceiveCallback m_rxCallback
 
TracedCallback< Ptr< const
Packet > > 
m_snifferTrace
 A trace source that emulates a non-promiscuous protocol sniffer connected to the device. More...
 
Time m_tInterframeGap
 The interframe gap that the Net Device uses to throttle packet transmission. More...
 
TxMachineState m_txMachineState
 The state of the Net Device transmit state machine. More...
 

Static Private Attributes

static const uint16_t DEFAULT_MTU = 1500
 

Additional Inherited Members

- Public Types inherited from ns3::NetDevice
enum  PacketType {
  PACKET_HOST = 1, NS3_PACKET_HOST = PACKET_HOST, PACKET_BROADCAST, NS3_PACKET_BROADCAST = PACKET_BROADCAST,
  PACKET_MULTICAST, NS3_PACKET_MULTICAST = PACKET_MULTICAST, PACKET_OTHERHOST, NS3_PACKET_OTHERHOST = PACKET_OTHERHOST
}
 Packet types are used as they are in Linux. More...
 
typedef Callback< bool, Ptr
< NetDevice >, Ptr< const
Packet >, uint16_t, const
Address &, const Address
&, enum PacketType
PromiscReceiveCallback
 
typedef Callback< bool, Ptr
< NetDevice >, Ptr< const
Packet >, uint16_t, const
Address & > 
ReceiveCallback
 

Detailed Description

A Device for a Point to Point Network Link.

Config Paths

ns3::PointToPointNetDevice is accessible through the following paths with Config::Set and Config::Connect:

  • /NodeList/[i]/DeviceList/[i]/$ns3::PointToPointNetDevice

Attributes

  • Mtu: The MAC-level Maximum Transmission Unit
  • Address: The MAC address of this device.
  • DataRate: The default data rate for point to point links
    • Set with class: DataRateValue
    • Underlying type: DataRate
    • Initial value: 32768bps
    • Flags: construct write read
  • ReceiveErrorModel: The receiver error model used to simulate packet loss
    • Set with class: ns3::PointerValue
    • Underlying type: ns3::Ptr< ns3::ErrorModel >
    • Initial value: 0
    • Flags: construct write read
  • InterframeGap: The time to wait between packet (frame) transmissions
    • Set with class: ns3::TimeValue
    • Underlying type: Time -9223372036854775808.0ns:+9223372036854775807.0ns
    • Initial value: +0.0ns
    • Flags: construct write read
  • TxQueue: A queue to use as the transmit queue in the device.
    • Set with class: ns3::PointerValue
    • Underlying type: ns3::Ptr< ns3::Queue >
    • Initial value: 0
    • Flags: construct write read

TraceSources

  • MacTx: Trace source indicating a packet has arrived for transmission by this device
  • MacTxDrop: Trace source indicating a packet has been dropped by the device before transmission
  • MacPromiscRx: A packet has been received by this device, has been passed up from the physical layer and is being forwarded up the local protocol stack. This is a promiscuous trace,
  • MacRx: A packet has been received by this device, has been passed up from the physical layer and is being forwarded up the local protocol stack. This is a non-promiscuous trace,
  • PhyTxBegin: Trace source indicating a packet has begun transmitting over the channel
  • PhyTxEnd: Trace source indicating a packet has been completely transmitted over the channel
  • PhyTxDrop: Trace source indicating a packet has been dropped by the device during transmission
  • PhyRxEnd: Trace source indicating a packet has been completely received by the device
  • PhyRxDrop: Trace source indicating a packet has been dropped by the device during reception
  • Sniffer: Trace source simulating a non-promiscuous packet sniffer attached to the device
  • PromiscSniffer: Trace source simulating a promiscuous packet sniffer attached to the device

This PointToPointNetDevice class specializes the NetDevice abstract base class. Together with a PointToPointChannel (and a peer PointToPointNetDevice), the class models, with some level of abstraction, a generic point-to-point or serial link. Key parameters or objects that can be specified for this device include a queue, data rate, and interframe transmission gap (the propagation delay is set in the PointToPointChannel).

Definition at line 58 of file point-to-point-net-device.h.

Member Enumeration Documentation

Enumeration of the states of the transmit machine of the net device.

Enumerator
READY 

The transmitter is ready to begin transmission of a packet.

BUSY 

The transmitter is busy transmitting a packet.

Definition at line 254 of file point-to-point-net-device.h.

Constructor & Destructor Documentation

ns3::PointToPointNetDevice::PointToPointNetDevice ( )

Construct a PointToPointNetDevice.

This is the constructor for the PointToPointNetDevice. It takes as a parameter a pointer to the Node to which this device is connected, as well as an optional DataRate object.

Definition at line 147 of file point-to-point-net-device.cc.

References NS_LOG_FUNCTION.

ns3::PointToPointNetDevice::~PointToPointNetDevice ( )
virtual

Destroy a PointToPointNetDevice.

This is the destructor for the PointToPointNetDevice.

Definition at line 157 of file point-to-point-net-device.cc.

References NS_LOG_FUNCTION_NOARGS.

ns3::PointToPointNetDevice::PointToPointNetDevice ( const PointToPointNetDevice )
private

Member Function Documentation

void ns3::PointToPointNetDevice::AddHeader ( Ptr< Packet p,
uint16_t  protocolNumber 
)
private

Adds the necessary headers and trailers to a packet of data in order to respect the protocol implemented by the agent.

Parameters
ppacket
protocolNumberprotocol number

Definition at line 163 of file point-to-point-net-device.cc.

References ns3::Packet::AddHeader(), EtherToPpp(), NS_LOG_FUNCTION_NOARGS, and ns3::PppHeader::SetProtocol().

Referenced by Send().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::PointToPointNetDevice::AddLinkChangeCallback ( Callback< void >  callback)
virtual
Parameters
callbackthe callback to invoke

Add a callback invoked whenever the link status changes to UP. This callback is typically used by the IP/ARP layer to flush the ARP cache and by IPv6 stack to flush NDISC cache whenever the link goes up.

Implements ns3::NetDevice.

Definition at line 405 of file point-to-point-net-device.cc.

References ns3::TracedCallback< T1, T2, T3, T4, T5, T6, T7, T8 >::ConnectWithoutContext(), and m_linkChangeCallbacks.

+ Here is the call graph for this function:

bool ns3::PointToPointNetDevice::Attach ( Ptr< PointToPointChannel ch)

Attach the device to a channel.

Parameters
chPtr to the channel to which this object is being attached.

Definition at line 273 of file point-to-point-net-device.cc.

References m_channel, NotifyLinkUp(), and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

void ns3::PointToPointNetDevice::DoDispose ( void  )
privatevirtual

This method is called by Object::Dispose or by the object's destructor, whichever comes first.

Subclasses are expected to implement their real destruction code in an overriden version of this method and chain up to their parent's implementation once they are done. i.e., for simplicity, the destructor of every subclass should be empty and its content should be moved to the associated DoDispose method.

It is safe to call GetObject from within this method.

Reimplemented from ns3::Object.

Definition at line 182 of file point-to-point-net-device.cc.

References ns3::Object::DoDispose(), m_channel, m_currentPkt, m_node, m_receiveErrorModel, and NS_LOG_FUNCTION_NOARGS.

+ Here is the call graph for this function:

void ns3::PointToPointNetDevice::DoMpiReceive ( Ptr< Packet p)
protected

Definition at line 566 of file point-to-point-net-device.cc.

References Receive().

+ Here is the call graph for this function:

uint16_t ns3::PointToPointNetDevice::EtherToPpp ( uint16_t  protocol)
staticprivate

Ethernet to PPP protocol number mapping.

Parameters
protocolAn Ethernet protocol number
Returns
The corresponding PPP protocol number

Definition at line 616 of file point-to-point-net-device.cc.

References NS_ASSERT_MSG.

Referenced by AddHeader().

+ Here is the caller graph for this function:

Address ns3::PointToPointNetDevice::GetAddress ( void  ) const
virtual
Returns
the current Address of this interface.

Implements ns3::NetDevice.

Definition at line 393 of file point-to-point-net-device.cc.

References m_address.

Referenced by Receive().

+ Here is the caller graph for this function:

Address ns3::PointToPointNetDevice::GetBroadcast ( void  ) const
virtual
Returns
the broadcast address supported by this netdevice.

Calling this method is invalid if IsBroadcast returns not true.

Implements ns3::NetDevice.

Definition at line 426 of file point-to-point-net-device.cc.

Referenced by PointToPointTest::SendOnePacket().

+ Here is the caller graph for this function:

Ptr< Channel > ns3::PointToPointNetDevice::GetChannel ( void  ) const
virtual
Returns
the channel this NetDevice is connected to. The value returned can be zero if the NetDevice is not yet connected to any channel or if the underlying NetDevice has no concept of a channel. i.e., callers must check for zero and be ready to handle it.

Implements ns3::NetDevice.

Definition at line 375 of file point-to-point-net-device.cc.

References m_channel.

uint32_t ns3::PointToPointNetDevice::GetIfIndex ( void  ) const
virtual
Returns
index ifIndex of the device

Implements ns3::NetDevice.

Definition at line 369 of file point-to-point-net-device.cc.

References m_ifIndex.

uint16_t ns3::PointToPointNetDevice::GetMtu ( void  ) const
virtual
Returns
the link-level MTU in bytes for this interface.

This value is typically used by the IP layer to perform IP fragmentation when needed.

Implements ns3::NetDevice.

Definition at line 597 of file point-to-point-net-device.cc.

References m_mtu, and NS_LOG_FUNCTION_NOARGS.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

Address ns3::PointToPointNetDevice::GetMulticast ( Ipv4Address  multicastGroup) const
virtual

Make and return a MAC multicast address using the provided multicast group.

RFC 1112 says that an Ipv4 host group address is mapped to an Ethernet multicast address by placing the low-order 23-bits of the IP address into the low-order 23 bits of the Ethernet multicast address 01-00-5E-00-00-00 (hex). Similar RFCs exist for Ipv6 and Eui64 mappings. This method performs the multicast address creation function appropriate to the underlying MAC address of the device. This MAC address is encapsulated in an abstract Address to avoid dependencies on the exact MAC address format.

In the case of net devices that do not support multicast, clients are expected to test NetDevice::IsMulticast and avoid attempting to map multicast packets. Subclasses of NetDevice that do support multicasting are expected to override this method and provide an implementation appropriate to the particular device.

Parameters
multicastGroupThe IP address for the multicast group destination of the packet.
Returns
The MAC multicast Address used to send packets to the provided multicast group.
Warning
Calling this method is invalid if IsMulticast returns not true.
See also
Ipv4Address
Address
NetDevice::IsMulticast

Implements ns3::NetDevice.

Definition at line 438 of file point-to-point-net-device.cc.

Address ns3::PointToPointNetDevice::GetMulticast ( Ipv6Address  addr) const
virtual

Get the MAC multicast address corresponding to the IPv6 address provided.

Parameters
addrIPv6 address
Returns
the MAC multicast address
Warning
Calling this method is invalid if IsMulticast returns not true.

Implements ns3::NetDevice.

Definition at line 444 of file point-to-point-net-device.cc.

References NS_LOG_FUNCTION.

Ptr< Node > ns3::PointToPointNetDevice::GetNode ( void  ) const
virtual
Returns
the node base class which contains this network interface.

When a subclass needs to get access to the underlying node base class to print the nodeid for example, it can invoke this method.

Implements ns3::NetDevice.

Definition at line 530 of file point-to-point-net-device.cc.

References m_node.

Ptr< Queue > ns3::PointToPointNetDevice::GetQueue ( void  ) const

Get a copy of the attached Queue.

Returns
Ptr to the queue.

Definition at line 349 of file point-to-point-net-device.cc.

References m_queue, and NS_LOG_FUNCTION_NOARGS.

Referenced by ns3::PointToPointHelper::EnableAsciiInternal(), and main().

+ Here is the caller graph for this function:

Address ns3::PointToPointNetDevice::GetRemote ( void  ) const
private
Returns
the address of the remote device connected to this device through the point to point channel.

Definition at line 572 of file point-to-point-net-device.cc.

References m_channel, and NS_ASSERT.

Referenced by Receive().

+ Here is the caller graph for this function:

bool ns3::PointToPointNetDevice::IsBridge ( void  ) const
virtual

Return true if the net device is acting as a bridge.

Returns
value of m_isBridge flag

Implements ns3::NetDevice.

Definition at line 457 of file point-to-point-net-device.cc.

bool ns3::PointToPointNetDevice::IsBroadcast ( void  ) const
virtual
Returns
true if this interface supports a broadcast address, false otherwise.

Implements ns3::NetDevice.

Definition at line 415 of file point-to-point-net-device.cc.

bool ns3::PointToPointNetDevice::IsLinkUp ( void  ) const
virtual
Returns
true if link is up; false otherwise

Implements ns3::NetDevice.

Definition at line 399 of file point-to-point-net-device.cc.

References m_linkUp.

Referenced by Send().

+ Here is the caller graph for this function:

bool ns3::PointToPointNetDevice::IsMulticast ( void  ) const
virtual
Returns
value of m_isMulticast flag

Implements ns3::NetDevice.

Definition at line 432 of file point-to-point-net-device.cc.

bool ns3::PointToPointNetDevice::IsPointToPoint ( void  ) const
virtual

Return true if the net device is on a point-to-point link.

Returns
value of m_isPointToPoint flag

Implements ns3::NetDevice.

Definition at line 451 of file point-to-point-net-device.cc.

bool ns3::PointToPointNetDevice::NeedsArp ( void  ) const
virtual
Returns
true if ARP is needed, false otherwise.

Called by higher-layers to check if this NetDevice requires ARP to be used.

Implements ns3::NetDevice.

Definition at line 542 of file point-to-point-net-device.cc.

void ns3::PointToPointNetDevice::NotifyLinkUp ( void  )
private

Definition at line 356 of file point-to-point-net-device.cc.

References m_linkChangeCallbacks, and m_linkUp.

Referenced by Attach().

+ Here is the caller graph for this function:

PointToPointNetDevice& ns3::PointToPointNetDevice::operator= ( const PointToPointNetDevice )
private
uint16_t ns3::PointToPointNetDevice::PppToEther ( uint16_t  protocol)
staticprivate

PPP to Ethernet protocol number mapping.

Parameters
protocolA PPP protocol number
Returns
The corresponding Ethernet protocol number

Definition at line 604 of file point-to-point-net-device.cc.

References NS_ASSERT_MSG.

Referenced by ProcessHeader().

+ Here is the caller graph for this function:

bool ns3::PointToPointNetDevice::ProcessHeader ( Ptr< Packet p,
uint16_t &  param 
)
private

Removes, from a packet of data, all headers and trailers that relate to the protocol implemented by the agent.

Parameters
pPacket whose headers need to be processed
paramAn integer parameter that can be set by the function
Returns
Returns true if the packet should be forwarded up the protocol stack.

Definition at line 172 of file point-to-point-net-device.cc.

References ns3::PppHeader::GetProtocol(), NS_LOG_FUNCTION_NOARGS, PppToEther(), and ns3::Packet::RemoveHeader().

Referenced by Receive().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::PointToPointNetDevice::Receive ( Ptr< Packet p)

Receive a packet from a connected PointToPointChannel.

The PointToPointNetDevice receives packets from its connected channel and forwards them up the protocol stack. This is the public method used by the channel to indicate that the last bit of a packet has arrived at the device.

See also
PointToPointChannel
Parameters
pPtr to the received packet.

Definition at line 305 of file point-to-point-net-device.cc.

References GetAddress(), GetRemote(), ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), m_macPromiscRxTrace, m_macRxTrace, m_phyRxDropTrace, m_phyRxEndTrace, m_promiscCallback, m_promiscSnifferTrace, m_receiveErrorModel, m_rxCallback, m_snifferTrace, NS_LOG_FUNCTION, ns3::NetDevice::PACKET_HOST, and ProcessHeader().

Referenced by DoMpiReceive(), ns3::PointToPointHelper::Install(), and ns3::PointToPointChannel::TransmitStart().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ns3::PointToPointNetDevice::Send ( Ptr< Packet packet,
const Address dest,
uint16_t  protocolNumber 
)
virtual
Parameters
packetpacket sent from above down to Network Device
destmac address of the destination (already resolved)
protocolNumberidentifies the type of payload contained in this packet. Used to call the right L3Protocol when the packet is received.

Called from higher layer to send packet into Network Device to the specified destination Address

Returns
whether the Send operation succeeded

Implements ns3::NetDevice.

Definition at line 463 of file point-to-point-net-device.cc.

References AddHeader(), ns3::Packet::GetUid(), IsLinkUp(), m_macTxDropTrace, m_macTxTrace, m_promiscSnifferTrace, m_queue, m_snifferTrace, m_txMachineState, NS_LOG_FUNCTION_NOARGS, NS_LOG_LOGIC, READY, and TransmitStart().

Referenced by PointToPointTest::SendOnePacket().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ns3::PointToPointNetDevice::SendFrom ( Ptr< Packet packet,
const Address source,
const Address dest,
uint16_t  protocolNumber 
)
virtual
Parameters
packetpacket sent from above down to Network Device
sourcesource mac address (so called "MAC spoofing")
destmac address of the destination (already resolved)
protocolNumberidentifies the type of payload contained in this packet. Used to call the right L3Protocol when the packet is received.

Called from higher layer to send packet into Network Device with the specified source and destination Addresses.

Returns
whether the Send operation succeeded

Implements ns3::NetDevice.

Definition at line 521 of file point-to-point-net-device.cc.

void ns3::PointToPointNetDevice::SetAddress ( Address  address)
virtual

Set the address of this interface.

Parameters
addressaddress to set

Implements ns3::NetDevice.

Definition at line 387 of file point-to-point-net-device.cc.

References ns3::Mac48Address::ConvertFrom(), and m_address.

+ Here is the call graph for this function:

void ns3::PointToPointNetDevice::SetDataRate ( DataRate  bps)

Set the Data Rate used for transmission of packets.

The data rate is set in the Attach () method from the corresponding field in the channel to which the device is attached. It can be overridden using this method.

See also
Attach ()
Parameters
bpsthe data rate at which this object operates

Definition at line 193 of file point-to-point-net-device.cc.

References m_bps, and NS_LOG_FUNCTION_NOARGS.

void ns3::PointToPointNetDevice::SetIfIndex ( const uint32_t  index)
virtual
Parameters
indexifIndex of the device

Implements ns3::NetDevice.

Definition at line 363 of file point-to-point-net-device.cc.

References m_ifIndex.

void ns3::PointToPointNetDevice::SetInterframeGap ( Time  t)

Set the interframe gap used to separate packets.

The interframe gap defines the minimum space required between packets sent by this device.

Parameters
tthe interframe gap time

Definition at line 200 of file point-to-point-net-device.cc.

References m_tInterframeGap, and NS_LOG_FUNCTION_NOARGS.

bool ns3::PointToPointNetDevice::SetMtu ( const uint16_t  mtu)
virtual
Parameters
mtuMTU value, in bytes, to set for the device
Returns
whether the MTU value was within legal bounds

Override for default MTU defined on a per-type basis.

Implements ns3::NetDevice.

Definition at line 589 of file point-to-point-net-device.cc.

References m_mtu, and NS_LOG_FUNCTION.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

void ns3::PointToPointNetDevice::SetNode ( Ptr< Node node)
virtual
Parameters
nodethe node associated to this netdevice.

This method is called from ns3::Node::AddDevice.

Implements ns3::NetDevice.

Definition at line 536 of file point-to-point-net-device.cc.

References m_node.

void ns3::PointToPointNetDevice::SetPromiscReceiveCallback ( PromiscReceiveCallback  cb)
virtual
Parameters
cbcallback to invoke whenever a packet has been received in promiscuous mode and must be forwarded to the higher layers.

Enables netdevice promiscuous mode and sets the callback that will handle promiscuous mode packets. Note, promiscuous mode packets means all packets, including those packets that can be sensed by the netdevice but which are intended to be received by other hosts.

Implements ns3::NetDevice.

Definition at line 554 of file point-to-point-net-device.cc.

References m_promiscCallback.

void ns3::PointToPointNetDevice::SetQueue ( Ptr< Queue queue)

Attach a queue to the PointToPointNetDevice.

The PointToPointNetDevice "owns" a queue that implements a queueing method such as DropTail or RED.

See also
Queue
DropTailQueue
Parameters
queuePtr to the new queue.

Definition at line 291 of file point-to-point-net-device.cc.

References m_queue, and NS_LOG_FUNCTION.

void ns3::PointToPointNetDevice::SetReceiveCallback ( NetDevice::ReceiveCallback  cb)
virtual
Parameters
cbcallback to invoke whenever a packet has been received and must be forwarded to the higher layers.

Implements ns3::NetDevice.

Definition at line 548 of file point-to-point-net-device.cc.

References m_rxCallback.

void ns3::PointToPointNetDevice::SetReceiveErrorModel ( Ptr< ErrorModel em)

Attach a receive ErrorModel to the PointToPointNetDevice.

The PointToPointNetDevice may optionally include an ErrorModel in the packet receive chain.

See also
ErrorModel
Parameters
emPtr to the ErrorModel.

Definition at line 298 of file point-to-point-net-device.cc.

References m_receiveErrorModel, and NS_LOG_FUNCTION.

bool ns3::PointToPointNetDevice::SupportsSendFrom ( void  ) const
virtual
Returns
true if this interface supports a bridging mode, false otherwise.

Implements ns3::NetDevice.

Definition at line 560 of file point-to-point-net-device.cc.

void ns3::PointToPointNetDevice::TransmitComplete ( void  )
private

Stop Sending a Packet Down the Wire and Begin the Interframe Gap.

The TransmitComplete method is used internally to finish the process of sending a packet out on the channel.

Definition at line 237 of file point-to-point-net-device.cc.

References BUSY, m_currentPkt, m_phyTxEndTrace, m_promiscSnifferTrace, m_queue, m_snifferTrace, m_txMachineState, NS_ASSERT_MSG, NS_LOG_FUNCTION_NOARGS, READY, and TransmitStart().

Referenced by TransmitStart().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ns3::PointToPointNetDevice::TransmitStart ( Ptr< Packet p)
private

Start Sending a Packet Down the Wire.

The TransmitStart method is the method that is used internally in the PointToPointNetDevice to begin the process of sending a packet out on the channel. The corresponding method is called on the channel to let it know that the physical device this class represents has virtually started sending signals. An event is scheduled for the time at which the bits have been completely transmitted.

See also
PointToPointChannel::TransmitStart ()
TransmitCompleteEvent ()
Parameters
pa reference to the packet to send
Returns
true if success, false on failure

Definition at line 207 of file point-to-point-net-device.cc.

References BUSY, ns3::DataRate::CalculateTxTime(), ns3::Time::GetSeconds(), ns3::Packet::GetSize(), ns3::Packet::GetUid(), m_bps, m_channel, m_currentPkt, m_phyTxBeginTrace, m_phyTxDropTrace, m_tInterframeGap, m_txMachineState, NS_ASSERT_MSG, NS_LOG_FUNCTION, NS_LOG_LOGIC, READY, ns3::Simulator::Schedule(), and TransmitComplete().

Referenced by Send(), and TransmitComplete().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

const uint16_t ns3::PointToPointNetDevice::DEFAULT_MTU = 1500
staticprivate

Definition at line 442 of file point-to-point-net-device.h.

Referenced by GetTypeId().

Mac48Address ns3::PointToPointNetDevice::m_address
private

Definition at line 435 of file point-to-point-net-device.h.

Referenced by GetAddress(), GetTypeId(), and SetAddress().

DataRate ns3::PointToPointNetDevice::m_bps
private

The data rate that the Net Device uses to simulate packet transmission timing.

See also
class DataRate

Definition at line 270 of file point-to-point-net-device.h.

Referenced by GetTypeId(), SetDataRate(), and TransmitStart().

Ptr<PointToPointChannel> ns3::PointToPointNetDevice::m_channel
private

The PointToPointChannel to which this PointToPointNetDevice has been attached.

See also
class PointToPointChannel

Definition at line 284 of file point-to-point-net-device.h.

Referenced by Attach(), DoDispose(), GetChannel(), GetRemote(), and TransmitStart().

Ptr<Packet> ns3::PointToPointNetDevice::m_currentPkt
private

Definition at line 452 of file point-to-point-net-device.h.

Referenced by DoDispose(), TransmitComplete(), and TransmitStart().

uint32_t ns3::PointToPointNetDevice::m_ifIndex
private

Definition at line 438 of file point-to-point-net-device.h.

Referenced by GetIfIndex(), and SetIfIndex().

TracedCallback ns3::PointToPointNetDevice::m_linkChangeCallbacks
private

Definition at line 440 of file point-to-point-net-device.h.

Referenced by AddLinkChangeCallback(), and NotifyLinkUp().

bool ns3::PointToPointNetDevice::m_linkUp
private

Definition at line 439 of file point-to-point-net-device.h.

Referenced by IsLinkUp(), and NotifyLinkUp().

TracedCallback<Ptr<const Packet> > ns3::PointToPointNetDevice::m_macPromiscRxTrace
private

The trace source fired for packets successfully received by the device immediately before being forwarded up to higher layers (at the L2/L3 transition).

This is a promiscuous trace (which doesn't mean a lot here in the point-to-point device).

See also
class CallBackTraceSource

Definition at line 324 of file point-to-point-net-device.h.

Referenced by GetTypeId(), and Receive().

TracedCallback<Ptr<const Packet> > ns3::PointToPointNetDevice::m_macRxDropTrace
private

The trace source fired for packets successfully received by the device but are dropped before being forwarded up to higher layers (at the L2/L3 transition).

See also
class CallBackTraceSource

Definition at line 343 of file point-to-point-net-device.h.

Referenced by GetTypeId().

TracedCallback<Ptr<const Packet> > ns3::PointToPointNetDevice::m_macRxTrace
private

The trace source fired for packets successfully received by the device immediately before being forwarded up to higher layers (at the L2/L3 transition).

This is a non-promiscuous trace (which doesn't mean a lot here in the point-to-point device).

See also
class CallBackTraceSource

Definition at line 334 of file point-to-point-net-device.h.

Referenced by GetTypeId(), and Receive().

TracedCallback<Ptr<const Packet> > ns3::PointToPointNetDevice::m_macTxDropTrace
private

The trace source fired when packets coming into the "top" of the device at the L3/L2 transition are dropped before being queued for transmission.

See also
class CallBackTraceSource

Definition at line 314 of file point-to-point-net-device.h.

Referenced by GetTypeId(), and Send().

TracedCallback<Ptr<const Packet> > ns3::PointToPointNetDevice::m_macTxTrace
private

The trace source fired when packets come into the "top" of the device at the L3/L2 transition, before being queued for transmission.

See also
class CallBackTraceSource

Definition at line 306 of file point-to-point-net-device.h.

Referenced by GetTypeId(), and Send().

uint32_t ns3::PointToPointNetDevice::m_mtu
private

The Maximum Transmission Unit.

This corresponds to the maximum number of bytes that can be transmitted as seen from higher layers. This corresponds to the 1500 byte MTU size often seen on IP over Ethernet.

Definition at line 450 of file point-to-point-net-device.h.

Referenced by GetMtu(), and SetMtu().

Ptr<Node> ns3::PointToPointNetDevice::m_node
private

Definition at line 434 of file point-to-point-net-device.h.

Referenced by DoDispose(), GetNode(), and SetNode().

TracedCallback<Ptr<const Packet> > ns3::PointToPointNetDevice::m_phyRxBeginTrace
private

The trace source fired when a packet begins the reception process from the medium – when the simulated first bit(s) arrive.

See also
class CallBackTraceSource

Definition at line 375 of file point-to-point-net-device.h.

Referenced by GetTypeId().

TracedCallback<Ptr<const Packet> > ns3::PointToPointNetDevice::m_phyRxDropTrace
private

The trace source fired when the phy layer drops a packet it has received.

This happens if the receiver is not enabled or the error model is active and indicates that the packet is corrupt.

See also
class CallBackTraceSource

Definition at line 392 of file point-to-point-net-device.h.

Referenced by GetTypeId(), and Receive().

TracedCallback<Ptr<const Packet> > ns3::PointToPointNetDevice::m_phyRxEndTrace
private

The trace source fired when a packet ends the reception process from the medium.

See also
class CallBackTraceSource

Definition at line 383 of file point-to-point-net-device.h.

Referenced by GetTypeId(), and Receive().

TracedCallback<Ptr<const Packet> > ns3::PointToPointNetDevice::m_phyTxBeginTrace
private

The trace source fired when a packet begins the transmission process on the medium.

See also
class CallBackTraceSource

Definition at line 351 of file point-to-point-net-device.h.

Referenced by GetTypeId(), and TransmitStart().

TracedCallback<Ptr<const Packet> > ns3::PointToPointNetDevice::m_phyTxDropTrace
private

The trace source fired when the phy layer drops a packet before it tries to transmit it.

See also
class CallBackTraceSource

Definition at line 367 of file point-to-point-net-device.h.

Referenced by GetTypeId(), and TransmitStart().

TracedCallback<Ptr<const Packet> > ns3::PointToPointNetDevice::m_phyTxEndTrace
private

The trace source fired when a packet ends the transmission process on the medium.

See also
class CallBackTraceSource

Definition at line 359 of file point-to-point-net-device.h.

Referenced by GetTypeId(), and TransmitComplete().

NetDevice::PromiscReceiveCallback ns3::PointToPointNetDevice::m_promiscCallback
private

Definition at line 437 of file point-to-point-net-device.h.

Referenced by Receive(), and SetPromiscReceiveCallback().

TracedCallback<Ptr<const Packet> > ns3::PointToPointNetDevice::m_promiscSnifferTrace
private

A trace source that emulates a promiscuous mode protocol sniffer connected to the device.

This trace source fire on packets destined for any host just like your average everyday packet sniffer.

On the transmit size, this trace hook will fire after a packet is dequeued from the device queue for transmission. In Linux, for example, this would correspond to the point just before a device hard_start_xmit where dev_queue_xmit_nit is called to dispatch the packet to the PF_PACKET ETH_P_ALL handlers.

On the receive side, this trace hook will fire when a packet is received, just before the receive callback is executed. In Linux, for example, this would correspond to the point at which the packet is dispatched to packet sniffers in netif_receive_skb.

See also
class CallBackTraceSource

Definition at line 432 of file point-to-point-net-device.h.

Referenced by GetTypeId(), Receive(), Send(), and TransmitComplete().

Ptr<Queue> ns3::PointToPointNetDevice::m_queue
private

The Queue which this PointToPointNetDevice uses as a packet source.

Management of this Queue has been delegated to the PointToPointNetDevice and it has the responsibility for deletion.

See also
class Queue
class DropTailQueue

Definition at line 293 of file point-to-point-net-device.h.

Referenced by GetQueue(), GetTypeId(), Send(), SetQueue(), and TransmitComplete().

Ptr<ErrorModel> ns3::PointToPointNetDevice::m_receiveErrorModel
private

Error model for receive packet events.

Definition at line 298 of file point-to-point-net-device.h.

Referenced by DoDispose(), GetTypeId(), Receive(), and SetReceiveErrorModel().

NetDevice::ReceiveCallback ns3::PointToPointNetDevice::m_rxCallback
private

Definition at line 436 of file point-to-point-net-device.h.

Referenced by Receive(), and SetReceiveCallback().

TracedCallback<Ptr<const Packet> > ns3::PointToPointNetDevice::m_snifferTrace
private

A trace source that emulates a non-promiscuous protocol sniffer connected to the device.

Unlike your average everyday sniffer, this trace source will not fire on PACKET_OTHERHOST events.

On the transmit size, this trace hook will fire after a packet is dequeued from the device queue for transmission. In Linux, for example, this would correspond to the point just before a device hard_start_xmit where dev_queue_xmit_nit is called to dispatch the packet to the PF_PACKET ETH_P_ALL handlers.

On the receive side, this trace hook will fire when a packet is received, just before the receive callback is executed. In Linux, for example, this would correspond to the point at which the packet is dispatched to packet sniffers in netif_receive_skb.

See also
class CallBackTraceSource

Definition at line 412 of file point-to-point-net-device.h.

Referenced by GetTypeId(), Receive(), Send(), and TransmitComplete().

Time ns3::PointToPointNetDevice::m_tInterframeGap
private

The interframe gap that the Net Device uses to throttle packet transmission.

See also
class Time

Definition at line 277 of file point-to-point-net-device.h.

Referenced by GetTypeId(), SetInterframeGap(), and TransmitStart().

TxMachineState ns3::PointToPointNetDevice::m_txMachineState
private

The state of the Net Device transmit state machine.

See also
TxMachineState

Definition at line 263 of file point-to-point-net-device.h.

Referenced by Send(), TransmitComplete(), and TransmitStart().


The documentation for this class was generated from the following files: