diff --git a/src/click/examples/nsclick-raw-wlan.cc b/src/click/examples/nsclick-raw-wlan.cc index 06ae094a0..9cffe043a 100644 --- a/src/click/examples/nsclick-raw-wlan.cc +++ b/src/click/examples/nsclick-raw-wlan.cc @@ -21,7 +21,7 @@ // // (Click) (non-Click) // A ))) WLAN ((( B -// (172.16.1.1) (172.16.1.2) +// (172.16.1.1) (172.16.1.2) // (eth0) // @@ -45,7 +45,7 @@ int main (int argc, char *argv[]) { #ifdef NS3_CLICK double rss = -80; - Time interPacketInterval = Seconds(1.0); + Time interPacketInterval = Seconds (1.0); // Setup nodes NodeContainer wifiNodes; @@ -77,14 +77,14 @@ int main (int argc, char *argv[]) wifiChannel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel"); // The below FixedRssLossModel will cause the rss to be fixed regardless // of the distance between the two stations, and the transmit power - wifiChannel.AddPropagationLoss ("ns3::FixedRssLossModel","Rss",DoubleValue(rss)); + wifiChannel.AddPropagationLoss ("ns3::FixedRssLossModel","Rss",DoubleValue (rss)); wifiPhy.SetChannel (wifiChannel.Create ()); // Add a non-QoS upper mac, and disable rate control NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default (); wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", - "DataMode",StringValue(phyMode), - "ControlMode",StringValue(phyMode)); + "DataMode",StringValue (phyMode), + "ControlMode",StringValue (phyMode)); // Set it to adhoc mode wifiMac.SetType ("ns3::AdhocWifiMac"); NetDeviceContainer wifiDevices = wifi.Install (wifiPhy, wifiMac, wifiNodes); @@ -96,7 +96,7 @@ int main (int argc, char *argv[]) positionAlloc->Add (Vector (5.0, 0.0, 0.0)); mobility.SetPositionAllocator (positionAlloc); mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); - mobility.Install (wifiNodes); + mobility.Install (wifiNodes); // Install normal internet stack on node B InternetStackHelper internet; @@ -105,7 +105,7 @@ int main (int argc, char *argv[]) // Install Click on node A ClickInternetStackHelper clickinternet; clickinternet.SetClickFile (wifiNodes.Get (0), "src/click/examples/nsclick-wifi-single-interface.click"); - clickinternet.SetRoutingTableElement(wifiNodes.Get (0), "rt"); + clickinternet.SetRoutingTableElement (wifiNodes.Get (0), "rt"); clickinternet.Install (wifiNodes.Get (0)); // Configure IP addresses @@ -136,8 +136,8 @@ int main (int argc, char *argv[]) // For tracing wifiPhy.EnablePcap ("nsclick-raw-wlan", wifiDevices); - Simulator::Stop (Seconds(20.0)); - Simulator::Run(); + Simulator::Stop (Seconds (20.0)); + Simulator::Run (); return 0; #else NS_FATAL_ERROR ("Can't use ns-3-click without NSCLICK compiled in"); diff --git a/src/click/examples/nsclick-routing.cc b/src/click/examples/nsclick-routing.cc index a5b1e8652..0b1d9cace 100644 --- a/src/click/examples/nsclick-routing.cc +++ b/src/click/examples/nsclick-routing.cc @@ -77,7 +77,7 @@ main (int argc, char *argv[]) // Explicitly create the channels required by the topology (shown above). // CsmaHelper csma; - csma.SetChannelAttribute ("DataRate", DataRateValue (DataRate(5000000))); + csma.SetChannelAttribute ("DataRate", DataRateValue (DataRate (5000000))); csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2))); csma.SetDeviceAttribute ("Mtu", UintegerValue (1400)); NetDeviceContainer d01 = csma.Install (NodeContainer (n.Get (0), n.Get (1))); @@ -100,7 +100,7 @@ main (int argc, char *argv[]) // uint16_t port = 4000; UdpServerHelper server (port); - ApplicationContainer apps = server.Install (n.Get(2)); + ApplicationContainer apps = server.Install (n.Get (2)); apps.Start (Seconds (1.0)); apps.Stop (Seconds (10.0)); @@ -126,7 +126,7 @@ main (int argc, char *argv[]) // Now, do the actual simulation. // NS_LOG_INFO ("Run Simulation."); - Simulator::Stop (Seconds(20.0)); + Simulator::Stop (Seconds (20.0)); Simulator::Run (); Simulator::Destroy (); NS_LOG_INFO ("Done."); diff --git a/src/click/examples/nsclick-simple-lan.cc b/src/click/examples/nsclick-simple-lan.cc index 2defb6356..b5dd6e5ce 100644 --- a/src/click/examples/nsclick-simple-lan.cc +++ b/src/click/examples/nsclick-simple-lan.cc @@ -20,7 +20,7 @@ // // (Click) CSMA (non-Click) // A ================ B -// (172.16.1.1) (172.16.1.2) +// (172.16.1.1) (172.16.1.2) // (eth0) // // @@ -90,8 +90,8 @@ int main (int argc, char *argv[]) // For tracing csma.EnablePcap ("nsclick-simple-lan", csmaDevices, false); - Simulator::Stop (Seconds(20.0)); - Simulator::Run(); + Simulator::Stop (Seconds (20.0)); + Simulator::Run (); return 0; #else NS_FATAL_ERROR ("Can't use ns-3-click without NSCLICK compiled in"); diff --git a/src/click/examples/nsclick-udp-client-server-csma.cc b/src/click/examples/nsclick-udp-client-server-csma.cc index 01bab31da..e1699cb0d 100644 --- a/src/click/examples/nsclick-udp-client-server-csma.cc +++ b/src/click/examples/nsclick-udp-client-server-csma.cc @@ -66,7 +66,7 @@ main (int argc, char *argv[]) // Explicitly create the channels required by the topology (shown above). // CsmaHelper csma; - csma.SetChannelAttribute ("DataRate", DataRateValue (DataRate(5000000))); + csma.SetChannelAttribute ("DataRate", DataRateValue (DataRate (5000000))); csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2))); csma.SetDeviceAttribute ("Mtu", UintegerValue (1400)); NetDeviceContainer d = csma.Install (n); @@ -93,7 +93,7 @@ main (int argc, char *argv[]) // uint16_t port = 4000; UdpServerHelper server (port); - ApplicationContainer apps = server.Install (n.Get(1)); + ApplicationContainer apps = server.Install (n.Get (1)); apps.Start (Seconds (1.0)); apps.Stop (Seconds (10.0)); @@ -118,7 +118,7 @@ main (int argc, char *argv[]) // Now, do the actual simulation. // NS_LOG_INFO ("Run Simulation."); - Simulator::Stop (Seconds(20.0)); + Simulator::Stop (Seconds (20.0)); Simulator::Run (); Simulator::Destroy (); NS_LOG_INFO ("Done."); diff --git a/src/click/examples/nsclick-udp-client-server-wifi.cc b/src/click/examples/nsclick-udp-client-server-wifi.cc index a47ebbfbf..319974876 100644 --- a/src/click/examples/nsclick-udp-client-server-wifi.cc +++ b/src/click/examples/nsclick-udp-client-server-wifi.cc @@ -46,18 +46,18 @@ NS_LOG_COMPONENT_DEFINE ("NsclickUdpClientServerWifi"); #ifdef NS3_CLICK void -readArp(Ptr clickRouter) +readArp (Ptr clickRouter) { // Access the handlers - NS_LOG_INFO(clickRouter->ReadHandler ("wifi/arpquerier", "table")); - NS_LOG_INFO(clickRouter->ReadHandler ("wifi/arpquerier", "stats")); + NS_LOG_INFO (clickRouter->ReadHandler ("wifi/arpquerier", "table")); + NS_LOG_INFO (clickRouter->ReadHandler ("wifi/arpquerier", "stats")); } void -writeArp(Ptr clickRouter) +writeArp (Ptr clickRouter) { // Access the handler - NS_LOG_INFO(clickRouter->WriteHandler ("wifi/arpquerier", "insert", "172.16.1.2 00:00:00:00:00:02")); + NS_LOG_INFO (clickRouter->WriteHandler ("wifi/arpquerier", "insert", "172.16.1.2 00:00:00:00:00:02")); } #endif @@ -106,17 +106,17 @@ main (int argc, char *argv[]) wifiChannel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel"); // The below FixedRssLossModel will cause the rss to be fixed regardless // of the distance between the two stations, and the transmit power - wifiChannel.AddPropagationLoss ("ns3::FixedRssLossModel","Rss",DoubleValue(-80)); + wifiChannel.AddPropagationLoss ("ns3::FixedRssLossModel","Rss",DoubleValue (-80)); wifiPhy.SetChannel (wifiChannel.Create ()); // Add a non-QoS upper mac, and disable rate control NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default (); wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", - "DataMode",StringValue(phyMode), - "ControlMode",StringValue(phyMode)); + "DataMode",StringValue (phyMode), + "ControlMode",StringValue (phyMode)); // Set it to adhoc mode wifiMac.SetType ("ns3::AdhocWifiMac"); - NetDeviceContainer d = wifi.Install (wifiPhy, wifiMac, n); + NetDeviceContainer d = wifi.Install (wifiPhy, wifiMac, n); MobilityHelper mobility; Ptr positionAlloc = CreateObject (); @@ -140,7 +140,7 @@ main (int argc, char *argv[]) // been added ahead of the official Wifi support // for promiscuous mode. Thus, the below line will // not work until then. - n.Get(3)->GetObject()->SetPromiscuous ("eth0"); + n.Get (3)->GetObject ()->SetPromiscuous ("eth0"); Ipv4AddressHelper ipv4; // @@ -156,7 +156,7 @@ main (int argc, char *argv[]) // uint16_t port = 4000; UdpServerHelper server (port); - ApplicationContainer apps = server.Install (n.Get(1)); + ApplicationContainer apps = server.Install (n.Get (1)); apps.Start (Seconds (1.0)); apps.Stop (Seconds (10.0)); @@ -184,15 +184,15 @@ main (int argc, char *argv[]) // requests of node 3 are lost due to interference from node // 1. Hence, we fill in the ARP table of node 2 before at the // beginning of the simulation - Simulator::Schedule (Seconds (0.5), &readArp,n.Get(2)->GetObject()); - Simulator::Schedule (Seconds (0.6), &writeArp,n.Get(2)->GetObject()); - Simulator::Schedule (Seconds (0.7), &readArp,n.Get(2)->GetObject()); + Simulator::Schedule (Seconds (0.5), &readArp,n.Get (2)->GetObject ()); + Simulator::Schedule (Seconds (0.6), &writeArp,n.Get (2)->GetObject ()); + Simulator::Schedule (Seconds (0.7), &readArp,n.Get (2)->GetObject ()); // // Now, do the actual simulation. // NS_LOG_INFO ("Run Simulation."); - Simulator::Stop (Seconds(20.0)); + Simulator::Stop (Seconds (20.0)); Simulator::Run (); Simulator::Destroy (); NS_LOG_INFO ("Done."); diff --git a/src/click/helper/click-internet-stack-helper.cc b/src/click/helper/click-internet-stack-helper.cc index b3d3f41d6..b3f793f85 100644 --- a/src/click/helper/click-internet-stack-helper.cc +++ b/src/click/helper/click-internet-stack-helper.cc @@ -49,7 +49,7 @@ namespace ns3 { #define INTERFACE_CONTEXT -typedef std::pair, uint32_t> InterfacePairIpv4; +typedef std::pair, uint32_t> InterfacePairIpv4; typedef std::map > InterfaceFileMapIpv4; typedef std::map > InterfaceStreamMapIpv4; @@ -102,7 +102,7 @@ ClickInternetStackHelper::SetTcp (const std::string tid) m_tcpFactory.SetTypeId (tid); } -void +void ClickInternetStackHelper::SetTcp (std::string tid, std::string n0, const AttributeValue &v0) { m_tcpFactory.SetTypeId (tid); @@ -139,7 +139,7 @@ ClickInternetStackHelper::SetRoutingTableElement (Ptr node, std::string rt m_nodeToRoutingTableElementMap.insert (std::make_pair (node, rt)); } -void +void ClickInternetStackHelper::Install (NodeContainer c) const { for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i) @@ -148,7 +148,7 @@ ClickInternetStackHelper::Install (NodeContainer c) const } } -void +void ClickInternetStackHelper::InstallAll (void) const { Install (NodeContainer::GetGlobal ()); @@ -170,7 +170,7 @@ ClickInternetStackHelper::Install (Ptr node) const { if (node->GetObject () != 0) { - NS_FATAL_ERROR ("ClickInternetStackHelper::Install (): Aggregating " + NS_FATAL_ERROR ("ClickInternetStackHelper::Install (): Aggregating " "an InternetStack to a node with an existing Ipv4 object"); return; } @@ -218,7 +218,7 @@ Ipv4L3ProtocolRxTxSink (Ptr p, Ptr ipv4, uint32_t interface) // // Since trace sources are independent of interface, if we hook a source // on a particular protocol we will get traces for all of its interfaces. - // We need to filter this to only report interfaces for which the user + // We need to filter this to only report interfaces for which the user // has expressed interest. // InterfacePairIpv4 pair = std::make_pair (ipv4, interface); @@ -229,14 +229,14 @@ Ipv4L3ProtocolRxTxSink (Ptr p, Ptr ipv4, uint32_t interface) } Ptr file = g_interfaceFileMapIpv4[pair]; - file->Write(Simulator::Now(), p); + file->Write (Simulator::Now (), p); } bool ClickInternetStackHelper::PcapHooked (Ptr ipv4) { - for ( InterfaceFileMapIpv4::const_iterator i = g_interfaceFileMapIpv4.begin (); - i != g_interfaceFileMapIpv4.end (); + for ( InterfaceFileMapIpv4::const_iterator i = g_interfaceFileMapIpv4.begin (); + i != g_interfaceFileMapIpv4.end (); ++i) { if ((*i).first.first == ipv4) @@ -247,7 +247,7 @@ ClickInternetStackHelper::PcapHooked (Ptr ipv4) return false; } -void +void ClickInternetStackHelper::EnablePcapIpv4Internal (std::string prefix, Ptr ipv4, uint32_t interface, bool explicitFilename) { NS_LOG_FUNCTION (prefix << ipv4 << interface); @@ -259,7 +259,7 @@ ClickInternetStackHelper::EnablePcapIpv4Internal (std::string prefix, Ptr } // - // We have to create a file and a mapping from protocol/interface to file + // We have to create a file and a mapping from protocol/interface to file // irrespective of how many times we want to trace a particular protocol. // PcapHelper pcapHelper; @@ -283,7 +283,7 @@ ClickInternetStackHelper::EnablePcapIpv4Internal (std::string prefix, Ptr if (!PcapHooked (ipv4)) { // - // Ptr is aggregated to node and Ipv4L3Protocol is aggregated to + // Ptr is aggregated to node and Ipv4L3Protocol is aggregated to // node so we can get to Ipv4L3Protocol through Ipv4. // Ptr ipv4L3Protocol = ipv4->GetObject (); @@ -305,16 +305,16 @@ ClickInternetStackHelper::EnablePcapIpv4Internal (std::string prefix, Ptr static void Ipv4L3ProtocolDropSinkWithoutContext ( Ptr stream, - Ipv4Header const &header, + Ipv4Header const &header, Ptr packet, - Ipv4L3Protocol::DropReason reason, - Ptr ipv4, + Ipv4L3Protocol::DropReason reason, + Ptr ipv4, uint32_t interface) { // // Since trace sources are independent of interface, if we hook a source // on a particular protocol we will get traces for all of its interfaces. - // We need to filter this to only report interfaces for which the user + // We need to filter this to only report interfaces for which the user // has expressed interest. // InterfacePairIpv4 pair = std::make_pair (ipv4, interface); @@ -333,16 +333,16 @@ static void Ipv4L3ProtocolDropSinkWithContext ( Ptr stream, std::string context, - Ipv4Header const &header, + Ipv4Header const &header, Ptr packet, - Ipv4L3Protocol::DropReason reason, - Ptr ipv4, + Ipv4L3Protocol::DropReason reason, + Ptr ipv4, uint32_t interface) { // // Since trace sources are independent of interface, if we hook a source // on a particular protocol we will get traces for all of its interfaces. - // We need to filter this to only report interfaces for which the user + // We need to filter this to only report interfaces for which the user // has expressed interest. // InterfacePairIpv4 pair = std::make_pair (ipv4, interface); @@ -355,7 +355,7 @@ Ipv4L3ProtocolDropSinkWithContext ( Ptr p = packet->Copy (); p->AddHeader (header); #ifdef INTERFACE_CONTEXT - *stream->GetStream () << "d " << Simulator::Now ().GetSeconds () << " " << context << "(" << interface << ") " + *stream->GetStream () << "d " << Simulator::Now ().GetSeconds () << " " << context << "(" << interface << ") " << *p << std::endl; #else *stream->GetStream () << "d " << Simulator::Now ().GetSeconds () << " " << context << " " << *p << std::endl; @@ -365,8 +365,8 @@ Ipv4L3ProtocolDropSinkWithContext ( bool ClickInternetStackHelper::AsciiHooked (Ptr ipv4) { - for ( InterfaceStreamMapIpv4::const_iterator i = g_interfaceStreamMapIpv4.begin (); - i != g_interfaceStreamMapIpv4.end (); + for ( InterfaceStreamMapIpv4::const_iterator i = g_interfaceStreamMapIpv4.begin (); + i != g_interfaceStreamMapIpv4.end (); ++i) { if ((*i).first.first == ipv4) @@ -377,11 +377,11 @@ ClickInternetStackHelper::AsciiHooked (Ptr ipv4) return false; } -void +void ClickInternetStackHelper::EnableAsciiIpv4Internal ( - Ptr stream, - std::string prefix, - Ptr ipv4, + Ptr stream, + std::string prefix, + Ptr ipv4, uint32_t interface, bool explicitFilename) { @@ -392,13 +392,13 @@ ClickInternetStackHelper::EnableAsciiIpv4Internal ( } // - // Our trace sinks are going to use packet printing, so we have to + // Our trace sinks are going to use packet printing, so we have to // make sure that is turned on. // Packet::EnablePrinting (); // - // If we are not provided an OutputStreamWrapper, we are expected to create + // If we are not provided an OutputStreamWrapper, we are expected to create // one using the usual trace filename conventions and hook WithoutContext // since there will be one file per context and therefore the context would // be redundant. @@ -406,12 +406,12 @@ ClickInternetStackHelper::EnableAsciiIpv4Internal ( if (stream == 0) { // - // Set up an output stream object to deal with private ofstream copy + // Set up an output stream object to deal with private ofstream copy // constructor and lifetime issues. Let the helper decide the actual // name of the file given the prefix. // - // We have to create a stream and a mapping from protocol/interface to - // stream irrespective of how many times we want to trace a particular + // We have to create a stream and a mapping from protocol/interface to + // stream irrespective of how many times we want to trace a particular // protocol. // AsciiTraceHelper asciiTraceHelper; @@ -445,11 +445,11 @@ ClickInternetStackHelper::EnableAsciiIpv4Internal ( // // The drop sink for the Ipv4L3Protocol uses a different signature than // the default sink, so we have to cook one up for ourselves. We can get - // to the Ptr through our Ptr since they must both + // to the Ptr through our Ptr since they must both // be aggregated to the same node. // Ptr ipv4L3Protocol = ipv4->GetObject (); - bool __attribute__ ((unused)) result = ipv4L3Protocol->TraceConnectWithoutContext ("Drop", + bool __attribute__ ((unused)) result = ipv4L3Protocol->TraceConnectWithoutContext ("Drop", MakeBoundCallback (&Ipv4L3ProtocolDropSinkWithoutContext, theStream)); NS_ASSERT_MSG (result == true, "ClickInternetStackHelper::EanableAsciiIpv4Internal(): " @@ -463,12 +463,12 @@ ClickInternetStackHelper::EnableAsciiIpv4Internal ( // // If we are provided an OutputStreamWrapper, we are expected to use it, and // to provide a context. We are free to come up with our own context if we - // want, and use the AsciiTraceHelper Hook*WithContext functions, but for + // want, and use the AsciiTraceHelper Hook*WithContext functions, but for // compatibility and simplicity, we just use Config::Connect and let it deal // with the context. // // We need to associate the ipv4/interface with a stream to express interest - // in tracing events on that pair, however, we only hook the trace sources + // in tracing events on that pair, however, we only hook the trace sources // once to avoid multiple trace sink calls per event (connect is independent // of interface). // @@ -478,9 +478,9 @@ ClickInternetStackHelper::EnableAsciiIpv4Internal ( std::ostringstream oss; // - // For the ARP Drop, we are going to use the default trace sink provided by - // the ascii trace helper. There is actually no AsciiTraceHelper in sight - // here, but the default trace sinks are actually publicly available static + // For the ARP Drop, we are going to use the default trace sink provided by + // the ascii trace helper. There is actually no AsciiTraceHelper in sight + // here, but the default trace sinks are actually publicly available static // functions that are always there waiting for just such a case. // oss << "/NodeList/" << node->GetId () << "/$ns3::ArpL3Protocol/Drop"; diff --git a/src/click/helper/click-internet-stack-helper.h b/src/click/helper/click-internet-stack-helper.h index 441500707..a01e4d7e0 100644 --- a/src/click/helper/click-internet-stack-helper.h +++ b/src/click/helper/click-internet-stack-helper.h @@ -46,18 +46,19 @@ class Ipv4RoutingHelper; * nodes will not be able to use Ipv6 functionalities. * */ -class ClickInternetStackHelper : public PcapHelperForIpv4, public AsciiTraceHelperForIpv4 +class ClickInternetStackHelper : public PcapHelperForIpv4, + public AsciiTraceHelperForIpv4 { public: /** * Create a new ClickInternetStackHelper which uses Ipv4ClickRouting for routing */ - ClickInternetStackHelper(void); + ClickInternetStackHelper (void); /** * Destroy the ClickInternetStackHelper */ - virtual ~ClickInternetStackHelper(void); + virtual ~ClickInternetStackHelper (void); ClickInternetStackHelper (const ClickInternetStackHelper &); ClickInternetStackHelper &operator = (const ClickInternetStackHelper &o); @@ -67,29 +68,29 @@ public: void Reset (void); /** - * Aggregate implementations of the ns3::Ipv4L3ClickProtocol, ns3::ArpL3Protocol, - * ns3::Udp, and ns3::Tcp classes onto the provided node. This method will + * Aggregate implementations of the ns3::Ipv4L3ClickProtocol, ns3::ArpL3Protocol, + * ns3::Udp, and ns3::Tcp classes onto the provided node. This method will * assert if called on a node that already has an Ipv4 object aggregated to it. - * + * * \param nodeName The name of the node on which to install the stack. */ void Install (std::string nodeName) const; /** * Aggregate implementations of the ns3::Ipv4L3ClickProtocol, ns3::ArpL3Protocol, - * ns3::Udp, and ns3::Tcp classes onto the provided node. This method will + * ns3::Udp, and ns3::Tcp classes onto the provided node. This method will * assert if called on a node that already has an Ipv4 object aggregated to it. - * + * * \param node The node on which to install the stack. */ void Install (Ptr node) const; /** - * For each node in the input container, aggregate implementations of the - * ns3::Ipv4L3ClickProtocol, ns3::ArpL3Protocol, ns3::Udp, and, ns3::Tcp classes. - * The program will assert if this method is called on a container with a + * For each node in the input container, aggregate implementations of the + * ns3::Ipv4L3ClickProtocol, ns3::ArpL3Protocol, ns3::Udp, and, ns3::Tcp classes. + * The program will assert if this method is called on a container with a * node that already has an Ipv4 object aggregated to it. - * + * * \param c NodeContainer that holds the set of nodes on which to install the * new stacks. */ @@ -103,7 +104,7 @@ public: /** * \brief set the Tcp stack which will not need any other parameter. * - * This function sets up the tcp stack to the given TypeId. It should not be + * This function sets up the tcp stack to the given TypeId. It should not be * used for NSC stack setup because the nsc stack needs the Library attribute * to be setup, please use instead the version that requires an attribute * and a value. If you choose to use this function anyways to set nsc stack @@ -111,21 +112,21 @@ public: * * \param tid the type id, typically it is set to "ns3::TcpL4Protocol" */ - void SetTcp(std::string tid); + void SetTcp (std::string tid); /** * \brief This function is used to setup the Network Simulation Cradle stack with library value. - * - * Give the NSC stack a shared library file name to use when creating the - * stack implementation. The attr string is actually the attribute name to - * be setup and val is its value. The attribute is the stack implementation + * + * Give the NSC stack a shared library file name to use when creating the + * stack implementation. The attr string is actually the attribute name to + * be setup and val is its value. The attribute is the stack implementation * to be used and the value is the shared library name. - * - * \param tid The type id, for the case of nsc it would be "ns3::NscTcpL4Protocol" + * + * \param tid The type id, for the case of nsc it would be "ns3::NscTcpL4Protocol" * \param attr The attribute name that must be setup, for example "Library" * \param val The attribute value, which will be in fact the shared library name (example:"liblinux2.6.26.so") */ - void SetTcp (std::string tid, std::string attr, const AttributeValue &val); + void SetTcp (std::string tid, std::string attr, const AttributeValue &val); /** * \brief Set a Click file to be used for a group of nodes. @@ -163,8 +164,8 @@ private: * @param ipv4 Ptr to the Ipv4 interface on which you want to enable tracing. * @param interface Interface ID on the Ipv4 on which you want to enable tracing. */ - virtual void EnablePcapIpv4Internal (std::string prefix, - Ptr ipv4, + virtual void EnablePcapIpv4Internal (std::string prefix, + Ptr ipv4, uint32_t interface, bool explicitFilename); @@ -178,9 +179,9 @@ private: * @param ipv4 Ptr to the Ipv4 interface on which you want to enable tracing. * @param interface Interface ID on the Ipv4 on which you want to enable tracing. */ - virtual void EnableAsciiIpv4Internal (Ptr stream, - std::string prefix, - Ptr ipv4, + virtual void EnableAsciiIpv4Internal (Ptr stream, + std::string prefix, + Ptr ipv4, uint32_t interface, bool explicitFilename); diff --git a/src/click/model/ipv4-click-routing.cc b/src/click/model/ipv4-click-routing.cc index 3f7e374dd..11e7bc8af 100644 --- a/src/click/model/ipv4-click-routing.cc +++ b/src/click/model/ipv4-click-routing.cc @@ -42,7 +42,7 @@ namespace ns3 { // Values from nsclick ExtRouter implementation #define INTERFACE_ID_KERNELTAP 0 #define INTERFACE_ID_FIRST 1 -#define INTERFACE_ID_FIRST_DROP 33 +#define INTERFACE_ID_FIRST_DROP 33 NS_OBJECT_ENSURE_REGISTERED (Ipv4ClickRouting); @@ -161,31 +161,31 @@ Ipv4ClickRouting::GetInterfaceId (const char *ifname) // corresponds to the interface ID that Click will use. // Tap/tun devices refer to the kernel devices - if (strstr(ifname, "tap") || strstr(ifname, "tun")) + if (strstr (ifname, "tap") || strstr (ifname, "tun")) { retval = 0; } - else if (const char *devname = strstr(ifname, "eth")) + else if (const char *devname = strstr (ifname, "eth")) { - while (*devname && !isdigit((unsigned char) *devname)) + while (*devname && !isdigit ((unsigned char) *devname)) { devname++; } if (*devname) { - retval = atoi(devname) + INTERFACE_ID_FIRST; + retval = atoi (devname) + INTERFACE_ID_FIRST; } } - else if (const char *devname = strstr(ifname, "drop")) + else if (const char *devname = strstr (ifname, "drop")) { - while (*devname && !isdigit((unsigned char) *devname)) + while (*devname && !isdigit ((unsigned char) *devname)) { devname++; } if (*devname) { - retval = atoi(devname) + INTERFACE_ID_FIRST_DROP; + retval = atoi (devname) + INTERFACE_ID_FIRST_DROP; } } @@ -230,7 +230,7 @@ Ipv4ClickRouting::GetMacAddressFromInterfaceId (int ifid) Ptr device = m_ipv4->GetNetDevice (ifid); Address devAddr = device->GetAddress (); - addr << Mac48Address::ConvertFrom(devAddr); + addr << Mac48Address::ConvertFrom (devAddr); return addr.str (); } @@ -261,7 +261,7 @@ Ipv4ClickRouting::HandleScheduleFromClick (const struct timeval *when) NS_LOG_DEBUG ("HandleScheduleFromClick at " << when->tv_sec << " " << when->tv_usec << " " << Simulator::Now ()); double simtime = when->tv_sec + (when->tv_usec / 1.0e6); - double simdelay = simtime - Simulator::Now ().GetMicroSeconds () / 1.0e6; + double simdelay = simtime - Simulator::Now ().GetMicroSeconds () / 1.0e6; Simulator::Schedule (Seconds (simdelay), &Ipv4ClickRouting::RunClickEvent, this); } @@ -269,7 +269,7 @@ Ipv4ClickRouting::HandleScheduleFromClick (const struct timeval *when) void Ipv4ClickRouting::HandlePacketFromClick (int ifid, int ptype, const unsigned char* data, int len) { - NS_LOG_DEBUG ("HandlePacketFromClick"); + NS_LOG_DEBUG ("HandlePacketFromClick"); // Figure out packet's destination here: // If ifid == 0, then the packet's going up @@ -288,7 +288,7 @@ Ipv4ClickRouting::HandlePacketFromClick (int ifid, int ptype, const unsigned cha } else if (ifid) { - NS_LOG_DEBUG ("Incoming packet from eth" << ifid - 1 << " of type " << ptype <<". Sending packet down the stack."); + NS_LOG_DEBUG ("Incoming packet from eth" << ifid - 1 << " of type " << ptype << ". Sending packet down the stack."); Ptr p = Create (data, len); @@ -309,7 +309,7 @@ Ipv4ClickRouting::SendPacketToClick (int ifid, int ptype, const unsigned char* d pinfo.id = 0; pinfo.fid = 0; - simclick_click_send(m_simNode,ifid,ptype,data,len,&pinfo); + simclick_click_send (m_simNode,ifid,ptype,data,len,&pinfo); } void @@ -360,7 +360,7 @@ Ipv4ClickRouting::Receive (Ptr p, Mac48Address receiverAddr, Mac48Addres uint8_t *buf = new uint8_t [len]; p->CopyData (buf, len); - //... and send the packet to the corresponding Click interface + // ... and send the packet to the corresponding Click interface SendPacketToClick (ifid, SIMCLICK_PTYPE_ETHER, buf, len); delete [] buf; @@ -391,7 +391,7 @@ void Ipv4ClickRouting::SetPromiscuous (std::string ifName) { Ptr ipv4l3 = DynamicCast (m_ipv4); - NS_ASSERT(ipv4l3); + NS_ASSERT (ipv4l3); // Interface ethN gets index 1+N, but netdevice will start at 0 // To ensure this, install a Click stack on a node only after // all NetDevices have been installed. @@ -420,7 +420,7 @@ Ipv4ClickRouting::RouteOutput (Ptr p, const Ipv4Header &header, Ptr (); rtentry->SetDestination (header.GetDestination ()); // the source address is the interface address that matches - // the destination address (when multiple are present on the + // the destination address (when multiple are present on the // outgoing interface, one is selected via scoping rules) NS_ASSERT (m_ipv4); uint32_t numOifAddresses = m_ipv4->GetNAddresses (interfaceId); @@ -438,10 +438,10 @@ Ipv4ClickRouting::RouteOutput (Ptr p, const Ipv4Header &header, PtrSetGateway (destination); rtentry->SetOutputDevice (m_ipv4->GetNetDevice (interfaceId)); sockerr = Socket::ERROR_NOTERROR; - NS_LOG_DEBUG ("Found route to " << rtentry->GetDestination () + NS_LOG_DEBUG ("Found route to " << rtentry->GetDestination () << " via nh " << rtentry->GetGateway () << " with source addr " << rtentry->GetSource () - << " and output dev " << rtentry->GetOutputDevice()); + << " and output dev " << rtentry->GetOutputDevice ()); } else { @@ -459,7 +459,7 @@ Ipv4ClickRouting::RouteOutput (Ptr p, const Ipv4Header &header, Ptr p, const Ipv4Header &header, Ptr idev, UnicastForwardCallback ucb, - MulticastForwardCallback mcb, LocalDeliverCallback lcb, + MulticastForwardCallback mcb, LocalDeliverCallback lcb, ErrorCallback ecb) { NS_FATAL_ERROR ("Click router does not have a RouteInput() interface!"); @@ -473,35 +473,39 @@ Ipv4ClickRouting::PrintRoutingTable (Ptr stream) const void Ipv4ClickRouting::NotifyInterfaceUp (uint32_t i) -{} +{ +} void Ipv4ClickRouting::NotifyInterfaceDown (uint32_t i) -{} +{ +} void Ipv4ClickRouting::NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address) -{} +{ +} void Ipv4ClickRouting::NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address) -{} +{ +} } // namespace ns3 -static int simstrlcpy(char *buf, int len, const std::string &s) +static int simstrlcpy (char *buf, int len, const std::string &s) { if (len) { len--; - if ((unsigned) len > s.length()) + if ((unsigned) len > s.length ()) { - len = s.length(); + len = s.length (); } - s.copy(buf, len); + s.copy (buf, len); buf[len] = '\0'; } return 0; @@ -509,11 +513,11 @@ static int simstrlcpy(char *buf, int len, const std::string &s) // Sends a Packet from Click to the Simulator: Defined in simclick.h. Click // calls these methods. -int simclick_sim_send(simclick_node_t *simnode, - int ifid, int type, const unsigned char* data, int len, - simclick_simpacketinfo *pinfo) +int simclick_sim_send (simclick_node_t *simnode, + int ifid, int type, const unsigned char* data, int len, + simclick_simpacketinfo *pinfo) { - NS_LOG_DEBUG ("simclick_sim_send called at " << ns3::Simulator::Now().GetSeconds()<<": " << ifid << " " << type << " " << data << " "<< len); + NS_LOG_DEBUG ("simclick_sim_send called at " << ns3::Simulator::Now ().GetSeconds () << ": " << ifid << " " << type << " " << data << " " << len); if (simnode == NULL) { @@ -528,7 +532,7 @@ int simclick_sim_send(simclick_node_t *simnode, } // Click Service Methods: Defined in simclick.h -int simclick_sim_command(simclick_node_t *simnode, int cmd, ...) +int simclick_sim_command (simclick_node_t *simnode, int cmd, ...) { va_list val; va_start (val, cmd); @@ -536,7 +540,7 @@ int simclick_sim_command(simclick_node_t *simnode, int cmd, ...) int retval = 0; ns3::Ptr clickInstance = ns3::Ipv4ClickRouting::GetClickInstanceFromSimNode (simnode); - switch (cmd) + switch (cmd) { case SIMCLICK_VERSION: { @@ -553,72 +557,72 @@ int simclick_sim_command(simclick_node_t *simnode, int cmd, ...) case SIMCLICK_IFID_FROM_NAME: { - const char *ifname = va_arg(val, const char *); + const char *ifname = va_arg (val, const char *); retval = clickInstance->GetInterfaceId (ifname); - + NS_LOG_DEBUG (clickInstance->GetNodeName () << " SIMCLICK_IFID_FROM_NAME: " << ifname << " " << retval); break; } case SIMCLICK_IPADDR_FROM_NAME: { - const char *ifname = va_arg(val, const char *); - char *buf = va_arg(val, char *); - int len = va_arg(val, int); + const char *ifname = va_arg (val, const char *); + char *buf = va_arg (val, char *); + int len = va_arg (val, int); int ifid = clickInstance->GetInterfaceId (ifname); if (ifid >= 0) { - retval = simstrlcpy(buf, len, clickInstance->GetIpAddressFromInterfaceId (ifid)); + retval = simstrlcpy (buf, len, clickInstance->GetIpAddressFromInterfaceId (ifid)); } else { retval = -1; } - NS_LOG_DEBUG (clickInstance->GetNodeName () << " SIMCLICK_IPADDR_FROM_NAME: "<< ifname << " "<< buf << " " << len); + NS_LOG_DEBUG (clickInstance->GetNodeName () << " SIMCLICK_IPADDR_FROM_NAME: " << ifname << " " << buf << " " << len); break; } case SIMCLICK_MACADDR_FROM_NAME: { - const char *ifname = va_arg(val, const char *); - char *buf = va_arg(val, char *); - int len = va_arg(val, int); + const char *ifname = va_arg (val, const char *); + char *buf = va_arg (val, char *); + int len = va_arg (val, int); int ifid = clickInstance->GetInterfaceId (ifname); if (ifid >= 0) { - retval = simstrlcpy(buf, len, clickInstance->GetMacAddressFromInterfaceId (ifid)); + retval = simstrlcpy (buf, len, clickInstance->GetMacAddressFromInterfaceId (ifid)); } else { retval = -1; } - NS_LOG_DEBUG (clickInstance->GetNodeName () << " SIMCLICK_MACADDR_FROM_NAME: "<< ifname << " "<< buf << " "<< len); + NS_LOG_DEBUG (clickInstance->GetNodeName () << " SIMCLICK_MACADDR_FROM_NAME: " << ifname << " " << buf << " " << len); break; } case SIMCLICK_SCHEDULE: { - const struct timeval *when = va_arg(val, const struct timeval *); + const struct timeval *when = va_arg (val, const struct timeval *); clickInstance->HandleScheduleFromClick (when); retval = 0; - NS_LOG_DEBUG (clickInstance->GetNodeName () << " SIMCLICK_SCHEDULE: "<< when->tv_sec << "s and " << when->tv_usec << "usecs later."); + NS_LOG_DEBUG (clickInstance->GetNodeName () << " SIMCLICK_SCHEDULE: " << when->tv_sec << "s and " << when->tv_usec << "usecs later."); break; } case SIMCLICK_GET_NODE_NAME: { - char *buf = va_arg(val, char *); - int len = va_arg(val, int); - retval = simstrlcpy(buf, len, clickInstance->GetNodeName ()); + char *buf = va_arg (val, char *); + int len = va_arg (val, int); + retval = simstrlcpy (buf, len, clickInstance->GetNodeName ()); NS_LOG_DEBUG (clickInstance->GetNodeName () << " SIMCLICK_GET_NODE_NAME: " << buf << " " << len); break; @@ -626,7 +630,7 @@ int simclick_sim_command(simclick_node_t *simnode, int cmd, ...) case SIMCLICK_IF_READY: { - int ifid = va_arg(val, int); // Commented out so that optimized build works + int ifid = va_arg (val, int); // Commented out so that optimized build works // We're not using a ClickQueue, so we're always ready (for the timebeing) retval = clickInstance->IsInterfaceReady (ifid); diff --git a/src/click/model/ipv4-click-routing.h b/src/click/model/ipv4-click-routing.h index 865c9d3c7..6bc5faab2 100644 --- a/src/click/model/ipv4-click-routing.h +++ b/src/click/model/ipv4-click-routing.h @@ -1,6 +1,6 @@ /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2010 Lalith Suresh + * Copyright (c) 2010 Lalith Suresh * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -122,7 +122,6 @@ public: static Ptr GetClickInstanceFromSimNode (simclick_node_t *simnode); public: - /** * \brief Provides for SIMCLICK_IFID_FROM_NAME * \param ifname The name of the interface @@ -174,7 +173,6 @@ private: void RunClickEvent (); public: - /** * \brief Schedules simclick_click_run to run at the given time * \param when Time at which the simclick_click_run instance should be run @@ -205,7 +203,7 @@ public: * \param src The source IP Address * \param dest The destination IP Address */ - void Send (Ptr p, Ipv4Address src, Ipv4Address dest); + void Send (Ptr p, Ipv4Address src, Ipv4Address dest); /** * \brief Allow a lower layer to send data to Click. (From Ipv4ExtRouting) @@ -239,7 +237,7 @@ private: bool m_nonDefaultName; Ptr m_ipv4; -#endif //NS3_CLICK +#endif // NS3_CLICK }; } // namespace ns3 diff --git a/src/click/model/ipv4-l3-click-protocol.cc b/src/click/model/ipv4-l3-click-protocol.cc index 277803f67..5b0f19d37 100644 --- a/src/click/model/ipv4-l3-click-protocol.cc +++ b/src/click/model/ipv4-l3-click-protocol.cc @@ -77,7 +77,7 @@ void Ipv4L3ClickProtocol::DoDispose (void) { NS_LOG_FUNCTION (this); - for (L4List_t::iterator i = m_protocols.begin(); i != m_protocols.end(); ++i) + for (L4List_t::iterator i = m_protocols.begin (); i != m_protocols.end (); ++i) { *i = 0; } @@ -99,7 +99,7 @@ Ipv4L3ClickProtocol::NotifyNewAggregate () { if (m_node == 0) { - Ptrnode = this->GetObject(); + Ptrnode = this->GetObject (); // verify that it's a valid node and that // the node has not been set before if (node != 0) @@ -194,7 +194,7 @@ int32_t Ipv4L3ClickProtocol::GetInterfaceForDevice ( Ptr device) const { - NS_LOG_FUNCTION (this << device->GetIfIndex()); + NS_LOG_FUNCTION (this << device->GetIfIndex ()); int32_t interface = 0; for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); @@ -253,7 +253,10 @@ Ipv4L3ClickProtocol::IsDestinationAddress (Ipv4Address address, uint32_t iif) co { for (uint32_t j = 0; j < GetNInterfaces (); j++) { - if (j == uint32_t (iif)) continue; + if (j == uint32_t (iif)) + { + continue; + } for (uint32_t i = 0; i < GetNAddresses (j); i++) { Ipv4InterfaceAddress iaddr = GetAddress (j, i); @@ -447,8 +450,14 @@ Ipv4L3ClickProtocol::SelectSourceAddress (Ptr device, for (uint32_t j = 0; j < GetNAddresses (i); j++) { iaddr = GetAddress (i, j); - if (iaddr.IsSecondary ()) continue; - if (iaddr.GetScope () > scope) continue; + if (iaddr.IsSecondary ()) + { + continue; + } + if (iaddr.GetScope () > scope) + { + continue; + } if (dst.CombineMask (iaddr.GetMask ()) == iaddr.GetLocal ().CombineMask (iaddr.GetMask ()) ) { return iaddr.GetLocal (); @@ -471,7 +480,10 @@ Ipv4L3ClickProtocol::SelectSourceAddress (Ptr device, for (uint32_t j = 0; j < GetNAddresses (i); j++) { iaddr = GetAddress (i, j); - if (iaddr.IsSecondary ()) continue; + if (iaddr.IsSecondary ()) + { + continue; + } if (iaddr.GetScope () != Ipv4InterfaceAddress::LINK && iaddr.GetScope () <= scope) { @@ -562,12 +574,12 @@ Ipv4L3ClickProtocol::SetForwarding (uint32_t i, bool val) void Ipv4L3ClickProtocol::SetPromisc (uint32_t i) { - NS_ASSERT(i <= m_node->GetNDevices ()); + NS_ASSERT (i <= m_node->GetNDevices ()); if (i > m_promiscDeviceList.size ()) { m_promiscDeviceList.resize (i); } - std::vector::iterator it = m_promiscDeviceList.begin(); + std::vector::iterator it = m_promiscDeviceList.begin (); std::advance (it, i); m_promiscDeviceList.insert (it, true); } @@ -578,10 +590,10 @@ Ipv4L3ClickProtocol::AddInterface (Ptr device) NS_LOG_FUNCTION (this << &device); Ptr node = GetObject (); - NS_LOG_DEBUG("Size:" << m_promiscDeviceList.size () << " Interface index" << device->GetIfIndex ()); - if (m_promiscDeviceList.size () > 0 && - (m_promiscDeviceList.size () >= device->GetIfIndex ()) && - (m_promiscDeviceList[device->GetIfIndex ()])) + NS_LOG_DEBUG ("Size:" << m_promiscDeviceList.size () << " Interface index" << device->GetIfIndex ()); + if (m_promiscDeviceList.size () > 0 + && (m_promiscDeviceList.size () >= device->GetIfIndex ()) + && (m_promiscDeviceList[device->GetIfIndex ()])) { node->RegisterProtocolHandler (MakeCallback (&Ipv4L3ClickProtocol::Receive, this), 0, device,true); @@ -656,7 +668,7 @@ Ipv4L3ClickProtocol::Send (Ptr packet, uint8_t protocol, Ptr route) { - NS_LOG_FUNCTION (this << packet << source << destination << uint32_t(protocol) << route); + NS_LOG_FUNCTION (this << packet << source << destination << uint32_t (protocol) << route); Ipv4Header ipHeader; bool mayFragment = true; @@ -709,16 +721,16 @@ Ipv4L3ClickProtocol::SendDown (Ptr p, int ifid) // Use the destination address and protocol obtained // from above to send the packet. - netdev->Send (p, header.GetDestination (), protocol); + netdev->Send (p, header.GetDestination (), protocol); } void -Ipv4L3ClickProtocol::Receive( Ptr device, Ptr p, uint16_t protocol, const Address &from, - const Address &to, NetDevice::PacketType packetType) +Ipv4L3ClickProtocol::Receive ( Ptr device, Ptr p, uint16_t protocol, const Address &from, + const Address &to, NetDevice::PacketType packetType) { NS_LOG_FUNCTION (this << device << p << from << to); Ptr packet = p->Copy (); - + // Add an ethernet frame. This allows // Click to work with csma and wifi EthernetHeader hdr; @@ -726,7 +738,7 @@ Ipv4L3ClickProtocol::Receive( Ptr device, Ptr p, uint16 hdr.SetDestination (Mac48Address::ConvertFrom (to)); hdr.SetLengthType (protocol); packet->AddHeader (hdr); - + Ptr click = DynamicCast (GetRoutingProtocol ()); click->Receive (packet->Copy (), Mac48Address::ConvertFrom (device->GetAddress ()), Mac48Address::ConvertFrom (to)); } @@ -747,7 +759,8 @@ Ipv4L3ClickProtocol::LocalDeliver (Ptr packet, Ipv4Header const&ip Ptr copy = p->Copy (); enum Ipv4L4Protocol::RxStatus status = protocol->Receive (p, ip, GetInterface (iif)); - switch (status) { + switch (status) + { case Ipv4L4Protocol::RX_OK: // fall through case Ipv4L4Protocol::RX_ENDPOINT_CLOSED: @@ -755,8 +768,8 @@ Ipv4L3ClickProtocol::LocalDeliver (Ptr packet, Ipv4Header const&ip case Ipv4L4Protocol::RX_CSUM_FAILED: break; case Ipv4L4Protocol::RX_ENDPOINT_UNREACH: - if (ip.GetDestination ().IsBroadcast () == true || - ip.GetDestination ().IsMulticast () == true) + if (ip.GetDestination ().IsBroadcast () == true + || ip.GetDestination ().IsMulticast () == true) { break; // Do not reply to broadcast or multicast } @@ -765,8 +778,8 @@ Ipv4L3ClickProtocol::LocalDeliver (Ptr packet, Ipv4Header const&ip for (uint32_t i = 0; i < GetNAddresses (iif); i++) { Ipv4InterfaceAddress addr = GetAddress (iif, i); - if (addr.GetLocal ().CombineMask (addr.GetMask ()) == ip.GetDestination().CombineMask (addr.GetMask ()) && - ip.GetDestination ().IsSubnetDirectedBroadcast (addr.GetMask ())) + if (addr.GetLocal ().CombineMask (addr.GetMask ()) == ip.GetDestination ().CombineMask (addr.GetMask ()) + && ip.GetDestination ().IsSubnetDirectedBroadcast (addr.GetMask ())) { subnetDirected = true; } @@ -794,15 +807,15 @@ Ipv4L3ClickProtocol::GetIcmp (void) const } void -Ipv4L3ClickProtocol::Insert(Ptr protocol) +Ipv4L3ClickProtocol::Insert (Ptr protocol) { m_protocols.push_back (protocol); } Ptr -Ipv4L3ClickProtocol::GetProtocol(int protocolNumber) const +Ipv4L3ClickProtocol::GetProtocol (int protocolNumber) const { - for (L4List_t::const_iterator i = m_protocols.begin(); i != m_protocols.end(); ++i) + for (L4List_t::const_iterator i = m_protocols.begin (); i != m_protocols.end (); ++i) { if ((*i)->GetProtocolNumber () == protocolNumber) { diff --git a/src/click/model/ipv4-l3-click-protocol.h b/src/click/model/ipv4-l3-click-protocol.h index 399c1b2eb..de02c2f31 100644 --- a/src/click/model/ipv4-l3-click-protocol.h +++ b/src/click/model/ipv4-l3-click-protocol.h @@ -48,7 +48,7 @@ class Icmpv4L4Protocol; /** * \brief Implement the Ipv4 layer specifically for Click nodes * to allow a clean integration of Click. - * + * * This is code is mostly repeated from the Ipv4L3Protocol implementation. * Changes include: * - A stripped down version of Send(). @@ -68,20 +68,20 @@ public: */ static const uint16_t PROT_NUMBER; - Ipv4L3ClickProtocol(); - virtual ~Ipv4L3ClickProtocol(); + Ipv4L3ClickProtocol (); + virtual ~Ipv4L3ClickProtocol (); /** * \param protocol a template for the protocol to add to this L4 Demux. * \returns the L4Protocol effectively added. * * Invoke Copy on the input template to get a copy of the input - * protocol which can be used on the Node on which this L4 Demux + * protocol which can be used on the Node on which this L4 Demux * is running. The new L4Protocol is registered internally as * a working L4 Protocol and returned from this method. * The caller does not get ownership of the returned pointer. */ - void Insert(Ptr protocol); + void Insert (Ptr protocol); /** * \param protocolNumber number of protocol to lookup @@ -92,7 +92,7 @@ public: * to forward packets up the stack to the right protocol. * It is also called from NodeImpl::GetUdp for example. */ - Ptr GetProtocol(int protocolNumber) const; + Ptr GetProtocol (int protocolNumber) const; /** * \param ttl default ttl to use @@ -133,8 +133,8 @@ public: * \param to address of the destination * \param packetType type of the packet */ - void Receive( Ptr device, Ptr p, uint16_t protocol, const Address &from, - const Address &to, NetDevice::PacketType packetType); + void Receive ( Ptr device, Ptr p, uint16_t protocol, const Address &from, + const Address &to, NetDevice::PacketType packetType); /** * Ipv4ClickRouting calls this to locally deliver a packet @@ -216,9 +216,8 @@ public: void SetDown (uint32_t i); bool IsForwarding (uint32_t i) const; void SetForwarding (uint32_t i, bool val); - void SetPromisc(uint32_t i); + void SetPromisc (uint32_t i); protected: - virtual void DoDispose (void); /** * This function will notify other components connected to the node that a new stack member is now connected @@ -262,9 +261,9 @@ private: std::vector m_promiscDeviceList; -#endif //NS3_CLICK +#endif // NS3_CLICK }; -} //namespace ns3 +} // namespace ns3 #endif // IPV4_L3_CLICK_ROUTING_H diff --git a/src/click/test/ipv4-click-routing-test.cc b/src/click/test/ipv4-click-routing-test.cc index 74eaa2f9d..3c16846a5 100644 --- a/src/click/test/ipv4-click-routing-test.cc +++ b/src/click/test/ipv4-click-routing-test.cc @@ -57,7 +57,7 @@ AddNetworkDevice (Ptr node, Mac48Address macaddr, Ipv4Address ipv4addr, Ip Ptr rxDev1; rxDev1 = CreateObject (); - rxDev1->SetAddress (Mac48Address(macaddr)); + rxDev1->SetAddress (Mac48Address (macaddr)); node->AddDevice (rxDev1); Ptr ipv4 = node->GetObject (); @@ -84,7 +84,7 @@ ClickIfidFromNameTest::DoRun () { Ptr node = CreateObject (); AddClickInternetStack (node); - AddNetworkDevice (node, Mac48Address("00:00:00:00:00:01"), Ipv4Address ("10.1.1.1"), Ipv4Mask ("255.255.255.0")); + AddNetworkDevice (node, Mac48Address ("00:00:00:00:00:01"), Ipv4Address ("10.1.1.1"), Ipv4Mask ("255.255.255.0")); Ptr ipv4 = node->GetObject (); Ptr click = DynamicCast (ipv4->GetRoutingProtocol ()); click->DoStart (); @@ -114,7 +114,7 @@ ClickIfidFromNameTest::DoRun () class ClickIpMacAddressFromNameTest : public TestCase { public: - ClickIpMacAddressFromNameTest (); + ClickIpMacAddressFromNameTest (); virtual void DoRun (); }; @@ -128,8 +128,8 @@ ClickIpMacAddressFromNameTest::DoRun () { Ptr node = CreateObject (); AddClickInternetStack (node); - AddNetworkDevice (node, Mac48Address("00:00:00:00:00:01"), Ipv4Address ("10.1.1.1"), Ipv4Mask ("255.255.255.0")); - AddNetworkDevice (node, Mac48Address("00:00:00:00:00:02"), Ipv4Address ("10.1.1.2"), Ipv4Mask ("255.255.255.0")); + AddNetworkDevice (node, Mac48Address ("00:00:00:00:00:01"), Ipv4Address ("10.1.1.1"), Ipv4Mask ("255.255.255.0")); + AddNetworkDevice (node, Mac48Address ("00:00:00:00:00:02"), Ipv4Address ("10.1.1.2"), Ipv4Mask ("255.255.255.0")); Ptr ipv4 = node->GetObject (); Ptr click = DynamicCast (ipv4->GetRoutingProtocol ()); click->DoStart (); @@ -145,7 +145,7 @@ ClickIpMacAddressFromNameTest::DoRun () NS_TEST_EXPECT_MSG_EQ (strcmp (buf, "00:00:00:00:00:01"), 0, "eth0 has Mac Address 00:00:00:00:00:01"); ret = simclick_sim_command (click->m_simNode, SIMCLICK_IPADDR_FROM_NAME, "eth1", buf, 255); - NS_TEST_EXPECT_MSG_EQ (strcmp(buf, "10.1.1.2"), 0, "eth1 has IP 10.1.1.2"); + NS_TEST_EXPECT_MSG_EQ (strcmp (buf, "10.1.1.2"), 0, "eth1 has IP 10.1.1.2"); ret = simclick_sim_command (click->m_simNode, SIMCLICK_MACADDR_FROM_NAME, "eth1", buf, 255); NS_TEST_EXPECT_MSG_EQ (strcmp (buf, "00:00:00:00:00:02"), 0, "eth0 has Mac Address 00:00:00:00:00:02"); @@ -155,10 +155,10 @@ ClickIpMacAddressFromNameTest::DoRun () // NS_TEST_EXPECT_MSG_EQ (buf, NULL, "No eth2"); ret = simclick_sim_command (click->m_simNode, SIMCLICK_IPADDR_FROM_NAME, "tap0", buf, 255); - NS_TEST_EXPECT_MSG_EQ (strcmp(buf, "127.0.0.1"), 0, "tun0 has IP 127.0.0.1"); + NS_TEST_EXPECT_MSG_EQ (strcmp (buf, "127.0.0.1"), 0, "tun0 has IP 127.0.0.1"); ret = simclick_sim_command (click->m_simNode, SIMCLICK_MACADDR_FROM_NAME, "tap0", buf, 255); - NS_TEST_EXPECT_MSG_EQ (strcmp(buf, "00:00:00:00:00:00"), 0, "tun0 has IP 127.0.0.1"); + NS_TEST_EXPECT_MSG_EQ (strcmp (buf, "00:00:00:00:00:00"), 0, "tun0 has IP 127.0.0.1"); delete [] buf; } @@ -180,7 +180,7 @@ ClickTrivialTest::DoRun () { Ptr node = CreateObject (); AddClickInternetStack (node); - AddNetworkDevice (node, Mac48Address("00:00:00:00:00:01"), Ipv4Address ("10.1.1.1"), Ipv4Mask ("255.255.255.0")); + AddNetworkDevice (node, Mac48Address ("00:00:00:00:00:01"), Ipv4Address ("10.1.1.1"), Ipv4Mask ("255.255.255.0")); Ptr ipv4 = node->GetObject (); Ptr click = DynamicCast (ipv4->GetRoutingProtocol ()); click->SetNodeName ("myNode");