A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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. More...
 
typedef Callback< void, Ptr
< NetDevice >, Ptr< const
Packet >, uint16_t, const
Address &, const Address
&, NetDevice::PacketType
ProtocolHandler
 A protocol handler. More...
 

Public Member Functions

 Node ()
 
 Node (uint32_t systemId)
 
virtual ~Node ()
 
uint32_t AddApplication (Ptr< Application > application)
 
uint32_t AddDevice (Ptr< NetDevice > device)
 
Ptr< ApplicationGetApplication (uint32_t index) const
 
Ptr< NetDeviceGetDevice (uint32_t index) const
 
uint32_t GetId (void) const
 
uint32_t GetNApplications (void) const
 
uint32_t GetNDevices (void) const
 
uint32_t GetSystemId (void) 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 ()
 
virtual ~Object ()
 
void AggregateObject (Ptr< Object > other)
 
void Dispose (void)
 Run the DoDispose methods of this object and all the objects aggregated to it. More...
 
AggregateIterator GetAggregateIterator (void) const
 
virtual TypeId GetInstanceTypeId (void) const
 
template<typename T >
Ptr< T > GetObject (void) const
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 
void Initialize (void)
 This method calls the virtual DoInitialize method on all the objects aggregated to this object. More...
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 Constructor. More...
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor. More...
 
uint32_t GetReferenceCount (void) const
 Get the reference count of the object. More...
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment. More...
 
void Ref (void) const
 Increment the reference count. More...
 
void Unref (void) const
 Decrement the reference count. More...
 
- Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
 Virtual destructor. More...
 
void GetAttribute (std::string name, AttributeValue &value) const
 
bool GetAttributeFailSafe (std::string name, AttributeValue &attribute) const
 
void SetAttribute (std::string name, const AttributeValue &value)
 
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 

Static Public Member Functions

static bool ChecksumEnabled (void)
 
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::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
static void Cleanup (void)
 Noop. More...
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId (void)
 Get the type ID. More...
 

Protected Member Functions

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

Private Types

typedef std::vector
< DeviceAdditionListener
DeviceAdditionListenerList
 Typedef for NetDevice addition listeners container. More...
 
typedef std::vector< struct
Node::ProtocolHandlerEntry
ProtocolHandlerList
 Typedef for protocol handlers container. More...
 

Private Member Functions

void Construct (void)
 Finish node's construction by setting the correct node ID. More...
 
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. More...
 
void NotifyDeviceAdded (Ptr< NetDevice > device)
 Notifies all the DeviceAdditionListener about the new device added. More...
 
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. More...
 
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. More...
 

Private Attributes

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

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.

Config Paths

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

  • /NodeList/[i]

Attributes

No TraceSources are defined for this type.

Definition at line 55 of file node.h.

Member Typedef Documentation

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

Definition at line 177 of file node.h.

Typedef for NetDevice addition listeners container.

Definition at line 272 of file node.h.

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 148 of file node.h.

typedef std::vector<struct Node::ProtocolHandlerEntry> ns3::Node::ProtocolHandlerList
private

Typedef for protocol handlers container.

Definition at line 270 of file node.h.

Constructor & Destructor Documentation

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:

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:

ns3::Node::~Node ( )
virtual

Definition at line 100 of file node.cc.

References NS_LOG_FUNCTION.

Member Function Documentation

uint32_t ns3::Node::AddDevice ( Ptr< NetDevice device)
Parameters
deviceNetDevice to associate to this node.
Returns
the index of the NetDevice into the Node's list of NetDevice.

Associate this device to this node.

Definition at line 120 of file node.cc.

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

