3 * Handle command-line arguments common to various programs
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
12 #ifndef __CLOPTS_COMMON_H__
13 #define __CLOPTS_COMMON_H__
15 #include <wireshark.h>
19 #endif /* __cplusplus */
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.
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
37 #define LONGOPT_READ_CAPTURE_COMMON \
38 {"read-file", ws_required_argument, NULL, 'r' }, \
40 #define OPTSTRING_READ_CAPTURE_COMMON \
44 get_natural_int(const char *string
, const char *name
);
47 get_positive_int(const char *string
, const char *name
);
49 WS_DLL_PUBLIC
uint32_t
50 get_uint32(const char *string
, const char *name
);
52 WS_DEPRECATED_X("Use get_uint32 instead")
53 static inline uint32_t
54 get_guint32(const char *string
, const char *name
) { return get_uint32(string
, name
); }
56 WS_DLL_PUBLIC
uint32_t
57 get_nonzero_uint32(const char *string
, const char *name
);
59 WS_DEPRECATED_X("Use get_nonzero_uint32 instead")
60 static inline uint32_t
61 get_nonzero_guint32(const char *string
, const char *name
) { return get_nonzero_uint32(string
, name
); }
63 WS_DLL_PUBLIC
uint64_t
64 get_uint64(const char *string
, const char *name
);
66 WS_DLL_PUBLIC
uint64_t
67 get_nonzero_uint64(const char *string
, const char *name
);
70 get_positive_double(const char *string
, const char *name
);
74 #endif /* __cplusplus */
76 #endif /* __CLOPTS_COMMON_H__ */