View | Details | Raw Unified | Return to bug 938
Collapse All | Expand All

(-)a/src/network/helper/application-container.h (-1 / +2 lines)
 Lines 64-69    Link Here 
64
   */
64
   */
65
  ApplicationContainer (std::string name);
65
  ApplicationContainer (std::string name);
66
66
67
  /// Application container iterator
67
  typedef std::vector<Ptr<Application> >::const_iterator Iterator;
68
  typedef std::vector<Ptr<Application> >::const_iterator Iterator;
68
69
69
  /**
70
  /**
 Lines 209-215    Link Here 
209
  void Stop (Time stop);
210
  void Stop (Time stop);
210
211
211
private:
212
private:
212
  std::vector<Ptr<Application> > m_applications;
213
  std::vector<Ptr<Application> > m_applications; //!< Applications smart pointers
213
};
214
};
214
215
215
} // namespace ns3
216
} // namespace ns3
(-)a/src/network/helper/delay-jitter-estimation.cc (-1 / +15 lines)
 Lines 25-34    Link Here 
25
25
26
namespace ns3 {
26
namespace ns3 {
27
27
28
/**
29
 * Tag to perform Delay and Jitter estimations
30
 *
31
 * The tag holds the packet's creation timestamp
32
 */
28
class DelayJitterEstimationTimestampTag : public Tag
33
class DelayJitterEstimationTimestampTag : public Tag
29
{
34
{
30
public:
35
public:
31
  DelayJitterEstimationTimestampTag ();
36
  DelayJitterEstimationTimestampTag ();
37
38
  /**
39
   * \brief Get the type ID.
40
   * \return the object TypeId
41
   */
32
  static TypeId GetTypeId (void);
42
  static TypeId GetTypeId (void);
33
  virtual TypeId GetInstanceTypeId (void) const;
43
  virtual TypeId GetInstanceTypeId (void) const;
34
44
 Lines 37-45    Link Here 
37
  virtual void Deserialize (TagBuffer i);
47
  virtual void Deserialize (TagBuffer i);
38
  virtual void Print (std::ostream &os) const;
48
  virtual void Print (std::ostream &os) const;
39
49
50
  /**
51
   * \brief Get the Transmission time stored in the tag
52
   * \return the transmission time
53
   */
40
  Time GetTxTime (void) const;
54
  Time GetTxTime (void) const;
41
private:
55
private:
42
  uint64_t m_creationTime;
56
  uint64_t m_creationTime; //!< The time stored in the tag
43
};
57
};
44
58
45
DelayJitterEstimationTimestampTag::DelayJitterEstimationTimestampTag ()
59
DelayJitterEstimationTimestampTag::DelayJitterEstimationTimestampTag ()
(-)a/src/network/helper/delay-jitter-estimation.h (-4 / +4 lines)
 Lines 69-78    Link Here 
69
  uint64_t GetLastJitter (void) const;
69
  uint64_t GetLastJitter (void) const;
70
70
71
private:
71
private:
72
  Time m_previousRx;
72
  Time m_previousRx;   //!< Previous Rx time
73
  Time m_previousRxTx;
73
  Time m_previousRxTx; //!< Previous Rx or Tx time
74
  int64x64_t m_jitter;
74
  int64x64_t m_jitter; //!< Jitter estimation
75
  Time m_delay;
75
  Time m_delay;        //!< Delay estimation
76
};
76
};
77
77
78
} // namespace ns3
78
} // namespace ns3
(-)a/src/network/helper/net-device-container.h (-1 / +2 lines)
 Lines 41-46    Link Here 
41
class NetDeviceContainer
41
class NetDeviceContainer
42
{
42
{
43
public:
43
public:
44
  /// NetDevice container iterator
44
  typedef std::vector<Ptr<NetDevice> >::const_iterator Iterator;
45
  typedef std::vector<Ptr<NetDevice> >::const_iterator Iterator;
45
46
46
  /**
47
  /**
 Lines 195-201    Link Here 
195
  void Add (std::string deviceName);
196
  void Add (std::string deviceName);
196
197
197
private:
198
private:
198
  std::vector<Ptr<NetDevice> > m_devices;
199
  std::vector<Ptr<NetDevice> > m_devices; //!< NetDevices smart pointers
199
};
200
};
200
201
201
} // namespace ns3
202
} // namespace ns3
(-)a/src/network/helper/node-container.h (-1 / +2 lines)
 Lines 38-43    Link Here 
38
class NodeContainer
38
class NodeContainer
39
{
39
{
40
public:
40
public:
41
  /// Node container iterator
41
  typedef std::vector<Ptr<Node> >::const_iterator Iterator;
42
  typedef std::vector<Ptr<Node> >::const_iterator Iterator;
42
43
43
  /**
44
  /**
 Lines 288-294    Link Here 
288
  static NodeContainer GetGlobal (void);
289
  static NodeContainer GetGlobal (void);
289
290
290
private:
291
private:
291
  std::vector<Ptr<Node> > m_nodes;
292
  std::vector<Ptr<Node> > m_nodes; //!< Nodes smart pointers
292
};
293
};
293
294
294
} // namespace ns3
295
} // namespace ns3
(-)a/src/network/helper/trace-helper.h (-6 / +185 lines)
 Lines 71-76    Link Here 
71
   * @param prefix prefix string
71
   * @param prefix prefix string
72
   * @param device NetDevice
72
   * @param device NetDevice
73
   * @param useObjectNames use node and device names instead of indexes
73
   * @param useObjectNames use node and device names instead of indexes
74
   * @returns file name
74
   */
75
   */
75
  std::string GetFilenameFromDevice (std::string prefix, Ptr<NetDevice> device, bool useObjectNames = true);
76
  std::string GetFilenameFromDevice (std::string prefix, Ptr<NetDevice> device, bool useObjectNames = true);
76
77
 Lines 82-87    Link Here 
82
   * @param object interface (such as Ipv4Interface or Ipv6Interface)
83
   * @param object interface (such as Ipv4Interface or Ipv6Interface)
83
   * @param interface interface id
84
   * @param interface interface id
84
   * @param useObjectNames use node and device names instead of indexes
85
   * @param useObjectNames use node and device names instead of indexes
86
   * @returns file name
85
   */
87
   */
86
  std::string GetFilenameFromInterfacePair (std::string prefix, Ptr<Object> object, 
88
  std::string GetFilenameFromInterfacePair (std::string prefix, Ptr<Object> object, 
87
                                            uint32_t interface, bool useObjectNames = true);
89
                                            uint32_t interface, bool useObjectNames = true);
 Lines 94-99    Link Here 
94
   * @param dataLinkType data link type of packet data
96
   * @param dataLinkType data link type of packet data
95
   * @param snapLen maximum length of packet data stored in records
97
   * @param snapLen maximum length of packet data stored in records
96
   * @param tzCorrection time zone correction to be applied to timestamps of packets
98
   * @param tzCorrection time zone correction to be applied to timestamps of packets
99
   * @returns a smart pointer to the Pcap file
97
   */
100
   */
98
  Ptr<PcapFileWrapper> CreateFile (std::string filename, std::ios::openmode filemode,
101
  Ptr<PcapFileWrapper> CreateFile (std::string filename, std::ios::openmode filemode,
99
                                   uint32_t dataLinkType,  uint32_t snapLen = 65535, int32_t tzCorrection = 0);
102
                                   uint32_t dataLinkType,  uint32_t snapLen = 65535, int32_t tzCorrection = 0);
 Lines 107-112    Link Here 
107
  template <typename T> void HookDefaultSink (Ptr<T> object, std::string traceName, Ptr<PcapFileWrapper> file);
110
  template <typename T> void HookDefaultSink (Ptr<T> object, std::string traceName, Ptr<PcapFileWrapper> file);
108
111
109
private:
112
private:
113
  /**
114
   * The basic default trace sink.
115
   *
116
   * This one just writes the packet to the pcap
117
   * file which is good enough for most kinds of captures.
118
   *
119
   * @param file the file to write to
120
   * @param p the packet to write
121
   */
110
  static void DefaultSink (Ptr<PcapFileWrapper> file, Ptr<const Packet> p);
122
  static void DefaultSink (Ptr<PcapFileWrapper> file, Ptr<const Packet> p);
111
};
123
};
112
124
 Lines 145-150    Link Here 
145
   * @param prefix prefix string
157
   * @param prefix prefix string
146
   * @param device NetDevice
158
   * @param device NetDevice
147
   * @param useObjectNames use node and device names instead of indexes
159
   * @param useObjectNames use node and device names instead of indexes
160
   * @returns file name
148
   */
161
   */
149
  std::string GetFilenameFromDevice (std::string prefix, Ptr<NetDevice> device, bool useObjectNames = true);
162
  std::string GetFilenameFromDevice (std::string prefix, Ptr<NetDevice> device, bool useObjectNames = true);
150
163
 Lines 156-161    Link Here 
156
   * @param object interface (such as Ipv4Interface or Ipv6Interface)
169
   * @param object interface (such as Ipv4Interface or Ipv6Interface)
157
   * @param interface interface id
170
   * @param interface interface id
158
   * @param useObjectNames use node and device names instead of indexes
171
   * @param useObjectNames use node and device names instead of indexes
172
   * @returns file name
159
   */
173
   */
160
  std::string GetFilenameFromInterfacePair (std::string prefix, Ptr<Object> object, 
174
  std::string GetFilenameFromInterfacePair (std::string prefix, Ptr<Object> object, 
161
                                            uint32_t interface, bool useObjectNames = true);
175
                                            uint32_t interface, bool useObjectNames = true);
 Lines 182-187    Link Here 
182
   * 
196
   * 
183
   * @param filename file name
197
   * @param filename file name
184
   * @param filemode file mode
198
   * @param filemode file mode
199
   * @returns a smart pointer to the output stream
185
   */
200
   */
186
  Ptr<OutputStreamWrapper> CreateFileStream (std::string filename, 
201
  Ptr<OutputStreamWrapper> CreateFileStream (std::string filename, 
187
                                             std::ios::openmode filemode = std::ios::out);
202
                                             std::ios::openmode filemode = std::ios::out);
 Lines 282-297    Link Here 
282
  void HookDefaultReceiveSinkWithContext (Ptr<T> object, 
297
  void HookDefaultReceiveSinkWithContext (Ptr<T> object, 
283
                                          std::string context, std::string traceName, Ptr<OutputStreamWrapper> stream);
298
                                          std::string context, std::string traceName, Ptr<OutputStreamWrapper> stream);
284
299
300
  /**
301
   * @brief Basic Enqueue default trace sink.
302
   *
303
   * When a packet has been sent to a device for transmission, the device is
304
   * expected to place the packet onto a transmit queue even if it does not
305
   * have to delay the packet at all, if only to trigger this event.  This
306
   * event will eventually translate into a '+' operation in the trace file.
307
   *
308
   * This is typically implemented by hooking the "TxQueue/Enqueue" trace hook
309
   * in the device (actually the Queue in the device).
310
   *
311
   * @param file the output file
312
   * @param p the packet
313
   */
285
  static void DefaultEnqueueSinkWithoutContext (Ptr<OutputStreamWrapper> file, Ptr<const Packet> p);
314
  static void DefaultEnqueueSinkWithoutContext (Ptr<OutputStreamWrapper> file, Ptr<const Packet> p);
315
316
  /**
317
   * @brief Basic Enqueue default trace sink.
318
   *
319
   * When a packet has been sent to a device for transmission, the device is
320
   * expected to place the packet onto a transmit queue even if it does not
321
   * have to delay the packet at all, if only to trigger this event.  This
322
   * event will eventually translate into a '+' operation in the trace file.
323
   *
324
   * This is typically implemented by hooking the "TxQueue/Enqueue" trace hook
325
   * in the device (actually the Queue in the device).
326
   *
327
   * @param file the output file
328
   * @param context the context
329
   * @param p the packet
330
   */
286
  static void DefaultEnqueueSinkWithContext (Ptr<OutputStreamWrapper> file, std::string context, Ptr<const Packet> p);
331
  static void DefaultEnqueueSinkWithContext (Ptr<OutputStreamWrapper> file, std::string context, Ptr<const Packet> p);
287
332
333
  /**
334
   * @brief Basic Drop default trace sink.
335
   *
336
   * When a packet has been sent to a device for transmission, the device is
337
   * expected to place the packet onto a transmit queue.  If this queue is
338
   * full the packet will be dropped.  The device is expected to trigger an
339
   * event to indicate that an outbound packet is being dropped.  This event
340
   * will eventually translate into a 'd' operation in the trace file.
341
   *
342
   * This is typically implemented by hooking the "TxQueue/Drop" trace hook
343
   * in the device (actually the Queue in the device).
344
   *
345
   * @param file the output file
346
   * @param p the packet
347
   */
288
  static void DefaultDropSinkWithoutContext (Ptr<OutputStreamWrapper> file, Ptr<const Packet> p);
348
  static void DefaultDropSinkWithoutContext (Ptr<OutputStreamWrapper> file, Ptr<const Packet> p);
349
350
  /**
351
   * @brief Basic Drop default trace sink.
352
   *
353
   * When a packet has been sent to a device for transmission, the device is
354
   * expected to place the packet onto a transmit queue.  If this queue is
355
   * full the packet will be dropped.  The device is expected to trigger an
356
   * event to indicate that an outbound packet is being dropped.  This event
357
   * will eventually translate into a 'd' operation in the trace file.
358
   *
359
   * This is typically implemented by hooking the "TxQueue/Drop" trace hook
360
   * in the device (actually the Queue in the device).
361
   *
362
   * @param file the output file
363
   * @param context the context
364
   * @param p the packet
365
   */
289
  static void DefaultDropSinkWithContext (Ptr<OutputStreamWrapper> file, std::string context, Ptr<const Packet> p);
366
  static void DefaultDropSinkWithContext (Ptr<OutputStreamWrapper> file, std::string context, Ptr<const Packet> p);
290
367
368
  /**
369
   * @brief Basic Dequeue default trace sink.
370
   *
371
   * When a packet has been sent to a device for transmission, the device is
372
   * expected to place the packet onto a transmit queue even if it does not
373
   * have to delay the packet at all.  The device removes the packet from the
374
   * transmit queue when the packet is ready to send, and this dequeue will
375
   * fire a corresponding event.  This event will eventually translate into a
376
   * '-' operation in the trace file.
377
   *
378
   * This is typically implemented by hooking the "TxQueue/Dequeue" trace hook
379
   * in the device (actually the Queue in the device).
380
   *
381
   * @param file the output file
382
   * @param p the packet
383
   */
291
  static void DefaultDequeueSinkWithoutContext (Ptr<OutputStreamWrapper> file, Ptr<const Packet> p);
384
  static void DefaultDequeueSinkWithoutContext (Ptr<OutputStreamWrapper> file, Ptr<const Packet> p);
385
386
  /**
387
   * @brief Basic Dequeue default trace sink.
388
   *
389
   * When a packet has been sent to a device for transmission, the device is
390
   * expected to place the packet onto a transmit queue even if it does not
391
   * have to delay the packet at all.  The device removes the packet from the
392
   * transmit queue when the packet is ready to send, and this dequeue will
393
   * fire a corresponding event.  This event will eventually translate into a
394
   * '-' operation in the trace file.
395
   *
396
   * This is typically implemented by hooking the "TxQueue/Dequeue" trace hook
397
   * in the device (actually the Queue in the device).
398
   *
399
   * @param file the output file
400
   * @param context the context
401
   * @param p the packet
402
   */
292
  static void DefaultDequeueSinkWithContext (Ptr<OutputStreamWrapper> file, std::string context, Ptr<const Packet> p);
403
  static void DefaultDequeueSinkWithContext (Ptr<OutputStreamWrapper> file, std::string context, Ptr<const Packet> p);
293
404
405
  /**
406
   * @brief Basic Receive default trace sink.
407
   *
408
   * When a packet is received by a device for transmission, the device is
409
   * expected to trigger this event to indicate the reception has occurred.
410
   * This event will eventually translate into an 'r' operation in the trace
411
   * file.
412
   *
413
   * This is typically implemented by hooking the "MacRx" trace hook in the
414
   * device.
415
   *
416
   * @param file the output file
417
   * @param p the packet
418
   */
294
  static void DefaultReceiveSinkWithoutContext (Ptr<OutputStreamWrapper> file, Ptr<const Packet> p);
419
  static void DefaultReceiveSinkWithoutContext (Ptr<OutputStreamWrapper> file, Ptr<const Packet> p);
420
421
  /**
422
   * @brief Basic Receive default trace sink.
423
   *
424
   * When a packet is received by a device for transmission, the device is
425
   * expected to trigger this event to indicate the reception has occurred.
426
   * This event will eventually translate into an 'r' operation in the trace
427
   * file.
428
   *
429
   * This is typically implemented by hooking the "MacRx" trace hook in the
430
   * device.
431
   *
432
   * @param file the output file
433
   * @param context the context
434
   * @param p the packet
435
   */
295
  static void DefaultReceiveSinkWithContext (Ptr<OutputStreamWrapper> file, std::string context, Ptr<const Packet> p);
436
  static void DefaultReceiveSinkWithContext (Ptr<OutputStreamWrapper> file, std::string context, Ptr<const Packet> p);
296
};
437
};
297
438
 Lines 562-568    Link Here 
562
   * of the appropriate type.
703
   * of the appropriate type.
563
   *
704
   *
564
   * @param prefix Filename prefix to use for ascii files.
705
   * @param prefix Filename prefix to use for ascii files.
565
   * @param d container of devices of type ns3::CsmaNetDevice
706
   * @param d container of devices
566
   */
707
   */
567
  void EnableAscii (std::string prefix, NetDeviceContainer d);
708
  void EnableAscii (std::string prefix, NetDeviceContainer d);
568
709
 Lines 572-578    Link Here 
572
   *
713
   *
573
   * @param stream An OutputStreamWrapper representing an existing file to use
714
   * @param stream An OutputStreamWrapper representing an existing file to use
574
   *               when writing trace data.
715
   *               when writing trace data.
575
   * @param d container of devices of type ns3::CsmaNetDevice
716
   * @param d container of devices
576
   */
717
   */
577
  void EnableAscii (Ptr<OutputStreamWrapper> stream, NetDeviceContainer d);
718
  void EnableAscii (Ptr<OutputStreamWrapper> stream, NetDeviceContainer d);
578
719
 Lines 640-645    Link Here 
640
781
641
private:
782
private:
642
  /**
783
  /**
784
   * @brief Enable ascii trace output on the device specified by a global
785
   * node-id (of a previously created node) and associated device-id (implementation)
786
   *
787
   * @param stream An OutputStreamWrapper representing an existing file to use
788
   *               when writing trace data.
789
   * @param prefix Filename prefix to use for ascii trace files.
790
   * @param nodeid The node identifier/number of the node on which to enable
791
   *               ascii tracing
792
   * @param deviceid The device identifier/index of the device on which to enable
793
   *               ascii tracing
794
   * @param explicitFilename Treat the prefix as an explicit filename if true
795
   */
796
  /**
643
   * @internal Avoid code duplication.
797
   * @internal Avoid code duplication.
644
   */
798
   */
645
  void EnableAsciiImpl (Ptr<OutputStreamWrapper> stream, 
799
  void EnableAsciiImpl (Ptr<OutputStreamWrapper> stream, 
 Lines 649-670    Link Here 
649
                        bool explicitFilename);
803
                        bool explicitFilename);
650
804
651
  /**
805
  /**
652
   * @internal Avoid code duplication.
806
   * @brief Enable ascii trace output on each device (which is of the
807
   * appropriate type) in the nodes provided in the container (implementation).
808
   *
809
   * @param stream An OutputStreamWrapper representing an existing file to use
810
   *               when writing trace data.
811
   * @param prefix Filename prefix to use for ascii files.
812
   * @param n container of nodes.
653
   */
813
   */
654
  void EnableAsciiImpl (Ptr<OutputStreamWrapper> stream, std::string prefix, NodeContainer n);
814
  void EnableAsciiImpl (Ptr<OutputStreamWrapper> stream, std::string prefix, NodeContainer n);
655
815
656
  /**
816
  /**
657
   * @internal Avoid code duplication.
817
   * @brief Enable ascii trace output on each device in the container which is
818
   * of the appropriate type (implementation).
819
   *
820
   * @param stream An OutputStreamWrapper representing an existing file to use
821
   *               when writing trace data.
822
   * @param prefix Filename prefix to use for ascii files.
823
   * @param d container of devices
658
   */
824
   */
659
  void EnableAsciiImpl (Ptr<OutputStreamWrapper> stream, std::string prefix, NetDeviceContainer d);
825
  void EnableAsciiImpl (Ptr<OutputStreamWrapper> stream, std::string prefix, NetDeviceContainer d);
660
826
661
  /**
827
  /**
662
   * @internal Avoid code duplication.
828
   * @brief Enable ascii trace output the indicated net device using a device
829
   * previously named using the ns-3 object name service (implementation).
830
   *
831
   * @param stream An OutputStreamWrapper representing an existing file to use
832
   *               when writing trace data.
833
   * @param prefix filename prefix to use for ascii files.
834
   * @param ndName The name of the net device in which you want to enable tracing.
835
   * @param explicitFilename Treat the prefix as an explicit filename if true
663
   */
836
   */
664
  void EnableAsciiImpl (Ptr<OutputStreamWrapper> stream, std::string prefix, std::string ndName, bool explicitFilename);
837
  void EnableAsciiImpl (Ptr<OutputStreamWrapper> stream, std::string prefix, std::string ndName, bool explicitFilename);
665
838
666
  /**
839
  /**
667
   * @internal Avoid code duplication.
840
   * @brief Enable ascii trace output the indicated net device (implementation).
841
   *
842
   * @param stream An OutputStreamWrapper representing an existing file to use
843
   *               when writing trace data.
844
   * @param prefix filename prefix to use for ascii files.
845
   * @param nd Net device for which you want to enable tracing
846
   * @param explicitFilename Treat the prefix as an explicit filename if true
668
   */
847
   */
669
  void EnableAsciiImpl (Ptr<OutputStreamWrapper> stream, std::string prefix, Ptr<NetDevice> nd, bool explicitFilename);
848
  void EnableAsciiImpl (Ptr<OutputStreamWrapper> stream, std::string prefix, Ptr<NetDevice> nd, bool explicitFilename);
670
};
849
};
(-)a/src/network/model/address.cc (-5 / +8 lines)
 Lines 169-175    Link Here 
169
  buffer.Read (m_data, m_len);
169
  buffer.Read (m_data, m_len);
170
}
170
}
171
171
172
ATTRIBUTE_HELPER_CPP (Address);   /// Macro to make help make class an ns-3 attribute
172
ATTRIBUTE_HELPER_CPP (Address);   //!< Macro to make help make class an ns-3 attribute
173
173
174
174
175
bool operator == (const Address &a, const Address &b)
175
bool operator == (const Address &a, const Address &b)
 Lines 248-261    Link Here 
248
  return os;
248
  return os;
249
}
249
}
250
250
251
/**
252
 * \brief Converts a string representing an hex number [0x0, 0xFF] into its value.
253
 *
254
 * \param v a string
255
 * \returns the value
256
 */
251
static uint8_t
257
static uint8_t
252
AsInt (std::string v)
258
AsInt (std::string v)
253
{
259
{
254
  NS_LOG_FUNCTION_NOARGS ();
260
  NS_LOG_FUNCTION_NOARGS ();
255
  std::istringstream iss;
261
  uint8_t retval = strtoul (v.c_str(), 0, 16);
256
  iss.str (v);
257
  uint8_t retval;
258
  iss >> std::hex >> retval >> std::dec;
259
  return retval;
262
  return retval;
260
}
263
}
261
264
(-)a/src/network/model/address.h (-9 / +61 lines)
 Lines 99-117    Link Here 
99
   */
99
   */
100
  Address ();
100
  Address ();
101
  /**
101
  /**
102
   * \brief Create an address from a type and a buffer.
103
   *
104
   * This constructor is typically invoked from the conversion
105
   * functions of various address types when they have to
106
   * convert themselves to an Address instance.
107
   *
102
   * \param type the type of the Address to create
108
   * \param type the type of the Address to create
103
   * \param buffer a pointer to a buffer of bytes which hold
109
   * \param buffer a pointer to a buffer of bytes which hold
104
   *        a serialized representation of the address in network
110
   *        a serialized representation of the address in network
105
   *        byte order.
111
   *        byte order.
106
   * \param len the length of the buffer.
112
   * \param len the length of the buffer.
107
   * 
108
   * Create an address from a type and a buffer. This constructor
109
   * is typically invoked from the conversion functions of various
110
   * address types when they have to convert themselves to an 
111
   * Address instance.
112
   */
113
   */
113
  Address (uint8_t type, const uint8_t *buffer, uint8_t len);
114
  Address (uint8_t type, const uint8_t *buffer, uint8_t len);
115
  /**
116
   * \brief Create an address from another address.
117
   * \param address the address to copy
118
   */
114
  Address (const Address & address);
119
  Address (const Address & address);
120
  /**
121
   * \brief Basic assignment operator.
122
   * \param address the address to copy
123
   * \returns the address
124
   */
115
  Address &operator = (const Address &address);
125
  Address &operator = (const Address &address);
116
126
117
  /**
127
  /**
 Lines 123-132    Link Here 
123
   */
133
   */
124
  bool IsInvalid (void) const;
134
  bool IsInvalid (void) const;
125
  /**
135
  /**
136
   * \brief Get the length of the underlying address.
126
   * \returns the length of the underlying address.
137
   * \returns the length of the underlying address.
127
   */
138
   */
128
  uint8_t GetLength (void) const;
139
  uint8_t GetLength (void) const;
129
  /**
140
  /**
141
   * \brief Copy the address bytes into a buffer.
130
   * \param buffer buffer to copy the address bytes to.
142
   * \param buffer buffer to copy the address bytes to.
131
   * \returns the number of bytes copied.
143
   * \returns the number of bytes copied.
132
   */
144
   */
 Lines 209-222    Link Here 
209
  void Deserialize (TagBuffer buffer);
221
  void Deserialize (TagBuffer buffer);
210
222
211
private:
223
private:
224
  /**
225
   * \brief Equal to operator.
226
   *
227
   * \param a the first operand
228
   * \param b the first operand
229
   * \returns true if the operands are equal
230
   */
212
  friend bool operator == (const Address &a, const Address &b);
231
  friend bool operator == (const Address &a, const Address &b);
232
233
  /**
234
   * \brief Not equal to operator.
235
   *
236
   * \param a the first operand
237
   * \param b the first operand
238
   * \returns true if the operands are not equal
239
   */
240
  friend bool operator != (const Address &a, const Address &b);
241
242
  /**
243
   * \brief Less than operator.
244
   *
245
   * \param a the first operand
246
   * \param b the first operand
247
   * \returns true if the operand a is less than operand b
248
   */
213
  friend bool operator < (const Address &a, const Address &b);
249
  friend bool operator < (const Address &a, const Address &b);
250
251
  /**
252
   * \brief Stream insertion operator.
253
   *
254
   * \param os the stream
255
   * \param address the address
256
   * \returns a reference to the stream
257
   */
214
  friend std::ostream& operator<< (std::ostream& os, const Address & address);
258
  friend std::ostream& operator<< (std::ostream& os, const Address & address);
259
260
  /**
261
   * \brief Stream extraction operator.
262
   *
263
   * \param is the stream
264
   * \param address the address
265
   * \returns a reference to the stream
266
   */
215
  friend std::istream& operator>> (std::istream& is, Address & address);
267
  friend std::istream& operator>> (std::istream& is, Address & address);
216
268
217
  uint8_t m_type;
269
  uint8_t m_type; //!< Type of the address
218
  uint8_t m_len;
270
  uint8_t m_len;  //!< Length of the address
219
  uint8_t m_data[MAX_SIZE];
271
  uint8_t m_data[MAX_SIZE]; //!< The address value
220
};
272
};
221
273
222
/**
274
/**
 Lines 224-230    Link Here 
224
 * \brief hold objects of type ns3::Address
276
 * \brief hold objects of type ns3::Address
225
 */
277
 */
226
278
227
ATTRIBUTE_HELPER_HEADER (Address);  /// Macro to make help make class an ns-3 attribute
279
ATTRIBUTE_HELPER_HEADER (Address);  //!< Macro to make help make class an ns-3 attribute
228
280
229
bool operator == (const Address &a, const Address &b);
281
bool operator == (const Address &a, const Address &b);
230
bool operator != (const Address &a, const Address &b);
282
bool operator != (const Address &a, const Address &b);
(-)a/src/network/model/application.h (-5 / +9 lines)
 Lines 61-66    Link Here 
61
class Application : public Object
61
class Application : public Object
62
{
62
{
63
public:
63
public:
64
  /**
65
   * \brief Get the type ID.
66
   * \return the object TypeId
67
   */
64
  static TypeId GetTypeId (void);
68
  static TypeId GetTypeId (void);
65
  Application ();
69
  Application ();
66
  virtual ~Application ();
70
  virtual ~Application ();
 Lines 123-133    Link Here 
123
  virtual void DoDispose (void);
127
  virtual void DoDispose (void);
124
  virtual void DoInitialize (void);
128
  virtual void DoInitialize (void);
125
129
126
  Ptr<Node>       m_node;   /// The node that this application is installed on
130
  Ptr<Node>       m_node;   //!< The node that this application is installed on
127
  Time m_startTime;         /// The simulation time that the appliacation will start
131
  Time m_startTime;         //!< The simulation time that the application will start
128
  Time m_stopTime;          /// The simulation time that the appliacation will end
132
  Time m_stopTime;          //!< The simulation time that the application will end
129
  EventId m_startEvent;     /// The event that will fire at m_startTime to start the application
133
  EventId m_startEvent;     //!< The event that will fire at m_startTime to start the application
130
  EventId m_stopEvent;      /// The event that will fire at m_stopTime to end the application
134
  EventId m_stopEvent;      //!< The event that will fire at m_stopTime to end the application
131
};
135
};
132
136
133
} // namespace ns3
137
} // namespace ns3
(-)a/src/network/model/buffer.cc (-3 / +7 lines)
 Lines 30-35    Link Here 
