Debian Codegraph @

libcerror/libcerror_error.h

raw symbols SCIP
1 /*
2 * Error functions
3 *
4 * Copyright (C) 2008-2024, Joachim Metz <[email protected]>
5 *
6 * Refer to AUTHORS for acknowledgements.
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
22 #if !defined( _LIBCERROR_INTERNAL_ERROR_H )
23 #define _LIBCERROR_INTERNAL_ERROR_H
24
25 #include <common.h>
26 #include <types.h>
27
28 #include <stdio.h>
29
30 #include "libcerror_extern.h"
31 #include "libcerror_types.h"
32
33 #if defined( __cplusplus )
34 extern "C" {
35 #endif
36
37 typedef struct libcerror_internal_error libcerror_internal_error_t;
38
39 struct libcerror_internal_error
40 {
41 /* The error domain
42 */
43 int domain;
44
45 /* The error code
46 */
47 int code;
48
49 /* The number of messages
50 */
51 int number_of_messages;
52
53 /* A dynamic array containing the message strings
54 */
55 system_character_t **messages;
56
57 /* A dynamic array containing the message string sizes
58 * without the end-of-string character
59 */
60 size_t *sizes;
61 };
62
63 int libcerror_error_initialize(
64 libcerror_error_t **error,
65 int error_domain,
66 int error_code );
67
68 LIBCERROR_EXTERN \
69 void libcerror_error_free(
70 libcerror_error_t **error );
71
72 int libcerror_error_resize(
73 libcerror_internal_error_t *internal_error );
74
75 #if defined( HAVE_WIDE_SYSTEM_CHARACTER )
76
77 void libcerror_error_get_system_format_string(
78 const char *format_string,
79 size_t format_string_length,
80 system_character_t **system_format_string );
81
82 #endif /* defined( HAVE_WIDE_SYSTEM_CHARACTER ) */
83
84 LIBCERROR_EXTERN \
85 void libcerror_error_set(
86 libcerror_error_t **error,
87 int error_domain,
88 int error_code,
89 const char *format_string,
90 ... );
91
92 LIBCERROR_EXTERN \
93 int libcerror_error_matches(
94 libcerror_error_t *error,
95 int error_domain,
96 int error_code );
97
98 LIBCERROR_EXTERN \
99 int libcerror_error_fprint(
100 libcerror_error_t *error,
101 FILE *stream );
102
103 LIBCERROR_EXTERN \
104 int libcerror_error_sprint(
105 libcerror_error_t *error,
106 char *string,
107 size_t size );
108
109 LIBCERROR_EXTERN \
110 int libcerror_error_backtrace_fprint(
111 libcerror_error_t *error,
112 FILE *stream );
113
114 LIBCERROR_EXTERN \
115 int libcerror_error_backtrace_sprint(
116 libcerror_error_t *error,
117 char *string,
118 size_t size );
119
120 #if defined( __cplusplus )
121 }
122 #endif
123
124 #endif /* !defined( _LIBCERROR_INTERNAL_ERROR_H ) */
125