A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::Node Class Reference

A network Node. More...

#include "node.h"

+ Inheritance diagram for ns3::Node:
+ Collaboration diagram for ns3::Node:

Classes

struct  ProtocolHandlerEntry
 Protocol handler entry. More...
 

Public Types

typedef Callback< void, Ptr< NetDevice > > DeviceAdditionListener
 A callback invoked whenever a device is added to a node.
 
typedef Callback< void, Ptr< NetDevice >, Ptr< const Packet >, uint16_t, const Address &, const Address &, NetDevice::PacketTypeProtocolHandler
 A protocol handler.
 

Public Member Functions

 Node ()
 
 Node (uint32_t systemId)
 
 ~Node () override
 
uint32_t AddApplication (Ptr< Application > application)
 Associate an Application to this Node.
 
uint32_t AddDevice (Ptr< NetDevice > device)
 Associate a NetDevice to this node.
 
Ptr< ApplicationGetApplication (uint32_t index) const
 Retrieve the index-th Application associated to this node.
 
Ptr< NetDeviceGetDevice (uint32_t index) const
 Retrieve the index-th NetDevice associated to this node.
 
uint32_t GetId () const
 
Time GetLocalTime () const
 In the future, ns3 nodes may have clock that returned a local time different from the virtual time Simulator::Now().
 
uint32_t GetNApplications () const
 
uint32_t GetNDevices () const
 
uint32_t GetSystemId () const
 
void RegisterDeviceAdditionListener (DeviceAdditionListener listener)
 
void RegisterProtocolHandler (ProtocolHandler handler, uint16_t protocolType, Ptr< NetDevice > device, bool promiscuous=false)
 
void UnregisterDeviceAdditionListener (DeviceAdditionListener listener)
 
void UnregisterProtocolHandler (ProtocolHandler handler)
 
- 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 bool ChecksumEnabled ()
 
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 DoDispose () override
 The dispose method.
 
void DoInitialize () override
 Initialize() implementation.
 
- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object.
 
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

typedef std::vector< DeviceAdditionListenerDeviceAdditionListenerList
 Typedef for NetDevice addition listeners container.
 
typedef std::vector< Node::ProtocolHandlerEntryProtocolHandlerList
 Typedef for protocol handlers container.
 

Private Member Functions

void Construct ()
 Finish node's construction by setting the correct node ID.
 
bool NonPromiscReceiveFromDevice (Ptr< NetDevice > device, Ptr< const Packet > packet, uint16_t protocol, const Address &from)
 Receive a packet from a device in non-promiscuous mode.
 
void NotifyDeviceAdded (Ptr< NetDevice > device)
 Notifies all the DeviceAdditionListener about the new device added.
 
bool PromiscReceiveFromDevice (Ptr< NetDevice > device, Ptr< const Packet > packet, uint16_t protocol, const Address &from, const Address &to, NetDevice::PacketType packetType)
 Receive a packet from a device in promiscuous mode.
 
bool ReceiveFromDevice (Ptr< NetDevice > device, Ptr< const Packet >, uint16_t protocol, const Address &from, const Address &to, NetDevice::PacketType packetType, bool promisc)
 Receive a packet from a device.
 

Private Attributes

std::vector< Ptr< Application > > m_applications
 Applications associated to this node.
 
DeviceAdditionListenerList m_deviceAdditionListeners
 Device addition listeners in the node.
 
std::vector< Ptr< NetDevice > > m_devices
 Devices associated to this node.
 
ProtocolHandlerList m_handlers
 Protocol handlers in the node.
 
uint32_t m_id
 Node id for this node.
 
uint32_t m_sid
 System id for this node.
 

Related Symbols

(Note that these are not member symbols.)

static GlobalValue g_checksumEnabled
 
 

Detailed Description

A network Node.

This class holds together:

  • a list of NetDevice objects which represent the network interfaces of this node which are connected to other Node instances through Channel instances.
  • a list of Application objects which represent the userspace traffic generation applications which interact with the Node through the Socket API.
  • a node Id: a unique per-node identifier.
  • a system Id: a unique Id used for parallel simulations.

Every Node created is added to the NodeList automatically.

Definition at line 45 of file node.h.

Member Typedef Documentation

◆ DeviceAdditionListener

A callback invoked whenever a device is added to a node.

Definition at line 183 of file node.h.

◆ DeviceAdditionListenerList

Typedef for NetDevice addition listeners container.

Definition at line 288 of file node.h.

◆ ProtocolHandler

