anchor.diff:  
   -define(THROW(T), throw({?MODULE, T})).
   
  -%%% ---------------------------------------------------------------------------
  -%%% # encode_avps/3
  -%%%
  -%%% Returns: binary()
  -%%% ---------------------------------------------------------------------------
  +-type parent_name()   :: atom().  %% parent = Message or AVP
  +-type parent_record() :: tuple(). %%
  +-type avp_name()   :: atom().
  +-type avp_record() :: tuple().
  +-type avp_values() :: [{avp_name(), term()}].
  +
  +-type non_grouped_avp() :: #diameter_avp{}.
  +-type grouped_avp() :: nonempty_improper_list(#diameter_avp{}, [avp()]).
  +-type avp() :: non_grouped_avp() | grouped_avp().
  +
  +%% ---------------------------------------------------------------------------
  +%% # encode_avps/2
  +%% ---------------------------------------------------------------------------
  +
  +-spec encode_avps(parent_name(), parent_record() | avp_values())
  +   -> binary()
  +    | no_return().
   
   encode_avps(Name, Vals)
     when is_list(Vals) ->
  
positive.code: value(_, Avp) ->
      Avp#diameter_avp.value.
  
  %%% ---------------------------------------------------------------------------
  %%% # grouped_avp/3
  %%% ---------------------------------------------------------------------------
  
  grouped_avp(decode, Name, Data) ->
      {Rec, Avps, []} = decode_avps(Name, diameter_codec:collect_avps(Data)),
      {Rec, Avps};
  %% Note that a failed match here will result in 5004. Note that this is
  %% the only AVP type that doesn't just return the decoded value, also
  %% returning the list of component #diameter_avp{}'s.
  
  grouped_avp(encode, Name, Data) ->
      encode_avps(Name, Data).
  
  %%% ---------------------------------------------------------------------------
  %%% # empty_group/1
  %%% ---------------------------------------------------------------------------
  
  empty_group(Name) ->
      list_to_binary(empty_body(Name)).
  
negative.code:     Bin = diameter_codec:pack_avp(avp_header(Name), empty_value(Name)),
      << <<0>> || <<_>> <= Bin >>.
  
  %% ---------------------------------------------------------------------------
  %% # empty/1
  %% ---------------------------------------------------------------------------
  
  empty(AvpName) ->
      avp(encode, zero, AvpName).
  