|
Wireshark 4.7.0
The Wireshark network protocol analyzer
|
#include <inttypes.h>#include <stddef.h>#include "ws_symbol_export.h"Go to the source code of this file.
Classes | |
| struct | Buffer |
| A dynamic byte buffer with adjustable start and end positions. More... | |
Macros | |
| #define | SOME_FUNCTIONS_ARE_INLINE |
| #define | DEFAULT_INIT_BUFFER_SIZE_2048 (2 * 1024) /* Everyone still uses 1500 byte frames, right? */ |
Typedefs | |
| typedef struct Buffer | Buffer |
| A dynamic byte buffer with adjustable start and end positions. | |
Functions | |
| WS_DLL_PUBLIC void | ws_buffer_init (Buffer *buffer, size_t space) |
| Initializes a Buffer with the specified initial capacity. | |
| WS_DLL_PUBLIC void | ws_buffer_free (Buffer *buffer) |
| Frees the memory associated with a Buffer. | |
| WS_DLL_PUBLIC void | ws_buffer_assure_space (Buffer *buffer, size_t space) |
| Ensures the buffer has enough space for additional data. | |
| WS_DLL_PUBLIC void | ws_buffer_append (Buffer *buffer, const uint8_t *from, size_t bytes) |
| Appends data to the end of the buffer. | |
| WS_DLL_PUBLIC void | ws_buffer_remove_start (Buffer *buffer, size_t bytes) |
| Removes bytes from the beginning of the buffer. | |
| WS_DLL_PUBLIC void | ws_buffer_cleanup (void) |
| Cleans up internal buffer state across all active buffers. | |
Wiretap Library Copyright (c) 1998 by Gilbert Ramirez gram@.nosp@m.alum.nosp@m.ni.ri.nosp@m.ce.e.nosp@m.du
SPDX-License-Identifier: GPL-2.0-or-later
A dynamic byte buffer with adjustable start and end positions.
This structure supports efficient appending and trimming of data, making it suitable for streaming or incremental parsing scenarios.
| WS_DLL_PUBLIC void ws_buffer_append | ( | Buffer * | buffer, |
| const uint8_t * | from, | ||
| size_t | bytes | ||
| ) |
Appends data to the end of the buffer.
Copies bytes from from into the buffer starting at first_free, expanding the buffer if needed.
| buffer | Pointer to the Buffer structure. |
| from | Pointer to the source data. |
| bytes | Number of bytes to append. |
| WS_DLL_PUBLIC void ws_buffer_assure_space | ( | Buffer * | buffer, |
| size_t | space | ||
| ) |
Ensures the buffer has enough space for additional data.
Expands the buffer if necessary to accommodate space bytes beyond first_free.
| buffer | Pointer to the Buffer structure. |
| space | Number of additional bytes required. |
| WS_DLL_PUBLIC void ws_buffer_cleanup | ( | void | ) |
Cleans up internal buffer state across all active buffers.
Performs global cleanup tasks, such as releasing shared resources or resetting internal buffer tracking. Typically called during shutdown.
| WS_DLL_PUBLIC void ws_buffer_free | ( | Buffer * | buffer | ) |
| WS_DLL_PUBLIC void ws_buffer_init | ( | Buffer * | buffer, |
| size_t | space | ||
| ) |
| WS_DLL_PUBLIC void ws_buffer_remove_start | ( | Buffer * | buffer, |
| size_t | bytes | ||
| ) |
Removes bytes from the beginning of the buffer.
Advances the start pointer by bytes, effectively discarding that portion. Does not shrink the allocated memory.
| buffer | Pointer to the Buffer structure. |
| bytes | Number of bytes to remove from the start. |
ws_error() does an abort() and thus never returns