A Discrete-Event Network Simulator
API
ipv4-routing-table-entry.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2005 INRIA
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  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18  */
19 #ifndef IPV4_ROUTING_TABLE_ENTRY_H
20 #define IPV4_ROUTING_TABLE_ENTRY_H
21 
22 #include "ns3/ipv4-address.h"
23 
24 #include <list>
25 #include <ostream>
26 #include <vector>
27 
28 namespace ns3
29 {
30 
38 {
39  public:
57  bool IsHost() const;
63  bool IsNetwork() const;
67  bool IsDefault() const;
71  bool IsGateway() const;
75  Ipv4Address GetGateway() const;
79  Ipv4Address GetDest() const;
91  uint32_t GetInterface() const;
99  Ipv4Address nextHop,
100  uint32_t interface);
106  static Ipv4RoutingTableEntry CreateHostRouteTo(Ipv4Address dest, uint32_t interface);
115  Ipv4Mask networkMask,
116  Ipv4Address nextHop,
117  uint32_t interface);
125  Ipv4Mask networkMask,
126  uint32_t interface);
134  static Ipv4RoutingTableEntry CreateDefaultRoute(Ipv4Address nextHop, uint32_t interface);
135 
136  private:
145  Ipv4Mask mask,
146  Ipv4Address gateway,
147  uint32_t interface);
154  Ipv4RoutingTableEntry(Ipv4Address dest, Ipv4Mask mask, uint32_t interface);
161  Ipv4RoutingTableEntry(Ipv4Address dest, Ipv4Address gateway, uint32_t interface);
167  Ipv4RoutingTableEntry(Ipv4Address dest, uint32_t interface);
168 
172  uint32_t m_interface;
173 };
174 
182 std::ostream& operator<<(std::ostream& os, const Ipv4RoutingTableEntry& route);
183 
192 
199 {
200  public:
205 
219  Ipv4Address GetOrigin() const;
223  Ipv4Address GetGroup() const;
227  uint32_t GetInputInterface() const;
231  uint32_t GetNOutputInterfaces() const;
236  uint32_t GetOutputInterface(uint32_t n) const;
240  std::vector<uint32_t> GetOutputInterfaces() const;
249  Ipv4Address origin,
250  Ipv4Address group,
251  uint32_t inputInterface,
252  std::vector<uint32_t> outputInterfaces);
253 
254  private:
263  Ipv4Address group,
264  uint32_t inputInterface,
265  std::vector<uint32_t> outputInterfaces);
266 
269  uint32_t m_inputInterface;
270  std::vector<uint32_t> m_outputInterfaces;
271 };
272 
280 std::ostream& operator<<(std::ostream& os, const Ipv4MulticastRoutingTableEntry& route);
281 
290 
291 } // namespace ns3
292 
293 #endif /* IPV4_ROUTING_TABLE_ENTRY_H */
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:42
a class to represent an Ipv4 address mask
Definition: ipv4-address.h:257
A record of an IPv4 multicast route for Ipv4GlobalRouting and Ipv4StaticRouting.
Ipv4Address m_origin
source address
Ipv4Address GetGroup() const
Ipv4Address GetOrigin() const
std::vector< uint32_t > m_outputInterfaces
output interfaces
std::vector< uint32_t > GetOutputInterfaces() const
Ipv4Address m_group
destination address
uint32_t GetOutputInterface(uint32_t n) const
Ipv4MulticastRoutingTableEntry()
This constructor does nothing.
static Ipv4MulticastRoutingTableEntry CreateMulticastRoute(Ipv4Address origin, Ipv4Address group, uint32_t inputInterface, std::vector< uint32_t > outputInterfaces)
uint32_t GetNOutputInterfaces() const
uint32_t GetInputInterface() const
uint32_t m_inputInterface
input interface
A record of an IPv4 routing table entry for Ipv4GlobalRouting and Ipv4StaticRouting.
Ipv4Address GetDest() const
Ipv4Address GetGateway() const
static Ipv4RoutingTableEntry CreateDefaultRoute(Ipv4Address nextHop, uint32_t interface)
bool IsHost() const
Ipv4Address m_dest
destination address
Ipv4RoutingTableEntry()
This constructor does nothing.
bool IsNetwork() const
uint32_t m_interface
output interface
bool IsGateway() const
Ipv4Mask m_destNetworkMask
destination network mask
Ipv4Address GetDestNetwork() const
uint32_t GetInterface() const
Ipv4Address m_gateway
gateway
static Ipv4RoutingTableEntry CreateNetworkRouteTo(Ipv4Address network, Ipv4Mask networkMask, Ipv4Address nextHop, uint32_t interface)
static Ipv4RoutingTableEntry CreateHostRouteTo(Ipv4Address dest, Ipv4Address nextHop, uint32_t interface)
bool IsDefault() const
Ipv4Mask GetDestNetworkMask() const
Every class exported by the ns3 library is enclosed in the ns3 namespace.
bool operator==(const EventId &a, const EventId &b)
Definition: event-id.h:157
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:159