30
30
31
namespace {
31
namespace {
32
32
33
/**
34
 * \ingroup packet
35
 * \brief Zero-filled buffer.
36
 */
33
static struct Zeroes
37
static struct Zeroes
34
{
38
{
35
  Zeroes ()
39
  Zeroes ()
 Lines 37-45    Link Here 
37
  {
41
  {
38
    memset (buffer, 0, size);
42
    memset (buffer, 0, size);
39
  }
43
  }
40
  char buffer[1000];
44
  char buffer[1000];    //!< buffer containing zero values
41
  const uint32_t size;
45
  const uint32_t size;  //!< buffer size
42
} g_zeroes;
46
} g_zeroes; //!< Zero-filled buffer
43
47
44
}
48
}
45
49
(-)a/src/network/model/buffer.h (-25 / +194 lines)
 Lines 25-31    Link Here 
25
#include <ostream>
25
#include <ostream>
26
#include "ns3/assert.h"
26
#include "ns3/assert.h"
27
27
28
#define noBUFFER_FREE_LIST 1
28
#define BUFFER_FREE_LIST 1
29
29
30
namespace ns3 {
30
namespace ns3 {
31
31
 Lines 80-86    Link Here 
80
 *                        |--------^ m_start
80
 *                        |--------^ m_start
81
 *                        |-------------------^ m_zeroAreaStart
81
 *                        |-------------------^ m_zeroAreaStart
82
 *                        |-----------------------------^ m_end - (m_zeroAreaEnd - m_zeroAreaStart)
82
 *                        |-----------------------------^ m_end - (m_zeroAreaEnd - m_zeroAreaStart)
83
 * virtual byte buffer:           |xxxxxxxxxxxx0000000000000.........|
83
 * Virtual byte buffer:           |xxxxxxxxxxxx0000000000000.........|
84
 *                        |--------^ m_start
84
 *                        |--------^ m_start
85
 *                        |--------------------^ m_zeroAreaStart
85
 *                        |--------------------^ m_zeroAreaStart
86
 *                        |---------------------------------^ m_zeroAreaEnd
86
 *                        |---------------------------------^ m_zeroAreaEnd
 Lines 378-414    Link Here 
378
378
379
private:
379
private:
380
    friend class Buffer;
380
    friend class Buffer;
381
    /**
382
     * Constructor - initializes the iterator to point to the buffer start
383
     *
384
     * \param buffer the buffer this iterator refers to
385
     */
381
    inline Iterator (Buffer const*buffer);
386
    inline Iterator (Buffer const*buffer);
382
    inline Iterator (Buffer const*buffer, bool);
387
    /**
388
     * Constructor - initializes the iterator to point to the buffer end
389
     *
390
     * \param buffer the buffer this iterator refers to
391
     * \param dummy not used param
392
     */
393
    inline Iterator (Buffer const*buffer, bool dummy);
394
    /**
395
     * Initializes the iterator values
396
     *
397
     * \param buffer the buffer this iterator refers to
398
     */
383
    inline void Construct (const Buffer *buffer);
399
    inline void Construct (const Buffer *buffer);
400
    /**
401
     * Checks that the [start, end) is not in the "virtual zero area".
402
     *
403
     * \param start start buffer position
404
     * \param end end buffer position
405
     * \returns true if [start, end) is not in the "virtual zero area".
406
     */
384
    bool CheckNoZero (uint32_t start, uint32_t end) const;
407
    bool CheckNoZero (uint32_t start, uint32_t end) const;
408
    /**
409
     * Checks that the buffer position is not in the "virtual zero area".
410
     *
411
     * \param i buffer position
412
     * \returns true if not in the "virtual zero area".
413
     */
385
    bool Check (uint32_t i) const;
414
    bool Check (uint32_t i) const;
415
    /**
416
     * \return the two bytes read in the buffer.
417
     *
418
     * Read data and advance the Iterator by the number of bytes
419
     * read.
420
     * The data is read in network format and return in host format.
421
     *
422
     * \warning this is the slow version, please use ReadNtohU16 (void)
423
     */
386
    uint16_t SlowReadNtohU16 (void);
424
    uint16_t SlowReadNtohU16 (void);
425
    /**
426
     * \return the four bytes read in the buffer.
427
     *
428
     * Read data and advance the Iterator by the number of bytes
429
     * read.
430
     * The data is read in network format and return in host format.
431
     *
432
     * \warning this is the slow version, please use ReadNtohU32 (void)
433
     */
387
    uint32_t SlowReadNtohU32 (void);
434
    uint32_t SlowReadNtohU32 (void);
435
    /**
436
     * \brief Returns an appropriate message indicating a read error
437
     * \returns the error message
438
     */
388
    std::string GetReadErrorMessage (void) const;
439
    std::string GetReadErrorMessage (void) const;
440
    /**
441
     * \brief Returns an appropriate message indicating a write error
442
     *
443
     * The message depends on the actual Buffer::Iterator status.
444
     *
445
     * \returns the error message
446
     */
389
    std::string GetWriteErrorMessage (void) const;
447
    std::string GetWriteErrorMessage (void) const;
390
448
391
    /* offset in virtual bytes from the start of the data buffer to the
449
    /**
450
     * offset in virtual bytes from the start of the data buffer to the
392
     * start of the "virtual zero area".
451
     * start of the "virtual zero area".
393
     */
452
     */
394
    uint32_t m_zeroStart;
453
    uint32_t m_zeroStart;
395
    /* offset in virtual bytes from the start of the data buffer to the
454
    /**
455
     * offset in virtual bytes from the start of the data buffer to the
396
     * end of the "virtual zero area".
456
     * end of the "virtual zero area".
397
     */
457
     */
398
    uint32_t m_zeroEnd;
458
    uint32_t m_zeroEnd;
399
    /* offset in virtual bytes from the start of the data buffer to the
459
    /**
460
     * offset in virtual bytes from the start of the data buffer to the
400
     * start of the data which can be read by this iterator
461
     * start of the data which can be read by this iterator
401
     */
462
     */
402
    uint32_t m_dataStart;
463
    uint32_t m_dataStart;
403
    /* offset in virtual bytes from the start of the data buffer to the
464
    /**
465
     * offset in virtual bytes from the start of the data buffer to the
404
     * end of the data which can be read by this iterator
466
     * end of the data which can be read by this iterator
405
     */
467
     */
406
    uint32_t m_dataEnd;
468
    uint32_t m_dataEnd;
407
    /* offset in virtual bytes from the start of the data buffer to the
469
    /**
470
     * offset in virtual bytes from the start of the data buffer to the
408
     * current position represented by this iterator.
471
     * current position represented by this iterator.
409
     */
472
     */
410
    uint32_t m_current;
473
    uint32_t m_current;
411
    /* a pointer to the underlying byte buffer. All offsets are relative
474
    /**
475
     * a pointer to the underlying byte buffer. All offsets are relative
412
     * to this pointer.
476
     * to this pointer.
413
     */
477
     */
414
    uint8_t *m_data;
478
    uint8_t *m_data;
 Lines 498-507    Link Here 
498
   */
562
   */
499
  inline Buffer::Iterator End (void) const;
563
  inline Buffer::Iterator End (void) const;
500
564
565
  /**
566
   * \brief Create a full copy of the buffer, including
567
   * all the internal structures.
568
   *
569
   * \returns a copy of the buffer
570
   */
501
  Buffer CreateFullCopy (void) const;
571
  Buffer CreateFullCopy (void) const;
502
572
503
  /**
573
  /**
504
   * \return the number of bytes required for serialization 
574
   * \brief Return the number of bytes required for serialization.
575
   * \return the number of bytes.
505
   */
576
   */
506
  uint32_t GetSerializedSize (void) const;
577
  uint32_t GetSerializedSize (void) const;
507
578
 Lines 527-533    Link Here 
527
   */
598
   */
528
  uint32_t Deserialize (const uint8_t* buffer, uint32_t size);
599
  uint32_t Deserialize (const uint8_t* buffer, uint32_t size);
529
600
601
  /**
602
   * \brief Returns the current buffer start offset
603
   * \return the offset
604
   */
530
  int32_t GetCurrentStartOffset (void) const;
605
  int32_t GetCurrentStartOffset (void) const;
606
  /**
607
   * \brief Returns the current buffer end offset
608
   * \return the offset
609
   */
531
  int32_t GetCurrentEndOffset (void) const;
610
  int32_t GetCurrentEndOffset (void) const;
532
611
533
  /** 
612
  /** 
 Lines 538-549    Link Here 
538
   */
617
   */
539
  void CopyData (std::ostream *os, uint32_t size) const;
618
  void CopyData (std::ostream *os, uint32_t size) const;
540
619
620
  /**
621
   * Copy the specified amount of data from the buffer to the given buffer.
622
   *
623
   * @param buffer the output buffer
624
   * @param size the maximum amount of bytes to copy. If zero, nothing is copied.
625
   * @returns the amount of bytes copied
626
   */
541
  uint32_t CopyData (uint8_t *buffer, uint32_t size) const;
627
  uint32_t CopyData (uint8_t *buffer, uint32_t size) const;
542
628
629
  /**
630
   * \brief Copy constructor
631
   * \param o the buffer to copy
632
   */
543
  inline Buffer (Buffer const &o);
633
  inline Buffer (Buffer const &o);
634
  /**
635
   * \brief Assignment operator
636
   * \param o the buffer to copy
637
   * \return a reference to the buffer
638
   */
544
  Buffer &operator = (Buffer const &o);
639
  Buffer &operator = (Buffer const &o);
545
  Buffer ();
640
  Buffer ();
641
  /**
642
   * \brief Constructor
643
   *
644
   * The buffer will be initialized with zeroes up to its size.
645
   *
646
   * \param dataSize the buffer size
647
   */
546
  Buffer (uint32_t dataSize);
648
  Buffer (uint32_t dataSize);
649
  /**
650
   * \brief Constructor
651
   *
652
   * If initialize is set to true, the buffer will be initialized
653
   * with zeroes up to its size.
654
   *
655
   * \param dataSize the buffer size.
656
   * \param initialize initialize the buffer with zeroes.
657
   */
547
  Buffer (uint32_t dataSize, bool initialize);
658
  Buffer (uint32_t dataSize, bool initialize);
548
  ~Buffer ();
659
  ~Buffer ();
549
private:
660
private:
 Lines 563-602    Link Here 
563
   */
674
   */
564
  struct Data
675
  struct Data
565
  {
676
  {
566
    /* The reference count of an instance of this data structure.
677
    /**
678
     * The reference count of an instance of this data structure.
567
     * Each buffer which references an instance holds a count.
679
     * Each buffer which references an instance holds a count.
568
       */
680
     */
569
    uint32_t m_count;
681
    uint32_t m_count;
570
    /* the size of the m_data field below.
682
    /**
683
     * the size of the m_data field below.
571
     */
684
     */
572
    uint32_t m_size;
685
    uint32_t m_size;
573
    /* offset from the start of the m_data field below to the
686
    /**
687
     * offset from the start of the m_data field below to the
574
     * start of the area in which user bytes were written.
688
     * start of the area in which user bytes were written.
575
     */
689
     */
576
    uint32_t m_dirtyStart;
690
    uint32_t m_dirtyStart;
577
    /* offset from the start of the m_data field below to the
691
    /**
692
     * offset from the start of the m_data field below to the
578
     * end of the area in which user bytes were written.
693
     * end of the area in which user bytes were written.
579
     */
694
     */
580
    uint32_t m_dirtyEnd;
695
    uint32_t m_dirtyEnd;
581
    /* The real data buffer holds _at least_ one byte.
696
    /**
697
     * The real data buffer holds _at least_ one byte.
582
     * Its real size is stored in the m_size field.
698
     * Its real size is stored in the m_size field.
583
     */
699
     */
584
    uint8_t m_data[1];
700
    uint8_t m_data[1];
585
  };
701
  };
586
702
703
  /**
704
   * \brief Transform a "Virtual byte buffer" into a "Real byte buffer"
705
   */
587
  void TransformIntoRealBuffer (void) const;
706
  void TransformIntoRealBuffer (void) const;
707
  /**
708
   * \brief Checks the internal buffer structures consistency
709
   *
710
   * Used only for debugging purposes.
711
   *
712
   * \returns true if the buffer status is consistent.
713
   */
588
  bool CheckInternalState (void) const;
714
  bool CheckInternalState (void) const;
715
716
  /**
717
   * \brief Initializes the buffer with a number of zeroes.
718
   *
719
   * \param zeroSize the zeroes size
720
   */
589
  void Initialize (uint32_t zeroSize);
721
  void Initialize (uint32_t zeroSize);
722
723
  /**
724
   * \brief Get the buffer real size.
725
   * \warning The real size is the actual memory used by the buffer.
726
   * \returns the memory used by the buffer.
727
   */
590
  uint32_t GetInternalSize (void) const;
728
  uint32_t GetInternalSize (void) const;
729
730
  /**
731
   * \brief Get the buffer end position.
732
   * \returns the buffer end index.
733
   */
591
  uint32_t GetInternalEnd (void) const;
734
  uint32_t GetInternalEnd (void) const;
735
736
  /**
737
   * \brief Recycle the buffer memory
738
   * \param data the buffer data storage
739
   */
592
  static void Recycle (struct Buffer::Data *data);
740
  static void Recycle (struct Buffer::Data *data);
741
  /**
742
   * \brief Create a buffer data storage
743
   * \param size the storage size to create
744
   * \returns a pointer to the created buffer storage
745
   */
593
  static struct Buffer::Data *Create (uint32_t size);
746
  static struct Buffer::Data *Create (uint32_t size);
747
  /**
748
   * \brief Allocate a buffer data storage
749
   * \param reqSize the storage size to create
750
   * \returns a pointer to the allocated buffer storage
751
   */
594
  static struct Buffer::Data *Allocate (uint32_t reqSize);
752
  static struct Buffer::Data *Allocate (uint32_t reqSize);
753
  /**
754
   * \brief Deallocate the buffer memory
755
   * \param data the buffer data storage
756
   */
595
  static void Deallocate (struct Buffer::Data *data);
757
  static void Deallocate (struct Buffer::Data *data);
596
758
597
  struct Data *m_data;
759
  struct Data *m_data; //!< the buffer data storage
598
760
599
  /* keep track of the maximum value of m_zeroAreaStart across
761
  /**
762
   * keep track of the maximum value of m_zeroAreaStart across
600
   * the lifetime of a Buffer instance. This variable is used
763
   * the lifetime of a Buffer instance. This variable is used
601
   * purely as a source of information for the heuristics which
764
   * purely as a source of information for the heuristics which
602
   * decide on the position of the zero area in new buffers.
765
   * decide on the position of the zero area in new buffers.
 Lines 613-644    Link Here 
613
   */
776
   */
614
  static uint32_t g_recommendedStart;
777
  static uint32_t g_recommendedStart;
615
778
616
  /* offset to the start of the virtual zero area from the start 
779
  /**
780
   * offset to the start of the virtual zero area from the start
617
   * of m_data->m_data
781
   * of m_data->m_data
618
   */
782
   */
619
  uint32_t m_zeroAreaStart;
783
  uint32_t m_zeroAreaStart;
620
  /* offset to the end of the virtual zero area from the start 
784
  /**
785
   * offset to the end of the virtual zero area from the start
621
   * of m_data->m_data
786
   * of m_data->m_data
622
   */
787
   */
623
  uint32_t m_zeroAreaEnd;
788
  uint32_t m_zeroAreaEnd;
624
  /* offset to the start of the data referenced by this Buffer
789
  /**
790
   * offset to the start of the data referenced by this Buffer
625
   * instance from the start of m_data->m_data
791
   * instance from the start of m_data->m_data
626
   */
792
   */
627
  uint32_t m_start;
793
  uint32_t m_start;
628
  /* offset to the end of the data referenced by this Buffer
794
  /**
795
   * offset to the end of the data referenced by this Buffer
629
   * instance from the start of m_data->m_data
796
   * instance from the start of m_data->m_data
630
   */
797
   */
631
  uint32_t m_end;
798
  uint32_t m_end;
632
799
633
#ifdef BUFFER_FREE_LIST
800
#ifdef BUFFER_FREE_LIST
801
  /// Container for buffer data
634
  typedef std::vector<struct Buffer::Data*> FreeList;
802
  typedef std::vector<struct Buffer::Data*> FreeList;
803
  /// Local static destructor structure
635
  struct LocalStaticDestructor 
804
  struct LocalStaticDestructor 
636
  {
805
  {
637
    ~LocalStaticDestructor ();
806
    ~LocalStaticDestructor ();
638
  };
807
  };
639
  static uint32_t g_maxSize;
808
  static uint32_t g_maxSize; //!< Max observed data size
640
  static FreeList *g_freeList;
809
  static FreeList *g_freeList; //!< Buffer data container
641
  static struct LocalStaticDestructor g_localStaticDestructor;
810
  static struct LocalStaticDestructor g_localStaticDestructor; //!< Local static destructor
642
#endif
811
#endif
643
};
812
};
644
813
(-)a/src/network/model/byte-tag-list.cc (-6 / +20 lines)
 Lines 30-49    Link Here 
30
30
31
namespace ns3 {
31
namespace ns3 {
32
32
33
/**
34
 * \ingroup packet
35
 *
36
 * \brief Internal representation of the byte tags stored in a packet.
37
 *
38
 * This structure is only used by ByteTagList and should not be accessed directly.
39
 */
33
struct ByteTagListData {
40
struct ByteTagListData {
34
  uint32_t size;
41
  uint32_t size;   //!< size of the data
35
  uint32_t count;
42
  uint32_t count;  //!< use counter (for smart deallocation)
36
  uint32_t dirty;
43
  uint32_t dirty;  //!< number of bytes actually in use
37
  uint8_t data[4];
44
  uint8_t data[4]; //!< data
38
};
45
};
39
46
40
#ifdef USE_FREE_LIST
47
#ifdef USE_FREE_LIST
48
/**
49
 * \ingroup packet
50
 *
51
 * \brief Container class for struct ByteTagListData
52
 *
53
 * Internal use only.
54
 */
41
static class ByteTagListDataFreeList : public std::vector<struct ByteTagListData *>
55
static class ByteTagListDataFreeList : public std::vector<struct ByteTagListData *>
42
{
56
{
43
public:
57
public:
44
  ~ByteTagListDataFreeList ();
58
  ~ByteTagListDataFreeList ();
45
} g_freeList;
59
} g_freeList; //!< Container for struct ByteTagListData
46
static uint32_t g_maxSize = 0;
60
static uint32_t g_maxSize = 0; //!< maximum data size (used for allocation)
47
61
48
ByteTagListDataFreeList::~ByteTagListDataFreeList ()
62
ByteTagListDataFreeList::~ByteTagListDataFreeList ()
49
{
63
{
(-)a/src/network/model/byte-tag-list.h (-21 / +59 lines)
 Lines 68-74    Link Here 
68
class ByteTagList
68
class ByteTagList
69
{
69
{
70
public:
70
public:
71
  /*
71
  /**
72
   * \brief An iterator for iterating through a byte tag list
72
   * \brief An iterator for iterating through a byte tag list
73
   *
73
   *
74
   * An iterator for iterating through a byte tag list
74
   * An iterator for iterating through a byte tag list
 Lines 77-83    Link Here 
77
  class Iterator
77
  class Iterator
78
  {
78
  {
79
public:
79
public:
80
    /*
80
    /**
81
     * \brief An item specifies an individual tag within a byte buffer
81
     * \brief An item specifies an individual tag within a byte buffer
82
     *
82
     *
83
     * An item specifies an individual tag within a byte buffer
83
     * An item specifies an individual tag within a byte buffer
 Lines 85-116    Link Here 
85
     */
85
     */
86
    struct Item 
86
    struct Item 
87
    {
87
    {
88
      TypeId tid;             /// type of the tag
88
      TypeId tid;             //!< type of the tag
89
      uint32_t size;          /// size of tag data
89
      uint32_t size;          //!< size of tag data
90
      int32_t start;          /// offset to the start of the tag from the virtual byte buffer 
90
      int32_t start;          //!< offset to the start of the tag from the virtual byte buffer
91
      int32_t end;            /// offset to the end of the tag from the virtual byte buffer
91
      int32_t end;            //!< offset to the end of the tag from the virtual byte buffer
92
      TagBuffer buf;          /// the data for the tag as generated by Tag::Serialize
92
      TagBuffer buf;          //!< the data for the tag as generated by Tag::Serialize
93
      Item (TagBuffer buf);   /// constructs an item with the given TagBuffer
93
      Item (TagBuffer buf);   //!< constructs an item with the given TagBuffer
94
private:
94
private:
95
      friend class ByteTagList;
95
      friend class ByteTagList;
96
      friend class ByteTagList::Iterator;
96
      friend class ByteTagList::Iterator;
97
    };
97
    };
98
    
98
    
99
    /*
99
    /**
100
     * \brief Used to determine if the iterator is at the end of the byteTagList
100
     * \brief Used to determine if the iterator is at the end of the byteTagList
101
     *
101
     *
102
     * \returns true if there are more Items in the list
102
     * \returns true if there are more Items in the list
103
     */
103
     */
104
    bool HasNext (void) const;
104
    bool HasNext (void) const;
105
105
106
    /*
106
    /**
107
     * \brief Returns the next Item from the ByteTagList
107
     * \brief Returns the next Item from the ByteTagList
108
     *
108
     *
109
     * \returns the next Item in the ByteTagList
109
     * \returns the next Item in the ByteTagList
110
     */        
110
     */        
111
    struct ByteTagList::Iterator::Item Next (void);
111
    struct ByteTagList::Iterator::Item Next (void);
112
    
112
    
113
    /*
113
    /**
114
     * \brief Returns the offset from the start of the virtual byte buffer to the ByteTagList
114
     * \brief Returns the offset from the start of the virtual byte buffer to the ByteTagList
115
     *
115
     *
116
     * \returns offset to the start of this ByteTagList
116
     * \returns offset to the start of this ByteTagList
 Lines 118-133    Link Here 
118
    uint32_t GetOffsetStart (void) const;
118
    uint32_t GetOffsetStart (void) const;
119
private:
119
private:
120
    friend class ByteTagList;
120
    friend class ByteTagList;
121
122
    /**
123
     * \brief Constructor
124
     * \param start Starting tag
125
     * \param end End tag
126
     * \param offsetStart offset to the start of the tag from the virtual byte buffer
127
     * \param offsetEnd offset to the end of the tag from the virtual byte buffer
128
     */
121
    Iterator (uint8_t *start, uint8_t *end, int32_t offsetStart, int32_t offsetEnd);
129
    Iterator (uint8_t *start, uint8_t *end, int32_t offsetStart, int32_t offsetEnd);
130
131
    /**
132
     * \brief Prepare the iterator for the next tag
133
     */
122
    void PrepareForNext (void);
134
    void PrepareForNext (void);
123
    uint8_t *m_current;
135
    uint8_t *m_current;     //!< Current tag
124
    uint8_t *m_end;
136
    uint8_t *m_end;         //!< End tag
125
    int32_t m_offsetStart;
137
    int32_t m_offsetStart;  //!< Offset to the start of the tag from the virtual byte buffer
126
    int32_t m_offsetEnd;
138
    int32_t m_offsetEnd;    //!< Offset to the end of the tag from the virtual byte buffer
127
    uint32_t m_nextTid;
139
    uint32_t m_nextTid;     //!< TypeId of the next tag
128
    uint32_t m_nextSize;
140
    uint32_t m_nextSize;    //!< Size of the next tag
129
    int32_t m_nextStart;
141
    int32_t m_nextStart;    //!< Start of the next tag
130
    int32_t m_nextEnd;
142
    int32_t m_nextEnd;      //!< End of the next tag
131
  };
143
  };
132
144
133
  ByteTagList ();
145
  ByteTagList ();
 Lines 214-228    Link Here 
214
  void AddAtStart (int32_t adjustment, int32_t prependOffset);
226
  void AddAtStart (int32_t adjustment, int32_t prependOffset);
215
227
216
private:
228
private:
229
  /**
230
   * \brief Check that all offsets are smaller than appendOffset
231
   * \param appendOffset the append offset to check
232
   * \returns true if the check is false
233
   */
217
  bool IsDirtyAtEnd (int32_t appendOffset);
234
  bool IsDirtyAtEnd (int32_t appendOffset);
235
  /**
236
   * \brief Check that all offsets are bigger than prependOffset
237
   * \param prependOffset the prepend offset to check
238
   * \returns true if the check is false
239
   */
218
  bool IsDirtyAtStart (int32_t prependOffset);
240
  bool IsDirtyAtStart (int32_t prependOffset);
241
242
  /**
243
   * Returns an iterator pointing to the very first tag in this list
244
   *
245
   * \returns an iterator
246
   */
219
  ByteTagList::Iterator BeginAll (void) const;
247
  ByteTagList::Iterator BeginAll (void) const;
220
248
249
  /**
250
   * \brief Allocate the memory for the ByteTagListData
251
   * \param size the memory to allocate
252
   * \returns the ByteTagListData structure
253
   */
221
  struct ByteTagListData *Allocate (uint32_t size);
254
  struct ByteTagListData *Allocate (uint32_t size);
255
256
  /**
257
   * \brief Deallocates a ByteTagListData
258
   * \param data the ByteTagListData to deallocate
259
   */
222
  void Deallocate (struct ByteTagListData *data);
260
  void Deallocate (struct ByteTagListData *data);
223
261
224
  uint16_t m_used;
262
  uint16_t m_used; //!< the number of used bytes in the buffer
225
  struct ByteTagListData *m_data;
263
  struct ByteTagListData *m_data; //!< the ByteTagListData structure
226
};
264
};
227
265
228
} // namespace ns3
266
} // namespace ns3
(-)a/src/network/model/channel-list.cc (-1 / +47 lines)
 Lines 30-59    Link Here 
30
  ;
30
  ;
31
31
32
/**
32
/**
33
 * \ingroup network
34
 *
33
 * \brief private implementation detail of the ChannelList API.
35
 * \brief private implementation detail of the ChannelList API.
34
 */
36
 */
35
class ChannelListPriv : public Object
37
class ChannelListPriv : public Object
36
{
38
{
37
public:
39
public:
40
  /**
41
   * \brief Get the type ID.
42
   * \return the object TypeId
43
   */
38
  static TypeId GetTypeId (void);
44
  static TypeId GetTypeId (void);
39
  ChannelListPriv ();
45
  ChannelListPriv ();
40
  ~ChannelListPriv ();
46
  ~ChannelListPriv ();
41
47
48
  /**
49
   * \param channel channel to add
50
   * \returns index of channel in list.
51
   *
52
   * This method is called automatically from Channel::Channel so
53
   * the user has little reason to call it himself.
54
   */
42
  uint32_t Add (Ptr<Channel> channel);
55
  uint32_t Add (Ptr<Channel> channel);
43
56
57
  /**
58
   * \returns a C++ iterator located at the beginning of this
59
   *          list.
60
   */
44
  ChannelList::Iterator Begin (void) const;
61
  ChannelList::Iterator Begin (void) const;
62
  /**
63
   * \returns a C++ iterator located at the end of this
64
   *          list.
65
   */
45
  ChannelList::Iterator End (void) const;
66
  ChannelList::Iterator End (void) const;
46
67
68
  /**
69
   * \param n index of requested channel.
70
   * \returns the Channel associated to index n.
71
   */
47
  Ptr<Channel> GetChannel (uint32_t n);
72
  Ptr<Channel> GetChannel (uint32_t n);
73
74
  /**
75
   * \returns the number of channels currently in the list.
76
   */
48
  uint32_t GetNChannels (void);
77
  uint32_t GetNChannels (void);
49
78
79
  /**
80
   * \brief Get the channel list object
81
   * \returns the channel list
82
   */
50
  static Ptr<ChannelListPriv> Get (void);
83
  static Ptr<ChannelListPriv> Get (void);
51
84
52
private:
85
private:
86
  /**
87
   * \brief Get the channel list object
88
   * \returns the channel list
89
   */
53
  static Ptr<ChannelListPriv> *DoGet (void);
90
  static Ptr<ChannelListPriv> *DoGet (void);
91
92
  /**
93
   * \brief Delete the channel list object
94
   */
54
  static void Delete (void);
95
  static void Delete (void);
96
97
  /**
98
   * \brief Dispose the channels in the list
99
   */
55
  virtual void DoDispose (void);
100
  virtual void DoDispose (void);
56
  std::vector<Ptr<Channel> > m_channels;
101
102
  std::vector<Ptr<Channel> > m_channels; //!< channel objects container
57
};
103
};
58
104
59
NS_OBJECT_ENSURE_REGISTERED (ChannelListPriv)
105
NS_OBJECT_ENSURE_REGISTERED (ChannelListPriv)
(-)a/src/network/model/channel-list.h (+1 lines)
 Lines 38-43    Link Here 
38
class ChannelList
38
class ChannelList
39
{
39
{
40
public:
40
public:
41
  /// Channel container iterator
41
  typedef std::vector< Ptr<Channel> >::const_iterator Iterator;
42
  typedef std::vector< Ptr<Channel> >::const_iterator Iterator;
42
43
43
  /**
44
  /**
(-)a/src/network/model/channel.h (-1 / +5 lines)
 Lines 43-48    Link Here 
43
class Channel : public Object
43
class Channel : public Object
44
{
44
{
45
public:
45
public:
46
  /**
47
   * \brief Get the type ID.
48
   * \return the object TypeId
49
   */
46
  static TypeId GetTypeId (void);
50
  static TypeId GetTypeId (void);
47
51
48
  Channel ();
52
  Channel ();
 Lines 71-77    Link Here 
71
  virtual Ptr<NetDevice> GetDevice (uint32_t i) const = 0;
75
  virtual Ptr<NetDevice> GetDevice (uint32_t i) const = 0;
72
76
73
private:
77
private:
74
  uint32_t m_id; // Channel id for this channel
78
  uint32_t m_id; //!< Channel id for this channel
75
};
79
};
76
80
77
} // namespace ns3
81
} // namespace ns3
(-)a/src/network/model/chunk.h (+14 lines)
 Lines 14-22    Link Here 