Referenced by TcpTestCase::AddSimpleNetDevice(), AddSimpleNetDevice(), TcpTestCase::AddSimpleNetDevice6(), BuildSimpleTopology(), ns3::MeshHelper::CreateInterface(), WifiTest::CreateOne(), InterferenceHelperSequenceTest::CreateOne(), PointToPointTest::DoRun(), IpAddressHelperTestCasev6::DoRun(), LrWpanCollisionTestCase::DoRun(), LrWpanEdTestCase::DoRun(), LrWpanAckTestCase::DoRun(), LrWpanErrorDistanceTestCase::DoRun(), StaticRoutingSlash32TestCase::DoRun(), UdpClientServerTestCase::DoRun(), Ipv4L3ProtocolTestCase::DoRun(), Ipv6L3ProtocolTestCase::DoRun(), LrWpanCcaTestCase::DoRun(), Ipv6RipngTest::DoRun(), Ipv4ForwardingTest::DoRun(), Ipv6ForwardingTest::DoRun(), Ipv6PacketInfoTagTest::DoRun(), SixlowpanHc1ImplTest::DoRun(), SixlowpanIphcImplTest::DoRun(), Ipv6RawSocketImplTest::DoRun(), Ipv4HeaderTest::DoRun(), Ipv4PacketInfoTagTest::DoRun(), Ipv4RawSocketImplTest::DoRun(), SixlowpanFragmentationTest::DoRun(), Ipv4FragmentationTest::DoRun(), UdpTraceClientServerTestCase::DoRun(), Ipv6FragmentationTest::DoRun(), UdpSocketImplTest::DoRun(), Ipv6RipngCountToInfinityTest::DoRun(), UdpEchoClientSetFillTestCase::DoRun(), GlobalRoutingSlash32TestCase::DoRun(), Bug555TestCase::DoRun(), Udp6SocketImplTest::DoRun(), Ipv6RipngSplitHorizonStrategyTest::DoRun(), ns3::BridgeHelper::Install(), ns3::LrWpanHelper::Install(), ns3::TapBridgeHelper::Install(), ns3::SixLowPanHelper::Install(), ns3::WaveformGeneratorHelper::Install(), ns3::PointToPointHelper::Install(), ns3::AdhocAlohaNoackIdealPhyHelper::Install(), ns3::SpectrumAnalyzerHelper::Install(), ns3::WifiHelper::Install(), ns3::MeshHelper::Install(), ns3::WimaxHelper::Install(), ns3::UanHelper::Install(), ns3::FdNetDeviceHelper::InstallPriv(), ns3::EmuHelper::InstallPriv(), ns3::CsmaHelper::InstallPriv(), ns3::LteSimpleHelper::InstallSingleEnbDevice(), ns3::LteHelper::InstallSingleEnbDevice(), ns3::LteSimpleHelper::InstallSingleUeDevice(), ns3::LteHelper::InstallSingleUeDevice(), main(), ns3::PointToPointEpcHelper::PointToPointEpcHelper(), ns3::Ipv4L3Protocol::SetupLoopback(), ns3::Ipv6L3Protocol::SetupLoopback(), and Tunnel::Tunnel().

+ Here is the call graph for this function:

void ns3::Node::Construct ( void  )
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().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::Node::DoDispose ( void  )
protectedvirtual

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

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

+ Here is the call graph for this function:

void ns3::Node::DoInitialize ( void  )
protectedvirtual

This method is called only once by Object::Initialize.

If the user calls Object::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 199 of file node.cc.

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

+ Here is the call graph for this function:

Ptr< Application > ns3::Node::GetApplication ( uint32_t  index) const
Parameters
index
Returns
the application associated to this requested index within this Node.

Definition at line 160 of file node.cc.

References m_applications, NS_ASSERT_MSG, and NS_LOG_FUNCTION.

Referenced by ns3::PointToPointEpcHelper::AddEnb(), ns3::OnOffHelper::AssignStreams(), EpcS1uDlTestCase::DoRun(), EpcS1uUlTestCase::DoRun(), ns3::V4Ping::GetApplicationId(), and ns3::LteHelper::InstallSingleEnbDevice().

+ Here is the caller graph for this function:

