anchor.diff:  %%  internal functions
   %%----------------------------------------------------------------------
   
  +-spec send_response(EapCode :: request | response | success | failure,
  +		EapID :: byte(), EapData :: binary(),
  +		RadiusCode :: integer(), RadiusID :: byte(),
  +		RadiusAttributes :: radius_attributes:attributes(),
  +		RequestAuthenticator :: binary() | [byte()], Secret :: binary(),
  +		RadiusFsm :: pid()) -> ok.
  +%% @doc Sends an RADIUS-Access/Challenge or Reject or Accept  packet to peer
  +%% @hidden
  +send_response(EapCode, EapID, EapData, RadiusCode, RadiusID, RadiusAttributes,
  +		RequestAuthenticator, Secret, RadiusFsm) ->
  +	Packet = #eap_packet{code = EapCode, type = ?PWD,
  +			identifier = EapID, data = EapData},
  +	EapPacketData = ocs_eap_codec:eap_packet(Packet),
  +	AttrList1 = radius_attributes:store(?EAPMessage, EapPacketData,
  +			RadiusAttributes),
  +	AttrList2 = radius_attributes:store(?MessageAuthenticator,
  +		<<0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0>>, AttrList1),
  +	Attributes1 = radius_attributes:codec(AttrList2),
  +	Length = size(Attributes1) + 20,
  +	MessageAuthenticator = crypto:hmac(md5, Secret, [<<RadiusCode, RadiusID,
  +			Length:16>>, RequestAuthenticator, Attributes1]),
  +	AttrList3 = radius_attributes:store(?MessageAuthenticator,
  +			MessageAuthenticator, AttrList2),
  +	Attributes2 = radius_attributes:codec(AttrList3),
  +	ResponseAuthenticator = crypto:hash(md5, [<<RadiusCode, RadiusID,
  +			Length:16>>, RequestAuthenticator, Attributes2, Secret]),
  +	Response = #radius{code = RadiusCode, id = RadiusID,
  +			authenticator = ResponseAuthenticator, attributes = Attributes2},
  +	ResponsePacket = radius:codec(Response),
  +	radius:response(RadiusFsm, {response, ResponsePacket}),
  +	ok.
  
positive.code: %%
  idle(timeout, #statedata{session_id = SessionID} = StateData)->
  	{stop, {shutdown, SessionID}, StateData};
  idle(_Event, StateData)->
  	{next_state, phase_1, StateData, ?TIMEOUT}.
  
  -spec phase_1(Event :: timeout | term(), StateData :: #statedata{}) ->
  	Result :: {next_state, NextStateName :: atom(), NewStateData :: #statedata{}}
  
negative.code: 		port :: pos_integer(),
  		session_id :: {NAS :: inet:ip_address() | string(),
  			Port :: string(), Peer :: string()},
  			secret :: binary(),
  		eap_id = 0 :: byte()}).
  
  -define(TIMEOUT, 30000).
  
  