anchor.diff:  -export([]).
   
   %% export the ocs_eap_pwd_fsm state callbacks
  --export([eap_start/2, id/2, commit/2, confirm/2]).
  +-export([eap_start/2, id/2, commit/2, confirm/2,
  +			eap_start/3]).
   
   %% 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]).
   
   -include_lib("radius/include/radius.hrl").
  +-include_lib("diameter/include/diameter.hrl").
  +-include_lib("diameter/include/diameter_gen_base_rfc6733.hrl").
   -include("ocs_eap_codec.hrl").
  +-include("../include/diameter_gen_eap_application_rfc4072.hrl").
  +
   -record(statedata,
   		{server_address :: inet:ip_address(),
   		server_port :: pos_integer(),
  -		client_address :: inet:ip_address(),
  -		client_port :: pos_integer(),
  -		radius_fsm :: pid(),
  -		session_id:: {NAS :: inet:ip_address() | string(),
  +		client_address :: undefined | inet:ip_address(),
  +		client_port :: undefined | pos_integer(),
  +		radius_fsm :: undefined | pid(),
  +		session_id:: string() | {NAS :: inet:ip_address() | string(),
   				Port :: string(), Peer :: string()},
  -		start :: undefined | #radius{},
  +		start :: undefined | #diameter_eap_app_DER{} | #radius{},
   		eap_id = 0 :: byte(),
   		group_desc  = 19 :: byte(),
   		rand_func = 1 :: byte(),
   		prf = 1 :: byte(),
  -		secret :: binary(),
  +		secret :: undefined | binary(),
   		token :: undefined | binary(),
   		password :: undefined | binary(),
   		prep :: undefined | none | rfc2759 | saslprep,
  -		server_id  :: binary(),
  +		server_id  ::  binary(),
   		peer_id :: undefined | binary(),
   		pwe :: undefined | binary(),
   		s_rand :: undefined | integer(),
  
positive.code: 		confirm_s :: undefined | binary(),
  		confirm_p :: undefined | binary(),
  		mk :: undefined | binary(),
  		msk :: undefined | binary()}).
  -type statedata() :: #statedata{}.
  
  -define(TIMEOUT, 30000).
  
negative.code: 			secret = Secret, session_id = SessionID,
  			server_id = list_to_binary(Hostname), start = AccessRequest},
  	process_flag(trap_exit, true),
  	{ok, eap_start, StateData, 0};
  init([diameter, ServerAddress, ServerPort, SessionId, ApplicationId,
  		AuthType, OHost, ORealm, _Options] = _Args) ->
  	{ok, Hostname} = inet:gethostname(),
  	StateData = #statedata{server_address = ServerAddress,
  			server_port = ServerPort, session_id = SessionId, server_id = list_to_binary(Hostname),
  			auth_app_id = ApplicationId, auth_req_type = AuthType, origin_host = OHost,
  			origin_realm = ORealm},
  	process_flag(trap_exit, true),
  	{ok, eap_start, StateData}.
  
  -spec eap_start(Event, StateData) -> Result
  	when
  