A Discrete-Event Network Simulator
API
ns3::CsmaNetDevice Class Reference

A Device for a Csma Network Link. More...

#include "csma-net-device.h"

+ Inheritance diagram for ns3::CsmaNetDevice:
+ Collaboration diagram for ns3::CsmaNetDevice:

Public Types

enum  EncapsulationMode { ILLEGAL, DIX, LLC }
 Enumeration of the types of packets supported in the class. More...
 
- Public Types inherited from ns3::NetDevice
typedef void(* LinkChangeTracedCallback) (void)
 TracedCallback signature for link changed event. More...
 
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 PacketTypePromiscReceiveCallback
 
typedef Callback< bool, Ptr< NetDevice >, Ptr< const Packet >, uint16_t, const Address & > ReceiveCallback
 

Public Member Functions

 CsmaNetDevice ()
 Construct a CsmaNetDevice. More...
 
virtual ~CsmaNetDevice ()
 Destroy a CsmaNetDevice. More...
 
virtual void AddLinkChangeCallback (Callback< void > callback)
 
int64_t AssignStreams (int64_t stream)
 Assign a fixed random variable stream number to the random variables used by this model. More...
 
bool Attach (Ptr< CsmaChannel > ch)
 Attach the device to a channel. More...
 
virtual Address GetAddress (void) const
 
virtual Address GetBroadcast (void) const
 
virtual Ptr< ChannelGetChannel (void) const
 
CsmaNetDevice::EncapsulationMode GetEncapsulationMode (void)
 Get the encapsulation mode of this device. More...
 
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
 Get the node to which this device is attached. More...
 
Ptr< Queue< Packet > > GetQueue (void) const
 Get a copy of the attached Queue. More...
 
virtual bool IsBridge (void) const
 Is this a bridge? More...
 
virtual bool IsBroadcast (void) const
 
virtual bool IsLinkUp (void) const
 
virtual bool IsMulticast (void) const
 
virtual bool IsPointToPoint (void) const
 Is this a point to point link? More...
 
bool IsReceiveEnabled (void)
 Is the receive side of the network device enabled? More...
 
bool IsSendEnabled (void)
 Is the send side of the network device enabled? More...
 
virtual bool NeedsArp (void) const
 Does this device need to use the address resolution protocol? More...
 
void Receive (Ptr< Packet > p, Ptr< CsmaNetDevice > sender)
 Receive a packet from a connected CsmaChannel. More...
 
virtual bool Send (Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)
 Start sending a packet down the channel. More...
 
virtual bool SendFrom (Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber)
 Start sending a packet down the channel, with MAC spoofing. More...
 
virtual void SetAddress (Address address)
 Set the address of this interface. More...
 
void SetBackoffParams (Time slotTime, uint32_t minSlots, uint32_t maxSlots, uint32_t maxRetries, uint32_t ceiling)
 Set the backoff parameters used to determine the wait to retry transmitting a packet when the channel is busy. More...
 
void SetEncapsulationMode (CsmaNetDevice::EncapsulationMode mode)
 Set the encapsulation mode of this device. 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)
 Set the node to which this device is being attached. More...
 
virtual void SetPromiscReceiveCallback (PromiscReceiveCallback cb)
 
void SetQueue (Ptr< Queue< Packet > > queue)
 Attach a queue to the CsmaNetDevice. More...
 
virtual void SetReceiveCallback (NetDevice::ReceiveCallback cb)
 Set the callback to be used to notify higher layers when a packet has been received. More...
 
void SetReceiveEnable (bool enable)
 Enable or disable the receive side of the network device. More...
 
void SetReceiveErrorModel (Ptr< ErrorModel > em)
 Attach a receive ErrorModel to the CsmaNetDevice. More...
 
void SetSendEnable (bool enable)
 Enable or disable the send side of the network device. More...
 
virtual bool SupportsSendFrom (void) const
 
- Public Member Functions inherited from ns3::NetDevice
virtual ~NetDevice ()
 
virtual void SetSniffPacketFromDevice (bool value)
 
virtual bool ShouldSniffPacketFromDevice ()
 
virtual void SniffPacket (Ptr< const Packet > p)
 
- Public Member Functions inherited from ns3::Object
 Object ()
 Constructor. More...
 
virtual ~Object ()
 Destructor. More...
 
void AggregateObject (Ptr< Object > other)
 Aggregate two Objects together. More...
 
void Dispose (void)
 Dispose of this Object. More...
 
AggregateIterator GetAggregateIterator (void) const
 Get an iterator to the Objects aggregated to this one. More...
 
virtual TypeId GetInstanceTypeId (void) const
 Get the most derived TypeId for this Object. More...
 
template<typename T >
Ptr< T > GetObject (void) const
 Get a pointer to the requested aggregated Object. More...
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 Get a pointer to the requested aggregated Object by TypeId. More...
 
void Initialize (void)
 Invoke DoInitialize on all Objects aggregated to this one. More...
 
bool IsInitialized (void) const
 Check if the object has been initialized. More...
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 Default 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 operator. 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
 Get the value of an attribute, raising fatal errors if unsuccessful. More...
 
bool GetAttributeFailSafe (std::string name, AttributeValue &value) const
 Get the value of an attribute without raising erros. More...
 
void SetAttribute (std::string name, const AttributeValue &value)
 Set a single attribute, raising fatal errors if unsuccessful. More...
 
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 Set a single attribute without raising errors. More...
 
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 Connect a TraceSource to a Callback with a context. More...
 
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 Connect a TraceSource to a Callback without a context. More...
 
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected with a context. More...
 
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected without a context. More...
 

