diff options
author | Anders Svensson <[email protected]> | 2017-04-19 23:15:14 +0200 |
---|---|---|
committer | Anders Svensson <[email protected]> | 2017-06-12 16:13:52 +0200 |
commit | 1b6f8a04ac3375217d9e0203898ffaedfb1f234f (patch) | |
tree | 5764b99ed1eee5623c86f765533311d358c76349 | |
parent | 6bf25fd661a43f9c72cf6292965f76fd7570d24f (diff) | |
download | otp-1b6f8a04ac3375217d9e0203898ffaedfb1f234f.tar.gz otp-1b6f8a04ac3375217d9e0203898ffaedfb1f234f.tar.bz2 otp-1b6f8a04ac3375217d9e0203898ffaedfb1f234f.zip |
Be more flexible in what can be packed as 'AVP'
In particular, allow {Name, Value} and {Dict, Name, Value} without
requiring a diameter_avp wrapper.
-rw-r--r-- | lib/diameter/include/diameter_gen.hrl | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/diameter/include/diameter_gen.hrl b/lib/diameter/include/diameter_gen.hrl index e35d448754..99f5da5aee 100644 --- a/lib/diameter/include/diameter_gen.hrl +++ b/lib/diameter/include/diameter_gen.hrl @@ -173,7 +173,15 @@ pack_AVP(Name, #diameter_avp{name = AvpName, value = Data}) -> 0 == avp_arity(Name, AvpName) orelse ?THROW([known_avp_as_AVP, Name, AvpName, Data]), - e(AvpName, [Data]). + e(AvpName, [Data]); + +%% The backdoor ... +pack_AVP(_, {AvpName, Value}) -> + e(AvpName, [Value]); + +%% ... and the side door. +pack_AVP(_Name, {_Dict, _AvpName, _Data}= T) -> + diameter_codec:pack_avp(#diameter_avp{data = T}). %% --------------------------------------------------------------------------- %% # decode_avps/2 |