Commit 82b4fc3b authored by Navid Nikaein's avatar Navid Nikaein

x2ap setup messaging

parent c1ba760b
...@@ -403,13 +403,15 @@ include_directories ("${X2AP_DIR}") ...@@ -403,13 +403,15 @@ include_directories ("${X2AP_DIR}")
add_library(X2AP_ENB add_library(X2AP_ENB
${X2AP_C_DIR}/x2ap_ies_defs.h ${X2AP_C_DIR}/x2ap_ies_defs.h
${X2AP_DIR}/x2ap.c ${X2AP_DIR}/x2ap_eNB.c
${X2AP_DIR}/x2ap_eNB_decoder.c ${X2AP_DIR}/x2ap_eNB_decoder.c
${X2AP_DIR}/x2ap_eNB_encoder.c ${X2AP_DIR}/x2ap_eNB_encoder.c
${X2AP_DIR}/x2ap_eNB_handlers.c ${X2AP_DIR}/x2ap_eNB_handler.c
${X2AP_DIR}/x2ap_eNB_itti_messaging.c ${X2AP_DIR}/x2ap_eNB_itti_messaging.c
${X2AP_DIR}/x2ap_eNB_management_procedures.c ${X2AP_DIR}/x2ap_eNB_management_procedures.c
${X2AP_DIR}/x2ap_eNB_generate_messages.c
) )
# Hardware dependant options # Hardware dependant options
################################### ###################################
add_list1_option(NB_ANTENNAS_RX "2" "Number of antennas in reception" "1" "2" "4") add_list1_option(NB_ANTENNAS_RX "2" "Number of antennas in reception" "1" "2" "4")
...@@ -469,7 +471,7 @@ include_directories ("${OPENAIR_TARGETS}/ARCH/COMMON") ...@@ -469,7 +471,7 @@ include_directories ("${OPENAIR_TARGETS}/ARCH/COMMON")
############################################################## ##############################################################
add_boolean_option(ENABLE_SECURITY True "Enable LTE integrity and ciphering between RRC UE and eNB") add_boolean_option(ENABLE_SECURITY True "Enable LTE integrity and ciphering between RRC UE and eNB")
add_boolean_option(ENABLE_USE_MME True "eNB connected to MME (INTERFACE S1-C), not standalone eNB") add_boolean_option(ENABLE_USE_MME True "eNB connected to MME (INTERFACE S1-C), not standalone eNB")
add_boolean_option(ENABLE_USE_X2 True "eNB connected to eNB (INTERFACE X2)") add_boolean_option(ENABLE_USE_X2 False "eNB connected to eNB (INTERFACE X2)")
add_boolean_option(NO_RRM True "DO WE HAVE A RADIO RESSOURCE MANAGER: NO") add_boolean_option(NO_RRM True "DO WE HAVE A RADIO RESSOURCE MANAGER: NO")
add_boolean_option(USER_MODE True "????") add_boolean_option(USER_MODE True "????")
...@@ -1604,7 +1606,7 @@ add_executable(oaisim_nos1 ...@@ -1604,7 +1606,7 @@ add_executable(oaisim_nos1
target_include_directories(oaisim_nos1 PUBLIC ${OPENAIR_TARGETS}/SIMU/USER) target_include_directories(oaisim_nos1 PUBLIC ${OPENAIR_TARGETS}/SIMU/USER)
target_link_libraries (oaisim_nos1 target_link_libraries (oaisim_nos1
-Wl,--start-group -Wl,--start-group
RRC_LIB X2AP_LIB SECU_CN UTIL HASHTABLE SCHED_LIB PHY LFDS ${MSC_LIB} L2 ${RAL_LIB} SIMU SIMU_ETH SECU_OSA ${ITTI_LIB} ${MIH_LIB} RRC_LIB X2AP_LIB X2AP_ENB SECU_CN UTIL HASHTABLE SCHED_LIB PHY LFDS ${MSC_LIB} L2 ${RAL_LIB} SIMU SIMU_ETH SECU_OSA ${ITTI_LIB} ${MIH_LIB}
-Wl,--end-group ) -Wl,--end-group )
target_link_libraries (oaisim_nos1 ${LIBXML2_LIBRARIES} ${LAPACK_LIBRARIES}) target_link_libraries (oaisim_nos1 ${LIBXML2_LIBRARIES} ${LAPACK_LIBRARIES})
......
...@@ -111,6 +111,7 @@ typedef enum cn_domain_s { ...@@ -111,6 +111,7 @@ typedef enum cn_domain_s {
typedef struct net_ip_address_s { typedef struct net_ip_address_s {
unsigned ipv4:1; unsigned ipv4:1;
unsigned ipv6:1; unsigned ipv6:1;
unsigned active:1;
char ipv4_address[16]; char ipv4_address[16];
char ipv6_address[40]; char ipv6_address[40];
} net_ip_address_t; } net_ip_address_t;
......
...@@ -33,14 +33,18 @@ ...@@ -33,14 +33,18 @@
/* ENCODER */ /* ENCODER */
MESSAGE_DEF(X2AP_RESET_REQUST_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , x2ap_reset_request_log) MESSAGE_DEF(X2AP_RESET_REQUST_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , x2ap_reset_request_log)
MESSAGE_DEF(X2AP_RESOURCE_STATUS_RESPONSE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , x2ap_resource_status_response_log) MESSAGE_DEF(X2AP_RESOURCE_STATUS_RESPONSE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , x2ap_resource_status_response_log)
MESSAGE_DEF(X2AP_RESOURCE_STATUS_FAILUIRE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , x2ap_resource_status_failure_log) MESSAGE_DEF(X2AP_RESOURCE_STATUS_FAILURE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , x2ap_resource_status_failure_log)
/* DECODER */ /* Messages for X2AP logging */
MESSAGE_DEF(X2AP_SETUP_REQUEST_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , x2ap_setup_request_log) MESSAGE_DEF(X2AP_SETUP_REQUEST_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , x2ap_setup_request_log)
/* eNB application layer -> X2AP messages */ /* eNB application layer -> X2AP messages */
MESSAGE_DEF(X2AP_REGISTER_ENB_REQ , MESSAGE_PRIORITY_MED, x2ap_register_enb_req_t , x2ap_register_enb_req) MESSAGE_DEF(X2AP_REGISTER_ENB_REQ , MESSAGE_PRIORITY_MED, x2ap_register_enb_req_t , x2ap_register_enb_req)
/* X2AP -> eNB application layer messages */ /* X2AP -> eNB application layer messages */
MESSAGE_DEF(X2AP_REGISTER_ENB_CNF , MESSAGE_PRIORITY_MED, x2ap_register_enb_cnf_t , x2ap_register_enb_cnf) MESSAGE_DEF(X2AP_REGISTER_ENB_CNF , MESSAGE_PRIORITY_MED, x2ap_register_enb_cnf_t , x2ap_register_enb_cnf)
MESSAGE_DEF(X2AP_DEREGISTERED_ENB_IND , MESSAGE_PRIORITY_MED, x2ap_deregistered_enb_ind_t , x2ap_deregistered_enb_ind) MESSAGE_DEF(X2AP_DEREGISTERED_ENB_IND , MESSAGE_PRIORITY_MED, x2ap_deregistered_enb_ind_t , x2ap_deregistered_enb_ind)
...@@ -34,6 +34,8 @@ ...@@ -34,6 +34,8 @@
// Defines to access message fields. // Defines to access message fields.
#define X2AP_REGISTER_ENB_REQ(mSGpTR) (mSGpTR)->ittiMsg.x2ap_register_enb_req #define X2AP_REGISTER_ENB_REQ(mSGpTR) (mSGpTR)->ittiMsg.x2ap_register_enb_req
#define X2AP_REGISTER_ENB_CNF(mSGpTR) (mSGpTR)->ittiMsg.x2ap_register_enb_cnf
#define X2AP_DEREGISTERED_ENB_IND(mSGpTR) (mSGpTR)->ittiMsg.x2ap_deregistered_enb_ind
#define X2AP_MAX_NB_ENB_IP_ADDRESS 2 #define X2AP_MAX_NB_ENB_IP_ADDRESS 2
...@@ -91,4 +93,16 @@ typedef struct x2ap_register_enb_req_s { ...@@ -91,4 +93,16 @@ typedef struct x2ap_register_enb_req_s {
uint16_t sctp_out_streams; uint16_t sctp_out_streams;
} x2ap_register_enb_req_t; } x2ap_register_enb_req_t;
//-------------------------------------------------------------------------------------------//
// X2AP -> eNB application layer messages
typedef struct x2ap_register_enb_cnf_s {
/* Nb of connected eNBs*/
uint8_t nb_x2;
} x2ap_register_enb_cnf_t;
typedef struct x2ap_deregistered_enb_ind_s {
/* Nb of connected eNBs */
uint8_t nb_x2;
} x2ap_deregistered_enb_ind_t;
#endif /* X2AP_MESSAGES_TYPES_H_ */ #endif /* X2AP_MESSAGES_TYPES_H_ */
...@@ -71,6 +71,10 @@ extern unsigned char NB_eNB_INST; ...@@ -71,6 +71,10 @@ extern unsigned char NB_eNB_INST;
# define ENB_REGISTER_RETRY_DELAY 10 # define ENB_REGISTER_RETRY_DELAY 10
# endif # endif
# if defined(ENABLE_USE_X2)
# define X2AP_ENB_REGISTER_RETRY_DELAY 10
#endif
/*------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------*/
static void configure_phy(module_id_t enb_id, const Enb_properties_array_t* enb_properties) static void configure_phy(module_id_t enb_id, const Enb_properties_array_t* enb_properties)
{ {
...@@ -271,7 +275,8 @@ static uint32_t eNB_app_register_s1(uint32_t enb_id_start, uint32_t enb_id_end, ...@@ -271,7 +275,8 @@ static uint32_t eNB_app_register_s1(uint32_t enb_id_start, uint32_t enb_id_end,
/*------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------*/
# if defined(ENABLE_USE_X2) # if defined(ENABLE_USE_X2)
static uint32_t eNB_app_register_x2(uint32_t enb_id_start, uint32_t enb_id_end, const Enb_properties_array_t *enb_properties) static uint32_t eNB_app_register_x2(uint32_t enb_id_start, uint32_t enb_id_end,
const Enb_properties_array_t *enb_properties)
{ {
uint32_t enb_id; uint32_t enb_id;
uint32_t x2_id; uint32_t x2_id;
...@@ -307,7 +312,8 @@ static uint32_t eNB_app_register_x2(uint32_t enb_id_start, uint32_t enb_id_end, ...@@ -307,7 +312,8 @@ static uint32_t eNB_app_register_x2(uint32_t enb_id_start, uint32_t enb_id_end,
x2ap_register_eNB->nb_x2 = enb_properties->properties[enb_id]->nb_x2; x2ap_register_eNB->nb_x2 = enb_properties->properties[enb_id]->nb_x2;
AssertFatal (x2ap_register_eNB->nb_x2 <= X2AP_MAX_NB_ENB_IP_ADDRESS, "Too many X2 interfaces for eNB %d (%d/%d)!", AssertFatal (x2ap_register_eNB->nb_x2 <= X2AP_MAX_NB_ENB_IP_ADDRESS,
"Too many X2 interfaces for eNB %d (%d/%d)!",
enb_id, x2ap_register_eNB->nb_x2, enb_id, x2ap_register_eNB->nb_x2,
X2AP_MAX_NB_ENB_IP_ADDRESS); X2AP_MAX_NB_ENB_IP_ADDRESS);
...@@ -321,6 +327,9 @@ static uint32_t eNB_app_register_x2(uint32_t enb_id_start, uint32_t enb_id_end, ...@@ -321,6 +327,9 @@ static uint32_t eNB_app_register_x2(uint32_t enb_id_start, uint32_t enb_id_end,
strncpy (x2ap_register_eNB->target_enb_x2_ip_address[x2_id].ipv6_address, strncpy (x2ap_register_eNB->target_enb_x2_ip_address[x2_id].ipv6_address,
enb_properties->properties[enb_id]->target_enb_x2_ip_address[x2_id].ipv6_address, enb_properties->properties[enb_id]->target_enb_x2_ip_address[x2_id].ipv6_address,
sizeof(x2ap_register_eNB->target_enb_x2_ip_address[0].ipv6_address)); sizeof(x2ap_register_eNB->target_enb_x2_ip_address[0].ipv6_address));
// this is used to identify whether this eNb is acting as an initiator (client) or listener (server)
x2ap_register_eNB->target_enb_x2_ip_address[x2_id].active = enb_properties->properties[enb_id]->target_enb_x2_ip_address[x2_id].active;
} }
x2ap_register_eNB->sctp_in_streams = enb_properties->properties[enb_id]->sctp_in_streams; x2ap_register_eNB->sctp_in_streams = enb_properties->properties[enb_id]->sctp_in_streams;
...@@ -329,6 +338,7 @@ static uint32_t eNB_app_register_x2(uint32_t enb_id_start, uint32_t enb_id_end, ...@@ -329,6 +338,7 @@ static uint32_t eNB_app_register_x2(uint32_t enb_id_start, uint32_t enb_id_end,
x2ap_register_eNB->enb_x2_ip_address.ipv6 = 0; x2ap_register_eNB->enb_x2_ip_address.ipv6 = 0;
x2ap_register_eNB->enb_x2_ip_address.ipv4 = 1; x2ap_register_eNB->enb_x2_ip_address.ipv4 = 1;
addr.s_addr = enb_properties->properties[enb_id]->enb_ipv4_address_for_X2C; addr.s_addr = enb_properties->properties[enb_id]->enb_ipv4_address_for_X2C;
str = inet_ntoa(addr); str = inet_ntoa(addr);
strcpy(x2ap_register_eNB->enb_x2_ip_address.ipv4_address, str); strcpy(x2ap_register_eNB->enb_x2_ip_address.ipv4_address, str);
...@@ -359,9 +369,9 @@ void *eNB_app_task(void *args_p) ...@@ -359,9 +369,9 @@ void *eNB_app_task(void *args_p)
long enb_register_retry_timer_id; long enb_register_retry_timer_id;
# endif # endif
# if defined(ENABLE_USE_X2) # if defined(ENABLE_USE_X2)
uint32_t x2ap_register_enb_pending; uint32_t x2_register_enb_pending;
uint32_t x2ap_registered_enb; uint32_t x2_registered_enb;
long x2ap_enb_register_retry_timer_id; long x2_enb_register_retry_timer_id;
# endif # endif
uint32_t enb_id; uint32_t enb_id;
MessageDef *msg_p = NULL; MessageDef *msg_p = NULL;
...@@ -406,8 +416,8 @@ void *eNB_app_task(void *args_p) ...@@ -406,8 +416,8 @@ void *eNB_app_task(void *args_p)
# if defined(ENABLE_USE_X2) # if defined(ENABLE_USE_X2)
/* Try to register each eNB with each other */ /* Try to register each eNB with each other */
registered_enb_x2 = 0; x2_registered_enb = 0;
register_enb_x2_pending = eNB_app_register_x2 (enb_id_start, enb_id_end, enb_properties_p); x2_register_enb_pending = eNB_app_register_x2 (enb_id_start, enb_id_end, enb_properties_p);
# else # else
# endif # endif
...@@ -510,29 +520,41 @@ void *eNB_app_task(void *args_p) ...@@ -510,29 +520,41 @@ void *eNB_app_task(void *args_p)
/* TODO handle recovering of registration */ /* TODO handle recovering of registration */
break; break;
case S1AP_REGISTER_ENB_CNF: case X2AP_REGISTER_ENB_CNF:
LOG_I(ENB_APP, "[eNB %d] Received %s: associated eNB %d\n", instance, msg_name, LOG_I(ENB_APP, "[eNB %d] Received %s: associated eNB %d\n", instance, msg_name,
X2AP_REGISTER_ENB_CNF(msg_p).nb_x2); X2AP_REGISTER_ENB_CNF(msg_p).nb_x2);
DevAssert(register_enb_x2_pending > 0); DevAssert(x2_register_enb_pending > 0);
register_enb_x2_pending--; x2_register_enb_pending--;
/* Check if at least eNB is registered with one target eNB */ /* Check if at least eNB is registered with one target eNB */
if (X2AP_REGISTER_ENB_CNF(msg_p).nb_x2 > 0) { if (X2AP_REGISTER_ENB_CNF(msg_p).nb_x2 > 0) {
registered_enb_x2++; x2_registered_enb++;
} }
/* Check if all register eNB requests have been processed */ /* Check if all register eNB requests have been processed */
if (register_enb_x2_pending == 0) { if (x2_register_enb_pending == 0) {
if (registered_enb_x2 == enb_nb) { if (x2_registered_enb == enb_nb) {
/* If all eNB are registered, start L2L1 task */ /* If all eNB are registered, start RRC HO task */
}else { }else {
uint32_t not_associated_x2 = enb_nb - registered_enb; uint32_t x2_not_associated = enb_nb - x2_registered_enb;
LOG_W(ENB_APP, " %d eNB %s not associated with the target\n", LOG_W(ENB_APP, " %d eNB %s not associated with the target\n",
not_associated, not_associated > 1 ? "are" : "is"); x2_not_associated, x2_not_associated > 1 ? "are" : "is");
// timer to retry // timer to retry
/* Restart the eNB registration process in ENB_REGISTER_RETRY_DELAY seconds */
if (timer_setup (X2AP_ENB_REGISTER_RETRY_DELAY, 0, TASK_ENB_APP,
INSTANCE_DEFAULT, TIMER_ONE_SHOT, NULL,
&x2_enb_register_retry_timer_id) < 0) {
LOG_E(ENB_APP, " Can not start eNB X2AP register: retry timer, use \"sleep\" instead!\n");
sleep(X2AP_ENB_REGISTER_RETRY_DELAY);
/* Restart the registration process */
x2_registered_enb = 0;
x2_register_enb_pending = eNB_app_register_x2 (enb_id_start, enb_id_end, enb_properties_p);
}
} }
} }
......
...@@ -2191,7 +2191,9 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) ...@@ -2191,7 +2191,9 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
if (strcmp(active, "yes") == 0) { if (strcmp(active, "yes") == 0) {
enb_properties.properties[enb_properties_index]->target_enb_x2_ip_address[j].active = 1; enb_properties.properties[enb_properties_index]->target_enb_x2_ip_address[j].active = 1;
} // else { (calloc) } else {
enb_properties.properties[enb_properties_index]->target_enb_x2_ip_address[j].active = 0;
}
if (strcmp(preference, "ipv4") == 0) { if (strcmp(preference, "ipv4") == 0) {
enb_properties.properties[enb_properties_index]->target_enb_x2_ip_address[j].ipv4 = 1; enb_properties.properties[enb_properties_index]->target_enb_x2_ip_address[j].ipv4 = 1;
......
...@@ -27,8 +27,8 @@ ...@@ -27,8 +27,8 @@
*******************************************************************************/ *******************************************************************************/
/*! \file x2ap.c /*! \file x2ap_eNB.c
* \brief x2ap protocol * \brief x2ap protocol for eNB
* \author Navid Nikaein * \author Navid Nikaein
* \date 2014 - 2015 * \date 2014 - 2015
* \version 1.0 * \version 1.0
...@@ -44,14 +44,22 @@ ...@@ -44,14 +44,22 @@
#include "intertask_interface.h" #include "intertask_interface.h"
#include "x2ap.h" #include "assertions.h"
#include "queue.h"
#include "msc.h" #include "x2ap_eNB.h"
#include "x2ap_eNB_defs.h"
#include "x2ap_eNB_decoder.h"
#include "x2ap_eNB_handler.h"
#include "x2ap_ies_defs.h"
#include "x2ap_eNB_management_procedures.h"
#include "msc.h"
#include "assertions.h" #include "assertions.h"
#include "conversions.h" #include "conversions.h"
static static
void x2ap_eNB_handle_register_eNB(instance_t instance, void x2ap_eNB_handle_register_eNB(instance_t instance,
x2ap_register_enb_req_t *x2ap_register_eNB); x2ap_register_enb_req_t *x2ap_register_eNB);
...@@ -69,21 +77,22 @@ void x2ap_eNB_handle_sctp_association_resp(instance_t instance, ...@@ -69,21 +77,22 @@ void x2ap_eNB_handle_sctp_association_resp(instance_t instance,
static static
int x2ap_eNB_generate_x2_setup_request(x2ap_eNB_instance_t *instance_p, int x2ap_eNB_generate_x2_setup_request(x2ap_eNB_instance_t *instance_p,
x2ap_enb_data_t *x2ap_enb_data_p); x2ap_eNB_data_t *x2ap_enb_data_p);
static static
int x2ap_eNB_generate_x2_setup_response(x2ap_eNB_instance_t *instance_p, int x2ap_eNB_generate_x2_setup_response(x2ap_eNB_instance_t *instance_p,
x2ap_enb_data_t *x2ap_enb_data_p); x2ap_eNB_data_t *x2ap_enb_data_p);
static static
int x2ap_eNB_generate_x2_setup_failure(x2ap_eNB_instance_t *instance_p, int x2ap_eNB_generate_x2_setup_failure(x2ap_eNB_instance_t *instance_p,
x2ap_enb_data_t *x2ap_enb_data_p); x2ap_eNB_data_t *x2ap_enb_data_p);
static static
void x2ap_eNB_handle_sctp_data_ind(instance_t instance, sctp_data_ind_t *sctp_data_ind) { void x2ap_eNB_handle_sctp_data_ind(instance_t instance,
sctp_data_ind_t *sctp_data_ind) {
int result; int result;
...@@ -101,14 +110,14 @@ static ...@@ -101,14 +110,14 @@ static
void x2ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp) void x2ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp)
{ {
x2ap_eNB_instance_t *instance_p; x2ap_eNB_instance_t *instance_p;
x2ap_eNB_mme_data_t *x2ap_enb_data_p; x2ap_eNB_data_t *x2ap_enb_data_p;
DevAssert(sctp_new_association_resp != NULL); DevAssert(sctp_new_association_resp != NULL);
instance_p = x2ap_eNB_get_instance(instance); instance_p = x2ap_eNB_get_instance(instance);
DevAssert(instance_p != NULL); DevAssert(instance_p != NULL);
x2ap_enb_data_p = x2ap_eNB_get_eNB(instance_p, -1, x2ap_enb_data_p = x2ap_get_eNB(instance_p, -1,
sctp_new_association_resp->ulp_cnx_id); sctp_new_association_resp->ulp_cnx_id);
DevAssert(x2ap_enb_data_p != NULL); DevAssert(x2ap_enb_data_p != NULL);
...@@ -118,7 +127,8 @@ void x2ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa ...@@ -118,7 +127,8 @@ void x2ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa
instance, instance,
sctp_new_association_resp->ulp_cnx_id); sctp_new_association_resp->ulp_cnx_id);
x2ap_handle_x2_setup_message(x2ap_enb_data_p, sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN); x2ap_handle_x2_setup_message(x2ap_enb_data_p,
sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN);
return; return;
} }
...@@ -132,6 +142,38 @@ void x2ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa ...@@ -132,6 +142,38 @@ void x2ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa
x2ap_eNB_generate_x2_setup_request(instance_p, x2ap_enb_data_p); x2ap_eNB_generate_x2_setup_request(instance_p, x2ap_enb_data_p);
} }
int x2ap_eNB_init_sctp (x2ap_eNB_instance_t *instance_p,
net_ip_address_t *local_ip_addr)
{
// Create and alloc new message
MessageDef *message;
sctp_init_t *sctp_init = NULL;
DevAssert(instance_p != NULL);
DevAssert(local_ip_addr != NULL);
message = itti_alloc_new_message (TASK_X2AP, SCTP_INIT_MSG);
sctp_init = &message->ittiMsg.sctp_init;
sctp_init->port = X2AP_PORT_NUMBER;
sctp_init->ppid = X2AP_SCTP_PPID;
sctp_init->ipv4 = 1;
sctp_init->ipv6 = 0;
sctp_init->nb_ipv4_addr = 1;
memcpy(&sctp_init->ipv4_address,
local_ip_addr,
sizeof(*local_ip_addr));
/*
* SR WARNING: ipv6 multi-homing fails sometimes for localhost.
* * * * Disable it for now.
*/
sctp_init->nb_ipv6_addr = 0;
sctp_init->ipv6_address[0] = "0:0:0:0:0:0:0:1";
return itti_send_msg_to_task (TASK_SCTP, instance_p->instance, message);
}
static void x2ap_eNB_register_eNB(x2ap_eNB_instance_t *instance_p, static void x2ap_eNB_register_eNB(x2ap_eNB_instance_t *instance_p,
net_ip_address_t *target_eNB_ip_address, net_ip_address_t *target_eNB_ip_address,
...@@ -140,54 +182,55 @@ static void x2ap_eNB_register_eNB(x2ap_eNB_instance_t *instance_p, ...@@ -140,54 +182,55 @@ static void x2ap_eNB_register_eNB(x2ap_eNB_instance_t *instance_p,
uint16_t out_streams) uint16_t out_streams)
{ {
MessageDef *message_p = NULL; MessageDef *message = NULL;
sctp_new_association_req_t *sctp_new_association_req_p = NULL; sctp_new_association_req_t *sctp_new_association_req = NULL;
x2ap_eNB_data_t *x2ap_enb_data_p = NULL; x2ap_eNB_data_t *x2ap_enb_data = NULL;
DevAssert(instance_p != NULL); DevAssert(instance_p != NULL);
DevAssert(target_eNB_ip_address != NULL); DevAssert(target_eNB_ip_address != NULL);
message_p = itti_alloc_new_message(TASK_X2AP, SCTP_NEW_ASSOCIATION_REQ); message = itti_alloc_new_message(TASK_X2AP, SCTP_NEW_ASSOCIATION_REQ);
sctp_new_association_req_p = &message_p->ittiMsg.sctp_new_association_req; sctp_new_association_req = &message->ittiMsg.sctp_new_association_req;
sctp_new_association_req_p->port = X2AP_PORT_NUMBER; sctp_new_association_req->port = X2AP_PORT_NUMBER;
sctp_new_association_req_p->ppid = X2AP_SCTP_PPID; sctp_new_association_req->ppid = X2AP_SCTP_PPID;
sctp_new_association_req_p->in_streams = in_streams; sctp_new_association_req->in_streams = in_streams;
sctp_new_association_req_p->out_streams = out_streams; sctp_new_association_req->out_streams = out_streams;
memcpy(&sctp_new_association_req_p->remote_address, memcpy(&sctp_new_association_req->remote_address,
target_eNB_ip_address, target_eNB_ip_address,
sizeof(*target_eNB_ip_address)); sizeof(*target_eNB_ip_address));
memcpy(&sctp_new_association_req_p->local_address, memcpy(&sctp_new_association_req->local_address,
local_ip_addr, local_ip_addr,
sizeof(*local_ip_addr)); sizeof(*local_ip_addr));
/* Create new MME descriptor */ /* Create new eNB descriptor */
x2ap_enb_data_p = calloc(1, sizeof(*x2ap_enb_data_p)); x2ap_enb_data = calloc(1, sizeof(*x2ap_enb_data));
DevAssert(x2ap_enb_data_p != NULL); DevAssert(x2ap_enb_data != NULL);
x2ap_enb_data_p->cnx_id = x2ap_eNB_fetch_add_global_cnx_id(); x2ap_enb_data->cnx_id = x2ap_eNB_fetch_add_global_cnx_id();
sctp_new_association_req_p->ulp_cnx_id = x2ap_enb_data_p->cnx_id; sctp_new_association_req->ulp_cnx_id = x2ap_enb_data->cnx_id;
x2ap_enb_data_p->assoc_id = -1; x2ap_enb_data->assoc_id = -1;
x2ap_enb_data_p->x2ap_eNB_instance = instance_p; x2ap_enb_data->x2ap_eNB_instance = instance_p;
/* Insert the new descriptor in list of known eNB /* Insert the new descriptor in list of known eNB
* but not yet associated. * but not yet associated.
*/ */
RB_INSERT(x2ap_enb_map, &instance_p->x2ap_enb_head, x2ap_enb_data_p); RB_INSERT(x2ap_enb_map, &instance_p->x2ap_enb_head, x2ap_enb_data);
s1ap_mme_data_p->state = X2AP_ENB_STATE_WAITING; x2ap_enb_data->state = X2AP_ENB_STATE_WAITING;
instance_p->x2ap_enb_nb ++; instance_p->x2_target_enb_nb ++;
instance_p->x2ap_enb_pending_nb ++; instance_p->x2_target_enb_pending_nb ++;
itti_send_msg_to_task(TASK_SCTP, instance_p->instance, message_p); itti_send_msg_to_task(TASK_SCTP, instance_p->instance, message);
} }
static static
void x2ap_eNB_handle_register_eNB(instance_t instance, x2ap_register_enb_req_t *x2ap_register_eNB) void x2ap_eNB_handle_register_eNB(instance_t instance,
x2ap_register_enb_req_t *x2ap_register_eNB)
{ {
x2ap_eNB_instance_t *new_instance; x2ap_eNB_instance_t *new_instance;
...@@ -233,17 +276,33 @@ void x2ap_eNB_handle_register_eNB(instance_t instance, x2ap_register_enb_req_t * ...@@ -233,17 +276,33 @@ void x2ap_eNB_handle_register_eNB(instance_t instance, x2ap_register_enb_req_t *
x2ap_register_eNB->eNB_id); x2ap_register_eNB->eNB_id);
} }
DevCheck(x2ap_register_eNB->nb_mme <= X2AP_MAX_NB_ENB_IP_ADDRESS, DevCheck(x2ap_register_eNB->nb_x2 <= X2AP_MAX_NB_ENB_IP_ADDRESS,
X2AP_MAX_NB_ENB_IP_ADDRESS, x2ap_register_eNB->nb_x2, 0); X2AP_MAX_NB_ENB_IP_ADDRESS, x2ap_register_eNB->nb_x2, 0);
/* Trying to connect to the provided list of eNB ip address */ /* Trying to connect to the provided list of eNB ip address */
for (index = 0; index < x2ap_register_eNB->nb_x2; index++) { for (index = 0; index < x2ap_register_eNB->nb_x2; index++) {
if (x2ap_register_eNB->target_enb_x2_ip_address[index].active == 1 ){
X2AP_INFO("eNB[%d] eNB id %u acting as an initiator\n",
instance, x2ap_register_eNB->eNB_id);
x2ap_eNB_register_eNB(new_instance, x2ap_eNB_register_eNB(new_instance,
&x2ap_register_eNB->target_enb_x2_ip_address[index], &x2ap_register_eNB->target_enb_x2_ip_address[index],
&x2ap_register_eNB->enb_x2_ip_address, &x2ap_register_eNB->enb_x2_ip_address,
x2ap_register_eNB->sctp_in_streams, x2ap_register_eNB->sctp_in_streams,
x2ap_register_eNB->sctp_out_streams); x2ap_register_eNB->sctp_out_streams);
} }
else {
/* initiate the SCTP listener */
if (x2ap_eNB_init_sctp(new_instance,&x2ap_register_eNB->enb_x2_ip_address) < 0 ) {
X2AP_ERROR ("Error while sending SCTP_INIT_MSG to SCTP \n");
return -1;
}
X2AP_INFO("eNB[%d] eNB id %u acting as a listner\n",
instance, x2ap_register_eNB->eNB_id);
}
}
} }
......
...@@ -35,8 +35,8 @@ ...@@ -35,8 +35,8 @@
* @{ * @{
*/ */
#ifndef X2AP_H_ #ifndef X2AP_ENB_H_
#define X2AP_H_ #define X2AP_ENB_H_
#define X2AP_PORT_NUMBER (36422) ///< X2AP SCTP IANA ASSIGNED Port Number #define X2AP_PORT_NUMBER (36422) ///< X2AP SCTP IANA ASSIGNED Port Number
#define X2AP_SCTP_PPID (27) ///< X2AP SCTP Payload Protocol Identifier (PPID) #define X2AP_SCTP_PPID (27) ///< X2AP SCTP Payload Protocol Identifier (PPID)
......
...@@ -38,14 +38,20 @@ ...@@ -38,14 +38,20 @@
#include <stdlib.h> #include <stdlib.h>
#include <pthread.h> #include <pthread.h>
#include <assert.h> #include <assert.h>
#include "x2ap_eNB_decoder.h"
#include "x2ap_common.h" #include "x2ap_common.h"
#include "x2ap_ies_defs.h" #include "x2ap_ies_defs.h"
#include "x2ap_pdu_decoder.h"
#include "X2ap-ProcedureCode.h"
#include "intertask_interface.h"
#include "assertions.h"
static inline int x2ap_decode_initiating(x2ap_message *x2ap_message_p, InitiatingMessage_t *initiating_p); int x2ap_decode_initiating(x2ap_message *x2ap_message_p, X2ap_InitiatingMessage_t *initiating_p);
static inline int x2ap_decode_successful(x2ap_message *x2ap_message_p, SuccessfulOutcome_t *successful_p); int x2ap_decode_successful(x2ap_message *x2ap_message_p, X2ap_SuccessfulOutcome_t *successful_p);
static inline int x2ap_decode_unsuccessful(x2ap_message *x2ap_message_p, UnsuccessfulOutcome_t *unsuccessful_p); int x2ap_decode_unsuccessful(x2ap_message *x2ap_message_p, X2ap_UnsuccessfulOutcome_t *unsuccessful_p);
int x2ap_eNB_decode_pdu(x2ap_message *x2ap_message_p, uint8_t *buffer, uint32_t len) { int x2ap_eNB_decode_pdu(x2ap_message *x2ap_message_p, uint8_t *buffer, uint32_t len) {
X2AP_PDU_t pdu; X2AP_PDU_t pdu;
...@@ -89,10 +95,11 @@ int x2ap_eNB_decode_pdu(x2ap_message *x2ap_message_p, uint8_t *buffer, uint32_t ...@@ -89,10 +95,11 @@ int x2ap_eNB_decode_pdu(x2ap_message *x2ap_message_p, uint8_t *buffer, uint32_t
} }
static int x2ap_eNB_decode_initiating(x2ap_message *x2ap_message_p, InitiatingMessage_t *initiating_p) { int
x2ap_eNB_decode_initiating(x2ap_message *x2ap_message_p, X2ap_InitiatingMessage_t *initiating_p) {
int ret = -1; int ret = -1;
MessageDef *message_p; MessageDef *message;
char *message_string = NULL; char *message_string = NULL;
size_t message_string_size; size_t message_string_size;
MessagesIds message_id; MessagesIds message_id;
...@@ -108,61 +115,61 @@ static int x2ap_eNB_decode_initiating(x2ap_message *x2ap_message_p, InitiatingMe ...@@ -108,61 +115,61 @@ static int x2ap_eNB_decode_initiating(x2ap_message *x2ap_message_p, InitiatingMe
x2ap_message_p->criticality = initiating_p->criticality; x2ap_message_p->criticality = initiating_p->criticality;
switch(x2ap_message_p->procedureCode) { switch(x2ap_message_p->procedureCode) {
case ProcedureCode_id_x2Setup: case X2ap_ProcedureCode_id_x2Setup :
ret = x2ap_decode_x2setuprequest_ies(&x2ap_message_p->msg.x2SetupRequest_IEs, &initiating_p->value); ret = x2ap_decode_x2setuprequest_ies(&x2ap_message_p->msg.x2SetupRequest_IEs, &initiating_p->value);
x2ap_xer_print_x2setuprequest_(x2ap_xer__print2sp,message_string,message); x2ap_xer_print_x2setuprequest_(x2ap_xer__print2sp,message_string,message);
message_id = X2AP_SETUP_REQUEST_LOG; message_id = X2AP_SETUP_REQUEST_LOG;
message_string_size = strlen(message_string); message_string_size = strlen(message_string);
message_p = itti_alloc_new_message_sized(TASK_S1AP, message = itti_alloc_new_message_sized(TASK_S1AP,
message_id, message_id,
message_string_size + sizeof (IttiMsgText)); message_string_size + sizeof (IttiMsgText));
message_p->ittiMsg.x2ap_setup_request_log.size = message_string_size; message->ittiMsg.x2ap_setup_request_log.size = message_string_size;
memcpy(&message_p->ittiMsg.x2ap_setup_request_log.text, message_string, message_string_size); memcpy(&message->ittiMsg.x2ap_setup_request_log.text, message_string, message_string_size);
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message);
free(message_string); free(message_string);
break; break;
case ProcedureCode_id_reset: case X2ap_ProcedureCode_id_reset:
ret = x2ap_decode_resetrequest_ies(&x2ap_message_p->msg.resetRequest_IEs, &initiating_p->value); ret = x2ap_decode_x2ap_resetrequest_ies(&x2ap_message_p->msg.x2ap_ResetRequest_IEs, &initiating_p->value);
break; break;
case ProcedureCode_id_resourceStatusReportingInitiation: case X2ap_ProcedureCode_id_resourceStatusReportingInitiation:
ret = x2ap_decode_resourcestatusrequest_ies(&x2ap_message_p->msg.resourceStatusRequest_IEs, &initiating_p->value); ret = x2ap_decode_x2ap_resourcestatusrequest_ies(&x2ap_message_p->msg.x2ap_ResourceStatusRequest_IEs, &initiating_p->value);
break; break;
case ProcedureCode_id_resourceStatusReporting: case X2ap_ProcedureCode_id_resourceStatusReporting:
ret = x2ap_decode_resourcestatusupdate_ies(&x2ap_message_p->msg.resourceStatusUpdate_IEs, &initiating_p->value); ret = x2ap_decode_x2ap_resourcestatusupdate_ies(&x2ap_message_p->msg.x2ap_ResourceStatusUpdate_IEs, &initiating_p->value);
break; break;
case ProcedureCode_id_loadIndication: case X2ap_ProcedureCode_id_loadIndication:
ret = x2ap_decode_loadinformation_ies(&x2ap_message_p->msg.loadInformation_IEs, &initiating_p->value); ret = x2ap_decode_x2ap_loadinformation_ies(&x2ap_message_p->msg.x2ap_LoadInformation_IEs, &initiating_p->value);
break; break;
case ProcedureCode_id_mobilitySettingsChange: case X2ap_ProcedureCode_id_mobilitySettingsChange:
ret = x2ap_decode_mobilitychangerequest_ies(&x2ap_message_p->msg.mobilityChangeRequest_IEs, &initiating_p->value); ret = x2ap_decode_x2ap_mobilitychangerequest_ies(&x2ap_message_p->msg.x2ap_MobilityChangeRequest_IEs, &initiating_p->value);
break; break;
case ProcedureCode_id_eNBConfigurationUpdate: case X2ap_ProcedureCode_id_eNBConfigurationUpdate:
ret = x2ap_decode_enbconfigurationupdate_ies(&x2ap_message_p->msg.enbConfigurationUpdate_IEs, &initiating_p->value); ret = x2ap_decode_x2ap_enbconfigurationupdate_ies(&x2ap_message_p->msg.x2ap_ENBConfigurationUpdate_IEs, &initiating_p->value);
break; break;
case ProcedureCode_id_errorIndication: case X2ap_ProcedureCode_id_errorIndication:
ret = x2ap_decode_errorindication_ies(&x2ap_message_p->msg.errorIndication_IEs, &initiating_p->value); ret = x2ap_decode_x2ap_errorindication_ies(&x2ap_message_p->msg.x2ap_ErrorIndication_IEs, &initiating_p->value);
break; break;
case ProcedureCode_id_handoverCancel: case X2ap_ProcedureCode_id_handoverCancel:
ret = x2ap_decode_handovercancel_ies(&x2ap_message_p->msg.handoverCancel_IEs, &initiating_p->value); ret = x2ap_decode_x2ap_handovercancel_ies(&x2ap_message_p->msg.x2ap_HandoverCancel_IEs, &initiating_p->value);
break; break;
case ProcedureCode_id_handoverPreparation: case X2ap_ProcedureCode_id_handoverPreparation:
ret = x2ap_decode_handoverrequest_ies(&x2ap_message_p->msg.handoverRequest_IEs, &initiating_p->value); ret = x2ap_decode_x2ap_handoverrequest_ies(&x2ap_message_p->msg.x2ap_HandoverRequest_IEs, &initiating_p->value);
break; break;
case ProcedureCode_id_uEContextRelease: case X2ap_ProcedureCode_id_uEContextRelease:
ret = x2ap_decode_uecontextrelease_ies(&x2ap_message_p->msg.ueContextRelease_IEs, &initiating_p->value); ret = x2ap_decode_x2ap_uecontextrelease_ies(&x2ap_message_p->msg.x2ap_UEContextRelease_IEs, &initiating_p->value);
break; break;
case ProcedureCode_id_snStatusTransfer: case X2ap_ProcedureCode_id_snStatusTransfer:
ret = x2ap_decode_snstatustransfer_ies(&x2ap_message_p->msg.snStatusTransfer_IEs, &initiating_p->value); ret = x2ap_decode_x2ap_snstatustransfer_ies(&x2ap_message_p->msg.x2ap_SNStatusTransfer_IEs, &initiating_p->value);
break; break;
case ProcedureCode_id_rLFIndication: case X2ap_ProcedureCode_id_rLFIndication:
ret = x2ap_decode_rlfindication_ies(&x2ap_message_p->msg.rlfIndication_IEs, &initiating_p->value); ret = x2ap_decode_x2ap_rlfindication_ies(&x2ap_message_p->msg.x2ap_RLFIndication_IEs, &initiating_p->value);
break; break;
case ProcedureCode_id_cellActivation: case X2ap_ProcedureCode_id_cellActivation:
ret = x2ap_decode_cellactivationrequest_ies(&x2ap_message_p->msg.cellActivationRequest_IEs, &initiating_p->value); ret = x2ap_decode_x2ap_cellactivationrequest_ies(&x2ap_message_p->msg.x2ap_CellActivationRequest_IEs, &initiating_p->value);
break; break;
case ProcedureCode_id_handoverReport: case X2ap_ProcedureCode_id_handoverReport:
ret = x2ap_decode_handoverreport_ies(&x2ap_message_p->msg.handoverReport_IEs, &initiating_p->value); ret = x2ap_decode_x2ap_handoverreport_ies(&x2ap_message_p->msg.x2ap_HandoverReport_IEs, &initiating_p->value);
break; break;
default: default:
X2AP_DEBUG("Unknown procedure (%d) or not implemented", (int)x2ap_message_p->procedureCode); X2AP_DEBUG("Unknown procedure (%d) or not implemented", (int)x2ap_message_p->procedureCode);
...@@ -171,7 +178,8 @@ static int x2ap_eNB_decode_initiating(x2ap_message *x2ap_message_p, InitiatingMe ...@@ -171,7 +178,8 @@ static int x2ap_eNB_decode_initiating(x2ap_message *x2ap_message_p, InitiatingMe
return ret; return ret;
} }
static int x2ap_eNB_decode_successful(x2ap_message *x2ap_message_p, SuccessfulOutcome_t *successful_p) { int
x2ap_eNB_decode_successful(x2ap_message *x2ap_message_p, X2ap_SuccessfulOutcome_t *successful_p) {
int ret = -1; int ret = -1;
MessageDef *message_p; MessageDef *message_p;
...@@ -190,26 +198,26 @@ static int x2ap_eNB_decode_successful(x2ap_message *x2ap_message_p, SuccessfulOu ...@@ -190,26 +198,26 @@ static int x2ap_eNB_decode_successful(x2ap_message *x2ap_message_p, SuccessfulOu
x2ap_message_p->criticality = successful_p->criticality; x2ap_message_p->criticality = successful_p->criticality;
switch(x2ap_message_p->procedureCode) { switch(x2ap_message_p->procedureCode) {
case ProcedureCode_id_x2Setup: case X2ap_ProcedureCode_id_x2Setup:
ret = x2ap_decode_x2setupresponse_ies(&x2ap_message_p->msg.x2SetupResponse_IEs, &successful_p->value); ret = x2ap_decode_x2setupresponse_ies(&x2ap_message_p->msg.x2SetupResponse_IEs, &successful_p->value);
case ProcedureCode_id_reset: case X2ap_ProcedureCode_id_reset:
ret = x2ap_decode_resetresponse_ies(&x2ap_message_p->msg.resetResponse_IEs, &successful_p->value); ret = x2ap_decode_x2ap_resetresponse_ies(&x2ap_message_p->msg.x2ap_ResetResponse_IEs, &successful_p->value);
case ProcedureCode_id_resourceStatusReportingInitiation: case X2ap_ProcedureCode_id_resourceStatusReportingInitiation:
ret = x2ap_decode_resourcestatusresponse_ies(&x2ap_message_p->msg.resourceStatusResponse_IEs, &successful_p->value); ret = x2ap_decode_x2ap_resourcestatusresponse_ies(&x2ap_message_p->msg.x2ap_ResourceStatusResponse_IEs, &successful_p->value);
case ProcedureCode_id_mobilitySettingsChange: case X2ap_ProcedureCode_id_mobilitySettingsChange:
ret = x2ap_decode_mobilitychangeacknowledge_ies(&x2ap_message_p->msg.mobilityChangeAcknowledge_IEs, &successful_p->value); ret = x2ap_decode_x2ap_mobilitychangeacknowledge_ies(&x2ap_message_p->msg.x2ap_MobilityChangeAcknowledge_IEs, &successful_p->value);
case ProcedureCode_id_eNBConfigurationUpdate: case X2ap_ProcedureCode_id_eNBConfigurationUpdate:
ret = x2ap_decode_enbconfigurationupdateacknowledge_ies(&x2ap_message_p->msg.enbConfigurationUpdateAcknowledge_IEs, &successful_p->value); ret = x2ap_decode_x2ap_enbconfigurationupdateacknowledge_ies(&x2ap_message_p->msg.x2ap_ENBConfigurationUpdateAcknowledge_IEs, &successful_p->value);
case ProcedureCode_id_handoverPreparation: case X2ap_ProcedureCode_id_handoverPreparation:
ret = x2ap_decode_handoverrequestacknowledge_ies(&x2ap_message_p->msg.handoverRequestAcknowledge_IEs, &successful_p->value); ret = x2ap_decode_x2ap_handoverrequestacknowledge_ies(&x2ap_message_p->msg.x2ap_HandoverRequestAcknowledge_IEs, &successful_p->value);
case ProcedureCode_id_cellActivation: case X2ap_ProcedureCode_id_cellActivation:
ret = x2ap_decode_cellactivationresponse_ies(&x2ap_message_p->msg.cellActivationResponse_IEs, &successful_p->value); ret = x2ap_decode_x2ap_cellactivationresponse_ies(&x2ap_message_p->msg.x2ap_CellActivationResponse_IEs, &successful_p->value);
default: default:
X2AP_DEBUG("Unknown procedure (%d) or not implemented", (int)x2ap_message_p->procedureCode); X2AP_DEBUG("Unknown procedure (%d) or not implemented", (int)x2ap_message_p->procedureCode);
...@@ -217,10 +225,12 @@ static int x2ap_eNB_decode_successful(x2ap_message *x2ap_message_p, SuccessfulOu ...@@ -217,10 +225,12 @@ static int x2ap_eNB_decode_successful(x2ap_message *x2ap_message_p, SuccessfulOu
} }
return ret; return ret;
} }
static int x2ap_decode_unsuccessful(x2ap_message *message_p, UnsuccessfulOutcome_t *unsuccessful_p) {
int
x2ap_decode_unsuccessful(x2ap_message *x2ap_message_p, X2ap_UnsuccessfulOutcome_t *unsuccessful_p) {
int ret = -1; int ret = -1;
MessageDef *message_p; MessageDef *message;
char *message_string = NULL; char *message_string = NULL;
size_t message_string_size; size_t message_string_size;
MessagesIds message_id; MessagesIds message_id;
...@@ -236,23 +246,23 @@ static int x2ap_decode_unsuccessful(x2ap_message *message_p, UnsuccessfulOutcome ...@@ -236,23 +246,23 @@ static int x2ap_decode_unsuccessful(x2ap_message *message_p, UnsuccessfulOutcome
x2ap_message_p->criticality = unsuccessful_p->criticality; x2ap_message_p->criticality = unsuccessful_p->criticality;
switch(x2ap_message_p->procedureCode) { switch(x2ap_message_p->procedureCode) {
case ProcedureCode_id_x2Setup: case X2ap_ProcedureCode_id_x2Setup:
ret = x2ap_decode_x2setupfailure_ies(&x2ap_message_p->msg.x2SetupFailure_IEs, &unsuccessful_p->value); ret = x2ap_decode_x2setupfailure_ies(&x2ap_message_p->msg.x2SetupFailure_IEs, &unsuccessful_p->value);
case ProcedureCode_id_resourceStatusReportingInitiation: case X2ap_ProcedureCode_id_resourceStatusReportingInitiation:
ret = x2ap_decode_resourcestatusfailure_ies(&x2ap_message_p->msg.resourceStatusFailure_IEs, &unsuccessful_p->value); ret = x2ap_decode_x2ap_resourcestatusfailure_ies(&x2ap_message_p->msg.x2ap_ResourceStatusFailure_IEs, &unsuccessful_p->value);
case ProcedureCode_id_mobilitySettingsChange: case X2ap_ProcedureCode_id_mobilitySettingsChange:
ret = x2ap_decode_mobilitychangefailure_ies(&x2ap_message_p->msg.mobilityChangeFailure_IEs, &unsuccessful_p->value); ret = x2ap_decode_x2ap_mobilitychangefailure_ies(&x2ap_message_p->msg.x2ap_MobilityChangeFailure_IEs, &unsuccessful_p->value);
case ProcedureCode_id_eNBConfigurationUpdate: case X2ap_ProcedureCode_id_eNBConfigurationUpdate:
ret = x2ap_decode_enbconfigurationupdatefailure_ies(&x2ap_message_p->msg.enbConfigurationUpdateFailure_IEs, &unsuccessful_p->value); ret = x2ap_decode_x2ap_enbconfigurationupdatefailure_ies(&x2ap_message_p->msg.x2ap_ENBConfigurationUpdateFailure_IEs, &unsuccessful_p->value);
case ProcedureCode_id_handoverPreparation: case X2ap_ProcedureCode_id_handoverPreparation:
ret = x2ap_decode_handoverpreparationfailure_ies(&x2ap_message_p->msg.handoverPreparationFailure_IEs, &unsuccessful_p->value); ret = x2ap_decode_x2ap_handoverpreparationfailure_ies(&x2ap_message_p->msg.x2ap_HandoverPreparationFailure_IEs, &unsuccessful_p->value);
case ProcedureCode_id_cellActivation: case X2ap_ProcedureCode_id_cellActivation:
ret = x2ap_decode_cellactivationfailure_ies(&x2ap_message_p->msg.cellActivationFailure_IEs, &unsuccessful_p->value); ret = x2ap_decode_x2ap_cellactivationfailure_ies(&x2ap_message_p->msg.x2ap_CellActivationFailure_IEs, &unsuccessful_p->value);
default: default:
X2AP_DEBUG("Unknown procedure (%d) or not implemented", (int)x2ap_message_p->procedureCode); X2AP_DEBUG("Unknown procedure (%d) or not implemented", (int)x2ap_message_p->procedureCode);
break; break;
......
...@@ -37,9 +37,9 @@ ...@@ -37,9 +37,9 @@
#include "x2ap_common.h" #include "x2ap_common.h"
#include "x2ap_ies_defs.h" #include "x2ap_ies_defs.h"
#ifndef X2AP_ENB_PDU_DECODER_H_ #ifndef X2AP_ENB_DECODER_H_
#define X2AP_ENB_PDU_DECODER_H_ #define X2AP_ENB_DECODER_H_
int x2ap_eNB_decode_pdu(x2ap_message *x2ap_message, uint8_t *buffer, uint32_t len); int x2ap_eNB_decode_pdu(x2ap_message *x2ap_message, uint8_t *buffer, uint32_t len);
#endif /* X2AP_PDU_DECODER_H_ */ #endif /* X2AP_ENB_DECODER_H_ */
...@@ -54,10 +54,15 @@ typedef enum { ...@@ -54,10 +54,15 @@ typedef enum {
/* /*
*/ */
X2AP_ENB_OVERLOAD = 0x3, X2AP_ENB_STATE_OVERLOAD = 0x3,
X2AP_ENB_STATE_RESETTING = 0x4,
X2AP_ENB_STATE_READY = 0x5,
/* Max number of states available */ /* Max number of states available */
X2AP_ENB_STATE_MAX, X2AP_ENB_STATE_MAX,
} s1ap_eNB_state_t; } x2ap_eNB_state_t;
/* Served PLMN identity element */ /* Served PLMN identity element */
...@@ -90,6 +95,9 @@ typedef struct x2ap_eNB_data_s { ...@@ -90,6 +95,9 @@ typedef struct x2ap_eNB_data_s {
/* This is the optional name provided by the MME */ /* This is the optional name provided by the MME */
char *eNB_name; char *eNB_name;
/* target eNB ID */
uint32_t eNB_id;
/* Current eNB load information (if any). */ /* Current eNB load information (if any). */
//x2ap_load_state_t overload_state; //x2ap_load_state_t overload_state;
...@@ -103,7 +111,7 @@ typedef struct x2ap_eNB_data_s { ...@@ -103,7 +111,7 @@ typedef struct x2ap_eNB_data_s {
uint16_t in_streams; uint16_t in_streams;
uint16_t out_streams; uint16_t out_streams;
/* Connexion id used between SCTP/S1AP */ /* Connexion id used between SCTP/X2AP */
uint16_t cnx_id; uint16_t cnx_id;
/* SCTP association id */ /* SCTP association id */
...@@ -114,17 +122,15 @@ typedef struct x2ap_eNB_data_s { ...@@ -114,17 +122,15 @@ typedef struct x2ap_eNB_data_s {
} x2ap_eNB_data_t; } x2ap_eNB_data_t;
typedef struct x2ap_eNB_instance_s { typedef struct x2ap_eNB_instance_s {
/* Next s1ap eNB association.
* Only used for virtual mode.
*/
STAILQ_ENTRY(x2ap_eNB_instance_s) x2ap_eNB_entries; STAILQ_ENTRY(x2ap_eNB_instance_s) x2ap_eNB_entries;
/* Number of target eNBs requested by eNB (tree size) */ /* Number of target eNBs requested by eNB (tree size) */
uint32_t x2ap_enb_nb; uint32_t x2_target_enb_nb;
/* Number of target eNBs for which association is pending */ /* Number of target eNBs for which association is pending */
uint32_t x2ap_target_enb_pending_nb; uint32_t x2_target_enb_pending_nb;
/* Number of target eNB successfully associated to eNB */ /* Number of target eNB successfully associated to eNB */
uint32_t x2ap_target_enb_associated_nb; uint32_t x2_target_enb_associated_nb;
/* Tree of X2AP eNB associations ordered by association ID */ /* Tree of X2AP eNB associations ordered by association ID */
RB_HEAD(x2ap_enb_map, x2ap_eNB_data_s) x2ap_enb_head; RB_HEAD(x2ap_enb_map, x2ap_eNB_data_s) x2ap_enb_head;
...@@ -166,15 +172,15 @@ typedef struct { ...@@ -166,15 +172,15 @@ typedef struct {
/* Nb of registered eNBs */ /* Nb of registered eNBs */
uint8_t nb_registered_eNBs; uint8_t nb_registered_eNBs;
/* Generate a unique connexion id used between S1AP and SCTP */ /* Generate a unique connexion id used between X2AP and SCTP */
uint16_t global_cnx_id; uint16_t global_cnx_id;
} x2ap_eNB_internal_data_t; } x2ap_eNB_internal_data_t;
int x2ap_eNB_compare_assoc_id( int x2ap_eNB_compare_assoc_id(struct x2ap_eNB_data_s *p1, struct x2ap_eNB_data_s *p2);
struct x2ap_eNB_data_s *p1, struct x2ap_eNB_data_s *p2);
/* Generate the tree management functions */ /* Generate the tree management functions */
RB_PROTOTYPE(x2ap_eNB_map, x2ap_eNB_data_s, entry, RB_PROTOTYPE(x2ap_eNB_map, x2ap_eNB_data_s, 0entry,
x2ap_eNB_compare_assoc_id); x2ap_eNB_compare_assoc_id);
#endif /* S1AP_ENB_DEFS_H_ */
#endif /* X2AP_ENB_DEFS_H_ */
...@@ -39,16 +39,49 @@ ...@@ -39,16 +39,49 @@
#include <stdint.h> #include <stdint.h>
#include "conversions.h" #include "conversions.h"
#include "x2ap_common.h"
#include "x2ap_ies_defs.h"
#include "intertask_interface.h" #include "intertask_interface.h"
#include "x2ap_common.h"
#include "x2ap_ies_defs.h"
#include "x2ap_eNB_encoder.h" #include "x2ap_eNB_encoder.h"
static inline int x2ap_encode_initiating(x2ap_message *x2ap_message_p, uint8_t **buf, uint32_t *length); #include "assertions.h"
static inline int x2ap_encode_successful(x2ap_message *x2ap_message_p, uint8_t **buf, uint32_t *length);
static inline int x2ap_encode_unsuccessful(x2ap_message *x2ap_message_p, uint8_t **buf, uint32_t *length); int x2ap_encode_initiating(x2ap_message *x2ap_message_p, uint8_t **buf, uint32_t *length);
int x2ap_encode_successful(x2ap_message *x2ap_message_p, uint8_t **buf, uint32_t *length);
int x2ap_encode_unsuccessful(x2ap_message *x2ap_message_p, uint8_t **buf, uint32_t *length);
static inline int x2ap_reset_request_encoder(X2ap_ResetRequest_IEs_t *resetRequest_IEs, uint8_t **buf, uint32_t *length);
static inline int x2_setup_response_encoder(X2SetupResponse_IEs_t *x2SetupResponse_IEs, uint8_t **buf, uint32_t *length);
static inline int x2_setup_failure_encoder(X2SetupFailure_IEs_t *x2SetupFailure_IEs, uint8_t **buf, uint32_t *length);
static inline int x2_setup_request_encoder(X2SetupRequest_IEs_t *x2SetupRequest_IEs, uint8_t **buf, uint32_t *length);
static inline int x2ap_reset_response_encoder(X2ap_ResetResponse_IEs_t *resetResponse_IEs, uint8_t **buf, uint32_t *length);
static inline int x2ap_mobility_change_failure_encoder(X2ap_MobilityChangeFailure_IEs_t *mobilityChangeFailure_IEs, uint8_t **buf, uint32_t *length);
static inline int x2ap_mobility_change_acknowledge_encoder(X2ap_MobilityChangeAcknowledge_IEs_t *mobilityChangeAcknowledge_IEs, uint8_t **buf, uint32_t *length);
static inline int x2ap_mobility_change_request_encoder(X2ap_MobilityChangeRequest_IEs_t *mobilityChangeRequest_IEs, uint8_t **buf, uint32_t *length);
static inline int x2ap_resource_status_update_encoder(X2ap_ResourceStatusUpdate_IEs_t *resourceStatusUpdate_IEs, uint8_t **buf, uint32_t *length);
static inline int x2ap_resource_status_failure_encoder(X2ap_ResourceStatusFailure_IEs_t *resourceStatusFailure_IEs, uint8_t **buf, uint32_t *length);
static inline int x2ap_resource_status_response_encoder(X2ap_ResourceStatusResponse_IEs_t *resourceStatusResponse_IEs, uint8_t **buf, uint32_t *length);
static inline int x2ap_resource_status_request_encoder(X2ap_ResourceStatusRequest_IEs_t *resourceStatusRequest_IEs, uint8_t **buf, uint32_t *length);
static inline int x2ap_load_information_encoder(X2ap_LoadInformation_IEs_t *loadInformation_IEs, uint8_t **buf, uint32_t *length);
static inline int x2ap_handover_request_encoder(X2ap_HandoverRequest_IEs_t *handoverRequest_IEs, uint8_t **buf, uint32_t *length);
static inline int x2ap_handover_request_acknowledge_encoder(X2ap_HandoverRequestAcknowledge_IEs_t *handoverRequestAcknowledge_IEs, uint8_t **buf, uint32_t *length);
static inline int x2ap_handover_preparation_failure_encoder(X2ap_HandoverPreparationFailure_IEs_t *handoverPreparationFailure_IEs, uint8_t **buf, uint32_t *length);
static inline int x2ap_error_indication_encoder(X2ap_ErrorIndication_IEs_t *errorIndication_IEs, uint8_t **buf, uint32_t *length);
static inline int x2ap_handover_cancel_encoder(X2ap_HandoverCancel_IEs_t *handoverCancel_IEs, uint8_t **buf, uint32_t *length);
static inline int x2ap_handover_report_encoder(X2ap_HandoverReport_IEs_t *handoverReport_IEs, uint8_t **buf, uint32_t *length);
static inline int x2ap_eNB_configuration_update_request_encoder(X2ap_ENBConfigurationUpdate_IEs_t *enbConfigurationUpdate_IEs, uint8_t **buf, uint32_t *length);
static inline int x2ap_eNB_configuration_update_acknowledge_encoder(X2ap_ENBConfigurationUpdateAcknowledge_IEs_t *enbConfigurationUpdateAcknowledge_IEs, uint8_t **buf, uint32_t *length);
static inline int x2ap_eNB_configuration_update_failure_encoder(X2ap_ENBConfigurationUpdateFailure_IEs_t *enbConfigurationUpdateFailure_IEs, uint8_t **buf, uint32_t *length);
static inline int x2ap_cell_activation_failure_encoder(X2ap_CellActivationFailure_IEs_t *cellActivationFailure_IEs, uint8_t **buf, uint32_t *length);
static inline int x2ap_cell_activation_response_encoder(X2ap_CellActivationResponse_IEs_t *cellActivationResponse_IEs, uint8_t **buf, uint32_t *length) ;
static inline int x2ap_cell_activation_request_encoder(X2ap_CellActivationRequest_IEs_t *cellActivationRequest_IEs, uint8_t **buf, uint32_t *length) ;
static inline int x2ap_rlf_indication_encoder(X2ap_RLFIndication_IEs_t *rlfIndication_IEs, uint8_t **buf, uint32_t *length) ;
static inline int x2ap_sn_status_transfer_encoder(X2ap_SNStatusTransfer_IEs_t *snStatusTransfer_IEs, uint8_t **buf, uint32_t *length);
static inline int x2ap_ue_context_release_encoder(X2ap_UEContextRelease_IEs_t *uecontext_rel, uint8_t **buf, uint32_t *length);
int int
x2ap_eNB_encode_pdu(x2ap_message *x2ap_message_p, uint8_t **buf, uint32_t *length) { x2ap_eNB_encode_pdu(x2ap_message *x2ap_message_p, uint8_t **buf, uint32_t *length) {
...@@ -68,11 +101,11 @@ x2ap_eNB_encode_pdu(x2ap_message *x2ap_message_p, uint8_t **buf, uint32_t *lengt ...@@ -68,11 +101,11 @@ x2ap_eNB_encode_pdu(x2ap_message *x2ap_message_p, uint8_t **buf, uint32_t *lengt
return -1; return -1;
} }
static inline int int
x2ap_eNB_encode_initiating(x2ap_message *x2ap_message_p, uint8_t **buf, uint32_t *length){ x2ap_eNB_encode_initiating(x2ap_message *x2ap_message_p, uint8_t **buf, uint32_t *length){
int ret = -1; int ret = -1;
MessageDef *message_p; MessageDef *message;
char *message_string = NULL; char *message_string = NULL;
size_t message_string_size; size_t message_string_size;
MessagesIds message_id; MessagesIds message_id;
...@@ -84,64 +117,64 @@ x2ap_eNB_encode_initiating(x2ap_message *x2ap_message_p, uint8_t **buf, uint32_t ...@@ -84,64 +117,64 @@ x2ap_eNB_encode_initiating(x2ap_message *x2ap_message_p, uint8_t **buf, uint32_t
x2ap_string_total_size = 0; x2ap_string_total_size = 0;
switch(x2ap_message_p->procedureCode) { switch(x2ap_message_p->procedureCode) {
case ProcedureCode_id_reset: case X2ap_ProcedureCode_id_reset:
ret = x2ap_reset_request_encoder(&x2ap_message_p->msg.resetRequest_IEs, buf, length); ret = x2ap_reset_request_encoder(&x2ap_message_p->msg.x2ap_ResetRequest_IEs, buf, length);
#warning "do the same for the other messages" #warning "do the same for the other messages"
x2ap_xer_print_x2ap_resetrequest_(x2ap_xer__print2sp, message_string, x2ap_message_p); x2ap_xer_print_x2ap_resetrequest_(x2ap_xer__print2sp, message_string, x2ap_message_p);
message_id = X2AP_RESET_REQUST_LOG; message_id = X2AP_RESET_REQUST_LOG;
message_p = itti_alloc_new_message_sized(TASK_X2AP, message_id, message_string_size + sizeof (IttiMsgText)); message = itti_alloc_new_message_sized(TASK_X2AP, message_id, message_string_size + sizeof (IttiMsgText));
message_p->ittiMsg.x2ap_reset_request_log.size = message_string_size; message->ittiMsg.x2ap_reset_request_log.size = message_string_size;
memcpy(&message_p->ittiMsg.x2ap_reset_request_log.text, message_string, message_string_size); memcpy(&message->ittiMsg.x2ap_reset_request_log.text, message_string, message_string_size);
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message);
free(message_string); free(message_string);
break; break;
case ProcedureCode_id_loadIndication: case X2ap_ProcedureCode_id_loadIndication:
ret = x2ap_load_information_encoder(&x2ap_message_p->msg.loadInformation_IEs, buf, length); ret = x2ap_load_information_encoder(&x2ap_message_p->msg.x2ap_LoadInformation_IEs, buf, length);
break; break;
case ProcedureCode_id_resourceStatusReportingInitiation: case X2ap_ProcedureCode_id_resourceStatusReportingInitiation:
ret = x2ap_resource_status_request_encoder(&x2ap_message_p->msg.resourceStatusRequest_IEs, buf, length); ret = x2ap_resource_status_request_encoder(&x2ap_message_p->msg.x2ap_ResourceStatusRequest_IEs, buf, length);
break; break;
case ProcedureCode_id_resourceStatusReporting: case X2ap_ProcedureCode_id_resourceStatusReporting:
ret = x2ap_resource_status_update_encoder(&x2ap_message_p->msg.resourceStatusUpdate_IEs, buf, length); ret = x2ap_resource_status_update_encoder(&x2ap_message_p->msg.x2ap_ResourceStatusUpdate_IEs, buf, length);
break; break;
case ProcedureCode_id_mobilitySettingsChange: case X2ap_ProcedureCode_id_mobilitySettingsChange:
ret = x2ap_mobility_change_request_encoder(&x2ap_message_p->msg.mobilityChangeRequest_IEs, buf, length); ret = x2ap_mobility_change_request_encoder(&x2ap_message_p->msg.x2ap_MobilityChangeRequest_IEs, buf, length);
break; break;
case ProcedureCode_id_x2Setup: case X2ap_ProcedureCode_id_x2Setup:
ret = x2_setup_request_encoder(&x2ap_message_p->msg.x2SetupRequest_IEs, buf, length); ret = x2_setup_request_encoder(&x2ap_message_p->msg.x2SetupRequest_IEs, buf, length);
break; break;
case ProcedureCode_id_handoverPreparation: case X2ap_ProcedureCode_id_handoverPreparation:
ret = x2ap_handover_request_encoder(&x2ap_message_p->msg.handoverRequest_IEs, buf, length); ret = x2ap_handover_request_encoder(&x2ap_message_p->msg.x2ap_HandoverRequest_IEs, buf, length);
break; break;
case ProcedureCode_id_errorIndication: case X2ap_ProcedureCode_id_errorIndication:
ret = x2ap_error_indication_encoder(&x2ap_message_p->msg.errorIndication_IEs, buf, length); ret = x2ap_error_indication_encoder(&x2ap_message_p->msg.x2ap_ErrorIndication_IEs, buf, length);
break; break;
case ProcedureCode_id_handoverCancel: case X2ap_ProcedureCode_id_handoverCancel:
ret = x2ap_handover_cancel_encoder(&x2ap_message_p->msg.handoverCancel_IEs, buf, length); ret = x2ap_handover_cancel_encoder(&x2ap_message_p->msg.x2ap_HandoverCancel_IEs, buf, length);
break; break;
case ProcedureCode_id_handoverReport: case X2ap_ProcedureCode_id_handoverReport:
ret = x2ap_handover_report_encoder(&x2ap_message_p->msg.handoverReport_IEs, buf, length); ret = x2ap_handover_report_encoder(&x2ap_message_p->msg.x2ap_HandoverReport_IEs, buf, length);
break; break;
case ProcedureCode_id_eNBConfigurationUpdate: case X2ap_ProcedureCode_id_eNBConfigurationUpdate:
ret = x2ap_eNB_configuration_update_request_encoder(&x2ap_message_p->msg.enbConfigurationUpdate_IEs,buf, length); ret = x2ap_eNB_configuration_update_request_encoder(&x2ap_message_p->msg.x2ap_ENBConfigurationUpdate_IEs,buf, length);
break; break;
case ProcedureCode_id_uEContextRelease: case X2ap_ProcedureCode_id_uEContextRelease:
ret = x2ap_ue_context_release_encoder(&x2ap_message_p->msg.ueContextRelease_IEs, buf, length ); ret = x2ap_ue_context_release_encoder(&x2ap_message_p->msg.x2ap_UEContextRelease_IEs, buf, length );
break; break;
case ProcedureCode_id_snStatusTransfer: case X2ap_ProcedureCode_id_snStatusTransfer:
ret = x2ap_sn_status_transfer_encoder(&x2ap_message_p->msg.snStatusTransfer_IEs, buf, length); ret = x2ap_sn_status_transfer_encoder(&x2ap_message_p->msg.x2ap_SNStatusTransfer_IEs, buf, length);
break; break;
case ProcedureCode_id_rLFIndication: case X2ap_ProcedureCode_id_rLFIndication:
ret = x2ap_rlf_indication_encoder(&x2ap_message_p->msg.rlfIndication_IEs, buf, length); ret = x2ap_rlf_indication_encoder(&x2ap_message_p->msg.x2ap_RLFIndication_IEs, buf, length);
break; break;
case ProcedureCode_id_cellActivation: case X2ap_ProcedureCode_id_cellActivation:
ret = x2ap_cell_activation_request_encoder(&x2ap_message_p->msg.cellActivationRequest_IEs, buf, length); ret = x2ap_cell_activation_request_encoder(&x2ap_message_p->msg.x2ap_CellActivationRequest_IEs, buf, length);
break; break;
default: default:
X2AP_DEBUG("Unknown procedure (%d) or not implemented", (int)x2ap_message_p->procedureCode); X2AP_DEBUG("Unknown procedure (%d) or not implemented", (int)x2ap_message_p->procedureCode);
...@@ -151,11 +184,11 @@ x2ap_eNB_encode_initiating(x2ap_message *x2ap_message_p, uint8_t **buf, uint32_t ...@@ -151,11 +184,11 @@ x2ap_eNB_encode_initiating(x2ap_message *x2ap_message_p, uint8_t **buf, uint32_t
return ret; return ret;
} }
static inline int int
x2ap_eNB_encode_successful(x2ap_message *x2ap_message_p, uint8_t **buf, uint32_t *length){ x2ap_eNB_encode_successful(x2ap_message *x2ap_message_p, uint8_t **buf, uint32_t *length){
int ret = -1; int ret = -1;
MessageDef *message_p; MessageDef *message;
char *message_string = NULL; char *message_string = NULL;
size_t message_string_size; size_t message_string_size;
MessagesIds message_id; MessagesIds message_id;
...@@ -168,35 +201,35 @@ x2ap_eNB_encode_successful(x2ap_message *x2ap_message_p, uint8_t **buf, uint32_t ...@@ -168,35 +201,35 @@ x2ap_eNB_encode_successful(x2ap_message *x2ap_message_p, uint8_t **buf, uint32_t
switch(x2ap_message_p->procedureCode) { switch(x2ap_message_p->procedureCode) {
case ProcedureCode_id_resourceStatusReportingInitiation: case X2ap_ProcedureCode_id_resourceStatusReportingInitiation:
ret = x2ap_resource_status_response_encoder(&x2ap_message_p->msg.resourceStatusResponse_IEs, buf, length); ret = x2ap_resource_status_response_encoder(&x2ap_message_p->msg.x2ap_ResourceStatusResponse_IEs, buf, length);
#warning "do the same for the other messages" #warning "do the same for the other messages"
x2ap_xer_print_x2ap_resourcestatusresponse_(x2ap_xer__print2sp, message_string, x2ap_message_p); x2ap_xer_print_x2ap_resourcestatusresponse_(x2ap_xer__print2sp, message_string, x2ap_message_p);
message_id = X2AP_RESOURCE_STATUS_RESPONSE_LOG; message_id = X2AP_RESOURCE_STATUS_RESPONSE_LOG;
message_p = itti_alloc_new_message_sized(TASK_X2AP, message_id, message_string_size + sizeof (IttiMsgText)); message = itti_alloc_new_message_sized(TASK_X2AP, message_id, message_string_size + sizeof (IttiMsgText));
message_p->ittiMsg.x2ap_resource_status_response_log.size = message_string_size; message->ittiMsg.x2ap_resource_status_response_log.size = message_string_size;
memcpy(&message_p->ittiMsg.x2ap_resource_status_response_log.text, message_string, message_string_size); memcpy(&message->ittiMsg.x2ap_resource_status_response_log.text, message_string, message_string_size);
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message);
free(message_string); free(message_string);
break; break;
case ProcedureCode_id_mobilitySettingsChange: case X2ap_ProcedureCode_id_mobilitySettingsChange:
ret = x2ap_mobility_change_acknowledge_encoder(&x2ap_message_p->msg.mobilityChangeAcknowledge_IEs, buf, length); ret = x2ap_mobility_change_acknowledge_encoder(&x2ap_message_p->msg.x2ap_MobilityChangeAcknowledge_IEs, buf, length);
break; break;
case ProcedureCode_id_reset: case X2ap_ProcedureCode_id_reset:
ret = x2ap_reset_response_encoder(&x2ap_message_p->msg.resetResponse_IEs, buf, length); ret = x2ap_reset_response_encoder(&x2ap_message_p->msg.x2ap_ResetResponse_IEs, buf, length);
break; break;
case ProcedureCode_id_x2Setup: case X2ap_ProcedureCode_id_x2Setup:
ret = x2_setup_response_encoder(&x2ap_message_p->msg.x2SetupResponse_IEs, buf, length); ret = x2_setup_response_encoder(&x2ap_message_p->msg.x2SetupResponse_IEs, buf, length);
break; break;
case ProcedureCode_id_handoverPreparation: case X2ap_ProcedureCode_id_handoverPreparation:
ret = x2ap_handover_request_acknowledge_encoder(&x2ap_message_p->msg.handoverRequestAcknowledge_IEs, buf, length); ret = x2ap_handover_request_acknowledge_encoder(&x2ap_message_p->msg.x2ap_HandoverRequestAcknowledge_IEs, buf, length);
break; break;
case ProcedureCode_id_eNBConfigurationUpdate: case X2ap_ProcedureCode_id_eNBConfigurationUpdate:
ret = x2ap_eNB_configuration_update_acknowledge_encoder(&x2ap_message_p->msg.enbConfigurationUpdateAcknowledge_IEs, buf, length); ret = x2ap_eNB_configuration_update_acknowledge_encoder(&x2ap_message_p->msg.x2ap_ENBConfigurationUpdateAcknowledge_IEs, buf, length);
break; break;
case ProcedureCode_id_cellActivation: case X2ap_ProcedureCode_id_cellActivation:
ret = x2ap_cell_activation_response_encoder(&x2ap_message_p->msg.cellActivationResponse_IEs, buf, length); ret = x2ap_cell_activation_response_encoder(&x2ap_message_p->msg.x2ap_CellActivationResponse_IEs, buf, length);
break; break;
default: default:
X2AP_DEBUG("Unknown procedure (%d) or not implemented", (int)x2ap_message_p->procedureCode); X2AP_DEBUG("Unknown procedure (%d) or not implemented", (int)x2ap_message_p->procedureCode);
...@@ -205,11 +238,11 @@ x2ap_eNB_encode_successful(x2ap_message *x2ap_message_p, uint8_t **buf, uint32_t ...@@ -205,11 +238,11 @@ x2ap_eNB_encode_successful(x2ap_message *x2ap_message_p, uint8_t **buf, uint32_t
return ret; return ret;
} }
static inline int
int x2ap_eNB_encode_unsuccessful(x2ap_message *x2ap_message_p, uint8_t **buf, uint32_t *length){ x2ap_eNB_encode_unsuccessful(x2ap_message *x2ap_message_p, uint8_t **buf, uint32_t *length){
int ret = -1; int ret = -1;
MessageDef *message_p; MessageDef *message;
char *message_string = NULL; char *message_string = NULL;
size_t message_string_size; size_t message_string_size;
MessagesIds message_id; MessagesIds message_id;
...@@ -221,32 +254,32 @@ int x2ap_eNB_encode_unsuccessful(x2ap_message *x2ap_message_p, uint8_t **buf, ui ...@@ -221,32 +254,32 @@ int x2ap_eNB_encode_unsuccessful(x2ap_message *x2ap_message_p, uint8_t **buf, ui
x2ap_string_total_size = 0; x2ap_string_total_size = 0;
switch(x2ap_message_p->procedureCode) { switch(x2ap_message_p->procedureCode) {
case ProcedureCode_id_resourceStatusReportingInitiation: case X2ap_ProcedureCode_id_resourceStatusReportingInitiation:
ret = x2ap_resource_status_failure_encoder(&x2ap_message_p->msg.resourceStatusFailure_IEs, buf, length); ret = x2ap_resource_status_failure_encoder(&x2ap_message_p->msg.x2ap_ResourceStatusFailure_IEs, buf, length);
#warning "do the same for the other messages" #warning "do the same for the other messages"
x2ap_xer_print_x2ap_resourcestatusfailure_(x2ap_xer__print2sp, message_string, x2ap_message_p); x2ap_xer_print_x2ap_resourcestatusfailure_(x2ap_xer__print2sp, message_string, x2ap_message_p);
message_id = X2AP_RESOURCE_STATUS_FAILURE_LOG; message_id = X2AP_RESOURCE_STATUS_FAILURE_LOG;
message_p = itti_alloc_new_message_sized(TASK_X2AP, message_id, message_string_size + sizeof (IttiMsgText)); message = itti_alloc_new_message_sized(TASK_X2AP, message_id, message_string_size + sizeof (IttiMsgText));
message_p->ittiMsg.x2ap_resource_status_failure_log.size = message_string_size; message->ittiMsg.x2ap_resource_status_failure_log.size = message_string_size;
memcpy(&message_p->ittiMsg.x2ap_resource_status_failure_log.text, message_string, message_string_size); memcpy(&message->ittiMsg.x2ap_resource_status_failure_log.text, message_string, message_string_size);
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message);
free(message_string); free(message_string);
break; break;
case ProcedureCode_id_mobilitySettingsChange: case X2ap_ProcedureCode_id_mobilitySettingsChange:
ret = x2ap_mobility_change_failure_encoder(&x2ap_message_p->msg.mobilityChangeFailure_IEs, buf, length); ret = x2ap_mobility_change_failure_encoder(&x2ap_message_p->msg.x2ap_MobilityChangeFailure_IEs, buf, length);
break; break;
case ProcedureCode_id_x2Setup: case X2ap_ProcedureCode_id_x2Setup:
ret = x2_setup_failure_encoder(&x2ap_message_p->msg.x2SetupFailure_IEs, buf, length); ret = x2_setup_failure_encoder(&x2ap_message_p->msg.x2SetupFailure_IEs, buf, length);
break; break;
case ProcedureCode_id_handoverPreparation: case X2ap_ProcedureCode_id_handoverPreparation:
ret = x2ap_handover_preparation_failure_encoder(&x2ap_message_p->msg.handoverPreparationFailure_IEs, buf, length); ret = x2ap_handover_preparation_failure_encoder(&x2ap_message_p->msg.x2ap_HandoverPreparationFailure_IEs, buf, length);
break; break;
case ProcedureCode_id_eNBConfigurationUpdate: case X2ap_ProcedureCode_id_eNBConfigurationUpdate:
ret = x2ap_eNB_configuration_update_failure_encoder(&x2ap_message_p->msg.enbConfigurationUpdateFailure_IEs, buf, length); ret = x2ap_eNB_configuration_update_failure_encoder(&x2ap_message_p->msg.x2ap_ENBConfigurationUpdateFailure_IEs, buf, length);
break; break;
case ProcedureCode_id_cellActivation: case X2ap_ProcedureCode_id_cellActivation:
ret = x2ap_cell_activation_failure_encoder(&x2ap_message_p->msg.cellActivationFailure_IEs, buf, length); ret = x2ap_cell_activation_failure_encoder(&x2ap_message_p->msg.x2ap_CellActivationFailure_IEs, buf, length);
break; break;
default: default:
X2AP_DEBUG("Unknown procedure (%d) or not implemented", (int)x2ap_message_p->procedureCode); X2AP_DEBUG("Unknown procedure (%d) or not implemented", (int)x2ap_message_p->procedureCode);
...@@ -257,36 +290,38 @@ int x2ap_eNB_encode_unsuccessful(x2ap_message *x2ap_message_p, uint8_t **buf, ui ...@@ -257,36 +290,38 @@ int x2ap_eNB_encode_unsuccessful(x2ap_message *x2ap_message_p, uint8_t **buf, ui
static inline static inline
int x2ap_reset_request_encoder(ResetRequest_IEs_t *resetRequest_IEs, uint8_t **buf, uint32_t *length){ int x2ap_reset_request_encoder(X2ap_ResetRequest_IEs_t *resetRequest_IEs, uint8_t **buf, uint32_t *length){
int i; X2ap_ResetRequest_t resetRequest;
ResetRequest_t resetRequest; memset (&resetRequest,0, sizeof(X2ap_ResetRequest_t));
memset (&resetRequest,0, sizeof(ResetRequest_t));
asn1_xer_print = 0; asn1_xer_print = 0;
asn_debug = 0; asn_debug = 0;
// encoding Reset request message // encoding Reset request message
if (x2ap_encode_resetrequest_ies(&resetRequest, resetRequest_IEs) <0) { if (x2ap_encode_x2ap_resetrequest_ies(&resetRequest, resetRequest_IEs) <0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
// encoding ProcedureCode_id_reset // encoding ProcedureCode_id_reset
if (x2ap_generate_initiating_message (buf, length, ProcedureCode_id_reset, Criticality_reject, &asn_DEF_ResetRequest, &resetRequest) <0) { if (x2ap_generate_initiating_message (buf, length, X2ap_ProcedureCode_id_reset, X2ap_Criticality_reject, &asn_DEF_X2ap_ResetRequest, &resetRequest) <0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
for (i=0;i< *length; i++) #ifdef X2AP_DEBUG_ENCODER
{ int i;
for (i=0;i< *length; i++) {
printf ("0x%02x ", (*buf)[i]); printf ("0x%02x ", (*buf)[i]);
} }
printf ("\n"); printf ("\n");
#endif
return 0;
} }
static inline
int x2_setup_response_encoder(X2SetupResponse_IEs_t *x2SetupResponse_IEs, uint8_t **buf, uint32_t *length){ int x2_setup_response_encoder(X2SetupResponse_IEs_t *x2SetupResponse_IEs, uint8_t **buf, uint32_t *length){
int i;
X2SetupResponse_t x2SetupResponse; X2SetupResponse_t x2SetupResponse;
memset (&x2SetupResponse,0, sizeof(X2SetupResponse_t)); memset (&x2SetupResponse,0, sizeof(X2SetupResponse_t));
...@@ -294,26 +329,30 @@ int x2_setup_response_encoder(X2SetupResponse_IEs_t *x2SetupResponse_IEs, uint8_ ...@@ -294,26 +329,30 @@ int x2_setup_response_encoder(X2SetupResponse_IEs_t *x2SetupResponse_IEs, uint8_
asn_debug = 0; asn_debug = 0;
// encoding X2 Setup response message // encoding X2 Setup response message
if (x2ap_encode_x2setupresponse_ies(&x2SetupResponse, x2SetupResponse_IEs) <0) { if (x2ap_encode_x2setupresponse_ies(&x2SetupResponse, x2SetupResponse_IEs) < 0 )
{
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
// encoding ProcedureCode_id_x2Setup // encoding ProcedureCode_id_x2Setup
if (x2ap_generate_successfull_outcome (buf, length, ProcedureCode_id_x2Setup, Criticality_reject, &asn_DEF_X2SetupResponse, &x2SetupResponse) <0) { if (x2ap_generate_successfull_outcome (buf, length, X2ap_ProcedureCode_id_x2Setup, X2ap_Criticality_reject, &asn_DEF_X2SetupResponse, &x2SetupResponse) <0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
for (i=0;i< *length; i++) #ifdef X2AP_DEBUG_ENCODER
{ int i;
for (i=0;i< *length; i++) {
printf ("0x%02x ", (*buf)[i]); printf ("0x%02x ", (*buf)[i]);
} }
printf ("\n"); printf ("\n");
#endif
return 0;
} }
static inline
int x2_setup_failure_encoder(X2SetupFailure_IEs_t *x2SetupFailure_IEs, uint8_t **buf, uint32_t *length){ int x2_setup_failure_encoder(X2SetupFailure_IEs_t *x2SetupFailure_IEs, uint8_t **buf, uint32_t *length){
int i;
X2SetupFailure_t x2SetupFailure; X2SetupFailure_t x2SetupFailure;
memset (&x2SetupFailure,0, sizeof(X2SetupFailure_t)); memset (&x2SetupFailure,0, sizeof(X2SetupFailure_t));
...@@ -326,21 +365,24 @@ int x2_setup_failure_encoder(X2SetupFailure_IEs_t *x2SetupFailure_IEs, uint8_t * ...@@ -326,21 +365,24 @@ int x2_setup_failure_encoder(X2SetupFailure_IEs_t *x2SetupFailure_IEs, uint8_t *
return -1; return -1;
} }
// encoding ProcedureCode_id_x2Setup // encoding ProcedureCode_id_x2Setup
if (x2ap_generate_unsuccessfull_outcome (buf, length, ProcedureCode_id_x2Setup, Criticality_reject, &asn_DEF_X2SetupFailure, &x2SetupFailure) <0) { if (x2ap_generate_unsuccessfull_outcome (buf, length, X2ap_ProcedureCode_id_x2Setup, X2ap_Criticality_reject, &asn_DEF_X2SetupFailure, &x2SetupFailure) <0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
for (i=0;i< *length; i++) #ifdef X2AP_DEBUG_ENCODER
{ int i;
for (i=0;i< *length; i++) {
printf ("0x%02x ", (*buf)[i]); printf ("0x%02x ", (*buf)[i]);
} }
printf ("\n"); printf ("\n");
#endif
return 0;
} }
static inline
int x2_setup_request_encoder(X2SetupRequest_IEs_t *x2SetupRequest_IEs, uint8_t **buf, uint32_t *length){ int x2_setup_request_encoder(X2SetupRequest_IEs_t *x2SetupRequest_IEs, uint8_t **buf, uint32_t *length){
int i;
X2SetupRequest_t x2SetupRequest; X2SetupRequest_t x2SetupRequest;
memset (&x2SetupRequest,0, sizeof(X2SetupRequest_t)); memset (&x2SetupRequest,0, sizeof(X2SetupRequest_t));
...@@ -353,683 +395,736 @@ int x2_setup_request_encoder(X2SetupRequest_IEs_t *x2SetupRequest_IEs, uint8_t * ...@@ -353,683 +395,736 @@ int x2_setup_request_encoder(X2SetupRequest_IEs_t *x2SetupRequest_IEs, uint8_t *
return -1; return -1;
} }
// encoding ProcedureCode_id_x2Setup // encoding ProcedureCode_id_x2Setup
if (x2ap_generate_initiating_message (buf, length, ProcedureCode_id_x2Setup, Criticality_reject, &asn_DEF_X2SetupRequest, &x2SetupRequest) <0) { if (x2ap_generate_initiating_message (buf, length, X2ap_ProcedureCode_id_x2Setup, X2ap_Criticality_reject, &asn_DEF_X2SetupRequest, &x2SetupRequest) <0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
for (i=0;i< *length; i++) #ifdef X2AP_DEBUG_ENCODER
{ int i;
for (i=0;i< *length; i++) {
printf ("0x%02x ", (*buf)[i]); printf ("0x%02x ", (*buf)[i]);
} }
printf ("\n"); printf ("\n");
#endif
return 0;
} }
static inline static inline
int x2ap_reset_response_encoder(ResetResponse_IEs_t *resetResponse_IEs, uint8_t **buf, uint32_t *length){ int x2ap_reset_response_encoder(X2ap_ResetResponse_IEs_t *resetResponse_IEs, uint8_t **buf, uint32_t *length){
int i; X2ap_ResetResponse_t resetResponse;
ResetResponse_t resetResponse; memset (&resetResponse,0, sizeof(X2ap_ResetResponse_t));
memset (&resetResponse,0, sizeof(ResetResponse_t));
asn1_xer_print = 0; asn1_xer_print = 0;
asn_debug = 0; asn_debug = 0;
// encoding Reset Response message // encoding Reset Response message
if (x2ap_encode_resetresponse_ies(&resetResponse, resetResponse_IEs) <0) { if (x2ap_encode_x2ap_resetresponse_ies(&resetResponse, resetResponse_IEs) <0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
// encoding ProcedureCode_id_reset // encoding ProcedureCode_id_reset
if (x2ap_generate_successfull_outcome(buf, length, ProcedureCode_id_reset, Criticality_reject, &asn_DEF_ResetResponse, &resetResponse) <0) { if (x2ap_generate_successfull_outcome(buf, length, X2ap_ProcedureCode_id_reset, X2ap_Criticality_reject, &asn_DEF_X2ap_ResetResponse, &resetResponse) <0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
for (i=0;i< *length; i++) #ifdef X2AP_DEBUG_ENCODER
{ int i;
for (i=0;i< *length; i++) {
printf ("0x%02x ", (*buf)[i]); printf ("0x%02x ", (*buf)[i]);
} }
printf ("\n"); printf ("\n");
#endif
return 0;
} }
static inline static inline
int x2ap_mobility_change_failure_encoder(MobilityChangeFailure_IEs_t *mobilityChangeFailure_IEs, uint8_t **buf, uint32_t *length){ int x2ap_mobility_change_failure_encoder(X2ap_MobilityChangeFailure_IEs_t *mobilityChangeFailure_IEs, uint8_t **buf, uint32_t *length){
int i; X2ap_MobilityChangeFailure_t mobilityChangeFailure;
MobilityChangeFailure_t mobilityChangeFailure; memset (&mobilityChangeFailure,0, sizeof(X2ap_MobilityChangeFailure_t));
memset (&mobilityChangeFailure,0, sizeof(MobilityChangeFailure_t));
asn1_xer_print = 0; asn1_xer_print = 0;
asn_debug = 0; asn_debug = 0;
// encoding Mobility Change Failure message // encoding Mobility Change Failure message
if (x2ap_encode_mobilitychangefailure_ies(&mobilityChangeFailure, mobilityChangeFailure_IEs) <0) { if (x2ap_encode_x2ap_mobilitychangefailure_ies(&mobilityChangeFailure, mobilityChangeFailure_IEs) <0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
// encoding ProcedureCode_id_mobilitySettingsChange // encoding ProcedureCode_id_mobilitySettingsChange
if (x2ap_generate_unsuccessfull_outcome (buf, length, ProcedureCode_id_mobilitySettingsChange, Criticality_reject, &asn_DEF_MobilityChangeFailure, &mobilityChangeFailure) <0) { if (x2ap_generate_unsuccessfull_outcome (buf, length, X2ap_ProcedureCode_id_mobilitySettingsChange, X2ap_Criticality_reject, &asn_DEF_X2ap_MobilityChangeFailure, &mobilityChangeFailure) <0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
for (i=0;i< *length; i++) #ifdef X2AP_DEBUG_ENCODER
{ int i;
for (i=0;i< *length; i++) {
printf ("0x%02x ", (*buf)[i]); printf ("0x%02x ", (*buf)[i]);
} }
printf ("\n"); printf ("\n");
#endif
return 0;
} }
static inline static inline
int x2ap_mobility_change_acknowledge_encoder(MobilityChangeAcknowledge_IEs_t *mobilityChangeAcknowledge_IEs, uint8_t **buf, uint32_t *length){ int x2ap_mobility_change_acknowledge_encoder(X2ap_MobilityChangeAcknowledge_IEs_t *mobilityChangeAcknowledge_IEs, uint8_t **buf, uint32_t *length){
int i; X2ap_MobilityChangeAcknowledge_t mobilityChangeAcknowledge;
MobilityChangeAcknowledge_t mobilityChangeAcknowledge; memset (&mobilityChangeAcknowledge,0, sizeof(X2ap_MobilityChangeAcknowledge_t));
memset (&mobilityChangeAcknowledge,0, sizeof(MobilityChangeAcknowledge_t));
asn1_xer_print = 0; asn1_xer_print = 0;
asn_debug = 0; asn_debug = 0;
// encoding Mobility Change Acknowledge message // encoding Mobility Change Acknowledge message
if (x2ap_encode_mobilitychangeacknowledge_ies(&mobilityChangeAcknowledge, mobilityChangeAcknowledge_IEs) <0) { if (x2ap_encode_x2ap_mobilitychangeacknowledge_ies(&mobilityChangeAcknowledge, mobilityChangeAcknowledge_IEs) <0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
// encoding ProcedureCode_id_mobilitySettingsChange // encoding ProcedureCode_id_mobilitySettingsChange
if (x2ap_generate_successfull_outcome (buf, length, ProcedureCode_id_mobilitySettingsChange, Criticality_reject, &asn_DEF_MobilityChangeAcknowledge, &mobilityChangeAcknowledge) <0) { if (x2ap_generate_successfull_outcome (buf, length, X2ap_ProcedureCode_id_mobilitySettingsChange, X2ap_Criticality_reject, &asn_DEF_X2ap_MobilityChangeAcknowledge, &mobilityChangeAcknowledge) <0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
for (i=0;i< *length; i++) #ifdef X2AP_DEBUG_ENCODER
{ int i;
for (i=0;i< *length; i++) {
printf ("0x%02x ", (*buf)[i]); printf ("0x%02x ", (*buf)[i]);
} }
printf ("\n"); printf ("\n");
#endif
return 0;
} }
static inline static inline
int x2ap_mobility_change_request_encoder(MobilityChangeRequest_IEs_t *mobilityChangeRequest_IEs, uint8_t **buf, uint32_t *length){ int x2ap_mobility_change_request_encoder(X2ap_MobilityChangeRequest_IEs_t *mobilityChangeRequest_IEs, uint8_t **buf, uint32_t *length){
int i; X2ap_MobilityChangeRequest_t mobilityChangeRequest;
MobilityChangeRequest_t mobilityChangeRequest; memset (&mobilityChangeRequest,0, sizeof(X2ap_MobilityChangeRequest_t));
memset (&mobilityChangeRequest,0, sizeof(MobilityChangeRequest_t));
asn1_xer_print = 0; asn1_xer_print = 0;
asn_debug = 0; asn_debug = 0;
// encoding Mobility Change Request message // encoding Mobility Change Request message
if (x2ap_encode_mobilitychangerequest_ies(&mobilityChangeRequest, mobilityChangeRequest_IEs) <0) { if (x2ap_encode_x2ap_mobilitychangerequest_ies(&mobilityChangeRequest, mobilityChangeRequest_IEs) <0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
// encoding ProcedureCode_id_mobilitySettingsChange // encoding ProcedureCode_id_mobilitySettingsChange
if (x2ap_generate_initiating_message (buf, length, ProcedureCode_id_mobilitySettingsChange, Criticality_reject, &asn_DEF_MobilityChangeRequest, &mobilityChangeRequest) <0) { if (x2ap_generate_initiating_message (buf, length, X2ap_ProcedureCode_id_mobilitySettingsChange, X2ap_Criticality_reject, &asn_DEF_X2ap_MobilityChangeRequest, &mobilityChangeRequest) <0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
for (i=0;i< *length; i++) #ifdef X2AP_DEBUG_ENCODER
{ int i;
for (i=0;i< *length; i++) {
printf ("0x%02x ", (*buf)[i]); printf ("0x%02x ", (*buf)[i]);
} }
printf ("\n"); printf ("\n");
#endif
return 0;
} }
static inline static inline
int x2ap_resource_status_update_encoder(ResourceStatusUpdate_IEs_t *resourceStatusUpdate_IEs, uint8_t **buf, uint32_t *length){ int x2ap_resource_status_update_encoder(X2ap_ResourceStatusUpdate_IEs_t *resourceStatusUpdate_IEs, uint8_t **buf, uint32_t *length){
int i; X2ap_ResourceStatusUpdate_t resourceStatusUpdate;
ResourceStatusUpdate_t resourceStatusUpdate; memset (&resourceStatusUpdate,0, sizeof(X2ap_ResourceStatusUpdate_t));
memset (&resourceStatusUpdate,0, sizeof(ResourceStatusUpdate_t));
asn1_xer_print = 0; asn1_xer_print = 0;
asn_debug = 0; asn_debug = 0;
// encoding Resource Status Update message // encoding Resource Status Update message
if (x2ap_encode_resourcestatusupdate_ies(&resourceStatusUpdate, resourceStatusUpdate_IEs) <0) { if (x2ap_encode_x2ap_resourcestatusupdate_ies(&resourceStatusUpdate, resourceStatusUpdate_IEs) <0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
// encoding ProcedureCode_id_resourceStatusReporting // encoding ProcedureCode_id_resourceStatusReporting
if (x2ap_generate_initiating_message (buf, length, ProcedureCode_id_resourceStatusReporting, Criticality_ignore, &asn_DEF_ResourceStatusUpdate, &resourceStatusUpdate) <0) { if (x2ap_generate_initiating_message (buf, length, X2ap_ProcedureCode_id_resourceStatusReporting, X2ap_Criticality_ignore, &asn_DEF_X2ap_ResourceStatusUpdate, &resourceStatusUpdate) <0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
#ifdef X2AP_DEBUG_ENCODER
int i;
for (i=0;i< *length; i++) for (i=0;i< *length; i++)
{ {
printf ("0x%02x ", (*buf)[i]); printf ("0x%02x ", (*buf)[i]);
} }
printf ("\n"); printf ("\n");
#endif
return 0;
} }
static inline static inline
int x2ap_resource_status_failure_encoder(ResourceStatusFailure_IEs_t *resourceStatusFailure_IEs, uint8_t **buf, uint32_t *length){ int x2ap_resource_status_failure_encoder(X2ap_ResourceStatusFailure_IEs_t *resourceStatusFailure_IEs, uint8_t **buf, uint32_t *length){
int i; X2ap_ResourceStatusFailure_t resourceStatusFailure;
ResourceStatusFailure_t resourceStatusFailure; memset (&resourceStatusFailure,0, sizeof(X2ap_ResourceStatusFailure_t));
memset (&resourceStatusFailure,0, sizeof(ResourceStatusFailure_t));
asn1_xer_print = 0; asn1_xer_print = 0;
asn_debug = 0; asn_debug = 0;
// encoding Resource Status Failure message // encoding Resource Status Failure message
if (x2ap_encode_resourcestatusfailure_ies(&resourceStatusFailure, resourceStatusFailure_IEs) <0) { if (x2ap_encode_x2ap_resourcestatusfailure_ies(&resourceStatusFailure, resourceStatusFailure_IEs) <0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
// encoding ProcedureCode_id_resourceStatusReportingInitiation // encoding ProcedureCode_id_resourceStatusReportingInitiation
if (x2ap_generate_unsuccessfull_outcome (buf, length, ProcedureCode_id_resourceStatusReportingInitiation, Criticality_reject, &asn_DEF_ResourceStatusFailure, &resourceStatusFailure) <0) { if (x2ap_generate_unsuccessfull_outcome (buf, length, X2ap_ProcedureCode_id_resourceStatusReportingInitiation, X2ap_Criticality_reject, &asn_DEF_X2ap_ResourceStatusFailure, &resourceStatusFailure) <0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
for (i=0;i< *length; i++) #ifdef X2AP_DEBUG_ENCODER
{ int i;
for (i=0;i< *length; i++) {
printf ("0x%02x ", (*buf)[i]); printf ("0x%02x ", (*buf)[i]);
} }
printf ("\n"); printf ("\n");
#endif
return 0;
} }
static inline static inline
int x2ap_resource_status_response_encoder(ResourceStatusResponse_IEs_t *resourceStatusResponse_IEs, uint8_t **buf, uint32_t *length){ int x2ap_resource_status_response_encoder(X2ap_ResourceStatusResponse_IEs_t *resourceStatusResponse_IEs, uint8_t **buf, uint32_t *length){
int i; X2ap_ResourceStatusResponse_t resourceStatusResponse;
ResourceStatusResponse_t resourceStatusResponse; memset (&resourceStatusResponse,0, sizeof(X2ap_ResourceStatusResponse_t));
memset (&resourceStatusResponse,0, sizeof(ResourceStatusResponse_t));
asn1_xer_print = 0; asn1_xer_print = 0;
asn_debug = 0; asn_debug = 0;
// encoding Resource Status Response message // encoding Resource Status Response message
if (x2ap_encode_resourcestatusresponse_ies(&resourceStatusResponse, resourceStatusResponse_IEs) <0) { if (x2ap_encode_x2ap_resourcestatusresponse_ies(&resourceStatusResponse, resourceStatusResponse_IEs) <0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
// encoding ProcedureCode_id_resourceStatusReportingInitiation // encoding ProcedureCode_id_resourceStatusReportingInitiation
if (x2ap_generate_successfull_outcome (buf, length, ProcedureCode_id_resourceStatusReportingInitiation, Criticality_reject, &asn_DEF_ResourceStatusResponse, &resourceStatusResponse) <0) { if (x2ap_generate_successfull_outcome (buf, length, X2ap_ProcedureCode_id_resourceStatusReportingInitiation, X2ap_Criticality_reject, &asn_DEF_X2ap_ResourceStatusResponse, &resourceStatusResponse) <0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
for (i=0;i< *length; i++) #ifdef X2AP_DEBUG_ENCODER
{ int i;
for (i=0;i< *length; i++) {
printf ("0x%02x ", (*buf)[i]); printf ("0x%02x ", (*buf)[i]);
} }
printf ("\n"); printf ("\n");
#endif
return 0;
} }
static inline static inline
int x2ap_resource_status_request_encoder(ResourceStatusRequest_IEs_t *resourceStatusRequest_IEs, uint8_t **buf, uint32_t *length){ int x2ap_resource_status_request_encoder(X2ap_ResourceStatusRequest_IEs_t *resourceStatusRequest_IEs, uint8_t **buf, uint32_t *length){
int i; X2ap_ResourceStatusRequest_t resourceStatusRequest;
ResourceStatusRequest_t resourceStatusRequest; memset (&resourceStatusRequest,0, sizeof(X2ap_ResourceStatusRequest_t));
memset (&resourceStatusRequest,0, sizeof(ResourceStatusRequest_t));
asn1_xer_print = 0; asn1_xer_print = 0;
asn_debug = 0; asn_debug = 0;
// encoding Resource Status Resquest message // encoding Resource Status Resquest message
if (x2ap_encode_resourcestatusrequest_ies(&resourceStatusRequest, resourceStatusRequest_IEs) <0) { if (x2ap_encode_x2ap_resourcestatusrequest_ies(&resourceStatusRequest, resourceStatusRequest_IEs) <0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
// encoding ProcedureCode_id_resourceStatusReportingInitiation // encoding ProcedureCode_id_resourceStatusReportingInitiation
if (x2ap_generate_initiating_message (buf, length, ProcedureCode_id_resourceStatusReportingInitiation, Criticality_reject, &asn_DEF_ResourceStatusRequest, &resourceStatusRequest) <0) { if (x2ap_generate_initiating_message (buf, length, X2ap_ProcedureCode_id_resourceStatusReportingInitiation, X2ap_Criticality_reject, &asn_DEF_X2ap_ResourceStatusRequest, &resourceStatusRequest) <0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
for (i=0;i< *length; i++) #ifdef X2AP_DEBUG_ENCODER
{ int i;
for (i=0;i< *length; i++) {
printf ("0x%02x ", (*buf)[i]); printf ("0x%02x ", (*buf)[i]);
} }
printf ("\n"); printf ("\n");
#endif
return 0;
} }
static inline static inline
int x2ap_load_information_encoder(LoadInformation_IEs_t *loadInformation_IEs, uint8_t **buf, uint32_t *length){ int x2ap_load_information_encoder(X2ap_LoadInformation_IEs_t *loadInformation_IEs, uint8_t **buf, uint32_t *length){
int i; X2ap_LoadInformation_t loadInformation;
LoadInformation_t loadInformation; memset (&loadInformation,0, sizeof(X2ap_LoadInformation_t));
memset (&loadInformation,0, sizeof(LoadInformation_t));
asn1_xer_print = 0; asn1_xer_print = 0;
asn_debug = 0; asn_debug = 0;
// encoding Reset request message // encoding Reset request message
if (x2ap_encode_loadinformation_ies(&loadInformation, loadInformation_IEs) <0) { if (x2ap_encode_x2ap_loadinformation_ies(&loadInformation, loadInformation_IEs) <0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
// encoding ProcedureCode_id_loadIndication // encoding ProcedureCode_id_loadIndication
if (x2ap_generate_initiating_message (buf, length, ProcedureCode_id_loadIndication, Criticality_ignore, &asn_DEF_LoadInformation, &loadInformation) <0) { if (x2ap_generate_initiating_message (buf, length, X2ap_ProcedureCode_id_loadIndication, X2ap_Criticality_ignore, &asn_DEF_X2ap_LoadInformation, &loadInformation) <0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
for (i=0;i< *length; i++) #ifdef X2AP_DEBUG_ENCODER
{ int i;
for (i=0;i< *length; i++) {
printf ("0x%02x ", (*buf)[i]); printf ("0x%02x ", (*buf)[i]);
} }
printf ("\n"); printf ("\n");
#endif
return 0;
} }
static inline static inline
int x2ap_handover_request_encoder(HandoverRequest_IEs_t *handoverRequest_IEs, uint8_t **buf, uint32_t *length){ int x2ap_handover_request_encoder(X2ap_HandoverRequest_IEs_t *handoverRequest_IEs, uint8_t **buf, uint32_t *length){
int i; X2ap_HandoverRequest_t x2HandoverRequest;
HandoverRequest_t x2HandoverRequest; memset (&x2HandoverRequest,0, sizeof(X2ap_HandoverRequest_t));
memset (&x2HandoverRequest,0, sizeof(HandoverRequest_t));
asn1_xer_print = 0; asn1_xer_print = 0;
asn_debug = 0; asn_debug = 0;
// encoding Reset request message // encoding Reset request message
if (x2ap_encode_handoverrequest_ies(&x2HandoverRequest, handoverRequest_IEs) <0) { if (x2ap_encode_x2ap_handoverrequest_ies(&x2HandoverRequest, handoverRequest_IEs) <0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
// encoding ProcedureCode_id_loadIndication // encoding ProcedureCode_id_loadIndication
if (x2ap_generate_initiating_message (buf, length, ProcedureCode_id_handoverPreparation, Criticality_reject, &asn_DEF_HandoverRequest, &x2HandoverRequest) <0) { if (x2ap_generate_initiating_message (buf, length, X2ap_ProcedureCode_id_handoverPreparation, X2ap_Criticality_reject, &asn_DEF_X2ap_HandoverRequest, &x2HandoverRequest) <0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
for (i=0;i< *length; i++) #ifdef X2AP_DEBUG_ENCODER
{ int i;
for (i=0;i< *length; i++) {
printf ("0x%02x ", (*buf)[i]); printf ("0x%02x ", (*buf)[i]);
} }
printf ("\n"); printf ("\n");
#endif
return 0;
} }
static inline static inline
int x2ap_handover_request_acknowledge_encoder(HandoverRequestAcknowledge_IEs_t *handoverRequestAcknowledge_IEs, uint8_t **buf, uint32_t *length){ int x2ap_handover_request_acknowledge_encoder(X2ap_HandoverRequestAcknowledge_IEs_t *handoverRequestAcknowledge_IEs, uint8_t **buf, uint32_t *length){
int i; X2ap_HandoverRequestAcknowledge_t x2HandoverRequestAcknowledge;
HandoverRequestAcknowledge_t x2HandoverRequestAcknowledge; memset (&x2HandoverRequestAcknowledge,0, sizeof(X2ap_HandoverRequestAcknowledge_t));
memset (&x2HandoverRequestAcknowledge,0, sizeof(HandoverRequestAcknowledge_t));
asn1_xer_print = 0; asn1_xer_print = 0;
asn_debug = 0; asn_debug = 0;
// encoding Reset request message // encoding Reset request message
if (x2ap_encode_handoverrequestacknowledge_ies(&x2HandoverRequestAcknowledge, handoverRequestAcknowledge_IEs) <0) { if (x2ap_encode_x2ap_handoverrequestacknowledge_ies(&x2HandoverRequestAcknowledge, handoverRequestAcknowledge_IEs) <0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
if (x2ap_generate_successfull_outcome(buf, length, ProcedureCode_id_handoverPreparation, Criticality_reject, &asn_DEF_HandoverRequestAcknowledge, &x2HandoverRequestAcknowledge) <0) { if (x2ap_generate_successfull_outcome(buf, length, X2ap_ProcedureCode_id_handoverPreparation, X2ap_Criticality_reject, &asn_DEF_X2ap_HandoverRequestAcknowledge, &x2HandoverRequestAcknowledge) <0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
for (i=0;i< *length; i++) #ifdef X2AP_DEBUG_ENCODER
{ int i;
for (i=0;i< *length; i++) {
printf ("0x%02x ", (*buf)[i]); printf ("0x%02x ", (*buf)[i]);
} }
printf ("\n"); printf ("\n");
#endif
return 0;
} }
static inline static inline
int x2ap_handover_preparation_failure_encoder(HandoverPreparationFailure_IEs_t *handoverPreparationFailure_IEs, uint8_t **buf, uint32_t *length){ int x2ap_handover_preparation_failure_encoder(X2ap_HandoverPreparationFailure_IEs_t *handoverPreparationFailure_IEs, uint8_t **buf, uint32_t *length){
int i;
HandoverPreparationFailure_t x2HandoverPreparationFailure; X2ap_HandoverPreparationFailure_t x2HandoverPreparationFailure;
memset (&x2HandoverPreparationFailure,0, sizeof(HandoverPreparationFailure_t)); memset (&x2HandoverPreparationFailure,0, sizeof(X2ap_HandoverPreparationFailure_t));
asn1_xer_print = 0; asn1_xer_print = 0;
asn_debug = 0; asn_debug = 0;
// encoding Reset request message // encoding Reset request message
if (x2ap_encode_handoverpreparationfailure_ies(&x2HandoverPreparationFailure, handoverPreparationFailure_IEs) <0) { if (x2ap_encode_x2ap_handoverpreparationfailure_ies(&x2HandoverPreparationFailure, handoverPreparationFailure_IEs) <0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
// encoding ProcedureCode_id_loadIndication // encoding ProcedureCode_id_loadIndication
if (x2ap_generate_unsuccessfull_outcome(buf, length, ProcedureCode_id_handoverPreparation, Criticality_reject, &asn_DEF_HandoverPreparationFailure, &x2HandoverPreparationFailure) <0) { if (x2ap_generate_unsuccessfull_outcome(buf, length, X2ap_ProcedureCode_id_handoverPreparation, X2ap_Criticality_reject, &asn_DEF_X2ap_HandoverPreparationFailure, &x2HandoverPreparationFailure) <0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
for (i=0;i< *length; i++) #ifdef X2AP_DEBUG_ENCODER
{ int i;
for (i=0;i< *length; i++) {
printf ("0x%02x ", (*buf)[i]); printf ("0x%02x ", (*buf)[i]);
} }
printf ("\n"); printf ("\n");
#endif
return 0;
} }
static inline static inline
int x2ap_error_indication_encoder(ErrorIndication_IEs_t *errorIndication_IEs, uint8_t **buf, uint32_t *length){ int x2ap_error_indication_encoder(X2ap_ErrorIndication_IEs_t *errorIndication_IEs, uint8_t **buf, uint32_t *length){
int i; X2ap_ErrorIndication_t x2Error_indication;
ErrorIndication_t x2Error_indication; memset (&x2Error_indication,0, sizeof(X2ap_ErrorIndication_t));
memset (&x2Error_indication,0, sizeof(ErrorIndication_t));
asn1_xer_print = 0; asn1_xer_print = 0;
asn_debug = 0; asn_debug = 0;
// encoding Reset request message // encoding Reset request message
if (x2ap_encode_errorindication_ies(&x2Error_indication, errorIndication_IEs) <0) { if (x2ap_encode_x2ap_errorindication_ies(&x2Error_indication, errorIndication_IEs) <0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
// encoding ProcedureCode_id_loadIndication // encoding ProcedureCode_id_loadIndication
if (x2ap_generate_initiating_message(buf, length, ProcedureCode_id_errorIndication, Criticality_ignore, &asn_DEF_ErrorIndication, &x2Error_indication) <0) { if (x2ap_generate_initiating_message(buf, length, X2ap_ProcedureCode_id_errorIndication, X2ap_Criticality_ignore, &asn_DEF_X2ap_ErrorIndication, &x2Error_indication) <0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
#ifdef X2AP_DEBUG_ENCODER
int i;
for (i=0;i< *length; i++) for (i=0;i< *length; i++)
{ {
printf ("0x%02x ", (*buf)[i]); printf ("0x%02x ", (*buf)[i]);
} }
printf ("\n"); printf ("\n");
#endif
return 0;
} }
static inline static inline
int x2ap_handover_cancel_encoder(HandoverCancel_IEs_t *handoverCancel_IEs, uint8_t **buf, uint32_t *length){ int x2ap_handover_cancel_encoder(X2ap_HandoverCancel_IEs_t *handoverCancel_IEs, uint8_t **buf, uint32_t *length){
int i;
HandoverCancel_t x2HandoverCancel; X2ap_HandoverCancel_t x2HandoverCancel;
memset (&x2HandoverCancel,0, sizeof(HandoverCancel_t)); memset (&x2HandoverCancel,0, sizeof(X2ap_HandoverCancel_t));
asn1_xer_print = 0; asn1_xer_print = 0;
asn_debug = 0; asn_debug = 0;
// encoding Reset request message // encoding Reset request message
if (x2ap_encode_handovercancel_ies(&x2HandoverCancel, handoverCancel_IEs) <0) { if (x2ap_encode_x2ap_handovercancel_ies(&x2HandoverCancel, handoverCancel_IEs) <0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
// encoding ProcedureCode_id_loadIndication // encoding ProcedureCode_id_loadIndication
if (x2ap_generate_initiating_message(buf, length, ProcedureCode_id_handoverCancel, Criticality_ignore, &asn_DEF_HandoverCancel, &x2HandoverCancel) <0) { if (x2ap_generate_initiating_message(buf, length, X2ap_ProcedureCode_id_handoverCancel, X2ap_Criticality_ignore, &asn_DEF_X2ap_HandoverCancel, &x2HandoverCancel) <0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
#ifdef X2AP_DEBUG_ENCODER
int i;
for (i=0;i< *length; i++) for (i=0;i< *length; i++)
{ {
printf ("0x%02x ", (*buf)[i]); printf ("0x%02x ", (*buf)[i]);
} }
printf ("\n"); printf ("\n");
#endif
return 0;
} }
static inline static inline
int x2ap_handover_report_encoder( HandoverReport_IEs_t *handoverReport_IEs, uint8_t **buf, uint32_t *length){ int x2ap_handover_report_encoder( X2ap_HandoverReport_IEs_t *handoverReport_IEs, uint8_t **buf, uint32_t *length){
int i;
HandoverReport_t HandoverReport; X2ap_HandoverReport_t HandoverReport;
memset (&HandoverReport,0, sizeof(HandoverReport_t)); memset (&HandoverReport,0, sizeof(X2ap_HandoverReport_t));
asn1_xer_print = 0; asn1_xer_print = 0;
asn_debug = 0; asn_debug = 0;
// encoding Reset request message // encoding Reset request message
if (x2ap_encode_handoverreport_ies(&HandoverReport, handoverReport_IEs) <0) { if (x2ap_encode_x2ap_handoverreport_ies(&HandoverReport, handoverReport_IEs) <0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
// encoding ProcedureCode_id_loadIndication // encoding ProcedureCode_id_loadIndication
if (x2ap_generate_initiating_message(buf, length, ProcedureCode_id_handoverReport, Criticality_ignore, &asn_DEF_HandoverReport, &HandoverReport) <0) { if (x2ap_generate_initiating_message(buf, length, X2ap_ProcedureCode_id_handoverReport, X2ap_Criticality_ignore, &asn_DEF_X2ap_HandoverReport, &HandoverReport) <0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
#ifdef X2AP_DEBUG_ENCODER
int i;
for (i=0;i< *length; i++) for (i=0;i< *length; i++)
{ {
printf ("0x%02x ", (*buf)[i]); printf ("0x%02x ", (*buf)[i]);
} }
printf ("\n"); printf ("\n");
#endif
return 0 ;
} }
static inline static inline
int x2ap_eNB_configuration_update_request_encoder(ENBConfigurationUpdate_IEs_t *enbConfigurationUpdate_IEs, uint8_t **buf, uint32_t *length){ int x2ap_eNB_configuration_update_request_encoder(X2ap_ENBConfigurationUpdate_IEs_t *enbConfigurationUpdate_IEs, uint8_t **buf, uint32_t *length){
int i;
ENBConfigurationUpdate_t x2ENBConfigurationUpdate; X2ap_ENBConfigurationUpdate_t x2ENBConfigurationUpdate;
memset (&x2ENBConfigurationUpdate,0, sizeof(ENBConfigurationUpdate_t)); memset (&x2ENBConfigurationUpdate,0, sizeof(X2ap_ENBConfigurationUpdate_t));
asn1_xer_print = 0; asn1_xer_print = 0;
asn_debug = 0; asn_debug = 0;
// encoding Reset request message // encoding Reset request message
if (x2ap_encode_enbconfigurationupdate_ies(&x2ENBConfigurationUpdate, enbConfigurationUpdate_IEs) <0) { if (x2ap_encode_x2ap_enbconfigurationupdate_ies(&x2ENBConfigurationUpdate, enbConfigurationUpdate_IEs) <0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
// encoding ProcedureCode_id_loadIndication // encoding ProcedureCode_id_loadIndication
if (x2ap_generate_initiating_message(buf, length, ProcedureCode_id_eNBConfigurationUpdate, Criticality_reject, &asn_DEF_ENBConfigurationUpdate, &x2ENBConfigurationUpdate) <0) { if (x2ap_generate_initiating_message(buf, length, X2ap_ProcedureCode_id_eNBConfigurationUpdate, X2ap_Criticality_reject, &asn_DEF_X2ap_ENBConfigurationUpdate, &x2ENBConfigurationUpdate) <0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
#ifdef X2AP_DEBUG_ENCODER
int i;
for (i=0;i< *length; i++) for (i=0;i< *length; i++)
{ {
printf ("0x%02x ", (*buf)[i]); printf ("0x%02x ", (*buf)[i]);
} }
printf ("\n"); printf ("\n");
#endif
return 0;
} }
static inline static inline
int x2ap_eNB_configuration_update_acknowledge_encoder(ENBConfigurationUpdateAcknowledge_IEs_t *enbConfigurationUpdateAcknowledge_IEs, uint8_t **buf, uint32_t *length){ int x2ap_eNB_configuration_update_acknowledge_encoder(X2ap_ENBConfigurationUpdateAcknowledge_IEs_t *enbConfigurationUpdateAcknowledge_IEs, uint8_t **buf, uint32_t *length){
int i; X2ap_ENBConfigurationUpdateAcknowledge_t x2ENBConfigurationUpdateAcknowledge;
memset (&x2ENBConfigurationUpdateAcknowledge,0, sizeof(X2ap_ENBConfigurationUpdateAcknowledge_t));
ENBConfigurationUpdateAcknowledge_t x2ENBConfigurationUpdateAcknowledge;
memset (&x2ENBConfigurationUpdateAcknowledge,0, sizeof(ENBConfigurationUpdateAcknowledge_t));
asn1_xer_print = 0; asn1_xer_print = 0;
asn_debug = 0; asn_debug = 0;
// encoding Reset request message // encoding Reset request message
if (x2ap_encode_enbconfigurationupdateacknowledge_ies(&x2ENBConfigurationUpdateAcknowledge, enbConfigurationUpdateAcknowledge_IEs) <0) { if (x2ap_encode_x2ap_enbconfigurationupdateacknowledge_ies(&x2ENBConfigurationUpdateAcknowledge, enbConfigurationUpdateAcknowledge_IEs) <0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
// encoding ProcedureCode_id_loadIndication // encoding ProcedureCode_id_loadIndication
if (x2ap_generate_successfull_outcome(buf, length, ProcedureCode_id_eNBConfigurationUpdate, Criticality_reject, &asn_DEF_ENBConfigurationUpdateAcknowledge, &x2ENBConfigurationUpdateAcknowledge) <0) { if (x2ap_generate_successfull_outcome(buf, length, X2ap_ProcedureCode_id_eNBConfigurationUpdate, X2ap_Criticality_reject, &asn_DEF_X2ap_ENBConfigurationUpdateAcknowledge, &x2ENBConfigurationUpdateAcknowledge) <0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
#ifdef X2AP_DEBUG_ENCODER
int i;
for (i=0;i< *length; i++) for (i=0;i< *length; i++)
{ {
printf ("0x%02x ", (*buf)[i]); printf ("0x%02x ", (*buf)[i]);
} }
printf ("\n"); printf ("\n");
#endif
return 0 ;
} }
static inline static inline
int x2ap_eNB_configuration_update_failure_encoder( ENBConfigurationUpdateFailure_IEs_t *enbConfigurationUpdateFailure_IEs, uint8_t **buf, uint32_t *length){ int x2ap_eNB_configuration_update_failure_encoder( X2ap_ENBConfigurationUpdateFailure_IEs_t *enbConfigurationUpdateFailure_IEs, uint8_t **buf, uint32_t *length){
int i;
ENBConfigurationUpdateFailure_t x2ENBConfigurationUpdateFailure; X2ap_ENBConfigurationUpdateFailure_t x2ENBConfigurationUpdateFailure;
memset (&x2ENBConfigurationUpdateFailure,0, sizeof(ENBConfigurationUpdateFailure_t)); memset (&x2ENBConfigurationUpdateFailure,0, sizeof(X2ap_ENBConfigurationUpdateFailure_t));
asn1_xer_print = 0; asn1_xer_print = 0;
asn_debug = 0; asn_debug = 0;
// encoding Reset request message // encoding Reset request message
if (x2ap_encode_enbconfigurationupdatefailure_ies(&x2ENBConfigurationUpdateFailure, enbConfigurationUpdateFailure_IEs) <0) { if (x2ap_encode_x2ap_enbconfigurationupdatefailure_ies(&x2ENBConfigurationUpdateFailure, enbConfigurationUpdateFailure_IEs) <0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
// encoding ProcedureCode_id_eNBConfigurationUpdate // encoding ProcedureCode_id_eNBConfigurationUpdate
if (x2ap_generate_unsuccessfull_outcome(buf, length, ProcedureCode_id_eNBConfigurationUpdate, Criticality_reject, &asn_DEF_ENBConfigurationUpdateFailure, &x2ENBConfigurationUpdateFailure) <0) { if (x2ap_generate_unsuccessfull_outcome(buf, length, X2ap_ProcedureCode_id_eNBConfigurationUpdate, X2ap_Criticality_reject, &asn_DEF_X2ap_ENBConfigurationUpdateFailure, &x2ENBConfigurationUpdateFailure) <0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
#ifdef X2AP_DEBUG_ENCODER
int i;
for (i=0;i< *length; i++) for (i=0;i< *length; i++)
{ {
printf ("0x%02x ", (*buf)[i]); printf ("0x%02x ", (*buf)[i]);
} }
printf ("\n"); printf ("\n");
#endif
return 0 ;
} }
static inline static inline
int x2ap_cell_activation_failure_encoder(CellActivationFailure_IEs_t *cellActivationFailure_IEs, uint8_t **buf, uint32_t *length){ int x2ap_cell_activation_failure_encoder(X2ap_CellActivationFailure_IEs_t *cellActivationFailure_IEs, uint8_t **buf, uint32_t *length){
int i; X2ap_CellActivationFailure_t cellActivationFailure;
CellActivationFailure_t cellActivationFailure; memset (&cellActivationFailure,0, sizeof(X2ap_CellActivationFailure_t));
memset (&cellActivationFailure,0, sizeof(CellActivationFailure_t));
asn1_xer_print = 0; asn1_xer_print = 0;
asn_debug = 0; asn_debug = 0;
// encoding cell activationfailure message // encoding cell activationfailure message
if (x2ap_encode_cellactivationfailure_ies(&cellActivationFailure,cellActivationFailure_IEs)<0) { if (x2ap_encode_x2ap_cellactivationfailure_ies(&cellActivationFailure,cellActivationFailure_IEs)<0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
// encoding ProcedureCode_id_cellActivation // encoding ProcedureCode_id_cellActivation
if (x2ap_generate_unsuccessfull_outcome (buf, length, ProcedureCode_id_cellActivation , Criticality_reject, &asn_DEF_CellActivationFailure, &cellActivationFailure) <0) if (x2ap_generate_unsuccessfull_outcome (buf, length, X2ap_ProcedureCode_id_cellActivation , X2ap_Criticality_reject, &asn_DEF_X2ap_CellActivationFailure, &cellActivationFailure) <0)
{ {
printf ("Initiating Message for Encode procedure failes\n"); printf ("Initiating Message for Encode procedure failes\n");
return -1; return -1;
} }
//Printing Buff values on terminal #ifdef X2AP_DEBUG_ENCODER
int i;
for (i=0;i< *length; i++) for (i=0;i< *length; i++)
{ {
printf ("0x%02x ", (*buf)[i]); printf ("0x%02x ", (*buf)[i]);
} }
printf ("\n"); printf ("\n");
#endif
return 0;
} }
static inline static inline
int x2ap_cell_activation_response_encoder(CellActivationResponse_IEs_t *cellActivationResponse_IEs, uint8_t **buf, uint32_t *length) { int x2ap_cell_activation_response_encoder(X2ap_CellActivationResponse_IEs_t *cellActivationResponse_IEs, uint8_t **buf, uint32_t *length) {
int i;
X2ap_CellActivationResponse_t cellActivationResponse;;
CellActivationResponse_t cellActivationResponse;; memset (&cellActivationResponse,0, sizeof(X2ap_CellActivationResponse_t));
memset (&cellActivationResponse,0, sizeof(CellActivationResponse_t));
asn1_xer_print = 0; asn1_xer_print = 0;
asn_debug = 0; asn_debug = 0;
// encoding Cell Activation Response message // encoding Cell Activation Response message
if (x2ap_encode_cellactivationresponse_ies(&cellActivationResponse,cellActivationResponse_IEs)<0) { if (x2ap_encode_x2ap_cellactivationresponse_ies(&cellActivationResponse,cellActivationResponse_IEs)<0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
// encoding ProcedureCode_id_cellActivation // encoding ProcedureCode_id_cellActivation
if (x2ap_generate_successfull_outcome (buf, length, ProcedureCode_id_cellActivation , Criticality_reject, &asn_DEF_CellActivationResponse, &cellActivationResponse) <0) if (x2ap_generate_successfull_outcome (buf, length, X2ap_ProcedureCode_id_cellActivation , X2ap_Criticality_reject, &asn_DEF_X2ap_CellActivationResponse, &cellActivationResponse) <0)
{ {
printf ("Initiating Message for Encode procedure failes\n"); printf ("Initiating Message for Encode procedure failes\n");
return -1; return -1;
} }
//Printing Buff values on terminal #ifdef X2AP_DEBUG_ENCODER
int i;
for (i=0;i< *length; i++) for (i=0;i< *length; i++)
{ {
printf ("0x%02x ", (*buf)[i]); printf ("0x%02x ", (*buf)[i]);
} }
printf ("\n"); printf ("\n");
#endif
return 0;
} }
static inline static inline
int x2ap_cell_activation_request_encoder(CellActivationRequest_IEs_t *cellActivationRequest_IEs, uint8_t **buf, uint32_t *length) { int x2ap_cell_activation_request_encoder(X2ap_CellActivationRequest_IEs_t *cellActivationRequest_IEs, uint8_t **buf, uint32_t *length) {
int i;
X2ap_CellActivationRequest_t cellActivationRequest;
CellActivationRequest_t cellActivationRequest; memset (&cellActivationRequest,0, sizeof(X2ap_CellActivationRequest_t));
memset (&cellActivationRequest,0, sizeof(CellActivationRequest_t));
asn1_xer_print = 0; asn1_xer_print = 0;
asn_debug = 0; asn_debug = 0;
// encoding cell Activation Request message // encoding cell Activation Request message
if (x2ap_encode_cellactivationrequest_ies(&cellActivationRequest,cellActivationRequest_IEs)<0) { if (x2ap_encode_x2ap_cellactivationrequest_ies(&cellActivationRequest,cellActivationRequest_IEs)<0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
// encoding ProcedureCode_id_cellActivation // encoding ProcedureCode_id_cellActivation
if (x2ap_generate_initiating_message (buf, length, ProcedureCode_id_cellActivation , Criticality_reject, &asn_DEF_CellActivationRequest, &cellActivationRequest) <0) if (x2ap_generate_initiating_message (buf, length, X2ap_ProcedureCode_id_cellActivation , X2ap_Criticality_reject, &asn_DEF_X2ap_CellActivationRequest, &cellActivationRequest) <0)
{ {
printf ("Initiating Message for Encode procedure failes\n"); printf ("Initiating Message for Encode procedure failes\n");
return -1; return -1;
} }
//Printing Buff values on terminal #ifdef X2AP_DEBUG_ENCODER
int i;
for (i=0;i< *length; i++) for (i=0;i< *length; i++)
{ {
printf ("0x%02x ", (*buf)[i]); printf ("0x%02x ", (*buf)[i]);
} }
printf ("\n"); printf ("\n");
#endif
return 0;
} }
static inline static inline
int x2ap_rlf_indication_encoder(RLFIndication_IEs_t *rlfIndication_IEs, uint8_t **buf, uint32_t *length) { int x2ap_rlf_indication_encoder(X2ap_RLFIndication_IEs_t *rlfIndication_IEs, uint8_t **buf, uint32_t *length) {
int i;
RLFIndication_t rlfIndication; X2ap_RLFIndication_t rlfIndication;
memset (&rlfIndication,0, sizeof(RLFIndication_t)); memset (&rlfIndication,0, sizeof(X2ap_RLFIndication_t));
asn1_xer_print = 0; asn1_xer_print = 0;
asn_debug = 0; asn_debug = 0;
// encoding RLF Indication message // encoding RLF Indication message
if (x2ap_encode_rlfindication_ies(&rlfIndication,rlfIndication_IEs)<0) { if (x2ap_encode_x2ap_rlfindication_ies(&rlfIndication,rlfIndication_IEs)<0)
{
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
// encoding ProcedureCode_id_rlfIndication // encoding ProcedureCode_id_rlfIndication
if (x2ap_generate_initiating_message (buf, length, ProcedureCode_id_rLFIndication , Criticality_reject, &asn_DEF_RLFIndication, &rlfIndication) <0) if (x2ap_generate_initiating_message (buf, length, X2ap_ProcedureCode_id_rLFIndication , X2ap_Criticality_reject, &asn_DEF_X2ap_RLFIndication, &rlfIndication) <0)
{ {
printf ("Initiating Message for Encode procedure failes\n"); printf ("Initiating Message for Encode procedure failes\n");
return -1; return -1;
} }
//Printing Buff values on terminal #ifdef X2AP_DEBUG_ENCODER
int i;
for (i=0;i< *length; i++) for (i=0;i< *length; i++)
{ {
printf ("0x%02x ", (*buf)[i]); printf ("0x%02x ", (*buf)[i]);
} }
printf ("\n"); printf ("\n");
#endif
return 0 ;
} }
static inline static inline
int x2ap_sn_status_transfer_encoder(SNStatusTransfer_IEs_t *snStatusTransfer_IEs, uint8_t **buf, uint32_t *length){ int x2ap_sn_status_transfer_encoder(X2ap_SNStatusTransfer_IEs_t *snStatusTransfer_IEs, uint8_t **buf, uint32_t *length){
int i;
SNStatusTransfer_t snStatusTransfer; X2ap_SNStatusTransfer_t snStatusTransfer;
memset (&snStatusTransfer,0, sizeof(SNStatusTransfer_t)); memset (&snStatusTransfer,0, sizeof(X2ap_SNStatusTransfer_t));
asn1_xer_print = 0; asn1_xer_print = 0;
asn_debug = 0; asn_debug = 0;
// encoding sn status transfer message // encoding sn status transfer message
if (x2ap_encode_snstatustransfer_ies(&snStatusTransfer,snStatusTransfer_IEs)<0) { if (x2ap_encode_x2ap_snstatustransfer_ies(&snStatusTransfer,snStatusTransfer_IEs)<0) {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
if (x2ap_generate_initiating_message (buf, length, ProcedureCode_id_snStatusTransfer , Criticality_reject, &asn_DEF_SNStatusTransfer, &snStatusTransfer) <0) if (x2ap_generate_initiating_message (buf, length, X2ap_ProcedureCode_id_snStatusTransfer , X2ap_Criticality_reject, &asn_DEF_X2ap_SNStatusTransfer, &snStatusTransfer) <0)
{ {
printf ("Initiating Message for Encode procedure failes\n"); printf ("Initiating Message for Encode procedure failes\n");
return -1; return -1;
} }
//Printing Buff values on terminal #ifdef X2AP_DEBUG_ENCODER
int i;
for (i=0;i< *length; i++) for (i=0;i< *length; i++)
{ {
printf ("0x%02x ", (*buf)[i]); printf ("0x%02x ", (*buf)[i]);
} }
printf ("\n"); printf ("\n");
#endif
return 0 ;
} }
static inline static inline
int x2ap_ue_context_release_encoder(UEContextRelease_IEs_t *uecontext_rel, uint8_t **buf, uint32_t *length){ int x2ap_ue_context_release_encoder(X2ap_UEContextRelease_IEs_t *uecontext_rel, uint8_t **buf, uint32_t *length){
int i;
UEContextRelease_t ueContextRelease; X2ap_UEContextRelease_t ueContextRelease;
memset (&ueContextRelease,0, sizeof(UEContextRelease_t)); memset (&ueContextRelease,0, sizeof(X2ap_UEContextRelease_t));
asn1_xer_print = 0; asn1_xer_print = 0;
asn_debug = 0; asn_debug = 0;
// encoding ue context release message // encoding ue context release message
if (x2ap_encode_uecontextrelease_ies(&ueContextRelease, uecontext_rel) <0) if (x2ap_encode_x2ap_uecontextrelease_ies(&ueContextRelease, uecontext_rel) <0)
{ {
printf ("Encode procedure failes\n"); printf ("Encode procedure failes\n");
return -1; return -1;
} }
//Procedure code for UE Context Release = "5" //Procedure code for UE Context Release = "5"
if (x2ap_generate_initiating_message (buf, length, ProcedureCode_id_uEContextRelease , Criticality_reject, &asn_DEF_UEContextRelease, &ueContextRelease) <0) if (x2ap_generate_initiating_message (buf, length, X2ap_ProcedureCode_id_uEContextRelease , X2ap_Criticality_reject, &asn_DEF_X2ap_UEContextRelease, &ueContextRelease) <0)
{ {
printf ("Initiating Message for Encode procedure failes\n"); printf ("Initiating Message for Encode procedure failes\n");
return -1; return -1;
} }
//Printing Buff values on terminal //Printing Buff values on terminal
#ifdef X2AP_DEBUG_ENCODER
int i;
for (i=0;i< *length; i++) for (i=0;i< *length; i++)
{ {
printf ("0x%02x ", (*buf)[i]); printf ("0x%02x ", (*buf)[i]);
} }
printf ("\n"); printf ("\n");
#endif
return 0 ;
} }
......
...@@ -30,7 +30,10 @@ ...@@ -30,7 +30,10 @@
#ifndef X2AP_ENB_ENCODER_H_ #ifndef X2AP_ENB_ENCODER_H_
#define X2AP_ENB_ENCODER_H_ #define X2AP_ENB_ENCODER_H_
int x2ap_eNB_encode_pdu(s1ap_message *message, uint8_t **buffer, uint32_t *len) #include "x2ap_common.h"
#include "x2ap_ies_defs.h"
int x2ap_eNB_encode_pdu(x2ap_message *x2ap_message_p, uint8_t **buffer, uint32_t *len)
__attribute__ ((warn_unused_result)); __attribute__ ((warn_unused_result));
#endif /* X2AP_ENB_ENCODER_H_ */ #endif /* X2AP_ENB_ENCODER_H_ */
...@@ -38,20 +38,21 @@ ...@@ -38,20 +38,21 @@
#include "intertask_interface.h" #include "intertask_interface.h"
#include "x2ap.h" #include "x2ap_eNB.h"
#include "x2ap_eNB_generate_messages.h"
#include "msc.h" #include "msc.h"
#include "assertions.h" #include "assertions.h"
static
int x2ap_eNB_generate_x2_setup_request(x2ap_eNB_instance_t *instance_p, int x2ap_eNB_generate_x2_setup_request(x2ap_eNB_instance_t *instance_p,
x2ap_enb_data_t *x2ap_enb_data_p){ x2ap_eNB_data_t *x2ap_enb_data_p){
x2ap_message message; x2ap_message message;
X2SetupRequest_IEs_t *x2SetupRequest_p; X2SetupRequest_IEs_t *x2SetupRequest;
X2ap_PLMN_Identity_t plmnIdentity; X2ap_PLMN_Identity_t plmnIdentity;
...@@ -74,7 +75,7 @@ int x2ap_eNB_generate_x2_setup_request(x2ap_eNB_instance_t *instance_p, ...@@ -74,7 +75,7 @@ int x2ap_eNB_generate_x2_setup_request(x2ap_eNB_instance_t *instance_p,
message.procedureCode = X2ap_ProcedureCode_id_X2Setup; message.procedureCode = X2ap_ProcedureCode_id_X2Setup;
message.criticality = X2ap_Criticality_reject; message.criticality = X2ap_Criticality_reject;
x2SetupRequest_p = &message.msg.x2SetupRequest_IEs; x2SetupRequest = &message.msg.x2SetupRequest_IEs;
memset((void *)&plmnIdentity, 0, sizeof(X2ap_PLMN_Identity_t)); memset((void *)&plmnIdentity, 0, sizeof(X2ap_PLMN_Identity_t));
memset((void *)&broadcast_plmnIdentity_1, 0, sizeof(X2ap_PLMN_Identity_t)); memset((void *)&broadcast_plmnIdentity_1, 0, sizeof(X2ap_PLMN_Identity_t));
...@@ -85,16 +86,16 @@ int x2ap_eNB_generate_x2_setup_request(x2ap_eNB_instance_t *instance_p, ...@@ -85,16 +86,16 @@ int x2ap_eNB_generate_x2_setup_request(x2ap_eNB_instance_t *instance_p,
x2ap_enb_data_p->state = X2AP_ENB_STATE_WAITING; x2ap_enb_data_p->state = X2AP_ENB_STATE_WAITING;
//----globalENB_ID------ //----globalENB_ID------
x2SetupRequest_p->global_ENB_ID.eNB_ID.present = X2ap_ENB_ID_PR_macro_eNB_ID; x2SetupRequest->global_ENB_ID.eNB_ID.present = X2ap_ENB_ID_PR_macro_eNB_ID;
MACRO_ENB_ID_TO_BIT_STRING(instance_p->eNB_id, MACRO_ENB_ID_TO_BIT_STRING(instance_p->eNB_id,
&x2SetupRequest_p->global_ENB_ID.eNB_ID.choice.macroENB_ID); &x2SetupRequest->global_ENB_ID.eNB_ID.choice.macroENB_ID);
MCC_MNC_TO_PLMNID(instance_p->mcc, instance_p->mnc, instance_p->mnc_digit_length, MCC_MNC_TO_PLMNID(instance_p->mcc, instance_p->mnc, instance_p->mnc_digit_length,
&x2SetupRequest_p->global_ENB_ID.pLMNidentity); &x2SetupRequest->global_ENB_ID.pLMNidentity);
X2AP_INFO("%d -> %02x%02x%02x\n", instance_p->eNB_id, X2AP_INFO("%d -> %02x%02x%02x\n", instance_p->eNB_id,
x2SetupRequest_p->global_ENB_ID.eNB_ID.choice.macroENB_ID.buf[0], x2SetupRequest->global_ENB_ID.eNB_ID.choice.macroENB_ID.buf[0],
x2SetupRequest_p->global_ENB_ID.eNB_ID.choice.macroENB_ID.buf[1], x2SetupRequest->global_ENB_ID.eNB_ID.choice.macroENB_ID.buf[1],
x2SetupRequest_p->global_ENB_ID.eNB_ID.choice.macroENB_ID.buf[2]); x2SetupRequest->global_ENB_ID.eNB_ID.choice.macroENB_ID.buf[2]);
//----served cells------ //----served cells------
#warning update the value of the message #warning update the value of the message
...@@ -116,13 +117,15 @@ int x2ap_eNB_generate_x2_setup_request(x2ap_eNB_instance_t *instance_p, ...@@ -116,13 +117,15 @@ int x2ap_eNB_generate_x2_setup_request(x2ap_eNB_instance_t *instance_p,
ECI_TO_BIT_STRING(instance_p->eNB_id, &served_cell->servedCellInfo.cellId.eUTRANcellIdentifier); ECI_TO_BIT_STRING(instance_p->eNB_id, &served_cell->servedCellInfo.cellId.eUTRANcellIdentifier);
TAC_TO_OCTET_STRING(instance_p->tac, &served_cell->servedCellInfo.tAC); TAC_TO_OCTET_STRING(instance_p->tac, &served_cell->servedCellInfo.tAC);
ASN_SEQUENCE_ADD(&x2SetupRequest_p->servedCells.list, served_cell); ASN_SEQUENCE_ADD(&x2SetupRequest->servedCells.list, served_cell);
if (x2ap_eNB_encode_pdu(&message, &buffer, &len) < 0) { if (x2ap_eNB_encode_pdu(&message, &buffer, &len) < 0) {
X2AP_ERROR("Failed to encode X2 setup request\n"); X2AP_ERROR("Failed to encode X2 setup request\n");
return -1; return -1;
} }
MSC_LOG_TX_MESSAGE (MSC_X2AP_SRC_ENB, MSC_X2AP_TARGET_ENB, NULL, 0, "0 X2Setup/initiatingMessage assoc_id %u", x2ap_enb_data_p->assoc_id);
/* Non UE-Associated signalling -> stream = 0 */ /* Non UE-Associated signalling -> stream = 0 */
x2ap_eNB_itti_send_sctp_data_req(instance_p->instance, x2ap_enb_data_p->assoc_id, buffer, len, 0); x2ap_eNB_itti_send_sctp_data_req(instance_p->instance, x2ap_enb_data_p->assoc_id, buffer, len, 0);
...@@ -130,6 +133,94 @@ int x2ap_eNB_generate_x2_setup_request(x2ap_eNB_instance_t *instance_p, ...@@ -130,6 +133,94 @@ int x2ap_eNB_generate_x2_setup_request(x2ap_eNB_instance_t *instance_p,
} }
int
x2ap_generate_x2_setup_response (x2ap_eNB_data_t * eNB_association)
{
x2ap_eNB_instance_t *instance=eNB_association->x2ap_eNB_instance;
x2ap_message message;
X2SetupResponse_IEs_t *x2SetupResponse;
X2ap_PLMN_Identity_t plmnIdentity;
X2ap_PLMN_Identity_t broadcast_plmnIdentity_1;
X2ap_PLMN_Identity_t broadcast_plmnIdentity_2;
X2ap_PLMN_Identity_t broadcast_plmnIdentity_3;
ServedCellItem_t *served_cell= malloc(sizeof(ServedCellItem_t));;
uint8_t *buffer;
uint32_t length;
int ret = 0;
// get the eNB instance
//
DevAssert (eNB_association != NULL);
// Generating response
memset (&message, 0, sizeof (x2ap_message));
message.direction = X2AP_PDU_PR_successfulOutcome
message.procedureCode = X2ap_ProcedureCode_id_X2Setup;
message.criticality = X2ap_Criticality_reject;
x2SetupResponse = &message.msg.x2SetupResponse_IEs;
memset((void *)&plmnIdentity, 0, sizeof(X2ap_PLMN_Identity_t));
memset((void *)&broadcast_plmnIdentity_1, 0, sizeof(X2ap_PLMN_Identity_t));
memset((void *)&broadcast_plmnIdentity_2, 0, sizeof(X2ap_PLMN_Identity_t));
memset((void *)&broadcast_plmnIdentity_3, 0, sizeof(X2ap_PLMN_Identity_t));
//----globalENB_ID------
x2SetupResponse->global_ENB_ID.eNB_ID.present = X2ap_ENB_ID_PR_macro_eNB_ID;
MACRO_ENB_ID_TO_BIT_STRING(instance_p->eNB_id,
&x2SetupResponse->global_ENB_ID.eNB_ID.choice.macroENB_ID);
MCC_MNC_TO_PLMNID(instance->mcc, instance->mnc, instance->mnc_digit_length,
&x2SetupResponse->global_ENB_ID.pLMNidentity);
X2AP_INFO("%d -> %02x%02x%02x\n", instance->eNB_id,
x2SetupResponse->global_ENB_ID.eNB_ID.choice.macroENB_ID.buf[0],
x2SetupResponse->global_ENB_ID.eNB_ID.choice.macroENB_ID.buf[1],
x2SetupResponse->global_ENB_ID.eNB_ID.choice.macroENB_ID.buf[2]);
//----served cells------
#warning update the value of the message
served_cell->servedCellInfo.pCI = 6;
served_cell->servedCellInfo.eUTRA_Mode_Info.present = EUTRA_Mode_Info_PR_fDD;
served_cell->servedCellInfo.eUTRA_Mode_Info.choice.fDD.uL_EARFCN = 3350;
served_cell->servedCellInfo.eUTRA_Mode_Info.choice.fDD.dL_EARFCN = 3350;
served_cell->servedCellInfo.eUTRA_Mode_Info.choice.fDD.uL_Transmission_Bandwidth = 0;
served_cell->servedCellInfo.eUTRA_Mode_Info.choice.fDD.dL_Transmission_Bandwidth = 0;
MCC_MNC_TO_PLMNID(instance->mcc,instance->mnc,&served_cell->servedCellInfo.cellId.pLMN_Identity);
MCC_MNC_TO_PLMNID(0,0,&broadcast_plmnid_1);
MCC_MNC_TO_PLMNID(0,0,&broadcast_plmnid_2);
MCC_MNC_TO_PLMNID(0,0,&broadcast_plmnid_3);
ASN_SEQUENCE_ADD(&served_cell->servedCellInfo.broadcastPLMNs.list, &broadcast_plmnid_1);
ASN_SEQUENCE_ADD(&served_cell->servedCellInfo.broadcastPLMNs.list, &broadcast_plmnid_2);
ASN_SEQUENCE_ADD(&served_cell->servedCellInfo.broadcastPLMNs.list, &broadcast_plmnid_3);
ECI_TO_BIT_STRING(instance->eNB_id, &served_cell->servedCellInfo.cellId.eUTRANcellIdentifier);
TAC_TO_OCTET_STRING(instance->tac, &served_cell->servedCellInfo.tAC);
ASN_SEQUENCE_ADD(&x2SetupRequest->servedCells.list, served_cell);
if (x2ap_eNB_encode_pdu(&message, &buffer, &len) < 0) {
X2AP_ERROR("Failed to encode X2 setup request\n");
return -1;
}
MSC_LOG_TX_MESSAGE (MSC_X2AP_TARGET_ENB, MSC_X2AP_SRC_ENB, NULL, 0, "0 X2Setup/successfulOutcome assoc_id %u", eNB_association->assoc_id);
/*
* Non-UE signalling -> stream 0
*/
return x2ap_eNB_itti_send_sctp_req (buffer, length, eNB_association->assoc_id, 0);
}
int x2ap_eNB_generate_x2_setup_failure ( uint32_t assoc_id, int x2ap_eNB_generate_x2_setup_failure ( uint32_t assoc_id,
X2ap_Cause_PR cause_type, X2ap_Cause_PR cause_type,
long cause_value, long cause_value,
......
/*******************************************************************************
OpenAirInterface
Copyright(c) 1999 - 2014 Eurecom
OpenAirInterface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenAirInterface is distributed in the hope that 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 OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
see <http://www.gnu.org/licenses/>.
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
*******************************************************************************/
#ifndef X2AP_ENB_GENERATE_MESSAGES_H_
#define X2AP_ENB_GENERATE_MESSAGES_H_
int x2ap_eNB_generate_x2_setup_request(x2ap_eNB_instance_t *instance_p,
x2ap_eNB_data_t *x2ap_enb_data_p);
int
x2ap_generate_x2_setup_response (x2ap_eNB_data_t * eNB_association);
int x2ap_eNB_generate_x2_setup_failure ( uint32_t assoc_id,
X2ap_Cause_PR cause_type,
long cause_value,
long time_to_waitx);
#endif /* X2AP_ENB_GENERATE_MESSAGES_H_ */
...@@ -44,10 +44,11 @@ ...@@ -44,10 +44,11 @@
#include "x2ap_ies_defs.h" #include "x2ap_ies_defs.h"
// #include "s1ap_eNB.h" // #include "s1ap_eNB.h"
#include "x2ap_eNB_defs.h" #include "x2ap_eNB_defs.h"
#include "x2ap_eNB_handlers.h" #include "x2ap_eNB_handler.h"
#include "x2ap_eNB_decoder.h" #include "x2ap_eNB_decoder.h"
#include "x2ap_eNB_management_procedures.h" #include "x2ap_eNB_management_procedures.h"
#include "x2ap_eNB_generate_messages.h"
//#include "x2ap_eNB_default_values.h" //#include "x2ap_eNB_default_values.h"
...@@ -55,6 +56,10 @@ ...@@ -55,6 +56,10 @@
#include "conversions.h" #include "conversions.h"
#include "msc.h" #include "msc.h"
static
int x2ap_eNB_handle_x2_setup_request (uint32_t assoc_id,
uint32_t stream,
struct x2ap_message_s *message);
static static
int x2ap_eNB_handle_x2_setup_response(uint32_t assoc_id, int x2ap_eNB_handle_x2_setup_response(uint32_t assoc_id,
uint32_t stream, uint32_t stream,
...@@ -123,7 +128,7 @@ int x2ap_eNB_handle_message(uint32_t assoc_id, int32_t stream, ...@@ -123,7 +128,7 @@ int x2ap_eNB_handle_message(uint32_t assoc_id, int32_t stream,
} }
/* Checking procedure Code and direction of message */ /* Checking procedure Code and direction of message */
if (message.procedureCode > sizeof(messages_callback) / (3 * sizeof(x2ap_message_decoded_callback)) if (message.procedureCode > sizeof(x2ap_messages_callback) / (3 * sizeof(x2ap_message_decoded_callback))
|| (message.direction > X2AP_PDU_PR_unsuccessfulOutcome)) { || (message.direction > X2AP_PDU_PR_unsuccessfulOutcome)) {
X2AP_ERROR("[SCTP %d] Either procedureCode %d or direction %d exceed expected\n", X2AP_ERROR("[SCTP %d] Either procedureCode %d or direction %d exceed expected\n",
assoc_id, message.procedureCode, message.direction); assoc_id, message.procedureCode, message.direction);
...@@ -134,9 +139,9 @@ int x2ap_eNB_handle_message(uint32_t assoc_id, int32_t stream, ...@@ -134,9 +139,9 @@ int x2ap_eNB_handle_message(uint32_t assoc_id, int32_t stream,
* This can mean not implemented or no procedure for eNB (wrong direction). * This can mean not implemented or no procedure for eNB (wrong direction).
*/ */
if (x2ap_messages_callback[message.procedureCode][message.direction-1] == NULL) { if (x2ap_messages_callback[message.procedureCode][message.direction-1] == NULL) {
S1AP_ERROR("[SCTP %d] No handler for procedureCode %d in %s\n", X2AP_ERROR("[SCTP %d] No handler for procedureCode %d in %s\n",
assoc_id, message.procedureCode, assoc_id, message.procedureCode,
s1ap_direction2String[message.direction]); x2ap_direction2String[message.direction]);
return -1; return -1;
} }
...@@ -146,7 +151,7 @@ int x2ap_eNB_handle_message(uint32_t assoc_id, int32_t stream, ...@@ -146,7 +151,7 @@ int x2ap_eNB_handle_message(uint32_t assoc_id, int32_t stream,
} }
void x2ap_handle_x2_setup_message(x2ap_enb_data_t *enb_desc_p, int sctp_shutdown) void x2ap_handle_x2_setup_message(x2ap_eNB_data_t *enb_desc_p, int sctp_shutdown)
{ {
if (sctp_shutdown) { if (sctp_shutdown) {
/* A previously connected eNB has been shutdown */ /* A previously connected eNB has been shutdown */
...@@ -155,13 +160,13 @@ void x2ap_handle_x2_setup_message(x2ap_enb_data_t *enb_desc_p, int sctp_shutdown ...@@ -155,13 +160,13 @@ void x2ap_handle_x2_setup_message(x2ap_enb_data_t *enb_desc_p, int sctp_shutdown
if (enb_desc_p->state == X2AP_ENB_STATE_CONNECTED) { if (enb_desc_p->state == X2AP_ENB_STATE_CONNECTED) {
enb_desc_p->state = X2AP_ENB_STATE_DISCONNECTED; enb_desc_p->state = X2AP_ENB_STATE_DISCONNECTED;
if (enb_desc_p->x2ap_eNB_instance->x2ap_enb_associated_nb > 0) { if (enb_desc_p->x2ap_eNB_instance-> x2_target_enb_associated_nb > 0) {
/* Decrease associated eNB number */ /* Decrease associated eNB number */
enb_desc_p->x2ap_eNB_instance->x2ap_enb_associated_nb --; enb_desc_p->x2ap_eNB_instance-> x2_target_enb_associated_nb --;
} }
/* If there are no more associated eNB, inform eNB app */ /* If there are no more associated eNB, inform eNB app */
if (enb_desc_p->x2ap_eNB_instance->x2ap_enb_associated_nb == 0) { if (enb_desc_p->x2ap_eNB_instance->x2_target_enb_associated_nb == 0) {
MessageDef *message_p; MessageDef *message_p;
message_p = itti_alloc_new_message(TASK_X2AP, X2AP_DEREGISTERED_ENB_IND); message_p = itti_alloc_new_message(TASK_X2AP, X2AP_DEREGISTERED_ENB_IND);
...@@ -171,21 +176,21 @@ void x2ap_handle_x2_setup_message(x2ap_enb_data_t *enb_desc_p, int sctp_shutdown ...@@ -171,21 +176,21 @@ void x2ap_handle_x2_setup_message(x2ap_enb_data_t *enb_desc_p, int sctp_shutdown
} }
} else { } else {
/* Check that at least one setup message is pending */ /* Check that at least one setup message is pending */
DevCheck(enb_desc_p->x2ap_eNB_instance->x2ap_enb_pending_nb > 0, DevCheck(enb_desc_p->x2ap_eNB_instance->x2_target_enb_pending_nb > 0,
enb_desc_p->x2ap_eNB_instance->instance, enb_desc_p->x2ap_eNB_instance->instance,
enb_desc_p->x2ap_eNB_instance->x2ap_enb_pending_nb, 0); enb_desc_p->x2ap_eNB_instance->x2_target_enb_pending_nb, 0);
if (enb_desc_p->x2ap_eNB_instance->x2ap_enb_pending_nb > 0) { if (enb_desc_p->x2ap_eNB_instance->x2_target_enb_pending_nb > 0) {
/* Decrease pending messages number */ /* Decrease pending messages number */
enb_desc_p->x2ap_eNB_instance->x2ap_enb_pending_nb --; enb_desc_p->x2ap_eNB_instance->x2_target_enb_pending_nb --;
} }
/* If there are no more pending messages, inform eNB app */ /* If there are no more pending messages, inform eNB app */
if (enb_desc_p->x2ap_eNB_instance->x2ap_enb_pending_nb == 0) { if (enb_desc_p->x2ap_eNB_instance->x2_target_enb_pending_nb == 0) {
MessageDef *message_p; MessageDef *message_p;
message_p = itti_alloc_new_message(TASK_X2AP, X2AP_REGISTER_ENB_CNF); message_p = itti_alloc_new_message(TASK_X2AP, X2AP_REGISTER_ENB_CNF);
X2AP_REGISTER_ENB_CNF(message_p).nb_x2 = enb_desc_p->x2ap_eNB_instance->x2ap_enb_associated_nb; X2AP_REGISTER_ENB_CNF(message_p).nb_x2 = enb_desc_p->x2ap_eNB_instance->x2_target_enb_associated_nb;
itti_send_msg_to_task(TASK_ENB_APP, enb_desc_p->x2ap_eNB_instance->instance, message_p); itti_send_msg_to_task(TASK_ENB_APP, enb_desc_p->x2ap_eNB_instance->instance, message_p);
} }
} }
...@@ -199,15 +204,14 @@ x2ap_eNB_handle_x2_setup_request (uint32_t assoc_id, ...@@ -199,15 +204,14 @@ x2ap_eNB_handle_x2_setup_request (uint32_t assoc_id,
{ {
X2SetupRequest_IEs_t *x2SetupRequest_p; X2SetupRequest_IEs_t *x2SetupRequest;
eNB_description_t *eNB_association; x2ap_eNB_data_t *x2ap_eNB_data;
uint32_t eNB_id = 0; uint32_t eNB_id = 0;
char *eNB_name = NULL;
int ta_ret; int ta_ret;
uint16_t max_enb_connected; //uint16_t max_enb_connected;
DevAssert (message != NULL); DevAssert (message != NULL);
x2SetupRequest_p = &message->msg.X2SetupRequestIEs; x2SetupRequest = &message->msg.x2SetupRequest_IEs;
/* /*
* We received a new valid X2 Setup Request on a stream != 0. * We received a new valid X2 Setup Request on a stream != 0.
* * * * This should not happen -> reject eNB s1 setup request. * * * * This should not happen -> reject eNB s1 setup request.
...@@ -231,11 +235,11 @@ x2ap_eNB_handle_x2_setup_request (uint32_t assoc_id, ...@@ -231,11 +235,11 @@ x2ap_eNB_handle_x2_setup_request (uint32_t assoc_id,
X2AP_DEBUG ("Received a new X2 setup request\n"); X2AP_DEBUG ("Received a new X2 setup request\n");
if (x2SetupRequest_p->global_ENB_ID.eNB_ID.present == X2ap_ENB_ID_PR_homeENB_ID) { if (x2SetupRequest->globalENB_ID.eNB_ID.present == X2ap_ENB_ID_PR_home_eNB_ID) {
// Home eNB ID = 28 bits // Home eNB ID = 28 bits
uint8_t *eNB_id_buf = x2SetupRequest_p->global_ENB_ID.eNB_ID.choice.homeENB_ID.buf; uint8_t *eNB_id_buf = x2SetupRequest->globalENB_ID.eNB_ID.choice.home_eNB_ID.buf;
if (x2SetupRequest_p->global_ENB_ID.eNB_ID.choice.macroENB_ID.size != 28) { if (x2SetupRequest->globalENB_ID.eNB_ID.choice.macro_eNB_ID.size != 28) {
//TODO: handle case were size != 28 -> notify ? reject ? //TODO: handle case were size != 28 -> notify ? reject ?
} }
...@@ -243,9 +247,9 @@ x2ap_eNB_handle_x2_setup_request (uint32_t assoc_id, ...@@ -243,9 +247,9 @@ x2ap_eNB_handle_x2_setup_request (uint32_t assoc_id,
X2AP_DEBUG ("Home eNB id: %07x\n", eNB_id); X2AP_DEBUG ("Home eNB id: %07x\n", eNB_id);
} else { } else {
// Macro eNB = 20 bits // Macro eNB = 20 bits
uint8_t *eNB_id_buf = x2SetupRequest_p->global_ENB_ID.eNB_ID.choice.macroENB_ID.buf; uint8_t *eNB_id_buf = x2SetupRequest->globalENB_ID.eNB_ID.choice.macro_eNB_ID.buf;
if (x2SetupRequest_p->global_ENB_ID.eNB_ID.choice.macroENB_ID.size != 20) { if (x2SetupRequest->globalENB_ID.eNB_ID.choice.macro_eNB_ID.size != 20) {
//TODO: handle case were size != 20 -> notify ? reject ? //TODO: handle case were size != 20 -> notify ? reject ?
} }
...@@ -273,40 +277,41 @@ x2ap_eNB_handle_x2_setup_request (uint32_t assoc_id, ...@@ -273,40 +277,41 @@ x2ap_eNB_handle_x2_setup_request (uint32_t assoc_id,
*/ */
X2AP_DEBUG ("Adding eNB to the list of associated eNBs\n"); X2AP_DEBUG ("Adding eNB to the list of associated eNBs\n");
if ((eNB_association = x2ap_is_eNB_id_in_list (eNB_id)) == NULL) { if ((x2ap_eNB_data = x2ap_is_eNB_id_in_list (eNB_id)) == NULL) {
/* /*
* eNB has not been fount in list of associated eNB, * eNB has not been fount in list of associated eNB,
* * * * Add it to the tail of list and initialize data * * * * Add it to the tail of list and initialize data
*/ */
if ((eNB_association = s1ap_is_eNB_assoc_id_in_list (assoc_id)) == NULL) { if ((x2ap_eNB_data = x2ap_is_eNB_assoc_id_in_list (assoc_id)) == NULL) {
/* /*
* ?? * ??
*/ */
return -1; return -1;
} else { } else {
eNB_association->x2_state = X2AP_RESETING; x2ap_eNB_data->state = X2AP_ENB_STATE_RESETTING;
eNB_association->eNB_id = eNB_id; x2ap_eNB_data->eNB_id = eNB_id;
} }
} else { } else {
eNB_association->s1_state = X2AP_RESETING; x2ap_eNB_data->state = X2AP_ENB_STATE_RESETTING;
/* /*
* eNB has been fount in list, consider the s1 setup request as a reset connection, * eNB has been fount in list, consider the s1 setup request as a reset connection,
* * * * reseting any previous UE state if sctp association is != than the previous one * * * * reseting any previous UE state if sctp association is != than the previous one
*/ */
if (eNB_association->sctp_assoc_id != assoc_id) { if (x2ap_eNB_data->assoc_id != assoc_id) {
X2SetupFailureIEs_t x2SetupFailure; X2SetupFailure_IEs_t x2SetupFailure;
memset (&x2SetupFailure, 0, sizeof (x2SetupFailure)); memset (&x2SetupFailure, 0, sizeof (x2SetupFailure));
/* /*
* Send an overload cause... * Send an overload cause...
*/ */
s1SetupFailure.cause.present = X2ap_Cause_PR_misc; //TODO: send the right cause X2AP_ERROR ("Rejeting x2 setup request as eNB id %d is already associated to an active sctp association" "Previous known: %d, new one: %d\n", eNB_id, x2ap_eNB_data->assoc_id, assoc_id);
s1SetupFailure.cause.choice.misc = X2ap_CauseMisc_control_processing_overload; x2ap_eNB_generate_x2_setup_failure (assoc_id,
X2AP_ERROR ("Rejeting x2 setup request as eNB id %d is already associated to an active sctp association" "Previous known: %d, new one: %d\n", eNB_id, eNB_association->sctp_assoc_id, assoc_id); X2ap_Cause_PR_protocol,
// x2ap_enb_encode_x2setupfailure(&x2SetupFailure, X2ap_CauseProtocol_unspecified,
// receivedMessage->msg.s1ap_sctp_new_msg_ind.assocId); -1);
return -1; return -1;
} }
...@@ -315,7 +320,7 @@ x2ap_eNB_handle_x2_setup_request (uint32_t assoc_id, ...@@ -315,7 +320,7 @@ x2ap_eNB_handle_x2_setup_request (uint32_t assoc_id,
*/ */
} }
return x2ap_generate_x2_setup_response (eNB_association); return x2ap_generate_x2_setup_response (x2ap_eNB_data);
} }
...@@ -324,36 +329,37 @@ int x2ap_eNB_handle_x2_setup_failure(uint32_t assoc_id, ...@@ -324,36 +329,37 @@ int x2ap_eNB_handle_x2_setup_failure(uint32_t assoc_id,
uint32_t stream, uint32_t stream,
struct x2ap_message_s *message_p) struct x2ap_message_s *message_p)
{ {
#ifdef 0
X2SetupFailureIEs_t *s1_setup_failure_p; X2SetupFailure_IEs_t *x2_setup_failure;
x2ap_eNB_data_t *enb_desc_p; x2ap_eNB_data_t *enb_desc;
DevAssert(message_p != NULL); DevAssert(message_p != NULL);
s1_setup_failure_p = &message_p->msg.s1ap_S1SetupFailureIEs; x2_setup_failure = &message_p->msg.x2SetupFailure_IEs;
/* S1 Setup Failure == Non UE-related procedure -> stream 0 */ /* S1 Setup Failure == Non UE-related procedure -> stream 0 */
if (stream != 0) { if (stream != 0) {
S1AP_WARN("[SCTP %d] Received s1 setup failure on stream != 0 (%d)\n", X2AP_WARN("[SCTP %d] Received s1 setup failure on stream != 0 (%d)\n",
assoc_id, stream); assoc_id, stream);
} }
if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) { if ((enb_desc = x2ap_get_eNB (NULL, assoc_id, 0)) == NULL) {
S1AP_ERROR("[SCTP %d] Received S1 setup response for non existing " X2AP_ERROR("[SCTP %d] Received X2 setup response for non existing "
"MME context\n", assoc_id); "eNB context\n", assoc_id);
return -1; return -1;
} }
if ((s1_setup_failure_p->cause.present == S1ap_Cause_PR_misc) && // need a FSM to handle all cases
(s1_setup_failure_p->cause.choice.misc == S1ap_CauseMisc_unspecified)) { if ((x2_setup_failure->cause.present == X2ap_Cause_PR_misc) &&
S1AP_WARN("Received s1 setup failure for MME... MME is not ready\n"); (x2_setup_failure->cause.choice.misc == X2ap_CauseMisc_unspecified)) {
X2AP_WARN("Received X2 setup failure for eNB ... eNB is not ready\n");
} else { } else {
S1AP_ERROR("Received s1 setup failure for MME... please check your parameters\n"); S1AP_ERROR("Received x2 setup failure for eNB... please check your parameters\n");
} }
mme_desc_p->state = S1AP_ENB_STATE_WAITING; enb_desc->state = X2AP_ENB_STATE_WAITING;
s1ap_handle_s1_setup_message(mme_desc_p, 0); x2ap_handle_x2_setup_message(enb_desc, 0);
#endif
return 0; return 0;
} }
...@@ -362,8 +368,8 @@ int x2ap_eNB_handle_x2_setup_response(uint32_t assoc_id, ...@@ -362,8 +368,8 @@ int x2ap_eNB_handle_x2_setup_response(uint32_t assoc_id,
uint32_t stream, uint32_t stream,
struct x2ap_message_s *message_p) struct x2ap_message_s *message_p)
{ {
#ifdef 0 #ifdef TBD
S1ap_S1SetupResponseIEs_t *s1SetupResponse_p; S1ap_S1SetupResponseIEs_t *s1SetupResponse;
s1ap_eNB_mme_data_t *mme_desc_p; s1ap_eNB_mme_data_t *mme_desc_p;
int i; int i;
...@@ -479,7 +485,7 @@ int x2ap_eNB_handle_error_indication(uint32_t assoc_id, ...@@ -479,7 +485,7 @@ int x2ap_eNB_handle_error_indication(uint32_t assoc_id,
{ {
#ifdef 0 #ifdef TBD
X2ap_ErrorIndicationIEs_t *x2_error_indication_p; X2ap_ErrorIndicationIEs_t *x2_error_indication_p;
x2ap_eNB_data_t *enb_desc_p; x2ap_eNB_data_t *enb_desc_p;
...@@ -493,7 +499,7 @@ int x2ap_eNB_handle_error_indication(uint32_t assoc_id, ...@@ -493,7 +499,7 @@ int x2ap_eNB_handle_error_indication(uint32_t assoc_id,
assoc_id, stream); assoc_id, stream);
} }
if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) { if ((mme_desc_p = x2ap_get_eNB(NULL, assoc_id, 0)) == NULL) {
S1AP_ERROR("[SCTP %d] Received S1 Error indication for non existing " S1AP_ERROR("[SCTP %d] Received S1 Error indication for non existing "
"MME context\n", assoc_id); "MME context\n", assoc_id);
return -1; return -1;
...@@ -731,3 +737,5 @@ int x2ap_eNB_handle_error_indication(uint32_t assoc_id, ...@@ -731,3 +737,5 @@ int x2ap_eNB_handle_error_indication(uint32_t assoc_id,
return 0; return 0;
} }
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
#ifndef X2AP_ENB_HANDLERS_H_ #ifndef X2AP_ENB_HANDLERS_H_
#define X2AP_ENB_HANDLERS_H_ #define X2AP_ENB_HANDLERS_H_
#include "x2ap_eNB_defs.h"
void x2ap_handle_x2_setup_message(x2ap_eNB_data_t *mme_desc_p, int sctp_shutdown); void x2ap_handle_x2_setup_message(x2ap_eNB_data_t *mme_desc_p, int sctp_shutdown);
int x2ap_eNB_handle_message(uint32_t assoc_id, int32_t stream, int x2ap_eNB_handle_message(uint32_t assoc_id, int32_t stream,
......
...@@ -47,28 +47,8 @@ void x2ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uin ...@@ -47,28 +47,8 @@ void x2ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uin
itti_send_msg_to_task(TASK_SCTP, instance, message_p); itti_send_msg_to_task(TASK_SCTP, instance, message_p);
} }
/*
void x2ap_eNB_itti_send_nas_downlink_ind(instance_t instance,
uint16_t ue_initial_id,
uint32_t eNB_ue_s1ap_id,
uint8_t *nas_pdu,
uint32_t nas_pdu_length)
{
MessageDef *message_p;
x2ap_rrc_t *x2ap_rrc;
message_p = itti_alloc_new_message(TASK_X2AP, X2AP_RRC);
x2ap_rrc = &message_p->ittiMsg.x2ap_rrc;
x2ap_rrc->ue_initial_id = ue_initial_id;
x2ap_rrc->eNB_ue_x2ap_id = eNB_ue_x2ap_id;
x2ap_rrc->rrc_pdu.buffer = rrc_pdu;
x2ap_rrc->rrc_pdu.length = rrc_pdu_length;
itti_send_msg_to_task(TASK_RRC_ENB, instance, message_p);
}
*/
void x2ap_eNB_itti_send_sctp_close_association(instance_t instance, int32_t assoc_id) void x2ap_eNB_itti_send_sctp_close_association(instance_t instance, int32_t assoc_id)
{ {
MessageDef *message_p = NULL; MessageDef *message_p = NULL;
......
/*******************************************************************************
OpenAirInterface
Copyright(c) 1999 - 2014 Eurecom
OpenAirInterface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenAirInterface is distributed in the hope that 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 OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
see <http://www.gnu.org/licenses/>.
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
*******************************************************************************/
#ifndef X2AP_ENB_ITTI_MESSAGING_H_
#define X2AP_ENB_ITTI_MESSAGING_H_
void x2ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer,
uint32_t buffer_length, uint16_t stream);
void x2ap_eNB_itti_send_sctp_close_association(instance_t instance,
int32_t assoc_id);
#endif /* X2AP_ENB_ITTI_MESSAGING_H_ */
...@@ -38,7 +38,20 @@ ...@@ -38,7 +38,20 @@
#include "x2ap_common.h" #include "x2ap_common.h"
#include "x2ap_eNB_defs.h" #include "x2ap_eNB_defs.h"
#include "x2ap.h" #include "x2ap_eNB.h"
#define X2AP_DEBUG_LIST
#ifdef X2AP_DEBUG_LIST
# define X2AP_eNB_LIST_OUT(x, args...) X2AP_DEBUG("[eNB]%*s"x"\n", 4*indent, "", ##args)
#else
# define X2AP_eNB_LIST_OUT(x, args...)
#endif
STAILQ_HEAD (x2ap_eNB_list_s, x2ap_eNB_data_s)
x2ap_eNB_list_head;
static int indent = 0;
x2ap_eNB_internal_data_t x2ap_eNB_internal_data; x2ap_eNB_internal_data_t x2ap_eNB_internal_data;
...@@ -88,9 +101,9 @@ void x2ap_eNB_insert_new_instance(x2ap_eNB_instance_t *new_instance_p) ...@@ -88,9 +101,9 @@ void x2ap_eNB_insert_new_instance(x2ap_eNB_instance_t *new_instance_p)
new_instance_p, x2ap_eNB_entries); new_instance_p, x2ap_eNB_entries);
} }
struct s1ap_eNB_mme_data_s *x2ap_eNB_get_taregt_eNB( struct x2ap_eNB_data_s *x2ap_get_eNB(x2ap_eNB_instance_t *instance_p,
x2ap_eNB_instance_t *instance_p, int32_t assoc_id,
int32_t assoc_id, uint16_t cnx_id) uint16_t cnx_id)
{ {
struct x2ap_eNB_data_s temp; struct x2ap_eNB_data_s temp;
struct x2ap_eNB_data_s *found; struct x2ap_eNB_data_s *found;
...@@ -116,6 +129,7 @@ struct s1ap_eNB_mme_data_s *x2ap_eNB_get_taregt_eNB( ...@@ -116,6 +129,7 @@ struct s1ap_eNB_mme_data_s *x2ap_eNB_get_taregt_eNB(
return NULL; return NULL;
} }
x2ap_eNB_instance_t *x2ap_eNB_get_instance(instance_t instance) x2ap_eNB_instance_t *x2ap_eNB_get_instance(instance_t instance)
{ {
x2ap_eNB_instance_t *temp = NULL; x2ap_eNB_instance_t *temp = NULL;
...@@ -130,3 +144,58 @@ x2ap_eNB_instance_t *x2ap_eNB_get_instance(instance_t instance) ...@@ -130,3 +144,58 @@ x2ap_eNB_instance_t *x2ap_eNB_get_instance(instance_t instance)
return NULL; return NULL;
} }
/// utility functions
void
x2ap_dump_eNB_list (void) {
x2ap_eNB_data_t *eNB_ref;
STAILQ_FOREACH (eNB_ref, &x2ap_eNB_list_head, x2ap_eNB_entries) {
x2ap_dump_eNB (eNB_ref);
}
}
void x2ap_dump_eNB ( x2ap_eNB_data_t * eNB_ref)
{
if (eNB_ref == NULL) {
return;
}
eNB_LIST_OUT ("");
eNB_LIST_OUT ("eNB name: %s", eNB_ref->eNB_name == NULL ? "not present" : eNB_ref->eNB_name);
eNB_LIST_OUT ("eNB ID: %07x", eNB_ref->eNB_id);
indent++;
eNB_LIST_OUT ("SCTP assoc id: %d", eNB_ref->assoc_id);
eNB_LIST_OUT ("SCTP instreams: %d", eNB_ref->instreams);
eNB_LIST_OUT ("SCTP outstreams: %d", eNB_ref->outstreams);
indent--;
}
x2ap_eNB_data_t * x2ap_is_eNB_id_in_list (const uint32_t eNB_id)
{
x2ap_eNB_data_t *eNB_ref;
STAILQ_FOREACH (eNB_ref, &x2ap_eNB_list_head, x2ap_eNB_entries) {
if (eNB_ref->eNB_id == eNB_id) {
return eNB_ref;
}
}
return NULL;
}
x2ap_eNB_data_t * x2ap_is_eNB_assoc_id_in_list (const uint32_t sctp_assoc_id)
{
x2ap_eNB_data_t *eNB_ref;
STAILQ_FOREACH (eNB_ref, &x2ap_eNB_list_head, x2ap_eNB_entries) {
if (eNB_ref->sctp_assoc_id == sctp_assoc_id) {
return eNB_ref;
}
}
return NULL;
}
...@@ -42,4 +42,8 @@ uint16_t x2ap_eNB_fetch_add_global_cnx_id(void); ...@@ -42,4 +42,8 @@ uint16_t x2ap_eNB_fetch_add_global_cnx_id(void);
void x2ap_eNB_prepare_internal_data(void); void x2ap_eNB_prepare_internal_data(void);
x2ap_eNB_data_t* x2ap_is_eNB_id_in_list(uint32_t eNB_id);
x2ap_eNB_data_t* x2ap_is_eNB_assoc_id_in_list(uint32_t sctp_assoc_id);
#endif /* X2AP_ENB_MANAGEMENT_PROCEDURES_H_ */ #endif /* X2AP_ENB_MANAGEMENT_PROCEDURES_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment