anchor.diff:  enc_AVP(Name, #diameter_avp{name = AvpName, value = Data}, Opts, Mod) ->
       0 == Mod:avp_arity(Name, AvpName)
           orelse ?THROW([known_avp_as_AVP, Name, AvpName, Data]),
  -    enc(AvpName, [Data], Opts, Mod);
  +    enc(AvpName, Data, Opts, Mod);
   
   %% The backdoor ...
   enc_AVP(_, {AvpName, Value}, Opts, Mod) ->
  -    enc(AvpName, [Value], Opts, Mod);
  +    enc(AvpName, Value, Opts, Mod);
   
   %% ... and the side door.
   enc_AVP(_Name, {_Dict, _AvpName, _Data} = T, Opts, _) ->
       diameter_codec:pack_avp(#diameter_avp{data = T}, Opts).
  +
  +%% enc/4
  +
  +enc(AvpName, Value, Opts, Mod) ->
  +    enc1(AvpName, Mod:avp_header(AvpName), Value, Opts, Mod).
   
   %% ---------------------------------------------------------------------------
   %% # decode_avps/3
  
positive.code:   when not is_list(T) ->
      ?THROW([repeated_avp_as_non_list, AvpName, T]);
  
  enc(_, AvpName, {Min, _}, L, _, _)
    when length(L) < Min ->
      ?THROW([repeated_avp_insufficient_arity, AvpName, Min, L]);
  
  enc(_, AvpName, {_, Max}, L, _, _)
    when Max < length(L) ->
      ?THROW([repeated_avp_excessive_arity, AvpName, Max, L]);
  
  enc(Name, AvpName, _, Values, Opts, Mod) ->
      enc(Name, AvpName, Values, Opts, Mod).
  
  %% enc/5
  
  enc(Name, 'AVP', Values, Opts, Mod) ->
      [enc_AVP(Name, A, Opts, Mod) || A <- Values];
  
  enc(_, AvpName, Values, Opts, Mod) ->
      enc(AvpName, Values, Opts, Mod).
  
  %% enc/4
  
  enc(AvpName, Values, Opts, Mod) ->
      H = Mod:avp_header(AvpName),
      [diameter_codec:pack_data(H, Mod:avp(encode, V, AvpName, Opts))
       || V <- Values].
  
  %% enc_AVP/4
  
  
negative.code:     ?THROW([mandatory_avp_missing, AvpName]);
  
  enc(Name, AvpName, 1, Value, Opts, Mod) ->
      H = avp_header(AvpName, Mod),
      enc1(Name, AvpName, H, Value, Opts, Mod);
  
  enc(_, _, {0,_}, [], _, _) ->
      [];
  