anchor.diff:  
   %% get_avp/3
   %%
  -%% Find an AVP in a message of one of three forms:
  -%%
  -%% - a message record (as generated from a .dia spec) or
  -%% - a list of an atom message name followed by 2-tuple, avp name/value pairs.
  -%% - a list of a #diameter_header{} followed by #diameter_avp{} records,
  -%%
  -%% In the first two forms a dictionary module is used at encode to
  -%% identify the type of the AVP and its arity in the message in
  -%% question. The third form allows messages to be sent as is, without
  -%% a dictionary, which is needed in the case of relay agents, for one.
  +%% Find an AVP in a message in one of the decoded formats, or as a
  +%% header/avps list. There are only four AVPs that are extracted here:
  +%% Result-Code and Experimental-Result in order when constructing
  +%% counter keys, and Destination-Host/Realm when selecting a next-hop
  +%% peer. Experimental-Result is the only of type Grouped, and is given
  +%% special treatment in order to return the value as a record.
   
   %% Messages will be header/avps list as a relay and the only AVP's we
   %% look for are in the common dictionary. This is required since the
  
positive.code:       string_decode => false,
        strict_mbit => false,
        failed_avp => false,
        dictionary => Dict}.
  
negative.code: 
  %% avp_decode/3
  
  %% Ensure Experimental-Result is decoded as record, since this format
  %% is used for counter keys.
  avp_decode(Dict, 'Experimental-Result' = N, #diameter_avp{data = Bin}
                                              = Avp)
    when is_binary(Bin) ->
      {V,_} = Dict:avp(decode, Bin, N, decode_opts(Dict)),
      Avp#diameter_avp{name = N, value = V};
  
  avp_decode(Dict, Name, #diameter_avp{value = X,
                                       data = Bin}
                         = Avp)
    when is_binary(Bin), X == undefined orelse X == false ->
      V = Dict:avp(decode, Bin, Name, decode_opts(Dict)),
      Avp#diameter_avp{name = Name, value = V};
  
  avp_decode(_, Name, #diameter_avp{} = Avp) ->
      Avp#diameter_avp{name = Name}.
  
  %% cb/3
  
  cb(#diameter_app{module = [_|_] = M}, F, A) ->
      eval(M, F, A).
  