Revert "UNUSED enc_key_id_{equal,hash}"
[wireshark-sm.git] / wsutil / report_message.h
blobca3c221780b2dd0a417683eac56ac0f546f67099
1 /** @file
2 * Declarations of routines for code that can run in GUI and command-line
3 * environments to use to report errors and warnings to the user (e.g.,
4 * I/O errors, or problems with preference settings) if the message should
5 * be shown as a GUI error in a GUI environment.
7 * The application using libwsutil will register message-reporting
8 * routines, and the routines declared here will call the registered
9 * routines. That way, these routines can be called by code that
10 * doesn't itself know whether to pop up a dialog or print something
11 * to the standard error.
13 * Wireshark - Network traffic analyzer
14 * By Gerald Combs <gerald@wireshark.org>
15 * Copyright 1998 Gerald Combs
17 * SPDX-License-Identifier: GPL-2.0-or-later
20 #ifndef __REPORT_MESSAGE_H__
21 #define __REPORT_MESSAGE_H__
23 #include <wireshark.h>
25 #ifdef __cplusplus
26 extern "C" {
27 #endif /* __cplusplus */
30 * Initialize the report message routines
32 struct report_message_routines {
33 void (*vreport_failure)(const char *, va_list);
34 void (*vreport_warning)(const char *, va_list);
35 void (*report_open_failure)(const char *, int, bool);
36 void (*report_read_failure)(const char *, int);
37 void (*report_write_failure)(const char *, int);
38 void (*report_rename_failure)(const char *, const char *, int);
39 void (*report_cfile_open_failure)(const char *, int, char *);
40 void (*report_cfile_dump_open_failure)(const char *, int, char *, int);
41 void (*report_cfile_read_failure)(const char *, int, char *);
42 void (*report_cfile_write_failure)(const char *, const char *,
43 int, char *, uint64_t, int);
44 void (*report_cfile_close_failure)(const char *, int, char *);
47 WS_DLL_PUBLIC void init_report_message(const char *friendly_program_name,
48 const struct report_message_routines *routines);
51 * Report a general error.
53 WS_DLL_PUBLIC void report_failure(const char *msg_format, ...) G_GNUC_PRINTF(1, 2);
56 * Report a general warning.
58 WS_DLL_PUBLIC void report_warning(const char *msg_format, ...) G_GNUC_PRINTF(1, 2);
61 * Report an error when trying to open a file.
62 * "err" is assumed to be an error code from Wiretap; positive values are
63 * UNIX-style errnos, so this can be used for open failures not from
64 * Wiretap as long as the failure code is just an errno.
66 WS_DLL_PUBLIC void report_open_failure(const char *filename, int err,
67 bool for_writing);
70 * Report an error when trying to read a file.
71 * "err" is assumed to be a UNIX-style errno.
73 WS_DLL_PUBLIC void report_read_failure(const char *filename, int err);
76 * Report an error when trying to write a file.
77 * "err" is assumed to be a UNIX-style errno.
79 WS_DLL_PUBLIC void report_write_failure(const char *filename, int err);
82 * Report an error when trying to rename a file.
83 * "err" is assumed to be a UNIX-style errno.
85 WS_DLL_PUBLIC void report_rename_failure(const char *old_filename,
86 const char *new_filename, int err);
89 * Report an error from opening a capture file for reading.
91 WS_DLL_PUBLIC void report_cfile_open_failure(const char *filename,
92 int err, char *err_info);
95 * Report an error from opening a capture file for writing.
97 WS_DLL_PUBLIC void report_cfile_dump_open_failure(const char *filename,
98 int err, char *err_info, int file_type_subtype);
101 * Report an error from attempting to read from a capture file.
103 WS_DLL_PUBLIC void report_cfile_read_failure(const char *filename,
104 int err, char *err_info);
107 * Report an error from attempting to write to a capture file.
109 WS_DLL_PUBLIC void report_cfile_write_failure(const char *in_filename,
110 const char *out_filename, int err, char *err_info, uint64_t framenum,
111 int file_type_subtype);
114 * Report an error from closing a capture file open for writing.
116 WS_DLL_PUBLIC void report_cfile_close_failure(const char *filename,
117 int err, char *err_info);
120 * Return the "friendly" program name.
122 WS_DLL_PUBLIC const char *get_friendly_program_name(void);
124 #ifdef __cplusplus
126 #endif /* __cplusplus */
128 #endif /* __REPORT_MESSAGE_H__ */