#include <csma-channel.h>
Public Member Functions | |
CsmaChannel () | |
Create a CsmaChannel. | |
int32_t | Attach (Ptr< CsmaNetDevice > device) |
Attach a given netdevice to this channel. | |
bool | Detach (Ptr< CsmaNetDevice > device) |
Detach a given netdevice from this channel. | |
bool | Detach (uint32_t deviceId) |
Detach a given netdevice from this channel. | |
bool | Reattach (uint32_t deviceId) |
Reattach a previously detached net device to the channel. | |
bool | Reattach (Ptr< CsmaNetDevice > device) |
Reattach a previously detached net device to the channel. | |
bool | TransmitStart (Ptr< Packet > p, uint32_t srcId) |
Start transmitting a packet over the channel. | |
bool | TransmitEnd () |
Indicates that the net device has finished transmitting the packet over the channel. | |
void | PropagationCompleteEvent () |
Indicates that the channel has finished propagating the current packet. The channel is released and becomes free. | |
int32_t | GetDeviceNum (Ptr< CsmaNetDevice > device) |
WireState | GetState () |
bool | IsBusy () |
Indicates if the channel is busy. The channel will only accept new packets for transmission if it is not busy. | |
bool | IsActive (uint32_t deviceId) |
Indicates if a net device is currently attached or detached from the channel. | |
uint32_t | GetNumActDevices (void) |
virtual uint32_t | GetNDevices (void) const |
virtual Ptr< NetDevice > | GetDevice (uint32_t i) const |
Ptr< CsmaNetDevice > | GetCsmaDevice (uint32_t i) const |
DataRate | GetDataRate (void) |
Time | GetDelay (void) |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
This method returns the TypeId associated to ns3::CsmaChannel. |
Csma Channel.
This class represents a simple Csma channel that can be used when many nodes are connected to one wire. It uses a single busy flag to indicate if the channel is currently in use. It does not take into account the distances between stations or the speed of light to determine collisions.
int32_t ns3::CsmaChannel::Attach | ( | Ptr< CsmaNetDevice > | device | ) |
Attach a given netdevice to this channel.
device | Device pointer to the netdevice to attach to the channel |
bool ns3::CsmaChannel::Detach | ( | uint32_t | deviceId | ) |
Detach a given netdevice from this channel.
The net device is marked as inactive and it is not allowed to receive or transmit packets
deviceId | The deviceID assigned to the net device when it was connected to the channel |
bool ns3::CsmaChannel::Detach | ( | Ptr< CsmaNetDevice > | device | ) |
Detach a given netdevice from this channel.
The net device is marked as inactive and it is not allowed to receive or transmit packets
device | Device pointer to the netdevice to detach from the channel |
Ptr<CsmaNetDevice> ns3::CsmaChannel::GetCsmaDevice | ( | uint32_t | i | ) | const |
i | The deviceId of the net device for which we want the pointer. |
DataRate ns3::CsmaChannel::GetDataRate | ( | void | ) |
Get the assigned data rate of the channel
Time ns3::CsmaChannel::GetDelay | ( | void | ) |
Get the assigned speed-of-light delay of the channel
i | The index of the net device. |
Implements ns3::Channel.
int32_t ns3::CsmaChannel::GetDeviceNum | ( | Ptr< CsmaNetDevice > | device | ) |
device | Device pointer to the netdevice for which the device number is needed |
virtual uint32_t ns3::CsmaChannel::GetNDevices | ( | void | ) | const [virtual] |
Implements ns3::Channel.
uint32_t ns3::CsmaChannel::GetNumActDevices | ( | void | ) |
WireState ns3::CsmaChannel::GetState | ( | ) |
static TypeId ns3::CsmaChannel::GetTypeId | ( | void | ) | [static] |
This method returns the TypeId associated to ns3::CsmaChannel.
This object is accessible through the following paths with Config::Set and Config::Connect:
Attributes defined for this type:
Attributes defined in parent class ns3::Channel:
No TraceSources defined for this type.
Reimplemented from ns3::Channel.
bool ns3::CsmaChannel::IsActive | ( | uint32_t | deviceId | ) |
Indicates if a net device is currently attached or detached from the channel.
deviceId | The ID that was assigned to the net device when it was attached to the channel. |
bool ns3::CsmaChannel::IsBusy | ( | ) |
Indicates if the channel is busy. The channel will only accept new packets for transmission if it is not busy.
void ns3::CsmaChannel::PropagationCompleteEvent | ( | ) |
Indicates that the channel has finished propagating the current packet. The channel is released and becomes free.
Calls the receive function of every active net device that is attached to the channel.
bool ns3::CsmaChannel::Reattach | ( | Ptr< CsmaNetDevice > | device | ) |
Reattach a previously detached net device to the channel.
The net device is marked as active. It is now allowed to receive or transmit packets. The net device must have been previously attached to the channel using the attach function.
device | Device pointer to the netdevice to detach from the channel |
bool ns3::CsmaChannel::Reattach | ( | uint32_t | deviceId | ) |
Reattach a previously detached net device to the channel.
The net device is marked as active. It is now allowed to receive or transmit packets. The net device must have been previously attached to the channel using the attach function.
deviceId | The device ID assigned to the net device when it was connected to the channel |
bool ns3::CsmaChannel::TransmitEnd | ( | ) |
Indicates that the net device has finished transmitting the packet over the channel.
The channel will stay busy until the packet has completely propagated to all net devices attached to the channel. The TransmitEnd function schedules the PropagationCompleteEvent which will free the channel for further transmissions. Stores the packet p as the m_currentPkt, the packet being currently transmitting.
Start transmitting a packet over the channel.
If the srcId belongs to a net device that is connected to the channel, packet transmission begins, and the channel becomes busy until the packet has completely reached all destinations.
p | A reference to the packet that will be transmitted over the channel | |
srcId | The device Id of the net device that wants to transmit on the channel. |