aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/src/base/diameter_capx.erl
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2013-03-19 13:17:40 +0100
committerAnders Svensson <[email protected]>2013-03-19 13:17:40 +0100
commita457557653b15b2f8e08954d96b0a0c0ec04b04c (patch)
tree7c66f3ec57b9db9c2a5fed70b87f5a4a66d581bf /lib/diameter/src/base/diameter_capx.erl
parent53375f432c3ba5aa5a03bcbd2cb89caba6754113 (diff)
parent16da847bc882eaaf69dffd5cdaaeddf26592ca8a (diff)
downloadotp-a457557653b15b2f8e08954d96b0a0c0ec04b04c.tar.gz
otp-a457557653b15b2f8e08954d96b0a0c0ec04b04c.tar.bz2
otp-a457557653b15b2f8e08954d96b0a0c0ec04b04c.zip
Merge branch 'anders/diameter/vendor_specific_app_id/OTP-10942' into maint-r16
* anders/diameter/vendor_specific_app_id/OTP-10942: Minor capx suite fix Update appup, vsn -> 1.4.1.1 Deal with RFC 6733 change to Vendor-Specific-Application-Id
Diffstat (limited to 'lib/diameter/src/base/diameter_capx.erl')
-rw-r--r--lib/diameter/src/base/diameter_capx.erl45
1 files changed, 44 insertions, 1 deletions
diff --git a/lib/diameter/src/base/diameter_capx.erl b/lib/diameter/src/base/diameter_capx.erl
index 715b15628c..9a443fead0 100644
--- a/lib/diameter/src/base/diameter_capx.erl
+++ b/lib/diameter/src/base/diameter_capx.erl
@@ -172,7 +172,50 @@ ipaddr(A) ->
bCER(#diameter_caps{} = Rec, Dict) ->
Values = lists:zip(Dict:'#info-'(diameter_base_CER, fields),
tl(tuple_to_list(Rec))),
- Dict:'#new-'(diameter_base_CER, Values).
+ Dict:'#new-'(diameter_base_CER, [{K, map(K, V, Dict)}
+ || {K,V} <- Values]).
+
+%% map/3
+%%
+%% Deal with differerences in common dictionary AVP's to make changes
+%% transparent in service/transport config. In particular, one
+%% annoying difference between RFC 3588 and RFC 6733.
+%%
+%% RFC 6773 changes the definition of Vendor-Specific-Application-Id,
+%% giving Vendor-Id arity 1 instead of 3588's 1*. This causes woe
+%% since the corresponding dictionaries expect different values for a
+%% 'Vendor-Id': a list for 3588, an integer for 6733.
+
+map('Vendor-Specific-Application-Id', L, Dict) ->
+ Rec = Dict:'#new-'('diameter_base_Vendor-Specific-Application-Id', []),
+ Def = Dict:'#get-'('Vendor-Id', Rec),
+ [vsa(V, Def) || V <- L];
+map(_, V, _) ->
+ V.
+
+vsa({_, N, _, _} = Rec, [])
+ when is_integer(N) ->
+ setelement(2, Rec, [N]);
+
+vsa({_, [N], _, _} = Rec, undefined)
+ when is_integer(N) ->
+ setelement(2, Rec, N);
+
+vsa([_|_] = L, Def) ->
+ [vid(T, Def) || T <- L];
+
+vsa(T, _) ->
+ T.
+
+vid({'Vendor-Id' = K, N}, [])
+ when is_integer(N) ->
+ {K, [N]};
+
+vid({'Vendor-Id' = K, [N]}, undefined) ->
+ {K, N};
+
+vid(T, _) ->
+ T.
%% rCER/3
%%