anchor.diff:  -record(targetlist, {list}).
   
   -record(target, {
  -	  ref,		%% ref(), unique reference
  -	  branch,	%% string(), this clients branch
  -	  request,	%% request record()
  -	  pid,		%% pid() of client transaction ???
  -	  state,
  -	  timeout,
  -	  endresult,
  -	  dstlist,	%% list() of sipdst record(), more destinations if this one fail
  -	  cancelled=false
  +	  ref,			%% ref(), unique reference
  +	  branch,		%% string(), this clients branch
  +	  request,		%% request record()
  +	  pid,			%% pid() of client transaction ???
  +	  state,		%% atom(), SIP state of this target
  +	  timeout,		%% integer()
  +	  endresult=none,	%% none | sp_response record()
  +	  dstlist,		%% list() of sipdst record(), more destinations if this one fail
  +	  cancelled=false	%% true | false, is this branch cancelled?
   	 }).
   
   %%--------------------------------------------------------------------
  
positive.code:     Request = H#target.request,
      {Method, URI} = {Request#request.method, Request#request.uri},
      RespStr = case H#target.endresult of
  	none -> "no response";
  	Response when is_record(Response, response) ->
  	    lists:concat(["response=", Response#response.status, " ", Response#response.reason]);
  	_ -> "INVALID response"
      end,
      Str = lists:concat(["pid=", pid_to_list(H#target.pid), "branch=", H#target.branch, ", request=", Method, " ",
  		sipurl:print(URI), ", ", RespStr, ", cancelled=", H#target.cancelled, ", state=" , H#target.state]),
      debugfriendly2(T, [binary_to_list(list_to_binary(Str)) | Res]).
  
  get_using_branch(Branch, TargetList) when is_record(TargetList, targetlist) ->
      get_using_branch(Branch, TargetList#targetlist.list);
  
  get_using_branch(_Branch, []) ->
      none;
  get_using_branch(Branch, [H | _T]) when is_record(H, target), H#target.branch == Branch ->
      H;
  get_using_branch(Branch, [H | T]) when is_record(H, target) ->
      get_using_branch(Branch, T).
  
  
  get_targets_in_state(State, TargetList) when is_record(TargetList, targetlist) ->
      get_targets_in_state(State, TargetList#targetlist.list);
  
  get_targets_in_state(_State, []) ->
      [];
  get_targets_in_state(State, [H | T]) when is_record(H, target), H#target.state == State ->
      lists:append(get_targets_in_state(State, T), [H]);
  get_targets_in_state(State, [H | T]) when is_record(H, target) ->
      get_targets_in_state(State, T).
  
  
  get_responses(TargetList) when is_record(TargetList, targetlist) ->
      get_responses2(TargetList#targetlist.list, []).
  
  get_responses2([], Res) ->
      Res;
  get_responses2([H | T], Res) when is_record(H, target) ->
      case H#target.endresult of
  	Response when is_record(Response, response) ->
  	    get_responses2(T, lists:append(Res, [Response]));
  	_ ->
  	    get_responses2(T, Res)
      end.
  
  
  extract(Values, Target) when is_record(Target, target) ->
      extract(Values, Target, []).
  
  extract([], Target, Res) when is_record(Target, target) ->
      Res;
  extract([pid | T], Target, Res) when is_record(Target, target) ->
      extract(T, Target, lists:append(Res, [Target#target.pid]));
  extract([branch | T], Target, Res) when is_record(Target, target) ->
      extract(T, Target, lists:append(Res, [Target#target.branch]));
  extract([request | T], Target, Res) when is_record(Target, target) ->
      extract(T, Target, lists:append(Res, [Target#target.request]));
  extract([state | T], Target, Res) when is_record(Target, target) ->
      extract(T, Target, lists:append(Res, [Target#target.state]));
  extract([timeout | T], Target, Res) when is_record(Target, target) ->
      extract(T, Target, lists:append(Res, [Target#target.timeout]));
  extract([dstlist | T], Target, Res) when is_record(Target, target) ->
      extract(T, Target, lists:append(Res, [Target#target.dstlist]));
  extract([endresult | T], Target, Res) when is_record(Target, target) ->
      extract(T, Target, lists:append(Res, [Target#target.endresult]));
  extract([cancelled | T], Target, Res) when is_record(Target, target) ->
      extract(T, Target, lists:append(Res, [Target#target.cancelled])).
  
  set_pid(Target, Value) when is_record(Target, target) ->
      Target#target{pid=Value}.
  set_state(Target, Value) when is_record(Target, target) ->
      Target#target{state=Value}.
  set_endresult(Target, Value) when is_record(Target, target) ->
      Target#target{endresult=Value}.
  set_dstlist(Target, Value) when is_record(Target, target) ->
      Target#target{dstlist=Value}.
  set_cancelled(Target, Value) when is_record(Target, target) ->
      Target#target{cancelled=Value}.
  
  
negative.code: -export([
  	 add/7,
  	 empty/0,
  	 get_length/1,
  	 debugfriendly/1,
  	 get_using_pid/2,
  	 get_using_branch/2,
  	 get_targets_in_state/2,
  	 get_responses/1,
  