1*408a4873SAndrew Rist/**************************************************************
2cdf0e10cSrcweir *
3*408a4873SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*408a4873SAndrew Rist * or more contributor license agreements.  See the NOTICE file
5*408a4873SAndrew Rist * distributed with this work for additional information
6*408a4873SAndrew Rist * regarding copyright ownership.  The ASF licenses this file
7*408a4873SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*408a4873SAndrew Rist * "License"); you may not use this file except in compliance
9*408a4873SAndrew Rist * with the License.  You may obtain a copy of the License at
10*408a4873SAndrew Rist *
11*408a4873SAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
12*408a4873SAndrew Rist *
13*408a4873SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*408a4873SAndrew Rist * software distributed under the License is distributed on an
15*408a4873SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*408a4873SAndrew Rist * KIND, either express or implied.  See the License for the
17*408a4873SAndrew Rist * specific language governing permissions and limitations
18*408a4873SAndrew Rist * under the License.
19*408a4873SAndrew Rist *
20*408a4873SAndrew Rist *************************************************************/
21*408a4873SAndrew Rist
22*408a4873SAndrew Rist
23cdf0e10cSrcweir#ifndef _COM_SUN_STAR_BRIDGE_XPROTOCOLPROPERTIES_IDL_
24cdf0e10cSrcweir#define _COM_SUN_STAR_BRIDGE_XPROTOCOLPROPERTIES_IDL_
25cdf0e10cSrcweir#include <com/sun/star/bridge/ProtocolProperty.idl>
26cdf0e10cSrcweir#include <com/sun/star/bridge/InvalidProtocolChangeException.idl>
27cdf0e10cSrcweir
28cdf0e10cSrcweirmodule com { module sun { module star { module bridge {
29cdf0e10cSrcweir
30cdf0e10cSrcweir
31cdf0e10cSrcweir/** Bridge internal interface, that allows to change protocol settings of the remote
32cdf0e10cSrcweir    counter part.
33cdf0e10cSrcweir
34cdf0e10cSrcweir	<p>In general, this interface is implemented by the bridge itself. It must not
35cdf0e10cSrcweir    be called from outside the bridge.</p>
36cdf0e10cSrcweir
37cdf0e10cSrcweir	<p>INTERNAL INTERFACE, DO NOT USE IT ELSEWHERE!</p>
38cdf0e10cSrcweir*/
39cdf0e10cSrcweirpublished interface XProtocolProperties : com::sun::star::uno::XInterface
40cdf0e10cSrcweir{
41cdf0e10cSrcweir	/** called to get a list of bridge internal properties. Which properties can be retrieved,
42cdf0e10cSrcweir		is protocol dependent.
43cdf0e10cSrcweir
44cdf0e10cSrcweir		<p> The properties MUST NOT change between a requestChange and a commit change call.</p>
45cdf0e10cSrcweir	 */
46cdf0e10cSrcweir	sequence< ProtocolProperty > getProperties( );
47cdf0e10cSrcweir
48cdf0e10cSrcweir	/** called to initiate a protocol change.
49cdf0e10cSrcweir
50cdf0e10cSrcweir		<p>This method should always be called in the scope of the local bridge setting object,
51cdf0e10cSrcweir		because the remote counter part may do such a call at the same time
52cdf0e10cSrcweir		(typically at startup time). </p>
53cdf0e10cSrcweir
54cdf0e10cSrcweir		@param nRandomNumber
55cdf0e10cSrcweir			In case both processes call requestChange at the same time,
56cdf0e10cSrcweir			 the caller with the higher nRandomNumber is allowed to call
57cdf0e10cSrcweir			 commitChange.
58cdf0e10cSrcweir
59cdf0e10cSrcweir		@returns
60cdf0e10cSrcweir			1, if the caller may ( and MUST !!!) call commitChange.
61cdf0e10cSrcweir			0, if the caller is not allowed to call commitChange. This can only happen,
62cdf0e10cSrcweir			   if the other bridge has called requestChange at the same time and
63cdf0e10cSrcweir			   nRandomNumber is smaller than the other bridge's nRandomNumber.
64cdf0e10cSrcweir			   The remote counterpart is supposed to call commitChange within a small
65cdf0e10cSrcweir			   time span. Please call requestChange() after the remote counterpart has
66cdf0e10cSrcweir			   called commitChange().
67cdf0e10cSrcweir			-1 if the nRandomNumber is of the same value as the previously
68cdf0e10cSrcweir			   sent requestChange (sent by the remote counterpart). This is a draw :o).
69cdf0e10cSrcweir			   Generate a new random number and try again.
70cdf0e10cSrcweir	 */
71cdf0e10cSrcweir	long requestChange( [in] long nRandomNumber );
72cdf0e10cSrcweir
73cdf0e10cSrcweir	/** called to commit a protocol change.
74cdf0e10cSrcweir
75cdf0e10cSrcweir		<p>It is only allowed to call commitChange, if requestChange
76cdf0e10cSrcweir		has been called previously and the return value was true.  The new properties are
77cdf0e10cSrcweir		valid after the reply of commitChange has been received.
78cdf0e10cSrcweir		Note, that this is difficult for the callee, because it must marshal the reply
79cdf0e10cSrcweir		with the old settings. </p>
80cdf0e10cSrcweir
81cdf0e10cSrcweir		<p>All properties not mentioned in the list are unchanged.
82cdf0e10cSrcweir		Note that the bridge must be blocked for other threads,
83cdf0e10cSrcweir		before commitChange is sent and unblocked
84cdf0e10cSrcweir		after the reply has been received. This blocks the bridge.</p>
85cdf0e10cSrcweir
86cdf0e10cSrcweir		@throws InvalidProtocolChangeException
87cdf0e10cSrcweir				when the remote counterpart could not change at least one of the properties.
88cdf0e10cSrcweir				No property has been changed. requestChange must be called
89cdf0e10cSrcweir				again to initiate a new change of the protocol.
90cdf0e10cSrcweir	 */
91cdf0e10cSrcweir	void commitChange( [in] sequence< ProtocolProperty > newValues )
92cdf0e10cSrcweir		raises ( com::sun::star::bridge::InvalidProtocolChangeException );
93cdf0e10cSrcweir};
94cdf0e10cSrcweir
95cdf0e10cSrcweir};};};};
96cdf0e10cSrcweir#endif
97