14
class Chunk : public ObjectBase
14
class Chunk : public ObjectBase
15
{
15
{
16
public:
16
public:
17
  /**
18
   * \brief Get the type ID.
19
   * \return the object TypeId
20
   */
17
  static TypeId GetTypeId (void); 
21
  static TypeId GetTypeId (void); 
18
22
23
  /**
24
   * \brief Deserialize the object from a buffer iterator
25
   * \param start the buffer iterator
26
   * \returns the number of deserialized bytes
27
   */
19
  virtual uint32_t Deserialize (Buffer::Iterator start) = 0;
28
  virtual uint32_t Deserialize (Buffer::Iterator start) = 0;
29
30
  /**
31
   * \brief Print the object contents
32
   * \param os the output stream
33
   */
20
  virtual void Print (std::ostream &os) const = 0;
34
  virtual void Print (std::ostream &os) const = 0;
21
};
35
};
22
36
(-)a/src/network/model/header.h (+12 lines)
 Lines 42-47    Link Here 
42
class Header : public Chunk
42
class Header : public Chunk
43
{
43
{
44
public:
44
public:
45
  /**
46
   * \brief Get the type ID.
47
   * \return the object TypeId
48
   */
45
  static TypeId GetTypeId (void);
49
  static TypeId GetTypeId (void);
46
  virtual ~Header ();
50
  virtual ~Header ();
47
  /**
51
  /**
 Lines 91-96    Link Here 
91
  virtual void Print (std::ostream &os) const = 0;
95
  virtual void Print (std::ostream &os) const = 0;
92
};
96
};
93
97
98
99
/**
100
 * \brief Stream insertion operator.
101
 *
102
 * \param os the stream
103
 * \param header the header
104
 * \returns a reference to the stream
105
 */
94
std::ostream & operator << (std::ostream &os, const Header &header);
106
std::ostream & operator << (std::ostream &os, const Header &header);
95
107
96
} // namespace ns3
108
} // namespace ns3
(-)a/src/network/model/net-device.h (+4 lines)
 Lines 75-80    Link Here 
75
class NetDevice : public Object
75
class NetDevice : public Object
76
{
76
{
77
public:
77
public:
78
  /**
79
   * \brief Get the type ID.
80
   * \return the object TypeId
81
   */
78
  static TypeId GetTypeId (void);
82
  static TypeId GetTypeId (void);
79
  virtual ~NetDevice();
83
  virtual ~NetDevice();
80
84
(-)a/src/network/model/nix-vector.cc (-1 / +1 lines)
 Lines 27-33    Link Here 
27
27
28
namespace ns3 {
28
namespace ns3 {
29
29
30
typedef std::vector<uint32_t> NixBits_t;  ///typedef for the nixVector
30
typedef std::vector<uint32_t> NixBits_t;  //!< typedef for the nixVector
31
31
32
NixVector::NixVector ()
32
NixVector::NixVector ()
33
  : m_nixVector (0),
33
  : m_nixVector (0),
(-)a/src/network/model/nix-vector.h (-14 / +34 lines)
 Lines 152-189    Link Here 
152
152
153
153
154
private:
154
private:
155
  /// Typedef: the NixVector bits storage.
155
  typedef std::vector<uint32_t> NixBits_t;
156
  typedef std::vector<uint32_t> NixBits_t;
156
157
158
  /**
159
   * \brief Print the NixVector.
160
   *
161
   * \param os the output stream
162
   */
157
  /* for printing of nix-vector */
163
  /* for printing of nix-vector */
158
  void DumpNixVector (std::ostream &os) const;
164
  void DumpNixVector (std::ostream &os) const;
159
  /* for printing of nix-vector */
160
  friend std::ostream & operator << ( std::ostream &outs, const NixVector &nix);
161
165
162
  /* the actual nix-vector */
166
  /**
163
  NixBits_t m_nixVector;
167
   * \brief Stream insertion operator.
168
   *
169
   * \param os the stream
170
   * \param nix the Nixvector
171
   * \returns a reference to the stream
172
   */
173
  friend std::ostream & operator << ( std::ostream &os, const NixVector &nix);
164
174
165
  /* for tracking where we are
175
  NixBits_t m_nixVector; //!< the actual nix-vector
166
   * in the nix-vector
176
  uint32_t m_used; //!< For tracking where we are in the nix-vector
167
   */
168
  uint32_t m_used;
169
177
170
  /* for tracking how many bits we
178
  /**
179
   * For tracking how many bits we
171
   * have used in the current vector
180
   * have used in the current vector
172
   * entry. need this in order to
181
   * entry. need this in order to
173
   * expand the vector passed 32bits
182
   * expand the vector passed 32bits
174
   */
183
   */
175
  uint32_t m_currentVectorBitSize;
184
  uint32_t m_currentVectorBitSize;
176
185
177
  /* a counter of how total bits are in
186
  /**
187
   * A counter of how total bits are in
178
   * the nix-vector
188
   * the nix-vector
179
   */
189
   */
180
  uint32_t m_totalBitSize;
190
  uint32_t m_totalBitSize;
181
191
182
  /* internal for pretty printing of nix-vector */
192
  /**
183
  void PrintDec2BinNixFill (uint32_t, uint32_t, std::ostream &os) const;
193
   * Internal for pretty printing of nix-vector (fill)
194
   * \param decimalNum decimal divider
195
   * \param bitCount bit counter
196
   * \param os output stream
197
   */
198
  void PrintDec2BinNixFill (uint32_t decimalNum, uint32_t bitCount, std::ostream &os) const;
184
199
185
  /* internal for pretty printing of nix-vector */
200
  /**
186
  void PrintDec2BinNix (uint32_t, uint32_t, std::ostream &os) const;
201
   * Internal for pretty printing of nix-vector (no fill)
202
   * \param decimalNum decimal divider
203
   * \param bitCount bit counter
204
   * \param os output stream
205
   */
206
  void PrintDec2BinNix (uint32_t decimalNum, uint32_t bitCount, std::ostream &os) const;
187
};
207
};
188
} // namespace ns3
208
} // namespace ns3
189
209
(-)a/src/network/model/node-list.cc (-3 / +51 lines)
 Lines 33-60    Link Here 
33
  ;
33
  ;
34
34
35
/**
35
/**
36
 * \ingroup network
36
 * \brief private implementation detail of the NodeList API.
37
 * \brief private implementation detail of the NodeList API.
37
 */
38
 */
38
class NodeListPriv : public Object
39
class NodeListPriv : public Object
39
{
40
{
40
public:
41
public:
42
  /**
43
   * \brief Get the type ID.
44
   * \return the object TypeId
45
   */
41
  static TypeId GetTypeId (void);
46
  static TypeId GetTypeId (void);
42
  NodeListPriv ();
47
  NodeListPriv ();
43
  ~NodeListPriv ();
48
  ~NodeListPriv ();
44
49
50
  /**
51
   * \param node node to add
52
   * \returns index of node in list.
53
   *
54
   * This method is called automatically from Node::Node so
55
   * the user has little reason to call it himself.
56
   */
45
  uint32_t Add (Ptr<Node> node);
57
  uint32_t Add (Ptr<Node> node);
58
59
  /**
60
   * \returns a C++ iterator located at the beginning of this
61
   *          list.
62
   */
46
  NodeList::Iterator Begin (void) const;
63
  NodeList::Iterator Begin (void) const;
64
65
  /**
66
   * \returns a C++ iterator located at the end of this
67
   *          list.
68
   */
47
  NodeList::Iterator End (void) const;
69
  NodeList::Iterator End (void) const;
70
71
  /**
72
   * \param n index of requested node.
73
   * \returns the Node associated to index n.
74
   */
48
  Ptr<Node> GetNode (uint32_t n);
75
  Ptr<Node> GetNode (uint32_t n);
76
77
  /**
78
   * \returns the number of nodes currently in the list.
79
   */
49
  uint32_t GetNNodes (void);
80
  uint32_t GetNNodes (void);
50
81
82
  /**
83
   * \brief Get the node list object
84
   * \returns the node list
85
   */
51
  static Ptr<NodeListPriv> Get (void);
86
  static Ptr<NodeListPriv> Get (void);
52
87
53
private:
88
private:
89
  /**
90
   * \brief Get the node list object
91
   * \returns the node list
92
   */
93
  static Ptr<NodeListPriv> *DoGet (void);
94
95
  /**
96
   * \brief Delete the nodes list object
97
   */
98
  static void Delete (void);
99
100
  /**
101
   * \brief Dispose the nodes in the list
102
   */
54
  virtual void DoDispose (void);
103
  virtual void DoDispose (void);
55
  static Ptr<NodeListPriv> *DoGet (void);
104
56
  static void Delete (void);
105
  std::vector<Ptr<Node> > m_nodes; //!< node objects container
57
  std::vector<Ptr<Node> > m_nodes;
58
};
106
};
59
107
60
NS_OBJECT_ENSURE_REGISTERED (NodeListPriv)
108
NS_OBJECT_ENSURE_REGISTERED (NodeListPriv)
(-)a/src/network/model/node-list.h (+1 lines)
 Lines 40-45    Link Here 
40
class NodeList
40
class NodeList
41
{
41
{
42
public:
42
public:
43
  /// Node container iterator
43
  typedef std::vector< Ptr<Node> >::const_iterator Iterator;
44
  typedef std::vector< Ptr<Node> >::const_iterator Iterator;
44
45
45
  /**
46
  /**
(-)a/src/network/model/node.cc (+3 lines)
 Lines 39-44    Link Here 
39
NS_OBJECT_ENSURE_REGISTERED (Node)
39
NS_OBJECT_ENSURE_REGISTERED (Node)
40
  ;
40
  ;
41
41
42
/**
43
 * \brief A global switch to enable all checksums for all protocols.
44
 */
42
GlobalValue g_checksumEnabled  = GlobalValue ("ChecksumEnabled",
45
GlobalValue g_checksumEnabled  = GlobalValue ("ChecksumEnabled",
43
                                              "A global switch to enable all checksums for all protocols",
46
                                              "A global switch to enable all checksums for all protocols",
44
                                              BooleanValue (false),
47
                                              BooleanValue (false),
(-)a/src/network/model/node.h (-13 / +62 lines)
 Lines 55-60    Link Here 
55
class Node : public Object
55
class Node : public Object
56
{
56
{
57
public:
57
public:
58
  /**
59
   * \brief Get the type ID.
60
   * \return the object TypeId
61
   */
58
  static TypeId GetTypeId (void);
62
  static TypeId GetTypeId (void);
59
63
60
  Node();
64
  Node();
 Lines 175-181    Link Here 
175
   * \param listener the listener to add
179
   * \param listener the listener to add
176
   *
180
   *
177
   * Add a new listener to the list of listeners for the device-added
181
   * Add a new listener to the list of listeners for the device-added
178
   * event. When a new listener is added, it is notified of the existance
182
   * event. When a new listener is added, it is notified of the existence
179
   * of all already-added devices to make discovery of devices easier.
183
   * of all already-added devices to make discovery of devices easier.
180
   */
184
   */
181
  void RegisterDeviceAdditionListener (DeviceAdditionListener listener);
185
  void RegisterDeviceAdditionListener (DeviceAdditionListener listener);
 Lines 204-233    Link Here 
204
  virtual void DoDispose (void);
208
  virtual void DoDispose (void);
205
  virtual void DoInitialize (void);
209
  virtual void DoInitialize (void);
206
private:
210
private:
211
212
  /**
213
   * \brief Notifies all the DeviceAdditionListener about the new device added.
214
   * \param device the added device to notify.
215
   */
207
  void NotifyDeviceAdded (Ptr<NetDevice> device);
216
  void NotifyDeviceAdded (Ptr<NetDevice> device);
208
  bool NonPromiscReceiveFromDevice (Ptr<NetDevice> device, Ptr<const Packet>, uint16_t protocol, const Address &from);
217
209
  bool PromiscReceiveFromDevice (Ptr<NetDevice> device, Ptr<const Packet>, uint16_t protocol,
218
  /**
219
   * \brief Receive a packet from a device in non-promiscuous mode.
220
   * \param device the device
221
   * \param packet the packet
222
   * \param protocol the protocol
223
   * \param from the sender
224
   * \returns true if the packet has been delivered to a protocol handler.
225
   */
226
  bool NonPromiscReceiveFromDevice (Ptr<NetDevice> device, Ptr<const Packet> packet, uint16_t protocol, const Address &from);
227
  /**
228
   * \brief Receive a packet from a device in promiscuous mode.
229
   * \param device the device
230
   * \param packet the packet
231
   * \param protocol the protocol
232
   * \param from the sender
233
   * \param to the destination
234
   * \param packetType the packet type
235
   * \returns true if the packet has been delivered to a protocol handler.
236
   */
237
  bool PromiscReceiveFromDevice (Ptr<NetDevice> device, Ptr<const Packet> packet, uint16_t protocol,
210
                                 const Address &from, const Address &to, NetDevice::PacketType packetType);
238
                                 const Address &from, const Address &to, NetDevice::PacketType packetType);
239
  /**
240
   * \brief Receive a packet from a device.
241
   * \param device the device
242
   * \param packet the packet
243
   * \param protocol the protocol
244
   * \param from the sender
245
   * \param to the destination
246
   * \param packetType the packet type
247
   * \param promisc true if received in promiscuous mode
248
   * \returns true if the packet has been delivered to a protocol handler.
249
   */
211
  bool ReceiveFromDevice (Ptr<NetDevice> device, Ptr<const Packet>, uint16_t protocol,
250
  bool ReceiveFromDevice (Ptr<NetDevice> device, Ptr<const Packet>, uint16_t protocol,
212
                          const Address &from, const Address &to, NetDevice::PacketType packetType, bool promisc);
251
                          const Address &from, const Address &to, NetDevice::PacketType packetType, bool promisc);
213
252
253
  /**
254
   * \brief Finish node's construction by setting the correct node ID.
255
   */
214
  void Construct (void);
256
  void Construct (void);
215
257
258
  /**
259
   * \brief Protocol handler entry.
260
   * This structure is used to demultiplex all the protocols.
261
   */
216
  struct ProtocolHandlerEntry {
262
  struct ProtocolHandlerEntry {
217
    ProtocolHandler handler;
263
    ProtocolHandler handler; //!< the protocol handler
218
    Ptr<NetDevice> device;
264
    Ptr<NetDevice> device;   //!< the NetDevice
219
    uint16_t protocol;
265
    uint16_t protocol;       //!< the protocol number
220
    bool promiscuous;
266
    bool promiscuous;        //!< true if it is a promiscuous handler
221
  };
267
  };
268
269
  /// Typedef for protocol handlers container
222
  typedef std::vector<struct Node::ProtocolHandlerEntry> ProtocolHandlerList;
270
  typedef std::vector<struct Node::ProtocolHandlerEntry> ProtocolHandlerList;
271
  /// Typedef for NetDevice addition listeners container
223
  typedef std::vector<DeviceAdditionListener> DeviceAdditionListenerList;
272
  typedef std::vector<DeviceAdditionListener> DeviceAdditionListenerList;
224
273
225
  uint32_t    m_id;         // Node id for this node
274
  uint32_t    m_id;         //!< Node id for this node
226
  uint32_t    m_sid;        // System id for this node
275
  uint32_t    m_sid;        //!< System id for this node
227
  std::vector<Ptr<NetDevice> > m_devices;
276
  std::vector<Ptr<NetDevice> > m_devices; //!< Devices associated to this node
228
  std::vector<Ptr<Application> > m_applications;
277
  std::vector<Ptr<Application> > m_applications; //!< Applications associated to this node
229
  ProtocolHandlerList m_handlers;
278
  ProtocolHandlerList m_handlers; //!< Protocol handlers in the node
230
  DeviceAdditionListenerList m_deviceAdditionListeners;
279
  DeviceAdditionListenerList m_deviceAdditionListeners; //!< Device addition listeners in the node
231
};
280
};
232
281
233
} // namespace ns3
282
} // namespace ns3
(-)a/src/network/model/packet-metadata.cc (-12 / +1 lines)
 Lines 447-458    Link Here 
447
  return n;
447
  return n;
448
}
448
}
449
449
450
/**
451
 * \param item the item data to write
452
 * \param extraItem the extra item data to write
453
 * \param available the number of bytes which can 
454
 *        be written without having to rewrite the buffer entirely.
455
 */
456
void
450
void
457
PacketMetadata::ReplaceTail (PacketMetadata::SmallItem *item, 
451
PacketMetadata::ReplaceTail (PacketMetadata::SmallItem *item, 
458
                             PacketMetadata::ExtraItem *extraItem,
452
                             PacketMetadata::ExtraItem *extraItem,
 Lines 530-541    Link Here 
530
  *this = h;
524
  *this = h;
531
}
525
}
532
526
533
/**
527
534
 * \param current the offset we should start reading the data from
535
 * \param item pointer to where we should store the data to return to the caller
536
 * \param extraItem pointer to where we should store the data to return to the caller
537
 * \returns the number of bytes read.
538
 */
