summaryrefslogtreecommitdiffstats
path: root/TCAP/src/ITU/tcap_tco_server.erl
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2012-01-30 19:47:24 +0100
committerHarald Welte <laforge@gnumonks.org>2012-01-30 19:47:24 +0100
commit8adb719ce57311bb12d21a86cd2ea1f3dc3279e5 (patch)
treefdd04d5d39457f8dc42ef2ea4501225e4d405f50 /TCAP/src/ITU/tcap_tco_server.erl
parentfd392388e9c0d83d2478ee7cae52b28233cd193b (diff)
TCO: correctly parse/decode incoming transaciton IDs to resolve TSM
Diffstat (limited to 'TCAP/src/ITU/tcap_tco_server.erl')
-rw-r--r--TCAP/src/ITU/tcap_tco_server.erl12
1 files changed, 10 insertions, 2 deletions
diff --git a/TCAP/src/ITU/tcap_tco_server.erl b/TCAP/src/ITU/tcap_tco_server.erl
index 8aebdcc..3ad480c 100644
--- a/TCAP/src/ITU/tcap_tco_server.erl
+++ b/TCAP/src/ITU/tcap_tco_server.erl
@@ -309,6 +309,8 @@ handle_cast({'N', 'UNITDATA', indication, UdataParams}, State)
% or that there are enough resources available. The real
% test is in whether the start succeeds.
case supervisor:start_child(State#state.supervisor, ChildSpec) of
+ % FIXME: the entire mobile-termianted
+ % transaction handling needs to reflect tcap_transaction_sup
{ok, TSM} ->
% Created a Transaction State Machine (TSM)
TsmParams = UdataParams#'N-UNITDATA'{userData = Begin},
@@ -346,7 +348,7 @@ handle_cast({'N', 'UNITDATA', indication, UdataParams}, State)
end;
{ok, {continue, TPDU = #'Continue'{dtid = Dtid}}} ->
% DTID assigned?
- case catch ets:lookup_element(tcap_transaction, binary:decode_unsigned(Dtid), 2) of
+ case ets:lookup_element(tcap_transaction, decode_tid(Dtid), 2) of
{error, _Reason} ->
error_logger:error_report(["DTID not found in received N-CONTINUE",
{dtid, Dtid},
@@ -380,7 +382,7 @@ handle_cast({'N', 'UNITDATA', indication, UdataParams}, State)
% end;
{ok, {'end', TPDU = #'End'{dtid = Dtid}}} ->
% DTID assigned?
- case catch ets:lookup(tcap_transaction, binary:decode_unsigned(Dtid), 2) of
+ case catch ets:lookup(tcap_transaction, decode_tid(Dtid), 2) of
{error, _Reason} ->
error_logger:error_report(["DTID not found in received N-END",
{dtid, Dtid},
@@ -731,3 +733,9 @@ enter_loop(Module, Options, State, Timeout) ->
% enter_loop(Module, Options, State, ServerName) ->
% gen_server:enter_loop(Module, Options, State, ServerName).
+
+% convert a TID from the four-octet binary/list form (OCTET STRING) to unsigned int
+decode_tid(Bin) when is_binary(Bin) ->
+ binary:decode_unsigned(Bin);
+decode_tid(List) when is_list(List) ->
+ decode_tid(list_to_binary(List)).