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
mesh-wifi-beacon.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2009 IITP RAS
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Pavel Boyko <boyko@iitp.ru>
7
*/
8
9
#include "
mesh-wifi-beacon.h
"
10
11
#include "ns3/nstime.h"
12
#include "ns3/wifi-mac-header.h"
13
14
namespace
ns3
15
{
16
17
MeshWifiBeacon::MeshWifiBeacon
(
Ssid
ssid,
AllSupportedRates
rates, uint64_t
us
)
18
{
19
m_header
.Get<
Ssid
>() = ssid;
20
m_header
.Get<
SupportedRates
>() = rates.
rates
;
21
m_header
.Get<
ExtendedSupportedRatesIE
>() = rates.
extendedRates
;
22
m_header
.
SetBeaconIntervalUs
(
us
);
23
}
24
25
void
26
MeshWifiBeacon::AddInformationElement
(
Ptr<WifiInformationElement>
ie
)
27
{
28
m_elements
.
AddInformationElement
(
ie
);
29
}
30
31
Time
32
MeshWifiBeacon::GetBeaconInterval
()
const
33
{
34
return
MicroSeconds
(
m_header
.
GetBeaconIntervalUs
());
35
}
36
37
Ptr<Packet>
38
MeshWifiBeacon::CreatePacket
()
39
{
40
Ptr<Packet>
packet =
Create<Packet>
();
41
packet->AddHeader(
m_elements
);
42
packet->AddHeader(
BeaconHeader
());
43
return
packet;
44
}
45
46
WifiMacHeader
47
MeshWifiBeacon::CreateHeader
(
Mac48Address
address,
Mac48Address
mpAddress
)
48
{
49
WifiMacHeader
hdr
;
50
hdr
.
SetType
(
WIFI_MAC_MGT_BEACON
);
51
hdr
.SetAddr1(
Mac48Address::GetBroadcast
());
52
hdr
.SetAddr2(address);
53
hdr
.SetAddr3(
mpAddress
);
54
hdr
.SetDsNotFrom();
55
hdr
.SetDsNotTo();
56
return
hdr
;
57
}
58
59
}
// namespace ns3
ns3::ExtendedSupportedRatesIE
The Extended Supported Rates Information Element.
Definition
supported-rates.h:65
ns3::Mac48Address
an EUI-48 address
Definition
mac48-address.h:35
ns3::Mac48Address::GetBroadcast
static Mac48Address GetBroadcast()
Definition
mac48-address.cc:144
ns3::MeshInformationElementVector::AddInformationElement
bool AddInformationElement(Ptr< WifiInformationElement > element)
add an IE, if maxSize has exceeded, returns false
Definition
mesh-information-element-vector.cc:177
ns3::MeshWifiBeacon::CreateHeader
WifiMacHeader CreateHeader(Mac48Address address, Mac48Address mpAddress)
Create Wifi header for beacon frame.
Definition
mesh-wifi-beacon.cc:47
ns3::MeshWifiBeacon::GetBeaconInterval
Time GetBeaconInterval() const
Returns the beacon interval of Wifi beacon.
Definition
mesh-wifi-beacon.cc:32
ns3::MeshWifiBeacon::CreatePacket
Ptr< Packet > CreatePacket()
Create frame = { beacon header + all information elements sorted by ElementId () }.
Definition
mesh-wifi-beacon.cc:38
ns3::MeshWifiBeacon::BeaconHeader
MgtBeaconHeader BeaconHeader() const
Read standard Wifi beacon header.
Definition
mesh-wifi-beacon.h:47
ns3::MeshWifiBeacon::m_header
MgtBeaconHeader m_header
Beacon header.
Definition
mesh-wifi-beacon.h:82
ns3::MeshWifiBeacon::AddInformationElement
void AddInformationElement(Ptr< WifiInformationElement > ie)
Add information element.
Definition
mesh-wifi-beacon.cc:26
ns3::MeshWifiBeacon::MeshWifiBeacon
MeshWifiBeacon(Ssid ssid, AllSupportedRates rates, uint64_t us)
C-tor.
Definition
mesh-wifi-beacon.cc:17
ns3::MeshWifiBeacon::m_elements
MeshInformationElementVector m_elements
List of information elements added.
Definition
mesh-wifi-beacon.h:84
ns3::MgtProbeResponseHeader::SetBeaconIntervalUs
void SetBeaconIntervalUs(uint64_t us)
Set the beacon interval in microseconds unit.
Definition
mgt-headers.cc:70
ns3::MgtProbeResponseHeader::GetBeaconIntervalUs
uint64_t GetBeaconIntervalUs() const
Return the beacon interval in microseconds unit.
Definition
mgt-headers.cc:64
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
ptr.h:66
ns3::Ssid
The IEEE 802.11 SSID Information Element.
Definition
ssid.h:25
ns3::SupportedRates
The Supported Rates Information Element.
Definition
supported-rates.h:30
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition
nstime.h:94
ns3::WifiMacHeader
Implements the IEEE 802.11 MAC header.
Definition
wifi-mac-header.h:87
ns3::WifiMacHeader::SetType
virtual void SetType(WifiMacType type, bool resetToDsFromDs=true)
Set Type/Subtype values with the correct values depending on the given type.
Definition
wifi-mac-header.cc:104
ns3::Create
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition
ptr.h:436
ns3::MicroSeconds
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition
nstime.h:1368
mesh-wifi-beacon.h
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::WIFI_MAC_MGT_BEACON
@ WIFI_MAC_MGT_BEACON
Definition
wifi-mac-header.h:48
ns3::AllSupportedRates
Struct containing all supported rates.
Definition
supported-rates.h:77
ns3::AllSupportedRates::rates
SupportedRates rates
supported rates
Definition
supported-rates.h:134
ns3::AllSupportedRates::extendedRates
std::optional< ExtendedSupportedRatesIE > extendedRates
supported extended rates
Definition
supported-rates.h:135
src
mesh
model
mesh-wifi-beacon.cc
Generated on Mon Dec 15 2025 15:22:00 for ns-3 by
1.9.8