A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ipv6-route.cc
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#include "ipv6-route.h"
10
11#include "ns3/net-device.h"
12
13#include <iostream>
14
15namespace ns3
16{
17
21
25
26void
31
34{
35 return m_dest;
36}
37
38void
43
46{
47 return m_source;
48}
49
50void
55
58{
59 return m_gateway;
60}
61
62void
64{
65 m_outputDevice = outputDevice;
66}
67
70{
71 return m_outputDevice;
72}
73
74std::ostream&
75operator<<(std::ostream& os, const Ipv6Route& route)
76{
77 os << "source=" << route.GetSource() << " dest=" << route.GetDestination()
78 << " gw=" << route.GetGateway();
79 return os;
80}
81
86
90
91void
93{
94 m_group = group;
95}
96
99{
100 return m_group;
101}
102
103void
105{
106 m_origin = origin;
107}
108
111{
112 return m_origin;
113}
114
115void
117{
118 m_parent = parent;
119}
120
123{
124 return m_parent;
125}
126
127void
129{
130 if (ttl >= MAX_TTL)
131 {
132 // This TTL value effectively disables the interface
133 auto iter = m_ttls.find(oif);
134 if (iter != m_ttls.end())
135 {
136 m_ttls.erase(iter);
137 }
138 }
139 else
140 {
141 m_ttls[oif] = ttl;
142 }
143}
144
145std::map<uint32_t, uint32_t>
147{
148 return m_ttls;
149}
150
151std::ostream&
152operator<<(std::ostream& os, const Ipv6MulticastRoute& route)
153{
154 os << "origin=" << route.GetOrigin() << " group=" << route.GetGroup()
155 << " parent=" << route.GetParent();
156 return os;
157}
158
159} /* namespace ns3 */
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
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.
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