summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2011-12-08 00:46:00 +0100
committerHarald Welte <laforge@gnumonks.org>2011-12-08 00:46:00 +0100
commit9baab6dbc994e4a26ef2cd5fda5fd90ba44cd612 (patch)
treea847ecc8c6f23b1899fe4b7be89cd714cca32ae7
parent21cde2e5dbc602ba0e4f938881975c1e105d5291 (diff)
sccp: addr helper functions for quick generation of GT/sccp_addr
-rw-r--r--src/sccp_codec.erl21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/sccp_codec.erl b/src/sccp_codec.erl
index 137812b..b3989e6 100644
--- a/src/sccp_codec.erl
+++ b/src/sccp_codec.erl
@@ -24,6 +24,8 @@
-export([parse_sccp_msg/1, encode_sccp_msg/1, encode_sccp_msgt/2,
is_connectionless/1]).
+-export([gen_gt_helper/1, gen_addr_helper/2, gen_addr_helper/3]).
+
-compile(export_all).
-compile({parse_transform, exprecs}).
@@ -448,3 +450,22 @@ is_connectionless(MsgType) ->
?SCCP_MSGT_LUDTS -> true;
_ -> false
end.
+
+
+gen_gt_helper(Number) when is_list(Number) ->
+ #global_title{gti=?SCCP_GTI_NAT_ONLY,
+ nature_of_addr_ind=?SCCP_NAI_INTERNATIONAL,
+ phone_number = Number}.
+
+gen_addr_helper(Gt, Pc, Ssn) when is_record(Gt, global_title) ->
+ #sccp_addr{point_code=Pc, ssn=Ssn, global_title=Gt};
+gen_addr_helper(Number, Pc, Ssn) when is_list(Number) ->
+ Gt = gen_gt_helper(Number),
+ gen_addr_helper(Gt, Pc, Ssn).
+
+
+gen_addr_helper(Gt, Pc) when is_record(Gt, global_title) ->
+ #sccp_addr{point_code=Pc, global_title=Gt};
+gen_addr_helper(Number, Pc) when is_list(Number) ->
+ Gt = gen_gt_helper(Number),
+ gen_addr_helper(Gt, Pc).