diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index fecb69939f..e11c850b8e 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -539,7 +539,6 @@ add_library(S1AP_ENB ${S1AP_DIR}/s1ap_eNB_overload.c ${S1AP_DIR}/s1ap_eNB_trace.c ${S1AP_DIR}/s1ap_eNB_ue_context.c - ${S1AP_DIR}/s1ap_eNB_timer.c ) add_dependencies(S1AP_ENB rrc_flag s1ap_flag) diff --git a/openair3/S1AP/s1ap_eNB.c b/openair3/S1AP/s1ap_eNB.c index 6cb82de8d3..e528c9e53e 100644 --- a/openair3/S1AP/s1ap_eNB.c +++ b/openair3/S1AP/s1ap_eNB.c @@ -58,8 +58,6 @@ #include "s1ap_eNB_ue_context.h" // test, to be removed #include "msc.h" -#include "s1ap_eNB_timer.h" - #include "assertions.h" #include "conversions.h" #if defined(TEST_S1C_MME) @@ -80,6 +78,37 @@ static int s1ap_sctp_req(s1ap_eNB_instance_t *instance_p, void s1ap_eNB_timer_expired(instance_t instance, timer_has_expired_t *msg_p); +int s1ap_timer_setup( + uint32_t interval_sec, + uint32_t interval_us, + task_id_t task_id, + int32_t instance, + uint32_t timer_kind, + timer_type_t type, + void *timer_arg, + long *timer_id) +{ + uint32_t *timeoutArg=NULL; + int ret=0; + timeoutArg=malloc(sizeof(uint32_t)); + *timeoutArg=timer_kind; + ret=timer_setup(interval_sec, + interval_us, + task_id, + instance, + type, + (void*)timeoutArg, + timer_id); + return ret; +} + +int s1ap_timer_remove(long timer_id) +{ + int ret; + ret=timer_remove(timer_id); + return ret; +} + uint32_t s1ap_generate_eNB_id(void) { char *out; char hostname[50]; @@ -407,7 +436,13 @@ void s1ap_eNB_timer_expired( long timer_id = S1AP_TIMERID_INIT; instance_p = s1ap_eNB_get_instance(instance); - timer_kind = *((uint32_t*)msg_p->arg); + if(msg_p->arg!=NULL){ + timer_kind = *((uint32_t*)msg_p->arg); + free(msg_p->arg); + }else{ + S1AP_ERROR("s1 timer timer_kind is NULL\n"); + return; + } line_ind = (int16_t)(timer_kind & S1AP_LINEIND); timer_id = msg_p->timer_id; diff --git a/openair3/S1AP/s1ap_eNB.h b/openair3/S1AP/s1ap_eNB.h index 2abbc53ec9..2183587214 100644 --- a/openair3/S1AP/s1ap_eNB.h +++ b/openair3/S1AP/s1ap_eNB.h @@ -30,6 +30,22 @@ #ifndef S1AP_ENB_H_ #define S1AP_ENB_H_ +#define S1AP_MMEIND 0x80000000 +#define S1AP_UEIND 0x00000000 +#define S1_SETRSP_WAIT 0x00010000 +#define S1_SETREQ_WAIT 0x00020000 +#define SCTP_REQ_WAIT 0x00030000 +#define S1AP_LINEIND 0x0000ffff +#define S1AP_TIMERIND 0x00ff0000 + +#define S1AP_TIMERID_INIT 0xffffffffffffffff + +typedef enum s1ap_timer_type_s { + S1AP_TIMER_PERIODIC, + S1AP_TIMER_ONE_SHOT, + S1AP_TIMER_TYPE_MAX, +} s1ap_timer_type_t; + typedef struct s1ap_eNB_config_s { // MME related params unsigned char mme_enabled; ///< MME enabled ? @@ -43,6 +59,7 @@ void *s1ap_eNB_process_itti_msg(void*); void s1ap_eNB_init(void); void *s1ap_eNB_task(void *arg); +int s1ap_timer_remove(long timer_id); uint32_t s1ap_generate_eNB_id(void); #endif /* S1AP_ENB_H_ */ diff --git a/openair3/S1AP/s1ap_eNB_handlers.c b/openair3/S1AP/s1ap_eNB_handlers.c index 7c611b0fbf..9ee3287b94 100644 --- a/openair3/S1AP/s1ap_eNB_handlers.c +++ b/openair3/S1AP/s1ap_eNB_handlers.c @@ -52,7 +52,6 @@ #include "assertions.h" #include "conversions.h" #include "msc.h" -#include "s1ap_eNB_timer.h" static int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id, @@ -117,6 +116,16 @@ static int s1ap_eNB_snd_s1_setup_request( s1ap_eNB_instance_t *instance_p, s1ap_eNB_mme_data_t *s1ap_mme_data_p); +int s1ap_timer_setup( + uint32_t interval_sec, + uint32_t interval_us, + task_id_t task_id, + int32_t instance, + uint32_t timer_kind, + timer_type_t type, + void *timer_arg, + long *timer_id); + /* Handlers matrix. Only eNB related procedure present here */ s1ap_message_decoded_callback messages_callback[][3] = { { 0, 0, 0 }, /* HandoverPreparation */ diff --git a/openair3/S1AP/s1ap_eNB_timer.c b/openair3/S1AP/s1ap_eNB_timer.c deleted file mode 100644 index 3014f961a9..0000000000 --- a/openair3/S1AP/s1ap_eNB_timer.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "assertions.h" -#include "intertask_interface.h" -#include "s1ap_eNB_timer.h" -#include "common/utils/LOG/log.h" -#include "queue.h" -#include "s1ap_common.h" - - -int s1ap_timer_setup( - uint32_t interval_sec, - uint32_t interval_us, - task_id_t task_id, - int32_t instance, - uint32_t timer_kind, - timer_type_t type, - void *timer_arg, - long *timer_id) -{ - uint32_t *timeoutArg=NULL; - int ret=0; - timeoutArg=malloc(sizeof(uint32_t)); - *timeoutArg=timer_kind; - ret=timer_setup(interval_sec, - interval_us, - task_id, - instance, - type, - (void*)timeoutArg, - timer_id); - return ret; -} - -int s1ap_timer_remove(long timer_id) -{ - int ret; - ret=timer_remove(timer_id); - return ret; -} - diff --git a/openair3/S1AP/s1ap_eNB_timer.h b/openair3/S1AP/s1ap_eNB_timer.h deleted file mode 100644 index 7af80eb806..0000000000 --- a/openair3/S1AP/s1ap_eNB_timer.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -#ifndef TIMER_H_ -#define TIMER_H_ - -#include - -#define SIGTIMER SIGRTMIN - -typedef enum s1ap_timer_type_s { - S1AP_TIMER_PERIODIC, - S1AP_TIMER_ONE_SHOT, - S1AP_TIMER_TYPE_MAX, -} s1ap_timer_type_t; - -typedef struct { - void *arg; - long timer_id; - int32_t timer_kind; -} s1ap_timer_has_expired_t; - - -int s1ap_timer_timeout(sigval_t info); - -/** \brief Request a new timer - * \param interval_sec timer interval in seconds - * \param interval_us timer interval in micro seconds - * \param task_id task id of the task requesting the timer - * \param instance instance of the task requesting the timer - * \param type timer type - * \param timer_id unique timer identifier - * @returns -1 on failure, 0 otherwise - **/ -int s1ap_timer_setup( - uint32_t interval_sec, - uint32_t interval_us, - task_id_t task_id, - int32_t instance, - uint32_t timer_kind, - timer_type_t type, - void *timer_arg, - long *timer_id); - -/** \brief Remove the timer from list - * \param timer_id unique timer id - * @returns -1 on failure, 0 otherwise - **/ - -int s1ap_timer_remove(long timer_id); - -/** \brief Initialize timer task and its API - * \param mme_config MME common configuration - * @returns -1 on failure, 0 otherwise - **/ -int s1ap_timer_init(void); - -#define S1AP_MMEIND 0x80000000 -#define S1AP_UEIND 0x00000000 -#define S1_SETRSP_WAIT 0x00010000 -#define S1_SETREQ_WAIT 0x00020000 -#define SCTP_REQ_WAIT 0x00030000 -#define S1AP_LINEIND 0x0000ffff -#define S1AP_TIMERIND 0x00ff0000 - -#define S1AP_TIMERID_INIT 0xffffffffffffffff - -#endif