xref: /illumos-gate/usr/src/cmd/cdrw/bstream.h (revision 2a8bcb4e)
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 #ifdef	__cplusplus
30 extern "C" {
31 #endif
32 
33 #include <sys/types.h>
34 
35 struct _bstr_hndl {
36 	int bstr_fd;
37 	int (*bstr_read)(struct _bstr_hndl *h, uchar_t *buf, off_t size);
38 	int (*bstr_write)(struct _bstr_hndl *h, uchar_t *buf, off_t size);
39 	int (*bstr_close)(struct _bstr_hndl *h);
40 	int (*bstr_size)(struct _bstr_hndl *h, off_t *size);
41 	void (*bstr_rewind)(struct _bstr_hndl *h);
42 	void *bstr_private;
43 };
44 typedef struct _bstr_hndl *bstreamhandle;
45 
46 extern int str_errno;
47 /*
48  * str_errno values
49  */
50 #define	STR_ERR_NO_ERR			0
51 #define	STR_ERR_NO_REG_FILE		1
52 #define	STR_ERR_NO_READ_STDIN		2
53 #define	STR_ERR_AU_READ_ERR		3
54 #define	STR_ERR_AU_UNSUPPORTED_FORMAT	4
55 #define	STR_ERR_AU_BAD_HEADER		5
56 #define	STR_ERR_WAV_READ_ERR		6
57 #define	STR_ERR_WAV_UNSUPPORTED_FORMAT	7
58 #define	STR_ERR_WAV_BAD_HEADER		8
59 #define	STR_ERR_ISO_BAD_HEADER		9
60 #define	STR_ERR_ISO_READ_ERR		10
61 
62 /*
63  * Constants for the ISO 9660 standard
64  */
65 #define	ISO9660_HEADER_SIZE		34816
66 #define	ISO9660_BOOT_BLOCK_SIZE		32768
67 #define	ISO9660_PRIMARY_DESC_SIZE	2048
68 #define	ISO9660_STD_IDENT_OFFSET	1
69 
70 bstreamhandle open_stdin_read_stream();
71 bstreamhandle open_file_read_stream(char *file);
72 bstreamhandle open_iso_read_stream(char *fname);
73 bstreamhandle open_au_read_stream(char *fname);
74 bstreamhandle open_wav_read_stream(char *fname);
75 bstreamhandle open_aur_read_stream(char *fname);
76 bstreamhandle open_au_write_stream(char *fname);
77 bstreamhandle open_wav_write_stream(char *fname);
78 bstreamhandle open_aur_write_stream(char *fname);
79 bstreamhandle open_file_write_stream(char *fname);
80 bstreamhandle open_temp_file_stream(void);
81 
82 char *str_errno_to_string(int serrno);
83 int check_avail_temp_space(size_t req_size);
84 char *get_tmp_name(void);
85 
86 #ifdef	__cplusplus
87 }
88 #endif
89 
90 #endif /* _BSTREAM_H */
91