A Discrete-Event Network Simulator
API
ipv4-routing-protocol.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 #ifndef IPV4_ROUTING_PROTOCOL_H
19 #define IPV4_ROUTING_PROTOCOL_H
20 
21 #include "ns3/packet.h"
22 #include "ns3/callback.h"
23 #include "ns3/object.h"
24 #include "ns3/socket.h"
25 #include "ipv4-header.h"
26 #include "ns3/ipv4-interface-address.h"
27 #include "ipv4.h"
28 #include "ns3/output-stream-wrapper.h"
29 
30 namespace ns3 {
31 
32 class Ipv4MulticastRoute;
33 class Ipv4Route;
34 class NetDevice;
35 
56 {
57 public:
62  static TypeId GetTypeId (void);
63 
66 
69 
72 
74  typedef Callback<void, Ptr<const Packet>, const Ipv4Header &, Socket::SocketErrno > ErrorCallback;
75 
96  virtual Ptr<Ipv4Route> RouteOutput (Ptr<Packet> p, const Ipv4Header &header, Ptr<NetDevice> oif, Socket::SocketErrno &sockerr) = 0;
97 
119  virtual bool RouteInput (Ptr<const Packet> p, const Ipv4Header &header, Ptr<const NetDevice> idev,
120  UnicastForwardCallback ucb, MulticastForwardCallback mcb,
121  LocalDeliverCallback lcb, ErrorCallback ecb) = 0;
122 
129  virtual void NotifyInterfaceUp (uint32_t interface) = 0;
136  virtual void NotifyInterfaceDown (uint32_t interface) = 0;
137 
146  virtual void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address) = 0;
147 
156  virtual void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address) = 0;
157 
163  virtual void SetIpv4 (Ptr<Ipv4> ipv4) = 0;
164 
170  virtual void PrintRoutingTable (Ptr<OutputStreamWrapper> stream) const = 0;
171 };
172 
173 } // namespace ns3
174 
175 #endif /* IPV4_ROUTING_PROTOCOL_H */
virtual void SetIpv4(Ptr< Ipv4 > ipv4)=0
SocketErrno
Enumeration of the possible errors returned by a socket.
Definition: socket.h:82
Callback template class.
Definition: callback.h:1176
virtual void NotifyRemoveAddress(uint32_t interface, Ipv4InterfaceAddress address)=0
virtual void NotifyInterfaceUp(uint32_t interface)=0
Callback< void, Ptr< const Packet >, const Ipv4Header &, Socket::SocketErrno > ErrorCallback
Callback for routing errors (e.g., no route found)
Packet header for IPv4.
Definition: ipv4-header.h:33
virtual void NotifyAddAddress(uint32_t interface, Ipv4InterfaceAddress address)=0
virtual bool RouteInput(Ptr< const Packet > p, const Ipv4Header &header, Ptr< const NetDevice > idev, UnicastForwardCallback ucb, MulticastForwardCallback mcb, LocalDeliverCallback lcb, ErrorCallback ecb)=0
Route an input packet (to be forwarded or locally delivered)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
virtual void PrintRoutingTable(Ptr< OutputStreamWrapper > stream) const =0
Print the Routing Table entries.
Callback< void, Ptr< const Packet >, const Ipv4Header &, uint32_t > LocalDeliverCallback
Callback for packets to be locally delivered.
a class to store IPv4 address information on an interface
Abstract base class for IPv4 routing protocols.
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.
A base class which provides memory management and object aggregation.
Definition: object.h:87
tuple address
Definition: first.py:37
static TypeId GetTypeId(void)
Get the type ID.
Callback< void, Ptr< Ipv4MulticastRoute >, Ptr< const Packet >, const Ipv4Header & > MulticastForwardCallback
Callback for multicast packets to be forwarded.
a unique identifier for an interface.
Definition: type-id.h:58
virtual void NotifyInterfaceDown(uint32_t interface)=0
Callback< void, Ptr< Ipv4Route >, Ptr< const Packet >, const Ipv4Header & > UnicastForwardCallback
Callback for unicast packets to be forwarded.