xref: /trunk/main/sal/inc/osl/pipe.h (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 
29 #ifndef _OSL_PIPE_H_
30 #define _OSL_PIPE_H_
31 
32 #   include <rtl/ustring.h>
33 
34 
35 #   include <osl/security.h>
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 typedef enum {
42     osl_Pipe_E_None,                /* no error */
43     osl_Pipe_E_NotFound,            /* Pipe could not be found */
44     osl_Pipe_E_AlreadyExists,       /* Pipe already exists */
45     osl_Pipe_E_NoProtocol,          /* Protocol not available */
46     osl_Pipe_E_NetworkReset,        /* Network dropped connection because of reset */
47     osl_Pipe_E_ConnectionAbort,     /* Software caused connection abort */
48     osl_Pipe_E_ConnectionReset,     /* Connection reset by peer */
49     osl_Pipe_E_NoBufferSpace,       /* No buffer space available */
50     osl_Pipe_E_TimedOut,            /* Connection timed out */
51     osl_Pipe_E_ConnectionRefused,   /* Connection refused */
52     osl_Pipe_E_invalidError,        /* unmapped error: always last entry in enum! */
53     osl_Pipe_E_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
54 } oslPipeError;
55 
56 typedef sal_uInt32 oslPipeOptions;
57 #define osl_Pipe_OPEN        0x0000     /* open existing pipe */
58 #define osl_Pipe_CREATE      0x0001     /* create pipe and open it, fails if already existst */
59 
60 typedef struct oslPipeImpl * oslPipe;
61 
62 /**
63  */
64 oslPipe SAL_CALL osl_createPipe(rtl_uString *strPipeName, oslPipeOptions Options, oslSecurity Security);
65 
66 /** decreases the refcount of the pipe.
67     If the refcount drops to zero, the handle is destroyed.
68  */
69 void    SAL_CALL osl_releasePipe( oslPipe );
70 
71 /** increases the refcount of the pipe.
72  */
73 void    SAL_CALL osl_acquirePipe( oslPipe Pipe );
74 
75 /** closes the pipe, any read,write or accept actions stop immeadiatly.
76  */
77 void    SAL_CALL osl_closePipe( oslPipe );
78 
79 
80 oslPipe SAL_CALL osl_acceptPipe(oslPipe Pipe);
81 
82 sal_Int32 SAL_CALL osl_sendPipe(oslPipe Pipe, const void* pBuffer, sal_Int32 BufferSize);
83 sal_Int32 SAL_CALL osl_receivePipe(oslPipe Pipe, void* pBuffer, sal_Int32 BufferSize);
84 
85 /** Reads blocking from the pipe.
86     @return Number of read bytes. If less than BufferSize, the pipe was closed.
87  */
88 sal_Int32 SAL_CALL osl_readPipe( oslPipe Pipe, void *pBuffer, sal_Int32 BufferSize );
89 
90 /** Writes blocking onto the pipe.
91     @return Number of written bytes. If less than BufferSize, the pipe was closed.
92  */
93 sal_Int32 SAL_CALL osl_writePipe( oslPipe Pipe, const void *pBuffer, sal_Int32 BufferSize );
94 
95 oslPipeError SAL_CALL osl_getLastPipeError(oslPipe Pipe);
96 
97 #ifdef __cplusplus
98 }
99 #endif
100 
101 #endif  /* _OSL_PIPE_H_ */
102 
103