Commit 875bdaf2 authored by frtabu's avatar frtabu

cppcheck fixes (2)

parent 227a0640
Branches unavailable
2023.w22 2023.w21 2023.w20 2023.w19 2023.w18 2023.w18b 2023.w16 2023.w15 2023.w14 2023.w13 2023.w12 2023.w11 2023.w11b 2023.w10 2023.w10b 2023.w09 2023.w08 2023.w08b 2023.w07 2023.w06 2023.w05 2023.w03 2023.w02 2022.42 2022.41 2022.w51 2022.w50 2022.w49 2022.w48 2022.w47 2022.w46 2022.w45 2022.w43 2022.w42 2022.w42b 2022.w41 2022.w40 2022.w39 2022.w38 2022.w37 2022.w37b 2022.w36 2022.w35 2022.w33 2022.w32 2022.w31 2022.w31b 2022.w30 2022.w29 2022.w26 2022.w25 2022.w24 2022.w24b 2022.w23 2022.w22 2022.w21 2022.w20 2022.w19 2022.w18 2022.w17 2022.w15 2022.w15b 2022.w14a 2022.w13 2022.w13b 2022.w13a 2022.w12 2022.w10 2022.w09 2022.w09b 2022.w08 2022.w08b 2022.w07 2022.w07b 2022.w06 2022.w06a 2022.w05 2022.w05b 2022.w03_hotfix 2022.w03_b 2022.w02 2022.w01 2021.wk46 2021.wk14_a 2021.wk13_d 2021.wk13_c 2021.w51_c 2021.w51_a 2021.w50_a 2021.w49_b 2021.w49_a 2021.w48 2021.w47 2021.w46 2021.w46-powder 2021.w45 2021.w45_b 2021.w44 2021.w43 2021.w42 2021.w37 2021.w36 2021.w35 2021.w34 2021.w33 2021.w32 2021.w31 2021.w30 2021.w29 2021.w28 2021.w27 2021.w26 2021.w25 2021.w24 2021.w23 2021.w22 2021.w20 2021.w19 2021.w18_b 2021.w18_a 2021.w17_b 2021.w16 2021.w15 2021.w14 2021.w13_a 2021.w12 2021.w11 2021.w10 2021.w09 2021.w08 2021.w06 2021.w05 2021.w04 2021.w02 2020.w51_2 2020.w51 2020.w50 2020.w49 2020.w48_2 2020.w48 2020.w47 2020.w46_2 2020.w46 2020.w45_2 2020.w45 2020.w44 2020.w42_2 2020.w42 2020.w41 2020.w39 2020.w38 2020.w37 2020.w36 2020.w34 2020.w33 2020.w31 2020.w30 2020.w29 2020.w28 2020.w26 2020.w25 2020.w24 2020.w23 2020.w22 2020.w19 2020.w17 2020.w16 2020.w15 2020.w11 2020.w09 2020.w06 2020.w05 2020.w04 2020.w03 2019.w51 2019.w44 2019.w41 2019.w36 2019.w30 2019.w28 2019.w27 2019.w25 2019.w23 2019.w21 2019.w17 2019.w15 2019.w13 2019.w11 2019.w10 2019.w09 2019.w08 2019.w07 v1.2.2 v1.2.1 v1.2.0 v1.1.1 v1.1.0 setparam nr-ip-over-lte-v.1.5 nr-ip-over-lte-v.1.4 nr-ip-over-lte-v.1.3 nr-ip-over-lte-v.1.2 nr-ip-over-lte-v.1.1 nr-ip-over-lte-v.1.0 flexran-eol develop-nr-2020w03 develop-nr-2020w02 develop-nr-2019w51 develop-nr-2019w50 develop-nr-2019w48 develop-nr-2019w47 develop-nr-2019w45 develop-nr-2019w43 develop-nr-2019w42 develop-nr-2019w40 benetel_phase_rotation benetel_gnb_rel_2.0 benetel_gnb_rel_1.0 benetel_enb_rel_2.0 benetel_enb_rel_1.0
No related merge requests found
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -90,6 +90,7 @@ extern int asn1_xer_print; ...@@ -90,6 +90,7 @@ extern int asn1_xer_print;
# define S1AP_DEBUG(x, args...) do { fprintf(stdout, "[S1AP][D]"x, ##args); } while(0) # define S1AP_DEBUG(x, args...) do { fprintf(stdout, "[S1AP][D]"x, ##args); } while(0)
#endif #endif
#define S1AP_FIND_PROTOCOLIE_BY_ID(IE_TYPE, ie, container, IE_ID, mandatory) \ #define S1AP_FIND_PROTOCOLIE_BY_ID(IE_TYPE, ie, container, IE_ID, mandatory) \
do {\ do {\
IE_TYPE **ptr; \ IE_TYPE **ptr; \
...@@ -102,15 +103,17 @@ extern int asn1_xer_print; ...@@ -102,15 +103,17 @@ extern int asn1_xer_print;
break; \ break; \
} \ } \
} \ } \
if (mandatory) DevAssert(ie != NULL); \ if (ie == NULL ) { \
S1AP_ERROR("S1AP_FIND_PROTOCOLIE_BY_ID: %s %d: ie is NULL\n",__FILE__,__LINE__);\
if (mandatory) _Assert_Exit_ \
} \
} while(0) } while(0)
/** \brief Function callback prototype. /** \brief Function callback prototype.
**/ **/
typedef int (*s1ap_message_decoded_callback)( typedef int (*s1ap_message_decoded_callback)(
uint32_t assoc_id, uint32_t assoc_id,
uint32_t stream, uint32_t stream,
S1AP_S1AP_PDU_t *pdu S1AP_S1AP_PDU_t *pdu
); );
/** \brief Handle criticality /** \brief Handle criticality
......
This diff is collapsed.
This diff is collapsed.
...@@ -47,60 +47,60 @@ int s1ap_eNB_handle_overload_start(uint32_t assoc_id, ...@@ -47,60 +47,60 @@ int s1ap_eNB_handle_overload_start(uint32_t assoc_id,
uint32_t stream, uint32_t stream,
S1AP_S1AP_PDU_t *pdu) S1AP_S1AP_PDU_t *pdu)
{ {
s1ap_eNB_mme_data_t *mme_desc_p; s1ap_eNB_mme_data_t *mme_desc_p;
S1AP_OverloadStart_t *container; S1AP_OverloadStart_t *container;
S1AP_OverloadStartIEs_t *ie; S1AP_OverloadStartIEs_t *ie;
DevAssert(pdu != NULL); DevAssert(pdu != NULL);
container = &pdu->choice.initiatingMessage.value.choice.OverloadStart; container = &pdu->choice.initiatingMessage.value.choice.OverloadStart;
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_OverloadStartIEs_t, ie, container, S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_OverloadStartIEs_t, ie, container,
S1AP_ProtocolIE_ID_id_OverloadResponse, true); S1AP_ProtocolIE_ID_id_OverloadResponse, true);
if (ie != NULL) {
DevCheck(ie->value.choice.OverloadResponse.present == DevCheck(ie->value.choice.OverloadResponse.present ==
S1AP_OverloadResponse_PR_overloadAction, S1AP_OverloadResponse_PR_overloadAction,
S1AP_OverloadResponse_PR_overloadAction, 0, 0); S1AP_OverloadResponse_PR_overloadAction, 0, 0);
}
/* Non UE-associated signalling -> stream 0 */ /* Non UE-associated signalling -> stream 0 */
DevCheck(stream == 0, stream, 0, 0); DevCheck(stream == 0, stream, 0, 0);
if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) { if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) {
/* No MME context associated */ /* No MME context associated */
return -1; return -1;
} }
/* Mark the MME as overloaded and set the overload state according to /* Mark the MME as overloaded and set the overload state according to
* the value received. * the value received.
*/ */
mme_desc_p->state = S1AP_ENB_OVERLOAD; mme_desc_p->state = S1AP_ENB_OVERLOAD;
mme_desc_p->overload_state = mme_desc_p->overload_state =
ie->value.choice.OverloadResponse.choice.overloadAction; ie->value.choice.OverloadResponse.choice.overloadAction;
return 0; return 0;
} }
int s1ap_eNB_handle_overload_stop(uint32_t assoc_id, int s1ap_eNB_handle_overload_stop(uint32_t assoc_id,
uint32_t stream, uint32_t stream,
S1AP_S1AP_PDU_t *pdu) S1AP_S1AP_PDU_t *pdu)
{ {
/* We received Overload stop message, meaning that the MME is no more /* We received Overload stop message, meaning that the MME is no more
* overloaded. This is an empty message, with only message header and no * overloaded. This is an empty message, with only message header and no
* Information Element. * Information Element.
*/ */
DevAssert(pdu != NULL); DevAssert(pdu != NULL);
s1ap_eNB_mme_data_t *mme_desc_p; s1ap_eNB_mme_data_t *mme_desc_p;
/* Non UE-associated signalling -> stream 0 */ /* Non UE-associated signalling -> stream 0 */
DevCheck(stream == 0, stream, 0, 0); DevCheck(stream == 0, stream, 0, 0);
if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) { if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) {
/* No MME context associated */ /* No MME context associated */
return -1; return -1;
} }
mme_desc_p->state = S1AP_ENB_STATE_CONNECTED; mme_desc_p->state = S1AP_ENB_STATE_CONNECTED;
mme_desc_p->overload_state = S1AP_NO_OVERLOAD; mme_desc_p->overload_state = S1AP_NO_OVERLOAD;
return 0; return 0;
} }
...@@ -42,107 +42,108 @@ void s1ap_eNB_generate_trace_failure(struct s1ap_eNB_ue_context_s *ue_desc_p, ...@@ -42,107 +42,108 @@ void s1ap_eNB_generate_trace_failure(struct s1ap_eNB_ue_context_s *ue_desc_p,
S1AP_E_UTRAN_Trace_ID_t *trace_id, S1AP_E_UTRAN_Trace_ID_t *trace_id,
S1AP_Cause_t *cause_p) S1AP_Cause_t *cause_p)
{ {
S1AP_S1AP_PDU_t pdu; S1AP_S1AP_PDU_t pdu;
S1AP_TraceFailureIndication_t *out; S1AP_TraceFailureIndication_t *out;
S1AP_TraceFailureIndicationIEs_t *ie; S1AP_TraceFailureIndicationIEs_t *ie;
uint8_t *buffer = NULL; uint8_t *buffer = NULL;
uint32_t length; uint32_t length;
DevAssert(ue_desc_p != NULL); DevAssert(ue_desc_p != NULL);
DevAssert(trace_id != NULL); DevAssert(trace_id != NULL);
DevAssert(cause_p != NULL); DevAssert(cause_p != NULL);
/* Prepare the S1AP message to encode */ /* Prepare the S1AP message to encode */
memset(&pdu, 0, sizeof(pdu)); memset(&pdu, 0, sizeof(pdu));
pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage; pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage;
pdu.choice.initiatingMessage.procedureCode = S1AP_ProcedureCode_id_TraceFailureIndication; pdu.choice.initiatingMessage.procedureCode = S1AP_ProcedureCode_id_TraceFailureIndication;
pdu.choice.initiatingMessage.criticality = S1AP_Criticality_ignore; pdu.choice.initiatingMessage.criticality = S1AP_Criticality_ignore;
pdu.choice.initiatingMessage.value.present = S1AP_InitiatingMessage__value_PR_TraceFailureIndication; pdu.choice.initiatingMessage.value.present = S1AP_InitiatingMessage__value_PR_TraceFailureIndication;
out = &pdu.choice.initiatingMessage.value.choice.TraceFailureIndication; out = &pdu.choice.initiatingMessage.value.choice.TraceFailureIndication;
/* mandatory */ /* mandatory */
ie = (S1AP_TraceFailureIndicationIEs_t *)calloc(1, sizeof(S1AP_TraceFailureIndicationIEs_t)); ie = (S1AP_TraceFailureIndicationIEs_t *)calloc(1, sizeof(S1AP_TraceFailureIndicationIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID; ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID;
ie->criticality = S1AP_Criticality_reject; ie->criticality = S1AP_Criticality_reject;
ie->value.present = S1AP_TraceFailureIndicationIEs__value_PR_MME_UE_S1AP_ID; ie->value.present = S1AP_TraceFailureIndicationIEs__value_PR_MME_UE_S1AP_ID;
ie->value.choice.MME_UE_S1AP_ID = ue_desc_p->mme_ue_s1ap_id; ie->value.choice.MME_UE_S1AP_ID = ue_desc_p->mme_ue_s1ap_id;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */ /* mandatory */
ie = (S1AP_TraceFailureIndicationIEs_t *)calloc(1, sizeof(S1AP_TraceFailureIndicationIEs_t)); ie = (S1AP_TraceFailureIndicationIEs_t *)calloc(1, sizeof(S1AP_TraceFailureIndicationIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID; ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID;
ie->criticality = S1AP_Criticality_reject; ie->criticality = S1AP_Criticality_reject;
ie->value.present = S1AP_TraceFailureIndicationIEs__value_PR_ENB_UE_S1AP_ID; ie->value.present = S1AP_TraceFailureIndicationIEs__value_PR_ENB_UE_S1AP_ID;
ie->value.choice.ENB_UE_S1AP_ID = ue_desc_p->eNB_ue_s1ap_id; ie->value.choice.ENB_UE_S1AP_ID = ue_desc_p->eNB_ue_s1ap_id;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */ /* mandatory */
ie = (S1AP_TraceFailureIndicationIEs_t *)calloc(1, sizeof(S1AP_TraceFailureIndicationIEs_t)); ie = (S1AP_TraceFailureIndicationIEs_t *)calloc(1, sizeof(S1AP_TraceFailureIndicationIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_E_UTRAN_Trace_ID; ie->id = S1AP_ProtocolIE_ID_id_E_UTRAN_Trace_ID;
ie->criticality = S1AP_Criticality_ignore; ie->criticality = S1AP_Criticality_ignore;
ie->value.present = S1AP_TraceFailureIndicationIEs__value_PR_E_UTRAN_Trace_ID; ie->value.present = S1AP_TraceFailureIndicationIEs__value_PR_E_UTRAN_Trace_ID;
memcpy(&ie->value.choice.E_UTRAN_Trace_ID, trace_id, sizeof(S1AP_E_UTRAN_Trace_ID_t)); memcpy(&ie->value.choice.E_UTRAN_Trace_ID, trace_id, sizeof(S1AP_E_UTRAN_Trace_ID_t));
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */ /* mandatory */
ie = (S1AP_TraceFailureIndicationIEs_t *)calloc(1, sizeof(S1AP_TraceFailureIndicationIEs_t)); ie = (S1AP_TraceFailureIndicationIEs_t *)calloc(1, sizeof(S1AP_TraceFailureIndicationIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_Cause; ie->id = S1AP_ProtocolIE_ID_id_Cause;
ie->criticality = S1AP_Criticality_ignore; ie->criticality = S1AP_Criticality_ignore;
ie->value.present = S1AP_TraceFailureIndicationIEs__value_PR_Cause; ie->value.present = S1AP_TraceFailureIndicationIEs__value_PR_Cause;
memcpy(&ie->value.choice.Cause, cause_p, sizeof(S1AP_Cause_t)); memcpy(&ie->value.choice.Cause, cause_p, sizeof(S1AP_Cause_t));
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
if (s1ap_eNB_encode_pdu(&pdu, &buffer, &length) < 0) { if (s1ap_eNB_encode_pdu(&pdu, &buffer, &length) < 0) {
return; return;
} }
s1ap_eNB_itti_send_sctp_data_req(ue_desc_p->mme_ref->s1ap_eNB_instance->instance, s1ap_eNB_itti_send_sctp_data_req(ue_desc_p->mme_ref->s1ap_eNB_instance->instance,
ue_desc_p->mme_ref->assoc_id, buffer, ue_desc_p->mme_ref->assoc_id, buffer,
length, ue_desc_p->tx_stream); length, ue_desc_p->tx_stream);
} }
int s1ap_eNB_handle_trace_start(uint32_t assoc_id, int s1ap_eNB_handle_trace_start(uint32_t assoc_id,
uint32_t stream, uint32_t stream,
S1AP_S1AP_PDU_t *pdu) S1AP_S1AP_PDU_t *pdu)
{ {
S1AP_TraceStart_t *container; S1AP_TraceStart_t *container;
S1AP_TraceStartIEs_t *ie; S1AP_TraceStartIEs_t *ie;
struct s1ap_eNB_ue_context_s *ue_desc_p; struct s1ap_eNB_ue_context_s *ue_desc_p;
struct s1ap_eNB_mme_data_s *mme_ref_p; struct s1ap_eNB_mme_data_s *mme_ref_p;
DevAssert(pdu != NULL); DevAssert(pdu != NULL);
container = &pdu->choice.initiatingMessage.value.choice.TraceStart; container = &pdu->choice.initiatingMessage.value.choice.TraceStart;
S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_TraceStartIEs_t, ie, container, S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_TraceStartIEs_t, ie, container,
S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID, TRUE); S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID, TRUE);
mme_ref_p = s1ap_eNB_get_MME(NULL, assoc_id, 0); mme_ref_p = s1ap_eNB_get_MME(NULL, assoc_id, 0);
DevAssert(mme_ref_p != NULL); DevAssert(mme_ref_p != NULL);
if ((ue_desc_p = s1ap_eNB_get_ue_context(mme_ref_p->s1ap_eNB_instance, ue_desc_p = s1ap_eNB_get_ue_context(mme_ref_p->s1ap_eNB_instance,
ie->value.choice.ENB_UE_S1AP_ID)) == NULL) { ie->value.choice.ENB_UE_S1AP_ID);
/* Could not find context associated with this eNB_ue_s1ap_id -> generate if (ue_desc_p == NULL) {
* trace failure indication. /* Could not find context associated with this eNB_ue_s1ap_id -> generate
*/ * trace failure indication.
S1AP_E_UTRAN_Trace_ID_t trace_id; */
S1AP_Cause_t cause; S1AP_E_UTRAN_Trace_ID_t trace_id;
memset(&trace_id, 0, sizeof(S1AP_E_UTRAN_Trace_ID_t)); S1AP_Cause_t cause;
memset(&cause, 0, sizeof(S1AP_Cause_t)); memset(&trace_id, 0, sizeof(S1AP_E_UTRAN_Trace_ID_t));
cause.present = S1AP_Cause_PR_radioNetwork; memset(&cause, 0, sizeof(S1AP_Cause_t));
cause.choice.radioNetwork = S1AP_CauseRadioNetwork_unknown_pair_ue_s1ap_id; cause.present = S1AP_Cause_PR_radioNetwork;
s1ap_eNB_generate_trace_failure(ue_desc_p, &trace_id, &cause); cause.choice.radioNetwork = S1AP_CauseRadioNetwork_unknown_pair_ue_s1ap_id;
} s1ap_eNB_generate_trace_failure(NULL, &trace_id, &cause);
}
return 0;
return 0;
} }
int s1ap_eNB_handle_deactivate_trace(uint32_t assoc_id, int s1ap_eNB_handle_deactivate_trace(uint32_t assoc_id,
uint32_t stream, uint32_t stream,
S1AP_S1AP_PDU_t *message_p) S1AP_S1AP_PDU_t *message_p)
{ {
// S1AP_DeactivateTraceIEs_t *deactivate_trace_p; // S1AP_DeactivateTraceIEs_t *deactivate_trace_p;
// //
// deactivate_trace_p = &message_p->msg.deactivateTraceIEs; // deactivate_trace_p = &message_p->msg.deactivateTraceIEs;
return 0; return 0;
} }
This diff is collapsed.
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