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#ifndef _COM_SUN_STAR_CONNECTION_XCONNECTION_IDL_
24#define _COM_SUN_STAR_CONNECTION_XCONNECTION_IDL_
25
26#include <com/sun/star/io/IOException.idl>
27
28
29module com {  module sun {  module star {  module connection {
30
31/** A bidirectional bytestream.
32
33	<p> You should additionally implement XConnection2.
34
35	@see XConnection2
36 */
37published interface XConnection: com::sun::star::uno::XInterface
38{
39
40	/** reads a requested number of bytes from the connection.
41		<p> This method is blocking, meaning that it always returns a bytesequence
42		with the requested number of bytes, unless it has reached end of file (which
43		often means, that close() has been called).
44
45		<p> please see also the readSomeBytes() method of XConnection2.
46
47		@return The read number of bytes.
48				The return value and the length of the
49				returned sequence must be identical.
50		@param nBytesToRead
51		        The number of bytes to be read from the stream.
52
53		@throws com::sun::star::io::IOException
54		       in case an error occurred during reading from the stream.
55	 */
56	long read( [out] sequence < byte > aReadBytes , [in] long nBytesToRead )
57			raises( com::sun::star::io::IOException );
58
59
60	// DocMerge from xml: method com::sun::star::connection::XConnection::write
61	/** writes the given bytesequence to the stream.
62		<p>The method blocks until the whole sequence is written.
63
64		@throws com::sun::star::io::IOException
65		       in case an error occurred during writing to the stream.
66	 */
67	void write( [in] sequence < byte > aData )
68		raises( com::sun::star::io::IOException );
69
70
71	/** Empties all internal buffers.
72	 */
73	void flush( )
74			raises( com::sun::star::io::IOException );
75
76	/** Immediately terminates any ongoing read or write calls.
77		All subsequent read or write calls()
78	 */
79	void close( )
80			raises( com::sun::star::io::IOException );
81
82
83	/** A unique string describing the connection.
84
85		<p>This string is different from the arguments to <member>XConnection::accept</member>
86		and <member>XConnector::connect</member>. In general, the string contains an additional
87		handle value.  For example, "socket,host=localhost,port=2002,uniqueValue=2324". </p>
88	 */
89	string getDescription();
90};
91
92};};};};
93
94#endif
95