Ptr< NetDevice > ns3::Node::GetDevice ( uint32_t  index) const
Parameters
indexthe index of the requested NetDevice
Returns
the requested NetDevice associated to this Node.

The indexes used by the GetDevice method start at one and end at GetNDevices ()

Definition at line 134 of file node.cc.

References m_devices, NS_ASSERT_MSG, and NS_LOG_FUNCTION.

Referenced by ns3::PointToPointEpcHelper::AddX2Interface(), ns3::Ipv4NixVectorRouting::BFS(), ns3::Socket::BindToNetDevice(), ns3::Ipv4NixVectorRouting::BuildNixVector(), ns3::Ipv4NixVectorRouting::BuildNixVectorLocal(), ns3::AnimationInterface::ConnectLte(), ns3::GlobalRouter::DiscoverLSAs(), ns3::PacketSocket::DoBind(), AcousticModemEnergyTestCase::DoRun(), InterferenceHelperSequenceTest::DoRun(), ns3::LteEnbRrcProtocolIdeal::DoSendSystemInformation(), ns3::LteEnbRrcProtocolReal::DoSendSystemInformation(), ns3::UanHelper::EnableAscii(), ns3::AsciiTraceHelperForDevice::EnableAsciiImpl(), ns3::AthstatsHelper::EnableAthstats(), ns3::PcapHelperForDevice::EnablePcap(), ns3::Ipv4NixVectorRouting::FindNetDeviceForNixIndex(), ns3::Ipv4NixVectorRouting::FindTotalNeighbors(), ns3::PacketSocket::GetMinMtu(), ns3::dsr::DsrRouting::GetNetDeviceFromContext(), ns3::AnimationInterface::GetNetDeviceFromContext(), ns3::PacketSocket::GetSockName(), ns3::AcousticModemEnergyModel::HandleEnergyDepletion(), ns3::Ipv4NixVectorRouting::NetDeviceIsBridged(), ns3::GlobalRouter::NetDeviceIsBridged(), OcbWifiMacTestCase::PostDeviceConfiguration(), PrintGnuplottableEnbListToFile(), PrintGnuplottableUeListToFile(), PrintPosition(), ns3::RipNg::Receive(), ns3::GrantedTimeWindowMpiInterface::ReceiveMessages(), ns3::NullMessageMpiInterface::ReceiveMessages(), ns3::Ipv4NixVectorRouting::RouteInput(), ns3::Ipv4NixVectorRouting::RouteOutput(), AcousticModemEnergyTestCase::SendOnePacket(), AcousticModemEnergyDepletionTestCase::SendOnePacket(), ns3::PacketSocket::SendTo(), ns3::LteUeRrcProtocolIdeal::SetEnbRrcSapProvider(), ns3::LteUeRrcProtocolReal::SetEnbRrcSapProvider(), ns3::Ipv4L3Protocol::SetupLoopback(), ns3::Ipv6L3Protocol::SetupLoopback(), ns3::AnimationInterface::StartAnimation(), ns3::PyViz::TraceNetDevRxCommon(), and ns3::PyViz::TraceNetDevTxCommon().

+ Here is the caller graph for this function:

uint32_t ns3::Node::GetId ( void  ) 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, and NS_LOG_FUNCTION.

