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