A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
sixlowpan-nd-context.h
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#ifndef SIXLOW_ND_CONTEXT_H
14#define SIXLOW_ND_CONTEXT_H
15
16#include "ns3/ipv6-address.h"
17#include "ns3/nstime.h"
18#include "ns3/output-stream-wrapper.h"
19#include "ns3/simple-ref-count.h"
20
21#include <stdint.h>
22
23namespace ns3
24{
25
26/**
27 * @ingroup sixlowpan
28 * @brief 6LoWPAN context container for 6LoWPAN ND.
29 */
30class SixLowPanNdContext : public SimpleRefCount<SixLowPanNdContext>
31{
32 public:
33 /**
34 * @brief Constructor.
35 */
37
38 /**
39 * @brief Constructor.
40 * @param flagC compression flag
41 * @param cid context identifier ( 0 <= x <= 15)
42 * @param time valid lifetime of context
43 * @param context 6LoWPAN context advertised
44 */
45 SixLowPanNdContext(bool flagC, uint8_t cid, Time time, Ipv6Prefix context);
46
47 /**
48 * @brief Destructor.
49 */
51
52 /**
53 * @brief Get the context length.
54 * @return context length value
55 */
56 uint8_t GetContextLen() const;
57
58 /**
59 * @brief Is compression flag ?
60 * @return true if context is valid for use in compression, false otherwise
61 */
62 bool IsFlagC() const;
63
64 /**
65 * @brief Set the compression flag.
66 * @param c the compression flag
67 */
68 void SetFlagC(bool c);
69
70 /**
71 * @brief Get the context identifier.
72 * @return context identifier value
73 */
74 uint8_t GetCid() const;
75
76 /**
77 * @brief Set the context identifier.
78 * @param cid the context identifier value
79 */
80 void SetCid(uint8_t cid);
81
82 /**
83 * @brief Get the valid lifetime.
84 * @return valid lifetime value
85 */
86 Time GetValidTime() const;
87
88 /**
89 * @brief Set the valid lifetime.
90 * @param time the valid lifetime value
91 */
92 void SetValidTime(Time time);
93
94 /**
95 * @brief Set the last update time.
96 * @param time the last update time
97 */
98 void SetLastUpdateTime(Time time);
99
100 /**
101 * @brief Get the last update time.
102 * @return the last update time
103 */
105
106 /**
107 * @brief Get the 6LoWPAN context prefix.
108 * @return context prefix value
109 */
111
112 /**
113 * @brief Set the 6LoWPAN context prefix.
114 * @param context the context prefix value
115 */
116 void SetContextPrefix(Ipv6Prefix context);
117
118 /**
119 * @brief Print the 6LoWPAN context.
120 * @param stream the ostream the 6LoWPAN context is printed to
121 */
123
124 private:
125 /**
126 * @brief The compression flag, indicates that this context is valid for use in compression.
127 */
128 bool m_c;
129
130 /**
131 * @brief The context identifier value.
132 */
133 uint8_t m_cid;
134
135 /**
136 * @brief The valid lifetime value.
137 */
139
140 /**
141 * @brief The context last update time.
142 */
144
145 /**
146 * @brief The context prefix value.
147 */
149};
150
151} /* namespace ns3 */
152
153#endif /* SIXLOW_ND_CONTEXT_H */
Describes an IPv6 prefix.
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:70
uint8_t GetCid() const
Get the context identifier.
bool IsFlagC() const
Is compression flag ?
Time m_validTime
The valid lifetime value.
Time GetValidTime() const
Get the valid lifetime.
Ipv6Prefix m_context
The context prefix value.
void SetFlagC(bool c)
Set the compression flag.
void SetValidTime(Time time)
Set the valid lifetime.
uint8_t GetContextLen() const
Get the context length.
Time m_lastUpdateTime
The context last update time.
void PrintContext(Ptr< OutputStreamWrapper > stream)
Print the 6LoWPAN context.
bool m_c
The compression flag, indicates that this context is valid for use in compression.
void SetCid(uint8_t cid)
Set the context identifier.
Time GetLastUpdateTime()
Get the last update time.
void SetContextPrefix(Ipv6Prefix context)
Set the 6LoWPAN context prefix.
void SetLastUpdateTime(Time time)
Set the last update time.
Ipv6Prefix GetContextPrefix() const
Get the 6LoWPAN context prefix.
uint8_t m_cid
The context identifier value.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:95
Every class exported by the ns3 library is enclosed in the ns3 namespace.