Commit cdfca6c0 authored by Bing-Kai Hong's avatar Bing-Kai Hong

F1:

1.create the f1ap handlers procedure
2.hide asn1c warning when in compile
parent e2dd22b6
......@@ -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 ####
#################
......
......@@ -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();
// while (1) {
// MessageDef *received_msg = NULL;
// int result;
// F1AP_DEBUG("Starting F1AP layer\n");
// switch () {
// f1ap_eNB_prepare_internal_data();
//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;
// 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;
// default:
// 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");
......
......@@ -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
......
This diff is collapsed.
......@@ -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_ */
This diff is collapsed.
......@@ -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 );
......
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