A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ipv6-route.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2007-2009 Strasbourg University
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
7 */
8
9#ifndef IPV6_ROUTE_H
10#define IPV6_ROUTE_H
11
12#include "ns3/ipv6-address.h"
13#include "ns3/simple-ref-count.h"
14
15#include <list>
16#include <map>
17#include <ostream>
18
19namespace ns3
20{
21
22class NetDevice;
23
24/**
25 * \ingroup ipv6Routing
26 *
27 * \brief IPv6 route cache entry.
28 */
29class Ipv6Route : public SimpleRefCount<Ipv6Route>
30{
31 public:
32 /**
33 * \brief Constructor.
34 */
35 Ipv6Route();
36
37 /**
38 * \brief Destructor.
39 */
40 virtual ~Ipv6Route();
41
42 /**
43 * \brief Set destination address.
44 * \param dest IPv6 destination address
45 */
46 void SetDestination(Ipv6Address dest);
47
48 /**
49 * \brief Get destination address.
50 * \return destination address
51 */
53
54 /**
55 * \brief Set source address.
56 * \param src IPv6 source address
57 */
58 void SetSource(Ipv6Address src);
59
60 /**
61 * \brief Get source address.
62 * \return source address
63 */
64 Ipv6Address GetSource() const;
65
66 /**
67 * \brief Set gateway address.
68 * \param gw IPv6 gateway address
69 */
70 void SetGateway(Ipv6Address gw);
71
72 /**
73 * \brief Get gateway address.
74 * \return gateway address
75 */
76 Ipv6Address GetGateway() const;
77
78 /**
79 * \brief Set output device for outgoing packets.
80 * \param outputDevice output device
81 */
82 void SetOutputDevice(Ptr<NetDevice> outputDevice);
83
84 /**
85 * \brief Get output device.
86 * \return output device
87 */
89
90 private:
91 /**
92 * \brief Destination address.
93 */
95
96 /**
97 * \brief source address.
98 */
100
101 /**
102 * \brief Gateway address.
103 */
105
106 /**
107 * \brief Output device.
108 */
110};
111
112/**
113 * \brief Stream insertion operator.
114 *
115 * \param os the reference to the output stream
116 * \param route the Ipv6 route
117 * \returns the reference to the output stream
118 */
119std::ostream& operator<<(std::ostream& os, const Ipv6Route& route);
120
121/**
122 * \ingroup ipv6Routing
123 *
124 * \brief IPv6 multicast route entry.
125 */
126class Ipv6MulticastRoute : public SimpleRefCount<Ipv6MulticastRoute>
127{
128 public:
129 /**
130 * \brief Maximum number of multicast interfaces on a router.
131 */
132 static const uint32_t MAX_INTERFACES = 16;
133
134 /**
135 * \brief Maximum Time-To-Live (TTL).
136 */
137 static const uint32_t MAX_TTL = 255;
138
139 /**
140 * \brief Constructor.
141 */
143
144 /**
145 * \brief Destructor.
146 */
147 virtual ~Ipv6MulticastRoute();
148
149 /**
150 * \brief Set IPv6 group.
151 * \param group Ipv6Address of the multicast group
152 */
153 void SetGroup(const Ipv6Address group);
154
155 /**
156 * \brief Get IPv6 group.
157 * \return Ipv6Address of the multicast group
158 */
159 Ipv6Address GetGroup() const;
160
161 /**
162 * \brief Set origin address.
163 * \param origin Ipv6Address of the origin address
164 */
165 void SetOrigin(const Ipv6Address origin);
166
167 /**
168 * \brief Get source address.
169 * \return Ipv6Address of the origin address
170 */
171 Ipv6Address GetOrigin() const;
172
173 /**
174 * \brief Set parent for this route.
175 * \param iif Parent (input interface) for this route
176 */
177 void SetParent(uint32_t iif);
178
179 /**
180 * \brief Get parent for this route.
181 * \return Parent (input interface) for this route
182 */
183 uint32_t GetParent() const;
184
185 /**
186 * \brief set output TTL for this route.
187 * \param oif Outgoing interface index
188 * \param ttl time-to-live for this route
189 */
190 void SetOutputTtl(uint32_t oif, uint32_t ttl);
191
192 /**
193 * \return map of output interface Ids and TTLs for this route
194 */
195 std::map<uint32_t, uint32_t> GetOutputTtlMap() const;
196
197 private:
198 /**
199 * \brief IPv6 group.
200 */
202
203 /**
204 * \brief IPv6 origin (source).
205 */
207
208 /**
209 * \brief Source interface.
210 */
212
213 /**
214 * \brief TTLs.
215 */
216 std::map<uint32_t, uint32_t> m_ttls;
217};
218
219/**
220 * \brief Stream insertion operator.
221 *
222 * \param os the reference to the output stream
223 * \param route the Ipv6 multicast route
224 * \returns the reference to the output stream
225 */
226std::ostream& operator<<(std::ostream& os, const Ipv6MulticastRoute& route);
227
228} /* namespace ns3 */
229
230#endif /* IPV6_ROUTE_H */
Describes an IPv6 address.
IPv6 multicast route entry.
Definition ipv6-route.h:127
void SetOrigin(const Ipv6Address origin)
Set origin address.
std::map< uint32_t, uint32_t > GetOutputTtlMap() const
Ipv6Address m_origin
IPv6 origin (source).
Definition ipv6-route.h:206
Ipv6Address GetOrigin() const
Get source address.
static const uint32_t MAX_TTL
Maximum Time-To-Live (TTL).
Definition ipv6-route.h:137
Ipv6MulticastRoute()
Constructor.
Definition ipv6-route.cc:82
static const uint32_t MAX_INTERFACES
Maximum number of multicast interfaces on a router.
Definition ipv6-route.h:132
Ipv6Address m_group
IPv6 group.
Definition ipv6-route.h:201
uint32_t GetParent() const
Get parent for this route.
void SetParent(uint32_t iif)
Set parent for this route.
uint32_t m_parent
Source interface.
Definition ipv6-route.h:211
std::map< uint32_t, uint32_t > m_ttls
TTLs.
Definition ipv6-route.h:216
void SetGroup(const Ipv6Address group)
Set IPv6 group.
Definition ipv6-route.cc:92
Ipv6Address GetGroup() const
Get IPv6 group.
Definition ipv6-route.cc:98
void SetOutputTtl(uint32_t oif, uint32_t ttl)
set output TTL for this route.
virtual ~Ipv6MulticastRoute()
Destructor.
Definition ipv6-route.cc:87
IPv6 route cache entry.
Definition ipv6-route.h:30
void SetGateway(Ipv6Address gw)
Set gateway address.
Definition ipv6-route.cc:51
void SetSource(Ipv6Address src)
Set source address.
Definition ipv6-route.cc:39
virtual ~Ipv6Route()
Destructor.
Definition ipv6-route.cc:22
Ipv6Address GetDestination() const
Get destination address.
Definition ipv6-route.cc:33
void SetDestination(Ipv6Address dest)
Set destination address.
Definition ipv6-route.cc:27
Ptr< NetDevice > m_outputDevice
Output device.
Definition ipv6-route.h:109
Ipv6Address GetSource() const
Get source address.
Definition ipv6-route.cc:45
Ipv6Address m_source
source address.
Definition ipv6-route.h:99
Ipv6Address m_dest
Destination address.
Definition ipv6-route.h:94
Ptr< NetDevice > GetOutputDevice() const
Get output device.
Definition ipv6-route.cc:69
Ipv6Address m_gateway
Gateway address.
Definition ipv6-route.h:104
Ipv6Address GetGateway() const
Get gateway address.
Definition ipv6-route.cc:57
Ipv6Route()
Constructor.
Definition ipv6-route.cc:18
void SetOutputDevice(Ptr< NetDevice > outputDevice)
Set output device for outgoing packets.
Definition ipv6-route.cc:63
Smart pointer class similar to boost::intrusive_ptr.
A template-based reference counting class.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition angles.cc:148