anchor.diff:  log(#diameter_packet{} = P, T) ->
       io:format("~p: ~p~n", [T,P]).
   
  +%% prepare/3
  +
  +prepare(Pkt, Caps, send_invalid_avp_bits) ->
  +    Req = prepare(Pkt, Caps),
  +    %% Last AVP in our STR is Termination-Cause of type Unsigned32:
  +    %% set its length improperly.
  +    #diameter_packet{header = #diameter_header{length = L},
  +                     bin = B}
  +        = E
  +        = diameter_codec:encode(?BASE, Pkt#diameter_packet{msg = Req}),
  +    Offset = L - 7,  %% to AVP Length
  +    <<H:Offset/binary, 12:24/integer, T:4/binary>> = B,
  +    E#diameter_packet{bin = <<H/binary, 13:24/integer, T/binary>>};
  +
  +prepare(Pkt, Caps, N)
  +  when N == send_invalid_avp_length;
  +       N == send_invalid_reject ->
  +    Req = prepare(Pkt, Caps),
  +    %% Second last AVP in our STR is Auth-Application-Id of type
  +    %% Unsigned32: Send a value of length 8.
  +    #diameter_packet{header = #diameter_header{length = L},
  +                     bin = B0}
  +        = E
  +        = diameter_codec:encode(?BASE, Pkt#diameter_packet{msg = Req}),
  +    Offset = L - 7 - 12,  %% to AVP Length
  +    <<H0:Offset/binary, 12:24/integer, T:16/binary>> = B0,
  +    <<V, L:24/integer, H/binary>> = H0,  %% assert
  +    E#diameter_packet{bin = <<V,
  +                              (L+4):24/integer,
  +                              H/binary,
  +                              16:24/integer,
  +                              0:32/integer,
  +                              T/binary>>};
  +
   prepare(Pkt, Caps, send_unsupported) ->
       Req = prepare(Pkt, Caps),
       #diameter_packet{bin = <<H:5/binary, _CmdCode:3/binary, T/binary>>}
  
positive.code:          send_unsupported_app/1,
           send_error_bit/1,
           send_unsupported_version/1,
           send_long/1,
           send_nopeer/1,
           send_noapp/1,
  
negative.code: send_nok(Config) ->
      Req = ['ACR', {'Accounting-Record-Type', ?EVENT_RECORD},
                    {'Accounting-Record-Number', 0}],
  
      #'diameter_base_answer-message'{'Result-Code' = ?INVALID_AVP_BITS}
          = call(Config, Req).
  
  