csma coding style changes
This commit is contained in:
1 parent
86379fa5b5
commit
85dfc0a20e
14 files changed
+124
-123
No files matched your search
@@ -20,8 +20,8 @@
|
||||
// Network topology
|
||||
// ==============
|
||||
// | |
|
||||
// n0 n1 n2
|
||||
// | |
|
||||
// n0 n1 n2
|
||||
// | |
|
||||
// ==========
|
||||
//
|
||||
// n0 originates UDP broadcast to 255.255.255.255/discard port, which
|
||||
@@ -91,7 +91,7 @@ main (int argc, char *argv[])
|
||||
// 512 bytes (default) at a rate of 500 Kb/s (default) from n0
|
||||
NS_LOG_INFO ("Create Applications.");
|
||||
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
||||
Address (InetSocketAddress (Ipv4Address ("255.255.255.255"), port)));
|
||||
Address (InetSocketAddress (Ipv4Address ("255.255.255.255"), port)));
|
||||
onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
|
||||
onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
|
||||
|
||||
@@ -99,10 +99,10 @@ main (int argc, char *argv[])
|
||||
// Start the application
|
||||
app.Start (Seconds (1.0));
|
||||
app.Stop (Seconds (10.0));
|
||||
|
||||
|
||||
// Create an optional packet sink to receive these packets
|
||||
PacketSinkHelper sink ("ns3::UdpSocketFactory",
|
||||
Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
|
||||
Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
|
||||
app = sink.Install (c0.Get (1));
|
||||
app.Add (sink.Install (c1.Get (1)));
|
||||
app.Start (Seconds (1.0));
|
||||
@@ -121,7 +121,7 @@ main (int argc, char *argv[])
|
||||
csma.EnablePcapAll ("csma-broadcast", false);
|
||||
|
||||
NS_LOG_INFO ("Run Simulation.");
|
||||
Simulator::Run ();
|
||||
Simulator::Run ();
|
||||
Simulator::Destroy ();
|
||||
NS_LOG_INFO ("Done.");
|
||||
}
|
||||
@@ -52,10 +52,10 @@ main (int argc, char *argv[])
|
||||
// LogComponentEnable ("CsmaMulticastExample", LOG_LEVEL_INFO);
|
||||
|
||||
//
|
||||
// Set up default values for the simulation.
|
||||
// Set up default values for the simulation.
|
||||
//
|
||||
// Select DIX/Ethernet II-style encapsulation (no LLC/Snap header)
|
||||
Config::SetDefault ("ns3::CsmaNetDevice::EncapsulationMode", StringValue ("Dix"));
|
||||
Config::SetDefault ("ns3::CsmaNetDevice::EncapsulationMode", StringValue ("Dix"));
|
||||
|
||||
// Allow the user to override any of the defaults at
|
||||
// run-time, via command-line arguments
|
||||
@@ -68,7 +68,7 @@ main (int argc, char *argv[])
|
||||
// We will later want two subcontainers of these nodes, for the two LANs
|
||||
NodeContainer c0 = NodeContainer (c.Get (0), c.Get (1), c.Get (2));
|
||||
NodeContainer c1 = NodeContainer (c.Get (2), c.Get (3), c.Get (4));
|
||||
|
||||
|
||||
NS_LOG_INFO ("Build Topology.");
|
||||
CsmaHelper csma;
|
||||
csma.SetChannelAttribute ("DataRate", DataRateValue (DataRate (5000000)));
|
||||
@@ -95,7 +95,7 @@ main (int argc, char *argv[])
|
||||
// source is at node zero, which we assigned the IP address of 10.1.1.1
|
||||
// earlier. We need to define a multicast group to send packets to. This
|
||||
// can be any multicast address from 224.0.0.0 through 239.255.255.255
|
||||
// (avoiding the reserved routing protocol addresses).
|
||||
// (avoiding the reserved routing protocol addresses).
|
||||
//
|
||||
|
||||
Ipv4Address multicastSource ("10.1.1.1");
|
||||
@@ -115,8 +115,8 @@ main (int argc, char *argv[])
|
||||
outputDevices.Add (nd1.Get (0)); // (we only need one NetDevice here)
|
||||
|
||||
multicast.AddMulticastRoute (multicastRouter, multicastSource,
|
||||
multicastGroup, inputIf, outputDevices);
|
||||
|
||||
multicastGroup, inputIf, outputDevices);
|
||||
|
||||
// 2) Set up a default multicast route on the sender n0
|
||||
Ptr<Node> sender = c.Get (0);
|
||||
Ptr<NetDevice> senderIf = nd0.Get(0);
|
||||
@@ -133,7 +133,7 @@ main (int argc, char *argv[])
|
||||
// Configure a multicast packet generator that generates a packet
|
||||
// every few seconds
|
||||
OnOffHelper onoff ("ns3::UdpSocketFactory",
|
||||
Address (InetSocketAddress (multicastGroup, multicastPort)));
|
||||
Address (InetSocketAddress (multicastGroup, multicastPort)));
|
||||
onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
|
||||
onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
|
||||
onoff.SetAttribute ("DataRate", DataRateValue (DataRate ("255b/s")));
|
||||
|
||||
@@ -99,7 +99,7 @@ main (int argc, char *argv[])
|
||||
|
||||
// Create an optional packet sink to receive these packets
|
||||
PacketSinkHelper sink ("ns3::UdpSocketFactory",
|
||||
Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
|
||||
Address (InetSocketAddress (Ipv4Address::GetAny (), port)));
|
||||
app = sink.Install (nodes.Get (1));
|
||||
app.Start (Seconds (0.0));
|
||||
|
||||
|
||||
@@ -72,8 +72,8 @@ main (int argc, char *argv[])
|
||||
// create the shared medium used by all csma devices.
|
||||
NS_LOG_INFO ("Create channels.");
|
||||
Ptr<CsmaChannel> channel = CreateObjectWithAttributes<CsmaChannel> (
|
||||
"DataRate", DataRateValue (DataRate(5000000)),
|
||||
"Delay", TimeValue (MilliSeconds(2)));
|
||||
"DataRate", DataRateValue (DataRate(5000000)),
|
||||
"Delay", TimeValue (MilliSeconds(2)));
|
||||
|
||||
// use a helper function to connect our nodes to the shared channel.
|
||||
NS_LOG_INFO ("Build Topology.");
|
||||
|
||||
@@ -121,7 +121,7 @@ main (int argc, char *argv[])
|
||||
MakeCallback (&PingRtt));
|
||||
|
||||
Packet::EnablePrinting ();
|
||||
|
||||
|
||||
|
||||
NS_LOG_INFO ("Run Simulation.");
|
||||
Simulator::Run ();
|
||||
|
||||
@@ -111,7 +111,7 @@ main (int argc, char *argv[])
|
||||
MakeCallback (&SinkRx));
|
||||
|
||||
Packet::EnablePrinting ();
|
||||
|
||||
|
||||
|
||||
NS_LOG_INFO ("Run Simulation.");
|
||||
Simulator::Run ();
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
NS_LOG_COMPONENT_DEFINE("CsmaStarHelper");
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
|
||||
CsmaStarHelper::CsmaStarHelper (uint32_t numSpokes,
|
||||
CsmaHelper csmaHelper)
|
||||
{
|
||||
@@ -45,15 +45,16 @@ CsmaStarHelper::CsmaStarHelper (uint32_t numSpokes,
|
||||
}
|
||||
|
||||
CsmaStarHelper::~CsmaStarHelper ()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
Ptr<Node>
|
||||
Ptr<Node>
|
||||
CsmaStarHelper::GetHub () const
|
||||
{
|
||||
return m_hub.Get (0);
|
||||
}
|
||||
|
||||
Ptr<Node>
|
||||
Ptr<Node>
|
||||
CsmaStarHelper::GetSpokeNode (uint32_t i) const
|
||||
{
|
||||
return m_spokes.Get (i);
|
||||
@@ -83,7 +84,7 @@ CsmaStarHelper::GetSpokeIpv4Address (uint32_t i) const
|
||||
return m_spokeInterfaces.GetAddress (i);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
uint32_t
|
||||
CsmaStarHelper::SpokeCount () const
|
||||
{
|
||||
return m_spokes.GetN ();
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "ipv4-interface-container.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
|
||||
/**
|
||||
* \brief A helper to make it easier to create a star topology
|
||||
* with Csma links
|
||||
|
||||
@@ -41,7 +41,7 @@ Backoff::Backoff(Time slotTime, uint32_t minSlots, uint32_t maxSlots, uint32_t c
|
||||
m_ceiling = ceiling;
|
||||
m_maxRetries = maxRetries;
|
||||
m_rng = UniformVariable ();
|
||||
}
|
||||
}
|
||||
|
||||
Time
|
||||
Backoff::GetBackoffTime (void)
|
||||
|
||||
@@ -28,11 +28,11 @@ Transmi */
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
/**
|
||||
* \brief The backoff class is used for calculating backoff times
|
||||
* when many net devices can write to the same channel
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* \brief The backoff class is used for calculating backoff times
|
||||
* when many net devices can write to the same channel
|
||||
*
|
||||
*/
|
||||
|
||||
class Backoff {
|
||||
public:
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace ns3 {
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (CsmaChannel);
|
||||
|
||||
TypeId
|
||||
TypeId
|
||||
CsmaChannel::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::CsmaChannel")
|
||||
@@ -45,32 +45,32 @@ CsmaChannel::GetTypeId (void)
|
||||
TimeValue (Seconds (0)),
|
||||
MakeTimeAccessor (&CsmaChannel::m_delay),
|
||||
MakeTimeChecker ())
|
||||
;
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
|
||||
CsmaChannel::CsmaChannel ()
|
||||
:
|
||||
Channel ()
|
||||
:
|
||||
Channel ()
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
m_state = IDLE;
|
||||
m_deviceList.clear();
|
||||
}
|
||||
|
||||
int32_t
|
||||
int32_t
|
||||
CsmaChannel::Attach (Ptr<CsmaNetDevice> device)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << device);
|
||||
NS_ASSERT (device != 0);
|
||||
|
||||
CsmaDeviceRec rec (device);
|
||||
|
||||
|
||||
m_deviceList.push_back (rec);
|
||||
return (m_deviceList.size () - 1);
|
||||
}
|
||||
|
||||
bool
|
||||
bool
|
||||
CsmaChannel::Reattach (Ptr<CsmaNetDevice> device)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << device);
|
||||
@@ -95,7 +95,7 @@ CsmaChannel::Reattach (Ptr<CsmaNetDevice> device)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
bool
|
||||
CsmaChannel::Reattach (uint32_t deviceId)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << deviceId);
|
||||
@@ -116,7 +116,7 @@ CsmaChannel::Reattach (uint32_t deviceId)
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
bool
|
||||
CsmaChannel::Detach (uint32_t deviceId)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << deviceId);
|
||||
@@ -144,7 +144,7 @@ CsmaChannel::Detach (uint32_t deviceId)
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
bool
|
||||
CsmaChannel::Detach (Ptr<CsmaNetDevice> device)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << device);
|
||||
@@ -162,7 +162,7 @@ CsmaChannel::Detach (Ptr<CsmaNetDevice> device)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
bool
|
||||
CsmaChannel::TransmitStart (Ptr<Packet> p, uint32_t srcId)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << p << srcId);
|
||||
@@ -187,13 +187,13 @@ CsmaChannel::TransmitStart (Ptr<Packet> p, uint32_t srcId)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
bool
|
||||
CsmaChannel::IsActive(uint32_t deviceId)
|
||||
{
|
||||
return (m_deviceList[deviceId].active);
|
||||
}
|
||||
|
||||
bool
|
||||
bool
|
||||
CsmaChannel::TransmitEnd()
|
||||
{
|
||||
NS_LOG_FUNCTION (this << m_currentPkt << m_currentSrc);
|
||||
@@ -214,7 +214,7 @@ CsmaChannel::TransmitEnd()
|
||||
|
||||
|
||||
NS_LOG_LOGIC ("Receive");
|
||||
|
||||
|
||||
std::vector<CsmaDeviceRec>::iterator it;
|
||||
uint32_t devId = 0;
|
||||
for (it = m_deviceList.begin (); it < m_deviceList.end(); it++)
|
||||
@@ -236,7 +236,7 @@ CsmaChannel::TransmitEnd()
|
||||
return retVal;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
CsmaChannel::PropagationCompleteEvent()
|
||||
{
|
||||
NS_LOG_FUNCTION (this << m_currentPkt);
|
||||
@@ -246,7 +246,7 @@ CsmaChannel::PropagationCompleteEvent()
|
||||
m_state = IDLE;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
uint32_t
|
||||
CsmaChannel::GetNumActDevices (void)
|
||||
{
|
||||
int numActDevices = 0;
|
||||
@@ -261,20 +261,20 @@ CsmaChannel::GetNumActDevices (void)
|
||||
return numActDevices;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
uint32_t
|
||||
CsmaChannel::GetNDevices (void) const
|
||||
{
|
||||
return (m_deviceList.size ());
|
||||
}
|
||||
|
||||
Ptr<CsmaNetDevice>
|
||||
Ptr<CsmaNetDevice>
|
||||
CsmaChannel::GetCsmaDevice (uint32_t i) const
|
||||
{
|
||||
Ptr<CsmaNetDevice> netDevice = m_deviceList[i].devicePtr;
|
||||
return netDevice;
|
||||
}
|
||||
|
||||
int32_t
|
||||
int32_t
|
||||
CsmaChannel::GetDeviceNum (Ptr<CsmaNetDevice> device)
|
||||
{
|
||||
std::vector<CsmaDeviceRec>::iterator it;
|
||||
@@ -297,7 +297,7 @@ CsmaChannel::GetDeviceNum (Ptr<CsmaNetDevice> device)
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool
|
||||
bool
|
||||
CsmaChannel::IsBusy (void)
|
||||
{
|
||||
if (m_state == IDLE)
|
||||
@@ -310,25 +310,25 @@ CsmaChannel::IsBusy (void)
|
||||
}
|
||||
}
|
||||
|
||||
DataRate
|
||||
DataRate
|
||||
CsmaChannel::GetDataRate (void)
|
||||
{
|
||||
return m_bps;
|
||||
}
|
||||
|
||||
Time
|
||||
Time
|
||||
CsmaChannel::GetDelay (void)
|
||||
{
|
||||
return m_delay;
|
||||
}
|
||||
|
||||
WireState
|
||||
WireState
|
||||
CsmaChannel::GetState (void)
|
||||
{
|
||||
return m_state;
|
||||
}
|
||||
|
||||
Ptr<NetDevice>
|
||||
Ptr<NetDevice>
|
||||
CsmaChannel::GetDevice (uint32_t i) const
|
||||
{
|
||||
return GetCsmaDevice (i);
|
||||
@@ -345,7 +345,7 @@ CsmaDeviceRec::CsmaDeviceRec (Ptr<CsmaNetDevice> device)
|
||||
active = true;
|
||||
}
|
||||
|
||||
bool
|
||||
bool
|
||||
CsmaDeviceRec::IsActive ()
|
||||
{
|
||||
return active;
|
||||
|
||||
@@ -50,18 +50,18 @@ public:
|
||||
* \return If the net device pointed to by the devicePtr is active
|
||||
* and ready to RX/TX.
|
||||
*/
|
||||
bool IsActive();
|
||||
bool IsActive();
|
||||
};
|
||||
|
||||
/**
|
||||
* Current state of the channel
|
||||
*/
|
||||
enum WireState
|
||||
{
|
||||
IDLE, /**< Channel is IDLE, no packet is being transmitted */
|
||||
TRANSMITTING, /**< Channel is BUSY, a packet is being written by a net device */
|
||||
PROPAGATING /**< Channel is BUSY, packet is propagating to all attached net devices */
|
||||
};
|
||||
{
|
||||
IDLE, /**< Channel is IDLE, no packet is being transmitted */
|
||||
TRANSMITTING, /**< Channel is BUSY, a packet is being written by a net device */
|
||||
PROPAGATING /**< Channel is BUSY, packet is propagating to all attached net devices */
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Csma Channel.
|
||||
@@ -210,7 +210,7 @@ public:
|
||||
* free.
|
||||
*/
|
||||
bool IsBusy ();
|
||||
|
||||
|
||||
/**
|
||||
* \brief Indicates if a net device is currently attached or
|
||||
* detached from the channel.
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace ns3 {
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (CsmaNetDevice);
|
||||
|
||||
TypeId
|
||||
TypeId
|
||||
CsmaNetDevice::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::CsmaNetDevice")
|
||||
@@ -148,12 +148,12 @@ CsmaNetDevice::GetTypeId (void)
|
||||
.AddTraceSource ("PromiscSniffer",
|
||||
"Trace source simulating a promiscuous packet sniffer attached to the device",
|
||||
MakeTraceSourceAccessor (&CsmaNetDevice::m_promiscSnifferTrace))
|
||||
;
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
|
||||
CsmaNetDevice::CsmaNetDevice ()
|
||||
: m_linkUp (false)
|
||||
: m_linkUp (false)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_txMachineState = READY;
|
||||
@@ -180,7 +180,7 @@ CsmaNetDevice::~CsmaNetDevice()
|
||||
m_queue = 0;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
CsmaNetDevice::DoDispose ()
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
@@ -189,7 +189,7 @@ CsmaNetDevice::DoDispose ()
|
||||
NetDevice::DoDispose ();
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
CsmaNetDevice::SetEncapsulationMode (enum EncapsulationMode mode)
|
||||
{
|
||||
NS_LOG_FUNCTION (mode);
|
||||
@@ -200,13 +200,13 @@ CsmaNetDevice::SetEncapsulationMode (enum EncapsulationMode mode)
|
||||
NS_LOG_LOGIC ("m_mtu = " << m_mtu);
|
||||
}
|
||||
|
||||
CsmaNetDevice::EncapsulationMode
|
||||
CsmaNetDevice::EncapsulationMode
|
||||
CsmaNetDevice::GetEncapsulationMode (void)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
return m_encapMode;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
CsmaNetDevice::SetMtu (uint16_t mtu)
|
||||
{
|
||||
@@ -219,7 +219,7 @@ CsmaNetDevice::SetMtu (uint16_t mtu)
|
||||
return true;
|
||||
}
|
||||
|
||||
uint16_t
|
||||
uint16_t
|
||||
CsmaNetDevice::GetMtu (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
@@ -227,42 +227,42 @@ CsmaNetDevice::GetMtu (void) const
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
CsmaNetDevice::SetSendEnable (bool sendEnable)
|
||||
{
|
||||
NS_LOG_FUNCTION (sendEnable);
|
||||
m_sendEnable = sendEnable;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
CsmaNetDevice::SetReceiveEnable (bool receiveEnable)
|
||||
{
|
||||
NS_LOG_FUNCTION (receiveEnable);
|
||||
m_receiveEnable = receiveEnable;
|
||||
}
|
||||
|
||||
bool
|
||||
bool
|
||||
CsmaNetDevice::IsSendEnabled (void)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
return m_sendEnable;
|
||||
}
|
||||
|
||||
bool
|
||||
bool
|
||||
CsmaNetDevice::IsReceiveEnabled (void)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
return m_receiveEnable;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
CsmaNetDevice::SetInterframeGap (Time t)
|
||||
{
|
||||
NS_LOG_FUNCTION (t);
|
||||
m_tInterframeGap = t;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
CsmaNetDevice::SetBackoffParams (Time slotTime, uint32_t minSlots, uint32_t maxSlots, uint32_t ceiling, uint32_t maxRetries)
|
||||
{
|
||||
NS_LOG_FUNCTION (slotTime << minSlots << maxSlots << ceiling << maxRetries);
|
||||
@@ -273,7 +273,7 @@ CsmaNetDevice::SetBackoffParams (Time slotTime, uint32_t minSlots, uint32_t maxS
|
||||
m_backoff.m_maxRetries = maxRetries;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
CsmaNetDevice::AddHeader (Ptr<Packet> p, Mac48Address source, Mac48Address dest, uint16_t protocolNumber)
|
||||
{
|
||||
NS_LOG_FUNCTION (p << source << dest << protocolNumber);
|
||||
@@ -343,8 +343,8 @@ CsmaNetDevice::AddHeader (Ptr<Packet> p, Mac48Address source, Mac48Address de
|
||||
}
|
||||
|
||||
NS_ASSERT_MSG (p->GetSize () <= GetMtu (),
|
||||
"CsmaNetDevice::AddHeader(): 802.3 Length/Type field with LLC/SNAP: "
|
||||
"length interpretation must not exceed device frame size minus overhead");
|
||||
"CsmaNetDevice::AddHeader(): 802.3 Length/Type field with LLC/SNAP: "
|
||||
"length interpretation must not exceed device frame size minus overhead");
|
||||
}
|
||||
break;
|
||||
case ILLEGAL:
|
||||
@@ -366,7 +366,7 @@ CsmaNetDevice::AddHeader (Ptr<Packet> p, Mac48Address source, Mac48Address de
|
||||
}
|
||||
|
||||
#if 0
|
||||
bool
|
||||
bool
|
||||
CsmaNetDevice::ProcessHeader (Ptr<Packet> p, uint16_t & param)
|
||||
{
|
||||
NS_LOG_FUNCTION (p << param);
|
||||
@@ -404,7 +404,7 @@ CsmaNetDevice::ProcessHeader (Ptr<Packet> p, uint16_t & param)
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
void
|
||||
CsmaNetDevice::TransmitStart (void)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
@@ -497,7 +497,7 @@ CsmaNetDevice::TransmitStart (void)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
CsmaNetDevice::TransmitAbort (void)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
@@ -541,7 +541,7 @@ CsmaNetDevice::TransmitAbort (void)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
CsmaNetDevice::TransmitCompleteEvent (void)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
@@ -573,7 +573,7 @@ CsmaNetDevice::TransmitCompleteEvent (void)
|
||||
Simulator::Schedule (m_tInterframeGap, &CsmaNetDevice::TransmitReadyEvent, this);
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
CsmaNetDevice::TransmitReadyEvent (void)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
@@ -609,7 +609,7 @@ CsmaNetDevice::TransmitReadyEvent (void)
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
bool
|
||||
CsmaNetDevice::Attach (Ptr<CsmaChannel> ch)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << &ch);
|
||||
@@ -635,21 +635,21 @@ CsmaNetDevice::Attach (Ptr<CsmaChannel> ch)
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
CsmaNetDevice::SetQueue (Ptr<Queue> q)
|
||||
{
|
||||
NS_LOG_FUNCTION (q);
|
||||
m_queue = q;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
CsmaNetDevice::SetReceiveErrorModel (Ptr<ErrorModel> em)
|
||||
{
|
||||
NS_LOG_FUNCTION (em);
|
||||
m_receiveErrorModel = em;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
CsmaNetDevice::Receive (Ptr<Packet> packet, Ptr<CsmaNetDevice> senderDevice)
|
||||
{
|
||||
NS_LOG_FUNCTION (packet << senderDevice);
|
||||
@@ -751,7 +751,7 @@ CsmaNetDevice::Receive (Ptr<Packet> packet, Ptr<CsmaNetDevice> senderDevice)
|
||||
}
|
||||
else if (header.GetDestination ().IsGroup ())
|
||||
{
|
||||
packetType = PACKET_MULTICAST;
|
||||
packetType = PACKET_MULTICAST;
|
||||
}
|
||||
else if (header.GetDestination () == m_address)
|
||||
{
|
||||
@@ -787,14 +787,14 @@ CsmaNetDevice::Receive (Ptr<Packet> packet, Ptr<CsmaNetDevice> senderDevice)
|
||||
}
|
||||
}
|
||||
|
||||
Ptr<Queue>
|
||||
Ptr<Queue>
|
||||
CsmaNetDevice::GetQueue (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
return m_queue;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
CsmaNetDevice::NotifyLinkUp (void)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
@@ -802,77 +802,77 @@ CsmaNetDevice::NotifyLinkUp (void)
|
||||
m_linkChangeCallbacks ();
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
CsmaNetDevice::SetIfIndex (const uint32_t index)
|
||||
{
|
||||
NS_LOG_FUNCTION (index);
|
||||
m_ifIndex = index;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
uint32_t
|
||||
CsmaNetDevice::GetIfIndex (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
return m_ifIndex;
|
||||
}
|
||||
|
||||
Ptr<Channel>
|
||||
Ptr<Channel>
|
||||
CsmaNetDevice::GetChannel (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
return m_channel;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
CsmaNetDevice::SetAddress (Address address)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
m_address = Mac48Address::ConvertFrom (address);
|
||||
}
|
||||
|
||||
Address
|
||||
Address
|
||||
CsmaNetDevice::GetAddress (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
return m_address;
|
||||
}
|
||||
|
||||
bool
|
||||
bool
|
||||
CsmaNetDevice::IsLinkUp (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
return m_linkUp;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
CsmaNetDevice::AddLinkChangeCallback (Callback<void> callback)
|
||||
{
|
||||
NS_LOG_FUNCTION (&callback);
|
||||
m_linkChangeCallbacks.ConnectWithoutContext (callback);
|
||||
}
|
||||
|
||||
bool
|
||||
bool
|
||||
CsmaNetDevice::IsBroadcast (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
return true;
|
||||
}
|
||||
|
||||
Address
|
||||
Address
|
||||
CsmaNetDevice::GetBroadcast (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
return Mac48Address ("ff:ff:ff:ff:ff:ff");
|
||||
}
|
||||
|
||||
bool
|
||||
bool
|
||||
CsmaNetDevice::IsMulticast (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
return true;
|
||||
}
|
||||
|
||||
Address
|
||||
Address
|
||||
CsmaNetDevice::GetMulticast (Ipv4Address multicastGroup) const
|
||||
{
|
||||
NS_LOG_FUNCTION (multicastGroup);
|
||||
@@ -889,28 +889,28 @@ CsmaNetDevice::GetMulticast (Ipv4Address multicastGroup) const
|
||||
return ad;
|
||||
}
|
||||
|
||||
bool
|
||||
bool
|
||||
CsmaNetDevice::IsPointToPoint (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
bool
|
||||
CsmaNetDevice::IsBridge (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
bool
|
||||
CsmaNetDevice::Send (Ptr<Packet> packet,const Address& dest, uint16_t protocolNumber)
|
||||
{
|
||||
NS_LOG_FUNCTION (packet << dest << protocolNumber);
|
||||
return SendFrom (packet, m_address, dest, protocolNumber);
|
||||
}
|
||||
|
||||
bool
|
||||
bool
|
||||
CsmaNetDevice::SendFrom (Ptr<Packet> packet, const Address& src, const Address& dest, uint16_t protocolNumber)
|
||||
{
|
||||
NS_LOG_FUNCTION (packet << src << dest << protocolNumber);
|
||||
@@ -963,14 +963,14 @@ CsmaNetDevice::SendFrom (Ptr<Packet> packet, const Address& src, const Address&
|
||||
return true;
|
||||
}
|
||||
|
||||
Ptr<Node>
|
||||
Ptr<Node>
|
||||
CsmaNetDevice::GetNode (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
return m_node;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
CsmaNetDevice::SetNode (Ptr<Node> node)
|
||||
{
|
||||
NS_LOG_FUNCTION (node);
|
||||
@@ -978,14 +978,14 @@ CsmaNetDevice::SetNode (Ptr<Node> node)
|
||||
m_node = node;
|
||||
}
|
||||
|
||||
bool
|
||||
bool
|
||||
CsmaNetDevice::NeedsArp (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
CsmaNetDevice::SetReceiveCallback (NetDevice::ReceiveCallback cb)
|
||||
{
|
||||
NS_LOG_FUNCTION (&cb);
|
||||
@@ -1000,14 +1000,14 @@ Address CsmaNetDevice::GetMulticast (Ipv6Address addr) const
|
||||
return ad;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
CsmaNetDevice::SetPromiscReceiveCallback (NetDevice::PromiscReceiveCallback cb)
|
||||
{
|
||||
NS_LOG_FUNCTION (&cb);
|
||||
m_promiscRxCallback = cb;
|
||||
}
|
||||
|
||||
bool
|
||||
bool
|
||||
CsmaNetDevice::SupportsSendFrom () const
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
enum EncapsulationMode {
|
||||
ILLEGAL, /**< Encapsulation mode not set */
|
||||
DIX, /**< DIX II / Ethernet II packet */
|
||||
LLC, /**< 802.2 LLC/SNAP Packet*/
|
||||
LLC, /**< 802.2 LLC/SNAP Packet*/
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -98,7 +98,7 @@ public:
|
||||
* \param ceiling Cap on the exponential function when calculating max slots
|
||||
*/
|
||||
void SetBackoffParams (Time slotTime, uint32_t minSlots, uint32_t maxSlots,
|
||||
uint32_t maxRetries, uint32_t ceiling);
|
||||
uint32_t maxRetries, uint32_t ceiling);
|
||||
|
||||
/**
|
||||
* Attach the device to a channel.
|
||||
@@ -116,7 +116,7 @@ public:
|
||||
*
|
||||
* The CsmaNetDevice "owns" a queue. This queue may be set by higher
|
||||
* level topology objects to implement a particular queueing method such as
|
||||
* DropTail or RED.
|
||||
* DropTail or RED.
|
||||
*
|
||||
* \see Queue
|
||||
* \see DropTailQueue
|
||||
@@ -259,7 +259,7 @@ public:
|
||||
* \return true if successfull, false otherwise (drop, ...)
|
||||
*/
|
||||
virtual bool Send (Ptr<Packet> packet, const Address& dest,
|
||||
uint16_t protocolNumber);
|
||||
uint16_t protocolNumber);
|
||||
|
||||
/**
|
||||
* Start sending a packet down the channel, with MAC spoofing
|
||||
@@ -445,19 +445,19 @@ private:
|
||||
* Enumeration of the states of the transmit machine of the net device.
|
||||
*/
|
||||
enum TxMachineState
|
||||
{
|
||||
READY, /**< The transmitter is ready to begin transmission of a packet */
|
||||
BUSY, /**< The transmitter is busy transmitting a packet */
|
||||
GAP, /**< The transmitter is in the interframe gap time */
|
||||
BACKOFF /**< The transmitter is waiting for the channel to be free */
|
||||
};
|
||||
{
|
||||
READY, /**< The transmitter is ready to begin transmission of a packet */
|
||||
BUSY, /**< The transmitter is busy transmitting a packet */
|
||||
GAP, /**< The transmitter is in the interframe gap time */
|
||||
BACKOFF /**< The transmitter is waiting for the channel to be free */
|
||||
};
|
||||
|
||||
/**
|
||||
* The state of the Net Device transmit state machine.
|
||||
* \see TxMachineState
|
||||
*/
|
||||
TxMachineState m_txMachineState;
|
||||
|
||||
|
||||
/**
|
||||
* The type of packet that should be created by the AddHeader
|
||||
* function and that should be processed by the ProcessHeader
|
||||
|
||||
Reference in new issue
Block a user