Static Public Member Functions

static TypeId GetTypeId (void)
 Get the type ID. More...
 
- Static Public Member Functions inherited from ns3::NetDevice
static TypeId GetTypeId (void)
 Get the type ID. More...
 
- Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId (void)
 Register this type. More...
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId (void)
 Get the type ID. More...
 

Protected Member Functions

void AddHeader (Ptr< Packet > p, Mac48Address source, Mac48Address dest, uint16_t protocolNumber)
 Adds the necessary headers and trailers to a packet of data in order to respect the packet type. More...
 
virtual void DoDispose (void)
 Perform any object release functionality required to break reference cycles in reference counted objects held by the device. More...
 
virtual void DoInitialize (void)
 Initialize() implementation. More...
 
virtual void NotifyNewAggregate (void)
 Notify all Objects aggregated to this one of a new Object being aggregated. More...
 
- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object. More...
 
- Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
 Complete construction of ObjectBase; invoked by derived classes. More...
 
virtual void NotifyConstructionCompleted (void)
 Notifier called once the ObjectBase is fully constructed. More...
 

Private Types

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

Private Member Functions

 CsmaNetDevice (const CsmaNetDevice &o)
 Copy constructor is declared but not implemented. More...
 
void Init (bool sendEnable, bool receiveEnable)
 Initialization function used during object construction. More...
 
void NotifyLinkUp (void)
 Notify any interested parties that the link has come up. More...
 
CsmaNetDeviceoperator= (const CsmaNetDevice &o)
 Operator = is declared but not implemented. More...
 
void TransmitAbort (void)
 Aborts the transmission of the current packet. More...
 
void TransmitCompleteEvent (void)
 Stop Sending a Packet Down the Wire and Begin the Interframe Gap. More...
 
void TransmitReadyEvent (void)
 Cause the Transmitter to Become Ready to Send Another Packet. More...
 
void TransmitStart ()
 Start Sending a Packet Down the Wire. More...
 

Private Attributes

Mac48Address m_address
 The MAC address which has been assigned to this device. More...
 
Backoff m_backoff
 Holds the backoff parameters and is used to calculate the next backoff time to use when the channel is busy and the net device is ready to transmit. More...
 
DataRate m_bps
 The data rate that the Net Device uses to simulate packet transmission timing. More...
 
Ptr< CsmaChannelm_channel
 The CsmaChannel to which this CsmaNetDevice has been attached. More...
 
Ptr< Packetm_currentPkt
 Next packet that will be transmitted (if transmitter is not currently transmitting) or packet that is currently being transmitted. More...
 
uint32_t m_deviceId
 Device ID returned by the attached functions. More...
 
EncapsulationMode m_encapMode
 The type of packet that should be created by the AddHeader function and that should be processed by the ProcessHeader function. More...
 
uint32_t m_ifIndex
 The interface index (really net evice index) that has been assigned to this network device. More...
 
TracedCallback m_linkChangeCallbacks
 List of callbacks to fire if the link changes state (up or down). More...
 
bool m_linkUp
 Flag indicating whether or not the link is up. More...
 
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 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_macTxBackoffTrace
 The trace source fired when the mac layer is forced to begin the backoff process for a packet. 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
 The Node to which this device is attached. More...
 
TracedCallback< Ptr< const Packet > > m_phyRxBeginTrace
 The trace source fired when a packet begins the reception process from the medium. 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 as 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_promiscRxCallback
 The callback used to notify higher layers that a packet has been received in promiscuous mode. More...
 
TracedCallback< Ptr< const Packet > > m_promiscSnifferTrace
 A trace source that emulates a promiscuous mode protocol sniffer connected to the device. More...
 
Ptr< Queue< Packet > > m_queue
 The Queue which this CsmaNetDevice uses as a packet source. More...
 
Ptr< NetDeviceQueueInterfacem_queueInterface
 NetDevice queue interface. More...
 
bool m_receiveEnable
 Enable net device to receive packets. More...
 
Ptr< ErrorModelm_receiveErrorModel
 Error model for receive packet events. More...
 
NetDevice::ReceiveCallback m_rxCallback
 The callback used to notify higher layers that a packet has been received. More...
 
bool m_sendEnable
 Enable net device to send packets. More...
 
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 insert time between 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
 Default Maximum Transmission Unit (MTU) for the CsmaNetDevice. More...
 

Additional Inherited Members

Detailed Description

A Device for a Csma Network Link.

Config Paths

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

  • "/NodeList/[i]/DeviceList/[i]/$ns3::CsmaNetDevice"

Attributes

  • Address: The MAC address of this device.
  • Mtu: The MAC-level Maximum Transmission Unit
    • Set with class: ns3::UintegerValue
    • Underlying type: uint16_t 0:65535
    • Initial value: 1500
    • Flags: construct write read
  • EncapsulationMode: The link-layer encapsulation type to use.
    • Set with class: ns3::EnumValue
    • Underlying type:
    • Initial value: Dix
    • Flags: construct write
  • SendEnable: Enable or disable the transmitter section of the device.
    • Set with class: BooleanValue
    • Underlying type: bool
    • Initial value: true
    • Flags: construct write read
  • ReceiveEnable: Enable or disable the receiver section of the device.
    • Set with class: BooleanValue
    • Underlying type: bool
    • Initial value: true
    • Flags: construct write read
  • ReceiveErrorModel: The receiver error model used to simulate packet loss
  • TxQueue: A queue to use as the transmit queue in the device.

