aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/src/base
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2017-07-08 00:48:07 +0200
committerAnders Svensson <[email protected]>2017-08-03 17:14:28 +0200
commit55e65b262cdf0b794ab443928676720a323cf6b0 (patch)
treefe4214afece02c79c2f48b2a10e11bdf20c364f4 /lib/diameter/src/base
parentdf12f634bec4b784f4c8d16846f2c24297b0e1ac (diff)
downloadotp-55e65b262cdf0b794ab443928676720a323cf6b0.tar.gz
otp-55e65b262cdf0b794ab443928676720a323cf6b0.tar.bz2
otp-55e65b262cdf0b794ab443928676720a323cf6b0.zip
Rename record_decode -> decode_format
{record_decode, map} is a bit too quirky.
Diffstat (limited to 'lib/diameter/src/base')
-rw-r--r--lib/diameter/src/base/diameter.erl6
-rw-r--r--lib/diameter/src/base/diameter_codec.erl2
-rw-r--r--lib/diameter/src/base/diameter_config.erl10
-rw-r--r--lib/diameter/src/base/diameter_gen.erl4
-rw-r--r--lib/diameter/src/base/diameter_peer_fsm.erl6
-rw-r--r--lib/diameter/src/base/diameter_service.erl2
-rw-r--r--lib/diameter/src/base/diameter_traffic.erl6
-rw-r--r--lib/diameter/src/base/diameter_watchdog.erl6
8 files changed, 23 insertions, 19 deletions
diff --git a/lib/diameter/src/base/diameter.erl b/lib/diameter/src/base/diameter.erl
index b033632c47..75deaad511 100644
--- a/lib/diameter/src/base/diameter.erl
+++ b/lib/diameter/src/base/diameter.erl
@@ -47,6 +47,7 @@
stop/0]).
-export_type([evaluable/0,
+ decode_format/0,
restriction/0,
message_length/0,
remotes/0,
@@ -330,6 +331,9 @@ call(SvcName, App, Message) ->
-type message_length()
:: 0..16#FFFFFF.
+-type decode_format()
+ :: record | list | map | false.
+
%% Options passed to start_service/2
-type service_opt()
@@ -338,7 +342,7 @@ call(SvcName, App, Message) ->
| {restrict_connections, restriction()}
| {sequence, sequence() | evaluable()}
| {share_peers, remotes()}
- | {record_decode, boolean() | list | map}
+ | {decode_format, decode_format()}
| {string_decode, boolean()}
| {strict_mbit, boolean()}
| {incoming_maxlen, message_length()}
diff --git a/lib/diameter/src/base/diameter_codec.erl b/lib/diameter/src/base/diameter_codec.erl
index 9043af145e..275e80b9bb 100644
--- a/lib/diameter/src/base/diameter_codec.erl
+++ b/lib/diameter/src/base/diameter_codec.erl
@@ -290,7 +290,7 @@ rec2msg(Mod, Rec) ->
%% longer *the* decode.
decode(Mod, Pkt) ->
- Opts = #{record_decode => true,
+ Opts = #{decode_format => record,
string_decode => true,
strict_mbit => true,
rfc => 6733},
diff --git a/lib/diameter/src/base/diameter_config.erl b/lib/diameter/src/base/diameter_config.erl
index 8f958a67b4..09018308d5 100644
--- a/lib/diameter/src/base/diameter_config.erl
+++ b/lib/diameter/src/base/diameter_config.erl
@@ -713,7 +713,7 @@ make_config(SvcName, Opts) ->
{nodes, restrict_connections},
{16#FFFFFF, incoming_maxlen},
{true, strict_mbit},
- {true, record_decode},
+ {record, decode_format},
{true, string_decode},
{[], spawn_opt}]),
@@ -757,7 +757,7 @@ opt(K, false = B)
K == monitor;
K == restrict_connections;
K == strict_mbit;
- K == record_decode;
+ K == decode_format;
K == string_decode ->
B;
@@ -765,12 +765,12 @@ opt(K, true = B)
when K == share_peers;
K == use_shared_peers;
K == strict_mbit;
- K == record_decode;
K == string_decode ->
B;
-opt(record_decode, T)
- when T == list;
+opt(decode_format, T)
+ when T == record;
+ T == list;
T == map ->
T;
diff --git a/lib/diameter/src/base/diameter_gen.erl b/lib/diameter/src/base/diameter_gen.erl
index 2381b73d07..239d4a535f 100644
--- a/lib/diameter/src/base/diameter_gen.erl
+++ b/lib/diameter/src/base/diameter_gen.erl
@@ -178,7 +178,7 @@ enc_AVP(_Name, {_Dict, _AvpName, _Data} = T, Opts, _) ->
-> {parent_record(), [avp()], Failed}
when Failed :: [{5000..5999, #diameter_avp{}}].
-decode_avps(Name, Recs, #{module := Mod, record_decode := Fmt} = Opts) ->
+decode_avps(Name, Recs, #{module := Mod, decode_format := Fmt} = Opts) ->
{Avps, {Rec, AM, Failed}}
= mapfoldl(fun(T,A) -> decode(Name, Opts, Mod, T, A) end,
{newrec(Mod, Name, Fmt), #{}, []},
@@ -749,7 +749,7 @@ empty(Name, #{module := Mod} = Opts) ->
newrec(_, _, false = No) ->
No;
-newrec(Mod, Name, true) ->
+newrec(Mod, Name, record) ->
newrec(Mod, Name);
newrec(_, Name, _) ->
diff --git a/lib/diameter/src/base/diameter_peer_fsm.erl b/lib/diameter/src/base/diameter_peer_fsm.erl
index f2fbb70270..abf948593f 100644
--- a/lib/diameter/src/base/diameter_peer_fsm.erl
+++ b/lib/diameter/src/base/diameter_peer_fsm.erl
@@ -128,7 +128,7 @@
%% outgoing DPR; boolean says whether or not
%% the request was sent explicitly with
%% diameter:call/4.
- codec :: #{record_decode := true,
+ codec :: #{decode_format := record,
string_decode := boolean(),
strict_mbit := boolean(),
rfc := 3588 | 6733,
@@ -254,13 +254,13 @@ i({Ack, WPid, {M, Ref} = T, Opts, {SvcOpts, Nodes, Dict0, Svc}}) ->
length_errors = LengthErr,
strict = Strictness,
incoming_maxlen = Maxlen,
- codec = maps:with([record_decode,
+ codec = maps:with([decode_format,
string_decode,
strict_mbit,
rfc,
ordered_encode],
SvcOpts#{ordered_encode => false,
- record_decode => true})}.
+ decode_format => record})}.
%% The transport returns its local ip addresses so that different
%% transports on the same service can use different local addresses.
%% The local addresses are put into Host-IP-Address avps here when
diff --git a/lib/diameter/src/base/diameter_service.erl b/lib/diameter/src/base/diameter_service.erl
index 7f7e3e3a3f..43be4d889a 100644
--- a/lib/diameter/src/base/diameter_service.erl
+++ b/lib/diameter/src/base/diameter_service.erl
@@ -113,7 +113,7 @@
restrict_connections := diameter:restriction(),
incoming_maxlen := diameter:message_length(),
strict_mbit := boolean(),
- record_decode := boolean() | map | list,
+ decode_format := diameter:decode_format(),
string_decode := boolean(),
spawn_opt := list() | {module(), atom(), list()}}}).
diff --git a/lib/diameter/src/base/diameter_traffic.erl b/lib/diameter/src/base/diameter_traffic.erl
index 6594994cfa..f684f60cb7 100644
--- a/lib/diameter/src/base/diameter_traffic.erl
+++ b/lib/diameter/src/base/diameter_traffic.erl
@@ -76,7 +76,7 @@
service_name :: diameter:service_name(),
apps :: [#diameter_app{}],
sequence :: diameter:sequence(),
- codec :: #{record_decode := boolean() | map | list,
+ codec :: #{decode_format := diameter:decode_format(),
string_decode := boolean(),
strict_mbit := boolean(),
incoming_maxlen := diameter:message_length()}}).
@@ -103,7 +103,7 @@ make_recvdata([SvcName, PeerT, Apps, SvcOpts | _]) ->
peerT = PeerT,
apps = Apps,
sequence = Mask,
- codec = maps:with([record_decode,
+ codec = maps:with([decode_format,
string_decode,
strict_mbit,
ordered_encode,
@@ -1976,7 +1976,7 @@ choose(false, _, X) -> X.
%% Decode options sufficient for AVP extraction.
decode_opts(Dict) ->
- #{record_decode => true,
+ #{decode_format => record,
string_decode => false,
strict_mbit => false,
failed_avp => false,
diff --git a/lib/diameter/src/base/diameter_watchdog.erl b/lib/diameter/src/base/diameter_watchdog.erl
index c3dc8c3bf0..60baf1e8a4 100644
--- a/lib/diameter/src/base/diameter_watchdog.erl
+++ b/lib/diameter/src/base/diameter_watchdog.erl
@@ -72,7 +72,7 @@
restrict := boolean(),
suspect := non_neg_integer(), %% OKAY -> SUSPECT
okay := non_neg_integer()}, %% REOPEN -> OKAY
- codec :: #{record_decode := false,
+ codec :: #{decode_format := false,
string_decode := false,
strict_mbit := boolean(),
failed_avp := false,
@@ -136,7 +136,7 @@ i({Ack, T, Pid, {Opts,
putr(restart, {T, Opts, Svc, SvcOpts}), %% save seeing it in trace
putr(dwr, dwr(Caps)), %%
Nodes = restrict_nodes(Restrict),
- CodecKeys = [record_decode,
+ CodecKeys = [decode_format,
string_decode,
strict_mbit,
incoming_maxlen,
@@ -157,7 +157,7 @@ i({Ack, T, Pid, {Opts,
suspect => 1,
okay => 3},
Opts)),
- codec = maps:with(CodecKeys, SvcOpts#{record_decode := false,
+ codec = maps:with(CodecKeys, SvcOpts#{decode_format := false,
string_decode := false,
ordered_encode => false})}.