Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Functions
util.h File Reference
#include <stdint.h>

Go to the source code of this file.

Functions

char * get_args_as_string (int argc, char **argv, int optindex)
 Concatenate command-line arguments into a single space-separated string.
 
void compute_timestamp_diff (int *diffsec, int *diffusec, uint32_t sec1, uint32_t usec1, uint32_t sec2, uint32_t usec2)
 Compute the difference between two seconds/microseconds timestamps.
 
const char * get_conn_cfilter (void)
 Build a capture filter string matching the current remote connection.
 
bool display_is_remote (void)
 Determine whether the current session is remote.
 
const char * get_last_open_dir (void)
 Return the most recently used file-open directory.
 
void set_last_open_dir (const char *dirname)
 Set the most recently used file-open directory.
 
const char * get_open_dialog_initial_dir (void)
 Return the initial directory to present in file-open dialogs.
 

Detailed Description

Utility definitions

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

◆ compute_timestamp_diff()

void compute_timestamp_diff ( int *  diffsec,
int *  diffusec,
uint32_t  sec1,
uint32_t  usec1,
uint32_t  sec2,
uint32_t  usec2 
)

Compute the difference between two seconds/microseconds timestamps.

Parameters
diffsecReceives the seconds component of the difference.
diffusecReceives the microseconds component of the difference.
sec1Seconds of the first (later) timestamp.
usec1Microseconds of the first (later) timestamp.
sec2Seconds of the second (earlier) timestamp.
usec2Microseconds of the second (earlier) timestamp.

◆ display_is_remote()

bool display_is_remote ( void  )

Determine whether the current session is remote.

Returns
true if a remote connection is detected (see get_conn_cfilter()), false if the session is local.

◆ get_args_as_string()

char * get_args_as_string ( int  argc,
char **  argv,
int  optindex 
)

Concatenate command-line arguments into a single space-separated string.

Parameters
argcThe total argument count (as passed to main()).
argvThe argument vector (as passed to main()).
optindexIndex of the first argument to include; typically the value of optind after option parsing is complete.
Returns
A newly allocated string containing the joined arguments, or NULL if no arguments remain.

◆ get_conn_cfilter()

const char * get_conn_cfilter ( void  )

Build a capture filter string matching the current remote connection.

  • SSH_CONNECTION (ssh): <remote IP> <remote port> <local IP> <local port>
  • SSH_CLIENT (ssh): <remote IP> <remote port> <local port>
  • REMOTEHOST (tcsh, others): <remote name>
  • DISPLAY (X11): [<remote name>]:<display num>
  • CLIENTNAME (Terminal Server): <remote name>
Returns
A capture filter string for the detected connection, or NULL if no remote session is detected.

◆ get_last_open_dir()

const char * get_last_open_dir ( void  )
extern

Return the most recently used file-open directory.

Returns
The path of the last directory in which a file was opened, or NULL if no file has been opened yet.

Get the latest opened directory.

Returns
the dirname

◆ get_open_dialog_initial_dir()

const char * get_open_dialog_initial_dir ( void  )
extern

Return the initial directory to present in file-open dialogs.

Returns
The initial directory path for file-open dialogs.

◆ set_last_open_dir()

void set_last_open_dir ( const char *  dirname)
extern

Set the most recently used file-open directory.

Parameters
dirnameThe directory path to record as the last opened.