TraceSources

  • MacTx: Trace source indicating a packet has arrived for transmission by this device
    Callback signature: ns3::Packet::TracedCallback
  • MacTxDrop: Trace source indicating a packet has been dropped by the device before transmission
    Callback signature: ns3::Packet::TracedCallback
  • 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,
    Callback signature: ns3::Packet::TracedCallback
  • 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,
    Callback signature: ns3::Packet::TracedCallback
  • MacTxBackoff: Trace source indicating a packet has been delayed by the CSMA backoff process
    Callback signature: ns3::Packet::TracedCallback
  • PhyTxBegin: Trace source indicating a packet has begun transmitting over the channel
    Callback signature: ns3::Packet::TracedCallback
  • PhyTxEnd: Trace source indicating a packet has been completely transmitted over the channel
    Callback signature: ns3::Packet::TracedCallback
  • PhyTxDrop: Trace source indicating a packet has been dropped by the device during transmission
    Callback signature: ns3::Packet::TracedCallback
  • PhyRxEnd: Trace source indicating a packet has been completely received by the device
    Callback signature: ns3::Packet::TracedCallback
  • PhyRxDrop: Trace source indicating a packet has been dropped by the device during reception
    Callback signature: ns3::Packet::TracedCallback
  • Sniffer: Trace source simulating a non-promiscuous packet sniffer attached to the device
    Callback signature: ns3::Packet::TracedCallback
  • PromiscSniffer: Trace source simulating a promiscuous packet sniffer attached to the device
    Callback signature: ns3::Packet::TracedCallback

Size of this type is 552 bytes (on a 64-bit architecture).

The Csma net device class is analogous to layer 1 and 2 of the TCP stack. The NetDevice takes a raw packet of bytes and creates a protocol specific packet from them.

Definition at line 59 of file csma-net-device.h.

Member Enumeration Documentation

Enumeration of the types of packets supported in the class.

Enumerator
ILLEGAL 

Encapsulation mode not set.

DIX 

DIX II / Ethernet II packet.

LLC 

802.2 LLC/SNAP Packet

Definition at line 72 of file csma-net-device.h.

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.

GAP 

The transmitter is in the interframe gap time.

BACKOFF 

The transmitter is waiting for the channel to be free.

Definition at line 474 of file csma-net-device.h.

Constructor & Destructor Documentation

ns3::CsmaNetDevice::CsmaNetDevice ( )

Construct a CsmaNetDevice.

This is the default constructor for a CsmaNetDevice.

Definition at line 187 of file csma-net-device.cc.

References DIX, m_channel, m_encapMode, m_tInterframeGap, m_txMachineState, NS_LOG_FUNCTION, READY, and ns3::Seconds().

+ Here is the call graph for this function:

ns3::CsmaNetDevice::~CsmaNetDevice ( )
virtual

Destroy a CsmaNetDevice.

This is the destructor for a CsmaNetDevice.

Definition at line 209 of file csma-net-device.cc.

References m_queue, and NS_LOG_FUNCTION_NOARGS.

ns3::CsmaNetDevice::CsmaNetDevice ( const CsmaNetDevice o)
private

Copy constructor is declared but not implemented.

This disables the copy constructor for CsmaNetDevice objects.

Parameters
oobject to copy

Member Function Documentation

void ns3::CsmaNetDevice::AddHeader ( Ptr< Packet p,
Mac48Address  source,
Mac48Address  dest,
uint16_t  protocolNumber 
)
protected

Adds the necessary headers and trailers to a packet of data in order to respect the packet type.

Parameters
pPacket to which header should be added
sourceMAC source address from which packet should be sent
destMAC destination address to which packet should be sent
protocolNumberIn some protocols, identifies the type of payload contained in this packet.

Definition at line 345 of file csma-net-device.cc.

References ns3::Packet::AddAtEnd(), ns3::Packet::AddHeader(), ns3::Packet::AddTrailer(), ns3::EthernetTrailer::CalcFcs(), ns3::Node::ChecksumEnabled(), DIX, ns3::EthernetTrailer::EnableFcs(), GetAddress(), GetBroadcast(), ns3::EthernetHeader::GetDestination(), ns3::EthernetHeader::GetLengthType(), GetMtu(), ns3::Packet::GetSize(), ns3::LlcSnapHeader::GetType(), ILLEGAL, LLC, m_encapMode, m_mtu, NS_ASSERT_MSG(), NS_FATAL_ERROR, NS_LOG_FUNCTION, NS_LOG_LOGIC(), ns3::Packet::RemoveHeader(), ns3::Packet::RemoveTrailer(), ns3::EthernetHeader::SetDestination(), ns3::EthernetHeader::SetLengthType(), ns3::EthernetHeader::SetSource(), and ns3::LlcSnapHeader::SetType().

Referenced by SendFrom().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::CsmaNetDevice::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 917 of file csma-net-device.cc.

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

+ Here is the call graph for this function:

int64_t ns3::CsmaNetDevice::AssignStreams ( int64_t  stream)

Assign a fixed random variable stream number to the random variables used by this model.

Return the number of streams (possibly zero) that have been assigned.

Parameters
streamfirst stream index to use
Returns
the number of stream indices assigned by this model

Definition at line 1088 of file csma-net-device.cc.

References ns3::Backoff::AssignStreams(), and m_backoff.

+ Here is the call graph for this function:

bool ns3::CsmaNetDevice::Attach ( Ptr< CsmaChannel ch)

Attach the device to a channel.

The function Attach is used to add a CsmaNetDevice to a CsmaChannel.

