A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ns3::PointToPointChannel Class Reference

Simple Point To Point Channel. More...

#include <point-to-point-channel.h>

+ Inheritance diagram for ns3::PointToPointChannel:
+ Collaboration diagram for ns3::PointToPointChannel:

Classes

class  Link
 

Public Member Functions

 PointToPointChannel ()
 Create a PointToPointChannel. More...
 
void Attach (Ptr< PointToPointNetDevice > device)
 Attach a given netdevice to this channel. More...
 
virtual Ptr< NetDeviceGetDevice (uint32_t i) const
 
virtual uint32_t GetNDevices (void) const
 Get number of devices on this channel. More...
 
Ptr< PointToPointNetDeviceGetPointToPointDevice (uint32_t i) const
 
virtual bool TransmitStart (Ptr< Packet > p, Ptr< PointToPointNetDevice > src, Time txTime)
 Transmit a packet over this channel. More...
 
- Public Member Functions inherited from ns3::Channel
 Channel ()
 
virtual ~Channel ()
 
uint32_t GetId (void) const
 
- 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 TypeId GetTypeId (void)
 
- Static Public Member Functions inherited from ns3::Channel
static TypeId GetTypeId (void)
 
- 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

Time GetDelay (void) const
 
Ptr< PointToPointNetDeviceGetDestination (uint32_t i) const
 
Ptr< PointToPointNetDeviceGetSource (uint32_t i) const
 
bool IsInitialized (void) const
 
- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 
virtual void DoDispose (void)
 This method is called by Object::Dispose or by the object's destructor, whichever comes first. More...
 
virtual void DoInitialize (void)
 This method is called only once by Object::Initialize. More...
 
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

enum  WireState { INITIALIZING, IDLE, TRANSMITTING, PROPAGATING }
 

Private Attributes

Time m_delay
 
Link m_link [N_DEVICES]
 
int32_t m_nDevices
 
TracedCallback< Ptr< const
Packet >, Ptr< NetDevice >
, Ptr< NetDevice >, Time, Time
m_txrxPointToPoint
 The trace source for the packet transmission animation events that the device can fire. More...
 

Static Private Attributes

static const int N_DEVICES = 2
 

Detailed Description

Simple Point To Point Channel.

This class represents a very simple point to point channel. Think full duplex RS-232 or RS-422 with null modem and no handshaking. There is no multi-drop capability on this channel – there can be a maximum of two point-to-point net devices connected.

There are two "wires" in the channel. The first device connected gets the [0] wire to transmit on. The second device gets the [1] wire. There is a state (IDLE, TRANSMITTING) associated with each wire.

Config Paths

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

  • /ChannelList/[i]/$ns3::PointToPointChannel

Attributes

  • Delay: Transmission delay through the channel
    • Set with class: ns3::TimeValue
    • Underlying type: Time -9223372036854775808.0ns:+9223372036854775807.0ns
    • Initial value: +0.0ns
    • Flags: construct write read

Attributes defined in parent class ns3::Channel

TraceSources

  • TxRxPointToPoint: Trace source indicating transmission of packet from the PointToPointChannel, used by the Animation interface.

Definition at line 47 of file point-to-point-channel.h.

Member Enumeration Documentation

Enumerator
INITIALIZING 
IDLE 
TRANSMITTING 
PROPAGATING 

Definition at line 147 of file point-to-point-channel.h.

Constructor & Destructor Documentation

ns3::PointToPointChannel::PointToPointChannel ( )

Create a PointToPointChannel.

By default, you get a channel that has zero transmission delay.

Definition at line 53 of file point-to-point-channel.cc.

References NS_LOG_FUNCTION_NOARGS.

Member Function Documentation

void ns3::PointToPointChannel::Attach ( Ptr< PointToPointNetDevice device)

Attach a given netdevice to this channel.

Parameters
devicepointer to the netdevice to attach to the channel

Definition at line 63 of file point-to-point-channel.cc.

References IDLE, ns3::PointToPointChannel::Link::m_dst, m_link, m_nDevices, ns3::PointToPointChannel::Link::m_src, ns3::PointToPointChannel::Link::m_state, N_DEVICES, NS_ASSERT, NS_ASSERT_MSG, and NS_LOG_FUNCTION.

Time ns3::PointToPointChannel::GetDelay ( void  ) const
protected

Definition at line 129 of file point-to-point-channel.cc.

References m_delay.

Referenced by ns3::PointToPointRemoteChannel::TransmitStart().

