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 describing a GTT match
-record(gtt_match, { -record(gtt_match, {
gt_range_from, % integer(), GT range lower boundary, included gt_range_from :: global_title(), % integer(), GT range lower boundary, included
gt_range_to, % integer(), GT range upper boundary, included gt_range_to :: global_title(), % integer(), GT range upper boundary, included
numbering_plan, % integer() numbering_plan :: numbering_plan(),
nature_of_addr_ind, % integer() nature_of_addr_ind :: nature_of_addr(),
dpc, % integer() dpc :: non_neg_integer(),
ssn}). ssn :: non_neg_integer()
}).
% GTT action for replacing some digits % GTT action for replacing some digits
-record(gtt_act_repl_digits, { -record(gtt_act_repl_digits, {
replace_digit_start, % integer(), digit from which we should replace replace_digit_start :: non_neg_integer(), % digit from which we should replace
replace_digit_end, % integer replace_digit_end :: non_neg_integer(),
new_digits % list of integers new_digits :: digit_list()
}). }).
% GTT action for replacing the numbering plan % GTT action for replacing the numbering plan
-record(gtt_act_repl_num_plan, { -record(gtt_act_repl_num_plan, {
numbering_plan numbering_plan :: numbering_plan()
}). }).
% GTT action for a generic apply/3 call % GTT action for a generic apply/3 call
-record(gtt_act_apply, { -record(gtt_act_apply, {
funct, funct,
args args :: list()
}). }).

View File

@ -105,8 +105,10 @@
phone_number} phone_number}
). ).
-type isup_cic() :: 0..65535.
-record(isup_msg, { -record(isup_msg, {
msg_type, msg_type :: non_neg_integer(),
cic, cic :: isup_cic(),
parameters parameters :: list()
}). }).

View File

@ -73,8 +73,8 @@
-define(M2UA_P_COM_CORREL_ID, 19). -define(M2UA_P_COM_CORREL_ID, 19).
-record(m2ua_msg, { -record(m2ua_msg, {
msg_class, msg_class :: 0..255,
msg_type, msg_type :: 0..255,
parameters parameters
}). }).

View File

@ -63,10 +63,10 @@
-define(M3UA_IEI_DEREG_STATUS, 16#0213). -define(M3UA_IEI_DEREG_STATUS, 16#0213).
-record(m3ua_msg, { -record(m3ua_msg, {
version, version :: 0..255,
msg_class, msg_class :: 0..255,
msg_type, msg_type :: 0..255,
msg_length, msg_length :: non_neg_integer(),
payload 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 % a primitive how it is used inside the SCCP stack and to the user
-record(primitive, { -record(primitive, {
subsystem, subsystem,
gen_name, gen_name,
spec_name, spec_name :: prim_spec_name(),
parameters parameters :: list()
}). }).

View File

@ -122,20 +122,22 @@
-define(SCCP_SSN_MAP_SGSN, 149). -define(SCCP_SSN_MAP_SGSN, 149).
-define(SCCP_SSN_MAP_GGSN, 150). -define(SCCP_SSN_MAP_GGSN, 150).
-type sccp_msg_type() :: 0..255.
-type sccp_proto_class() :: 0..3.
% a single parsed SCCP message % a single parsed SCCP message
-record(sccp_msg, { -record(sccp_msg, {
msg_type, msg_type :: sccp_msg_type(),
parameters parameters
}). }).
-record(global_title, { -record(global_title, {
gti, gti :: 0..15,
nature_of_addr_ind, nature_of_addr_ind :: 0..255,
trans_type, trans_type,
encoding, encoding :: 0..15,
numbering_plan, numbering_plan:: 0..15,
phone_number phone_number
}). }).