This file is indexed.

/usr/include/ns3.27/ns3/wave-net-device.h is in libns3-dev 3.27+dfsg-1.

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
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
 * Copyright (c) 2005,2006 INRIA
 * 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
 *
 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
 *         Junling Bu <linlinjavaer@gmail.com>
 */
#ifndef WAVE_NET_DEVICE_H
#define WAVE_NET_DEVICE_H

#include <map>
#include <vector>
#include "ns3/packet.h"
#include "ns3/traced-callback.h"
#include "ns3/mac48-address.h"
#include "ns3/net-device.h"
#include "ocb-wifi-mac.h"
#include "vendor-specific-action.h"
#include "channel-coordinator.h"
#include "channel-manager.h"
#include "channel-scheduler.h"
#include "vsa-manager.h"
namespace ns3 {
struct SchInfo;
struct VsaInfo;
class NetDevice;
class ChannelScheduler;
class VsaManager;
class OcbWifiMac;

/**
 * \defgroup wave WAVE module
 */


/**
 * \ingroup wave
 *
 * \param channelNumber the specific channel
 * \param priority the priority of packet with range 0-7
 * \param dataRate the transmit data rate of packet
 * \param txPowerLevel the transmit power level with range 0-7
 * \param expireTime indicate how many milliseconds the packet
 * can stay before sent
 *
 * typically these parameters are used by higher layer to control
 * the transmission characteristics of WSMP packets.
 * When dataRate is an invalid WifiMode and txPowerLevel is 8, this
 * indicates that high layer does not set tx parameters.
 */
struct TxInfo
{
  uint32_t channelNumber; ///< channel number
  uint32_t priority; ///< priority
  WifiMode dataRate; ///< data rate
  WifiPreamble preamble; ///< preamble
  uint32_t txPowerLevel; ///< transmit power level
  // Time expiryTime;   // unsupported
  /// Initializer
  TxInfo ()
    : channelNumber (CCH),
      priority (7),
      txPowerLevel (8)
  {

  }
  /**
   * Initializer
   * \param channel the channel
   * \param prio the priority
   * \param rate the wifi mode
   * \param preamble the preamble
   * \param powerLevel the power level
   */
  TxInfo (uint32_t channel, uint32_t prio = 7, WifiMode rate = WifiMode (), WifiPreamble preamble = WIFI_PREAMBLE_NONE, uint32_t powerLevel = 8)
    : channelNumber (channel),
      priority (prio),
      dataRate (rate),
      preamble (preamble),
      txPowerLevel (powerLevel)
  {

  }
};

/**
 * \ingroup wave
 *
 * \param channelNumber the channel number for the SCH.
 * \param adaptable if true, the actual power level and data
 * rate for transmission are adaptable. TxPwr_Level is the maximum
 * transmit power that sets the upper bound for the actual transmit
 * power; DataRate is the minimum data rate that sets the lower
 * bound for the actual data rate. If false, the actual power level
 * and data rate for transmission are non-adaptable. TxPwr_Level and
 * DataRate are the actual values to be used for transmission.
 * \param txPowerLevel transmit power level.
 * \param dataRate transmit data rate
 */
struct TxProfile
{
  uint32_t channelNumber; ///< channel number
  bool adaptable; ///< adaptable
  uint32_t txPowerLevel; ///< transmit power level
  WifiMode dataRate; ///< data rate
  WifiPreamble preamble; ///< preamble
  /// Initializer
  TxProfile (void)
    : channelNumber (SCH1),
      adaptable (false),
      txPowerLevel (4),
      preamble (WIFI_PREAMBLE_LONG)
  {
      dataRate = WifiMode ("OfdmRate6MbpsBW10MHz");
  }
  /**
   * Initializer
   * \param channel the channel number
   * \param adapt true to adapt
   * \param powerLevel the power level
   */
  TxProfile (uint32_t channel, bool adapt = true, uint32_t powerLevel = 4)
    : channelNumber (channel),
      adaptable (adapt),
      txPowerLevel (powerLevel)
  {
      dataRate = WifiMode ("OfdmRate6MbpsBW10MHz");
      preamble = WIFI_PREAMBLE_LONG;
  }
};

/**
 * \ingroup wave
 *
 * This class holds together multiple, ns3::WifiPhy,
 * and ns3::OcbWifiMac (including ns3::WifiRemoteStationManager).
 * Besides that, to support multiple channel operation this
 * class also holds ns3::ChannelScheduler, ns3::ChannelManager,
 * ns3::ChannelCoordinator and ns3::VsaManager.
 *
 * these primitives specified in the standard will not be implemented
 * because of limited use in simulation:
 * void StartTimingAdvertisement ();
 * void StopTimingAdvertisement ();
 * UtcTime GetUtcTime ();
 * void SetUtcTime ();
 */
class WaveNetDevice : public NetDevice
{
public:
  /**
   * \brief Get the type ID.
   * \return the object TypeId
   */
  static TypeId GetTypeId (void);
  WaveNetDevice (void);
  virtual ~WaveNetDevice (void);

