This file is indexed.

/usr/include/ns3.26/ns3/uan-mac-rc-gw.h is in libns3-dev 3.26+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
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
 * Copyright (c) 2009 University of Washington
 *
 * 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: Leonard Tracy <lentracy@gmail.com>
 */

#ifndef UAN_MAC_RC_GW_H
#define UAN_MAC_RC_GW_H

#include "uan-mac.h"
#include "uan-address.h"

#include "ns3/nstime.h"
#include "ns3/traced-callback.h"




#include <set>
#include <map>

namespace ns3 {

class UanTxMode;

/**
 * \ingroup uan
 *
 * Gateway side of RC-MAC.
 *
 * This MAC protocol assumes a network topology where all traffic
 * is destined for a set of GW nodes which are connected via
 * some out of band (RF?) means.  UanMacRcGw is the protocol
 * which runs on the gateway nodes.
 *
 * This particular implementation
 * assumes that there is only a single gateway.
 *
 * For more information on class operation email
 * lentracy@u.washington.edu
 * (This work is, as of yet, unpublished)
 */
class UanMacRcGw : public UanMac
{
public:
  UanMacRcGw ();           //!< Constructor
  virtual ~UanMacRcGw ();  //!< Dummy destructor, see DoDispose.

  /**
   * Register this type.
   * \return The type ID.
   */
  static TypeId GetTypeId (void);

  // Inherited methods
  virtual Address GetAddress (void);
  virtual void SetAddress (UanAddress addr);
  virtual bool Enqueue (Ptr<Packet> pkt, const Address &dest, uint16_t protocolNumber);
  virtual void SetForwardUpCb (Callback<void, Ptr<Packet>, const UanAddress&> cb);
  virtual void AttachPhy (Ptr<UanPhy> phy);
  virtual Address GetBroadcast (void) const;
  virtual void Clear (void);
  int64_t AssignStreams (int64_t stream);

  /**
   * TracedCallback signature for
   *
   * \param [in] now, The current simulation time.
   * \param [in] delay Minimum path delay of first RTS.
   * \param [in] numRts Number of pending RTS.
   * \param [in] totalBytes Length of RTS header.
   * \param [in] secs Effective window size for RcCtsGlobal message, or
   *             time to next cycle, both in seconds.
   * \param [in] ctlRate CTL rate in Bps.
   * \param [in] actualX Current retry rate.
   */
  typedef void (* CycleCallback)
    (Time now, Time delay, uint32_t numRts, uint32_t totalBytes,
     double secs, uint32_t ctlRate, double actualX);

  
private:
  /** Gateway state. */
  enum State {
    IDLE,     //!< Initial idle state.
    INCYCLE,  //!< Cycling through nodes.
    CTSING    //!< Sending CTS.
  };
  State m_state;  //!< Gateway processing state.

  /**
   * \ingroup uan
   * Reservation request.
   */
  struct Request
  {
    uint8_t numFrames;  //!< Number of frames.
    uint8_t frameNo;    //!< Current frame number.
    uint8_t retryNo;    //!< Retry number.
    uint16_t length;    //!< Request header length.
    Time rxTime;        //!< Time request received.
  };

  /**
   * \ingroup uan
   * Packet ACK data.
   */
  struct AckData
  {
    uint8_t frameNo;    //!< Frame number being ACK'ed.
    std::set<uint8_t> rxFrames;  //!< Received frames.
    uint8_t expFrames;  //!< Expected number of frames.
  };
  /** Forwarding up callback. */
  Callback<void, Ptr<Packet>, const UanAddress& > m_forwardUpCb;
  
  Ptr<UanPhy> m_phy;            //!< PHY layer attached to this MAC.
  UanAddress m_address;         //!< The MAC address.
  Time m_maxDelta;              //!< Maximum propagation delay between gateway and non-gateway nodes .
  Time m_sifs;                  //!< Spacing between frames to account for timing error and processing delay.
  uint32_t m_maxRes;            //!< Maximum number of reservations to accept per cycle.
  uint32_t m_numRates;          //!< Number of rates per Phy layer.
  uint32_t m_rtsSize;           //!< Size of UanHeaderCommon and UanHeaderRcRts.
  uint32_t m_ctsSizeN;          //!< Size of UanHeaderRcCts.
  uint32_t m_ctsSizeG;          //!< Size of UanHeaderCommon and UanHeaderRcCtsGlobal.
  uint32_t m_ackSize;           //!< Size of UanHeaderCommon and UanHeaderRcAck.
  uint16_t m_currentRetryRate;  //!< Retry rate number for current cycle.
  uint32_t m_currentRateNum;    //!< Rate number corresponding to data rate of current cycle.
  uint32_t m_numNodes;          //!< Number of non-gateway nodes in this gateway's neighborhood.
  uint32_t m_totalRate;         //!< Total available channel rate in bps (for a single channel, without splitting reservation channel).
  uint32_t m_rateStep;          //!< Increments available for rate assignment in bps.
  uint32_t m_frameSize;         //!< Size of data frames in bytes.

