Added packing of TMSI to mobile station identity IE.

master
Pedro Alvarez 7 years ago
parent d913fdd499
commit 669ef9816f

@ -175,6 +175,7 @@ typedef struct{
uint8 imsi[15]; uint8 imsi[15];
uint8 imei[15]; uint8 imei[15];
uint8 imeisv[16]; uint8 imeisv[16];
uint32 tmsi;
}LIBLTE_MME_MOBILE_ID_STRUCT; }LIBLTE_MME_MOBILE_ID_STRUCT;
// Functions // Functions
LIBLTE_ERROR_ENUM liblte_mme_pack_mobile_id_ie(LIBLTE_MME_MOBILE_ID_STRUCT *mobile_id, LIBLTE_ERROR_ENUM liblte_mme_pack_mobile_id_ie(LIBLTE_MME_MOBILE_ID_STRUCT *mobile_id,

@ -297,6 +297,7 @@ LIBLTE_ERROR_ENUM liblte_mme_pack_mobile_id_ie(LIBLTE_MME_MOBILE_ID_STRUCT *mob
{ {
LIBLTE_ERROR_ENUM err = LIBLTE_ERROR_INVALID_INPUTS; LIBLTE_ERROR_ENUM err = LIBLTE_ERROR_INVALID_INPUTS;
uint8 *id; uint8 *id;
uint32 id32;
uint32 i; uint32 i;
uint8 length; uint8 length;
bool odd = false; bool odd = false;
@ -317,6 +318,11 @@ LIBLTE_ERROR_ENUM liblte_mme_pack_mobile_id_ie(LIBLTE_MME_MOBILE_ID_STRUCT *mob
id = mobile_id->imeisv; id = mobile_id->imeisv;
length = 9; length = 9;
odd = false; odd = false;
}else if(LIBLTE_MME_MOBILE_ID_TYPE_TMSI == mobile_id->type_of_id){
id32 = mobile_id->tmsi;
length = 4;
odd = false;
}
}else{ }else{
// FIXME: Not handling these IDs // FIXME: Not handling these IDs
return(err); return(err);
@ -325,30 +331,48 @@ LIBLTE_ERROR_ENUM liblte_mme_pack_mobile_id_ie(LIBLTE_MME_MOBILE_ID_STRUCT *mob
// Length // Length
**ie_ptr = length; **ie_ptr = length;
*ie_ptr += 1; *ie_ptr += 1;
if(LIBLTE_MME_MOBILE_ID_TYPE_TMSI != mobile_id->type_of_id)
// | Identity digit 1 | odd/even | Id type |
if(odd)
{ {
**ie_ptr = (id[0] << 4) | (1 << 3) | mobile_id->type_of_id; // | Identity digit 1 | odd/even | Id type |
}else{ if(odd)
**ie_ptr = (id[0] << 4) | (0 << 3) | mobile_id->type_of_id; {
} **ie_ptr = (id[0] << 4) | (1 << 3) | mobile_id->type_of_id;
*ie_ptr += 1; }else{
**ie_ptr = (id[0] << 4) | (0 << 3) | mobile_id->type_of_id;
}
*ie_ptr += 1;
// | Identity digit p+1 | Identity digit p |
for(i=0; i<7; i++) // | Identity digit p+1 | Identity digit p |
{ for(i=0; i<7; i++)
(*ie_ptr)[i] = (id[i*2+2] << 4) | id[i*2+1]; {
} (*ie_ptr)[i] = (id[i*2+2] << 4) | id[i*2+1];
*ie_ptr += 7; }
if(!odd) *ie_ptr += 7;
{ if(!odd)
**ie_ptr = 0xF0 | id[15]; {
*ie_ptr += 1; **ie_ptr = 0xF0 | id[15];
*ie_ptr += 1;
}
err = LIBLTE_SUCCESS;
} }
else{
err = LIBLTE_SUCCESS; **ie_ptr = (0xFF << 4) | (0 << 3) | mobile_id->type_of_id;
} *ie_ptr += 1;
//4-Byte based ids
**ie_ptr = (id32 >> 24) & 0xFF;
*ie_ptr += 1;
**ie_ptr = (id32 >> 16) & 0xFF;
*ie_ptr += 1;
**ie_ptr = (id32 >> 8) & 0xFF;
*ie_ptr += 1;
**ie_ptr = id32 & 0xFF;
*ie_ptr += 1;
err = LIBLTE_SUCCESS;
}
return(err); return(err);
} }

@ -1542,8 +1542,9 @@ s1ap_nas_transport::pack_attach_accept(ue_emm_ctx_t *ue_emm_ctx, ue_ecm_ctx_t *u
} }
//Attach accept //Attach accept
attach_accept.eps_attach_result = LIBLTE_MME_EPS_ATTACH_RESULT_EPS_ONLY; //attach_accept.eps_attach_result = LIBLTE_MME_EPS_ATTACH_RESULT_EPS_ONLY;
//attach_accept.eps_attach_result = LIBLTE_MME_EPS_ATTACH_RESULT_COMBINED_EPS_IMSI_ATTACH; attach_accept.eps_attach_result = LIBLTE_MME_EPS_ATTACH_RESULT_COMBINED_EPS_IMSI_ATTACH;
//Mandatory //Mandatory
//FIXME: Set t3412 from config //FIXME: Set t3412 from config
attach_accept.t3412.unit = LIBLTE_MME_GPRS_TIMER_UNIT_1_MINUTE; // GPRS 1 minute unit attach_accept.t3412.unit = LIBLTE_MME_GPRS_TIMER_UNIT_1_MINUTE; // GPRS 1 minute unit
@ -1570,13 +1571,22 @@ s1ap_nas_transport::pack_attach_accept(ue_emm_ctx_t *ue_emm_ctx, ue_ecm_ctx_t *u
attach_accept.guti.guti.m_tmsi); attach_accept.guti.guti.m_tmsi);
//Set EMM cause to no CS available //Set EMM cause to no CS available
//attach_accept.emm_cause_present=false; attach_accept.emm_cause_present=false;
attach_accept.emm_cause_present=true; //attach_accept.emm_cause_present=true;
attach_accept.emm_cause=18; //attach_accept.emm_cause=18;
//Set up LAI for combined EPS/IMSI attach
//attach_accept.lai_present=false;
attach_accept.lai_present=true;
attach_accept.lai.mcc = mcc;
attach_accept.lai.mnc = mnc;
attach_accept.lai.lac = 001;
attach_accept.ms_id_present=true;
attach_accept.ms_id.type_of_id = LIBLTE_MME_MOBILE_ID_TYPE_TMSI;
attach_accept.ms_id.tmsi = attach_accept.guti.guti.m_tmsi;
//Make sure all unused options are set to false //Make sure all unused options are set to false
attach_accept.lai_present=false;
attach_accept.ms_id_present=false;
attach_accept.t3402_present=false; attach_accept.t3402_present=false;
attach_accept.t3423_present=false; attach_accept.t3423_present=false;
attach_accept.equivalent_plmns_present=false; attach_accept.equivalent_plmns_present=false;

Loading…
Cancel
Save