A Discrete-Event Network Simulator
API
ipv6-list-routing.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 #ifndef IPV6_LIST_ROUTING_H
19 #define IPV6_LIST_ROUTING_H
20 
21 #include "ipv6-routing-protocol.h"
22 
23 #include <list>
24 
25 namespace ns3
26 {
27 
44 {
45  public:
50  static TypeId GetTypeId();
51 
56 
60  ~Ipv6ListRouting() override;
61 
68  virtual void AddRoutingProtocol(Ptr<Ipv6RoutingProtocol> routingProtocol, int16_t priority);
69 
74  virtual uint32_t GetNRoutingProtocols() const;
75 
87  virtual Ptr<Ipv6RoutingProtocol> GetRoutingProtocol(uint32_t index, int16_t& priority) const;
88 
89  // Below are from Ipv6RoutingProtocol
91  const Ipv6Header& header,
92  Ptr<NetDevice> oif,
93  Socket::SocketErrno& sockerr) override;
94 
96  const Ipv6Header& header,
98  const UnicastForwardCallback& ucb,
99  const MulticastForwardCallback& mcb,
100  const LocalDeliverCallback& lcb,
101  const ErrorCallback& ecb) override;
102  void NotifyInterfaceUp(uint32_t interface) override;
103  void NotifyInterfaceDown(uint32_t interface) override;
104  void NotifyAddAddress(uint32_t interface, Ipv6InterfaceAddress address) override;
105  void NotifyRemoveAddress(uint32_t interface, Ipv6InterfaceAddress address) override;
106  void NotifyAddRoute(Ipv6Address dst,
107  Ipv6Prefix mask,
108  Ipv6Address nextHop,
109  uint32_t interface,
110  Ipv6Address prefixToUse = Ipv6Address::GetZero()) override;
112  Ipv6Prefix mask,
113  Ipv6Address nextHop,
114  uint32_t interface,
115  Ipv6Address prefixToUse = Ipv6Address::GetZero()) override;
116  void SetIpv6(Ptr<Ipv6> ipv6) override;
118  Time::Unit unit = Time::S) const override;
119 
120  protected:
124  void DoDispose() override;
125 
126  private:
130  typedef std::pair<int16_t, Ptr<Ipv6RoutingProtocol>> Ipv6RoutingProtocolEntry;
131 
135  typedef std::list<Ipv6RoutingProtocolEntry> Ipv6RoutingProtocolList;
136 
143  static bool Compare(const Ipv6RoutingProtocolEntry& a, const Ipv6RoutingProtocolEntry& b);
144 
147 };
148 
149 } // namespace ns3
150 
151 #endif /* IPV6_LIST_ROUTING_H */
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.
Hold list of Ipv6RoutingProtocol objects.
void PrintRoutingTable(Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S) const override
Print the Routing Table entries.
static TypeId GetTypeId()
Get the type ID of this class.
std::pair< int16_t, Ptr< Ipv6RoutingProtocol > > Ipv6RoutingProtocolEntry
Container identifying an IPv6 Routing Protocol entry in the list.
static bool Compare(const Ipv6RoutingProtocolEntry &a, const Ipv6RoutingProtocolEntry &b)
Compare two routing protocols.
void DoDispose() override
Dispose this object.
Ptr< Ipv6Route > RouteOutput(Ptr< Packet > p, const Ipv6Header &header, Ptr< NetDevice > oif, Socket::SocketErrno &sockerr) override
Query routing cache for an existing route, for an outbound packet.
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) override
Route an input packet (to be forwarded or locally delivered)
virtual uint32_t GetNRoutingProtocols() const
Get the number of routing protocols.
void SetIpv6(Ptr< Ipv6 > ipv6) override
Typically, invoked directly or indirectly from ns3::Ipv6::SetRoutingProtocol.
virtual Ptr< Ipv6RoutingProtocol > GetRoutingProtocol(uint32_t index, int16_t &priority) const
Get pointer to routing protocol stored at index,.
void NotifyAddAddress(uint32_t interface, Ipv6InterfaceAddress address) override
Notify when specified interface add an address.
Ipv6ListRouting()
Constructor.
void NotifyInterfaceDown(uint32_t interface) override
Notify when specified interface goes DOWN.
std::list< Ipv6RoutingProtocolEntry > Ipv6RoutingProtocolList
Container of the IPv6 Routing Protocols.
void NotifyRemoveAddress(uint32_t interface, Ipv6InterfaceAddress address) override
Notify when specified interface add an address.
void NotifyInterfaceUp(uint32_t interface) override
Notify when specified interface goes UP.
void NotifyAddRoute(Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse=Ipv6Address::GetZero()) override
Notify a new route.
~Ipv6ListRouting() override
Destructor.
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.
void NotifyRemoveRoute(Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse=Ipv6Address::GetZero()) override
Notify route removing.
Describes an IPv6 prefix.
Definition: ipv6-address.h:455
Abstract base class for IPv6 routing protocols.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
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.