aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2017-04-19 23:15:14 +0200
committerAnders Svensson <[email protected]>2017-06-12 16:13:52 +0200
commit1b6f8a04ac3375217d9e0203898ffaedfb1f234f (patch)
tree5764b99ed1eee5623c86f765533311d358c76349 /lib
parent6bf25fd661a43f9c72cf6292965f76fd7570d24f (diff)
downloadotp-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.
Diffstat (limited to 'lib')
-rw-r--r--lib/diameter/include/diameter_gen.hrl10
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