anchor.diff:  -behaviour(gen_fsm).
   
   %% API
  --export([start_link/1, accept/3, get_peer_data/1]).
  +-export([start_link/1, accept/3, get_peer_data/1, get_peer_mode/1]).
   
   %% gen_fsm callbacks
   -export([init/1, listen/2, idle/2, join/2, configure/2, data_check/2, run/2,
  
positive.code: handle_sync_event(get_peer_data, _From, StateName, State) ->
      Reply = {error, not_connected},
      reply(Reply, StateName, State);
  handle_sync_event(_Event, _From, StateName, State) ->
      Reply = ok,
      reply(Reply, StateName, State).
  
negative.code: 
  idle({join_request, Seq, Elements, #capwap_header{
  			   radio_id = RadioId, wb_id = WBID, flags = Flags}},
       State0 = #state{peer = {Address, _}}) ->
      ?DEBUG(?GREEN "Join-Request: ~p~n", [Elements]),
  
      SessionId = proplists:get_value(session_id, Elements),
      capwap_wtp_reg:register_sessionid(Address, SessionId),
  
      MacTypes = ie(wtp_mac_type, Elements),
      TunnelModes = ie(wtp_frame_tunnel_mode, Elements),
      State1 = State0#state{mac_types = MacTypes, tunnel_modes = TunnelModes},
  
      RespElements = ac_info() ++ [#result_code{result_code = 0}],
      Header = #capwap_header{radio_id = RadioId, wb_id = WBID, flags = Flags},
      State = send_response(Header, join_response, Seq, RespElements, State1),
      next_state(join, State);
  
  idle({Msg, Seq, Elements, Header}, State) ->
      ?DEBUG(?RED "in IDLE got unexpexted: ~p~n", [{Msg, Seq, Elements, Header}]),
  