See also
SetDataRate ()
SetInterframeGap ()
Parameters
cha pointer to the channel to which this object is being attached.
Returns
true if no error

Definition at line 683 of file csma-net-device.cc.

References ns3::DataRate::CalculateBytesTxTime(), m_bps, m_channel, m_deviceId, m_tInterframeGap, NotifyLinkUp(), and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

void ns3::CsmaNetDevice::DoDispose ( void  )
protectedvirtual

Perform any object release functionality required to break reference cycles in reference counted objects held by the device.

Reimplemented from ns3::Object.

Definition at line 216 of file csma-net-device.cc.

References ns3::Object::DoDispose(), m_channel, m_node, m_queue, m_queueInterface, and NS_LOG_FUNCTION_NOARGS.

+ Here is the call graph for this function:

void ns3::CsmaNetDevice::DoInitialize ( void  )
protectedvirtual

Initialize() implementation.

This method is called only once by Initialize(). If the user calls Initialize() multiple times, DoInitialize() is called only the first time.

Subclasses are expected to override this method and chain up to their parent's implementation once they are done. It is safe to call GetObject() and AggregateObject() from within this method.

Reimplemented from ns3::Object.

Definition at line 227 of file csma-net-device.cc.

References ns3::Object::DoInitialize(), m_queue, m_queueInterface, and NS_ASSERT_MSG().

+ Here is the call graph for this function:

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

Implements ns3::NetDevice.

Definition at line 903 of file csma-net-device.cc.

References m_address, and NS_LOG_FUNCTION_NOARGS.

Referenced by AddHeader().

+ Here is the caller graph for this function:

Address ns3::CsmaNetDevice::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 931 of file csma-net-device.cc.

References NS_LOG_FUNCTION_NOARGS.

Referenced by AddHeader().

+ Here is the caller graph for this function:

Ptr< Channel > ns3::CsmaNetDevice::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 889 of file csma-net-device.cc.

References m_channel, and NS_LOG_FUNCTION_NOARGS.

CsmaNetDevice::EncapsulationMode ns3::CsmaNetDevice::GetEncapsulationMode ( void  )

Get the encapsulation mode of this device.

Returns
The encapsulation mode of this device.

Definition at line 272 of file csma-net-device.cc.

References m_encapMode, and NS_LOG_FUNCTION_NOARGS.

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

Implements ns3::NetDevice.

Definition at line 882 of file csma-net-device.cc.

References m_ifIndex, and NS_LOG_FUNCTION_NOARGS.

uint16_t ns3::CsmaNetDevice::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 291 of file csma-net-device.cc.

References m_mtu, and NS_LOG_FUNCTION_NOARGS.

Referenced by AddHeader(), and GetTypeId().

+ Here is the caller graph for this function:

Address ns3::CsmaNetDevice::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).

This method performs the multicast address creation function appropriate to an EUI-48-based CSMA device. This MAC address is encapsulated in an abstract Address to avoid dependencies on the exact address format.

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.
See also
Ipv4Address
Mac48Address
Address

Implements ns3::NetDevice.

Definition at line 945 of file csma-net-device.cc.

References ns3::Mac48Address::GetMulticast(), NS_LOG_FUNCTION, and NS_LOG_LOGIC().

+ Here is the call graph for this function:

Address ns3::CsmaNetDevice::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 1065 of file csma-net-device.cc.

References ns3::Mac48Address::GetMulticast(), and NS_LOG_LOGIC().

+ Here is the call graph for this function:

Ptr< Node > ns3::CsmaNetDevice::GetNode ( void  ) const
virtual

Get the node to which this device is attached.

Returns
Ptr to the Node to which the device is attached.

Implements ns3::NetDevice.

Definition at line 1037 of file csma-net-device.cc.

References m_node, and NS_LOG_FUNCTION_NOARGS.

Ptr< Queue< Packet > > ns3::CsmaNetDevice::GetQueue ( void  ) const

Get a copy of the attached Queue.

Returns
a pointer to the queue.

Definition at line 860 of file csma-net-device.cc.

References m_queue, and NS_LOG_FUNCTION_NOARGS.

Referenced by ns3::CsmaHelper::EnableAsciiInternal().

+ Here is the caller graph for this function:

void ns3::CsmaNetDevice::Init ( bool  sendEnable,
bool  receiveEnable 
)
private

Initialization function used during object construction.

Parameters
sendEnableif device will be allowed to send
receiveEnableif device will be allowed to receive
bool ns3::CsmaNetDevice::IsBridge ( void  ) const
virtual

Is this a bridge?

Returns
false.

Implements ns3::NetDevice.

Definition at line 969 of file csma-net-device.cc.

References NS_LOG_FUNCTION_NOARGS.

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

Implements ns3::NetDevice.

Definition at line 924 of file csma-net-device.cc.

References NS_LOG_FUNCTION_NOARGS.

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

Implements ns3::NetDevice.

Definition at line 910 of file csma-net-device.cc.

References m_linkUp, and NS_LOG_FUNCTION_NOARGS.

Referenced by SendFrom().

+ Here is the caller graph for this function:

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

Implements ns3::NetDevice.

Definition at line 938 of file csma-net-device.cc.

References NS_LOG_FUNCTION_NOARGS.

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

Is this a point to point link?

Returns
false.

Implements ns3::NetDevice.

Definition at line 962 of file csma-net-device.cc.

References NS_LOG_FUNCTION_NOARGS.

bool ns3::CsmaNetDevice::IsReceiveEnabled ( void  )

Is the receive side of the network device enabled?

Returns
True if the receiver side is enabled, otherwise false.

