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
radvd-prefix.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 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 "radvd-prefix.h"
21 
22 #include <ns3/log.h>
23 
24 namespace ns3
25 {
26 
27 NS_LOG_COMPONENT_DEFINE("RadvdPrefix");
28 
30  uint8_t prefixLength,
31  uint32_t preferredLifeTime,
32  uint32_t validLifeTime,
33  bool onLinkFlag,
34  bool autonomousFlag,
35  bool routerAddrFlag)
36  : m_network(network),
37  m_prefixLength(prefixLength),
38  m_preferredLifeTime(preferredLifeTime),
39  m_validLifeTime(validLifeTime),
40  m_onLinkFlag(onLinkFlag),
41  m_autonomousFlag(autonomousFlag),
42  m_routerAddrFlag(routerAddrFlag)
43 {
44  NS_LOG_FUNCTION(this << network << prefixLength << preferredLifeTime << validLifeTime
45  << onLinkFlag << autonomousFlag << routerAddrFlag);
46 }
47 
49 {
50  NS_LOG_FUNCTION(this);
51 }
52 
55 {
56  NS_LOG_FUNCTION(this);
57  return m_network;
58 }
59 
60 void
62 {
63  NS_LOG_FUNCTION(this << network);
64  m_network = network;
65 }
66 
67 uint8_t
69 {
70  NS_LOG_FUNCTION(this);
71  return m_prefixLength;
72 }
73 
74 void
75 RadvdPrefix::SetPrefixLength(uint8_t prefixLength)
76 {
77  NS_LOG_FUNCTION(this << prefixLength);
78  m_prefixLength = prefixLength;
79 }
80 
81 uint32_t
83 {
84  NS_LOG_FUNCTION(this);
85  return m_validLifeTime;
86 }
87 
88 void
89 RadvdPrefix::SetValidLifeTime(uint32_t validLifeTime)
90 {
91  NS_LOG_FUNCTION(this << validLifeTime);
92  m_validLifeTime = validLifeTime;
93 }
94 
95 uint32_t
97 {
98  NS_LOG_FUNCTION(this);
99  return m_preferredLifeTime;
100 }
101 
102 void
103 RadvdPrefix::SetPreferredLifeTime(uint32_t preferredLifeTime)
104 {
105  NS_LOG_FUNCTION(this << preferredLifeTime);
106  m_preferredLifeTime = preferredLifeTime;
107 }
108 
109 bool
111 {
112  NS_LOG_FUNCTION(this);
113  return m_onLinkFlag;
114 }
115 
116 void
118 {
119  NS_LOG_FUNCTION(this << onLinkFlag);
120  m_onLinkFlag = onLinkFlag;
121 }
122 
123 bool
125 {
126  NS_LOG_FUNCTION(this);
127  return m_autonomousFlag;
128 }
129 
130 void
131 RadvdPrefix::SetAutonomousFlag(bool autonomousFlag)
132 {
133  NS_LOG_FUNCTION(this << autonomousFlag);
134  m_autonomousFlag = autonomousFlag;
135 }
136 
137 bool
139 {
140  NS_LOG_FUNCTION(this);
141  return m_routerAddrFlag;
142 }
143 
144 void
145 RadvdPrefix::SetRouterAddrFlag(bool routerAddrFlag)
146 {
147  NS_LOG_FUNCTION(this << routerAddrFlag);
148  m_routerAddrFlag = routerAddrFlag;
149 }
150 
151 } /* namespace ns3 */
Describes an IPv6 address.
Definition: ipv6-address.h:49
void SetAutonomousFlag(bool autonomousFlag)
Set autonomous flag.
bool m_routerAddrFlag
Router address flag, indicates that router address is sent instead of network prefix as is required b...
Definition: radvd-prefix.h:180
void SetOnLinkFlag(bool onLinkFlag)
Set on-link flag.
void SetNetwork(Ipv6Address network)
Set network prefix.
Definition: radvd-prefix.cc:61
uint32_t m_preferredLifeTime
Preferred time.
Definition: radvd-prefix.h:159
void SetPreferredLifeTime(uint32_t preferredLifeTime)
Set preferred lifetime.
uint32_t GetPreferredLifeTime() const
Get preferred lifetime.
Definition: radvd-prefix.cc:96
void SetValidLifeTime(uint32_t validLifeTime)
Set valid lifetime.
Definition: radvd-prefix.cc:89
uint32_t GetValidLifeTime() const
Get valid lifetime.
Definition: radvd-prefix.cc:82
uint8_t GetPrefixLength() const
Get prefix length.
Definition: radvd-prefix.cc:68
uint8_t m_prefixLength
Prefix length.
Definition: radvd-prefix.h:154
bool m_onLinkFlag
On link flag, indicates that this prefix can be used for on-link determination.
Definition: radvd-prefix.h:169
void SetRouterAddrFlag(bool routerAddrFlag)
Set router address flag.
bool m_autonomousFlag
Autonomous flag, it is used for autonomous address configuration (RFC 2462).
Definition: radvd-prefix.h:174
Ipv6Address GetNetwork() const
Get network prefix.
Definition: radvd-prefix.cc:54
Ipv6Address m_network
Network prefix.
Definition: radvd-prefix.h:149
bool IsRouterAddrFlag() const
Is router address flag ?
RadvdPrefix(Ipv6Address network, uint8_t prefixLength, uint32_t preferredLifeTime=604800, uint32_t validLifeTime=2592000, bool onLinkFlag=true, bool autonomousFlag=true, bool routerAddrFlag=false)
Constructor.
Definition: radvd-prefix.cc:29
~RadvdPrefix()
Destructor.
Definition: radvd-prefix.cc:48
uint32_t m_validLifeTime
Valid time.
Definition: radvd-prefix.h:164
bool IsAutonomousFlag() const
Is autonomous flag ?
bool IsOnLinkFlag() const
Is on-link flag ?
void SetPrefixLength(uint8_t prefixLength)
Set prefix length.
Definition: radvd-prefix.cc:75
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Every class exported by the ns3 library is enclosed in the ns3 namespace.