This file is indexed.

/usr/include/ns3.17/ns3/wimax-tlv.h is in libns3-dev 3.17+dfsg-1build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
 *  Copyright (c) 2009 INRIA, UDcast
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation;
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 *         Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
 *
 */

#ifndef WIMAX_TLV_H
#define WIMAX_TLV_H

#define WIMAX_TLV_EXTENDED_LENGTH_MASK 0x80

#include "ns3/ipv4-address.h"
#include <cstdlib>
#include "ns3/log.h"
#include "ns3/assert.h"
#include "ns3/uinteger.h"
#include "ns3/header.h"
#include <vector>

namespace ns3 {

/**
 * \ingroup wimax
 * \brief The value field of a tlv can take different values (uint8_t, uint16, vector...). This class is a virtual interface
 * that all the types of tlv values should derive
 */
class TlvValue
{
public:
  virtual ~TlvValue ()
  {
  }
  virtual uint32_t GetSerializedSize (void) const = 0;
  virtual void Serialize (Buffer::Iterator start) const = 0;
  virtual uint32_t Deserialize (Buffer::Iterator start, uint64_t valueLen ) = 0;
  virtual TlvValue * Copy (void) const = 0;
private:
};


// =============================================================================
/**
 * \ingroup wimax
 * \brief This class implements the Type-Len-Value structure channel encodings as described by "IEEE Standard for
 * Local and metropolitan area networks Part 16: Air Interface for Fixed Broadband Wireless Access Systems"
 * 11. TLV encodings, page 645
 *
 */
class Tlv : public Header
{
public:
  enum CommonTypes
  {
    HMAC_TUPLE = 149,
    MAC_VERSION_ENCODING = 148,
    CURRENT_TRANSMIT_POWER = 147,
    DOWNLINK_SERVICE_FLOW = 146,
    UPLINK_SERVICE_FLOW = 145,
    VENDOR_ID_EMCODING = 144,
    VENDOR_SPECIFIC_INFORMATION = 143
  };
  Tlv (uint8_t type, uint64_t length, const TlvValue & value);
  Tlv (void);
  ~Tlv (void);
  virtual TypeId GetInstanceTypeId (void) const;
  virtual void Print (std::ostream &os) const;
  virtual uint32_t GetSerializedSize (void) const;
  virtual void Serialize (Buffer::Iterator start) const;
  virtual uint32_t Deserialize (Buffer::Iterator start);
  uint8_t GetSizeOfLen (void) const;
  uint8_t GetType (void) const;
  uint64_t GetLength (void) const;
  TlvValue* PeekValue (void);
  Tlv * Copy (void) const;
  TlvValue * CopyValue (void) const;
  Tlv &operator = (Tlv const& o);
  Tlv (const Tlv & tlv);

private:
  uint8_t m_type;
  uint64_t m_length;
  TlvValue * m_value;
};

// ==============================================================================
/**
 * \ingroup wimax
 */
class U8TlvValue : public TlvValue
{
public:
  U8TlvValue (uint8_t value);
  U8TlvValue ();
  ~U8TlvValue (void);
  virtual uint32_t GetSerializedSize (void) const;
  virtual void Serialize (Buffer::Iterator start) const;
  virtual uint32_t Deserialize (Buffer::Iterator start,uint64_t valueLen);
  uint32_t Deserialize (Buffer::Iterator start);
  uint8_t GetValue (void) const;
  U8TlvValue * Copy (void) const;
private:
  uint8_t  m_value;
};

// ==============================================================================
/**
 * \ingroup wimax
 */
class U16TlvValue : public TlvValue
{
public:
  U16TlvValue (uint16_t value);
  U16TlvValue ();
  ~U16TlvValue (void);
  virtual uint32_t GetSerializedSize (void) const;
  virtual void Serialize (Buffer::Iterator start) const;
  virtual uint32_t Deserialize (Buffer::Iterator start,uint64_t valueLen);
  uint32_t Deserialize (Buffer::Iterator start);
  uint16_t GetValue (void) const;
  virtual U16TlvValue * Copy (void) const;
private:
  uint16_t  m_value;
};

// ==============================================================================
/**
 * \ingroup wimax
 */
class U32TlvValue : public TlvValue
{
public:
  U32TlvValue (uint32_t value);
  U32TlvValue ();
  ~U32TlvValue (void);

