sixlowpan: use standard internet helpers

This commit is contained in:
Tommaso Pecorella
2016-02-18 20:50:59 +01:00
parent edaa5fd760
commit dd2d0858d1
5 changed files with 40 additions and 104 deletions

View File

@@ -1061,6 +1061,11 @@ def register_Ns3Ipv4Address_methods(root_module, cls):
'ns3::Ipv4Address',
[],
is_static=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsAny() const [member function]
cls.add_method('IsAny',
'bool',
[],
is_const=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsBroadcast() const [member function]
cls.add_method('IsBroadcast',
'bool',
@@ -1076,6 +1081,11 @@ def register_Ns3Ipv4Address_methods(root_module, cls):
'bool',
[],
is_const=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsLocalhost() const [member function]
cls.add_method('IsLocalhost',
'bool',
[],
is_const=True)
## ipv4-address.h (module 'network'): static bool ns3::Ipv4Address::IsMatchingType(ns3::Address const & address) [member function]
cls.add_method('IsMatchingType',
'bool',
@@ -1252,7 +1262,7 @@ def register_Ns3Ipv6Address_methods(root_module, cls):
cls.add_method('IsAllHostsMulticast',
'bool',
[],
is_const=True)
deprecated=True, is_const=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsAllNodesMulticast() const [member function]
cls.add_method('IsAllNodesMulticast',
'bool',

View File

@@ -1061,6 +1061,11 @@ def register_Ns3Ipv4Address_methods(root_module, cls):
'ns3::Ipv4Address',
[],
is_static=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsAny() const [member function]
cls.add_method('IsAny',
'bool',
[],
is_const=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsBroadcast() const [member function]
cls.add_method('IsBroadcast',
'bool',
@@ -1076,6 +1081,11 @@ def register_Ns3Ipv4Address_methods(root_module, cls):
'bool',
[],
is_const=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsLocalhost() const [member function]
cls.add_method('IsLocalhost',
'bool',
[],
is_const=True)
## ipv4-address.h (module 'network'): static bool ns3::Ipv4Address::IsMatchingType(ns3::Address const & address) [member function]
cls.add_method('IsMatchingType',
'bool',
@@ -1252,7 +1262,7 @@ def register_Ns3Ipv6Address_methods(root_module, cls):
cls.add_method('IsAllHostsMulticast',
'bool',
[],
is_const=True)
deprecated=True, is_const=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsAllNodesMulticast() const [member function]
cls.add_method('IsAllNodesMulticast',
'bool',

View File

@@ -35,14 +35,8 @@
#include "ns3/inet-socket-address.h"
#include "ns3/boolean.h"
#include "ns3/ipv6-static-routing.h"
#include "ns3/ipv6-list-routing.h"
#include "ns3/inet6-socket-address.h"
#include "ns3/sixlowpan-net-device.h"
#include "ns3/udp-l4-protocol.h"
#include "ns3/ipv6-l3-protocol.h"
#include "ns3/internet-stack-helper.h"
#include "ns3/icmpv6-l4-protocol.h"
#include <string>
@@ -51,42 +45,12 @@
using namespace ns3;
class UdpSocketImpl;
static void
AddInternetStack (Ptr<Node> node)
{
//IPV6
Ptr<Ipv6L3Protocol> ipv6 = CreateObject<Ipv6L3Protocol> ();
//Routing for Ipv6
Ptr<Ipv6ListRouting> ipv6Routing = CreateObject<Ipv6ListRouting> ();
ipv6->SetRoutingProtocol (ipv6Routing);
Ptr<Ipv6StaticRouting> ipv6staticRouting = CreateObject<Ipv6StaticRouting> ();
ipv6Routing->AddRoutingProtocol (ipv6staticRouting, 0);
node->AggregateObject (ipv6);
//ICMPv6
Ptr<Icmpv6L4Protocol> icmp6 = CreateObject<Icmpv6L4Protocol> ();
node->AggregateObject (icmp6);
//Ipv6 Extensions
ipv6->RegisterExtensions ();
ipv6->RegisterOptions ();
//UDP
Ptr<UdpL4Protocol> udp = CreateObject<UdpL4Protocol> ();
node->AggregateObject (udp);
}
class SixlowpanFragmentationTest : public TestCase
{
Ptr<Packet> m_sentPacketClient;
Ptr<Packet> m_receivedPacketClient;
Ptr<Packet> m_receivedPacketServer;
Ptr<Socket> m_socketServer;
Ptr<Socket> m_socketClient;
uint32_t m_dataSize;
@@ -122,6 +86,9 @@ SixlowpanFragmentationTest::SixlowpanFragmentationTest ()
m_socketServer = 0;
m_data = 0;
m_dataSize = 0;
m_size = 0;
m_icmpType = 0;
m_icmpCode = 0;
}
SixlowpanFragmentationTest::~SixlowpanFragmentationTest ()
@@ -256,12 +223,13 @@ void
SixlowpanFragmentationTest::DoRun (void)
{
// Create topology
InternetStackHelper internet;
internet.SetIpv4StackInstall (false);
Packet::EnablePrinting ();
// Receiver Node
Ptr<Node> serverNode = CreateObject<Node> ();
AddInternetStack (serverNode);
internet.Install (serverNode);
Ptr<SimpleNetDevice> serverDev;
Ptr<BinaryErrorSixlowModel> serverDevErrorModel = CreateObject<BinaryErrorSixlowModel> ();
{
@@ -292,7 +260,7 @@ SixlowpanFragmentationTest::DoRun (void)
// Sender Node
Ptr<Node> clientNode = CreateObject<Node> ();
AddInternetStack (clientNode);
internet.Install (clientNode);
Ptr<SimpleNetDevice> clientDev;
Ptr<BinaryErrorSixlowModel> clientDevErrorModel = CreateObject<BinaryErrorSixlowModel> ();
{

View File

@@ -31,12 +31,7 @@
#include "ns3/log.h"
#include "ns3/node.h"
#include "ns3/inet6-socket-address.h"
#include "ns3/ipv6-l3-protocol.h"
#include "ns3/icmpv6-l4-protocol.h"
#include "ns3/udp-l4-protocol.h"
#include "ns3/ipv6-list-routing.h"
#include "ns3/ipv6-static-routing.h"
#include "ns3/internet-stack-helper.h"
#include "ns3/sixlowpan-net-device.h"
@@ -45,29 +40,6 @@
using namespace ns3;
static void
AddInternetStack6 (Ptr<Node> node)
{
//IPV6
Ptr<Ipv6L3Protocol> ipv6 = CreateObject<Ipv6L3Protocol> ();
//Routing for Ipv6
Ptr<Ipv6ListRouting> ipv6Routing = CreateObject<Ipv6ListRouting> ();
ipv6->SetRoutingProtocol (ipv6Routing);
Ptr<Ipv6StaticRouting> ipv6staticRouting = CreateObject<Ipv6StaticRouting> ();
ipv6Routing->AddRoutingProtocol (ipv6staticRouting, 0);
node->AggregateObject (ipv6);
//ICMP
Ptr<Icmpv6L4Protocol> icmp = CreateObject<Icmpv6L4Protocol> ();
node->AggregateObject (icmp);
//Ipv6 Extensions
ipv6->RegisterExtensions ();
ipv6->RegisterOptions ();
//UDP
Ptr<UdpL4Protocol> udp = CreateObject<UdpL4Protocol> ();
node->AggregateObject (udp);
}
class SixlowpanHc1ImplTest : public TestCase
{
Ptr<Packet> m_receivedPacket;
@@ -127,10 +99,12 @@ void
SixlowpanHc1ImplTest::DoRun (void)
{
// Create topology
InternetStackHelper internet;
internet.SetIpv4StackInstall (false);
// Receiver Node
Ptr<Node> rxNode = CreateObject<Node> ();
AddInternetStack6 (rxNode);
internet.Install (rxNode);
Ptr<SimpleNetDevice> rxDev;
{ // first interface
rxDev = CreateObject<SimpleNetDevice> ();
@@ -153,7 +127,7 @@ SixlowpanHc1ImplTest::DoRun (void)
// Sender Node
Ptr<Node> txNode = CreateObject<Node> ();
AddInternetStack6 (txNode);
internet.Install (txNode);
Ptr<SimpleNetDevice> txDev;
{
txDev = CreateObject<SimpleNetDevice> ();

View File

@@ -31,12 +31,7 @@
#include "ns3/log.h"
#include "ns3/node.h"
#include "ns3/inet6-socket-address.h"
#include "ns3/ipv6-l3-protocol.h"
#include "ns3/icmpv6-l4-protocol.h"
#include "ns3/udp-l4-protocol.h"
#include "ns3/ipv6-list-routing.h"
#include "ns3/ipv6-static-routing.h"
#include "ns3/internet-stack-helper.h"
#include "ns3/sixlowpan-net-device.h"
@@ -45,29 +40,6 @@
using namespace ns3;
static void
AddInternetStack6 (Ptr<Node> node)
{
//IPV6
Ptr<Ipv6L3Protocol> ipv6 = CreateObject<Ipv6L3Protocol> ();
//Routing for Ipv6
Ptr<Ipv6ListRouting> ipv6Routing = CreateObject<Ipv6ListRouting> ();
ipv6->SetRoutingProtocol (ipv6Routing);
Ptr<Ipv6StaticRouting> ipv6staticRouting = CreateObject<Ipv6StaticRouting> ();
ipv6Routing->AddRoutingProtocol (ipv6staticRouting, 0);
node->AggregateObject (ipv6);
//ICMP
Ptr<Icmpv6L4Protocol> icmp = CreateObject<Icmpv6L4Protocol> ();
node->AggregateObject (icmp);
//Ipv6 Extensions
ipv6->RegisterExtensions ();
ipv6->RegisterOptions ();
//UDP
Ptr<UdpL4Protocol> udp = CreateObject<UdpL4Protocol> ();
node->AggregateObject (udp);
}
class SixlowpanIphcImplTest : public TestCase
{
Ptr<Packet> m_receivedPacket;
@@ -127,10 +99,12 @@ void
SixlowpanIphcImplTest::DoRun (void)
{
// Create topology
InternetStackHelper internet;
internet.SetIpv4StackInstall (false);
// Receiver Node
Ptr<Node> rxNode = CreateObject<Node> ();
AddInternetStack6 (rxNode);
internet.Install (rxNode);
Ptr<SimpleNetDevice> rxDev;
{ // first interface
rxDev = CreateObject<SimpleNetDevice> ();
@@ -152,7 +126,7 @@ SixlowpanIphcImplTest::DoRun (void)
// Sender Node
Ptr<Node> txNode = CreateObject<Node> ();
AddInternetStack6 (txNode);
internet.Install (txNode);
Ptr<SimpleNetDevice> txDev;
{
txDev = CreateObject<SimpleNetDevice> ();