aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/src
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2011-08-17 11:50:23 +0200
committerAnders Svensson <[email protected]>2011-08-17 11:50:23 +0200
commit46bcbf8b8c5e53d3b9aaa1be987947fc0b927f8d (patch)
treeb814e88ab7ae189f07ac6bd362817b7fa6a67c3d /lib/diameter/src
parenta7c0e439ee84d25ce18f65959be06315063a7de8 (diff)
downloadotp-46bcbf8b8c5e53d3b9aaa1be987947fc0b927f8d.tar.gz
otp-46bcbf8b8c5e53d3b9aaa1be987947fc0b927f8d.tar.bz2
otp-46bcbf8b8c5e53d3b9aaa1be987947fc0b927f8d.zip
@id required in dictionary files only when @messages is specified.
@id defines an application identifier and this is used only when sending or receiving messages. A dictionary can define only AVP's however, to be included by other dictionaries using @inherits, in which case it makes no sense to require @id. Note that message definitions are not inherited with @inherits, only AVP's
Diffstat (limited to 'lib/diameter/src')
-rw-r--r--lib/diameter/src/compiler/diameter_codegen.erl17
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/diameter/src/compiler/diameter_codegen.erl b/lib/diameter/src/compiler/diameter_codegen.erl
index 213ba0d22c..6895f38248 100644
--- a/lib/diameter/src/compiler/diameter_codegen.erl
+++ b/lib/diameter/src/compiler/diameter_codegen.erl
@@ -250,9 +250,14 @@ f_name(Name) ->
%%% ------------------------------------------------------------------------
f_id(Spec) ->
- Id = orddict:fetch(id, Spec),
{?function, id, 0,
- [{?clause, [], [], [?INTEGER(Id)]}]}.
+ [c_id(orddict:find(id, Spec))]}.
+
+c_id({ok, Id}) ->
+ {?clause, [], [], [?INTEGER(Id)]};
+
+c_id(error) ->
+ ?UNEXPECTED(0).
%%% ------------------------------------------------------------------------
%%% # vendor_id/0
@@ -537,10 +542,14 @@ f_msg_header(Spec) ->
{?function, msg_header, 1, msg_header(Spec) ++ [?UNEXPECTED(1)]}.
msg_header(Spec) ->
+ msg_header(get_value(messages, Spec), Spec).
+
+msg_header([], _) ->
+ [];
+msg_header(Msgs, Spec) ->
ApplId = orddict:fetch(id, Spec),
- lists:map(fun({M,C,F,_,_}) -> c_msg_header(M, C, F, ApplId) end,
- get_value(messages, Spec)).
+ lists:map(fun({M,C,F,_,_}) -> c_msg_header(M, C, F, ApplId) end, Msgs).
%% Note that any application id in the message header spec is ignored.