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