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