Debian Codegraph @

libbfio/libbfio_file_io_handle.h

raw symbols SCIP
1 /*
2 * File IO handle functions
3 *
4 * Copyright (C) 2009-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( _LIBBFIO_FILE_IO_HANDLE_H )
23 #define _LIBBFIO_FILE_IO_HANDLE_H
24
25 #include <common.h>
26 #include <types.h>
27
28 #include "libbfio_libcerror.h"
29 #include "libbfio_libcfile.h"
30
31 #if defined( __cplusplus )
32 extern "C" {
33 #endif
34
35 typedef struct libbfio_file_io_handle libbfio_file_io_handle_t;
36
37 struct libbfio_file_io_handle
38 {
39 /* The name
40 */
41 system_character_t *name;
42
43 /* The size of the name
44 */
45 size_t name_size;
46
47 /* The file (handle)
48 */
49 libcfile_file_t *file;
50
51 /* The access flags
52 */
53 int access_flags;
54 };
55
56 int libbfio_file_io_handle_initialize(
57 libbfio_file_io_handle_t **file_io_handle,
58 libcerror_error_t **error );
59
60 int libbfio_file_io_handle_free(
61 libbfio_file_io_handle_t **file_io_handle,
62 libcerror_error_t **error );
63
64 int libbfio_file_io_handle_clone(
65 libbfio_file_io_handle_t **destination_file_io_handle,
66 libbfio_file_io_handle_t *source_file_io_handle,
67 libcerror_error_t **error );
68
69 int libbfio_file_io_handle_get_name_size(
70 libbfio_file_io_handle_t *file_io_handle,
71 size_t *name_size,
72 libcerror_error_t **error );
73
74 int libbfio_file_io_handle_get_name(
75 libbfio_file_io_handle_t *file_io_handle,
76 char *name,
77 size_t name_size,
78 libcerror_error_t **error );
79
80 int libbfio_file_io_handle_set_name(
81 libbfio_file_io_handle_t *file_io_handle,
82 const char *name,
83 size_t name_length,
84 libcerror_error_t **error );
85
86 #if defined( HAVE_WIDE_CHARACTER_TYPE )
87
88 int libbfio_file_io_handle_get_name_size_wide(
89 libbfio_file_io_handle_t *file_io_handle,
90 size_t *name_size,
91 libcerror_error_t **error );
92
93 int libbfio_file_io_handle_get_name_wide(
94 libbfio_file_io_handle_t *file_io_handle,
95 wchar_t *name,
96 size_t name_size,
97 libcerror_error_t **error );
98
99 int libbfio_file_io_handle_set_name_wide(
100 libbfio_file_io_handle_t *file_io_handle,
101 const wchar_t *name,
102 size_t name_length,
103 libcerror_error_t **error );
104
105 #endif /* defined( HAVE_WIDE_CHARACTER_TYPE ) */
106
107 int libbfio_file_io_handle_open(
108 libbfio_file_io_handle_t *file_io_handle,
109 int access_flags,
110 libcerror_error_t **error );
111
112 int libbfio_file_io_handle_close(
113 libbfio_file_io_handle_t *file_io_handle,
114 libcerror_error_t **error );
115
116 ssize_t libbfio_file_io_handle_read_buffer(
117 libbfio_file_io_handle_t *file_io_handle,
118 uint8_t *buffer,
119 size_t size,
120 libcerror_error_t **error );
121
122 ssize_t libbfio_file_io_handle_write_buffer(
123 libbfio_file_io_handle_t *file_io_handle,
124 const uint8_t *buffer,
125 size_t size,
126 libcerror_error_t **error );
127
128 off64_t libbfio_file_io_handle_seek_offset(
129 libbfio_file_io_handle_t *file_io_handle,
130 off64_t offset,
131 int whence,
132 libcerror_error_t **error );
133
134 int libbfio_file_io_handle_exists(
135 libbfio_file_io_handle_t *file_io_handle,
136 libcerror_error_t **error );
137
138 int libbfio_file_io_handle_is_open(
139 libbfio_file_io_handle_t *file_io_handle,
140 libcerror_error_t **error );
141
142 int libbfio_file_io_handle_get_size(
143 libbfio_file_io_handle_t *file_io_handle,
144 size64_t *size,
145 libcerror_error_t **error );
146
147 #if defined( __cplusplus )
148 }
149 #endif
150
151 #endif /* !defined( _LIBBFIO_FILE_IO_HANDLE_H ) */
152