anchor.diff:  			secret = Secret, session_id = SessionID,
   			server_id = list_to_binary(Hostname), start = AccessRequest},
   	process_flag(trap_exit, true),
  -	{ok, eap_start, StateData, 0}.
  +	{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
  
positive.code: 		confirm_s :: undefined | binary(),
  		confirm_p :: undefined | binary(),
  		mk :: undefined | binary(),
  		msk :: undefined | binary()}).
  -type statedata() :: #statedata{}.
  
  -define(TIMEOUT, 30000).
  
negative.code: 			{next_state, id, NewStateData, ?TIMEOUT}
  	end.
  
  -spec eap_start(Event, From, StateData) -> Result
  	when
  		Event :: term(),
  		From :: {Pid, Tag},
  		Pid :: pid(),
  		Tag :: term(),
  		StateData :: term(),
  		Result :: {reply, Reply, NextStateName, NewStateData}
  				| {reply, Reply,NextStateName, NewStateData, Timeout}
  				| {reply, Reply,NextStateName, NewStateData, hibernate}
  				| {next_state, NextStateName, NewStateData}
  				| {next_state, NextStateName, NewStateData, Timeout}
  				| {next_state, NextStateName, NewStateData, hibernate}
  				| {stop, Reason, Reply, NewStateData} | {stop, Reason, NewStateData},
  				Reply :: term(),
  		NextStateName :: atom(),
  		NewStateData :: term(),
  		Timeout :: pos_integer() | infinity,
  		Reason :: normal | term().
  eap_start(Request, _From, StateData) ->
  	try crypto:strong_rand_bytes(4) of
  		Token ->
  			eap_start2(Token, Request, StateData)
  	catch
  		Reason ->
  			{stop, Reason, StateData}
  	end.
  %% @hidden
  eap_start2(Token, Request, #statedata{eap_id = EapID, session_id = SessionId,
  		server_id = ServerID, group_desc = GroupDesc, rand_func = RandFunc,
  		prf = PRF, auth_app_id = AppId, auth_req_type = AuthType,
  		origin_host = OHost, origin_realm = ORealm} = StateData) ->
  	EapPwdId = #eap_pwd_id{group_desc = GroupDesc, random_fun = RandFunc,
  			prf = PRF, token = Token, pwd_prep = none, identity = ServerID},
  	EapPwdData = ocs_eap_codec:eap_pwd_id(EapPwdId),
  	EapPwd = #eap_pwd{pwd_exch = id, data = EapPwdData},
  	EapData = ocs_eap_codec:eap_pwd(EapPwd),
  	NewStateData = StateData#statedata{token = Token, start = Request},
  	EapPacket = #eap_packet{code = request, type = ?PWD, identifier = EapID, data = EapData},
  	EapPayload = ocs_eap_codec:eap_packet(EapPacket),
  	Answer = #diameter_eap_app_DEA{'Session-Id' = SessionId, 'Auth-Application-Id' = AppId,
  			'Auth-Request-Type' = AuthType,
  			'Result-Code' = ?'DIAMETER_BASE_RESULT-CODE_MULTI_ROUND_AUTH',
  			'Origin-Host' = OHost, 'Origin-Realm' = ORealm, 'EAP-Payload' = [EapPayload]},
  	{reply, Answer, id ,NewStateData, ?TIMEOUT}.
  
  -spec id(Event, StateData) -> Result
  	when
  		Event :: timeout | term(),
  