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
This commit is contained in:
winckel
2013-10-23 12:18:35 +00:00
parent 228aa778e0
commit b45af4a3c9
50 changed files with 1088 additions and 1017 deletions
+2
View File
@@ -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)
+3
View File
@@ -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
+183 -165
View File
@@ -1,32 +1,32 @@
/*******************************************************************************
Eurecom OpenAirInterface
Copyright(c) 1999 - 2012 Eurecom
Eurecom OpenAirInterface
Copyright(c) 1999 - 2012 Eurecom
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Contact Information
Openair Admin: openair_admin@eurecom.fr
Openair Tech : openair_tech@eurecom.fr
Forums : http://forums.eurecom.fr/openairinterface
Address : EURECOM, Campus SophiaTech, 450 Route des Chappes
06410 Biot FRANCE
Contact Information
Openair Admin: openair_admin@eurecom.fr
Openair Tech : openair_tech@eurecom.fr
Forums : http://forums.eurecom.fr/openairinterface
Address : EURECOM, Campus SophiaTech, 450 Route des Chappes
06410 Biot FRANCE
*******************************************************************************/
*******************************************************************************/
#include <pthread.h>
#include <stdio.h>
@@ -34,6 +34,7 @@
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <signal.h>
#include "queue.h"
#include "assertions.h"
@@ -45,6 +46,7 @@
#include "intertask_interface_init.h"
#undef CHECK_PROTOTYPE_ONLY
#include "signals.h"
#include "timer.h"
int itti_debug = 1;
@@ -58,125 +60,124 @@ int itti_debug = 1;
#define MESSAGE_SIZE(mESSAGEiD) (sizeof(MessageHeader) + itti_desc.messages_info[mESSAGEiD].size)
typedef enum task_state_s {
TASK_STATE_NOT_CONFIGURED,
TASK_STATE_STARTING,
TASK_STATE_READY,
TASK_STATE_MAX,
TASK_STATE_NOT_CONFIGURED, TASK_STATE_STARTING, TASK_STATE_READY, TASK_STATE_ENDED, TASK_STATE_MAX,
} task_state_t;
/* This list acts as a FIFO of messages received by tasks (RRC, NAS, ...) */
struct message_list_s {
STAILQ_ENTRY(message_list_s) next_element;
MessageDef *msg; ///< Pointer to the message
MessageDef *msg; ///< Pointer to the message
message_number_t message_number; ///< Unique message number
uint32_t message_priority; ///< Message priority
message_number_t message_number; ///< Unique message number
uint32_t message_priority; ///< Message priority
};
typedef struct task_desc_s {
/* Queue of messages belonging to the task */
STAILQ_HEAD(message_queue_head, message_list_s) message_queue;
STAILQ_HEAD(message_queue_head, message_list_s)
message_queue;
/* Number of messages in the queue */
volatile uint32_t message_in_queue;
volatile uint32_t message_in_queue;
/* Mutex for the message queue */
pthread_mutex_t message_queue_mutex;
pthread_mutex_t message_queue_mutex;
/* Conditional var for message queue and task synchro */
pthread_cond_t message_queue_cond_var;
pthread_t task_thread;
pthread_cond_t message_queue_cond_var;
pthread_t task_thread;
volatile task_state_t task_state;
} task_desc_t;
struct itti_desc_s {
task_desc_t *tasks;
/* Current message number. Incremented every call to send_msg_to_task */
message_number_t message_number __attribute__((aligned(8)));
message_number_t message_number __attribute__((aligned(8)));
thread_id_t thread_max;
MessagesIds messages_id_max;
pthread_t thread_handling_signals;
const char * const *threads_name;
const message_info_t *messages_info;
};
static struct itti_desc_s itti_desc;
static inline
message_number_t increment_message_number(void)
{
static inline message_number_t itti_increment_message_number(void) {
/* Atomic operation supported by GCC: returns the current message number
* and then increment it by 1.
* This can be done without mutex.
*/
return __sync_fetch_and_add(&itti_desc.message_number, 1);
return __sync_fetch_and_add (&itti_desc.message_number, 1);
}
static inline uint32_t get_message_priority(MessagesIds message_id)
{
static inline uint32_t itti_get_message_priority(MessagesIds message_id) {
DevCheck(message_id < itti_desc.messages_id_max, message_id, itti_desc.messages_id_max, 0);
return (itti_desc.messages_info[message_id].priority);
}
char *get_message_name(MessagesIds message_id)
{
char *itti_get_message_name(MessagesIds message_id) {
DevCheck(message_id < itti_desc.messages_id_max, message_id, itti_desc.messages_id_max, 0);
return (itti_desc.messages_info[message_id].name);
}
int send_broadcast_message(MessageDef *message_p)
{
int itti_send_broadcast_message(MessageDef *message_p) {
thread_id_t origin_thread_id;
uint32_t i;
int ret = 0;
int temp;
int result;
for (i = THREAD_FIRST; i < itti_desc.thread_max; i++)
{
if (message_p == NULL) {
ITTI_ERROR("Message to broadcast is NULL (%s:%d)\n", __FILE__, __LINE__);
return -1;
}
origin_thread_id = TASK_GET_THREAD_ID(message_p->header.originTaskId);
for (i = THREAD_FIRST; i < itti_desc.thread_max; i++) {
MessageDef *new_message_p;
/* Skip tasks which are not running */
if (itti_desc.tasks[i].task_state == TASK_STATE_READY)
{
new_message_p = malloc(sizeof(MessageDef));
/* Skip task that broadcast the message */
if (i != origin_thread_id) {
/* Skip tasks which are not running */
if (itti_desc.tasks[i].task_state == TASK_STATE_READY) {
new_message_p = malloc (sizeof(MessageDef));
if (new_message_p == NULL) {
ITTI_ERROR("Failed to allocate memory (%s:%d)\n",
__FILE__, __LINE__);
return -1;
}
memcpy(new_message_p, message_p, sizeof(MessageDef));
temp = send_msg_to_task(TASK_SHIFT_THREAD_ID(i), INSTANCE_DEFAULT, new_message_p);
if (temp < 0) {
ITTI_ERROR("Failed to send broadcast message (%s) to queue (%u:%s)\n",
itti_desc.messages_info[message_p->header.messageId].name, i, itti_desc.threads_name[i]);
ret = temp;
free(new_message_p);
if (new_message_p == NULL) {
ITTI_ERROR("Failed to allocate memory (%s:%d)\n", __FILE__, __LINE__);
return -1;
}
memcpy (new_message_p, message_p, sizeof(MessageDef));
result = itti_send_msg_to_task (TASK_SHIFT_THREAD_ID(i), INSTANCE_DEFAULT, new_message_p);
if (result < 0) {
ITTI_ERROR("Failed to send broadcast message (%s) to queue (%u:%s)\n",
itti_desc.messages_info[message_p->header.messageId].name, i, itti_desc.threads_name[i]);
ret = result;
free (new_message_p);
}
}
}
}
free (message_p);
return ret;
}
inline MessageDef *alloc_new_message(
task_id_t origin_task_id,
MessagesIds message_id)
{
inline MessageDef *itti_alloc_new_message(task_id_t origin_task_id, MessagesIds message_id) {
MessageDef *temp = NULL;
if ((TASK_GET_THREAD_ID(origin_task_id) >= itti_desc.thread_max) ||
(message_id >= itti_desc.messages_id_max))
{
if (message_id >= itti_desc.messages_id_max) {
ITTI_ERROR("Invalid message id %d (%s:%d)\n", message_id, __FILE__, __LINE__);
return NULL;
}
temp = calloc(1, MESSAGE_SIZE(message_id));
temp = calloc (1, MESSAGE_SIZE(message_id));
if (temp == NULL) {
ITTI_ERROR("Cannot allocate memory for new message (%s:%d)\n",
__FILE__, __LINE__);
ITTI_ERROR("Cannot allocate memory for new message (%s:%d)\n", __FILE__, __LINE__);
return NULL;
}
@@ -187,16 +188,14 @@ inline MessageDef *alloc_new_message(
return temp;
}
int send_msg_to_task(task_id_t task_id, instance_t instance, MessageDef *message)
{
thread_id_t thread_id = TASK_GET_THREAD_ID(task_id);
struct message_list_s *new;
uint32_t priority;
message_number_t message_number;
uint32_t message_id;
int itti_send_msg_to_task(task_id_t task_id, instance_t instance, MessageDef *message) {
thread_id_t thread_id = TASK_GET_THREAD_ID(task_id);
struct message_list_s *new;
uint32_t priority;
message_number_t message_number;
uint32_t message_id;
if (thread_id >= itti_desc.thread_max)
{
if (thread_id >= itti_desc.thread_max) {
return -1;
}
@@ -208,43 +207,41 @@ int send_msg_to_task(task_id_t task_id, instance_t instance, MessageDef *message
DevCheck(thread_id < itti_desc.thread_max, thread_id, 0, 0);
DevCheck(message_id < itti_desc.messages_id_max, itti_desc.messages_id_max, message_id, 0);
priority = get_message_priority(message_id);
priority = itti_get_message_priority (message_id);
/* Lock the mutex to get exclusive access to the list */
pthread_mutex_lock(&itti_desc.tasks[thread_id].message_queue_mutex);
pthread_mutex_lock (&itti_desc.tasks[thread_id].message_queue_mutex);
/* We cannot send a message if the task is not running */
DevCheck(itti_desc.tasks[thread_id].task_state == TASK_STATE_READY,
itti_desc.tasks[thread_id].task_state, TASK_STATE_READY, thread_id);
DevCheck(itti_desc.tasks[thread_id].task_state == TASK_STATE_READY, itti_desc.tasks[thread_id].task_state,
TASK_STATE_READY, thread_id);
/* Check the number of messages in the queue */
DevCheck((itti_desc.tasks[thread_id].message_in_queue * sizeof(MessageDef))
< ITTI_QUEUE_SIZE_PER_TASK,
(itti_desc.tasks[thread_id].message_in_queue * sizeof(MessageDef)),
ITTI_QUEUE_SIZE_PER_TASK,
DevCheck((itti_desc.tasks[thread_id].message_in_queue * sizeof(MessageDef)) < ITTI_QUEUE_SIZE_PER_TASK,
(itti_desc.tasks[thread_id].message_in_queue * sizeof(MessageDef)), ITTI_QUEUE_SIZE_PER_TASK,
itti_desc.tasks[thread_id].message_in_queue);
/* Allocate new list element */
if ((new = (struct message_list_s *)malloc(sizeof(struct message_list_s))) == NULL)
{
ITTI_ERROR("Cannot allocate memory for new message (%s:%d)\n",
__FILE__, __LINE__);
if ((new = (struct message_list_s *) malloc (sizeof(struct message_list_s))) == NULL) {
ITTI_ERROR("Cannot allocate memory for new message (%s:%d)\n", __FILE__, __LINE__);
return -1;
}
/* Increment the global message number */
message_number = increment_message_number();
message_number = itti_increment_message_number ();
/* Fill in members */
new->msg = message;
new->message_number = message_number;
new->msg = message;
new->message_number = message_number;
new->message_priority = priority;
itti_dump_queue_message(message_number, message, itti_desc.messages_info[message_id].name, MESSAGE_SIZE(message_id));
itti_dump_queue_message (message_number, message, itti_desc.messages_info[message_id].name,
MESSAGE_SIZE(message_id));
if (STAILQ_EMPTY(&itti_desc.tasks[thread_id].message_queue)) {
STAILQ_INSERT_HEAD(&itti_desc.tasks[thread_id].message_queue, new, next_element);
} else {
if (STAILQ_EMPTY (&itti_desc.tasks[thread_id].message_queue)) {
STAILQ_INSERT_HEAD (&itti_desc.tasks[thread_id].message_queue, new, next_element);
}
else {
// struct message_list_s *insert_after = NULL;
// struct message_list_s *temp;
//
@@ -263,7 +260,7 @@ int send_msg_to_task(task_id_t task_id, instance_t instance, MessageDef *message
// }
// }
// if (insert_after == NULL) {
STAILQ_INSERT_TAIL(&itti_desc.tasks[thread_id].message_queue, new, next_element);
STAILQ_INSERT_TAIL (&itti_desc.tasks[thread_id].message_queue, new, next_element);
// } else {
// STAILQ_INSERT_AFTER(&itti_desc.tasks[thread_id].message_queue, insert_after, new,
// next_element);
@@ -274,84 +271,78 @@ int send_msg_to_task(task_id_t task_id, instance_t instance, MessageDef *message
itti_desc.tasks[thread_id].message_in_queue++;
if (itti_desc.tasks[thread_id].message_in_queue == 1) {
/* Emit a signal to wake up target task thread */
pthread_cond_signal(&itti_desc.tasks[thread_id].message_queue_cond_var);
pthread_cond_signal (&itti_desc.tasks[thread_id].message_queue_cond_var);
}
/* Release the mutex */
pthread_mutex_unlock(&itti_desc.tasks[thread_id].message_queue_mutex);
ITTI_DEBUG("Message %s, number %lu with priority %d successfully sent to queue (%u:%s)\n",
itti_desc.messages_info[message_id].name, message_number,
priority, thread_id, itti_desc.threads_name[thread_id]);
pthread_mutex_unlock (&itti_desc.tasks[thread_id].message_queue_mutex);
ITTI_DEBUG(
"Message %s, number %lu with priority %d successfully sent to queue (%u:%s)\n",
itti_desc.messages_info[message_id].name, message_number, priority, thread_id, itti_desc.threads_name[thread_id]);
return 0;
}
void receive_msg(task_id_t task_id, MessageDef **received_msg)
{
void itti_receive_msg(task_id_t task_id, MessageDef **received_msg) {
thread_id_t thread_id = TASK_GET_THREAD_ID(task_id);
DevCheck(thread_id < itti_desc.thread_max, thread_id, 0, 0);
DevAssert(received_msg != NULL);
// Lock the mutex to get exclusive access to the list
pthread_mutex_lock(&itti_desc.tasks[thread_id].message_queue_mutex);
pthread_mutex_lock (&itti_desc.tasks[thread_id].message_queue_mutex);
if (itti_desc.tasks[thread_id].message_in_queue == 0) {
ITTI_DEBUG("Message in queue[(%u:%s)] == 0, waiting\n",
thread_id, itti_desc.threads_name[thread_id]);
ITTI_DEBUG("Message in queue[(%u:%s)] == 0, waiting\n", thread_id, itti_desc.threads_name[thread_id]);
// Wait while list == 0
pthread_cond_wait(&itti_desc.tasks[thread_id].message_queue_cond_var,
&itti_desc.tasks[thread_id].message_queue_mutex);
pthread_cond_wait (&itti_desc.tasks[thread_id].message_queue_cond_var,
&itti_desc.tasks[thread_id].message_queue_mutex);
ITTI_DEBUG("Receiver queue[(%u:%s)] got new message notification for task %x\n",
thread_id, itti_desc.threads_name[thread_id], task_id);
}
if (!STAILQ_EMPTY(&itti_desc.tasks[thread_id].message_queue)) {
struct message_list_s *temp = STAILQ_FIRST(
&itti_desc.tasks[thread_id].message_queue);
if (!STAILQ_EMPTY (&itti_desc.tasks[thread_id].message_queue)) {
struct message_list_s *temp = STAILQ_FIRST (&itti_desc.tasks[thread_id].message_queue);
/* Update received_msg reference */
*received_msg = temp->msg;
/* Remove message from queue */
STAILQ_REMOVE_HEAD(&itti_desc.tasks[thread_id].message_queue, next_element);
free(temp);
STAILQ_REMOVE_HEAD (&itti_desc.tasks[thread_id].message_queue, next_element);
free (temp);
itti_desc.tasks[thread_id].message_in_queue--;
}
// Release the mutex
pthread_mutex_unlock(&itti_desc.tasks[thread_id].message_queue_mutex);
pthread_mutex_unlock (&itti_desc.tasks[thread_id].message_queue_mutex);
}
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) {
thread_id_t thread_id = TASK_GET_THREAD_ID(task_id);
DevCheck (thread_id < itti_desc.thread_max, thread_id, 0, 0);
DevAssert (received_msg != NULL);
DevCheck(thread_id < itti_desc.thread_max, thread_id, 0, 0);
DevAssert(received_msg != NULL);
*received_msg = NULL;
if (itti_desc.tasks[thread_id].message_in_queue != 0)
{
if (itti_desc.tasks[thread_id].message_in_queue != 0) {
struct message_list_s *temp;
// Lock the mutex to get exclusive access to the list
pthread_mutex_lock (&itti_desc.tasks[thread_id].message_queue_mutex);
STAILQ_FOREACH(temp, &itti_desc.tasks[thread_id].message_queue, next_element)
STAILQ_FOREACH (temp, &itti_desc.tasks[thread_id].message_queue, next_element)
{
if ((temp->msg->header.destinationTaskId == task_id)
&& ((instance == INSTANCE_ALL) || (temp->msg->header.instance == instance)))
{
&& ((instance == INSTANCE_ALL) || (temp->msg->header.instance == instance))) {
/* Update received_msg reference */
*received_msg = temp->msg;
/* Remove message from queue */
STAILQ_REMOVE(&itti_desc.tasks[thread_id].message_queue, temp, message_list_s, next_element);
STAILQ_REMOVE (&itti_desc.tasks[thread_id].message_queue, temp, message_list_s, next_element);
free (temp);
itti_desc.tasks[thread_id].message_in_queue--;
ITTI_DEBUG("Receiver queue[(%u:%s)] got new message %s, number %lu for task %x\n",
thread_id, itti_desc.threads_name[thread_id], itti_desc.messages_info[temp->msg->header.messageId].name,
temp->message_number, task_id);
ITTI_DEBUG(
"Receiver queue[(%u:%s)] got new message %s, number %lu for task %x\n",
thread_id, itti_desc.threads_name[thread_id], itti_desc.messages_info[temp->msg->header.messageId].name, temp->message_number, task_id);
break;
}
}
@@ -360,16 +351,12 @@ void poll_msg(task_id_t task_id, instance_t instance, MessageDef **received_msg)
pthread_mutex_unlock (&itti_desc.tasks[thread_id].message_queue_mutex);
}
if (*received_msg == NULL)
{
if (*received_msg == NULL) {
ITTI_DEBUG("No message in queue[(%u:%s)] for task %x\n", thread_id, itti_desc.threads_name[thread_id], task_id);
}
}
int intertask_interface_create_task(task_id_t task_id,
void *(*start_routine) (void *),
void *args_p)
{
int itti_create_task(task_id_t task_id, void *(*start_routine)(void *), void *args_p) {
thread_id_t thread_id = TASK_GET_THREAD_ID(task_id);
DevAssert(start_routine != NULL);
@@ -377,76 +364,107 @@ int intertask_interface_create_task(task_id_t task_id,
if (itti_desc.tasks[thread_id].task_state != TASK_STATE_NOT_CONFIGURED) {
ITTI_ERROR("You are attempting to start an already configured thread"
" for %s thread\n", itti_desc.threads_name[thread_id]);
" for %s thread\n",
itti_desc.threads_name[thread_id]);
return -1;
}
itti_desc.tasks[thread_id].task_state = TASK_STATE_STARTING;
if (pthread_create(&itti_desc.tasks[thread_id].task_thread, NULL, start_routine,
args_p) < 0) {
ITTI_ERROR("Failed to initialize %s thread: %s:%d\n", itti_desc.threads_name[thread_id],
strerror(errno),
errno);
if (pthread_create (&itti_desc.tasks[thread_id].task_thread, NULL, start_routine, args_p) < 0) {
ITTI_ERROR("Failed to initialize %s thread: %s:%d\n",
itti_desc.threads_name[thread_id], strerror(errno), errno);
return -1;
}
/* Wait till the thread is completely ready */
while (itti_desc.tasks[thread_id].task_state != TASK_STATE_READY);
while (itti_desc.tasks[thread_id].task_state != TASK_STATE_READY)
;
return 0;
}
void intertask_interface_mark_task_ready(task_id_t task_id)
{
void itti_mark_task_ready(task_id_t task_id) {
thread_id_t thread_id = TASK_GET_THREAD_ID(task_id);
DevCheck(thread_id < itti_desc.thread_max, thread_id, 0, 0);
// Lock the mutex to get exclusive access to the list
pthread_mutex_lock(&itti_desc.tasks[thread_id].message_queue_mutex);
pthread_mutex_lock (&itti_desc.tasks[thread_id].message_queue_mutex);
itti_desc.tasks[thread_id].task_state = TASK_STATE_READY;
// Release the mutex
pthread_mutex_unlock(&itti_desc.tasks[thread_id].message_queue_mutex);
pthread_mutex_unlock (&itti_desc.tasks[thread_id].message_queue_mutex);
}
int intertask_interface_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)
{
void itti_terminate_tasks(task_id_t task_id) {
// Sends Terminate signals to all tasks.
itti_send_terminate_message (task_id);
if (itti_desc.thread_handling_signals >= 0) {
pthread_kill (itti_desc.thread_handling_signals, SIGUSR1);
}
pthread_exit (NULL);
}
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) {
int i;
itti_desc.message_number = 0;
CHECK_INIT_RETURN(signal_init());
/* Saves threads and messages max values */
itti_desc.thread_max = thread_max;
itti_desc.messages_id_max = messages_id_max;
itti_desc.thread_handling_signals = -1;
itti_desc.threads_name = threads_name;
itti_desc.messages_info = messages_info;
/* Allocates memory for tasks info */
itti_desc.tasks = calloc(itti_desc.thread_max, sizeof(task_desc_t));
itti_desc.tasks = calloc (itti_desc.thread_max, sizeof(task_desc_t));
/* Initializing each queue and related stuff */
for (i = THREAD_FIRST; i < itti_desc.thread_max; i++) {
STAILQ_INIT(&itti_desc.tasks[i].message_queue);
STAILQ_INIT (&itti_desc.tasks[i].message_queue);
itti_desc.tasks[i].message_in_queue = 0;
// Initialize mutexes
pthread_mutex_init(&itti_desc.tasks[i].message_queue_mutex, NULL);
pthread_mutex_init (&itti_desc.tasks[i].message_queue_mutex, NULL);
// Initialize Cond vars
pthread_cond_init(&itti_desc.tasks[i].message_queue_cond_var, NULL);
pthread_cond_init (&itti_desc.tasks[i].message_queue_cond_var, NULL);
itti_desc.tasks[i].task_state = TASK_STATE_NOT_CONFIGURED;
}
itti_dump_init(messages_definition_xml);
itti_dump_init (messages_definition_xml);
timer_init();
CHECK_INIT_RETURN(timer_init ());
return 0;
}
void intertask_interface_send_quit_signal(void)
{
void itti_wait_tasks_end(void) {
int end = 0;
int i;
itti_desc.thread_handling_signals = pthread_self ();
/* Handle signals here */
while (end == 0) {
signal_handle (&end);
}
for (i = THREAD_FIRST; i < itti_desc.thread_max; i++) {
/* Skip tasks which are not running */
if (itti_desc.tasks[i].task_state == TASK_STATE_READY) {
ITTI_DEBUG("Waiting end of thread %s\n", itti_desc.threads_name[i]);
pthread_join (itti_desc.tasks[i].task_thread, NULL);
itti_desc.tasks[i].task_state = TASK_STATE_ENDED;
}
}
}
void itti_send_terminate_message(task_id_t task_id) {
MessageDef *terminate_message_p;
terminate_message_p = alloc_new_message(TASK_UNKNOWN, TERMINATE_MESSAGE);
terminate_message_p = itti_alloc_new_message (task_id, TERMINATE_MESSAGE);
send_broadcast_message(terminate_message_p);
itti_send_broadcast_message (terminate_message_p);
}
+25 -12
View File
@@ -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_ */
/* @} */
+1 -1
View File
@@ -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_ */
+2 -2
View File
@@ -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;
+16 -16
View File
@@ -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;
}
+8 -8
View File
@@ -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);
}
}
}
+4 -4
View File
@@ -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;
+4 -4
View File
@@ -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;
}
+2 -2
View File
@@ -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);
+9 -9
View File
@@ -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");
+2 -12
View File
@@ -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;
}
+2 -12
View File
@@ -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;
}
+2 -11
View File
@@ -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;
}
+2 -2
View File
@@ -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);
}
+8 -8
View File
@@ -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);
ret = itti_send_msg_to_task(TASK_UDP, INSTANCE_DEFAULT, message_p);
return ((ret == 0) ? NW_OK : NW_FAILURE);
}
@@ -173,10 +173,10 @@ NwRcT s11_mme_stop_timer_wrapper(
static void *s11_mme_thread(void *args)
{
intertask_interface_mark_task_ready(TASK_S11);
itti_mark_task_ready(TASK_S11);
while(1) {
MessageDef *received_message_p = NULL;
receive_msg(TASK_S11, &received_message_p);
itti_receive_msg(TASK_S11, &received_message_p);
assert(received_message_p != NULL);
switch(received_message_p->header.messageId) {
@@ -209,7 +209,7 @@ static void *s11_mme_thread(void *args)
} break;
default: {
S11_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;
@@ -224,7 +224,7 @@ static int s11_send_init_udp(char *address, uint16_t port_number)
{
MessageDef *message_p;
message_p = alloc_new_message(TASK_S11, UDP_INIT);
message_p = itti_alloc_new_message(TASK_S11, UDP_INIT);
if (message_p == NULL) {
return -1;
}
@@ -235,7 +235,7 @@ static int s11_send_init_udp(char *address, uint16_t port_number)
S11_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);
}
int s11_mme_init(const mme_config_t *mme_config_p)
@@ -276,7 +276,7 @@ int s11_mme_init(const mme_config_t *mme_config_p)
logMgr.logReqCallback = s11_mme_log_wrapper;
DevAssert(NW_OK == nwGtpv2cSetLogMgrEntity(s11_mme_stack_handle, &logMgr));
if (intertask_interface_create_task(TASK_S11, &s11_mme_thread, NULL) < 0) {
if (itti_create_task(TASK_S11, &s11_mme_thread, NULL) < 0) {
S11_ERROR("gtpv1u phtread_create: %s\n", strerror(errno));
goto fail;
}
+8 -8
View File
@@ -110,7 +110,7 @@ NwRcT s11_sgw_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_sgw_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);
ret = itti_send_msg_to_task(TASK_UDP, INSTANCE_DEFAULT, message_p);
return ret == 0 ? NW_OK : NW_FAILURE;
}
@@ -185,10 +185,10 @@ NwRcT s11_sgw_stop_timer_wrapper(
static void *s11_sgw_thread(void *args)
{
intertask_interface_mark_task_ready(TASK_S11);
itti_mark_task_ready(TASK_S11);
while(1) {
MessageDef *received_message_p = NULL;
receive_msg(TASK_S11, &received_message_p);
itti_receive_msg(TASK_S11, &received_message_p);
assert(received_message_p != NULL);
switch(received_message_p->header.messageId) {
@@ -235,7 +235,7 @@ static void *s11_sgw_thread(void *args)
} break;
default: {
S11_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;
@@ -250,7 +250,7 @@ static int s11_send_init_udp(char *address, uint16_t port_number)
{
MessageDef *message_p;
message_p = alloc_new_message(TASK_S11, UDP_INIT);
message_p = itti_alloc_new_message(TASK_S11, UDP_INIT);
if (message_p == NULL) {
return -1;
}
@@ -261,7 +261,7 @@ static int s11_send_init_udp(char *address, uint16_t port_number)
S11_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);
}
int s11_sgw_init(const mme_config_t *mme_config_p)
@@ -302,7 +302,7 @@ int s11_sgw_init(const mme_config_t *mme_config_p)
DevAssert(NW_OK == nwGtpv2cSetLogMgrEntity(s11_sgw_stack_handle, &logMgr));
if (intertask_interface_create_task(TASK_S11, &s11_sgw_thread, NULL) < 0) {
if (itti_create_task(TASK_S11, &s11_sgw_thread, NULL) < 0) {
S11_ERROR("gtpv1u phtread_create: %s\n", strerror(errno));
goto fail;
}
+2 -2
View File
@@ -32,7 +32,7 @@ int s11_sgw_handle_modify_bearer_request(NwGtpv2cStackHandleT *stack_p,
DevAssert(stack_p != NULL);
message_p = alloc_new_message(TASK_S11, SGW_MODIFY_BEARER_REQUEST);
message_p = itti_alloc_new_message(TASK_S11, SGW_MODIFY_BEARER_REQUEST);
modify_bearer_request_p = &message_p->msg.sgwModifyBearerRequest;
@@ -159,7 +159,7 @@ int s11_sgw_handle_modify_bearer_request(NwGtpv2cStackHandleT *stack_p,
rc = nwGtpv2cMsgDelete(*stack_p, (pUlpApi->hMsg));
DevAssert(NW_OK == rc);
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);
}
int s11_sgw_handle_modify_bearer_response(
+4 -4
View File
@@ -32,7 +32,7 @@ int s11_sgw_handle_create_session_request(NwGtpv2cStackHandleT *stack_p,
DevAssert(stack_p != NULL);
message_p = alloc_new_message(TASK_S11, SGW_CREATE_SESSION_REQUEST);
message_p = itti_alloc_new_message(TASK_S11, SGW_CREATE_SESSION_REQUEST);
create_session_request_p = &message_p->msg.sgwCreateSessionRequest;
@@ -244,7 +244,7 @@ int s11_sgw_handle_create_session_request(NwGtpv2cStackHandleT *stack_p,
rc = nwGtpv2cMsgDelete(*stack_p, (pUlpApi->hMsg));
DevAssert(NW_OK == rc);
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);
}
int s11_sgw_handle_create_session_response(
@@ -333,7 +333,7 @@ int s11_sgw_handle_delete_session_request(NwGtpv2cStackHandleT *stack_p,
DevAssert(stack_p != NULL);
message_p = alloc_new_message(TASK_S11, SGW_DELETE_SESSION_REQUEST);
message_p = itti_alloc_new_message(TASK_S11, SGW_DELETE_SESSION_REQUEST);
delete_session_request_p = &message_p->msg.sgwDeleteSessionRequest;
@@ -444,7 +444,7 @@ int s11_sgw_handle_delete_session_request(NwGtpv2cStackHandleT *stack_p,
rc = nwGtpv2cMsgDelete(*stack_p, (pUlpApi->hMsg));
DevAssert(NW_OK == rc);
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);
}
int s11_sgw_handle_delete_session_response(
+6 -6
View File
@@ -68,7 +68,7 @@ void *s1ap_mme_thread(void *args);
static int s1ap_send_init_sctp(void) {
// Create and alloc new message
MessageDef *message_p;
message_p = alloc_new_message(TASK_S1AP, SCTP_INIT_MSG);
message_p = itti_alloc_new_message(TASK_S1AP, SCTP_INIT_MSG);
message_p->msg.sctpInit.port = S1AP_PORT_NUMBER;
message_p->msg.sctpInit.ppid = S1AP_SCTP_PPID;
message_p->msg.sctpInit.ipv4 = 1;
@@ -81,20 +81,20 @@ static int s1ap_send_init_sctp(void) {
message_p->msg.sctpInit.nb_ipv6_addr = 0;
message_p->msg.sctpInit.ipv6_address[0] = "0:0:0:0:0:0:0:1";
return send_msg_to_task(TASK_SCTP, INSTANCE_DEFAULT, message_p);
return itti_send_msg_to_task(TASK_SCTP, INSTANCE_DEFAULT, message_p);
}
void *s1ap_mme_thread(void *args)
{
MessageDef *received_message_p;
intertask_interface_mark_task_ready(TASK_S1AP);
itti_mark_task_ready(TASK_S1AP);
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.
*/
receive_msg(TASK_S1AP, &received_message_p);
itti_receive_msg(TASK_S1AP, &received_message_p);
assert(received_message_p != NULL);
switch(received_message_p->header.messageId) {
case S1AP_SCTP_NEW_MESSAGE_IND: {
@@ -140,7 +140,7 @@ void *s1ap_mme_thread(void *args)
} break;
default: {
S1AP_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;
}
@@ -170,7 +170,7 @@ int s1ap_mme_init(const mme_config_t *mme_config_p) {
# endif
#endif
if (intertask_interface_create_task(TASK_S1AP, &s1ap_mme_thread, NULL) < 0) {
if (itti_create_task(TASK_S1AP, &s1ap_mme_thread, NULL) < 0) {
S1AP_ERROR("Error while creating S1AP task\n");
return -1;
}
+4 -4
View File
@@ -445,7 +445,7 @@ int s1ap_mme_handle_ue_cap_indication(uint32_t assoc_id, uint32_t stream,
MessageDef *message_p;
s1ap_ue_cap_ind_t *ue_cap_ind_p;
message_p = alloc_new_message(TASK_S1AP, S1AP_UE_CAPABILITIES_IND);
message_p = itti_alloc_new_message(TASK_S1AP, S1AP_UE_CAPABILITIES_IND);
DevAssert(message_p != NULL);
@@ -461,7 +461,7 @@ int s1ap_mme_handle_ue_cap_indication(uint32_t assoc_id, uint32_t stream,
ue_cap_ind_p->radio_capabilities_length = ue_cap_p->ueRadioCapability.size;
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);
}
return 0;
}
@@ -506,7 +506,7 @@ int s1ap_mme_handle_initial_context_setup_response(
ue_ref->s1_ue_state = S1AP_UE_CONNECTED;
message_p = alloc_new_message(TASK_SPGW_APP, SGW_MODIFY_BEARER_REQUEST);
message_p = itti_alloc_new_message(TASK_SPGW_APP, SGW_MODIFY_BEARER_REQUEST);
if (message_p == NULL) {
return -1;
@@ -525,7 +525,7 @@ int s1ap_mme_handle_initial_context_setup_response(
memcpy(&modify_request_p->bearer_context_to_modify.s1_eNB_fteid.ipv4_address,
eRABSetupItemCtxtSURes_p->transportLayerAddress.buf, 4);
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);
}
int s1ap_mme_handle_ue_context_release_request(uint32_t assoc_id,
+2 -2
View File
@@ -36,7 +36,7 @@ int s1ap_mme_itti_send_sctp_request(uint8_t *buffer, uint32_t length,
MessageDef *message_p;
SctpNewDataReq *sctpNewDataReq_p;
message_p = alloc_new_message(TASK_SCTP, SCTP_NEW_DATA_REQ);
message_p = itti_alloc_new_message(TASK_SCTP, SCTP_NEW_DATA_REQ);
sctpNewDataReq_p = &message_p->msg.sctpNewDataReq;
@@ -45,7 +45,7 @@ int s1ap_mme_itti_send_sctp_request(uint8_t *buffer, uint32_t length,
sctpNewDataReq_p->assocId = assoc_id;
sctpNewDataReq_p->stream = stream;
return send_msg_to_task(TASK_SCTP, INSTANCE_DEFAULT, message_p);
return itti_send_msg_to_task(TASK_SCTP, INSTANCE_DEFAULT, message_p);
}
int s1ap_mme_itti_forward_nas_uplink(uint8_t *buffer, uint32_t length)
+2 -2
View File
@@ -127,7 +127,7 @@ int s1ap_mme_handle_initial_ue_message(uint32_t assoc_id, uint32_t stream,
s1ap_initial_ue_message_t *s1ap_p;
message_p = alloc_new_message(TASK_S1AP, NAS_CONNECTION_ESTABLISHMENT_IND);
message_p = itti_alloc_new_message(TASK_S1AP, NAS_CONNECTION_ESTABLISHMENT_IND);
/* We failed to allocate a new message... */
if (message_p == NULL) {
return -1;
@@ -164,7 +164,7 @@ int s1ap_mme_handle_initial_ue_message(uint32_t assoc_id, uint32_t stream,
memcpy(con_ind_p->initialNasMsg.data, initialUEMessage_p->nas_pdu.buf,
initialUEMessage_p->nas_pdu.size);
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;
+2 -2
View File
@@ -200,7 +200,7 @@ int s6a_aia_cb(struct msg **msg, struct avp *paramavp,
DevAssert(qry != NULL);
message_p = alloc_new_message(TASK_S6A, S6A_AUTH_INFO_ANS);
message_p = itti_alloc_new_message(TASK_S6A, S6A_AUTH_INFO_ANS);
s6a_auth_info_ans_p = &message_p->msg.s6a_auth_info_ans;
S6A_DEBUG("Received S6A Authentication Information Answer (AIA)\n");
@@ -257,7 +257,7 @@ int s6a_aia_cb(struct msg **msg, struct avp *paramavp,
DevMessage("We requested E-UTRAN vectors with an immediate response...\n");
}
send_msg_to_task(TASK_MME_APP, INSTANCE_DEFAULT, message_p);
itti_send_msg_to_task(TASK_MME_APP, INSTANCE_DEFAULT, message_p);
err:
return 0;
}
+4 -4
View File
@@ -67,7 +67,7 @@ static void fd_gnutls_debug(int level, const char *str)
void *s6a_thread(void *args)
{
intertask_interface_mark_task_ready(TASK_S6A);
itti_mark_task_ready(TASK_S6A);
while(1) {
MessageDef *received_message_p = NULL;
@@ -75,7 +75,7 @@ void *s6a_thread(void *args)
* If the queue is empty, this function will block till a
* message is sent to the task.
*/
receive_msg(TASK_S6A, &received_message_p);
itti_receive_msg(TASK_S6A, &received_message_p);
DevAssert(received_message_p != NULL);
switch(received_message_p->header.messageId) {
case S6A_UPDATE_LOCATION_REQ: {
@@ -86,7 +86,7 @@ void *s6a_thread(void *args)
} break;
default: {
S6A_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;
}
@@ -156,7 +156,7 @@ int s6a_init(const mme_config_t *mme_config_p)
/* Trying to connect to peers */
CHECK_FCT(s6a_fd_new_peer());
if (intertask_interface_create_task(TASK_S6A, &s6a_thread, NULL) < 0) {
if (itti_create_task(TASK_S6A, &s6a_thread, NULL) < 0) {
S6A_ERROR("s6a create task\n");
return -1;
}
+2 -2
View File
@@ -60,7 +60,7 @@ int s6a_ula_cb(struct msg **msg, struct avp *paramavp,
DevAssert(qry != NULL);
message_p = alloc_new_message(TASK_S6A, S6A_UPDATE_LOCATION_ANS);
message_p = itti_alloc_new_message(TASK_S6A, S6A_UPDATE_LOCATION_ANS);
s6a_update_location_ans_p = &message_p->msg.s6a_update_location_ans;
@@ -152,7 +152,7 @@ err:
ans = NULL;
send_msg_to_task(TASK_MME_APP, INSTANCE_DEFAULT, message_p);
itti_send_msg_to_task(TASK_MME_APP, INSTANCE_DEFAULT, message_p);
S6A_DEBUG("Sending S6A_UPDATE_LOCATION_ANS to task MME_APP\n");
+6 -6
View File
@@ -10,7 +10,7 @@ int sctp_itti_send_new_association(uint32_t assoc_id, uint16_t instreams,
MessageDef *message_p;
sctp_new_peer_t *sctp_new_peer_p;
message_p = alloc_new_message(TASK_SCTP, SCTP_NEW_ASSOCIATION);
message_p = itti_alloc_new_message(TASK_SCTP, SCTP_NEW_ASSOCIATION);
sctp_new_peer_p = &message_p->msg.sctp_new_peer;
@@ -18,7 +18,7 @@ int sctp_itti_send_new_association(uint32_t assoc_id, uint16_t instreams,
sctp_new_peer_p->instreams = instreams;
sctp_new_peer_p->outstreams = outstreams;
return send_msg_to_task(TASK_S1AP, INSTANCE_DEFAULT, message_p);
return itti_send_msg_to_task(TASK_S1AP, INSTANCE_DEFAULT, message_p);
}
int sctp_itti_send_new_message_ind(int n, uint8_t *buffer, uint32_t assoc_id,
@@ -28,7 +28,7 @@ int sctp_itti_send_new_message_ind(int n, uint8_t *buffer, uint32_t assoc_id,
MessageDef *message_p;
s1ap_sctp_new_msg_ind_t *sctp_new_msg_ind_p;
message_p = alloc_new_message(TASK_SCTP, S1AP_SCTP_NEW_MESSAGE_IND);
message_p = itti_alloc_new_message(TASK_SCTP, S1AP_SCTP_NEW_MESSAGE_IND);
sctp_new_msg_ind_p = &message_p->msg.s1ap_sctp_new_msg_ind;
@@ -42,7 +42,7 @@ int sctp_itti_send_new_message_ind(int n, uint8_t *buffer, uint32_t assoc_id,
sctp_new_msg_ind_p->instreams = instreams;
sctp_new_msg_ind_p->outstreams = outstreams;
return send_msg_to_task(TASK_S1AP, INSTANCE_DEFAULT, message_p);
return itti_send_msg_to_task(TASK_S1AP, INSTANCE_DEFAULT, message_p);
}
int sctp_itti_send_com_down_ind(uint32_t assoc_id)
@@ -50,11 +50,11 @@ int sctp_itti_send_com_down_ind(uint32_t assoc_id)
MessageDef *message_p;
sctp_close_association_t *sctp_close_association_p;
message_p = alloc_new_message(TASK_SCTP, SCTP_CLOSE_ASSOCIATION);
message_p = itti_alloc_new_message(TASK_SCTP, SCTP_CLOSE_ASSOCIATION);
sctp_close_association_p = &message_p->msg.sctp_close_association;
sctp_close_association_p->assoc_id = assoc_id;
return send_msg_to_task(TASK_S1AP, INSTANCE_DEFAULT, message_p);
return itti_send_msg_to_task(TASK_S1AP, INSTANCE_DEFAULT, message_p);
}
+4 -4
View File
@@ -583,11 +583,11 @@ void *sctp_receiver_thread(void *args_p)
static void *sctp_intertask_interface(void *args_p)
{
intertask_interface_mark_task_ready(TASK_SCTP);
itti_mark_task_ready(TASK_SCTP);
while(1) {
MessageDef *received_message_p;
receive_msg(TASK_SCTP, &received_message_p);
itti_receive_msg(TASK_SCTP, &received_message_p);
switch(received_message_p->header.messageId) {
case SCTP_INIT_MSG: {
SCTP_DEBUG("Received SCTP_INIT_MSG\n");
@@ -616,7 +616,7 @@ static void *sctp_intertask_interface(void *args_p)
} break;
default: {
SCTP_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;
}
@@ -636,7 +636,7 @@ int sctp_init(const mme_config_t *mme_config_p)
sctp_desc.nb_instreams = mme_config_p->sctp_config.in_streams;
sctp_desc.nb_outstreams = mme_config_p->sctp_config.out_streams;
if (intertask_interface_create_task(TASK_SCTP, &sctp_intertask_interface,
if (itti_create_task(TASK_SCTP, &sctp_intertask_interface,
NULL) < 0) {
SCTP_ERROR("create task failed");
SCTP_DEBUG("Initializing SCTP task interface: FAILED\n");
+1
View File
@@ -1,5 +1,6 @@
AM_CFLAGS = @ADD_CFLAGS@ \
-I$(top_srcdir)/UTILS \
-I$(top_srcdir)/INTERTASK_INTERFACE \
-I$(top_srcdir)/COMMON
noinst_LTLIBRARIES = libsecu.la
+4 -4
View File
@@ -146,7 +146,7 @@ void sgi_process_raw_packet(sgi_data_t *sgi_data_pP, unsigned char* data_pP, int
return;
}
message_p = alloc_new_message(TASK_FW_IP, GTPV1U_TUNNEL_DATA_REQ);
message_p = itti_alloc_new_message(TASK_FW_IP, GTPV1U_TUNNEL_DATA_REQ);
if (message_p == NULL) {
SGI_IF_ERROR("%s OUT OF MEMORY DROP EGRESS PACKET\n", __FUNCTION__);
return;
@@ -167,7 +167,7 @@ void sgi_process_raw_packet(sgi_data_t *sgi_data_pP, unsigned char* data_pP, int
gtpv1u_tunnel_data_req_p->buffer = message_payload_p;
SGI_IF_DEBUG("%s send GTPV1U_TUNNEL_DATA_REQ to GTPV1U S1u_enb_teid %u local_S1u_teid %u size %u\n", __FUNCTION__, gtpv1u_tunnel_data_req_p->S1u_enb_teid, gtpv1u_tunnel_data_req_p->local_S1u_teid, packet_sizeP);
send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p);
itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p);
}
#else
@@ -279,7 +279,7 @@ void sgi_process_raw_packet(sgi_data_t *sgi_data_pP, unsigned char* data_pP, int
return;
}
message_p = alloc_new_message(TASK_FW_IP, GTPV1U_TUNNEL_DATA_REQ);
message_p = itti_alloc_new_message(TASK_FW_IP, GTPV1U_TUNNEL_DATA_REQ);
if (message_p == NULL) {
SGI_IF_ERROR("%s OUT OF MEMORY DROP EGRESS PACKET\n", __FUNCTION__);
return;
@@ -300,7 +300,7 @@ void sgi_process_raw_packet(sgi_data_t *sgi_data_pP, unsigned char* data_pP, int
gtpv1u_tunnel_data_req_p->buffer = message_payload_p;
SGI_IF_DEBUG("%s send GTPV1U_TUNNEL_DATA_REQ to GTPV1U S1u_enb_teid %u local_S1u_teid %u size %u\n", __FUNCTION__, gtpv1u_tunnel_data_req_p->S1u_enb_teid, gtpv1u_tunnel_data_req_p->local_S1u_teid, packet_sizeP);
send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p);
itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p);
}
#endif
+2 -2
View File
@@ -211,7 +211,7 @@ static int sgi_nfqueue_callback(struct nfq_q_handle *myQueue, struct nfgenmsg *m
//sgi_print_hex_octets((unsigned char *)pktData, len);
message_p = alloc_new_message(TASK_FW_IP, GTPV1U_TUNNEL_DATA_REQ);
message_p = itti_alloc_new_message(TASK_FW_IP, GTPV1U_TUNNEL_DATA_REQ);
if (message_p == NULL) {
return -1;
}
@@ -233,7 +233,7 @@ static int sgi_nfqueue_callback(struct nfq_q_handle *myQueue, struct nfgenmsg *m
memcpy(data_req_p->buffer, pktData, len);
data_req_p->length = len;
if (send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p) < 0) {
if (itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p) < 0) {
SGI_IF_ERROR("Failed to send message to task\n");
free(message_p);
}
+6 -6
View File
@@ -61,7 +61,7 @@ static void* sgi_task_thread(void *args_p)
return NULL;
}
intertask_interface_mark_task_ready(TASK_FW_IP);
itti_mark_task_ready(TASK_FW_IP);
sgi_data_p = (sgi_data_t *)args_p;
@@ -72,7 +72,7 @@ static void* sgi_task_thread(void *args_p)
* message is sent to the task.
*/
MessageDef *received_message_p;
receive_msg(TASK_FW_IP, &received_message_p);
itti_receive_msg(TASK_FW_IP, &received_message_p);
assert(received_message_p != NULL);
switch(received_message_p->header.messageId) {
case GTPV1U_TUNNEL_DATA_IND: {
@@ -126,7 +126,7 @@ static int sgi_create_endpoint_request(sgi_data_t *sgi_dataP, SGICreateEndpointR
SGI_IF_DEBUG("Rx IP_FW_CREATE_SGI_ENDPOINT_REQUEST, Context: S-GW S11 teid %u, S-GW S1U teid %u EPS bearer id %u\n",
req_p->context_teid, req_p->sgw_S1u_teid, req_p->eps_bearer_id);
message_p = alloc_new_message(TASK_FW_IP, SGI_CREATE_ENDPOINT_RESPONSE);
message_p = itti_alloc_new_message(TASK_FW_IP, SGI_CREATE_ENDPOINT_RESPONSE);
if (message_p == NULL) {
return -1;
}
@@ -161,7 +161,7 @@ static int sgi_create_endpoint_request(sgi_data_t *sgi_dataP, SGICreateEndpointR
}
}
}
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);
}
//------------------------------------------------------
@@ -175,7 +175,7 @@ static int sgi_update_endpoint_request(sgi_data_t *sgi_dataP, SGIUpdateEndpointR
SGI_IF_DEBUG("Rx IP_FW_UPDATE_SGI_ENDPOINT_REQUEST, Context: S-GW S11 teid %u, S-GW S1U teid %u EPS bearer id %u\n",
req_p->context_teid, req_p->sgw_S1u_teid, req_p->eps_bearer_id);
message_p = alloc_new_message(TASK_FW_IP, SGI_UPDATE_ENDPOINT_RESPONSE);
message_p = itti_alloc_new_message(TASK_FW_IP, SGI_UPDATE_ENDPOINT_RESPONSE);
if (message_p == NULL) {
return -1;
}
@@ -193,7 +193,7 @@ static int sgi_update_endpoint_request(sgi_data_t *sgi_dataP, SGIUpdateEndpointR
SGI_IF_ERROR("SGI_STATUS_ERROR_CONTEXT_NOT_FOUND Context: S11 teid %u\n", req_p->context_teid);
sgi_update_endpoint_resp_p->status = SGI_STATUS_ERROR_CONTEXT_NOT_FOUND;
}
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);
}
//-----------------------------------------------------------------------------
+28 -28
View File
@@ -164,7 +164,7 @@ int sgw_lite_handle_create_session_request(SgwCreateSessionRequest *session_req_
* tunnel for S1 user plane interface. If status in response is successfull (0),
* the tunnel endpoint is locally ready.
*/
message_p = alloc_new_message(TASK_SPGW_APP, GTPV1U_CREATE_TUNNEL_REQ);
message_p = itti_alloc_new_message(TASK_SPGW_APP, GTPV1U_CREATE_TUNNEL_REQ);
if (message_p == NULL) {
sgw_lite_cm_remove_s11_tunnel(new_endpoint->remote_teid);
return -1;
@@ -175,7 +175,7 @@ int sgw_lite_handle_create_session_request(SgwCreateSessionRequest *session_req_
SPGW_APP_DEBUG("Tx GTPV1U_CREATE_TUNNEL_REQ -> TASK_GTPV1_U, Context: S-GW S11 teid %u eps bearer id %d (from session req)\n",
message_p->msg.gtpv1uCreateTunnelReq.context_teid,
message_p->msg.gtpv1uCreateTunnelReq.eps_bearer_id);
return send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p);
return itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p);
} else {
SPGW_APP_WARNING("Could not create new transaction for SESSION_CREATE message\n");
free(new_endpoint);
@@ -202,7 +202,7 @@ int sgw_lite_handle_sgi_endpoint_created(SGICreateEndpointResp *resp_p)
to_task = TASK_S11;
#endif
message_p = alloc_new_message(TASK_SPGW_APP, SGW_CREATE_SESSION_RESPONSE);
message_p = itti_alloc_new_message(TASK_SPGW_APP, SGW_CREATE_SESSION_RESPONSE);
if (message_p == NULL) {
return -1;
@@ -249,7 +249,7 @@ int sgw_lite_handle_sgi_endpoint_created(SGICreateEndpointResp *resp_p)
create_session_response_p->bearer_context_created.s1u_sgw_fteid.teid,
create_session_response_p->bearer_context_created.eps_bearer_id,
create_session_response_p->bearer_context_created.cause);
return send_msg_to_task(to_task, INSTANCE_DEFAULT, message_p);
return itti_send_msg_to_task(to_task, INSTANCE_DEFAULT, message_p);
}
int sgw_lite_handle_gtpv1uCreateTunnelResp(Gtpv1uCreateTunnelResp *endpoint_created_p)
@@ -287,7 +287,7 @@ int sgw_lite_handle_gtpv1uCreateTunnelResp(Gtpv1uCreateTunnelResp *endpoint_crea
sgw_lite_display_s11_bearer_context_information_mapping();
/* SEND IP_FW_CREATE_IP_ENDPOINT_REQUEST to FW_IP task */
message_p = alloc_new_message(TASK_SPGW_APP, SGI_CREATE_ENDPOINT_REQUEST);
message_p = itti_alloc_new_message(TASK_SPGW_APP, SGI_CREATE_ENDPOINT_REQUEST);
if (message_p == NULL) {
return -1;
}
@@ -299,10 +299,10 @@ int sgw_lite_handle_gtpv1uCreateTunnelResp(Gtpv1uCreateTunnelResp *endpoint_crea
//create_sgi_endpoint_req_p->pdn_type = new_bearer_context_information_p->
// TO DO TFT, QOS
return send_msg_to_task(TASK_FW_IP, INSTANCE_DEFAULT, message_p);
return itti_send_msg_to_task(TASK_FW_IP, INSTANCE_DEFAULT, message_p);
} else {
SPGW_APP_DEBUG("Rx SGW_S1U_ENDPOINT_CREATED, Context: teid %u NOT FOUND\n", endpoint_created_p->context_teid);
message_p = alloc_new_message(TASK_SPGW_APP, SGW_CREATE_SESSION_RESPONSE);
message_p = itti_alloc_new_message(TASK_SPGW_APP, SGW_CREATE_SESSION_RESPONSE);
if (message_p == NULL) {
return -1;
}
@@ -310,7 +310,7 @@ int sgw_lite_handle_gtpv1uCreateTunnelResp(Gtpv1uCreateTunnelResp *endpoint_crea
memset(create_session_response_p, 0, sizeof(SgwCreateSessionResponse));
create_session_response_p->cause = CONTEXT_NOT_FOUND;
create_session_response_p->bearer_context_created.cause = CONTEXT_NOT_FOUND;
return send_msg_to_task(to_task, INSTANCE_DEFAULT, message_p);
return itti_send_msg_to_task(to_task, INSTANCE_DEFAULT, message_p);
}
}
@@ -348,7 +348,7 @@ int sgw_lite_handle_gtpv1uUpdateTunnelResp(Gtpv1uUpdateTunnelResp *endpoint_upda
new_bearer_context_information_p->sgw_eps_bearer_context_information.trxn,
endpoint_updated_p->eps_bearer_id);
message_p = alloc_new_message(TASK_SPGW_APP, SGW_MODIFY_BEARER_RESPONSE);
message_p = itti_alloc_new_message(TASK_SPGW_APP, SGW_MODIFY_BEARER_RESPONSE);
if (message_p == NULL) {
return -1;
}
@@ -360,10 +360,10 @@ int sgw_lite_handle_gtpv1uUpdateTunnelResp(Gtpv1uUpdateTunnelResp *endpoint_upda
modify_response_p->cause = CONTEXT_NOT_FOUND;
modify_response_p->trxn = new_bearer_context_information_p->sgw_eps_bearer_context_information.trxn;
return send_msg_to_task(to_task, INSTANCE_DEFAULT, message_p);
return itti_send_msg_to_task(to_task, INSTANCE_DEFAULT, message_p);
} else if (hash_rc == HASH_TABLE_OK) {
message_p = alloc_new_message(TASK_SPGW_APP, SGI_UPDATE_ENDPOINT_REQUEST);
message_p = itti_alloc_new_message(TASK_SPGW_APP, SGI_UPDATE_ENDPOINT_REQUEST);
if (message_p == NULL) {
return -1;
}
@@ -374,14 +374,14 @@ int sgw_lite_handle_gtpv1uUpdateTunnelResp(Gtpv1uUpdateTunnelResp *endpoint_upda
update_request_p->enb_S1u_teid = endpoint_updated_p->enb_S1u_teid;
update_request_p->eps_bearer_id = endpoint_updated_p->eps_bearer_id;
return send_msg_to_task(TASK_FW_IP, INSTANCE_DEFAULT, message_p);
return itti_send_msg_to_task(TASK_FW_IP, INSTANCE_DEFAULT, message_p);
}
} else {
SPGW_APP_DEBUG("Sending SGW_MODIFY_BEARER_RESPONSE trxn %p bearer %u CONTEXT_NOT_FOUND (s11_bearer_context_information_hashtable)\n",
new_bearer_context_information_p->sgw_eps_bearer_context_information.trxn,
endpoint_updated_p->eps_bearer_id);
message_p = alloc_new_message(TASK_SPGW_APP, SGW_MODIFY_BEARER_RESPONSE);
message_p = itti_alloc_new_message(TASK_SPGW_APP, SGW_MODIFY_BEARER_RESPONSE);
if (message_p == NULL) {
return -1;
}
@@ -393,7 +393,7 @@ int sgw_lite_handle_gtpv1uUpdateTunnelResp(Gtpv1uUpdateTunnelResp *endpoint_upda
modify_response_p->choice.bearer_for_removal.cause = CONTEXT_NOT_FOUND;
modify_response_p->cause = CONTEXT_NOT_FOUND;
modify_response_p->trxn = new_bearer_context_information_p->sgw_eps_bearer_context_information.trxn;
return send_msg_to_task(to_task, INSTANCE_DEFAULT, message_p);
return itti_send_msg_to_task(to_task, INSTANCE_DEFAULT, message_p);
}
return -1;
}
@@ -420,7 +420,7 @@ int sgw_lite_handle_sgi_endpoint_updated(SGIUpdateEndpointResp *resp_p)
resp_p->eps_bearer_id,
resp_p->status);
message_p = alloc_new_message(TASK_SPGW_APP, SGW_MODIFY_BEARER_RESPONSE);
message_p = itti_alloc_new_message(TASK_SPGW_APP, SGW_MODIFY_BEARER_RESPONSE);
if (message_p == NULL) {
return -1;
}
@@ -444,7 +444,7 @@ int sgw_lite_handle_sgi_endpoint_updated(SGIUpdateEndpointResp *resp_p)
modify_response_p->cause = CONTEXT_NOT_FOUND;
modify_response_p->trxn = 0;
return send_msg_to_task(to_task, INSTANCE_DEFAULT, message_p);
return itti_send_msg_to_task(to_task, INSTANCE_DEFAULT, message_p);
} else if (hash_rc == HASH_TABLE_OK) {
SPGW_APP_DEBUG("Rx SGI_UPDATE_ENDPOINT_RESPONSE: REQUEST_ACCEPTED\n");
@@ -456,7 +456,7 @@ int sgw_lite_handle_sgi_endpoint_updated(SGIUpdateEndpointResp *resp_p)
modify_response_p->cause = REQUEST_ACCEPTED;
modify_response_p->trxn = new_bearer_context_information_p->sgw_eps_bearer_context_information.trxn;
}
return send_msg_to_task(to_task, INSTANCE_DEFAULT, message_p);
return itti_send_msg_to_task(to_task, INSTANCE_DEFAULT, message_p);
} else {
SPGW_APP_DEBUG("Rx SGI_UPDATE_ENDPOINT_RESPONSE: CONTEXT_NOT_FOUND (S11 context)\n");
@@ -467,7 +467,7 @@ int sgw_lite_handle_sgi_endpoint_updated(SGIUpdateEndpointResp *resp_p)
modify_response_p->cause = CONTEXT_NOT_FOUND;
modify_response_p->trxn = 0;
return send_msg_to_task(to_task, INSTANCE_DEFAULT, message_p);
return itti_send_msg_to_task(to_task, INSTANCE_DEFAULT, message_p);
}
}
@@ -504,7 +504,7 @@ int sgw_lite_handle_modify_bearer_request(SgwModifyBearerRequest *modify_bearer_
hash_rc = hashtbl_is_key_exists (new_bearer_context_information_p->sgw_eps_bearer_context_information.pdn_connection.sgw_eps_bearers, modify_bearer_p->bearer_context_to_modify.eps_bearer_id);
if (hash_rc == HASH_TABLE_KEY_NOT_EXISTS) {
message_p = alloc_new_message(TASK_SPGW_APP, SGW_MODIFY_BEARER_RESPONSE);
message_p = itti_alloc_new_message(TASK_SPGW_APP, SGW_MODIFY_BEARER_RESPONSE);
if (message_p == NULL) {
return -1;
}
@@ -515,7 +515,7 @@ int sgw_lite_handle_modify_bearer_request(SgwModifyBearerRequest *modify_bearer_
modify_response_p->choice.bearer_for_removal.cause = CONTEXT_NOT_FOUND;
modify_response_p->cause = CONTEXT_NOT_FOUND;
modify_response_p->trxn = modify_bearer_p->trxn;
return send_msg_to_task(to_task, INSTANCE_DEFAULT, message_p);
return itti_send_msg_to_task(to_task, INSTANCE_DEFAULT, message_p);
} else if (hash_rc == HASH_TABLE_OK) {
// TO DO
hash_rc = hashtbl_get (new_bearer_context_information_p->sgw_eps_bearer_context_information.pdn_connection.sgw_eps_bearers, modify_bearer_p->bearer_context_to_modify.eps_bearer_id, (void**)&eps_bearer_entry_p);
@@ -523,7 +523,7 @@ int sgw_lite_handle_modify_bearer_request(SgwModifyBearerRequest *modify_bearer_
eps_bearer_entry_p->enb_teid_for_S1u = modify_bearer_p->bearer_context_to_modify.s1_eNB_fteid.teid;
// UPDATE GTPV1U mapping tables with eNB references (teid, addresses)
message_p = alloc_new_message(TASK_SPGW_APP, GTPV1U_UPDATE_TUNNEL_REQ);
message_p = itti_alloc_new_message(TASK_SPGW_APP, GTPV1U_UPDATE_TUNNEL_REQ);
if (message_p == NULL) {
return -1;
}
@@ -540,10 +540,10 @@ int sgw_lite_handle_modify_bearer_request(SgwModifyBearerRequest *modify_bearer_
//SPGW_APP_DEBUG("Rx MODIFY_BEARER_REQUEST, gtpv1u_update_tunnel_req_p->enb_ip_address_for_S1u = %u\n",modify_bearer_p->enb_ip_address_for_S1u);
SPGW_APP_DEBUG("Rx MODIFY_BEARER_REQUEST, gtpv1u_update_tunnel_req_p->eps_bearer_id = %u\n",gtpv1u_update_tunnel_req_p->eps_bearer_id);
return send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p);
return itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p);
}
} else {
message_p = alloc_new_message(TASK_SPGW_APP, SGW_MODIFY_BEARER_RESPONSE);
message_p = itti_alloc_new_message(TASK_SPGW_APP, SGW_MODIFY_BEARER_RESPONSE);
if (message_p == NULL) {
return -1;
}
@@ -554,7 +554,7 @@ int sgw_lite_handle_modify_bearer_request(SgwModifyBearerRequest *modify_bearer_
modify_response_p->choice.bearer_for_removal.cause = CONTEXT_NOT_FOUND;
modify_response_p->cause = CONTEXT_NOT_FOUND;
modify_response_p->trxn = modify_bearer_p->trxn;
return send_msg_to_task(to_task, INSTANCE_DEFAULT, message_p);
return itti_send_msg_to_task(to_task, INSTANCE_DEFAULT, message_p);
}
return -1;
}
@@ -574,7 +574,7 @@ int sgw_lite_handle_delete_session_request(SgwDeleteSessionRequest *delete_sessi
to_task = TASK_S11;
#endif
message_p = alloc_new_message(TASK_SPGW_APP, SGW_DELETE_SESSION_RESPONSE);
message_p = itti_alloc_new_message(TASK_SPGW_APP, SGW_DELETE_SESSION_RESPONSE);
if (message_p == NULL) {
return -1;
}
@@ -609,12 +609,12 @@ int sgw_lite_handle_delete_session_request(SgwDeleteSessionRequest *delete_sessi
delete_session_resp_p->trxn = delete_session_req_p->trxn;
delete_session_resp_p->peer_ip = delete_session_req_p->peer_ip;
return send_msg_to_task(to_task, INSTANCE_DEFAULT, message_p);
return itti_send_msg_to_task(to_task, INSTANCE_DEFAULT, message_p);
} else {
/* Context not found... set the cause to CONTEXT_NOT_FOUND
* 3GPP TS 29.274 #7.2.10.1
*/
message_p = alloc_new_message(TASK_SPGW_APP, SGW_DELETE_SESSION_RESPONSE);
message_p = itti_alloc_new_message(TASK_SPGW_APP, SGW_DELETE_SESSION_RESPONSE);
if (message_p == NULL) {
return -1;
}
@@ -630,7 +630,7 @@ int sgw_lite_handle_delete_session_request(SgwDeleteSessionRequest *delete_sessi
delete_session_resp_p->trxn = delete_session_req_p->trxn;
delete_session_resp_p->peer_ip = delete_session_req_p->peer_ip;
return send_msg_to_task(to_task, INSTANCE_DEFAULT, message_p);
return itti_send_msg_to_task(to_task, INSTANCE_DEFAULT, message_p);
}
return -1;
+4 -4
View File
@@ -45,10 +45,10 @@ sgw_app_t sgw_app;
static void *sgw_lite_intertask_interface(void *args_p)
{
intertask_interface_mark_task_ready(TASK_SPGW_APP);
itti_mark_task_ready(TASK_SPGW_APP);
while(1) {
MessageDef *received_message_p;
receive_msg(TASK_SPGW_APP, &received_message_p);
itti_receive_msg(TASK_SPGW_APP, &received_message_p);
switch(received_message_p->header.messageId) {
case SGW_CREATE_SESSION_REQUEST: {
/* We received a create session request from MME (with GTP abstraction here)
@@ -89,7 +89,7 @@ static void *sgw_lite_intertask_interface(void *args_p)
default: {
SPGW_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;
}
@@ -102,7 +102,7 @@ static void *sgw_lite_intertask_interface(void *args_p)
int sgw_lite_init(const mme_config_t *mme_config_p)
{
SPGW_APP_DEBUG("Initializing SPGW-APP task interface\n");
if (intertask_interface_create_task(TASK_SPGW_APP,
if (itti_create_task(TASK_SPGW_APP,
&sgw_lite_intertask_interface, NULL) < 0) {
perror("pthread_create");
SPGW_APP_DEBUG("Initializing SPGW-APP task interface: ERROR\n");
+2 -2
View File
@@ -78,7 +78,7 @@ int main(int argc, char *argv[])
/* Calling each layer init function */
log_init(&mme_config);
intertask_interface_init(THREAD_MAX, MESSAGES_ID_MAX, threads_name, messages_info, messages_definition_xml);
itti_init(THREAD_MAX, MESSAGES_ID_MAX, threads_name, messages_info, messages_definition_xml);
sctp_init(&mme_config);
udp_init(&mme_config);
s1ap_mme_init(&mme_config);
@@ -87,7 +87,7 @@ int main(int argc, char *argv[])
sgw_lite_init(&mme_config);
message_p = alloc_new_message(TASK_S1AP, MESSAGE_TEST);
message_p = itti_alloc_new_message(TASK_S1AP, MESSAGE_TEST);
while(i < (1 << 15)) {
if (send_broadcast_message(message_p) < 0) {
+6 -6
View File
@@ -164,7 +164,7 @@ void *udp_receiver_thread(void *arg_p)
memcpy(forwarded_buffer, buffer, n);
message_p = alloc_new_message(TASK_UDP, UDP_DATA_IND);
message_p = itti_alloc_new_message(TASK_UDP, UDP_DATA_IND);
DevAssert(message_p != NULL);
@@ -177,7 +177,7 @@ void *udp_receiver_thread(void *arg_p)
UDP_DEBUG("Msg of length %d received from %s:%u\n",
n, inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
if (send_msg_to_task(udp_sock_p->task_id, INSTANCE_DEFAULT, message_p) < 0) {
if (itti_send_msg_to_task(udp_sock_p->task_id, INSTANCE_DEFAULT, message_p) < 0) {
UDP_DEBUG("Failed to send message %d to task %d\n",
UDP_DATA_IND, udp_sock_p->task_id);
break;
@@ -196,10 +196,10 @@ void *udp_receiver_thread(void *arg_p)
static void *udp_intertask_interface(void *args_p)
{
intertask_interface_mark_task_ready(TASK_UDP);
itti_mark_task_ready(TASK_UDP);
while(1) {
MessageDef *received_message_p = NULL;
receive_msg(TASK_UDP, &received_message_p);
itti_receive_msg(TASK_UDP, &received_message_p);
DevAssert(received_message_p != NULL);
switch (received_message_p->header.messageId) {
@@ -259,7 +259,7 @@ static void *udp_intertask_interface(void *args_p)
} break;
default: {
UDP_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;
}
@@ -276,7 +276,7 @@ int udp_init(const mme_config_t *mme_config_p)
STAILQ_INIT(&udp_socket_list);
if (intertask_interface_create_task(TASK_UDP, &udp_intertask_interface,
if (itti_create_task(TASK_UDP, &udp_intertask_interface,
NULL) < 0) {
UDP_ERROR("udp pthread_create (%s)\n", strerror(errno));
return -1;
+1 -4
View File
@@ -9,13 +9,10 @@ AM_YFLAGS = -d
noinst_LTLIBRARIES = libutils.la
libutils_la_LDFLAGS = -all-static
libutils_la_SOURCES = \
assertions.h \
backtrace.c backtrace.h \
conversions.h conversions.c \
enum_string.h enum_string.c \
log.c log.h \
mme_parser.y mme_scanner.l \
mme_config.c mme_config.h \
mme_default_values.h \
queue.h tree.h \
signals.c signals.h
queue.h tree.h
+1 -1
View File
@@ -43,7 +43,7 @@
******************************************************************************/
#define ITTI_QUEUE_SIZE_PER_TASK (5 * 1024 * 1024) /* Limit the queue size to 5M */
#define ITTI_PORT (10007)
#define ITTI_PORT (10006)
/* This is the queue size for signal dumper */
#define ITTI_QUEUE_SIZE_MAX (1 * 1024 * 1024) /* 1 MBytes */
#define ITTI_DUMP_MAX_CON (5) /* Max connections in parallel */
+2 -2
View File
@@ -73,7 +73,7 @@ static int s1ap_send_init_sctp(void) {
message_p->msg.sctpS1APInit.ppid = S1AP_SCTP_PPID;
message_p->msg.sctpS1APInit.address = "0.0.0.0"; //ANY address
return send_msg_to_task(TASK_SCTP, message_p);
return itti_send_msg_to_task(TASK_SCTP, message_p);
}
void* s1ap_mme_thread(void *args) {
@@ -82,7 +82,7 @@ void* s1ap_mme_thread(void *args) {
* If the queue is empty, this function will block till a
* message is sent to the task.
*/
receive_msg(TASK_S1AP, &receivedMessage);
itti_receive_msg(TASK_S1AP, &receivedMessage);
assert(receivedMessage != NULL);
switch(receivedMessage->messageId) {
case S1AP_SCTP_NEW_MESSAGE_IND:
+5 -5
View File
@@ -72,7 +72,7 @@ int s1ap_mme_encode_s1setupresponse(S1SetupResponseIEs_t *s1SetupResponseIEs, ui
return -1;
}
return send_msg_to_task(TASK_SCTP, message_p);
return itti_send_msg_to_task(TASK_SCTP, message_p);
}
int s1ap_mme_encode_s1setupfailure(S1SetupFailureIEs_t *s1SetupFailureIEs, uint32_t assocId) {
@@ -105,7 +105,7 @@ int s1ap_mme_encode_s1setupfailure(S1SetupFailureIEs_t *s1SetupFailureIEs, uint3
return -1;
}
return send_msg_to_task(TASK_SCTP, message_p);
return itti_send_msg_to_task(TASK_SCTP, message_p);
}
int s1ap_mme_encode_initial_context_setup_request(InitialContextSetupRequestIEs_t *initialContextSetupRequestIEs,
@@ -139,7 +139,7 @@ int s1ap_mme_encode_initial_context_setup_request(InitialContextSetupRequestIEs_
return -1;
}
return send_msg_to_task(TASK_SCTP, message_p);
return itti_send_msg_to_task(TASK_SCTP, message_p);
}
int s1ap_mme_encode_downlink_nas_transport(DownlinkNASTransportIEs_t *downlinkNasTransportIEs,
@@ -174,7 +174,7 @@ int s1ap_mme_encode_downlink_nas_transport(DownlinkNASTransportIEs_t *downlinkNa
return -1;
}
return send_msg_to_task(TASK_SCTP, message_p);
return itti_send_msg_to_task(TASK_SCTP, message_p);
}
int s1ap_mme_encode_ue_context_release_command(UEContextReleaseCommandIEs_t *ueContextReleaseCommandIEs,
@@ -206,7 +206,7 @@ int s1ap_mme_encode_ue_context_release_command(UEContextReleaseCommandIEs_t *ueC
ueContextReleaseCommand_p) < 0)
goto error;
return send_msg_to_task(TASK_SCTP, message_p);
return itti_send_msg_to_task(TASK_SCTP, message_p);
error:
free(message_p);
return -1;
+4 -4
View File
@@ -350,7 +350,7 @@ int s1ap_mme_handle_initial_ue_message(uint32_t assocId, uint32_t stream, struct
MessageDef *message_p;
SgwCreateSessionRequest *session_request_p;
message_p = alloc_new_message(TASK_S1AP, TASK_SGW_LITE, SGW_CREATE_SESSION_REQUEST);
message_p = itti_alloc_new_message(TASK_S1AP, TASK_SGW_LITE, SGW_CREATE_SESSION_REQUEST);
if (message_p == NULL) return -1;
/* WARNING:
@@ -400,7 +400,7 @@ int s1ap_mme_handle_initial_ue_message(uint32_t assocId, uint32_t stream, struct
session_request_p->paa.ipv4_address = 0x00000000;
session_request_p->selection_mode = MS_O_N_P_APN_S_V;
return send_msg_to_task(TASK_SGW_LITE, message_p);
return itti_send_msg_to_task(TASK_SGW_LITE, message_p);
}
}
return 0;
@@ -485,7 +485,7 @@ int s1ap_mme_handle_initial_context_setup_response(
ue_ref->s1_ue_state = S1AP_UE_CONNECTED;
message_p = alloc_new_message(TASK_SGW_LITE, TASK_S1AP, SGW_MODIFY_BEARER_REQUEST);
message_p = itti_alloc_new_message(TASK_SGW_LITE, TASK_S1AP, SGW_MODIFY_BEARER_REQUEST);
if (message_p == NULL) {
return -1;
@@ -500,7 +500,7 @@ int s1ap_mme_handle_initial_context_setup_response(
modify_request_p->bearer_context_to_modify.s1_eNB_fteid.ipv4 = 1;
memcpy(&modify_request_p->bearer_context_to_modify.s1_eNB_fteid.ipv4_address, eRABSetupItemCtxtSURes_p->transportLayerAddress.buf, 4);
return send_msg_to_task(TASK_SGW_LITE, message_p);
return itti_send_msg_to_task(TASK_SGW_LITE, message_p);
}
int s1ap_mme_handle_ue_context_release_request(uint32_t assocId, uint32_t stream, struct s1ap_message_s *message) {
+1 -1
View File
@@ -34,7 +34,7 @@ CFLAGS += -DOPENAIR_LTE -DPUCCH #-DOFDMA_ULSCH -DIFFT_FPGA -DIFFT_FPGA_UE
CFLAGS += -DMAC_CONTEXT=1 -DPHY_CONTEXT=1 -DPHY_ABSTRACTION #-DPHY_ABSTRACTION_UL #-DRLC_UM_TEST_TRAFFIC=1
CFLAGS += -DNEW_FFT
#CFLAGS += -DLLR8
CFLAGS += -DPACKAGE_NAME='"oaisim"'
ifndef OPENAIR2
OPENAIR2=1
endif
+688 -627
View File
File diff suppressed because it is too large Load Diff