+ Here is the caller graph for this function:

Ptr< PointToPointNetDevice > ns3::PointToPointChannel::GetDestination ( uint32_t  i) const
protected

Definition at line 141 of file point-to-point-channel.cc.

References ns3::PointToPointChannel::Link::m_dst, and m_link.

Referenced by ns3::PointToPointRemoteChannel::TransmitStart().

+ Here is the caller graph for this function:

Ptr< NetDevice > ns3::PointToPointChannel::GetDevice ( uint32_t  i) const
virtual
Parameters
iindex of NetDevice to retrieve
Returns
one of the NetDevices connected to this channel.

This method must be implemented by subclasses.

Implements ns3::Channel.

Definition at line 122 of file point-to-point-channel.cc.

References GetPointToPointDevice(), and NS_LOG_FUNCTION_NOARGS.

+ Here is the call graph for this function:

uint32_t ns3::PointToPointChannel::GetNDevices ( void  ) const
virtual

Get number of devices on this channel.

Returns
number of devices on this channel

Implements ns3::Channel.

Definition at line 107 of file point-to-point-channel.cc.

References m_nDevices, and NS_LOG_FUNCTION_NOARGS.

Ptr< PointToPointNetDevice > ns3::PointToPointChannel::GetPointToPointDevice ( uint32_t  i) const

Definition at line 114 of file point-to-point-channel.cc.

References m_link, ns3::PointToPointChannel::Link::m_src, NS_ASSERT, and NS_LOG_FUNCTION_NOARGS.

Referenced by GetDevice().

+ Here is the caller graph for this function:

Ptr< PointToPointNetDevice > ns3::PointToPointChannel::GetSource ( uint32_t  i) const
protected

Definition at line 135 of file point-to-point-channel.cc.

References m_link, and ns3::PointToPointChannel::Link::m_src.

Referenced by ns3::PointToPointRemoteChannel::TransmitStart().

+ Here is the caller graph for this function:

TypeId ns3::PointToPointChannel::GetTypeId ( void  )
static

Definition at line 34 of file point-to-point-channel.cc.

References m_delay, m_txrxPointToPoint, ns3::MakeTimeChecker(), ns3::MakeTraceSourceAccessor(), and ns3::TypeId::SetParent().

+ Here is the call graph for this function:

bool ns3::PointToPointChannel::IsInitialized ( void  ) const
protected

Definition at line 147 of file point-to-point-channel.cc.

References INITIALIZING, m_link, and NS_ASSERT.

Referenced by ns3::PointToPointRemoteChannel::TransmitStart().

+ Here is the caller graph for this function:

bool ns3::PointToPointChannel::TransmitStart ( Ptr< Packet p,
Ptr< PointToPointNetDevice src,
Time  txTime 
)
virtual

Transmit a packet over this channel.

Parameters
pPacket to transmit
srcSource PointToPointNetDevice
txTimeTransmit time to apply
Returns
true if successful (currently always true)

Reimplemented in ns3::PointToPointRemoteChannel.

Definition at line 84 of file point-to-point-channel.cc.

References ns3::Packet::GetUid(), INITIALIZING, m_delay, ns3::PointToPointChannel::Link::m_dst, m_link, ns3::PointToPointChannel::Link::m_src, m_txrxPointToPoint, NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::PointToPointNetDevice::Receive(), and ns3::Simulator::ScheduleWithContext().

+ Here is the call graph for this function:

Member Data Documentation

Time ns3::PointToPointChannel::m_delay
private

Definition at line 128 of file point-to-point-channel.h.

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

Link ns3::PointToPointChannel::m_link[N_DEVICES]
private
int32_t ns3::PointToPointChannel::m_nDevices
private

Definition at line 129 of file point-to-point-channel.h.

Referenced by Attach(), and GetNDevices().

TracedCallback<Ptr<const Packet>, Ptr<NetDevice>, Ptr<NetDevice>, Time, Time > ns3::PointToPointChannel::m_txrxPointToPoint
private

The trace source for the packet transmission animation events that the device can fire.

Arguments to the callback are the packet, transmitting net device, receiving net device, transmission time and packet receipt time.

See also
class CallBackTraceSource

Definition at line 145 of file point-to-point-channel.h.

Referenced by GetTypeId(), and TransmitStart().

const int ns3::PointToPointChannel::N_DEVICES = 2
staticprivate

Definition at line 126 of file point-to-point-channel.h.

Referenced by Attach().


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