  /**
   * \param channelNumber the specific channel
   * \param mac add a new available MAC entity for specific channel
   */
  void AddMac (uint32_t channelNumber, Ptr<OcbWifiMac> mac);
  /**
   * \param channelNumber the specific channel number
   * \return corresponding MAC entity
   */
  Ptr<OcbWifiMac> GetMac (uint32_t channelNumber) const;
  /**
   * \return all inserted MAC entities.
   */
  std::map<uint32_t, Ptr<OcbWifiMac> >  GetMacs (void) const;
  /**
   * \param phy add a new available PHY entity
   */
  void AddPhy (Ptr<WifiPhy> phy);
  /**
   * \param index the index of PHY entity
   * \return corresponding PHY entity
   */
  Ptr<WifiPhy> GetPhy (uint32_t index) const;
  /**
   * \return all inserted PHY entities.
   */
  std::vector<Ptr<WifiPhy> > GetPhys (void) const;

  /**
   * \param channelScheduler the channel scheduler for multiple channel operation
   */
  void SetChannelScheduler (Ptr<ChannelScheduler> channelScheduler);
  /**
   * \return current channel scheduler for multiple channel operation
   */
  Ptr<ChannelScheduler> GetChannelScheduler (void) const;
  /**
   * \param channelManager the channel manager for multiple channel operation
   */
  void SetChannelManager (Ptr<ChannelManager> channelManager);
  /**
   * \return currentc channel manager for multiple channel operation
   */
  Ptr<ChannelManager> GetChannelManager (void) const;
  /**
   * \param channelCoordinator  the channel coordinator for multiple channel operation
   */
  void SetChannelCoordinator (Ptr<ChannelCoordinator> channelCoordinator);
  /**
   * \return current channel coordinator for multiple channel operation
   */
  Ptr<ChannelCoordinator> GetChannelCoordinator (void) const;
  /**
   * \param vsaManager the VSA manager for multiple channel operation
   */
  void SetVsaManager (Ptr<VsaManager> vsaManager);
  /**
   * \return current VSA manager for multiple channel operation
   */
  Ptr<VsaManager> GetVsaManager (void) const;

  /**
   * \param schInfo the parameters about how to start SCH service
   * \return whether channel access is assigned successfully
   */
  bool StartSch (const SchInfo & schInfo);
  /**
   *  \param channelNumber the channel which access resource will be released.
   *  \return whether channel access is released successfully
   */
  bool StopSch (uint32_t channelNumber);

  /**
   * \param vsaInfo the parameters about how to send VSA frame
   * \return whether the request for VSA transmission is completed
   */
  bool StartVsa (const VsaInfo & vsaInfo);
  /**
   * \param channelNumber the channel on which VSA transmit event will be canceled.
   * \return whether the request for stopping VSA transmission is completed
   */
  bool StopVsa (uint32_t channelNumber);
  /**
   * \param packet the packet is Vendor Specific Action frame.
   * \param address the address of the MAC from which the management frame
   *  was received.
   * \param managementID identify the originator of the data.
   *  Values are specified in IEEE P1609.0 with range 0-15.
   * \param channelNumber the channel on which the frame was received.
   * \returns true if the callback could handle the packet successfully, false
   *          otherwise.
   */
  typedef Callback<bool, Ptr<const Packet>,const Address &, uint32_t, uint32_t> WaveVsaCallback;
  /**
   * \param vsaCallback the VSA receive callback for 1609 management information
   */
  void SetWaveVsaCallback (WaveVsaCallback vsaCallback);

  /**
   * \param txprofile transmit profile for IP-based data
   * register a transmitter profile in the MLME before
   * the associated IP-based data transfer starts.
   * \return whether the tx profile is registered successfully
   *
   * note: This method should be called before WaveNetDevice::Send method
   */
  bool RegisterTxProfile (const TxProfile &txprofile);
  /**
   * \param channelNumber the specific channel number
   * delete a registered transmitter profile in the MLME
   * after the associated IP-based data transfer is complete
   * \return whether the tx profile is unregistered successfully
   */
  bool DeleteTxProfile (uint32_t channelNumber);