539
uint32_t
528
uint32_t
540
PacketMetadata::ReadItems (uint16_t current, 
529
PacketMetadata::ReadItems (uint16_t current, 
541
                           struct PacketMetadata::SmallItem *item,
530
                           struct PacketMetadata::SmallItem *item,
(-)a/src/network/model/packet-metadata.h (-42 / +355 lines)
 Lines 79-210    Link Here 
79
class PacketMetadata 
79
class PacketMetadata 
80
{
80
{
81
public:
81
public:
82
83
  /**
84
   * \brief structure describing a packet metadata item
85
   */
82
  struct Item 
86
  struct Item 
83
  {
87
  {
84
    enum {
88
    enum {
85
      PAYLOAD,
89
      PAYLOAD,
86
      HEADER,
90
      HEADER,
87
      TRAILER
91
      TRAILER
88
    } type;
92
    } type; //!< metadata type
89
    /* true: this is a fragmented header, trailer, or, payload.
93
    /**
94
     * true: this is a fragmented header, trailer, or, payload.
90
     * false: this is a whole header, trailer, or, payload.
95
     * false: this is a whole header, trailer, or, payload.
91
     */
96
     */
92
    bool isFragment;
97
    bool isFragment;
93
    /* TypeId of Header or Trailer. Valid only if type is 
98
    /**
99
     * TypeId of Header or Trailer. Valid only if type is
94
     * header or trailer.
100
     * header or trailer.
95
     */
101
     */
96
    TypeId tid;
102
    TypeId tid;
97
    /* size of item. If fragment, size of fragment. Otherwise, 
103
    /**
104
     * size of item. If fragment, size of fragment. Otherwise,
98
     * size of original item. 
105
     * size of original item. 
99
     */
106
     */
100
    uint32_t currentSize;
107
    uint32_t currentSize;
101
    /* how many bytes were trimed from the start of a fragment.
108
    /**
109
     * how many bytes were trimed from the start of a fragment.
102
     * if isFragment is true, this field is zero.
110
     * if isFragment is true, this field is zero.
103
     */
111
     */
104
    uint32_t currentTrimedFromStart;
112
    uint32_t currentTrimedFromStart;
105
    /* how many bytes were trimed from the end of a fragment.
113
    /**
114
     * how many bytes were trimed from the end of a fragment.
106
     * if isFragment is true, this field is zero.
115
     * if isFragment is true, this field is zero.
107
     */
116
     */
108
    uint32_t currentTrimedFromEnd;
117
    uint32_t currentTrimedFromEnd;
109
    /* an iterator which can be fed to Deserialize. Valid only
118
    /**
119
     * an iterator which can be fed to Deserialize. Valid only
110
     * if isFragment and isPayload are false.
120
     * if isFragment and isPayload are false.
111
     */
121
     */
112
    Buffer::Iterator current;
122
    Buffer::Iterator current;
113
  };
123
  };
124
125
  /**
126
   * \brief Iterator class for metadata items.
127
   */
114
  class ItemIterator 
128
  class ItemIterator 
115
  {
129
  {
116
public:
130
public:
131
    /**
132
     * Constructor
133
     * \param metadata a pointer to the metadata
134
     * \param buffer the buffer the metadata refers to
135
     */
117
    ItemIterator (const PacketMetadata *metadata, Buffer buffer);
136
    ItemIterator (const PacketMetadata *metadata, Buffer buffer);
137
    /**
138
     * \brief Checks if there is another metadata item
139
     * \returns true if there is another item
140
     */
118
    bool HasNext (void) const;
141
    bool HasNext (void) const;
142
    /**
143
     * \brief Retrieve the next metadata item
144
     * \returns the next metadata item
145
     */
119
    Item Next (void);
146
    Item Next (void);
120
private:
147
private:
121
    const PacketMetadata *m_metadata;
148
    const PacketMetadata *m_metadata; //!< pointer to the metadata
122
    Buffer m_buffer;
149
    Buffer m_buffer; //!< buffer the metadata refers to
123
    uint16_t m_current;
150
    uint16_t m_current; //!< current position
124
    uint32_t m_offset;
151
    uint32_t m_offset; //!< offset
125
    bool m_hasReadTail;
152
    bool m_hasReadTail; //!< true if the metadata tail has been read
126
  };
153
  };
127
154
155
  /**
156
   * \brief Enable the packet metadata
157
   */
128
  static void Enable (void);
158
  static void Enable (void);
159
  /**
160
   * \brief Enable the packet metadata checking
161
   */
129
  static void EnableChecking (void);
162
  static void EnableChecking (void);
130
163
164
  /**
165
   * Constructor
166
   * \param uid packet uid
167
   * \param size size of the header
168
   */
131
  inline PacketMetadata (uint64_t uid, uint32_t size);
169
  inline PacketMetadata (uint64_t uid, uint32_t size);
170
  /**
171
   * Copy constructor
172
   * \param o the object to copy
173
   */
132
  inline PacketMetadata (PacketMetadata const &o);
174
  inline PacketMetadata (PacketMetadata const &o);
175
  /**
176
   * Basic assignment
177
   * \param o the object to copy
178
   * \return a copied object
179
   */
133
  inline PacketMetadata &operator = (PacketMetadata const& o);
180
  inline PacketMetadata &operator = (PacketMetadata const& o);
134
  inline ~PacketMetadata ();
181
  inline ~PacketMetadata ();
135
182
183
  /**
184
   * Add an header
185
   * \param header header to add
186
   * \param size header serialized size
187
   */
136
  void AddHeader (Header const &header, uint32_t size);
188
  void AddHeader (Header const &header, uint32_t size);
189
  /**
190
   * Remove an header
191
   * \param header header to remove
192
   * \param size header serialized size
193
   */
137
  void RemoveHeader (Header const &header, uint32_t size);
194
  void RemoveHeader (Header const &header, uint32_t size);
138
195
196
  /**
197
   * Add a trailer
198
   * \param trailer trailer to add
199
   * \param size trailer serialized size
200
   */
139
  void AddTrailer (Trailer const &trailer, uint32_t size);
201
  void AddTrailer (Trailer const &trailer, uint32_t size);
202
  /**
203
   * Remove a trailer
204
   * \param trailer trailer to remove
205
   * \param size trailer serialized size
206
   */
140
  void RemoveTrailer (Trailer const &trailer, uint32_t size);
207
  void RemoveTrailer (Trailer const &trailer, uint32_t size);
141
208
142
  /**
209
  /**
143
   * \param start the amount of stuff to remove from the start
210
   * \param start the amount of stuff to remove from the start
144
   * \param end the amount of stuff to remove from the end
211
   * \param end the amount of stuff to remove from the end
212
   * \return the fragment's metadata
145
   *
213
   *
146
   * Calling this method is equivalent to calling RemoveAtStart (start)
214
   * Calling this method is equivalent to calling RemoveAtStart (start)
147
   * and then, RemoveAtEnd (end).
215
   * and then, RemoveAtEnd (end).
148
   */
216
   */
149
  PacketMetadata CreateFragment (uint32_t start, uint32_t end) const;
217
  PacketMetadata CreateFragment (uint32_t start, uint32_t end) const;
218
219
  /**
220
   * Add a metadata at the metadata start
221
   * \param o the metadata to add
222
   */
150
  void AddAtEnd (PacketMetadata const&o);
223
  void AddAtEnd (PacketMetadata const&o);
224
  /**
225
   * Add some padding at the end
226
   * \param end size of padding
227
   */
151
  void AddPaddingAtEnd (uint32_t end);
228
  void AddPaddingAtEnd (uint32_t end);
229
  /**
230
   * Remove a chunk of metadata at the metadata start
231
   * \param start the size of metadata to remove
232
   */
152
  void RemoveAtStart (uint32_t start);
233
  void RemoveAtStart (uint32_t start);
234
  /**
235
   * Remove a chunk of metadata at the metadata end
236
   * \param end the size of metadata to remove
237
   */
153
  void RemoveAtEnd (uint32_t end);
238
  void RemoveAtEnd (uint32_t end);
154
239
240
  /**
241
   * Get the packet Uid
242
   * \return the packet Uid
243
   */
155
  uint64_t GetUid (void) const;
244
  uint64_t GetUid (void) const;
156
245
246
  /**
247
   * Get the metadata serialized size
248
   * \return the seralized size
249
   */
157
  uint32_t GetSerializedSize (void) const;
250
  uint32_t GetSerializedSize (void) const;
158
251
252
  /**
253
   * Initialize the item iterator to the buffer begin
254
   */
159
  ItemIterator BeginItem (Buffer buffer) const;
255
  ItemIterator BeginItem (Buffer buffer) const;
160
256
161
  // Serialization to/from raw uint8_t*
257
  /**
258
   *  Serialization to raw uint8_t*
259
   *  \param buffer the buffer to serialize to
260
   *  \param maxSize the maximum serialization size
261
   *  \return 1 on success, 0 on failure
262
   */
162
  uint32_t Serialize   (uint8_t* buffer, uint32_t maxSize) const;
263
  uint32_t Serialize   (uint8_t* buffer, uint32_t maxSize) const;
264
  /**
265
   *  Deserialization from raw uint8_t*
266
   *  \param buffer the buffer to deserialize from
267
   *  \param size the size
268
   *  \return 1 on success, 0 on failure
269
   */
163
  uint32_t Deserialize (const uint8_t* buffer, uint32_t size);
270
  uint32_t Deserialize (const uint8_t* buffer, uint32_t size);
164
271
165
private:
272
private:
166
  // Helper for the raw serilization/deserialization
273
  /**
274
   * Helper for the raw serilization
275
   * \param data the buffer to write to
276
   * \param start start index
277
   * \param current current index
278
   * \param maxSize maximum size
279
   * \return updated current index
280
   */
167
  static uint8_t* AddToRawU8 (const uint8_t& data,
281
  static uint8_t* AddToRawU8 (const uint8_t& data,
168
                              uint8_t* start,
282
                              uint8_t* start,
169
                              uint8_t* current,
283
                              uint8_t* current,
170
                              uint32_t maxSize);
284
                              uint32_t maxSize);
171
285
286
  /**
287
   * Helper for the raw serilization
288
   * \param data the buffer to write to
289
   * \param start start index
290
   * \param current current index
291
   * \param maxSize maximum size
292
   * \return updated current index
293
   */
172
  static uint8_t* AddToRawU16 (const uint16_t& data,
294
  static uint8_t* AddToRawU16 (const uint16_t& data,
173
                               uint8_t* start,
295
                               uint8_t* start,
174
                               uint8_t* current,
296
                               uint8_t* current,
175
                               uint32_t maxSize);
297
                               uint32_t maxSize);
176
298
299
  /**
300
   * Helper for the raw serilization
301
   * \param data the buffer to write to
302
   * \param start start index
303
   * \param current current index
304
   * \param maxSize maximum size
305
   * \return updated current index
306
   */
177
  static uint8_t* AddToRawU32 (const uint32_t& data,
307
  static uint8_t* AddToRawU32 (const uint32_t& data,
178
                               uint8_t* start,
308
                               uint8_t* start,
179
                               uint8_t* current,
309
                               uint8_t* current,
180
                               uint32_t maxSize);
310
                               uint32_t maxSize);
181
311
312
  /**
313
   * Helper for the raw serilization
314
   * \param data the buffer to write to
315
   * \param start start index
316
   * \param current current index
317
   * \param maxSize maximum size
318
   * \return updated current index
319
   */
182
  static uint8_t* AddToRawU64 (const uint64_t& data,
320
  static uint8_t* AddToRawU64 (const uint64_t& data,
183
                               uint8_t* start,
321
                               uint8_t* start,
184
                               uint8_t* current,
322
                               uint8_t* current,
185
                               uint32_t maxSize);
323
                               uint32_t maxSize);
186
324
325
  /**
326
   * Helper for the raw serilization
327
   * \param data the buffer to write to
328
   * \param dataSize the data size to write to
329
   * \param start start index
330
   * \param current current index
331
   * \param maxSize maximum size
332
   * \return updated current index
333
   */
187
  static uint8_t* AddToRaw (const uint8_t* data,
334
  static uint8_t* AddToRaw (const uint8_t* data,
188
                            uint32_t dataSize,
335
                            uint32_t dataSize,
189
                            uint8_t* start,
336
                            uint8_t* start,
190
                            uint8_t* current,
337
                            uint8_t* current,
191
                            uint32_t maxSize);
338
                            uint32_t maxSize);
192
339
340
  /**
341
   * Helper for the raw deserilization
342
   * \param data the buffer to read from
343
   * \param start start index
344
   * \param current current index
345
   * \param maxSize maximum size
346
   * \return updated current index
347
   */
193
  static uint8_t* ReadFromRawU8 (uint8_t& data,
348
  static uint8_t* ReadFromRawU8 (uint8_t& data,
194
                                 const uint8_t* start,
349
                                 const uint8_t* start,
195
                                 const uint8_t* current,
350
                                 const uint8_t* current,
196
                                 uint32_t maxSize);
351
                                 uint32_t maxSize);
197
352
353
  /**
354
   * Helper for the raw deserilization
355
   * \param data the buffer to read from
356
   * \param start start index
357
   * \param current current index
358
   * \param maxSize maximum size
359
   * \return updated current index
360
   */
198
  static uint8_t* ReadFromRawU16 (uint16_t& data,
361
  static uint8_t* ReadFromRawU16 (uint16_t& data,
199
                                  const uint8_t* start,
362
                                  const uint8_t* start,
200
                                  const uint8_t* current,
363
                                  const uint8_t* current,
201
                                  uint32_t maxSize);
364
                                  uint32_t maxSize);
202
365
366
  /**
367
   * Helper for the raw deserilization
368
   * \param data the buffer to read from
369
   * \param start start index
370
   * \param current current index
371
   * \param maxSize maximum size
372
   * \return updated current index
373
   */
203
  static uint8_t* ReadFromRawU32 (uint32_t& data,
374
  static uint8_t* ReadFromRawU32 (uint32_t& data,
204
                                  const uint8_t* start,
375
                                  const uint8_t* start,
205
                                  const uint8_t* current,
376
                                  const uint8_t* current,
206
                                  uint32_t maxSize);
377
                                  uint32_t maxSize);
207
378
379
  /**
380
   * Helper for the raw deserilization
381
   * \param data the buffer to read from
382
   * \param start start index
383
   * \param current current index
384
   * \param maxSize maximum size
385
   * \return updated current index
386
   */
208
  static uint8_t* ReadFromRawU64 (uint64_t& data,
387
  static uint8_t* ReadFromRawU64 (uint64_t& data,
209
                                  const uint8_t* start,
388
                                  const uint8_t* start,
210
                                  const uint8_t* current,
389
                                  const uint8_t* current,
 Lines 216-230    Link Here 
216
   */ 
395
   */ 
217
#define PACKET_METADATA_DATA_M_DATA_SIZE 8
396
#define PACKET_METADATA_DATA_M_DATA_SIZE 8
218
  
397
  
398
  /**
399
   * Data structure
400
   */
219
  struct Data {
401
  struct Data {
220
    /* number of references to this struct Data instance. */
402
    /** number of references to this struct Data instance. */
221
    uint32_t m_count;
403
    uint32_t m_count;
222
    /* size (in bytes) of m_data buffer below */
404
    /** size (in bytes) of m_data buffer below */
223
    uint16_t m_size;
405
    uint16_t m_size;
224
    /* max of the m_used field over all objects which 
406
    /** max of the m_used field over all objects which
225
     * reference this struct Data instance */
407
     * reference this struct Data instance */
226
    uint16_t m_dirtyEnd;
408
    uint16_t m_dirtyEnd;
227
    /* variable-sized buffer of bytes */
409
    /** variable-sized buffer of bytes */
228
    uint8_t m_data[PACKET_METADATA_DATA_M_DATA_SIZE]; 
410
    uint8_t m_data[PACKET_METADATA_DATA_M_DATA_SIZE]; 
229
  };
411
  };
230
  /* Note that since the next and prev fields are 16 bit integers
412
  /* Note that since the next and prev fields are 16 bit integers
 Lines 233-252    Link Here 
233
     only a limited number of elements can be stored in 
415
     only a limited number of elements can be stored in 
234
     a m_data byte buffer.
416
     a m_data byte buffer.
235
   */
417
   */
418
  /**
419
   * SmallItem structure
420
   */
236
  struct SmallItem {
421
  struct SmallItem {
237
    /* offset (in bytes) from start of m_data buffer 
422
    /** offset (in bytes) from start of m_data buffer
238
       to next element in linked list. value is 0xffff 
423
       to next element in linked list. value is 0xffff 
239
       if next element does not exist.
424
       if next element does not exist.
240
       stored as a fixed-size 16 bit integer.
425
       stored as a fixed-size 16 bit integer.
241
    */
426
    */
242
    uint16_t next;
427
    uint16_t next;
243
    /* offset (in bytes) from start of m_data buffer 
428
    /** offset (in bytes) from start of m_data buffer
244
       to previous element in linked list. value is 0xffff 
429
       to previous element in linked list. value is 0xffff 
245
       if previous element does not exist.
430
       if previous element does not exist.
246
       stored as a fixed-size 16 bit integer.
431
       stored as a fixed-size 16 bit integer.
247
     */
432
     */
248
    uint16_t prev;
433
    uint16_t prev;
249
    /* the high 31 bits of this field identify the 
434
    /** the high 31 bits of this field identify the
250
       type of the header or trailer represented by 
435
       type of the header or trailer represented by 
251
       this item: the value zero represents payload.
436
       this item: the value zero represents payload.
252
       If the low bit of this uid is one, an ExtraItem
437
       If the low bit of this uid is one, an ExtraItem
 Lines 254-265    Link Here 
254
       stored as a variable-size 32 bit integer.
439
       stored as a variable-size 32 bit integer.
255
     */
440
     */
256
    uint32_t typeUid;
441
    uint32_t typeUid;
257
    /* the size (in bytes) of the header or trailer represented
442
    /** the size (in bytes) of the header or trailer represented
258
       by this element.
443
       by this element.
259
       stored as a variable-size 32 bit integer.
444
       stored as a variable-size 32 bit integer.
260
     */
445
     */
261
    uint32_t size;
446
    uint32_t size;
262
    /* this field tries to uniquely identify each header or 
447
    /** this field tries to uniquely identify each header or
263
       trailer _instance_ while the typeUid field uniquely
448
       trailer _instance_ while the typeUid field uniquely
264
       identifies each header or trailer _type_. This field
449
       identifies each header or trailer _type_. This field
265
       is used to test whether two items are equal in the sense 
450
       is used to test whether two items are equal in the sense 
 Lines 273-290    Link Here 
273
     */
458
     */
274
    uint16_t chunkUid;
459
    uint16_t chunkUid;
275
  };
460
  };
461
462
  /**
463
   * ExtraItem structure
464
   */
276
  struct ExtraItem {
465
  struct ExtraItem {
277
    /* offset (in bytes) from start of original header to 
466
    /** offset (in bytes) from start of original header to
278
       the start of the fragment still present.
467
       the start of the fragment still present.
279
       stored as a variable-size 32 bit integer.
468
       stored as a variable-size 32 bit integer.
280
     */
469
     */
281
    uint32_t fragmentStart;
470
    uint32_t fragmentStart;
282
    /* offset (in bytes) from start of original header to 
471
    /** offset (in bytes) from start of original header to
283
       the end of the fragment still present.
472
       the end of the fragment still present.
284
       stored as a variable-size 32 bit integer.
473
       stored as a variable-size 32 bit integer.
285
     */
474
     */
286
    uint32_t fragmentEnd;
475
    uint32_t fragmentEnd;
287
    /* the packetUid of the packet in which this header or trailer
476
    /** the packetUid of the packet in which this header or trailer
288
       was first added. It could be different from the m_packetUid
477
       was first added. It could be different from the m_packetUid
289
       field if the user has aggregated multiple packets into one.
478
       field if the user has aggregated multiple packets into one.
290
       stored as a fixed-size 64 bit integer.
479
       stored as a fixed-size 64 bit integer.
 Lines 292-297    Link Here 
292
    uint64_t packetUid;
481
    uint64_t packetUid;
293
  };
482
  };
294
483
484
  /**
485
   * Class to hold all the metadata
486
   */
295
  class DataFreeList : public std::vector<struct Data *>
487
  class DataFreeList : public std::vector<struct Data *>
296
  {
488
  {
297
public:
489
public:
 Lines 303-362    Link Here 
303
495
304
  PacketMetadata ();
496
  PacketMetadata ();
305
497
498
  /**
499
   * Add a SmallItem
500
   * \param item the SmallItem to add
501
   * \return added size
502
   */
306
  inline uint16_t AddSmall (const PacketMetadata::SmallItem *item);
503
  inline uint16_t AddSmall (const PacketMetadata::SmallItem *item);
504
  /**
505
   * Add a "Big" Item (a SmallItem plus an ExtraItem)
506
   * \param head the head
507
   * \param tail the tail
508
   * \param item the SmallItem to add
509
   * \param extraItem the ExtraItem to add
510
   * \return added size
511
   */
307
  uint16_t AddBig (uint32_t head, uint32_t tail,
512
  uint16_t AddBig (uint32_t head, uint32_t tail,
308
                   const PacketMetadata::SmallItem *item, 
513
                   const PacketMetadata::SmallItem *item, 
309
                   const PacketMetadata::ExtraItem *extraItem);
514
                   const PacketMetadata::ExtraItem *extraItem);
515
  /**
516
   * Replace the tail
517
   * \param item the item data to write
518
   * \param extraItem the extra item data to write
519
   * \param available the number of bytes which can
520
   *        be written without having to rewrite the buffer entirely.
521
   */
310
  void ReplaceTail (PacketMetadata::SmallItem *item, 
522
  void ReplaceTail (PacketMetadata::SmallItem *item, 
311
                    PacketMetadata::ExtraItem *extraItem,
523
                    PacketMetadata::ExtraItem *extraItem,
312
                    uint32_t available);
524
                    uint32_t available);
525
  /**
526
   * Update the head
527
   * \param written the used bytes
528
   */
313
  inline void UpdateHead (uint16_t written);
529
  inline void UpdateHead (uint16_t written);
530
  /**
531
   * Update the tail
532
   * \param written the used bytes
533
   */
314
  inline void UpdateTail (uint16_t written);
534
  inline void UpdateTail (uint16_t written);
535
536
  /**
537
   * Get the ULEB128 (Unsigned Little Endian Base 128) size
538
   * \param value the value
539
   * \returns the value's ULEB128 size
540
   */
315
  inline uint32_t GetUleb128Size (uint32_t value) const;
541
  inline uint32_t GetUleb128Size (uint32_t value) const;
542
  /**
543
   * Read a ULEB128 (Unsigned Little Endian Base 128) coded number
544
   * \param pBuffer the buffer to read from
545
   * \returns the value
546
   */
316
  uint32_t ReadUleb128 (const uint8_t **pBuffer) const;
547
  uint32_t ReadUleb128 (const uint8_t **pBuffer) const;
548
  /**
549
   * Append a 16-bit value to the buffer
550
   * \param value the value to add
551
   * \param buffer the buffer to write to
552
   */
317
  inline void Append16 (uint16_t value, uint8_t *buffer);
553
  inline void Append16 (uint16_t value, uint8_t *buffer);
554
  /**
555
   * Append a 32-bit value to the buffer
556
   * \param value the value to add
557
   * \param buffer the buffer to write to
558
   */
318
  inline void Append32 (uint32_t value, uint8_t *buffer);
559
  inline void Append32 (uint32_t value, uint8_t *buffer);
560
  /**
561
   * Append a value to the buffer
562
   * \param value the value to add
563
   * \param buffer the buffer to write to
564
   */
319
  inline void AppendValue (uint32_t value, uint8_t *buffer);
565
  inline void AppendValue (uint32_t value, uint8_t *buffer);
566
  /**
567
   * \brief Append a value to the buffer - extra
568
   *
569
   * This function is called by AppendValue
570
   *
571
   * \param value the value to add
572
   * \param buffer the buffer to write to
573
   */
320
  void AppendValueExtra (uint32_t value, uint8_t *buffer);
574
  void AppendValueExtra (uint32_t value, uint8_t *buffer);
575
576
  /**
577
   * Reserve space
578
   * \param n space to reserve
579
   */
321
  inline void Reserve (uint32_t n);
580
  inline void Reserve (uint32_t n);
581
  /**
582
   * Reserve space and make a metadata copy
583
   * \param n space to reserve
584
   */
322
  void ReserveCopy (uint32_t n);
585
  void ReserveCopy (uint32_t n);
586
587
  /**
588
   * Get the total size used by the metadata
589
   */
323
  uint32_t GetTotalSize (void) const;
590
  uint32_t GetTotalSize (void) const;
591
592
  /**
593
   * Read items
594
   * \param current the offset we should start reading the data from
595
   * \param item pointer to where we should store the data to return to the caller
596
   * \param extraItem pointer to where we should store the data to return to the caller
597
   * \returns the number of bytes read.
598
   */
324
  uint32_t ReadItems (uint16_t current, 
599
  uint32_t ReadItems (uint16_t current, 
325
                      struct PacketMetadata::SmallItem *item,
600
                      struct PacketMetadata::SmallItem *item,
326
                      struct PacketMetadata::ExtraItem *extraItem) const;
601
                      struct PacketMetadata::ExtraItem *extraItem) const;
602
  /**
603
   * Add an header
604
   * \param uid header's uid to add
605
   * \param size header serialized size
606
   */
327
  void DoAddHeader (uint32_t uid, uint32_t size);
607
  void DoAddHeader (uint32_t uid, uint32_t size);
608
  /**
609
   * Check if the metadata state is ok
610
   * \returns true if the internal state is ok
611
   */
328
  bool IsStateOk (void) const;
612
  bool IsStateOk (void) const;
613
  /**
614
   * Check if the position is valid
615
   * \param pointer the position to check
616
   * \returns true if the position is valid
617
   */
329
  bool IsPointerOk (uint16_t pointer) const;
618
  bool IsPointerOk (uint16_t pointer) const;
619
  /**
620
   * Check if the position is valid
621
   * \param pointer the position to check
622
   * \returns true if the position is valid
623
   */
330
  bool IsSharedPointerOk (uint16_t pointer) const;
624
  bool IsSharedPointerOk (uint16_t pointer) const;
331
625
332
626
  /**
627
   * \brief Recycle the buffer memory
628
   * \param data the buffer data storage
629
   */
630
  static void Recycle (struct PacketMetadata::Data *data);
631
  /**
632
   * \brief Create a buffer data storage
633
   * \param size the storage size to create
634
   * \returns a pointer to the created buffer storage
635
   */
333
  static struct PacketMetadata::Data *Create (uint32_t size);
636
  static struct PacketMetadata::Data *Create (uint32_t size);
334
  static void Recycle (struct PacketMetadata::Data *data);
637
  /**
638
   * \brief Allocate a buffer data storage
639
   * \param n the storage size to create
640
   * \returns a pointer to the allocated buffer storage
641
   */
335
  static struct PacketMetadata::Data *Allocate (uint32_t n);
642
  static struct PacketMetadata::Data *Allocate (uint32_t n);
643
  /**
644
   * \brief Deallocate the buffer memory
645
   * \param data the buffer data storage
646
   */
336
  static void Deallocate (struct PacketMetadata::Data *data);
647
  static void Deallocate (struct PacketMetadata::Data *data);
337
648
338
  static DataFreeList m_freeList;
649
  static DataFreeList m_freeList; //!< the metadata data storage
339
  static bool m_enable;
650
  static bool m_enable; //!< Enable the packet metadata
340
  static bool m_enableChecking;
651
  static bool m_enableChecking; //!< Enable the packet metadata checking
341
652
342
  // set to true when adding metadata to a packet is skipped because
653
  /**
343
  // m_enable is false; used to detect enabling of metadata in the
654
   * Set to true when adding metadata to a packet is skipped because
344
  // middle of a simulation, which isn't allowed.
655
   * m_enable is false; used to detect enabling of metadata in the
656
   * middle of a simulation, which isn't allowed.
657
   */
345
  static bool m_metadataSkipped;
658
  static bool m_metadataSkipped;
346
659
347
  static uint32_t m_maxSize;
660
  static uint32_t m_maxSize; //!< maximum metadata size
348
  static uint16_t m_chunkUid;
661
  static uint16_t m_chunkUid; //!< Chunk Uid
349
662
350
  struct Data *m_data;
663
  struct Data *m_data; //!< Metadata storage
351
  /**
664
  /*
352
     head -(next)-> tail
665
     head -(next)-> tail
353
       ^             |
666
       ^             |
354
        \---(prev)---|
667
        \---(prev)---|
355
   */
668
   */
356
  uint16_t m_head;
669
  uint16_t m_head; //!< list head
357
  uint16_t m_tail;
670
  uint16_t m_tail; //!< list tail
358
  uint16_t m_used;
671
  uint16_t m_used; //!< used portion
359
  uint64_t m_packetUid;
672
  uint64_t m_packetUid; //!< packet Uid
360
};
673
};
361
674
362
} // namespace ns3
675
} // namespace ns3
(-)a/src/network/model/packet-tag-list.h (+1 lines)
 Lines 184-189    Link Here 
184
   * Assignment
184
   * Assignment
185
   *
185
   *
186
   * \param [in] o The PacketTagList to copy.
186
   * \param [in] o The PacketTagList to copy.
187
   * \returns the copied object
187
   *
188
   *
188
   * This makes a light-weight copy by #RemoveAll, then
189
   * This makes a light-weight copy by #RemoveAll, then
189
   * pointing to the same \ref TagData as \pname{o}.
190
   * pointing to the same \ref TagData as \pname{o}.
(-)a/src/network/model/packet.h (-14 / +61 lines)
 Lines 84-94    Link Here 
84
    void GetTag (Tag &tag) const;
84
    void GetTag (Tag &tag) const;
85
private:
85
private:
86
    friend class ByteTagIterator;
86
    friend class ByteTagIterator;
87
    /**
88
     * Constructor
89
     * \param tid the ns3::TypeId associated to this tag.
90
     * \param start the index of the first byte tagged by this tag.
91
     * \param end the index of the last byte tagged by this tag.
92
     * \param buffer the buffer associated with this tag.
93
     */
87
    Item (TypeId tid, uint32_t start, uint32_t end, TagBuffer buffer);
94
    Item (TypeId tid, uint32_t start, uint32_t end, TagBuffer buffer);
88
    TypeId m_tid;
95
89
    uint32_t m_start;
96
    TypeId m_tid;       //!< the ns3::TypeId associated to this tag.
90
    uint32_t m_end;
97
    uint32_t m_start;   //!< the index of the first byte tagged by this tag.
91
    TagBuffer m_buffer;
98
    uint32_t m_end;     //!< the index of the last byte tagged by this tag.
99
    TagBuffer m_buffer; //!< the buffer associated with this tag.
92
  };
100
  };
93
  /**
101
  /**
94
   * \returns true if calling Next is safe, false otherwise.
102
   * \returns true if calling Next is safe, false otherwise.
 Lines 100-107    Link Here 
100
  Item Next (void);
108
  Item Next (void);
101
private:
109
private:
102
  friend class Packet;
110
  friend class Packet;
111
  /**
112
   * Copy Constructor
113
   * \param i object to copy
114
   */
103
  ByteTagIterator (ByteTagList::Iterator i);
115
  ByteTagIterator (ByteTagList::Iterator i);
104
  ByteTagList::Iterator m_current;
116
  ByteTagList::Iterator m_current; //!< actual position over the set of byte tags in a packet
105
};
117
};
106
118
107
/**
119
/**
 Lines 134-141    Link Here 
134
    void GetTag (Tag &tag) const;
146
    void GetTag (Tag &tag) const;
135
private:
147
private:
136
    friend class PacketTagIterator;
148
    friend class PacketTagIterator;
149
    /**
150
     * Constructor
151
     * \param data the data to copy.
152
     */
137
    Item (const struct PacketTagList::TagData *data);
153
    Item (const struct PacketTagList::TagData *data);
138
    const struct PacketTagList::TagData *m_data;
154
    const struct PacketTagList::TagData *m_data; //!< the tag data
139
  };
155
  };
140
  /**
156
  /**
141
   * \returns true if calling Next is safe, false otherwise.
157
   * \returns true if calling Next is safe, false otherwise.
 Lines 147-154    Link Here 
147
  Item Next (void);
163
  Item Next (void);
148
private:
164
private:
149
  friend class Packet;
165
  friend class Packet;
166
  /**
167
   * Constructor
168
   * \param head head of the items
169
   */
150
  PacketTagIterator (const struct PacketTagList::TagData *head);
170
  PacketTagIterator (const struct PacketTagList::TagData *head);
151
  const struct PacketTagList::TagData *m_current;
171
  const struct PacketTagList::TagData *m_current;  //!< actual position over the set of tags in a packet
152
};
172
};
153
173
154
/**
174
/**
 Lines 209-215    Link Here 
209
   * by getUid).
229
   * by getUid).
210
   */
230
   */
211
  Packet ();
231
  Packet ();
232
  /**
233
   * Copy constructor
234
   * \param o object to copy
235
   */
212
  Packet (const Packet &o);
236
  Packet (const Packet &o);
237
  /**
238
   * Basic assignment
239
   * \param o object to copy
240
   * \return the copied object
241
   */
213
  Packet &operator = (const Packet &o);
242
  Packet &operator = (const Packet &o);
214
  /**
243
  /**
215
   * Create a packet with a zero-filled payload.
244
   * Create a packet with a zero-filled payload.
 Lines 569-600    Link Here 
569
   * with a packet.  This design methodology 
598
   * with a packet.  This design methodology 
570
   * should _not_ be followed, and is only here as an 
599
   * should _not_ be followed, and is only here as an 
571
   * impetus to fix this general issue.
600
   * impetus to fix this general issue.
601
   *
602
   * \param nixVector the nix vector
572
   */
603
   */
573
  void SetNixVector (Ptr<NixVector>);
604
  void SetNixVector (Ptr<NixVector> nixVector);
574
  /**
605
  /**
575
   * Get the packet nix-vector.
606
   * Get the packet nix-vector.
576
   *
607
   *
577
   * See the comment on SetNixVector
608
   * See the comment on SetNixVector
609
   *
610
   * \returns the Nix vector
578
   */
611
   */
579
  Ptr<NixVector> GetNixVector (void) const; 
612
  Ptr<NixVector> GetNixVector (void) const; 
580
613
581
private:
614
private:
615
  /**
616
   * Constructor
617
   * \param buffer the packet buffer
618
   * \param byteTagList the ByteTag list
619
   * \param packetTagList the packet's Tag list
620
   * \param metadata the packet's metadata
621
   */
582
  Packet (const Buffer &buffer, const ByteTagList &byteTagList, 
622
  Packet (const Buffer &buffer, const ByteTagList &byteTagList, 
583
          const PacketTagList &packetTagList, const PacketMetadata &metadata);
623
          const PacketTagList &packetTagList, const PacketMetadata &metadata);
584
624
585
  uint32_t Deserialize (uint8_t const*buffer, uint32_t size);
625
  uint32_t Deserialize (uint8_t const*buffer, uint32_t size);
586
626
587
  Buffer m_buffer;
627
  Buffer m_buffer;                //!< the packet buffer (it's actual contents)
588
  ByteTagList m_byteTagList;
628
  ByteTagList m_byteTagList;      //!< the ByteTag list
589
  PacketTagList m_packetTagList;
629
  PacketTagList m_packetTagList;  //!< the packet's Tag list
590
  PacketMetadata m_metadata;
630
  PacketMetadata m_metadata;      //!< the packet's metadata
591
631
592
  /* Please see comments above about nix-vector */
632
  /* Please see comments above about nix-vector */
593
  Ptr<NixVector> m_nixVector;
633
  Ptr<NixVector> m_nixVector; //!< the packet's Nix vector
594
634
595
  static uint32_t m_globalUid;
635
  static uint32_t m_globalUid; //!< Global counter of packets Uid
596
};
636
};
597
637
638
/**
639
 * \brief Stream insertion operator.
640
 *
641
 * \param os the stream
642
 * \param packet the packet
643
 * \returns a reference to the stream
644
 */
598
std::ostream& operator<< (std::ostream& os, const Packet &packet);
645
std::ostream& operator<< (std::ostream& os, const Packet &packet);
599
646
600
/**
647
/**
(-)a/src/network/model/socket-factory.h (+4 lines)
 Lines 48-53    Link Here 
48
class SocketFactory : public Object
48
class SocketFactory : public Object
49
{
49
{
50
public:
50
public:
51
  /**
52
   * \brief Get the type ID.
53
   * \return the object TypeId
54
   */
51
  static TypeId GetTypeId (void);
55
  static TypeId GetTypeId (void);
52
56
53
  SocketFactory ();
57
  SocketFactory ();
(-)a/src/network/model/tag-buffer.h (-2 / +18 lines)
 Lines 51-58    Link Here 
51
class TagBuffer
51
class TagBuffer
52
{
52
{
53
public:
53
public:
54
55
  /**
56
   * \brief Constructor
57
   * \param start start position
58
   * \param end end position
59
   */
54
  TagBuffer (uint8_t *start, uint8_t *end);
60
  TagBuffer (uint8_t *start, uint8_t *end);
61
62
  /**
63
   * \brief Trim some space from the end
64
   * \param trim space to remove
65
   */
55
  void TrimAtEnd (uint32_t trim);
66
  void TrimAtEnd (uint32_t trim);
67
68
  /**
69
   * \brief Copy the nternal structure of another TagBuffer
70
   * \param o the TagBuffer to copy from
71
   */
56
  void CopyFrom (TagBuffer o);
72
  void CopyFrom (TagBuffer o);
57
73
58
  /**
74
  /**
 Lines 140-147    Link Here 
140
  void Read (uint8_t *buffer, uint32_t size);
156
  void Read (uint8_t *buffer, uint32_t size);
141
private:
157
private:
142
158
143
  uint8_t *m_current;
159
  uint8_t *m_current; //!< current TagBuffer position
144
  uint8_t *m_end;
160
  uint8_t *m_end;     //!< end TagBuffer position
145
};
161
};
146
162
147
} // namespace ns3
163
} // namespace ns3
(-)a/src/network/model/tag.h (+4 lines)
 Lines 36-41    Link Here 
36
class Tag : public ObjectBase
36
class Tag : public ObjectBase
37
{
37
{
38
public:
38
public:
39
  /**
40
   * \brief Get the type ID.
41
   * \return the object TypeId
42
   */
39
  static TypeId GetTypeId (void);
43
  static TypeId GetTypeId (void);
40
44
41
  /**
45
  /**
(-)a/src/network/model/trailer.h (+11 lines)
 Lines 40-45    Link Here 
40
class Trailer : public Chunk
40
class Trailer : public Chunk
41
{
41
{
42
public:
42
public:
43
  /**
44
   * \brief Get the type ID.
45
   * \return the object TypeId
46
   */
43
  static TypeId GetTypeId (void);
47
  static TypeId GetTypeId (void);
44
  virtual ~Trailer ();
48
  virtual ~Trailer ();
45
  /**
49
  /**
 Lines 93-98    Link Here 
93
  virtual void Print (std::ostream &os) const = 0;
97
  virtual void Print (std::ostream &os) const = 0;
94
};
98
};
95
99
100
/**
101
 * \brief Stream insertion operator.
102
 *
103
 * \param os the stream
104
 * \param trailer the trailer
105
 * \returns a reference to the stream
106
 */
96
std::ostream & operator << (std::ostream &os, const Trailer &trailer);
107
std::ostream & operator << (std::ostream &os, const Trailer &trailer);
97
108
98
} // namespace ns3
109
} // namespace ns3
(-)a/src/network/utils/ascii-file.h (-2 / +2 lines)
 Lines 85-92    Link Here 
85
                    uint64_t & lineNumber);
85
                    uint64_t & lineNumber);
86
86
87
private:
87
private:
88
  std::string    m_filename;
88
  std::string    m_filename; //!< output file name
89
  std::fstream   m_file;
89
  std::fstream   m_file;     //!< output file
90
};
90
};
91
91
92
} // namespace ns3
92
} // namespace ns3
(-)a/src/network/utils/crc32.cc (+3 lines)
 Lines 29-34    Link Here 