  double m_minRetryRate;        //!< Smallest allowed RTS retry rate.
  double m_retryStep;           //!< Retry rate increment.

  /** Propagation delay to each node. */
  std::map<UanAddress, Time> m_propDelay;

  /** AckData for each node. */
  std::map<UanAddress, AckData> m_ackData;

  /** Request for each node. */
  std::map<UanAddress, Request> m_requests;
  /** Queued request times. */
  std::set<std::pair<Time, UanAddress> > m_sortedRes;

  /** Flag when we've been cleared. */
  bool m_cleared;

  /** A packet was destined for and received at this MAC layer. */
  TracedCallback<Ptr<const Packet>, UanTxMode > m_rxLogger;

  /**
   * A packet was destined for and received at this MAC layer.
   *
   * \pname{Start time}
   * \pname{min propagation delay}
   * \pname{reservations}
   * \pname{frames}
   * \pname{bytes}
   * \pname{window size}
   * \pname{CTS rate}
   * \pname{retry rate}
   */
  TracedCallback<Time, Time, uint32_t, uint32_t, double, uint32_t, double> m_cycleLogger;

  /**
   * PHY recieve ok callback.
   *
   * \param pkt The Packet to receive
   * \param sinr The SINR on the channel
   * \param mode The transmission mode
   */
  void ReceivePacket (Ptr<Packet> pkt, double sinr, UanTxMode mode);

  /** Cycle through pending requests. */
  void StartCycle (void);
  /** End cycle by scheduling pending ACKs. */
  void EndCycle (void);
  /**
   * Send packet on PHY.
   *
   * \param pkt The Packet.
   * \param rate The UanTxMode number, m_currentRateNum.
   */
  void SendPacket (Ptr<Packet> pkt, uint32_t rate);
  /** Set state to INCYCLE. */
  void CycleStarted (void);
  /**
   * PHY receive error callback.
   *
   * \param pkt The failed packet.
   * \param sinr The SINR value on the channel.
   */
  void ReceiveError (Ptr<Packet> pkt, double sinr);

  // Stuff for computing exp throughput
  /**
   * Compute alpha parameter.
   *
   * \param totalFrames Total number of frames in m_requests.
   * \param totalBytes Total number of bytes in m_requests.
   * \param n Number of nodes.
   * \param a m_maxRes, or optimal A value.
   * \param deltaK Propagation delay.
   * \return Alpha parameter.
   */
   double ComputeAlpha (uint32_t totalFrames, uint32_t totalBytes, uint32_t n, uint32_t a, double deltaK);
  /**
   * Get the expected propagation delay to each node.
   *
   * \return Vector of expected propagation delays.
   */
  std::vector<double>  GetExpPdk (void);
  /**
   * Throughput for \pname{a} reservations with framesize \pname{ld},
   * given expected delays exppdk.
   *
   * \param a Number of reservations.
   * \param ld Frame size.
   * \param exppdk Expected delays, given by GetExpPdk.
   * \return Expected throughput.
   */
  double ComputeExpS (uint32_t a, uint32_t ld, std::vector<double> exppdk);
  /**
   * Throughput for \pname{a} reservations with framesize \pname{ld}.
   *
   * \param a Number of reservations.
   * \param ld Frame size.
   * \return Expected throughput.
   */
  double ComputeExpS (uint32_t a, uint32_t ld);
  /**
   * Index to the k'th expected delay among n nodes.
   *
   * \param n Number of nodes.
   * \param k Target index.
   * \return The expected index.
   */
  uint32_t CompExpMinIndex (uint32_t n, uint32_t k);
  /**
   * Numeric function.
   *
   * \param a Number of reservations.
   * \param n number of nodes.
   * \param k K'th node.
   * \return Value.
   */
  double ComputePiK (uint32_t a, uint32_t n, uint32_t k);
  /**
   * Numeric function.
   *
   * \param n Number of nodes.
   * \param a Number of reservations.
   * \param ldlh Sum of common header length and frame size.
   * \param deltaK Result of GetExpPdk
   * \return value.
   */
  double ComputeExpBOverA (uint32_t n, uint32_t a, uint32_t ldlh, std::vector<double> deltaK);
  /**
   * Binomial coefficient.
   *
   * \param n Pool size.
   * \param k Selection size.
   * \return Binomial coefficient n choose k.
   */
  uint64_t NchooseK (uint32_t n, uint32_t k);
  /**
   * Compute the optimum maximum number of reservations to accept per cycle.
   *
   * \return Optimum number.
   */
  uint32_t FindOptA (void);
protected:
  virtual void DoDispose ();

};  // class UanMacRcGw

} // namespace ns3

#endif /* UAN_MAC_RC_GW_H */