A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
dot11s-mac-header.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2009 IITP RAS
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Kirill Andreev <andreev@iitp.ru>
18 */
19
20#ifndef MESH_WIFI_MAC_HEADER_H
21#define MESH_WIFI_MAC_HEADER_H
22
23#include "ns3/header.h"
24#include "ns3/mac48-address.h"
25
26namespace ns3
27{
28namespace dot11s
29{
30/**
31 * \ingroup dot11s
32 *
33 * \brief Mesh Control field, see Section 8.2.4.7.3 IEEE 802.11-2012
34 *
35 * Header format: | Mesh flags: 1 | TTL: 1 | Sequence number: 4 | Address ext.: 0, 6, or 12 |
36 */
37class MeshHeader : public Header
38{
39 public:
40 MeshHeader();
41 ~MeshHeader() override;
42 /**
43 * \brief Get the type ID.
44 * \return the object TypeId
45 */
46 static TypeId GetTypeId();
47 TypeId GetInstanceTypeId() const override;
48 void Print(std::ostream& os) const override;
49
50 /**
51 * Set extended address 4
52 * \param address the MAC address to set
53 */
54 void SetAddr4(Mac48Address address);
55 /**
56 * Set extended address 5
57 * \param address the MAC address
58 */
59 void SetAddr5(Mac48Address address);
60 /**
61 * Set extended address 6
62 * \param address the MAC address
63 */
64 void SetAddr6(Mac48Address address);
65 /**
66 * Get extended address 4
67 * \returns the MAC address
68 */
69 Mac48Address GetAddr4() const;
70 /**
71 * Get extended address 5
72 * \returns the MAC address
73 */
74 Mac48Address GetAddr5() const;
75 /**
76 * Get extended address 6
77 * \returns the MAC address
78 */
79 Mac48Address GetAddr6() const;
80
81 /**
82 * Set four-byte mesh sequence number
83 * \param seqno the sequence number to set
84 */
85 void SetMeshSeqno(uint32_t seqno);
86 /**
87 * Get the four-byte mesh sequence number
88 * \returns the sequence number
89 */
90 uint32_t GetMeshSeqno() const;
91
92 /**
93 * Set mesh TTL subfield corresponding to the remaining number of hops
94 * the MSDU/MMPDU is forwarded.
95 *
96 * \param TTL the TTL value to set
97 */
98 void SetMeshTtl(uint8_t TTL);
99 /**
100 * Get mesh TTL function subfield value
101 * \returns the TTL value
102 */
103 uint8_t GetMeshTtl() const;
104
105 /**
106 * Set Address Extension Mode
107 * \param num_of_addresses value between 0 and 3 for the two-bit field
108 */
109 void SetAddressExt(uint8_t num_of_addresses);
110 /**
111 * Get Address Extension Mode
112 * \returns the address extension mode value
113 */
114 uint8_t GetAddressExt() const;
115
116 uint32_t GetSerializedSize() const override;
117 void Serialize(Buffer::Iterator start) const override;
118 uint32_t Deserialize(Buffer::Iterator start) override;
119
120 private:
121 uint8_t m_meshFlags; ///< mesh flags
122 uint8_t m_meshTtl; ///< mesh TTL
123 uint32_t m_meshSeqno; ///< mesh sequence no
124 Mac48Address m_addr4; ///< MAC address 4
125 Mac48Address m_addr5; ///< MAC address 5
126 Mac48Address m_addr6; ///< MAC address 6
127 /**
128 * equality operator
129 *
130 * \param a left hand side
131 * \param b right hand side
132 * \returns true if equal
133 */
134 friend bool operator==(const MeshHeader& a, const MeshHeader& b);
135};
136
137bool operator==(const MeshHeader& a, const MeshHeader& b);
138
139} // namespace dot11s
140} // namespace ns3
141#endif /* MESH_WIFI_MAC_HEADER_H */
iterator in a Buffer instance
Definition: buffer.h:100
Protocol header serialization and deserialization.
Definition: header.h:44
an EUI-48 address
Definition: mac48-address.h:46
a unique identifier for an interface.
Definition: type-id.h:59
Mesh Control field, see Section 8.2.4.7.3 IEEE 802.11-2012.
void SetAddr6(Mac48Address address)
Set extended address 6.
void SetMeshSeqno(uint32_t seqno)
Set four-byte mesh sequence number.
void Serialize(Buffer::Iterator start) const override
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Mac48Address m_addr6
MAC address 6.
uint32_t GetMeshSeqno() const
Get the four-byte mesh sequence number.
void SetMeshTtl(uint8_t TTL)
Set mesh TTL subfield corresponding to the remaining number of hops the MSDU/MMPDU is forwarded.
Mac48Address m_addr4
MAC address 4.
uint32_t Deserialize(Buffer::Iterator start) override
static TypeId GetTypeId()
Get the type ID.
void Print(std::ostream &os) const override
Mac48Address GetAddr5() const
Get extended address 5.
Mac48Address GetAddr4() const
Get extended address 4.
uint8_t m_meshFlags
mesh flags
uint32_t GetSerializedSize() const override
Mac48Address GetAddr6() const
Get extended address 6.
uint8_t GetAddressExt() const
Get Address Extension Mode.
friend bool operator==(const MeshHeader &a, const MeshHeader &b)
equality operator
void SetAddressExt(uint8_t num_of_addresses)
Set Address Extension Mode.
void SetAddr5(Mac48Address address)
Set extended address 5.
void SetAddr4(Mac48Address address)
Set extended address 4.
uint8_t GetMeshTtl() const
Get mesh TTL function subfield value.
Mac48Address m_addr5
MAC address 5.
uint32_t m_meshSeqno
mesh sequence no
bool operator==(const MeshHeader &a, const MeshHeader &b)
Every class exported by the ns3 library is enclosed in the ns3 namespace.