anchor.diff:             Fmt,
              Strict,
              Opts,
  +           Idx,
              AM);
   
  -decode(<<>>, Name, Mod, Fmt, Strict, _, AM) ->
  +decode(<<>>, Name, Mod, Fmt, Strict, _, _, AM) ->
       [AM, [], [] | newrec(Fmt, Mod, Name, Strict)];
   
  -decode(Bin, Name, Mod, Fmt, Strict, _, AM) ->
  -    Avp = #diameter_avp{data = Bin},
  +decode(Bin, Name, Mod, Fmt, Strict, _, Idx, AM) ->
  +    Avp = #diameter_avp{data = Bin, index = Idx},
       [AM, [Avp], [{5014, Avp}] | newrec(Fmt, Mod, Name, Strict)].
   
  -%% decode/13
  -
  -decode(Bin, Code, Vid, DataLen, Pad, M, P, Name, Mod, Fmt, Strict, Opts0, AM0) ->
  +%% decode/14
  +
  +decode(Bin, Code, Vid, DataLen, Pad, M, P, Name, Mod, Fmt, Strict, Opts0,
  +       Idx, AM0) ->
       case Bin of
           <<Data:DataLen/binary, _:Pad/binary, T/binary>> ->
  -            {NameT, AvpName, Arity, {Idx, AM}}
  +            {NameT, AvpName, Arity, {I, AM}}
                   = incr(Name, Code, Vid, M, Mod, Strict, Opts0, AM0),
   
               Opts = setopts(NameT, Name, M, Opts0),
  
positive.code:        Fmt,
         Strict,
         Opts,
         AM) ->
      decode(Rest,
             Code,
  
negative.code: %% encountered. Failed-AVP should typically contain the first
  %% error encountered.
  
  %% decode/8
  
  decode(<<Code:32, V:1, M:1, P:1, _:5, Len:24, I:V/unit:32, Rest/binary>>,
         Name,
  