151 #include "ns3/assert.h"
153 #include "ns3/object.h"
154 #include "ns3/names.h"
155 #include "ns3/ipv4.h"
156 #include "ns3/ipv6.h"
157 #include "ns3/packet-socket-factory.h"
158 #include "ns3/config.h"
159 #include "ns3/simulator.h"
160 #include "ns3/string.h"
161 #include "ns3/net-device.h"
162 #include "ns3/callback.h"
163 #include "ns3/node.h"
164 #include "ns3/node-list.h"
165 #include "ns3/core-config.h"
166 #include "ns3/arp-l3-protocol.h"
168 #include "ns3/ipv4-global-routing.h"
169 #include "ns3/ipv4-list-routing-helper.h"
170 #include "ns3/ipv4-static-routing-helper.h"
171 #include "ns3/ipv4-global-routing-helper.h"
172 #include "ns3/ipv6-list-routing-helper.h"
173 #include "ns3/ipv6-static-routing-helper.h"
174 #include "ns3/ipv6-extension.h"
175 #include "ns3/ipv6-extension-demux.h"
176 #include "ns3/ipv6-extension-header.h"
177 #include "ns3/global-router-interface.h"
193 #define INTERFACE_CONTEXT
235 m_ipv4Enabled (true),
245 SetTcp (
"ns3::TcpL4Protocol");
251 listRouting.
Add (staticRouting, 0);
252 listRouting.
Add (globalRouting, -10);
253 listRoutingv6.
Add (staticRoutingv6, 0);
325 int64_t currentStream = stream;
346 return (currentStream - stream);
394 "an InternetStack to a node with an existing Ipv4 object");
417 "an InternetStack to a node with an existing Ipv6 object");
437 Ptr<Node> node = Names::Find<Node> (nodeName);
455 NS_LOG_INFO (
"Ignoring packet to/from interface " << interface);
470 if ((*i).first.first == ipv4)
485 NS_LOG_INFO (
"Call to enable Ipv4 pcap tracing but Ipv4 not enabled");
495 std::string filename;
496 if (explicitFilename)
518 NS_ASSERT_MSG (ipv4L3Protocol,
"InternetStackHelper::EnablePcapIpv4Internal(): "
519 "m_ipv4Enabled and ipv4L3Protocol inconsistent");
522 NS_ASSERT_MSG (result ==
true,
"InternetStackHelper::EnablePcapIpv4Internal(): "
523 "Unable to connect ipv4L3Protocol \"Tx\"");
526 NS_ASSERT_MSG (result ==
true,
"InternetStackHelper::EnablePcapIpv4Internal(): "
527 "Unable to connect ipv4L3Protocol \"Rx\"");
547 NS_LOG_INFO (
"Ignoring packet to/from interface " << interface);
562 if ((*i).first.first == ipv6)
577 NS_LOG_INFO (
"Call to enable Ipv6 pcap tracing but Ipv6 not enabled");
587 std::string filename;
588 if (explicitFilename)
610 NS_ASSERT_MSG (ipv6L3Protocol,
"InternetStackHelper::EnablePcapIpv6Internal(): "
611 "m_ipv6Enabled and ipv6L3Protocol inconsistent");
614 NS_ASSERT_MSG (result ==
true,
"InternetStackHelper::EnablePcapIpv6Internal(): "
615 "Unable to connect ipv6L3Protocol \"Tx\"");
618 NS_ASSERT_MSG (result ==
true,
"InternetStackHelper::EnablePcapIpv6Internal(): "
619 "Unable to connect ipv6L3Protocol \"Rx\"");
643 NS_LOG_INFO (
"Ignoring packet to/from interface " << interface);
662 NS_LOG_INFO (
"Ignoring packet to/from interface " << interface);
679 NS_LOG_INFO (
"Ignoring packet to/from interface " << interface);
705 NS_LOG_INFO (
"Ignoring packet to/from interface " << interface);
711 #ifdef INTERFACE_CONTEXT
730 NS_LOG_INFO (
"Ignoring packet to/from interface " << interface);
734 #ifdef INTERFACE_CONTEXT
736 << *packet << std::endl;
753 NS_LOG_INFO (
"Ignoring packet to/from interface " << interface);
757 #ifdef INTERFACE_CONTEXT
759 << *packet << std::endl;
772 if ((*i).first.first == ipv4)
786 bool explicitFilename)
790 NS_LOG_INFO (
"Call to enable Ipv4 ascii tracing but Ipv4 not enabled");
819 std::string filename;
820 if (explicitFilename)
854 NS_ASSERT_MSG (result ==
true,
"InternetStackHelper::EnableAsciiIpv4Internal(): "
855 "Unable to connect ipv4L3Protocol \"Drop\"");
856 result = ipv4L3Protocol->TraceConnectWithoutContext (
"Tx",
858 NS_ASSERT_MSG (result ==
true,
"InternetStackHelper::EnableAsciiIpv4Internal(): "
859 "Unable to connect ipv4L3Protocol \"Tx\"");
860 result = ipv4L3Protocol->TraceConnectWithoutContext (
"Rx",
862 NS_ASSERT_MSG (result ==
true,
"InternetStackHelper::EnableAsciiIpv4Internal(): "
863 "Unable to connect ipv4L3Protocol \"Rx\"");
885 std::ostringstream oss;
893 oss <<
"/NodeList/" << node->
GetId () <<
"/$ns3::ArpL3Protocol/Drop";
901 oss <<
"/NodeList/" << node->
GetId () <<
"/$ns3::Ipv4L3Protocol/Drop";
904 oss <<
"/NodeList/" << node->
GetId () <<
"/$ns3::Ipv4L3Protocol/Tx";
907 oss <<
"/NodeList/" << node->
GetId () <<
"/$ns3::Ipv4L3Protocol/Rx";
932 NS_LOG_INFO (
"Ignoring packet to/from interface " << interface);
951 NS_LOG_INFO (
"Ignoring packet to/from interface " << interface);
968 NS_LOG_INFO (
"Ignoring packet to/from interface " << interface);
994 NS_LOG_INFO (
"Ignoring packet to/from interface " << interface);
1000 #ifdef INTERFACE_CONTEXT
1011 std::string context,
1019 NS_LOG_INFO (
"Ignoring packet to/from interface " << interface);
1023 #ifdef INTERFACE_CONTEXT
1025 << *packet << std::endl;
1034 std::string context,
1042 NS_LOG_INFO (
"Ignoring packet to/from interface " << interface);
1046 #ifdef INTERFACE_CONTEXT
1048 << *packet << std::endl;
1061 if ((*i).first.first == ipv6)
1075 bool explicitFilename)
1079 NS_LOG_INFO (
"Call to enable Ipv6 ascii tracing but Ipv6 not enabled");
1108 std::string filename;
1109 if (explicitFilename)
1133 bool result = ipv6L3Protocol->TraceConnectWithoutContext (
"Drop",
1135 NS_ASSERT_MSG (result ==
true,
"InternetStackHelper::EnableAsciiIpv6Internal(): "
1136 "Unable to connect ipv6L3Protocol \"Drop\"");
1137 result = ipv6L3Protocol->TraceConnectWithoutContext (
"Tx",
1139 NS_ASSERT_MSG (result ==
true,
"InternetStackHelper::EnableAsciiIpv6Internal(): "
1140 "Unable to connect ipv6L3Protocol \"Tx\"");
1141 result = ipv6L3Protocol->TraceConnectWithoutContext (
"Rx",
1143 NS_ASSERT_MSG (result ==
true,
"InternetStackHelper::EnableAsciiIpv6Internal(): "
1144 "Unable to connect ipv6L3Protocol \"Rx\"");
1166 std::ostringstream oss;
1169 oss <<
"/NodeList/" << node->
GetId () <<
"/$ns3::Ipv6L3Protocol/Drop";
1172 oss <<
"/NodeList/" << node->
GetId () <<
"/$ns3::Ipv6L3Protocol/Tx";
1175 oss <<
"/NodeList/" << node->
GetId () <<
"/$ns3::Ipv6L3Protocol/Rx";