anchor.diff:      ok.
   code_change(_OldVsn, St, _Extra) ->
       {ok, St}.
  -
  -
  -
  -
  -%% Invoked by schedule_rpc.
  -%% A message originated from a locally connected service
  -%% has timed out
  -handle_local_timeout(CompSpec, Service, TransID) ->
  -    rvi_common:notification(service_edge, ?SERVER, handle_local_timeout, 
  -			    [ { service, Service}, 
  -			      { transaction_id, TransID} ], 
  -			    CompSpec).
  -
  -%%
  -%% Handle a message, delivered from a remote node through protocol, that is
  -%% to be forwarded to a locally connected service.
  -%%
  -handle_remote_message(CompSpec, ServiceName, Timeout, NetworkAddress,
  -		      Parameters, Signature, Certificate) ->
  -    rvi_common:notification(service_edge, ?SERVER, handle_remote_message,
  -			    [ { service, ServiceName }, 
  -			      { timeout, Timeout }, 
  -			      { network_address, NetworkAddress },
  -			      { parameters, Parameters },
  -			      { signature, Signature }, 
  -			      { certificate, Certificate } ],
  -			    CompSpec).
  -
   
   
   
  
positive.code: 
  
  handle_rpc("message", Args) ->
      {ok, ServiceName} = rvi_common:get_json_element(["service_name"], Args),
      {ok, Timeout} = rvi_common:get_json_element(["timeout"], Args),
      {ok, Parameters} = rvi_common:get_json_element(["parameters"], Args),
      [ Res, TID ] = gen_server:call(?SERVER, { rvi, handle_local_message, 
  					      [ ServiceName, Timeout, Parameters]}),
  
      {ok, [ { status, rvi_common:json_rpc_status(Res) },
  	   { transaction_id, TID } ]};
  
negative.code:     { reply, [ invalid_command ], St}.
  
  
  handle_cast({rvi, service_available, [SvcName, _DataLinkModule] }, St) ->
      announce_service_availability(available, SvcName),
      { noreply, St };
  
  		      
  handle_cast({rvi, service_unavailable, [SvcName, _DataLinkModule] }, St) ->
      announce_service_availability(unavailable, SvcName),
      { noreply, St };
  
  		      
  handle_cast({rvi, handle_remote_message, 
  	     [
  	      SvcName,
  	      Timeout,
  	      Parameters,
  	      Certificate,
  	      Signature
  	     ] }, St) ->
  
      ?debug("service_edge:remote_msg(): service_name:    ~p", [SvcName]),
      ?debug("service_edge:remote_msg(): timeout:         ~p", [Timeout]),
      ?debug("service_edge:remote_msg(): parameters:      ~p", [Parameters]),
      ?debug("service_edge:remote_msg(): signature:       ~p", [Signature]),
      ?debug("service_edge:remote_msg(): certificate:     ~p", [Certificate]),
  
      %% Check if this is a local message.
      case ets:lookup(?SERVICE_TABLE, SvcName) of
  	[ #service_entry { url = URL }] -> %% This is a local message
  	    case authorize_rpc:authorize_remote_message(St#st.cs, 
  							SvcName, 
  							Certificate, 
  							Signature) of
  		[ ok ] -> 
  		    forward_message_to_local_service(URL, SvcName, 
  						     Parameters, St#st.cs),
  		    { noreply, St};
  
  		[ _ ] ->
  		    ?warning("service_entry:remote_msg(): Failed to authenticate ~p",
  			     [SvcName]),
  		    { noreply, St}
  		end;
  	[] ->
  	    ?notice("service_entry:remote_msg(): Service Disappeared ~p",
  		     [SvcName]),
  	    { noreply, St}
  	
      end;
  
  
  handle_cast({ rvi, handle_local_timeout, [SvcName, TransactionID] }, St) ->
      %% FIXME: Should be forwarded to service.
      ?info("service_edge_rpc:handle_local_timeout(): service: ~p trans_id: ~p ", 
  	  [SvcName, TransactionID]),
      
      { noreply, St};
  
  