Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Macros | Functions
/builds/wireshark/wireshark/ringbuffer.h File Reference
#include <wireshark.h>
#include <writecap/pcapio.h>

Go to the source code of this file.

Macros

#define RINGBUFFER_UNLIMITED_FILES   0
 
#define RINGBUFFER_MIN_NUM_FILES   0
 
#define RINGBUFFER_MAX_NUM_FILES   100000
 
#define RINGBUFFER_WARN_NUM_FILES   65535
 

Functions

int ringbuf_init (const char *capture_name, unsigned num_files, bool group_read_access, const char *compress_type, bool nametimenum)
 Initialize the ringbuffer system.
 
bool ringbuf_is_initialized (void)
 Check if the ringbuffer system is initialized.
 
const char * ringbuf_current_filename (void)
 Get the current filename used by the ringbuffer.
 
ws_cwstreamringbuf_init_libpcap_fdopen (int *err)
 Initialize a libpcap dump file for the ringbuffer. Initializes a libpcap dump file for writing captured packets to the ringbuffer.
 
bool ringbuf_switch_file (ws_cwstream **pdh, char **save_file, int *save_file_fd, int *err)
 Switch the ringbuffer dump file.
 
bool ringbuf_libpcap_dump_close (char **save_file, int *err)
 Close the ringbuffer dump file.
 
void ringbuf_free (void)
 Frees all memory allocated by the ringbuffer.
 
void ringbuf_error_cleanup (void)
 Clean up any errors related to the ringbuffer system.
 
bool ringbuf_set_print_name (char *name, int *err)
 Set the name for the ringbuffer.
 

Detailed Description

Definitions for capture ringbuffer files

Wireshark - Network traffic analyzer By Gerald Combs geral.nosp@m.d@wi.nosp@m.resha.nosp@m.rk.o.nosp@m.rg Copyright 1998 Gerald Combs

SPDX-License-Identifier: GPL-2.0-or-later

Function Documentation

◆ ringbuf_current_filename()

const char * ringbuf_current_filename ( void  )

Get the current filename used by the ringbuffer.

Returns
The current filename used by the ringbuffer.

◆ ringbuf_error_cleanup()

void ringbuf_error_cleanup ( void  )

Clean up any errors related to the ringbuffer system.

Frees all memory allocated by the ringbuffer and closes any open files.

◆ ringbuf_free()

void ringbuf_free ( void  )

Frees all memory allocated by the ringbuffer.

Cleans up and frees all resources used by the ringbuffer system.

◆ ringbuf_init()

int ringbuf_init ( const char *  capture_name,
unsigned  num_files,
bool  group_read_access,
const char *  compress_type,
bool  nametimenum 
)

Initialize the ringbuffer system.

Initializes the ringbuffer system with the specified parameters.

Parameters
capture_nameThe name of the capture file.
num_filesThe number of files in the ringbuffer.
group_read_accessWhether to set group read access for the files.
compress_typeThe compression type for the files.
nametimenumWhether to include name, time, and number in the filenames.
Returns
file descriptor on success, -1 on failure.

◆ ringbuf_init_libpcap_fdopen()

ws_cwstream * ringbuf_init_libpcap_fdopen ( int *  err)

Initialize a libpcap dump file for the ringbuffer. Initializes a libpcap dump file for writing captured packets to the ringbuffer.

Parameters
errPointer to an integer that will be set to an error code if an error occurs.
Returns
A pointer to a ws_cwstream on success, or NULL on failure.

◆ ringbuf_is_initialized()

bool ringbuf_is_initialized ( void  )

Check if the ringbuffer system is initialized.

Determines whether the ringbuffer system has been initialized.

Returns
true if the ringbuffer system is initialized, false otherwise.

◆ ringbuf_libpcap_dump_close()

bool ringbuf_libpcap_dump_close ( char **  save_file,
int *  err 
)

Close the ringbuffer dump file.

Closes the current ringbuffer dump file and cleans up resources.

Parameters
save_filePointer to a string that will be set to the name of the saved file.
errPointer to an integer that will be set to an error code if an error occurs.
Returns
true on success, false otherwise.

◆ ringbuf_set_print_name()

bool ringbuf_set_print_name ( char *  name,
int *  err 
)

Set the name for the ringbuffer.

Sets the name of the file to which the ringbuffer will write data.

Parameters
namePointer to a string that will be set to the name of the capture file.
errPointer to an integer that will be set to an error code if an error occurs.
Returns
true on success, false otherwise.

◆ ringbuf_switch_file()

bool ringbuf_switch_file ( ws_cwstream **  pdh,
char **  save_file,
int *  save_file_fd,
int *  err 
)

Switch the ringbuffer dump file.

Parameters
pdhPointer to the current pcap dump handle, which will be updated to the new handle.
save_filePointer to a string that will be set to the name of the saved file.
save_file_fdPointer to an integer that will be set to the file descriptor of the saved file.
errPointer to an integer that will be set to an error code if an error occurs.
Returns
true on success, false otherwise.