automatically resized byte buffer
More...
#include <buffer.h>
List of all members.
Detailed Description
automatically resized byte buffer
This represents a buffer of bytes. Its size is automatically adjusted to hold any data prepended or appended by the user. Its implementation is optimized to ensure that the number of buffer resizes is minimized, by creating new Buffers of the maximum size ever used. The correct maximum size is learned at runtime during use by recording the maximum size of each packet.
Member Function Documentation
bool ns3::Buffer::AddAtEnd |
( |
uint32_t |
end |
) |
|
- Parameters:
-
- Returns:
- true if the buffer needed resizing, false otherwise.
Add bytes at the end of the Buffer. The content of these bytes is undefined but debugging builds initialize them to 0x33. Any call to this method invalidates any Iterator pointing to this Buffer.
void ns3::Buffer::AddAtEnd |
( |
const Buffer & |
o |
) |
|
- Parameters:
-
| o | the buffer to append to the end of this buffer. |
Add bytes at the end of the Buffer. Any call to this method invalidates any Iterator pointing to this Buffer.
bool ns3::Buffer::AddAtStart |
( |
uint32_t |
start |
) |
|
- Parameters:
-
- Returns:
- true if the buffer needed resizing, false otherwise.
Add bytes at the start of the Buffer. The content of these bytes is undefined but debugging builds initialize them to 0x33. Any call to this method invalidates any Iterator pointing to this Buffer.
void ns3::Buffer::CopyData |
( |
std::ostream * |
os, |
|
|
uint32_t |
size | |
|
) |
| | const |
Copy the specified amount of data from the buffer to the given output stream.
- Parameters:
-
| os | the output stream |
| size | the maximum amount of bytes to copy. If zero, nothing is copied. |
Buffer ns3::Buffer::CreateFragment |
( |
uint32_t |
start, |
|
|
uint32_t |
length | |
|
) |
| | const |
- Parameters:
-
| start | offset from start of packet |
| length | |
- Returns:
- a fragment of size length starting at offset start.
uint32_t ns3::Buffer::Deserialize |
( |
uint8_t * |
buffer, |
|
|
uint32_t |
size | |
|
) |
| | |
- Returns:
- zero if a complete buffer is not deserialized
- Parameters:
-
| buffer | points to buffer for deserialization |
| size | number of bytes to deserialize |
The raw character buffer is deserialized and all the data is placed into this buffer.
uint32_t ns3::Buffer::GetSerializedSize |
( |
void |
|
) |
const |
- Returns:
- the number of bytes required for serialization
uint32_t ns3::Buffer::GetSize |
( |
void |
|
) |
const [inline] |
- Returns:
- the number of bytes stored in this buffer.
uint8_t const* ns3::Buffer::PeekData |
( |
void |
|
) |
const |
- Returns:
- a pointer to the start of the internal byte buffer.
The returned pointer points to an area of memory which is ns3::Buffer::GetSize () bytes big. Please, try to never ever use this method. It is really evil and is present only for a few specific uses.
void ns3::Buffer::RemoveAtEnd |
( |
uint32_t |
end |
) |
|
- Parameters:
-
Remove bytes at the end of the Buffer. Any call to this method invalidates any Iterator pointing to this Buffer.
void ns3::Buffer::RemoveAtStart |
( |
uint32_t |
start |
) |
|
- Parameters:
-
Remove bytes at the start of the Buffer. Any call to this method invalidates any Iterator pointing to this Buffer.
uint32_t ns3::Buffer::Serialize |
( |
uint8_t * |
buffer, |
|
|
uint32_t |
maxSize | |
|
) |
| | const |
- Returns:
- zero if buffer not large enough
- Parameters:
-
| buffer | points to serialization buffer |
| maxSize | max number of bytes to write |
This buffer's contents are serialized into the raw character buffer parameter. Note: The zero length data is not copied entirely. Only the length of zero byte data is serialized.
The documentation for this class was generated from the following file: