A Discrete-Event Network Simulator
API
ipv4-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 IPV4_LIST_ROUTING_H
20 #define IPV4_LIST_ROUTING_H
21 
22 #include <list>
23 #include "ns3/ipv4-routing-protocol.h"
24 #include "ns3/simulator.h"
25 #include "ns3/nstime.h"
26 
27 namespace ns3 {
28 
45 {
46 public:
51  static TypeId GetTypeId (void);
52 
53  Ipv4ListRouting ();
54  virtual ~Ipv4ListRouting ();
55 
63  virtual void AddRoutingProtocol (Ptr<Ipv4RoutingProtocol> routingProtocol, int16_t priority);
67  virtual uint32_t GetNRoutingProtocols (void) const;
79  virtual Ptr<Ipv4RoutingProtocol> GetRoutingProtocol (uint32_t index, int16_t& priority) const;
80 
81  // Below are from Ipv4RoutingProtocol
82  virtual Ptr<Ipv4Route> RouteOutput (Ptr<Packet> p, const Ipv4Header &header, Ptr<NetDevice> oif, Socket::SocketErrno &sockerr);
83 
84  virtual bool RouteInput (Ptr<const Packet> p, const Ipv4Header &header, Ptr<const NetDevice> idev,
87  virtual void NotifyInterfaceUp (uint32_t interface);
88  virtual void NotifyInterfaceDown (uint32_t interface);
89  virtual void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address);
90  virtual void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address);
91  virtual void SetIpv4 (Ptr<Ipv4> ipv4);
92  virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream, Time::Unit unit = Time::S) const;
93 
94 protected:
95  virtual void DoDispose (void);
96  virtual void DoInitialize (void);
97 private:
101  typedef std::pair<int16_t, Ptr<Ipv4RoutingProtocol> > Ipv4RoutingProtocolEntry;
105  typedef std::list<Ipv4RoutingProtocolEntry> Ipv4RoutingProtocolList;
107 
114  static bool Compare (const Ipv4RoutingProtocolEntry& a, const Ipv4RoutingProtocolEntry& b);
116 
117 
118 };
119 
120 } // namespace ns3
121 
122 #endif /* IPV4_LIST_ROUTING_H */
Callback template class.
Definition: callback.h:1279
Packet header for IPv4.
Definition: ipv4-header.h:34
a class to store IPv4 address information on an interface
IPv4 list routing.
std::pair< int16_t, Ptr< Ipv4RoutingProtocol > > Ipv4RoutingProtocolEntry
Container identifying an IPv4 Routing Protocol entry in the list.
virtual void NotifyRemoveAddress(uint32_t interface, Ipv4InterfaceAddress address)
virtual void NotifyInterfaceUp(uint32_t interface)
virtual void NotifyInterfaceDown(uint32_t interface)
virtual void DoInitialize(void)
Initialize() implementation.
Ipv4RoutingProtocolList m_routingProtocols
List of routing protocols.
virtual uint32_t GetNRoutingProtocols(void) const
virtual void SetIpv4(Ptr< Ipv4 > ipv4)
virtual void PrintRoutingTable(Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S) const
Print the Routing Table entries.
virtual void NotifyAddAddress(uint32_t interface, Ipv4InterfaceAddress address)
std::list< Ipv4RoutingProtocolEntry > Ipv4RoutingProtocolList
Container of the IPv4 Routing Protocols.
virtual void AddRoutingProtocol(Ptr< Ipv4RoutingProtocol > routingProtocol, int16_t priority)
Register a new routing protocol to be used in this IPv4 stack.
Ptr< Ipv4 > m_ipv4
Ipv4 this protocol is associated with.
static TypeId GetTypeId(void)
Get the type ID of this class.
static bool Compare(const Ipv4RoutingProtocolEntry &a, const Ipv4RoutingProtocolEntry &b)
Compare two routing protocols.
virtual Ptr< Ipv4RoutingProtocol > GetRoutingProtocol(uint32_t index, int16_t &priority) const
Return pointer to routing protocol stored at index, with the first protocol (index 0) the highest pri...
virtual Ptr< Ipv4Route > RouteOutput(Ptr< Packet > p, const Ipv4Header &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 Ipv4Header &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 DoDispose(void)
Destructor implementation.
Abstract base class for IPv4 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.