A Discrete-Event Network Simulator
API
ipv6-list-routing.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2009 University of Washington
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 
19 #ifndef IPV6_LIST_ROUTING_H
20 #define IPV6_LIST_ROUTING_H
21 
22 #include <list>
23 #include "ns3/ipv6-routing-protocol.h"
24 
25 namespace ns3 {
26 
43 {
44 public:
49  static TypeId GetTypeId (void);
50 
54  Ipv6ListRouting ();
55 
59  virtual ~Ipv6ListRouting ();
60 
67  virtual void AddRoutingProtocol (Ptr<Ipv6RoutingProtocol> routingProtocol, int16_t priority);
68 
73  virtual uint32_t GetNRoutingProtocols (void) const;
74 
86  virtual Ptr<Ipv6RoutingProtocol> GetRoutingProtocol (uint32_t index, int16_t& priority) const;
87 
88  // Below are from Ipv6RoutingProtocol
89  virtual Ptr<Ipv6Route> RouteOutput (Ptr<Packet> p, const Ipv6Header &header, Ptr<NetDevice> oif, Socket::SocketErrno &sockerr);
90 
91  virtual bool RouteInput (Ptr<const Packet> p, const Ipv6Header &header, Ptr<const NetDevice> idev,
94  virtual void NotifyInterfaceUp (uint32_t interface);
95  virtual void NotifyInterfaceDown (uint32_t interface);
96  virtual void NotifyAddAddress (uint32_t interface, Ipv6InterfaceAddress address);
97  virtual void NotifyRemoveAddress (uint32_t interface, Ipv6InterfaceAddress address);
98  virtual void NotifyAddRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse = Ipv6Address::GetZero ());
99  virtual void NotifyRemoveRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse = Ipv6Address::GetZero ());
100  virtual void SetIpv6 (Ptr<Ipv6> ipv6);
101  virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream, Time::Unit unit = Time::S) const;
102 
103 protected:
107  virtual void DoDispose (void);
108 
109 private:
113  typedef std::pair<int16_t, Ptr<Ipv6RoutingProtocol> > Ipv6RoutingProtocolEntry;
114 
118  typedef std::list<Ipv6RoutingProtocolEntry> Ipv6RoutingProtocolList;
119 
126  static bool Compare (const Ipv6RoutingProtocolEntry& a, const Ipv6RoutingProtocolEntry& b);
127 
130 };
131 
132 } // namespace ns3
133 
134 #endif /* IPV6_LIST_ROUTING_H */
135 
Callback template class.
Definition: callback.h:1279
Describes an IPv6 address.
Definition: ipv6-address.h:50
static Ipv6Address GetZero()
Get the 0 (::) Ipv6Address.
Packet header for IPv6.
Definition: ipv6-header.h:36
IPv6 address associated with an interface.
Hold list of Ipv6RoutingProtocol objects.
virtual ~Ipv6ListRouting()
Destructor.
virtual void NotifyRemoveRoute(Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse=Ipv6Address::GetZero())
Notify route removing.
virtual Ptr< Ipv6Route > RouteOutput(Ptr< Packet > p, const Ipv6Header &header, Ptr< NetDevice > oif, Socket::SocketErrno &sockerr)
Query routing cache for an existing route, for an outbound packet.
virtual bool RouteInput(Ptr< const Packet > p, const Ipv6Header &header, Ptr< const NetDevice > idev, UnicastForwardCallback ucb, MulticastForwardCallback mcb, LocalDeliverCallback lcb, ErrorCallback ecb)
Route an input packet (to be forwarded or locally delivered)
virtual void NotifyInterfaceDown(uint32_t interface)
Notify when specified interface goes DOWN.
static TypeId GetTypeId(void)
Get the type ID of this class.
std::pair< int16_t, Ptr< Ipv6RoutingProtocol > > Ipv6RoutingProtocolEntry
Container identifying an IPv6 Routing Protocol entry in the list.
virtual void NotifyAddRoute(Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse=Ipv6Address::GetZero())
Notify a new route.
static bool Compare(const Ipv6RoutingProtocolEntry &a, const Ipv6RoutingProtocolEntry &b)
Compare two routing protocols.
virtual void NotifyRemoveAddress(uint32_t interface, Ipv6InterfaceAddress address)
Notify when specified interface add an address.
virtual void NotifyAddAddress(uint32_t interface, Ipv6InterfaceAddress address)
Notify when specified interface add an address.
virtual void DoDispose(void)
Dispose this object.
virtual Ptr< Ipv6RoutingProtocol > GetRoutingProtocol(uint32_t index, int16_t &priority) const
Get pointer to routing protocol stored at index,.
virtual uint32_t GetNRoutingProtocols(void) const
Get the number of routing protocols.
virtual void PrintRoutingTable(Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S) const
Print the Routing Table entries.
Ipv6ListRouting()
Constructor.
std::list< Ipv6RoutingProtocolEntry > Ipv6RoutingProtocolList
Container of the IPv6 Routing Protocols.
virtual void SetIpv6(Ptr< Ipv6 > ipv6)
Typically, invoked directly or indirectly from ns3::Ipv6::SetRoutingProtocol.
Ipv6RoutingProtocolList m_routingProtocols
List of routing protocols.
virtual void AddRoutingProtocol(Ptr< Ipv6RoutingProtocol > routingProtocol, int16_t priority)
Register a new routing protocol to be used in this IPv4 stack.
Ptr< Ipv6 > m_ipv6
Ipv6 this protocol is associated with.
virtual void NotifyInterfaceUp(uint32_t interface)
Notify when specified interface goes UP.
Describes an IPv6 prefix.
Definition: ipv6-address.h:456
Abstract base class for IPv6 routing protocols.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
SocketErrno
Enumeration of the possible errors returned by a socket.
Definition: socket.h:82
Unit
The unit to use to interpret a number representing time.
Definition: nstime.h:109
@ S
second
Definition: nstime.h:114
a unique identifier for an interface.
Definition: type-id.h:59
address
Definition: first.py:44
Every class exported by the ns3 library is enclosed in the ns3 namespace.