Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
clopts_common.h
Go to the documentation of this file.
1
12#ifndef __CLOPTS_COMMON_H__
13#define __CLOPTS_COMMON_H__
14
15#include <wireshark.h>
16
17#ifdef __cplusplus
18extern "C" {
19#endif /* __cplusplus */
20
21/*
22 * Long options.
23 * For long options with no corresponding short options, we define values
24 * outside the range of ASCII graphic characters, make that the last
25 * component of the entry for the long option, and have a case for that
26 * option in the switch statement.
27 */
28// Base value for capture related long options
29#define LONGOPT_BASE_CAPTURE 1000
30// Base value for dissector related long options
31#define LONGOPT_BASE_DISSECTOR 2000
32// Base value for application specific long options
33#define LONGOPT_BASE_APPLICATION 3000
34// Base value for GUI specific long options
35#define LONGOPT_BASE_GUI 4000
36// Base value for logging related long options
37#define LONGOPT_BASE_WSLOG 5000
38
39#define LONGOPT_READ_CAPTURE_COMMON \
40 {"read-file", ws_required_argument, NULL, 'r' }, \
41
42#define OPTSTRING_READ_CAPTURE_COMMON \
43 "r:"
44
56WS_DLL_PUBLIC bool
57get_natural_int(const char *string, const char *name, int32_t* number);
58
70WS_DLL_PUBLIC bool
71get_positive_int(const char *string, const char *name, int32_t* number);
72
84WS_DLL_PUBLIC bool
85get_natural_int64(const char* string, const char* name, int64_t* number);
86
98WS_DLL_PUBLIC bool
99get_positive_int64(const char* string, const char* name, int64_t* number);
100
112WS_DLL_PUBLIC bool
113get_uint32(const char *string, const char *name, uint32_t* number);
114
115WS_DEPRECATED_X("Use get_uint32 instead")
116static inline uint32_t
117get_guint32(const char *string, const char *name) {
118 uint32_t number = 0;
119 get_uint32(string, name, &number);
120 return number;
121}
122
135WS_DLL_PUBLIC bool
136get_nonzero_uint32(const char *string, const char *name, uint32_t* number);
137
138WS_DEPRECATED_X("Use get_nonzero_uint32 instead")
139static inline uint32_t
140get_nonzero_guint32(const char *string, const char *name) {
141 uint32_t number = 0;
142 get_nonzero_uint32(string, name, &number);
143 return number;
144}
145
157WS_DLL_PUBLIC bool
158get_uint64(const char *string, const char *name, uint64_t* number);
159
171WS_DLL_PUBLIC bool
172get_nonzero_uint64(const char *string, const char *name, uint64_t* number);
173
185WS_DLL_PUBLIC bool
186get_positive_double(const char *string, const char *name, double* number);
187
188#ifdef __cplusplus
189}
190#endif /* __cplusplus */
191
192#endif /* __CLOPTS_COMMON_H__ */
WS_DLL_PUBLIC bool get_uint64(const char *string, const char *name, uint64_t *number)
Parses a string as an unsigned 64-bit integer.
Definition clopts_common.c:125
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.
Definition clopts_common.c:111
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.
Definition clopts_common.c:59
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.
Definition clopts_common.c:45
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.
Definition clopts_common.c:82
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.
Definition clopts_common.c:140
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.
Definition clopts_common.c:22
WS_DLL_PUBLIC bool get_uint32(const char *string, const char *name, uint32_t *number)
Parses a string as an unsigned 32-bit integer.
Definition clopts_common.c:96
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.
Definition clopts_common.c:154