anchor.diff:    when [] == Es;
          is_record(hd(Msg), diameter_header) ->
       Pkt = diameter_codec:encode(Dict, make_answer_packet(Msg, ReqPkt)),
  -    incr(send, Pkt, TPid),  %% count result codes in sent answers
  +    incr(send, Pkt, Dict, TPid),  %% count result codes in sent answers
       send(TPid, Pkt#diameter_packet{transport_data = TD});
   
   %% Or not: set Result-Code and Failed-AVP AVP's.
  
positive.code: %% Maintain statistics assuming one or the other, not both, which is
  %% surely the intent of the RFC.
  
  rc_counter(_, RC)
    when is_integer(RC) ->
      {'Result-Code', RC};
  rc_counter(Rec, _) ->
      rcc(get_avp_value(?BASE, 'Experimental-Result', Rec)).
  
  %% Outgoing answers may be in any of the forms messages can be sent
  %% in. Incoming messages will be records. We're assuming here that the
  %% arity of the result code AVP's is 0 or 1.
  
  rcc([{_,_,RC} = T])
    when is_integer(RC) ->
      T;
  rcc({_,_,RC} = T)
    when is_integer(RC) ->
      T;
  rcc(_) ->
      undefined.
  
  int([N])
    when is_integer(N) ->
      N;
  int(N)
  
negative.code: %% Increment a stats counter for an incoming or outgoing message.
  
  %% TODO: fix
  incr(_, #diameter_packet{msg = undefined}, _, _) ->
      ok;
  
  incr(recv = D, #diameter_packet{header = H, errors = [_|_]}, _, TPid) ->
      incr(TPid, {diameter_codec:msg_id(H), D, error});
  
  incr(Dir, Pkt, Dict, TPid) ->
      #diameter_packet{header = #diameter_header{is_error = E}
                              = Hdr,
                       msg = Rec}
          = Pkt,
  
      RC = int(get_avp_value(Dict, 'Result-Code', Rec)),
      PE = is_protocol_error(RC),
  
      %% Check that the E bit is set only for 3xxx result codes.
  