A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ipv6-interface.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2007-2009 Strasbourg University
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
18 */
19
20#ifndef IPV6_INTERFACE_H
21#define IPV6_INTERFACE_H
22
24
25#include "ns3/object.h"
26#include "ns3/ptr.h"
27
28#include <list>
29
30namespace ns3
31{
32
33class NetDevice;
34class Packet;
35class Node;
36class NdiscCache;
37class Ipv6InterfaceAddress;
38class Ipv6Address;
39class Ipv6Header;
40class TrafficControlLayer;
41
52class Ipv6Interface : public Object
53{
54 public:
59 static TypeId GetTypeId();
60
65
69 ~Ipv6Interface() override;
70
71 // Delete copy constructor and assignment operator to avoid misuse
72 Ipv6Interface(const Ipv6Interface&) = delete;
74
79 void SetNode(Ptr<Node> node);
80
85 void SetDevice(Ptr<NetDevice> device);
86
92
97 virtual Ptr<NetDevice> GetDevice() const;
98
103 void SetMetric(uint16_t metric);
104
109 uint16_t GetMetric() const;
110
115 bool IsUp() const;
116
121 bool IsDown() const;
122
126 void SetUp();
127
131 void SetDown();
132
137 bool IsForwarding() const;
138
143 void SetForwarding(bool forward);
144
149 void SetCurHopLimit(uint8_t curHopLimit);
150
155 uint8_t GetCurHopLimit() const;
156
161 void SetBaseReachableTime(uint16_t baseReachableTime);
162
167 uint16_t GetBaseReachableTime() const;
168
173 void SetReachableTime(uint16_t reachableTime);
174
179 uint16_t GetReachableTime() const;
180
185 void SetRetransTimer(uint16_t retransTimer);
186
191 uint16_t GetRetransTimer() const;
192
202 void Send(Ptr<Packet> p, const Ipv6Header& hdr, Ipv6Address dest);
203
210
216
222 bool IsSolicitedMulticastAddress(Ipv6Address address) const;
223
230
237
242 uint32_t GetNAddresses() const;
243
250
259
266
272 void SetNsDadUid(Ipv6Address address, uint32_t uid);
273
278
287 Callback<void, Ptr<Ipv6Interface>, Ipv6InterfaceAddress> removeAddressCallback);
288
297 Callback<void, Ptr<Ipv6Interface>, Ipv6InterfaceAddress> addAddressCallback);
298
299 protected:
303 void DoDispose() override;
304
305 private:
309 typedef std::list<std::pair<Ipv6InterfaceAddress, Ipv6Address>> Ipv6InterfaceAddressList;
310
314 typedef std::list<std::pair<Ipv6InterfaceAddress, Ipv6Address>>::iterator
316
320 typedef std::list<std::pair<Ipv6InterfaceAddress, Ipv6Address>>::const_iterator
322
326 void DoSetup();
327
332
337
341 bool m_ifup;
342
347
351 uint16_t m_metric;
352
357
362
367
372
377
382
388
394
397
400};
401
402} /* namespace ns3 */
403
404#endif /* IPV6_INTERFACE_H */
Callback template class.
Definition: callback.h:438
Describes an IPv6 address.
Definition: ipv6-address.h:49
Packet header for IPv6.
Definition: ipv6-header.h:35
IPv6 address associated with an interface.
State_e
State of an address associated with an interface.
The IPv6 representation of a network interface.
Ipv6InterfaceAddress RemoveAddress(uint32_t index)
Remove an address from interface.
uint16_t GetBaseReachableTime() const
Get the base reachable time.
uint8_t m_curHopLimit
Current hop limit.
Ptr< NetDevice > m_device
NetDevice associated with this interface.
bool IsDown() const
Is the interface DOWN ?
Ptr< NdiscCache > m_ndCache
Neighbor cache.
Ipv6InterfaceAddress GetLinkLocalAddress() const
Get link-local address from IPv6 interface.
bool m_ifup
The state of this interface.
uint8_t GetCurHopLimit() const
Get the current hop limit value.
static TypeId GetTypeId()
Get the type ID.
Ipv6Interface(const Ipv6Interface &)=delete
Ipv6Interface()
Constructs an Ipv6Interface.
void SetRetransTimer(uint16_t retransTimer)
Set the retransmission timer.
void DoSetup()
Initialize interface.
void SetForwarding(bool forward)
Set forwarding enabled or not.
void SetReachableTime(uint16_t reachableTime)
Set the reachable time.
Ipv6InterfaceAddress GetAddressMatchingDestination(Ipv6Address dst)
Get an address which is in the same network prefix as destination.
void SetNode(Ptr< Node > node)
Set node associated with interface.
void SetDown()
Disable this interface.
bool IsForwarding() const
If the interface allows forwarding packets.
void RemoveAddressCallback(Callback< void, Ptr< Ipv6Interface >, Ipv6InterfaceAddress > removeAddressCallback)
This callback is set when an address is removed from an interface with auto-generated Ndisc cache and...
uint16_t GetReachableTime() const
Get the reachable time.
bool IsUp() const
Is the interface UP ?
bool m_forwarding
Forwarding state.
uint16_t m_metric
The metric.
uint16_t m_reachableTime
Reachable time (in millisecond).
uint32_t GetNAddresses() const
Get number of addresses on this IPv6 interface.
void DoDispose() override
Dispose this object.
Callback< void, Ptr< Ipv6Interface >, Ipv6InterfaceAddress > m_removeAddressCallback
remove address callback
bool IsSolicitedMulticastAddress(Ipv6Address address) const
Checks if the address is a Solicited Multicast address for this interface.
void SetCurHopLimit(uint8_t curHopLimit)
Set the current hop limit.
Ipv6InterfaceAddress GetAddress(uint32_t index) const
Get an address from IPv6 interface.
std::list< std::pair< Ipv6InterfaceAddress, Ipv6Address > > Ipv6InterfaceAddressList
Container for the Ipv6InterfaceAddresses.
~Ipv6Interface() override
Destructor.
bool AddAddress(Ipv6InterfaceAddress iface)
Add an IPv6 address.
std::list< std::pair< Ipv6InterfaceAddress, Ipv6Address > >::iterator Ipv6InterfaceAddressListI
Container Iterator for the Ipv6InterfaceAddresses.
void SetUp()
Enable this interface.
void SetNsDadUid(Ipv6Address address, uint32_t uid)
Update NS DAD packet UID of an interface address.
uint16_t m_retransTimer
Retransmission timer (in millisecond).
void Send(Ptr< Packet > p, const Ipv6Header &hdr, Ipv6Address dest)
Send a packet through this interface.
Ipv6InterfaceAddressList m_addresses
The addresses assigned to this interface.
uint16_t GetRetransTimer() const
Get the retransmission timer.
uint16_t GetMetric() const
Get the metric.
void SetBaseReachableTime(uint16_t baseReachableTime)
Set the base reachable time.
Ptr< NdiscCache > GetNdiscCache() const
Ipv6InterfaceAddress m_linkLocalAddress
The link-local addresses assigned to this interface.
Ptr< Node > m_node
Node associated with this interface.
Callback< void, Ptr< Ipv6Interface >, Ipv6InterfaceAddress > m_addAddressCallback
add address callback
void SetTrafficControl(Ptr< TrafficControlLayer > tc)
Set the TrafficControlLayer.
void SetMetric(uint16_t metric)
Set the metric.
uint16_t m_baseReachableTime
Base value used for computing the random reachable time value (in millisecond).
Ptr< TrafficControlLayer > m_tc
TrafficControlLayer associated with this interface.
std::list< std::pair< Ipv6InterfaceAddress, Ipv6Address > >::const_iterator Ipv6InterfaceAddressListCI
Const Container Iterator for the Ipv6InterfaceAddresses.
void AddAddressCallback(Callback< void, Ptr< Ipv6Interface >, Ipv6InterfaceAddress > addAddressCallback)
This callback is set when an address is added from an interface with auto-generated Ndisc cache and i...
Ipv6Interface & operator=(const Ipv6Interface &)=delete
void SetDevice(Ptr< NetDevice > device)
Set the NetDevice.
virtual Ptr< NetDevice > GetDevice() const
Get the NetDevice.
void SetState(Ipv6Address address, Ipv6InterfaceAddress::State_e state)
Update state of an interface address.
A base class which provides memory management and object aggregation.
Definition: object.h:89
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.