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 _VOS_CONNECTN_HXX_ 26 #define _VOS_CONNECTN_HXX_ 27 28 # include <vos/ref.hxx> 29 # include <rtl/ustring.hxx> 30 31 namespace vos 32 { 33 //--------------------------------------------------------------------------- 34 /** abstract connection class 35 */ 36 37 class IConnection: public ::vos::IReference 38 { 39 public: 40 41 //--------------------------------------------------------------------------- 42 /** reads the specified amount of bytes from the stream. The call will block 43 until nBytesToRead bytes are available. 44 45 @param pData 46 pointer to the buffer to fill. 47 48 @param nBytesToRead 49 the number of bytes to read. 50 51 @returns 52 the number of bytes read; 53 */ 54 55 virtual sal_Int32 SAL_CALL read( sal_Int8* pData, sal_Int32 nBytesToRead ) = 0; 56 57 //--------------------------------------------------------------------------- 58 /** tries to read the specified amount of bytes from the stream. 59 60 @param pData 61 pointer to the buffer to fill. 62 63 @param nBytesToRead 64 the maximum number of bytes to read. 65 66 @returns 67 the number of bytes read; 68 */ 69 70 virtual sal_Int32 SAL_CALL readSomeBytes( sal_Int8* pData, sal_Int32 nBytesToRead ) = 0; 71 72 //--------------------------------------------------------------------------- 73 /** writes the specified number of bytes to the stream. 74 75 @param pData 76 pointer to the buffer to read from. 77 78 @param nBytesToWrite 79 the number of bytes to write. 80 */ 81 82 virtual sal_Int32 SAL_CALL write( const sal_Int8* pData , sal_Int32 nBytesToWrite ) = 0; 83 84 //--------------------------------------------------------------------------- 85 /** flushes all output data to the stream. 86 */ 87 88 virtual sal_Int32 SAL_CALL flush() = 0; 89 90 //--------------------------------------------------------------------------- 91 /** closes the stream of the connection. 92 93 NOTE: implementation must be able to handle more than one close calls. 94 */ 95 96 virtual sal_Int32 SAL_CALL close() = 0; 97 98 //--------------------------------------------------------------------------- 99 /** gets the source address 100 */ 101 virtual ::rtl::OUString SAL_CALL getSource() = 0; 102 103 //--------------------------------------------------------------------------- 104 /** gets the destination address 105 */ 106 virtual ::rtl::OUString SAL_CALL getDestination() = 0; 107 }; 108 109 } 110 111 #endif // _VOS_CONNECTN_HXX_ 112 113