{		RPC Run-time Support Definition
		===============================

	(c) CERN DD Division 1986 (T.J. Berners-Lee CERN/DD/OC)

History:
	 1 May 86	Pointers to messages for RPC_CALL and rpc_early_return.
			Parameter type for RPC_REJECT becomes rpc_status.
	13 May 86	rxsize removed from rpc_call. txsize made var.
	10 Jun 86	status returned from close for 68k compatability
	15 aug 86	All parameters made var for FORTRAN compatability
			(except rpc_new and rpc_early_return)
			Service name added to rpc_attach
	27 Aug 86	NOT var in rpc_reject, rpc_report_error, etc
			No status in rpc_call
	 1 Oct 86	rpc_switch and rpc_configure added
	27 Oct 86	rpc_hardware_reset added (VMS only)
	 3 Nov 86	"Build-a-server" kit added
	16 Dec 86	M6809 version uses integer instead of procedure
			arguments. extern --> external for M6809
	 9 Mar 87	timeout parameter in rpc_call
	27 Mar 87	rpc_establish added
	14 Apr 87	rpc_init added. Timeout parameter in rpc_accept    (TJA)
	22 May 87	VAR pointer for rpc_early_return
	26 May 87	sockets are socket_type, rpc_q_s is async, unbound.
	 3 Feb 88	Added rpc_caller_address
	28 Mar 88	Remove rpc_reject


			Initialisation of the whole RPC system
}

*IF -DEF VAXVMS
PROCEDURE rpc_init;
*IF -DEF M6809 1
extern;
*IF DEF M6809 1
external;

{____________________________________________________________________________

			Procedures called from Stubs

	Report error
}
*ENDIF
PROCEDURE rpc_report_error(status: rpc_status);
*IF -DEF M6809 1
extern;
*IF DEF M6809 1
external;

{	Establish Error Handler
}
PROCEDURE rpc_establish(
*IF -DEF M6809 2
			procedure handler( VAR p: rpc_message_pointer));
extern;
*IF DEF M6809 2
			handler:		integer);
external;

{	Bind Client Stub
}
PROCEDURE RPC_Open(	VAR status:		rpc_status;
			VAR handle:		integer;
			    service_name:	rpc_name);
*IF -DEF M6809 1
extern;
*IF DEF M6809 1
external;

{	Unbind Client Stub
}
PROCEDURE RPC_CLOSE(	VAR status:		rpc_status;	
			    handle:		unit_index);
*IF -DEF M6809 1
extern;
*IF DEF M6809 1
external;

{	Allocate one RPC transaction buffer
}
PROCEDURE rpc_new(VAR P: rpc_message_pointer; bytes: integer);
*IF -DEF M6809 1
extern;                 
*IF DEF M6809 1
external;

{	Deallocate one RPC transaction buffer
}
PROCEDURE rpc_dispose(P: rpc_message_pointer);
*IF -DEF M6809 1
extern;
*IF DEF M6809 1
external;

{	Make one call
}
PROCEDURE RPC_call(	var handle:	integer;
	  		VAR p_buffer:	rpc_message_pointer;
			    timeout:	integer);
*IF -DEF M6809 1
extern;
*IF DEF M6809 1
external;
*IF -DEF M6809
{   The name would clash on the M6809 with RPC_Call }
FUNCTION RPC_Call_Status(	var handle:	integer;
		    		VAR p_message:	rpc_message_pointer;
	  			    timeout:	integer):
						rpc_status;
extern;
*ENDIF
{	Attach server stub to RPC system
}
PROCEDURE RPC_attach_stub(	VAR status:	  rpc_status;
*IF -DEF M6809 1
				    procedure 	  e(VAR p: rpc_message_pointer);
*IF DEF M6809 1
				    e:		  integer;
				    service_name: rpc_name;
				VAR p: 		  program_index);
*IF -DEF M6809 1
extern;
*IF DEF M6809 1
external;

{	Detach server stub
}
PROCEDURE RPC_DETACH_STUB (p: program_index);
*IF -DEF M6809 1
extern;
*IF DEF M6809 1
external;

{	Return results before processing data
}
PROCEDURE rpc_early_return(VAR	return_mes_p:	rpc_message_pointer);	
*IF -DEF M6809 1
extern;
*IF DEF M6809 1
external;

{____________________________________________________________________________

		Procedures called from server

	Start asynchronous server
}
*IF -DEF M6809
PROCEDURE RPC_Start_Server(var status: rpc_status; address: rpc_name);
extern;

{	Start synchronous server
}
*ENDIF
PROCEDURE rpc_loop_server (var status: rpc_status; address: rpc_name);
*IF -DEF M6809 1
extern;
*IF DEF M6809 1
external;

{	Find out who the caller was
}
*IF DEF VAXVMS 1
[asynchronous, unbound]
PROCEDURE rpc_caller_address(
			var	status:		rpc_status;
			var	name:		rpc_name);
*IF -DEF M6809 1
extern;
*IF DEF M6809 1
external;

{____________________________________________________________________________
			Proceduers called from client programs

	Rebind client stub
}
PROCEDURE rpc_switch(VAR status: rpc_status; VAR handle: integer);
*IF -DEF M6809 1
extern;
*IF DEF M6809 1
external;

{	Rebind all client stubs
}
PROCEDURE rpc_configure( VAR status: rpc_status);
*IF -DEF M6809 1
extern;
*IF DEF M6809 1
external;

{	Perform a hardware reset on the remote device
}
*IF DEF VAXVMS
PROCEDURE rpc_hardware_reset(VAR status: rpc_status; VAR handle: integer);
extern;
*ENDIF

{____________________________________________________________________________

			Build-your-own-server kit:

	Create a server
}
PROCEDURE rpc_create_server(var	status:		rpc_status;
				client_address: rpc_name;
			VAR	server_socket:	socket_type);
*IF -DEF M6809 1
Extern;
*IF DEF M6809 1
external;

{	Wait for and service one request
}
PROCEDURE RPC_Accept(var status:	rpc_status;
			 server_socket: socket_type;
			 timeout:	integer);
*IF -DEF M6809 1
extern;
*IF DEF M6809 1
external;

{	Queue a server procedure to be run when a request arrives
}
*IF -DEF M6809
*IF DEF VAXVMS 1
[asynchronous, unbound]
PROCEDURE RPC_Queue_Server(
		VAR	status:		rpc_status;
			socket:		socket_type;
*IF DEF VAXVMS 1
  [unbound,asynchronous]
		 procedure Action (VAR message:
*IF DEF VAXVMS 1
					[volatile]
	      					 rpc_message);
			user_1:		integer);
extern;

{	An AST procedure to service a request
}
*IF DEF VAXVMS 1
[asynchronous, unbound]	
PROCEDURE RPC_SERVICE(pmessage:
*IF DEF VAXVMS 1
				[volatile]
						rpc_message_pointer);
extern;

*ENDIF