  virtual uint32_t GetSerializedSize (void) const;
  virtual void Serialize (Buffer::Iterator start) const;
  virtual uint32_t Deserialize (Buffer::Iterator start, uint64_t valueLen);
  uint32_t Deserialize (Buffer::Iterator start);
  uint32_t GetValue (void) const;
  virtual U32TlvValue * Copy (void) const;
private:
  uint32_t  m_value;
};

// ==============================================================================

/**
 * \ingroup wimax
 * \brief this class is used to implement a vector of values in one tlv value field
 */
class VectorTlvValue : public TlvValue
{
public:
  typedef std::vector<Tlv*>::const_iterator Iterator;
  VectorTlvValue (void);
  ~VectorTlvValue (void);
  virtual uint32_t GetSerializedSize (void) const;
  virtual void Serialize (Buffer::Iterator start) const;
  virtual uint32_t Deserialize (Buffer::Iterator start, uint64_t valueLength) = 0;
  Iterator Begin () const;
  Iterator End () const;
  void Add (const Tlv & val);
  virtual VectorTlvValue * Copy (void) const = 0;
private:
  std::vector<Tlv*>  * m_tlvList;
};

// ==============================================================================
/**
 * \ingroup wimax
 */
class SfVectorTlvValue : public VectorTlvValue
{

public:
  enum Type
  {
    SFID = 1,
    CID = 2,
    Service_Class_Name = 3,
    reserved1 = 4,
    QoS_Parameter_Set_Type = 5,
    Traffic_Priority = 6,
    Maximum_Sustained_Traffic_Rate = 7,
    Maximum_Traffic_Burst = 8,
    Minimum_Reserved_Traffic_Rate = 9,
    Minimum_Tolerable_Traffic_Rate = 10,
    Service_Flow_Scheduling_Type = 11,
    Request_Transmission_Policy = 12,
    Tolerated_Jitter = 13,
    Maximum_Latency = 14,
    Fixed_length_versus_Variable_length_SDU_Indicator = 15,
    SDU_Size = 16,
    Target_SAID = 17,
    ARQ_Enable = 18,
    ARQ_WINDOW_SIZE = 19,
    ARQ_RETRY_TIMEOUT_Transmitter_Delay = 20,
    ARQ_RETRY_TIMEOUT_Receiver_Delay = 21,
    ARQ_BLOCK_LIFETIME = 22,
    ARQ_SYNC_LOSS = 23,
    ARQ_DELIVER_IN_ORDER = 24,
    ARQ_PURGE_TIMEOUT = 25,
    ARQ_BLOCK_SIZE = 26,
    reserved2 = 27,
    CS_Specification = 28,
    IPV4_CS_Parameters = 100
  };
  SfVectorTlvValue ();
  virtual uint32_t Deserialize (Buffer::Iterator start, uint64_t valueLength);
  virtual SfVectorTlvValue * Copy (void) const;

};
// ==============================================================================

/**
 * \ingroup wimax
 * \brief this class implements the convergence sub-layer descriptor as a tlv vector
 */
class CsParamVectorTlvValue : public VectorTlvValue
{
public:
  enum Type
  {
    Classifier_DSC_Action = 1,
    Packet_Classification_Rule = 3,
  };
  CsParamVectorTlvValue ();
  virtual uint32_t Deserialize (Buffer::Iterator start, uint64_t valueLength);
  virtual CsParamVectorTlvValue * Copy (void) const;
private:
};

// ==============================================================================

/**
 * \ingroup wimax
 * \brief this class implements the classifier descriptor as a tlv vector
 */
class ClassificationRuleVectorTlvValue : public VectorTlvValue
{
public:
  enum ClassificationRuleTlvType
  {
    Priority = 1,
    ToS = 2,
    Protocol = 3,
    IP_src = 4,
    IP_dst = 5,
    Port_src = 6,
    Port_dst = 7,
    Index = 14,
  };
  ClassificationRuleVectorTlvValue ();
  virtual uint32_t Deserialize (Buffer::Iterator start, uint64_t valueLength);
  virtual ClassificationRuleVectorTlvValue * Copy (void) const;
private:
};

// ==============================================================================
/**
 * \ingroup wimax
 */
class TosTlvValue : public TlvValue
{
public:
  TosTlvValue ();
  TosTlvValue (uint8_t, uint8_t, uint8_t);
  ~TosTlvValue ();
  virtual uint32_t GetSerializedSize (void) const;
  virtual void Serialize (Buffer::Iterator start) const;
  virtual uint32_t Deserialize (Buffer::Iterator start, uint64_t valueLength);
  uint8_t GetLow (void) const;
  uint8_t GetHigh (void) const;
  uint8_t GetMask (void) const;
  virtual TosTlvValue * Copy () const;
private:
  uint8_t m_low;
  uint8_t m_high;
  uint8_t m_mask;
};

// ==============================================================================
/**
 * \ingroup wimax
 */
class PortRangeTlvValue : public TlvValue
{
public:
  struct PortRange
  {
    uint16_t PortLow;
    uint16_t PortHigh;
  };
  typedef std::vector<struct PortRange>::const_iterator Iterator;
  PortRangeTlvValue ();
  ~PortRangeTlvValue ();
  virtual uint32_t GetSerializedSize (void) const;
  virtual void Serialize (Buffer::Iterator start) const;
  virtual uint32_t Deserialize (Buffer::Iterator start, uint64_t valueLength);
  void Add (uint16_t portLow, uint16_t portHigh);
  Iterator Begin () const;
  Iterator End () const;
  virtual PortRangeTlvValue * Copy (void) const;
private:
  std::vector<struct PortRange> * m_portRange;
};

// ==============================================================================
/**
 * \ingroup wimax
 */
class ProtocolTlvValue : public TlvValue
{
public:
  ProtocolTlvValue ();
  ~ProtocolTlvValue ();
  typedef std::vector<uint8_t>::const_iterator Iterator;
  virtual uint32_t GetSerializedSize (void) const;
  virtual void Serialize (Buffer::Iterator start) const;
  virtual uint32_t Deserialize (Buffer::Iterator start, uint64_t valueLength);
  void Add (uint8_t protiocol);
  Iterator Begin () const;
  Iterator End () const;
  virtual ProtocolTlvValue * Copy (void) const;
private:
  std::vector<uint8_t> * m_protocol;
};

// ==============================================================================

/**
 * \ingroup wimax
 */
class Ipv4AddressTlvValue : public TlvValue
{
public:
  struct ipv4Addr
  {
    Ipv4Address Address;
    Ipv4Mask Mask;
  };
  typedef std::vector<struct ipv4Addr>::const_iterator Iterator;
  Ipv4AddressTlvValue ();
  ~Ipv4AddressTlvValue ();
  virtual uint32_t GetSerializedSize (void) const;
  virtual void Serialize (Buffer::Iterator start) const;
  virtual uint32_t Deserialize (Buffer::Iterator start, uint64_t valueLength);
  void Add (Ipv4Address address, Ipv4Mask Mask);
  Iterator Begin () const;
  Iterator End () const;
  virtual Ipv4AddressTlvValue * Copy () const;
private:
  std::vector<struct ipv4Addr> * m_ipv4Addr;
};

}

#endif /* WIMAX_TLV_H */