A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
radvd-prefix.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2009 Strasbourg University
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
7 */
8
9#include "radvd-prefix.h"
10
11#include <ns3/log.h>
12
13namespace ns3
14{
15
16NS_LOG_COMPONENT_DEFINE("RadvdPrefix");
17
19 uint8_t prefixLength,
20 uint32_t preferredLifeTime,
21 uint32_t validLifeTime,
22 bool onLinkFlag,
23 bool autonomousFlag,
24 bool routerAddrFlag)
25 : m_network(network),
26 m_prefixLength(prefixLength),
27 m_preferredLifeTime(preferredLifeTime),
28 m_validLifeTime(validLifeTime),
29 m_onLinkFlag(onLinkFlag),
30 m_autonomousFlag(autonomousFlag),
31 m_routerAddrFlag(routerAddrFlag)
32{
33 NS_LOG_FUNCTION(this << network << prefixLength << preferredLifeTime << validLifeTime
34 << onLinkFlag << autonomousFlag << routerAddrFlag);
35}
36
41
44{
45 NS_LOG_FUNCTION(this);
46 return m_network;
47}
48
49void
51{
52 NS_LOG_FUNCTION(this << network);
53 m_network = network;
54}
55
56uint8_t
58{
59 NS_LOG_FUNCTION(this);
60 return m_prefixLength;
61}
62
63void
64RadvdPrefix::SetPrefixLength(uint8_t prefixLength)
65{
66 NS_LOG_FUNCTION(this << prefixLength);
67 m_prefixLength = prefixLength;
68}
69
76
77void
79{
80 NS_LOG_FUNCTION(this << validLifeTime);
81 m_validLifeTime = validLifeTime;
82}
83
90
91void
93{
94 NS_LOG_FUNCTION(this << preferredLifeTime);
95 m_preferredLifeTime = preferredLifeTime;
96}
97
98bool
100{
101 NS_LOG_FUNCTION(this);
102 return m_onLinkFlag;
103}
104
105void
107{
108 NS_LOG_FUNCTION(this << onLinkFlag);
109 m_onLinkFlag = onLinkFlag;
110}
111
112bool
114{
115 NS_LOG_FUNCTION(this);
116 return m_autonomousFlag;
117}
118
119void
121{
122 NS_LOG_FUNCTION(this << autonomousFlag);
123 m_autonomousFlag = autonomousFlag;
124}
125
126bool
128{
129 NS_LOG_FUNCTION(this);
130 return m_routerAddrFlag;
131}
132
133void
135{
136 NS_LOG_FUNCTION(this << routerAddrFlag);
137 m_routerAddrFlag = routerAddrFlag;
138}
139
140} /* namespace ns3 */
Describes an IPv6 address.
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...
void SetOnLinkFlag(bool onLinkFlag)
Set on-link flag.
void SetNetwork(Ipv6Address network)
Set network prefix.
uint32_t m_preferredLifeTime
Preferred time.
void SetPreferredLifeTime(uint32_t preferredLifeTime)
Set preferred lifetime.
uint32_t GetPreferredLifeTime() const
Get preferred lifetime.
void SetValidLifeTime(uint32_t validLifeTime)
Set valid lifetime.
uint32_t GetValidLifeTime() const
Get valid lifetime.
uint8_t GetPrefixLength() const
Get prefix length.
uint8_t m_prefixLength
Prefix length.
bool m_onLinkFlag
On link flag, indicates that this prefix can be used for on-link determination.
void SetRouterAddrFlag(bool routerAddrFlag)
Set router address flag.
bool m_autonomousFlag
Autonomous flag, it is used for autonomous address configuration (RFC 2462 ).
Ipv6Address GetNetwork() const
Get network prefix.
Ipv6Address m_network
Network prefix.
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.
~RadvdPrefix()
Destructor.
uint32_t m_validLifeTime
Valid time.
bool IsAutonomousFlag() const
Is autonomous flag ?
bool IsOnLinkFlag() const
Is on-link flag ?
void SetPrefixLength(uint8_t prefixLength)
Set prefix length.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#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.