  /**
   * \param packet packet sent from above down to Network Device
   * \param dest mac address of the destination (already resolved)
   * \param protocol identifies the type of payload contained in the packet.
   *  Used to call the right L3Protocol when the packet is received.
   * \param txInfo WSMP or other packets parameters for sending
   * \return whether the SendX operation succeeded
   *
   * Normally this method is called by 1609.3 standard to
   * send WSMP packets, however high layers can also send packets
   * in other types except IP-based packets in CCH.
   */
  bool SendX (Ptr<Packet> packet, const Address& dest, uint32_t protocol, const TxInfo & txInfo);
  /**
   * \param newAddress  an immediate MAC-layer address change is required
   *
   * This method is similar with SetAddress method, but
   * SetAddress is suggested for initializing a device, while this method
   * is preferred for changing address and a addressChange TracedCallback
   * will be called.
   */
  void ChangeAddress (Address newAddress);
  /**
   * \param channelNumber the specific channel number
   * \param ac the specific access category
   *
   * Cancel all transmissions with the particular category and channel number.
   */
  void CancelTx (uint32_t channelNumber, enum AcIndex ac);

  /**
   * \param packet packet sent from above down to Network Device
   * \param dest mac address of the destination (already resolved)
   * \param protocolNumber identifies the type of payload contained in
   *        this packet. Used to call the right L3Protocol when the packet
   *        is received.
   * \return whether the Send operation succeeded
   *
   * Normally this method is called by 1609.3 standard to
   * send IP-based packets, however high layers can also send packets
   * in other types except IP-based packets in CCH.
   */
  virtual bool Send (Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber);

  // inherited from NetDevice base class.
  virtual void SetIfIndex (const uint32_t index);
  virtual uint32_t GetIfIndex (void) const;
  virtual Ptr<Channel> GetChannel (void) const;
  virtual void SetAddress (Address address);
  virtual Address GetAddress (void) const;
  virtual bool SetMtu (const uint16_t mtu);
  virtual uint16_t GetMtu (void) const;
  virtual bool IsLinkUp (void) const;
  virtual void AddLinkChangeCallback (Callback<void> callback);
  virtual bool IsBroadcast (void) const;
  virtual Address GetBroadcast (void) const;
  virtual bool IsMulticast (void) const;
  virtual Address GetMulticast (Ipv4Address multicastGroup) const;
  virtual bool IsPointToPoint (void) const;
  virtual bool IsBridge (void) const;
  virtual Ptr<Node> GetNode (void) const;
  virtual void SetNode (Ptr<Node> node);
  virtual bool NeedsArp (void) const;
  virtual void SetReceiveCallback (NetDevice::ReceiveCallback cb);
  virtual Address GetMulticast (Ipv6Address addr) const;
  virtual bool SendFrom (Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber);
  virtual void SetPromiscReceiveCallback (PromiscReceiveCallback cb);
  virtual bool SupportsSendFrom (void) const;

private:
  /// This value conforms to the 802.11 specification
  static const uint16_t MAX_MSDU_SIZE = 2304;

  /// IP v4 Protocol number
  static const uint16_t IPv4_PROT_NUMBER = 0x0800;
  /// IP v6 Protocol number
  static const uint16_t IPv6_PROT_NUMBER = 0x86DD;

  virtual void DoDispose (void);
  virtual void DoInitialize (void);
  /**
   * \param channelNumber the specific channel
   * \return whether this channel is valid and available for use
   */
  bool IsAvailableChannel (uint32_t channelNumber) const;
  /**
   * Receive a packet from the lower layer and pass the
   * packet up the stack.
   *
   * \param packet
   * \param from
   * \param to
   */
  void ForwardUp (Ptr<Packet> packet, Mac48Address from, Mac48Address to);

  /// MacEntities typedef
  typedef std::map<uint32_t, Ptr<OcbWifiMac> > MacEntities;
  /// MacEntities iterator typedef
  typedef std::map<uint32_t, Ptr<OcbWifiMac> >::const_iterator MacEntitiesI;
  MacEntities m_macEntities; ///< MAC entities
  /// PhyEntities typedef
  typedef std::vector<Ptr<WifiPhy> > PhyEntities; 
  /// PhyEntities iterator typedef
  typedef std::vector<Ptr<WifiPhy> >::const_iterator PhyEntitiesI;
  PhyEntities m_phyEntities; ///< Phy entities

  Ptr<ChannelManager> m_channelManager; ///< the channel manager
  Ptr<ChannelScheduler> m_channelScheduler; ///< the channel scheduler
  Ptr<ChannelCoordinator> m_channelCoordinator; ///< the channel coordinator
  Ptr<VsaManager> m_vsaManager; ///< the VSA manager 
  TxProfile *m_txProfile; ///< transmit profile
  /**
   * \todo The Address arguments should be passed
   * by const reference, since they are large.
   */
  TracedCallback<Address, Address> m_addressChange;

  // copy from WifiNetDevice
  Ptr<Node> m_node; ///< the node
  NetDevice::ReceiveCallback m_forwardUp; ///< forward up receive callback
  NetDevice::PromiscReceiveCallback m_promiscRx; ///< promiscious receive callback
  uint32_t m_ifIndex; ///< IF index
  mutable uint16_t m_mtu; ///< MTU
};

} // namespace ns3

#endif /* WAVE_NET_DEVICE_H */