A Discrete-Event Network Simulator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
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  */
19 #ifndef IPV4_LIST_ROUTING_H
20 #define IPV4_LIST_ROUTING_H
22 #include <list>
23 #include "ns3/ipv4-routing-protocol.h"
24 #include "ns3/simulator.h"
26 namespace ns3 {
46 {
47 public:
52  static TypeId GetTypeId (void);
54  Ipv4ListRouting ();
55  virtual ~Ipv4ListRouting ();
64  virtual void AddRoutingProtocol (Ptr<Ipv4RoutingProtocol> routingProtocol, int16_t priority);
68  virtual uint32_t GetNRoutingProtocols (void) const;
80  virtual Ptr<Ipv4RoutingProtocol> GetRoutingProtocol (uint32_t index, int16_t& priority) const;
82  // Below are from Ipv4RoutingProtocol
83  virtual Ptr<Ipv4Route> RouteOutput (Ptr<Packet> p, const Ipv4Header &header, Ptr<NetDevice> oif, Socket::SocketErrno &sockerr);
85  virtual bool RouteInput (Ptr<const Packet> p, const Ipv4Header &header, Ptr<const NetDevice> idev,
88  virtual void NotifyInterfaceUp (uint32_t interface);
89  virtual void NotifyInterfaceDown (uint32_t interface);
90  virtual void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address);
91  virtual void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address);
92  virtual void SetIpv4 (Ptr<Ipv4> ipv4);
93  virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const;
95 protected:
96  void DoDispose (void);
97  void DoInitialize (void);
98 private:
102  typedef std::pair<int16_t, Ptr<Ipv4RoutingProtocol> > Ipv4RoutingProtocolEntry;
106  typedef std::list<Ipv4RoutingProtocolEntry> Ipv4RoutingProtocolList;
115  static bool Compare (const Ipv4RoutingProtocolEntry& a, const Ipv4RoutingProtocolEntry& b);
119 };
121 } // namespace ns3
123 #endif /* IPV4_LIST_ROUTING_H */
smart pointer class similar to boost::intrusive_ptr
Definition: ptr.h:60
virtual void PrintRoutingTable(Ptr< OutputStreamWrapper > stream) const
Print the Routing Table entries.
Callback template class.
Definition: callback.h:924
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 void SetIpv4(Ptr< Ipv4 > ipv4)
void DoInitialize(void)
This method is called only once by Object::Initialize.
virtual void AddRoutingProtocol(Ptr< Ipv4RoutingProtocol > routingProtocol, int16_t priority)
Register a new routing protocol to be used in this IPv4 stack.
static TypeId GetTypeId(void)
Get the type ID of this class.
virtual void NotifyRemoveAddress(uint32_t interface, Ipv4InterfaceAddress address)
Enumeration of the possible errors returned by a socket.
Definition: socket.h:82
Ptr< Ipv4 > m_ipv4
Ipv4 this protocol is associated with.
Packet header for IPv4.
Definition: ipv4-header.h:31
static bool Compare(const Ipv4RoutingProtocolEntry &a, const Ipv4RoutingProtocolEntry &b)
Compare two routing protocols.
std::pair< int16_t, Ptr< Ipv4RoutingProtocol > > Ipv4RoutingProtocolEntry
Container identifying an IPv4 Routing Protocol entry in the list.
std::list< Ipv4RoutingProtocolEntry > Ipv4RoutingProtocolList
Container of the IPv4 Routing Protocols.
This class is a specialization of Ipv4RoutingProtocol that allows other instances of Ipv4RoutingProto...
virtual uint32_t GetNRoutingProtocols(void) const
void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
virtual void NotifyInterfaceUp(uint32_t interface)
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 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.
a class to store IPv4 address information on an interface
Ipv4RoutingProtocolList m_routingProtocols
List of routing protocols.
virtual void NotifyInterfaceDown(uint32_t interface)
Abstract base class for IPv4 routing protocols.
tuple address
Definition: first.py:37
a unique identifier for an interface.
Definition: type-id.h:49
virtual void NotifyAddAddress(uint32_t interface, Ipv4InterfaceAddress address)