Wireshark 4.5.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Functions | Variables
wtap-int.h File Reference
#include "wtap.h"
#include <time.h>
#include <wsutil/array.h>
#include <wsutil/file_util.h>
#include "wtap_opttypes.h"
#include <wsutil/pint.h>

Go to the source code of this file.

Classes

struct  wtap
 
struct  wtap_dumper
 
struct  backwards_compatibiliity_lua_name
 

Macros

#define PBSWAP64(p)
 
#define PBSWAP32(p)
 
#define PBSWAP16(p)
 
#define phtons(p, v)
 
#define phton24(p, v)
 
#define phtonl(p, v)
 
#define phtonll(p, v)
 
#define phtole8(p, v)
 
#define phtoles(p, v)
 
#define phtole24(p, v)
 
#define phtolel(p, v)
 
#define phtolell(p, v)
 

Typedefs

typedef bool(* subtype_read_func) (struct wtap *, wtap_rec *, Buffer *, int *, char **, int64_t *)
 
typedef bool(* subtype_seek_read_func) (struct wtap *, int64_t, wtap_rec *, Buffer *, int *, char **)
 
typedef void * WFILE_T
 
typedef bool(* subtype_add_idb_func) (struct wtap_dumper *, wtap_block_t, int *, char **)
 
typedef bool(* subtype_write_func) (struct wtap_dumper *, const wtap_rec *rec, const uint8_t *, int *, char **)
 
typedef bool(* subtype_finish_func) (struct wtap_dumper *, int *, char **)
 

Functions

void wtap_init_file_type_subtypes (void)
 
WS_DLL_PUBLIC int wtap_fstat (wtap *wth, ws_statb64 *statb, int *err)
 
WS_DLL_PUBLIC bool wtap_dump_file_write (wtap_dumper *wdh, const void *buf, size_t bufsize, int *err)
 
WS_DLL_PUBLIC int64_t wtap_dump_file_seek (wtap_dumper *wdh, int64_t offset, int whence, int *err)
 
WS_DLL_PUBLIC int64_t wtap_dump_file_tell (wtap_dumper *wdh, int *err)
 
WS_DLL_PUBLIC bool wtap_read_bytes_or_eof (FILE_T fh, void *buf, unsigned int count, int *err, char **err_info)
 
WS_DLL_PUBLIC bool wtap_read_bytes (FILE_T fh, void *buf, unsigned int count, int *err, char **err_info)
 
WS_DLL_PUBLIC bool wtap_read_packet_bytes (FILE_T fh, Buffer *buf, unsigned length, int *err, char **err_info)
 
bool wtap_full_file_read (wtap *wth, wtap_rec *rec, Buffer *buf, int *err, char **err_info, int64_t *data_offset)
 
bool wtap_full_file_seek_read (wtap *wth, int64_t seek_off, wtap_rec *rec, Buffer *buf, int *err, char **err_info)
 
void wtap_add_idb (wtap *wth, wtap_block_t idb)
 
void wtapng_process_nrb (wtap *wth, wtap_block_t nrb)
 
void wtapng_process_dsb (wtap *wth, wtap_block_t dsb)
 
void wtap_register_compatibility_file_subtype_name (const char *old_name, const char *new_name)
 
void wtap_register_backwards_compatibility_lua_name (const char *name, int ft)
 
WS_DLL_PUBLIC const GArray * get_backwards_compatibility_lua_table (void)
 
GArray * wtap_file_get_shb_for_new_file (wtap *wth)
 Gets new section header block for new file, based on existing info.
 
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_dump_params_generate_idb (const wtap_dump_params *params)
 Generate an IDB, given a set of dump parameters, using the parameters' encapsulation type, snapshot length, and time stamp resolution. For use when a dump file has a given encapsulation type, and the source is not passing IDBs.
 
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.
 
GArray * wtap_file_get_nrb_for_new_file (wtap *wth)
 Gets new name resolution info for new file, based on existing info.
 

Variables

int wtap_num_file_types
 

Detailed Description

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

Macro Definition Documentation

◆ PBSWAP16

#define PBSWAP16 (   p)
Value:
{ \
uint8_t tmp; \
tmp = (p)[1]; \
(p)[1] = (p)[0]; \
(p)[0] = tmp; \
}

◆ PBSWAP32

#define PBSWAP32 (   p)
Value:
{ \
uint8_t tmp; \
tmp = (p)[3]; \
(p)[3] = (p)[0]; \
(p)[0] = tmp; \
tmp = (p)[2]; \
(p)[2] = (p)[1]; \
(p)[1] = tmp; \
}

◆ PBSWAP64

#define PBSWAP64 (   p)
Value:
{ \
uint8_t tmp; \
tmp = (p)[7]; \
(p)[7] = (p)[0]; \
(p)[0] = tmp; \
tmp = (p)[6]; \
(p)[6] = (p)[1]; \
(p)[1] = tmp; \
tmp = (p)[5]; \
(p)[5] = (p)[2]; \
(p)[2] = tmp; \
tmp = (p)[4]; \
(p)[4] = (p)[3]; \
(p)[3] = tmp; \
}

◆ phtole24

