[
uuid(40967f07-7820-415c-83c0-4130b0481605),
version(1.0),
pointer_default(unique),
implicit_handle (handle_t bridgeserver_IfHandle)
]
interface bridgeserver
{
	// The BridgeServer Service: listens for RPC calls from the BridgeClient
	// maintains context handles to identify (on BridgeServer) which BridgeClient is making each RPC call.
	#pragma warning( disable : 4312 4311 )  // Disable annoying warning messages

 
	typedef [context_handle] void * CLIENTCONTEXT;  // i.e. a handle to a ClientContext object
	typedef [ref] CLIENTCONTEXT * CLIENTCONTEXT_PTR;

	typedef enum {
		bsFailed, 
		bsOk, 
		bsInvalidContext, 
		bsInvalidUserId, 
		bsUsernameMismatch, 
		bsPasswordMismatch, 
		bsRecipientNotLoggedOn,
		bsRecipientIsAway
	} BridgeServerReturnCodes;
	// unless otherwise stated, these functions return bsFailed and bsOk.

	int LogOn([out] CLIENTCONTEXT_PTR context_ptr, 
		[in,string] wchar_t * username, 
		[in,string] wchar_t * password, 
		[in, string] wchar_t * machinename,
		[in, string] wchar_t * port);

	int LogOff([in, out] CLIENTCONTEXT_PTR context_ptr);

	//  notify the server of changes initiated by the client
	int ServerNotify([in] CLIENTCONTEXT context, [in] int type, [in] int theId, [in] int reason, [in] int param);

	// time synchronization
	double GetServerTime();

	// chat routines
	int SendInstantMessage([in] CLIENTCONTEXT context, 
		[in] int recipientId, 
		[in, string] wchar_t * msg);

	int SendGroupMessage([in] CLIENTCONTEXT context, 
		[in] int groupId, 
		[in, string] wchar_t * group,
		[in, string] wchar_t * msg);

}

