A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
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) ()
 TracedCallback signature for link changed event.
 
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 &, PacketTypePromiscReceiveCallback
 
typedef Callback< bool, Ptr< NetDevice >, Ptr< const Packet >, uint16_t, const Address & > ReceiveCallback
 

Public Member Functions

 CsmaNetDevice ()
 Construct a CsmaNetDevice.
 
 ~CsmaNetDevice () override
 Destroy a CsmaNetDevice.
 
void AddLinkChangeCallback (Callback< void > callback) override
 
int64_t AssignStreams (int64_t stream)
 Assign a fixed random variable stream number to the random variables used by this model.
 
bool Attach (Ptr< CsmaChannel > ch)
 Attach the device to a channel.
 
Address GetAddress () const override
 
Address GetBroadcast () const override
 
Ptr< ChannelGetChannel () const override
 
CsmaNetDevice::EncapsulationMode GetEncapsulationMode ()
 Get the encapsulation mode of this device.
 
uint32_t GetIfIndex () const override
 
uint16_t GetMtu () const override
 
Address GetMulticast (Ipv4Address multicastGroup) const override
 Make and return a MAC multicast address using the provided multicast group.
 
Address GetMulticast (Ipv6Address addr) const override
 Get the MAC multicast address corresponding to the IPv6 address provided.
 
Ptr< NodeGetNode () const override
 Get the node to which this device is attached.
 
Ptr< Queue< Packet > > GetQueue () const
 Get a copy of the attached Queue.
 
bool IsBridge () const override
 Is this a bridge?
 
bool IsBroadcast () const override
 
bool IsLinkUp () const override
 
bool IsMulticast () const override
 
bool IsPointToPoint () const override
 Is this a point to point link?
 
bool IsReceiveEnabled () const
 Is the receive side of the network device enabled?
 
bool IsSendEnabled () const
 Is the send side of the network device enabled?
 
bool NeedsArp () const override
 Does this device need to use the address resolution protocol?
 
void Receive (Ptr< const Packet > p, Ptr< CsmaNetDevice > sender)
 Receive a packet from a connected CsmaChannel.
 
bool Send (Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber) override
 Start sending a packet down the channel.
 
bool SendFrom (Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber) override
 Start sending a packet down the channel, with MAC spoofing.
 
void SetAddress (Address address) override
 Set the address of this interface.
 
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.
 
void SetEncapsulationMode (CsmaNetDevice::EncapsulationMode mode)
 Set the encapsulation mode of this device.
 
void SetIfIndex (const uint32_t index) override
 
void SetInterframeGap (Time t)
 Set the interframe gap used to separate packets.
 
bool SetMtu (const uint16_t mtu) override
 
void SetNode (Ptr< Node > node) override
 Set the node to which this device is being attached.
 
void SetPromiscReceiveCallback (PromiscReceiveCallback cb) override
 
void SetQueue (Ptr< Queue< Packet > > queue)
 Attach a queue to the CsmaNetDevice.
 
void SetReceiveCallback (NetDevice::ReceiveCallback cb) override
 Set the callback to be used to notify higher layers when a packet has been received.
 
void SetReceiveEnable (bool enable)
 Enable or disable the receive side of the network device.
 
void SetReceiveErrorModel (Ptr< ErrorModel > em)
 Attach a receive ErrorModel to the CsmaNetDevice.
 
void SetSendEnable (bool enable)
 Enable or disable the send side of the network device.
 
bool SupportsSendFrom () const override
 
- Public Member Functions inherited from ns3::NetDevice
 ~NetDevice () override
 
- Public Member Functions inherited from ns3::Object
 Object ()
 Constructor.
 
 ~Object () override
 Destructor.
 
void AggregateObject (Ptr< Object > other)
 Aggregate two Objects together.
 
void Dispose ()
 Dispose of this Object.
 
AggregateIterator GetAggregateIterator () const
 Get an iterator to the Objects aggregated to this one.
 
