anchor.diff:  -include("diameter_internal.hrl").
   
   -define(MASK(N,I), ((I) band (1 bsl (N)))).
  +-define(PAD(Len), ((4 - (Len rem 4)) rem 4)).
   
   -type u32() :: 0..16#FFFFFFFF.
   -type u24() :: 0..16#FFFFFF.
  
positive.code: pack_avp({Code, Flags, VendorId}, Bin)
    when is_binary(Bin) ->
      Sz = size(Bin),
      pack_avp(Code, Flags, VendorId, Sz, pad(Sz rem 4, Bin)).
  
  pad(0, Bin) ->
      Bin;
  pad(N, Bin) ->
      P = 8*(4-N),
      <<Bin/binary, 0:P>>.
  %% Note that padding is not included in the length field as mandated by
  %% the RFC.
  
  %% pack_avp/5
  %%
  %% Prepend the vendor id as required.
  
  pack_avp(Code, Flags, Vid, Sz, Bin)
    when 0 == Flags band 2#10000000 ->
      undefined = Vid,  %% sanity check
      pack_avp(Code, Flags, Sz, Bin);
  
  pack_avp(Code, Flags, Vid, Sz, Bin) ->
      pack_avp(Code, Flags, Sz+4, <<Vid:32, Bin/binary>>).
  
  %% pack_avp/4
  
  pack_avp(Code, Flags, Sz, Bin) ->
      Length = Sz + 8,
      <<Code:32, Flags:8, Length:24, Bin/binary>>.
  
negative.code:              N,
               Acc) ->
      DataLen = Len - 8 - V*4,  %% Might be negative, which ensures
      Pad = ?PAD(Len),          %% failure of the Data match below.
      VendorId = if 1 == V -> I; 0 == V -> undefined end,
  
      %% Duplicate the diameter_avp creation in each branch below to
  