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