TypeId GetInstanceTypeId () const override
 Get the most derived TypeId for this Object.
 
template<typename T >
Ptr< T > GetObject () const
 Get a pointer to the requested aggregated Object.
 
template<>
Ptr< ObjectGetObject () const
 Specialization of () for objects of type ns3::Object.
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 Get a pointer to the requested aggregated Object by TypeId.
 
template<>
Ptr< ObjectGetObject (TypeId tid) const
 Specialization of (TypeId tid) for objects of type ns3::Object.
 
void Initialize ()
 Invoke DoInitialize on all Objects aggregated to this one.
 
bool IsInitialized () const
 Check if the object has been initialized.
 
void UnidirectionalAggregateObject (Ptr< Object > other)
 Aggregate an Object to another Object.
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 Default constructor.
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor.
 
uint32_t GetReferenceCount () const
 Get the reference count of the object.
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment operator.
 
void Ref () const
 Increment the reference count.
 
void Unref () const
 Decrement the reference count.
 
- Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
 Virtual destructor.
 
void GetAttribute (std::string name, AttributeValue &value, bool permissive=false) const
 Get the value of an attribute, raising fatal errors if unsuccessful.
 
bool GetAttributeFailSafe (std::string name, AttributeValue &value) const
 Get the value of an attribute without raising errors.
 
void SetAttribute (std::string name, const AttributeValue &value)
 Set a single attribute, raising fatal errors if unsuccessful.
 
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 Set a single attribute without raising errors.
 
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 Connect a TraceSource to a Callback with a context.
 
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 Connect a TraceSource to a Callback without a context.
 
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected with a context.
 
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected without a context.
 

Static Public Member Functions

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

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.
 
void DoDispose () override
 Perform any object release functionality required to break reference cycles in reference counted objects held by the device.
 
- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object.
 
virtual void DoInitialize ()
 Initialize() implementation.
 
virtual void NotifyNewAggregate ()
 Notify all Objects aggregated to this one of a new Object being aggregated.
 
- Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
 Complete construction of ObjectBase; invoked by derived classes.
 
virtual void NotifyConstructionCompleted ()
 Notifier called once the ObjectBase is fully constructed.
 

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

Private Attributes

Mac48Address m_address
 The MAC address which has been assigned to this device.
 
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.
 
DataRate m_bps
 The data rate that the Net Device uses to simulate packet transmission timing.
 
Ptr< CsmaChannelm_channel
 The CsmaChannel to which this CsmaNetDevice has been attached.
 
Ptr< Packetm_currentPkt
 Next packet that will be transmitted (if transmitter is not currently transmitting) or packet that is currently being transmitted.
 
uint32_t m_deviceId
 Device ID returned by the attached functions.
 
EncapsulationMode m_encapMode
 The type of packet that should be created by the AddHeader function and that should be processed by the ProcessHeader function.
 
uint32_t m_ifIndex
 The interface index (really net evice index) that has been assigned to this network device.
 
TracedCallback m_linkChangeCallbacks
 List of callbacks to fire if the link changes state (up or down).
 
bool m_linkUp
 Flag indicating whether or not the link is up.
 
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).
 
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).
 
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).
 
TracedCallback< Ptr< const Packet > > m_macTxBackoffTrace
 The trace source fired when the mac layer is forced to begin the backoff process for a packet.
 
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.
 
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.
 
uint32_t m_mtu
 The Maximum Transmission Unit.
 
Ptr< Nodem_node
 The Node to which this device is attached.
 
TracedCallback< Ptr< const Packet > > m_phyRxBeginTrace
 The trace source fired when a packet begins the reception process from the medium.
 
TracedCallback< Ptr< const Packet > > m_phyRxDropTrace
 The trace source fired when the phy layer drops a packet it has received.
 
TracedCallback< Ptr< const Packet > > m_phyRxEndTrace
 The trace source fired when a packet ends the reception process from the medium.
 