29
29
30
namespace ns3 {
30
namespace ns3 {
31
31
32
/**
33
 * Table of CRC-32 values.
34
 */
32
static uint32_t crc32table[256] = {
35
static uint32_t crc32table[256] = {
33
0x00000000,0x77073096,0xEE0E612C,0x990951BA,0x076DC419,0x706AF48F,0xE963A535,0x9E6495A3,
36
0x00000000,0x77073096,0xEE0E612C,0x990951BA,0x076DC419,0x706AF48F,0xE963A535,0x9E6495A3,
34
0x0EDB8832,0x79DCB8A4,0xE0D5E91E,0x97D2D988,0x09B64C2B,0x7EB17CBD,0xE7B82D07,0x90BF1D91,
37
0x0EDB8832,0x79DCB8A4,0xE0D5E91E,0x97D2D988,0x09B64C2B,0x7EB17CBD,0xE7B82D07,0x90BF1D91,
(-)a/src/network/utils/crc32.h (-1 / +3 lines)
 Lines 24-32    Link Here 
24
namespace ns3 {
24
namespace ns3 {
25
25
26
/**
26
/**
27
 * Calculates the CRC-32 for a given input
28
 *
27
 * \param data buffer to calculate the checksum for
29
 * \param data buffer to calculate the checksum for
28
 * \param length the length of the buffer (bytes)
30
 * \param length the length of the buffer (bytes)
29
 * \returns the computed crc.
31
 * \returns the computed crc-32.
30
 *
32
 *
31
 */
33
 */
32
uint32_t CRC32Calculate (const uint8_t *data, int length);
34
uint32_t CRC32Calculate (const uint8_t *data, int length);
(-)a/src/network/utils/data-rate.cc (-17 / +2 lines)
 Lines 182-188    Link Here 
182
182
183
namespace ns3 {
183
namespace ns3 {
184
184
185
ATTRIBUTE_HELPER_CPP (DataRate);  /// Macro to make help make data-rate an ns-3 attribute
185
ATTRIBUTE_HELPER_CPP (DataRate);  //!< Macro to make help make data-rate an ns-3 attribute
186
186
187
DataRate::DataRate ()
187
DataRate::DataRate ()
188
  : m_bps (0)
188
  : m_bps (0)
 Lines 269-294    Link Here 
269
  return is;
269
  return is;
270
}
270
}
271
271
272
/**
273
  * \brief Multiply datarate by a time value
274
  *
275
  * Calculates the number of bits that have been transmitted over a period of time
276
  * \param lhs rate
277
  * \param rhs time
278
  * \return the number of bits over the period of time
279
  */
280
double operator* (const DataRate& lhs, const Time& rhs)
272
double operator* (const DataRate& lhs, const Time& rhs)
281
{
273
{
282
  return rhs.GetSeconds ()*lhs.GetBitRate ();
274
  return rhs.GetSeconds ()*lhs.GetBitRate ();
283
}
275
}
284
/**
276
285
  * \brief Multiply time value by a data rate
286
  *
287
  * Calculates the number of bits that have been transmitted over a period of time
288
  * \param lhs time
289
  * \param rhs rate
290
  * \return the number of bits over the period of time
291
  */
292
double operator* (const Time& lhs, const DataRate& rhs)
277
double operator* (const Time& lhs, const DataRate& rhs)
293
{
278
{
294
  return lhs.GetSeconds ()*rhs.GetBitRate ();
279
  return lhs.GetSeconds ()*rhs.GetBitRate ();
(-)a/src/network/utils/data-rate.h (-6 / +33 lines)
 Lines 159-169    Link Here 
159
  uint64_t GetBitRate () const;
159
  uint64_t GetBitRate () const;
160
160
161
private:
161
private:
162
  uint64_t m_bps;
162
  uint64_t m_bps; //!< data rate [bps]
163
  static uint64_t Parse (const std::string);
164
};
163
};
165
164
165
/**
166
 * \brief Stream insertion operator.
167
 *
168
 * \param os the stream
169
 * \param rate the data rate
170
 * \returns a reference to the stream
171
 */
166
std::ostream &operator << (std::ostream &os, const DataRate &rate);
172
std::ostream &operator << (std::ostream &os, const DataRate &rate);
173
174
/**
175
 * \brief Stream extraction operator.
176
 *
177
 * \param is the stream
178
 * \param rate the data rate
179
 * \returns a reference to the stream
180
 */
167
std::istream &operator >> (std::istream &is, DataRate &rate);
181
std::istream &operator >> (std::istream &is, DataRate &rate);
168
182
169
/**
183
/**
 Lines 172-187    Link Here 
172
 */
186
 */
173
187
174
188
175
ATTRIBUTE_HELPER_HEADER (DataRate);   /// Macro to make help make data-rate an ns-3 attribute
189
ATTRIBUTE_HELPER_HEADER (DataRate);   //!< Macro to make help make data-rate an ns-3 attribute
190
176
191
177
/**
192
/**
178
 * \param lhs
193
 * \brief Multiply datarate by a time value
179
 * \param rhs
194
 *
180
 * \return Bits transmitted in rhs seconds at lhs b/s
195
 * Calculates the number of bits that have been transmitted over a period of time
196
 * \param lhs rate
197
 * \param rhs time
198
 * \return the number of bits over the period of time
181
 */
199
 */
182
double operator* (const DataRate& lhs, const Time& rhs);
200
double operator* (const DataRate& lhs, const Time& rhs);
201
/**
202
 * \brief Multiply time value by a data rate
203
 *
204
 * Calculates the number of bits that have been transmitted over a period of time
205
 * \param lhs time
206
 * \param rhs rate
207
 * \return the number of bits over the period of time
208
 */
183
double operator* (const Time& lhs, const DataRate& rhs);
209
double operator* (const Time& lhs, const DataRate& rhs);
184
210
211
185
} // namespace ns3
212
} // namespace ns3
186
213
187
#endif /* DATA_RATE_H */
214
#endif /* DATA_RATE_H */
(-)a/src/network/utils/drop-tail-queue.h (-5 / +9 lines)
 Lines 34-39    Link Here 
34
 */
34
 */
35
class DropTailQueue : public Queue {
35
class DropTailQueue : public Queue {
36
public:
36
public:
37
  /**
38
   * \brief Get the type ID.
39
   * \return the object TypeId
40
   */
37
  static TypeId GetTypeId (void);
41
  static TypeId GetTypeId (void);
38
  /**
42
  /**
39
   * \brief DropTailQueue Constructor
43
   * \brief DropTailQueue Constructor
 Lines 64-74    Link Here 
64
  virtual Ptr<Packet> DoDequeue (void);
68
  virtual Ptr<Packet> DoDequeue (void);
65
  virtual Ptr<const Packet> DoPeek (void) const;
69
  virtual Ptr<const Packet> DoPeek (void) const;
66
70
67
  std::queue<Ptr<Packet> > m_packets;
71
  std::queue<Ptr<Packet> > m_packets; //!< the packets in the queue
68
  uint32_t m_maxPackets;
72
  uint32_t m_maxPackets;              //!< max packets in the queue
69
  uint32_t m_maxBytes;
73
  uint32_t m_maxBytes;                //!< max bytes in the queue
70
  uint32_t m_bytesInQueue;
74
  uint32_t m_bytesInQueue;            //!< actual bytes in the queue
71
  QueueMode m_mode;
75
  QueueMode m_mode;                   //!< queue mode (packets or bytes limited)
72
};
76
};
73
77
74
} // namespace ns3
78
} // namespace ns3
(-)a/src/network/utils/error-model.h (-19 / +66 lines)
 Lines 115-120    Link Here 
115
class ErrorModel : public Object
115
class ErrorModel : public Object
116
{
116
{
117
public:
117
public:
118
  /**
119
   * \brief Get the type ID.
120
   * \return the object TypeId
121
   */
118
  static TypeId GetTypeId (void);
122
  static TypeId GetTypeId (void);
119
123
120
  ErrorModel ();
124
  ErrorModel ();
 Lines 146-158    Link Here 
146
  bool IsEnabled (void) const;
150
  bool IsEnabled (void) const;
147
151
148
private:
152
private:
149
  /*
153
  /**
150
   * These methods must be implemented by subclasses
154
   * Corrupt a packet according to the specified model.
155
   * \param p the packet to corrupt
156
   * \returns true if the packet is corrupted
151
   */
157
   */
152
  virtual bool DoCorrupt (Ptr<Packet>) = 0;
158
  virtual bool DoCorrupt (Ptr<Packet> p) = 0;
159
  /**
160
   * Re-initialize any state
161
   */
153
  virtual void DoReset (void) = 0;
162
  virtual void DoReset (void) = 0;
154
163
155
  bool m_enable;
164
  bool m_enable; //!< True if the error model is enabled
156
};
165
};
157
166
158
/**
167
/**
 Lines 173-183    Link Here 
173
class RateErrorModel : public ErrorModel
182
class RateErrorModel : public ErrorModel
174
{
183
{
175
public:
184
public:
185
  /**
186
   * \brief Get the type ID.
187
   * \return the object TypeId
188
   */
176
  static TypeId GetTypeId (void);
189
  static TypeId GetTypeId (void);
177
190
178
  RateErrorModel ();
191
  RateErrorModel ();
179
  virtual ~RateErrorModel ();
192
  virtual ~RateErrorModel ();
180
193
194
  /**
195
   * Error unit. The error model can be packet, Byte or bit based.
196
   */
181
  enum ErrorUnit
197
  enum ErrorUnit
182
  {
198
  {
183
    ERROR_UNIT_BIT,
199
    ERROR_UNIT_BIT,
 Lines 220-234    Link Here 
220
236
221
private:
237
private:
222
  virtual bool DoCorrupt (Ptr<Packet> p);
238
  virtual bool DoCorrupt (Ptr<Packet> p);
239
  /**
240
   * Corrupt a packet (packet unit).
241
   * \param p the packet to corrupt
242
   * \returns true if the packet is corrupted
243
   */
223
  virtual bool DoCorruptPkt (Ptr<Packet> p);
244
  virtual bool DoCorruptPkt (Ptr<Packet> p);
245
  /**
246
   * Corrupt a packet (Byte unit).
247
   * \param p the packet to corrupt
248
   * \returns true if the packet is corrupted
249
   */
224
  virtual bool DoCorruptByte (Ptr<Packet> p);
250
  virtual bool DoCorruptByte (Ptr<Packet> p);
251
  /**
252
   * Corrupt a packet (bit unit).
253
   * \param p the packet to corrupt
254
   * \returns true if the packet is corrupted
255
   */
225
  virtual bool DoCorruptBit (Ptr<Packet> p);
256
  virtual bool DoCorruptBit (Ptr<Packet> p);
226
  virtual void DoReset (void);
257
  virtual void DoReset (void);
227
258
228
  enum ErrorUnit m_unit;
259
  enum ErrorUnit m_unit; //!< Error rate unit
229
  double m_rate;
260
  double m_rate; //!< Error rate
230
261
231
  Ptr<RandomVariableStream> m_ranvar;
262
  Ptr<RandomVariableStream> m_ranvar; //!< rng stream
232
};
263
};
233
264
234
265
 Lines 267-272    Link Here 
267
class BurstErrorModel : public ErrorModel
298
class BurstErrorModel : public ErrorModel
268
{
299
{
269
public:
300
public:
301
  /**
302
   * \brief Get the type ID.
303
   * \return the object TypeId
304
   */
270
  static TypeId GetTypeId (void);
305
  static TypeId GetTypeId (void);
271
306
272
  BurstErrorModel ();
307
  BurstErrorModel ();
 Lines 305-320    Link Here 
305
  virtual bool DoCorrupt (Ptr<Packet> p);
340
  virtual bool DoCorrupt (Ptr<Packet> p);
306
  virtual void DoReset (void);
341
  virtual void DoReset (void);
307
342
308
  double m_burstRate;                         //the burst error event
343
  double m_burstRate;                         //!< the burst error event
344
  Ptr<RandomVariableStream> m_burstStart;     //!< the error decision variable
345
  Ptr<RandomVariableStream> m_burstSize;      //!< the number of packets being flagged as errored
309
346
310
  Ptr<RandomVariableStream> m_burstStart;     //the error decision variable
347
  /**
311
348
   * keep track of the number of packets being errored
312
  Ptr<RandomVariableStream> m_burstSize;      //the number of packets being flagged as errored
349
   * until it reaches m_burstSize
313
350
   */
314
  uint32_t m_counter;                         //keep track of the number of packets being errored
351
  uint32_t m_counter;
315
                                              //until it reaches m_burstSize
352
  uint32_t m_currentBurstSz;                  //!< the current burst size
316
317
  uint32_t m_currentBurstSz;                  //the current burst size
318
353
319
};
354
};
320
355
 Lines 344-349    Link Here 
344
class ListErrorModel : public ErrorModel
379
class ListErrorModel : public ErrorModel
345
{
380
{
346
public:
381
public:
382
  /**
383
   * \brief Get the type ID.
384
   * \return the object TypeId
385
   */
347
  static TypeId GetTypeId (void);
386
  static TypeId GetTypeId (void);
348
  ListErrorModel ();
387
  ListErrorModel ();
349
  virtual ~ListErrorModel ();
388
  virtual ~ListErrorModel ();
 Lines 363-372    Link Here 
363
  virtual bool DoCorrupt (Ptr<Packet> p);
402
  virtual bool DoCorrupt (Ptr<Packet> p);
364
  virtual void DoReset (void);
403
  virtual void DoReset (void);
365
404
405
  /// Typedef: packet Uid list
366
  typedef std::list<uint32_t> PacketList;
406
  typedef std::list<uint32_t> PacketList;
407
  /// Typedef: packet Uid list const iterator
367
  typedef std::list<uint32_t>::const_iterator PacketListCI;
408
  typedef std::list<uint32_t>::const_iterator PacketListCI;
368
409
369
  PacketList m_packetList;
410
  PacketList m_packetList; //!< container of Uid of packets to corrupt
370
411
371
};
412
};
372
413
 Lines 385-390    Link Here 
385
class ReceiveListErrorModel : public ErrorModel
426
class ReceiveListErrorModel : public ErrorModel
386
{
427
{
387
public:
428
public:
429
  /**
430
   * \brief Get the type ID.
431
   * \return the object TypeId
432
   */
388
  static TypeId GetTypeId (void);
433
  static TypeId GetTypeId (void);
389
  ReceiveListErrorModel ();
434
  ReceiveListErrorModel ();
390
  virtual ~ReceiveListErrorModel ();
435
  virtual ~ReceiveListErrorModel ();
 Lines 404-414    Link Here 
404
  virtual bool DoCorrupt (Ptr<Packet> p);
449
  virtual bool DoCorrupt (Ptr<Packet> p);
405
  virtual void DoReset (void);
450
  virtual void DoReset (void);
406
451
452
  /// Typedef: packet sequence number list
407
  typedef std::list<uint32_t> PacketList;
453
  typedef std::list<uint32_t> PacketList;
454
  /// Typedef: packet sequence number list const iterator
408
  typedef std::list<uint32_t>::const_iterator PacketListCI;
455
  typedef std::list<uint32_t>::const_iterator PacketListCI;
409
456
410
  PacketList m_packetList;
457
  PacketList m_packetList; //!< container of sequence number of packets to corrupt
411
  uint32_t m_timesInvoked;
458
  uint32_t m_timesInvoked; //!< number of times the error model has been invoked
412
459
413
};
460
};
414
461
(-)a/src/network/utils/ethernet-header.h (-7 / +11 lines)
 Lines 103-108    Link Here 
103
   */
103
   */
104
  uint32_t GetHeaderSize () const;
104
  uint32_t GetHeaderSize () const;
105
105
106
  /**
107
   * \brief Get the type ID.
108
   * \return the object TypeId
109
   */
106
  static TypeId GetTypeId (void);
110
  static TypeId GetTypeId (void);
107
  virtual TypeId GetInstanceTypeId (void) const;
111
  virtual TypeId GetInstanceTypeId (void) const;
108
  virtual void Print (std::ostream &os) const;
112
  virtual void Print (std::ostream &os) const;
 Lines 110-127    Link Here 
110
  virtual void Serialize (Buffer::Iterator start) const;
114
  virtual void Serialize (Buffer::Iterator start) const;
111
  virtual uint32_t Deserialize (Buffer::Iterator start);
115
  virtual uint32_t Deserialize (Buffer::Iterator start);
112
private:
116
private:
113
  static const int PREAMBLE_SIZE = 8; /// size of the preamble_sfd header field
117
  static const int PREAMBLE_SIZE = 8; //!< size of the preamble_sfd header field
114
  static const int LENGTH_SIZE = 2;   /// size of the length_type header field
118
  static const int LENGTH_SIZE = 2;   //!< size of the length_type header field
115
  static const int MAC_ADDR_SIZE = 6; /// size of src/dest addr header fields
119
  static const int MAC_ADDR_SIZE = 6; //!< size of src/dest addr header fields
116
120
117
  /**
121
  /**
118
   * If false, the preamble/sfd are not serialised/deserialised.
122
   * If false, the preamble/sfd are not serialised/deserialised.
119
   */
123
   */
120
  bool m_enPreambleSfd;
124
  bool m_enPreambleSfd;
121
  uint64_t m_preambleSfd;     /// Value of the Preamble/SFD fields
125
  uint64_t m_preambleSfd;     //!< Value of the Preamble/SFD fields
122
  uint16_t m_lengthType;      /// Length or type of the packet
126
  uint16_t m_lengthType;      //!< Length or type of the packet
123
  Mac48Address m_source;        /// Source address
127
  Mac48Address m_source;        //!< Source address
124
  Mac48Address m_destination;   /// Destination address
128
  Mac48Address m_destination;   //!< Destination address
125
};
129
};
126
130
127
} // namespace ns3
131
} // namespace ns3
(-)a/src/network/utils/ethernet-trailer.h (-1 / +5 lines)
 Lines 90-95    Link Here 
90
   */ 
90
   */ 
91
  uint32_t GetTrailerSize () const;
91
  uint32_t GetTrailerSize () const;
92
92
93
  /**
94
   * \brief Get the type ID.
95
   * \return the object TypeId
96
   */
93
  static TypeId GetTypeId (void);
97
  static TypeId GetTypeId (void);
94
  virtual TypeId GetInstanceTypeId (void) const;
98
  virtual TypeId GetInstanceTypeId (void) const;
95
  virtual void Print (std::ostream &os) const;
99
  virtual void Print (std::ostream &os) const;
 Lines 102-108    Link Here 
102
   * returns true.
106
   * returns true.
103
   */
107
   */
104
  bool m_calcFcs;
108
  bool m_calcFcs;
105
  uint32_t m_fcs; /// Value of the fcs contained in the trailer
109
  uint32_t m_fcs; //!< Value of the fcs contained in the trailer
106
110
107
};
111
};
108
112
(-)a/src/network/utils/flow-id-tag.h (-1 / +5 lines)
 Lines 27-32    Link Here 
27
class FlowIdTag : public Tag
27
class FlowIdTag : public Tag
28
{
28
{
29
public:
29
public:
30
  /**
31
   * \brief Get the type ID.
32
   * \return the object TypeId
33
   */
30
  static TypeId GetTypeId (void);
34
  static TypeId GetTypeId (void);
31
  virtual TypeId GetInstanceTypeId (void) const;
35
  virtual TypeId GetInstanceTypeId (void) const;
32
  virtual uint32_t GetSerializedSize (void) const;
36
  virtual uint32_t GetSerializedSize (void) const;
 Lines 57-63    Link Here 
57
   */
61
   */
58
  static uint32_t AllocateFlowId (void);
62
  static uint32_t AllocateFlowId (void);
59
private:
63
private:
60
  uint32_t m_flowId;
64
  uint32_t m_flowId; //!< Flow ID
61
};
65
};
62
66
63
} // namespace ns3
67
} // namespace ns3
(-)a/src/network/utils/inet-socket-address.h (-5 / +14 lines)
 Lines 99-116    Link Here 
99
  operator Address () const;
99
  operator Address () const;
100
100
101
  /**
101
  /**
102
   * \brief Returns an InetSocketAddress which corresponds to the input
103
   * Address.
104
   *
102
   * \param address the Address instance to convert from.
105
   * \param address the Address instance to convert from.
103
   *
106
   * \returns an InetSocketAddress
104
   * Returns an InetSocketAddress which corresponds to the input
105
   * Address
106
   */
107
   */
107
  static InetSocketAddress ConvertFrom (const Address &address);
108
  static InetSocketAddress ConvertFrom (const Address &address);
108
private:
109
private:
110
  /**
111
   * \brief Convert to an Address type
112
   */
109
  Address ConvertTo (void) const;
113
  Address ConvertTo (void) const;
110
114
115
  /**
116
   * \brief Get the underlying address type (automatically assigned).
117
   *
118
   * \returns the address type
119
   */
111
  static uint8_t GetType (void);
120
  static uint8_t GetType (void);
112
  Ipv4Address m_ipv4;
121
  Ipv4Address m_ipv4; //!< the IPv4 address
113
  uint16_t m_port;
122
  uint16_t m_port;    //!< the port
114
};
123
};
115
124
116
} // namespace ns3
125
} // namespace ns3
(-)a/src/network/utils/ipv4-address.cc (-2 / +7 lines)
 Lines 31-36    Link Here 
31
#define ASCII_ZERO (0x30)
31
#define ASCII_ZERO (0x30)
32
#define ASCII_SLASH (0x2f)
32
#define ASCII_SLASH (0x2f)
33
33
34
/**
35
 * \brief Converts a string representing an IP address into the address
36
 * \param address the address string
37
 * \returns the address
38
 */
34
static uint32_t 
39
static uint32_t 
35
AsciiToIpv4Host (char const *address)
40
AsciiToIpv4Host (char const *address)
36
{
41
{
 Lines 417-423    Link Here 
417
  return !a.IsEqual (b);
422
  return !a.IsEqual (b);
418
}
423
}
419
424
420
ATTRIBUTE_HELPER_CPP (Ipv4Address); /// Macro to make help make class an ns-3 attribute
425
ATTRIBUTE_HELPER_CPP (Ipv4Address); //!< Macro to make help make class an ns-3 attribute
421
ATTRIBUTE_HELPER_CPP (Ipv4Mask);    /// Macro to make help make class an ns-3 attribute
426
ATTRIBUTE_HELPER_CPP (Ipv4Mask);    //!< Macro to make help make class an ns-3 attribute
422
427
423
} // namespace ns3
428
} // namespace ns3
(-)a/src/network/utils/ipv4-address.h (-6 / +90 lines)
 Lines 123-128    Link Here 
123
   * address.
123
   * address.
124
   *
124
   *
125
   * \param mask a network mask 
125
   * \param mask a network mask 
126
   * \returns the address combined with the mask
126
   */
127
   */
127
  Ipv4Address CombineMask (Ipv4Mask const &mask) const;
128
  Ipv4Address CombineMask (Ipv4Mask const &mask) const;
128
  /**
129
  /**
 Lines 134-139    Link Here 
134
   * there is no subnet associated with a /32 address.
135
   * there is no subnet associated with a /32 address.
135
   *
136
   *
136
   * \param mask a network mask 
137
   * \param mask a network mask 
138
   * \returns a broadcast address for the subnet.
137
   */
139
   */
138
  Ipv4Address GetSubnetDirectedBroadcast (Ipv4Mask const &mask) const;
140
  Ipv4Address GetSubnetDirectedBroadcast (Ipv4Mask const &mask) const;
139
  /**
141
  /**
 Lines 189-201    Link Here 
189
  static Ipv4Address GetLoopback (void);
191
  static Ipv4Address GetLoopback (void);
190
192
191
private:
193
private:
194
195
  /**
196
   * \brief Convert to an Address type
197
   */
192
  Address ConvertTo (void) const;
198
  Address ConvertTo (void) const;
199
200
  /**
201
   * \brief Get the underlying address type (automatically assigned).
202
   *
203
   * \returns the address type
204
   */
193
  static uint8_t GetType (void);
205
  static uint8_t GetType (void);
194
  uint32_t m_address;
206
  uint32_t m_address; //!< IPv4 address
195
207
196
  friend bool operator == (Ipv4Address const &a, Ipv4Address const &b);
208
  friend bool operator == (Ipv4Address const &a, Ipv4Address const &b);
197
  friend bool operator != (Ipv4Address const &a, Ipv4Address const &b);
209
  friend bool operator != (Ipv4Address const &a, Ipv4Address const &b);
198
  friend bool operator < (Ipv4Address const &addrA, Ipv4Address const &addrB);
210
  friend bool operator < (Ipv4Address const &a, Ipv4Address const &b);
199
};
211
};
200
212
201
/**
213
/**
 Lines 274-280    Link Here 
274
  static Ipv4Mask GetOnes (void);
286
  static Ipv4Mask GetOnes (void);
275
287
276
private:
288
private:
277
  uint32_t m_mask;
289
  uint32_t m_mask; //!< IP mask
278
};
290
};
279
291
280
/**
292
/**
 Lines 286-319    Link Here 
286
 * \brief hold objects of type ns3::Ipv4Mask
298
 * \brief hold objects of type ns3::Ipv4Mask
287
 */
299
 */
288
300
289
ATTRIBUTE_HELPER_HEADER (Ipv4Address);  /// Macro to make help make class an ns-3 attribute
301
ATTRIBUTE_HELPER_HEADER (Ipv4Address);  //!< Macro to make help make class an ns-3 attribute
290
ATTRIBUTE_HELPER_HEADER (Ipv4Mask);     /// Macro to make help make class an ns-3 attribute
302
ATTRIBUTE_HELPER_HEADER (Ipv4Mask);     //!< Macro to make help make class an ns-3 attribute
291
303
304
/**
305
 * \brief Stream insertion operator.
306
 *
307
 * \param os the stream
308
 * \param address the address
309
 * \returns a reference to the stream
310
 */
292
std::ostream& operator<< (std::ostream& os, Ipv4Address const& address);
311
std::ostream& operator<< (std::ostream& os, Ipv4Address const& address);
312
/**
313
 * \brief Stream insertion operator.
314
 *
315
 * \param os the stream
316
 * \param mask the mask
317
 * \returns a reference to the stream
318
 */
293
std::ostream& operator<< (std::ostream& os, Ipv4Mask const& mask);
319
std::ostream& operator<< (std::ostream& os, Ipv4Mask const& mask);
320
/**
321
 * \brief Stream extraction operator.
322
 *
323
 * \param is the stream
324
 * \param address the address
325
 * \returns a reference to the stream
326
 */
294
std::istream & operator >> (std::istream &is, Ipv4Address &address);
327
std::istream & operator >> (std::istream &is, Ipv4Address &address);
328
/**
329
 * \brief Stream extraction operator.
330
 *
331
 * \param is the stream
332
 * \param mask the mask
333
 * \returns a reference to the stream
334
 */
295
std::istream & operator >> (std::istream &is, Ipv4Mask &mask);
335
std::istream & operator >> (std::istream &is, Ipv4Mask &mask);
296
336
337
/**
338
 * \brief Equal to operator.
339
 *
340
 * \param a the first operand
341
 * \param b the first operand
342
 * \returns true if the operands are equal
343
 */
297
inline bool operator == (const Ipv4Address &a, const Ipv4Address &b)
344
inline bool operator == (const Ipv4Address &a, const Ipv4Address &b)
298
{
345
{
299
  return (a.m_address == b.m_address);
346
  return (a.m_address == b.m_address);
300
}
347
}
348
/**
349
 * \brief Not equal to operator.
350
 *
351
 * \param a the first operand
352
 * \param b the first operand
353
 * \returns true if the operands are not equal
354
 */
301
inline bool operator != (const Ipv4Address &a, const Ipv4Address &b)
355
inline bool operator != (const Ipv4Address &a, const Ipv4Address &b)
302
{
356
{
303
  return (a.m_address != b.m_address);
357
  return (a.m_address != b.m_address);
304
}
358
}
359
/**
360
 * \brief Less than operator.
361
 *
362
 * \param a the first operand
363
 * \param b the first operand
364
 * \returns true if the operand a is less than operand b
365
 */
305
inline bool operator < (const Ipv4Address &a, const Ipv4Address &b)
366
inline bool operator < (const Ipv4Address &a, const Ipv4Address &b)
306
{
367
{
307
  return (a.m_address < b.m_address);
368
  return (a.m_address < b.m_address);
308
}
369
}
309
370
310
371
/**
372
 * \ingroup address
373
 *
374
 * \brief Class providing an hash for IPv4 addresses
375
 */
311
class Ipv4AddressHash : public std::unary_function<Ipv4Address, size_t> {
376
class Ipv4AddressHash : public std::unary_function<Ipv4Address, size_t> {
312
public:
377
public:
378
  /**
379
   * Returns the hash of the address
380
   * \param x the address
381
   * \return the hash
382
   */
313
  size_t operator() (Ipv4Address const &x) const;
383
  size_t operator() (Ipv4Address const &x) const;
314
};
384
};
315
385
386
/**
387
 * \brief Equal to operator.
388
 *
389
 * \param a the first operand
390
 * \param b the first operand
391
 * \returns true if the operands are equal
392
 */
316
bool operator == (Ipv4Mask const &a, Ipv4Mask const &b);
393
bool operator == (Ipv4Mask const &a, Ipv4Mask const &b);
394
/**
395
 * \brief Not equal to operator.
396
 *
397
 * \param a the first operand
398
 * \param b the first operand
399
 * \returns true if the operands are not equal
400
 */
317
bool operator != (Ipv4Mask const &a, Ipv4Mask const &b);
401
bool operator != (Ipv4Mask const &a, Ipv4Mask const &b);
318
402
319
} // namespace ns3
403
} // namespace ns3
(-)a/src/network/utils/ipv6-address.cc (-2 / +2 lines)
 Lines 1011-1018    Link Here 
1011
  return lookuphash (buf, sizeof (buf), 0);
1011
  return lookuphash (buf, sizeof (buf), 0);
1012
}
1012
}
1013
1013
1014
ATTRIBUTE_HELPER_CPP (Ipv6Address); /// Macro to make help make class an ns-3 attribute
1014
ATTRIBUTE_HELPER_CPP (Ipv6Address); //!< Macro to make help make class an ns-3 attribute
1015
ATTRIBUTE_HELPER_CPP (Ipv6Prefix);  /// Macro to make help make class an ns-3 attribute
1015
ATTRIBUTE_HELPER_CPP (Ipv6Prefix);  //!< Macro to make help make class an ns-3 attribute
1016
1016
1017
} /* namespace ns3 */
1017
} /* namespace ns3 */
1018
1018
(-)a/src/network/utils/ipv6-address.h (-2 / +2 lines)
 Lines 510-522    Link Here 
510
 * \class ns3::Ipv6AddressValue
510
 * \class ns3::Ipv6AddressValue
511
 * \brief Hold objects of type ns3::Ipv6Address
511
 * \brief Hold objects of type ns3::Ipv6Address
512
 */
512
 */
513
ATTRIBUTE_HELPER_HEADER (Ipv6Address);  /// Macro to make help make class an ns-3 attribute
513
ATTRIBUTE_HELPER_HEADER (Ipv6Address);  //!< Macro to make help make class an ns-3 attribute
514
514
515
/**
515
/**
516
 * \class ns3::Ipv6PrefixValue
516
 * \class ns3::Ipv6PrefixValue
517
 * \brief Hold objects of type ns3::Ipv6Prefix
517
 * \brief Hold objects of type ns3::Ipv6Prefix
518
 */
518
 */
519
ATTRIBUTE_HELPER_HEADER (Ipv6Prefix);   /// Macro to make help make class an ns-3 attribute
519
ATTRIBUTE_HELPER_HEADER (Ipv6Prefix);   //!< Macro to make help make class an ns-3 attribute
520
520
521
/**
521
/**
522
 * \brief Stream insertion operator.
522
 * \brief Stream insertion operator.
(-)a/src/network/utils/llc-snap-header.h (-1 / +15 lines)
 Lines 36-50    Link Here 
36
 * \ingroup network
36
 * \ingroup network
37
 *
37
 *
38
 * \brief Header for the LLC/SNAP encapsulation
38
 * \brief Header for the LLC/SNAP encapsulation
39
 *
40
 * For a list of EtherTypes, see http://www.iana.org/assignments/ieee-802-numbers/ieee-802-numbers.xhtml
39
 */
41
 */
40
class LlcSnapHeader : public Header 
42
class LlcSnapHeader : public Header 
41
{
43
{
42
public:
44
public:
43
  LlcSnapHeader ();
45
  LlcSnapHeader ();
44
46
47
  /**
48
   * \brief Set the Ethertype.
49
   * \param type the Ethertype
50
   */
45
  void SetType (uint16_t type);
51
  void SetType (uint16_t type);
52
  /**
53
   * \brief Return the Ethertype.
54
   * \return Ethertype
55
   */
46
  uint16_t GetType (void);
56
  uint16_t GetType (void);
47
57
58
  /**
59
   * \brief Get the type ID.
60
   * \return the object TypeId
61
   */
48
  static TypeId GetTypeId (void);
62
  static TypeId GetTypeId (void);
49
  virtual TypeId GetInstanceTypeId (void) const;
63
  virtual TypeId GetInstanceTypeId (void) const;
50
  virtual void Print (std::ostream &os) const;
64
  virtual void Print (std::ostream &os) const;
 Lines 52-58    Link Here 
52
  virtual void Serialize (Buffer::Iterator start) const;
66
  virtual void Serialize (Buffer::Iterator start) const;
53
  virtual uint32_t Deserialize (Buffer::Iterator start);
67
  virtual uint32_t Deserialize (Buffer::Iterator start);
54
private:
68
private:
55
  uint16_t m_etherType;
69
  uint16_t m_etherType; //!< the Ethertype
56
};
70
};
57
71
58
} // namespace ns3
72
} // namespace ns3
(-)a/src/network/utils/mac16-address.cc (-1 / +12 lines)
 Lines 30-36    Link Here 
