aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2011-10-19 22:57:44 +0200
committerHarald Welte <laforge@gnumonks.org>2011-10-19 22:57:44 +0200
commitab725b5cc73559c50eb1fe17c9c6f43b2a0528d1 (patch)
tree5d8b18fcee79724898e4175735ccfef317cf88bf
parentab61a4ec387a1d35fde860477b45978ac7dcc1ac (diff)
allow users to bind to a subsystem number on all local point codes
binding to {SSN,undefined} basically corresponds to binding to a UDP port with INADDR_ANY.
-rw-r--r--src/sccp_user.erl12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/sccp_user.erl b/src/sccp_user.erl
index 0795afb..0df5c7d 100644
--- a/src/sccp_user.erl
+++ b/src/sccp_user.erl
@@ -56,6 +56,10 @@ init(_Arg) ->
% client side code
+bind_ssn(Ssn) when is_integer(Ssn) ->
+ gen_server:call(?MODULE, {bind_ssn, Ssn, undefined}).
+bind_ssn(Ssn, undefined) when is_integer(Ssn) ->
+ gen_server:call(?MODULE, {bind_ssn, Ssn, undefined});
bind_ssn(Ssn, Pc) when is_integer(Ssn), is_integer(Pc) ->
gen_server:call(?MODULE, {bind_ssn, Ssn, Pc});
bind_ssn(Ssn, Pc) when is_integer(Ssn), is_tuple(Pc) ->
@@ -76,7 +80,13 @@ pid_for_ssn(Ssn, Pc) when is_integer(Ssn), is_integer(Pc) ->
[#scu_record{user_pid = UserPid}] ->
{ok, UserPid};
_ ->
- {error, no_such_ssn}
+ % check if somebody has bound a SSN to all point codes
+ case ets:lookup(sccp_user_tbl, {Ssn, undefined}) of
+ [#scu_record{user_pid = UserPid}] ->
+ {ok, UserPid};
+ _ ->
+ {error, no_such_ssn}
+ end
end;
pid_for_ssn(Ssn, Pc) when is_integer(Ssn), is_tuple(Pc) ->
PcInt = osmo_util:pointcode2int(Pc),