TracedCallback< Ptr< const Packet > > m_phyTxBeginTrace
 The trace source fired when a packet begins the transmission process on the medium.
 
TracedCallback< Ptr< const Packet > > m_phyTxDropTrace
 The trace source fired when the phy layer drops a packet as it tries to transmit it.
 
TracedCallback< Ptr< const Packet > > m_phyTxEndTrace
 The trace source fired when a packet ends the transmission process on the medium.
 
NetDevice::PromiscReceiveCallback m_promiscRxCallback
 The callback used to notify higher layers that a packet has been received in promiscuous mode.
 
TracedCallback< Ptr< const Packet > > m_promiscSnifferTrace
 A trace source that emulates a promiscuous mode protocol sniffer connected to the device.
 
Ptr< Queue< Packet > > m_queue
 The Queue which this CsmaNetDevice uses as a packet source.
 
bool m_receiveEnable
 Enable net device to receive packets.
 
Ptr< ErrorModelm_receiveErrorModel
 Error model for receive packet events.
 
NetDevice::ReceiveCallback m_rxCallback
 The callback used to notify higher layers that a packet has been received.
 
bool m_sendEnable
 Enable net device to send packets.
 
TracedCallback< Ptr< const Packet > > m_snifferTrace
 A trace source that emulates a non-promiscuous protocol sniffer connected to the device.
 
Time m_tInterframeGap
 The interframe gap that the Net Device uses insert time between packet transmission.
 
TxMachineState m_txMachineState
 The state of the Net Device transmit state machine.
 

Static Private Attributes

static const uint16_t DEFAULT_MTU = 1500
 Default Maximum Transmission Unit (MTU) for the CsmaNetDevice.
 

Additional Inherited Members

Detailed Description

A Device for a Csma Network Link.

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 50 of file csma-net-device.h.

Member Enumeration Documentation

◆ EncapsulationMode

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 62 of file csma-net-device.h.

◆ TxMachineState

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 464 of file csma-net-device.h.

Constructor & Destructor Documentation

◆ CsmaNetDevice() [1/2]

ns3::CsmaNetDevice::CsmaNetDevice ( )

Construct a CsmaNetDevice.

This is the default constructor for a CsmaNetDevice.

Definition at line 176 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:

◆ ~CsmaNetDevice()

ns3::CsmaNetDevice::~CsmaNetDevice ( )
override

Destroy a CsmaNetDevice.

This is the destructor for a CsmaNetDevice.

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

References m_queue, and NS_LOG_FUNCTION_NOARGS.

◆ CsmaNetDevice() [2/2]

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

◆ AddHeader()

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 302 of file csma-net-device.cc.

References ns3::EthernetTrailer::CalcFcs(), ns3::Node::ChecksumEnabled(), ns3::Create(), DIX, ns3::EthernetTrailer::EnableFcs(), GetMtu(), ILLEGAL, LLC, m_encapMode, m_mtu, NS_ASSERT_MSG, NS_FATAL_ERROR, NS_LOG_FUNCTION, NS_LOG_LOGIC, 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:

◆ AddLinkChangeCallback()

void ns3::CsmaNetDevice::AddLinkChangeCallback ( Callback< void > callback)
overridevirtual
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 887 of file csma-net-device.cc.

References ns3::TracedCallback< Ts >::ConnectWithoutContext(), m_linkChangeCallbacks, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ AssignStreams()

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 1063 of file csma-net-device.cc.

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

+ Here is the call graph for this function:

◆ Attach()

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 647 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:

◆ DoDispose()

void ns3::CsmaNetDevice::DoDispose ( )
overrideprotectedvirtual

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 205 of file csma-net-device.cc.

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

+ Here is the call graph for this function:

◆ GetAddress()

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

Implements ns3::NetDevice.

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

References m_address, and NS_LOG_FUNCTION_NOARGS.

◆ GetBroadcast()

Address ns3::CsmaNetDevice::GetBroadcast ( ) const
overridevirtual
Returns
the broadcast address supported by this netdevice.

