A Discrete-Event Network Simulator
API
ipv6-routing-table-entry.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2007-2009 Strasbourg University
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  * Author: Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
19  */
20 
21 #ifndef IPV6_ROUTING_TABLE_ENTRY_H
22 #define IPV6_ROUTING_TABLE_ENTRY_H
23 
24 #include <list>
25 #include <vector>
26 #include <ostream>
27 
28 #include "ns3/ipv6-address.h"
29 
30 namespace ns3
31 {
32 
39 {
40 public:
45 
51 
57 
61  virtual ~Ipv6RoutingTableEntry ();
62 
67  bool IsHost () const;
68 
73  Ipv6Address GetDest () const;
74 
79  Ipv6Address GetPrefixToUse () const;
80 
85  void SetPrefixToUse (Ipv6Address prefix);
86 
91  bool IsNetwork () const;
92 
97  Ipv6Address GetDestNetwork () const;
98 
104 
109  bool IsDefault () const;
110 
115  bool IsGateway () const;
116 
121  Ipv6Address GetGateway () const;
122 
127  uint32_t GetInterface () const;
128 
137  static Ipv6RoutingTableEntry CreateHostRouteTo (Ipv6Address dest, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse=Ipv6Address ());
138 
145  static Ipv6RoutingTableEntry CreateHostRouteTo (Ipv6Address dest, uint32_t interface);
146 
155  static Ipv6RoutingTableEntry CreateNetworkRouteTo (Ipv6Address network, Ipv6Prefix networkPrefix, Ipv6Address nextHop, uint32_t interface);
156 
166  static Ipv6RoutingTableEntry CreateNetworkRouteTo (Ipv6Address network, Ipv6Prefix networkPrefix, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse);
167 
175  static Ipv6RoutingTableEntry CreateNetworkRouteTo (Ipv6Address network, Ipv6Prefix networkPrefix, uint32_t interface);
176 
183  static Ipv6RoutingTableEntry CreateDefaultRoute (Ipv6Address nextHop, uint32_t interface);
184 
185 private:
193  Ipv6RoutingTableEntry (Ipv6Address network, Ipv6Prefix prefix, Ipv6Address gateway, uint32_t interface);
194 
202  Ipv6RoutingTableEntry (Ipv6Address network, Ipv6Prefix prefix, uint32_t interface, Ipv6Address prefixToUse);
203 
212  Ipv6RoutingTableEntry (Ipv6Address network, Ipv6Prefix prefix, Ipv6Address gateway, uint32_t interface, Ipv6Address prefixToUse);
213 
220  Ipv6RoutingTableEntry (Ipv6Address dest, Ipv6Prefix prefix, uint32_t interface);
221 
228  Ipv6RoutingTableEntry (Ipv6Address dest, Ipv6Address gateway, uint32_t interface);
229 
235  Ipv6RoutingTableEntry (Ipv6Address dest, uint32_t interface);
236 
241 
246 
251 
255  uint32_t m_interface;
256 
261 
262 };
263 
271 std::ostream& operator<< (std::ostream& os, Ipv6RoutingTableEntry const& route);
272 
279 {
280 public:
285 
291 
297 
302  Ipv6Address GetOrigin () const;
303 
308  Ipv6Address GetGroup () const;
309 
314  uint32_t GetInputInterface () const;
315 
320  uint32_t GetNOutputInterfaces () const;
321 
327  uint32_t GetOutputInterface (uint32_t n) const;
328 
333  std::vector<uint32_t> GetOutputInterfaces () const;
334 
343  static Ipv6MulticastRoutingTableEntry CreateMulticastRoute (Ipv6Address origin, Ipv6Address group, uint32_t inputInterface, std::vector<uint32_t> outputInterfaces);
344 
345 private:
353  Ipv6MulticastRoutingTableEntry (Ipv6Address origin, Ipv6Address group, uint32_t inputInterface, std::vector<uint32_t> outputInterfaces);
354 
359 
364 
369 
373  std::vector<uint32_t> m_outputInterfaces;
374 };
375 
383 std::ostream& operator<< (std::ostream& os, Ipv6MulticastRoutingTableEntry const& route);
384 
385 } /* namespace ns3 */
386 
387 #endif /* IPV6_ROUTING_TABLE_ENTRY_H */
388 
void SetPrefixToUse(Ipv6Address prefix)
Set the prefix to use.
Ipv6Address GetPrefixToUse() const
Get the prefix to use (for multihomed link).
Ipv6Prefix GetDestNetworkPrefix() const
Get the destination prefix.
static Ipv6RoutingTableEntry CreateNetworkRouteTo(Ipv6Address network, Ipv6Prefix networkPrefix, Ipv6Address nextHop, uint32_t interface)
Create a route to a network.
A record of an IPv6 multicast route.
Ipv6RoutingTableEntry()
Constructor.
uint32_t GetInputInterface() const
Get the input interface address.
static Ipv6RoutingTableEntry CreateHostRouteTo(Ipv6Address dest, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse=Ipv6Address())
Create a route to a host.
uint32_t GetNOutputInterfaces() const
Get the number of output interfaces of this route.
Ipv6MulticastRoutingTableEntry()
Constructor.
static Ipv6MulticastRoutingTableEntry CreateMulticastRoute(Ipv6Address origin, Ipv6Address group, uint32_t inputInterface, std::vector< uint32_t > outputInterfaces)
Create a multicast route.
uint32_t m_inputInterface
The input interface.
Ipv6Address m_prefixToUse
Prefix to use.
Ipv6Address GetDestNetwork() const
Get the destination network.
A record of an IPv6 route.
Ipv6Address m_group
The IPv6 address of the group.
Ipv6Prefix m_destNetworkPrefix
IPv6 prefix of the destination.
Ipv6Address GetOrigin() const
Get the source of this route.
bool IsHost() const
Is the route entry correspond to a host ?
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
Definition: angles.cc:42
uint32_t GetOutputInterface(uint32_t n) const
Get a specified output interface.
static Ipv6RoutingTableEntry CreateDefaultRoute(Ipv6Address nextHop, uint32_t interface)
Create a default route.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ipv6Address m_origin
The IPv6 address of the source.
std::vector< uint32_t > GetOutputInterfaces() const
Get all of the output interfaces of this route.
bool IsDefault() const
Is it the default route ?
Ipv6Address m_gateway
IPv6 address of the gateway.
Ipv6Address GetGateway() const
Get the gateway.
uint32_t GetInterface() const
Get the interface index.
Describes an IPv6 address.
Definition: ipv6-address.h:48
Ipv6Address GetGroup() const
Get the group.
uint32_t m_interface
The interface index.
Ipv6Address GetDest() const
Get the destination.
virtual ~Ipv6RoutingTableEntry()
Destructor.
bool IsNetwork() const
Is the route entry correspond to a network ?
Describes an IPv6 prefix.
Definition: ipv6-address.h:394
bool IsGateway() const
Is it the gateway ?
std::vector< uint32_t > m_outputInterfaces
The output interfaces.
Ipv6Address m_dest
IPv6 address of the destination.