A Discrete-Event Network Simulator
API
radvd-prefix.cc
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2009 Strasbourg University
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
19 */
20
21#include "radvd-prefix.h"
22#include <ns3/log.h>
23
24namespace ns3
25{
26
27NS_LOG_COMPONENT_DEFINE ("RadvdPrefix");
28
29RadvdPrefix::RadvdPrefix (Ipv6Address network, uint8_t prefixLength, uint32_t preferredLifeTime, uint32_t validLifeTime, bool onLinkFlag, bool autonomousFlag, bool routerAddrFlag)
30 : m_network (network),
31 m_prefixLength (prefixLength),
32 m_preferredLifeTime (preferredLifeTime),
33 m_validLifeTime (validLifeTime),
34 m_onLinkFlag (onLinkFlag),
35 m_autonomousFlag (autonomousFlag),
36 m_routerAddrFlag (routerAddrFlag)
37{
38 NS_LOG_FUNCTION (this << network << prefixLength << preferredLifeTime << validLifeTime << onLinkFlag << autonomousFlag << routerAddrFlag);
39}
40
42{
43 NS_LOG_FUNCTION (this);
44}
45
47{
48 NS_LOG_FUNCTION (this);
49 return m_network;
50}
51
53{
54 NS_LOG_FUNCTION (this << network);
55 m_network = network;
56}
57
59{
60 NS_LOG_FUNCTION (this);
61 return m_prefixLength;
62}
63
64void RadvdPrefix::SetPrefixLength (uint8_t prefixLength)
65{
66 NS_LOG_FUNCTION (this << prefixLength);
67 m_prefixLength = prefixLength;
68}
69
71{
72 NS_LOG_FUNCTION (this);
73 return m_validLifeTime;
74}
75
77{
78 NS_LOG_FUNCTION (this << validLifeTime);
79 m_validLifeTime = validLifeTime;
80}
81
83{
84 NS_LOG_FUNCTION (this);
86}
87
89{
90 NS_LOG_FUNCTION (this << preferredLifeTime);
91 m_preferredLifeTime = preferredLifeTime;
92}
93
95{
96 NS_LOG_FUNCTION (this);
97 return m_onLinkFlag;
98}
99
100void RadvdPrefix::SetOnLinkFlag (bool onLinkFlag)
101{
102 NS_LOG_FUNCTION (this << onLinkFlag);
103 m_onLinkFlag = onLinkFlag;
104}
105
107{
108 NS_LOG_FUNCTION (this);
109 return m_autonomousFlag;
110}
111
112void RadvdPrefix::SetAutonomousFlag (bool autonomousFlag)
113{
114 NS_LOG_FUNCTION (this << autonomousFlag);
115 m_autonomousFlag = autonomousFlag;
116}
117
119{
120 NS_LOG_FUNCTION (this);
121 return m_routerAddrFlag;
122}
123
124void RadvdPrefix::SetRouterAddrFlag (bool routerAddrFlag)
125{
126 NS_LOG_FUNCTION (this << routerAddrFlag);
127 m_routerAddrFlag = routerAddrFlag;
128}
129
130} /* namespace ns3 */
131
Describes an IPv6 address.
Definition: ipv6-address.h:50
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:175
void SetOnLinkFlag(bool onLinkFlag)
Set on-link flag.
void SetNetwork(Ipv6Address network)
Set network prefix.
Definition: radvd-prefix.cc:52
uint32_t m_preferredLifeTime
Preferred time.
Definition: radvd-prefix.h:154
void SetPreferredLifeTime(uint32_t preferredLifeTime)
Set preferred lifetime.
Definition: radvd-prefix.cc:88
uint32_t GetPreferredLifeTime() const
Get preferred lifetime.
Definition: radvd-prefix.cc:82
void SetValidLifeTime(uint32_t validLifeTime)
Set valid lifetime.
Definition: radvd-prefix.cc:76
uint32_t GetValidLifeTime() const
Get valid lifetime.
Definition: radvd-prefix.cc:70
uint8_t GetPrefixLength() const
Get prefix length.
Definition: radvd-prefix.cc:58
uint8_t m_prefixLength
Prefix length.
Definition: radvd-prefix.h:149
bool m_onLinkFlag
On link flag, indicates that this prefix can be used for on-link determination.
Definition: radvd-prefix.h:164
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:169
Ipv6Address GetNetwork() const
Get network prefix.
Definition: radvd-prefix.cc:46
Ipv6Address m_network
Network prefix.
Definition: radvd-prefix.h:144
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:41
uint32_t m_validLifeTime
Valid time.
Definition: radvd-prefix.h:159
bool IsAutonomousFlag() const
Is autonomous flag ?
bool IsOnLinkFlag() const
Is on-link flag ?
Definition: radvd-prefix.cc:94
void SetPrefixLength(uint8_t prefixLength)
Set prefix length.
Definition: radvd-prefix.cc:64
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
#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.