forked from nmap/nmap
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
949d2f8
commit d8d58b3
Showing
2 changed files
with
142 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
#include <fstream> | ||
/* #include "core-module.h" | ||
#include "internet-module.h" | ||
#include "csma-module.h" | ||
This comment has been minimized.
Sorry, something went wrong. |
||
#include "internet-apps-module.h" */ | ||
#include "ipv6-static-routing-helper.h" | ||
|
||
// #include "ipv6-routing-table-entry.h" | ||
|
||
|
||
|
||
NS_LOG_COMPONENT_DEFINE ("FragmentationIpv6TwoMtuExample"); | ||
|
||
int main (int argc, char** argv) | ||
{ | ||
bool connection = false; | ||
|
||
CommandLine cmd; | ||
cmd.AddValue ("connection", "turn on log components", connection); | ||
cmd.Parse (argc, argv); | ||
|
||
if (connection) | ||
{ | ||
LogComponentEnable ("Ipv6L3Protocol", LOG_LEVEL_ALL); | ||
LogComponentEnable ("Icmpv6L4Protocol", LOG_LEVEL_ALL); | ||
LogComponentEnable ("Ipv6StaticRouting", LOG_LEVEL_ALL); | ||
LogComponentEnable ("Ipv6Interface", LOG_LEVEL_ALL); | ||
LogComponentEnable ("Ping6Application", LOG_LEVEL_ALL); | ||
} | ||
|
||
/* NS_LOG_INFO ("Create nodes."); | ||
Ptr<Node> n0 = CreateObject<Node> (); | ||
Ptr<Node> r = CreateObject<Node> (); | ||
Ptr<Node> n1 = CreateObject<Node> (); | ||
NodeContainer net1 (n0, r); | ||
NodeContainer net2 (r, n1); | ||
NodeContainer all (n0, r, n1); | ||
NS_LOG_INFO ("Create IPv6 Internet Stack"); | ||
InternetStackHelper internetv6; | ||
internetv6.Install (all); | ||
NS_LOG_INFO ("Create channels."); | ||
CsmaHelper csma; | ||
csma.SetChannelAttribute ("DataRate", DataRateValue (5000000)); | ||
csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2))); | ||
NetDeviceContainer d2 = csma.Install (net2); | ||
csma.SetDeviceAttribute ("Mtu", UintegerValue (5000)); | ||
This comment has been minimized.
Sorry, something went wrong.
DGunasekara
Author
Owner
|
||
NetDeviceContainer d1 = csma.Install (net1); | ||
NS_LOG_INFO ("Create networks and assign IPv6 Addresses."); | ||
Ipv6AddressHelper ipv6; | ||
ipv6.SetBase (Ipv6Address ("2001:1::"), Ipv6Prefix (64)); | ||
Ipv6InterfaceContainer i1 = ipv6.Assign (d1); | ||
i1.SetForwarding (1, true); | ||
i1.SetDefaultRouteInAllNodes (1); | ||
ipv6.SetBase (Ipv6Address ("2001:2::"), Ipv6Prefix (64)); | ||
Ipv6InterfaceContainer i2 = ipv6.Assign (d2); | ||
i2.SetForwarding (0, true); | ||
i2.SetDefaultRouteInAllNodes (0); | ||
Ipv6StaticRoutingHelper routingHelper; | ||
Ptr<OutputStreamWrapper> routingStream = Create<OutputStreamWrapper> (&std::cout); | ||
routingHelper.PrintRoutingTableAt (Seconds (0), n0, routingStream);*/ | ||
|
||
/* Create a Ping6 application to send ICMPv6 echo request from n0 to n1 via r */ | ||
uint32_t packetSize = 4096; | ||
uint32_t maxPacketCount = 5; | ||
Time interPacketInterval = Seconds (1.0); | ||
Ping6Helper ping6; | ||
|
||
ping6.SetLocal (i1.GetAddress (0, 1)); | ||
ping6.SetRemote (i2.GetAddress (1, 1)); | ||
|
||
ping6.SetAttribute ("MaxPackets", UintegerValue (maxPacketCount)); | ||
ping6.SetAttribute ("Interval", TimeValue (interPacketInterval)); | ||
ping6.SetAttribute ("PacketSize", UintegerValue (packetSize)); | ||
ApplicationContainer apps = ping6.Install (net1.Get (0)); | ||
apps.Start (Seconds (2.0)); | ||
apps.Stop (Seconds (20.0)); | ||
|
||
AsciiTraceHelper ascii; | ||
csma.EnableAsciiAll (ascii.CreateFileStream ("fragmentation-ipv6-two-mtu.tr")); | ||
csma.EnablePcapAll (std::string ("fragmentation-ipv6-two-mtu"), true); | ||
|
||
NS_LOG_INFO ("Run Simulation."); | ||
Simulator::Run (); | ||
Simulator::Destroy (); | ||
NS_LOG_INFO ("Done."); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
|
||
#define IPV6_STATIC_ROUTING_HELPER_H | ||
|
||
#include "ipv6.h" | ||
#include "ipv6-static-routing.h" | ||
#include "ptr.h" | ||
#include "ipv6-address.h" | ||
#include "node.h" | ||
#include "net-device.h" | ||
|
||
#include "node-container.h" | ||
#include "net-device-container.h" | ||
#include "ipv6-routing-helper.h" | ||
|
||
|
||
class Ipv6StaticRoutingHelper : public Ipv6RoutingHelper | ||
{ | ||
public: | ||
Ipv6StaticRoutingHelper (); | ||
|
||
Ipv6StaticRoutingHelper (const Ipv6StaticRoutingHelper &); | ||
|
||
Ipv6StaticRoutingHelper* Copy (void) const; | ||
|
||
virtual Ptr<Ipv6RoutingProtocol> Create (Ptr<Node> node) const; | ||
|
||
Ptr<Ipv6StaticRouting> GetStaticRouting (Ptr<Ipv6> ipv6) const; | ||
/* | ||
void AddMulticastRoute (Ptr<Node> n, Ipv6Address source, Ipv6Address group, | ||
Ptr<NetDevice> input, NetDeviceContainer output); | ||
void AddMulticastRoute (std::string n, Ipv6Address source, Ipv6Address group, | ||
Ptr<NetDevice> input, NetDeviceContainer output); | ||
void AddMulticastRoute (Ptr<Node> n, Ipv6Address source, Ipv6Address group, | ||
std::string inputName, NetDeviceContainer output); | ||
void AddMulticastRoute (std::string nName, Ipv6Address source, Ipv6Address group, | ||
std::string inputName, NetDeviceContainer output); | ||
*/ | ||
#if 0 | ||
|
||
void SetDefaultMulticastRoute (Ptr<Node> n, Ptr<NetDevice> nd); | ||
void SetDefaultMulticastRoute (Ptr<Node> n, std::string ndName); | ||
void SetDefaultMulticastRoute (std::string nName, Ptr<NetDevice> nd); | ||
void SetDefaultMulticastRoute (std::string nName, std::string ndName); | ||
#endif | ||
private: | ||
Ipv6StaticRoutingHelper &operator = (const Ipv6StaticRoutingHelper &o); | ||
}; | ||
|
more helper files have to be uploaded and it is linked only with ipv6-static-routing-helper.h