Calling this method is invalid if IsBroadcast returns not true.

Implements ns3::NetDevice.

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

References ns3::Mac48Address::GetBroadcast(), and NS_LOG_FUNCTION_NOARGS.

+ Here is the call graph for this function:

◆ GetChannel()

Ptr< Channel > ns3::CsmaNetDevice::GetChannel ( ) const
overridevirtual
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 859 of file csma-net-device.cc.

References m_channel, and NS_LOG_FUNCTION_NOARGS.

◆ GetEncapsulationMode()

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

Get the encapsulation mode of this device.

Returns
The encapsulation mode of this device.

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

References m_encapMode, and NS_LOG_FUNCTION_NOARGS.

◆ GetIfIndex()

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

Implements ns3::NetDevice.

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

References m_ifIndex, and NS_LOG_FUNCTION_NOARGS.

◆ GetMtu()

uint16_t ns3::CsmaNetDevice::GetMtu ( ) const
overridevirtual
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 245 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:

◆ GetMulticast() [1/2]

Address ns3::CsmaNetDevice::GetMulticast ( Ipv4Address multicastGroup) const
overridevirtual

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 915 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:

◆ GetMulticast() [2/2]

Address ns3::CsmaNetDevice::GetMulticast ( Ipv6Address addr) const
overridevirtual

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 1040 of file csma-net-device.cc.

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

+ Here is the call graph for this function:

◆ GetNode()

Ptr< Node > ns3::CsmaNetDevice::GetNode ( ) const
overridevirtual

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 1011 of file csma-net-device.cc.

References m_node, and NS_LOG_FUNCTION_NOARGS.

◆ GetQueue()

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

Get a copy of the attached Queue.

Returns
a pointer to the queue.

Definition at line 830 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:

◆ GetTypeId()

◆ Init()

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

◆ IsBridge()

bool ns3::CsmaNetDevice::IsBridge ( ) const
overridevirtual

Is this a bridge?

Returns
false.

Implements ns3::NetDevice.

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

References NS_LOG_FUNCTION_NOARGS.

◆ IsBroadcast()

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

Implements ns3::NetDevice.

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

References NS_LOG_FUNCTION_NOARGS.

◆ IsLinkUp()

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

Implements ns3::NetDevice.

Definition at line 880 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:

◆ IsMulticast()

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

Implements ns3::NetDevice.

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

References NS_LOG_FUNCTION_NOARGS.

◆ IsPointToPoint()

bool ns3::CsmaNetDevice::IsPointToPoint ( ) const
overridevirtual

Is this a point to point link?

Returns
false.

Implements ns3::NetDevice.

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

References NS_LOG_FUNCTION_NOARGS.

◆ IsReceiveEnabled()

bool ns3::CsmaNetDevice::IsReceiveEnabled ( ) const

Is the receive side of the network device enabled?

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

Definition at line 273 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:

◆ IsSendEnabled()

bool ns3::CsmaNetDevice::IsSendEnabled ( ) const

Is the send side of the network device enabled?

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

Definition at line 266 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:

◆ NeedsArp()

bool ns3::CsmaNetDevice::NeedsArp ( ) const
overridevirtual

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 1026 of file csma-net-device.cc.

References NS_LOG_FUNCTION_NOARGS.

◆ NotifyLinkUp()

void ns3::CsmaNetDevice::NotifyLinkUp ( )
private

Notify any interested parties that the link has come up.

Definition at line 837 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:

◆ operator=()

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

◆ Receive()

