anchor.diff:  %% export the ocs_simple_auth_fsm state callbacks
   -export([request/2]).
   
  +-export([radius/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]).
  
positive.code: 			gen_server:cast(PortServer, {self(), Answer}),
  			{stop, {shutdown, SessionID}, StateData}
  	end.
  %% @hidden
  request1(#statedata{req_attr = Attributes, req_auth = Authenticator,
  		shared_secret = Secret, session_id = SessionID} = StateData) ->
  	case radius_attributes:find(?UserPassword, Attributes) of
  		{ok, Hidden} ->
  			Password = radius_attributes:unhide(Secret, Authenticator, Hidden),
  			NewStateData = StateData#statedata{password = Password},
  			request2(NewStateData);
  		{error, not_found} ->
  			response(?AccessReject, [], StateData),
  			{stop, {shutdown, SessionID}, StateData}
  	end.
  %% @hidden
  request2(#statedata{subscriber = Subscriber, password = Password} = StateData) ->
  	case existing_sessions(Subscriber) of
  		false ->
  			request3(list_to_binary(Password), StateData);
  		{true, false, [ExistingSessionAtt]} ->
  			NewStateData = StateData#statedata{multisession = false},
  			case pg2:get_closest_pid(ocs_radius_acct_port_sup) of
  				{error, Reason} ->
  					request5(Reason, NewStateData);
  				DiscFsmSup ->
  					start_disconnect(DiscFsmSup, ExistingSessionAtt, NewStateData)
  			end;
  		{true, true, _ExistingSessionAtt} ->
  			NewStateData = StateData#statedata{multisession = true},
  			request3(list_to_binary(Password), NewStateData);
  		{error, _Reason} ->
  			request5(not_found, StateData)
  	end.
  %% @hidden
  request3(<<>>, #statedata{subscriber = Subscriber} = StateData) ->
  	case ocs:authorize(ocs:normalize(Subscriber), []) of
  		{ok, <<>>, Attributes} ->
  			request4(?AccessAccept, Attributes, StateData);
  		{ok, PSK, Attributes} when is_binary(PSK) ->
  			VendorSpecific = {?Mikrotik, ?MikrotikWirelessPsk, binary_to_list(PSK)},
  			ResponseAttributes = radius_attributes:store(?VendorSpecific,
  					VendorSpecific, Attributes),
  			request4(?AccessAccept, ResponseAttributes, StateData);
  		{error, Reason} ->
  			request5(Reason, StateData)
  	end;
  request3(Password, #statedata{subscriber = Subscriber} = StateData) ->
  	case ocs:authorize(Subscriber, Password) of
  		{ok, _, ResponseAttributes} ->
  			request4(?AccessAccept, ResponseAttributes, StateData);
  		{error, Reason} ->
  			request5(Reason, StateData)
  	end.
  %% @hidden
  request4(RadiusPacketType, ResponseAttributes, #statedata{session_id = SessionID,
  		req_attr = Attributes, subscriber = Subscriber,
  		multisession = MultiSessions} = StateData) ->
  	case add_session_attributes(Subscriber, Attributes, MultiSessions) of
  		ok ->
  			response(RadiusPacketType, ResponseAttributes, StateData),
  			{stop, {shutdown, SessionID}, StateData};
  		{error, Reason} ->
  			request5(Reason, StateData)
  	end.
  %% @hidden
  request5(out_of_credit, #statedata{session_id = SessionID} = StateData) ->
  	RejectAttributes = [{?ReplyMessage, "Out of Credit"}],
  	response(?AccessReject, RejectAttributes, StateData),
  	{stop, {shutdown, SessionID}, StateData};
  request5(disabled, #statedata{session_id = SessionID} = StateData) ->
  	RejectAttributes = [{?ReplyMessage, "Subscriber Disabled"}],
  	response(?AccessReject, RejectAttributes, StateData),
  	{stop, {shutdown, SessionID}, StateData};
  request5(bad_password, #statedata{session_id = SessionID} = StateData) ->
  	RejectAttributes = [{?ReplyMessage, "Bad Password"}],
  	response(?AccessReject, RejectAttributes, StateData),
  	{stop, {shutdown, SessionID}, StateData};
  request5(not_found, #statedata{session_id = SessionID} = StateData) ->
  	RejectAttributes = [{?ReplyMessage, "Unknown Username"}],
  	response(?AccessReject, RejectAttributes, StateData),
  	{stop, {shutdown, SessionID}, StateData};
  request5(_, #statedata{session_id = SessionID} = StateData) ->
  	RejectAttributes = [{?ReplyMessage, "Unable to comply"}],
  	response(?AccessReject, RejectAttributes, StateData),
  	{stop, {shutdown, SessionID}, StateData}.
  
negative.code: 			{ClientAddress, ClientPort}, Type, RequestAttributes, AttributeList2),
  	radius:response(RadiusFsm, {response, ResponsePacket}).
  
  -spec extract_session_attributes(Attributes) -> SessionAttributes
  	when
  		Attributes :: radius_attributes:attributes(),
  