Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Macros | Functions
clopts_common.h File Reference
#include <wireshark.h>

Go to the source code of this file.

Macros

#define LONGOPT_BASE_CAPTURE   1000
 
#define LONGOPT_BASE_DISSECTOR   2000
 
#define LONGOPT_BASE_APPLICATION   3000
 
#define LONGOPT_BASE_GUI   4000
 
#define LONGOPT_BASE_WSLOG   5000
 
#define LONGOPT_READ_CAPTURE_COMMON    {"read-file", ws_required_argument, NULL, 'r' }, \
 
#define OPTSTRING_READ_CAPTURE_COMMON    "r:"
 

Functions

WS_DLL_PUBLIC bool get_natural_int (const char *string, const char *name, int32_t *number)
 Parses a string as a natural (non-negative) 32-bit integer.
 
WS_DLL_PUBLIC bool get_positive_int (const char *string, const char *name, int32_t *number)
 Parses a string as a strictly positive 32-bit integer.
 
WS_DLL_PUBLIC bool get_natural_int64 (const char *string, const char *name, int64_t *number)
 Parses a string as a natural (non-negative) 64-bit integer.
 
WS_DLL_PUBLIC bool get_positive_int64 (const char *string, const char *name, int64_t *number)
 Parses a string as a strictly positive 64-bit integer.
 
WS_DLL_PUBLIC bool get_uint32 (const char *string, const char *name, uint32_t *number)
 Parses a string as an unsigned 32-bit integer.
 
WS_DLL_PUBLIC bool get_nonzero_uint32 (const char *string, const char *name, uint32_t *number)
 Parses a string as a non-zero unsigned 32-bit integer.
 
WS_DLL_PUBLIC bool get_uint64 (const char *string, const char *name, uint64_t *number)
 Parses a string as an unsigned 64-bit integer.
 
WS_DLL_PUBLIC bool get_nonzero_uint64 (const char *string, const char *name, uint64_t *number)
 Parses a string as a non-zero unsigned 64-bit integer.
 
WS_DLL_PUBLIC bool get_positive_double (const char *string, const char *name, double *number)
 Parses a string as a strictly positive double-precision floating-point number.
 

Detailed Description

Handle command-line arguments common to various programs

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

◆ get_natural_int()

WS_DLL_PUBLIC bool get_natural_int ( const char *  string,
const char *  name,
int32_t *  number 
)

Parses a string as a natural (non-negative) 32-bit integer.

Attempts to convert the input string to an int32_t value ≥ 0. If successful, stores the result in number and returns true.

Parameters
stringThe input string to parse.
nameContextual name used for error reporting.
numberPointer to receive the parsed value.
Returns
true if parsing succeeds and value is ≥ 0, false otherwise.

◆ get_natural_int64()

WS_DLL_PUBLIC bool get_natural_int64 ( const char *  string,
const char *  name,
int64_t *  number 
)

Parses a string as a natural (non-negative) 64-bit integer.

Attempts to convert the input string to an int64_t value ≥ 0. If successful, stores the result in number and returns true.

Parameters
stringThe input string to parse.
nameContextual name used for error reporting.
numberPointer to receive the parsed value.
Returns
true if parsing succeeds and value is ≥ 0, false otherwise.

◆ get_nonzero_uint32()

WS_DLL_PUBLIC bool get_nonzero_uint32 ( const char *  string,
const char *  name,
uint32_t *  number 
)

Parses a string as a non-zero unsigned 32-bit integer.

Attempts to convert the input string to a uint32_t value. If successful and the value is not zero, stores the result in number and returns true. Returns false if the string is invalid or the parsed value is zero.

Parameters
stringThe input string to parse.
nameContextual name used for error reporting.
numberPointer to receive the parsed value.
Returns
true if parsing succeeds and value is > 0, false otherwise.

◆ get_nonzero_uint64()

WS_DLL_PUBLIC bool get_nonzero_uint64 ( const char *  string,
const char *  name,
uint64_t *  number 
)

Parses a string as a non-zero unsigned 64-bit integer.

Attempts to convert the input string to a uint64_t value. If successful and the value is not zero, stores the result in number and returns true.

Parameters
stringThe input string to parse.
nameContextual name used for error reporting.
numberPointer to receive the parsed value.
Returns
true if parsing succeeds and value is > 0, false otherwise.

◆ get_positive_double()

WS_DLL_PUBLIC bool get_positive_double ( const char *  string,
const char *  name,
double *  number 
)

Parses a string as a strictly positive double-precision floating-point number.

Attempts to convert the input string to a double value. If successful and the value is greater than zero, stores the result in number and returns true.

Parameters
stringThe input string to parse.
nameContextual name used for error reporting.
numberPointer to receive the parsed value.
Returns
true if parsing succeeds and value is > 0.0, false otherwise.

◆ get_positive_int()

WS_DLL_PUBLIC bool get_positive_int ( const char *  string,
const char *  name,
int32_t *  number 
)

Parses a string as a strictly positive 32-bit integer.

Attempts to convert the input string to an int32_t value > 0. If successful, stores the result in number and returns true.

Parameters
stringThe input string to parse.
nameContextual name used for error reporting.
numberPointer to receive the parsed value.
Returns
true if parsing succeeds and value is > 0, false otherwise.

◆ get_positive_int64()

WS_DLL_PUBLIC bool get_positive_int64 ( const char *  string,
const char *  name,
int64_t *  number 
)

Parses a string as a strictly positive 64-bit integer.

Attempts to convert the input string to an int64_t value > 0. If successful, stores the result in number and returns true.

Parameters
stringThe input string to parse.
nameContextual name used for error reporting.
numberPointer to receive the parsed value.
Returns
true if parsing succeeds and value is > 0, false otherwise.

◆ get_uint32()

WS_DLL_PUBLIC bool get_uint32 ( const char *  string,
const char *  name,
uint32_t *  number 
)

Parses a string as an unsigned 32-bit integer.

Attempts to convert the input string to a uint32_t value. If successful, stores the result in number and returns true.

Parameters
stringThe input string to parse.
nameContextual name used for error reporting.
numberPointer to receive the parsed value.
Returns
true if parsing succeeds, false otherwise.

◆ get_uint64()

WS_DLL_PUBLIC bool get_uint64 ( const char *  string,
const char *  name,
uint64_t *  number 
)

Parses a string as an unsigned 64-bit integer.

Attempts to convert the input string to a uint64_t value. If successful, stores the result in number and returns true.

Parameters
stringThe input string to parse.
nameContextual name used for error reporting.
numberPointer to receive the parsed value.
Returns
true if parsing succeeds, false otherwise.