L3_Templates: More GMM related templates

Change-Id: Idf305731afb9a4c316e7320553705946c3edb633
This commit is contained in:
Harald Welte 2018-02-16 18:14:28 +01:00
parent 78d9f275c2
commit b0386dfd30
1 changed files with 158 additions and 0 deletions

View File

@ -71,6 +71,12 @@ template MobileIdentityTLV ts_MI_TMSI_TLV(OCT4 tmsi) := {
mobileIdentityLV := ts_MI_TMSI_LV(tmsi)
}
template MobileIdentityTLV ts_MI_IMEISV_TLV(hexstring imeisv) := {
elementIdentifier := '0100011'B,
spare1 := '0'B,
mobileIdentityLV := ts_MI_IMEISV_LV(imeisv)
}
private function f_enc_IMSI_L3(hexstring digits) return IMSI_L3 {
var IMSI_L3 l3;
var integer len := lengthof(digits);
@ -97,6 +103,19 @@ private function f_enc_IMEI_L3(hexstring digits) return IMEI_L3 {
return l3;
}
private function f_enc_IMEI_SV(hexstring digits) return IMEI_SV {
var IMEI_SV l3;
var integer len := lengthof(digits);
if (len rem 2 == 1) { /* modulo remainder */
l3.oddevenIndicator := '1'B;
} else {
l3.oddevenIndicator := '0'B;
}
l3.digits := digits;
l3.fillerDigit := '1111'B;
return l3;
}
/* send template fro Mobile Identity (IMSI) */
template (value) MobileIdentityLV ts_MI_IMSI_LV(hexstring imsi_digits) := {
lengthIndicator := 0, /* overwritten */
@ -119,6 +138,17 @@ template (value) MobileIdentityLV ts_MI_IMEI_LV(hexstring imei_digits) := {
}
}
/* send template fro Mobile Identity (IMEISV) */
template (value) MobileIdentityLV ts_MI_IMEISV_LV(hexstring imei_digits) := {
lengthIndicator := 0, /* overwritten */
mobileIdentityV := {
typeOfIdentity := '011'B,
oddEvenInd_identity := {
imei_sv := f_enc_IMEI_SV(imei_digits)
}
}
}
/* Send template for Classmark 2 */
template (value) MobileStationClassmark2_LV ts_CM2 := {
@ -1312,6 +1342,71 @@ template (value) PDU_L3_MS_SGSN
}
}
private function tr_MI_TMSI_TLV(template OCT4 tmsi) return template MobileIdentityTLV {
if (istemplatekind(tmsi, "*")) {
return *;
} else if (istemplatekind(tmsi, "?")) {
return ?;
} else {
var template MobileIdentityTLV mi := {
elementIdentifier := '0011000'B,
spare1 := '0'B,
mobileIdentityLV := {
lengthIndicator := 4,
mobileIdentityV := {
typeOfIdentity := '100'B,
oddEvenInd_identity := {
tmsi_ptmsi := {
oddevenIndicator := '1'B,
fillerDigit := '1111'B,
octets := tmsi
}
}
}
}
};
return mi;
}
}
template PDU_L3_SGSN_MS tr_GMM_ATTACH_ACCEPT(template BIT3 res := ?,
template RoutingAreaIdentificationV ra := ?,
template OCT4 ptmsi := *) := {
discriminator := '1000'B,
tiOrSkip := {
skipIndicator := '0000'B
},
msgs := {
gprs_mm := {
attachAccept := {
messageType := '00000010'B,
attachResult := { res, ? },
forceToStandby := ?,
updateTimer := ?,
radioPriority := ?,
radioPriorityTOM8 := ?,
routingAreaIdentification := ra,
ptmsiSignature := *,
readyTimer := *,
allocatedPTMSI := tr_MI_TMSI_TLV(ptmsi),
msIdentity := *,
gmmCause := *,
t3302 := *,
cellNotification := *,
equivalentPLMNs := *,
networkFeatureSupport := *,
emergencyNumberList := *,
requestedMSInformation := *,
t3319 := *,
t3323 := *,
t3312_ExtendedValue := *,
additionalNetworkFeatureSupport := *,
t3324 := *,
extendedDRXParameters := *
}
}
}
}
template (value) PDU_L3_MS_SGSN ts_GMM_ATTACH_COMPL := {
discriminator := '0000'B, /* overwritten */
@ -1430,6 +1525,22 @@ template (value) PDU_L3_MS_SGSN ts_GMM_AUTH_CIPH_COMPL(ACReferenceNumberV ref, O
}
}
template PDU_L3_SGSN_MS tr_GMM_ID_REQ(template BIT3 id_type := ?) := {
discriminator := '1000'B,
tiOrSkip := {
skipIndicator := '0000'B
},
msgs := {
gprs_mm := {
identityRequest := {
messageType := '00010101'B,
identityType := { id_type, '0'B },
forceToStandby := ?
}
}
}
}
template (value) PDU_L3_MS_SGSN ts_GMM_ID_RESP(MobileIdentityLV mi_lv) := {
discriminator := '0000'B, /* overwritten */
tiOrSkip := {
@ -1445,6 +1556,53 @@ template (value) PDU_L3_MS_SGSN ts_GMM_ID_RESP(MobileIdentityLV mi_lv) := {
}
}
template PDU_L3_SGSN_MS tr_GMM_AUTH_REQ(template OCT16 rand := ?, template BIT3 ciph_alg := ?) := {
discriminator := '1000'B,
tiOrSkip := {
skipIndicator := '0000'B
},
msgs := {
gprs_mm := {
authenticationAndCipheringRequest := {
messageType := '00010010'B,
cipheringAlgorithm := { ciph_alg, '0'B },
imeisvRequest := ?,
forceToStandby := ?,
acReferenceNumber := ?,
authenticationParameterRAND := {
elementIdentifier := '21'O,
randValue := rand
},
cipheringKeySequenceNumber := *,
authenticationParameterAUTN := *
}
}
}
}
template (value) PDU_L3_MS_SGSN ts_GMM_AUTH_RESP_2G(BIT4 ac_ref, OCT4 sres) := {
discriminator := '1000'B,
tiOrSkip := {
skipIndicator := '0000'B
},
msgs := {
gprs_mm := {
authenticationAndCipheringResponse := {
messageType := '00010011'B,
acReferenceNumber := { valueField := ac_ref },
spare := '0000'B,
authenticationParResp := {
elementIdentifier := '22'O,
valueField := sres
},
imeisv := omit,
authenticationRespParExt := omit
}
}
}
}
const BIT3 c_GMM_DTT_MO_GPRS := '001'B;
const BIT3 c_GMM_DTT_MO_IMSI := '010'B;
const BIT3 c_GMM_DTT_MO_GPRS_IMSI_COMBINED := '011'B;