Definition at line 320 of file csma-net-device.cc.

References m_receiveEnable, and NS_LOG_FUNCTION_NOARGS.

Referenced by Receive().

+ Here is the caller graph for this function:

bool ns3::CsmaNetDevice::IsSendEnabled ( void  )

Is the send side of the network device enabled?

Returns
True if the send side is enabled, otherwise false.

Definition at line 313 of file csma-net-device.cc.

References m_sendEnable, and NS_LOG_FUNCTION_NOARGS.

Referenced by SendFrom(), and TransmitStart().

+ Here is the caller graph for this function:

bool ns3::CsmaNetDevice::NeedsArp ( void  ) const
virtual

Does this device need to use the address resolution protocol?

Returns
True if the encapsulation mode is set to a value that requires ARP (IP_ARP or LLC).

Implements ns3::NetDevice.

Definition at line 1052 of file csma-net-device.cc.

References NS_LOG_FUNCTION_NOARGS.

void ns3::CsmaNetDevice::NotifyLinkUp ( void  )
private

Notify any interested parties that the link has come up.

Definition at line 867 of file csma-net-device.cc.

References m_linkChangeCallbacks, m_linkUp, and NS_LOG_FUNCTION_NOARGS.

Referenced by Attach().

+ Here is the caller graph for this function:

void ns3::CsmaNetDevice::NotifyNewAggregate ( void  )
protectedvirtual

Notify all Objects aggregated to this one of a new Object being aggregated.

This function must be implemented in the stack that needs to notify other stacks connected to the node of their presence in the node.

This method is invoked whenever two sets of Objects are aggregated together. It is invoked exactly once for each Object in both sets. This method can be overridden by subclasses who wish to be notified of aggregation events. These subclasses must chain up to their base class NotifyNewAggregate() method.

It is safe to call GetObject() and AggregateObject() from within this method.

Reimplemented from ns3::Object.

Definition at line 244 of file csma-net-device.cc.

References m_queueInterface, ns3::Object::NotifyNewAggregate(), and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

CsmaNetDevice& ns3::CsmaNetDevice::operator= ( const CsmaNetDevice o)
private

Operator = is declared but not implemented.

This disables the assignment operator for CsmaNetDevice objects.

Parameters
oobject to copy
Returns
the copied object
void ns3::CsmaNetDevice::Receive ( Ptr< Packet p,
Ptr< CsmaNetDevice sender 
)

Receive a packet from a connected CsmaChannel.

The CsmaNetDevice 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
CsmaChannel
Parameters
pa reference to the received packet
senderthe CsmaNetDevice that transmitted the packet in the first place

Definition at line 723 of file csma-net-device.cc.

References ns3::EthernetTrailer::CheckFcs(), ns3::Node::ChecksumEnabled(), ns3::Packet::Copy(), ns3::EthernetTrailer::EnableFcs(), ns3::EthernetHeader::GetDestination(), ns3::EthernetHeader::GetLengthType(), ns3::Packet::GetSize(), ns3::EthernetHeader::GetSource(), ns3::LlcSnapHeader::GetType(), ns3::Packet::GetUid(), ns3::Mac48Address::IsBroadcast(), ns3::Mac48Address::IsGroup(), ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), IsReceiveEnabled(), m_address, m_macPromiscRxTrace, m_macRxTrace, m_phyRxDropTrace, m_phyRxEndTrace, m_promiscRxCallback, m_promiscSnifferTrace, m_receiveErrorModel, m_rxCallback, m_snifferTrace, NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_INFO, NS_LOG_LOGIC(), ns3::NetDevice::PACKET_BROADCAST, ns3::NetDevice::PACKET_HOST, ns3::NetDevice::PACKET_MULTICAST, ns3::NetDevice::PACKET_OTHERHOST, ns3::Packet::RemoveAtEnd(), ns3::Packet::RemoveHeader(), and ns3::Packet::RemoveTrailer().

Referenced by ns3::CsmaChannel::TransmitEnd().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ns3::CsmaNetDevice::Send ( Ptr< Packet packet,
const Address dest,
uint16_t  protocolNumber 
)
virtual

Start sending a packet down the channel.

Parameters
packetpacket to send
destlayer 2 destination address
protocolNumberprotocol number
Returns
true if successful, false otherwise (drop, ...)

Implements ns3::NetDevice.

Definition at line 976 of file csma-net-device.cc.

References m_address, NS_LOG_FUNCTION, and SendFrom().

+ Here is the call graph for this function:

bool ns3::CsmaNetDevice::SendFrom ( Ptr< Packet packet,
const Address source,
const Address dest,
uint16_t  protocolNumber 
)
virtual

Start sending a packet down the channel, with MAC spoofing.

Parameters
packetpacket to send
sourcelayer 2 source address
destlayer 2 destination address
protocolNumberprotocol number
Returns
true if successful, false otherwise (drop, ...)

Implements ns3::NetDevice.

Definition at line 983 of file csma-net-device.cc.

References AddHeader(), ns3::Mac48Address::ConvertFrom(), ns3::Packet::GetUid(), IsLinkUp(), IsSendEnabled(), m_currentPkt, m_macTxDropTrace, m_macTxTrace, m_promiscSnifferTrace, m_queue, m_snifferTrace, m_txMachineState, NS_ASSERT, NS_ASSERT_MSG(), NS_LOG_FUNCTION, NS_LOG_LOGIC(), READY, and TransmitStart().

Referenced by Send().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Set the address of this interface.

Parameters
addressaddress to set

Implements ns3::NetDevice.