#define phtole24 (   p,
 
)
Value:
{ \
(p)[0] = (uint8_t)((v) >> 0); \
(p)[1] = (uint8_t)((v) >> 8); \
(p)[2] = (uint8_t)((v) >> 16); \
}

◆ phtole8

#define phtole8 (   p,
 
)
Value:
{ \
(p)[0] = (uint8_t)((v) >> 0); \
}

◆ phtolel

#define phtolel (   p,
 
)
Value:
{ \
(p)[0] = (uint8_t)((v) >> 0); \
(p)[1] = (uint8_t)((v) >> 8); \
(p)[2] = (uint8_t)((v) >> 16); \
(p)[3] = (uint8_t)((v) >> 24); \
}

◆ phtolell

#define phtolell (   p,
 
)
Value:
{ \
(p)[0] = (uint8_t)((v) >> 0); \
(p)[1] = (uint8_t)((v) >> 8); \
(p)[2] = (uint8_t)((v) >> 16); \
(p)[3] = (uint8_t)((v) >> 24); \
(p)[4] = (uint8_t)((v) >> 32); \
(p)[5] = (uint8_t)((v) >> 40); \
(p)[6] = (uint8_t)((v) >> 48); \
(p)[7] = (uint8_t)((v) >> 56); \
}

◆ phtoles

#define phtoles (   p,
 
)
Value:
{ \
(p)[0] = (uint8_t)((v) >> 0); \
(p)[1] = (uint8_t)((v) >> 8); \
}

◆ phton24

#define phton24 (   p,
 
)
Value:
{ \
(p)[0] = (uint8_t)((v) >> 16); \
(p)[1] = (uint8_t)((v) >> 8); \
(p)[2] = (uint8_t)((v) >> 0); \
}

◆ phtonl

#define phtonl (   p,
 
)
Value:
{ \
(p)[0] = (uint8_t)((v) >> 24); \
(p)[1] = (uint8_t)((v) >> 16); \
(p)[2] = (uint8_t)((v) >> 8); \
(p)[3] = (uint8_t)((v) >> 0); \
}

◆ phtonll

#define phtonll (   p,
 
)
Value:
{ \
(p)[0] = (uint8_t)((v) >> 56); \
(p)[1] = (uint8_t)((v) >> 48); \
(p)[2] = (uint8_t)((v) >> 40); \
(p)[3] = (uint8_t)((v) >> 32); \
(p)[4] = (uint8_t)((v) >> 24); \
(p)[5] = (uint8_t)((v) >> 16); \
(p)[6] = (uint8_t)((v) >> 8); \
(p)[7] = (uint8_t)((v) >> 0); \
}

◆ phtons

#define phtons (   p,
 
)
Value:
{ \
(p)[0] = (uint8_t)((v) >> 8); \
(p)[1] = (uint8_t)((v) >> 0); \
}

Function Documentation

◆ wtap_add_generated_idb()

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.

Note
This requires that the encapsulation type and time stamp resolution not be per-packet; it will terminate the process if either of them are.
Parameters
wthThe wiretap handle for the file.

◆ wtap_add_idb()

void wtap_add_idb ( wtap wth,
wtap_block_t  idb 
)

Add an IDB to the interface data for a file.

◆ wtap_dump_params_generate_idb()

wtap_block_t wtap_dump_params_generate_idb ( const wtap_dump_params params)

Generate an IDB, given a set of dump parameters, using the parameters' encapsulation type, snapshot length, and time stamp resolution. For use when a dump file has a given encapsulation type, and the source is not passing IDBs.

Note
This requires that the encapsulation type and time stamp resolution not be per-packet; it will terminate the process if either of them are.
Parameters
paramsThe wtap dump parameters.

◆ wtap_file_get_nrb_for_new_file()

GArray * wtap_file_get_nrb_for_new_file ( wtap wth)

Gets new name resolution info for new file, based on existing info.

Creates a new wtap_block_t of name resolution info and only copies appropriate members for a new file.

Note
Use wtap_free_nrb() to free the returned pointer.
Parameters
wthThe wiretap session.
Returns
The new name resolution info, which must be freed.

◆ wtap_file_get_shb_for_new_file()

GArray * wtap_file_get_shb_for_new_file ( wtap wth)

Gets new section header block for new file, based on existing info.

Creates a new wtap_block_t section header block and only copies appropriate members of the SHB for a new file. In particular, the comment string is copied, and any custom options which should be copied are copied. The os, hardware, and application strings are not copied.

Note
Use wtap_free_shb() to free the returned section header.
Parameters
wthThe wiretap session.
Returns
The new section header, which must be wtap_free_shb'd.

◆ wtap_rec_generate_idb()

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.

Note
This requires that the record type be REC_TYPE_PACKET, and the encapsulation type and time stamp resolution not be per-packet; it will terminate the process if any of them are.
Parameters
recThe packet record.

◆ wtapng_process_dsb()

void wtapng_process_dsb ( wtap wth,
wtap_block_t  dsb 
)

Invokes the callback with the given decryption secrets block.

◆ wtapng_process_nrb()

void wtapng_process_nrb ( wtap wth,
wtap_block_t  nrb 
)

Invokes the callback with the given name resolution block.