A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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-address.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 NdiscCache;
39 
49 class Ipv6Interface : public Object
50 {
51 public:
56  static TypeId GetTypeId ();
57 
61  Ipv6Interface ();
62 
66  virtual ~Ipv6Interface ();
67 
72  void SetNode (Ptr<Node> node);
73 
78  void SetDevice (Ptr<NetDevice> device);
79 
84  virtual Ptr<NetDevice> GetDevice () const;
85 
90  void SetMetric (uint16_t metric);
91 
96  uint16_t GetMetric () const;
97 
102  bool IsUp () const;
103 
108  bool IsDown () const;
109 
113  void SetUp ();
114 
118  void SetDown ();
119 
124  bool IsForwarding () const;
125 
130  void SetForwarding (bool forward);
131 
136  void SetCurHopLimit (uint8_t curHopLimit);
137 
142  uint8_t GetCurHopLimit () const;
143 
148  void SetBaseReachableTime (uint16_t baseReachableTime);
149 
154  uint16_t GetBaseReachableTime () const;
155 
160  void SetReachableTime (uint16_t reachableTime);
161 
166  uint16_t GetReachableTime () const;
167 
172  void SetRetransTimer (uint16_t retransTimer);
173 
178  uint16_t GetRetransTimer () const;
179 
188  void Send (Ptr<Packet> p, Ipv6Address dest);
189 
195  bool AddAddress (Ipv6InterfaceAddress iface);
196 
202 
208  Ipv6InterfaceAddress GetAddress (uint32_t index) const;
209 
216 
221  uint32_t GetNAddresses (void) const;
222 
228  Ipv6InterfaceAddress RemoveAddress (uint32_t index);
229 
235  void SetState (Ipv6Address address, Ipv6InterfaceAddress::State_e state);
236 
242  void SetNsDadUid (Ipv6Address address, uint32_t uid);
243 
244 protected:
248  virtual void DoDispose ();
249 
250 private:
251  typedef std::list<Ipv6InterfaceAddress> Ipv6InterfaceAddressList;
252  typedef std::list<Ipv6InterfaceAddress>::iterator Ipv6InterfaceAddressListI;
253  typedef std::list<Ipv6InterfaceAddress>::const_iterator Ipv6InterfaceAddressListCI;
254 
258  void DoSetup ();
259 
264 
268  bool m_ifup;
269 
274 
278  uint16_t m_metric;
279 
284 
289 
294 
298  uint8_t m_curHopLimit;
299 
304 
309  uint16_t m_reachableTime;
310 
315  uint16_t m_retransTimer;
316 };
317 
318 } /* namespace ns3 */
319 
320 #endif /* IPV6_INTERFACE_H */
321