anchor.diff:  -include_lib("diameter/include/diameter.hrl").
   
   -record(statedata,
  -		{aka_fsm :: undefined | pid(),
  -		hss_realm :: string(),
  -		hss_host :: string()}).
  +		{aka_fsm :: pid() | undefined,
  +		identity :: string() | undefined,
  +		anid :: string() | undefined,
  +		hss_realm :: string() | undefined,
  +		hss_host :: string() | undefined}).
   -type statedata() :: #statedata{}.
   
   %%----------------------------------------------------------------------
  
positive.code: 	AUTN = autn(SQN, AK, AMF, MAC),
  	gen_fsm:send_event(AkaFsm, {RAND, AUTN, CK, IK, XRES}),
  	{next_state, idle, StateData};
  idle1(AkaFsm, ANID, StateData,
  		{ok, #service{password = #aka_cred{k = K, opc = OPc, dif = DIF}}}) ->
  	RAND = ocs_milenage:f0(),
  	{XRES, CK, IK, <<AK:48>>} = ocs_milenage:f2345(OPc, K, RAND),
  	SQN = sqn(DIF),
  
negative.code: %%
  idle({AkaFsm, Identity, ANID}, StateData)
  		when is_pid(AkaFsm), is_binary(Identity), is_list(ANID) ->
  	NewStateData = StateData#statedata{aka_fsm = AkaFsm,
  			identity = Identity, anid = ANID},
  	idle1(ocs:find_service(Identity), NewStateData);
  idle({AkaFsm, Identity}, StateData)
  		when is_pid(AkaFsm), is_binary(Identity) ->
  	NewStateData = StateData#statedata{aka_fsm = AkaFsm, identity = Identity},
  	idle1(ocs:find_service(Identity), NewStateData).
  %% @hidden
  idle1({ok, #service{enabled = false}},
  		#statedata{aka_fsm = AkaFsm} = StateData) ->
  	gen_fsm:send_event(AkaFsm, {error, disabled}),
  	{next_state, idle, StateData};
  idle1({ok, #service{password = #aka_cred{k = K, opc = OPc, dif = DIF}}},
  		#statedata{anid = undefined, aka_fsm = AkaFsm} = StateData) ->
  	RAND = ocs_milenage:f0(),
  	{XRES, CK, IK, <<AK:48>>} = ocs_milenage:f2345(OPc, K, RAND),
  	SQN = sqn(DIF),
  