Definition at line 896 of file csma-net-device.cc.

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

+ Here is the call graph for this function:

void ns3::CsmaNetDevice::SetBackoffParams ( Time  slotTime,
uint32_t  minSlots,
uint32_t  maxSlots,
uint32_t  maxRetries,
uint32_t  ceiling 
)

Set the backoff parameters used to determine the wait to retry transmitting a packet when the channel is busy.

See also
Attach ()
Parameters
slotTimeLength of a packet slot (or average packet time)
minSlotsMinimum number of slots to wait
maxSlotsMaximum number of slots to wait
maxRetriesMaximum number of retries before packet is discard
ceilingCap on the exponential function when calculating max slots

Definition at line 334 of file csma-net-device.cc.

References m_backoff, ns3::Backoff::m_ceiling, ns3::Backoff::m_maxRetries, ns3::Backoff::m_maxSlots, ns3::Backoff::m_minSlots, ns3::Backoff::m_slotTime, and NS_LOG_FUNCTION.

void ns3::CsmaNetDevice::SetEncapsulationMode ( CsmaNetDevice::EncapsulationMode  mode)

Set the encapsulation mode of this device.

Parameters
modeThe encapsulation mode of this device.

Definition at line 261 of file csma-net-device.cc.

References m_encapMode, m_mtu, NS_LOG_FUNCTION, and NS_LOG_LOGIC().

Referenced by GetTypeId().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Implements ns3::NetDevice.

Definition at line 875 of file csma-net-device.cc.

References m_ifIndex, and NS_LOG_FUNCTION.

void ns3::CsmaNetDevice::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. As in Ethernet, it defaults to 96 bit times.

Parameters
tthe interframe gap time

Definition at line 327 of file csma-net-device.cc.

References m_tInterframeGap, and NS_LOG_FUNCTION.

bool ns3::CsmaNetDevice::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 279 of file csma-net-device.cc.

References m_encapMode, m_mtu, NS_LOG_FUNCTION, and NS_LOG_LOGIC().

Referenced by GetTypeId().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::CsmaNetDevice::SetNode ( Ptr< Node node)
virtual

Set the node to which this device is being attached.

Parameters
nodePtr to the Node to which the device is being attached.

Implements ns3::NetDevice.

Definition at line 1044 of file csma-net-device.cc.

References m_node, and NS_LOG_FUNCTION.

void ns3::CsmaNetDevice::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 1074 of file csma-net-device.cc.

References m_promiscRxCallback, and NS_LOG_FUNCTION.

void ns3::CsmaNetDevice::SetQueue ( Ptr< Queue< Packet > >  queue)

Attach a queue to the CsmaNetDevice.

The CsmaNetDevice "owns" a queue. This queue may be set by higher level topology objects to implement a particular queueing method such as DropTail.

See also
Queue
DropTailQueue
Parameters
queuea Ptr to the queue for being assigned to the device.

Definition at line 709 of file csma-net-device.cc.

References m_queue, and NS_LOG_FUNCTION.

void ns3::CsmaNetDevice::SetReceiveCallback ( NetDevice::ReceiveCallback  cb)
virtual

Set the callback to be used to notify higher layers when a packet has been received.

Parameters
cbThe callback.

Implements ns3::NetDevice.

Definition at line 1059 of file csma-net-device.cc.

References m_rxCallback, and NS_LOG_FUNCTION.

void ns3::CsmaNetDevice::SetReceiveEnable ( bool  enable)

Enable or disable the receive side of the network device.

Parameters
enableEnable the receive side if true, otherwise disable.

Definition at line 306 of file csma-net-device.cc.

References m_receiveEnable, and NS_LOG_FUNCTION.

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

Attach a receive ErrorModel to the CsmaNetDevice.

The CsmaNetDevice may optionally include an ErrorModel in the packet receive chain to simulate data errors in during transmission.

See also
ErrorModel
Parameters
ema pointer to the ErrorModel

Definition at line 716 of file csma-net-device.cc.

References m_receiveErrorModel, and NS_LOG_FUNCTION.

void ns3::CsmaNetDevice::SetSendEnable ( bool  enable)

Enable or disable the send side of the network device.

Parameters
enableEnable the send side if true, otherwise disable.

Definition at line 299 of file csma-net-device.cc.

References m_sendEnable, and NS_LOG_FUNCTION.

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

Implements ns3::NetDevice.

Definition at line 1081 of file csma-net-device.cc.

References NS_LOG_FUNCTION_NOARGS.

void ns3::CsmaNetDevice::TransmitAbort ( void  )
private

Aborts the transmission of the current packet.

If the net device has tried to transmit a packet for more times than the maximum allowed number of retries (channel always busy) then the packet is dropped.

Definition at line 569 of file csma-net-device.cc.

References BACKOFF, ns3::Packet::GetUid(), m_backoff, m_currentPkt, m_phyTxDropTrace, m_promiscSnifferTrace, m_queue, m_snifferTrace, m_txMachineState, NS_ASSERT_MSG(), NS_LOG_FUNCTION_NOARGS, NS_LOG_LOGIC(), READY, ns3::Backoff::ResetBackoffTime(), and TransmitStart().

Referenced by TransmitStart().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::CsmaNetDevice::TransmitCompleteEvent ( void  )
private

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

The TransmitCompleteEvent method is used internally to finish the process of sending a packet out on the channel. During execution of this method the TransmitEnd method is called on the channel to let it know that the physical device this class represents has finished sending simulated signals. The channel uses this event to begin its speed of light delay timer after which it notifies the Net Device(s) at the other end of the link that new bits have arrived (it delivers the Packet). During this method, the net device also schedules the TransmitReadyEvent at which time the transmitter becomes ready to send the next packet.

