23 #include "ns3/uinteger.h"
24 #include "ns3/vector.h"
25 #include "ns3/boolean.h"
26 #include "ns3/callback.h"
27 #include "ns3/trace-source-accessor.h"
28 #include "ns3/object-vector.h"
29 #include "ns3/ipv6-routing-protocol.h"
30 #include "ns3/ipv6-route.h"
31 #include "ns3/mac16-address.h"
32 #include "ns3/mac64-address.h"
33 #include "ns3/traffic-control-layer.h"
50 #define IPV6_MIN_MTU 1280
64 .SetGroupName (
"Internet")
66 .AddAttribute (
"DefaultTtl",
67 "The TTL value set by default on all "
68 "outgoing packets generated on this node.",
71 MakeUintegerChecker<uint8_t> ())
72 .AddAttribute (
"DefaultTclass",
73 "The TCLASS value set by default on all "
74 "outgoing packets generated on this node.",
77 MakeUintegerChecker<uint8_t> ())
78 .AddAttribute (
"InterfaceList",
79 "The set of IPv6 interfaces associated to this IPv6 stack.",
82 MakeObjectVectorChecker<Ipv6Interface> ())
83 .AddAttribute (
"SendIcmpv6Redirect",
84 "Send the ICMPv6 Redirect when appropriate.",
89 .AddAttribute (
"StrongEndSystemModel",
90 "Reject packets for an address not configured on the interface they're coming from (RFC1222).",
94 .AddTraceSource (
"Tx",
95 "Send IPv6 packet to outgoing interface.",
97 "ns3::Ipv6L3Protocol::TxRxTracedCallback")
98 .AddTraceSource (
"Rx",
99 "Receive IPv6 packet from incoming interface.",
101 "ns3::Ipv6L3Protocol::TxRxTracedCallback")
102 .AddTraceSource (
"Drop",
105 "ns3::Ipv6L3Protocol::DropTracedCallback")
107 .AddTraceSource (
"SendOutgoing",
108 "A newly-generated packet by this node is "
109 "about to be queued for transmission",
111 "ns3::Ipv6L3Protocol::SentTracedCallback")
112 .AddTraceSource (
"UnicastForward",
113 "A unicast IPv6 packet was received by this node "
114 "and is being forwarded to another node",
116 "ns3::Ipv6L3Protocol::SentTracedCallback")
117 .AddTraceSource (
"LocalDeliver",
118 "An IPv6 packet was received by/for this node, "
119 "and it is being forward up the stack",
121 "ns3::Ipv6L3Protocol::SentTracedCallback")
170 (*it)->StopValidTimer ();
171 (*it)->StopPreferredTimer ();
210 interface->SetNode (
m_node);
211 interface->SetDevice (device);
212 interface->SetTrafficControl (tc);
253 uint32_t
max = (*it)->GetNAddresses ();
255 for (j = 0; j <
max; j++)
257 if ((*it)->GetAddress (j).GetAddress () ==
address)
275 for (j = 0; j < (*it)->GetNAddresses (); j++)
277 if ((*it)->GetAddress (j).GetAddress ().CombinePrefix (mask) ==
address.CombinePrefix (mask))
300 return (*iter).second;
308 NS_LOG_FUNCTION (
this << interface << network << mask << (uint32_t)flags << validTime << preferredTime);
313 if (!defaultRouter.
IsAny())
332 if ((*it)->GetInterface () == interface && (*it)->GetPrefix () == network && (*it)->GetMask () == mask)
334 (*it)->StopPreferredTimer ();
335 (*it)->StopValidTimer ();
336 (*it)->StartPreferredTimer ();
380 if ((*it)->GetInterface () == interface && (*it)->GetPrefix () == network && (*it)->GetMask () == mask)
395 address.SetOnLink (addOnLinkRoute);
396 bool ret = interface->AddAddress (
address);
491 return interface->
GetDevice ()->GetMtu ();
505 return interface->
IsUp ();
518 if (interface->GetDevice ()->GetMtu () >= 1280)
529 NS_LOG_LOGIC (
"Interface " <<
int(i) <<
" is set to be down for IPv6. Reason: not respecting minimum IPv6 MTU (1280 octets)");
564 device = CreateObject<LoopbackNetDevice> ();
568 interface->SetDevice (device);
569 interface->SetNode (
m_node);
571 interface->AddAddress (ifaceAddr);
588 NS_LOG_LOGIC (
"Forwarding state: " << interface->IsForwarding ());
589 return interface->IsForwarding ();
611 return test.GetAddress ();
614 NS_ASSERT_MSG (
false,
"No link-local address found on interface " << interface);
623 if (test.IsInSameSubnet (dest))
625 return test.GetAddress ();
629 ret = test.GetAddress ();
645 (*it)->SetForwarding (forward);
685 Ptr<Node> node = this->GetObject<Node> ();
752 NS_LOG_WARN (
"Trying to remove an non-existent protocol " <<
int(protocol->
GetProtocolNumber ()) <<
" on interface " <<
int(interfaceIndex));
772 L4List_t::const_iterator i;
773 if (interfaceIndex >= 0)
776 key = std::make_pair (protocolNumber, interfaceIndex);
784 key = std::make_pair (protocolNumber, -1);
846 NS_LOG_FUNCTION (
this << packet << source << destination << (uint32_t)protocol << route);
875 NS_LOG_LOGIC (
"Ipv6L3Protocol::Send case 1: passed in with a route");
886 NS_LOG_LOGIC (
"Ipv6L3Protocol::Send case 2: probably sent to machine on same IPv6 network");
895 NS_LOG_LOGIC (
"Ipv6L3Protocol::Send case 3: passed in with no route " << destination);
908 NS_ASSERT_MSG (index >= 0,
"Can not find an outgoing interface for a packet with src " << source <<
" and dst " << destination);
929 NS_LOG_FUNCTION (
this << device << p << protocol << from << to << packetType);
933 uint32_t
interface = GetInterfaceForDevice(device);
938 if (ipv6Interface->IsUp ())
944 NS_LOG_LOGIC (
"Dropping received packet-- interface is down");
975 std::list<NdiscCache::Entry *> entryList = ndiscCache->
LookupInverse (from);
976 std::list<NdiscCache::Entry *>::iterator iter;
977 for (iter = entryList.begin (); iter != entryList.end (); iter ++)
979 (*iter)->UpdateReachableTimer ();
996 bool stopProcessing =
false;
997 bool isDropped =
false;
1002 ipv6Extension = ipv6ExtensionDemux->GetExtension (nextHeader);
1006 ipv6Extension->Process (packet, 0, hdr, hdr.
GetDestinationAddress (), (uint8_t *)0, stopProcessing, isDropped, dropReason);
1035 if (isSolicited || isRegisteredGlobally || isRegisteredOnInterface)
1055 NS_LOG_LOGIC (
"For me (destination " << addr <<
" match)");
1075 NS_LOG_WARN (
"No route found for forwarding packet. Drop.");
1086 m_txTrace (packetCopy, ipv6, interface);
1100 int32_t
interface = GetInterfaceForDevice (dev);
1104 NS_LOG_LOGIC (
"Send via NetDevice ifIndex " << dev->GetIfIndex () <<
" Ipv6InterfaceIndex " << interface);
1107 std::list<Ipv6ExtensionFragment::Ipv6PayloadHeaderPair> fragments;
1113 targetMtu = dev->GetMtu ();
1116 if (packet->
GetSize () > targetMtu + 40)
1120 bool fromMe =
false;
1138 icmpv6->SendErrorTooBig (packet, ipHeader.
GetSourceAddress (), dev->GetMtu ());
1148 ipv6Fragment->GetFragments (packet, ipHeader, targetMtu, fragments);
1153 if (outInterface->
IsUp ())
1155 NS_LOG_LOGIC (
"Send to gateway " << route->GetGateway ());
1157 if (fragments.size () != 0)
1159 std::ostringstream oss;
1161 for (std::list<Ipv6ExtensionFragment::Ipv6PayloadHeaderPair>::const_iterator it = fragments.begin (); it != fragments.end (); it++)
1164 outInterface->
Send (it->first, it->second, route->GetGateway ());
1170 outInterface->
Send (packet, ipHeader, route->GetGateway ());
1175 NS_LOG_LOGIC (
"Dropping-- outgoing interface is down: " << route->GetGateway ());
1181 if (outInterface->
IsUp ())
1185 if (fragments.size () != 0)
1187 std::ostringstream oss;
1189 for (std::list<Ipv6ExtensionFragment::Ipv6PayloadHeaderPair>::const_iterator it = fragments.begin (); it != fragments.end (); it++)
1217 NS_LOG_WARN (
"Received a packet for 2001:db8::/32 (documentation class). Drop.");
1268 if (target.
IsAny ())
1276 if (icmpv6->Lookup (target, rtentry->GetOutputDevice (), 0, &hardwareTarget))
1278 icmpv6->SendRedirection (copy, linkLocal, src, target, dst, hardwareTarget);
1282 icmpv6->SendRedirection (copy, linkLocal, src, target, dst,
Address ());
1298 std::map<uint32_t, uint32_t> ttlMap = mrtentry->GetOutputTtlMap ();
1299 std::map<uint32_t, uint32_t>::iterator mapIter;
1301 for (mapIter = ttlMap.begin (); mapIter != ttlMap.end (); mapIter++)
1303 uint32_t interfaceId = mapIter->first;
1314 NS_LOG_LOGIC (
"Forward multicast via interface " << interfaceId);
1335 uint8_t nextHeaderPosition = 0;
1336 bool isDropped =
false;
1337 bool stopProcessing =
false;
1348 NS_LOG_WARN(
"Double Ipv6Header::IPV6_EXT_HOP_BY_HOP in packet, dropping packet");
1357 ipv6Extension = ipv6ExtensionDemux->GetExtension (nextHeader);
1361 uint8_t nextHeaderStep = 0;
1362 uint8_t curHeader = nextHeader;
1363 nextHeaderStep = ipv6Extension->Process (p, nextHeaderPosition, ip, dst, &nextHeader, stopProcessing, isDropped, dropReason);
1364 nextHeaderPosition += nextHeaderStep;
1376 "Zero-size IPv6 Option Header, aborting" << *packet );
1390 if (nextHeaderPosition == 0)
1434 while (ipv6Extension);
1440 NS_LOG_LOGIC (
"Route input failure-- dropping packet to " << ipHeader <<
" with errno " << sockErrno);
1454 NS_LOG_FUNCTION (
this << src << dst << (uint32_t)protocol << (uint32_t)payloadSize << (uint32_t)ttl << (uint32_t)tclass);
1469 ipv6ExtensionDemux->SetNode (
m_node);
1472 hopbyhopExtension->SetNode (
m_node);
1474 destinationExtension->SetNode (
m_node);
1476 fragmentExtension->SetNode (
m_node);
1482 ipv6ExtensionDemux->Insert (hopbyhopExtension);
1483 ipv6ExtensionDemux->Insert (destinationExtension);
1484 ipv6ExtensionDemux->Insert (fragmentExtension);
1485 ipv6ExtensionDemux->Insert (routingExtension);
1490 routingExtensionDemux->SetNode (
m_node);
1492 looseRoutingExtension->SetNode (
m_node);
1493 routingExtensionDemux->Insert (looseRoutingExtension);
1502 ipv6OptionDemux->SetNode (
m_node);
1505 pad1Option->SetNode (
m_node);
1507 padnOption->SetNode (
m_node);
1509 jumbogramOption->SetNode (
m_node);
1511 routerAlertOption->SetNode (
m_node);
1513 ipv6OptionDemux->Insert (pad1Option);
1514 ipv6OptionDemux->Insert (padnOption);
1515 ipv6OptionDemux->Insert (jumbogramOption);
1516 ipv6OptionDemux->Insert (routerAlertOption);
1636 for (std::list<NdiscCache::Ipv6PayloadHeaderPair>::const_iterator it = waiting.begin (); it != waiting.end (); it++)
1638 ndiscCache->
GetInterface ()->
Send (it->first, it->second, it->second.GetSourceAddress ());
a polymophic address class
AttributeValue implementation for Boolean.
An implementation of the ICMPv6 protocol.
static uint16_t GetStaticProtocolNumber()
Get ICMPv6 protocol number.
virtual int GetProtocolNumber(void) const =0
Returns the protocol number of this protocol.
virtual enum RxStatus Receive(Ptr< Packet > p, Ipv4Header const &header, Ptr< Ipv4Interface > incomingInterface)=0
Called from lower-level layers to send the packet up in the stack.
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.
static Ipv6Address GetLoopback()
Get the loopback address.
bool IsAllRoutersMulticast() const
If the IPv6 address is "all routers multicast" (ff02::2/8).
Demultiplexes IPv6 extensions.
void SetNode(Ptr< Node > node)
Set the node.
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.
void SetForwarding(bool forward)
Set forwarding enabled or not.
void SetDown()
Disable this interface.
bool IsUp() const
Is the interface UP ?
Ipv6InterfaceAddress GetAddress(uint32_t index) const
Get an address from IPv6 interface.
void SetUp()
Enable this interface.
void Send(Ptr< Packet > p, const Ipv6Header &hdr, Ipv6Address dest)
Send a packet through this interface.
uint16_t GetMetric() const
Get the metric.
uint32_t GetNAddresses(void) const
Get number of addresses on this IPv6 interface.
void SetMetric(uint16_t metric)
Set the metric.
virtual Ptr< NetDevice > GetDevice() const
Get the NetDevice.
IPv6 layer implementation.
Ptr< Ipv6PmtuCache > m_pmtuCache
Path MTU Cache.
bool IsForwarding(uint32_t i) const
Is interface allows forwarding ?
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.
virtual ~Ipv6L3Protocol()
Destructor.
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 SetForwarding(uint32_t i, bool val)
Enable or disable forwarding on interface.
Ipv6InterfaceAddress GetAddress(uint32_t interfaceIndex, uint32_t addressIndex) const
Get an address.
TracedCallback< Ptr< const Packet >, Ptr< Ipv6 >, uint32_t > m_txTrace
Callback to trace TX (transmission) packets.
bool m_sendIcmpv6Redirect
Allow ICMPv6 Redirect sending state.
virtual void RegisterExtensions()
Register the IPv6 Extensions.
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.
TracedCallback< Ptr< const Packet >, Ptr< Ipv6 >, uint32_t > m_rxTrace
Callback to trace RX (reception) packets.
DropReason
Reason why a packet has been dropped.
@ DROP_ROUTE_ERROR
Route error.
@ DROP_TTL_EXPIRED
Packet TTL has expired.
@ DROP_INTERFACE_DOWN
Interface is down so can not send packet.
@ DROP_NO_ROUTE
No route to host.
@ DROP_UNKNOWN_PROTOCOL
Unknown L4 protocol.
uint16_t GetMetric(uint32_t i) const
Get metric for an interface.
bool m_ipForward
Forwarding packets (i.e.
Ipv6AutoconfiguredPrefixList m_prefixes
List of IPv6 prefix received from RA.
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.
Ipv6RegisteredMulticastAddressNoInterface_t m_multicastAddressesNoInterface
List of multicast IP addresses of interest for all the interfaces.
int32_t GetInterfaceForPrefix(Ipv6Address addr, Ipv6Prefix mask) const
Get interface index which match specified address/prefix.
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.
Ptr< Node > m_node
Node attached to stack.
uint32_t AddInterface(Ptr< NetDevice > device)
Add IPv6 interface for a device.
Ptr< NetDevice > GetNetDevice(uint32_t i)
Get device by index.
Ptr< Ipv6RoutingProtocol > GetRoutingProtocol() const
Get current routing protocol used.
virtual bool GetIpForward() const
Get IPv6 forwarding state.
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.
void SetMetric(uint32_t i, uint16_t metric)
Set metric for an interface.
uint32_t m_nInterfaces
Number of IPv6 interfaces managed by the stack.
std::map< Ipv6Address, uint32_t >::const_iterator Ipv6RegisteredMulticastAddressNoInterfaceCIter_t
Container Const Iterator of the IPv6 multicast addresses.
void AddMulticastAddress(Ipv6Address address)
Adds a multicast address to the list of addresses to pass to local deliver.
int32_t GetInterfaceForAddress(Ipv6Address addr) const
Get interface index which has specified IPv6 address.
virtual void ReportDrop(Ipv6Header ipHeader, Ptr< Packet > p, DropReason dropReason)
Report a packet drop.
std::map< Ipv6RegisteredMulticastAddressKey_t, uint32_t >::const_iterator Ipv6RegisteredMulticastAddressCIter_t
Container Const Iterator of the IPv6 multicast addresses.
void SetupLoopback()
Setup loopback interface.
Ptr< Socket > CreateRawSocket()
Create raw IPv6 socket.
virtual Ptr< IpL4Protocol > GetProtocol(int protocolNumber) const
Get L4 protocol by protocol number.
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.
bool RemoveAddress(uint32_t interfaceIndex, uint32_t addressIndex)
Remove an address from an interface.
virtual void Remove(Ptr< IpL4Protocol > protocol)
Remove a L4 protocol.
TracedCallback< const Ipv6Header &, Ptr< const Packet >, uint32_t > m_unicastForwardTrace
Trace of unicast forwarded packets.
Ipv6Address SourceAddressSelection(uint32_t interface, Ipv6Address dest)
Choose the source address to use with destination address.
bool m_mtuDiscover
MTU Discover (i.e.
void SetDefaultTtl(uint8_t ttl)
Set the default TTL.
void SetUp(uint32_t i)
Set an interface up.
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.
void LocalDeliver(Ptr< const Packet > p, Ipv6Header const &ip, uint32_t iif)
Deliver a packet.
virtual bool GetMtuDiscover(void) const
Get IPv6 MTU discover state.
void RemoveMulticastAddress(Ipv6Address address)
Removes a multicast address from the list of addresses to pass to local deliver.
virtual void SetMtuDiscover(bool mtuDiscover)
Set IPv6 MTU discover state.
void SetRoutingProtocol(Ptr< Ipv6RoutingProtocol > routingProtocol)
Set routing protocol for this stack.
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 IpMulticastForward(Ptr< const NetDevice > idev, Ptr< Ipv6MulticastRoute > mrtentry, Ptr< const Packet > p, const Ipv6Header &header)
Forward a multicast packet.
bool IsUp(uint32_t i) const
Is specified interface up ?
uint16_t GetMtu(uint32_t i) const
Get MTU for an interface.
TracedCallback< const Ipv6Header &, Ptr< const Packet >, uint32_t > m_sendOutgoingTrace
Trace of sent packets.
int32_t GetInterfaceForDevice(Ptr< const NetDevice > device) const
Get interface index which is on a specified net device.
void SetDown(uint32_t i)
set an interface down.
uint32_t GetNAddresses(uint32_t interface) const
Get number of address for an interface.
void DeleteRawSocket(Ptr< Socket > socket)
Remove raw IPv6 socket.
virtual void SetPmtu(Ipv6Address dst, uint32_t pmtu)
Set the Path MTU for the specified IPv6 destination address.
Ipv6InterfaceReverseContainer m_reverseInterfacesContainer
Container of NetDevice / Interface index associations.
bool m_strongEndSystemModel
Rejects packets directed to an interface with wrong address (RFC 1222).
TracedCallback< const Ipv6Header &, Ptr< const Packet >, DropReason, Ptr< Ipv6 >, uint32_t > m_dropTrace
Callback to trace drop packets.
virtual void Send(Ptr< Packet > packet, Ipv6Address source, Ipv6Address destination, uint8_t protocol, Ptr< Ipv6Route > route)
Higher-level layers call this method to send a packet down the stack to the MAC and PHY layers.
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.
virtual void RegisterOptions()
Register the IPv6 Options.
bool AddAddress(uint32_t i, Ipv6InterfaceAddress address, bool addOnLinkRoute=true)
Add an address on interface.
std::pair< Ipv6Address, uint64_t > Ipv6RegisteredMulticastAddressKey_t
IPv6 multicast addresses / interface key.
void SendRealOut(Ptr< Ipv6Route > route, Ptr< Packet > packet, Ipv6Header const &ipHeader)
Send packet with route.
std::pair< int, int32_t > L4ListKey_t
Container of the IPv6 L4 keys: protocol number, interface index.
virtual void NotifyNewAggregate()
Notify other components connected to the node that a new stack member is now connected.
virtual void DoDispose()
Dispose object.
Ipv6L3Protocol()
Constructor.
std::list< Ptr< Ipv6AutoconfiguredPrefix > >::iterator Ipv6AutoconfiguredPrefixListI
Iterator of the container of the IPv6 Autoconfigured addresses.
virtual void SetIpForward(bool forward)
Set IPv6 forwarding state.
uint32_t GetNInterfaces() const
Get current number of interface on this stack.
static TypeId GetTypeId()
Get the type ID of this class.
virtual void Insert(Ptr< IpL4Protocol > protocol)
Add a L4 protocol.
TracedCallback< const Ipv6Header &, Ptr< const Packet >, uint32_t > m_localDeliverTrace
Trace of locally delivered packets.
Describes an IPv6 prefix.
void SetNode(Ptr< Node > node)
Set the node associated with this socket.
bool ForwardUp(Ptr< const Packet > p, Ipv6Header hdr, Ptr< NetDevice > device)
Forward up to receive method.
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 IsReachable() const
Is the entry REACHABLE.
virtual NdiscCache::Entry * Lookup(Ipv6Address dst)
Lookup in the cache.
std::list< NdiscCache::Entry * > LookupInverse(Address dst)
Lookup in the cache for a MAC address.
Ptr< Ipv6Interface > GetInterface() const
Get the Ipv6Interface associated with this cache.
PacketType
Packet types are used as they are in Linux.
uint32_t GetId(void) const
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
uint32_t GetNDevices(void) 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(void)
Notify all Objects aggregated to this one of a new Object being aggregated.
virtual void DoDispose(void)
Destructor implementation.
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Container for a set of ns3::Object pointers.
bool RemovePacketTag(Tag &tag)
Remove a packet tag.
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
void AddHeader(const Header &header)
Add header to this packet.
uint32_t CopyData(uint8_t *buffer, uint32_t size) const
Copy the packet contents to a byte buffer.
void RemoveAtEnd(uint32_t size)
Remove size bytes from the end of the current packet.
void RemoveAtStart(uint32_t size)
Remove size bytes from the start of the current packet.
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
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(void) const
Get the tag's Hop Limit.
indicates whether the socket has IPV6_TCLASS set.
uint8_t GetTclass(void) const
Get the tag's Tclass.
indicates whether the socket has a priority set.
Introspection did not find any typical Config paths.
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 AttributeChecker > MakeBooleanChecker(void)
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeAccessor > MakeObjectVectorAccessor(U T::*memberVariable)
MakeAccessorHelper implementation for ObjectVector.
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
#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.
double max(double x, double y)
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
U * PeekPointer(const Ptr< U > &p)