typedef Callback<void, Ptr<NetDevice>, Ptr<const Packet>, uint16_t, const Address&, const Address&, NetDevice::PacketType> ns3::Node::ProtocolHandler

A protocol handler.

Parameters
devicea pointer to the net device which received the packet
packetthe packet received
protocolthe 16 bit protocol number associated with this packet. This protocol number is expected to be the same protocol number given to the Send method by the user on the sender side.
senderthe address of the sender
receiverthe address of the receiver; Note: this value is only valid for promiscuous mode protocol handlers. Note: If the L2 protocol does not use L2 addresses, the address reported here is the value of device->GetAddress().
packetTypetype of packet received (broadcast/multicast/unicast/otherhost); Note: this value is only valid for promiscuous mode protocol handlers.

Definition at line 154 of file node.h.

◆ ProtocolHandlerList

Typedef for protocol handlers container.

Definition at line 286 of file node.h.

Constructor & Destructor Documentation

◆ Node() [1/2]

ns3::Node::Node ( )

Definition at line 77 of file node.cc.

References Construct(), and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ Node() [2/2]

ns3::Node::Node ( uint32_t systemId)
Parameters
systemIda unique integer used for parallel simulations.

Definition at line 85 of file node.cc.

References Construct(), and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ ~Node()

ns3::Node::~Node ( )
override

Definition at line 100 of file node.cc.

References NS_LOG_FUNCTION.

Member Function Documentation

◆ AddApplication()

uint32_t ns3::Node::AddApplication ( Ptr< Application > application)

Associate an Application to this Node.

Parameters
applicationApplication to associate to this node.
Returns
the index of the Application within the Node's list of Application.

Definition at line 153 of file node.cc.

References GetId(), ns3::Object::Initialize(), m_applications, NS_LOG_FUNCTION, ns3::Simulator::ScheduleWithContext(), and ns3::Seconds().

Referenced by ns3::NoBackhaulEpcHelper::NoBackhaulEpcHelper(), BlockAckAggregationDisabledTest::DoRun(), Bug2222TestCase::DoRun(), Bug730TestCase::DoRun(), DsssModulationTest::DoRun(), PacketSocketAppsTest::DoRun(), PingTestCase::DoRun(), PreservePacketsInAmpdus::DoRun(), QosFragmentationTestCase::DoRun(), SpectrumIdealPhyTestCase::DoRun(), WifiUseAvailBwTest::DoRun(), OrigBlockAckWindowStalled::DoSetup(), Experiment::Run(), WifiChannelSwitchingTest::SendPacket(), and BackoffGenerationTest::Transmit().

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

◆ AddDevice()

uint32_t ns3::Node::AddDevice ( Ptr< NetDevice > device)

Associate a NetDevice to this node.

Parameters
deviceNetDevice to associate to this node.
Returns
the index of the NetDevice into the Node's list of NetDevice.

Definition at line 124 of file node.cc.

References GetId(), ns3::Object::Initialize(), m_devices, ns3::MakeCallback(), NonPromiscReceiveFromDevice(), NotifyDeviceAdded(), NS_LOG_FUNCTION, ns3::Simulator::ScheduleWithContext(), and ns3::Seconds().

Referenced by ns3::NoBackhaulEpcHelper::NoBackhaulEpcHelper(), IcmpEchoReplyTestCase::DoRun(), IcmpV6EchoReplyTestCase::DoRun(), IpAddressHelperTestCasev6::DoRun(), PacketSocketAppsTest::DoRun(), SixlowpanIphcStatefulImplTest::DoRun(), ThreeGppAntennaSetupChangedTest::DoRun(), ThreeGppCalcLongTermMultiPortTest::DoRun(), ThreeGppChannelMatrixComputationTest::DoRun(), ThreeGppChannelMatrixUpdateTest::DoRun(), ThreeGppMimoPolarizationTest::DoRun(), ThreeGppSpectrumPropagationLossModelTest::DoRun(), UdpClientServerTestCase::DoRun(), UdpEchoClientSetFillTestCase::DoRun(), UdpTraceClientServerTestCase::DoRun(), TestWifiPhyRxTraceHelper::DoSetup(), TestWifiPhyRxTraceHelperYans::DoSetup(), TbfQueueDiscTestCase::RunTbfTest(), ns3::Ipv4L3ClickProtocol::SetupLoopback(), ns3::Ipv4L3Protocol::SetupLoopback(), and ns3::Ipv6L3Protocol::SetupLoopback().

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

◆ ChecksumEnabled()