Referenced by ns3::LteHelper::ActivateDataRadioBearer(), AddApplication(), AddDevice(), ns3::Ipv4NixVectorRouting::BFS(), ns3::Ipv4NixVectorRouting::BuildNixVector(), ns3::Ipv4NixVectorRouting::BuildNixVectorLocal(), ns3::AcousticModemEnergyModel::ChangeState(), ns3::AnimationInterface::ConnectLteEnb(), ns3::AnimationInterface::ConnectLteUe(), ns3::MobilityHelper::CourseChanged(), ns3::Ipv4GlobalRoutingHelper::Create(), ns3::GlobalRouteManagerImpl::DeleteGlobalRoutes(), ns3::GlobalRouter::DiscoverLSAs(), WifiMsduAggregatorThroughputTest::DoRun(), SixlowpanFragmentationTest::DoRun(), Ipv4FragmentationTest::DoRun(), Ipv6FragmentationTest::DoRun(), ns3::SixLowPanNetDevice::DoSend(), ns3::AsciiTraceHelperForDevice::EnableAsciiImpl(), ns3::AsciiTraceHelperForIpv4::EnableAsciiIpv4Impl(), ns3::InternetStackHelper::EnableAsciiIpv4Internal(), ns3::AsciiTraceHelperForIpv6::EnableAsciiIpv6Impl(), ns3::InternetStackHelper::EnableAsciiIpv6Internal(), ns3::PcapHelperForDevice::EnablePcap(), ns3::PcapHelperForIpv4::EnablePcapIpv4(), ns3::PcapHelperForIpv6::EnablePcapIpv6(), ns3::GlobalRouter::FindDesignatedRouterForLink(), ns3::GlobalRouter::FindInterfaceForDevice(), ns3::PcapHelper::GetFilenameFromDevice(), ns3::AsciiTraceHelper::GetFilenameFromDevice(), ns3::PcapHelper::GetFilenameFromInterfacePair(), ns3::AsciiTraceHelper::GetFilenameFromInterfacePair(), ns3::AnimationInterface::GetIpv4RoutingTable(), ns3::Ipv4NixVectorRouting::GetNixVector(), ns3::PyViz::GetPacketDropSamples(), ns3::AnimationInterface::GetPosition(), ns3::PyViz::GetTransmissionSamples(), ns3::AcousticModemEnergyModel::HandleEnergyDepletion(), ns3::BuildingsHelper::Install(), ns3::BridgeHelper::Install(), ns3::TapBridgeHelper::Install(), ns3::SixLowPanHelper::Install(), ns3::SpectrumAnalyzerHelper::Install(), ns3::Ipv4L3Protocol::IpForward(), ns3::Ipv6L3Protocol::IpForward(), ns3::Ipv4L3Protocol::IpMulticastForward(), ns3::Ipv6L3Protocol::IpMulticastForward(), ns3::Ipv4FlowProbe::Ipv4FlowProbe(), ns3::Ipv6FlowProbe::Ipv6FlowProbe(), ns3::ArpL3Protocol::Lookup(), main(), ns3::AnimationInterface::MobilityAutoCheck(), ns3::AnimationInterface::MobilityCourseChangeTrace(), PrintReceivedPacket(), ns3::GlobalRouter::ProcessBridgedBroadcastLink(), ns3::GlobalRouter::ProcessSingleBroadcastLink(), ns3::ArpL3Protocol::Receive(), ns3::Ipv6L3Protocol::Receive(), ns3::Ipv4L3Protocol::Receive(), ns3::TapBridge::ReceiveFromBridgedDevice(), ReceiveFromDevice(), ns3::GrantedTimeWindowMpiInterface::ReceiveMessages(), ns3::NullMessageMpiInterface::ReceiveMessages(), ns3::AnimationInterface::RecursiveIpv4RoutePathSearch(), ns3::Ipv4ListRouting::RouteInput(), ns3::Ipv6ListRouting::RouteInput(), ns3::Ipv4NixVectorRouting::RouteInput(), ns3::olsr::RoutingProtocol::RouteInput(), ns3::olsr::RoutingProtocol::RouteOutput(), ns3::LoopbackNetDevice::Send(), ns3::V4Ping::Send(), ns3::ArpL3Protocol::SendArpReply(), ns3::ArpL3Protocol::SendArpRequest(), Ipv6RipngTest::SendData(), Ipv6ForwardingTest::SendData(), Ipv4ForwardingTest::SendData(), SixlowpanIphcImplTest::SendData(), SixlowpanHc1ImplTest::SendData(), Ipv6RawSocketImplTest::SendData(), Ipv4RawSocketImplTest::SendData(), UdpSocketImplTest::SendData(), Ipv6RipngCountToInfinityTest::SendData(), Udp6SocketImplTest::SendData(), Ipv4RawSocketImplTest::SendData_IpHdr(), Ipv4HeaderTest::SendData_IpHdr_Dscp(), ns3::LoopbackNetDevice::SendFrom(), Experiment::SendMultiDestinations(), ns3::AnimationInterface::SetConstantPosition(), ns3::AnimationInterface::SetLinkDescription(), ns3::GlobalRoutingLSA::SetNode(), ns3::AnimationInterface::SetNodeColor(), ns3::AnimationInterface::SetNodeDescription(), showPosition(), ns3::GlobalRouteManagerImpl::SPFAddASExternal(), ns3::GlobalRouteManagerImpl::SPFIntraAddRouter(), ns3::GlobalRouteManagerImpl::SPFIntraAddStub(), ns3::GlobalRouteManagerImpl::SPFIntraAddTransit(), ns3::AnimationInterface::StartAnimation(), ns3::FdNetDevice::StartDevice(), ns3::EmuNetDevice::StartDevice(), ns3::TapBridge::StartTapDevice(), ns3::PyViz::TraceNetDevRxCommon(), ns3::AnimationInterface::TrackIpv4Route(), ns3::AnimationInterface::UpdateLinkDescription(), ns3::AnimationInterface::UpdateNodeColor(), ns3::AnimationInterface::UpdateNodeDescription(), ns3::AnimationInterface::UpdatePosition(), ns3::AnimationInterface::WifiPhyTxBeginTrace(), and WifiInterferenceTestCase::WifiSimpleInterference().

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

