3 * Routines to print various "standard" failure messages used in multiple
6 * This is a "simple" version that does not link with libwiretap and interpret
7 * the WTAP_ERR_ or WTAP_FILE_TYPE_SUBTYPE_ values that are parameters to the
8 * capture file routines (cfile_*). It is for use in dumpcap, which does not
9 * link with libwiretap or libui. The libwiretap-related routines should not
10 * be called from dumpcap, but a rudimentary implementation is provided since
11 * wsutil/report_message expects them.
13 * Console programs that do link against libwiretap should include
14 * ui/failure_message.h instead.
16 * Wireshark - Network traffic analyzer
17 * By Gerald Combs <gerald@wireshark.org>
18 * Copyright 1998 Gerald Combs
20 * SPDX-License-Identifier: GPL-2.0-or-later
23 #ifndef __FAILURE_MESSAGE_SIMPLE_H__
24 #define __FAILURE_MESSAGE_SIMPLE_H__
28 #endif /* __cplusplus */
31 * Generic error message.
33 extern void failure_message_simple(const char *msg_format
, va_list ap
);
36 * Error message for a failed attempt to open or create a file
37 * other than a capture file.
38 * "filename" is the name of the file being opened; "err" is assumed
39 * to be a UNIX-style errno; "for_writing" is true if we're opening
40 * the file for writing and false if we're opening it for reading.
42 extern void open_failure_message_simple(const char *filename
, int err
,
46 * Error message for a failed attempt to read from a file other than
48 * "filename" is the name of the file being opened; "err" is assumed
49 * to be a UNIX-style errno.
51 extern void read_failure_message_simple(const char *filename
, int err
);
54 * Error message for a failed attempt to write to a file other than
56 * "filename" is the name of the file being written to; "err" is assumed
57 * to be a UNIX-style errno.
59 extern void write_failure_message_simple(const char *filename
, int err
);
62 * Error message for a failed attempt to rename a file other than
64 * "old_filename" is the name of the file being renamed; "new_filename"
65 * is the name to which it's being renamed; "err" is assumed to be a
68 extern void rename_failure_message_simple(const char *old_filename
,
69 const char *new_filename
, int err
);
71 /* XXX - The cfile_ routines below here should not be called. */
74 * Error message for a failed attempt to open a capture file for input.
75 * "filename" is the name of the file being opened; "err" is assumed
76 * to be a UNIX-style errno or a WTAP_ERR_ value; "err_info" is assumed
77 * to be a string giving further information for some WTAP_ERR_ values.
79 extern void cfile_open_failure_message_simple(const char* filename
, int err
,
83 * Error message for a failed attempt to open a capture file for output.
84 * "filename" is the name of the file being opened; "err" is assumed
85 * to be a UNIX-style errno or a WTAP_ERR_ value; "err_info" is assumed
86 * to be a string giving further information for some WTAP_ERR_ values;
87 * "file_type_subtype" is a WTAP_FILE_TYPE_SUBTYPE_ value for the type
88 * and subtype of file being opened.
90 extern void cfile_dump_open_failure_message_simple(const char* filename
, int err
,
92 int file_type_subtype _U_
);
95 * Error message for a failed attempt to read from a capture file.
96 * "filename" is the name of the file being opened; "err" is assumed
97 * to be a UNIX-style errno or a WTAP_ERR_ value; "err_info" is assumed
98 * to be a string giving further information for some WTAP_ERR_ values.
100 extern void cfile_read_failure_message_simple(const char* filename
, int err
,
104 * Error message for a failed attempt to write to a capture file.
105 * "in_filename" is the name of the file from which the record
106 * being written came; "out_filename" is the name of the file to
107 * which we're writing; "err" is assumed "err" is assumed to be a
108 * UNIX-style errno or a WTAP_ERR_ value; "err_info" is assumed to be
109 * a string giving further information for some WTAP_ERR_ values;
110 * "framenum" is the frame number of the record on which the error
111 * occurred; "file_type_subtype" is a WTAP_FILE_TYPE_SUBTYPE_ value
112 * for the type and subtype of file being written.
114 extern void cfile_write_failure_message_simple(const char* in_filename
,
115 const char* out_filename
,
116 int err
, char* err_info
,
118 int file_type_subtype _U_
);
121 * Error message for a failed attempt to close a capture file.
122 * "filename" is the name of the file being closed; "err" is assumed
123 * to be a UNIX-style errno or a WTAP_ERR_ value; "err_info" is assumed
124 * to be a string giving further information for some WTAP_ERR_ values.
126 * When closing a capture file:
128 * some information in the file that can't be determined until
129 * all packets have been written might be written to the file
130 * (such as a table of the file offsets of all packets);
132 * data buffered in the low-level file writing code might be
133 * flushed to the file;
135 * for remote file systems, data written to the file but not
136 * yet sent to the server might be sent to the server or, if
137 * that data was sent asynchronously, "out of space", "disk
138 * quota exceeded", or "I/O error" indications might have
139 * been received but not yet delivered, and the close operation
140 * could deliver them;
142 * so we have to check for write errors here.
144 extern void cfile_close_failure_message_simple(const char* filename
, int err
,
148 * Register these routines with the report_message mechanism.
150 extern void init_report_failure_message_simple(const char *friendly_program_name
);
154 #endif /* __cplusplus */
156 #endif /* __FAILURE_MESSAGE_SIMPLE_H__ */