anchor.diff:  % SCCP routing control procedures (SCRC)
   
  -% (C) 2010 by Harald Welte <laforge@gnumonks.org>
  +% (C) 2010-2011 by Harald Welte <laforge@gnumonks.org>
   %
   % All Rights Reserved
   %
  
positive.code: 	{ok, idle, LoopData}.
  
  
  idle(#primitive{subsystem = 'MTP', gen_name = 'TRANSFER',
  		spec_name = indication, parameters = Params}, LoopDat) ->
  	{ok, Msg} = sccp_codec:parse_sccp_msg(Params),
  	io:format("Parsed Msg: ~p LoopDat ~p ~n", [Msg, LoopDat]),
  	case Msg of
  		% special handling for CR message here in SCRC
  		#sccp_msg{msg_type = ?SCCP_MSGT_CR} ->
  			% create new SCOC instance
  			UserPid = LoopDat#scrc_state.user_pid,
  			% Compute the new local reference
  			LocalRef = LoopDat#scrc_state.next_local_ref + 1,
  			LoopDat1 = LoopDat#scrc_state{next_local_ref = LocalRef},
  			% generate proplist for SCRC initialization
  			ScocPropList = [{scrc_pid, self()}, {user_pid, UserPid}, {local_reference, LocalRef}],
  			{ok, ScocPid} = sccp_scoc:start_link(ScocPropList),
  			% insert SCOC instance in connection table
  			ConnTable = get(scoc_by_ref),
  			ets:insert_new(ConnTable, {LocalRef, ScocPid}),
  			% send a RCOC-CONNECTING.ind primitive to the new SCOC fsm
  			UserPrim = sccp_scoc:make_prim('RCOC','CONNECTION', indication, Msg#sccp_msg.parameters),
  			io:format("Sending ~p to ~p~n", [UserPrim, ScocPid]),
  
negative.code: % triggered by N-CONNECT.req from user to SCOC:
  idle(#primitive{subsystem = 'OCRC', gen_name = 'CONNECTION',
  		spec_name = indication, parameters = Params}, LoopDat) ->
  	% encode the actual SCCP message
  	EncMsg = sccp_codec:encode_sccp_msgt(?SCCP_MSGT_CR, Params),
  	% generate a MTP-TRANSFER.req primitive to the lower layer
  	send_mtp_transfer_down(LoopDat, EncMsg),
  	{next_state, idle, LoopDat}.
  
  send_mtp_down(#scrc_state{mtp_tx_action = MtpTxAction}, Prim) ->
  	io:format("MTP Tx ~p, Prim ~p~n", [MtpTxAction, Prim]),
  