anchor.diff:  -export([]).
   
   %% export the ocs_radius_disconnect_fsm state callbacks
  --export([start/2]).
  +-export([wait_for_start/2, started/2, wait_for_stop/2]).
   
   %% export the call backs needed for gen_fsm behaviour
   -export([init/1, handle_event/3, handle_sync_event/4, handle_info/3,
   			terminate/3, code_change/4]).
   
  --record(statedata, {}).
  +-include_lib("diameter/include/diameter.hrl").
  +-record(statedata,
  +		{address :: inet:ip_address(),
  +		port :: pos_integer()}).
   
   -define(AUTHENTICATION, diameter_authentication).
   
  
positive.code: %% @see //stdlib/gen_fsm:handle_info/3
  %% @private
  %%
  handle_info(_Event, _StateName, StateData) ->
  	{stop, not_implemented, StateData}.
  
  -spec terminate(Reason, StateName, StateData) -> any()
  	when
  
negative.code: %% @see //stdlib/gen_fsm:init/1
  %% @private
  %%
  init([Address, Port] = _Args) ->
  	SvcName = ?AUTHENTICATION,
  	diameter:subscribe(SvcName),
  	StateData  = #statedata{address = Address, port = Port},
  	process_flag(trap_exit, true),
  	{ok, wait_for_start, StateData, 0}.
  
  -spec wait_for_start(Event, StateData) -> Result
  	when
  		Event :: timeout | term(), 
  		StateData :: #statedata{},
  		Result :: {next_state, NextStateName, NewStateData}
  			| {next_state, NextStateName, NewStateData, Timeout}
  			| {next_state, NextStateName, NewStateData, hibernate}
  			| {stop, Reason, NewStateData},
  		NextStateName :: atom(),
  		NewStateData :: #statedata{},
  		Timeout :: non_neg_integer() | infinity,
  		Reason :: normal | term().
  %% @doc Handle events sent with {@link //stdlib/gen_fsm:send_event/2.
  %%		gen_fsm:send_event/2} in the <b>wait_for_start</b> state.
  %% @@see //stdlib/gen_fsm:StateName/2
  %% @private
  %%
  wait_for_start(timeout, StateData) ->
  	{next_state, wait_for_start, StateData}.
  
  -spec started(Event, StateData) -> Result
  	when
  		Event :: timeout | term(), 
  		StateData :: #statedata{},
  		Result :: {next_state, NextStateName, NewStateData}
  			| {next_state, NextStateName, NewStateData, Timeout}
  			| {next_state, NextStateName, NewStateData, hibernate}
  			| {stop, Reason, NewStateData},
  		NextStateName :: atom(),
  		NewStateData :: #statedata{},
  		Timeout :: non_neg_integer() | infinity,
  		Reason :: normal | term().
  %% @doc Handle events sent with {@link //stdlib/gen_fsm:send_event/2.
  %%		gen_fsm:send_event/2} in the <b>started</b> state.
  %% @@see //stdlib/gen_fsm:StateName/2
  %% @private
  %%
  started(timeout, #statedata{address = Address, port = Port} = StateData) ->
  	SvcName = ?AUTHENTICATION,
  	SOptions = service_options(SvcName),
  	TOptions = transport_options(diameter_tcp, Address, Port),
  	diameter:start_service(SvcName, SOptions),
  	diameter:add_transport(SvcName, TOptions),
  	{next_state, started, StateData}.
  
  -spec wait_for_stop(Event, StateData) -> Result
  	when
  		Event :: timeout | term(), 
  		StateData :: #statedata{},
  