remove compilation warnings, especially when disabling T_TRACER. enhance LOG_M macro implementation, introduce LOG_DEBUG_XXX macro to replace #ifdef DEBUG_XXX

This commit is contained in:
frtabu
2018-07-30 20:07:22 +02:00
parent b85cbddeec
commit 30509955c2
55 changed files with 686 additions and 934 deletions
@@ -144,10 +144,8 @@ int network_api_initialize(const char* host, const char* port)
#endif
if (_network_api_id.endpoint == NULL) {
const char* error = ( (errno < 0) ?
gai_strerror(errno) : strerror(errno) );
LOG_TRACE(ERROR, "NET-API - Failed to open connection endpoint, %s",
error);
((errno < 0) ? gai_strerror(errno) : strerror(errno)));
LOG_FUNC_RETURN (RETURNerror);
}
+1 -3
View File
@@ -134,10 +134,8 @@ int user_api_initialize(user_api_id_t *user_api_id, const char* host, const char
user_api_id->endpoint = user_api_id->open(SOCKET_SERVER, host, port);
if (user_api_id->endpoint == NULL) {
const char* error = ( (errno < 0) ?
gai_strerror(errno) : strerror(errno) );
LOG_TRACE(ERROR, "USR-API - Failed to open connection endpoint, "
"%s", error);
"%s", ( (errno < 0) ?gai_strerror(errno) : strerror(errno) ));
LOG_FUNC_RETURN (RETURNerror);
}
+5 -3
View File
@@ -79,10 +79,12 @@ Description Defines the attach related EMM procedure executed by the
/****************************************************************************/
/* String representation of the EPS attach type */
static const char *_emm_attach_type_str[] = {
char *emm_attach_type2str(int type) {
static char *_emm_attach_type_str[] = {
"EPS", "IMSI", "EMERGENCY", "RESERVED"
};
return _emm_attach_type_str[type];
}
/*
* --------------------------------------------------------------------------
* Internal data handled by the attach procedure in the UE
@@ -140,7 +142,7 @@ int emm_proc_attach(nas_user_t *user, emm_proc_attach_type_t type)
emm_timers_t *emm_timers = user->emm_data->emm_timers;
LOG_TRACE(INFO, "EMM-PROC - Initiate EPS attach type = %s (%d)",
_emm_attach_type_str[type], type);
emm_attach_type2str(type), type);
/* Update the emergency bearer service indicator */
if (type == EMM_ATTACH_TYPE_EMERGENCY) {
+5 -3
View File
@@ -66,11 +66,13 @@ Description Defines the detach related EMM procedure executed by the
/****************************************************************************/
/* String representation of the detach type */
static const char *_emm_detach_type_str[] = {
char *emm_detach_type2str(int type) {
static char *_emm_detach_type_str[] = {
"EPS", "IMSI", "EPS/IMSI",
"RE-ATTACH REQUIRED", "RE-ATTACH NOT REQUIRED", "RESERVED"
};
return _emm_detach_type_str[type];
}
/*
* --------------------------------------------------------------------------
* Internal data handled by the detach procedure in the UE
@@ -123,7 +125,7 @@ int emm_proc_detach(nas_user_t *user, emm_proc_detach_type_t type, int switch_of
int rc;
LOG_TRACE(INFO, "EMM-PROC - Initiate EPS detach type = %s (%d)",
_emm_detach_type_str[type], type);
emm_detach_type2str(type), type);
/* Initialize the detach procedure internal data */
emm_detach_data->count = 0;
+5 -3
View File
@@ -62,11 +62,13 @@ Description Defines the identification EMM procedure executed by the
/******************* L O C A L D E F I N I T I O N S *******************/
/****************************************************************************/
char *emm_identity_type2str(int id_type) {
/* String representation of the requested identity type */
static const char *_emm_identity_type_str[] = {
static char *_emm_identity_type_str[] = {
"NOT AVAILABLE", "IMSI", "IMEI", "IMEISV", "TMSI"
};
return _emm_identity_type_str[id_type];
}
/*
* --------------------------------------------------------------------------
* Internal data handled by the identification procedure in the UE
@@ -111,7 +113,7 @@ int emm_proc_identification_request(nas_user_t *user, emm_proc_identity_type_t t
emm_sap_t emm_sap;
LOG_TRACE(INFO, "EMM-PROC - Identification requested type = %s (%d)",
_emm_identity_type_str[type], type);
emm_identity_type2str(type), type);
/* Setup EMM procedure handler to be executed upon receiving
* lower layer notification */
+9 -6
View File
@@ -74,7 +74,9 @@ Description Defines the EMMAS Service Access Point that provides
/*
* String representation of EMMAS-SAP primitives
*/
static const char *_emm_as_primitive_str[] = {
char *emmas_to_str(int emmas) {
static char *_emm_as_primitive_str[] = {
"EMMAS_SECURITY_REQ",
"EMMAS_SECURITY_IND",
"EMMAS_SECURITY_RES",
@@ -92,7 +94,8 @@ static const char *_emm_as_primitive_str[] = {
"EMMAS_CELL_INFO_RES",
"EMMAS_CELL_INFO_IND",
};
return _emm_as_primitive_str[emmas];
}
/*
* Functions executed to process EMM procedures upon receiving
* data from the network
@@ -195,7 +198,7 @@ int emm_as_send(nas_user_t *user, const emm_as_t *msg)
emm_as_primitive_t primitive = msg->primitive;
LOG_TRACE(INFO, "EMMAS-SAP - Received primitive %s (%d)",
_emm_as_primitive_str[primitive - _EMMAS_START - 1], primitive);
emmas_to_str(primitive - _EMMAS_START - 1), primitive);
switch (primitive) {
case _EMMAS_DATA_IND:
@@ -234,7 +237,7 @@ int emm_as_send(nas_user_t *user, const emm_as_t *msg)
if (rc != RETURNok) {
LOG_TRACE(ERROR, "EMMAS-SAP - "
"Failed to process primitive %s (%d)",
_emm_as_primitive_str[primitive - _EMMAS_START - 1],
emmas_to_str(primitive - _EMMAS_START - 1),
primitive);
LOG_FUNC_RETURN (RETURNerror);
}
@@ -266,7 +269,7 @@ int emm_as_send(nas_user_t *user, const emm_as_t *msg)
if (rc != RETURNok) {
LOG_TRACE(ERROR, "EMMAS-SAP - Failed to process primitive %s (%d)",
_emm_as_primitive_str[primitive - _EMMAS_START - 1],
emmas_to_str(primitive - _EMMAS_START - 1),
primitive);
}
@@ -984,7 +987,7 @@ static int _emm_as_send(const nas_user_t *user, const emm_as_t *msg)
LOG_TRACE(DEBUG, "EMMAS-SAP - "
"Sending msg with id 0x%x, primitive %s (%d) to RRC layer for transmission",
as_msg.msgID,
_emm_as_primitive_str[msg->primitive - _EMMAS_START - 1],
emmas_to_str(msg->primitive - _EMMAS_START - 1),
msg->primitive);
switch (as_msg.msgID) {
+5 -2
View File
@@ -58,6 +58,7 @@ Description Defines the EMMESM Service Access Point that provides
/*
* String representation of EMMESM-SAP primitives
*/
const char *emm_esm_primitive2str(int esmprim) {
static const char *_emm_esm_primitive_str[] = {
"EMMESM_ESTABLISH_REQ",
"EMMESM_ESTABLISH_CNF",
@@ -66,6 +67,8 @@ static const char *_emm_esm_primitive_str[] = {
"EMMESM_UNITDATA_REQ",
"EMMESM_UNITDATA_IND",
};
return _emm_esm_primitive_str[esmprim];
}
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
@@ -116,7 +119,7 @@ int emm_esm_send(nas_user_t *user, const emm_esm_t *msg)
emm_esm_primitive_t primitive = msg->primitive;
LOG_TRACE(INFO, "EMMESM-SAP - Received primitive %s (%d)",
_emm_esm_primitive_str[primitive - _EMMESM_START - 1], primitive);
emm_esm_primitive2str(primitive - _EMMESM_START - 1), primitive);
switch (primitive) {
@@ -159,7 +162,7 @@ int emm_esm_send(nas_user_t *user, const emm_esm_t *msg)
if (rc != RETURNok) {
LOG_TRACE(WARNING, "EMMESM-SAP - Failed to process primitive %s (%d)",
_emm_esm_primitive_str[primitive - _EMMESM_START - 1],
emm_esm_primitive2str(primitive - _EMMESM_START - 1),
primitive);
}
+10 -7
View File
@@ -64,6 +64,7 @@ Description Defines the EPS Mobility Management procedures executed at
*/
/* String representation of EMM events */
const char *emm_fsm_event2str(int evt) {
static const char *_emm_fsm_event_str[] = {
"S1_ENABLED",
"S1_DISABLED",
@@ -93,7 +94,10 @@ static const char *_emm_fsm_event_str[] = {
"LOWERLAYER_FAILURE",
"LOWERLAYER_RELEASE",
};
return _emm_fsm_event_str[evt];
}
const char *emm_fsm_status2str(int status) {
/* String representation of EMM status */
static const char *_emm_fsm_status_str[EMM_STATE_MAX] = {
"INVALID",
@@ -120,7 +124,8 @@ static const char *_emm_fsm_status_str[EMM_STATE_MAX] = {
"TRACKING-AREA-UPDATING-INITIATED",
"SERVICE-REQUEST-INITIATED",
};
return _emm_fsm_status_str[status];
}
/*
* -----------------------------------------------------------------------------
* EPS Mobility Management state machine handlers
@@ -229,8 +234,8 @@ int emm_fsm_set_status(nas_user_t *user,
if ( status < EMM_STATE_MAX ) {
LOG_TRACE(INFO, "EMM-FSM - Status changed: %s ===> %s",
_emm_fsm_status_str[user->emm_fsm_status],
_emm_fsm_status_str[status]);
emm_fsm_status2str(user->emm_fsm_status),
emm_fsm_status2str(status));
if (status != user->emm_fsm_status) {
user->emm_fsm_status = status;
@@ -280,17 +285,15 @@ int emm_fsm_process(nas_user_t *user, const emm_reg_t *evt)
{
int rc;
emm_fsm_state_t status;
emm_reg_primitive_t primitive;
LOG_FUNC_IN;
primitive = evt->primitive;
status = user->emm_fsm_status;
LOG_TRACE(INFO, "EMM-FSM - Received event %s (%d) in state %s",
_emm_fsm_event_str[primitive - _EMMREG_START - 1], primitive,
_emm_fsm_status_str[status]);
emm_fsm_event2str(evt->primitive - _EMMREG_START - 1), evt->primitive,
emm_fsm_status2str(status));
/* Execute the EMM state machine */
+2 -1
View File
@@ -357,7 +357,8 @@ int esm_proc_pdn_connectivity_accept(nas_user_t *user, int pti, esm_proc_pdn_typ
int rc;
int pid = RETURNerror;
char apn_first_char[4];
char str[128];
LOG_VAR(char, str[128]);
if (isprint(apn->value[0])) {
apn_first_char[0] = '\0';
+5 -2
View File
@@ -72,6 +72,8 @@ static int _esm_sap_send(nas_user_t *user, int msg_type, int is_standalone, int
/*
* String representation of ESM-SAP primitives
*/
const char *esm_sap_primitive2str(int esmsapp) {
static const char *_esm_sap_primitive_str[] = {
"ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_REQ",
"ESM_DEFAULT_EPS_BEARER_CONTEXT_ACTIVATE_CNF",
@@ -94,7 +96,8 @@ static const char *_esm_sap_primitive_str[] = {
"ESM_BEARER_RESOURCE_MODIFY_REJ",
"ESM_UNITDATA_IND",
};
return _esm_sap_primitive_str[esmsapp];
}
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
@@ -152,7 +155,7 @@ int esm_sap_send(nas_user_t *user, esm_sap_t *msg)
assert( (primitive > ESM_START) && (primitive < ESM_END));
LOG_TRACE(INFO, "ESM-SAP - Received primitive %s (%d)",
_esm_sap_primitive_str[primitive - ESM_START - 1], primitive);
esm_sap_primitive2str(primitive - ESM_START - 1), primitive);
switch (primitive) {
case ESM_PDN_CONNECTIVITY_REQ:
+4 -1
View File
@@ -56,10 +56,13 @@ Description Defines functions used to handle state of EPS bearer contexts
/****************************************************************************/
/* String representation of EPS bearer context status */
const char *esm_ebr_state2str(int esmebrstate) {
static const char *_esm_ebr_state_str[ESM_EBR_STATE_MAX] = {
"BEARER CONTEXT INACTIVE",
"BEARER CONTEXT ACTIVE",
};
return _esm_ebr_state_str[esmebrstate];
}
/*
* ----------------------
@@ -318,7 +321,7 @@ int esm_ebr_set_status(user_api_id_t *user_api_id, esm_ebr_data_t *esm_ebr_data,
if (status < ESM_EBR_STATE_MAX) {
LOG_TRACE(INFO, "ESM-FSM - Status of EPS bearer context %d changed:"
" %s ===> %s", ebi,
_esm_ebr_state_str[old_status], _esm_ebr_state_str[status]);
esm_ebr_state2str(old_status), esm_ebr_state2str(status));
if (status != old_status) {
ebr_ctx->status = status;
+4 -1
View File
@@ -56,10 +56,13 @@ Description Defines functions used to handle ESM procedure transactions.
/****************************************************************************/
/* String representation of ESM procedure transaction status */
const char *esm_pt_state2str( int esmptstate){
static const char *_esm_pt_state_str[ESM_PT_STATE_MAX] = {
"PROCEDURE TRANSACTION INACTIVE",
"PROCEDURE TRANSACTION PENDING"
};
return _esm_pt_state_str[esmptstate];
}
/* Return the index of the next available entry in the list of procedure
* transaction data */
@@ -380,7 +383,7 @@ int esm_pt_set_status(esm_pt_data_t *esm_pt_data, int pti, esm_pt_state status)
if (status < ESM_PT_STATE_MAX) {
LOG_TRACE(INFO, "ESM-FSM - Status of procedure transaction %d changed:"
" %s ===> %s", pti,
_esm_pt_state_str[old_status], _esm_pt_state_str[status]);
esm_pt_state2str(old_status), esm_pt_state2str(status));
if (status != old_status) {
ctx->status = status;
+11 -13
View File
@@ -89,7 +89,6 @@ void *nas_ue_task(void *args_p)
int nb_events;
struct epoll_event *events;
MessageDef *msg_p;
const char *msg_name;
instance_t instance;
unsigned int Mod_id;
int result;
@@ -147,19 +146,18 @@ void *nas_ue_task(void *args_p)
itti_receive_msg (TASK_NAS_UE, &msg_p);
if (msg_p != NULL) {
msg_name = ITTI_MSG_NAME (msg_p);
instance = ITTI_MSG_INSTANCE (msg_p);
Mod_id = instance - NB_eNB_INST;
if (instance == INSTANCE_DEFAULT) {
printf("%s:%d: FATAL: instance is INSTANCE_DEFAULT, should not happen.\n",
__FILE__, __LINE__);
abort();
exit_fun("exit... \n");
}
nas_user_t *user = &users->item[Mod_id];
switch (ITTI_MSG_ID(msg_p)) {
case INITIALIZE_MESSAGE:
LOG_I(NAS, "[UE %d] Received %s\n", Mod_id, msg_name);
LOG_I(NAS, "[UE %d] Received %s\n", Mod_id, ITTI_MSG_NAME (msg_p));
#if (NAS_UE_AUTOSTART != 0)
{
/* Send an activate modem command to NAS like UserProcess should do it */
@@ -175,11 +173,11 @@ void *nas_ue_task(void *args_p)
break;
case MESSAGE_TEST:
LOG_I(NAS, "[UE %d] Received %s\n", Mod_id, msg_name);
LOG_I(NAS, "[UE %d] Received %s\n", Mod_id, ITTI_MSG_NAME (msg_p));
break;
case NAS_CELL_SELECTION_CNF:
LOG_I(NAS, "[UE %d] Received %s: errCode %u, cellID %u, tac %u\n", Mod_id, msg_name,
LOG_I(NAS, "[UE %d] Received %s: errCode %u, cellID %u, tac %u\n", Mod_id, ITTI_MSG_NAME (msg_p),
NAS_CELL_SELECTION_CNF (msg_p).errCode, NAS_CELL_SELECTION_CNF (msg_p).cellID, NAS_CELL_SELECTION_CNF (msg_p).tac);
{
@@ -192,21 +190,21 @@ void *nas_ue_task(void *args_p)
break;
case NAS_CELL_SELECTION_IND:
LOG_I(NAS, "[UE %d] Received %s: cellID %u, tac %u\n", Mod_id, msg_name,
LOG_I(NAS, "[UE %d] Received %s: cellID %u, tac %u\n", Mod_id, ITTI_MSG_NAME (msg_p),
NAS_CELL_SELECTION_IND (msg_p).cellID, NAS_CELL_SELECTION_IND (msg_p).tac);
/* TODO not processed by NAS currently */
break;
case NAS_PAGING_IND:
LOG_I(NAS, "[UE %d] Received %s: cause %u\n", Mod_id, msg_name,
LOG_I(NAS, "[UE %d] Received %s: cause %u\n", Mod_id, ITTI_MSG_NAME (msg_p),
NAS_PAGING_IND (msg_p).cause);
/* TODO not processed by NAS currently */
break;
case NAS_CONN_ESTABLI_CNF:
LOG_I(NAS, "[UE %d] Received %s: errCode %u, length %u\n", Mod_id, msg_name,
LOG_I(NAS, "[UE %d] Received %s: errCode %u, length %u\n", Mod_id, ITTI_MSG_NAME (msg_p),
NAS_CONN_ESTABLI_CNF (msg_p).errCode, NAS_CONN_ESTABLI_CNF (msg_p).nasMsg.length);
if ((NAS_CONN_ESTABLI_CNF (msg_p).errCode == AS_SUCCESS)
@@ -221,14 +219,14 @@ void *nas_ue_task(void *args_p)
break;
case NAS_CONN_RELEASE_IND:
LOG_I(NAS, "[UE %d] Received %s: cause %u\n", Mod_id, msg_name,
LOG_I(NAS, "[UE %d] Received %s: cause %u\n", Mod_id, ITTI_MSG_NAME (msg_p),
NAS_CONN_RELEASE_IND (msg_p).cause);
nas_proc_release_ind (user, NAS_CONN_RELEASE_IND (msg_p).cause);
break;
case NAS_UPLINK_DATA_CNF:
LOG_I(NAS, "[UE %d] Received %s: UEid %u, errCode %u\n", Mod_id, msg_name,
LOG_I(NAS, "[UE %d] Received %s: UEid %u, errCode %u\n", Mod_id, ITTI_MSG_NAME (msg_p),
NAS_UPLINK_DATA_CNF (msg_p).UEid, NAS_UPLINK_DATA_CNF (msg_p).errCode);
if (NAS_UPLINK_DATA_CNF (msg_p).errCode == AS_SUCCESS) {
@@ -240,7 +238,7 @@ void *nas_ue_task(void *args_p)
break;
case NAS_DOWNLINK_DATA_IND:
LOG_I(NAS, "[UE %d] Received %s: UEid %u, length %u\n", Mod_id, msg_name,
LOG_I(NAS, "[UE %d] Received %s: UEid %u, length %u\n", Mod_id, ITTI_MSG_NAME (msg_p),
NAS_DOWNLINK_DATA_IND (msg_p).UEid, NAS_DOWNLINK_DATA_IND (msg_p).nasMsg.length);
nas_proc_dl_transfer_ind (user, NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.data, NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.length);
@@ -254,7 +252,7 @@ void *nas_ue_task(void *args_p)
break;
default:
LOG_E(NAS, "[UE %d] Received unexpected message %s\n", Mod_id, msg_name);
LOG_E(NAS, "[UE %d] Received unexpected message %s\n", Mod_id, ITTI_MSG_NAME (msg_p));
break;
}
+6 -5
View File
@@ -147,14 +147,15 @@ s1ap_message_decoded_callback messages_callback[][3] = {
{ 0, 0, 0 }, /* UplinkNonUEAssociatedLPPaTransport */
#endif /* #if (S1AP_VERSION >= MAKE_VERSION(9, 0, 0)) */
};
static const char *s1ap_direction2String[] = {
char *s1ap_direction2String(int s1ap_dir) {
static char *s1ap_direction_String[] = {
"", /* Nothing */
"Originating message", /* originating message */
"Successfull outcome", /* successfull outcome */
"UnSuccessfull outcome", /* successfull outcome */
};
return(s1ap_direction_String[s1ap_dir]);
}
void s1ap_handle_s1_setup_message(s1ap_eNB_mme_data_t *mme_desc_p, int sctp_shutdown)
{
if (sctp_shutdown) {
@@ -230,7 +231,7 @@ int s1ap_eNB_handle_message(uint32_t assoc_id, int32_t stream,
if (messages_callback[pdu.choice.initiatingMessage.procedureCode][pdu.present - 1] == NULL) {
S1AP_ERROR("[SCTP %d] No handler for procedureCode %ld in %s\n",
assoc_id, pdu.choice.initiatingMessage.procedureCode,
s1ap_direction2String[pdu.present - 1]);
s1ap_direction2String(pdu.present - 1));
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_S1AP_S1AP_PDU, &pdu);
return -1;
}
@@ -852,7 +853,7 @@ int s1ap_eNB_handle_ue_context_release_command(uint32_t assoc_id,
MSC_S1AP_MME,
NULL,0,
"0 UEContextRelease/%s eNB_ue_s1ap_id "S1AP_UE_ID_FMT" mme_ue_s1ap_id "S1AP_UE_ID_FMT" len %u",
s1ap_direction2String[pdu->present - 1],
s1ap_direction2String(pdu->present - 1),
enb_ue_s1ap_id,
mme_ue_s1ap_id);