Commit d8a67153 authored by Robert Schmidt's avatar Robert Schmidt

store IMSI information + provide FlexRAN API to query UE's IMSI

parent 9d05a9a3
...@@ -889,6 +889,17 @@ int flexran_get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id) ...@@ -889,6 +889,17 @@ int flexran_get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id)
} }
} }
uint64_t flexran_get_ue_imsi(mid_t mod_id, mid_t ue_id)
{
if (!rrc_is_present(mod_id)) return -1;
rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id);
struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[mod_id], rnti);
if (!ue_context_p) return -1;
return ue_context_p->ue_context.imsi;
}
long flexran_get_lcg(mid_t mod_id, mid_t ue_id, mid_t lc_id) long flexran_get_lcg(mid_t mod_id, mid_t ue_id, mid_t lc_id)
{ {
if (!mac_is_present(mod_id)) return 0; if (!mac_is_present(mod_id)) return 0;
......
...@@ -301,6 +301,9 @@ long flexran_get_extended_bsr_size(mid_t mod_id, mid_t ue_id); ...@@ -301,6 +301,9 @@ long flexran_get_extended_bsr_size(mid_t mod_id, mid_t ue_id);
/* Get number of UE transmission antennas */ /* Get number of UE transmission antennas */
int flexran_get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id); int flexran_get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id);
/* Get the IMSI of UE */
uint64_t flexran_get_ue_imsi(mid_t mod_id, mid_t ue_id);
/* Get logical channel group of a channel with id lc_id */ /* Get logical channel group of a channel with id lc_id */
long flexran_get_lcg(mid_t mod_id, mid_t ue_id, mid_t lc_id); long flexran_get_lcg(mid_t mod_id, mid_t ue_id, mid_t lc_id);
......
...@@ -394,6 +394,7 @@ typedef struct eNB_RRC_UE_s { ...@@ -394,6 +394,7 @@ typedef struct eNB_RRC_UE_s {
MeasResults_t* measResults; MeasResults_t* measResults;
UE_EUTRA_Capability_t* UE_Capability; UE_EUTRA_Capability_t* UE_Capability;
uint64_t imsi;
#if defined(ENABLE_SECURITY) #if defined(ENABLE_SECURITY)
/* KeNB as derived from KASME received from EPC */ /* KeNB as derived from KASME received from EPC */
......
...@@ -86,8 +86,25 @@ static const uint16_t S1AP_INTEGRITY_EIA2_MASK = 0x4000; ...@@ -86,8 +86,25 @@ static const uint16_t S1AP_INTEGRITY_EIA2_MASK = 0x4000;
#endif #endif
#endif #endif
uint64_t compute_imsi(ImsiMobileIdentity_t *id) {
uint64_t imsi;
imsi = id->digit15;
imsi += id->digit14 * 10; // pow(10, 1)
imsi += id->digit13 * 100; // pow(10, 2)
imsi += id->digit12 * 1000; // pow(10, 3)
imsi += id->digit11 * 10000; // pow(10, 4)
imsi += id->digit10 * 100000; // pow(10, 5)
imsi += id->digit9 * 1000000; // pow(10, 6)
imsi += id->digit8 * 10000000; // pow(10, 7)
imsi += id->digit7 * 100000000; // pow(10, 8)
imsi += id->digit6 * 1000000000; // pow(10, 9)
imsi += id->digit5 * 10000000000; // pow(10, 10)
imsi += id->digit4 * 100000000000; // pow(10, 11)
imsi += id->digit3 * 1000000000000; // pow(10, 12)
imsi += id->digit2 * 10000000000000; // pow(10, 13)
imsi += id->digit1 * 100000000000000; // pow(10, 14)
return imsi;
}
# if defined(ENABLE_ITTI) # if defined(ENABLE_ITTI)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment