add some simplistic type / range annotations for records in headers

This commit is contained in:
Harald Welte 2011-11-04 22:25:40 +01:00
parent dbe1c88489
commit dd540862da
6 changed files with 41 additions and 27 deletions

View File

@ -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()
}).

View File

@ -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()
}).

View File

@ -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
}).

View File

@ -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
}).

View File

@ -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()
}).

View File

@ -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
}).