Definition at line 168 of file node.cc.

References m_applications, and NS_LOG_FUNCTION.

Referenced by ns3::PointToPointEpcHelper::AddEnb(), ns3::OnOffHelper::AssignStreams(), and ns3::V4Ping::GetApplicationId().

+ Here is the caller graph for this function:

uint32_t ns3::Node::GetSystemId ( void  ) const
TypeId ns3::Node::GetTypeId ( void  )
static

Get the type ID.

Returns
the object TypeId

Definition at line 50 of file node.cc.

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

+ Here is the call graph for this function:

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

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

References m_deviceAdditionListeners, and NS_LOG_FUNCTION.

Referenced by AddDevice().

+ Here is the caller graph for this function:

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

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

References ns3::Simulator::GetContext(), GetId(), ns3::Packet::GetUid(), 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:

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

References m_deviceAdditionListeners, m_devices, and NS_LOG_FUNCTION.

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 219 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::MeshPointDevice::AddInterface(), ns3::Ipv6L3Protocol::AddInterface(), ns3::Ipv4L3Protocol::AddInterface(), ns3::PacketSocket::DoBind(), ns3::SixLowPanNetDevice::SetNetDevice(), ns3::Ipv4L3Protocol::SetupLoopback(), and ns3::Ipv6L3Protocol::SetupLoopback().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

References m_deviceAdditionListeners, and NS_LOG_FUNCTION.

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:

Member Data Documentation

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

Applications associated to this node.

Definition at line 277 of file node.h.

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

DeviceAdditionListenerList ns3::Node::m_deviceAdditionListeners
private

Device addition listeners in the node.

Definition at line 279 of file node.h.

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

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

Devices associated to this node.

Definition at line 276 of file node.h.

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

ProtocolHandlerList ns3::Node::m_handlers
private

Protocol handlers in the node.

Definition at line 278 of file node.h.

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

uint32_t ns3::Node::m_id
private

Node id for this node.

Definition at line 274 of file node.h.

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

uint32_t ns3::Node::m_sid
private

System id for this node.

Definition at line 275 of file node.h.

Referenced by GetSystemId(), and GetTypeId().


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