|
|
| 22 |
|
22 |
|
| 23 |
#include <stdint.h> |
23 |
#include <stdint.h> |
| 24 |
#include <vector> |
24 |
#include <vector> |
|
|
25 |
#include <limits> |
| 25 |
#include "ns3/callback.h" |
26 |
#include "ns3/callback.h" |
| 26 |
#include "ns3/assert.h" |
27 |
#include "ns3/assert.h" |
| 27 |
#include "ns3/type-id.h" |
28 |
#include "ns3/type-id.h" |
|
|
| 208 |
const uint8_t* start, |
209 |
const uint8_t* start, |
| 209 |
const uint8_t* current, |
210 |
const uint8_t* current, |
| 210 |
uint32_t maxSize); |
211 |
uint32_t maxSize); |
|
|
212 |
|
| 213 |
/** |
| 214 |
* the size of PacketMetadata::Data::m_data such that the total size |
| 215 |
* of PacketMetadata::Data is 16 bytes |
| 216 |
*/ |
| 217 |
#define PACKET_METADATA_DATA_M_DATA_SIZE 8 |
| 218 |
|
| 211 |
struct Data { |
219 |
struct Data { |
| 212 |
/* number of references to this struct Data instance. */ |
220 |
/* number of references to this struct Data instance. */ |
| 213 |
uint16_t m_count; |
221 |
uint32_t m_count; |
| 214 |
/* size (in bytes) of m_data buffer below */ |
222 |
/* size (in bytes) of m_data buffer below */ |
| 215 |
uint16_t m_size; |
223 |
uint16_t m_size; |
| 216 |
/* max of the m_used field over all objects which |
224 |
/* max of the m_used field over all objects which |
| 217 |
* reference this struct Data instance */ |
225 |
* reference this struct Data instance */ |
| 218 |
uint16_t m_dirtyEnd; |
226 |
uint16_t m_dirtyEnd; |
| 219 |
/* variable-sized buffer of bytes */ |
227 |
/* variable-sized buffer of bytes */ |
| 220 |
uint8_t m_data[10]; |
228 |
uint8_t m_data[PACKET_METADATA_DATA_M_DATA_SIZE]; |
| 221 |
}; |
229 |
}; |
| 222 |
/* Note that since the next and prev fields are 16 bit integers |
230 |
/* Note that since the next and prev fields are 16 bit integers |
| 223 |
and since the value 0xffff is reserved to identify the |
231 |
and since the value 0xffff is reserved to identify the |
|
|
| 376 |
m_packetUid (o.m_packetUid) |
384 |
m_packetUid (o.m_packetUid) |
| 377 |
{ |
385 |
{ |
| 378 |
NS_ASSERT (m_data != 0); |
386 |
NS_ASSERT (m_data != 0); |
|
|
387 |
NS_ASSERT (m_data->m_count < std::numeric_limits<uint32_t>::max()); |
| 379 |
m_data->m_count++; |
388 |
m_data->m_count++; |
| 380 |
} |
389 |
} |
| 381 |
PacketMetadata & |
390 |
PacketMetadata & |