anchor.diff:  %% Increment a stats counter for result codes in incoming and outgoing
   %% answers.
   
  +%% Message sent as a header/avps list.
  +incr_result(send = Dir,
  +            #diameter_packet{msg = [#diameter_header{} = H | _]}
  +            = Pkt,
  +            TPid,
  +            DictT) ->
  +    incr_res(Dir, Pkt#diameter_packet{header = H}, TPid, DictT);
  +
   %% Outgoing message as binary: don't count. (Sending binaries is only
   %% partially supported.)
  -incr_result(_, #diameter_packet{msg = undefined = No}, _, _) ->
  +incr_result(send, #diameter_packet{header = undefined = No}, _, _) ->
       No;
   
   %% Incoming or outgoing. Outgoing with encode errors never gets here
   %% since encode fails.
  -incr_result(Dir, Pkt, TPid, {MsgDict, AppDict, Dict0}) ->
  -    #diameter_packet{header = #diameter_header{is_error = E}
  -                            = Hdr,
  -                     errors = Es}
  -        = Pkt,
  +incr_result(Dir, Pkt, TPid, DictT) ->
  +    incr_res(Dir, Pkt, TPid, DictT).
  +
  +incr_res(Dir,
  +         #diameter_packet{header = #diameter_header{is_error = E}
  +                          = Hdr,
  +                          errors = Es}
  +         = Pkt,
  +         TPid,
  +         DictT) ->
  +    {MsgDict, AppDict, Dict0} = DictT,
   
       Id = msg_id(Hdr, AppDict),
       %% Could be {relay, 0}, in which case the R-bit is redundant since
  
positive.code:        is_tuple(Msg) ->
      local(Msg, TPid, DictT, Fs, ReqPkt#diameter_packet{errors = []});
  
  local(Msg, TPid, {MsgDict, AppDict, Dict0} = DictT, Fs, ReqPkt) ->
      Pkt = encode({MsgDict, AppDict},
                   TPid,
                   reset(make_answer_packet(Msg, ReqPkt), MsgDict, Dict0),
                   Fs),
      incr(send, Pkt, TPid, AppDict),
      incr_rc(send, Pkt, TPid, DictT),  %% count outgoing
      Pkt.
  
  %% reset/3
  
  
negative.code:     local(Ans, TPid, {MsgDict, AppDict, Dict0}, Fs, ReqPkt);
  
  %% ... or relayed.
  reply(#diameter_packet{} = Pkt, _TPid, {AppDict, Dict0}, Fs, _ReqPkt) ->
      eval_packet(Pkt, Fs),
      {msg_dict(AppDict, Dict0, Pkt), Pkt}.
  
  %% local/5
  %%
  