30
30
31
namespace ns3 {
31
namespace ns3 {
32
32
33
ATTRIBUTE_HELPER_CPP (Mac16Address);  /// Macro to make help make class an ns-3 attribute
33
ATTRIBUTE_HELPER_CPP (Mac16Address);  //!< Macro to make help make class an ns-3 attribute
34
34
35
#define ASCII_a (0x41)
35
#define ASCII_a (0x41)
36
#define ASCII_z (0x5a)
36
#define ASCII_z (0x5a)
 Lines 39-44    Link Here 
39
#define ASCII_COLON (0x3a)
39
#define ASCII_COLON (0x3a)
40
#define ASCII_ZERO (0x30)
40
#define ASCII_ZERO (0x30)
41
41
42
/**
43
 * Converts a char to lower case.
44
 * \param c the char
45
 * \returns the lower case
46
 */
42
static char
47
static char
43
AsciiToLowCase (char c)
48
AsciiToLowCase (char c)
44
{
49
{
 Lines 169-174    Link Here 
169
  return os;
174
  return os;
170
}
175
}
171
176
177
/**
178
 * \brief Converts a string representing an hex number [0x0, 0xFF] into its value.
179
 *
180
 * \param v a string
181
 * \returns the value
182
 */
172
static uint8_t
183
static uint8_t
173
AsInt (std::string v)
184
AsInt (std::string v)
174
{
185
{
(-)a/src/network/utils/mac16-address.h (-4 / +50 lines)
 Lines 91-103    Link Here 
91
   * Convert an instance of this class to a polymorphic Address instance.
91
   * Convert an instance of this class to a polymorphic Address instance.
92
   */
92
   */
93
  Address ConvertTo (void) const;
93
  Address ConvertTo (void) const;
94
95
  /**
96
   * \brief Return the Type of address.
97
   * \return type of address
98
   */
94
  static uint8_t GetType (void);
99
  static uint8_t GetType (void);
100
101
  /**
102
   * \brief Equal to operator.
103
   *
104
   * \param a the first operand
105
   * \param b the first operand
106
   * \returns true if the operands are equal
107
   */
108
  friend bool operator == (const Mac16Address &a, const Mac16Address &b);
109
110
  /**
111
   * \brief Not equal to operator.
112
   *
113
   * \param a the first operand
114
   * \param b the first operand
115
   * \returns true if the operands are not equal
116
   */
117
  friend bool operator != (const Mac16Address &a, const Mac16Address &b);
118
119
  /**
120
   * \brief Less than operator.
121
   *
122
   * \param a the first operand
123
   * \param b the first operand
124
   * \returns true if the operand a is less than operand b
125
   */
95
  friend bool operator < (const Mac16Address &a, const Mac16Address &b);
126
  friend bool operator < (const Mac16Address &a, const Mac16Address &b);
96
  friend bool operator == (const Mac16Address &a, const Mac16Address &b);
127
97
  friend bool operator != (const Mac16Address &a, const Mac16Address &b);
128
  /**
129
   * \brief Stream insertion operator.
130
   *
131
   * \param os the stream
132
   * \param address the address
133
   * \returns a reference to the stream
134
   */
135
  friend std::ostream& operator<< (std::ostream& os, const Mac16Address & address);
136
137
  /**
138
   * \brief Stream extraction operator.
139
   *
140
   * \param is the stream
141
   * \param address the address
142
   * \returns a reference to the stream
143
   */
98
  friend std::istream& operator>> (std::istream& is, Mac16Address & address);
144
  friend std::istream& operator>> (std::istream& is, Mac16Address & address);
99
145
100
  uint8_t m_address[2];
146
  uint8_t m_address[2]; //!< address value
101
};
147
};
102
148
103
/**
149
/**
 Lines 105-111    Link Here 
105
 * \brief hold objects of type ns3::Mac16Address
151
 * \brief hold objects of type ns3::Mac16Address
106
 */
152
 */
107
153
108
ATTRIBUTE_HELPER_HEADER (Mac16Address); /// Macro to make help make class an ns-3 attribute
154
ATTRIBUTE_HELPER_HEADER (Mac16Address); //!< Macro to make help make class an ns-3 attribute
109
155
110
inline bool operator == (const Mac16Address &a, const Mac16Address &b)
156
inline bool operator == (const Mac16Address &a, const Mac16Address &b)
111
{
157
{
(-)a/src/network/utils/mac48-address.cc (-1 / +12 lines)
 Lines 29-35    Link Here 
29
29
30
namespace ns3 {
30
namespace ns3 {
31
31
32
ATTRIBUTE_HELPER_CPP (Mac48Address);  /// Macro to make help make class an ns-3 attribute
32
ATTRIBUTE_HELPER_CPP (Mac48Address);  //!< Macro to make help make class an ns-3 attribute
33
33
34
#define ASCII_a (0x41)
34
#define ASCII_a (0x41)
35
#define ASCII_z (0x5a)
35
#define ASCII_z (0x5a)
 Lines 38-43    Link Here 
38
#define ASCII_COLON (0x3a)
38
#define ASCII_COLON (0x3a)
39
#define ASCII_ZERO (0x30)
39
#define ASCII_ZERO (0x30)
40
40
41
/**
42
 * Converts a char to lower case.
43
 * \param c the char
44
 * \returns the lower case
45
 */
41
static char
46
static char
42
AsciiToLowCase (char c)
47
AsciiToLowCase (char c)
43
{
48
{
 Lines 259-264    Link Here 
259
  return os;
264
  return os;
260
}
265
}
261
266
267
/**
268
 * \brief Converts a string representing an hex number [0x0, 0xFF] into its value.
269
 *
270
 * \param v a string
271
 * \returns the value
272
 */
262
static uint8_t
273
static uint8_t
263
AsInt (std::string v)
274
AsInt (std::string v)
264
{
275
{
(-)a/src/network/utils/mac48-address.h (-4 / +50 lines)
 Lines 133-145    Link Here 
133
   * Convert an instance of this class to a polymorphic Address instance.
133
   * Convert an instance of this class to a polymorphic Address instance.
134
   */
134
   */
135
  Address ConvertTo (void) const;
135
  Address ConvertTo (void) const;
136
137
  /**
138
   * \brief Return the Type of address.
139
   * \return type of address
140
   */
136
  static uint8_t GetType (void);
141
  static uint8_t GetType (void);
142
143
  /**
144
   * \brief Equal to operator.
145
   *
146
   * \param a the first operand
147
   * \param b the first operand
148
   * \returns true if the operands are equal
149
   */
150
  friend bool operator == (const Mac48Address &a, const Mac48Address &b);
151
152
  /**
153
   * \brief Not equal to operator.
154
   *
155
   * \param a the first operand
156
   * \param b the first operand
157
   * \returns true if the operands are not equal
158
   */
159
  friend bool operator != (const Mac48Address &a, const Mac48Address &b);
160
161
  /**
162
   * \brief Less than operator.
163
   *
164
   * \param a the first operand
165
   * \param b the first operand
166
   * \returns true if the operand a is less than operand b
167
   */
137
  friend bool operator < (const Mac48Address &a, const Mac48Address &b);
168
  friend bool operator < (const Mac48Address &a, const Mac48Address &b);
138
  friend bool operator == (const Mac48Address &a, const Mac48Address &b);
169
139
  friend bool operator != (const Mac48Address &a, const Mac48Address &b);
170
  /**
171
   * \brief Stream insertion operator.
172
   *
173
   * \param os the stream
174
   * \param address the address
175
   * \returns a reference to the stream
176
   */
177
  friend std::ostream& operator<< (std::ostream& os, const Mac48Address & address);
178
179
  /**
180
   * \brief Stream extraction operator.
181
   *
182
   * \param is the stream
183
   * \param address the address
184
   * \returns a reference to the stream
185
   */
140
  friend std::istream& operator>> (std::istream& is, Mac48Address & address);
186
  friend std::istream& operator>> (std::istream& is, Mac48Address & address);
141
187
142
  uint8_t m_address[6];
188
  uint8_t m_address[6]; //!< address value
143
};
189
};
144
190
145
/**
191
/**
 Lines 147-153    Link Here 
147
 * \brief hold objects of type ns3::Mac48Address
193
 * \brief hold objects of type ns3::Mac48Address
148
 */
194
 */
149
195
150
ATTRIBUTE_HELPER_HEADER (Mac48Address); /// Macro to make help make class an ns-3 attribute
196
ATTRIBUTE_HELPER_HEADER (Mac48Address); //!< Macro to make help make class an ns-3 attribute
151
197
152
inline bool operator == (const Mac48Address &a, const Mac48Address &b)
198
inline bool operator == (const Mac48Address &a, const Mac48Address &b)
153
{
199
{
(-)a/src/network/utils/mac64-address.cc (-1 / +12 lines)
 Lines 29-35    Link Here 
29
29
30
namespace ns3 {
30
namespace ns3 {
31
31
32
ATTRIBUTE_HELPER_CPP (Mac64Address);  /// Macro to make help make class an ns-3 attribute
32
ATTRIBUTE_HELPER_CPP (Mac64Address);  //!< Macro to make help make class an ns-3 attribute
33
33
34
#define ASCII_a (0x41)
34
#define ASCII_a (0x41)
35
#define ASCII_z (0x5a)
35
#define ASCII_z (0x5a)
 Lines 38-43    Link Here 
38
#define ASCII_COLON (0x3a)
38
#define ASCII_COLON (0x3a)
39
#define ASCII_ZERO (0x30)
39
#define ASCII_ZERO (0x30)
40
40
41
/**
42
 * Converts a char to lower case.
43
 * \param c the char
44
 * \returns the lower case
45
 */
41
static char
46
static char
42
AsciiToLowCase (char c)
47
AsciiToLowCase (char c)
43
{
48
{
 Lines 171-176    Link Here 
171
  return os;
176
  return os;
172
}
177
}
173
178
179
/**
180
 * \brief Converts a string representing an hex number [0x0, 0xFF] into its value.
181
 *
182
 * \param v a string
183
 * \returns the value
184
 */
174
static uint8_t
185
static uint8_t
175
AsInt (std::string v)
186
AsInt (std::string v)
176
{
187
{
(-)a/src/network/utils/mac64-address.h (-4 / +50 lines)
 Lines 93-105    Link Here 
93
   * Convert an instance of this class to a polymorphic Address instance.
93
   * Convert an instance of this class to a polymorphic Address instance.
94
   */
94
   */
95
  Address ConvertTo (void) const;
95
  Address ConvertTo (void) const;
96
97
  /**
98
   * \brief Return the Type of address.
99
   * \return type of address
100
   */
96
  static uint8_t GetType (void);
101
  static uint8_t GetType (void);
102
103
  /**
104
   * \brief Equal to operator.
105
   *
106
   * \param a the first operand
107
   * \param b the first operand
108
   * \returns true if the operands are equal
109
   */
110
  friend bool operator == (const Mac64Address &a, const Mac64Address &b);
111
112
  /**
113
   * \brief Not equal to operator.
114
   *
115
   * \param a the first operand
116
   * \param b the first operand
117
   * \returns true if the operands are not equal
118
   */
119
  friend bool operator != (const Mac64Address &a, const Mac64Address &b);
120
121
  /**
122
   * \brief Less than operator.
123
   *
124
   * \param a the first operand
125
   * \param b the first operand
126
   * \returns true if the operand a is less than operand b
127
   */
97
  friend bool operator < (const Mac64Address &a, const Mac64Address &b);
128
  friend bool operator < (const Mac64Address &a, const Mac64Address &b);
98
  friend bool operator == (const Mac64Address &a, const Mac64Address &b);
129
99
  friend bool operator != (const Mac64Address &a, const Mac64Address &b);
130
  /**
131
   * \brief Stream insertion operator.
132
   *
133
   * \param os the stream
134
   * \param address the address
135
   * \returns a reference to the stream
136
   */
137
  friend std::ostream& operator<< (std::ostream& os, const Mac64Address & address);
138
139
  /**
140
   * \brief Stream extraction operator.
141
   *
142
   * \param is the stream
143
   * \param address the address
144
   * \returns a reference to the stream
145
   */
100
  friend std::istream& operator>> (std::istream& is, Mac64Address & address);
146
  friend std::istream& operator>> (std::istream& is, Mac64Address & address);
101
147
102
  uint8_t m_address[8];
148
  uint8_t m_address[8]; //!< address value
103
};
149
};
104
150
105
/**
151
/**
 Lines 107-113    Link Here 
107
 * \brief hold objects of type ns3::Mac64Address
153
 * \brief hold objects of type ns3::Mac64Address
108
 */
154
 */
109
155
110
ATTRIBUTE_HELPER_HEADER (Mac64Address); /// Macro to make help make class an ns-3 attribute
156
ATTRIBUTE_HELPER_HEADER (Mac64Address); //!< Macro to make help make class an ns-3 attribute
111
157
112
inline bool operator == (const Mac64Address &a, const Mac64Address &b)
158
inline bool operator == (const Mac64Address &a, const Mac64Address &b)
113
{
159
{
(-)a/src/network/utils/output-stream-wrapper.h (-4 / +13 lines)
 Lines 26-33    Link Here 
26
26
27
namespace ns3 {
27
namespace ns3 {
28
28
29
/*
29
/**
30
 * @brief A class encapsulating an STL output stream.
30
 * @brief A class encapsulating an output stream.
31
 *
31
 *
32
 * This class wraps a pointer to a C++ std::ostream and provides 
32
 * This class wraps a pointer to a C++ std::ostream and provides 
33
 * reference counting of the object.  This class is recommended for users 
33
 * reference counting of the object.  This class is recommended for users 
 Lines 70-76    Link Here 
70
class OutputStreamWrapper : public SimpleRefCount<OutputStreamWrapper>
70
class OutputStreamWrapper : public SimpleRefCount<OutputStreamWrapper>
71
{
71
{
72
public:
72
public:
73
  /**
74
   * Constructor
75
   * \param filename file name
76
   * \param filemode std::ios::openmode flags
77
   */
73
  OutputStreamWrapper (std::string filename, std::ios::openmode filemode);
78
  OutputStreamWrapper (std::string filename, std::ios::openmode filemode);
79
  /**
80
   * Constructor
81
   * \param os output stream
82
   */
74
  OutputStreamWrapper (std::ostream* os);
83
  OutputStreamWrapper (std::ostream* os);
75
  ~OutputStreamWrapper ();
84
  ~OutputStreamWrapper ();
76
85
 Lines 84-91    Link Here 
84
  std::ostream *GetStream (void);
93
  std::ostream *GetStream (void);
85
94
86
private:
95
private:
87
  std::ostream *m_ostream;
96
  std::ostream *m_ostream; //!< The output stream
88
  bool m_destroyable;
97
  bool m_destroyable; //!< Can be destroyed
89
};
98
};
90
99
91
} // namespace ns3
100
} // namespace ns3
(-)a/src/network/utils/packet-burst.h (-3 / +15 lines)
 Lines 29-40    Link Here 
29
29
30
class Packet;
30
class Packet;
31
31
32
/**
33
 * \brief this class implement a burst as a list of packets
34
 */
32
class PacketBurst : public Object
35
class PacketBurst : public Object
33
{
36
{
37
public:
34
  /**
38
  /**
35
   * \brief this class implement a burst as a list of packets
39
   * \brief Get the type ID.
40
   * \return the object TypeId
36
   */
41
   */
37
public:
38
  static TypeId GetTypeId (void);
42
  static TypeId GetTypeId (void);
39
  PacketBurst (void);
43
  PacketBurst (void);
40
  virtual ~PacketBurst (void);
44
  virtual ~PacketBurst (void);
 Lines 60-70    Link Here 
60
   */
64
   */
61
  uint32_t GetSize (void) const;
65
  uint32_t GetSize (void) const;
62
66
67
  /**
68
   * \brief Returns an iterator to the begin of the burst
69
   * \return iterator to the burst list start
70
   */
63
  std::list<Ptr<Packet> >::const_iterator Begin (void) const;
71
  std::list<Ptr<Packet> >::const_iterator Begin (void) const;
72
  /**
73
   * \brief Returns an iterator to the end of the burst
74
   * \return iterator to the burst list end
75
   */
64
  std::list<Ptr<Packet> >::const_iterator End (void) const;
76
  std::list<Ptr<Packet> >::const_iterator End (void) const;
65
private:
77
private:
66
  void DoDispose (void);
78
  void DoDispose (void);
67
  std::list<Ptr<Packet> > m_packets;
79
  std::list<Ptr<Packet> > m_packets; //!< the list of packets in the burst
68
};
80
};
69
} // namespace ns3
81
} // namespace ns3
70
82
(-)a/src/network/utils/packet-probe.h (+6 lines)
 Lines 47-52    Link Here 
47
class PacketProbe : public Probe
47
class PacketProbe : public Probe
48
{
48
{
49
public:
49
public:
50
  /**
51
   * \brief Get the type ID.
52
   * \return the object TypeId
53
   */
50
  static TypeId GetTypeId ();
54
  static TypeId GetTypeId ();
51
  PacketProbe ();
55
  PacketProbe ();
52
  virtual ~PacketProbe ();
56
  virtual ~PacketProbe ();
 Lines 96-102    Link Here 
96
   */
100
   */
97
  void TraceSink (Ptr<const Packet> packet);
101
  void TraceSink (Ptr<const Packet> packet);
98
102
103
  /// Traced callback: packet received
99
  TracedCallback<Ptr<const Packet> > m_output;
104
  TracedCallback<Ptr<const Packet> > m_output;
105
  /// Traced callback: size of previous packet receive, size of actual packet received
100
  TracedCallback<uint32_t, uint32_t> m_outputBytes;
106
  TracedCallback<uint32_t, uint32_t> m_outputBytes;
101
107
102
  /// The traced packet.
108
  /// The traced packet.
(-)a/src/network/utils/packet-socket-address.h (-5 / +55 lines)
 Lines 39-53    Link Here 
39
{
39
{
40
public:
40
public:
41
  PacketSocketAddress ();
41
  PacketSocketAddress ();
42
43
  /**
44
   * \brief Set the protocol
45
   * \param protocol the protocol
46
   */
42
  void SetProtocol (uint16_t protocol);
47
  void SetProtocol (uint16_t protocol);
43
48
49
  /**
50
   * \brief Set the address to match all the outgoing NetDevice
51
   */
44
  void SetAllDevices (void);
52
  void SetAllDevices (void);
53
54
  /**
55
   * \brief Set the address to match only a specified NetDevice
56
   * \param device the NetDevice index
57
   */
45
  void SetSingleDevice (uint32_t device);
58
  void SetSingleDevice (uint32_t device);
59
60
  /**
61
   * \brief Set the destination address
62
   * \param address the destination address
63
   */
46
  void SetPhysicalAddress (const Address address);
64
  void SetPhysicalAddress (const Address address);
47
65
66
  /**
67
   * \brief Get the protocol
68
   * \return the protocol
69
   */
48
  uint16_t GetProtocol (void) const;
70
  uint16_t GetProtocol (void) const;
71
72
  /**
73
   * \brief Get the device this address is bound to
74
   * \return the device index
75
   */
49
  uint32_t GetSingleDevice (void) const;
76
  uint32_t GetSingleDevice (void) const;
77
78
  /**
79
   * \brief Checks if the address is bound to a specified NetDevice
80
   * \return true if the address is bound to a NetDevice
81
   */
50
  bool IsSingleDevice (void) const;
82
  bool IsSingleDevice (void) const;
83
84
  /**
85
   * \brief Get the destination address
86
   * \returns The destination address
87
   */
51
  Address GetPhysicalAddress (void) const;
88
  Address GetPhysicalAddress (void) const;
52
89
53
  /**
90
  /**
 Lines 56-80    Link Here 
56
   * Convert an instance of this class to a polymorphic Address instance.
93
   * Convert an instance of this class to a polymorphic Address instance.
57
   */
94
   */
58
  operator Address () const;
95
  operator Address () const;
96
59
  /**
97
  /**
60
   * \param address a polymorphic address
98
   * \param address a polymorphic address
61
   *
99
   * \returns an Address
62
   * Convert a polymorphic address to an Mac48Address instance.
100
   * Convert a polymorphic address to an Mac48Address instance.
63
   * The conversion performs a type check.
101
   * The conversion performs a type check.
64
   */
102
   */
65
  static PacketSocketAddress ConvertFrom (const Address &address);
103
  static PacketSocketAddress ConvertFrom (const Address &address);
104
66
  /**
105
  /**
67
   * \param address address to test
106
   * \param address address to test
68
   * \returns true if the address matches, false otherwise.
107
   * \returns true if the address matches, false otherwise.
69
   */
108
   */
70
  static bool IsMatchingType (const Address &address);
109
  static bool IsMatchingType (const Address &address);
71
private:
110
private:
111
112
  /**
113
   * \brief Return the Type of address.
114
   * \return type of address
115
   */
72
  static uint8_t GetType (void);
116
  static uint8_t GetType (void);
117
118
  /**
119
   * \brief Convert an instance of this class to a polymorphic Address instance.
120
   * \returns a new Address instance
121
   */
73
  Address ConvertTo (void) const;
122
  Address ConvertTo (void) const;
74
  uint16_t m_protocol;
123
75
  bool m_isSingleDevice;
124
  uint16_t m_protocol;    //!< Protocol
76
  uint32_t m_device;
125
  bool m_isSingleDevice;  //!< True if directed to a specific outgoing NetDevice
77
  Address m_address;
126
  uint32_t m_device;      //!< Outgoing NetDevice index
127
  Address m_address;      //!< Destination address
78
};
128
};
79
129
80
130
(-)a/src/network/utils/packet-socket-factory.h (+4 lines)
 Lines 35-40    Link Here 
35
class PacketSocketFactory : public SocketFactory
35
class PacketSocketFactory : public SocketFactory
36
{
36
{
37
public:
37
public:
38
  /**
39
   * \brief Get the type ID.
40
   * \return the object TypeId
41
   */
38
  static TypeId GetTypeId (void);
42
  static TypeId GetTypeId (void);
39
43
40
  PacketSocketFactory ();
44
  PacketSocketFactory ();
(-)a/src/network/utils/packet-socket.h (-19 / +80 lines)
 Lines 43-49    Link Here 
43
 *
43
 *
44
 * A PacketSocket can be used to connect an application to a net
44
 * A PacketSocket can be used to connect an application to a net
45
 * device. The application provides the buffers of data, the socket
45
 * device. The application provides the buffers of data, the socket
46
 * conserts them to a raw packet and the net device then adds the
46
 * converts them to a raw packet and the net device then adds the
47
 * protocol specific headers and trailers. This socket type
47
 * protocol specific headers and trailers. This socket type
48
 * is very similar to the linux and BSD "packet" sockets.
48
 * is very similar to the linux and BSD "packet" sockets.
49
 *
49
 *
 Lines 78-95    Link Here 
78
class PacketSocket : public Socket
78
class PacketSocket : public Socket
79
{
79
{
80
public:
80
public:
81
  /**
82
   * \brief Get the type ID.
83
   * \return the object TypeId
84
   */
81
  static TypeId GetTypeId (void);
85
  static TypeId GetTypeId (void);
82
86
83
  PacketSocket ();
87
  PacketSocket ();
84
  virtual ~PacketSocket ();
88
  virtual ~PacketSocket ();
85
89
90
  /**
91
   * \brief Set the associated node.
92
   * \param node the node
93
   */
86
  void SetNode (Ptr<Node> node);
94
  void SetNode (Ptr<Node> node);
87
95
88
  virtual enum SocketErrno GetErrno (void) const;
96
  virtual enum SocketErrno GetErrno (void) const;
89
  virtual enum SocketType GetSocketType (void) const;
97
  virtual enum SocketType GetSocketType (void) const;
90
  virtual Ptr<Node> GetNode (void) const;
98
  virtual Ptr<Node> GetNode (void) const;
99
  /**
100
   * \brief Bind the socket to the NetDevice and register the protocol handler.
101
   *
102
   * \warning this will actually bind protocol "0".
103
   *
104
   * \returns 0 on success, -1 on failure.
105
   */
91
  virtual int Bind (void);
106
  virtual int Bind (void);
107
  /**
108
   * \brief Bind the socket to the NetDevice and register the protocol handler.
109
   *
110
   * \warning this will actually bind protocol "0".
111
   *
112
   * \returns 0 on success, -1 on failure.
113
   */
92
  virtual int Bind6 (void);
114
  virtual int Bind6 (void);
115
  /**
116
   * \brief Bind the socket to the NetDevice and register the
117
   *        protocol handler specified in the address.
118
   *
119
   * \param address the packet socket address
120
   * \returns 0 on success, -1 on failure.
121
   */
93
  virtual int Bind (const Address & address);
122
  virtual int Bind (const Address & address);
94
  virtual int Close (void);
123
  virtual int Close (void);
95
  virtual int ShutdownSend (void);
124
  virtual int ShutdownSend (void);
 Lines 108-149    Link Here 
108
  virtual bool GetAllowBroadcast () const;
137
  virtual bool GetAllowBroadcast () const;
109
138
110
private:
139
private:
140
  /**
141
   * \brief Called by the L3 protocol when it received a packet to pass on to TCP.
142
   *
143
   * \param device the incoming NetDevice
144
   * \param packet the incoming packet
145
   * \param protocol the protocol
146
   * \param from sender address
147
   * \param to destination address
148
   * \param packetType packet type
149
   */
111
  void ForwardUp (Ptr<NetDevice> device, Ptr<const Packet> packet, 
150
  void ForwardUp (Ptr<NetDevice> device, Ptr<const Packet> packet, 
112
                  uint16_t protocol, const Address &from, const Address &to,
151
                  uint16_t protocol, const Address &from, const Address &to,
113
                  NetDevice::PacketType packetType);
152
                  NetDevice::PacketType packetType);
153
  /**
154
   * \brief Bind the socket to the NetDevice and register the
155
   *        protocol handler specified in the address.
156
   * \param address the packet socket address
157
   * \returns 0 on success, -1 on failure.
158
   */
114
  int DoBind (const PacketSocketAddress &address);
159
  int DoBind (const PacketSocketAddress &address);
160
161
  /**
162
   * \brief Get the minimum MTU supported by the NetDevices bound to a specific address
163
   * \param ad the socket address to check for
164
   * \returns The minimum MTU
165
   */
115
  uint32_t GetMinMtu (PacketSocketAddress ad) const;
166
  uint32_t GetMinMtu (PacketSocketAddress ad) const;
116
  virtual void DoDispose (void);
167
  virtual void DoDispose (void);
117
168
169
  /**
170
   * \brief States of the socket
171
   */
118
  enum State {
172
  enum State {
119
    STATE_OPEN,
173
    STATE_OPEN,
120
    STATE_BOUND,     // open and bound
174
    STATE_BOUND,     // open and bound
121
    STATE_CONNECTED, // open, bound and connected
175
    STATE_CONNECTED, // open, bound and connected
122
    STATE_CLOSED
176
    STATE_CLOSED
123
  };
177
  };
124
  Ptr<Node> m_node;
125
  enum SocketErrno m_errno;
126
  bool m_shutdownSend;
127
  bool m_shutdownRecv;
128
  enum State m_state;
129
  uint16_t m_protocol;
130
  bool m_isSingleDevice;
131
  uint32_t m_device;
132
  Address m_destAddr; /// Default destination address
133
178
134
  std::queue<Ptr<Packet> > m_deliveryQueue;
179
  Ptr<Node> m_node;         //!< the associated node
135
  uint32_t m_rxAvailable;
180
  enum SocketErrno m_errno; //!< Socket error code
181
  bool m_shutdownSend;      //!< Send no longer allowed
182
  bool m_shutdownRecv;      //!< Receive no longer allowed
183
  enum State m_state;       //!< Socket state
184
  uint16_t m_protocol;      //!< Socket protocol
185
  bool m_isSingleDevice;    //!< Is bound to a single netDevice
186
  uint32_t m_device;        //!< index of the bound NetDevice
187
  Address m_destAddr;       //!< Default destination address
136
188
189
  std::queue<Ptr<Packet> > m_deliveryQueue; //!< Rx queue
190
  uint32_t m_rxAvailable; //!< Rx queue size [Bytes]
191
192
  /// Traced callback: dropped packets
137
  TracedCallback<Ptr<const Packet> > m_dropTrace;
193
  TracedCallback<Ptr<const Packet> > m_dropTrace;
138
194
139
  // Socket options (attributes)
195
  // Socket options (attributes)
140
  uint32_t m_rcvBufSize;
196
  uint32_t m_rcvBufSize; //!< Rx buffer size [Bytes]
141
197
142
};
198
};
143
199
144
/**
200
/**
145
 * \brief  This class implements a tag that carries the dest address of a packet and the packet type.
201
 * \brief  This class implements a tag that carries the dest address of a packet and the packet type.
146
 *
147
 */
202
 */
148
class PacketSocketTag : public Tag
203
class PacketSocketTag : public Tag
149
{
204
{
 Lines 173-178    Link Here 
173
   */
228
   */
174
  Address GetDestAddress (void) const;
229
  Address GetDestAddress (void) const;
175
230
231
  /**
232
   * \brief Get the type ID.
233
   * \return the object TypeId
234
   */
176
  static TypeId GetTypeId (void);
235
  static TypeId GetTypeId (void);
177
  virtual TypeId GetInstanceTypeId (void) const;
236
  virtual TypeId GetInstanceTypeId (void) const;
178
  virtual uint32_t GetSerializedSize (void) const;
237
  virtual uint32_t GetSerializedSize (void) const;
 Lines 181-193    Link Here 
181
  virtual void Print (std::ostream &os) const;
240
  virtual void Print (std::ostream &os) const;
182
241
183
private:
242
private:
184
  std::string m_deviceName;
243
  NetDevice::PacketType m_packetType; //!< Packet type
185
  NetDevice::PacketType m_packetType;
244
  Address m_destAddr; //!< Destination address
186
  Address m_destAddr;
187
};
245
};
188
/**
246
/**
189
 * \brief  This class implements a tag that carries the ns3 device name from where a packet is coming.
247
 * \brief  This class implements a tag that carries the ns3 device name from where a packet is coming.
190
 *
191
 */
248
 */
192
class DeviceNameTag : public Tag
249
class DeviceNameTag : public Tag
193
{
250
{
 Lines 206-211    Link Here 
206
   * @return the device name from where the corresponding packet is coming.
263
   * @return the device name from where the corresponding packet is coming.
207
   */
264
   */
208
  std::string GetDeviceName (void) const;
265
  std::string GetDeviceName (void) const;
266
  /**
267
   * \brief Get the type ID.
268
   * \return the object TypeId
269
   */
209
  static TypeId GetTypeId (void);
270
  static TypeId GetTypeId (void);
210
  virtual TypeId GetInstanceTypeId (void) const;
271
  virtual TypeId GetInstanceTypeId (void) const;
211
  virtual uint32_t GetSerializedSize (void) const;
272
  virtual uint32_t GetSerializedSize (void) const;
 Lines 214-220    Link Here 
214
  virtual void Print (std::ostream &os) const;
275
  virtual void Print (std::ostream &os) const;
215
276
216
private:
277
private:
217
  std::string m_deviceName;
278
  std::string m_deviceName; //!< Device name
218
};
279
};
219
280
220
} // namespace ns3
281
} // namespace ns3
(-)a/src/network/utils/packetbb.h (-51 / +155 lines)
 Lines 55-62    Link Here 
55
class PbbTlvBlock
55
class PbbTlvBlock
56
{
56
{
57
public:
57
public:
58
  typedef std::list< Ptr<PbbTlv> >::iterator Iterator;              /// this is an iterator
58
  /// PbbTlv container iterator
59
  typedef std::list< Ptr<PbbTlv> >::const_iterator ConstIterator;   /// this is a const iterator
59
  typedef std::list< Ptr<PbbTlv> >::iterator Iterator;
60
  /// PbbTlv container const iterator
61
  typedef std::list< Ptr<PbbTlv> >::const_iterator ConstIterator;
60
62
61
  PbbTlvBlock (void);
63
  PbbTlvBlock (void);
62
  ~PbbTlvBlock (void);
64
  ~PbbTlvBlock (void);
 Lines 206-212    Link Here 
206
  bool operator!= (const PbbTlvBlock &other) const;
208
  bool operator!= (const PbbTlvBlock &other) const;
207
209
208
private:
210
private:
209
  std::list< Ptr<PbbTlv> > m_tlvList;
211
  std::list< Ptr<PbbTlv> > m_tlvList; //!< PbbTlv container
210
};
212
};
211
213
212
/**
214
/**
 Lines 217-224    Link Here 
217
class PbbAddressTlvBlock
219
class PbbAddressTlvBlock
218
{
220
{
219
public:
221
public:
220
  typedef std::list< Ptr<PbbAddressTlv> >::iterator Iterator;               /// This is a PbbAddressTlv iterator for PbbAddressTlvBlock
222
  /// PbbAddressTlv iterator for PbbAddressTlvBlock
221
  typedef std::list< Ptr<PbbAddressTlv> >::const_iterator ConstIterator;    /// This is a const PbbAddressTlv iterator for PbbAddressTlvBlock
223
  typedef std::list< Ptr<PbbAddressTlv> >::iterator Iterator;
224
  /// PbbAddressTlv const iterator for PbbAddressTlvBlock
225
  typedef std::list< Ptr<PbbAddressTlv> >::const_iterator ConstIterator;
222
226
223
  PbbAddressTlvBlock (void);
227
  PbbAddressTlvBlock (void);
224
  ~PbbAddressTlvBlock (void);
228
  ~PbbAddressTlvBlock (void);
 Lines 371-377    Link Here 
371
  bool operator!= (const PbbAddressTlvBlock &other) const;
375
  bool operator!= (const PbbAddressTlvBlock &other) const;
372
376
373
private:
377
private:
374
  std::list< Ptr<PbbAddressTlv> > m_tlvList;
378
  std::list< Ptr<PbbAddressTlv> > m_tlvList; //!< PbbAddressTlv container
375
};
379
};
376
380
377
/**
381
/**
 Lines 385-394    Link Here 
385
class PbbPacket : public SimpleRefCount<PbbPacket,Header>
389
class PbbPacket : public SimpleRefCount<PbbPacket,Header>
386
{
390
{
387
public:
391
public:
388
  typedef std::list< Ptr<PbbTlv> >::iterator TlvIterator;                       /// This is a PbbTlv iterator for PbbPacket
392
  /// PbbTlv iterator for PbbPacket
389
  typedef std::list< Ptr<PbbTlv> >::const_iterator ConstTlvIterator;            /// This is a const PbbTlv iterator for PbbPacket
393
  typedef std::list< Ptr<PbbTlv> >::iterator TlvIterator;
390
  typedef std::list< Ptr<PbbMessage> >::iterator MessageIterator;               /// This is a PbbMessageIterator for PbbPacket
394
  /// PbbTlv const iterator for PbbPacket
391
  typedef std::list< Ptr<PbbMessage> >::const_iterator ConstMessageIterator;    /// This is a const PbbMessageIterator for PbbPacket
395
  typedef std::list< Ptr<PbbTlv> >::const_iterator ConstTlvIterator;
396
  /// PbbMessage Iterator for PbbPacket
397
  typedef std::list< Ptr<PbbMessage> >::iterator MessageIterator;
398
  /// PbbMessage Const Iterator for PbbPacket
399
  typedef std::list< Ptr<PbbMessage> >::const_iterator ConstMessageIterator;
392
400
393
  PbbPacket (void);
401
  PbbPacket (void);
394
  ~PbbPacket (void);
402
  ~PbbPacket (void);
 Lines 617-623    Link Here 
617
   */
625
   */
618
  void MessageClear (void);
626
  void MessageClear (void);
619
627
620
  /* Methods implemented by all headers */
628
  /**
629
   * \brief Get the type ID.
630
   * \return the object TypeId
631
   */
621
  static TypeId GetTypeId (void);
632
  static TypeId GetTypeId (void);
622
  virtual TypeId GetInstanceTypeId (void) const;
633
  virtual TypeId GetInstanceTypeId (void) const;
623
634
 Lines 665-677    Link Here 
665
protected:
676
protected:
666
677
667
private:
678
private:
668
  PbbTlvBlock m_tlvList;
679
  PbbTlvBlock m_tlvList; //!< PbbTlv container
669
  std::list< Ptr<PbbMessage> > m_messageList;
680
  std::list< Ptr<PbbMessage> > m_messageList; //!< PbbTlvBlock container
670
681
671
  uint8_t m_version;
682
  uint8_t m_version; //!< version
672
683
673
  bool m_hasseqnum;
684
  bool m_hasseqnum; //!< Sequence number present
674
  uint16_t m_seqnum;
685
  uint16_t m_seqnum; //!< Sequence number
675
};
686
};
676
687
677
/**
688
/**
 Lines 684-693    Link Here 
684
class PbbMessage : public SimpleRefCount<PbbMessage>
695
class PbbMessage : public SimpleRefCount<PbbMessage>
685
{
696
{
686
public:
697
public:
687
  typedef std::list< Ptr<PbbTlv> >::iterator TlvIterator;                                 /// This is a PbbTlv iterator for PbbMessage
698
  /// PbbTlv iterator
688
  typedef std::list< Ptr<PbbTlv> >::const_iterator ConstTlvIterator;                      /// This is a const PbbTlv iterator for PbbMessage
699
  typedef std::list< Ptr<PbbTlv> >::iterator TlvIterator;
689
  typedef std::list< Ptr<PbbAddressBlock> >::iterator AddressBlockIterator;               /// This is a PbbAddressBlock iterator for PbbMessage
700
  /// PbbTlv const iterator
690
  typedef std::list< Ptr<PbbAddressBlock> >::const_iterator ConstAddressBlockIterator;    /// This is a const PbbAddressBlock iterator for PbbMessage
701
  typedef std::list< Ptr<PbbTlv> >::const_iterator ConstTlvIterator;
702
  /// PbbAddressBlock iterator
703
  typedef std::list< Ptr<PbbAddressBlock> >::iterator AddressBlockIterator;
704
  /// PbbAddressBlock const iterator
705
  typedef std::list< Ptr<PbbAddressBlock> >::const_iterator ConstAddressBlockIterator;
691
706
692
  PbbMessage ();
707
  PbbMessage ();
693
  virtual ~PbbMessage ();
708
  virtual ~PbbMessage ();
 Lines 1060-1089    Link Here 
1060
   */
1075
   */
1061
  virtual PbbAddressLength GetAddressLength (void) const = 0;
1076
  virtual PbbAddressLength GetAddressLength (void) const = 0;
1062
1077
1078
  /**
1079
   * \brief Serialize the originator address
1080
   * \param start the buffer iterator start
1081
   */
1063
  virtual void SerializeOriginatorAddress (Buffer::Iterator &start) const = 0;
1082
  virtual void SerializeOriginatorAddress (Buffer::Iterator &start) const = 0;
1083
  /**
1084
   * \brief Deserialize the originator address
1085
   * \param start the buffer iterator start
1086
   * \returns the deserialized address
1087
   */
1064
  virtual Address DeserializeOriginatorAddress (Buffer::Iterator &start) const = 0;
1088
  virtual Address DeserializeOriginatorAddress (Buffer::Iterator &start) const = 0;
1089
  /**
1090
   * \brief Print the originator address
1091
   * \param os the output stream
1092
   */
1065
  virtual void PrintOriginatorAddress (std::ostream &os) const = 0;
1093
  virtual void PrintOriginatorAddress (std::ostream &os) const = 0;
1066
1094
1095
  /**
1096
   * \brief Deserialize an address block
1097
   * \param start the buffer iterator start
1098
   * \returns the deserialized address block
1099
   */
1067
  virtual Ptr<PbbAddressBlock> AddressBlockDeserialize (Buffer::Iterator &start) const = 0;
1100
  virtual Ptr<PbbAddressBlock> AddressBlockDeserialize (Buffer::Iterator &start) const = 0;
1068
1101
1069
private:
1102
private:
1070
  PbbTlvBlock m_tlvList;
1103
  PbbTlvBlock m_tlvList; //!< PbbTlvBlock
1071
  std::list< Ptr<PbbAddressBlock> > m_addressBlockList;
1104
  std::list< Ptr<PbbAddressBlock> > m_addressBlockList; //!< PbbAddressBlock container
1072
1105
1073
  uint8_t m_type;
1106
  uint8_t m_type; //!< the type for this message
1074
  PbbAddressLength m_addrSize;
1107
  PbbAddressLength m_addrSize; //!< the address size
1075
1108
1076
  bool m_hasOriginatorAddress;
1109
  bool m_hasOriginatorAddress; //!< Originator address present
1077
  Address m_originatorAddress;
1110
  Address m_originatorAddress; //!< originator address
1078
1111
1079
  bool m_hasHopLimit;
1112
  bool m_hasHopLimit; //!< Hop limit present
1080
  uint8_t m_hopLimit;
1113
  uint8_t m_hopLimit; //!< Hop limit
1081
1114
1082
  bool m_hasHopCount;
1115
  bool m_hasHopCount; //!< Hop count present
1083
  uint8_t m_hopCount;
1116
  uint8_t m_hopCount; //!< Hop count
1084
1117
1085
  bool m_hasSequenceNumber;
1118
  bool m_hasSequenceNumber;  //!< Sequence number present
1086
  uint16_t m_sequenceNumber;
1119
  uint16_t m_sequenceNumber; //!< Sequence number
1087
};
1120
};
1088
1121
1089
/**
1122
/**
 Lines 1151-1164    Link Here 
1151
class PbbAddressBlock : public SimpleRefCount<PbbAddressBlock>
1184
class PbbAddressBlock : public SimpleRefCount<PbbAddressBlock>
1152
{
1185
{
1153
public:
1186
public:
1154
  typedef std::list< Address >::iterator AddressIterator;             /// this is an address iterator for PbbAddressBlock
1187
  /// Address iterator
1155
  typedef std::list< Address >::const_iterator ConstAddressIterator;  /// this is an const address iterator for PbbAddressBlock
1188
  typedef std::list< Address >::iterator AddressIterator;
1189
  /// Address const iterator
1190
  typedef std::list< Address >::const_iterator ConstAddressIterator;
1156
1191
1157
  typedef std::list<uint8_t>::iterator PrefixIterator;                /// this is a prefix iterator for PbbAddressBlock
1192
  /// Prefix iterator
1158
  typedef std::list<uint8_t>::const_iterator ConstPrefixIterator;     /// this is a const prefix iterator for PbbAddressBlock
1193
  typedef std::list<uint8_t>::iterator PrefixIterator;
1194
  /// Prefix const iterator
1195
  typedef std::list<uint8_t>::const_iterator ConstPrefixIterator;
1159
1196
1160
  typedef PbbAddressTlvBlock::Iterator TlvIterator;                   /// this is a tlvblock iterator for PbbAddressBlock
1197
  /// tlvblock iterator
1161
  typedef PbbAddressTlvBlock::ConstIterator ConstTlvIterator;         /// this is a const tlvblock iterator for PbbAddressBlock
1198
  typedef PbbAddressTlvBlock::Iterator TlvIterator;
1199
  /// tlvblock const iterator
1200
  typedef PbbAddressTlvBlock::ConstIterator ConstTlvIterator;
1162
1201
1163
  PbbAddressBlock ();
1202
  PbbAddressBlock ();
1164
  virtual ~PbbAddressBlock ();
1203
  virtual ~PbbAddressBlock ();
 Lines 1522-1540    Link Here 
1522
   * \returns Address length
1561
   * \returns Address length
1523
   */
1562
   */
1524
  virtual uint8_t GetAddressLength (void) const = 0;
1563
  virtual uint8_t GetAddressLength (void) const = 0;
1564
  /**
1565
   * \brief Serialize one or more addresses
1566
   * \param buffer the buffer to serialize to
1567
   * \param iter the iterator to the addresses
1568
   */
1525
  virtual void SerializeAddress (uint8_t *buffer, ConstAddressIterator iter) const = 0;
1569
  virtual void SerializeAddress (uint8_t *buffer, ConstAddressIterator iter) const = 0;
1570
  /**
1571
   * \brief Deserialize one address
1572
   * \param buffer the buffer to deserialize from
1573
   * \returns the address
1574
   */
1526
  virtual Address DeserializeAddress (uint8_t *buffer) const = 0;
1575
  virtual Address DeserializeAddress (uint8_t *buffer) const = 0;
1576
  /**
1577
   * \brief Print one or more addresses
1578
   * \param os the output stream
1579
   * \param iter the iterator to the addresses
1580
   */
1527
  virtual void PrintAddress (std::ostream &os, ConstAddressIterator iter) const = 0;
1581
  virtual void PrintAddress (std::ostream &os, ConstAddressIterator iter) const = 0;
1528
1582
1529
private:
1583
private:
1584
  /**
1585
   * \brief Get the prefix flags
1586
   * \return the prefix flags
1587
   */
1530
  uint8_t GetPrefixFlags (void) const;
1588
  uint8_t GetPrefixFlags (void) const;
1589
  /**
1590
   * \brief Get head and tail
1591
   * \param head the head
1592
   * \param headlen the head length
1593
   * \param tail the tail
1594
   * \param taillen the tail length
1595
   */
1531
  void GetHeadTail (uint8_t *head, uint8_t &headlen,
1596
  void GetHeadTail (uint8_t *head, uint8_t &headlen,
1532
                    uint8_t *tail, uint8_t &taillen) const;
1597
                    uint8_t *tail, uint8_t &taillen) const;
1598
1599
  /**
1600
   * \brief Check if the tail is empty
1601
   * \param tail the tail
1602
   * \param taillen the tail length
1603
   * \returns true if the tail is empty
1604
   */
1533
  bool HasZeroTail (const uint8_t *tail, uint8_t taillen) const;
1605
  bool HasZeroTail (const uint8_t *tail, uint8_t taillen) const;
1534
1606
1535
  std::list<Address> m_addressList;
1607
  std::list<Address> m_addressList; //!< Addreses container
1536
  std::list<uint8_t> m_prefixList;
1608
  std::list<uint8_t> m_prefixList; //!< Prefixes container
1537
  PbbAddressTlvBlock m_addressTlvList;
1609
  PbbAddressTlvBlock m_addressTlvList; //!< PbbAddressTlv container
1538
};
1610
};
1539
1611
1540
/**
1612
/**
 Lines 1717-1748    Link Here 
1717
  bool operator!= (const PbbTlv &other) const;
1789
  bool operator!= (const PbbTlv &other) const;
1718
1790
1719
protected:
1791
protected:
1792
  /**
1793
   * \brief Set an index as starting point
1794
   * \param index the starting index
1795
   */
1720
  void SetIndexStart (uint8_t index);
1796
  void SetIndexStart (uint8_t index);
1797
  /**
1798
   * \brief Get the starting point index
1799
   * \returns the starting index
1800
   */
1721
  uint8_t GetIndexStart (void) const;
1801
  uint8_t GetIndexStart (void) const;
1802
  /**
1803
   * \brief Checks if there is a starting index
1804
   * \returns true if the start index has been set
1805
   */
1722
  bool HasIndexStart (void) const;
1806
  bool HasIndexStart (void) const;
1723
1807
1808
  /**
1809
   * \brief Set an index as stop point
1810
   * \param index the stop index
1811
   */
1724
  void SetIndexStop (uint8_t index);
1812
  void SetIndexStop (uint8_t index);
1813
  /**
1814
   * \brief Get the stop point index
1815
   * \returns the stop index
1816
   */
1725
  uint8_t GetIndexStop (void) const;
1817
  uint8_t GetIndexStop (void) const;
1818
  /**
1819
   * \brief Checks if there is a stop index
1820
   * \returns true if the stop index has been set
1821
   */
1726
  bool HasIndexStop (void) const;
1822
  bool HasIndexStop (void) const;
1727
1823
1824
  /**
1825
   * \brief Set the multivalue parameter
1826
   * \param isMultivalue the multivalue status
1827
   */
1728
  void SetMultivalue (bool isMultivalue);
1828
  void SetMultivalue (bool isMultivalue);
1829
  /**
1830
   * \brief Check the multivalue parameter
1831
   * \returns the multivalue status
1832
   */
1729
  bool IsMultivalue (void) const;
1833
  bool IsMultivalue (void) const;
1730
1834
1731
private:
1835
private:
1732
  uint8_t m_type;
1836
  uint8_t m_type; //!< Type of this TLV.
1733
1837
1734
  bool m_hasTypeExt;
1838
  bool m_hasTypeExt; //!< Extended type present.
1735
  uint8_t m_typeExt;
1839
  uint8_t m_typeExt; //!< Extended type.
1736
1840
1737
  bool m_hasIndexStart;
1841
  bool m_hasIndexStart; //!< Start index present.
1738
  uint8_t m_indexStart;
1842
  uint8_t m_indexStart; //!< Start index.
1739
1843
1740
  bool m_hasIndexStop;
1844
  bool m_hasIndexStop; //!< Stop index present.
1741
  uint8_t m_indexStop;
1845
  uint8_t m_indexStop; //!< Stop index.
1742
1846
1743
  bool m_isMultivalue;
1847
  bool m_isMultivalue; //!< Is multivalue.
1744
  bool m_hasValue;
1848
  bool m_hasValue;     //!< Has value.
1745
  Buffer m_value;
1849
  Buffer m_value;      //!< Value.
1746
};
1850
};
1747
1851
1748
/**
1852
/**
(-)a/src/network/utils/pcap-file-wrapper.h (-10 / +28 lines)
 Lines 30-36    Link Here 
30
30
31
namespace ns3 {
31
namespace ns3 {
32
32
33
/*
33
/**
34
 * A class that wraps a PcapFile as an ns3::Object and provides a higher-layer
34
 * A class that wraps a PcapFile as an ns3::Object and provides a higher-layer
35
 * ns-3 interface to the low-level public methods of PcapFile.  Users are
35
 * ns-3 interface to the low-level public methods of PcapFile.  Users are
36
 * encouraged to use this object instead of class ns3::PcapFile in ns-3
36
 * encouraged to use this object instead of class ns3::PcapFile in ns-3
 Lines 39-44    Link Here 
39
class PcapFileWrapper : public Object
39
class PcapFileWrapper : public Object
40
{
40
{
41
public:
41
public:
42
  /**
43
   * \brief Get the type ID.
44
   * \return the object TypeId
45
   */
42
  static TypeId GetTypeId (void);
46
  static TypeId GetTypeId (void);
43
47
44
  PcapFileWrapper ();
48
  PcapFileWrapper ();
 Lines 138-202    Link Here 
138
   */
142
   */
139
  void Write (Time t, uint8_t const *buffer, uint32_t length);
143
  void Write (Time t, uint8_t const *buffer, uint32_t length);
140
144
141
  /*
145
  /**
142
   * \brief Returns the magic number of the pcap file as defined by the magic_number
146
   * \brief Returns the magic number of the pcap file as defined by the magic_number
143
   * field in the pcap global header.
147
   * field in the pcap global header.
144
   *
148
   *
145
   * See http://wiki.wireshark.org/Development/LibpcapFileFormat
149
   * See http://wiki.wireshark.org/Development/LibpcapFileFormat
150
   *
151
   * \returns magic number
146
   */ 
152
   */ 
147
  uint32_t GetMagic (void);
153
  uint32_t GetMagic (void);
148
154
149
  /*
155
  /**
150
   * \brief Returns the major version of the pcap file as defined by the version_major
156
   * \brief Returns the major version of the pcap file as defined by the version_major
151
   * field in the pcap global header.
157
   * field in the pcap global header.
152
   *
158
   *
153
   * See http://wiki.wireshark.org/Development/LibpcapFileFormat
159
   * See http://wiki.wireshark.org/Development/LibpcapFileFormat
160
   *
161
   * \returns major version
154
   */ 
162
   */ 
155
  uint16_t GetVersionMajor (void);
163
  uint16_t GetVersionMajor (void);
156
164
157
  /*
165
  /**
158
   * \brief Returns the minor version of the pcap file as defined by the version_minor
166
   * \brief Returns the minor version of the pcap file as defined by the version_minor
159
   * field in the pcap global header.
167
   * field in the pcap global header.
160
   *
168
   *
161
   * See http://wiki.wireshark.org/Development/LibpcapFileFormat
169
   * See http://wiki.wireshark.org/Development/LibpcapFileFormat
170
   *
171
   * \returns minor version
162
   */ 
172
   */ 
163
  uint16_t GetVersionMinor (void);
173
  uint16_t GetVersionMinor (void);
164
174
165
  /*
175
  /**
166
   * \brief Returns the time zone offset of the pcap file as defined by the thiszone
176
   * \brief Returns the time zone offset of the pcap file as defined by the thiszone
167
   * field in the pcap global header.
177
   * field in the pcap global header.
168
   *
178
   *
169
   * See http://wiki.wireshark.org/Development/LibpcapFileFormat
179
   * See http://wiki.wireshark.org/Development/LibpcapFileFormat
180
   *
181
   * \returns time zone offset
170
   */ 
182
   */ 
171
  int32_t GetTimeZoneOffset (void);
183
  int32_t GetTimeZoneOffset (void);
172
184
173
  /*
185
  /**
174
   * \brief Returns the accuracy of timestamps field of the pcap file as defined
186
   * \brief Returns the accuracy of timestamps field of the pcap file as defined
175
   * by the sigfigs field in the pcap global header.
187
   * by the sigfigs field in the pcap global header.
176
   *
188
   *
177
   * See http://wiki.wireshark.org/Development/LibpcapFileFormat
189
   * See http://wiki.wireshark.org/Development/LibpcapFileFormat
190
   *
191
   * \returns accuracy of timestamps
178
   */ 
192
   */ 
179
  uint32_t GetSigFigs (void);
193
  uint32_t GetSigFigs (void);
180
194
181
  /*
195
  /**
182
   * \brief Returns the max length of saved packets field of the pcap file as 
196
   * \brief Returns the max length of saved packets field of the pcap file as 
183
   * defined by the snaplen field in the pcap global header.
197
   * defined by the snaplen field in the pcap global header.
184
   *
198
   *
185
   * See http://wiki.wireshark.org/Development/LibpcapFileFormat
199
   * See http://wiki.wireshark.org/Development/LibpcapFileFormat
200
   *
201
   * \returns max length of saved packets field
186
   */ 
202
   */ 
187
  uint32_t GetSnapLen (void);
203
  uint32_t GetSnapLen (void);
188
204
189
  /*
205
  /**
190
   * \brief Returns the data link type field of the pcap file as defined by the 
206
   * \brief Returns the data link type field of the pcap file as defined by the 
191
   * network field in the pcap global header.
207
   * network field in the pcap global header.
192
   *
208
   *
193
   * See http://wiki.wireshark.org/Development/LibpcapFileFormat
209
   * See http://wiki.wireshark.org/Development/LibpcapFileFormat
210
   *
211
   * \returns data link type field
194
   */ 
212
   */ 
195
  uint32_t GetDataLinkType (void);
213
  uint32_t GetDataLinkType (void);
196
214
197
private:
215
private:
198
  PcapFile m_file;
216
  PcapFile m_file; //!< Pcap file
199
  uint32_t m_snapLen;
217
  uint32_t m_snapLen; //!< max length of saved packets
200
};
218
};
201
219
202
} // namespace ns3
220
} // namespace ns3
(-)a/src/network/utils/pcap-file.h (-11 / +72 lines)
 Lines 186-247    Link Here 
