Commit b45af4a3 authored by winckel's avatar winckel

Moved files related to assertions, backtrace and signals handling into ITTI directory.

Renamed all ITTI functions, to make them start with module name ("itti_").
Added generic signals handling support in ITTI.
Changed ITTI log port for oaisim to 10006.
Introduce an option to use ITTI in oaisim and reoragized code.

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4267 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 228aa778
......@@ -2,6 +2,8 @@ ITTI_DIR = $(COMMON_UTILS_DIR)/itti
ITTI_OBJS = $(ITTI_DIR)/intertask_interface.o
ITTI_OBJS += $(ITTI_DIR)/intertask_interface_dump.o
ITTI_OBJS += $(ITTI_DIR)/backtrace.o
ITTI_OBJS += $(ITTI_DIR)/signals.o
ITTI_OBJS += $(ITTI_DIR)/timer.o
UTILS_OBJS = $(ITTI_OBJS)
......
......@@ -17,4 +17,7 @@ libitti_la_SOURCES = \
udp_message_def.h udp_messages_types.h \
intertask_interface.c intertask_interface.h \
intertask_interface_dump.c intertask_interface_dump.h \
assertions.h \
backtrace.c backtrace.h \
signals.c signals.h \
timer.c timer.h
\ No newline at end of file
This diff is collapsed.
......@@ -81,7 +81,7 @@ enum task_priorities {
\param message_p Pointer to the message to send
@returns < 0 on failure, 0 otherwise
**/
int send_broadcast_message(MessageDef *message_p);
int itti_send_broadcast_message(MessageDef *message_p);
/** \brief Send a message to a task (could be itself)
\param task_id Task ID
......@@ -89,21 +89,21 @@ int send_broadcast_message(MessageDef *message_p);
\param message Pointer to the message to send
@returns -1 on failure, 0 otherwise
**/
int send_msg_to_task(task_id_t task_id, instance_t instance, MessageDef *message);
int itti_send_msg_to_task(task_id_t task_id, instance_t instance, MessageDef *message);
/** \brief Retrieves a message in the queue associated to task_id.
* If the queue is empty, the thread is blocked till a new message arrives.
\param task_id Task ID of the receiving task
\param received_msg Pointer to the allocated message
**/
void receive_msg(task_id_t task_id, MessageDef **received_msg);
void itti_receive_msg(task_id_t task_id, MessageDef **received_msg);
/** \brief Try to retrieves a message in the queue associated to task_id and matching requested instance.
\param task_id Task ID of the receiving task
\param instance Instance of the task used for virtualization
\param received_msg Pointer to the allocated message
**/
void poll_msg(task_id_t task_id, instance_t instance, MessageDef **received_msg);
void itti_poll_msg(task_id_t task_id, instance_t instance, MessageDef **received_msg);
/** \brief Start thread associated to the task
* \param task_id task to start
......@@ -111,30 +111,43 @@ void poll_msg(task_id_t task_id, instance_t instance, MessageDef **received_msg)
* \param args_p Optional argument to pass to the start routine
* @returns -1 on failure, 0 otherwise
**/
int intertask_interface_create_task(task_id_t task_id,
int itti_create_task(task_id_t task_id,
void *(*start_routine) (void *),
void *args_p);
/** \brief Mark the task as in ready state
* \param task_id task to mark as ready
**/
void intertask_interface_mark_task_ready(task_id_t task_id);
void itti_mark_task_ready(task_id_t task_id);
/** \brief Indicate that the task is completed and initiate termination of all tasks.
* \param task_id task that is completed
**/
void itti_terminate_tasks(task_id_t task_id);
/** \brief Return the printable string associated with the message
* \param message_id Id of the message
**/
char *get_message_name(MessagesIds message_id);
char *itti_get_message_name(MessagesIds message_id);
/** \brief Alloc and memset(0) a new itti message.
\param origin_task_id Task ID of the sending task
\param message_id Message ID
@returns NULL in case of failure or newly allocated mesage ref
* \param origin_task_id Task ID of the sending task
* \param message_id Message ID
* @returns NULL in case of failure or newly allocated mesage ref
**/
inline MessageDef *alloc_new_message(
inline MessageDef *itti_alloc_new_message(
task_id_t origin_task_id,
MessagesIds message_id);
void intertask_interface_send_quit_signal(void);
/** \brief handle signals and wait for all threads to join when the process complete.
* This function should be called from the main thread after having created all ITTI tasks.
**/
void itti_wait_tasks_end(void);
/** \brief Send a termination message to all tasks.
* \param task_id task that is broadcasting the message.
**/
void itti_send_terminate_message(task_id_t task_id);
#endif /* INTERTASK_INTERFACE_H_ */
/* @} */
......@@ -79,7 +79,7 @@ const message_info_t messages_info[] = {
* \param threads_name Pointer on the threads name information as created by this include file
* \param messages_info Pointer on messages information as created by this include file
**/
int intertask_interface_init(thread_id_t thread_max, MessagesIds messages_id_max,
int itti_init(thread_id_t thread_max, MessagesIds messages_id_max,
const char * const *threads_name, const message_info_t *messages_info,
const char * const messages_definition_xml);
......
......@@ -43,13 +43,13 @@
#include <errno.h>
#include "intertask_interface.h"
#include "assertions.h"
#include "timer.h"
#include "backtrace.h"
#include "assertions.h"
#include "signals.h"
sigset_t set;
static sigset_t set;
int signal_init(void)
{
......@@ -74,7 +74,7 @@ int signal_init(void)
extern int timer_handle_signal(siginfo_t *info);
int signal_handle(void)
int signal_handle(int *end)
{
int ret;
siginfo_t info;
......@@ -82,6 +82,7 @@ int signal_handle(void)
sigemptyset(&set);
sigaddset (&set, SIGTIMER);
sigaddset (&set, SIGUSR1);
sigaddset (&set, SIGABRT);
sigaddset (&set, SIGSEGV);
sigaddset (&set, SIGINT);
......@@ -110,6 +111,10 @@ int signal_handle(void)
} else {
/* Dispatch the signal to sub-handlers */
switch(info.si_signo) {
case SIGUSR1:
printf("Received SIGUSR1\n");
*end = 1;
break;
case SIGSEGV: /* Fall through */
case SIGABRT:
printf("Received SIGABORT\n");
......@@ -118,7 +123,7 @@ int signal_handle(void)
case SIGQUIT:
case SIGINT:
printf("Received SIGINT\n");
intertask_interface_send_quit_signal();
itti_send_terminate_message(TASK_UNKNOWN);
printf("All tasks terminated -> exiting '"PACKAGE_NAME"'\n");
exit(0);
break;
......
......@@ -3,6 +3,6 @@
int signal_init(void);
int signal_handle(void);
int signal_handle(int *end);
#endif /* SIGNALS_H_ */
......@@ -93,7 +93,7 @@ int timer_handle_signal(siginfo_t *info)
task_id = timer_p->task_id;
instance = timer_p->instance;
message_p = alloc_new_message(TASK_TIMER, TIMER_HAS_EXPIRED);
message_p = itti_alloc_new_message(TASK_TIMER, TIMER_HAS_EXPIRED);
timer_expired_p = &message_p->msg.timer_has_expired;
......@@ -116,7 +116,7 @@ int timer_handle_signal(siginfo_t *info)
}
}
/* Notify task of timer expiry */
if (send_msg_to_task(task_id, instance, message_p) < 0) {
if (itti_send_msg_to_task(task_id, instance, message_p) < 0) {
TMR_DEBUG("Failed to send msg TIMER_HAS_EXPIRED to task %u\n", task_id);
free(message_p);
return -1;
......
......@@ -77,7 +77,7 @@ static int gtpv1u_send_init_udp(uint16_t port_number)
MessageDef *message_p;
struct in_addr addr;
message_p = alloc_new_message(TASK_GTPV1_U, UDP_INIT);
message_p = itti_alloc_new_message(TASK_GTPV1_U, UDP_INIT);
if (message_p == NULL) {
return -1;
}
......@@ -89,7 +89,7 @@ static int gtpv1u_send_init_udp(uint16_t port_number)
message_p->msg.udp_init.address = inet_ntoa(addr);
GTPU_DEBUG("Tx UDP_INIT IP addr %s\n", message_p->msg.udp_init.address);
return send_msg_to_task(TASK_UDP, INSTANCE_DEFAULT, message_p);
return itti_send_msg_to_task(TASK_UDP, INSTANCE_DEFAULT, message_p);
}
NwGtpv1uRcT gtpv1u_log_request(NwGtpv1uLogMgrHandleT hLogMgr,
......@@ -113,7 +113,7 @@ NwGtpv1uRcT gtpv1u_send_udp_msg(
MessageDef *message_p;
udp_data_req_t *udp_data_req_p;
message_p = alloc_new_message(TASK_GTPV1_U, UDP_DATA_REQ);
message_p = itti_alloc_new_message(TASK_GTPV1_U, UDP_DATA_REQ);
udp_data_req_p = &message_p->msg.udp_data_req;
......@@ -122,7 +122,7 @@ NwGtpv1uRcT gtpv1u_send_udp_msg(
udp_data_req_p->buffer = buffer;
udp_data_req_p->buffer_length = buffer_len;
return send_msg_to_task(TASK_UDP, INSTANCE_DEFAULT, message_p);
return itti_send_msg_to_task(TASK_UDP, INSTANCE_DEFAULT, message_p);
}
/* Callback called when a gtpv1u message arrived on UDP interface */
......@@ -150,7 +150,7 @@ NwGtpv1uRcT gtpv1u_process_stack_req(
}
GTPU_DEBUG("Received TPDU from gtpv1u stack %u with size %d", pUlpApi->apiInfo.recvMsgInfo.teid, buffer_len);
message_p = alloc_new_message(TASK_GTPV1_U, GTPV1U_TUNNEL_DATA_IND);
message_p = itti_alloc_new_message(TASK_GTPV1_U, GTPV1U_TUNNEL_DATA_IND);
if (message_p == NULL) {
return -1;
}
......@@ -163,7 +163,7 @@ NwGtpv1uRcT gtpv1u_process_stack_req(
} else {
memcpy(data_ind_p->buffer, buffer, buffer_len);
data_ind_p->length = buffer_len;
if (send_msg_to_task(TASK_FW_IP, INSTANCE_DEFAULT, message_p) < 0) {
if (itti_send_msg_to_task(TASK_FW_IP, INSTANCE_DEFAULT, message_p) < 0) {
GTPU_ERROR("Failed to send message to task\n");
free(message_p);
}
......@@ -223,7 +223,7 @@ static int gtpv1u_create_s1u_tunnel(Gtpv1uCreateTunnelReq *create_tunnel_reqP)
gtpv1u_teid2enb_info->state = BEARER_IN_CONFIG;
message_p = alloc_new_message(TASK_GTPV1_U, GTPV1U_CREATE_TUNNEL_RESP);
message_p = itti_alloc_new_message(TASK_GTPV1_U, GTPV1U_CREATE_TUNNEL_RESP);
message_p->msg.gtpv1uCreateTunnelResp.S1u_teid = s1u_teid;
message_p->msg.gtpv1uCreateTunnelResp.context_teid = create_tunnel_reqP->context_teid;
message_p->msg.gtpv1uCreateTunnelResp.eps_bearer_id = create_tunnel_reqP->eps_bearer_id;
......@@ -242,7 +242,7 @@ static int gtpv1u_create_s1u_tunnel(Gtpv1uCreateTunnelReq *create_tunnel_reqP)
message_p->msg.gtpv1uCreateTunnelResp.S1u_teid,
message_p->msg.gtpv1uCreateTunnelResp.eps_bearer_id,
message_p->msg.gtpv1uCreateTunnelResp.status);
return send_msg_to_task(TASK_SPGW_APP, INSTANCE_DEFAULT, message_p);
return itti_send_msg_to_task(TASK_SPGW_APP, INSTANCE_DEFAULT, message_p);
}
......@@ -253,7 +253,7 @@ static int gtpv1u_delete_s1u_tunnel(Teid_t context_teidP, Teid_t S1U_teidP)
MessageDef *message_p;
GTPU_DEBUG("Rx GTPV1U_DELETE_TUNNEL Context %u S1U teid %u\n", context_teidP, S1U_teidP);
message_p = alloc_new_message(TASK_GTPV1_U, GTPV1U_DELETE_TUNNEL_RESP);
message_p = itti_alloc_new_message(TASK_GTPV1_U, GTPV1U_DELETE_TUNNEL_RESP);
message_p->msg.gtpv1uDeleteTunnelResp.S1u_teid = S1U_teidP;
message_p->msg.gtpv1uDeleteTunnelResp.context_teid = context_teidP;
......@@ -264,7 +264,7 @@ static int gtpv1u_delete_s1u_tunnel(Teid_t context_teidP, Teid_t S1U_teidP)
message_p->msg.gtpv1uDeleteTunnelResp.status = -1;
}
GTPU_DEBUG("Tx SGW_S1U_ENDPOINT_CREATED Context %u teid %u status %d\n", context_teidP, S1U_teidP, message_p->msg.gtpv1uDeleteTunnelResp.status);
return send_msg_to_task(TASK_SPGW_APP, INSTANCE_DEFAULT, message_p);
return itti_send_msg_to_task(TASK_SPGW_APP, INSTANCE_DEFAULT, message_p);
}
......@@ -278,7 +278,7 @@ static int gtpv1u_update_s1u_tunnel(Gtpv1uUpdateTunnelReq *reqP)
reqP->context_teid,
reqP->sgw_S1u_teid,
reqP->enb_S1u_teid);
message_p = alloc_new_message(TASK_GTPV1_U, GTPV1U_UPDATE_TUNNEL_RESP);
message_p = itti_alloc_new_message(TASK_GTPV1_U, GTPV1U_UPDATE_TUNNEL_RESP);
hash_rc = hashtbl_get(gtpv1u_sgw_data.S1U_mapping, reqP->sgw_S1u_teid, (void**)&gtpv1u_teid2enb_info);
......@@ -296,7 +296,7 @@ static int gtpv1u_update_s1u_tunnel(Gtpv1uUpdateTunnelReq *reqP)
message_p->msg.gtpv1uUpdateTunnelResp.sgw_S1u_teid = reqP->sgw_S1u_teid;
message_p->msg.gtpv1uUpdateTunnelResp.enb_S1u_teid = reqP->enb_S1u_teid;
message_p->msg.gtpv1uUpdateTunnelResp.eps_bearer_id = reqP->eps_bearer_id;
return send_msg_to_task(TASK_SPGW_APP, INSTANCE_DEFAULT, message_p);
return itti_send_msg_to_task(TASK_SPGW_APP, INSTANCE_DEFAULT, message_p);
}
......@@ -345,14 +345,14 @@ static NwGtpv1uRcT gtpv1u_stop_timer_wrapper(
static void *gtpv1u_thread(void *args)
{
intertask_interface_mark_task_ready(TASK_GTPV1_U);
itti_mark_task_ready(TASK_GTPV1_U);
while(1) {
/* Trying to fetch a message from the message queue.
* If the queue is empty, this function will block till a
* message is sent to the task.
*/
MessageDef *received_message_p = NULL;
receive_msg(TASK_GTPV1_U, &received_message_p);
itti_receive_msg(TASK_GTPV1_U, &received_message_p);
DevAssert(received_message_p != NULL);
switch(received_message_p->header.messageId) {
......@@ -453,7 +453,7 @@ static void *gtpv1u_thread(void *args)
break;
default: {
GTPU_ERROR("Unkwnon message ID %s:%d\n",
get_message_name(received_message_p->header.messageId),
itti_get_message_name(received_message_p->header.messageId),
received_message_p->header.messageId);
}
break;
......@@ -537,7 +537,7 @@ int gtpv1u_init(const mme_config_t *mme_config_p)
return -1;
}
if (intertask_interface_create_task(TASK_GTPV1_U, &gtpv1u_thread, NULL) < 0) {
if (itti_create_task(TASK_GTPV1_U, &gtpv1u_thread, NULL) < 0) {
GTPU_ERROR("gtpv1u phtread_create: %s", strerror(errno));
return -1;
}
......
......@@ -54,7 +54,7 @@ int mme_app_request_authentication_info(const mme_app_imsi_t imsi,
DevAssert(plmn != NULL);
message_p = alloc_new_message(TASK_MME_APP, S6A_AUTH_INFO_REQ);
message_p = itti_alloc_new_message(TASK_MME_APP, S6A_AUTH_INFO_REQ);
if (message_p == NULL) return -1;
......@@ -63,7 +63,7 @@ int mme_app_request_authentication_info(const mme_app_imsi_t imsi,
memcpy(&auth_info_req->visited_plmn, plmn, sizeof(plmn_t));
auth_info_req->nb_of_vectors = nb_of_vectors;
return send_msg_to_task(TASK_S6A, INSTANCE_DEFAULT, message_p);
return itti_send_msg_to_task(TASK_S6A, INSTANCE_DEFAULT, message_p);
}
int mme_app_handle_nas_auth_resp(nas_auth_resp_t *nas_auth_resp_p)
......@@ -92,7 +92,7 @@ int mme_app_handle_nas_auth_resp(nas_auth_resp_t *nas_auth_resp_p)
MessageDef *message_p;
s6a_update_location_req_t *s6a_ulr;
message_p = alloc_new_message(TASK_MME_APP, S6A_UPDATE_LOCATION_REQ);
message_p = itti_alloc_new_message(TASK_MME_APP, S6A_UPDATE_LOCATION_REQ);
if (message_p == NULL) {
return -1;
......@@ -106,7 +106,7 @@ int mme_app_handle_nas_auth_resp(nas_auth_resp_t *nas_auth_resp_p)
/* Check if we already have UE data */
s6a_ulr->skip_subsriber_data = 0;
return send_msg_to_task(TASK_S6A, INSTANCE_DEFAULT, message_p);
return itti_send_msg_to_task(TASK_S6A, INSTANCE_DEFAULT, message_p);
}
return -1;
}
......@@ -121,7 +121,7 @@ int mme_app_handle_authentication_info_answer(s6a_auth_info_ans_t *s6a_auth_info
DevAssert(s6a_auth_info_ans_p != NULL);
message_p = alloc_new_message(TASK_MME_APP, NAS_AUTHENTICATION_REQ);
message_p = itti_alloc_new_message(TASK_MME_APP, NAS_AUTHENTICATION_REQ);
if (message_p == NULL) {
return -1;
......@@ -172,7 +172,7 @@ int mme_app_handle_authentication_info_answer(s6a_auth_info_ans_t *s6a_auth_info
"!= S6A_RESULT_BASE");
}
return send_msg_to_task(TASK_NAS, INSTANCE_DEFAULT, message_p);
return itti_send_msg_to_task(TASK_NAS, INSTANCE_DEFAULT, message_p);
}
int mme_app_handle_attach_req(nas_attach_req_t *attach_req_p)
......@@ -270,14 +270,14 @@ request_auth:
/* We have a vector... USE it */
MME_APP_DEBUG("but we have an auth. vector for it, request"
" authentication from NAS\n");
message_p = alloc_new_message(TASK_MME_APP, NAS_AUTHENTICATION_REQ);
message_p = itti_alloc_new_message(TASK_MME_APP, NAS_AUTHENTICATION_REQ);
nas_auth_req_p = &message_p->msg.nas_auth_req;
MME_APP_IMSI_TO_STRING(imsi, nas_auth_req_p->imsi);
nas_auth_req_p->failure = NAS_FAILURE_OK;
return send_msg_to_task(TASK_NAS, INSTANCE_DEFAULT, message_p);
return itti_send_msg_to_task(TASK_NAS, INSTANCE_DEFAULT, message_p);
}
}
}
......
......@@ -115,7 +115,7 @@ int mme_app_create_bearer(s6a_update_location_ans_t *ula_p)
DevMessage("Not implemented: ACCESS NOT GRANTED, send ESM Failure to NAS\n");
}
message_p = alloc_new_message(TASK_MME_APP, SGW_CREATE_SESSION_REQUEST);
message_p = itti_alloc_new_message(TASK_MME_APP, SGW_CREATE_SESSION_REQUEST);
/* WARNING:
* Some parameters should be provided by NAS Layer:
......@@ -237,7 +237,7 @@ int mme_app_create_bearer(s6a_update_location_ans_t *ula_p)
session_request_p->serving_network.mnc[2] = ue_context->e_utran_cgi.plmn.MNCdigit3;
session_request_p->selection_mode = MS_O_N_P_APN_S_V;
return send_msg_to_task(to_task, INSTANCE_DEFAULT, message_p);
return itti_send_msg_to_task(to_task, INSTANCE_DEFAULT, message_p);
}
int mme_app_handle_create_sess_resp(SgwCreateSessionResponse *create_sess_resp_p)
......@@ -318,7 +318,7 @@ int mme_app_handle_create_sess_resp(SgwCreateSessionResponse *create_sess_resp_p
MessageDef *message_p;
nas_attach_accept_t *attach_accept_p;
message_p = alloc_new_message(TASK_MME_APP, NAS_ATTACH_ACCEPT);
message_p = itti_alloc_new_message(TASK_MME_APP, NAS_ATTACH_ACCEPT);
attach_accept_p = &message_p->msg.nas_attach_accept;
......@@ -344,7 +344,7 @@ int mme_app_handle_create_sess_resp(SgwCreateSessionResponse *create_sess_resp_p
memcpy(&attach_accept_p->transparent.ambr, &ue_context_p->subscribed_ambr,
sizeof(ambr_t));
return send_msg_to_task(TASK_NAS, INSTANCE_DEFAULT, message_p);
return itti_send_msg_to_task(TASK_NAS, INSTANCE_DEFAULT, message_p);
}
return 0;
......
......@@ -49,7 +49,7 @@ void *mme_app_thread(void *args);
void *mme_app_thread(void *args)
{
intertask_interface_mark_task_ready(TASK_MME_APP);
itti_mark_task_ready(TASK_MME_APP);
while(1) {
MessageDef *received_message_p = NULL;
......@@ -57,7 +57,7 @@ void *mme_app_thread(void *args)
* If the queue is empty, this function will block till a
* message is sent to the task.
*/
receive_msg(TASK_MME_APP, &received_message_p);
itti_receive_msg(TASK_MME_APP, &received_message_p);
DevAssert(received_message_p != NULL);
switch(received_message_p->header.messageId) {
case S6A_AUTH_INFO_ANS: {
......@@ -92,7 +92,7 @@ void *mme_app_thread(void *args)
} break;
default: {
MME_APP_DEBUG("Unkwnon message ID %s:%d\n",
get_message_name(received_message_p->header.messageId),
itti_get_message_name(received_message_p->header.messageId),
received_message_p->header.messageId);
} break;
}
......@@ -109,7 +109,7 @@ int mme_app_init(const mme_config_t *mme_config_p)
memset(&mme_app_desc, 0, sizeof(mme_app_desc));
/* Create the thread associated with MME applicative layer */
if (intertask_interface_create_task(TASK_MME_APP, &mme_app_thread, NULL) < 0) {
if (itti_create_task(TASK_MME_APP, &mme_app_thread, NULL) < 0) {
MME_APP_ERROR("MME APP create task failed\n");
return -1;
}
......
......@@ -36,10 +36,10 @@
// {
// MessageDef *message_p;
//
// message_p = alloc_new_message(TASK_MME_APP, TASK_NAS,
// message_p = itti_alloc_new_message(TASK_MME_APP, TASK_NAS,
// SGW_CREATE_SESSION_REQUEST);
//
// return send_msg_to_task(TASK_NAS, message_p);
// return itti_send_msg_to_task(TASK_NAS, message_p);
// }
int s6a_error_2_nas_cause(uint32_t s6a_error, int experimental)
......
......@@ -1090,13 +1090,13 @@ static int _emm_as_send(const emm_as_t* msg)
case AS_DL_INFO_TRANSFER_REQ: {
int ret;
message_p = alloc_new_message(TASK_NAS, NAS_DOWNLINK_DATA_IND);
message_p = itti_alloc_new_message(TASK_NAS, NAS_DOWNLINK_DATA_IND);
memcpy(&message_p->msg.nas_dl_data_ind,
&as_msg.msg.dl_info_transfer_req,
sizeof(nas_dl_data_ind_t));
ret = send_msg_to_task(TASK_S1AP, 0, message_p);
ret = itti_send_msg_to_task(TASK_S1AP, 0, message_p);
if (ret != -1) {
LOG_FUNC_RETURN (RETURNok);
......
......@@ -21,13 +21,13 @@
static void *nas_intertask_interface(void *args_p)
{
intertask_interface_mark_task_ready(TASK_NAS);
itti_mark_task_ready(TASK_NAS);
while(1) {
MessageDef *received_message_p;
next_message:
receive_msg(TASK_NAS, &received_message_p);
itti_receive_msg(TASK_NAS, &received_message_p);
switch(received_message_p->header.messageId) {
case NAS_CONNECTION_ESTABLISHMENT_IND: {
#if defined(DISABLE_USE_NAS)
......@@ -37,7 +37,7 @@ next_message:
NAS_DEBUG("NAS abstraction: Generating NAS ATTACH REQ\n");
message_p = alloc_new_message(TASK_NAS, NAS_ATTACH_REQ);
message_p = itti_alloc_new_message(TASK_NAS, NAS_ATTACH_REQ);
nas_req_p = &message_p->msg.nas_attach_req;
transparent = &message_p->msg.nas_attach_req.transparent;
......@@ -48,7 +48,7 @@ next_message:
memcpy(transparent, &received_message_p->msg.nas_conn_est_ind.transparent,
sizeof(s1ap_initial_ue_message_t));
send_msg_to_task(TASK_MME_APP, INSTANCE_DEFAULT, message_p);
itti_send_msg_to_task(TASK_MME_APP, INSTANCE_DEFAULT, message_p);
#else
nas_establish_ind_t *nas_est_ind_p;
......@@ -61,7 +61,7 @@ next_message:
#endif
} break;
case NAS_ATTACH_ACCEPT: {
send_msg_to_task(TASK_S1AP, INSTANCE_DEFAULT, received_message_p);
itti_send_msg_to_task(TASK_S1AP, INSTANCE_DEFAULT, received_message_p);
goto next_message;
} break;
case NAS_AUTHENTICATION_REQ: {
......@@ -70,17 +70,17 @@ next_message:
NAS_DEBUG("NAS abstraction: Generating NAS AUTHENTICATION RESPONSE\n");
message_p = alloc_new_message(TASK_NAS, NAS_AUTHENTICATION_RESP);
message_p = itti_alloc_new_message(TASK_NAS, NAS_AUTHENTICATION_RESP);
nas_resp_p = &message_p->msg.nas_auth_resp;
memcpy(nas_resp_p->imsi, received_message_p->msg.nas_auth_req.imsi, 16);
send_msg_to_task(TASK_MME_APP, INSTANCE_DEFAULT, message_p);
itti_send_msg_to_task(TASK_MME_APP, INSTANCE_DEFAULT, message_p);
} break;
default: {
NAS_DEBUG("Unkwnon message ID %s:%d\n",
get_message_name(received_message_p->header.messageId),
itti_get_message_name(received_message_p->header.messageId),
received_message_p->header.messageId);
} break;
}
......@@ -98,7 +98,7 @@ int nas_init(const mme_config_t *mme_config_p)
emm_main_initialize();
#endif
if (intertask_interface_create_task(TASK_NAS, &nas_intertask_interface,
if (itti_create_task(TASK_NAS, &nas_intertask_interface,
NULL) < 0) {
NAS_ERROR("Create task failed");
NAS_DEBUG("Initializing NAS task interface: FAILED\n");
......
......@@ -41,8 +41,6 @@
#include "mme_config.h"
#include "gtpv1u_sgw_defs.h"
#include "signals.h"
#include "intertask_interface_init.h"
#include "sctp_primitives_server.h"
......@@ -65,18 +63,12 @@
int main(int argc, char *argv[])
{
/* Initialize signals */
CHECK_INIT_RETURN(signal_init());
/* Parse the command line for options and set the mme_config accordingly. */
CHECK_INIT_RETURN(config_parse_opt_line(argc, argv, &mme_config));
/* Calling each layer init function */
CHECK_INIT_RETURN(log_init(&mme_config, oai_mme_log_specific));
CHECK_INIT_RETURN(intertask_interface_init(THREAD_MAX,
MESSAGES_ID_MAX, threads_name,
messages_info,
messages_definition_xml));
CHECK_INIT_RETURN(itti_init(THREAD_MAX, MESSAGES_ID_MAX, threads_name, messages_info, messages_definition_xml));
CHECK_INIT_RETURN(nas_init(&mme_config));
CHECK_INIT_RETURN(sctp_init(&mme_config));
......@@ -91,9 +83,7 @@ int main(int argc, char *argv[])
// if (sgw_lite_init(&mme_config) < 0) return -1;
/* Handle signals here */
while(1) {
signal_handle();
}
itti_wait_tasks_end();
return 0;
}
......@@ -47,7 +47,6 @@
#include "gtpv1u_sgw_defs.h"
#include "assertions.h"
#include "signals.h"
#include "intertask_interface_init.h"
......@@ -70,19 +69,12 @@
int main(int argc, char *argv[])
{
/* Initialize signals. Note that signals should be initialized before
* other threads are created as it will block signals for child threads.
*/
CHECK_INIT_RETURN(signal_init());
/* Parse the command line for options and set the mme_config accordingly. */
CHECK_INIT_RETURN(config_parse_opt_line(argc, argv, &mme_config) < 0);
/* Calling each layer init function */
CHECK_INIT_RETURN(log_init(&mme_config, oai_epc_log_specific));
CHECK_INIT_RETURN(intertask_interface_init(THREAD_MAX, MESSAGES_ID_MAX,
threads_name, messages_info,
messages_definition_xml));
CHECK_INIT_RETURN(itti_init(THREAD_MAX, MESSAGES_ID_MAX, threads_name, messages_info, messages_definition_xml));
CHECK_INIT_RETURN(nas_init(&mme_config));
CHECK_INIT_RETURN(sctp_init(&mme_config));
......@@ -97,9 +89,7 @@ int main(int argc, char *argv[])
CHECK_INIT_RETURN(sgw_lite_init(&mme_config));
/* Handle signals here */
while(1) {
signal_handle();
}
itti_wait_tasks_end();
return 0;
}
......@@ -41,8 +41,6 @@
#include "assertions.h"
#include "mme_config.h"
#include "signals.h"
#include "intertask_interface_init.h"
#include "udp_primitives_server.h"
......@@ -57,17 +55,12 @@
int main(int argc, char *argv[])
{
/* Initialize signals */
CHECK_INIT_RETURN(signal_init());
/* Parse the command line for options and set the mme_config accordingly. */
CHECK_INIT_RETURN(config_parse_opt_line(argc, argv, &mme_config));
/* Calling each layer init function */
CHECK_INIT_RETURN(log_init(&mme_config, oai_sgw_log_specific));
CHECK_INIT_RETURN(intertask_interface_init(THREAD_MAX, MESSAGES_ID_MAX,
threads_name, messages_info,
messages_definition_xml));
CHECK_INIT_RETURN(itti_init(THREAD_MAX, MESSAGES_ID_MAX, threads_name, messages_info, messages_definition_xml));
CHECK_INIT_RETURN(udp_init(&mme_config));
CHECK_INIT_RETURN(s11_sgw_init(&mme_config));
......@@ -77,9 +70,7 @@ int main(int argc, char *argv[])
CHECK_INIT_RETURN(sgw_lite_init(&mme_config));
/* Handle signals here */
while(1) {
signal_handle();
}
itti_wait_tasks_end();
return 0;
}
......@@ -96,7 +96,7 @@ int s11_mme_handle_create_session_response(NwGtpv2cStackHandleT *stack_p,
DevAssert(stack_p != NULL);
message_p = alloc_new_message(TASK_S11, SGW_CREATE_SESSION_RESPONSE);
message_p = itti_alloc_new_message(TASK_S11, SGW_CREATE_SESSION_RESPONSE);
create_session_resp_p = &message_p->msg.sgwCreateSessionResponse;
......@@ -173,5 +173,5 @@ int s11_mme_handle_create_session_response(NwGtpv2cStackHandleT *stack_p,
rc = nwGtpv2cMsgDelete(*stack_p, (pUlpApi->hMsg));
DevAssert(NW_OK == rc);
return send_msg_to_task(TASK_MME_APP, INSTANCE_DEFAULT, message_p);
return itti_send_msg_to_task(TASK_MME_APP, INSTANCE_DEFAULT, message_p);
}
......@@ -110,7 +110,7 @@ NwRcT s11_mme_send_udp_msg(
udp_data_req_t *udp_data_req_p;
int ret = 0;
message_p = alloc_new_message(TASK_S11, UDP_DATA_REQ);
message_p = itti_alloc_new_message(TASK_S11, UDP_DATA_REQ);
udp_data_req_p = &message_p->msg.udp_data_req;
......@@ -119,7 +119,7 @@ NwRcT s11_mme_send_udp_msg(
udp_data_req_p->buffer = buffer;
udp_data_req_p->buffer_length = buffer_len;
ret = send_msg_to_task(TASK_UDP, INSTANCE_DEFAULT, message_p);