A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
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
28namespace ns3
29{
30
31/**
32 * \ingroup radvd
33 * \brief Router prefix for radvd application.
34 */
35class RadvdPrefix : public SimpleRefCount<RadvdPrefix>
36{
37 public:
38 /**
39 * \brief Constructor.
40 * \param network network prefix advertised
41 * \param prefixLength prefix length ( 0 < x <= 128)
42 * \param preferredLifeTime preferred life time in seconds (default 7 days)
43 * \param validLifeTime valid life time in seconds (default 30 days)
44 * \param onLinkFlag on link flag
45 * \param autonomousFlag autonomous link flag
46 * \param routerAddrFlag router address flag (for Mobile IPv6)
47 */
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
56 /**
57 * \brief Destructor.
58 */
60
61 /**
62 * \brief Get network prefix.
63 * \return network prefix
64 */
65 Ipv6Address GetNetwork() const;
66
67 /**
68 * \brief Set network prefix.
69 * \param network network prefix
70 */
71 void SetNetwork(Ipv6Address network);
72
73 /**
74 * \brief Get prefix length.
75 * \return prefix length
76 */
77 uint8_t GetPrefixLength() const;
78
79 /**
80 * \brief Set prefix length.
81 * \param prefixLength prefix length
82 */
83 void SetPrefixLength(uint8_t prefixLength);
84
85 /**
86 * \brief Get preferred lifetime.
87 * \return lifetime
88 */
90
91 /**
92 * \brief Set preferred lifetime.
93 * \param preferredLifeTime lifetime
94 */
95 void SetPreferredLifeTime(uint32_t preferredLifeTime);
96
97 /**
98 * \brief Get valid lifetime.
99 * \return lifetime
100 */
102
103 /**
104 * \brief Set valid lifetime.
105 * \param validLifeTime lifetime
106 */
107 void SetValidLifeTime(uint32_t validLifeTime);
108
109 /**
110 * \brief Is on-link flag ?
111 * \return true if on-link is activated, false otherwise
112 */
113 bool IsOnLinkFlag() const;
114
115 /**
116 * \brief Set on-link flag.
117 * \param onLinkFlag value
118 */
119 void SetOnLinkFlag(bool onLinkFlag);
120
121 /**
122 * \brief Is autonomous flag ?
123 * \return true if autonomous is activated, false otherwise
124 */
125 bool IsAutonomousFlag() const;
126
127 /**
128 * \brief Set autonomous flag.
129 * \param autonomousFlag value
130 */
131 void SetAutonomousFlag(bool autonomousFlag);
132
133 /**
134 * \brief Is router address flag ?
135 * \return true if router address is activated, false otherwise
136 */
137 bool IsRouterAddrFlag() const;
138
139 /**
140 * \brief Set router address flag.
141 * \param routerAddrFlag value
142 */
143 void SetRouterAddrFlag(bool routerAddrFlag);
144
145 private:
146 /**
147 * \brief Network prefix.
148 */
150
151 /**
152 * \brief Prefix length.
153 */
155
156 /**
157 * \brief Preferred time.
158 */
160
161 /**
162 * \brief Valid time.
163 */
165
166 /**
167 * \brief On link flag, indicates that this prefix can be used for on-link determination.
168 */
170
171 /**
172 * \brief Autonomous flag, it is used for autonomous address configuration (\RFC{2462}).
173 */
175
176 /**
177 * \brief Router address flag, indicates that router address is sent instead
178 * of network prefix as is required by Mobile IPv6.
179 */
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()
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.