See also
CsmaChannel::TransmitEnd ()
TransmitReadyEvent ()

Definition at line 614 of file csma-net-device.cc.

References BUSY, GAP, ns3::Time::GetSeconds(), ns3::Packet::GetUid(), m_channel, m_currentPkt, m_phyTxEndTrace, m_tInterframeGap, m_txMachineState, NS_ASSERT, NS_ASSERT_MSG(), NS_LOG_FUNCTION_NOARGS, NS_LOG_LOGIC(), ns3::Simulator::Schedule(), TransmitReadyEvent(), and ns3::TRANSMITTING.

Referenced by TransmitStart().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::CsmaNetDevice::TransmitReadyEvent ( void  )
private

Cause the Transmitter to Become Ready to Send Another Packet.

The TransmitReadyEvent method is used internally to re-enable the transmit machine of the net device. It is scheduled after a suitable interframe gap after the completion of the previous transmission. The queue is checked at this time, and if there is a packet waiting on the queue, the transmission process is begun.

If a packet is in the queue, it is extracted for the queue as the next packet to be transmitted by the net device.

See also
TransmitStart ()

Definition at line 646 of file csma-net-device.cc.

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

Referenced by TransmitCompleteEvent().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::CsmaNetDevice::TransmitStart ( void  )
private

Start Sending a Packet Down the Wire.

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

If the channel is found to be BUSY, this method reschedules itself for execution at a later time (within the backoff period).

See also
CsmaChannel::TransmitStart ()
TransmitCompleteEvent ()

Definition at line 476 of file csma-net-device.cc.

References BACKOFF, BUSY, ns3::DataRate::CalculateBytesTxTime(), ns3::Backoff::GetBackoffTime(), ns3::Time::GetSeconds(), ns3::Packet::GetSize(), ns3::Packet::GetUid(), ns3::IDLE, ns3::Backoff::IncrNumRetries(), IsSendEnabled(), m_backoff, m_bps, m_channel, m_currentPkt, m_deviceId, m_macTxBackoffTrace, m_phyTxBeginTrace, m_phyTxDropTrace, m_txMachineState, ns3::Backoff::MaxRetriesReached(), NS_ASSERT_MSG(), NS_LOG_FUNCTION_NOARGS, NS_LOG_LOGIC(), NS_LOG_WARN, READY, ns3::Backoff::ResetBackoffTime(), ns3::Simulator::Schedule(), TransmitAbort(), and TransmitCompleteEvent().

Referenced by SendFrom(), TransmitAbort(), and TransmitReadyEvent().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

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

Default Maximum Transmission Unit (MTU) for the CsmaNetDevice.

Definition at line 730 of file csma-net-device.h.

Referenced by GetTypeId().

Mac48Address ns3::CsmaNetDevice::m_address
private

The MAC address which has been assigned to this device.

Definition at line 698 of file csma-net-device.h.

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

Backoff ns3::CsmaNetDevice::m_backoff
private

Holds the backoff parameters and is used to calculate the next backoff time to use when the channel is busy and the net device is ready to transmit.

Definition at line 514 of file csma-net-device.h.

Referenced by AssignStreams(), SetBackoffParams(), TransmitAbort(), and TransmitStart().

DataRate ns3::CsmaNetDevice::m_bps
private

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

See also
class DataRate

Definition at line 500 of file csma-net-device.h.

Referenced by Attach(), and TransmitStart().

Ptr<CsmaChannel> ns3::CsmaNetDevice::m_channel
private

The CsmaChannel to which this CsmaNetDevice has been attached.

See also
class CsmaChannel

Definition at line 528 of file csma-net-device.h.

Referenced by Attach(), CsmaNetDevice(), DoDispose(), GetChannel(), TransmitCompleteEvent(), and TransmitStart().

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

Next packet that will be transmitted (if transmitter is not currently transmitting) or packet that is currently being transmitted.

Definition at line 521 of file csma-net-device.h.

Referenced by SendFrom(), TransmitAbort(), TransmitCompleteEvent(), TransmitReadyEvent(), and TransmitStart().

uint32_t ns3::CsmaNetDevice::m_deviceId
private

Device ID returned by the attached functions.

It is used by the mp-channel to identify each net device to make sure that only active net devices are writing to the channel

Definition at line 459 of file csma-net-device.h.

Referenced by Attach(), and TransmitStart().

EncapsulationMode ns3::CsmaNetDevice::m_encapMode
private

The type of packet that should be created by the AddHeader function and that should be processed by the ProcessHeader function.

Definition at line 493 of file csma-net-device.h.

Referenced by AddHeader(), CsmaNetDevice(), GetEncapsulationMode(), SetEncapsulationMode(), and SetMtu().

uint32_t ns3::CsmaNetDevice::m_ifIndex
private

The interface index (really net evice index) that has been assigned to this network device.

Definition at line 714 of file csma-net-device.h.

Referenced by GetIfIndex(), and SetIfIndex().

TracedCallback ns3::CsmaNetDevice::m_linkChangeCallbacks
private

List of callbacks to fire if the link changes state (up or down).

Definition at line 725 of file csma-net-device.h.

Referenced by AddLinkChangeCallback(), and NotifyLinkUp().

bool ns3::CsmaNetDevice::m_linkUp
private

Flag indicating whether or not the link is up.

In this case, whether or not the device is connected to a channel.

Definition at line 720 of file csma-net-device.h.

