A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
24 namespace ns3
25 {
26 
27 NS_LOG_COMPONENT_DEFINE ("RadvdPrefix")
28  ;
29 
30 RadvdPrefix::RadvdPrefix (Ipv6Address network, uint8_t prefixLength, uint32_t preferredLifeTime, uint32_t validLifeTime, bool onLinkFlag, bool autonomousFlag, bool routerAddrFlag)
31  : m_network (network),
32  m_prefixLength (prefixLength),
33  m_preferredLifeTime (preferredLifeTime),
34  m_validLifeTime (validLifeTime),
35  m_onLinkFlag (onLinkFlag),
36  m_autonomousFlag (autonomousFlag),
37  m_routerAddrFlag (routerAddrFlag)
38 {
39  NS_LOG_FUNCTION (this << network << prefixLength << preferredLifeTime << validLifeTime << onLinkFlag << autonomousFlag << routerAddrFlag);
40 }
41 
43 {
44  NS_LOG_FUNCTION (this);
45 }
46 
48 {
49  NS_LOG_FUNCTION (this);
50  return m_network;
51 }
52 
54 {
55  NS_LOG_FUNCTION (this << network);
56  m_network = network;
57 }
58 
60 {
61  NS_LOG_FUNCTION (this);
62  return m_prefixLength;
63 }
64 
65 void RadvdPrefix::SetPrefixLength (uint8_t prefixLength)
66 {
67  NS_LOG_FUNCTION (this << prefixLength);
68  m_prefixLength = prefixLength;
69 }
70 
72 {
73  NS_LOG_FUNCTION (this);
74  return m_validLifeTime;
75 }
76 
77 void RadvdPrefix::SetValidLifeTime (uint32_t validLifeTime)
78 {
79  NS_LOG_FUNCTION (this << validLifeTime);
80  m_validLifeTime = validLifeTime;
81 }
82 
84 {
85  NS_LOG_FUNCTION (this);
86  return m_preferredLifeTime;
87 }
88 
89 void RadvdPrefix::SetPreferredLifeTime (uint32_t preferredLifeTime)
90 {
91  NS_LOG_FUNCTION (this << preferredLifeTime);
92  m_preferredLifeTime = preferredLifeTime;
93 }
94 
96 {
97  NS_LOG_FUNCTION (this);
98  return m_onLinkFlag;
99 }
100 
101 void RadvdPrefix::SetOnLinkFlag (bool onLinkFlag)
102 {
103  NS_LOG_FUNCTION (this << onLinkFlag);
104  m_onLinkFlag = onLinkFlag;
105 }
106 
108 {
109  NS_LOG_FUNCTION (this);
110  return m_autonomousFlag;
111 }
112 
113 void RadvdPrefix::SetAutonomousFlag (bool autonomousFlag)
114 {
115  NS_LOG_FUNCTION (this << autonomousFlag);
116  m_autonomousFlag = autonomousFlag;
117 }
118 
120 {
121  NS_LOG_FUNCTION (this);
122  return m_routerAddrFlag;
123 }
124 
125 void RadvdPrefix::SetRouterAddrFlag (bool routerAddrFlag)
126 {
127  NS_LOG_FUNCTION (this << routerAddrFlag);
128  m_routerAddrFlag = routerAddrFlag;
129 }
130 
131 } /* namespace ns3 */
132 
void SetValidLifeTime(uint32_t validLifeTime)
Set valid lifetime.
Definition: radvd-prefix.cc:77
bool m_onLinkFlag
On link flag, indicates that this prefix can be used for on-link determination.
Definition: radvd-prefix.h:165
#define NS_LOG_FUNCTION(parameters)
Definition: log.h:345
NS_LOG_COMPONENT_DEFINE("GrantedTimeWindowMpiInterface")
Ipv6Address GetNetwork() const
Get network prefix.
Definition: radvd-prefix.cc:47
bool m_autonomousFlag
Autonomous flag, it is used for autonomous address configuration (RFC 2462).
Definition: radvd-prefix.h:170
uint32_t m_preferredLifeTime
Preferred time.
Definition: radvd-prefix.h:155
void SetPrefixLength(uint8_t prefixLength)
Set prefix length.
Definition: radvd-prefix.cc:65
void SetOnLinkFlag(bool onLinkFlag)
Set on-link flag.
uint8_t m_prefixLength
Prefix length.
Definition: radvd-prefix.h:150
void SetPreferredLifeTime(uint32_t preferredLifeTime)
Set preferred lifetime.
Definition: radvd-prefix.cc:89
bool IsRouterAddrFlag() const
Is router address flag ?
void SetAutonomousFlag(bool autonomousFlag)
Set autonomous flag.
uint32_t GetPreferredLifeTime() const
Get preferred lifetime.
Definition: radvd-prefix.cc:83
void SetNetwork(Ipv6Address network)
Set network prefix.
Definition: radvd-prefix.cc:53
void SetRouterAddrFlag(bool routerAddrFlag)
Set router address flag.
bool IsOnLinkFlag() const
Is on-link flag ?
Definition: radvd-prefix.cc:95
bool m_routerAddrFlag
Router address flag, indicates that router address is sent instead of network prefix as is required b...
Definition: radvd-prefix.h:176
uint32_t m_validLifeTime
Valid time.
Definition: radvd-prefix.h:160
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:30
Describes an IPv6 address.
Definition: ipv6-address.h:46
uint32_t GetValidLifeTime() const
Get valid lifetime.
Definition: radvd-prefix.cc:71
~RadvdPrefix()
Destructor.
Definition: radvd-prefix.cc:42
uint8_t GetPrefixLength() const
Get prefix length.
Definition: radvd-prefix.cc:59
Ipv6Address m_network
Network prefix.
Definition: radvd-prefix.h:145
bool IsAutonomousFlag() const
Is autonomous flag ?