xref: /aoo42x/main/sal/inc/osl/pipe.h (revision 9eab2a37)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 
25 #ifndef _OSL_PIPE_H_
26 #define _OSL_PIPE_H_
27 
28 #	include <rtl/ustring.h>
29 
30 
31 #	include <osl/security.h>
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 typedef enum {
38 	osl_Pipe_E_None,				/* no error */
39 	osl_Pipe_E_NotFound,	 		/* Pipe could not be found */
40 	osl_Pipe_E_AlreadyExists,	 	/* Pipe already exists */
41 	osl_Pipe_E_NoProtocol,			/* Protocol not available */
42 	osl_Pipe_E_NetworkReset,		/* Network dropped connection because of reset */
43 	osl_Pipe_E_ConnectionAbort,		/* Software caused connection abort */
44 	osl_Pipe_E_ConnectionReset,		/* Connection reset by peer */
45 	osl_Pipe_E_NoBufferSpace,		/* No buffer space available */
46 	osl_Pipe_E_TimedOut,			/* Connection timed out */
47 	osl_Pipe_E_ConnectionRefused,	/* Connection refused */
48 	osl_Pipe_E_invalidError,		/* unmapped error: always last entry in enum! */
49 	osl_Pipe_E_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
50 } oslPipeError;
51 
52 typedef sal_uInt32 oslPipeOptions;
53 #define	osl_Pipe_OPEN        0x0000  	/* open existing pipe */
54 #define	osl_Pipe_CREATE      0x0001     /* create pipe and open it, fails if already existst */
55 
56 typedef struct oslPipeImpl * oslPipe;
57 
58 /**
59  */
60 oslPipe SAL_CALL osl_createPipe(rtl_uString *strPipeName, oslPipeOptions Options, oslSecurity Security);
61 
62 /** decreases the refcount of the pipe.
63 	If the refcount drops to zero, the handle is destroyed.
64  */
65 void    SAL_CALL osl_releasePipe( oslPipe );
66 
67 /** increases the refcount of the pipe.
68  */
69 void 	SAL_CALL osl_acquirePipe( oslPipe Pipe );
70 
71 /** closes the pipe, any read,write or accept actions stop immeadiatly.
72  */
73 void 	SAL_CALL osl_closePipe( oslPipe );
74 
75 
76 oslPipe SAL_CALL osl_acceptPipe(oslPipe Pipe);
77 
78 sal_Int32 SAL_CALL osl_sendPipe(oslPipe Pipe, const void* pBuffer, sal_Int32 BufferSize);
79 sal_Int32 SAL_CALL osl_receivePipe(oslPipe Pipe, void* pBuffer, sal_Int32 BufferSize);
80 
81 /** Reads blocking from the pipe.
82 	@return Number of read bytes. If less than BufferSize, the pipe was closed.
83  */
84 sal_Int32 SAL_CALL osl_readPipe( oslPipe Pipe, void *pBuffer, sal_Int32 BufferSize );
85 
86 /** Writes blocking onto the pipe.
87 	@return Number of written bytes. If less than BufferSize, the pipe was closed.
88  */
89 sal_Int32 SAL_CALL osl_writePipe( oslPipe Pipe, const void *pBuffer, sal_Int32 BufferSize );
90 
91 oslPipeError SAL_CALL osl_getLastPipeError(oslPipe Pipe);
92 
93 #ifdef __cplusplus
94 }
95 #endif
96 
97 #endif	/* _OSL_PIPE_H_ */
98 
99