A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ipv6.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2007 INRIA
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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  */
20 
21 /* taken from src/node/ipv4.h and adapted to IPv6 */
22 
23 #ifndef IPV6_H
24 #define IPV6_H
25 
26 #include <stdint.h>
27 
28 #include "ns3/object.h"
29 #include "ns3/socket.h"
30 #include "ns3/callback.h"
31 
32 #include "ns3/ipv6-address.h"
33 #include "ipv6-interface-address.h"
34 
35 namespace ns3 {
36 
37 class Node;
38 class NetDevice;
39 class Packet;
40 class Ipv6RoutingProtocol;
41 
79 class Ipv6 : public Object
80 {
81 public:
86  static TypeId GetTypeId (void);
87 
91  Ipv6 ();
92 
96  virtual ~Ipv6 ();
97 
107  virtual void SetRoutingProtocol (Ptr<Ipv6RoutingProtocol> routingProtocol) = 0;
108 
114  virtual Ptr<Ipv6RoutingProtocol> GetRoutingProtocol (void) const = 0;
115 
126  virtual uint32_t AddInterface (Ptr<NetDevice> device) = 0;
127 
132  virtual uint32_t GetNInterfaces (void) const = 0;
133 
148  virtual int32_t GetInterfaceForAddress (Ipv6Address address) const = 0;
149 
166  virtual int32_t GetInterfaceForPrefix (Ipv6Address address,
167  Ipv6Prefix mask) const = 0;
168 
174  virtual Ptr<NetDevice> GetNetDevice (uint32_t interface) = 0;
175 
181  virtual int32_t GetInterfaceForDevice (Ptr<const NetDevice> device) const = 0;
182 
189  virtual bool AddAddress (uint32_t interface, Ipv6InterfaceAddress address) = 0;
190 
196  virtual uint32_t GetNAddresses (uint32_t interface) const = 0;
197 
208  virtual Ipv6InterfaceAddress GetAddress (uint32_t interface, uint32_t addressIndex) const = 0;
209 
222  virtual bool RemoveAddress (uint32_t interface, uint32_t addressIndex) = 0;
223 
231  virtual bool RemoveAddress (uint32_t interface, Ipv6Address address) = 0;
232 
240  virtual void SetMetric (uint32_t interface, uint16_t metric) = 0;
241 
249  virtual uint16_t GetMetric (uint32_t interface) const = 0;
250 
257  virtual uint16_t GetMtu (uint32_t interface) const = 0;
258 
264  virtual void SetPmtu (Ipv6Address dst, uint32_t pmtu) = 0;
265 
272  virtual bool IsUp (uint32_t interface) const = 0;
273 
280  virtual void SetUp (uint32_t interface) = 0;
281 
288  virtual void SetDown (uint32_t interface) = 0;
289 
295  virtual bool IsForwarding (uint32_t interface) const = 0;
296 
304  virtual void SetForwarding (uint32_t interface, bool val) = 0;
305 
309  virtual void RegisterExtensions () = 0;
310 
314  virtual void RegisterOptions () = 0;
315 
319  static const uint32_t IF_ANY = 0xffffffff;
320 
321 private:
322  // Indirect the IPv6 attributes through private pure virtual methods
327  virtual void SetIpForward (bool forward) = 0;
328 
333  virtual bool GetIpForward (void) const = 0;
334 
339  virtual void SetMtuDiscover (bool mtuDiscover) = 0;
340 
345  virtual bool GetMtuDiscover (void) const = 0;
346 };
347 
348 } // namespace ns3
349 
350 #endif /* IPV6_H */
351 
virtual uint16_t GetMetric(uint32_t interface) const =0
Get metric for the specified IPv6 interface.
static TypeId GetTypeId(void)
Get the type ID.
Definition: ipv6.cc:35
smart pointer class similar to boost::intrusive_ptr
Definition: ptr.h:59
virtual void SetMetric(uint32_t interface, uint16_t metric)=0
Set metric on specified Ipv6 interface.
virtual uint32_t GetNAddresses(uint32_t interface) const =0
Get number of addresses on specified IPv6 interface.
Access to the IPv6 forwarding table, interfaces, and configuration.
Definition: ipv6.h:79
virtual bool IsUp(uint32_t interface) const =0
If the specified interface index is in "up" state.
virtual void SetPmtu(Ipv6Address dst, uint32_t pmtu)=0
Set the Path MTU for the specified IPv6 destination address.
virtual bool RemoveAddress(uint32_t interface, uint32_t addressIndex)=0
Remove an address on specified IPv6 interface.
IPv6 address associated with an interface.
Ipv6()
Constructor.
Definition: ipv6.cc:53
virtual void SetMtuDiscover(bool mtuDiscover)=0
Set IPv6 MTU discover state.
virtual void SetIpForward(bool forward)=0
Set IPv6 forwarding state.
virtual void SetRoutingProtocol(Ptr< Ipv6RoutingProtocol > routingProtocol)=0
Register a new routing protocol to be used by this IPv6 stack.
virtual Ipv6InterfaceAddress GetAddress(uint32_t interface, uint32_t addressIndex) const =0
Get IPv6 address on specified IPv6 interface.
virtual void SetForwarding(uint32_t interface, bool val)=0
Set forwarding on specified IPv6 interface.
virtual bool GetMtuDiscover(void) const =0
Get IPv6 MTU discover state.
virtual void RegisterExtensions()=0
Register the IPv6 Extensions.
virtual uint16_t GetMtu(uint32_t interface) const =0
Get MTU for the specified IPv6 interface.
virtual ~Ipv6()
Destructor.
Definition: ipv6.cc:57
static const uint32_t IF_ANY
Any interface magic number.
Definition: ipv6.h:319
virtual bool GetIpForward(void) const =0
Get IPv6 forwarding state.
virtual uint32_t AddInterface(Ptr< NetDevice > device)=0
Add a NetDevice interface.
Describes an IPv6 address.
Definition: ipv6-address.h:46
virtual int32_t GetInterfaceForPrefix(Ipv6Address address, Ipv6Prefix mask) const =0
Return the interface number of first interface found that has an IPv6 address within the prefix speci...
virtual void RegisterOptions()=0
Register the IPv6 Options.
virtual Ptr< NetDevice > GetNetDevice(uint32_t interface)=0
Get the NetDevice of the specified interface number.
Describes an IPv6 prefix.
Definition: ipv6-address.h:387
virtual bool IsForwarding(uint32_t interface) const =0
If the specified IPv6 interface has forwarding enabled.
virtual bool AddAddress(uint32_t interface, Ipv6InterfaceAddress address)=0
Add an address on the specified IPv6 interface.
a base class which provides memory management and object aggregation
Definition: object.h:63
tuple address
Definition: first.py:37
virtual Ptr< Ipv6RoutingProtocol > GetRoutingProtocol(void) const =0
Get the routing protocol to be used by this IPv6 stack.
virtual int32_t GetInterfaceForAddress(Ipv6Address address) const =0
Return the interface number of the interface that has been assigned the specified IP address...
a unique identifier for an interface.
Definition: type-id.h:49
virtual int32_t GetInterfaceForDevice(Ptr< const NetDevice > device) const =0
Get the interface index of the specified NetDevice.
virtual void SetDown(uint32_t interface)=0
Set the interface into the "down" state.
virtual uint32_t GetNInterfaces(void) const =0
Get number of interfaces.
virtual void SetUp(uint32_t interface)=0
Set the interface into the "up" state.