summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2012-01-18 00:25:26 +0100
committerHarald Welte <laforge@gnumonks.org>2012-01-18 00:25:26 +0100
commit8e92c9a46e6c3cb8909297f60a3b6928527b201e (patch)
tree7316f84738fe136cfe42fb7898e5c08780aaf736
parent8ed441d72d99611f8cff64a0c9004d0705a7271b (diff)
SCCP->SUA conversion: fix lots of bugs in initial untested code
-rw-r--r--src/sua_sccp_conv.erl19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/sua_sccp_conv.erl b/src/sua_sccp_conv.erl
index 11592a5..aee8f1f 100644
--- a/src/sua_sccp_conv.erl
+++ b/src/sua_sccp_conv.erl
@@ -43,15 +43,15 @@ sccp_to_sua(M=#sccp_msg{msg_type = Type, parameters = Params}) ->
sccp_to_sua(Type, Params) when Type == ?SCCP_MSGT_UDT;
Type == ?SCCP_MSGT_XUDT;
Type == ?SCCP_MSGT_LUDT ->
- Opts = sccp_to_sua_params(Params),
- #sua_msg{msg_class = ?SUA_MSGC_CL, msg_type = ?SUA_CL_CLDT,
- payload = Opts};
+ Opts = sccp_to_sua_params(Type, Params),
+ #sua_msg{version = 1, msg_class = ?SUA_MSGC_CL,
+ msg_type = ?SUA_CL_CLDT, payload = Opts};
sccp_to_sua(Type, Params) when Type == ?SCCP_MSGT_UDTS;
Type == ?SCCP_MSGT_XUDTS;
Type == ?SCCP_MSGT_LUDTS ->
Opts = sccp_to_sua_params(Params),
- #sua_msg{msg_class = ?SUA_MSGC_CL, msg_type = ?SUA_CL_CLDR,
- payload = Opts}.
+ #sua_msg{version=1, msg_class = ?SUA_MSGC_CL,
+ msg_type = ?SUA_CL_CLDR, payload = Opts}.
% CLDT parameters:
@@ -161,7 +161,7 @@ sccp_to_sua_addr(Addr) when is_record(Addr, sccp_addr) ->
global_title = GT} = Addr,
case GT of
#global_title{} ->
- GTopt = encode_sua_gt(GT),
+ GTopt = [{?SUA_IEI_GT, encode_sua_gt(GT)}],
GTinc = 1;
_ ->
GTopt = [],
@@ -169,7 +169,7 @@ sccp_to_sua_addr(Addr) when is_record(Addr, sccp_addr) ->
end,
case PC of
Int when is_integer(Int) ->
- PCopt = encode_sua_pc(PC),
+ PCopt = [{?SUA_IEI_PC, encode_sua_pc(PC)}],
PCinc = 1;
_ ->
PCopt = [],
@@ -177,7 +177,7 @@ sccp_to_sua_addr(Addr) when is_record(Addr, sccp_addr) ->
end,
case SSN of
Int2 when is_integer(Int2) ->
- SSNopt = encode_sua_ssn(SSN),
+ SSNopt = [{?SUA_IEI_SSN, encode_sua_ssn(SSN)}],
SSNinc = 1;
_ ->
SSNopt = [],
@@ -229,7 +229,8 @@ parse_sua_gt_digits(NoDigits, Remain) ->
isup_codec:parse_isup_party(Bin, OddEven).
encode_sua_gt_digits(Digits) when is_list(Digits); is_integer(Digits) ->
% Assume that overall option encoder will do the padding...
- isup_codec:encode_isup_party(Digits).
+ {Enc, _OddEven} = isup_codec:encode_isup_party(Digits),
+ Enc.
parse_sua_pc(<<PC:32/big>>) ->
PC.