ns-3
|
#include <node.h>
Classes | |
struct | ProtocolHandlerEntry |
Public Types | |
typedef Callback< void, Ptr < NetDevice >, Ptr< const Packet >, uint16_t, const Address &, const Address &, NetDevice::PacketType > | ProtocolHandler |
typedef Callback< void, Ptr < NetDevice > > | DeviceAdditionListener |
Public Member Functions | |
Node () | |
Node (uint32_t systemId) | |
uint32_t | GetId (void) const |
uint32_t | GetSystemId (void) const |
uint32_t | AddDevice (Ptr< NetDevice > device) |
Ptr< NetDevice > | GetDevice (uint32_t index) const |
uint32_t | GetNDevices (void) const |
uint32_t | AddApplication (Ptr< Application > application) |
Ptr< Application > | GetApplication (uint32_t index) const |
uint32_t | GetNApplications (void) const |
void | RegisterProtocolHandler (ProtocolHandler handler, uint16_t protocolType, Ptr< NetDevice > device, bool promiscuous=false) |
void | UnregisterProtocolHandler (ProtocolHandler handler) |
void | RegisterDeviceAdditionListener (DeviceAdditionListener listener) |
void | UnregisterDeviceAdditionListener (DeviceAdditionListener listener) |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
This method returns the TypeId associated to ns3::Node. | |
static bool | ChecksumEnabled (void) |
Protected Member Functions | |
virtual void | DoDispose (void) |
virtual void | DoStart (void) |
A network Node.
This class holds together:
typedef Callback<void,Ptr<NetDevice> > ns3::Node::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::PacketType> ns3::Node::ProtocolHandler |
A protocol handler
device | a pointer to the net device which received the packet |
packet | the packet received |
protocol | the 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. |
sender | the address of the sender |
receiver | the 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(). |
packetType | type of packet received (broadcast/multicast/unicast/otherhost); Note: this value is only valid for promiscuous mode protocol handlers. |
ns3::Node::Node | ( | ) |
Must be invoked by subclasses only.
ns3::Node::Node | ( | uint32_t | systemId | ) |
systemId | a unique integer used for parallel simulations. |
Must be invoked by subclasses only.
uint32_t ns3::Node::AddApplication | ( | Ptr< Application > | application | ) |
application | Application to associate to this node. |
Associated this Application to this Node.
References GetId(), ns3::Simulator::ScheduleWithContext(), ns3::Seconds(), and ns3::Object::Start().
Referenced by ns3::Ping6Helper::Install(), ns3::UdpServerHelper::Install(), ns3::UdpClientHelper::Install(), and ns3::UdpTraceClientHelper::Install().
uint32_t ns3::Node::AddDevice | ( | Ptr< NetDevice > | device | ) |
device | NetDevice to associate to this node. |
Associate this device to this node.
References GetId(), ns3::MakeCallback(), ns3::Simulator::ScheduleWithContext(), ns3::Seconds(), ns3::NetDevice::SetIfIndex(), ns3::NetDevice::SetNode(), ns3::NetDevice::SetReceiveCallback(), and ns3::Object::Start().
Referenced by ns3::BridgeHelper::Install(), ns3::TapBridgeHelper::Install(), ns3::LteHelper::Install(), ns3::WaveformGeneratorHelper::Install(), ns3::AdhocAlohaNoackIdealPhyHelper::Install(), ns3::SpectrumAnalyzerHelper::Install(), ns3::PointToPointHelper::Install(), ns3::WifiHelper::Install(), ns3::MeshHelper::Install(), ns3::WimaxHelper::Install(), and ns3::UanHelper::Install().
bool ns3::Node::ChecksumEnabled | ( | void | ) | [static] |
References ns3::GlobalValue::GetValue().
Referenced by ns3::CsmaNetDevice::AddHeader(), ns3::UdpL4Protocol::Receive(), ns3::TcpL4Protocol::Receive(), ns3::Ipv4L3Protocol::Receive(), ns3::CsmaNetDevice::Receive(), ns3::UdpL4Protocol::Send(), and ns3::TcpL4Protocol::Send().
void ns3::Node::DoDispose | ( | void | ) | [protected, virtual] |
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.
References ns3::Object::Dispose().
void ns3::Node::DoStart | ( | void | ) | [protected, virtual] |
This method is called only once by Object::Start. If the user calls Object::Start multiple times, DoStart 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.
References ns3::Object::Start().
Ptr< Application > ns3::Node::GetApplication | ( | uint32_t | index | ) | const |
index |
References NS_ASSERT_MSG.
Ptr< NetDevice > ns3::Node::GetDevice | ( | uint32_t | index | ) | const |
index | the index of the requested NetDevice |
The indexes used by the GetDevice method start at one and end at GetNDevices ()
References NS_ASSERT_MSG.
Referenced by ns3::Socket::BindToNetDevice(), ns3::GlobalRouter::DiscoverLSAs(), ns3::UanHelper::EnableAscii(), ns3::PcapHelperForDevice::EnablePcap(), ns3::PacketSocket::GetSockName(), ns3::AcousticModemEnergyModel::HandleEnergyDepletion(), ns3::MpiInterface::ReceiveMessages(), ns3::PacketSocket::SendTo(), and ns3::AnimationInterface::StartAnimation().
uint32_t ns3::Node::GetId | ( | void | ) | const |
This unique id happens to be also the index of the Node into the NodeList.
Referenced by AddApplication(), AddDevice(), ns3::AcousticModemEnergyModel::ChangeState(), ns3::Ipv4GlobalRoutingHelper::Create(), ns3::GlobalRouteManagerImpl::DeleteGlobalRoutes(), ns3::GlobalRouter::DiscoverLSAs(), ns3::UanHelper::EnableAscii(), ns3::PcapHelperForDevice::EnablePcap(), ns3::PcapHelperForIpv4::EnablePcapIpv4(), ns3::PcapHelperForIpv6::EnablePcapIpv6(), ns3::UanPhyGen::EnergyDepletionHandler(), ns3::PcapHelper::GetFilenameFromDevice(), ns3::AsciiTraceHelper::GetFilenameFromDevice(), ns3::PcapHelper::GetFilenameFromInterfacePair(), ns3::AsciiTraceHelper::GetFilenameFromInterfacePair(), ns3::AnimPacketInfo::GetRxInfo(), ns3::AcousticModemEnergyModel::HandleEnergyDepletion(), ns3::BridgeHelper::Install(), ns3::TapBridgeHelper::Install(), ns3::SpectrumAnalyzerHelper::Install(), ns3::ArpL3Protocol::Lookup(), ns3::AnimPacketInfo::ProcessRxBegin(), ns3::AnimPacketInfo::ProcessRxEnd(), ns3::ArpL3Protocol::Receive(), ns3::Ipv6L3Protocol::Receive(), ns3::Ipv4L3Protocol::Receive(), ns3::MpiInterface::ReceiveMessages(), ns3::AnimPacketInfo::RemoveRxInfo(), ns3::Ipv4ListRouting::RouteInput(), ns3::Ipv6ListRouting::RouteInput(), ns3::LoopbackNetDevice::Send(), ns3::LoopbackNetDevice::SendFrom(), ns3::AnimationInterface::SetConstantPosition(), ns3::GlobalRoutingLSA::SetNode(), ns3::AnimationInterface::StartAnimation(), ns3::SingleModelSpectrumChannel::StartTx(), ns3::MultiModelSpectrumChannel::StartTx(), and ns3::PointToPointRemoteChannel::TransmitStart().
uint32_t ns3::Node::GetNApplications | ( | void | ) | const |
uint32_t ns3::Node::GetNDevices | ( | void | ) | const |
uint32_t ns3::Node::GetSystemId | ( | void | ) | const |
Referenced by ns3::GlobalRouteManagerImpl::InitializeRoutes(), ns3::PointToPointHelper::Install(), and ns3::MpiInterface::SendPacket().
TypeId ns3::Node::GetTypeId | ( | void | ) | [static] |
This method returns the TypeId associated to ns3::Node.
This object is accessible through the following paths with Config::Set and Config::Connect:
Attributes defined for this type:
No TraceSources defined for this type.
Reimplemented from ns3::Object.
References ns3::TypeId::ATTR_GET, and ns3::TypeId::SetParent().
void ns3::Node::RegisterDeviceAdditionListener | ( | DeviceAdditionListener | listener | ) |
listener | the 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 existance of all already-added devices to make discovery of devices easier.
void ns3::Node::RegisterProtocolHandler | ( | ProtocolHandler | handler, |
uint16_t | protocolType, | ||
Ptr< NetDevice > | device, | ||
bool | promiscuous = false |
||
) |
handler | the handler to register |
protocolType | the 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. |
device | the device attached to this handler. If the value is zero, the handler is attached to all devices on this node. |
promiscuous | whether to register a promiscuous mode handler |
References ns3::MakeCallback(), and ns3::NetDevice::SetPromiscReceiveCallback().
Referenced by ns3::BridgeNetDevice::AddBridgePort(), ns3::MeshPointDevice::AddInterface(), ns3::Ipv6L3Protocol::AddInterface(), and ns3::Ipv4L3Protocol::AddInterface().
void ns3::Node::UnregisterDeviceAdditionListener | ( | DeviceAdditionListener | listener | ) |
listener | the listener to remove |
Remove an existing listener from the list of listeners for the device-added event.
void ns3::Node::UnregisterProtocolHandler | ( | ProtocolHandler | handler | ) |
handler | the handler to unregister |
After this call returns, the input handler will never be invoked anymore.
Referenced by ns3::PacketSocket::Close().