BSSMAP_Templates: Add templates for various PAGING options
diff --git a/library/BSSMAP_Templates.ttcn b/library/BSSMAP_Templates.ttcn
index b2e42ae..22fefdd 100644
--- a/library/BSSMAP_Templates.ttcn
+++ b/library/BSSMAP_Templates.ttcn
@@ -2,6 +2,7 @@
import from General_Types all;
import from Osmocom_Types all;
+import from GSM_Types all;
import from BSSAP_Types all;
type integer BssmapCause;
@@ -443,17 +444,68 @@
digits := imsi_digits
}
-template PDU_BSSAP ts_BSSMAP_Paging(hexstring imsi_digits, BSSMAP_FIELD_CellIdentificationList cid_list,
- template integer tmsi := omit)
+template BSSMAP_FIELD_CellIdentificationList ts_BSSMAP_CIL_noCell := {
+ cIl_noCell := ''O
+}
+
+private function f_enc_mcc_mnc(GsmMcc mcc, GsmMnc mnc) return OCT3 {
+ return hex2oct(mcc[1] & mcc[0] & mnc[0] & mnc[3] & mnc[2]);
+}
+
+template BSSMAP_FIELD_CellIdentification_CGI ts_BSSMAP_CI_CGI(GsmMcc mcc, GsmMnc mnc, GsmLac lac, GsmCellId ci) := {
+ mcc_mnc := f_enc_mcc_mnc(mcc, mnc),
+ lac := int2oct(lac, 2),
+ ci := int2oct(ci, 2)
+}
+
+template BSSMAP_FIELD_CellIdentification_LAC_CI ts_BSSMAP_CI_LAC_CI(GsmLac lac, GsmCellId ci) := {
+ lac := int2oct(lac, 2),
+ ci := int2oct(ci, 2)
+}
+
+template BSSMAP_FIELD_CellIdentification_LAI ts_BSSMAP_CI_LAI(GsmMcc mcc, GsmMnc mnc, GsmLac lac) := {
+ mcc_mnc := f_enc_mcc_mnc(mcc, mnc),
+ lac := int2oct(lac, 2)
+}
+
+template OCT2 ts_BSSMAP_CI_CI(GsmCellId ci) := int2oct(ci, 2);
+template OCT2 ts_BSSMAP_CI_LAC(GsmLac lac) := int2oct(lac, 2);
+
+template BSSMAP_IE_ChannelNeeded ts_BSSMAP_IE_ChanNeeded(BIT2 chneed) := {
+ elementIdentifier := '24'O,
+ channel := chneed,
+ spare := '000000'B
+}
+
+template BSSMAP_IE_TMSI ts_BSSMAP_IE_TMSI(OCT4 tmsi) := {
+ elementIdentifier := '09'O,
+ lengthIndicator := 4,
+ tmsiOctets := tmsi
+};
+
+private function f_tmsi_or_omit(template OCT4 tmsi) return template BSSMAP_IE_TMSI {
+ var template BSSMAP_IE_TMSI ret;
+ if (ispresent(tmsi)) {
+ ret := ts_BSSMAP_IE_TMSI(valueof(tmsi));
+ } else {
+ ret := omit;
+ }
+ return ret;
+}
+
+template PDU_BSSAP ts_BSSMAP_Paging(hexstring imsi_digits,
+ template BSSMAP_FIELD_CellIdentificationList cid_list,
+ template OCT4 tmsi := omit,
+ template BSSMAP_IE_ChannelNeeded chneed := omit)
modifies ts_BSSAP_BSSMAP := {
pdu := {
bssmap := {
paging := {
messageType := '51'O,
iMSI := ts_BSSMAP_Imsi(imsi_digits),
- tMSI := omit, // FIXME: convert tmsi,
- cellIdentifierList := ts_BSSMAP_IE_CidList(cid_list),
- channelNeeded := omit,
+ tMSI := f_tmsi_or_omit(tmsi),
+ cellIdentifierList := ts_BSSMAP_IE_CidList(valueof(cid_list)),
+ channelNeeded := chneed,
eMLPP_Priority := omit,
pagingInformation := omit /* only VGCS/VBS flag */
}
diff --git a/library/GSM_Types.ttcn b/library/GSM_Types.ttcn
index 09566b4..1efeac8 100644
--- a/library/GSM_Types.ttcn
+++ b/library/GSM_Types.ttcn
@@ -17,6 +17,10 @@
type integer GsmTsc (0..7) with { variant "FIELDLENGTH(8)" };
type uint32_t GsmTmsi;
type uint32_t GprsTlli;
+ type hexstring GsmMcc length(3);
+ type hexstring GsmMnc length(2 .. 3);
+ type uint16_t GsmLac;
+ type uint16_t GsmCellId;
type enumerated GprsCodingScheme {
CS1, CS2, CS3, CS4