A Discrete-Event Network Simulator
API
ipv4-routing-protocol.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 #ifndef IPV4_ROUTING_PROTOCOL_H
18 #define IPV4_ROUTING_PROTOCOL_H
19 
20 #include "ipv4-header.h"
21 #include "ipv4-interface-address.h"
22 #include "ipv4.h"
23 
24 #include "ns3/callback.h"
25 #include "ns3/nstime.h"
26 #include "ns3/object.h"
27 #include "ns3/output-stream-wrapper.h"
28 #include "ns3/packet.h"
29 #include "ns3/socket.h"
30 
31 namespace ns3
32 {
33 
34 class Ipv4MulticastRoute;
35 class Ipv4Route;
36 class NetDevice;
37 
58 {
59  public:
64  static TypeId GetTypeId();
65 
69 
73 
76 
79 
101  const Ipv4Header& header,
102  Ptr<NetDevice> oif,
103  Socket::SocketErrno& sockerr) = 0;
104 
127  const Ipv4Header& header,
129  const UnicastForwardCallback& ucb,
130  const MulticastForwardCallback& mcb,
131  const LocalDeliverCallback& lcb,
132  const ErrorCallback& ecb) = 0;
133 
140  virtual void NotifyInterfaceUp(uint32_t interface) = 0;
147  virtual void NotifyInterfaceDown(uint32_t interface) = 0;
148 
157  virtual void NotifyAddAddress(uint32_t interface, Ipv4InterfaceAddress address) = 0;
158 
167  virtual void NotifyRemoveAddress(uint32_t interface, Ipv4InterfaceAddress address) = 0;
168 
174  virtual void SetIpv4(Ptr<Ipv4> ipv4) = 0;
175 
183  Time::Unit unit = Time::S) const = 0;
184 };
185 
186 } // namespace ns3
187 
188 #endif /* IPV4_ROUTING_PROTOCOL_H */
Callback template class.
Definition: callback.h:438
Packet header for IPv4.
Definition: ipv4-header.h:34
a class to store IPv4 address information on an interface
Abstract base class for IPv4 routing protocols.
virtual void NotifyRemoveAddress(uint32_t interface, Ipv4InterfaceAddress address)=0
virtual bool RouteInput(Ptr< const Packet > p, const Ipv4Header &header, Ptr< const NetDevice > idev, const UnicastForwardCallback &ucb, const MulticastForwardCallback &mcb, const LocalDeliverCallback &lcb, const ErrorCallback &ecb)=0
Route an input packet (to be forwarded or locally delivered)
Callback< void, Ptr< Ipv4MulticastRoute >, Ptr< const Packet >, const Ipv4Header & > MulticastForwardCallback
Callback for multicast packets to be forwarded.
Callback< void, Ptr< const Packet >, const Ipv4Header &, uint32_t > LocalDeliverCallback
Callback for packets to be locally delivered.
Callback< void, Ptr< Ipv4Route >, Ptr< const Packet >, const Ipv4Header & > UnicastForwardCallback
Callback for unicast packets to be forwarded.
virtual void PrintRoutingTable(Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S) const =0
Print the Routing Table entries.
virtual void NotifyInterfaceDown(uint32_t interface)=0
Callback< void, Ptr< const Packet >, const Ipv4Header &, Socket::SocketErrno > ErrorCallback
Callback for routing errors (e.g., no route found)
virtual Ptr< Ipv4Route > RouteOutput(Ptr< Packet > p, const Ipv4Header &header, Ptr< NetDevice > oif, Socket::SocketErrno &sockerr)=0
Query routing cache for an existing route, for an outbound packet.
virtual void NotifyInterfaceUp(uint32_t interface)=0
static TypeId GetTypeId()
Get the type ID.
virtual void NotifyAddAddress(uint32_t interface, Ipv4InterfaceAddress address)=0
virtual void SetIpv4(Ptr< Ipv4 > ipv4)=0
A base class which provides memory management and object aggregation.
Definition: object.h:89
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.