36#include "ns3/boolean.h"
37#include "ns3/callback.h"
39#include "ns3/mac16-address.h"
40#include "ns3/mac64-address.h"
42#include "ns3/object-vector.h"
43#include "ns3/trace-source-accessor.h"
44#include "ns3/traffic-control-layer.h"
45#include "ns3/uinteger.h"
46#include "ns3/vector.h"
49#define IPV6_MIN_MTU 1280
64 TypeId(
"ns3::Ipv6L3Protocol")
66 .SetGroupName(
"Internet")
68 .AddAttribute(
"DefaultTtl",
69 "The TTL value set by default on all "
70 "outgoing packets generated on this node.",
73 MakeUintegerChecker<uint8_t>())
74 .AddAttribute(
"DefaultTclass",
75 "The TCLASS value set by default on all "
76 "outgoing packets generated on this node.",
79 MakeUintegerChecker<uint8_t>())
80 .AddAttribute(
"InterfaceList",
81 "The set of IPv6 interfaces associated to this IPv6 stack.",
84 MakeObjectVectorChecker<Ipv6Interface>())
85 .AddAttribute(
"SendIcmpv6Redirect",
86 "Send the ICMPv6 Redirect when appropriate.",
91 .AddAttribute(
"StrongEndSystemModel",
92 "Reject packets for an address not configured on the interface they're "
93 "coming from (RFC1122, section 3.3.4.2).",
98 "Send IPv6 packet to outgoing interface.",
100 "ns3::Ipv6L3Protocol::TxRxTracedCallback")
101 .AddTraceSource(
"Rx",
102 "Receive IPv6 packet from incoming interface.",
104 "ns3::Ipv6L3Protocol::TxRxTracedCallback")
105 .AddTraceSource(
"Drop",
108 "ns3::Ipv6L3Protocol::DropTracedCallback")
110 .AddTraceSource(
"SendOutgoing",
111 "A newly-generated packet by this node is "
112 "about to be queued for transmission",
114 "ns3::Ipv6L3Protocol::SentTracedCallback")
115 .AddTraceSource(
"UnicastForward",
116 "A unicast IPv6 packet was received by this node "
117 "and is being forwarded to another node",
119 "ns3::Ipv6L3Protocol::SentTracedCallback")
120 .AddTraceSource(
"LocalDeliver",
121 "An IPv6 packet was received by/for this node, "
122 "and it is being forward up the stack",
124 "ns3::Ipv6L3Protocol::SentTracedCallback");
155 it->second =
nullptr;
177 (*it)->StopValidTimer();
178 (*it)->StopPreferredTimer();
222 interface->SetNode(
m_node);
223 interface->SetDevice(device);
224 interface->SetTrafficControl(tc);
272 for (j = 0; j <
max; j++)
274 if ((*it)->GetAddress(j).GetAddress() == address)
294 for (j = 0; j < (*it)->GetNAddresses(); j++)
296 if ((*it)->GetAddress(j).GetAddress().CombinePrefix(mask) ==
297 address.CombinePrefix(mask))
322 return (*iter).second;
343 if (!defaultRouter.
IsAny())
361 address.SetOnLink(onLink);
366 if ((*it)->GetInterface() == interface && (*it)->GetPrefix() == network &&
367 (*it)->GetMask() == mask)
369 (*it)->StopPreferredTimer();
370 (*it)->StopValidTimer();
371 (*it)->StartPreferredTimer();
377 NS_LOG_INFO(
"Autoconfigured address is :" << address.GetAddress());
381 CreateObject<Ipv6AutoconfiguredPrefix>(
m_node,
388 aPrefix->StartPreferredTimer();
410 Address addr = iface->GetDevice()->GetAddress();
414 for (
uint32_t i = 0; i < iface->GetNAddresses(); i++)
416 if (iface->GetAddress(i).GetAddress() == addressToFind)
426 if ((*it)->GetInterface() == interface && (*it)->GetPrefix() == network &&
427 (*it)->GetMask() == mask)
447 address.SetOnLink(addOnLinkRoute);
448 bool ret = interface->AddAddress(address);
450 if (m_routingProtocol)
452 m_routingProtocol->NotifyAddAddress(i, address);
457 Ipv6Address networkAddress = address.GetAddress().CombinePrefix(address.GetPrefix());
459 GetRoutingProtocol()->NotifyAddRoute(networkAddress,
461 Ipv6Address::GetZero(),
472 return interface->GetNAddresses();
480 return interface->GetAddress(addressIndex);
492 if (m_routingProtocol)
494 m_routingProtocol->NotifyRemoveAddress(i, address);
515 if (m_routingProtocol)
517 m_routingProtocol->NotifyRemoveAddress(i, ifAddr);
529 interface->SetMetric(metric);
537 return interface->GetMetric();
552 return interface->GetDevice()->GetMtu();
567 return interface->IsUp();
581 if (interface->GetDevice()->GetMtu() >= 1280)
585 if (m_routingProtocol)
587 m_routingProtocol->NotifyInterfaceUp(i);
593 <<
" is set to be down for IPv6. Reason: not respecting minimum "
594 "IPv6 MTU (1280 octets)");
604 interface->SetDown();
606 if (m_routingProtocol)
608 m_routingProtocol->NotifyInterfaceDown(i);
631 device = CreateObject<LoopbackNetDevice>();
635 interface->SetDevice(device);
636 interface->SetNode(
m_node);
639 interface->AddAddress(ifaceAddr);
659 NS_LOG_LOGIC(
"Forwarding state: " << interface->IsForwarding());
660 return interface->IsForwarding();
668 interface->SetForwarding(val);
689 return test.GetAddress();
692 NS_ASSERT_MSG(
false,
"No link-local address found on interface " << interface);
701 if (
test.IsInSameSubnet(dest))
703 return test.GetAddress();
707 ret =
test.GetAddress();
714 "Could not find any address for " << dest <<
" on interface " << interface);
727 (*it)->SetForwarding(forward);
773 Ptr<Node> node = this->GetObject<Node>();
798 L4ListKey_t key = std::make_pair(protocol->GetProtocolNumber(), -1);
801 NS_LOG_WARN(
"Overwriting default protocol " <<
int(protocol->GetProtocolNumber()));
811 L4ListKey_t key = std::make_pair(protocol->GetProtocolNumber(), interfaceIndex);
814 NS_LOG_WARN(
"Overwriting protocol " <<
int(protocol->GetProtocolNumber())
815 <<
" on interface " <<
int(interfaceIndex));
825 L4ListKey_t key = std::make_pair(protocol->GetProtocolNumber(), -1);
829 NS_LOG_WARN(
"Trying to remove an non-existent default protocol "
830 <<
int(protocol->GetProtocolNumber()));
843 L4ListKey_t key = std::make_pair(protocol->GetProtocolNumber(), interfaceIndex);
847 NS_LOG_WARN(
"Trying to remove an non-existent protocol "
848 <<
int(protocol->GetProtocolNumber()) <<
" on interface "
849 <<
int(interfaceIndex));
871 L4List_t::const_iterator i;
872 if (interfaceIndex >= 0)
875 key = std::make_pair(protocolNumber, interfaceIndex);
883 key = std::make_pair(protocolNumber, -1);
959 bool found = packet->RemovePacketTag(tag);
968 found = packet->RemovePacketTag(tclassTag);
984 NS_LOG_LOGIC(
"Ipv6L3Protocol::Send case 1: passed in with a route");
985 hdr =
BuildHeader(source, destination, protocol, packet->GetSize(), ttl, tclass);
995 NS_LOG_LOGIC(
"Ipv6L3Protocol::Send case 2: probably sent to machine on same IPv6 network");
996 hdr =
BuildHeader(source, destination, protocol, packet->GetSize(), ttl, tclass);
1004 NS_LOG_LOGIC(
"Ipv6L3Protocol::Send case 3: passed in with no route " << destination);
1009 hdr =
BuildHeader(source, destination, protocol, packet->GetSize(), ttl, tclass);
1016 "Can not find an outgoing interface for a packet with src "
1017 << source <<
" and dst " << destination);
1044 NS_LOG_FUNCTION(
this << device << p << protocol << from << to << packetType);
1048 "Received a packet from an interface that is not known to IPv6");
1049 uint32_t interface = GetInterfaceForDevice(device);
1054 if (ipv6Interface->IsUp())
1056 m_rxTrace(packet,
this, interface);
1060 NS_LOG_LOGIC(
"Dropping received packet-- interface is down");
1062 packet->RemoveHeader(hdr);
1063 m_dropTrace(hdr, packet, DROP_INTERFACE_DOWN,
this, interface);
1068 packet->RemoveHeader(hdr);
1091 std::list<NdiscCache::Entry*> entryList = ndiscCache->LookupInverse(from);
1092 std::list<NdiscCache::Entry*>::iterator iter;
1093 for (iter = entryList.begin(); iter != entryList.end(); iter++)
1095 (*iter)->UpdateReachableTimer();
1101 for (SocketList::iterator it = m_sockets.begin(); it != m_sockets.end(); ++it)
1104 socket->ForwardUp(packet, hdr, device);
1110 bool stopProcessing =
false;
1111 bool isDropped =
false;
1114 if (nextHeader == Ipv6Header::IPV6_EXT_HOP_BY_HOP)
1116 ipv6Extension = ipv6ExtensionDemux->GetExtension(nextHeader);
1120 ipv6Extension->Process(packet,
1132 m_dropTrace(hdr, packet, dropReason,
this, interface);
1143 LocalDeliver(packet, hdr, interface);
1148 LocalDeliver(packet, hdr, interface);
1153 bool isSolicited = ipv6Interface->IsSolicitedMulticastAddress(hdr.
GetDestination());
1154 bool isRegisteredOnInterface =
1156 bool isRegisteredGlobally = IsRegisteredMulticastAddress(hdr.
GetDestination());
1157 if (isSolicited || isRegisteredGlobally || isRegisteredOnInterface)
1159 LocalDeliver(packet, hdr, interface);
1164 for (
uint32_t j = 0; j < GetNInterfaces(); j++)
1166 for (
uint32_t i = 0; i < GetNAddresses(j); i++)
1174 NS_LOG_LOGIC(
"For me (destination " << addr <<
" match)");
1175 LocalDeliver(packet, hdr, interface);
1178 else if (!m_strongEndSystemModel)
1181 << addr <<
" match) on another interface with Weak ES Model"
1183 LocalDeliver(packet, hdr, interface);
1190 <<
" match) on another interface with Strong ES Model - discarding"
1192 m_dropTrace(hdr, packet, DROP_NO_ROUTE,
this, interface);
1200 if (!m_routingProtocol->RouteInput(packet, hdr, device, m_ucb, m_mcb, m_lcb, m_ecb))
1202 NS_LOG_WARN(
"No route found for forwarding packet. Drop.");
1216 packetCopy->AddHeader(ipHeader);
1233 int32_t interface = GetInterfaceForDevice(dev);
1237 NS_LOG_LOGIC(
"Send via NetDevice ifIndex " << dev->GetIfIndex() <<
" Ipv6InterfaceIndex "
1241 std::list<Ipv6ExtensionFragment::Ipv6PayloadHeaderPair> fragments;
1244 bool fromMe =
false;
1245 for (
uint32_t i = 0; i < GetNInterfaces(); i++)
1247 for (
uint32_t j = 0; j < GetNAddresses(i); j++)
1249 if (GetAddress(i, j).GetAddress() == ipHeader.
GetSource())
1257 size_t targetMtu = 0;
1264 targetMtu = (size_t)(m_pmtuCache->GetPmtu(ipHeader.
GetDestination()));
1268 targetMtu = dev->GetMtu();
1279 packet->AddHeader(ipHeader);
1280 icmpv6->SendErrorTooBig(packet, ipHeader.
GetSource(), dev->GetMtu());
1289 PeekPointer(ipv6ExtensionDemux->GetExtension(Ipv6Header::IPV6_EXT_FRAGMENTATION)));
1291 ipv6Fragment->GetFragments(packet, ipHeader, targetMtu, fragments);
1294 if (route->GetGateway() != Ipv6Address::GetAny())
1296 if (outInterface->IsUp())
1298 NS_LOG_LOGIC(
"Send to gateway " << route->GetGateway());
1300 if (!fragments.empty())
1302 std::ostringstream oss;
1304 for (std::list<Ipv6ExtensionFragment::Ipv6PayloadHeaderPair>::const_iterator it =
1306 it != fragments.end();
1309 CallTxTrace(it->second, it->first,
this, interface);
1310 outInterface->Send(it->first, it->second, route->GetGateway());
1315 CallTxTrace(ipHeader, packet,
this, interface);
1316 outInterface->Send(packet, ipHeader, route->GetGateway());
1321 NS_LOG_LOGIC(
"Dropping-- outgoing interface is down: " << route->GetGateway());
1322 m_dropTrace(ipHeader, packet, DROP_INTERFACE_DOWN,
this, interface);
1327 if (outInterface->IsUp())
1331 if (!fragments.empty())
1333 std::ostringstream oss;
1335 for (std::list<Ipv6ExtensionFragment::Ipv6PayloadHeaderPair>::const_iterator it =
1337 it != fragments.end();
1340 CallTxTrace(it->second, it->first,
this, interface);
1341 outInterface->Send(it->first, it->second, ipHeader.
GetDestination());
1346 CallTxTrace(ipHeader, packet,
this, interface);
1353 m_dropTrace(ipHeader, packet, DROP_INTERFACE_DOWN,
this, interface);
1370 NS_LOG_WARN(
"Received a packet for 2001:db8::/32 (documentation class). Drop.");
1393 packet->AddHeader(ipHeader);
1394 GetIcmpv6()->SendErrorTimeExceeded(packet,
1429 copy->AddHeader(header);
1434 if (icmpv6->Lookup(target, rtentry->GetOutputDevice(),
nullptr, &hardwareTarget))
1436 icmpv6->SendRedirection(copy, linkLocal, src, target, dst, hardwareTarget);
1440 icmpv6->SendRedirection(copy, linkLocal, src, target, dst,
Address());
1445 packet->RemovePacketTag(priorityTag);
1460 std::map<uint32_t, uint32_t> ttlMap = mrtentry->GetOutputTtlMap();
1461 std::map<uint32_t, uint32_t>::iterator mapIter;
1463 for (mapIter = ttlMap.begin(); mapIter != ttlMap.end(); mapIter++)
1465 uint32_t interfaceId = mapIter->first;
1476 NS_LOG_LOGIC(
"Forward multicast via interface " << interfaceId);
1497 uint8_t nextHeaderPosition = 0;
1498 bool isDropped =
false;
1499 bool stopProcessing =
false;
1507 p->CopyData(&buf, 1);
1510 NS_LOG_WARN(
"Double Ipv6Header::IPV6_EXT_HOP_BY_HOP in packet, dropping packet");
1519 ipv6Extension = ipv6ExtensionDemux->GetExtension(nextHeader);
1523 uint8_t nextHeaderStep = 0;
1524 uint8_t curHeader = nextHeader;
1525 nextHeaderStep = ipv6Extension->Process(p,
1533 nextHeaderPosition += nextHeaderStep;
1545 "Zero-size IPv6 Option Header, aborting" << *packet);
1557 malformedPacket->AddHeader(ip);
1559 if (nextHeaderPosition == 0)
1561 GetIcmpv6()->SendErrorParameterError(malformedPacket,
1568 GetIcmpv6()->SendErrorParameterError(malformedPacket,
1572 nextHeaderPosition);
1579 p->RemoveAtStart(nextHeaderPosition);
1604 copy->AddHeader(ip);
1605 GetIcmpv6()->SendErrorDestinationUnreachable(
1612 }
while (ipv6Extension);
1621 NS_LOG_LOGIC(
"Route input failure-- dropping packet to " << ipHeader <<
" with errno "
1629 packet->AddHeader(ipHeader);
1630 GetIcmpv6()->SendErrorDestinationUnreachable(packet,
1640 uint16_t payloadSize,
1665 ipv6ExtensionDemux->SetNode(
m_node);
1668 hopbyhopExtension->SetNode(
m_node);
1670 destinationExtension->SetNode(
m_node);
1672 fragmentExtension->SetNode(
m_node);
1674 routingExtension->SetNode(
m_node);
1678 ipv6ExtensionDemux->Insert(hopbyhopExtension);
1679 ipv6ExtensionDemux->Insert(destinationExtension);
1680 ipv6ExtensionDemux->Insert(fragmentExtension);
1681 ipv6ExtensionDemux->Insert(routingExtension);
1686 CreateObject<Ipv6ExtensionRoutingDemux>();
1687 routingExtensionDemux->SetNode(
m_node);
1689 CreateObject<Ipv6ExtensionLooseRouting>();
1690 looseRoutingExtension->SetNode(
m_node);
1691 routingExtensionDemux->Insert(looseRoutingExtension);
1705 ipv6OptionDemux->SetNode(
m_node);
1708 pad1Option->SetNode(
m_node);
1710 padnOption->SetNode(
m_node);
1712 jumbogramOption->SetNode(
m_node);
1714 routerAlertOption->SetNode(
m_node);
1716 ipv6OptionDemux->Insert(pad1Option);
1717 ipv6OptionDemux->Insert(padnOption);
1718 ipv6OptionDemux->Insert(jumbogramOption);
1719 ipv6OptionDemux->Insert(routerAlertOption);
1735 if (!address.IsMulticast())
1737 NS_LOG_WARN(
"Not adding a non-multicast address " << address);
1750 if (!address.IsMulticast())
1752 NS_LOG_WARN(
"Not adding a non-multicast address " << address);
1838 std::list<NdiscCache::Ipv6PayloadHeaderPair> waiting =
1840 for (std::list<NdiscCache::Ipv6PayloadHeaderPair>::const_iterator it = waiting.begin();
1841 it != waiting.end();
1844 ndiscCache->GetInterface()->Send(it->first, it->second, it->second.GetSource());
a polymophic address class
AttributeValue implementation for Boolean.
An implementation of the ICMPv6 protocol.
static uint16_t GetStaticProtocolNumber()
Get ICMPv6 protocol number.
Describes an IPv6 address.
bool IsLinkLocal() const
If the IPv6 address is a link-local address (fe80::/64).
static Ipv6Address GetAny()
Get the "any" (::) Ipv6Address.
bool IsDocumentation() const
If the IPv6 address is a documentation address (2001:DB8::/32).
bool IsAllNodesMulticast() const
If the IPv6 address is "all nodes multicast" (ff02::1/8).
bool IsLinkLocalMulticast() const
If the IPv6 address is link-local multicast (ff02::/16).
static Ipv6Address GetZero()
Get the 0 (::) Ipv6Address.
static Ipv6Address MakeAutoconfiguredAddress(Address addr, Ipv6Address prefix)
Make the autoconfigured IPv6 address from a Mac address.
bool IsMulticast() const
If the IPv6 address is multicast (ff00::/8).
bool IsAny() const
If the IPv6 address is the "Any" address.
bool IsLocalhost() const
If the IPv6 address is localhost (::1).
static Ipv6Address GetLoopback()
Get the loopback address.
bool IsAllRoutersMulticast() const
If the IPv6 address is "all routers multicast" (ff02::2/8).
Demultiplexes IPv6 extensions.
Access to the IPv6 forwarding table, interfaces, and configuration.
IPv6 address associated with an interface.
Ipv6Address GetAddress() const
Get the IPv6 address.
@ LINKLOCAL
Link-local address (fe80::/64)
@ GLOBAL
Global address (2000::/3)
The IPv6 representation of a network interface.
Ipv6InterfaceAddress GetLinkLocalAddress() const
Get link-local address from IPv6 interface.
virtual Ptr< NetDevice > GetDevice() const
Get the NetDevice.
IPv6 layer implementation.
bool GetIpForward() const override
Get IPv6 forwarding state.
Ptr< Ipv6PmtuCache > m_pmtuCache
Path MTU Cache.
Ipv6RoutingProtocol::MulticastForwardCallback m_mcb
Multicast forward callback.
void SetForwarding(uint32_t i, bool val) override
Enable or disable forwarding on interface.
void SetPmtu(Ipv6Address dst, uint32_t pmtu) override
Set the Path MTU for the specified IPv6 destination address.
void RegisterOptions() override
Register the IPv6 Options.
void RouteInputError(Ptr< const Packet > p, const Ipv6Header &ipHeader, Socket::SocketErrno sockErrno)
Fallback when no route is found.
uint8_t m_defaultTclass
Default TCLASS for outgoing packets.
bool IsRegisteredMulticastAddress(Ipv6Address address) const
Checks if the address has been registered.
Ptr< Ipv6RoutingProtocol > GetRoutingProtocol() const override
Get current routing protocol used.
bool GetMtuDiscover() const override
Get IPv6 MTU discover state.
bool AddAddress(uint32_t i, Ipv6InterfaceAddress address, bool addOnLinkRoute=true) override
Add an address on interface.
std::map< Ipv6RegisteredMulticastAddressKey_t, uint32_t >::const_iterator Ipv6RegisteredMulticastAddressCIter_t
Container Const Iterator of the IPv6 multicast addresses.
uint16_t GetMetric(uint32_t i) const override
Get metric for an interface.
Ipv6RoutingProtocol::UnicastForwardCallback m_ucb
Unicast forward callback.
void AddAutoconfiguredAddress(uint32_t interface, Ipv6Address network, Ipv6Prefix mask, uint8_t flags, uint32_t validTime, uint32_t preferredTime, Ipv6Address defaultRouter=Ipv6Address::GetZero())
Add an autoconfigured address with RA information.
void SetUp(uint32_t i) override
Set an interface up.
TracedCallback< Ptr< const Packet >, Ptr< Ipv6 >, uint32_t > m_txTrace
Callback to trace TX (transmission) packets.
bool IsForwarding(uint32_t i) const override
Is interface allows forwarding ?
bool m_sendIcmpv6Redirect
Allow ICMPv6 Redirect sending state.
Ptr< Icmpv6L4Protocol > GetIcmpv6() const
Get ICMPv6 protocol.
bool ReachabilityHint(uint32_t ipInterfaceIndex, Ipv6Address address)
Provides reachability hint for Neighbor Cache Entries from L4-L7 protocols.
uint8_t m_defaultTtl
Default TTL for outgoing packets.
void SetMetric(uint32_t i, uint16_t metric) override
Set metric for an interface.
TracedCallback< Ptr< const Packet >, Ptr< Ipv6 >, uint32_t > m_rxTrace
Callback to trace RX (reception) packets.
TracedCallback< const Ipv6Header &, Ptr< const Packet >, DropReason, Ptr< Ipv6 >, uint32_t > m_dropTrace
Callback to trace drop packets.
DropReason
Reason why a packet has been dropped.
@ DROP_ROUTE_ERROR
Route error.
@ DROP_TTL_EXPIRED
Packet TTL has expired.
@ DROP_NO_ROUTE
No route to host.
@ DROP_UNKNOWN_PROTOCOL
Unknown L4 protocol.
uint32_t GetNAddresses(uint32_t interface) const override
Get number of address for an interface.
int32_t GetInterfaceForDevice(Ptr< const NetDevice > device) const override
Get interface index which is on a specified net device.
void RegisterExtensions() override
Register the IPv6 Extensions.
TracedCallback< const Ipv6Header &, Ptr< const Packet >, uint32_t > m_sendOutgoingTrace
Trace of sent packets.
bool m_ipForward
Forwarding packets (i.e.
Ipv6AutoconfiguredPrefixList m_prefixes
List of IPv6 prefix received from RA.
std::list< Ptr< Ipv6AutoconfiguredPrefix > >::iterator Ipv6AutoconfiguredPrefixListI
Iterator of the container of the IPv6 Autoconfigured addresses.
void CallTxTrace(const Ipv6Header &ipHeader, Ptr< Packet > packet, Ptr< Ipv6 > ipv6, uint32_t interface)
Make a copy of the packet, add the header and invoke the TX trace callback.
Ipv6InterfaceList m_interfaces
List of IPv6 interfaces.
void Remove(Ptr< IpL4Protocol > protocol) override
Remove a L4 protocol.
Ipv6RegisteredMulticastAddressNoInterface_t m_multicastAddressesNoInterface
List of multicast IP addresses of interest for all the interfaces.
Ipv6InterfaceAddress GetAddress(uint32_t interfaceIndex, uint32_t addressIndex) const override
Get an address.
SocketList m_sockets
List of IPv6 raw sockets.
Ipv6Header BuildHeader(Ipv6Address src, Ipv6Address dst, uint8_t protocol, uint16_t payloadSize, uint8_t hopLimit, uint8_t tclass)
Construct an IPv6 header.
void SetNode(Ptr< Node > node)
Set node associated with this stack.
Ipv6Address SourceAddressSelection(uint32_t interface, Ipv6Address dest) override
Choose the source address to use with destination address.
Ptr< Node > m_node
Node attached to stack.
virtual bool GetSendIcmpv6Redirect() const
Get the ICMPv6 Redirect sending state.
L4List_t m_protocols
List of transport protocol.
Ptr< Ipv6Interface > GetInterface(uint32_t i) const
Get an interface.
TracedCallback< const Ipv6Header &, Ptr< const Packet >, uint32_t > m_unicastForwardTrace
Trace of unicast forwarded packets.
uint32_t m_nInterfaces
Number of IPv6 interfaces managed by the stack.
void AddMulticastAddress(Ipv6Address address)
Adds a multicast address to the list of addresses to pass to local deliver.
virtual void ReportDrop(Ipv6Header ipHeader, Ptr< Packet > p, DropReason dropReason)
Report a packet drop.
void Send(Ptr< Packet > packet, Ipv6Address source, Ipv6Address destination, uint8_t protocol, Ptr< Ipv6Route > route) override
Higher-level layers call this method to send a packet down the stack to the MAC and PHY layers.
void SetupLoopback()
Setup loopback interface.
Ptr< IpL4Protocol > GetProtocol(int protocolNumber) const override
Get L4 protocol by protocol number.
Ptr< Socket > CreateRawSocket()
Create raw IPv6 socket.
Ipv6RegisteredMulticastAddress_t m_multicastAddresses
List of multicast IP addresses of interest, divided per interface.
void RemoveAutoconfiguredAddress(uint32_t interface, Ipv6Address network, Ipv6Prefix mask, Ipv6Address defaultRouter)
Remove an autoconfigured address.
uint16_t GetMtu(uint32_t i) const override
Get MTU for an interface.
void Insert(Ptr< IpL4Protocol > protocol) override
Add a L4 protocol.
bool m_mtuDiscover
MTU Discover (i.e.
void SetDefaultTtl(uint8_t ttl)
Set the default TTL.
uint32_t AddInterface(Ptr< NetDevice > device) override
Add IPv6 interface for a device.
Ipv6RoutingProtocol::ErrorCallback m_ecb
Error callback.
bool RemoveAddress(uint32_t interfaceIndex, uint32_t addressIndex) override
Remove an address from an interface.
void Receive(Ptr< NetDevice > device, Ptr< const Packet > p, uint16_t protocol, const Address &from, const Address &to, NetDevice::PacketType packetType)
Receive method when a packet arrive in the stack.
Ptr< NetDevice > GetNetDevice(uint32_t i) override
Get device by index.
std::map< Ipv6Address, uint32_t >::const_iterator Ipv6RegisteredMulticastAddressNoInterfaceCIter_t
Container Const Iterator of the IPv6 multicast addresses.
void RemoveMulticastAddress(Ipv6Address address)
Removes a multicast address from the list of addresses to pass to local deliver.
void SetDown(uint32_t i) override
set an interface down.
void DoDispose() override
Dispose object.
uint32_t AddIpv6Interface(Ptr< Ipv6Interface > interface)
Add an IPv6 interface to the stack.
Ptr< Ipv6RoutingProtocol > m_routingProtocol
Routing protocol.
virtual void SetSendIcmpv6Redirect(bool sendIcmpv6Redirect)
Set the ICMPv6 Redirect sending state.
void NotifyNewAggregate() override
Notify other components connected to the node that a new stack member is now connected.
void IpMulticastForward(Ptr< const NetDevice > idev, Ptr< Ipv6MulticastRoute > mrtentry, Ptr< const Packet > p, const Ipv6Header &header)
Forward a multicast packet.
~Ipv6L3Protocol() override
Destructor.
void DeleteRawSocket(Ptr< Socket > socket)
Remove raw IPv6 socket.
Ipv6InterfaceReverseContainer m_reverseInterfacesContainer
Container of NetDevice / Interface index associations.
void SendRealOut(Ptr< Ipv6Route > route, Ptr< Packet > packet, const Ipv6Header &ipHeader)
Send packet with route.
bool m_strongEndSystemModel
Rejects packets directed to an interface with wrong address (RFC 1222).
TracedCallback< const Ipv6Header &, Ptr< const Packet >, uint32_t > m_localDeliverTrace
Trace of locally delivered packets.
int32_t GetInterfaceForPrefix(Ipv6Address addr, Ipv6Prefix mask) const override
Get interface index which match specified address/prefix.
static const uint16_t PROT_NUMBER
The protocol number for IPv6 (0x86DD).
void SetDefaultTclass(uint8_t tclass)
Set the default TCLASS.
void IpForward(Ptr< const NetDevice > idev, Ptr< Ipv6Route > rtentry, Ptr< const Packet > p, const Ipv6Header &header)
Forward a packet.
uint32_t GetNInterfaces() const override
Get current number of interface on this stack.
bool IsUp(uint32_t i) const override
Is specified interface up ?
void SetRoutingProtocol(Ptr< Ipv6RoutingProtocol > routingProtocol) override
Set routing protocol for this stack.
std::pair< Ipv6Address, uint64_t > Ipv6RegisteredMulticastAddressKey_t
IPv6 multicast addresses / interface key.
Ipv6RoutingProtocol::LocalDeliverCallback m_lcb
Local delivery callback.
std::pair< int, int32_t > L4ListKey_t
Container of the IPv6 L4 keys: protocol number, interface index.
int32_t GetInterfaceForAddress(Ipv6Address addr) const override
Get interface index which has specified IPv6 address.
Ipv6L3Protocol()
Constructor.
void SetIpForward(bool forward) override
Set IPv6 forwarding state.
void LocalDeliver(Ptr< const Packet > p, const Ipv6Header &ip, uint32_t iif)
Deliver a packet.
static TypeId GetTypeId()
Get the type ID of this class.
void SetMtuDiscover(bool mtuDiscover) override
Set IPv6 MTU discover state.
Describes an IPv6 prefix.
A record that holds information about a NdiscCache entry.
bool IsPermanent() const
Is the entry PERMANENT.
void ClearWaitingPacket()
Clear the waiting packet list.
void StartReachableTimer()
Start the reachable timer.
void UpdateReachableTimer()
Update the reachable timer.
Address GetMacAddress() const
Get the MAC address of this entry.
std::list< Ipv6PayloadHeaderPair > MarkReachable(Address mac)
Changes the state to this entry to REACHABLE.
bool IsIncomplete() const
Is the entry INCOMPLETE.
bool IsProbe() const
Is the entry PROBE.
bool IsAutoGenerated() const
Is the entry STATIC_AUTOGENERATED.
bool IsReachable() const
Is the entry REACHABLE.
PacketType
Packet types are used as they are in Linux.
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
uint32_t GetNDevices() const
Ptr< NetDevice > GetDevice(uint32_t index) const
Retrieve the index-th NetDevice associated to this node.
void RegisterProtocolHandler(ProtocolHandler handler, uint16_t protocolType, Ptr< NetDevice > device, bool promiscuous=false)
virtual void NotifyNewAggregate()
Notify all Objects aggregated to this one of a new Object being aggregated.
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
virtual void DoDispose()
Destructor implementation.
Smart pointer class similar to boost::intrusive_ptr.
SocketErrno
Enumeration of the possible errors returned by a socket.
This class implements a tag that carries the socket-specific HOPLIMIT of a packet to the IPv6 layer.
uint8_t GetHopLimit() const
Get the tag's Hop Limit.
indicates whether the socket has IPV6_TCLASS set.
uint8_t GetTclass() const
Get the tag's Tclass.
indicates whether the socket has a priority set.
The Traffic Control layer aims at introducing an equivalent of the Linux Traffic Control infrastructu...
virtual void Receive(Ptr< NetDevice > device, Ptr< const Packet > p, uint16_t protocol, const Address &from, const Address &to, NetDevice::PacketType packetType)
Called by NetDevices, incoming packet.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Hold an unsigned integer type.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Ptr< const AttributeChecker > MakeBooleanChecker()
ObjectPtrContainerValue ObjectVectorValue
ObjectVectorValue is an alias for ObjectPtrContainerValue.
Ptr< const AttributeAccessor > MakeObjectVectorAccessor(U T::*memberVariable)
MakeAccessorHelper implementation for ObjectVector.
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
#define IPV6_MIN_MTU
Minimum IPv6 MTU, as defined by RFC 2460
Every class exported by the ns3 library is enclosed in the ns3 namespace.
U * PeekPointer(const Ptr< U > &p)
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
-ns3 Test suite for the ns3 wrapper script