A Discrete-Event Network Simulator
API
ipv6-interface.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2007-2009 Strasbourg University
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
19  */
20 
21 #ifndef IPV6_INTERFACE_H
22 #define IPV6_INTERFACE_H
23 
24 #include <list>
25 
26 #include "ns3/ipv6-header.h"
27 #include "ns3/ipv6-interface-address.h"
28 #include "ns3/ptr.h"
29 #include "ns3/object.h"
30 #include "ns3/timer.h"
31 
32 namespace ns3
33 {
34 
35 class NetDevice;
36 class Packet;
37 class Node;
38 class TrafficControlLayer;
39 class NdiscCache;
40 
50 class Ipv6Interface : public Object
51 {
52 public:
57  static TypeId GetTypeId ();
58 
62  Ipv6Interface ();
63 
67  virtual ~Ipv6Interface ();
68 
73  void SetNode (Ptr<Node> node);
74 
79  void SetDevice (Ptr<NetDevice> device);
80 
86 
91  virtual Ptr<NetDevice> GetDevice () const;
92 
97  void SetMetric (uint16_t metric);
98 
103  uint16_t GetMetric () const;
104 
109  bool IsUp () const;
110 
115  bool IsDown () const;
116 
120  void SetUp ();
121 
125  void SetDown ();
126 
131  bool IsForwarding () const;
132 
137  void SetForwarding (bool forward);
138 
143  void SetCurHopLimit (uint8_t curHopLimit);
144 
149  uint8_t GetCurHopLimit () const;
150 
155  void SetBaseReachableTime (uint16_t baseReachableTime);
156 
161  uint16_t GetBaseReachableTime () const;
162 
167  void SetReachableTime (uint16_t reachableTime);
168 
173  uint16_t GetReachableTime () const;
174 
179  void SetRetransTimer (uint16_t retransTimer);
180 
185  uint16_t GetRetransTimer () const;
186 
196  void Send (Ptr<Packet> p, const Ipv6Header & hdr, Ipv6Address dest);
197 
203  bool AddAddress (Ipv6InterfaceAddress iface);
204 
210 
217 
223  Ipv6InterfaceAddress GetAddress (uint32_t index) const;
224 
231 
236  uint32_t GetNAddresses (void) const;
237 
243  Ipv6InterfaceAddress RemoveAddress (uint32_t index);
244 
253 
259  void SetState (Ipv6Address address, Ipv6InterfaceAddress::State_e state);
260 
266  void SetNsDadUid (Ipv6Address address, uint32_t uid);
267 
272 
273 
274 protected:
278  virtual void DoDispose ();
279 
280 private:
284  typedef std::list<std::pair<Ipv6InterfaceAddress, Ipv6Address> > Ipv6InterfaceAddressList;
285 
289  typedef std::list<std::pair<Ipv6InterfaceAddress, Ipv6Address> >::iterator Ipv6InterfaceAddressListI;
290 
294  typedef std::list<std::pair<Ipv6InterfaceAddress, Ipv6Address> >::const_iterator Ipv6InterfaceAddressListCI;
295 
299  void DoSetup ();
300 
304  Ipv6InterfaceAddressList m_addresses;
305 
310 
314  bool m_ifup;
315 
320 
324  uint16_t m_metric;
325 
330 
335 
340 
345 
349  uint8_t m_curHopLimit;
350 
355 
360  uint16_t m_reachableTime;
361 
366  uint16_t m_retransTimer;
367 };
368 
369 } /* namespace ns3 */
370 
371 #endif /* IPV6_INTERFACE_H */
372 
Ipv6InterfaceAddressList m_addresses
The addresses assigned to this interface.
bool m_ifup
The state of this interface.
Introspection did not find any typical Config paths.
Definition: ipv6-header.h:33
bool AddAddress(Ipv6InterfaceAddress iface)
Add an IPv6 address.
void SetState(Ipv6Address address, Ipv6InterfaceAddress::State_e state)
Update state of an interface address.
void SetUp()
Enable this interface.
uint16_t GetRetransTimer() const
Get the retransmission timer.
bool m_forwarding
Forwarding state.
Ipv6InterfaceAddress GetAddress(uint32_t index) const
Get an address from IPv6 interface.
IPv6 address associated with an interface.
Ptr< NetDevice > m_device
NetDevice associated with this interface.
void SetDevice(Ptr< NetDevice > device)
Set the NetDevice.
void SetReachableTime(uint16_t reachableTime)
Set the reachable time.
bool IsUp() const
Is the interface UP ?
bool IsDown() const
Is the interface DOWN ?
void SetBaseReachableTime(uint16_t baseReachableTime)
Set the base reachable time.
bool IsSolicitedMulticastAddress(Ipv6Address address) const
Checks if the address is a Solicited Multicast address for this interface.
Ptr< NdiscCache > GetNdiscCache() const
uint16_t m_baseReachableTime
Base value used for computing the random reachable time value (in millisecond).
The IPv6 representation of a network interface.
uint16_t GetBaseReachableTime() const
Get the base reachable time.
void Send(Ptr< Packet > p, const Ipv6Header &hdr, Ipv6Address dest)
Send a packet through this interface.
uint32_t GetNAddresses(void) const
Get number of addresses on this IPv6 interface.
void SetMetric(uint16_t metric)
Set the metric.
Ptr< Node > m_node
Node associated with this interface.
virtual ~Ipv6Interface()
Destructor.
void SetRetransTimer(uint16_t retransTimer)
Set the retransmission timer.
uint16_t m_retransTimer
Retransmission timer (in millisecond).
static TypeId GetTypeId()
Get the type ID.
virtual Ptr< NetDevice > GetDevice() const
Get the NetDevice.
Ipv6InterfaceAddress m_linkLocalAddress
The link-local addresses assigned to this interface.
void SetTrafficControl(Ptr< TrafficControlLayer > tc)
Set the TrafficControlLayer.
void SetNsDadUid(Ipv6Address address, uint32_t uid)
Update NS DAD packet UID of an interface address.
void SetNode(Ptr< Node > node)
Set node associated with interface.
void SetForwarding(bool forward)
Set forwarding enabled or not.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint8_t m_curHopLimit
Current hop limit.
void SetCurHopLimit(uint8_t curHopLimit)
Set the current hop limit.
std::list< std::pair< Ipv6InterfaceAddress, Ipv6Address > >::const_iterator Ipv6InterfaceAddressListCI
Const Container Iterator for the Ipv6InterfaceAddresses.
std::list< std::pair< Ipv6InterfaceAddress, Ipv6Address > >::iterator Ipv6InterfaceAddressListI
Container Iterator for the Ipv6InterfaceAddresses.
Ipv6InterfaceAddress GetLinkLocalAddress() const
Get link-local address from IPv6 interface.
uint8_t GetCurHopLimit() const
Get the current hop limit value.
Describes an IPv6 address.
Definition: ipv6-address.h:48
uint16_t GetMetric() const
Get the metric.
State_e
State of an address associated with an interface.
void DoSetup()
Initialize interface.
uint16_t m_reachableTime
Reachable time (in millisecond).
bool IsForwarding() const
If the interface allows forwarding packets.
uint16_t GetReachableTime() const
Get the reachable time.
Ipv6InterfaceAddress RemoveAddress(uint32_t index)
Remove an address from interface.
A base class which provides memory management and object aggregation.
Definition: object.h:87
tuple address
Definition: first.py:37
virtual void DoDispose()
Dispose this object.
uint16_t m_metric
The metric.
Ptr< TrafficControlLayer > m_tc
TrafficControlLayer associated with this interface.
void SetDown()
Disable this interface.
a unique identifier for an interface.
Definition: type-id.h:58
Ipv6InterfaceAddress GetAddressMatchingDestination(Ipv6Address dst)
Get an address which is in the same network prefix as destination.
Ptr< NdiscCache > m_ndCache
Neighbor cache.
std::list< std::pair< Ipv6InterfaceAddress, Ipv6Address > > Ipv6InterfaceAddressList
Container for the Ipv6InterfaceAddresses.
Ipv6Interface()
Constructs an Ipv6Interface.