A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ipv4-list-routing.h
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 
26 namespace ns3 {
27 
46 {
47 public:
48  static TypeId GetTypeId (void);
49 
50  Ipv4ListRouting ();
51  virtual ~Ipv4ListRouting ();
52 
60  virtual void AddRoutingProtocol (Ptr<Ipv4RoutingProtocol> routingProtocol, int16_t priority);
64  virtual uint32_t GetNRoutingProtocols (void) const;
76  virtual Ptr<Ipv4RoutingProtocol> GetRoutingProtocol (uint32_t index, int16_t& priority) const;
77 
78  // Below are from Ipv4RoutingProtocol
79  virtual Ptr<Ipv4Route> RouteOutput (Ptr<Packet> p, const Ipv4Header &header, Ptr<NetDevice> oif, Socket::SocketErrno &sockerr);
80 
81  virtual bool RouteInput (Ptr<const Packet> p, const Ipv4Header &header, Ptr<const NetDevice> idev,
84  virtual void NotifyInterfaceUp (uint32_t interface);
85  virtual void NotifyInterfaceDown (uint32_t interface);
86  virtual void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address);
87  virtual void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address);
88  virtual void SetIpv4 (Ptr<Ipv4> ipv4);
89  virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const;
90 
91 protected:
92  void DoDispose (void);
93  void DoInitialize (void);
94 private:
95  typedef std::pair<int16_t, Ptr<Ipv4RoutingProtocol> > Ipv4RoutingProtocolEntry;
96  typedef std::list<Ipv4RoutingProtocolEntry> Ipv4RoutingProtocolList;
97  Ipv4RoutingProtocolList m_routingProtocols;
98  static bool Compare (const Ipv4RoutingProtocolEntry& a, const Ipv4RoutingProtocolEntry& b);
99  Ptr<Ipv4> m_ipv4;
100 
101 };
102 
103 } // namespace ns3
104 
105 #endif /* IPV4_LIST_ROUTING_H */
smart pointer class similar to boost::intrusive_ptr
Definition: ptr.h:59
virtual void PrintRoutingTable(Ptr< OutputStreamWrapper > stream) const
Print the Routing Table entries.
Callback template class.
Definition: callback.h:369
virtual Ptr< Ipv4RoutingProtocol > GetRoutingProtocol(uint32_t index, int16_t &priority) const
virtual void SetIpv4(Ptr< Ipv4 > ipv4)
virtual void AddRoutingProtocol(Ptr< Ipv4RoutingProtocol > routingProtocol, int16_t priority)
Register a new routing protocol to be used in this IPv4 stack.
virtual void NotifyRemoveAddress(uint32_t interface, Ipv4InterfaceAddress address)
Packet header for IPv4.
Definition: ipv4-header.h:31
virtual uint32_t GetNRoutingProtocols(void) const
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
virtual void NotifyInterfaceDown(uint32_t interface)
Abstract base class for IPv4 routing protocols.
a unique identifier for an interface.
Definition: type-id.h:44
virtual void NotifyAddAddress(uint32_t interface, Ipv4InterfaceAddress address)