186
   * byteswapped.  Used primarily for testing the class itself, but may be 
186
   * byteswapped.  Used primarily for testing the class itself, but may be 
187
   * useful as a flag indicating a difference in endianness of the writing 
187
   * useful as a flag indicating a difference in endianness of the writing 
188
   * system.
188
   * system.
189
   *
190
   * \returns swap mode of the file
189
   */
191
   */
190
  bool GetSwapMode (void);
192
  bool GetSwapMode (void);
191
193
192
  /*
194
  /**
193
   * \brief Returns the magic number of the pcap file as defined by the magic_number
195
   * \brief Returns the magic number of the pcap file as defined by the magic_number
194
   * field in the pcap global header.
196
   * field in the pcap global header.
195
   *
197
   *
196
   * See http://wiki.wireshark.org/Development/LibpcapFileFormat
198
   * See http://wiki.wireshark.org/Development/LibpcapFileFormat
199
   *
200
   * \returns magic number
197
   */ 
201
   */ 
198
  uint32_t GetMagic (void);
202
  uint32_t GetMagic (void);
199
203
200
  /*
204
  /**
201
   * \brief Returns the major version of the pcap file as defined by the version_major
205
   * \brief Returns the major version of the pcap file as defined by the version_major
202
   * field in the pcap global header.
206
   * field in the pcap global header.
203
   *
207
   *
204
   * See http://wiki.wireshark.org/Development/LibpcapFileFormat
208
   * See http://wiki.wireshark.org/Development/LibpcapFileFormat
209
   *
210
   * \returns major version
205
   */ 
211
   */ 
206
  uint16_t GetVersionMajor (void);
212
  uint16_t GetVersionMajor (void);
207
213
208
  /*
214
  /**
209
   * \brief Returns the minor version of the pcap file as defined by the version_minor
215
   * \brief Returns the minor version of the pcap file as defined by the version_minor
210
   * field in the pcap global header.
216
   * field in the pcap global header.
211
   *
217
   *
212
   * See http://wiki.wireshark.org/Development/LibpcapFileFormat
218
   * See http://wiki.wireshark.org/Development/LibpcapFileFormat
219
   *
220
   * \returns minor version
213
   */ 
221
   */ 
214
  uint16_t GetVersionMinor (void);
222
  uint16_t GetVersionMinor (void);
215
223
216
  /*
224
  /**
217
   * \brief Returns the time zone offset of the pcap file as defined by the thiszone
225
   * \brief Returns the time zone offset of the pcap file as defined by the thiszone
218
   * field in the pcap global header.
226
   * field in the pcap global header.
219
   *
227
   *
220
   * See http://wiki.wireshark.org/Development/LibpcapFileFormat
228
   * See http://wiki.wireshark.org/Development/LibpcapFileFormat
229
   *
230
   * \returns time zone offset
221
   */ 
231
   */ 
222
  int32_t GetTimeZoneOffset (void);
232
  int32_t GetTimeZoneOffset (void);
223
233
224
  /*
234
  /**
225
   * \brief Returns the accuracy of timestamps field of the pcap file as defined
235
   * \brief Returns the accuracy of timestamps field of the pcap file as defined
226
   * by the sigfigs field in the pcap global header.
236
   * by the sigfigs field in the pcap global header.
227
   *
237
   *
228
   * See http://wiki.wireshark.org/Development/LibpcapFileFormat
238
   * See http://wiki.wireshark.org/Development/LibpcapFileFormat
239
   *
240
   * \returns accuracy of timestamps
229
   */ 
241
   */ 
230
  uint32_t GetSigFigs (void);
242
  uint32_t GetSigFigs (void);
231
243
232
  /*
244
  /**
233
   * \brief Returns the max length of saved packets field of the pcap file as 
245
   * \brief Returns the max length of saved packets field of the pcap file as 
234
   * defined by the snaplen field in the pcap global header.
246
   * defined by the snaplen field in the pcap global header.
235
   *
247
   *
236
   * See http://wiki.wireshark.org/Development/LibpcapFileFormat
248
   * See http://wiki.wireshark.org/Development/LibpcapFileFormat
249
   *
250
   * \returns max length of saved packets field
237
   */ 
251
   */ 
