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/tim.h"
13
#include "ns3/wifi-mac-header.h"
14
15
namespace
ns3
16
{
17
18
MeshWifiBeacon::MeshWifiBeacon
(
Ssid
ssid,
AllSupportedRates
rates, uint64_t us)
19
{
20
m_header
.Get<
Ssid
>() = ssid;
21
m_header
.Get<
SupportedRates
>() = rates.
rates
;
22
m_header
.Get<
ExtendedSupportedRatesIE
>() = rates.
extendedRates
;
23
m_header
.Get<
Tim
>() =
Tim
{};
24
m_header
.m_beaconInterval = us;
25
}
26
27
void
28
MeshWifiBeacon::AddInformationElement
(
Ptr<WifiInformationElement>
ie)
29
{
30
m_elements
.AddInformationElement(ie);
31
}
32
33
Time
34
MeshWifiBeacon::GetBeaconInterval
()
const
35
{
36
return
MicroSeconds
(
m_header
.m_beaconInterval);
37
}
38
39
Ptr<Packet>
40
MeshWifiBeacon::CreatePacket
()
41
{
42
Ptr<Packet>
packet =
Create<Packet>
();
43
packet->AddHeader(
m_elements
);
44
packet->AddHeader(
BeaconHeader
());
45
return
packet;
46
}
47
48
WifiMacHeader
49
MeshWifiBeacon::CreateHeader
(
Mac48Address
address,
Mac48Address
mpAddress)
50
{
51
WifiMacHeader
hdr;
52
hdr.
SetType
(
WIFI_MAC_MGT_BEACON
);
53
hdr.
SetAddr1
(
Mac48Address::GetBroadcast
());
54
hdr.
SetAddr2
(address);
55
hdr.
SetAddr3
(mpAddress);
56
hdr.
SetDsNotFrom
();
57
hdr.
SetDsNotTo
();
58
return
hdr;
59
}
60
61
}
// 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:37
ns3::Mac48Address::GetBroadcast
static Mac48Address GetBroadcast()
Definition
mac48-address.cc:145
ns3::MeshWifiBeacon::CreateHeader
WifiMacHeader CreateHeader(Mac48Address address, Mac48Address mpAddress)
Create Wifi header for beacon frame.
Definition
mesh-wifi-beacon.cc:49
ns3::MeshWifiBeacon::GetBeaconInterval
Time GetBeaconInterval() const
Returns the beacon interval of Wifi beacon.
Definition
mesh-wifi-beacon.cc:34
ns3::MeshWifiBeacon::CreatePacket
Ptr< Packet > CreatePacket()
Create frame = { beacon header + all information elements sorted by ElementId () }...
Definition
mesh-wifi-beacon.cc:40
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:28
ns3::MeshWifiBeacon::MeshWifiBeacon
MeshWifiBeacon(Ssid ssid, AllSupportedRates rates, uint64_t us)
C-tor.
Definition
mesh-wifi-beacon.cc:18
ns3::MeshWifiBeacon::m_elements
MeshInformationElementVector m_elements
List of information elements added.
Definition
mesh-wifi-beacon.h:84
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
ptr.h:70
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::Tim
The Traffic Indication Map Information Element.
Definition
tim.h:29
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition
nstime.h:95
ns3::WifiMacHeader
Implements the IEEE 802.11 MAC header.
Definition
wifi-mac-header.h:87
ns3::WifiMacHeader::SetDsNotFrom
void SetDsNotFrom()
Un-set the From DS bit in the Frame Control field.
Definition
wifi-mac-header.cc:62
ns3::WifiMacHeader::SetAddr1
void SetAddr1(Mac48Address address)
Fill the Address 1 field with the given address.
Definition
wifi-mac-header.cc:80
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::WifiMacHeader::SetAddr2
void SetAddr2(Mac48Address address)
Fill the Address 2 field with the given address.
Definition
wifi-mac-header.cc:86
ns3::WifiMacHeader::SetAddr3
void SetAddr3(Mac48Address address)
Fill the Address 3 field with the given address.
Definition
wifi-mac-header.cc:92
ns3::WifiMacHeader::SetDsNotTo
void SetDsNotTo()
Un-set the To DS bit in the Frame Control field.
Definition
wifi-mac-header.cc:74
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:454
ns3::MicroSeconds
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition
nstime.h:1307
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
for ns-3 by
1.15.0