void ns3::CsmaNetDevice::Receive ( Ptr< const 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 687 of file csma-net-device.cc.

References ns3::EthernetTrailer::CheckFcs(), ns3::Node::ChecksumEnabled(), ns3::EthernetTrailer::EnableFcs(), ns3::EthernetHeader::GetDestination(), ns3::EthernetHeader::GetLengthType(), ns3::EthernetHeader::GetSource(), ns3::LlcSnapHeader::GetType(), ns3::Mac48Address::IsBroadcast(), ns3::Mac48Address::IsGroup(), ns3::Callback< R, UArgs >::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, and ns3::NetDevice::PACKET_OTHERHOST.

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Send()

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

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 946 of file csma-net-device.cc.

References m_address, NS_LOG_FUNCTION, and SendFrom().

+ Here is the call graph for this function:

◆ SendFrom()

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

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 953 of file csma-net-device.cc.

References AddHeader(), ns3::Mac48Address::ConvertFrom(), 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:

◆ SetAddress()

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

Set the address of this interface.

Parameters
addressaddress to set

Implements ns3::NetDevice.

Definition at line 866 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:

◆ SetBackoffParams()

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 287 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.

◆ SetEncapsulationMode()

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

Set the encapsulation mode of this device.

Parameters
modeThe encapsulation mode of this device.

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

References m_encapMode, m_mtu, NS_LOG_FUNCTION, and NS_LOG_LOGIC.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

◆ SetIfIndex()

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

Implements ns3::NetDevice.

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

References m_ifIndex, and NS_LOG_FUNCTION.

◆ SetInterframeGap()

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 280 of file csma-net-device.cc.

References m_tInterframeGap, and NS_LOG_FUNCTION.

◆ SetMtu()

bool ns3::CsmaNetDevice::SetMtu ( const uint16_t mtu)
overridevirtual
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 233 of file csma-net-device.cc.

References m_encapMode, m_mtu, NS_LOG_FUNCTION, and NS_LOG_LOGIC.

Referenced by GetTypeId().

+ Here is the caller graph for this function:

◆ SetNode()

void ns3::CsmaNetDevice::SetNode ( Ptr< Node > node)
overridevirtual

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 1018 of file csma-net-device.cc.

References m_node, and NS_LOG_FUNCTION.

◆ SetPromiscReceiveCallback()

void ns3::CsmaNetDevice::SetPromiscReceiveCallback ( PromiscReceiveCallback cb)
overridevirtual
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 1049 of file csma-net-device.cc.

References m_promiscRxCallback, and NS_LOG_FUNCTION.

◆ SetQueue()

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 673 of file csma-net-device.cc.

References m_queue, and NS_LOG_FUNCTION.

◆ SetReceiveCallback()

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

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 1033 of file csma-net-device.cc.

References m_rxCallback, and NS_LOG_FUNCTION.

◆ SetReceiveEnable()

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 259 of file csma-net-device.cc.

References m_receiveEnable, and NS_LOG_FUNCTION.

◆ SetReceiveErrorModel()

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 680 of file csma-net-device.cc.

References m_receiveErrorModel, and NS_LOG_FUNCTION.

◆ SetSendEnable()

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 252 of file csma-net-device.cc.

References m_sendEnable, and NS_LOG_FUNCTION.

◆ SupportsSendFrom()

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

Implements ns3::NetDevice.

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

References NS_LOG_FUNCTION_NOARGS.

◆ TransmitAbort()

void ns3::CsmaNetDevice::TransmitAbort ( )
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 528 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:

◆ TransmitCompleteEvent()

void ns3::CsmaNetDevice::TransmitCompleteEvent ( )
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 575 of file csma-net-device.cc.

References ns3::Time::As(), BUSY, GAP, 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::Time::S, 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:

◆ TransmitReadyEvent()

void ns3::CsmaNetDevice::TransmitReadyEvent ( )
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 608 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:

◆ TransmitStart()

void ns3::CsmaNetDevice::TransmitStart ( )
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 435 of file csma-net-device.cc.

References ns3::Time::As(), BACKOFF, BUSY, ns3::DataRate::CalculateBytesTxTime(), ns3::Backoff::GetBackoffTime(), 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::Time::S, ns3::Simulator::Schedule(), TransmitAbort(), TransmitCompleteEvent(), and TransmitStart().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ DEFAULT_MTU

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

Default Maximum Transmission Unit (MTU) for the CsmaNetDevice.

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

Referenced by GetTypeId().

◆ m_address

Mac48Address ns3::CsmaNetDevice::m_address
private

The MAC address which has been assigned to this device.

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

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

◆ m_backoff

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 504 of file csma-net-device.h.

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

◆ m_bps

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 490 of file csma-net-device.h.

Referenced by Attach(), and TransmitStart().

◆ m_channel

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

The CsmaChannel to which this CsmaNetDevice has been attached.

See also
class CsmaChannel

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

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

◆ m_currentPkt

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 511 of file csma-net-device.h.

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

◆ m_deviceId

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 449 of file csma-net-device.h.

Referenced by Attach(), and TransmitStart().

◆ m_encapMode

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 483 of file csma-net-device.h.

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

◆ m_ifIndex

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 700 of file csma-net-device.h.

Referenced by GetIfIndex(), and SetIfIndex().

◆ m_linkChangeCallbacks

TracedCallback ns3::CsmaNetDevice::m_linkChangeCallbacks
private

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

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

Referenced by AddLinkChangeCallback(), and NotifyLinkUp().

◆ m_linkUp

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 706 of file csma-net-device.h.

Referenced by IsLinkUp(), and NotifyLinkUp().

◆ m_macPromiscRxTrace

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 559 of file csma-net-device.h.

Referenced by GetTypeId(), and Receive().

◆ m_macRxDropTrace

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 577 of file csma-net-device.h.

Referenced by GetTypeId().

◆ m_macRxTrace

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 568 of file csma-net-device.h.

Referenced by GetTypeId(), and Receive().

◆ m_macTxBackoffTrace

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 586 of file csma-net-device.h.

Referenced by GetTypeId(), and TransmitStart().

◆ m_macTxDropTrace

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 550 of file csma-net-device.h.

Referenced by GetTypeId(), and SendFrom().

◆ m_macTxTrace

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 542 of file csma-net-device.h.

Referenced by GetTypeId(), and SendFrom().

◆ m_mtu

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 724 of file csma-net-device.h.

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

◆ m_node

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

The Node to which this device is attached.

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

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

◆ m_phyRxBeginTrace

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 618 of file csma-net-device.h.

Referenced by GetTypeId().

◆ m_phyRxDropTrace

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 633 of file csma-net-device.h.

Referenced by GetTypeId(), and Receive().

◆ m_phyRxEndTrace

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 626 of file csma-net-device.h.

Referenced by GetTypeId(), and Receive().

◆ m_phyTxBeginTrace

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 594 of file csma-net-device.h.

Referenced by GetTypeId(), and TransmitStart().

◆ m_phyTxDropTrace

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 610 of file csma-net-device.h.

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

◆ m_phyTxEndTrace

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 602 of file csma-net-device.h.

Referenced by GetTypeId(), and TransmitCompleteEvent().

◆ m_promiscRxCallback

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 694 of file csma-net-device.h.

Referenced by Receive(), and SetPromiscReceiveCallback().

◆ m_promiscSnifferTrace

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 673 of file csma-net-device.h.

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

◆ m_queue

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 527 of file csma-net-device.h.

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

◆ m_receiveEnable

bool ns3::CsmaNetDevice::m_receiveEnable
private

Enable net device to receive packets.

True by default

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

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

◆ m_receiveErrorModel

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 534 of file csma-net-device.h.

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

◆ m_rxCallback

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

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

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

Referenced by Receive(), and SetReceiveCallback().

◆ m_sendEnable

bool ns3::CsmaNetDevice::m_sendEnable
private

Enable net device to send packets.

True by default

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

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

◆ m_snifferTrace

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 653 of file csma-net-device.h.

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

◆ m_tInterframeGap

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 497 of file csma-net-device.h.

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

◆ m_txMachineState

TxMachineState ns3::CsmaNetDevice::m_txMachineState
private

The state of the Net Device transmit state machine.

See also
TxMachineState

Definition at line 476 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: