1 /* Hey EMACS -*- linux-c -*- */
2 /* $Id$ */
3 
4 /*  libTIFILES - file format library, a part of the TiLP project
5  *  Copyright (C) 1999-2005  Romain Lievin
6  *
7  *  This program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation; either version 2 of the License, or
10  *  (at your option) any later version.
11  *
12  *  This program is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with this program; if not, write to the Free Software Foundation,
19  *  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #ifndef __TIFILES_H__
23 #define __TIFILES_H__
24 
25 #ifdef HAVE_CONFIG_H
26 #  include <config.h>
27 #endif
28 
29 #include <ticonv.h>
30 
31 #include "export2.h"
32 #include "stdints2.h"
33 #include "typesxx.h"
34 
35 	/***********************/
36 	/* Types & Definitions */
37 	/***********************/
38 
39 /* Conditionnals */
40 
41 //#define CHECKSUM_ENABLED
42 
43 /* Versioning */
44 
45 #ifdef __WIN32__
46 # define LIBFILES_VERSION "1.1.7"
47 #else
48 # define LIBFILES_VERSION VERSION
49 #endif
50 
51 /* Types */
52 
53 // TI-XX: up to 4*8 chars + 1, NSpire, up to 4*255 chars + 1
54 #define FLDNAME_MAX		1024
55 #define VARNAME_MAX		1024
56 #define FULNAME_MAX		2048
57 
58 #define FILES_NCALCS	CALC_MAX	// # of supported calcs
59 
60 /**
61  * FileAttr:
62  *
63  * An enumeration which contains the different variable attributes.
64  **/
65 typedef enum
66 {
67 	ATTRB_NONE = 0, ATTRB_LOCKED = 1, ATTRB_PROTECTED, ATTRB_ARCHIVED = 3,
68 } FileAttr;
69 
70 /**
71  * FileClass:
72  *
73  * An enumeration which contains the following class of TI files:
74  **/
75 typedef enum
76 {
77 	TIFILE_SINGLE = 1, TIFILE_GROUP = 2, TIFILE_REGULAR = 3, TIFILE_BACKUP = 4,
78 	TIFILE_FLASH = 8, TIFILE_TIGROUP = 16, TIFILE_OS = 32, TIFILE_APP = 64,
79 } FileClass;
80 
81 /**
82  * FileEncoding:
83  *
84  * An enumeration which contains the following encodings:
85  **/
86 typedef enum
87 {
88 	ENCODING_ASCII = 1, ENCODING_LATIN1, ENCODING_UNICODE,
89 } FileEncoding;
90 
91 /**
92  * DeviceType:
93  *
94  * An enumeration which contains some device IDs for FLASH apps:
95  **/
96 typedef enum
97 {
98 	DEVICE_TYPE_83P = 0x73,
99 	DEVICE_TYPE_73  = 0x74,
100 	DEVICE_TYPE_89  = 0x98,
101 	DEVICE_TYPE_92P = 0x88,
102 } DeviceType;
103 
104 /* Structures (common to all calcs) */
105 
106 /**
107  * VarEntry:
108  * @folder: name of folder (TI-68k, Nspire) or ""
109  * @name: name of variable (raw on-calc encoding)
110  * @type: vartype ID
111  * @attr: TI83+/89/92+ only (ATTRB_NONE or ARCHIVED)
112  * @version: version compatibility level (TI83+/84+ only)
113  * @size: size of data (uint16_t for TI-Z80, TI-eZ80)
114  * @data: pure data
115  * @action: used by ticalcs library (must be set to 0)
116  *
117  * A generic structure used to store the content of a TI variable.
118  **/
119 typedef struct
120 {
121 	char		folder[FLDNAME_MAX];
122 	char		name[VARNAME_MAX];
123 
124 	uint8_t		type;
125 	uint8_t		attr;
126 	uint8_t		version;
127 	uint32_t	size;
128 	uint8_t*	data;
129 
130 	int			action;
131 } VarEntry;
132 
133 /**
134  * FileContent:
135  * @model: calculator model
136  * @default_folder: name of the default folder (TI-68k)
137  * @comment: comment embedded in file (like "Single file received by TiLP")
138  * @num_entries: number of variables stored after
139  * @entries: a NULL-terminated array of #TiVarEntry structures
140  * @checksum: checksum of file
141  *
142  * A generic structure used to store the content of a single/grouped TI file.
143  * Please note that:
144  * - entries must be NULL-terminated. Parsing is based on this property.
145  * - num_entries must be exact. Counting relies on this.
146  *
147  * Note: NSpire uses only one entry (no grouping support).
148  *
149  **/
150 typedef struct
151 {
152 	CalcModel		model;
153 
154 	char			default_folder[FLDNAME_MAX];	// TI-68k only
155 	char			comment[43];					// TI-Z80, TI-eZ80: 42 max; TI-68k: 40 max; TI-Nspire: N/A
156 
157 	unsigned int	num_entries;
158 	VarEntry**	entries;
159 
160 	uint16_t		checksum;
161 
162 	CalcModel		model_dst;
163 } FileContent;
164 
165 /**
166  * BackupContent:
167  * @model: calculator model
168  * @comment: comment embedded in file (like "Backup file received by TiLP")
169  * @checksum: checksum of file
170  *
171  * A generic structure used to store the content of a backup file.
172  **/
173 typedef struct
174 {
175 	CalcModel model;
176 
177 	char		comment[43];	// 41 on TI-68k
178 
179 	char		rom_version[9];	// TI92 only
180 	uint16_t	mem_address;	// TI-Z80 only
181 
182 	uint8_t	type;
183 	uint8_t version;			// TI-Z80, TI-eZ80
184 
185 	uint32_t	data_length;	// TI-68k only
186 	uint8_t*	data_part;
187 
188 	uint16_t	data_length1;	// TI-Z80 only
189 	uint8_t*	data_part1;
190 
191 	uint16_t	data_length2;	// TI-Z80 only
192 	uint8_t*	data_part2;
193 
194 	uint16_t	data_length3;	// TI-Z80 only
195 	uint8_t*	data_part3;
196 
197 	uint16_t	data_length4;	// TI-86 only
198 	uint8_t*	data_part4;
199 
200 	uint16_t	checksum;
201 } BackupContent;
202 
203 #define FLASH_PAGE_SIZE	16384
204 
205 /**
206  * FlashPage:
207  * @offset: FLASH offset (see TI link guide).
208  * @page: FLASH page (see TI link guide).
209  * @flag: see link guide.
210  * @size: length of pure data (up to 16384 bytes)
211  * @data: pure FLASH data.
212  *
213  * A generic structure used to store the content of a TI-Z80 memory page for FLASH.
214  **/
215 typedef struct
216 {
217 	uint16_t	addr;
218 	uint16_t	page;
219 	uint8_t	flag;
220 	uint16_t	size;
221 	uint8_t*	data;
222 } FlashPage;
223 
224 /**
225  * FlashContent:
226  * @model: a calculator model.
227  * @revision_major:
228  * @revision_minor:
229  * @flags:
230  * @object_type:
231  * @revision_day:
232  * @revision_month:
233  * @revision_year:
234  * @name: name of FLASH app or OS
235  * @device_type: a device ID
236  * @data_type: a type ID
237  * @hw_id: hardware ID (used on TI-68k only, 0 otherwise)
238  * @data_length: length of pure data
239  * @data_part: pure FLASH data (TI-68k, TI-eZ80) or license or certificate
240  * @num_pages: number of FLASH pages (TI-Z80 only)
241  * @pages: NULL-terminated array of FLASH pages (TI-Z80 only)
242  * @next: pointer to next structure (linked list of contents)
243  *
244  * A generic structure used to store the content of a FLASH file (os or app).
245  **/
246 typedef struct _FlashContent FlashContent;
247 struct _FlashContent
248 {
249 	CalcModel		model;
250 	CalcModel		model_dst;
251 
252 	//FlashHeader	header;
253 	uint8_t		revision_major;
254 	uint8_t		revision_minor;
255 	uint8_t		flags;
256 	uint8_t		object_type;
257 	uint8_t		revision_day;
258 	uint8_t		revision_month;
259 	uint16_t		revision_year;
260 	char			name[VARNAME_MAX];
261 	uint8_t		device_type;
262 	uint8_t		data_type;
263 	uint8_t		hw_id;
264 	uint32_t		data_length;
265 
266 	uint8_t*		data_part;	// TI-68k and TI-eZ80 FlashApps.
267 	unsigned int			num_pages;	// TI-Z80 only
268 	FlashPage**	pages;		// TI-Z80 only
269 
270 	FlashContent*	next;		// TI-68k only
271 };
272 
273 typedef struct
274 {
275 	char*		filename;
276 	FileClass	type;
277 	union {
278 		FileContent*	regular;
279 		FlashContent*	flash;
280 		void*			data;
281 	} content;
282 } TigEntry;
283 
284 /**
285  * TigContent:
286  * @model: a calculator model
287  * @comment: a global comment for archive
288  * @comp_level: compression level (0: store, 1 to 4: slow to fast)
289  * @num_entries: the number of entries
290  * @entries: a NULL-terminated array of #TigEntry structures
291  *
292  * A generic structure used to store the content of a TiGroup file.
293  **/
294 typedef struct
295 {
296 	CalcModel			model;
297 	char*				comment;
298 	int				comp_level;
299 
300 	TigEntry**		var_entries;
301 	unsigned int		n_vars;
302 
303 	TigEntry**		app_entries;
304 	unsigned int		n_apps;
305 
306 	CalcModel			model_dst;
307 } TigContent;
308 
309 /* Functions */
310 
311 // namespace scheme: library_class_function like tifiles_fext_get
312 
313 #ifdef __cplusplus
314 extern "C" {
315 #endif
316 
317 	/****************/
318 	/* Entry points */
319 	/****************/
320 
321 	TIEXPORT2 int TICALL tifiles_library_init(void);
322 	TIEXPORT2 int TICALL tifiles_library_exit(void);
323 
324 	/*********************/
325 	/* General functions */
326 	/*********************/
327 
328 	// tifiles.c
329 	TIEXPORT2 const char* TICALL tifiles_version_get(void);
330 
331 	// error.c
332 	TIEXPORT2 int         TICALL tifiles_error_get(int number, char **message);
333 	TIEXPORT2 int         TICALL tifiles_error_free(char *message);
334 
335 	// type2str.c
336 	TIEXPORT2 const char* TICALL tifiles_model_to_string(CalcModel type);
337 	TIEXPORT2 CalcModel   TICALL tifiles_string_to_model(const char *str);
338 
339 	TIEXPORT2 const char* TICALL tifiles_attribute_to_string(FileAttr atrb);
340 	TIEXPORT2 FileAttr    TICALL tifiles_string_to_attribute(const char *str);
341 
342 	TIEXPORT2 const char* TICALL tifiles_class_to_string(FileClass type);
343 	TIEXPORT2 FileClass   TICALL tifiles_string_to_class(const char *str);
344 
345 	// filetypes.c
346 	TIEXPORT2 const char* TICALL tifiles_fext_of_group    (CalcModel model);
347 	TIEXPORT2 const char* TICALL tifiles_fext_of_backup   (CalcModel model);
348 	TIEXPORT2 const char* TICALL tifiles_fext_of_flash_app(CalcModel model);
349 	TIEXPORT2 const char* TICALL tifiles_fext_of_flash_os (CalcModel model);
350 	TIEXPORT2 const char* TICALL tifiles_fext_of_certif   (CalcModel model);
351 
352 	TIEXPORT2 char* TICALL tifiles_fext_get (const char *filename);
353 	TIEXPORT2 char* TICALL tifiles_fext_dup (const char *filename);
354 	TIEXPORT2 void  TICALL tifiles_fext_free(char *filename);
355 
356 	TIEXPORT2 int TICALL tifiles_file_is_ti     (const char *filename);
357 	TIEXPORT2 int TICALL tifiles_file_is_single (const char *filename);
358 	TIEXPORT2 int TICALL tifiles_file_is_group  (const char *filename);
359 	TIEXPORT2 int TICALL tifiles_file_is_regular(const char *filename);
360 	TIEXPORT2 int TICALL tifiles_file_is_backup (const char *filename);
361 	TIEXPORT2 int TICALL tifiles_file_is_os     (const char *filename);
362 	TIEXPORT2 int TICALL tifiles_file_is_app    (const char *filename);
363 	TIEXPORT2 int TICALL tifiles_file_is_tib    (const char *filename);
364 	TIEXPORT2 int TICALL tifiles_file_is_flash  (const char *filename);
365 	TIEXPORT2 int TICALL tifiles_file_is_tigroup(const char *filename);
366 	TIEXPORT2 int TICALL tifiles_file_is_tno    (const char *filename);
367 
368 	TIEXPORT2 int TICALL tifiles_file_has_ti_header  (const char *filename);
369 	TIEXPORT2 int TICALL tifiles_file_has_tib_header (const char *filename);
370 	TIEXPORT2 int TICALL tifiles_file_has_tig_header (const char *filename);
371 	TIEXPORT2 int TICALL tifiles_file_has_tifl_header(const char *filename, uint8_t *dev_type, uint8_t *data_type);
372 	TIEXPORT2 int TICALL tifiles_file_has_tno_header (const char *filename);
373 
374 	TIEXPORT2 int TICALL tifiles_model_to_dev_type(CalcModel model);
375 
376 	TIEXPORT2 int TICALL tifiles_file_test(const char *filename, FileClass type, CalcModel target);
377 
378 	TIEXPORT2 CalcModel TICALL tifiles_fext_to_model(const char *ext);
379 
380 	TIEXPORT2 CalcModel TICALL tifiles_file_get_model(const char *filename);
381 	TIEXPORT2 FileClass TICALL tifiles_file_get_class(const char *filename);
382 
383 	TIEXPORT2 const char* TICALL tifiles_file_get_type(const char *filename);
384 	TIEXPORT2 const char* TICALL tifiles_file_get_icon(const char *filename);
385 
386 	// typesXX.c
387 	TIEXPORT2 const char* TICALL tifiles_vartype2string(CalcModel model, uint8_t data);
388 	TIEXPORT2 uint8_t     TICALL tifiles_string2vartype(CalcModel model, const char *s);
389 
390 	TIEXPORT2 const char* TICALL tifiles_vartype2fext(CalcModel model, uint8_t data);
391 	TIEXPORT2 uint8_t     TICALL tifiles_fext2vartype(CalcModel model, const char *s);
392 
393 	TIEXPORT2 const char* TICALL tifiles_vartype2type(CalcModel model, uint8_t id);
394 	TIEXPORT2 const char* TICALL tifiles_vartype2icon(CalcModel model, uint8_t id);
395 
396 	TIEXPORT2 const char*  TICALL tifiles_calctype2signature(CalcModel model);
397 	TIEXPORT2 CalcModel    TICALL tifiles_signature2calctype(const char *signature);
398 
399 	TIEXPORT2 uint8_t TICALL tifiles_folder_type(CalcModel model);
400 	TIEXPORT2 uint8_t TICALL tifiles_flash_type(CalcModel model);
401 	TIEXPORT2 uint8_t TICALL tifiles_idlist_type(CalcModel model);
402 
403 	// misc.c
404 	TIEXPORT2 int TICALL tifiles_calc_is_ti8x(CalcModel model);
405 	TIEXPORT2 int TICALL tifiles_calc_is_ti9x(CalcModel model);
406 
407 	TIEXPORT2 int TICALL tifiles_calc_are_compat(CalcModel model1, CalcModel model2);
408 
409 	TIEXPORT2 int TICALL tifiles_has_folder(CalcModel model);
410 	TIEXPORT2 int TICALL tifiles_is_flash  (CalcModel model);
411 	TIEXPORT2 int TICALL tifiles_has_backup(CalcModel model);
412 
413 	TIEXPORT2 uint16_t TICALL tifiles_checksum(const uint8_t * buffer, unsigned int size);
414 	TIEXPORT2 int TICALL      tifiles_hexdump(const uint8_t* ptr, unsigned int length);
415 
416 	TIEXPORT2 char* TICALL tifiles_get_varname(const char *full_name);
417 	TIEXPORT2 char* TICALL tifiles_get_fldname(const char *full_name);
418 	TIEXPORT2 char* TICALL tifiles_build_fullname(CalcModel model, char *full_name, const char *fldname, const char *varname);
419 	TIEXPORT2 char* TICALL tifiles_build_filename(CalcModel model, const VarEntry *ve);
420 	TIEXPORT2 void  TICALL tifiles_filename_free(char * filename);
421 
422 	// filesXX.c
423 	TIEXPORT2 FileContent* TICALL tifiles_content_create_regular(CalcModel model);
424 	TIEXPORT2 int          TICALL tifiles_content_delete_regular(FileContent *content);
425 	TIEXPORT2 int TICALL tifiles_file_read_regular(const char *filename, FileContent *content);
426 	TIEXPORT2 int TICALL tifiles_file_write_regular(const char *filename, FileContent *content, char **filename2);
427 	TIEXPORT2 int TICALL tifiles_file_display_regular(FileContent *content);
428 
429 	TIEXPORT2 BackupContent* TICALL tifiles_content_create_backup(CalcModel model);
430 	TIEXPORT2 int            TICALL tifiles_content_delete_backup(BackupContent *content);
431 	TIEXPORT2 int TICALL tifiles_file_read_backup(const char *filename, BackupContent *content);
432 	TIEXPORT2 int TICALL tifiles_file_write_backup(const char *filename, BackupContent *content);
433 	TIEXPORT2 int TICALL tifiles_file_display_backup(BackupContent *content);
434 
435 	TIEXPORT2 FlashContent* TICALL tifiles_content_create_flash(CalcModel model);
436 	TIEXPORT2 int           TICALL tifiles_content_delete_flash(FlashContent *content);
437 	TIEXPORT2 int TICALL tifiles_file_read_flash   (const char *filename, FlashContent *content);
438 	TIEXPORT2 int TICALL tifiles_file_write_flash  (const char *filename, FlashContent *content);
439 	TIEXPORT2 int TICALL tifiles_file_write_flash2 (const char *filename, FlashContent *content, char **filename2);
440 	TIEXPORT2 int TICALL tifiles_file_display_flash(FlashContent *content);
441 
442 	TIEXPORT2 FileContent*  TICALL tifiles_content_dup_regular(FileContent *content);
443 	TIEXPORT2 FlashContent* TICALL tifiles_content_dup_flash(FlashContent *content);
444 
445 	TIEXPORT2 int TICALL tifiles_file_display(const char *filename);
446 
447 	// grouped.c
448 	TIEXPORT2 FileContent** TICALL tifiles_content_create_group(unsigned int n_entries);
449 	TIEXPORT2 int           TICALL tifiles_content_delete_group(FileContent **array);
450 
451 	TIEXPORT2 int TICALL tifiles_group_contents(FileContent **src_contents, FileContent **dst_content);
452 	TIEXPORT2 int TICALL tifiles_ungroup_content(FileContent *src_content, FileContent ***dst_contents);
453 
454 	TIEXPORT2 int TICALL tifiles_group_files(char **src_filenames, const char *dst_filename);
455 	TIEXPORT2 int TICALL tifiles_ungroup_file(const char *src_filename, char ***dst_filenames);
456 
457 
458 	TIEXPORT2 int TICALL tifiles_content_add_entry(FileContent *content, VarEntry *ve);
459 	TIEXPORT2 int TICALL tifiles_content_del_entry(FileContent *content, VarEntry *ve);
460 
461 	TIEXPORT2 int TICALL tifiles_group_add_file(const char *src_filename, const char *dst_filename);
462 	TIEXPORT2 int TICALL tifiles_group_del_file(VarEntry *entry,          const char *dst_filename);
463 
464 	// tigroup.c -> filesXX.c
465 	TIEXPORT2 TigContent* TICALL tifiles_content_create_tigroup(CalcModel model, unsigned int);
466 	TIEXPORT2 int         TICALL tifiles_content_delete_tigroup(TigContent *content);
467 
468 	TIEXPORT2 int TICALL tifiles_file_read_tigroup(const char *filename, TigContent *content);
469 	TIEXPORT2 int TICALL tifiles_file_write_tigroup(const char *filename, TigContent *content);
470 	TIEXPORT2 int TICALL tifiles_file_display_tigroup(const char *filename); // Should have been e.g. tifiles_file_display_tigfile.
471 	TIEXPORT2 int TICALL tifiles_file_display_tigcontent(TigContent *content); // Should have been tifiles_file_display_tigroup, for consistency.
472 
473 	// tigroup.c -> grouped.c
474 	TIEXPORT2 int TICALL tifiles_tigroup_contents(FileContent **src_contents1, FlashContent **src_contents2, TigContent **dst_content);
475 	TIEXPORT2 int TICALL tifiles_untigroup_content(TigContent *src_content, FileContent ***dst_contents1, FlashContent ***dst_contents2);
476 
477 	TIEXPORT2 int TICALL tifiles_tigroup_files(char **src_filenames, const char *dst_filename);
478 	TIEXPORT2 int TICALL tifiles_untigroup_file(const char *src_filename, char ***dst_filenames);
479 
480 
481 	TIEXPORT2 int TICALL tifiles_content_add_te(TigContent *content, TigEntry *te);
482 	TIEXPORT2 int TICALL tifiles_content_del_te(TigContent *content, TigEntry *te);
483 
484 	TIEXPORT2 int TICALL tifiles_tigroup_add_file(const char *src_filename, const char *dst_filename);
485 	TIEXPORT2 int TICALL tifiles_tigroup_del_file(TigEntry *entry,          const char *dst_filename);
486 
487 	// tigroup.c -> ve_fp.c
488 	TIEXPORT2 TigEntry* TICALL tifiles_te_create(const char *filename, FileClass type, CalcModel model);
489 	TIEXPORT2 int		  TICALL tifiles_te_delete(TigEntry* entry);
490 	TIEXPORT2 int		  TICALL tifiles_te_display(TigEntry* entry);
491 
492 	TIEXPORT2 TigEntry**	TICALL tifiles_te_create_array(unsigned int nelts);
493 	TIEXPORT2 TigEntry**	TICALL tifiles_te_resize_array(TigEntry**, unsigned int nelts);
494 	TIEXPORT2 void		TICALL tifiles_te_delete_array(TigEntry**);
495 	TIEXPORT2 int			TICALL tifiles_te_sizeof_array(TigEntry**);
496 
497 	// comments.c
498 	TIEXPORT2 const char* TICALL tifiles_comment_set_single(void);
499 	TIEXPORT2 const char* TICALL tifiles_comment_set_group(void);
500 	TIEXPORT2 const char* TICALL tifiles_comment_set_backup(void);
501 	TIEXPORT2 const char* TICALL tifiles_comment_set_tigroup(void);
502 
503 	// ve_fp.c
504 	TIEXPORT2 VarEntry*	TICALL tifiles_ve_create(void);
505 	TIEXPORT2 VarEntry*	TICALL tifiles_ve_create_alloc_data(uint32_t size);
506 	TIEXPORT2 VarEntry*	TICALL tifiles_ve_create_with_data2(uint32_t size, uint8_t * data);
507 	TIEXPORT2 void		TICALL tifiles_ve_delete(VarEntry*);
508 
509 	TIEXPORT2 void*		TICALL tifiles_ve_alloc_data(size_t size);
510 	TIEXPORT2 VarEntry*	TICALL tifiles_ve_realloc_data(VarEntry* ve, size_t size);
511 	TIEXPORT2 void		TICALL tifiles_ve_free_data(void * data);
512 	TIEXPORT2 VarEntry*	TICALL tifiles_ve_copy(VarEntry* dst, VarEntry* src);
513 	TIEXPORT2 VarEntry*	TICALL tifiles_ve_dup(VarEntry* src);
514 
515 	TIEXPORT2 VarEntry**	TICALL tifiles_ve_create_array(unsigned int nelts);
516 	TIEXPORT2 VarEntry**	TICALL tifiles_ve_resize_array(VarEntry**, unsigned int nelts);
517 	TIEXPORT2 void		TICALL tifiles_ve_delete_array(VarEntry**);
518 
519 	TIEXPORT2 FlashPage*	TICALL tifiles_fp_create(void);
520 	TIEXPORT2 FlashPage*	TICALL tifiles_fp_create_alloc_data(uint32_t size);
521 	TIEXPORT2 FlashPage*	TICALL tifiles_fp_create_with_data2(uint32_t size, uint8_t * data);
522 	TIEXPORT2 void		TICALL tifiles_fp_delete(FlashPage*);
523 
524 	TIEXPORT2 void*		TICALL tifiles_fp_alloc_data(size_t size);
525 	TIEXPORT2 FlashPage*	TICALL tifiles_fp_realloc_data(FlashPage* fp, size_t size);
526 	TIEXPORT2 void		TICALL tifiles_fp_free_data(void * data);
527 
528 	TIEXPORT2 FlashPage**	TICALL tifiles_fp_create_array(unsigned int nelts);
529 	TIEXPORT2 FlashPage**	TICALL tifiles_fp_resize_array(FlashPage**, unsigned int nelts);
530 	TIEXPORT2 void		TICALL tifiles_fp_delete_array(FlashPage**);
531 
532 	// cert.c
533 	TIEXPORT2 int TICALL tifiles_cert_field_get(const uint8_t *data, uint32_t length, uint16_t *field_type, const uint8_t **contents, uint32_t *field_size);
534 	TIEXPORT2 int TICALL tifiles_cert_field_next(const uint8_t **data, uint32_t *length);
535 	TIEXPORT2 int TICALL tifiles_cert_field_find(const uint8_t *data, uint32_t length, uint16_t field_type, const uint8_t **contents, uint32_t *field_size);
536 	TIEXPORT2 int TICALL tifiles_cert_field_find_path(const uint8_t *data, uint32_t length, const uint16_t *field_path, uint16_t field_path_len, const uint8_t **contents, uint32_t *field_size);
537 
538 	// undocumented
539 	TIEXPORT2 int** tifiles_create_table_of_entries(FileContent *content, unsigned int *nfolders);
540 	TIEXPORT2 void tifiles_free_table_of_entries(int ** table);
541 
542 	/************************/
543 	/* Deprecated functions */
544 	/************************/
545 
546 	TILIBS_DEPRECATED TIEXPORT2 VarEntry*	TICALL tifiles_ve_create_with_data(uint32_t size);
547 	TILIBS_DEPRECATED TIEXPORT2 FlashPage*	TICALL tifiles_fp_create_with_data(uint32_t size);
548 
549 #ifdef __cplusplus
550 }
551 #endif
552 
553 #endif
554