A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
common-info-probe-req-mle.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Sharan Naribole <sharan.naribole@gmail.com>
7 */
8
10
11#include "ns3/abort.h"
12
13namespace ns3
14{
15
16uint16_t
18{
19 // IEEE 802.11be D5.0 Figure 9-1072q
20 return (m_apMldId.has_value() ? 0x0001 : 0x0);
21}
22
23uint8_t
25{
26 uint8_t size = 1; // Common Info Length
27 size += (m_apMldId.has_value() ? 1 : 0);
28 return size;
29}
30
31void
33{
34 start.WriteU8(GetSize()); // Common Info Length
35 if (m_apMldId.has_value())
36 {
37 start.WriteU8(*m_apMldId);
38 }
39}
40
41uint8_t
43{
44 auto i = start;
45 auto length = i.ReadU8();
46 uint8_t count = 1;
47
48 if (presence & 0x1)
49 {
50 m_apMldId = i.ReadU8();
51 count++;
52 }
53 NS_ABORT_MSG_IF(count != length,
54 "Common Info Length (" << +length
55 << ") differs "
56 "from actual number of bytes read ("
57 << +count << ")");
58 return count;
59}
60
61} // namespace ns3
iterator in a Buffer instance
Definition buffer.h:89
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition abort.h:97
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::optional< uint8_t > m_apMldId
AP MLD ID.
void Serialize(Buffer::Iterator &start) const
Serialize the Common Info field.
uint16_t GetPresenceBitmap() const
Get the Presence Bitmap subfield of the Common Info field.
uint8_t Deserialize(Buffer::Iterator start, uint16_t presence)
Deserialize the Common Info field.
uint8_t GetSize() const
Get the size of the serialized Common Info field.