|
Wireshark 4.7.0
The Wireshark network protocol analyzer
|
Go to the source code of this file.
Classes | |
| struct | wtap |
| struct | wtap_dumper |
| Wiretap dumper handle and associated state. More... | |
Macros | |
| #define | PBSWAP64(p) |
| Byte-swap an unaligned 64-bit quantity in place. | |
| #define | PBSWAP32(p) |
| Byte-swap an unaligned 32-bit quantity in place. | |
| #define | PBSWAP16(p) |
| Byte-swap an unaligned 16-bit quantity in place. | |
Typedefs | |
| typedef bool(* | subtype_read_func) (struct wtap *wtap, wtap_rec *rec, int *err, char **err_info, int64_t *offset) |
| Function pointer type for reading a record. | |
| typedef bool(* | subtype_seek_read_func) (struct wtap *wtap, int64_t seek_off, wtap_rec *rec, int *err, char **err_info) |
| Function pointer type for seeking and reading a record. | |
| typedef void * | WFILE_T |
| Abstract file handle for writing. | |
| typedef bool(* | subtype_add_idb_func) (struct wtap_dumper *dumper, wtap_block_t idb, int *err, char **err_info) |
| Function pointer type for adding an Interface Description Block (IDB). | |
| typedef bool(* | subtype_write_func) (struct wtap_dumper *dumper, const wtap_rec *rec, int *err, char **err_info) |
| Function pointer type for writing a record. | |
| typedef bool(* | subtype_finish_func) (struct wtap_dumper *dumper, int *err, char **err_info) |
| Function pointer type for finalizing a dump file. | |
Functions | |
| WS_DLL_PUBLIC int | wtap_fstat (wtap *wth, ws_statb64 *statb, int *err) |
| Retrieve file statistics for a wiretap handle. | |
| WS_DLL_PUBLIC bool | wtap_dump_file_write (wtap_dumper *wdh, const void *buf, size_t bufsize, int *err) |
| Write raw data to the dump file. | |
| WS_DLL_PUBLIC int64_t | wtap_dump_file_seek (wtap_dumper *wdh, int64_t offset, int whence, int *err) |
| Seek to a position in the dump file. | |
| WS_DLL_PUBLIC int64_t | wtap_dump_file_tell (wtap_dumper *wdh, int *err) |
| Get current position in the dump file. | |
| WS_DLL_PUBLIC bool | wtap_read_bytes_or_eof (FILE_T fh, void *buf, unsigned int count, int *err, char **err_info) |
| Read a specified number of bytes from a file or discard them. | |
| WS_DLL_PUBLIC bool | wtap_read_bytes_or_eof_buffer (FILE_T fh, Buffer *buf, unsigned int count, int *err, char **err_info) |
| Read a specified number of bytes into a Buffer, growing it as needed. | |
| WS_DLL_PUBLIC bool | wtap_read_bytes (FILE_T fh, void *buf, unsigned int count, int *err, char **err_info) |
| Read a specified number of bytes from a file or discard them. | |
| WS_DLL_PUBLIC bool | wtap_read_bytes_buffer (FILE_T fh, Buffer *buf, unsigned length, int *err, char **err_info) |
| Read a specified number of bytes into a Buffer, growing it as needed. | |
| bool | wtap_full_file_read (wtap *wth, wtap_rec *rec, int *err, char **err_info, int64_t *data_offset) |
| Read entire file contents as a single packet (sequential mode). | |
| bool | wtap_full_file_seek_read (wtap *wth, int64_t seek_off, wtap_rec *rec, int *err, char **err_info) |
| Read entire file contents as a single packet (seek mode). | |
| void | wtap_add_idb (wtap *wth, wtap_block_t idb) |
| Add an Interface Description Block (IDB) to a wiretap handle. | |
| void | wtap_add_dpib (wtap *wth, wtap_block_t dpib) |
| Add a DPIB to the dpibs list for a file. | |
| void | wtapng_process_nrb (wtap *wth, wtap_block_t nrb) |
| Invoke the registered callback with a Name Resolution Block (NRB). | |
| void | wtapng_process_dsb (wtap *wth, wtap_block_t dsb) |
| Invoke the registered callback with a Decryption Secrets Block (DSB). | |
| void | wtap_register_compatibility_file_subtype_name (const char *old_name, const char *new_name) |
| Register a compatibility alias for a file subtype name. | |
| void | wtap_register_backwards_compatibility_lua_name (const char *name, int ft) |
| Register a backwards compatibility Lua name for a file type. | |
| WS_DLL_PUBLIC void | wtap_add_generated_idb (wtap *wth) |
| Generate an IDB, given a wiretap handle for the file, using the file's encapsulation type, snapshot length, and time stamp resolution, and add it to the interface data for a file. | |
| wtap_block_t | wtap_rec_generate_idb (const wtap_rec *rec) |
| Generate an IDB, given a packet record, using the records's encapsulation type and time stamp resolution, and the default snap length for the encapsulation type. For use when a file has per-packet encapsulation, and the source is not passing along IDBs. | |
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
| #define PBSWAP16 | ( | p | ) |
Byte-swap an unaligned 16-bit quantity in place.
| p | Pointer to 2-byte array to swap. |
| #define PBSWAP32 | ( | p | ) |
Byte-swap an unaligned 32-bit quantity in place.
| p | Pointer to 4-byte array to swap. |
| #define PBSWAP64 | ( | p | ) |
Byte-swap an unaligned 64-bit quantity in place.
| p | Pointer to 8-byte array to swap. |
| typedef bool(* subtype_add_idb_func) (struct wtap_dumper *dumper, wtap_block_t idb, int *err, char **err_info) |
Function pointer type for adding an Interface Description Block (IDB).
| dumper | Wiretap dumper handle. |
| idb | Interface Description Block to add. |
| err | Optional error code output. |
| err_info | Optional error info string. |
| typedef bool(* subtype_finish_func) (struct wtap_dumper *dumper, int *err, char **err_info) |
Function pointer type for finalizing a dump file.
| dumper | Wiretap dumper handle. |
| err | Optional error code output. |
| err_info | Optional error info string. |
| typedef bool(* subtype_read_func) (struct wtap *wtap, wtap_rec *rec, int *err, char **err_info, int64_t *offset) |
Function pointer type for reading a record.
| wtap | Wiretap handle. |
| rec | Output record. |
| err | Optional error code output. |
| err_info | Optional error info string. |
| offset | Optional offset output. |
| typedef bool(* subtype_seek_read_func) (struct wtap *wtap, int64_t seek_off, wtap_rec *rec, int *err, char **err_info) |
Function pointer type for seeking and reading a record.
| wtap | Wiretap handle. |
| seek_off | Offset to seek to. |
| rec | Output record. |
| err | Optional error code output. |
| err_info | Optional error info string. |
| typedef bool(* subtype_write_func) (struct wtap_dumper *dumper, const wtap_rec *rec, int *err, char **err_info) |
Function pointer type for writing a record.
| dumper | Wiretap dumper handle. |
| rec | Record to write. |
| err | Optional error code output. |
| err_info | Optional error info string. |
| typedef void* WFILE_T |
Abstract file handle for writing.
May represent a FILE* or a handle for writing a compressed file.
| void wtap_add_dpib | ( | wtap * | wth, |
| wtap_block_t | dpib | ||
| ) |
Add a DPIB to the dpibs list for a file.
Used during parsing to register a Decryption Parameters Info Block (DPIB).
| wth | Wiretap handle. |
| dpib | DPIB block to add. |
| WS_DLL_PUBLIC void wtap_add_generated_idb | ( | wtap * | wth | ) |
Generate an IDB, given a wiretap handle for the file, using the file's encapsulation type, snapshot length, and time stamp resolution, and add it to the interface data for a file.
| wth | The wiretap handle for the file. |
| void wtap_add_idb | ( | wtap * | wth, |
| wtap_block_t | idb | ||
| ) |
Add an Interface Description Block (IDB) to a wiretap handle.
Used during file parsing to register interface metadata.
| wth | Wiretap handle. |
| idb | IDB block to add. |
| WS_DLL_PUBLIC int64_t wtap_dump_file_seek | ( | wtap_dumper * | wdh, |
| int64_t | offset, | ||
| int | whence, | ||
| int * | err | ||
| ) |
Seek to a position in the dump file.
| wdh | Wiretap dumper handle. |
| offset | Byte offset to seek to. |
| whence | Seek origin (e.g., SEEK_SET). |
| err | Optional error code output. |
| WS_DLL_PUBLIC int64_t wtap_dump_file_tell | ( | wtap_dumper * | wdh, |
| int * | err | ||
| ) |
Get current position in the dump file.
| wdh | Wiretap dumper handle. |
| err | Optional error code output. |
| WS_DLL_PUBLIC bool wtap_dump_file_write | ( | wtap_dumper * | wdh, |
| const void * | buf, | ||
| size_t | bufsize, | ||
| int * | err | ||
| ) |
Write raw data to the dump file.
| wdh | Wiretap dumper handle. |
| buf | Pointer to data buffer. |
| bufsize | Size of buffer in bytes. |
| err | Optional error code output. |
| WS_DLL_PUBLIC int wtap_fstat | ( | wtap * | wth, |
| ws_statb64 * | statb, | ||
| int * | err | ||
| ) |
Retrieve file statistics for a wiretap handle.
| wth | Wiretap handle. |
| statb | Pointer to stat structure to populate. |
| err | Optional error code output. |
| bool wtap_full_file_read | ( | wtap * | wth, |
| wtap_rec * | rec, | ||
| int * | err, | ||
| char ** | err_info, | ||
| int64_t * | data_offset | ||
| ) |
Read entire file contents as a single packet (sequential mode).
Used for formats that treat the whole file as one record.
| wth | Wiretap handle. |
| rec | Output record. |
| err | Output error code. |
| err_info | Optional error info string. |
| data_offset | Output offset of packet data. |
| bool wtap_full_file_seek_read | ( | wtap * | wth, |
| int64_t | seek_off, | ||
| wtap_rec * | rec, | ||
| int * | err, | ||
| char ** | err_info | ||
| ) |
Read entire file contents as a single packet (seek mode).
Used for formats that support random access to a single-record file.
| wth | Wiretap handle. |
| seek_off | Offset to seek to. |
| rec | Output record. |
| err | Output error code. |
| err_info | Optional error info string. |
| WS_DLL_PUBLIC bool wtap_read_bytes | ( | FILE_T | fh, |
| void * | buf, | ||
| unsigned int | count, | ||
| int * | err, | ||
| char ** | err_info | ||
| ) |
Read a specified number of bytes from a file or discard them.
| fh | File handle to read from. |
| buf | Destination buffer, or NULL to discard bytes. |
| count | Number of bytes to read. |
| err | Output error code (WTAP_ERR_SHORT_READ on short read or EOF). |
| err_info | Optional error info string on failure. |
| WS_DLL_PUBLIC bool wtap_read_bytes_buffer | ( | FILE_T | fh, |
| Buffer * | buf, | ||
| unsigned | length, | ||
| int * | err, | ||
| char ** | err_info | ||
| ) |
Read a specified number of bytes into a Buffer, growing it as needed.
| fh | File handle to read from. |
| buf | Buffer to receive data. |
| length | Number of bytes to read. |
| err | Output error code (WTAP_ERR_SHORT_READ on short read or EOF). |
| err_info | Optional error info string on failure. |
| WS_DLL_PUBLIC bool wtap_read_bytes_or_eof | ( | FILE_T | fh, |
| void * | buf, | ||
| unsigned int | count, | ||
| int * | err, | ||
| char ** | err_info | ||
| ) |
Read a specified number of bytes from a file or discard them.
| fh | File handle to read from. |
| buf | Destination buffer, or NULL to discard bytes. |
| count | Number of bytes to read. |
| err | Output error code (0 for EOF, WTAP_ERR_SHORT_READ for short read, or other on failure). |
| err_info | Optional error info string on failure. |
| WS_DLL_PUBLIC bool wtap_read_bytes_or_eof_buffer | ( | FILE_T | fh, |
| Buffer * | buf, | ||
| unsigned int | count, | ||
| int * | err, | ||
| char ** | err_info | ||
| ) |
Read a specified number of bytes into a Buffer, growing it as needed.
| fh | File handle to read from. |
| buf | Destination buffer, or NULL to discard bytes. |
| count | Number of bytes to read. |
| err | Output error code (0 for EOF, WTAP_ERR_SHORT_READ for short read, or other on failure). |
| err_info | Optional error info string on failure. |
| wtap_block_t wtap_rec_generate_idb | ( | const wtap_rec * | rec | ) |
Generate an IDB, given a packet record, using the records's encapsulation type and time stamp resolution, and the default snap length for the encapsulation type. For use when a file has per-packet encapsulation, and the source is not passing along IDBs.
| rec | The packet record. |
< packet
< time stamp
| void wtap_register_backwards_compatibility_lua_name | ( | const char * | name, |
| int | ft | ||
| ) |
Register a backwards compatibility Lua name for a file type.
Associates a legacy Lua-accessible name with a file type identifier.
| name | Legacy Lua name. |
| ft | File type identifier. |
| void wtap_register_compatibility_file_subtype_name | ( | const char * | old_name, |
| const char * | new_name | ||
| ) |
Register a compatibility alias for a file subtype name.
Used to map legacy subtype names to updated identifiers.
| old_name | Deprecated subtype name. |
| new_name | Canonical subtype name. |
| void wtapng_process_dsb | ( | wtap * | wth, |
| wtap_block_t | dsb | ||
| ) |
Invoke the registered callback with a Decryption Secrets Block (DSB).
Used to process DSBs during capture file parsing.
| wth | Wiretap handle. |
| dsb | DSB block to process. |
| void wtapng_process_nrb | ( | wtap * | wth, |
| wtap_block_t | nrb | ||
| ) |
Invoke the registered callback with a Name Resolution Block (NRB).
Used to process NRBs during capture file parsing.
| wth | Wiretap handle. |
| nrb | NRB block to process. |