anchor.diff:  
   %% incr/4
   %%
  -%% Increment a stats counter for an incoming or outgoing message.
  +%% Increment a stats counter for result codes in incoming and outgoing
  +%% answers.
   
   %% Outgoing message as binary: don't count. (Sending binaries is only
   %% partially supported.)
   incr(_, #diameter_packet{msg = undefined}, _, _) ->
       ok;
   
  +%% Incoming with decode errors.
   incr(recv = D, #diameter_packet{header = H, errors = [_|_]}, _, TPid) ->
       incr(TPid, {diameter_codec:msg_id(H), D, error});
   
  +%% Incoming without errors or outgoing. Outgoing with encode errors
  +%% never gets here since encode fails.
   incr(Dir, Pkt, Dict, TPid) ->
       #diameter_packet{header = #diameter_header{is_error = E}
                               = Hdr,
  
positive.code: incr(TPid, Counter) ->
      diameter_stats:incr(Counter, TPid, 1).
  
  %% error_counter/2
  
  %% RFC 3588, 7.6:
  %%
  
negative.code: 
  answer(Pkt, SvcName, Dict, App, #request{transport = TPid} = Req) ->
      try
          incr(recv, Pkt, Dict, TPid) %% count result codes in received answers
      of
          _ -> answer(Pkt, SvcName, App, Req)
      catch
          exit: {invalid_error_bit, RC} ->
              #diameter_packet{errors = Es}
                  = Pkt,
              E = {5004, #diameter_avp{name = 'Result-Code', value = RC}},
              answer(Pkt#diameter_packet{errors = [E|Es]}, SvcName, App, Req)
      end.
  
  answer(Pkt,
  