bool ns3::Node::ChecksumEnabled ( )
static
Returns
true if checksums are enabled, false otherwise.

Definition at line 267 of file node.cc.

References g_checksumEnabled, ns3::BooleanValue::Get(), and ns3::GlobalValue::GetValue().

Referenced by ns3::CsmaNetDevice::AddHeader(), ns3::Ipv4L3ClickProtocol::BuildHeader(), ns3::Ipv4L3Protocol::BuildHeader(), ns3::SixLowPanNetDevice::DecompressLowPanUdpNhc(), ns3::Ipv4L3Protocol::DoFragmentation(), ns3::lrwpan::LrWpanMac::McpsDataRequest(), ns3::lrwpan::LrWpanMac::MlmeAssociateResponse(), ns3::lrwpan::LrWpanMac::MlmeOrphanResponse(), ns3::TcpL4Protocol::PacketReceived(), ns3::lrwpan::LrWpanMac::PdDataIndication(), ns3::CsmaNetDevice::Receive(), ns3::UdpL4Protocol::Receive(), ns3::UdpL4Protocol::Receive(), ns3::Ipv4L3ClickProtocol::Send(), ns3::Ping::Send(), ns3::UdpL4Protocol::Send(), ns3::UdpL4Protocol::Send(), ns3::UdpL4Protocol::Send(), ns3::UdpL4Protocol::Send(), ns3::V4TraceRoute::Send(), ns3::lrwpan::LrWpanMac::SendAck(), ns3::lrwpan::LrWpanMac::SendAssocRequestCommand(), ns3::lrwpan::LrWpanMac::SendBeaconRequestCommand(), ns3::lrwpan::LrWpanMac::SendDataRequestCommand(), ns3::Icmpv4L4Protocol::SendMessage(), ns3::lrwpan::LrWpanMac::SendOneBeacon(), ns3::lrwpan::LrWpanMac::SendOrphanNotificationCommand(), ns3::TcpL4Protocol::SendPacketV4(), ns3::TcpL4Protocol::SendPacketV6(), ChainRegressionTest::SendPing(), ns3::olsr::Bug780Test::SendPing(), ns3::Ipv4L3ClickProtocol::SendWithHeader(), and ns3::Ipv4L3Protocol::SendWithHeader().

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

◆ Construct()

void ns3::Node::Construct ( )
private

Finish node's construction by setting the correct node ID.

Definition at line 94 of file node.cc.

References ns3::NodeList::Add(), m_id, and NS_LOG_FUNCTION.

Referenced by Node(), and Node().

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

◆ DoDispose()

void ns3::Node::DoDispose ( )
overrideprotectedvirtual

The dispose method.

Subclasses must override this method and must chain up to it by calling Node::DoDispose at the end of their own DoDispose method.

Reimplemented from ns3::Object.

Definition at line 179 of file node.cc.

References ns3::Object::DoDispose(), m_applications, m_deviceAdditionListeners, m_devices, m_handlers, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ DoInitialize()

void ns3::Node::DoInitialize ( )
overrideprotectedvirtual

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 202 of file node.cc.

References ns3::Object::DoInitialize(), m_applications, m_devices, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ GetApplication()

Ptr< Application > ns3::Node::GetApplication ( uint32_t index) const

Retrieve the index-th Application associated to this node.

Parameters
indexthe index of the requested Application
Returns
the requested Application.

Definition at line 164 of file node.cc.

References m_applications, and NS_ASSERT_MSG.

◆ GetDevice()

◆ GetId()

uint32_t ns3::Node::GetId ( ) const
Returns
the unique id of this node.

This unique id happens to be also the index of the Node into the NodeList.

Definition at line 106 of file node.cc.

References m_id.

