IPv6 layer implementation. More...
#include <ipv6-l3-protocol.h>
Public Types | |
enum | DropReason { DROP_TTL_EXPIRED = 1, DROP_NO_ROUTE, DROP_INTERFACE_DOWN, DROP_ROUTE_ERROR, DROP_UNKNOWN_PROTOCOL } |
Reason why a packet has been dropped. More... | |
Public Member Functions | |
Ipv6L3Protocol () | |
Constructor. More... | |
virtual | ~Ipv6L3Protocol () |
Destructor. More... | |
bool | AddAddress (uint32_t i, Ipv6InterfaceAddress address) |
Add an address on interface. More... | |
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. More... | |
uint32_t | AddInterface (Ptr< NetDevice > device) |
Add IPv6 interface for a device. More... | |
Ptr< Socket > | CreateRawSocket () |
Create raw IPv6 socket. More... | |
void | DeleteRawSocket (Ptr< Socket > socket) |
Remove raw IPv6 socket. More... | |
Ipv6InterfaceAddress | GetAddress (uint32_t interfaceIndex, uint32_t addressIndex) const |
Get an address. More... | |
Ptr< Icmpv6L4Protocol > | GetIcmpv6 () const |
Get ICMPv6 protocol. More... | |
Ptr< Ipv6Interface > | GetInterface (uint32_t i) const |
Get an interface. More... | |
int32_t | GetInterfaceForAddress (Ipv6Address addr) const |
Get interface index which has specified IPv6 address. More... | |
int32_t | GetInterfaceForDevice (Ptr< const NetDevice > device) const |
Get interface index which is on a specified net device. More... | |
int32_t | GetInterfaceForPrefix (Ipv6Address addr, Ipv6Prefix mask) const |
Get interface index which match specified address/prefix. More... | |
uint16_t | GetMetric (uint32_t i) const |
Get metric for an interface. More... | |
uint16_t | GetMtu (uint32_t i) const |
Get MTU for an interface. More... | |
uint32_t | GetNAddresses (uint32_t interface) const |
Get number of address for an interface. More... | |
Ptr< NetDevice > | GetNetDevice (uint32_t i) |
Get device by index. More... | |
uint32_t | GetNInterfaces () const |
Get current number of interface on this stack. More... | |
Ptr< IpL4Protocol > | GetProtocol (int protocolNumber) const |
Get L4 protocol by protocol number. More... | |
Ptr< Ipv6RoutingProtocol > | GetRoutingProtocol () const |
Get current routing protocol used. More... | |
void | Insert (Ptr< IpL4Protocol > protocol) |
Add an L4 protocol. More... | |
bool | IsForwarding (uint32_t i) const |
Is interface allows forwarding ? More... | |
bool | IsUp (uint32_t i) const |
Is specified interface up ? More... | |
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. More... | |
virtual void | RegisterExtensions () |
Register the IPv6 Extensions. More... | |
virtual void | RegisterOptions () |
Register the IPv6 Options. More... | |
void | Remove (Ptr< IpL4Protocol > protocol) |
Remove an L4 protocol. More... | |
bool | RemoveAddress (uint32_t interfaceIndex, uint32_t addressIndex) |
Remove an address from an interface. More... | |
bool | RemoveAddress (uint32_t interfaceIndex, Ipv6Address address) |
Remove a specified Ipv6 address from an interface. More... | |
void | RemoveAutoconfiguredAddress (uint32_t interface, Ipv6Address network, Ipv6Prefix mask, Ipv6Address defaultRouter) |
Remove an autoconfigured address. More... | |
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. More... | |
void | SetDefaultTclass (uint8_t tclass) |
Set the default TCLASS. More... | |
void | SetDefaultTtl (uint8_t ttl) |
Set the default TTL. More... | |
void | SetDown (uint32_t i) |
set an interface down. More... | |
void | SetForwarding (uint32_t i, bool val) |
Enable or disable forwarding on interface. More... | |
void | SetMetric (uint32_t i, uint16_t metric) |
Set metric for an interface. More... | |
void | SetNode (Ptr< Node > node) |
Set node associated with this stack. More... | |
virtual void | SetPmtu (Ipv6Address dst, uint32_t pmtu) |
Set the Path MTU for the specified IPv6 destination address. More... | |
void | SetRoutingProtocol (Ptr< Ipv6RoutingProtocol > routingProtocol) |
Set routing protocol for this stack. More... | |
void | SetUp (uint32_t i) |
Set an interface up. More... | |
Public Member Functions inherited from ns3::Ipv6 | |
Ipv6 () | |
Constructor. More... | |
virtual | ~Ipv6 () |
Destructor. More... | |
Public Member Functions inherited from ns3::Object | |
Object () | |
virtual | ~Object () |
void | AggregateObject (Ptr< Object > other) |
void | Dispose (void) |
Run the DoDispose methods of this object and all the objects aggregated to it. More... | |
AggregateIterator | GetAggregateIterator (void) const |
virtual TypeId | GetInstanceTypeId (void) const |
template<typename T > | |
Ptr< T > | GetObject (void) const |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
void | Initialize (void) |
This method calls the virtual DoInitialize method on all the objects aggregated to this object. More... | |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
SimpleRefCount () | |
Constructor. More... | |
SimpleRefCount (const SimpleRefCount &o) | |
Copy constructor. More... | |
uint32_t | GetReferenceCount (void) const |
Get the reference count of the object. More... | |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
Assignment. More... | |
void | Ref (void) const |
Increment the reference count. More... | |
void | Unref (void) const |
Decrement the reference count. More... | |
Public Member Functions inherited from ns3::ObjectBase | |
virtual | ~ObjectBase () |
Virtual destructor. More... | |
void | GetAttribute (std::string name, AttributeValue &value) const |
bool | GetAttributeFailSafe (std::string name, AttributeValue &attribute) const |
void | SetAttribute (std::string name, const AttributeValue &value) |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Static Public Member Functions | |
static TypeId | GetTypeId () |
Get the type ID of this class. More... | |
Static Public Member Functions inherited from ns3::Ipv6 | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId (void) |
Register this type. More... | |
Static Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
static void | Cleanup (void) |
Noop. More... | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
Static Public Attributes | |
static const uint16_t | PROT_NUMBER = 0x86DD |
The protocol number for IPv6 (0x86DD). More... | |
Static Public Attributes inherited from ns3::Ipv6 | |
static const uint32_t | IF_ANY = 0xffffffff |
Any interface magic number. More... | |
Protected Member Functions | |
virtual void | DoDispose () |
Dispose object. More... | |
virtual void | NotifyNewAggregate () |
Notify other components connected to the node that a new stack member is now connected. More... | |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
virtual void | DoInitialize (void) |
This method is called only once by Object::Initialize. More... | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
virtual void | NotifyConstructionCompleted (void) |
This method is invoked once all member attributes have been initialized. More... | |
Private Types | |
typedef std::list< Ptr < Ipv6AutoconfiguredPrefix > > | Ipv6AutoconfiguredPrefixList |
Container of the IPv6 Autoconfigured addresses. More... | |
typedef std::list< Ptr < Ipv6AutoconfiguredPrefix > >::iterator | Ipv6AutoconfiguredPrefixListI |
Iterator of the container of the IPv6 Autoconfigured addresses. More... | |
typedef std::list< Ptr < Ipv6Interface > > | Ipv6InterfaceList |
Container of the IPv6 Interfaces. More... | |
typedef std::list< Ptr < IpL4Protocol > > | L4List_t |
Container of the IPv6 L4 instances. More... | |
typedef std::list< Ptr < Ipv6RawSocketImpl > > | SocketList |
Container of the IPv6 Raw Sockets. More... | |
Private Member Functions | |
Ipv6L3Protocol (const Ipv6L3Protocol &) | |
Copy constructor. More... | |
uint32_t | AddIpv6Interface (Ptr< Ipv6Interface > interface) |
Add an IPv6 interface to the stack. More... | |
Ipv6Header | BuildHeader (Ipv6Address src, Ipv6Address dst, uint8_t protocol, uint16_t payloadSize, uint8_t hopLimit, uint8_t tclass) |
Construct an IPv6 header. More... | |
virtual bool | GetIpForward () const |
Get IPv6 forwarding state. More... | |
virtual bool | GetMtuDiscover (void) const |
Get IPv6 MTU discover state. More... | |
virtual bool | GetSendIcmpv6Redirect () const |
Get the ICMPv6 Redirect sending state. More... | |
void | IpForward (Ptr< const NetDevice > idev, Ptr< Ipv6Route > rtentry, Ptr< const Packet > p, const Ipv6Header &header) |
Forward a packet. More... | |
void | IpMulticastForward (Ptr< const NetDevice > idev, Ptr< Ipv6MulticastRoute > mrtentry, Ptr< const Packet > p, const Ipv6Header &header) |
Forward a multicast packet. More... | |
void | LocalDeliver (Ptr< const Packet > p, Ipv6Header const &ip, uint32_t iif) |
Deliver a packet. More... | |
Ipv6L3Protocol & | operator= (const Ipv6L3Protocol &) |
Copy constructor. More... | |
void | RouteInputError (Ptr< const Packet > p, const Ipv6Header &ipHeader, Socket::SocketErrno sockErrno) |
Fallback when no route is found. More... | |
void | SendRealOut (Ptr< Ipv6Route > route, Ptr< Packet > packet, Ipv6Header const &ipHeader) |
Send packet with route. More... | |
virtual void | SetIpForward (bool forward) |
Set IPv6 forwarding state. More... | |
virtual void | SetMtuDiscover (bool mtuDiscover) |
Set IPv6 MTU discover state. More... | |
virtual void | SetSendIcmpv6Redirect (bool sendIcmpv6Redirect) |
Set the ICMPv6 Redirect sending state. More... | |
void | SetupLoopback () |
Setup loopback interface. More... | |
Private Attributes | |
uint8_t | m_defaultTclass |
Default TCLASS for outgoing packets. More... | |
uint8_t | m_defaultTtl |
Default TTL for outgoing packets. More... | |
TracedCallback< const Ipv6Header &, Ptr< const Packet >, DropReason, Ptr < Ipv6 >, uint32_t > | m_dropTrace |
Callback to trace drop packets. More... | |
Ipv6InterfaceList | m_interfaces |
List of IPv6 interfaces. More... | |
bool | m_ipForward |
Forwarding packets (i.e. More... | |
bool | m_mtuDiscover |
MTU Discover (i.e. More... | |
uint32_t | m_nInterfaces |
Number of IPv6 interfaces managed by the stack. More... | |
Ptr< Node > | m_node |
Node attached to stack. More... | |
Ptr< Ipv6PmtuCache > | m_pmtuCache |
Path MTU Cache. More... | |
Ipv6AutoconfiguredPrefixList | m_prefixes |
List of IPv6 prefix received from RA. More... | |
L4List_t | m_protocols |
List of transport protocol. More... | |
Ptr< Ipv6RoutingProtocol > | m_routingProtocol |
Routing protocol. More... | |
TracedCallback< Ptr< const Packet >, Ptr< Ipv6 > , uint32_t > | m_rxTrace |
Callback to trace RX (reception) packets. More... | |
bool | m_sendIcmpv6Redirect |
Allow ICMPv6 Redirect sending state. More... | |
SocketList | m_sockets |
List of IPv6 raw sockets. More... | |
TracedCallback< Ptr< const Packet >, Ptr< Ipv6 > , uint32_t > | m_txTrace |
Callback to trace TX (transmission) packets. More... | |
Friends | |
class | Ipv6ExtensionLooseRouting |
class | Ipv6L3ProtocolTestCase |
IPv6 layer implementation.
ns3::Ipv6L3Protocol is accessible through the following paths with Config::Set and Config::Connect:
This class contains two distinct groups of trace sources. The trace sources 'Rx' and 'Tx' are called, respectively, immediately after receiving from the NetDevice and immediately before sending to a NetDevice for transmitting a packet. These are low level trace sources that include the Ipv6Header already serialized into the packet. In contrast, the Drop, SendOutgoing, UnicastForward, and LocalDeliver trace sources are slightly higher-level and pass around the Ipv6Header as an explicit parameter and not as part of the packet.
Definition at line 59 of file ipv6-l3-protocol.h.
|
private |
Container of the IPv6 Autoconfigured addresses.
Definition at line 406 of file ipv6-l3-protocol.h.
|
private |
Iterator of the container of the IPv6 Autoconfigured addresses.
Definition at line 411 of file ipv6-l3-protocol.h.
|
private |
Container of the IPv6 Interfaces.
Definition at line 391 of file ipv6-l3-protocol.h.
|
private |
Container of the IPv6 L4 instances.
Definition at line 401 of file ipv6-l3-protocol.h.
|
private |
Container of the IPv6 Raw Sockets.
Definition at line 396 of file ipv6-l3-protocol.h.
Reason why a packet has been dropped.
Enumerator | |
---|---|
DROP_TTL_EXPIRED |
Packet TTL has expired. |
DROP_NO_ROUTE |
No route to host. |
DROP_INTERFACE_DOWN |
Interface is down so can not send packet. |
DROP_ROUTE_ERROR |
Route error. |
DROP_UNKNOWN_PROTOCOL |
Unknown L4 protocol. |
Definition at line 77 of file ipv6-l3-protocol.h.
ns3::Ipv6L3Protocol::Ipv6L3Protocol | ( | ) |
Constructor.
Definition at line 92 of file ipv6-l3-protocol.cc.
References m_pmtuCache, and NS_LOG_FUNCTION_NOARGS.
|
virtual |
|
private |
Copy constructor.
Defined but not implemented to avoid misuse
|
virtual |
Add an address on interface.
i | interface index |
address | to add |
Implements ns3::Ipv6.
Definition at line 375 of file ipv6-l3-protocol.cc.
References ns3::Ipv6Interface::AddAddress(), m_routingProtocol, and NS_LOG_FUNCTION.
Referenced by AddAutoconfiguredAddress().
void ns3::Ipv6L3Protocol::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.
interface | interface index |
network | network prefix |
mask | network mask |
flags | flags of the prefix information option (home agent, ...) |
validTime | valid time of the prefix |
preferredTime | preferred time of the prefix |
defaultRouter | default router address |
Definition at line 266 of file ipv6-l3-protocol.cc.
References AddAddress(), first::address, ns3::Mac16Address::ConvertFrom(), ns3::Mac64Address::ConvertFrom(), ns3::Mac48Address::ConvertFrom(), ns3::Ipv6InterfaceAddress::GetAddress(), ns3::Ipv6Address::GetAny(), ns3::Ipv6Interface::GetDevice(), GetInterface(), GetRoutingProtocol(), ns3::Ipv6Address::IsAny(), ns3::Mac16Address::IsMatchingType(), ns3::Mac64Address::IsMatchingType(), ns3::Mac48Address::IsMatchingType(), m_node, m_prefixes, ns3::Ipv6Address::MakeAutoconfiguredAddress(), NS_FATAL_ERROR, NS_LOG_FUNCTION, NS_LOG_INFO, and ns3::Ipv6AutoconfiguredPrefix::StartPreferredTimer().
Add IPv6 interface for a device.
device | net device |
Implements ns3::Ipv6.
Definition at line 157 of file ipv6-l3-protocol.cc.
References AddIpv6Interface(), ns3::CreateObject(), m_ipForward, m_node, ns3::MakeCallback(), NS_LOG_FUNCTION, PROT_NUMBER, Receive(), and ns3::Node::RegisterProtocolHandler().
|
private |
Add an IPv6 interface to the stack.
interface | interface to add |
Definition at line 170 of file ipv6-l3-protocol.cc.
References m_interfaces, m_nInterfaces, and NS_LOG_FUNCTION.
Referenced by AddInterface(), and SetupLoopback().
|
private |
Construct an IPv6 header.
src | source IPv6 address |
dst | destination IPv6 address |
protocol | L4 protocol |
payloadSize | payload size |
hopLimit | Hop limit |
tclass | Tclass |
Definition at line 1223 of file ipv6-l3-protocol.cc.
References NS_LOG_FUNCTION, ns3::Ipv6Header::SetDestinationAddress(), ns3::Ipv6Header::SetHopLimit(), ns3::Ipv6Header::SetNextHeader(), ns3::Ipv6Header::SetPayloadLength(), ns3::Ipv6Header::SetSourceAddress(), and ns3::Ipv6Header::SetTrafficClass().
Referenced by Send().
Create raw IPv6 socket.
Definition at line 667 of file ipv6-l3-protocol.cc.
References m_node, m_sockets, NS_LOG_FUNCTION_NOARGS, and ns3::Ipv6RawSocketImpl::SetNode().
Remove raw IPv6 socket.
socket | socket to remove |
Definition at line 676 of file ipv6-l3-protocol.cc.
References m_sockets, and NS_LOG_FUNCTION.
|
protectedvirtual |
Dispose object.
Reimplemented from ns3::Object.
Definition at line 104 of file ipv6-l3-protocol.cc.
References ns3::Object::DoDispose(), m_interfaces, m_node, m_pmtuCache, m_prefixes, m_protocols, m_routingProtocol, m_sockets, and NS_LOG_FUNCTION_NOARGS.
|
virtual |
Get an address.
interfaceIndex | interface index |
addressIndex | address index on the interface |
Implements ns3::Ipv6.
Definition at line 395 of file ipv6-l3-protocol.cc.
References ns3::Ipv6Interface::GetAddress(), and NS_LOG_FUNCTION.
Referenced by SendRealOut().
Ptr< Icmpv6L4Protocol > ns3::Ipv6L3Protocol::GetIcmpv6 | ( | ) | const |
Get ICMPv6 protocol.
Definition at line 690 of file ipv6-l3-protocol.cc.
References ns3::Object::GetObject(), GetProtocol(), ns3::Icmpv6L4Protocol::GetStaticProtocolNumber(), and NS_LOG_FUNCTION_NOARGS.
Referenced by IpForward(), LocalDeliver(), and SendRealOut().
Ptr< Ipv6Interface > ns3::Ipv6L3Protocol::GetInterface | ( | uint32_t | i | ) | const |
Get an interface.
i | interface index |
Definition at line 180 of file ipv6-l3-protocol.cc.
References m_interfaces, and NS_LOG_FUNCTION.
Referenced by AddAutoconfiguredAddress(), GetNetDevice(), IpForward(), LocalDeliver(), RemoveAutoconfiguredAddress(), and SendRealOut().
|
virtual |
Get interface index which has specified IPv6 address.
addr | IPv6 address |
Implements ns3::Ipv6.
Definition at line 202 of file ipv6-l3-protocol.cc.
References first::address, m_interfaces, and NS_LOG_FUNCTION.
Referenced by Send().
Get interface index which is on a specified net device.
device | net device |
Implements ns3::Ipv6.
Definition at line 250 of file ipv6-l3-protocol.cc.
References m_interfaces, and NS_LOG_FUNCTION.
Referenced by IpForward(), and Send().
|
virtual |
Get interface index which match specified address/prefix.
addr | IPv6 address |
mask | IPv6 prefix (mask) |
Implements ns3::Ipv6.
Definition at line 224 of file ipv6-l3-protocol.cc.
References ns3::Ipv6Address::CombinePrefix(), m_interfaces, and NS_LOG_FUNCTION.
|
privatevirtual |
Get IPv6 forwarding state.
Implements ns3::Ipv6.
Definition at line 586 of file ipv6-l3-protocol.cc.
References m_ipForward, and NS_LOG_FUNCTION_NOARGS.
|
virtual |
Get metric for an interface.
i | index |
Implements ns3::Ipv6.
Definition at line 449 of file ipv6-l3-protocol.cc.
References ns3::Ipv6Interface::GetMetric(), and NS_LOG_FUNCTION.
|
virtual |
Get MTU for an interface.
i | index |
Implements ns3::Ipv6.
Definition at line 456 of file ipv6-l3-protocol.cc.
References ns3::Ipv6Interface::GetDevice(), IPV6_MIN_MTU, m_mtuDiscover, and NS_LOG_FUNCTION.
|
privatevirtual |
Get IPv6 MTU discover state.
Implements ns3::Ipv6.
Definition at line 598 of file ipv6-l3-protocol.cc.
References m_mtuDiscover, and NS_LOG_FUNCTION.
|
virtual |
Get number of address for an interface.
interface | interface index |
Implements ns3::Ipv6.
Definition at line 388 of file ipv6-l3-protocol.cc.
References ns3::Ipv6Interface::GetNAddresses(), and NS_LOG_FUNCTION.
Referenced by SendRealOut().
Get device by index.
i | device index on this stack |
Implements ns3::Ipv6.
Definition at line 244 of file ipv6-l3-protocol.cc.
References ns3::Ipv6Interface::GetDevice(), GetInterface(), and NS_LOG_FUNCTION.
Referenced by IpMulticastForward(), and Send().
|
virtual |
Get current number of interface on this stack.
Implements ns3::Ipv6.
Definition at line 196 of file ipv6-l3-protocol.cc.
References m_nInterfaces, and NS_LOG_FUNCTION_NOARGS.
Referenced by SendRealOut().
Ptr< IpL4Protocol > ns3::Ipv6L3Protocol::GetProtocol | ( | int | protocolNumber | ) | const |
Get L4 protocol by protocol number.
protocolNumber | protocol number |
Definition at line 653 of file ipv6-l3-protocol.cc.
References m_protocols, and NS_LOG_FUNCTION.
Referenced by GetIcmpv6(), and LocalDeliver().
|
virtual |
Get current routing protocol used.
Implements ns3::Ipv6.
Definition at line 151 of file ipv6-l3-protocol.cc.
References m_routingProtocol, and NS_LOG_FUNCTION_NOARGS.
Referenced by AddAutoconfiguredAddress(), and RemoveAutoconfiguredAddress().
|
privatevirtual |
Get the ICMPv6 Redirect sending state.
Definition at line 610 of file ipv6-l3-protocol.cc.
References m_sendIcmpv6Redirect, and NS_LOG_FUNCTION_NOARGS.
Referenced by GetTypeId().
|
static |
Get the type ID of this class.
Definition at line 60 of file ipv6-l3-protocol.cc.
References GetSendIcmpv6Redirect(), m_defaultTclass, m_defaultTtl, m_dropTrace, m_interfaces, m_rxTrace, m_txTrace, ns3::MakeObjectVectorAccessor(), ns3::MakeTraceSourceAccessor(), ns3::TypeId::SetParent(), and SetSendIcmpv6Redirect().
void ns3::Ipv6L3Protocol::Insert | ( | Ptr< IpL4Protocol > | protocol | ) |
Add an L4 protocol.
protocol | L4 protocol |
Definition at line 641 of file ipv6-l3-protocol.cc.
References m_protocols, and NS_LOG_FUNCTION.
Referenced by AddInternetStack().
|
private |
Forward a packet.
idev | Pointer to ingress network device |
rtentry | route |
p | packet to forward |
header | IPv6 header to add to the packet |
Definition at line 1002 of file ipv6-l3-protocol.cc.
References ns3::Packet::AddHeader(), ns3::Packet::Copy(), DROP_ROUTE_ERROR, DROP_TTL_EXPIRED, ns3::Ipv6InterfaceAddress::GetAddress(), ns3::Ipv6Header::GetDestinationAddress(), ns3::Ipv6Header::GetHopLimit(), GetIcmpv6(), ns3::Node::GetId(), GetInterface(), GetInterfaceForDevice(), ns3::Ipv6Interface::GetLinkLocalAddress(), ns3::Ipv6Header::GetNextHeader(), ns3::Object::GetObject(), ns3::Ipv6Header::GetSourceAddress(), ns3::Icmpv6Header::ICMPV6_HOPLIMIT, ns3::Ipv6Address::IsAny(), ns3::Ipv6Address::IsDocumentation(), ns3::Ipv6Address::IsLinkLocal(), ns3::Ipv6Address::IsMulticast(), m_dropTrace, m_node, m_sendIcmpv6Redirect, NS_LOG_FUNCTION, NS_LOG_LOGIC, NS_LOG_WARN, ns3::Icmpv6L4Protocol::PROT_NUMBER, SendRealOut(), and ns3::Ipv6Header::SetHopLimit().
Referenced by Receive().
|
private |
Forward a multicast packet.
idev | Pointer to ingress network device |
mrtentry | route |
p | packet to forward |
header | IPv6 header to add to the packet |
Definition at line 1083 of file ipv6-l3-protocol.cc.
References ns3::Packet::Copy(), DROP_TTL_EXPIRED, ns3::Ipv6Address::GetAny(), ns3::Ipv6Header::GetDestinationAddress(), ns3::Ipv6Header::GetHopLimit(), ns3::Node::GetId(), GetNetDevice(), ns3::Object::GetObject(), ns3::Ipv6Header::GetSourceAddress(), m_dropTrace, m_node, NS_LOG_FUNCTION, NS_LOG_LOGIC, NS_LOG_WARN, SendRealOut(), and ns3::Ipv6Header::SetHopLimit().
Referenced by Receive().
|
virtual |
Is interface allows forwarding ?
i | interface index |
Implements ns3::Ipv6.
Definition at line 559 of file ipv6-l3-protocol.cc.
References NS_LOG_FUNCTION, and NS_LOG_LOGIC.
|
virtual |
Is specified interface up ?
i | interface index |
Implements ns3::Ipv6.
Definition at line 477 of file ipv6-l3-protocol.cc.
References ns3::Ipv6Interface::IsUp(), and NS_LOG_FUNCTION.
|
private |
Deliver a packet.
p | packet delivered |
ip | IPv6 header |
iif | input interface packet was received |
Definition at line 1115 of file ipv6-l3-protocol.cc.
References ns3::Packet::AddHeader(), ns3::Packet::Copy(), ns3::Packet::CopyData(), DROP_UNKNOWN_PROTOCOL, ns3::Ipv6Header::GetDestinationAddress(), GetIcmpv6(), GetInterface(), ns3::Ipv6Header::GetNextHeader(), ns3::Object::GetObject(), GetProtocol(), ns3::Ipv6Header::GetSerializedSize(), ns3::Ipv6Header::GetSourceAddress(), ns3::Icmpv6Header::ICMPV6_PORT_UNREACHABLE, ns3::Icmpv6Header::ICMPV6_UNKNOWN_NEXT_HEADER, ns3::Ipv6Header::IPV6_EXT_FRAGMENTATION, ns3::Ipv6Header::IPV6_EXT_HOP_BY_HOP, ns3::Ipv6Address::IsMulticast(), m_dropTrace, m_node, NS_ASSERT_MSG, NS_LOG_FUNCTION, NS_LOG_LOGIC, NS_LOG_WARN, ns3::IpL4Protocol::Receive(), ns3::Packet::RemoveAtStart(), ns3::IpL4Protocol::RX_CSUM_FAILED, ns3::IpL4Protocol::RX_ENDPOINT_CLOSED, ns3::IpL4Protocol::RX_ENDPOINT_UNREACH, and ns3::IpL4Protocol::RX_OK.
Referenced by Receive().
|
protectedvirtual |
Notify other components connected to the node that a new stack member is now connected.
This will be used to notify Layer 3 protocol of layer 4 protocol stack to connect them together.
Reimplemented from ns3::Object.
Definition at line 616 of file ipv6-l3-protocol.cc.
References m_node, ns3::Object::NotifyNewAggregate(), NS_LOG_FUNCTION_NOARGS, and SetNode().
|
private |
Copy constructor.
Defined but not implemented to avoid misuse
void ns3::Ipv6L3Protocol::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.
This method removes IPv6 header and forward up to L4 protocol.
device | network device |
p | the packet |
protocol | next header value |
from | address of the correspondant |
to | address of the destination |
packetType | type of the packet |
Definition at line 798 of file ipv6-l3-protocol.cc.
References ns3::Packet::Copy(), DROP_INTERFACE_DOWN, DROP_NO_ROUTE, ns3::Ipv6RawSocketImpl::ForwardUp(), ns3::Ipv6Header::GetDestinationAddress(), ns3::Ipv6Interface::GetDevice(), ns3::Node::GetId(), ns3::Ipv6Header::GetNextHeader(), ns3::Object::GetObject(), ns3::Ipv6Header::GetPayloadLength(), IpForward(), IpMulticastForward(), ns3::Ipv6Header::IPV6_EXT_HOP_BY_HOP, ns3::Ipv6Interface::IsUp(), LocalDeliver(), m_dropTrace, m_interfaces, m_node, m_routingProtocol, m_rxTrace, m_sockets, ns3::MakeCallback(), NS_LOG_FUNCTION, NS_LOG_LOGIC, NS_LOG_WARN, and RouteInputError().
Referenced by AddInterface(), and SetupLoopback().
|
virtual |
Register the IPv6 Extensions.
Implements ns3::Ipv6.
Definition at line 1237 of file ipv6-l3-protocol.cc.
References ns3::Object::AggregateObject(), m_node, and ns3::Ipv6Extension::SetNode().
Referenced by AddInternetStack(), AddInternetStack6(), and CreateDualStackNode().
|
virtual |
Register the IPv6 Options.
Implements ns3::Ipv6.
Definition at line 1270 of file ipv6-l3-protocol.cc.
References ns3::Object::AggregateObject(), and m_node.
Referenced by AddInternetStack(), AddInternetStack6(), and CreateDualStackNode().
void ns3::Ipv6L3Protocol::Remove | ( | Ptr< IpL4Protocol > | protocol | ) |
Remove an L4 protocol.
protocol | L4 protocol to remove |
Definition at line 647 of file ipv6-l3-protocol.cc.
References m_protocols, and NS_LOG_FUNCTION.
|
virtual |
Remove an address from an interface.
interfaceIndex | interface index |
addressIndex | address index on the interface |
Implements ns3::Ipv6.
Definition at line 402 of file ipv6-l3-protocol.cc.
References first::address, m_routingProtocol, and NS_LOG_FUNCTION.
Referenced by RemoveAutoconfiguredAddress().
|
virtual |
Remove a specified Ipv6 address from an interface.
interfaceIndex | interface index |
address | Ipv6Address to be removed from the interface |
Implements ns3::Ipv6.
Definition at line 420 of file ipv6-l3-protocol.cc.
References ns3::Ipv6Address::GetLoopback(), m_routingProtocol, NS_LOG_FUNCTION, and NS_LOG_WARN.
void ns3::Ipv6L3Protocol::RemoveAutoconfiguredAddress | ( | uint32_t | interface, |
Ipv6Address | network, | ||
Ipv6Prefix | mask, | ||
Ipv6Address | defaultRouter | ||
) |
Remove an autoconfigured address.
Typically it is used when an autoconfigured address expires.
interface | interface index |
network | network prefix |
mask | network mask |
defaultRouter | gateway |
Definition at line 325 of file ipv6-l3-protocol.cc.
References ns3::Mac16Address::ConvertFrom(), ns3::Mac64Address::ConvertFrom(), ns3::Mac48Address::ConvertFrom(), ns3::Ipv6InterfaceAddress::GetAddress(), ns3::Ipv6Interface::GetAddress(), ns3::Ipv6Address::GetAny(), ns3::Ipv6Interface::GetDevice(), GetInterface(), ns3::Ipv6Interface::GetNAddresses(), GetRoutingProtocol(), ns3::Mac16Address::IsMatchingType(), ns3::Mac64Address::IsMatchingType(), ns3::Mac48Address::IsMatchingType(), m_prefixes, ns3::Ipv6Address::MakeAutoconfiguredAddress(), NS_FATAL_ERROR, NS_LOG_FUNCTION, and RemoveAddress().
|
private |
Fallback when no route is found.
p | packet |
ipHeader | IPv6 header |
sockErrno | error number |
Definition at line 1216 of file ipv6-l3-protocol.cc.
References DROP_ROUTE_ERROR, ns3::Object::GetObject(), m_dropTrace, m_node, NS_LOG_FUNCTION, and NS_LOG_LOGIC.
Referenced by Receive().
void ns3::Ipv6L3Protocol::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.
packet | packet to send |
source | source address of packet |
destination | address of packet |
protocol | number of packet |
route | route to take |
Definition at line 717 of file ipv6-l3-protocol.cc.
References BuildHeader(), DROP_NO_ROUTE, ns3::SocketIpv6HopLimitTag::GetHopLimit(), GetInterfaceForAddress(), GetInterfaceForDevice(), GetNetDevice(), ns3::Object::GetObject(), ns3::Packet::GetSize(), ns3::SocketIpv6TclassTag::GetTclass(), ns3::Ipv6Address::GetZero(), ns3::Ipv6Address::IsAllHostsMulticast(), ns3::Ipv6Address::IsAllNodesMulticast(), ns3::Ipv6Address::IsAllRoutersMulticast(), ns3::Ipv6Address::IsLinkLocal(), ns3::Ipv6Address::IsSolicitedMulticast(), m_defaultTclass, m_defaultTtl, m_dropTrace, m_node, m_routingProtocol, NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_LOGIC, NS_LOG_WARN, ns3::Packet::RemovePacketTag(), and SendRealOut().
Referenced by ns3::Icmpv6L4Protocol::NotifyNewAggregate(), ns3::TcpL4Protocol::NotifyNewAggregate(), and ns3::UdpL4Protocol::NotifyNewAggregate().
|
private |
Send packet with route.
route | route |
packet | packet to send |
ipHeader | IPv6 header to add to the packet |
Definition at line 876 of file ipv6-l3-protocol.cc.
References ns3::Packet::AddHeader(), DROP_INTERFACE_DOWN, ns3::Ipv6InterfaceAddress::GetAddress(), GetAddress(), ns3::Ipv6Address::GetAny(), ns3::Ipv6Header::GetDestinationAddress(), ns3::Ipv6ExtensionFragment::GetFragments(), GetIcmpv6(), GetInterface(), GetNAddresses(), GetNInterfaces(), ns3::Object::GetObject(), ns3::Packet::GetSize(), ns3::Ipv6Header::GetSourceAddress(), ns3::Ipv6Header::IPV6_EXT_FRAGMENTATION, list, m_dropTrace, m_node, m_pmtuCache, m_txTrace, NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_LOGIC, and ns3::PeekPointer().
Referenced by IpForward(), IpMulticastForward(), and Send().
void ns3::Ipv6L3Protocol::SetDefaultTclass | ( | uint8_t | tclass | ) |
Set the default TCLASS.
tclass | TCLASS to set |
Definition at line 711 of file ipv6-l3-protocol.cc.
References m_defaultTclass, and NS_LOG_FUNCTION.
void ns3::Ipv6L3Protocol::SetDefaultTtl | ( | uint8_t | ttl | ) |
Set the default TTL.
ttl | TTL to set |
Definition at line 705 of file ipv6-l3-protocol.cc.
References m_defaultTtl, and NS_LOG_FUNCTION.
|
virtual |
set an interface down.
i | interface index |
Implements ns3::Ipv6.
Definition at line 509 of file ipv6-l3-protocol.cc.
References m_routingProtocol, NS_LOG_FUNCTION, and ns3::Ipv6Interface::SetDown().
|
virtual |
Enable or disable forwarding on interface.
i | interface index |
val | true = enable forwarding, false = disable |
Implements ns3::Ipv6.
Definition at line 568 of file ipv6-l3-protocol.cc.
References NS_LOG_FUNCTION, and ns3::Ipv6Interface::SetForwarding().
|
privatevirtual |
Set IPv6 forwarding state.
forward | IPv6 forwarding enabled or not |
Implements ns3::Ipv6.
Definition at line 575 of file ipv6-l3-protocol.cc.
References m_interfaces, m_ipForward, and NS_LOG_FUNCTION.
|
virtual |
Set metric for an interface.
i | index |
metric |
Implements ns3::Ipv6.
Definition at line 442 of file ipv6-l3-protocol.cc.
References NS_LOG_FUNCTION, and ns3::Ipv6Interface::SetMetric().
|
privatevirtual |
Set IPv6 MTU discover state.
mtuDiscover | IPv6 MTU discover enabled or not |
Implements ns3::Ipv6.
Definition at line 592 of file ipv6-l3-protocol.cc.
References m_mtuDiscover, and NS_LOG_FUNCTION.
Set node associated with this stack.
node | node to set |
Definition at line 633 of file ipv6-l3-protocol.cc.
References m_node, NS_LOG_FUNCTION, and SetupLoopback().
Referenced by NotifyNewAggregate().
|
virtual |
Set the Path MTU for the specified IPv6 destination address.
dst | Ipv6 destination address |
pmtu | the Path MTU |
Implements ns3::Ipv6.
Definition at line 470 of file ipv6-l3-protocol.cc.
References m_pmtuCache, and NS_LOG_FUNCTION.
|
virtual |
Set routing protocol for this stack.
routingProtocol | IPv6 routing protocol to set |
Implements ns3::Ipv6.
Definition at line 144 of file ipv6-l3-protocol.cc.
References m_routingProtocol, and NS_LOG_FUNCTION.
Referenced by AddInternetStack(), AddInternetStack6(), and CreateDualStackNode().
|
privatevirtual |
Set the ICMPv6 Redirect sending state.
sendIcmpv6Redirect | ICMPv6 Redirect sending enabled or not |
Definition at line 604 of file ipv6-l3-protocol.cc.
References m_sendIcmpv6Redirect, and NS_LOG_FUNCTION.
Referenced by GetTypeId().
|
virtual |
Set an interface up.
i | interface index |
Implements ns3::Ipv6.
Definition at line 484 of file ipv6-l3-protocol.cc.
References m_routingProtocol, NS_LOG_FUNCTION, NS_LOG_LOGIC, and ns3::Ipv6Interface::SetUp().
|
private |
Setup loopback interface.
Definition at line 522 of file ipv6-l3-protocol.cc.
References ns3::Node::AddDevice(), AddIpv6Interface(), ns3::CreateObject(), ns3::Node::GetDevice(), ns3::Ipv6Address::GetLoopback(), ns3::Node::GetNDevices(), m_node, m_routingProtocol, ns3::MakeCallback(), NS_LOG_FUNCTION_NOARGS, PROT_NUMBER, Receive(), and ns3::Node::RegisterProtocolHandler().
Referenced by SetNode().
|
friend |
Definition at line 386 of file ipv6-l3-protocol.h.
|
friend |
Definition at line 385 of file ipv6-l3-protocol.h.
|
private |
Default TCLASS for outgoing packets.
Definition at line 589 of file ipv6-l3-protocol.h.
Referenced by GetTypeId(), Send(), and SetDefaultTclass().
|
private |
Default TTL for outgoing packets.
Definition at line 584 of file ipv6-l3-protocol.h.
Referenced by GetTypeId(), Send(), and SetDefaultTtl().
|
private |
Callback to trace drop packets.
Definition at line 426 of file ipv6-l3-protocol.h.
Referenced by GetTypeId(), IpForward(), IpMulticastForward(), LocalDeliver(), Receive(), RouteInputError(), Send(), and SendRealOut().
|
private |
List of IPv6 interfaces.
Definition at line 574 of file ipv6-l3-protocol.h.
Referenced by AddIpv6Interface(), DoDispose(), GetInterface(), GetInterfaceForAddress(), GetInterfaceForDevice(), GetInterfaceForPrefix(), GetTypeId(), Receive(), and SetIpForward().
|
private |
Forwarding packets (i.e.
router mode) state.
Definition at line 554 of file ipv6-l3-protocol.h.
Referenced by AddInterface(), GetIpForward(), and SetIpForward().
|
private |
MTU Discover (i.e.
Path MTU) state.
Definition at line 559 of file ipv6-l3-protocol.h.
Referenced by GetMtu(), GetMtuDiscover(), and SetMtuDiscover().
|
private |
Number of IPv6 interfaces managed by the stack.
Definition at line 579 of file ipv6-l3-protocol.h.
Referenced by AddIpv6Interface(), and GetNInterfaces().
Node attached to stack.
Definition at line 549 of file ipv6-l3-protocol.h.
Referenced by AddAutoconfiguredAddress(), AddInterface(), CreateRawSocket(), DoDispose(), IpForward(), IpMulticastForward(), LocalDeliver(), NotifyNewAggregate(), Receive(), RegisterExtensions(), RegisterOptions(), RouteInputError(), Send(), SendRealOut(), SetNode(), and SetupLoopback().
|
private |
Path MTU Cache.
Definition at line 564 of file ipv6-l3-protocol.h.
Referenced by DoDispose(), Ipv6L3Protocol(), SendRealOut(), and SetPmtu().
|
private |
List of IPv6 prefix received from RA.
Definition at line 604 of file ipv6-l3-protocol.h.
Referenced by AddAutoconfiguredAddress(), DoDispose(), and RemoveAutoconfiguredAddress().
|
private |
List of transport protocol.
Definition at line 569 of file ipv6-l3-protocol.h.
Referenced by DoDispose(), GetProtocol(), Insert(), and Remove().
|
private |
Routing protocol.
Definition at line 594 of file ipv6-l3-protocol.h.
Referenced by AddAddress(), DoDispose(), GetRoutingProtocol(), Receive(), RemoveAddress(), Send(), SetDown(), SetRoutingProtocol(), SetUp(), and SetupLoopback().
|
private |
Callback to trace RX (reception) packets.
Definition at line 421 of file ipv6-l3-protocol.h.
Referenced by GetTypeId(), and Receive().
|
private |
Allow ICMPv6 Redirect sending state.
Definition at line 609 of file ipv6-l3-protocol.h.
Referenced by GetSendIcmpv6Redirect(), IpForward(), and SetSendIcmpv6Redirect().
|
private |
List of IPv6 raw sockets.
Definition at line 599 of file ipv6-l3-protocol.h.
Referenced by CreateRawSocket(), DeleteRawSocket(), DoDispose(), and Receive().
|
private |
Callback to trace TX (transmission) packets.
Definition at line 416 of file ipv6-l3-protocol.h.
Referenced by GetTypeId(), and SendRealOut().
|
static |
The protocol number for IPv6 (0x86DD).
Definition at line 71 of file ipv6-l3-protocol.h.
Referenced by AddInterface(), ns3::NdiscCache::Entry::FunctionDelayTimeout(), ns3::NdiscCache::Entry::FunctionProbeTimeout(), ns3::SixLowPanNetDevice::ReceiveFromDevice(), ns3::Ipv6Interface::Send(), and SetupLoopback().