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");
413 "an InternetStack to a node with an existing Ipv6 object");
441 Ptr<Node> node = Names::Find<Node> (nodeName);
459 NS_LOG_INFO (
"Ignoring packet to/from interface " << interface);
474 if ((*i).first.first == ipv4)
489 NS_LOG_INFO (
"Call to enable Ipv4 pcap tracing but Ipv4 not enabled");
499 std::string filename;
500 if (explicitFilename)
522 NS_ASSERT_MSG (ipv4L3Protocol,
"InternetStackHelper::EnablePcapIpv4Internal(): "
523 "m_ipv4Enabled and ipv4L3Protocol inconsistent");
526 NS_ASSERT_MSG (result ==
true,
"InternetStackHelper::EnablePcapIpv4Internal(): "
527 "Unable to connect ipv4L3Protocol \"Tx\"");
530 NS_ASSERT_MSG (result ==
true,
"InternetStackHelper::EnablePcapIpv4Internal(): "
531 "Unable to connect ipv4L3Protocol \"Rx\"");
551 NS_LOG_INFO (
"Ignoring packet to/from interface " << interface);
566 if ((*i).first.first == ipv6)
581 NS_LOG_INFO (
"Call to enable Ipv6 pcap tracing but Ipv6 not enabled");
591 std::string filename;
592 if (explicitFilename)
614 NS_ASSERT_MSG (ipv6L3Protocol,
"InternetStackHelper::EnablePcapIpv6Internal(): "
615 "m_ipv6Enabled and ipv6L3Protocol inconsistent");
618 NS_ASSERT_MSG (result ==
true,
"InternetStackHelper::EnablePcapIpv6Internal(): "
619 "Unable to connect ipv6L3Protocol \"Tx\"");
622 NS_ASSERT_MSG (result ==
true,
"InternetStackHelper::EnablePcapIpv6Internal(): "
623 "Unable to connect ipv6L3Protocol \"Rx\"");
647 NS_LOG_INFO (
"Ignoring packet to/from interface " << interface);
666 NS_LOG_INFO (
"Ignoring packet to/from interface " << interface);
683 NS_LOG_INFO (
"Ignoring packet to/from interface " << interface);
709 NS_LOG_INFO (
"Ignoring packet to/from interface " << interface);
715 #ifdef INTERFACE_CONTEXT
734 NS_LOG_INFO (
"Ignoring packet to/from interface " << interface);
738 #ifdef INTERFACE_CONTEXT
740 << *packet << std::endl;
757 NS_LOG_INFO (
"Ignoring packet to/from interface " << interface);
761 #ifdef INTERFACE_CONTEXT
763 << *packet << std::endl;
776 if ((*i).first.first == ipv4)
790 bool explicitFilename)
794 NS_LOG_INFO (
"Call to enable Ipv4 ascii tracing but Ipv4 not enabled");
823 std::string filename;
824 if (explicitFilename)
858 NS_ASSERT_MSG (result ==
true,
"InternetStackHelper::EnableAsciiIpv4Internal(): "
859 "Unable to connect ipv4L3Protocol \"Drop\"");
860 result = ipv4L3Protocol->TraceConnectWithoutContext (
"Tx",
862 NS_ASSERT_MSG (result ==
true,
"InternetStackHelper::EnableAsciiIpv4Internal(): "
863 "Unable to connect ipv4L3Protocol \"Tx\"");
864 result = ipv4L3Protocol->TraceConnectWithoutContext (
"Rx",
866 NS_ASSERT_MSG (result ==
true,
"InternetStackHelper::EnableAsciiIpv4Internal(): "
867 "Unable to connect ipv4L3Protocol \"Rx\"");
889 std::ostringstream oss;
897 oss <<
"/NodeList/" << node->
GetId () <<
"/$ns3::ArpL3Protocol/Drop";
905 oss <<
"/NodeList/" << node->
GetId () <<
"/$ns3::Ipv4L3Protocol/Drop";
908 oss <<
"/NodeList/" << node->
GetId () <<
"/$ns3::Ipv4L3Protocol/Tx";
911 oss <<
"/NodeList/" << node->
GetId () <<
"/$ns3::Ipv4L3Protocol/Rx";
936 NS_LOG_INFO (
"Ignoring packet to/from interface " << interface);
955 NS_LOG_INFO (
"Ignoring packet to/from interface " << interface);
972 NS_LOG_INFO (
"Ignoring packet to/from interface " << interface);
998 NS_LOG_INFO (
"Ignoring packet to/from interface " << interface);
1004 #ifdef INTERFACE_CONTEXT
1015 std::string context,
1023 NS_LOG_INFO (
"Ignoring packet to/from interface " << interface);
1027 #ifdef INTERFACE_CONTEXT
1029 << *packet << std::endl;
1038 std::string context,
1046 NS_LOG_INFO (
"Ignoring packet to/from interface " << interface);
1050 #ifdef INTERFACE_CONTEXT
1052 << *packet << std::endl;
1065 if ((*i).first.first == ipv6)
1079 bool explicitFilename)
1083 NS_LOG_INFO (
"Call to enable Ipv6 ascii tracing but Ipv6 not enabled");
1112 std::string filename;
1113 if (explicitFilename)
1137 bool result = ipv6L3Protocol->TraceConnectWithoutContext (
"Drop",
1139 NS_ASSERT_MSG (result ==
true,
"InternetStackHelper::EnableAsciiIpv6Internal(): "
1140 "Unable to connect ipv6L3Protocol \"Drop\"");
1141 result = ipv6L3Protocol->TraceConnectWithoutContext (
"Tx",
1143 NS_ASSERT_MSG (result ==
true,
"InternetStackHelper::EnableAsciiIpv6Internal(): "
1144 "Unable to connect ipv6L3Protocol \"Tx\"");
1145 result = ipv6L3Protocol->TraceConnectWithoutContext (
"Rx",
1147 NS_ASSERT_MSG (result ==
true,
"InternetStackHelper::EnableAsciiIpv6Internal(): "
1148 "Unable to connect ipv6L3Protocol \"Rx\"");
1170 std::ostringstream oss;
1173 oss <<
"/NodeList/" << node->
GetId () <<
"/$ns3::Ipv6L3Protocol/Drop";
1176 oss <<
"/NodeList/" << node->
GetId () <<
"/$ns3::Ipv6L3Protocol/Tx";
1179 oss <<
"/NodeList/" << node->
GetId () <<
"/$ns3::Ipv6L3Protocol/Rx";