Referenced by AddApplication(), AddDevice(), ns3::TcpSocketBase::AddOptionSack(), ns3::TcpSocketBase::AddOptionSackPermitted(), ns3::TcpSocketBase::AddOptionTimestamp(), ns3::TcpSocketBase::AddOptionWScale(), ns3::TcpSocketBase::CalculateWScale(), ns3::AcousticModemEnergyModel::ChangeState(), Bug772ChainTest::CreateDevices(), Ipv4FragmentationTest::DoRun(), Ipv6FragmentationTest::DoRun(), ns3::aodv::LoopbackTestCase::DoRun(), ns3::TcpGeneralTest::DoRun(), SixlowpanFragmentationTest::DoRun(), TestWifiPhyRxTraceHelper::DoRun(), TestWifiPhyRxTraceHelperMloStr::DoRun(), TestWifiPhyRxTraceHelperYans::DoRun(), WifiMsduAggregatorThroughputTest::DoRun(), ns3::SixLowPanNetDevice::DoSend(), ns3::InternetStackHelper::EnableAsciiIpv4Internal(), ns3::InternetStackHelper::EnableAsciiIpv6Internal(), ns3::InternetStackHelper::EnablePcapIpv4Internal(), ns3::InternetStackHelper::EnablePcapIpv6Internal(), ns3::UanPhyGen::EnergyDepletionHandler(), ns3::UanPhyGen::EnergyRechargeHandler(), ns3::ThreeGppChannelModel::GenerateChannelParameters(), ns3::Ping::GetApplicationSignature(), ns3::ThreeGppChannelModel::GetChannel(), ns3::ThreeGppChannelConditionModel::GetKey(), ns3::ThreeGppPropagationLossModel::GetKey(), ns3::ThreeGppChannelModel::GetNewChannel(), ns3::PyViz::GetPacketDropSamples(), ns3::ThreeGppChannelModel::GetParams(), ns3::PyViz::GetTransmissionSamples(), ns3::AcousticModemEnergyModel::HandleEnergyDepletion(), ns3::AcousticModemEnergyModel::HandleEnergyRecharged(), FlameRegressionTest::InstallApplications(), HwmpDoRfRegressionTest::InstallApplications(), HwmpProactiveRegressionTest::InstallApplications(), HwmpReactiveRegressionTest::InstallApplications(), HwmpSimplestRegressionTest::InstallApplications(), ns3::Ipv4L3Protocol::IpForward(), ns3::Ipv6L3Protocol::IpForward(), ns3::Ipv4L3Protocol::IpMulticastForward(), ns3::Ipv6L3Protocol::IpMulticastForward(), ns3::Ipv4L3ProtocolDropSinkWithContext(), ns3::Ipv4L3ProtocolDropSinkWithoutContext(), ns3::Ipv4L3ProtocolRxSinkWithContext(), ns3::Ipv4L3ProtocolRxSinkWithoutContext(), ns3::Ipv4L3ProtocolRxTxSink(), ns3::Ipv4L3ProtocolTxSinkWithContext(), ns3::Ipv4L3ProtocolTxSinkWithoutContext(), ns3::Ipv6L3ProtocolDropSinkWithContext(), ns3::Ipv6L3ProtocolDropSinkWithoutContext(), ns3::Ipv6L3ProtocolRxSinkWithContext(), ns3::Ipv6L3ProtocolRxSinkWithoutContext(), ns3::Ipv6L3ProtocolRxTxSink(), ns3::Ipv6L3ProtocolTxSinkWithContext(), ns3::Ipv6L3ProtocolTxSinkWithoutContext(), ns3::ArpL3Protocol::Lookup(), ns3::AnimationInterface::OutputCsmaPacket(), ns3::AnimationInterface::OutputWirelessPacketRxInfo(), ns3::AnimationInterface::OutputWirelessPacketTxInfo(), ns3::TcpSocketBase::ProcessOptionSackPermitted(), ns3::TcpSocketBase::ProcessOptionTimestamp(), ns3::TcpSocketBase::ProcessOptionWScale(), ns3::ArpL3Protocol::Receive(), ns3::Ipv4L3ClickProtocol::Receive(), ns3::Ipv4L3Protocol::Receive(), ns3::Ipv6L3Protocol::Receive(), ns3::TapBridge::ReceiveFromBridgedDevice(), ReceiveFromDevice(), ns3::Ipv4ListRouting::RouteInput(), ns3::Ipv6ListRouting::RouteInput(), ns3::olsr::RoutingProtocol::RouteInput(), ns3::olsr::RoutingProtocol::RouteOutput(), ns3::TrafficControlLayer::ScanDevices(), ns3::LoopbackNetDevice::Send(), ns3::ArpL3Protocol::SendArpReply(), ns3::ArpL3Protocol::SendArpRequest(), ns3::LoopbackNetDevice::SendFrom(), ns3::SubscriberStationNetDevice::SetBasicConnection(), ns3::SubscriberStationNetDevice::SetPrimaryConnection(), ns3::TapBridge::StartTapDevice(), and ns3::PyViz::TraceNetDevRxCommon().

◆ GetLocalTime()

Time ns3::Node::GetLocalTime ( ) const

In the future, ns3 nodes may have clock that returned a local time different from the virtual time Simulator::Now().

