xref: /titanic_52/usr/src/cmd/cdrw/bstream.h (revision e98fafb9956429b59c817d4fbd27720c73879203)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_BSTREAM_H
27 #define	_BSTREAM_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #ifdef	__cplusplus
32 extern "C" {
33 #endif
34 
35 #include <sys/types.h>
36 
37 struct _bstr_hndl {
38 	int bstr_fd;
39 	int (*bstr_read)(struct _bstr_hndl *h, uchar_t *buf, off_t size);
40 	int (*bstr_write)(struct _bstr_hndl *h, uchar_t *buf, off_t size);
41 	int (*bstr_close)(struct _bstr_hndl *h);
42 	int (*bstr_size)(struct _bstr_hndl *h, off_t *size);
43 	void (*bstr_rewind)(struct _bstr_hndl *h);
44 	void *bstr_private;
45 };
46 typedef struct _bstr_hndl *bstreamhandle;
47 
48 extern int str_errno;
49 /*
50  * str_errno values
51  */
52 #define	STR_ERR_NO_ERR			0
53 #define	STR_ERR_NO_REG_FILE		1
54 #define	STR_ERR_NO_READ_STDIN		2
55 #define	STR_ERR_AU_READ_ERR		3
56 #define	STR_ERR_AU_UNSUPPORTED_FORMAT	4
57 #define	STR_ERR_AU_BAD_HEADER		5
58 #define	STR_ERR_WAV_READ_ERR		6
59 #define	STR_ERR_WAV_UNSUPPORTED_FORMAT	7
60 #define	STR_ERR_WAV_BAD_HEADER		8
61 #define	STR_ERR_ISO_BAD_HEADER		9
62 #define	STR_ERR_ISO_READ_ERR		10
63 
64 /*
65  * Constants for the ISO 9660 standard
66  */
67 #define	ISO9660_HEADER_SIZE		34816
68 #define	ISO9660_BOOT_BLOCK_SIZE		32768
69 #define	ISO9660_PRIMARY_DESC_SIZE	2048
70 #define	ISO9660_STD_IDENT_OFFSET	1
71 
72 bstreamhandle open_stdin_read_stream();
73 bstreamhandle open_file_read_stream(char *file);
74 bstreamhandle open_iso_read_stream(char *fname);
75 bstreamhandle open_au_read_stream(char *fname);
76 bstreamhandle open_wav_read_stream(char *fname);
77 bstreamhandle open_aur_read_stream(char *fname);
78 bstreamhandle open_au_write_stream(char *fname);
79 bstreamhandle open_wav_write_stream(char *fname);
80 bstreamhandle open_aur_write_stream(char *fname);
81 bstreamhandle open_file_write_stream(char *fname);
82 bstreamhandle open_temp_file_stream(void);
83 
84 char *str_errno_to_string(int serrno);
85 int check_avail_temp_space(size_t req_size);
86 char *get_tmp_name(void);
87 
88 #ifdef	__cplusplus
89 }
90 #endif
91 
92 #endif /* _BSTREAM_H */
93