xref: /freebsd/contrib/file/src/cdf.h (revision b6cee71de37d56e36dbc118e2d9b03e7cece5709)
1*b6cee71dSXin LI /*-
2*b6cee71dSXin LI  * Copyright (c) 2008 Christos Zoulas
3*b6cee71dSXin LI  * All rights reserved.
4*b6cee71dSXin LI  *
5*b6cee71dSXin LI  * Redistribution and use in source and binary forms, with or without
6*b6cee71dSXin LI  * modification, are permitted provided that the following conditions
7*b6cee71dSXin LI  * are met:
8*b6cee71dSXin LI  * 1. Redistributions of source code must retain the above copyright
9*b6cee71dSXin LI  *    notice, this list of conditions and the following disclaimer.
10*b6cee71dSXin LI  * 2. Redistributions in binary form must reproduce the above copyright
11*b6cee71dSXin LI  *    notice, this list of conditions and the following disclaimer in the
12*b6cee71dSXin LI  *    documentation and/or other materials provided with the distribution.
13*b6cee71dSXin LI  *
14*b6cee71dSXin LI  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
15*b6cee71dSXin LI  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
16*b6cee71dSXin LI  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17*b6cee71dSXin LI  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
18*b6cee71dSXin LI  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19*b6cee71dSXin LI  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20*b6cee71dSXin LI  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21*b6cee71dSXin LI  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22*b6cee71dSXin LI  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23*b6cee71dSXin LI  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24*b6cee71dSXin LI  * POSSIBILITY OF SUCH DAMAGE.
25*b6cee71dSXin LI  */
26*b6cee71dSXin LI /*
27*b6cee71dSXin LI  * Parse Composite Document Files, the format used in Microsoft Office
28*b6cee71dSXin LI  * document files before they switched to zipped XML.
29*b6cee71dSXin LI  * Info from: http://sc.openoffice.org/compdocfileformat.pdf
30*b6cee71dSXin LI  *
31*b6cee71dSXin LI  * N.B. This is the "Composite Document File" format, and not the
32*b6cee71dSXin LI  * "Compound Document Format", nor the "Channel Definition Format".
33*b6cee71dSXin LI  */
34*b6cee71dSXin LI 
35*b6cee71dSXin LI #ifndef _H_CDF_
36*b6cee71dSXin LI #define _H_CDF_
37*b6cee71dSXin LI 
38*b6cee71dSXin LI #ifdef WIN32
39*b6cee71dSXin LI #include <winsock2.h>
40*b6cee71dSXin LI #define timespec timeval
41*b6cee71dSXin LI #define tv_nsec tv_usec
42*b6cee71dSXin LI #endif
43*b6cee71dSXin LI #ifdef __DJGPP__
44*b6cee71dSXin LI #define timespec timeval
45*b6cee71dSXin LI #define tv_nsec tv_usec
46*b6cee71dSXin LI #endif
47*b6cee71dSXin LI 
48*b6cee71dSXin LI typedef int32_t cdf_secid_t;
49*b6cee71dSXin LI 
50*b6cee71dSXin LI #define CDF_LOOP_LIMIT					10000
51*b6cee71dSXin LI 
52*b6cee71dSXin LI #define CDF_SECID_NULL					0
53*b6cee71dSXin LI #define CDF_SECID_FREE					-1
54*b6cee71dSXin LI #define CDF_SECID_END_OF_CHAIN				-2
55*b6cee71dSXin LI #define CDF_SECID_SECTOR_ALLOCATION_TABLE		-3
56*b6cee71dSXin LI #define CDF_SECID_MASTER_SECTOR_ALLOCATION_TABLE	-4
57*b6cee71dSXin LI 
58*b6cee71dSXin LI typedef struct {
59*b6cee71dSXin LI 	uint64_t	h_magic;
60*b6cee71dSXin LI #define CDF_MAGIC	0xE11AB1A1E011CFD0LL
61*b6cee71dSXin LI 	uint64_t	h_uuid[2];
62*b6cee71dSXin LI 	uint16_t	h_revision;
63*b6cee71dSXin LI 	uint16_t	h_version;
64*b6cee71dSXin LI 	uint16_t	h_byte_order;
65*b6cee71dSXin LI 	uint16_t	h_sec_size_p2;
66*b6cee71dSXin LI 	uint16_t	h_short_sec_size_p2;
67*b6cee71dSXin LI 	uint8_t		h_unused0[10];
68*b6cee71dSXin LI 	uint32_t	h_num_sectors_in_sat;
69*b6cee71dSXin LI 	uint32_t	h_secid_first_directory;
70*b6cee71dSXin LI 	uint8_t		h_unused1[4];
71*b6cee71dSXin LI 	uint32_t	h_min_size_standard_stream;
72*b6cee71dSXin LI 	cdf_secid_t	h_secid_first_sector_in_short_sat;
73*b6cee71dSXin LI 	uint32_t	h_num_sectors_in_short_sat;
74*b6cee71dSXin LI 	cdf_secid_t	h_secid_first_sector_in_master_sat;
75*b6cee71dSXin LI 	uint32_t	h_num_sectors_in_master_sat;
76*b6cee71dSXin LI 	cdf_secid_t	h_master_sat[436/4];
77*b6cee71dSXin LI } cdf_header_t;
78*b6cee71dSXin LI 
79*b6cee71dSXin LI #define CDF_SEC_SIZE(h) ((size_t)(1 << (h)->h_sec_size_p2))
80*b6cee71dSXin LI #define CDF_SEC_POS(h, secid) (CDF_SEC_SIZE(h) + (secid) * CDF_SEC_SIZE(h))
81*b6cee71dSXin LI #define CDF_SHORT_SEC_SIZE(h)	((size_t)(1 << (h)->h_short_sec_size_p2))
82*b6cee71dSXin LI #define CDF_SHORT_SEC_POS(h, secid) ((secid) * CDF_SHORT_SEC_SIZE(h))
83*b6cee71dSXin LI 
84*b6cee71dSXin LI typedef int32_t cdf_dirid_t;
85*b6cee71dSXin LI #define CDF_DIRID_NULL	-1
86*b6cee71dSXin LI 
87*b6cee71dSXin LI typedef int64_t cdf_timestamp_t;
88*b6cee71dSXin LI #define CDF_BASE_YEAR	1601
89*b6cee71dSXin LI #define CDF_TIME_PREC	10000000
90*b6cee71dSXin LI 
91*b6cee71dSXin LI typedef struct {
92*b6cee71dSXin LI 	uint16_t	d_name[32];
93*b6cee71dSXin LI 	uint16_t	d_namelen;
94*b6cee71dSXin LI 	uint8_t		d_type;
95*b6cee71dSXin LI #define CDF_DIR_TYPE_EMPTY		0
96*b6cee71dSXin LI #define CDF_DIR_TYPE_USER_STORAGE	1
97*b6cee71dSXin LI #define CDF_DIR_TYPE_USER_STREAM	2
98*b6cee71dSXin LI #define CDF_DIR_TYPE_LOCKBYTES		3
99*b6cee71dSXin LI #define CDF_DIR_TYPE_PROPERTY		4
100*b6cee71dSXin LI #define CDF_DIR_TYPE_ROOT_STORAGE	5
101*b6cee71dSXin LI 	uint8_t		d_color;
102*b6cee71dSXin LI #define CDF_DIR_COLOR_READ	0
103*b6cee71dSXin LI #define CDF_DIR_COLOR_BLACK	1
104*b6cee71dSXin LI 	cdf_dirid_t	d_left_child;
105*b6cee71dSXin LI 	cdf_dirid_t	d_right_child;
106*b6cee71dSXin LI 	cdf_dirid_t	d_storage;
107*b6cee71dSXin LI 	uint64_t	d_storage_uuid[2];
108*b6cee71dSXin LI 	uint32_t	d_flags;
109*b6cee71dSXin LI 	cdf_timestamp_t d_created;
110*b6cee71dSXin LI 	cdf_timestamp_t d_modified;
111*b6cee71dSXin LI 	cdf_secid_t	d_stream_first_sector;
112*b6cee71dSXin LI 	uint32_t	d_size;
113*b6cee71dSXin LI 	uint32_t	d_unused0;
114*b6cee71dSXin LI } cdf_directory_t;
115*b6cee71dSXin LI 
116*b6cee71dSXin LI #define CDF_DIRECTORY_SIZE	128
117*b6cee71dSXin LI 
118*b6cee71dSXin LI typedef struct {
119*b6cee71dSXin LI 	cdf_secid_t *sat_tab;
120*b6cee71dSXin LI 	size_t sat_len;
121*b6cee71dSXin LI } cdf_sat_t;
122*b6cee71dSXin LI 
123*b6cee71dSXin LI typedef struct {
124*b6cee71dSXin LI 	cdf_directory_t *dir_tab;
125*b6cee71dSXin LI 	size_t dir_len;
126*b6cee71dSXin LI } cdf_dir_t;
127*b6cee71dSXin LI 
128*b6cee71dSXin LI typedef struct {
129*b6cee71dSXin LI 	void *sst_tab;
130*b6cee71dSXin LI 	size_t sst_len;
131*b6cee71dSXin LI 	size_t sst_dirlen;
132*b6cee71dSXin LI } cdf_stream_t;
133*b6cee71dSXin LI 
134*b6cee71dSXin LI typedef struct {
135*b6cee71dSXin LI 	uint32_t	cl_dword;
136*b6cee71dSXin LI 	uint16_t	cl_word[2];
137*b6cee71dSXin LI 	uint8_t		cl_two[2];
138*b6cee71dSXin LI 	uint8_t		cl_six[6];
139*b6cee71dSXin LI } cdf_classid_t;
140*b6cee71dSXin LI 
141*b6cee71dSXin LI typedef struct {
142*b6cee71dSXin LI 	uint16_t	si_byte_order;
143*b6cee71dSXin LI 	uint16_t	si_zero;
144*b6cee71dSXin LI 	uint16_t	si_os_version;
145*b6cee71dSXin LI 	uint16_t	si_os;
146*b6cee71dSXin LI 	cdf_classid_t	si_class;
147*b6cee71dSXin LI 	uint32_t	si_count;
148*b6cee71dSXin LI } cdf_summary_info_header_t;
149*b6cee71dSXin LI 
150*b6cee71dSXin LI #define CDF_SECTION_DECLARATION_OFFSET 0x1c
151*b6cee71dSXin LI 
152*b6cee71dSXin LI typedef struct {
153*b6cee71dSXin LI 	cdf_classid_t	sd_class;
154*b6cee71dSXin LI 	uint32_t	sd_offset;
155*b6cee71dSXin LI } cdf_section_declaration_t;
156*b6cee71dSXin LI 
157*b6cee71dSXin LI typedef struct {
158*b6cee71dSXin LI 	uint32_t	sh_len;
159*b6cee71dSXin LI 	uint32_t	sh_properties;
160*b6cee71dSXin LI } cdf_section_header_t;
161*b6cee71dSXin LI 
162*b6cee71dSXin LI typedef struct {
163*b6cee71dSXin LI 	uint32_t	pi_id;
164*b6cee71dSXin LI 	uint32_t	pi_type;
165*b6cee71dSXin LI 	union {
166*b6cee71dSXin LI 		uint16_t	_pi_u16;
167*b6cee71dSXin LI 		int16_t		_pi_s16;
168*b6cee71dSXin LI 		uint32_t	_pi_u32;
169*b6cee71dSXin LI 		int32_t		_pi_s32;
170*b6cee71dSXin LI 		uint64_t	_pi_u64;
171*b6cee71dSXin LI 		int64_t		_pi_s64;
172*b6cee71dSXin LI 		cdf_timestamp_t _pi_tp;
173*b6cee71dSXin LI 		float		_pi_f;
174*b6cee71dSXin LI 		double		_pi_d;
175*b6cee71dSXin LI 		struct {
176*b6cee71dSXin LI 			uint32_t s_len;
177*b6cee71dSXin LI 			const char *s_buf;
178*b6cee71dSXin LI 		} _pi_str;
179*b6cee71dSXin LI 	} pi_val;
180*b6cee71dSXin LI #define pi_u64	pi_val._pi_u64
181*b6cee71dSXin LI #define pi_s64	pi_val._pi_s64
182*b6cee71dSXin LI #define pi_u32	pi_val._pi_u32
183*b6cee71dSXin LI #define pi_s32	pi_val._pi_s32
184*b6cee71dSXin LI #define pi_u16	pi_val._pi_u16
185*b6cee71dSXin LI #define pi_s16	pi_val._pi_s16
186*b6cee71dSXin LI #define pi_f	pi_val._pi_f
187*b6cee71dSXin LI #define pi_d	pi_val._pi_d
188*b6cee71dSXin LI #define pi_tp	pi_val._pi_tp
189*b6cee71dSXin LI #define pi_str	pi_val._pi_str
190*b6cee71dSXin LI } cdf_property_info_t;
191*b6cee71dSXin LI 
192*b6cee71dSXin LI #define CDF_ROUND(val, by)     (((val) + (by) - 1) & ~((by) - 1))
193*b6cee71dSXin LI 
194*b6cee71dSXin LI /* Variant type definitions */
195*b6cee71dSXin LI #define CDF_EMPTY		0x00000000
196*b6cee71dSXin LI #define CDF_NULL		0x00000001
197*b6cee71dSXin LI #define CDF_SIGNED16		0x00000002
198*b6cee71dSXin LI #define CDF_SIGNED32		0x00000003
199*b6cee71dSXin LI #define CDF_FLOAT		0x00000004
200*b6cee71dSXin LI #define CDF_DOUBLE		0x00000005
201*b6cee71dSXin LI #define CDF_CY			0x00000006
202*b6cee71dSXin LI #define CDF_DATE		0x00000007
203*b6cee71dSXin LI #define CDF_BSTR		0x00000008
204*b6cee71dSXin LI #define CDF_DISPATCH		0x00000009
205*b6cee71dSXin LI #define CDF_ERROR		0x0000000a
206*b6cee71dSXin LI #define CDF_BOOL		0x0000000b
207*b6cee71dSXin LI #define CDF_VARIANT		0x0000000c
208*b6cee71dSXin LI #define CDF_UNKNOWN		0x0000000d
209*b6cee71dSXin LI #define CDF_DECIMAL		0x0000000e
210*b6cee71dSXin LI #define CDF_SIGNED8		0x00000010
211*b6cee71dSXin LI #define CDF_UNSIGNED8		0x00000011
212*b6cee71dSXin LI #define CDF_UNSIGNED16		0x00000012
213*b6cee71dSXin LI #define CDF_UNSIGNED32		0x00000013
214*b6cee71dSXin LI #define CDF_SIGNED64		0x00000014
215*b6cee71dSXin LI #define CDF_UNSIGNED64		0x00000015
216*b6cee71dSXin LI #define CDF_INT			0x00000016
217*b6cee71dSXin LI #define CDF_UINT		0x00000017
218*b6cee71dSXin LI #define CDF_VOID		0x00000018
219*b6cee71dSXin LI #define CDF_HRESULT		0x00000019
220*b6cee71dSXin LI #define CDF_PTR			0x0000001a
221*b6cee71dSXin LI #define CDF_SAFEARRAY		0x0000001b
222*b6cee71dSXin LI #define CDF_CARRAY		0x0000001c
223*b6cee71dSXin LI #define CDF_USERDEFINED		0x0000001d
224*b6cee71dSXin LI #define CDF_LENGTH32_STRING	0x0000001e
225*b6cee71dSXin LI #define CDF_LENGTH32_WSTRING	0x0000001f
226*b6cee71dSXin LI #define CDF_FILETIME		0x00000040
227*b6cee71dSXin LI #define CDF_BLOB		0x00000041
228*b6cee71dSXin LI #define CDF_STREAM		0x00000042
229*b6cee71dSXin LI #define CDF_STORAGE		0x00000043
230*b6cee71dSXin LI #define CDF_STREAMED_OBJECT	0x00000044
231*b6cee71dSXin LI #define CDF_STORED_OBJECT	0x00000045
232*b6cee71dSXin LI #define CDF_BLOB_OBJECT		0x00000046
233*b6cee71dSXin LI #define CDF_CLIPBOARD		0x00000047
234*b6cee71dSXin LI #define CDF_CLSID		0x00000048
235*b6cee71dSXin LI #define CDF_VECTOR		0x00001000
236*b6cee71dSXin LI #define CDF_ARRAY		0x00002000
237*b6cee71dSXin LI #define CDF_BYREF		0x00004000
238*b6cee71dSXin LI #define CDF_RESERVED		0x00008000
239*b6cee71dSXin LI #define CDF_ILLEGAL		0x0000ffff
240*b6cee71dSXin LI #define CDF_ILLEGALMASKED	0x00000fff
241*b6cee71dSXin LI #define CDF_TYPEMASK		0x00000fff
242*b6cee71dSXin LI 
243*b6cee71dSXin LI #define CDF_PROPERTY_CODE_PAGE			0x00000001
244*b6cee71dSXin LI #define CDF_PROPERTY_TITLE			0x00000002
245*b6cee71dSXin LI #define CDF_PROPERTY_SUBJECT			0x00000003
246*b6cee71dSXin LI #define CDF_PROPERTY_AUTHOR			0x00000004
247*b6cee71dSXin LI #define CDF_PROPERTY_KEYWORDS			0x00000005
248*b6cee71dSXin LI #define CDF_PROPERTY_COMMENTS			0x00000006
249*b6cee71dSXin LI #define CDF_PROPERTY_TEMPLATE			0x00000007
250*b6cee71dSXin LI #define CDF_PROPERTY_LAST_SAVED_BY		0x00000008
251*b6cee71dSXin LI #define CDF_PROPERTY_REVISION_NUMBER		0x00000009
252*b6cee71dSXin LI #define CDF_PROPERTY_TOTAL_EDITING_TIME		0x0000000a
253*b6cee71dSXin LI #define CDF_PROPERTY_LAST_PRINTED		0X0000000b
254*b6cee71dSXin LI #define CDF_PROPERTY_CREATE_TIME		0x0000000c
255*b6cee71dSXin LI #define CDF_PROPERTY_LAST_SAVED_TIME		0x0000000d
256*b6cee71dSXin LI #define CDF_PROPERTY_NUMBER_OF_PAGES		0x0000000e
257*b6cee71dSXin LI #define CDF_PROPERTY_NUMBER_OF_WORDS		0x0000000f
258*b6cee71dSXin LI #define CDF_PROPERTY_NUMBER_OF_CHARACTERS	0x00000010
259*b6cee71dSXin LI #define CDF_PROPERTY_THUMBNAIL			0x00000011
260*b6cee71dSXin LI #define CDF_PROPERTY_NAME_OF_APPLICATION	0x00000012
261*b6cee71dSXin LI #define CDF_PROPERTY_SECURITY			0x00000013
262*b6cee71dSXin LI #define CDF_PROPERTY_LOCALE_ID			0x80000000
263*b6cee71dSXin LI 
264*b6cee71dSXin LI typedef struct {
265*b6cee71dSXin LI 	int i_fd;
266*b6cee71dSXin LI 	const unsigned char *i_buf;
267*b6cee71dSXin LI 	size_t i_len;
268*b6cee71dSXin LI } cdf_info_t;
269*b6cee71dSXin LI 
270*b6cee71dSXin LI struct timespec;
271*b6cee71dSXin LI int cdf_timestamp_to_timespec(struct timespec *, cdf_timestamp_t);
272*b6cee71dSXin LI int cdf_timespec_to_timestamp(cdf_timestamp_t *, const struct timespec *);
273*b6cee71dSXin LI int cdf_read_header(const cdf_info_t *, cdf_header_t *);
274*b6cee71dSXin LI void cdf_swap_header(cdf_header_t *);
275*b6cee71dSXin LI void cdf_unpack_header(cdf_header_t *, char *);
276*b6cee71dSXin LI void cdf_swap_dir(cdf_directory_t *);
277*b6cee71dSXin LI void cdf_unpack_dir(cdf_directory_t *, char *);
278*b6cee71dSXin LI void cdf_swap_class(cdf_classid_t *);
279*b6cee71dSXin LI ssize_t cdf_read_sector(const cdf_info_t *, void *, size_t, size_t,
280*b6cee71dSXin LI     const cdf_header_t *, cdf_secid_t);
281*b6cee71dSXin LI ssize_t cdf_read_short_sector(const cdf_stream_t *, void *, size_t, size_t,
282*b6cee71dSXin LI     const cdf_header_t *, cdf_secid_t);
283*b6cee71dSXin LI int cdf_read_sat(const cdf_info_t *, cdf_header_t *, cdf_sat_t *);
284*b6cee71dSXin LI size_t cdf_count_chain(const cdf_sat_t *, cdf_secid_t, size_t);
285*b6cee71dSXin LI int cdf_read_long_sector_chain(const cdf_info_t *, const cdf_header_t *,
286*b6cee71dSXin LI     const cdf_sat_t *, cdf_secid_t, size_t, cdf_stream_t *);
287*b6cee71dSXin LI int cdf_read_short_sector_chain(const cdf_header_t *, const cdf_sat_t *,
288*b6cee71dSXin LI     const cdf_stream_t *, cdf_secid_t, size_t, cdf_stream_t *);
289*b6cee71dSXin LI int cdf_read_sector_chain(const cdf_info_t *, const cdf_header_t *,
290*b6cee71dSXin LI     const cdf_sat_t *, const cdf_sat_t *, const cdf_stream_t *, cdf_secid_t,
291*b6cee71dSXin LI     size_t, cdf_stream_t *);
292*b6cee71dSXin LI int cdf_read_dir(const cdf_info_t *, const cdf_header_t *, const cdf_sat_t *,
293*b6cee71dSXin LI     cdf_dir_t *);
294*b6cee71dSXin LI int cdf_read_ssat(const cdf_info_t *, const cdf_header_t *, const cdf_sat_t *,
295*b6cee71dSXin LI     cdf_sat_t *);
296*b6cee71dSXin LI int cdf_read_short_stream(const cdf_info_t *, const cdf_header_t *,
297*b6cee71dSXin LI     const cdf_sat_t *, const cdf_dir_t *, cdf_stream_t *,
298*b6cee71dSXin LI     const cdf_directory_t **);
299*b6cee71dSXin LI int cdf_read_property_info(const cdf_stream_t *, const cdf_header_t *, uint32_t,
300*b6cee71dSXin LI     cdf_property_info_t **, size_t *, size_t *);
301*b6cee71dSXin LI int cdf_read_user_stream(const cdf_info_t *, const cdf_header_t *,
302*b6cee71dSXin LI     const cdf_sat_t *, const cdf_sat_t *, const cdf_stream_t *,
303*b6cee71dSXin LI     const cdf_dir_t *, const char *, cdf_stream_t *);
304*b6cee71dSXin LI int cdf_read_summary_info(const cdf_info_t *, const cdf_header_t *,
305*b6cee71dSXin LI     const cdf_sat_t *, const cdf_sat_t *, const cdf_stream_t *,
306*b6cee71dSXin LI     const cdf_dir_t *, cdf_stream_t *);
307*b6cee71dSXin LI int cdf_unpack_summary_info(const cdf_stream_t *, const cdf_header_t *,
308*b6cee71dSXin LI     cdf_summary_info_header_t *, cdf_property_info_t **, size_t *);
309*b6cee71dSXin LI int cdf_print_classid(char *, size_t, const cdf_classid_t *);
310*b6cee71dSXin LI int cdf_print_property_name(char *, size_t, uint32_t);
311*b6cee71dSXin LI int cdf_print_elapsed_time(char *, size_t, cdf_timestamp_t);
312*b6cee71dSXin LI uint16_t cdf_tole2(uint16_t);
313*b6cee71dSXin LI uint32_t cdf_tole4(uint32_t);
314*b6cee71dSXin LI uint64_t cdf_tole8(uint64_t);
315*b6cee71dSXin LI char *cdf_ctime(const time_t *, char *);
316*b6cee71dSXin LI 
317*b6cee71dSXin LI #ifdef CDF_DEBUG
318*b6cee71dSXin LI void cdf_dump_header(const cdf_header_t *);
319*b6cee71dSXin LI void cdf_dump_sat(const char *, const cdf_sat_t *, size_t);
320*b6cee71dSXin LI void cdf_dump(void *, size_t);
321*b6cee71dSXin LI void cdf_dump_stream(const cdf_header_t *, const cdf_stream_t *);
322*b6cee71dSXin LI void cdf_dump_dir(const cdf_info_t *, const cdf_header_t *, const cdf_sat_t *,
323*b6cee71dSXin LI     const cdf_sat_t *, const cdf_stream_t *, const cdf_dir_t *);
324*b6cee71dSXin LI void cdf_dump_property_info(const cdf_property_info_t *, size_t);
325*b6cee71dSXin LI void cdf_dump_summary_info(const cdf_header_t *, const cdf_stream_t *);
326*b6cee71dSXin LI #endif
327*b6cee71dSXin LI 
328*b6cee71dSXin LI 
329*b6cee71dSXin LI #endif /* _H_CDF_ */
330