This function is currently a placeholder to ease the development of this feature. For now, it is only an alias to Simulator::Now()

Returns
The time as seen by this node

Definition at line 112 of file node.cc.

References ns3::Simulator::Now().

+ Here is the call graph for this function:

◆ GetNApplications()

uint32_t ns3::Node::GetNApplications ( ) const
Returns
the number of Application instances associated to this Node.

Definition at line 173 of file node.cc.

References m_applications.

◆ GetNDevices()

uint32_t ns3::Node::GetNDevices ( ) const
Returns
the number of NetDevice instances associated to this Node.

Definition at line 147 of file node.cc.

References m_devices.

Referenced by ns3::Socket::BindToNetDevice(), ns3::PacketSocket::GetMinMtu(), ns3::TrafficControlLayer::GetNDevices(), ns3::TrafficControlLayer::ScanDevices(), ns3::PacketSocket::SendTo(), ns3::Ipv4L3ClickProtocol::SetupLoopback(), ns3::Ipv4L3Protocol::SetupLoopback(), and ns3::Ipv6L3Protocol::SetupLoopback().

+ Here is the caller graph for this function:

◆ GetSystemId()

uint32_t ns3::Node::GetSystemId ( ) const
Returns
the system id for parallel simulations associated to this node.

Definition at line 118 of file node.cc.

References m_sid.

◆ GetTypeId()

TypeId ns3::Node::GetTypeId ( )
static

Get the type ID.

Returns
the object TypeId

Definition at line 44 of file node.cc.

References ns3::TypeId::ATTR_GET, ns3::TypeId::ATTR_SET, m_applications, m_devices, m_id, m_sid, ns3::MakeObjectVectorAccessor(), ns3::MakeObjectVectorChecker(), ns3::MakeUintegerAccessor(), ns3::MakeUintegerChecker(), and ns3::TypeId::SetParent().

+ Here is the call graph for this function:

◆ NonPromiscReceiveFromDevice()

bool ns3::Node::NonPromiscReceiveFromDevice ( Ptr< NetDevice > device,
Ptr< const Packet > packet,
uint16_t protocol,
const Address & from )
private

Receive a packet from a device in non-promiscuous mode.

Parameters
devicethe device
packetthe packet
protocolthe protocol
fromthe sender
Returns
true if the packet has been delivered to a protocol handler.

Definition at line 287 of file node.cc.

References NS_LOG_FUNCTION, and ReceiveFromDevice().

Referenced by AddDevice().

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

◆ NotifyDeviceAdded()

void ns3::Node::NotifyDeviceAdded ( Ptr< NetDevice > device)
private

Notifies all the DeviceAdditionListener about the new device added.

Parameters
devicethe added device to notify.

Definition at line 366 of file node.cc.

References m_deviceAdditionListeners, and NS_LOG_FUNCTION.

Referenced by AddDevice().

+ Here is the caller graph for this function:

◆ PromiscReceiveFromDevice()

bool ns3::Node::PromiscReceiveFromDevice ( Ptr< NetDevice > device,
Ptr< const Packet > packet,
uint16_t protocol,
const Address & from,
const Address & to,
NetDevice::PacketType packetType )
private

Receive a packet from a device in promiscuous mode.

Parameters
devicethe device
packetthe packet
protocolthe protocol
fromthe sender
tothe destination
packetTypethe packet type
Returns
true if the packet has been delivered to a protocol handler.

Definition at line 275 of file node.cc.

References NS_LOG_FUNCTION, and ReceiveFromDevice().

Referenced by RegisterProtocolHandler().

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

◆ ReceiveFromDevice()

bool ns3::Node::ReceiveFromDevice ( Ptr< NetDevice > device,
Ptr< const Packet > packet,
uint16_t protocol,
const Address & from,
const Address & to,
NetDevice::PacketType packetType,
bool promisc )
private

Receive a packet from a device.

Parameters
devicethe device
packetthe packet
protocolthe protocol
fromthe sender
tothe destination
packetTypethe packet type
promisctrue if received in promiscuous mode
Returns
true if the packet has been delivered to a protocol handler.

Definition at line 303 of file node.cc.

References ns3::Simulator::GetContext(), GetId(), m_handlers, NS_ASSERT_MSG, NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by NonPromiscReceiveFromDevice(), and PromiscReceiveFromDevice().

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

◆ RegisterDeviceAdditionListener()

void ns3::Node::RegisterDeviceAdditionListener ( DeviceAdditionListener listener)
Parameters
listenerthe listener to add