Referenced by IsLinkUp(), and NotifyLinkUp().

TracedCallback<Ptr<const Packet> > ns3::CsmaNetDevice::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.

See also
class CallBackTraceSource

Definition at line 569 of file csma-net-device.h.

Referenced by GetTypeId(), and Receive().

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

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

See also
class CallBackTraceSource

Definition at line 587 of file csma-net-device.h.

Referenced by GetTypeId().

TracedCallback<Ptr<const Packet> > ns3::CsmaNetDevice::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.

See also
class CallBackTraceSource

Definition at line 578 of file csma-net-device.h.

Referenced by GetTypeId(), and Receive().

TracedCallback<Ptr<const Packet> > ns3::CsmaNetDevice::m_macTxBackoffTrace
private

The trace source fired when the mac layer is forced to begin the backoff process for a packet.

This can happen a number of times as the backoff sequence is repeated with increasing delays.

See also
class CallBackTraceSource

Definition at line 596 of file csma-net-device.h.

Referenced by GetTypeId(), and TransmitStart().

TracedCallback<Ptr<const Packet> > ns3::CsmaNetDevice::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 560 of file csma-net-device.h.

Referenced by GetTypeId(), and SendFrom().

TracedCallback<Ptr<const Packet> > ns3::CsmaNetDevice::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 552 of file csma-net-device.h.

Referenced by GetTypeId(), and SendFrom().

uint32_t ns3::CsmaNetDevice::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 738 of file csma-net-device.h.

Referenced by AddHeader(), GetMtu(), SetEncapsulationMode(), and SetMtu().

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

The Node to which this device is attached.

Definition at line 688 of file csma-net-device.h.

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

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

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

See also
class CallBackTraceSource

Definition at line 628 of file csma-net-device.h.

Referenced by GetTypeId().

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

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

See also
class CallBackTraceSource

Definition at line 643 of file csma-net-device.h.

Referenced by GetTypeId(), and Receive().

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

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

See also
class CallBackTraceSource

Definition at line 636 of file csma-net-device.h.

Referenced by GetTypeId(), and Receive().

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

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

See also
class CallBackTraceSource

Definition at line 604 of file csma-net-device.h.

Referenced by GetTypeId(), and TransmitStart().

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

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

See also
class CallBackTraceSource

Definition at line 620 of file csma-net-device.h.

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

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

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

See also
class CallBackTraceSource

Definition at line 612 of file csma-net-device.h.

Referenced by GetTypeId(), and TransmitCompleteEvent().

NetDevice::PromiscReceiveCallback ns3::CsmaNetDevice::m_promiscRxCallback
private

The callback used to notify higher layers that a packet has been received in promiscuous mode.

Definition at line 708 of file csma-net-device.h.

Referenced by Receive(), and SetPromiscReceiveCallback().

TracedCallback<Ptr<const Packet> > ns3::CsmaNetDevice::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 683 of file csma-net-device.h.

Referenced by GetTypeId(), Receive(), SendFrom(), TransmitAbort(), and TransmitReadyEvent().

Ptr<Queue<Packet> > ns3::CsmaNetDevice::m_queue
private

The Queue which this CsmaNetDevice uses as a packet source.

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

See also
class Queue
class DropTailQueue

Definition at line 537 of file csma-net-device.h.

Referenced by DoDispose(), DoInitialize(), GetQueue(), GetTypeId(), SendFrom(), SetQueue(), TransmitAbort(), TransmitReadyEvent(), and ~CsmaNetDevice().

Ptr<NetDeviceQueueInterface> ns3::CsmaNetDevice::m_queueInterface
private

NetDevice queue interface.

Definition at line 693 of file csma-net-device.h.

Referenced by DoDispose(), DoInitialize(), and NotifyNewAggregate().

bool ns3::CsmaNetDevice::m_receiveEnable
private

Enable net device to receive packets.

True by default

Definition at line 469 of file csma-net-device.h.

Referenced by GetTypeId(), IsReceiveEnabled(), and SetReceiveEnable().

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

Error model for receive packet events.

When active this model will be used to model transmission errors by marking some of the packets received as corrupt.

Definition at line 544 of file csma-net-device.h.

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

NetDevice::ReceiveCallback ns3::CsmaNetDevice::m_rxCallback
private

The callback used to notify higher layers that a packet has been received.

Definition at line 703 of file csma-net-device.h.

Referenced by Receive(), and SetReceiveCallback().

bool ns3::CsmaNetDevice::m_sendEnable
private

Enable net device to send packets.

True by default

Definition at line 464 of file csma-net-device.h.

Referenced by GetTypeId(), IsSendEnabled(), and SetSendEnable().

TracedCallback<Ptr<const Packet> > ns3::CsmaNetDevice::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 663 of file csma-net-device.h.

Referenced by GetTypeId(), Receive(), SendFrom(), TransmitAbort(), and TransmitReadyEvent().

Time ns3::CsmaNetDevice::m_tInterframeGap
private

The interframe gap that the Net Device uses insert time between packet transmission.

See also
class Time

Definition at line 507 of file csma-net-device.h.

Referenced by Attach(), CsmaNetDevice(), SetInterframeGap(), and TransmitCompleteEvent().

TxMachineState ns3::CsmaNetDevice::m_txMachineState
private

The state of the Net Device transmit state machine.

See also
TxMachineState

Definition at line 486 of file csma-net-device.h.

Referenced by CsmaNetDevice(), SendFrom(), TransmitAbort(), TransmitCompleteEvent(), TransmitReadyEvent(), and TransmitStart().


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