SCCP: move is_connectionless/1 to sccp_codec
diff --git a/src/sccp_codec.erl b/src/sccp_codec.erl
index a3b0352..25ad05b 100644
--- a/src/sccp_codec.erl
+++ b/src/sccp_codec.erl
@@ -21,7 +21,8 @@
-author('Harald Welte <laforge@gnumonks.org>').
-include("sccp.hrl").
--export([parse_sccp_msg/1, encode_sccp_msg/1, encode_sccp_msgt/2]).
+-export([parse_sccp_msg/1, encode_sccp_msg/1, encode_sccp_msgt/2,
+ is_connectionless/1]).
-compile(export_all).
@@ -433,3 +434,17 @@
% encode one sccp message data structure into the on-wire format
encode_sccp_msg(#sccp_msg{msg_type = MsgType, parameters = Params}) ->
encode_sccp_msgt(MsgType, Params).
+
+% is the supplied message type a connectionless message?
+is_connectionless(#sccp_msg{msg_type = MsgType}) ->
+ is_connectionless(MsgType);
+is_connectionless(MsgType) ->
+ case MsgType of
+ ?SCCP_MSGT_UDT -> true;
+ ?SCCP_MSGT_UDTS -> true;
+ ?SCCP_MSGT_XUDT -> true;
+ ?SCCP_MSGT_XUDTS -> true;
+ ?SCCP_MSGT_LUDT -> true;
+ ?SCCP_MSGT_LUDTS -> true;
+ _ -> false
+ end.
diff --git a/src/sccp_scrc.erl b/src/sccp_scrc.erl
index 0d56487..54d38b7 100644
--- a/src/sccp_scrc.erl
+++ b/src/sccp_scrc.erl
@@ -35,18 +35,6 @@
}).
% TODO:
-% is the supplied message type a connectionless message?
-is_connectionless(MsgType) ->
- case MsgType of
- ?SCCP_MSGT_UDT -> true;
- ?SCCP_MSGT_UDTS -> true;
- ?SCCP_MSGT_XUDT -> true;
- ?SCCP_MSGT_XUDTS -> true;
- ?SCCP_MSGT_LUDT -> true;
- ?SCCP_MSGT_LUDTS -> true;
- _ -> false
- end.
-
tx_prim_to_local_ref(Prim, LocalRef) ->
% determine the Pid to which the primitive must be sent
ConnTable = get(scoc_by_ref),
@@ -130,7 +118,7 @@
% T(ias) expired on the other end of the connection
%#sccp_msg{msg_type = ?SCCP_MSGT_IT} ->
_ ->
- IsConnLess = is_connectionless(Msg#sccp_msg.msg_type),
+ IsConnLess = sccp_codec:is_connectionless(Msg),
case IsConnLess of
true ->
% it would be more proper to send them via SCLC ??