238
  uint32_t GetSnapLen (void);
252
  uint32_t GetSnapLen (void);
239
253
240
  /*
254
  /**
241
   * \brief Returns the data link type field of the pcap file as defined by the 
255
   * \brief Returns the data link type field of the pcap file as defined by the 
242
   * network field in the pcap global header.
256
   * network field in the pcap global header.
243
   *
257
   *
244
   * See http://wiki.wireshark.org/Development/LibpcapFileFormat
258
   * See http://wiki.wireshark.org/Development/LibpcapFileFormat
259
   *
260
   * \returns data link type field
245
   */ 
261
   */ 
246
  uint32_t GetDataLinkType (void);
262
  uint32_t GetDataLinkType (void);
247
263
 Lines 261-266    Link Here 
261
                    uint32_t snapLen = SNAPLEN_DEFAULT);
277
                    uint32_t snapLen = SNAPLEN_DEFAULT);
262
278
263
private:
279
private:
280
  /**
281
   * \brief Pcap file header
282
   */
264
  typedef struct {
283
  typedef struct {
265
    uint32_t m_magicNumber;   /**< Magic number identifying this as a pcap file */
284
    uint32_t m_magicNumber;   /**< Magic number identifying this as a pcap file */
266
    uint16_t m_versionMajor;  /**< Major version identifying the version of pcap used in this file */
285
    uint16_t m_versionMajor;  /**< Major version identifying the version of pcap used in this file */
 Lines 271-276    Link Here 
271
    uint32_t m_type;          /**< Data link type of packet data */
290
    uint32_t m_type;          /**< Data link type of packet data */
272
  } PcapFileHeader;
291
  } PcapFileHeader;
273
292
293
  /**
294
   * \brief Pcap record header
295
   */
274
  typedef struct {
296
  typedef struct {
275
    uint32_t m_tsSec;         /**< seconds part of timestamp */
297
    uint32_t m_tsSec;         /**< seconds part of timestamp */
276
    uint32_t m_tsUsec;        /**< microseconds part of timestamp (nsecs for PCAP_NSEC_MAGIC) */
298
    uint32_t m_tsUsec;        /**< microseconds part of timestamp (nsecs for PCAP_NSEC_MAGIC) */
 Lines 278-297    Link Here 
278
    uint32_t m_origLen;       /**< actual length of original packet */
300
    uint32_t m_origLen;       /**< actual length of original packet */
279
  } PcapRecordHeader;
301
  } PcapRecordHeader;
280
302
303
  /**
304
   * \brief Swap a value byte order
305
   * \param val the value
306
   * \returns the value with byte order swapped
307
   */
281
  uint8_t Swap (uint8_t val);
308
  uint8_t Swap (uint8_t val);
309
  /**
310
   * \brief Swap a value byte order
311
   * \param val the value
312
   * \returns the value with byte order swapped
313
   */
282
  uint16_t Swap (uint16_t val);
314
  uint16_t Swap (uint16_t val);
315
  /**
316
   * \brief Swap a value byte order
317
   * \param val the value
318
   * \returns the value with byte order swapped
319
   */
283
  uint32_t Swap (uint32_t val);
320
  uint32_t Swap (uint32_t val);
321
  /**
322
   * \brief Swap the byte order of a Pcap file header
323
   * \param from original file header
324
   * \param to swapped file header
325
   */
284
  void Swap (PcapFileHeader *from, PcapFileHeader *to);
326
  void Swap (PcapFileHeader *from, PcapFileHeader *to);
327
  /**
328
   * \brief Swap the byte order of a Pcap record header
329
   * \param from original record header
330
   * \param to swapped record header
331
   */
285
  void Swap (PcapRecordHeader *from, PcapRecordHeader *to);
332
  void Swap (PcapRecordHeader *from, PcapRecordHeader *to);
286
333
334
  /**
335
   * \brief Write a Pcap file header
336
   */
287
  void WriteFileHeader (void);
337
  void WriteFileHeader (void);
338
  /**
339
   * \brief Write a Pcap packet header
340
   * \param tsSec Time stamp (seconds part)
341
   * \param tsUsec Time stamp (microseconds part)
342
   * \param totalLen total packet length
343
   * \returns the length of the packet to write in the Pcap file
344
   */
288
  uint32_t WritePacketHeader (uint32_t tsSec, uint32_t tsUsec, uint32_t totalLen);
345
  uint32_t WritePacketHeader (uint32_t tsSec, uint32_t tsUsec, uint32_t totalLen);
346
347
  /**
348
   * \brief Read and verify a Pcap file header
349
   */
289
  void ReadAndVerifyFileHeader (void);
350
  void ReadAndVerifyFileHeader (void);
290
351
291
  std::string    m_filename;
352
  std::string    m_filename;    //!< file name
292
  std::fstream   m_file;
353
  std::fstream   m_file;        //!< file stream
293
  PcapFileHeader m_fileHeader;
354
  PcapFileHeader m_fileHeader;  //!< file header
294
  bool m_swapMode;
355
  bool m_swapMode;              //!< swap mode
295
};
356
};
296
357
297
} // namespace ns3
358
} // namespace ns3
(-)a/src/network/utils/queue.h (-6 / +26 lines)
 Lines 45-50    Link Here 
45
class Queue : public Object
45
class Queue : public Object
46
{
46
{
47
public:
47
public:
48
  /**
49
   * \brief Get the type ID.
50
   * \return the object TypeId
51
   */
48
  static TypeId GetTypeId (void);
52
  static TypeId GetTypeId (void);
49
53
50
  Queue ();
54
  Queue ();
 Lines 151-158    Link Here 
151
155
152
private:
156
private:
153
157
158
  /**
159
   * Push a packet in the queue
160
   * \param p the packet to enqueue
161
   * \return true if success, false if the packet has been dropped.
162
   */
154
  virtual bool DoEnqueue (Ptr<Packet> p) = 0;
163
  virtual bool DoEnqueue (Ptr<Packet> p) = 0;
164
  /**
165
   * Pull a packet from the queue
166
   * \return the packet.
167
   */
155
  virtual Ptr<Packet> DoDequeue (void) = 0;
168
  virtual Ptr<Packet> DoDequeue (void) = 0;
169
  /**
170
   * Peek the front packet in the queue
171
   * \return the packet.
172
   */
156
  virtual Ptr<const Packet> DoPeek (void) const = 0;
173
  virtual Ptr<const Packet> DoPeek (void) const = 0;
157
174
158
protected:
175
protected:
 Lines 164-179    Link Here 
164
  void Drop (Ptr<Packet> packet);
181
  void Drop (Ptr<Packet> packet);
165
182
166
private:
183
private:
184
  /// Traced callback: fired when a packet is enqueued
167
  TracedCallback<Ptr<const Packet> > m_traceEnqueue;
185
  TracedCallback<Ptr<const Packet> > m_traceEnqueue;
186
  /// Traced callback: fired when a packet is dequeued
168
  TracedCallback<Ptr<const Packet> > m_traceDequeue;
187
  TracedCallback<Ptr<const Packet> > m_traceDequeue;
188
  /// Traced callback: fired when a packet is dropped
169
  TracedCallback<Ptr<const Packet> > m_traceDrop;
189
  TracedCallback<Ptr<const Packet> > m_traceDrop;
170
190
171
  uint32_t m_nBytes;
191
  uint32_t m_nBytes;                //!< Number of bytes in the queue
172
  uint32_t m_nTotalReceivedBytes;
192
  uint32_t m_nTotalReceivedBytes;   //!< Total received bytes
173
  uint32_t m_nPackets;
193
  uint32_t m_nPackets;              //!< Number of packets in the queue
174
  uint32_t m_nTotalReceivedPackets;
194
  uint32_t m_nTotalReceivedPackets; //!< Total received packets
175
  uint32_t m_nTotalDroppedBytes;
195
  uint32_t m_nTotalDroppedBytes;    //!< Total dropped bytes
176
  uint32_t m_nTotalDroppedPackets;
196
  uint32_t m_nTotalDroppedPackets;  //!< Total dropped packets
177
};
197
};
178
198
179
} // namespace ns3
199
} // namespace ns3
(-)a/src/network/utils/radiotap-header.h (-12 / +14 lines)
 Lines 35-41    Link Here 
35
 * from a userspace application to the driver for transmission. 
35
 * from a userspace application to the driver for transmission. 
36
 *
36
 *
37
 * @warning the radiotap header specification says that the fields included in
37
 * @warning the radiotap header specification says that the fields included in
38
 * the header should be aligned to their natural ize (e.g., 16-bit fields 
38
 * the header should be aligned to their natural size (e.g., 16-bit fields
39
 * aligned to 16-bit boundaries, 32-bit fields aligned to 32-bit boundaries, 
39
 * aligned to 16-bit boundaries, 32-bit fields aligned to 32-bit boundaries, 
40
 * and so on.  This implementation does not enforce this.  However, the radiotap
40
 * and so on.  This implementation does not enforce this.  However, the radiotap
41
 * specification enforces an order in which fields have to appear (if they 
41
 * specification enforces an order in which fields have to appear (if they 
 Lines 49-54    Link Here 
49
{
49
{
50
public:
50
public:
51
  RadiotapHeader();
51
  RadiotapHeader();
52
  /**
53
   * \brief Get the type ID.
54
   * \return the object TypeId
55
   */
52
  static TypeId GetTypeId (void);
56
  static TypeId GetTypeId (void);
53
  virtual TypeId GetInstanceTypeId (void) const;
57
  virtual TypeId GetInstanceTypeId (void) const;
54
58
 Lines 242-259    Link Here 
242
    RADIOTAP_EXT               = 0x10000000
246
    RADIOTAP_EXT               = 0x10000000
243
  };
247
  };
244
 
248
 
245
  void CheckAddChannelField ();
249
  uint16_t m_length;        //!< entire length of radiotap data + header
250
  uint32_t m_present;       //!< bits describing which fields follow header
246
251
247
  uint16_t m_length;
252
  uint64_t m_tsft;          //!< Time Synchronization Function Timer (when the first bit of the MPDU arrived at the MAC)
248
  uint32_t m_present;
253
  uint8_t m_flags;          //!< Properties of transmitted and received frames.
249
254
  uint8_t m_rate;           //!< TX/RX data rate in units of 500 kbps
250
  uint64_t m_tsft;
255
  uint16_t m_channelFreq;   //!< Tx/Rx frequency in MHz.
251
  uint8_t m_flags;
256
  uint16_t m_channelFlags;  //!< Tx/Rx channel flags.
252
  uint8_t m_rate;
257
  int8_t m_antennaSignal;   //!< RF signal power at the antenna, dB difference from an arbitrary, fixed reference.
253
  uint16_t m_channelFreq;
258
  int8_t m_antennaNoise;    //!< RF noise power at the antenna, dB difference from an arbitrary, fixed reference.
254
  uint16_t m_channelFlags;
255
  int8_t m_antennaSignal;
256
  int8_t m_antennaNoise;
257
};
259
};
258
260
259
} // namespace ns3
261
} // namespace ns3
(-)a/src/network/utils/red-queue.h (-74 / +89 lines)
 Lines 74-80    Link Here 
74
class TraceContainer;
74
class TraceContainer;
75
class UniformRandomVariable;
75
class UniformRandomVariable;
76
76
77
/*
77
/**
78
 * \ingroup queue
78
 * \ingroup queue
79
 *
79
 *
80
 * \brief A RED packet queue
80
 * \brief A RED packet queue
 Lines 82-87    Link Here 
82
class RedQueue : public Queue
82
class RedQueue : public Queue
83
{
83
{
84
public:
84
public:
85
  /**
86
   * \brief Get the type ID.
87
   * \return the object TypeId
88
   */
85
  static TypeId GetTypeId (void);
89
  static TypeId GetTypeId (void);
86
  /**
90
  /**
87
   * \brief RedQueue Constructor
91
   * \brief RedQueue Constructor
 Lines 99-122    Link Here 
99
103
100
  /**
104
  /**
101
   * \brief Stats
105
   * \brief Stats
102
   *
103
   */
106
   */
104
  typedef struct
107
  typedef struct
105
  {   
108
  {   
106
    uint32_t unforcedDrop;  /// Early probability drops 
109
    uint32_t unforcedDrop;  //!< Early probability drops
107
    uint32_t forcedDrop;    /// Forced drops, qavg > max threshold
110
    uint32_t forcedDrop;    //!< Forced drops, qavg > max threshold
108
    uint32_t qLimDrop;      /// Drops due to queue limits
111
    uint32_t qLimDrop;      //!< Drops due to queue limits
109
  } Stats;
112
  } Stats;
110
113
111
  /** 
114
  /** 
112
   * \brief Drop types
115
   * \brief Drop types
113
   *
114
   */
116
   */
115
  enum
117
  enum
116
  {
118
  {
117
    DTYPE_NONE,        /// Ok, no drop
119
    DTYPE_NONE,        //!< Ok, no drop
118
    DTYPE_FORCED,      /// A "forced" drop
120
    DTYPE_FORCED,      //!< A "forced" drop
119
    DTYPE_UNFORCED,    /// An "unforced" (random) drop
121
    DTYPE_UNFORCED,    //!< An "unforced" (random) drop
120
  };
122
  };
121
123
122
  /**
124
  /**
 Lines 179-268    Link Here 
179
  virtual Ptr<Packet> DoDequeue (void);
181
  virtual Ptr<Packet> DoDequeue (void);
180
  virtual Ptr<const Packet> DoPeek (void) const;
182
  virtual Ptr<const Packet> DoPeek (void) const;
181
183
182
  // ...
184
  /**
185
   * \brief Initialize the queue parameters.
186
   *
187
   * Note: if the link bandwidth changes in the course of the
188
   * simulation, the bandwidth-dependent RED parameters do not change.
189
   * This should be fixed, but it would require some extra parameters,
190
   * and didn't seem worth the trouble...
191
   */
183
  void InitializeParams (void);
192
  void InitializeParams (void);
184
  // Compute the average queue size
193
  /**
194
   * \brief Compute the average queue size
195
   * \param nQueued number of queued packets
196
   * \param m simulated number of packets arrival during idle period
197
   * \param qAvg average queue size
198
   * \param qW queue weight given to cur q size sample
199
   * \returns new average queue size
200
   */
185
  double Estimator (uint32_t nQueued, uint32_t m, double qAvg, double qW);
201
  double Estimator (uint32_t nQueued, uint32_t m, double qAvg, double qW);
186
  // Check if packet p needs to be dropped due to probability mark
202
  /**
203
   * \brief Check if packet p needs to be dropped due to probability mark
204
   * \param p packet
205
   * \param qSize queue size
206
   * \returns 0 for no drop/mark, 1 for drop
207
   */
187
  uint32_t DropEarly (Ptr<Packet> p, uint32_t qSize);
208
  uint32_t DropEarly (Ptr<Packet> p, uint32_t qSize);
188
  // Returns a probability using these function parameters for the DropEarly funtion
209
  /**
189
  double CalculatePNew (double qAvg, double maxTh, bool gentle, double vA,
210
   * \brief Returns a probability using these function parameters for the DropEarly function
211
   * \param qAvg Average queue length
212
   * \param maxTh Max avg length threshold
213
   * \param gentle "gentle" algorithm
214
   * \param vA vA
215
   * \param vB vB
216
   * \param vC vC
217
   * \param vD vD
218
   * \param maxP max_p
219
   * \returns Prob. of packet drop before "count"
220
   */
221
  double CalculatePNew (double qAvg, double , bool gentle, double vA,
190
                        double vB, double vC, double vD, double maxP);
222
                        double vB, double vC, double vD, double maxP);
191
  // Returns a probability using these function parameters for the DropEarly funtion
223
  /**
224
   * \brief Returns a probability using these function parameters for the DropEarly function
225
   * \param p Prob. of packet drop before "count"
226
   * \param count number of packets since last random number generation
227
   * \param countBytes number of bytes since last drop
228
   * \param meanPktSize Avg pkt size
229
   * \param wait True for waiting between dropped packets
230
   * \param size packet size
231
   * \returns Prob. of packet drop
232
   */
192
  double ModifyP (double p, uint32_t count, uint32_t countBytes,
233
  double ModifyP (double p, uint32_t count, uint32_t countBytes,
193
                  uint32_t meanPktSize, bool wait, uint32_t size);
234
                  uint32_t meanPktSize, bool wait, uint32_t size);
194
235
195
  std::list<Ptr<Packet> > m_packets;
236
  std::list<Ptr<Packet> > m_packets; //!< packets in the queue
196
237
197
  uint32_t m_bytesInQueue;
238
  uint32_t m_bytesInQueue; //!< bytes in the queue
198
  bool m_hasRedStarted;
239
  bool m_hasRedStarted; //!< True if RED has started
199
  Stats m_stats;
240
  Stats m_stats; //!< RED statistics
200
241
201
  // ** Variables supplied by user
242
  // ** Variables supplied by user
202
  // Bytes or packets?
243
  QueueMode m_mode;         //!< Mode (Bytes or packets)
203
  QueueMode m_mode;
244
  uint32_t m_meanPktSize;   //!< Avg pkt size
204
  // Avg pkt size
245
  uint32_t m_idlePktSize;   //!< Avg pkt size used during idle times
205
  uint32_t m_meanPktSize;
246
  bool m_isWait;            //!< True for waiting between dropped packets
206
  // Avg pkt size used during idle times
247
  bool m_isGentle;          //!< True to increases dropping prob. slowly when ave queue exceeds maxthresh
207
  uint32_t m_idlePktSize;
248
  double m_minTh;           //!< Min avg length threshold (bytes)
208
  // True for waiting between dropped packets
249
  double m_maxTh;           //!< Max avg length threshold (bytes), should be >= 2*minTh
209
  bool m_isWait;
250
  uint32_t m_queueLimit;    //!< Queue limit in bytes / packets
210
  // True to increases dropping prob. slowly when ave queue exceeds maxthresh
251
  double m_qW;              //!< Queue weight given to cur queue size sample
211
  bool m_isGentle;
252
  double m_lInterm;         //!< The max probability of dropping a packet
212
  // Min avg length threshold (bytes)
253
  bool m_isNs1Compat;       //!< Ns-1 compatibility
213
  double m_minTh;
254
  DataRate m_linkBandwidth; //!< Link bandwidth
214
  // Max avg length threshold (bytes), should be >= 2*minTh
255
  Time m_linkDelay;         //!< Link delay
215
  double m_maxTh;
216
  // Queue limit in bytes / packets
217
  uint32_t m_queueLimit;
218
  // Queue weight given to cur q size sample
219
  double m_qW;
220
  // The max probability of dropping a packet
221
  double m_lInterm;
222
  // Ns-1 compatibility
223
  bool m_isNs1Compat;
224
  // Link bandwidth
225
  DataRate m_linkBandwidth;
226
  // Link delay
227
  Time m_linkDelay;
228
256
229
  // ** Variables maintained by RED
257
  // ** Variables maintained by RED
230
  // Prob. of packet drop before "count"
258
  double m_vProb1;          //!< Prob. of packet drop before "count"
231
  double m_vProb1;
259
  double m_vA;              //!< 1.0 / (m_maxTh - m_minTh)
232
  // v_prob = v_a * v_ave + v_b
260
  double m_vB;              //!< -m_minTh / (m_maxTh - m_minTh)
233
  double m_vA;
261
  double m_vC;              //!< (1.0 - m_curMaxP) / m_maxTh - used in "gentle" mode
234
  double m_vB;
262
  double m_vD;              //!< 2.0 * m_curMaxP - 1.0 - used in "gentle" mode
235
  // Used for "gentle" mode
263
  double m_curMaxP;         //!< Current max_p
236
  double m_vC;
264
  double m_vProb;           //!< Prob. of packet drop
237
  // Used for "gentle" mode
265
  uint32_t m_countBytes;    //!< Number of bytes since last drop
238
  double m_vD;
266
  uint32_t m_old;           //!< 0 when average queue first exceeds threshold
239
  // Current max_p
267
  uint32_t m_idle;          //!< 0/1 idle status
240
  double m_curMaxP;
268
  double m_ptc;             //!< packet time constant in packets/second
241
  // Prob. of packet drop
269
  double m_qAvg;            //!< Average queue length
242
  double m_vProb;
270
  uint32_t m_count;         //!< Number of packets since last random number generation
243
  // # of bytes since last drop
271
  /**
244
  uint32_t m_countBytes;
245
  // 0 when average queue first exceeds thresh
246
  uint32_t m_old;
247
  // 0/1 idle status
248
  uint32_t m_idle;
249
  // packet time constant in packets/second
250
  double m_ptc;
251
  // Average queue length
252
  double m_qAvg;
253
  // number of packets since last random number generation
254
  uint32_t m_count;
255
  /*
256
   * 0 for default RED
272
   * 0 for default RED
257
   * 1 experimental (see red-queue.cc)
273
   * 1 experimental (see red-queue.cc)
258
   * 2 experimental (see red-queue.cc)
274
   * 2 experimental (see red-queue.cc)
259
   * 3 use Idle packet size in the ptc
275
   * 3 use Idle packet size in the ptc
260
   */
276
   */
261
  uint32_t m_cautious;
277
  uint32_t m_cautious;
262
  // Start of current idle period
278
  Time m_idleTime;          //!< Start of current idle period
263
  Time m_idleTime;
264
279
265
  Ptr<UniformRandomVariable> m_uv;
280
  Ptr<UniformRandomVariable> m_uv;  //!< rng stream
266
};
281
};
267
282
268
}; // namespace ns3
283
}; // namespace ns3
(-)a/src/network/utils/sequence-number.h (-2 / +91 lines)
 Lines 341-367    Link Here 
341
  friend std::istream & operator >> (std::istream &is, const SequenceNumber<NUMERIC_TYPE2, SIGNED_TYPE2> &val);
341
  friend std::istream & operator >> (std::istream &is, const SequenceNumber<NUMERIC_TYPE2, SIGNED_TYPE2> &val);
342
342
343
private: // unimplemented operators
343
private: // unimplemented operators
344
  /**
345
   * \brief Plus equals operator - unimplemented
346
   * \param value value
347
   * \returns sequence number
348
   */
344
  SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE>& operator+= (SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> const &value);
349
  SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE>& operator+= (SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> const &value);
350
  /**
351
   * \brief Minus equals operator - unimplemented
352
   * \param value value
353
   * \returns sequence number
354
   */
345
  SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE>& operator-= (SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> const &value);
355
  SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE>& operator-= (SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> const &value);
356
  /**
357
   * \brief Multiplication operator - unimplemented
358
   * \param b value
359
   * \returns sequence number
360
   */
346
  SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> operator* (const SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE>& b) const;
361
  SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> operator* (const SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE>& b) const;
362
  /**
363
   * \brief Division operator - unimplemented
364
   * \param b value
365
   * \returns sequence number
366
   */
347
  SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> operator/ (const SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE>& b) const;
367
  SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> operator/ (const SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE>& b) const;
368
  /**
369
   * \brief Modulo operator - unimplemented
370
   * \param b value
371
   * \returns sequence number
372
   */
348
  SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> operator% (const SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE>& b) const;
373
  SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> operator% (const SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE>& b) const;
374
  /**
375
   * \brief Logical NOT operator - unimplemented
376
   * \returns condition
377
   */
349
  bool operator ! () const;
378
  bool operator ! () const;
379
  /**
380
   * \brief Logical AND operator - unimplemented
381
   * \param b value
382
   * \returns condition
383
   */
350
  bool operator && (const SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE>& b) const;
384
  bool operator && (const SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE>& b) const;
385
  /**
386
   * \brief Logical OR operator - unimplemented
387
   * \param b value
388
   * \returns condition
389
   */
351
  bool operator || (const SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE>& b) const;
390
  bool operator || (const SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE>& b) const;
391
  /**
392
   * \brief Bitwise NOT operator - unimplemented
393
   * \returns sequence number
394
   */
352
  SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> operator~ () const;
395
  SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> operator~ () const;
396
  /**
397
   * \brief Bitwise AND operator - unimplemented
398
   * \param b value
399
   * \returns sequence number
400
   */
353
  SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> operator& (const SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE>& b) const;
401
  SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> operator& (const SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE>& b) const;
402
  /**
403
   * \brief Bitwise OR operator - unimplemented
404
   * \param b value
405
   * \returns sequence number
406
   */
354
  SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> operator| (const SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE>& b) const;
407
  SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> operator| (const SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE>& b) const;
408
  /**
409
   * \brief Bitwise XOR operator - unimplemented
410
   * \param b value
411
   * \returns sequence number
412
   */
355
  SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> operator^ (const SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE>& b) const;
413
  SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> operator^ (const SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE>& b) const;
414
  /**
415
   * \brief Bitwise left shift operator - unimplemented
416
   * \param b value
417
   * \returns sequence number
418
   */
356
  SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> operator<< (const SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE>& b) const;
419
  SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> operator<< (const SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE>& b) const;
420
  /**
421
   * \brief Bitwise right shift operator - unimplemented
422
   * \param b value
423
   * \returns sequence number
424
   */
357
  SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> operator>> (const SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE>& b) const;
425
  SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> operator>> (const SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE>& b) const;
426
  /**
427
   * \brief Indirection operator - unimplemented
428
   * \returns integer
429
   */
358
  int operator* ();
430
  int operator* ();
359
  //SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE>* operator& ();
431
  //SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE>* operator& ();
360
432
361
private:
433
private:
362
  NUMERIC_TYPE m_value;
434
  NUMERIC_TYPE m_value; //!< Sequence number value
363
};
435
};
364
436
437
438
/**
439
 * \brief Stream insertion operator.
440
 *
441
 * \param os the stream
442
 * \param val the value
443
 * \returns a reference to the stream
444
 */
365
template<typename NUMERIC_TYPE, typename SIGNED_TYPE>
445
template<typename NUMERIC_TYPE, typename SIGNED_TYPE>
366
std::ostream &
446
std::ostream &
367
operator<< (std::ostream& os, const SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> &val)
447
operator<< (std::ostream& os, const SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> &val)
 Lines 370-375    Link Here 
370
  return os;
450
  return os;
371
}
451
}
372
452
453
454
/**
455
 * \brief Stream extraction operator.
456
 *
457
 * \param is the stream
458
 * \param val the value
459
 * \returns a reference to the stream
460
 */
373
template<typename NUMERIC_TYPE, typename SIGNED_TYPE>
461
template<typename NUMERIC_TYPE, typename SIGNED_TYPE>
374
std::istream & operator >> (std::istream &is, const SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> &val)
462
std::istream & operator >> (std::istream &is, const SequenceNumber<NUMERIC_TYPE, SIGNED_TYPE> &val)
375
{
463
{
 Lines 377-384    Link Here 
377
  return is;
465
  return is;
378
}
466
}
379
467
380
468
/// 32 bit Sequence number
381
typedef SequenceNumber<uint32_t, int32_t> SequenceNumber32;
469
typedef SequenceNumber<uint32_t, int32_t> SequenceNumber32;
470
/// 16 bit Sequence number
382
typedef SequenceNumber<uint16_t, int16_t> SequenceNumber16;
471
typedef SequenceNumber<uint16_t, int16_t> SequenceNumber16;
383
472
384
} // namespace ns3
473
} // namespace ns3
(-)a/src/network/utils/simple-channel.h (-1 / +5 lines)
 Lines 36-41    Link Here 
36
class SimpleChannel : public Channel
36
class SimpleChannel : public Channel
37
{
37
{
38
public:
38
public:
39
  /**
40
   * \brief Get the type ID.
41
   * \return the object TypeId
42
   */
39
  static TypeId GetTypeId (void);
43
  static TypeId GetTypeId (void);
40
  SimpleChannel ();
44
  SimpleChannel ();
41
45
 Lines 66-72    Link Here 
66
  virtual Ptr<NetDevice> GetDevice (uint32_t i) const;
70
  virtual Ptr<NetDevice> GetDevice (uint32_t i) const;
67
71
68
private:
72
private:
69
  std::vector<Ptr<SimpleNetDevice> > m_devices;
73
  std::vector<Ptr<SimpleNetDevice> > m_devices; //!< devices connected by the channel
70
};
74
};
71
75
72
} // namespace ns3
76
} // namespace ns3
(-)a/src/network/utils/simple-net-device.h (-8 / +12 lines)
 Lines 45-50    Link Here 
45
class SimpleNetDevice : public NetDevice
45
class SimpleNetDevice : public NetDevice
46
{
46
{
47
public:
47
public:
48
  /**
49
   * \brief Get the type ID.
50
   * \return the object TypeId
51
   */
48
  static TypeId GetTypeId (void);
52
  static TypeId GetTypeId (void);
49
  SimpleNetDevice ();
53
  SimpleNetDevice ();
50
54
 Lines 112-125    Link Here 
112
protected:
116
protected:
113
  virtual void DoDispose (void);
117
  virtual void DoDispose (void);
114
private:
118
private:
115
  Ptr<SimpleChannel> m_channel;
119
  Ptr<SimpleChannel> m_channel; //!< the channel the device is connected to
116
  NetDevice::ReceiveCallback m_rxCallback;
120
  NetDevice::ReceiveCallback m_rxCallback; //!< Receive callback
117
  NetDevice::PromiscReceiveCallback m_promiscCallback;
121
  NetDevice::PromiscReceiveCallback m_promiscCallback; //!< Promiscuous receive callback
118
  Ptr<Node> m_node;
122
  Ptr<Node> m_node; //!< Node this netDevice is associated to
119
  uint16_t m_mtu;
123
  uint16_t m_mtu;   //!< MTU
120
  uint32_t m_ifIndex;
124
  uint32_t m_ifIndex; //!< Interface index
121
  Mac48Address m_address;
125
  Mac48Address m_address; //!< MAC address
122
  Ptr<ErrorModel> m_receiveErrorModel;
126
  Ptr<ErrorModel> m_receiveErrorModel; //!< Receive error model.
123
  /**
127
  /**
124
   * The trace source fired when the phy layer drops a packet it has received
128
   * The trace source fired when the phy layer drops a packet it has received
125
   * due to the error model being active.  Although SimpleNetDevice doesn't 
129
   * due to the error model being active.  Although SimpleNetDevice doesn't 

Return to bug 938