A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
sixlowpan-nd-prefix.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2015 Università di Firenze, Italy
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 *
7 *
8 * Author: Alessio Bonadio <alessio.bonadio@gmail.com>
9 * Tommaso Pecorella <tommaso.pecorella@unifi.it>
10 * Adnan Rashid <adnanrashidpk@gmail.com>
11 */
12
13#include "sixlowpan-nd-prefix.h"
14
15#include "ns3/log.h"
16#include "ns3/simulator.h"
17
18namespace ns3
19{
20
21NS_LOG_COMPONENT_DEFINE("SixLowPanNdPrefix");
22
27
29 uint8_t prefixLen,
30 Time prefTime,
31 Time validTime)
32 : m_prefix(prefix),
33 m_prefixLength(prefixLen),
34 m_preferredLifeTime(prefTime),
35 m_validLifeTime(validTime)
36{
37 NS_LOG_FUNCTION(this << prefix << prefixLen << prefTime << validTime);
38}
39
44
47{
48 NS_LOG_FUNCTION(this);
49 return m_prefix;
50}
51
52void
54{
55 NS_LOG_FUNCTION(this << prefix);
56 m_prefix = prefix;
57}
58
59uint8_t
65
66void
68{
69 NS_LOG_FUNCTION(this << prefixLen);
70 m_prefixLength = prefixLen;
71}
72
73Time
80
81void
83{
84 NS_LOG_FUNCTION(this << validTime);
85 m_validLifeTime = validTime;
86}
87
88Time
94
95void
97{
98 NS_LOG_FUNCTION(this << prefTime);
99 m_preferredLifeTime = prefTime;
100}
101
102void
104{
105 NS_LOG_FUNCTION(this << stream);
106 std::ostream* os = stream->GetStream();
107
108 *os << " Prefix Length: " << GetPrefixLength();
109 *os << " Valid Lifetime: " << GetValidLifeTime();
110 *os << " Preferred Lifetime: " << GetPreferredLifeTime();
111 *os << " Prefix: " << GetPrefix();
112}
113
114} /* namespace ns3 */
Describes an IPv6 address.
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:70
Ipv6Address GetPrefix() const
Get network prefix.
void SetValidLifeTime(Time validTime)
Set valid lifetime.
void SetPrefix(Ipv6Address prefix)
Set network prefix.
void SetPrefixLength(uint8_t prefixLen)
Set prefix length.
Time m_preferredLifeTime
Preferred time.
uint8_t m_prefixLength
Prefix length.
void SetPreferredLifeTime(Time prefTime)
Set preferred lifetime.
Ipv6Address m_prefix
Network prefix.
Time GetValidLifeTime() const
Get valid lifetime.
Time GetPreferredLifeTime() const
Get preferred lifetime.
uint8_t GetPrefixLength() const
Get prefix length.
void PrintPrefix(Ptr< OutputStreamWrapper > stream)
Print the prefix.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:95
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:194
#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.