A Discrete-Event Network Simulator
API
radvd-prefix.h
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 #ifndef RADVD_PREFIX_H
21 #define RADVD_PREFIX_H
22 
23 #include "ns3/ipv6-address.h"
24 #include "ns3/simple-ref-count.h"
25 
26 #include <stdint.h>
27 
28 namespace ns3
29 {
30 
35 class RadvdPrefix : public SimpleRefCount<RadvdPrefix>
36 {
37  public:
48  RadvdPrefix(Ipv6Address network,
49  uint8_t prefixLength,
50  uint32_t preferredLifeTime = 604800,
51  uint32_t validLifeTime = 2592000,
52  bool onLinkFlag = true,
53  bool autonomousFlag = true,
54  bool routerAddrFlag = false);
55 
59  ~RadvdPrefix();
60 
65  Ipv6Address GetNetwork() const;
66 
71  void SetNetwork(Ipv6Address network);
72 
77  uint8_t GetPrefixLength() const;
78 
83  void SetPrefixLength(uint8_t prefixLength);
84 
89  uint32_t GetPreferredLifeTime() const;
90 
95  void SetPreferredLifeTime(uint32_t preferredLifeTime);
96 
101  uint32_t GetValidLifeTime() const;
102 
107  void SetValidLifeTime(uint32_t validLifeTime);
108 
113  bool IsOnLinkFlag() const;
114 
119  void SetOnLinkFlag(bool onLinkFlag);
120 
125  bool IsAutonomousFlag() const;
126 
131  void SetAutonomousFlag(bool autonomousFlag);
132 
137  bool IsRouterAddrFlag() const;
138 
143  void SetRouterAddrFlag(bool routerAddrFlag);
144 
145  private:
150 
154  uint8_t m_prefixLength;
155 
160 
164  uint32_t m_validLifeTime;
165 
170 
175 
181 };
182 
183 } /* namespace ns3 */
184 
185 #endif /* RADVD_PREFIX_H */
Describes an IPv6 address.
Definition: ipv6-address.h:49
Router prefix for radvd application.
Definition: radvd-prefix.h:36
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
A template-based reference counting class.
Every class exported by the ns3 library is enclosed in the ns3 namespace.