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_BRIDGE_XPROTOCOLPROPERTIES_IDL_
24#define _COM_SUN_STAR_BRIDGE_XPROTOCOLPROPERTIES_IDL_
25#include <com/sun/star/bridge/ProtocolProperty.idl>
26#include <com/sun/star/bridge/InvalidProtocolChangeException.idl>
27
28module com { module sun { module star { module bridge {
29
30
31/** Bridge internal interface, that allows to change protocol settings of the remote
32    counter part.
33
34	<p>In general, this interface is implemented by the bridge itself. It must not
35    be called from outside the bridge.</p>
36
37	<p>INTERNAL INTERFACE, DO NOT USE IT ELSEWHERE!</p>
38*/
39published interface XProtocolProperties : com::sun::star::uno::XInterface
40{
41	/** called to get a list of bridge internal properties. Which properties can be retrieved,
42		is protocol dependent.
43
44		<p> The properties MUST NOT change between a requestChange and a commit change call.</p>
45	 */
46	sequence< ProtocolProperty > getProperties( );
47
48	/** called to initiate a protocol change.
49
50		<p>This method should always be called in the scope of the local bridge setting object,
51		because the remote counter part may do such a call at the same time
52		(typically at startup time). </p>
53
54		@param nRandomNumber
55			In case both processes call requestChange at the same time,
56			 the caller with the higher nRandomNumber is allowed to call
57			 commitChange.
58
59		@returns
60			1, if the caller may ( and MUST !!!) call commitChange.
61			0, if the caller is not allowed to call commitChange. This can only happen,
62			   if the other bridge has called requestChange at the same time and
63			   nRandomNumber is smaller than the other bridge's nRandomNumber.
64			   The remote counterpart is supposed to call commitChange within a small
65			   time span. Please call requestChange() after the remote counterpart has
66			   called commitChange().
67			-1 if the nRandomNumber is of the same value as the previously
68			   sent requestChange (sent by the remote counterpart). This is a draw :o).
69			   Generate a new random number and try again.
70	 */
71	long requestChange( [in] long nRandomNumber );
72
73	/** called to commit a protocol change.
74
75		<p>It is only allowed to call commitChange, if requestChange
76		has been called previously and the return value was true.  The new properties are
77		valid after the reply of commitChange has been received.
78		Note, that this is difficult for the callee, because it must marshal the reply
79		with the old settings. </p>
80
81		<p>All properties not mentioned in the list are unchanged.
82		Note that the bridge must be blocked for other threads,
83		before commitChange is sent and unblocked
84		after the reply has been received. This blocks the bridge.</p>
85
86		@throws InvalidProtocolChangeException
87				when the remote counterpart could not change at least one of the properties.
88				No property has been changed. requestChange must be called
89				again to initiate a new change of the protocol.
90	 */
91	void commitChange( [in] sequence< ProtocolProperty > newValues )
92		raises ( com::sun::star::bridge::InvalidProtocolChangeException );
93};
94
95};};};};
96#endif
97