Add a new listener to the list of listeners for the device-added event. When a new listener is added, it is notified of the existence of all already-added devices to make discovery of devices easier.

Definition at line 340 of file node.cc.

References m_deviceAdditionListeners, m_devices, and NS_LOG_FUNCTION.

◆ RegisterProtocolHandler()

void ns3::Node::RegisterProtocolHandler ( ProtocolHandler handler,
uint16_t protocolType,
Ptr< NetDevice > device,
bool promiscuous = false )
Parameters
handlerthe handler to register
protocolTypethe type of protocol this handler is interested in. This protocol type is a so-called EtherType, as registered here: http://standards.ieee.org/regauth/ethertype/eth.txt the value zero is interpreted as matching all protocols.
devicethe device attached to this handler. If the value is zero, the handler is attached to all devices on this node.
promiscuouswhether to register a promiscuous mode handler

Definition at line 220 of file node.cc.

References ns3::Node::ProtocolHandlerEntry::device, ns3::Node::ProtocolHandlerEntry::handler, m_devices, m_handlers, ns3::MakeCallback(), NS_LOG_FUNCTION, PromiscReceiveFromDevice(), ns3::Node::ProtocolHandlerEntry::promiscuous, and ns3::Node::ProtocolHandlerEntry::protocol.

Referenced by ns3::BridgeNetDevice::AddBridgePort(), ns3::Ipv4L3Protocol::AddInterface(), ns3::Ipv6L3Protocol::AddInterface(), ns3::MeshPointDevice::AddInterface(), ns3::OpenFlowSwitchNetDevice::AddSwitchPort(), ns3::PacketSocket::DoBind(), and ns3::SixLowPanNetDevice::SetNetDevice().

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

◆ UnregisterDeviceAdditionListener()

void ns3::Node::UnregisterDeviceAdditionListener ( DeviceAdditionListener listener)
Parameters
listenerthe listener to remove

Remove an existing listener from the list of listeners for the device-added event.

Definition at line 352 of file node.cc.

References m_deviceAdditionListeners, and NS_LOG_FUNCTION.

◆ UnregisterProtocolHandler()

void ns3::Node::UnregisterProtocolHandler ( ProtocolHandler handler)
Parameters
handlerthe handler to unregister

After this call returns, the input handler will never be invoked anymore.

Definition at line 253 of file node.cc.

References m_handlers, and NS_LOG_FUNCTION.

Referenced by ns3::PacketSocket::Close().

+ Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ g_checksumEnabled

GlobalValue g_checksumEnabled
related
Initial value:
=
GlobalValue("ChecksumEnabled",
"A global switch to enable all checksums for all protocols",
BooleanValue(false),
Ptr< const AttributeChecker > MakeBooleanChecker()
Definition boolean.cc:113

A global switch to enable all checksums for all protocols.

Definition at line 37 of file node.cc.

Referenced by ChecksumEnabled().

Member Data Documentation

◆ m_applications

std::vector<Ptr<Application> > ns3::Node::m_applications
private

Applications associated to this node.

Definition at line 293 of file node.h.

Referenced by AddApplication(), DoDispose(), DoInitialize(), GetApplication(), GetNApplications(), and GetTypeId().

◆ m_deviceAdditionListeners

DeviceAdditionListenerList ns3::Node::m_deviceAdditionListeners
private

Device addition listeners in the node.

Definition at line 295 of file node.h.

Referenced by DoDispose(), NotifyDeviceAdded(), RegisterDeviceAdditionListener(), and UnregisterDeviceAdditionListener().

◆ m_devices

std::vector<Ptr<NetDevice> > ns3::Node::m_devices
private

Devices associated to this node.

Definition at line 292 of file node.h.

Referenced by AddDevice(), DoDispose(), DoInitialize(), GetDevice(), GetNDevices(), GetTypeId(), RegisterDeviceAdditionListener(), and RegisterProtocolHandler().

◆ m_handlers

ProtocolHandlerList ns3::Node::m_handlers
private

Protocol handlers in the node.

Definition at line 294 of file node.h.

Referenced by DoDispose(), ReceiveFromDevice(), RegisterProtocolHandler(), and UnregisterProtocolHandler().

◆ m_id

uint32_t ns3::Node::m_id
private

Node id for this node.

Definition at line 290 of file node.h.

Referenced by Construct(), GetId(), and GetTypeId().

◆ m_sid

uint32_t ns3::Node::m_sid
private

System id for this node.

Definition at line 291 of file node.h.

Referenced by GetSystemId(), and GetTypeId().


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