summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2011-11-04 22:25:40 +0100
committerHarald Welte <laforge@gnumonks.org>2011-11-04 22:25:40 +0100
commitdd540862daef277ea70c1fbe95b2f9892d106602 (patch)
tree82dbe071a9dd88695538e1d1338a7f99920ba082
parentdbe1c884894a657be6f5a8826148937e005152c2 (diff)
add some simplistic type / range annotations for records in headers
-rw-r--r--include/gtt.hrl30
-rw-r--r--include/isup.hrl8
-rw-r--r--include/m2ua.hrl4
-rw-r--r--include/m3ua.hrl8
-rw-r--r--include/osmo_util.hrl6
-rw-r--r--include/sccp.hrl12
6 files changed, 41 insertions, 27 deletions
diff --git a/include/gtt.hrl b/include/gtt.hrl
index 7d48ae7..8af7dcd 100644
--- a/include/gtt.hrl
+++ b/include/gtt.hrl
@@ -1,26 +1,34 @@
+
+-type digit() :: 0..9.
+-type global_title() :: non_neg_integer().
+-type digit_list() :: [digit()].
+-type nature_of_addr() :: 1..256. % FIXME
+-type numbering_plan() :: 1..256. % FIXME
+
% Record describing a GTT match
-record(gtt_match, {
- gt_range_from, % integer(), GT range lower boundary, included
- gt_range_to, % integer(), GT range upper boundary, included
- numbering_plan, % integer()
- nature_of_addr_ind, % integer()
- dpc, % integer()
- ssn}).
+ gt_range_from :: global_title(), % integer(), GT range lower boundary, included
+ gt_range_to :: global_title(), % integer(), GT range upper boundary, included
+ numbering_plan :: numbering_plan(),
+ nature_of_addr_ind :: nature_of_addr(),
+ dpc :: non_neg_integer(),
+ ssn :: non_neg_integer()
+ }).
% GTT action for replacing some digits
-record(gtt_act_repl_digits, {
- replace_digit_start, % integer(), digit from which we should replace
- replace_digit_end, % integer
- new_digits % list of integers
+ replace_digit_start :: non_neg_integer(), % digit from which we should replace
+ replace_digit_end :: non_neg_integer(),
+ new_digits :: digit_list()
}).
% GTT action for replacing the numbering plan
-record(gtt_act_repl_num_plan, {
- numbering_plan
+ numbering_plan :: numbering_plan()
}).
% GTT action for a generic apply/3 call
-record(gtt_act_apply, {
funct,
- args
+ args :: list()
}).
diff --git a/include/isup.hrl b/include/isup.hrl
index a1b5531..794f291 100644
--- a/include/isup.hrl
+++ b/include/isup.hrl
@@ -105,8 +105,10 @@
phone_number}
).
+-type isup_cic() :: 0..65535.
+
-record(isup_msg, {
- msg_type,
- cic,
- parameters
+ msg_type :: non_neg_integer(),
+ cic :: isup_cic(),
+ parameters :: list()
}).
diff --git a/include/m2ua.hrl b/include/m2ua.hrl
index e3bea0e..c43884b 100644
--- a/include/m2ua.hrl
+++ b/include/m2ua.hrl
@@ -73,8 +73,8 @@
-define(M2UA_P_COM_CORREL_ID, 19).
-record(m2ua_msg, {
- msg_class,
- msg_type,
+ msg_class :: 0..255,
+ msg_type :: 0..255,
parameters
}).
diff --git a/include/m3ua.hrl b/include/m3ua.hrl
index e5f0f6d..a5973a7 100644
--- a/include/m3ua.hrl
+++ b/include/m3ua.hrl
@@ -63,10 +63,10 @@
-define(M3UA_IEI_DEREG_STATUS, 16#0213).
-record(m3ua_msg, {
- version,
- msg_class,
- msg_type,
- msg_length,
+ version :: 0..255,
+ msg_class :: 0..255,
+ msg_type :: 0..255,
+ msg_length :: non_neg_integer(),
payload
}).
diff --git a/include/osmo_util.hrl b/include/osmo_util.hrl
index e81d24e..f537b2c 100644
--- a/include/osmo_util.hrl
+++ b/include/osmo_util.hrl
@@ -1,8 +1,10 @@
+-type prim_spec_name() :: 'request' | 'response' | 'confirm' | 'indication'.
+
% a primitive how it is used inside the SCCP stack and to the user
-record(primitive, {
subsystem,
gen_name,
- spec_name,
- parameters
+ spec_name :: prim_spec_name(),
+ parameters :: list()
}).
diff --git a/include/sccp.hrl b/include/sccp.hrl
index 83386cc..4201ce0 100644
--- a/include/sccp.hrl
+++ b/include/sccp.hrl
@@ -122,20 +122,22 @@
-define(SCCP_SSN_MAP_SGSN, 149).
-define(SCCP_SSN_MAP_GGSN, 150).
+-type sccp_msg_type() :: 0..255.
+-type sccp_proto_class() :: 0..3.
% a single parsed SCCP message
-record(sccp_msg, {
- msg_type,
+ msg_type :: sccp_msg_type(),
parameters
}).
-record(global_title, {
- gti,
- nature_of_addr_ind,
+ gti :: 0..15,
+ nature_of_addr_ind :: 0..255,
trans_type,
- encoding,
- numbering_plan,
+ encoding :: 0..15,
+ numbering_plan:: 0..15,
phone_number
}).