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