A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
wimax-tlv.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2009 INRIA, UDcast
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
* Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
19
*
20
*/
21
22
#ifndef WIMAX_TLV_H
23
#define WIMAX_TLV_H
24
25
#define WIMAX_TLV_EXTENDED_LENGTH_MASK 0x80
26
27
#include "ns3/ipv4-address.h"
28
#include <cstdlib>
29
#include "ns3/log.h"
30
#include "ns3/assert.h"
31
#include "ns3/uinteger.h"
32
#include "ns3/header.h"
33
#include <vector>
34
35
namespace
ns3 {
36
42
class
TlvValue
43
{
44
public
:
45
virtual
~TlvValue
()
46
{
47
}
48
virtual
uint32_t
GetSerializedSize
(
void
)
const
= 0;
49
virtual
void
Serialize
(
Buffer::Iterator
start
)
const
= 0;
50
virtual
uint32_t
Deserialize
(
Buffer::Iterator
start
, uint64_t valueLen ) = 0;
51
virtual
TlvValue
*
Copy
(
void
)
const
= 0;
52
private
:
53
};
54
55
56
// =============================================================================
64
class
Tlv
:
public
Header
65
{
66
public
:
67
enum
CommonTypes
68
{
69
HMAC_TUPLE
= 149,
70
MAC_VERSION_ENCODING
= 148,
71
CURRENT_TRANSMIT_POWER
= 147,
72
DOWNLINK_SERVICE_FLOW
= 146,
73
UPLINK_SERVICE_FLOW
= 145,
74
VENDOR_ID_EMCODING
= 144,
75
VENDOR_SPECIFIC_INFORMATION
= 143
76
};
77
Tlv
(uint8_t type, uint64_t length,
const
TlvValue
& value);
78
Tlv
(
void
);
79
~Tlv
(
void
);
80
virtual
TypeId
GetInstanceTypeId
(
void
)
const
;
81
virtual
void
Print
(std::ostream &os)
const
;
82
virtual
uint32_t
GetSerializedSize
(
void
)
const
;
83
virtual
void
Serialize
(
Buffer::Iterator
start
)
const
;
84
virtual
uint32_t
Deserialize
(
Buffer::Iterator
start
);
85
uint8_t
GetSizeOfLen
(
void
)
const
;
86
uint8_t
GetType
(
void
)
const
;
87
uint64_t
GetLength
(
void
)
const
;
88
TlvValue
*
PeekValue
(
void
);
89
Tlv
*
Copy
(
void
)
const
;
90
TlvValue
*
CopyValue
(
void
)
const
;
91
Tlv
&
operator =
(
Tlv
const
& o);
92
Tlv
(
const
Tlv
& tlv);
93
94
private
:
95
uint8_t
m_type
;
96
uint64_t
m_length
;
97
TlvValue
*
m_value
;
98
};
99
100
// ==============================================================================
104
class
U8TlvValue
:
public
TlvValue
105
{
106
public
:
107
U8TlvValue
(uint8_t value);
108
U8TlvValue
();
109
~U8TlvValue
(
void
);
110
virtual
uint32_t
GetSerializedSize
(
void
)
const
;
111
virtual
void
Serialize
(
Buffer::Iterator
start
)
const
;
112
virtual
uint32_t
Deserialize
(
Buffer::Iterator
start,uint64_t valueLen);
113
uint32_t
Deserialize
(
Buffer::Iterator
start);
114
uint8_t
GetValue
(
void
)
const
;
115
U8TlvValue
*
Copy
(
void
)
const
;
116
private
:
117
uint8_t
m_value
;
118
};
119
120
// ==============================================================================
124
class
U16TlvValue
:
public
TlvValue
125
{
126
public
:
127
U16TlvValue
(uint16_t value);
128
U16TlvValue
();
129
~U16TlvValue
(
void
);
130
virtual
uint32_t
GetSerializedSize
(
void
)
const
;
131
virtual
void
Serialize
(
Buffer::Iterator
start
)
const
;
132
virtual
uint32_t
Deserialize
(
Buffer::Iterator
start,uint64_t valueLen);
133
uint32_t
Deserialize
(
Buffer::Iterator
start);
134
uint16_t
GetValue
(
void
)
const
;
135
virtual
U16TlvValue
*
Copy
(
void
)
const
;
136
private
:
137
uint16_t
m_value
;
138
};
139
140
// ==============================================================================
144
class
U32TlvValue
:
public
TlvValue
145
{
146
public
:
147
U32TlvValue
(uint32_t value);
148
U32TlvValue
();
149
~U32TlvValue
(
void
);
150
151
virtual
uint32_t
GetSerializedSize
(
void
)
const
;
152
virtual
void
Serialize
(
Buffer::Iterator
start
)
const
;
153
virtual
uint32_t
Deserialize
(
Buffer::Iterator
start, uint64_t valueLen);
154
uint32_t
Deserialize
(
Buffer::Iterator
start);
155
uint32_t
GetValue
(
void
)
const
;
156
virtual
U32TlvValue
*
Copy
(
void
)
const
;
157
private
:
158
uint32_t
m_value
;
159
};
160
161
// ==============================================================================
162
167
class
VectorTlvValue
:
public
TlvValue
168
{
169
public
:
170
typedef
std::vector<Tlv*>::const_iterator
Iterator
;
171
VectorTlvValue
(
void
);
172
~VectorTlvValue
(
void
);
173
virtual
uint32_t
GetSerializedSize
(
void
)
const
;
174
virtual
void
Serialize
(
Buffer::Iterator
start
)
const
;
175
virtual
uint32_t
Deserialize
(
Buffer::Iterator
start
, uint64_t valueLength) = 0;
176
Iterator
Begin
()
const
;
177
Iterator
End
()
const
;
178
void
Add
(
const
Tlv
& val);
179
virtual
VectorTlvValue
*
Copy
(
void
)
const
= 0;
180
private
:
181
std::vector<Tlv*> *
m_tlvList
;
182
};
183
184
// ==============================================================================
188
class
SfVectorTlvValue
:
public
VectorTlvValue
189
{
190
191
public
:
192
enum
Type
193
{
194
SFID
= 1,
195
CID
= 2,
196
Service_Class_Name
= 3,
197
reserved1
= 4,
198
QoS_Parameter_Set_Type
= 5,
199
Traffic_Priority
= 6,
200
Maximum_Sustained_Traffic_Rate
= 7,
201
Maximum_Traffic_Burst
= 8,
202
Minimum_Reserved_Traffic_Rate
= 9,
203
Minimum_Tolerable_Traffic_Rate
= 10,
204
Service_Flow_Scheduling_Type
= 11,
205
Request_Transmission_Policy
= 12,
206
Tolerated_Jitter
= 13,
207
Maximum_Latency
= 14,
208
Fixed_length_versus_Variable_length_SDU_Indicator
= 15,
209
SDU_Size
= 16,
210
Target_SAID
= 17,
211
ARQ_Enable
= 18,
212
ARQ_WINDOW_SIZE
= 19,
213
ARQ_RETRY_TIMEOUT_Transmitter_Delay
= 20,
214
ARQ_RETRY_TIMEOUT_Receiver_Delay
= 21,
215
ARQ_BLOCK_LIFETIME
= 22,
216
ARQ_SYNC_LOSS
= 23,
217
ARQ_DELIVER_IN_ORDER
= 24,
218
ARQ_PURGE_TIMEOUT
= 25,
219
ARQ_BLOCK_SIZE
= 26,
220
reserved2
= 27,
221
CS_Specification
= 28,
222
IPV4_CS_Parameters
= 100
223
};
224
SfVectorTlvValue
();
225
virtual
uint32_t
Deserialize
(
Buffer::Iterator
start
, uint64_t valueLength);
226
virtual
SfVectorTlvValue
*
Copy
(
void
)
const
;
227
228
};
229
// ==============================================================================
230
235
class
CsParamVectorTlvValue
:
public
VectorTlvValue
236
{
237
public
:
238
enum
Type
239
{
240
Classifier_DSC_Action
= 1,
241
Packet_Classification_Rule
= 3,
242
};
243
CsParamVectorTlvValue
();
244
virtual
uint32_t
Deserialize
(
Buffer::Iterator
start
, uint64_t valueLength);
245
virtual
CsParamVectorTlvValue
*
Copy
(
void
)
const
;
246
private
:
247
};
248
249
// ==============================================================================
250
255
class
ClassificationRuleVectorTlvValue
:
public
VectorTlvValue
256
{
257
public
:
258
enum
ClassificationRuleTlvType
259
{
260
Priority
= 1,
261
ToS
= 2,
262
Protocol
= 3,
263
IP_src
= 4,
264
IP_dst
= 5,
265
Port_src
= 6,
266
Port_dst
= 7,
267
Index
= 14,
268
};
269
ClassificationRuleVectorTlvValue
();
270
virtual
uint32_t
Deserialize
(
Buffer::Iterator
start
, uint64_t valueLength);
271
virtual
ClassificationRuleVectorTlvValue
*
Copy
(
void
)
const
;
272
private
:
273
};
274
275
// ==============================================================================
279
class
TosTlvValue
:
public
TlvValue
280
{
281
public
:
282
TosTlvValue
();
283
TosTlvValue
(uint8_t, uint8_t, uint8_t);
284
~TosTlvValue
();
285
virtual
uint32_t
GetSerializedSize
(
void
)
const
;
286
virtual
void
Serialize
(
Buffer::Iterator
start
)
const
;
287
virtual
uint32_t
Deserialize
(
Buffer::Iterator
start, uint64_t valueLength);
288
uint8_t
GetLow
(
void
)
const
;
289
uint8_t
GetHigh
(
void
)
const
;
290
uint8_t
GetMask
(
void
)
const
;
291
virtual
TosTlvValue
*
Copy
()
const
;
292
private
:
293
uint8_t
m_low
;
294
uint8_t
m_high
;
295
uint8_t
m_mask
;
296
};
297
298
// ==============================================================================
302
class
PortRangeTlvValue
:
public
TlvValue
303
{
304
public
:
305
struct
PortRange
306
{
307
uint16_t
PortLow
;
308
uint16_t
PortHigh
;
309
};
310
typedef
std::vector<struct PortRange>::const_iterator
Iterator
;
311
PortRangeTlvValue
();
312
~PortRangeTlvValue
();
313
virtual
uint32_t
GetSerializedSize
(
void
)
const
;
314
virtual
void
Serialize
(
Buffer::Iterator
start
)
const
;
315
virtual
uint32_t
Deserialize
(
Buffer::Iterator
start
, uint64_t valueLength);
316
void
Add
(uint16_t portLow, uint16_t portHigh);
317
Iterator
Begin
()
const
;
318
Iterator
End
()
const
;
319
virtual
PortRangeTlvValue
*
Copy
(
void
)
const
;
320
private
:
321
std::vector<struct PortRange> *
m_portRange
;
322
};
323
324
// ==============================================================================
328
class
ProtocolTlvValue
:
public
TlvValue
329
{
330
public
:
331
ProtocolTlvValue
();
332
~ProtocolTlvValue
();
333
typedef
std::vector<uint8_t>::const_iterator
Iterator
;
334
virtual
uint32_t
GetSerializedSize
(
void
)
const
;
335
virtual
void
Serialize
(
Buffer::Iterator
start
)
const
;
336
virtual
uint32_t
Deserialize
(
Buffer::Iterator
start
, uint64_t valueLength);
337
void
Add
(uint8_t protiocol);
338
Iterator
Begin
()
const
;
339
Iterator
End
()
const
;
340
virtual
ProtocolTlvValue
*
Copy
(
void
)
const
;
341
private
:
342
std::vector<uint8_t> *
m_protocol
;
343
};
344
345
// ==============================================================================
346
350
class
Ipv4AddressTlvValue
:
public
TlvValue
351
{
352
public
:
353
struct
ipv4Addr
354
{
355
Ipv4Address
Address
;
356
Ipv4Mask
Mask
;
357
};
358
typedef
std::vector<struct ipv4Addr>::const_iterator
Iterator
;
359
Ipv4AddressTlvValue
();
360
~Ipv4AddressTlvValue
();
361
virtual
uint32_t
GetSerializedSize
(
void
)
const
;
362
virtual
void
Serialize
(
Buffer::Iterator
start
)
const
;
363
virtual
uint32_t
Deserialize
(
Buffer::Iterator
start
, uint64_t valueLength);
364
void
Add
(
Ipv4Address
address,
Ipv4Mask
Mask);
365
Iterator
Begin
()
const
;
366
Iterator
End
()
const
;
367
virtual
Ipv4AddressTlvValue
*
Copy
()
const
;
368
private
:
369
std::vector<struct ipv4Addr> *
m_ipv4Addr
;
370
};
371
372
}
373
374
#endif
/* WIMAX_TLV_H */
src
wimax
model
wimax-tlv.h
Generated on Tue May 14 2013 11:08:38 for ns-3 by
1.8.1.2