Commit 54aa295e authored by Robert Schmidt's avatar Robert Schmidt

Use f1ap_encoder.c file for F1AP encoding functionality

parent e82cae08
...@@ -543,6 +543,7 @@ add_library(F1AP ...@@ -543,6 +543,7 @@ add_library(F1AP
#${F1AP_DIR}/test.c #${F1AP_DIR}/test.c
${F1AP_DIR}/DU_F1AP.c ${F1AP_DIR}/DU_F1AP.c
${F1AP_DIR}/CU_F1AP.c ${F1AP_DIR}/CU_F1AP.c
${F1AP_DIR}/f1ap_encoder.c
${F1AP_DIR}/f1ap_decoder.c ${F1AP_DIR}/f1ap_decoder.c
${F1AP_DIR}/f1ap_handlers.c ${F1AP_DIR}/f1ap_handlers.c
${F1AP_DIR}/sctp_du.c ${F1AP_DIR}/sctp_du.c
......
...@@ -334,46 +334,6 @@ void CU_send_F1_SETUP_RESPONSE(void) { ...@@ -334,46 +334,6 @@ void CU_send_F1_SETUP_RESPONSE(void) {
} }
int f1ap_encode_pdu(F1AP_F1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *length) {
DevAssert(pdu != NULL);
DevAssert(buffer != NULL);
DevAssert(length != NULL);
xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu);
ssize_t encoded;
// asn_DEF_F1AP_F1SetupRequest
// asn_DEF_F1AP_F1AP_PDU
/* We can safely free list of IE from sptr */
//ASN_STRUCT_FREE_CONTENTS_ONLY(&asn_DEF_F1AP_F1SetupRequest, pdu);
if ((encoded = aper_encode_to_new_buffer(&asn_DEF_F1AP_F1AP_PDU, 0,
pdu,
(void **)buffer)) < 0) {
printf("\nencoded len = %ld\n", encoded);
return -1;
}
printf("encoded len = %ld\n", encoded);
printf("buffer = \n");
int i_ret;
for (i_ret = 0; i_ret < encoded; i_ret++) {
printf("%x ", *((*buffer)+i_ret));
}
printf("\n");
*length = encoded;
// ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, pdu);
return encoded;
}
// 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"); // //LOG_I(F1AP,"Entering main loop of DU F1AP pdu receiver\n");
......
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
#include "conversions.h" #include "conversions.h"
#include "f1ap_common.h" #include "f1ap_common.h"
#include "du_f1ap_defs.h" #include "du_f1ap_defs.h"
#include "f1ap_encoder.h"
#include "f1ap_decoder.h"
#include "platform_types.h" #include "platform_types.h"
#include "common/utils/LOG/log.h" #include "common/utils/LOG/log.h"
#include "sctp_du.h" #include "sctp_du.h"
...@@ -506,47 +508,6 @@ void DU_send_F1_SETUP_REQUEST(module_id_t enb_mod_idP, module_id_t du_mod_idP, f ...@@ -506,47 +508,6 @@ void DU_send_F1_SETUP_REQUEST(module_id_t enb_mod_idP, module_id_t du_mod_idP, f
} }
// ==============================================================================
int f1ap_encode_pdu(F1AP_F1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *length) {
DevAssert(pdu != NULL);
DevAssert(buffer != NULL);
DevAssert(length != NULL);
xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu);
ssize_t encoded;
// asn_DEF_F1AP_F1SetupRequest
// asn_DEF_F1AP_F1AP_PDU
/* We can safely free list of IE from sptr */
//ASN_STRUCT_FREE_CONTENTS_ONLY(&asn_DEF_F1AP_F1SetupRequest, pdu);
if ((encoded = aper_encode_to_new_buffer(&asn_DEF_F1AP_F1AP_PDU, 0,
pdu,
(void **)buffer)) < 0) {
printf("encoded len = %ld\n", encoded);
return -1;
}
printf("encoded len = %ld\n", encoded);
printf("buffer = \n");
int i_ret;
for (i_ret = 0; i_ret < encoded; i_ret++) {
printf("%x ", *((*buffer)+i_ret));
}
printf("\n");
*length = encoded;
//ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, pdu);
return encoded;
}
// 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"); // //LOG_I(F1AP,"Entering main loop of DU F1AP pdu receiver\n");
......
...@@ -41,9 +41,9 @@ ...@@ -41,9 +41,9 @@
#include "intertask_interface.h" #include "intertask_interface.h"
#include "f1ap_common.h" #include "f1ap_common.h"
#include "f1ap_ies_defs.h"
#include "f1ap_encoder.h" #include "f1ap_encoder.h"
/*
static inline int f1ap_encode_initiating(f1ap_message *message, static inline int f1ap_encode_initiating(f1ap_message *message,
uint8_t **buffer, uint8_t **buffer,
uint32_t *len); uint32_t *len);
...@@ -77,32 +77,29 @@ int f1ap_encode_ue_context_release_request( ...@@ -77,32 +77,29 @@ int f1ap_encode_ue_context_release_request(
F1ap_UEContextReleaseRequestIEs_t *f1ap_UEContextReleaseRequestIEs, F1ap_UEContextReleaseRequestIEs_t *f1ap_UEContextReleaseRequestIEs,
uint8_t **buffer, uint8_t **buffer,
uint32_t *length); uint32_t *length);
*/
int f1ap_encode_pdu(f1ap_message *message, uint8_t **buffer, uint32_t *len) int f1ap_encode_pdu(F1AP_F1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *length)
{ {
DevAssert(message != NULL); ssize_t encoded;
DevAssert(pdu != NULL);
DevAssert(buffer != NULL); DevAssert(buffer != NULL);
DevAssert(len != NULL); DevAssert(length != NULL);
switch(message->direction) { // Need Check (present)?
case F1AP_F1AP_PDU_PR_initiatingMessage:
return f1ap_encode_initiating(message, buffer, len);
case F1AP_F1AP_PDU_PR_successfulOutcome:
return f1ap_encode_successfull_outcome(message, buffer, len);
case F1AP_F1AP_PDU_PR_unsuccessfulOutcome: //xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu);
return f1ap_encode_unsuccessfull_outcome(message, buffer, len); encoded = aper_encode_to_new_buffer(&asn_DEF_F1AP_F1AP_PDU, 0, pdu, (void **)buffer);
default: if (encoded < 0) {
F1AP_DEBUG("Unknown message outcome (%d) or not implemented", LOG_E(F1AP, "Failed to encode F1AP message\n");
(int)message->direction); return -1;
break;
} }
*length = encoded;
return -1; /* Is the following needed? I moved the code here from CU_F1AP.c/DU_F1AP.c */
// ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, pdu);
return encoded;
} }
/*
static inline static inline
int f1ap_encode_initiating(f1ap_message *f1ap_message_p, int f1ap_encode_initiating(f1ap_message *f1ap_message_p,
uint8_t **buffer, uint32_t *len) uint8_t **buffer, uint32_t *len)
...@@ -379,4 +376,4 @@ int f1ap_encode_ue_context_release_request( ...@@ -379,4 +376,4 @@ int f1ap_encode_ue_context_release_request(
&asn_DEF_F1ap_UEContextReleaseRequest, &asn_DEF_F1ap_UEContextReleaseRequest,
ue_context_release_request_p); ue_context_release_request_p);
} }
*/
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