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. | |
virtual | ~Ipv6L3Protocol () |
Destructor. | |
void | SetNode (Ptr< Node > node) |
Set node for this stack. | |
void | Insert (Ptr< Ipv6L4Protocol > protocol) |
Add an L4 protocol. | |
void | Remove (Ptr< Ipv6L4Protocol > protocol) |
Remove an L4 protocol. | |
Ptr< Ipv6L4Protocol > | GetProtocol (int protocolNumber) const |
Get L4 protocol by protocol number. | |
Ptr< Socket > | CreateRawSocket () |
Create raw IPv6 socket. | |
void | DeleteRawSocket (Ptr< Socket > socket) |
Remove raw IPv6 socket. | |
void | SetDefaultTtl (uint8_t ttl) |
Set the default TTL. | |
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. This method removes IPv6 header and forward up to L4 protocol. | |
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. | |
void | SetRoutingProtocol (Ptr< Ipv6RoutingProtocol > routingProtocol) |
Set routing protocol for this stack. | |
Ptr< Ipv6RoutingProtocol > | GetRoutingProtocol () const |
Get current routing protocol used. | |
uint32_t | AddInterface (Ptr< NetDevice > device) |
Add IPv6 interface for a device. | |
Ptr< Ipv6Interface > | GetInterface (uint32_t i) const |
Get an interface. | |
uint32_t | GetNInterfaces () const |
Get current number of interface on this stack. | |
int32_t | GetInterfaceForAddress (Ipv6Address addr) const |
Get interface index which has specified IPv6 address. | |
int32_t | GetInterfaceForPrefix (Ipv6Address addr, Ipv6Prefix mask) const |
Get interface index which match specified address/prefix. | |
int32_t | GetInterfaceForDevice (Ptr< const NetDevice > device) const |
Get interface index which is on a specified net device. | |
bool | AddAddress (uint32_t i, Ipv6InterfaceAddress address) |
Add an address on interface. | |
Ipv6InterfaceAddress | GetAddress (uint32_t interfaceIndex, uint32_t addressIndex) const |
Get an address. | |
uint32_t | GetNAddresses (uint32_t interface) const |
Get number of address for an interface. | |
bool | RemoveAddress (uint32_t interfaceIndex, uint32_t addressIndex) |
Remove an address from an interface. | |
void | SetMetric (uint32_t i, uint16_t metric) |
Set metric for an interface. | |
uint16_t | GetMetric (uint32_t i) const |
Get metric for an interface. | |
uint16_t | GetMtu (uint32_t i) const |
Get MTU for an interface. | |
bool | IsUp (uint32_t i) const |
Is specified interface up ? | |
void | SetUp (uint32_t i) |
Set an interface up. | |
void | SetDown (uint32_t i) |
set an interface down. | |
bool | IsForwarding (uint32_t i) const |
Is interface allows forwarding ? | |
void | SetForwarding (uint32_t i, bool val) |
Enable or disable forwarding on interface. | |
Ptr< NetDevice > | GetNetDevice (uint32_t i) |
Get device by index. | |
Ptr< Icmpv6L4Protocol > | GetIcmpv6 () const |
Get ICMPv6 protocol. | |
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 | RemoveAutoconfiguredAddress (uint32_t interface, Ipv6Address network, Ipv6Prefix mask, Ipv6Address defaultRouter) |
Remove an autoconfigured address. | |
virtual void | RegisterExtensions () |
Register the IPv6 Extensions. | |
virtual void | RegisterOptions () |
Register the IPv6 Options. | |
Static Public Member Functions | |
static TypeId | GetTypeId () |
Get the type ID of this class. | |
Static Public Attributes | |
static const uint16_t | PROT_NUMBER |
The protocol number for IPv6 (0x86DD). | |
Protected Member Functions | |
virtual void | DoDispose () |
Dispose object. | |
virtual void | NotifyNewAggregate () |
Notify other components connected to the node that a new stack member is now connected. | |
Friends | |
class | Ipv6L3ProtocolTestCase |
class | Ipv6ExtensionLooseRouting |
IPv6 layer implementation.
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.
Reason why a packet has been dropped.
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 |
Unkown L4 protocol |
bool ns3::Ipv6L3Protocol::AddAddress | ( | uint32_t | i, | |
Ipv6InterfaceAddress | address | |||
) | [virtual] |
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 |
Add IPv6 interface for a device.
device | net device |
Implements ns3::Ipv6.
Create raw IPv6 socket.
Remove raw IPv6 socket.
socket | socket to remove |
Ipv6InterfaceAddress ns3::Ipv6L3Protocol::GetAddress | ( | uint32_t | interfaceIndex, | |
uint32_t | addressIndex | |||
) | const [virtual] |
Get an address.
interfaceIndex | interface index | |
addressIndex | address index on the interface |
Implements ns3::Ipv6.
Ptr<Icmpv6L4Protocol> ns3::Ipv6L3Protocol::GetIcmpv6 | ( | ) | const |
Get ICMPv6 protocol.
Ptr<Ipv6Interface> ns3::Ipv6L3Protocol::GetInterface | ( | uint32_t | i | ) | const |
Get an interface.
i | interface index |
int32_t ns3::Ipv6L3Protocol::GetInterfaceForAddress | ( | Ipv6Address | addr | ) | const [virtual] |
Get interface index which has specified IPv6 address.
addr | IPv6 address |
Implements ns3::Ipv6.
int32_t ns3::Ipv6L3Protocol::GetInterfaceForDevice | ( | Ptr< const NetDevice > | device | ) | const [virtual] |
Get interface index which is on a specified net device.
device | net device |
Implements ns3::Ipv6.
int32_t ns3::Ipv6L3Protocol::GetInterfaceForPrefix | ( | Ipv6Address | addr, | |
Ipv6Prefix | mask | |||
) | const [virtual] |
Get interface index which match specified address/prefix.
addr | IPv6 address | |
mask | IPv6 prefix (mask) |
Implements ns3::Ipv6.
uint16_t ns3::Ipv6L3Protocol::GetMetric | ( | uint32_t | i | ) | const [virtual] |
uint16_t ns3::Ipv6L3Protocol::GetMtu | ( | uint32_t | i | ) | const [virtual] |
uint32_t ns3::Ipv6L3Protocol::GetNAddresses | ( | uint32_t | interface | ) | const [virtual] |
Get number of address for an interface.
interface | interface index |
Implements ns3::Ipv6.
uint32_t ns3::Ipv6L3Protocol::GetNInterfaces | ( | ) | const [virtual] |
Get current number of interface on this stack.
Implements ns3::Ipv6.
Ptr<Ipv6L4Protocol> ns3::Ipv6L3Protocol::GetProtocol | ( | int | protocolNumber | ) | const |
Get L4 protocol by protocol number.
protocolNumber | protocol number |
Ptr<Ipv6RoutingProtocol> ns3::Ipv6L3Protocol::GetRoutingProtocol | ( | ) | const [virtual] |
static TypeId ns3::Ipv6L3Protocol::GetTypeId | ( | void | ) | [static] |
Get the type ID of this class.
This method returns the TypeId associated to ns3::Ipv6L3Protocol.
Attributes defined for this type:
Attributes defined in parent class ns3::Ipv6:
TraceSources defined for this type:
Reimplemented from ns3::Ipv6.
void ns3::Ipv6L3Protocol::Insert | ( | Ptr< Ipv6L4Protocol > | protocol | ) |
Add an L4 protocol.
protocol | L4 protocol |
bool ns3::Ipv6L3Protocol::IsForwarding | ( | uint32_t | i | ) | const [virtual] |
bool ns3::Ipv6L3Protocol::IsUp | ( | uint32_t | i | ) | const [virtual] |
virtual void ns3::Ipv6L3Protocol::NotifyNewAggregate | ( | ) | [protected, virtual] |
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.
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 |
void ns3::Ipv6L3Protocol::Remove | ( | Ptr< Ipv6L4Protocol > | protocol | ) |
Remove an L4 protocol.
protocol | L4 protocol to remove |
bool ns3::Ipv6L3Protocol::RemoveAddress | ( | uint32_t | interfaceIndex, | |
uint32_t | addressIndex | |||
) | [virtual] |
Remove an address from an interface.
interfaceIndex | interface index | |
addressIndex | address index on the interface |
Implements ns3::Ipv6.
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 |
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 |
void ns3::Ipv6L3Protocol::SetDefaultTtl | ( | uint8_t | ttl | ) |
Set the default TTL.
ttl | TTL to set |
void ns3::Ipv6L3Protocol::SetDown | ( | uint32_t | i | ) | [virtual] |
void ns3::Ipv6L3Protocol::SetForwarding | ( | uint32_t | i, | |
bool | val | |||
) | [virtual] |
Enable or disable forwarding on interface.
i | interface index | |
val | true = enable forwarding, false = disable |
Implements ns3::Ipv6.
void ns3::Ipv6L3Protocol::SetMetric | ( | uint32_t | i, | |
uint16_t | metric | |||
) | [virtual] |
Set node for this stack.
node | node to set |
void ns3::Ipv6L3Protocol::SetRoutingProtocol | ( | Ptr< Ipv6RoutingProtocol > | routingProtocol | ) | [virtual] |
Set routing protocol for this stack.
routingProtocol | IPv6 routing protocol to set |
Implements ns3::Ipv6.
void ns3::Ipv6L3Protocol::SetUp | ( | uint32_t | i | ) | [virtual] |