1 /*
2  * Catalog definition functions
3  *
4  * Copyright (C) 2009-2021, Joachim Metz <joachim.metz@gmail.com>
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( _LIBESEDB_CATALOG_DEFINITION_H )
23 #define _LIBESEDB_CATALOG_DEFINITION_H
24 
25 #include <common.h>
26 #include <types.h>
27 
28 #include "libesedb_libcerror.h"
29 
30 #if defined( __cplusplus )
31 extern "C" {
32 #endif
33 
34 typedef struct libesedb_catalog_definition libesedb_catalog_definition_t;
35 
36 struct libesedb_catalog_definition
37 {
38 	/* The father data page (FDP) object identifier
39 	 */
40 	uint32_t father_data_page_object_identifier;
41 
42 	/* The type
43 	 */
44 	uint16_t type;
45 
46 	/* The identifier
47 	 */
48 	uint32_t identifier;
49 
50 	union
51 	{
52 		/* The father data page (FDP) number
53 		 */
54 		uint32_t father_data_page_number;
55 
56 		/* The column type
57 		 */
58 		uint32_t column_type;
59 	};
60 
61 	/* The size (or space usage)
62 	 */
63 	uint32_t size;
64 
65 	/* The codepage
66 	 */
67 	uint32_t codepage;
68 
69 	/* The LCMAP flags
70 	 */
71 	uint32_t lcmap_flags;
72 
73 	/* The name
74 	 */
75 	uint8_t *name;
76 
77 	/* The name size
78 	 */
79 	size_t name_size;
80 
81 #if defined( HAVE_DEBUG_OUTPUT )
82 	/* The name string
83 	 */
84 	system_character_t *name_string;
85 #endif
86 
87 	/* The template name
88 	 */
89 	uint8_t *template_name;
90 
91 	/* The template name size
92 	 */
93 	size_t template_name_size;
94 
95 	/* The default value
96 	 */
97 	uint8_t *default_value;
98 
99 	/* The default value size
100 	 */
101 	size_t default_value_size;
102 };
103 
104 int libesedb_catalog_definition_initialize(
105      libesedb_catalog_definition_t **catalog_definition,
106      libcerror_error_t **error );
107 
108 int libesedb_catalog_definition_free(
109      libesedb_catalog_definition_t **catalog_definition,
110      libcerror_error_t **error );
111 
112 int libesedb_catalog_definition_read_data(
113      libesedb_catalog_definition_t *catalog_definition,
114      const uint8_t *data,
115      size_t data_size,
116      int ascii_codepage,
117      libcerror_error_t **error );
118 
119 int libesedb_catalog_definition_get_identifier(
120      libesedb_catalog_definition_t *catalog_definition,
121      uint32_t *identifier,
122      libcerror_error_t **error );
123 
124 int libesedb_catalog_definition_get_column_type(
125      libesedb_catalog_definition_t *catalog_definition,
126      uint32_t *column_type,
127      libcerror_error_t **error );
128 
129 int libesedb_catalog_definition_get_utf8_name_size(
130      libesedb_catalog_definition_t *catalog_definition,
131      size_t *utf8_string_size,
132      int ascii_codepage,
133      libcerror_error_t **error );
134 
135 int libesedb_catalog_definition_get_utf8_name(
136      libesedb_catalog_definition_t *catalog_definition,
137      uint8_t *utf8_string,
138      size_t utf8_string_size,
139      int ascii_codepage,
140      libcerror_error_t **error );
141 
142 int libesedb_catalog_definition_get_utf16_name_size(
143      libesedb_catalog_definition_t *catalog_definition,
144      size_t *utf16_string_size,
145      int ascii_codepage,
146      libcerror_error_t **error );
147 
148 int libesedb_catalog_definition_get_utf16_name(
149      libesedb_catalog_definition_t *catalog_definition,
150      uint16_t *utf16_string,
151      size_t utf16_string_size,
152      int ascii_codepage,
153      libcerror_error_t **error );
154 
155 int libesedb_catalog_definition_get_utf8_template_name_size(
156      libesedb_catalog_definition_t *catalog_definition,
157      size_t *utf8_string_size,
158      int ascii_codepage,
159      libcerror_error_t **error );
160 
161 int libesedb_catalog_definition_get_utf8_template_name(
162      libesedb_catalog_definition_t *catalog_definition,
163      uint8_t *utf8_string,
164      size_t utf8_string_size,
165      int ascii_codepage,
166      libcerror_error_t **error );
167 
168 int libesedb_catalog_definition_get_utf16_template_name_size(
169      libesedb_catalog_definition_t *catalog_definition,
170      size_t *utf16_string_size,
171      int ascii_codepage,
172      libcerror_error_t **error );
173 
174 int libesedb_catalog_definition_get_utf16_template_name(
175      libesedb_catalog_definition_t *catalog_definition,
176      uint16_t *utf16_string,
177      size_t utf16_string_size,
178      int ascii_codepage,
179      libcerror_error_t **error );
180 
181 int libesedb_catalog_definition_compare_name(
182      libesedb_catalog_definition_t *catalog_definition,
183      const uint8_t *name,
184      size_t name_size,
185      libcerror_error_t **error );
186 
187 int libesedb_catalog_definition_compare_name_with_utf8_string(
188      libesedb_catalog_definition_t *catalog_definition,
189      const uint8_t *utf8_string,
190      size_t utf8_string_length,
191      libcerror_error_t **error );
192 
193 int libesedb_catalog_definition_compare_name_with_utf16_string(
194      libesedb_catalog_definition_t *catalog_definition,
195      const uint16_t *utf16_string,
196      size_t utf16_string_length,
197      libcerror_error_t **error );
198 
199 #if defined( __cplusplus )
200 }
201 #endif
202 
203 #endif /* !defined( _LIBESEDB_CATALOG_DEFINITION_H ) */
204 
205