A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
sixlowpan-helper.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2011 Universita' di Firenze, Italy
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Tommaso Pecorella <tommaso.pecorella@unifi.it>
7
*/
8
9
#ifndef SIXLOWPAN_HELPER_H
10
#define SIXLOWPAN_HELPER_H
11
12
#include "ns3/net-device-container.h"
13
#include "ns3/object-factory.h"
14
15
#include <string>
16
17
namespace
ns3
18
{
19
20
class
Node;
21
class
AttributeValue;
22
class
Time
;
23
24
/**
25
* \ingroup sixlowpan
26
*
27
* \brief Setup a sixlowpan stack to be used as a shim between IPv6 and a generic NetDevice.
28
*/
29
class
SixLowPanHelper
30
{
31
public
:
32
/*
33
* Construct a SixlowpanHelper
34
*/
35
SixLowPanHelper
();
36
/**
37
* Set an attribute on each ns3::SixlowpanNetDevice created by
38
* SixlowpanHelper::Install.
39
*
40
* \param n1 [in] The name of the attribute to set.
41
* \param v1 [in] The value of the attribute to set.
42
*/
43
void
SetDeviceAttribute
(std::string n1,
const
AttributeValue
& v1);
44
45
/**
46
* \brief Install the SixLoWPAN stack on top of an existing NetDevice.
47
*
48
* This function requires a set of properly configured NetDevices
49
* passed in as the parameter "c". The new NetDevices will have to
50
* be used instead of the original ones. In this way these
51
* SixLoWPAN devices will behave as shims between the NetDevices
52
* passed in and IPv6.
53
*
54
* Note that only IPv6 (and related protocols, such as ICMPv6) can
55
* be transmitted over a 6LoWPAN interface.
56
* Any other protocol (e.g., IPv4) will be discarded by 6LoWPAN.
57
*
58
* Other protocols (e.g., IPv4) could be used on the original NetDevices
59
* with some limitations.
60
* See the manual for a complete discussion.
61
*
62
* \note IPv6 stack must be installed \a after SixLoWPAN,
63
* using the SixLoWPAN NetDevices. See the example in the
64
* examples directory.
65
*
66
*
67
* \param [in] c The NetDevice container.
68
* \return A container with the newly created SixLowPanNetDevices.
69
*/
70
NetDeviceContainer
Install
(
NetDeviceContainer
c);
71
72
/**
73
* \brief Adds a compression Context to a set of NetDevices.
74
*
75
* This function installs one Compression Context on a set of NetDevices.
76
* The context is used only in IPHC compression and decompression.
77
*
78
* \param [in] c The NetDevice container.
79
* \param [in] contextId The context id (must be less than 16).
80
* \param [in] context The context prefix.
81
* \param [in] validity the context validity time (relative to the actual time).
82
*/
83
void
AddContext
(
NetDeviceContainer
c, uint8_t contextId,
Ipv6Prefix
context,
Time
validity);
84
85
/**
86
* \brief Renew a compression Context in a set of NetDevices.
87
*
88
* The context will have its lifetime extended and its validity for compression re-enabled.
89
*
90
* \param [in] c The NetDevice container.
91
* \param [in] contextId The context id (must be less than 16).
92
* \param [in] validity the context validity time (relative to the actual time).
93
*/
94
void
RenewContext
(
NetDeviceContainer
c, uint8_t contextId,
Time
validity);
95
96
/**
97
* \brief Invalidates a compression Context in a set of NetDevices.
98
*
99
* An invalid context is used only in IPHC decompression and not
100
* in IPHC compression.
101
*
102
* This is necessary to avoid that a context reaching its validity lifetime
103
* can not be used for decompression whie packets are traveling the network.
104
*
105
* \param [in] c The NetDevice container.
106
* \param [in] contextId The context id (must be less than 16).
107
*/
108
void
InvalidateContext
(
NetDeviceContainer
c, uint8_t contextId);
109
110
/**
111
* \brief Remove a compression Context in a set of NetDevices.
112
*
113
* The context is removed immediately from the contexts in the devices.
114
*
115
* \param [in] c The NetDevice container.
116
* \param [in] contextId The context id (must be less than 16).
117
*/
118
void
RemoveContext
(
NetDeviceContainer
c, uint8_t contextId);
119
120
/**
121
* Assign a fixed random variable stream number to the random variables
122
* used by this model. Return the number of streams (possibly zero) that
123
* have been assigned. The Install() method should have previously been
124
* called by the user.
125
*
126
* \param [in] c NetDeviceContainer of the set of net devices for which the
127
* SixLowPanNetDevice should be modified to use a fixed stream.
128
* \param [in] stream First stream index to use.
129
* \return The number of stream indices assigned by this helper.
130
*/
131
int64_t
AssignStreams
(
NetDeviceContainer
c, int64_t stream);
132
133
private
:
134
ObjectFactory
m_deviceFactory
;
//!< Object factory.
135
};
136
137
}
// namespace ns3
138
139
#endif
/* SIXLOWPAN_HELPER_H */
ns3::AttributeValue
Hold a value for an Attribute.
Definition
attribute.h:59
ns3::Ipv6Prefix
Describes an IPv6 prefix.
Definition
ipv6-address.h:444
ns3::NetDeviceContainer
holds a vector of ns3::NetDevice pointers
Definition
net-device-container.h:32
ns3::ObjectFactory
Instantiate subclasses of ns3::Object.
Definition
object-factory.h:37
ns3::SixLowPanHelper
Setup a sixlowpan stack to be used as a shim between IPv6 and a generic NetDevice.
Definition
sixlowpan-helper.h:30
ns3::SixLowPanHelper::m_deviceFactory
ObjectFactory m_deviceFactory
Object factory.
Definition
sixlowpan-helper.h:134
ns3::SixLowPanHelper::SetDeviceAttribute
void SetDeviceAttribute(std::string n1, const AttributeValue &v1)
Set an attribute on each ns3::SixlowpanNetDevice created by SixlowpanHelper::Install.
Definition
sixlowpan-helper.cc:31
ns3::SixLowPanHelper::SixLowPanHelper
SixLowPanHelper()
Definition
sixlowpan-helper.cc:24
ns3::SixLowPanHelper::Install
NetDeviceContainer Install(NetDeviceContainer c)
Install the SixLoWPAN stack on top of an existing NetDevice.
Definition
sixlowpan-helper.cc:38
ns3::SixLowPanHelper::RemoveContext
void RemoveContext(NetDeviceContainer c, uint8_t contextId)
Remove a compression Context in a set of NetDevices.
Definition
sixlowpan-helper.cc:112
ns3::SixLowPanHelper::RenewContext
void RenewContext(NetDeviceContainer c, uint8_t contextId, Time validity)
Renew a compression Context in a set of NetDevices.
Definition
sixlowpan-helper.cc:80
ns3::SixLowPanHelper::AssignStreams
int64_t AssignStreams(NetDeviceContainer c, int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Definition
sixlowpan-helper.cc:128
ns3::SixLowPanHelper::InvalidateContext
void InvalidateContext(NetDeviceContainer c, uint8_t contextId)
Invalidates a compression Context in a set of NetDevices.
Definition
sixlowpan-helper.cc:96
ns3::SixLowPanHelper::AddContext
void AddContext(NetDeviceContainer c, uint8_t contextId, Ipv6Prefix context, Time validity)
Adds a compression Context to a set of NetDevices.
Definition
sixlowpan-helper.cc:61
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition
nstime.h:94
ns3::TracedValueCallback::Time
void(* Time)(Time oldValue, Time newValue)
TracedValue callback signature for Time.
Definition
nstime.h:828
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
sixlowpan
helper
sixlowpan-helper.h
Generated on Fri Nov 8 2024 13:59:05 for ns-3 by
1.11.0