Commit 772dc508 authored by Konstantinos Alexandris's avatar Konstantinos Alexandris Committed by Robert Schmidt
Browse files

Fix: Segfault error, free properly measurement info struct, add rsrp/rsrq filter coefficient

parent b7530528
......@@ -1597,6 +1597,22 @@ long flexran_get_rrc_ocn(mid_t mod_id, rnti_t rnti, long cell_id) {
return ue_context_p->ue_context.measurement_info->cellIndividualOffset[cell_id+1];
}
long flexran_get_filter_coeff_rsrp(mid_t mod_id, rnti_t rnti) {
if (!rrc_is_present(mod_id)) return -1;
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;
if (!ue_context_p->ue_context.measurement_info) return -1;
return ue_context_p->ue_context.measurement_info->filterCoefficientRSRP;
}
long flexran_get_filter_coeff_rsrq(mid_t mod_id, rnti_t rnti) {
if (!rrc_is_present(mod_id)) return -1;
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;
if (!ue_context_p->ue_context.measurement_info) return -1;
return ue_context_p->ue_context.measurement_info->filterCoefficientRSRQ;
}
/* Periodic event */
long flexran_get_rrc_per_event_maxReportCells(mid_t mod_id, rnti_t rnti) {
......
......@@ -570,6 +570,12 @@ long flexran_get_rrc_a3_event_a3_offset(mid_t mod_id, rnti_t rnti);
/* Get A3 Event report on leave */
int flexran_get_rrc_a3_event_reportOnLeave(mid_t mod_id, rnti_t rnti);
/* Get filter coefficient for rsrp */
long flexran_get_filter_coeff_rsrp(mid_t mod_id, rnti_t rnti);
/* Get filter coefficient for rsrq */
long flexran_get_filter_coeff_rsrq(mid_t mod_id, rnti_t rnti);
/* Get number of PLMNs that is broadcasted in SIB1 */
uint8_t flexran_get_rrc_num_plmn_ids(mid_t mod_id);
......
......@@ -538,8 +538,10 @@ typedef struct EVENTS_s {
typedef struct MEASUREMENT_INFO_s {
//TODO: Extend to multiple meas objects for OFP/OFN offsets
long offsetFreq;
//TODO: extend to multiple cells for OCP/OCN offsets
//TODO: extend to multiple carriers for OCP/OCN offsets
long cellIndividualOffset[MAX_NUM_NEIGH_CELLs+1];
long filterCoefficientRSRP;
long filterCoefficientRSRQ;
EVENTS_t *events;
} MEASUREMENT_INFO;
......
......@@ -977,20 +977,16 @@ rrc_eNB_free_mem_UE_context(
ue_context_pP->ue_context.handover_info = NULL;
}
if (ue_context_pP->ue_context.measurement_info->events->a3_event) {
/* TODO: be sure free is enough here (check memory leaks) */
free(ue_context_pP->ue_context.measurement_info->events->a3_event);
ue_context_pP->ue_context.measurement_info->events->a3_event = NULL;
}
if (ue_context_pP->ue_context.measurement_info->events) {
/* TODO: be sure free is enough here (check memory leaks) */
free(ue_context_pP->ue_context.measurement_info->events);
ue_context_pP->ue_context.measurement_info->events = NULL;
}
if (ue_context_pP->ue_context.measurement_info) {
/* TODO: be sure free is enough here (check memory leaks) */
if (ue_context_pP->ue_context.measurement_info->events) {
if (ue_context_pP->ue_context.measurement_info->events->a3_event) {
free(ue_context_pP->ue_context.measurement_info->events->a3_event);
ue_context_pP->ue_context.measurement_info->events->a3_event = NULL;
}
free(ue_context_pP->ue_context.measurement_info->events);
ue_context_pP->ue_context.measurement_info->events = NULL;
}
free(ue_context_pP->ue_context.measurement_info);
ue_context_pP->ue_context.measurement_info = NULL;
}
......@@ -3486,6 +3482,9 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t
*quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = LTE_FilterCoefficient_fc4;
*quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = LTE_FilterCoefficient_fc4;
ue_context_pP->ue_context.measurement_info->filterCoefficientRSRP = *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP;
ue_context_pP->ue_context.measurement_info->filterCoefficientRSRQ = *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ;
/* Initialize NAS list */
dedicatedInfoNASList = CALLOC(1, sizeof(struct LTE_RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList));
......@@ -5542,6 +5541,10 @@ rrc_eNB_generate_HO_RRCConnectionReconfiguration(const protocol_ctxt_t *const ct
CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ)));
*quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = LTE_FilterCoefficient_fc4;
*quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = LTE_FilterCoefficient_fc4;
ue_context_pP->ue_context.measurement_info->filterCoefficientRSRP = *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP;
ue_context_pP->ue_context.measurement_info->filterCoefficientRSRQ = *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ;
/* mobilityinfo */
mobilityInfo = ue_context_pP->ue_context.mobilityInfo;
......
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