A Discrete-Event Network Simulator
API
ipv6-routing-protocol.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2009 University of Washington
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 
18 /* taken from src/node/ipv4-routing-protocol.h and adapted to IPv6 */
19 
20 #ifndef IPV6_ROUTING_PROTOCOL_H
21 #define IPV6_ROUTING_PROTOCOL_H
22 
23 #include "ipv6-header.h"
24 #include "ipv6-interface-address.h"
25 #include "ipv6.h"
26 
27 #include "ns3/callback.h"
28 #include "ns3/nstime.h"
29 #include "ns3/object.h"
30 #include "ns3/output-stream-wrapper.h"
31 #include "ns3/packet.h"
32 #include "ns3/socket.h"
33 
34 namespace ns3
35 {
36 
37 class Ipv6MulticastRoute;
38 class Ipv6Route;
39 class NetDevice;
40 
60 {
61  public:
66  static TypeId GetTypeId();
67 
69  typedef Callback<void,
73  const Ipv6Header&>
75 
77  typedef Callback<void,
81  const Ipv6Header&>
83 
86 
89 
107  const Ipv6Header& header,
108  Ptr<NetDevice> oif,
109  Socket::SocketErrno& sockerr) = 0;
110 
133  const Ipv6Header& header,
135  const UnicastForwardCallback& ucb,
136  const MulticastForwardCallback& mcb,
137  const LocalDeliverCallback& lcb,
138  const ErrorCallback& ecb) = 0;
139 
147  virtual void NotifyInterfaceUp(uint32_t interface) = 0;
148 
156  virtual void NotifyInterfaceDown(uint32_t interface) = 0;
157 
167  virtual void NotifyAddAddress(uint32_t interface, Ipv6InterfaceAddress address) = 0;
168 
178  virtual void NotifyRemoveAddress(uint32_t interface, Ipv6InterfaceAddress address) = 0;
179 
191  virtual void NotifyAddRoute(Ipv6Address dst,
192  Ipv6Prefix mask,
193  Ipv6Address nextHop,
194  uint32_t interface,
195  Ipv6Address prefixToUse = Ipv6Address::GetZero()) = 0;
196 
205  virtual void NotifyRemoveRoute(Ipv6Address dst,
206  Ipv6Prefix mask,
207  Ipv6Address nextHop,
208  uint32_t interface,
209  Ipv6Address prefixToUse = Ipv6Address::GetZero()) = 0;
210 
215  virtual void SetIpv6(Ptr<Ipv6> ipv6) = 0;
216 
224  Time::Unit unit = Time::S) const = 0;
225 };
226 
227 } // namespace ns3
228 
229 #endif /* IPV6_ROUTING_PROTOCOL_H */
Callback template class.
Definition: callback.h:438
Describes an IPv6 address.
Definition: ipv6-address.h:49
static Ipv6Address GetZero()
Get the 0 (::) Ipv6Address.
Packet header for IPv6.
Definition: ipv6-header.h:35
IPv6 address associated with an interface.
Describes an IPv6 prefix.
Definition: ipv6-address.h:455
Abstract base class for IPv6 routing protocols.
virtual void NotifyInterfaceUp(uint32_t interface)=0
Notify when specified interface goes UP.
static TypeId GetTypeId()
Get the type ID.
virtual void PrintRoutingTable(Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S) const =0
Print the Routing Table entries.
virtual bool RouteInput(Ptr< const Packet > p, const Ipv6Header &header, Ptr< const NetDevice > idev, const UnicastForwardCallback &ucb, const MulticastForwardCallback &mcb, const LocalDeliverCallback &lcb, const ErrorCallback &ecb)=0
Route an input packet (to be forwarded or locally delivered)
Callback< void, Ptr< const Packet >, const Ipv6Header &, Socket::SocketErrno > ErrorCallback
Callback for routing errors (e.g., no route found)
Callback< void, Ptr< const NetDevice >, Ptr< Ipv6MulticastRoute >, Ptr< const Packet >, const Ipv6Header & > MulticastForwardCallback
Callback for multicast packets to be forwarded.
virtual void NotifyRemoveAddress(uint32_t interface, Ipv6InterfaceAddress address)=0
Notify when specified interface add an address.
virtual Ptr< Ipv6Route > RouteOutput(Ptr< Packet > p, const Ipv6Header &header, Ptr< NetDevice > oif, Socket::SocketErrno &sockerr)=0
Query routing cache for an existing route, for an outbound packet.
Callback< void, Ptr< const Packet >, const Ipv6Header &, uint32_t > LocalDeliverCallback
Callback for packets to be locally delivered.
virtual void NotifyInterfaceDown(uint32_t interface)=0
Notify when specified interface goes DOWN.
virtual void SetIpv6(Ptr< Ipv6 > ipv6)=0
Typically, invoked directly or indirectly from ns3::Ipv6::SetRoutingProtocol.
Callback< void, Ptr< const NetDevice >, Ptr< Ipv6Route >, Ptr< const Packet >, const Ipv6Header & > UnicastForwardCallback
Callback for unicast packets to be forwarded.
virtual void NotifyAddRoute(Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse=Ipv6Address::GetZero())=0
Notify a new route.
virtual void NotifyAddAddress(uint32_t interface, Ipv6InterfaceAddress address)=0
Notify when specified interface add an address.
virtual void NotifyRemoveRoute(Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse=Ipv6Address::GetZero())=0
Notify route removing.
A base class which provides memory management and object aggregation.
Definition: object.h:89
SocketErrno
Enumeration of the possible errors returned by a socket.
Definition: socket.h:84
Unit
The unit to use to interpret a number representing time.
Definition: nstime.h:111
@ S
second
Definition: nstime.h:116
a unique identifier for an interface.
Definition: type-id.h:59
address
Definition: first.py:47
Every class exported by the ns3 library is enclosed in the ns3 namespace.