A Discrete-Event Network Simulator
QKDNetSim v2.0 (NS-3 v3.41) @ (+)
API
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
ipv6-route.cc
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 #include "ipv6-route.h"
21 
22 #include "ns3/net-device.h"
23 
24 #include <iostream>
25 
26 namespace ns3
27 {
28 
30 {
31 }
32 
34 {
35 }
36 
37 void
39 {
40  m_dest = dest;
41 }
42 
45 {
46  return m_dest;
47 }
48 
49 void
51 {
52  m_source = src;
53 }
54 
57 {
58  return m_source;
59 }
60 
61 void
63 {
64  m_gateway = gw;
65 }
66 
69 {
70  return m_gateway;
71 }
72 
73 void
75 {
76  m_outputDevice = outputDevice;
77 }
78 
81 {
82  return m_outputDevice;
83 }
84 
85 std::ostream&
86 operator<<(std::ostream& os, const Ipv6Route& route)
87 {
88  os << "source=" << route.GetSource() << " dest=" << route.GetDestination()
89  << " gw=" << route.GetGateway();
90  return os;
91 }
92 
94 {
95  m_ttls.clear();
96 }
97 
99 {
100 }
101 
102 void
104 {
105  m_group = group;
106 }
107 
110 {
111  return m_group;
112 }
113 
114 void
116 {
117  m_origin = origin;
118 }
119 
122 {
123  return m_origin;
124 }
125 
126 void
128 {
129  m_parent = parent;
130 }
131 
132 uint32_t
134 {
135  return m_parent;
136 }
137 
138 void
139 Ipv6MulticastRoute::SetOutputTtl(uint32_t oif, uint32_t ttl)
140 {
141  if (ttl >= MAX_TTL)
142  {
143  // This TTL value effectively disables the interface
144  auto iter = m_ttls.find(oif);
145  if (iter != m_ttls.end())
146  {
147  m_ttls.erase(iter);
148  }
149  }
150  else
151  {
152  m_ttls[oif] = ttl;
153  }
154 }
155 
156 std::map<uint32_t, uint32_t>
158 {
159  return m_ttls;
160 }
161 
162 std::ostream&
163 operator<<(std::ostream& os, const Ipv6MulticastRoute& route)
164 {
165  os << "origin=" << route.GetOrigin() << " group=" << route.GetGroup()
166  << " parent=" << route.GetParent();
167  return os;
168 }
169 
170 } /* namespace ns3 */
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
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
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