bump product version to 6.3.0.0.beta1
[LibreOffice.git] / include / osl / pipe.h
blob4bb482e20b2a511fd714c7486b5bae5664ab6a2d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #ifndef INCLUDED_OSL_PIPE_H
22 #define INCLUDED_OSL_PIPE_H
24 #include "sal/config.h"
26 #include "osl/security.h"
27 #include "rtl/ustring.h"
28 #include "sal/saldllapi.h"
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
34 typedef enum {
35 osl_Pipe_E_None, /*< no error */
36 osl_Pipe_E_NotFound, /*< Pipe could not be found */
37 osl_Pipe_E_AlreadyExists, /*< Pipe already exists */
38 osl_Pipe_E_NoProtocol, /*< Protocol not available */
39 osl_Pipe_E_NetworkReset, /*< Network dropped connection because of reset */
40 osl_Pipe_E_ConnectionAbort, /*< Software caused connection abort */
41 osl_Pipe_E_ConnectionReset, /*< Connection reset by peer */
42 osl_Pipe_E_NoBufferSpace, /*< No buffer space available */
43 osl_Pipe_E_TimedOut, /*< Connection timed out */
44 osl_Pipe_E_ConnectionRefused, /*< Connection refused */
45 osl_Pipe_E_invalidError, /*< unmapped error: always last entry in enum! */
46 osl_Pipe_E_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
47 } oslPipeError;
49 /** Pipe creation options.
51 A pipe can either be opened, or a new pipe can be created and opened.
53 typedef sal_uInt32 oslPipeOptions;
54 #define osl_Pipe_OPEN 0x0000 /*< open existing pipe */
55 #define osl_Pipe_CREATE 0x0001 /*< create pipe and open it, fails if already exists */
57 typedef struct oslPipeImpl * oslPipe;
59 /** Create or open a pipe.
61 @param[in] strPipeName pipe name
62 @param[in] Options create or open the pipe
63 @param[in] Security pipe creator
65 @returns nullptr on failure, otherwise returns the pipe handle
67 @see osl_closePipe
69 SAL_DLLPUBLIC oslPipe SAL_CALL osl_createPipe(
70 rtl_uString *strPipeName, oslPipeOptions Options, oslSecurity Security);
72 /** Decreases the refcount of the pipe.
74 If the refcount drops to zero, the handle is destroyed.
76 @param[in] Pipe pipe handle
78 @see osl_acquirePipe
80 SAL_DLLPUBLIC void SAL_CALL osl_releasePipe(oslPipe Pipe);
82 /** Increases the refcount of the pipe.
84 @param[in] Pipe pipe handle
86 @see osl_releasePipe
88 SAL_DLLPUBLIC void SAL_CALL osl_acquirePipe(oslPipe Pipe);
90 /** Close the pipe.
92 Any read, write or accept actions stop immediately.
94 @param[in] Pipe pipe handle
96 @see osl_createPipe
98 SAL_DLLPUBLIC void SAL_CALL osl_closePipe(oslPipe Pipe);
101 SAL_DLLPUBLIC oslPipe SAL_CALL osl_acceptPipe(oslPipe Pipe);
103 SAL_DLLPUBLIC sal_Int32 SAL_CALL osl_sendPipe(oslPipe Pipe, const void* pBuffer, sal_Int32 BufferSize);
104 SAL_DLLPUBLIC sal_Int32 SAL_CALL osl_receivePipe(oslPipe Pipe, void* pBuffer, sal_Int32 BufferSize);
106 /** Reads blocking from the pipe.
107 @return Number of read bytes. If less than BufferSize, the pipe was closed.
109 SAL_DLLPUBLIC sal_Int32 SAL_CALL osl_readPipe( oslPipe Pipe, void *pBuffer, sal_Int32 BufferSize );
111 /** Writes blocking onto the pipe.
112 @return Number of written bytes. If less than BufferSize, the pipe was closed.
114 SAL_DLLPUBLIC sal_Int32 SAL_CALL osl_writePipe( oslPipe Pipe, const void *pBuffer, sal_Int32 BufferSize );
116 SAL_DLLPUBLIC oslPipeError SAL_CALL osl_getLastPipeError(oslPipe Pipe);
118 #ifdef __cplusplus
120 #endif
122 #endif // INCLUDED_OSL_PIPE_H
124 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */