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 "ws_symbol_export.h"
27 #endif /* __cplusplus */
30 * Initialize the report message routines
32 WS_DLL_PUBLIC void init_report_message(
33 void (*vreport_failure)(const char *, va_list),
34 void (*vreport_warning)(const char *, va_list),
35 void (*report_open_failure)(const char *, int, gboolean),
36 void (*report_read_failure)(const char *, int),
37 void (*report_write_failure)(const char *, int));
40 * Report a general error.
42 WS_DLL_PUBLIC void report_failure(const char *msg_format, ...) G_GNUC_PRINTF(1, 2);
45 * Report a general warning.
47 WS_DLL_PUBLIC void report_warning(const char *msg_format, ...) G_GNUC_PRINTF(1, 2);
50 * Report an error when trying to open a file.
51 * "err" is assumed to be an error code from Wiretap; positive values are
52 * UNIX-style errnos, so this can be used for open failures not from
53 * Wiretap as long as the failure code is just an errno.
55 WS_DLL_PUBLIC void report_open_failure(const char *filename, int err,
56 gboolean for_writing);
59 * Report an error when trying to read a file.
60 * "err" is assumed to be a UNIX-style errno.
62 WS_DLL_PUBLIC void report_read_failure(const char *filename, int err);
65 * Report an error when trying to write a file.
66 * "err" is assumed to be a UNIX-style errno.
68 WS_DLL_PUBLIC void report_write_failure(const char *filename, int err);
72 #endif /* __cplusplus */
74 #endif /* __REPORT_MESSAGE_H__ */