1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
|
2 /* |
|
3 * Copyright (c) 2009 IITP RAS |
|
4 * |
|
5 * This program is free software; you can redistribute it and/or modify |
|
6 * it under the terms of the GNU General Public License version 2 as |
|
7 * published by the Free Software Foundation; |
|
8 * |
|
9 * This program is distributed in the hope that it will be useful, |
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 * GNU General Public License for more details. |
|
13 * |
|
14 * You should have received a copy of the GNU General Public License |
|
15 * along with this program; if not, write to the Free Software |
|
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
17 * |
|
18 * Author: Kirill Andreev <andreev@iitp.ru> |
|
19 */ |
|
20 |
|
21 |
|
22 #ifndef MESH_WIFI_MAC_HEADER_H |
|
23 #define MESH_WIFI_MAC_HEADER_H |
|
24 |
|
25 #include "ns3/header.h" |
|
26 #include "ns3/mac48-address.h" |
|
27 |
|
28 namespace ns3 { |
|
29 /** |
|
30 * \ingroup mesh |
|
31 */ |
|
32 class WifiMeshHeader : public Header //7.1.3.5b |
|
33 { |
|
34 public: |
|
35 WifiMeshHeader (); |
|
36 ~WifiMeshHeader (); |
|
37 static TypeId GetTypeId (); |
|
38 virtual TypeId GetInstanceTypeId () const; |
|
39 virtual void Print (std::ostream &os) const; |
|
40 |
|
41 void SetAddr5 (Mac48Address address); |
|
42 void SetAddr6 (Mac48Address address); |
|
43 void SetAddr7 (Mac48Address address); |
|
44 Mac48Address GetAddr5 (); |
|
45 Mac48Address GetAddr6 (); |
|
46 Mac48Address GetAddr7 (); |
|
47 |
|
48 void SetMeshSeqno (uint32_t seqno); |
|
49 uint32_t GetMeshSeqno (); |
|
50 |
|
51 void SetMeshTtl (uint8_t TTL); |
|
52 uint8_t GetMeshTtl (); |
|
53 |
|
54 void SetAddressExt (uint8_t num_of_addresses); |
|
55 uint8_t GetAddressExt (); |
|
56 |
|
57 virtual uint32_t GetSerializedSize () const; |
|
58 virtual void Serialize (Buffer::Iterator start) const; |
|
59 virtual uint32_t Deserialize (Buffer::Iterator start); |
|
60 private: |
|
61 uint8_t m_meshFlags; |
|
62 uint8_t m_meshTtl; |
|
63 uint32_t m_meshSeqno; |
|
64 Mac48Address m_addr5; |
|
65 Mac48Address m_addr6; |
|
66 Mac48Address m_addr7; |
|
67 }; |
|
68 |
|
69 /** |
|
70 * \ingroup mesh |
|
71 */ |
|
72 class WifiMeshMultihopActionHeader : public Header //7.2.3.14 |
|
73 { |
|
74 //Multichop action frame consists of Mesh header, Action, and |
|
75 //the last information. Mesh header is present within all data |
|
76 //frames and multihop action frames, so Mesh header is a |
|
77 //separate structure. Each MultihopAction frames (frames like |
|
78 //PREQ, PREP and other) start form Category field and Action |
|
79 //value field, so the Multihop Action Frame should containt |
|
80 //three fields: Category, Action Value; |
|
81 public: |
|
82 WifiMeshMultihopActionHeader (); |
|
83 ~WifiMeshMultihopActionHeader (); |
|
84 enum CategoryValue //table 7-24 staring from 4 |
|
85 { |
|
86 MESH_PEER_LINK_MGT =4, |
|
87 MESH_LINK_METRIC, |
|
88 MESH_PATH_SELECTION, |
|
89 MESH_INTERWORK_ACTION, |
|
90 MESH_RESOURCE_COORDINATION, |
|
91 }; |
|
92 enum PeerLinkMgtActionValue |
|
93 { |
|
94 PEER_LINK_OPEN = 0, |
|
95 PEER_LINK_CONFIRM, |
|
96 PEER_LINK_CLOSE, |
|
97 }; |
|
98 enum LinkMetricActionValue |
|
99 { |
|
100 LINK_METRIC_REQUEST = 0, |
|
101 LINK_METRIC_REPORT, |
|
102 }; |
|
103 enum PathSelectionActionValue |
|
104 { |
|
105 PATH_REQUEST = 0, |
|
106 PATH_REPLY, |
|
107 PATH_ERROR, |
|
108 ROOT_ANNOUNCEMENT, |
|
109 }; |
|
110 enum InterworkActionValue |
|
111 { |
|
112 PORTAL_ANNOUNCEMENT = 0, |
|
113 }; |
|
114 enum ResourceCoordinationActionValue |
|
115 { |
|
116 CONGESTION_CONTROL_NOTIFICATION = 0, |
|
117 MDA_SETUP_REQUEST, |
|
118 MDA_SETUP_REPLY, |
|
119 MDAOP_ADVERTISMENT_REQUEST, |
|
120 MDAOP_ADVERTISMENTS, |
|
121 MDAOP_SET_TEARDOWN, |
|
122 BEACON_TIMING_REQUEST, |
|
123 BEACON_TIMING_RESPONSE, |
|
124 TBTT_ADJASTMENT_REQUEST, |
|
125 MESH_CHANNEL_SWITCH_ANNOUNCEMENT, |
|
126 }; |
|
127 typedef union |
|
128 { |
|
129 enum PeerLinkMgtActionValue peerLink; |
|
130 enum LinkMetricActionValue linkMetrtic; |
|
131 enum PathSelectionActionValue pathSelection; |
|
132 enum InterworkActionValue interwork; |
|
133 enum ResourceCoordinationActionValue resourceCoordination; |
|
134 } ACTION_VALUE; |
|
135 void SetAction (enum CategoryValue type,ACTION_VALUE action); |
|
136 enum CategoryValue GetCategory (); |
|
137 ACTION_VALUE GetAction (); |
|
138 static TypeId GetTypeId (); |
|
139 virtual TypeId GetInstanceTypeId () const; |
|
140 virtual void Print (std::ostream &os) const; |
|
141 virtual uint32_t GetSerializedSize () const; |
|
142 virtual void Serialize (Buffer::Iterator start) const; |
|
143 virtual uint32_t Deserialize (Buffer::Iterator start); |
|
144 private: |
|
145 uint8_t m_category; |
|
146 uint8_t m_actionValue; |
|
147 }; |
|
148 } // namespace ns3 |
|
149 #endif /* MESH_WIFI_MAC_HEADER_H */ |
|