F1:
1.create the f1ap handlers procedure 2.hide asn1c warning when in compile
This commit is contained in:
@@ -323,7 +323,9 @@ set (RRC_FULL_DIR ${asn1_generated_dir}/RRC_${RRC_ASN1_VERSION})
|
||||
message("calling asn1c -pdu=all -fcompound-names -gen-PER -no-gen-OER -no-gen-example -D ${RRC_FULL_DIR} ${RRC_GRAMMAR}")
|
||||
execute_process(COMMAND mkdir -p ${RRC_FULL_DIR}
|
||||
COMMAND env asn1c -pdu=all -fcompound-names -gen-PER -no-gen-OER -no-gen-example -D ${RRC_FULL_DIR} ${RRC_GRAMMAR}
|
||||
RESULT_VARIABLE ret)
|
||||
RESULT_VARIABLE ret
|
||||
OUTPUT_QUIET
|
||||
ERROR_QUIET)
|
||||
if (NOT ${ret} STREQUAL 0)
|
||||
message(FATAL_ERROR "${ret}: error")
|
||||
endif (NOT ${ret} STREQUAL 0)
|
||||
@@ -384,7 +386,10 @@ set(S1AP_C_DIR ${asn1_generated_dir}/S1AP_${S1AP_RELEASE})
|
||||
message("calling ASN1C_PREFIX=S1AP_ asn1c -pdu=all -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${S1AP_C_DIR} ${S1AP_ASN_DIR}/${S1AP_ASN_FILES}")
|
||||
execute_process(COMMAND mkdir -p ${S1AP_C_DIR}
|
||||
COMMAND env "ASN1C_PREFIX=S1AP_" asn1c -pdu=all -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${S1AP_C_DIR} ${S1AP_ASN_DIR}/${S1AP_ASN_FILES}
|
||||
RESULT_VARIABLE ret)
|
||||
RESULT_VARIABLE ret
|
||||
OUTPUT_QUIET
|
||||
ERROR_QUIET)
|
||||
|
||||
if (NOT ${ret} STREQUAL 0)
|
||||
message(FATAL_ERROR "${ret}: error")
|
||||
endif (NOT ${ret} STREQUAL 0)
|
||||
@@ -451,7 +456,9 @@ set(X2AP_C_DIR ${asn1_generated_dir}/X2AP_${X2AP_RELEASE})
|
||||
message("calling ASN1C_PREFIX=X2AP_ asn1c -pdu=all -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${X2AP_C_DIR} ${X2AP_ASN_DIR}/${X2AP_ASN_FILES}")
|
||||
execute_process(COMMAND mkdir -p ${X2AP_C_DIR}
|
||||
COMMAND env "ASN1C_PREFIX=X2AP_" asn1c -pdu=all -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${X2AP_C_DIR} ${X2AP_ASN_DIR}/${X2AP_ASN_FILES}
|
||||
RESULT_VARIABLE ret)
|
||||
RESULT_VARIABLE ret
|
||||
OUTPUT_QUIET
|
||||
ERROR_QUIET)
|
||||
if (NOT ${ret} STREQUAL 0)
|
||||
message(FATAL_ERROR "${ret}: error")
|
||||
endif (NOT ${ret} STREQUAL 0)
|
||||
@@ -498,10 +505,13 @@ set(F1AP_ASN_FILES
|
||||
)
|
||||
|
||||
set(F1AP_C_DIR ${asn1_generated_dir}/F1AP_${ASN1RELDIR})
|
||||
set(ENV{ASN1C_PREFIX} F1AP_)
|
||||
execute_process(COMMAND ${asn1c_call} ${F1AP_C_DIR} ${F1AP_ASN_FILES}
|
||||
RESULT_VARIABLE reti)
|
||||
unset(ENV{ASN1C_PREFIX})
|
||||
message("calling ASN1C_PREFIX=F1AP_ asn1c -gen-PER -fcompound-names -no-gen-example -findirect-choice -fno-include-deps -D ${F1AP_C_DIR} ${F1AP_ASN_FILES}")
|
||||
execute_process(COMMAND mkdir -p ${F1AP_C_DIR}
|
||||
COMMAND env "ASN1C_PREFIX=F1AP_" asn1c -gen-PER -fcompound-names -no-gen-example -findirect-choice -fno-include-deps -D ${F1AP_C_DIR} ${F1AP_ASN_FILES}
|
||||
RESULT_VARIABLE ret
|
||||
OUTPUT_QUIET
|
||||
ERROR_QUIET)
|
||||
|
||||
if (NOT ${ret} STREQUAL 0)
|
||||
message(FATAL_ERROR "${asn1c_call}: error")
|
||||
endif (NOT ${ret} STREQUAL 0)
|
||||
@@ -533,6 +543,8 @@ add_library(F1AP
|
||||
#${F1AP_DIR}/test.c
|
||||
${F1AP_DIR}/DU_F1AP.c
|
||||
${F1AP_DIR}/CU_F1AP.c
|
||||
${F1AP_DIR}/f1ap_decoder.c
|
||||
${F1AP_DIR}/f1ap_handlers.c
|
||||
${F1AP_DIR}/sctp_du.c
|
||||
${F1AP_DIR}/sctp_cu.c
|
||||
)
|
||||
@@ -540,21 +552,25 @@ add_library(F1AP
|
||||
add_executable(test_f1ap_du
|
||||
${F1AP_DIR}/test_f1ap_du.c
|
||||
${F1AP_DIR}/DU_F1AP.c
|
||||
${F1AP_DIR}/f1ap_decoder.c
|
||||
${F1AP_DIR}/f1ap_handlers.c
|
||||
${F1AP_DIR}/sctp_du.c
|
||||
)
|
||||
|
||||
target_link_libraries(test_f1ap_du
|
||||
-Wl,--start-group F1AP_LIB sctp pthread -Wl,--end-group
|
||||
-Wl,--start-group F1AP_LIB ${T_LIB} sctp pthread -Wl,--end-group
|
||||
)
|
||||
|
||||
add_executable(test_f1ap_cu
|
||||
${F1AP_DIR}/test_f1ap_cu.c
|
||||
${F1AP_DIR}/CU_F1AP.c
|
||||
${F1AP_DIR}/f1ap_decoder.c
|
||||
${F1AP_DIR}/f1ap_handlers.c
|
||||
${F1AP_DIR}/sctp_cu.c
|
||||
)
|
||||
|
||||
target_link_libraries(test_f1ap_cu
|
||||
-Wl,--start-group F1AP_LIB sctp pthread -Wl,--end-group
|
||||
-Wl,--start-group F1AP_LIB ${T_LIB} sctp pthread -Wl,--end-group
|
||||
)
|
||||
|
||||
# Hardware dependant options
|
||||
|
||||
@@ -868,6 +868,21 @@ ID = LEGACY_F1U_ERROR
|
||||
GROUP = ALL:LEGACY_F1U:LEGACY_GROUP_ERROR:LEGACY
|
||||
FORMAT = string,log
|
||||
|
||||
ID = LEGACY_F1AP_DEBUG
|
||||
DESC = F1AP DEBUG LEVEL
|
||||
GROUP = ALL:LEGACY_F1AP:LEGACY_GROUP_DEBUG:LEGACY
|
||||
FORMAT = string,log
|
||||
|
||||
ID = LEGACY_F1AP_INFO
|
||||
DESC = F1AP INFO LEVEL
|
||||
GROUP = ALL:LEGACY_F1AP:LEGACY_GROUP_INFO:LEGACY
|
||||
FORMAT = string,log
|
||||
|
||||
ID = LEGACY_F1AP_ERROR
|
||||
DESC = F1AP ERROR LEVEL
|
||||
GROUP = ALL:LEGACY_F1AP:LEGACY_GROUP_ERROR:LEGACY
|
||||
FORMAT = string,log
|
||||
|
||||
#################
|
||||
#### UE LOGS ####
|
||||
#################
|
||||
|
||||
+67
-54
@@ -52,7 +52,7 @@ typedef struct f1ap_info {
|
||||
|
||||
/* This is the optional name provided by the MME */
|
||||
char *GNB_CU_Name;
|
||||
net_ip_address_t mme_net_ip_address; // useful for joining assoc_id and ip address of packets
|
||||
f1ap_net_ip_address_t mme_net_ip_address; // useful for joining assoc_id and ip address of packets
|
||||
|
||||
|
||||
/* Number of input/ouput streams */
|
||||
@@ -87,25 +87,38 @@ uint8_t F1AP_get_next_transaction_identifier(module_id_t enb_mod_idP, module_id_
|
||||
void F1AP_CU_task() {
|
||||
printf("Start F1AP CU task!\n");
|
||||
|
||||
//sctp_cu_init();
|
||||
sctp_cu_init();
|
||||
|
||||
// MessageDef *received_msg = NULL;
|
||||
// int result;
|
||||
|
||||
// F1AP_DEBUG("Starting F1AP layer\n");
|
||||
|
||||
// f1ap_eNB_prepare_internal_data();
|
||||
|
||||
// itti_mark_task_ready(TASK_F1AP);
|
||||
|
||||
// while (1) {
|
||||
// switch (ITTI_MSG_ID(received_msg)) {
|
||||
// case F1AP_SETUP_RESP:
|
||||
// CU_send_F1_SETUP_RESPONSE();
|
||||
// break;
|
||||
// case F1AP_INITIAL_UL_RRC_MESSAGE:
|
||||
// CU_handle_UL_INITIAL_RRC_MESSAGE_TRANSFER();
|
||||
// break;
|
||||
// case F1AP_DL_RRC_MESSAGE:
|
||||
// CU_send_DL_RRC_MESSAGE_TRANSFER(); // SRBID and RRCContainer get issue when decode.
|
||||
// break;
|
||||
// //CU_send_UE_CONTEXT_SETUP_REQUEST();
|
||||
// case F1AP_UE_CONTEXT_MODIFICATION_REQ:
|
||||
// CU_send_UE_CONTEXT_MODIFICATION_REQUEST();
|
||||
// break;
|
||||
// //CU_send_gNB_CU_CONFIGURATION_UPDATE((module_id_t)1, (module_id_t)2); // some problem found
|
||||
// break;
|
||||
|
||||
// switch () {
|
||||
// default:
|
||||
|
||||
//case F1AP_ProcedureCode_id_F1Setup:
|
||||
CU_send_F1_SETUP_RESPONSE();
|
||||
//case F1AP_ProcedureCode_id_InitialULRRCMessageTransfer:
|
||||
// CU_handle_UL_INITIAL_RRC_MESSAGE_TRANSFER ();
|
||||
//CU_send_DL_RRC_MESSAGE_TRANSFER(); // SRBID and RRCContainer get issue when decode.
|
||||
//CU_send_UE_CONTEXT_SETUP_REQUEST();
|
||||
//CU_send_UE_CONTEXT_MODIFICATION_REQUEST();
|
||||
//CU_send_gNB_CU_CONFIGURATION_UPDATE((module_id_t)1, (module_id_t)2); // some problem found
|
||||
// break;
|
||||
|
||||
// default:
|
||||
|
||||
// } // switch
|
||||
// } // switch
|
||||
|
||||
// } // while
|
||||
|
||||
@@ -321,59 +334,59 @@ int f1ap_encode_pdu(F1AP_F1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *length) {
|
||||
}
|
||||
|
||||
|
||||
int f1ap_decode_pdu(F1AP_F1AP_PDU_t *message, uint8_t *buffer, uint32_t length) {
|
||||
// int f1ap_decode_pdu(F1AP_F1AP_PDU_t *message, uint8_t *buffer, uint32_t length) {
|
||||
|
||||
//LOG_I(F1AP,"Entering main loop of DU F1AP pdu receiver\n");
|
||||
F1AP_F1AP_PDU_t pdu;
|
||||
F1AP_F1AP_PDU_t *pdu_p = &pdu;
|
||||
asn_dec_rval_t dec_ret;
|
||||
// //LOG_I(F1AP,"Entering main loop of DU F1AP pdu receiver\n");
|
||||
// F1AP_F1AP_PDU_t pdu;
|
||||
// F1AP_F1AP_PDU_t *pdu_p = &pdu;
|
||||
// asn_dec_rval_t dec_ret;
|
||||
|
||||
DevAssert(buffer != NULL);
|
||||
// DevAssert(buffer != NULL);
|
||||
|
||||
printf("buffer = \n");
|
||||
int i_ret;
|
||||
for (i_ret = 0; i_ret < length; i_ret++) {
|
||||
printf("%x ", *(buffer+i_ret));
|
||||
}
|
||||
printf("\n");
|
||||
// printf("buffer = \n");
|
||||
// int i_ret;
|
||||
// for (i_ret = 0; i_ret < length; i_ret++) {
|
||||
// printf("%x ", *(buffer+i_ret));
|
||||
// }
|
||||
// printf("\n");
|
||||
|
||||
memset((void *)pdu_p, 0, sizeof(F1AP_F1AP_PDU_t));
|
||||
// memset((void *)pdu_p, 0, sizeof(F1AP_F1AP_PDU_t));
|
||||
|
||||
|
||||
dec_ret = aper_decode(NULL,
|
||||
&asn_DEF_F1AP_F1AP_PDU,
|
||||
(void **)&pdu_p,
|
||||
buffer,
|
||||
length,
|
||||
0,
|
||||
0);
|
||||
// dec_ret = aper_decode(NULL,
|
||||
// &asn_DEF_F1AP_F1AP_PDU,
|
||||
// (void **)&pdu_p,
|
||||
// buffer,
|
||||
// length,
|
||||
// 0,
|
||||
// 0);
|
||||
|
||||
xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu_p);
|
||||
// xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu_p);
|
||||
|
||||
printf("\n");
|
||||
// printf("\n");
|
||||
|
||||
printf("dec_ret.code = %d \n", dec_ret.code);
|
||||
// printf("dec_ret.code = %d \n", dec_ret.code);
|
||||
|
||||
AssertFatal(dec_ret.code == RC_OK,"Failed to decode pdu\n");
|
||||
// AssertFatal(dec_ret.code == RC_OK,"Failed to decode pdu\n");
|
||||
|
||||
// switch(pdu_p->present) {
|
||||
// case F1AP_F1AP_PDU_PR_initiatingpdu:
|
||||
// return F1AP_DU_decode_initiating_pdu(&pdu_p->choice.initiatingpdu);
|
||||
// // switch(pdu_p->present) {
|
||||
// // case F1AP_F1AP_PDU_PR_initiatingpdu:
|
||||
// // return F1AP_DU_decode_initiating_pdu(&pdu_p->choice.initiatingpdu);
|
||||
|
||||
// case F1AP_F1AP_PDU_PR_successfulOutcome:
|
||||
// return F1AP_DU_decode_successful_outcome(&pdu_p->choice.successfulOutcome);
|
||||
// // case F1AP_F1AP_PDU_PR_successfulOutcome:
|
||||
// // return F1AP_DU_decode_successful_outcome(&pdu_p->choice.successfulOutcome);
|
||||
|
||||
// case F1AP_F1AP_PDU_PR_unsuccessfulOutcome:
|
||||
// return F1AP_DU_decode_unsuccessful_outcome(&pdu_p->choice.unsuccessfulOutcome);
|
||||
// // case F1AP_F1AP_PDU_PR_unsuccessfulOutcome:
|
||||
// // return F1AP_DU_decode_unsuccessful_outcome(&pdu_p->choice.unsuccessfulOutcome);
|
||||
|
||||
// default:
|
||||
// /*AssertFatal(1==0,"Unknown presence (%d) or not implemented\n", (int)pdu_p->present);*/
|
||||
// break;
|
||||
// }
|
||||
// // default:
|
||||
// // /*AssertFatal(1==0,"Unknown presence (%d) or not implemented\n", (int)pdu_p->present);*/
|
||||
// // break;
|
||||
// // }
|
||||
|
||||
//AssertFatal(1==0,"Shouldn't get here\n");
|
||||
return -1;
|
||||
}
|
||||
// //AssertFatal(1==0,"Shouldn't get here\n");
|
||||
// return -1;
|
||||
// }
|
||||
|
||||
void CU_send_F1_SETUP_FAILURE(F1AP_F1SetupFailure_t *F1SetupFailure) {
|
||||
AssertFatal(1==0,"Not implemented yet\n");
|
||||
|
||||
+40
-40
@@ -53,7 +53,7 @@ typedef struct f1ap_info {
|
||||
|
||||
/* This is the optional name provided by the MME */
|
||||
char *GNB_DU_Name;
|
||||
net_ip_address_t mme_net_ip_address; // useful for joining assoc_id and ip address of packets
|
||||
f1ap_net_ip_address_t mme_net_ip_address; // useful for joining assoc_id and ip address of packets
|
||||
|
||||
|
||||
/* Number of input/ouput streams */
|
||||
@@ -103,7 +103,7 @@ void F1AP_DU_task() {
|
||||
// switch () {
|
||||
|
||||
// case F1AP_ProcedureCode_id_F1Setup:
|
||||
//DU_send_F1_SETUP_REQUEST((module_id_t)1, (module_id_t)2);
|
||||
DU_send_F1_SETUP_REQUEST((module_id_t)1, (module_id_t)2);
|
||||
// break;
|
||||
//DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER();
|
||||
//DU_send_UL_RRC_MESSAGE_TRANSFER(); // OK
|
||||
@@ -422,59 +422,59 @@ int f1ap_encode_pdu(F1AP_F1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *length) {
|
||||
}
|
||||
|
||||
|
||||
int f1ap_decode_pdu(F1AP_F1AP_PDU_t *message, uint8_t *buffer, uint32_t length) {
|
||||
// int f1ap_decode_pdu(F1AP_F1AP_PDU_t *message, uint8_t *buffer, uint32_t length) {
|
||||
|
||||
//LOG_I(F1AP,"Entering main loop of DU F1AP pdu receiver\n");
|
||||
F1AP_F1AP_PDU_t pdu;
|
||||
F1AP_F1AP_PDU_t *pdu_p = &pdu;
|
||||
asn_dec_rval_t dec_ret;
|
||||
// //LOG_I(F1AP,"Entering main loop of DU F1AP pdu receiver\n");
|
||||
// F1AP_F1AP_PDU_t pdu;
|
||||
// F1AP_F1AP_PDU_t *pdu_p = &pdu;
|
||||
// asn_dec_rval_t dec_ret;
|
||||
|
||||
DevAssert(buffer != NULL);
|
||||
// DevAssert(buffer != NULL);
|
||||
|
||||
printf("buffer = \n");
|
||||
int i_ret;
|
||||
for (i_ret = 0; i_ret < length; i_ret++) {
|
||||
printf("%x ", *(buffer+i_ret));
|
||||
}
|
||||
printf("\n");
|
||||
// printf("buffer = \n");
|
||||
// int i_ret;
|
||||
// for (i_ret = 0; i_ret < length; i_ret++) {
|
||||
// printf("%x ", *(buffer+i_ret));
|
||||
// }
|
||||
// printf("\n");
|
||||
|
||||
memset((void *)pdu_p, 0, sizeof(F1AP_F1AP_PDU_t));
|
||||
// memset((void *)pdu_p, 0, sizeof(F1AP_F1AP_PDU_t));
|
||||
|
||||
|
||||
dec_ret = aper_decode(NULL,
|
||||
&asn_DEF_F1AP_F1AP_PDU,
|
||||
(void **)&pdu_p,
|
||||
buffer,
|
||||
length,
|
||||
0,
|
||||
0);
|
||||
// dec_ret = aper_decode(NULL,
|
||||
// &asn_DEF_F1AP_F1AP_PDU,
|
||||
// (void **)&pdu_p,
|
||||
// buffer,
|
||||
// length,
|
||||
// 0,
|
||||
// 0);
|
||||
|
||||
xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu_p);
|
||||
// xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu_p);
|
||||
|
||||
printf("\n");
|
||||
// printf("\n");
|
||||
|
||||
printf("dec_ret.code = %d \n", dec_ret.code);
|
||||
// printf("dec_ret.code = %d \n", dec_ret.code);
|
||||
|
||||
AssertFatal(dec_ret.code == RC_OK,"Failed to decode pdu\n");
|
||||
// AssertFatal(dec_ret.code == RC_OK,"Failed to decode pdu\n");
|
||||
|
||||
// switch(pdu_p->present) {
|
||||
// case F1AP_F1AP_PDU_PR_initiatingpdu:
|
||||
// return F1AP_DU_decode_initiating_pdu(&pdu_p->choice.initiatingpdu);
|
||||
// // switch(pdu_p->present) {
|
||||
// // case F1AP_F1AP_PDU_PR_initiatingpdu:
|
||||
// // return F1AP_DU_decode_initiating_pdu(&pdu_p->choice.initiatingpdu);
|
||||
|
||||
// case F1AP_F1AP_PDU_PR_successfulOutcome:
|
||||
// return F1AP_DU_decode_successful_outcome(&pdu_p->choice.successfulOutcome);
|
||||
// // case F1AP_F1AP_PDU_PR_successfulOutcome:
|
||||
// // return F1AP_DU_decode_successful_outcome(&pdu_p->choice.successfulOutcome);
|
||||
|
||||
// case F1AP_F1AP_PDU_PR_unsuccessfulOutcome:
|
||||
// return F1AP_DU_decode_unsuccessful_outcome(&pdu_p->choice.unsuccessfulOutcome);
|
||||
// // case F1AP_F1AP_PDU_PR_unsuccessfulOutcome:
|
||||
// // return F1AP_DU_decode_unsuccessful_outcome(&pdu_p->choice.unsuccessfulOutcome);
|
||||
|
||||
// default:
|
||||
// /*AssertFatal(1==0,"Unknown presence (%d) or not implemented\n", (int)pdu_p->present);*/
|
||||
// break;
|
||||
// }
|
||||
// // default:
|
||||
// // /*AssertFatal(1==0,"Unknown presence (%d) or not implemented\n", (int)pdu_p->present);*/
|
||||
// // break;
|
||||
// // }
|
||||
|
||||
//AssertFatal(1==0,"Shouldn't get here\n");
|
||||
return -1;
|
||||
}
|
||||
// //AssertFatal(1==0,"Shouldn't get here\n");
|
||||
// return -1;
|
||||
// }
|
||||
|
||||
|
||||
// ssize_t s1ap_generate_initiating_pdu(
|
||||
|
||||
@@ -375,7 +375,7 @@ extern int asn1_xer_print;
|
||||
#include "assertions.h"
|
||||
|
||||
#if defined(ENB_MODE)
|
||||
# include "log.h"
|
||||
# include "common/utils/LOG/log.h"
|
||||
# include "f1ap_default_values.h"
|
||||
# define F1AP_ERROR(x, args...) LOG_E(F1AP, x, ##args)
|
||||
# define F1AP_WARN(x, args...) LOG_W(F1AP, x, ##args)
|
||||
@@ -394,30 +394,30 @@ extern int asn1_xer_print;
|
||||
//Forward declaration
|
||||
//struct f1ap_message_s;
|
||||
|
||||
typedef struct net_ip_address_s {
|
||||
typedef struct f1ap_net_ip_address_s {
|
||||
unsigned ipv4:1;
|
||||
unsigned ipv6:1;
|
||||
char ipv4_address[16];
|
||||
char ipv6_address[46];
|
||||
} net_ip_address_t;
|
||||
} f1ap_net_ip_address_t;
|
||||
|
||||
|
||||
typedef struct f1ap_message_s {
|
||||
/*typedef struct f1ap_message_s {
|
||||
F1AP_ProtocolIE_ID_t id;
|
||||
F1AP_Criticality_t criticality;
|
||||
uint8_t direction;
|
||||
union {
|
||||
F1AP_F1SetupRequestIEs_t f1ap_F1SetupRequestIEs;
|
||||
} msg;
|
||||
} f1ap_message;
|
||||
} f1ap_message;*/
|
||||
|
||||
/** \brief Function callback prototype.
|
||||
**/
|
||||
/*typedef int (*f1ap_message_decoded_callback)(
|
||||
typedef int (*f1ap_message_decoded_callback)(
|
||||
uint32_t assoc_id,
|
||||
uint32_t stream,
|
||||
struct f1ap_message_s *message_p
|
||||
);*/
|
||||
);
|
||||
|
||||
/** \brief Encode a successfull outcome message
|
||||
\param buffer pointer to buffer in which data will be encoded
|
||||
|
||||
+88
-145
@@ -37,199 +37,142 @@
|
||||
#include "intertask_interface.h"
|
||||
|
||||
#include "f1ap_common.h"
|
||||
#include "f1ap_ies_defs.h"
|
||||
#include "f1ap_decoder.h"
|
||||
|
||||
static int f1ap_decode_initiating_message(f1ap_message *message,
|
||||
F1ap_InitiatingMessage_t *initiating_p)
|
||||
static int f1ap_eNB_decode_initiating_message(F1AP_F1AP_PDU_t *pdu)
|
||||
{
|
||||
int ret = -1;
|
||||
MessageDef *message_p;
|
||||
char *message_string = NULL;
|
||||
size_t message_string_size;
|
||||
MessagesIds message_id;
|
||||
asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} };
|
||||
DevAssert(pdu != NULL);
|
||||
|
||||
DevAssert(initiating_p != NULL);
|
||||
switch(pdu->choice.initiatingMessage->procedureCode) {
|
||||
|
||||
message_string = calloc(10000, sizeof(char));
|
||||
case F1AP_ProcedureCode_id_F1Setup:
|
||||
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu);
|
||||
printf("f1ap_eNB_decode_initiating_message!\n");
|
||||
break;
|
||||
// case F1AP_ProcedureCode_id_InitialContextSetup:
|
||||
// res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu);
|
||||
// message_id = F1AP_INITIAL_CONTEXT_SETUP_LOG;
|
||||
// message_p = itti_alloc_new_message_sized(TASK_F1AP, message_id,
|
||||
// res.result.encoded + sizeof (IttiMsgText));
|
||||
// message_p->ittiMsg.f1ap_initial_context_setup_log.size = res.result.encoded;
|
||||
// memcpy(&message_p->ittiMsg.f1ap_initial_context_setup_log.text, res.buffer, res.result.encoded);
|
||||
// itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
// free(res.buffer);
|
||||
// break;
|
||||
|
||||
f1ap_string_total_size = 0;
|
||||
|
||||
message->procedureCode = initiating_p->procedureCode;
|
||||
message->criticality = initiating_p->criticality;
|
||||
|
||||
switch(initiating_p->procedureCode) {
|
||||
|
||||
case F1ap_ProcedureCode_id_InitialContextSetup:
|
||||
ret = f1ap_decode_f1ap_initialcontextsetuprequesties(
|
||||
&message->msg.f1ap_InitialContextSetupRequestIEs, &initiating_p->value);
|
||||
f1ap_xer_print_f1ap_initialcontextsetuprequest(f1ap_xer__print2sp, message_string, message);
|
||||
message_id = F1AP_INITIAL_CONTEXT_SETUP_LOG;
|
||||
message_string_size = strlen(message_string);
|
||||
message_p = itti_alloc_new_message_sized(TASK_F1AP,
|
||||
message_id,
|
||||
message_string_size + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.f1ap_initial_context_setup_log.size = message_string_size;
|
||||
memcpy(&message_p->ittiMsg.f1ap_initial_context_setup_log.text, message_string, message_string_size);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(message_string);
|
||||
break;
|
||||
|
||||
case F1ap_ProcedureCode_id_UEContextRelease:
|
||||
ret = f1ap_decode_f1ap_uecontextreleasecommandies(
|
||||
&message->msg.f1ap_UEContextReleaseCommandIEs, &initiating_p->value);
|
||||
f1ap_xer_print_f1ap_uecontextreleasecommand(f1ap_xer__print2sp, message_string, message);
|
||||
message_id = F1AP_UE_CONTEXT_RELEASE_COMMAND_LOG;
|
||||
message_string_size = strlen(message_string);
|
||||
message_p = itti_alloc_new_message_sized(TASK_F1AP,
|
||||
message_id,
|
||||
message_string_size + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.f1ap_ue_context_release_command_log.size = message_string_size;
|
||||
memcpy(&message_p->ittiMsg.f1ap_ue_context_release_command_log.text, message_string, message_string_size);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(message_string);
|
||||
break;
|
||||
|
||||
case F1ap_ProcedureCode_id_ErrorIndication:
|
||||
ret = f1ap_decode_f1ap_errorindicationies(
|
||||
&message->msg.f1ap_ErrorIndicationIEs, &initiating_p->value);
|
||||
f1ap_xer_print_f1ap_errorindication(f1ap_xer__print2sp, message_string, message);
|
||||
message_id = F1AP_E_RAB_ERROR_INDICATION_LOG;
|
||||
message_string_size = strlen(message_string);
|
||||
message_p = itti_alloc_new_message_sized(TASK_F1AP,
|
||||
message_id,
|
||||
message_string_size + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.f1ap_e_rab_release_request_log.size = message_string_size;
|
||||
memcpy(&message_p->ittiMsg.f1ap_error_indication_log.text, message_string, message_string_size);
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
free(message_string);
|
||||
F1AP_INFO("ErrorIndication initiating message\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
F1AP_ERROR("Unknown procedure ID (%d) for initiating message\n",
|
||||
(int)initiating_p->procedureCode);
|
||||
AssertFatal( 0 , "Unknown procedure ID (%d) for initiating message\n",
|
||||
(int)initiating_p->procedureCode);
|
||||
return -1;
|
||||
default:
|
||||
// F1AP_ERROR("Unknown procedure ID (%d) for initiating message\n",
|
||||
// (int)pdu->choice.initiatingMessage->procedureCode);
|
||||
printf("Unknown procedure ID (%d) for initiating message\n",
|
||||
(int)pdu->choice.initiatingMessage->procedureCode);
|
||||
AssertFatal( 0, "Unknown procedure ID (%d) for initiating message\n",
|
||||
(int)pdu->choice.initiatingMessage->procedureCode);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int f1ap_decode_successful_outcome(f1ap_message *message,
|
||||
F1ap_SuccessfulOutcome_t *successfullOutcome_p)
|
||||
static int f1ap_eNB_decode_successful_outcome(F1AP_F1AP_PDU_t *pdu)
|
||||
{
|
||||
int ret = -1;
|
||||
MessageDef *message_p;
|
||||
char *message_string = NULL;
|
||||
size_t message_string_size;
|
||||
MessagesIds message_id;
|
||||
asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} };
|
||||
DevAssert(pdu != NULL);
|
||||
|
||||
DevAssert(successfullOutcome_p != NULL);
|
||||
switch(pdu->choice.successfulOutcome->procedureCode) {
|
||||
// case F1AP_ProcedureCode_id_F1Setup:
|
||||
// res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu);
|
||||
// message_id = F1AP_F1_SETUP_LOG;
|
||||
// message_p = itti_alloc_new_message_sized(TASK_F1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
|
||||
// message_p->ittiMsg.f1ap_s1_setup_log.size = res.result.encoded;
|
||||
// memcpy(&message_p->ittiMsg.f1ap_s1_setup_log.text, res.buffer, res.result.encoded);
|
||||
// itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
// free(res.buffer);
|
||||
// break;
|
||||
|
||||
message_string = malloc(sizeof(char) * 10000);
|
||||
memset((void*)message_string,0,sizeof(char) * 10000);
|
||||
|
||||
f1ap_string_total_size = 0;
|
||||
|
||||
message->procedureCode = successfullOutcome_p->procedureCode;
|
||||
message->criticality = successfullOutcome_p->criticality;
|
||||
|
||||
switch(successfullOutcome_p->procedureCode) {
|
||||
case F1ap_ProcedureCode_id_F1Setup:
|
||||
ret = f1ap_decode_f1ap_f1setupresponseies(
|
||||
&message->msg.f1ap_F1SetupResponseIEs, &successfullOutcome_p->value);
|
||||
f1ap_xer_print_f1ap_f1setupresponse(f1ap_xer__print2sp, message_string, message);
|
||||
message_id = F1AP_F1_SETUP_LOG;
|
||||
break;
|
||||
|
||||
default:
|
||||
F1AP_ERROR("Unknown procedure ID (%d) for successfull outcome message\n",
|
||||
(int)successfullOutcome_p->procedureCode);
|
||||
return -1;
|
||||
default:
|
||||
// F1AP_ERROR("Unknown procedure ID (%d) for successfull outcome message\n",
|
||||
// (int)pdu->choice.successfulOutcome->procedureCode);
|
||||
printf("Unknown procedure ID (%d) for successfull outcome message\n",
|
||||
(int)pdu->choice.successfulOutcome->procedureCode);
|
||||
return -1;
|
||||
}
|
||||
|
||||
message_string_size = strlen(message_string);
|
||||
|
||||
message_p = itti_alloc_new_message_sized(TASK_F1AP, message_id, message_string_size + sizeof (IttiMsgText));
|
||||
message_p->ittiMsg.f1ap_f1_setup_log.size = message_string_size;
|
||||
memcpy(&message_p->ittiMsg.f1ap_f1_setup_log.text, message_string, message_string_size);
|
||||
|
||||
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
|
||||
free(message_string);
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int f1ap_decode_unsuccessful_outcome(f1ap_message *message,
|
||||
F1ap_UnsuccessfulOutcome_t *unSuccessfullOutcome_p)
|
||||
static int f1ap_eNB_decode_unsuccessful_outcome(F1AP_F1AP_PDU_t *pdu)
|
||||
{
|
||||
int ret = -1;
|
||||
DevAssert(unSuccessfullOutcome_p != NULL);
|
||||
MessageDef *message_p;
|
||||
MessagesIds message_id;
|
||||
asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} };
|
||||
DevAssert(pdu != NULL);
|
||||
|
||||
message->procedureCode = unSuccessfullOutcome_p->procedureCode;
|
||||
message->criticality = unSuccessfullOutcome_p->criticality;
|
||||
switch(pdu->choice.unsuccessfulOutcome->procedureCode) {
|
||||
// case F1AP_ProcedureCode_id_F1Setup:
|
||||
// res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu);
|
||||
// message_id = F1AP_F1_SETUP_LOG;
|
||||
// message_p = itti_alloc_new_message_sized(TASK_F1AP, message_id, res.result.encoded + sizeof (IttiMsgText));
|
||||
// message_p->ittiMsg.f1ap_f1_setup_log.size = res.result.encoded;
|
||||
// memcpy(&message_p->ittiMsg.f1ap_f1_setup_log.text, res.buffer, res.result.encoded);
|
||||
// itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
|
||||
// free(res.buffer);
|
||||
// break;
|
||||
|
||||
switch(unSuccessfullOutcome_p->procedureCode) {
|
||||
case F1ap_ProcedureCode_id_F1Setup:
|
||||
return f1ap_decode_f1ap_f1setupfailureies(
|
||||
&message->msg.f1ap_F1SetupFailureIEs, &unSuccessfullOutcome_p->value);
|
||||
|
||||
default:
|
||||
F1AP_ERROR("Unknown procedure ID (%d) for unsuccessfull outcome message\n",
|
||||
(int)unSuccessfullOutcome_p->procedureCode);
|
||||
break;
|
||||
default:
|
||||
// F1AP_ERROR("Unknown procedure ID (%d) for unsuccessfull outcome message\n",
|
||||
// (int)pdu->choice.unsuccessfulOutcome->procedureCode);
|
||||
printf("Unknown procedure ID (%d) for unsuccessfull outcome message\n",
|
||||
(int)pdu->choice.unsuccessfulOutcome->procedureCode);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int f1ap_decode_pdu(f1ap_message *message, const uint8_t * const buffer,
|
||||
int f1ap_decode_pdu(F1AP_F1AP_PDU_t *pdu, const uint8_t *const buffer,
|
||||
const uint32_t length)
|
||||
{
|
||||
F1AP_PDU_t pdu;
|
||||
F1AP_PDU_t *pdu_p = &pdu;
|
||||
asn_dec_rval_t dec_ret;
|
||||
|
||||
DevAssert(buffer != NULL);
|
||||
|
||||
memset((void *)pdu_p, 0, sizeof(F1AP_PDU_t));
|
||||
|
||||
dec_ret = aper_decode(NULL,
|
||||
&asn_DEF_F1AP_PDU,
|
||||
(void **)&pdu_p,
|
||||
&asn_DEF_F1AP_F1AP_PDU,
|
||||
(void **)&pdu,
|
||||
buffer,
|
||||
length,
|
||||
0,
|
||||
0);
|
||||
|
||||
//xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu_p);
|
||||
|
||||
if (dec_ret.code != RC_OK) {
|
||||
F1AP_ERROR("Failed to decode pdu\n");
|
||||
//F1AP_ERROR("Failed to decode pdu\n");
|
||||
printf("Failed to decode pdu\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
message->direction = pdu_p->present;
|
||||
switch(pdu->present) {
|
||||
case F1AP_F1AP_PDU_PR_initiatingMessage:
|
||||
return f1ap_eNB_decode_initiating_message(pdu);
|
||||
|
||||
switch(pdu_p->present) {
|
||||
case F1AP_F1AP_PDU_PR_initiatingMessage:
|
||||
return f1ap_decode_initiating_message(message,
|
||||
&pdu_p->choice.initiatingMessage);
|
||||
case F1AP_F1AP_PDU_PR_successfulOutcome:
|
||||
return f1ap_eNB_decode_successful_outcome(pdu);
|
||||
|
||||
case F1AP_F1AP_PDU_PR_successfulOutcome:
|
||||
return f1ap_decode_successful_outcome(message,
|
||||
&pdu_p->choice.successfulOutcome);
|
||||
case F1AP_F1AP_PDU_PR_unsuccessfulOutcome:
|
||||
return f1ap_eNB_decode_unsuccessful_outcome(pdu);
|
||||
|
||||
case F1AP_F1AP_PDU_PR_unsuccessfulOutcome:
|
||||
return f1ap_decode_unsuccessful_outcome(message,
|
||||
&pdu_p->choice.unsuccessfulOutcome);
|
||||
|
||||
default:
|
||||
F1AP_DEBUG("Unknown presence (%d) or not implemented\n", (int)pdu_p->present);
|
||||
break;
|
||||
default:
|
||||
//F1AP_DEBUG("Unknown presence (%d) or not implemented\n", (int)pdu->present);
|
||||
printf("Unknown presence (%d) or not implemented\n", (int)pdu->present);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -30,13 +30,10 @@
|
||||
* \warning
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include "f1ap_ies_defs.h"
|
||||
#ifndef F1AP_ENB_ENCODER_H_
|
||||
#define F1AP_ENB_ENCODER_H_
|
||||
|
||||
#ifndef F1AP_DECODER_H_
|
||||
#define F1AP_DECODER_H_
|
||||
int f1ap_eNB_encode_pdu(F1AP_F1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *len)
|
||||
__attribute__ ((warn_unused_result));
|
||||
|
||||
int f1ap_decode_pdu(f1ap_message *message, const uint8_t * const buffer,
|
||||
const uint32_t length) __attribute__ ((warn_unused_result));
|
||||
|
||||
#endif /* F1AP_DECODER_H_ */
|
||||
#endif /* F1AP_ENB_ENCODER_H_ */
|
||||
|
||||
+60
-1288
File diff suppressed because it is too large
Load Diff
@@ -33,8 +33,6 @@
|
||||
#ifndef F1AP_HANDLERS_H_
|
||||
#define F1AP_HANDLERS_H_
|
||||
|
||||
void f1ap_handle_f1_setup_message(f1ap_eNB_mme_data_t *mme_desc_p, int sctp_shutdown);
|
||||
|
||||
int f1ap_handle_message(uint32_t assoc_id, int32_t stream,
|
||||
const uint8_t * const data, const uint32_t data_length);
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <pthread.h>
|
||||
#include <unistd.h> // for close
|
||||
#include <stdlib.h>
|
||||
#include "f1ap_handlers.h"
|
||||
|
||||
#define MAX_BUFFER 1024
|
||||
|
||||
@@ -81,7 +82,10 @@ void *recv_func(void *cfd) {
|
||||
|
||||
printf("\n");
|
||||
|
||||
f1ap_decode_pdu(NULL , buffer_recv, sizeof(buffer_recv));
|
||||
f1ap_handle_message(1/*sctp_data_ind->assoc_id*/, 1/*sctp_data_ind->stream*/,
|
||||
buffer_recv, sizeof(buffer_recv));
|
||||
|
||||
//f1ap_decode_pdu(NULL , buffer_recv, sizeof(buffer_recv));
|
||||
}
|
||||
printf("ret = %d\n", ret);
|
||||
close( *(int*)cfd );
|
||||
|
||||
Reference in New Issue
Block a user