point-to-point coding style changes

This commit is contained in:
Josh Pelkey committed 2011-05-13 14:58:47 -04:00
1 parent 268e6b6e13
commit 108e5fb30c
9 files changed
+90 -89

No files matched your search

@@ -106,7 +106,7 @@ main (int argc, char *argv[])
UintegerValue limit;
dtq->GetAttribute ("MaxPackets", limit);
NS_LOG_INFO ("1. dtq limit: " << limit.Get () << " packets");
// Note that the above downcast is not really needed; we could have
// done the same using the Ptr<Queue> even though the attribute
// is a member of the subclass
@@ -124,7 +124,7 @@ main (int argc, char *argv[])
// namespace. Here, this attribute resides on a known path in this
// namespace; this approach is useful if one doesn't have access to
// the underlying pointers and would like to configure a specific
// attribute with a single statement.
// attribute with a single statement.
Config::Set ("/NodeList/0/DeviceList/0/TxQueue/MaxPackets", UintegerValue (25));
txQueue->GetAttribute ("MaxPackets", limit);
NS_LOG_INFO ("4. txQueue limit changed through namespace: " <<
@@ -265,7 +265,7 @@ PointToPointHelper::Install (Ptr<Node> a, Ptr<Node> b)
devA->AggregateObject (mpiRecA);
devB->AggregateObject (mpiRecB);
}
devA->Attach (channel);
devB->Attach (channel);
container.Add (devA);
@@ -172,10 +172,10 @@ private:
* \param nd Net device for which you want to enable tracing.
*/
virtual void EnableAsciiInternal (
Ptr<OutputStreamWrapper> stream,
std::string prefix,
Ptr<NetDevice> nd,
bool explicitFilename);
Ptr<OutputStreamWrapper> stream,
std::string prefix,
Ptr<NetDevice> nd,
bool explicitFilename);
ObjectFactory m_queueFactory;
ObjectFactory m_channelFactory;
@@ -42,7 +42,7 @@ PointToPointChannel::GetTypeId (void)
.AddTraceSource ("TxRxPointToPoint",
"Trace source indicating transmission of packet from the PointToPointChannel, used by the Animation interface.",
MakeTraceSourceAccessor (&PointToPointChannel::m_txrxPointToPoint))
;
;
return tid;
}
@@ -50,10 +50,10 @@ PointToPointChannel::GetTypeId (void)
// By default, you get a channel that
// has an "infitely" fast transmission speed and zero delay.
PointToPointChannel::PointToPointChannel()
:
Channel (),
m_delay (Seconds (0.)),
m_nDevices (0)
:
Channel (),
m_delay (Seconds (0.)),
m_nDevices (0)
{
NS_LOG_FUNCTION_NOARGS ();
}
@@ -144,22 +144,22 @@ private:
> m_txrxPointToPoint;
enum WireState
{
INITIALIZING,
IDLE,
TRANSMITTING,
PROPAGATING
};
{
INITIALIZING,
IDLE,
TRANSMITTING,
PROPAGATING
};
class Link
{
public:
public:
Link() : m_state (INITIALIZING), m_src (0), m_dst (0) {}
WireState m_state;
Ptr<PointToPointNetDevice> m_src;
Ptr<PointToPointNetDevice> m_dst;
};
Link m_link[N_DEVICES];
};
@@ -46,7 +46,7 @@ PointToPointNetDevice::GetTypeId (void)
UintegerValue (DEFAULT_MTU),
MakeUintegerAccessor (&PointToPointNetDevice::SetMtu,
&PointToPointNetDevice::GetMtu),
MakeUintegerChecker<uint16_t> ())
MakeUintegerChecker<uint16_t> ())
.AddAttribute ("Address",
"The MAC address of this device.",
Mac48AddressValue (Mac48Address ("ff:ff:ff:ff:ff:ff")),
@@ -139,17 +139,17 @@ PointToPointNetDevice::GetTypeId (void)
.AddTraceSource ("PromiscSniffer",
"Trace source simulating a promiscuous packet sniffer attached to the device",
MakeTraceSourceAccessor (&PointToPointNetDevice::m_promiscSnifferTrace))
;
;
return tid;
}
PointToPointNetDevice::PointToPointNetDevice ()
:
m_txMachineState (READY),
m_channel (0),
m_linkUp (false),
m_currentPkt (0)
:
m_txMachineState (READY),
m_channel (0),
m_linkUp (false),
m_currentPkt (0)
{
NS_LOG_FUNCTION (this);
}
@@ -159,7 +159,7 @@ PointToPointNetDevice::~PointToPointNetDevice ()
NS_LOG_FUNCTION_NOARGS ();
}
void
void
PointToPointNetDevice::AddHeader(Ptr<Packet> p, uint16_t protocolNumber)
{
NS_LOG_FUNCTION_NOARGS ();
@@ -168,7 +168,7 @@ PointToPointNetDevice::AddHeader(Ptr<Packet> p, uint16_t protocolNumber)
p->AddHeader (ppp);
}
bool
bool
PointToPointNetDevice::ProcessHeader(Ptr<Packet> p, uint16_t& param)
{
NS_LOG_FUNCTION_NOARGS ();
@@ -178,7 +178,7 @@ PointToPointNetDevice::ProcessHeader(Ptr<Packet> p, uint16_t& param)
return true;
}
void
void
PointToPointNetDevice::DoDispose()
{
NS_LOG_FUNCTION_NOARGS ();
@@ -189,21 +189,21 @@ PointToPointNetDevice::DoDispose()
NetDevice::DoDispose ();
}
void
void
PointToPointNetDevice::SetDataRate(DataRate bps)
{
NS_LOG_FUNCTION_NOARGS ();
m_bps = bps;
}
void
void
PointToPointNetDevice::SetInterframeGap(Time t)
{
NS_LOG_FUNCTION_NOARGS ();
m_tInterframeGap = t;
}
bool
bool
PointToPointNetDevice::TransmitStart (Ptr<Packet> p)
{
NS_LOG_FUNCTION (this << p);
@@ -233,7 +233,7 @@ PointToPointNetDevice::TransmitStart (Ptr<Packet> p)
return result;
}
void
void
PointToPointNetDevice::TransmitComplete (void)
{
NS_LOG_FUNCTION_NOARGS ();
@@ -269,7 +269,7 @@ PointToPointNetDevice::TransmitComplete (void)
TransmitStart(p);
}
bool
bool
PointToPointNetDevice::Attach (Ptr<PointToPointChannel> ch)
{
NS_LOG_FUNCTION (this << &ch);
@@ -287,21 +287,21 @@ PointToPointNetDevice::Attach (Ptr<PointToPointChannel> ch)
return true;
}
void
void
PointToPointNetDevice::SetQueue (Ptr<Queue> q)
{
NS_LOG_FUNCTION (this << q);
m_queue = q;
}
void
void
PointToPointNetDevice::SetReceiveErrorModel (Ptr<ErrorModel> em)
{
NS_LOG_FUNCTION (this << em);
m_receiveErrorModel = em;
}
void
void
PointToPointNetDevice::Receive (Ptr<Packet> packet)
{
NS_LOG_FUNCTION (this << packet);
@@ -345,33 +345,33 @@ PointToPointNetDevice::Receive (Ptr<Packet> packet)
}
}
Ptr<Queue>
Ptr<Queue>
PointToPointNetDevice::GetQueue(void) const
{
NS_LOG_FUNCTION_NOARGS ();
return m_queue;
}
void
void
PointToPointNetDevice::NotifyLinkUp (void)
{
m_linkUp = true;
m_linkChangeCallbacks ();
}
void
void
PointToPointNetDevice::SetIfIndex(const uint32_t index)
{
m_ifIndex = index;
}
uint32_t
uint32_t
PointToPointNetDevice::GetIfIndex(void) const
{
return m_ifIndex;
}
Ptr<Channel>
Ptr<Channel>
PointToPointNetDevice::GetChannel (void) const
{
return m_channel;
@@ -383,25 +383,25 @@ PointToPointNetDevice::GetChannel (void) const
// methods to get and set the address. Rather than be rude and assert, we let
// clients get and set the address, but simply ignore them.
void
void
PointToPointNetDevice::SetAddress (Address address)
{
m_address = Mac48Address::ConvertFrom (address);
}
Address
Address
PointToPointNetDevice::GetAddress (void) const
{
return m_address;
}
bool
bool
PointToPointNetDevice::IsLinkUp (void) const
{
return m_linkUp;
}
void
void
PointToPointNetDevice::AddLinkChangeCallback (Callback<void> callback)
{
m_linkChangeCallbacks.ConnectWithoutContext (callback);
@@ -411,7 +411,7 @@ PointToPointNetDevice::AddLinkChangeCallback (Callback<void> callback)
// This is a point-to-point device, so every transmission is a broadcast to
// all of the devices on the network.
//
bool
bool
PointToPointNetDevice::IsBroadcast (void) const
{
return true;
@@ -422,19 +422,19 @@ PointToPointNetDevice::IsBroadcast (void) const
// point-to-point device. The base class NetDevice wants us to return a
// broadcast address, so we make up something reasonable.
//
Address
Address
PointToPointNetDevice::GetBroadcast (void) const
{
return Mac48Address ("ff:ff:ff:ff:ff:ff");
}
bool
bool
PointToPointNetDevice::IsMulticast (void) const
{
return true;
}
Address
Address
PointToPointNetDevice::GetMulticast (Ipv4Address multicastGroup) const
{
return Mac48Address ("01:00:5e:00:00:00");
@@ -447,19 +447,19 @@ PointToPointNetDevice::GetMulticast (Ipv6Address addr) const
return Mac48Address ("33:33:00:00:00:00");
}
bool
bool
PointToPointNetDevice::IsPointToPoint (void) const
{
return true;
}
bool
bool
PointToPointNetDevice::IsBridge (void) const
{
return false;
}
bool
bool
PointToPointNetDevice::Send(
Ptr<Packet> packet,
const Address &dest,
@@ -526,25 +526,25 @@ PointToPointNetDevice::SendFrom (Ptr<Packet> packet,
return false;
}
Ptr<Node>
Ptr<Node>
PointToPointNetDevice::GetNode (void) const
{
return m_node;
}
void
void
PointToPointNetDevice::SetNode (Ptr<Node> node)
{
m_node = node;
}
bool
bool
PointToPointNetDevice::NeedsArp (void) const
{
return false;
}
void
void
PointToPointNetDevice::SetReceiveCallback (NetDevice::ReceiveCallback cb)
{
m_rxCallback = cb;
@@ -556,7 +556,7 @@ PointToPointNetDevice::SetPromiscReceiveCallback (NetDevice::PromiscReceiveCallb
m_promiscCallback = cb;
}
bool
bool
PointToPointNetDevice::SupportsSendFrom (void) const
{
return false;
@@ -585,7 +585,7 @@ PointToPointNetDevice::GetRemote (void) const
return Address ();
}
bool
bool
PointToPointNetDevice::SetMtu (uint16_t mtu)
{
NS_LOG_FUNCTION (this << mtu);
@@ -593,33 +593,33 @@ PointToPointNetDevice::SetMtu (uint16_t mtu)
return true;
}
uint16_t
uint16_t
PointToPointNetDevice::GetMtu (void) const
{
NS_LOG_FUNCTION_NOARGS ();
return m_mtu;
}
uint16_t
uint16_t
PointToPointNetDevice::PppToEther(uint16_t proto)
{
switch(proto)
{
case 0x0021: return 0x0800; //IPv4
case 0x0057: return 0x86DD; //IPv6
default: NS_ASSERT_MSG(false, "PPP Protocol number not defined!");
case 0x0021: return 0x0800; //IPv4
case 0x0057: return 0x86DD; //IPv6
default: NS_ASSERT_MSG(false, "PPP Protocol number not defined!");
}
return 0;
}
uint16_t
uint16_t
PointToPointNetDevice::EtherToPpp(uint16_t proto)
{
switch(proto)
{
case 0x0800: return 0x0021; //IPv4
case 0x86DD: return 0x0057; //IPv6
default: NS_ASSERT_MSG(false, "PPP Protocol number not defined!");
case 0x0800: return 0x0021; //IPv4
case 0x86DD: return 0x0057; //IPv6
default: NS_ASSERT_MSG(false, "PPP Protocol number not defined!");
}
return 0;
}
@@ -44,7 +44,7 @@ class ErrorModel;
* This PointToPointNetDevice class specializes the NetDevice abstract
* base class. Together with a PointToPointChannel (and a peer
* PointToPointNetDevice), the class models, with some level of
* abstraction, a generic point-to-point or serial link.
* abstraction, a generic point-to-point or serial link.
* Key parameters or objects that can be specified for this device
* include a queue, data rate, and interframe transmission gap (the
* propagation delay is set in the PointToPointChannel).
@@ -99,7 +99,7 @@ public:
* Attach a queue to the PointToPointNetDevice.
*
* The PointToPointNetDevice "owns" a queue that implements a queueing
* method such as DropTail or RED.
* method such as DropTail or RED.
*
* @see Queue
* @see DropTailQueue
@@ -139,7 +139,7 @@ public:
void Receive (Ptr<Packet> p);
// The remaining methods are documented in ns3::NetDevice*
virtual void SetIfIndex(const uint32_t index);
virtual uint32_t GetIfIndex(void) const;
@@ -246,10 +246,10 @@ 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 */
};
{
READY, /**< The transmitter is ready to begin transmission of a packet */
BUSY /**< The transmitter is busy transmitting a packet */
};
/**
* The state of the Net Device transmit state machine.
* @see TxMachineState
@@ -346,7 +346,7 @@ private:
/**
* The trace source fired when a packet ends the transmission process on
* the medium.
* the medium.
*
* \see class CallBackTraceSource
*/
+11 -11
View File
@@ -37,17 +37,17 @@ PppHeader::~PppHeader ()
{
}
TypeId
TypeId
PppHeader::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::PppHeader")
.SetParent<Header> ()
.AddConstructor<PppHeader> ()
;
;
return tid;
}
TypeId
TypeId
PppHeader::GetInstanceTypeId (void) const
{
return GetTypeId ();
@@ -57,9 +57,9 @@ void
PppHeader::Print (std::ostream &os) const
{
std::string proto;
switch(m_protocol)
{
{
case 0x0021: /* IPv4 */
proto = "IP (0x0021)";
break;
@@ -68,36 +68,36 @@ PppHeader::Print (std::ostream &os) const
break;
default:
NS_ASSERT_MSG(false, "PPP Protocol number not defined!");
}
}
os << "Point-to-Point Protocol: " << proto;
}
uint32_t
uint32_t
PppHeader::GetSerializedSize (void) const
{
return 2;
}
void
void
PppHeader::Serialize (Buffer::Iterator start) const
{
start.WriteHtonU16 (m_protocol);
}
uint32_t
uint32_t
PppHeader::Deserialize (Buffer::Iterator start)
{
m_protocol = start.ReadNtohU16 ();
return GetSerializedSize();
}
void
void
PppHeader::SetProtocol (uint16_t protocol)
{
m_protocol=protocol;
}
uint16_t
uint16_t
PppHeader::GetProtocol (void)
{
return m_protocol;
@@ -19,7 +19,8 @@ private:
PointToPointTest::PointToPointTest ()
: TestCase ("PointToPoint")
{}
{
}
void
PointToPointTest::SendOnePacket (Ptr<PointToPointNetDevice> device)