Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Public Slots | Signals | Public Member Functions | Static Public Member Functions | List of all members
CaptureFile Class Reference

Manages a capture file and its associated state and operations. More...

#include <capture_file.h>

Inheritance diagram for CaptureFile:

Public Slots

void retapPackets ()
 Retap the capture file. Convenience wrapper for cf_retap_packets. Application events are processed periodically via update_progress_dlg.
 
void delayedRetapPackets ()
 Retap the capture file after the current batch of application events is processed. If you call this instead of retapPackets or cf_retap_packets in a dialog's constructor it will be displayed before tapping starts.
 
void stopLoading ()
 Cancel any tapping that might be in progress.
 
void setCaptureStopFlag (bool stop_flag=true)
 Sets the capture file's "stop_flag" member.
 

Signals

void captureEvent (CaptureEvent event)
 Signal emitted when a capture-related event occurs.
 

Public Member Functions

 CaptureFile (QObject *parent=0, capture_file *cap_file=NULL)
 Constructs a new CaptureFile object.
 
 ~CaptureFile ()
 Destroys the CaptureFile.
 
capture_filecapFile () const
 Retrieves the underlying capture_file pointer if valid.
 
void setCapFile (capture_file *cap_file)
 Sets the underlying capture_file pointer.
 
bool isValid () const
 Check capture file validity.
 
const QString filePath ()
 Return the full pathname.
 
const QString fileName ()
 Return the plain filename.
 
const QString fileBaseName ()
 Return the plain filename without an extension.
 
const QString fileDisplayName ()
 Return a string representing the file suitable for use for display in the UI in places such as a main window title.
 
const QString fileTitle ()
 Return a string representing the file suitable for use in an auxiliary window title.
 
struct _packet_infopacketInfo ()
 Return the current packet information.
 
int timestampPrecision ()
 Timestamp precision for the current file.
 
void reload ()
 Reload the capture file.
 
QString displayFilter () const
 Return any set display filter.
 
void * window ()
 Retrieves the main window associated with this capture file.
 

Static Public Member Functions

static capture_fileglobalCapFile ()
 Retrieves the global capture_file instance.
 

Detailed Description

Manages a capture file and its associated state and operations.

This class serves as a Qt-friendly wrapper around the underlying core capture_file struct, handling file validity, paths, events, and tapping operations.

Constructor & Destructor Documentation

◆ CaptureFile()

CaptureFile::CaptureFile ( QObject *  parent = 0,
capture_file cap_file = NULL 
)
explicit

Constructs a new CaptureFile object.

Parameters
parentThe parent QObject, defaults to 0.
cap_filePointer to the underlying capture_file structure, defaults to NULL.

Member Function Documentation

◆ capFile()

capture_file * CaptureFile::capFile ( ) const
inline

Retrieves the underlying capture_file pointer if valid.

Returns
Pointer to the capture_file, or NULL if invalid.

◆ captureEvent

void CaptureFile::captureEvent ( CaptureEvent  event)
signal

Signal emitted when a capture-related event occurs.

Parameters
eventThe capture event details.

◆ displayFilter()

QString CaptureFile::displayFilter ( ) const

Return any set display filter.

Returns
The current display filter string.

◆ fileBaseName()

const QString CaptureFile::fileBaseName ( )

Return the plain filename without an extension.

Returns
The last component of the pathname, without the extension, converted from the native OS's encoding to Unicode if necessary, or a null string if the conversion can't be done.

◆ fileDisplayName()

const QString CaptureFile::fileDisplayName ( )

Return a string representing the file suitable for use for display in the UI in places such as a main window title.

Returns
One of:

the devices on which the capture was done, if the file is a temporary file for a capture;

the last component of the capture file's name, converted from the native OS's encoding to Unicode if necessary (and with REPLACEMENT CHARACTER inserted if the string can't be converted).

a null string, if there is no capture file.

◆ fileName()

const QString CaptureFile::fileName ( )

Return the plain filename.

Returns
The last component of the pathname, including the extension, converted from the native OS's encoding to Unicode if necessary, or a null string if the conversion can't be done.

◆ filePath()

const QString CaptureFile::filePath ( )

Return the full pathname.

Returns
The entire pathname, converted from the native OS's encoding to Unicode if necessary, or a null string if the conversion can't be done.

◆ fileTitle()

const QString CaptureFile::fileTitle ( )

Return a string representing the file suitable for use in an auxiliary window title.

Returns
One of:

the result of fileDisplayName(), if the file is open;

the result of fileDisplayName() followed by [closing], if the file is being closed;

the result of fileDisplayName() followed by [closed], if the file has been closed;

[no capture file], if there is no capture file.

◆ globalCapFile()

capture_file * CaptureFile::globalCapFile ( )
static

Retrieves the global capture_file instance.

Returns
Pointer to the global capture_file.

◆ isValid()

bool CaptureFile::isValid ( ) const

Check capture file validity.

Returns
true if the file is open, readable, and tappable. false if the file is closed.

◆ packetInfo()

struct _packet_info * CaptureFile::packetInfo ( )

Return the current packet information.

Returns
A pointer to the current packet_info struct or NULL.

◆ setCapFile()

void CaptureFile::setCapFile ( capture_file cap_file)
inline

Sets the underlying capture_file pointer.

Parameters
cap_fileThe new capture_file pointer.

◆ setCaptureStopFlag

void CaptureFile::setCaptureStopFlag ( bool  stop_flag = true)
slot

Sets the capture file's "stop_flag" member.

Parameters
stop_flagIf true, stops the current capture file operation.

◆ timestampPrecision()

int CaptureFile::timestampPrecision ( )

Timestamp precision for the current file.

Returns
One of the WTAP_TSPREC_x values defined in wiretap/wtap.h, or WTAP_TSPREC_UNKNOWN if no file is open.

◆ window()

void * CaptureFile::window ( )

Retrieves the main window associated with this capture file.

Returns
Pointer to the window.

The documentation for this class was generated from the following files: