Commit 7321aab6 authored by Bi-Ruei, Chiu's avatar Bi-Ruei, Chiu

Add S1AP R14 based on new asn1c

This feature requires an un-official version of asn1c :

https://github.com/velichkov/asn1c/tree/s1ap
parent 1272cabb
...@@ -280,6 +280,7 @@ set(protobuf_generated_dir ${OPENAIR_BIN_DIR}) ...@@ -280,6 +280,7 @@ set(protobuf_generated_dir ${OPENAIR_BIN_DIR})
# RRC # RRC
###### ######
add_list2_option(RRC_ASN1_VERSION "Rel14" "ASN.1 version of RRC interface" "Rel8" "Rel10" "Rel14" "CBA") add_list2_option(RRC_ASN1_VERSION "Rel14" "ASN.1 version of RRC interface" "Rel8" "Rel10" "Rel14" "CBA")
if (${RRC_ASN1_VERSION} STREQUAL "Rel8") if (${RRC_ASN1_VERSION} STREQUAL "Rel8")
...@@ -292,7 +293,7 @@ else() ...@@ -292,7 +293,7 @@ else()
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1c/ASN1_files/RRC-e30.asn) set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1c/ASN1_files/RRC-e30.asn)
endif (${RRC_ASN1_VERSION} STREQUAL "Rel8") endif (${RRC_ASN1_VERSION} STREQUAL "Rel8")
set (RRC_FULL_DIR ${asn1_generated_dir}/${RRC_ASN1_VERSION}) set (RRC_FULL_DIR ${asn1_generated_dir}/RRC_${RRC_ASN1_VERSION})
if(NOT EXISTS ${asn1c_call}) if(NOT EXISTS ${asn1c_call})
message( FATAL_ERROR "The script ${asn1c_call} must be present" ) message( FATAL_ERROR "The script ${asn1c_call} must be present" )
endif(NOT EXISTS ${asn1c_call}) endif(NOT EXISTS ${asn1c_call})
...@@ -331,10 +332,14 @@ add_custom_command ( ...@@ -331,10 +332,14 @@ add_custom_command (
# Same limitation as described in RRC: unknown generated file list # Same limitation as described in RRC: unknown generated file list
# so we generate it at cmake time # so we generate it at cmake time
############## ##############
add_list1_option(S1AP_VERSION R10 "S1AP Asn.1 grammar version" R8 R9 R10) add_list1_option(S1AP_VERSION R14 "S1AP Asn.1 grammar version" R8 R9 R10 R14)
set(S1AP_DIR ${OPENAIR3_DIR}/S1AP) set(S1AP_DIR ${OPENAIR3_DIR}/S1AP)
if (${S1AP_VERSION} STREQUAL "R10") if (${S1AP_VERSION} STREQUAL "R14")
set (ASN1RELDIR R14.4)
add_definitions("-DUPDATE_RELEASE_9 -DUPDATE_RELEASE_10 -DUPDATE_RELEASE_14")
set(S1AP_ASN_FILES s1ap-14.4.0.asn1)
elseif (${S1AP_VERSION} STREQUAL "R10")
set (ASN1RELDIR R10.5) set (ASN1RELDIR R10.5)
add_definitions("-DUPDATE_RELEASE_9 -DUPDATE_RELEASE_10") add_definitions("-DUPDATE_RELEASE_9 -DUPDATE_RELEASE_10")
elseif (${S1AP_VERSION} STREQUAL "R9") elseif (${S1AP_VERSION} STREQUAL "R9")
...@@ -342,52 +347,28 @@ elseif (${S1AP_VERSION} STREQUAL "R9") ...@@ -342,52 +347,28 @@ elseif (${S1AP_VERSION} STREQUAL "R9")
add_definitions("-DUPDATE_RELEASE_9") add_definitions("-DUPDATE_RELEASE_9")
else(${S1AP_VERSION} STREQUAL "R8") else(${S1AP_VERSION} STREQUAL "R8")
set (ASN1RELDIR R8.10) set (ASN1RELDIR R8.10)
endif(${S1AP_VERSION} STREQUAL "R10") endif(${S1AP_VERSION} STREQUAL "R14")
set(S1AP_ASN_DIR ${S1AP_DIR}/MESSAGES/ASN1/${ASN1RELDIR}) set(S1AP_ASN_DIR ${S1AP_DIR}/MESSAGES/ASN1/${ASN1RELDIR})
set(S1AP_ASN_FILES set(S1AP_C_DIR ${asn1_generated_dir}/S1AP_${ASN1RELDIR})
${S1AP_ASN_DIR}/S1AP-CommonDataTypes.asn message("calling ASN1C_PREFIX=S1AP_ asn1c -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${S1AP_C_DIR} ${S1AP_ASN_DIR}/${S1AP_ASN_FILES}")
${S1AP_ASN_DIR}/S1AP-Constants.asn execute_process(COMMAND mkdir -p ${S1AP_C_DIR}
${S1AP_ASN_DIR}/S1AP-IEs.asn 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}
${S1AP_ASN_DIR}/S1AP-PDU.asn
)
set(S1AP_C_DIR ${asn1_generated_dir}/${ASN1RELDIR})
#message("calling ${asn1c_call} ${S1AP_C_DIR} ${S1AP_ASN_FILES}")
execute_process(COMMAND ${asn1c_call} ${S1AP_C_DIR} ${S1AP_ASN_FILES}
RESULT_VARIABLE ret)
if (NOT ${ret} STREQUAL 0)
message(FATAL_ERROR "${asn1c_call}: error")
endif (NOT ${ret} STREQUAL 0)
execute_process(COMMAND python ${S1AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f${S1AP_ASN_DIR}/S1AP-PDU-Contents.asn -o${S1AP_C_DIR}
RESULT_VARIABLE ret) RESULT_VARIABLE ret)
if (NOT ${ret} STREQUAL 0) if (NOT ${ret} STREQUAL 0)
message(FATAL_ERROR "asn1tostruct.py: error") message(FATAL_ERROR "${ret}: error")
endif (NOT ${ret} STREQUAL 0)
execute_process(COMMAND ${fix_asn1c_call} ${S1AP_C_DIR} S1AP ${S1AP_VERSION}
RESULT_VARIABLE ret)
if (NOT ${ret} STREQUAL 0)
message(FATAL_ERROR "${fix_asn1c_call}: error")
endif (NOT ${ret} STREQUAL 0) endif (NOT ${ret} STREQUAL 0)
file(GLOB S1AP_source ${S1AP_C_DIR}/*.c) file(GLOB S1AP_source ${S1AP_C_DIR}/*.c)
set(S1AP_OAI_generated
${S1AP_C_DIR}/s1ap_decoder.c
${S1AP_C_DIR}/s1ap_encoder.c
${S1AP_C_DIR}/s1ap_xer_print.c
${S1AP_C_DIR}/s1ap_compare.c
${S1AP_C_DIR}/s1ap_ies_defs.h
)
file(GLOB s1ap_h ${S1AP_C_DIR}/*.h) file(GLOB s1ap_h ${S1AP_C_DIR}/*.h)
set(s1ap_h ${s1ap_h} ) set(s1ap_h ${s1ap_h} )
add_custom_command ( add_custom_command (
OUTPUT ${S1AP_OAI_generated} OUTPUT ${S1AP_C_DIR}/S1AP_asn_constant.h
COMMAND ${asn1c_call} ${S1AP_C_DIR} ${S1AP_ASN_FILES} COMMAND mkdir -p ${S1AP_C_DIR}
COMMAND python ${S1AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f${S1AP_ASN_DIR}/S1AP-PDU-Contents.asn -o${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}
COMMAND ${fix_asn1c_call} ${S1AP_C_DIR} S1AP ${S1AP_VERSION} DEPENDS ${S1AP_ASN_DIR}/${S1AP_ASN_FILES}
DEPENDS ${S1AP_ASN_FILES} )
)
add_library(S1AP_LIB add_library(S1AP_LIB
${S1AP_OAI_generated}
${S1AP_source} ${S1AP_source}
${S1AP_DIR}/s1ap_common.c ${S1AP_DIR}/s1ap_common.c
) )
...@@ -396,10 +377,9 @@ include_directories ("${S1AP_C_DIR}") ...@@ -396,10 +377,9 @@ include_directories ("${S1AP_C_DIR}")
include_directories ("${S1AP_DIR}") include_directories ("${S1AP_DIR}")
add_library(S1AP_ENB add_library(S1AP_ENB
${S1AP_C_DIR}/s1ap_ies_defs.h # ${S1AP_C_DIR}/s1ap_ies_defs.h
${S1AP_DIR}/s1ap_eNB.c ${S1AP_DIR}/s1ap_eNB.c
${S1AP_DIR}/s1ap_eNB_context_management_procedures.c ${S1AP_DIR}/s1ap_eNB_context_management_procedures.c
${S1AP_DIR}/s1ap_eNB_decoder.c
${S1AP_DIR}/s1ap_eNB_encoder.c ${S1AP_DIR}/s1ap_eNB_encoder.c
${S1AP_DIR}/s1ap_eNB_handlers.c ${S1AP_DIR}/s1ap_eNB_handlers.c
${S1AP_DIR}/s1ap_eNB_itti_messaging.c ${S1AP_DIR}/s1ap_eNB_itti_messaging.c
...@@ -409,6 +389,7 @@ add_library(S1AP_ENB ...@@ -409,6 +389,7 @@ add_library(S1AP_ENB
${S1AP_DIR}/s1ap_eNB_overload.c ${S1AP_DIR}/s1ap_eNB_overload.c
${S1AP_DIR}/s1ap_eNB_trace.c ${S1AP_DIR}/s1ap_eNB_trace.c
${S1AP_DIR}/s1ap_eNB_ue_context.c ${S1AP_DIR}/s1ap_eNB_ue_context.c
${S1AP_DIR}/s1ap_eNB_decoder.c
) )
...@@ -417,61 +398,39 @@ add_library(S1AP_ENB ...@@ -417,61 +398,39 @@ add_library(S1AP_ENB
# Same limitation as described in RRC/S1AP: unknown generated file list # Same limitation as described in RRC/S1AP: unknown generated file list
# so we generate it at cmake time # so we generate it at cmake time
############## ##############
add_list1_option(X2AP_VERSION R11 "X2AP Asn.1 grammar version" R10 R11) add_list1_option(X2AP_VERSION R14 "X2AP Asn.1 grammar version" R10 R11 R14)
set(X2AP_DIR ${OPENAIR2_DIR}/X2AP) set(X2AP_DIR ${OPENAIR2_DIR}/X2AP)
if (${X2AP_VERSION} STREQUAL "R11") if (${X2AP_VERSION} STREQUAL "R14")
set (ASN1RELDIR R14.5)
set (X2AP_ASN_FILES x2ap-14.5.0.asn1)
elseif (${X2AP_VERSION} STREQUAL "R11")
set (ASN1RELDIR R11.2) set (ASN1RELDIR R11.2)
elseif (${X2AP_VERSION} STREQUAL "R10") elseif (${X2AP_VERSION} STREQUAL "R10")
set (ASN1RELDIR R.UNKNOWN) set (ASN1RELDIR R.UNKNOWN)
endif(${X2AP_VERSION} STREQUAL "R11") endif(${X2AP_VERSION} STREQUAL "R14")
set(X2AP_ASN_DIR ${X2AP_DIR}/MESSAGES/ASN1/${ASN1RELDIR}) set(X2AP_ASN_DIR ${X2AP_DIR}/MESSAGES/ASN1/${ASN1RELDIR})
set(X2AP_ASN_FILES
${X2AP_ASN_DIR}/X2AP-CommonDataTypes.asn
${X2AP_ASN_DIR}/X2AP-Constants.asn
${X2AP_ASN_DIR}/X2AP-IEs.asn
${X2AP_ASN_DIR}/X2AP-PDU.asn
${X2AP_ASN_DIR}/X2AP-Containers.asn
)
set(X2AP_C_DIR ${asn1_generated_dir}/${ASN1RELDIR}) set(X2AP_C_DIR ${asn1_generated_dir}/X2AP_${ASN1RELDIR})
#message("calling ${asn1c_call} ${X2AP_C_DIR} ${X2AP_ASN_FILES}") message("calling asn1c -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 ${asn1c_call} ${X2AP_C_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)
if (NOT ${ret} STREQUAL 0) if (NOT ${ret} STREQUAL 0)
message(FATAL_ERROR "${asn1c_call}: error") message(FATAL_ERROR "${asn1c_call}: error")
endif (NOT ${ret} STREQUAL 0) endif (NOT ${ret} STREQUAL 0)
execute_process(COMMAND python ${X2AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f ${X2AP_ASN_DIR}/X2AP-PDU-Contents.asn -o ${X2AP_C_DIR}
RESULT_VARIABLE ret)
if (NOT ${ret} STREQUAL 0)
message(FATAL_ERROR "asn1tostruct.py: error")
endif (NOT ${ret} STREQUAL 0)
execute_process(COMMAND ${fix_asn1c_call} ${X2AP_C_DIR} X2AP ${X2AP_VERSION}
RESULT_VARIABLE ret)
if (NOT ${ret} STREQUAL 0)
message(FATAL_ERROR "${fix_asn1c_call}: error")
endif (NOT ${ret} STREQUAL 0)
file(GLOB X2AP_source ${X2AP_C_DIR}/*.c) file(GLOB X2AP_source ${X2AP_C_DIR}/*.c)
set(X2AP_OAI_generated
${X2AP_C_DIR}/x2ap_decoder.c
${X2AP_C_DIR}/x2ap_encoder.c
${X2AP_C_DIR}/x2ap_xer_print.c
${X2AP_C_DIR}/x2ap_ies_defs.h
)
file(GLOB x2ap_h ${X2AP_C_DIR}/*.h) file(GLOB x2ap_h ${X2AP_C_DIR}/*.h)
set(x2ap_h ${x2ap_h} ) set(x2ap_h ${x2ap_h} )
#message("calling ${X2AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f ${X2AP_ASN_DIR}/X2AP-PDU-Contents.asn -o ${X2AP_C_DIR}")
add_custom_command ( add_custom_command (
OUTPUT ${X2AP_OAI_generated} OUTPUT ${X2AP_C_DIR}/X2AP_asn_constant.h
COMMAND ${asn1c_call} ${X2AP_C_DIR} ${X2AP_ASN_FILES} COMMAND mkdir -p ${X2AP_C_DIR}
COMMAND python ${X2AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f ${X2AP_ASN_DIR}/X2AP-PDU-Contents.asn -o ${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}
COMMAND ${fix_asn1c_call} ${X2AP_C_DIR} X2AP ${X2AP_VERSION} DEPENDS ${X2AP_ASN_DIR}/${X2AP_ASN_FILES}
DEPENDS ${X2AP_ASN_FILES}
) )
add_library(X2AP_LIB add_library(X2AP_LIB
${X2AP_OAI_generated}
${X2AP_source} ${X2AP_source}
${X2AP_DIR}/x2ap_common.c ${X2AP_DIR}/x2ap_common.c
) )
......
...@@ -659,8 +659,10 @@ install_asn1c_from_source(){ ...@@ -659,8 +659,10 @@ install_asn1c_from_source(){
echo_info "\nInstalling ASN1. The log file for ASN1 installation is here: $asn1_install_log " echo_info "\nInstalling ASN1. The log file for ASN1 installation is here: $asn1_install_log "
( (
$SUDO rm -rf /tmp/asn1c $SUDO rm -rf /tmp/asn1c
GIT_SSL_NO_VERIFY=true git clone https://gitlab.eurecom.fr/oai/asn1c.git /tmp/asn1c # GIT_SSL_NO_VERIFY=true git clone https://gitlab.eurecom.fr/oai/asn1c.git /tmp/asn1c
git clone git checkout https://github.com/velichkov/asn1c /tmp/asn1c
cd /tmp/asn1c cd /tmp/asn1c
git checkout s1ap
./configure ./configure
make -j`nproc` make -j`nproc`
$SUDO make install $SUDO make install
......
...@@ -94,7 +94,7 @@ function patch_rrc() ...@@ -94,7 +94,7 @@ function patch_rrc()
case "$version" in case "$version" in
Rel14 ) Rel14 )
echo "patching RRC files release 14" echo "patching RRC files release 14"
apply_patches "$directory" RRC_Rel14 ${#RRC_Rel14[*]} # apply_patches "$directory" RRC_Rel14 ${#RRC_Rel14[*]}
;; ;;
Rel10 ) Rel10 )
echo "patching RRC files release 10" echo "patching RRC files release 10"
...@@ -115,6 +115,8 @@ function patch_x2ap() ...@@ -115,6 +115,8 @@ function patch_x2ap()
local version="$2" local version="$2"
case "$version" in case "$version" in
R14 )
;;
R11 ) R11 )
echo "patching X2AP files release 11.2" echo "patching X2AP files release 11.2"
apply_patches "$directory" X2AP_Rel11_2 ${#X2AP_Rel11_2[*]} apply_patches "$directory" X2AP_Rel11_2 ${#X2AP_Rel11_2[*]}
...@@ -131,6 +133,8 @@ function patch_s1ap() ...@@ -131,6 +133,8 @@ function patch_s1ap()
local version="$2" local version="$2"
case "$version" in case "$version" in
R14 )
;;
R10 ) R10 )
#nothing to do anymore (fixes went to asn1c) #nothing to do anymore (fixes went to asn1c)
;; ;;
......
...@@ -99,7 +99,7 @@ echo done with asnfix ...@@ -99,7 +99,7 @@ echo done with asnfix
echo running asn1c echo running asn1c
asn1c -gen-PER -fcompound-names fixed_grammar.asn 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample asn1c -gen-PER -fcompound-names -no-gen-example fixed_grammar.asn 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample
rm -f fixed_grammar.asn rm -f fixed_grammar.asn
...@@ -107,7 +107,7 @@ echo asn1c done ...@@ -107,7 +107,7 @@ echo asn1c done
else else
asn1c -gen-PER -fcompound-names $* 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample asn1c -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example $* 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample
fi fi
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include <stdint.h> #include <stdint.h>
#include "x2ap_common.h" #include "x2ap_common.h"
#include "X2AP-PDU.h" #include "X2AP_X2AP-PDU.h"
int asn_debug = 0; int asn_debug = 0;
int asn1_xer_print = 0; int asn1_xer_print = 0;
...@@ -55,29 +55,27 @@ inline void ASN_DEBUG(const char *fmt, ...) ...@@ -55,29 +55,27 @@ inline void ASN_DEBUG(const char *fmt, ...)
ssize_t x2ap_generate_initiating_message( ssize_t x2ap_generate_initiating_message(
uint8_t **buffer, uint8_t **buffer,
uint32_t *length, uint32_t *length,
X2ap_ProcedureCode_t procedureCode, X2AP_ProcedureCode_t procedureCode,
X2ap_Criticality_t criticality, X2AP_Criticality_t criticality,
asn_TYPE_descriptor_t *td, asn_TYPE_descriptor_t *td,
void *sptr) void *sptr)
{ {
X2AP_PDU_t pdu; X2AP_X2AP_PDU_t pdu;
ssize_t encoded; ssize_t encoded;
memset(&pdu, 0, sizeof(X2AP_X2AP_PDU_t));
memset(&pdu, 0, sizeof(X2AP_PDU_t)); pdu.present = X2AP_X2AP_PDU_PR_initiatingMessage;
pdu.present = X2AP_PDU_PR_initiatingMessage;
pdu.choice.initiatingMessage.procedureCode = procedureCode; pdu.choice.initiatingMessage.procedureCode = procedureCode;
pdu.choice.initiatingMessage.criticality = criticality; pdu.choice.initiatingMessage.criticality = criticality;
ANY_fromType_aper(&pdu.choice.initiatingMessage.value, td, sptr); ANY_fromType_aper(&pdu.choice.initiatingMessage.value, td, sptr);
if (asn1_xer_print) { if (asn1_xer_print) {
xer_fprint(stdout, &asn_DEF_X2AP_PDU, (void *)&pdu); xer_fprint(stdout, &asn_DEF_X2AP_X2AP_PDU, (void *)&pdu);
} }
/* We can safely free list of IE from sptr */ /* We can safely free list of IE from sptr */
ASN_STRUCT_FREE_CONTENTS_ONLY(*td, sptr); ASN_STRUCT_FREE_CONTENTS_ONLY(*td, sptr);
if ((encoded = aper_encode_to_new_buffer(&asn_DEF_X2AP_PDU, 0, &pdu, if ((encoded = aper_encode_to_new_buffer(&asn_DEF_X2AP_X2AP_PDU, 0, &pdu,
(void **)buffer)) < 0) { (void **)buffer)) < 0) {
return -1; return -1;
} }
...@@ -89,107 +87,67 @@ ssize_t x2ap_generate_initiating_message( ...@@ -89,107 +87,67 @@ ssize_t x2ap_generate_initiating_message(
ssize_t x2ap_generate_successfull_outcome( ssize_t x2ap_generate_successfull_outcome(
uint8_t **buffer, uint8_t **buffer,
uint32_t *length, uint32_t *length,
X2ap_ProcedureCode_t procedureCode, X2AP_ProcedureCode_t procedureCode,
X2ap_Criticality_t criticality, X2AP_Criticality_t criticality,
asn_TYPE_descriptor_t *td, asn_TYPE_descriptor_t *td,
void *sptr) void *sptr)
{ {
X2AP_PDU_t pdu; X2AP_X2AP_PDU_t pdu;
ssize_t encoded; ssize_t encoded;
memset(&pdu, 0, sizeof(X2AP_X2AP_PDU_t));
memset(&pdu, 0, sizeof(X2AP_PDU_t)); pdu.present = X2AP_X2AP_PDU_PR_successfulOutcome;
pdu.present = X2AP_PDU_PR_successfulOutcome;
pdu.choice.successfulOutcome.procedureCode = procedureCode; pdu.choice.successfulOutcome.procedureCode = procedureCode;
pdu.choice.successfulOutcome.criticality = criticality; pdu.choice.successfulOutcome.criticality = criticality;
ANY_fromType_aper(&pdu.choice.successfulOutcome.value, td, sptr); ANY_fromType_aper(&pdu.choice.successfulOutcome.value, td, sptr);
if (asn1_xer_print) { if (asn1_xer_print) {
xer_fprint(stdout, &asn_DEF_X2AP_PDU, (void *)&pdu); xer_fprint(stdout, &asn_DEF_X2AP_X2AP_PDU, (void *)&pdu);
} }
/* We can safely free list of IE from sptr */ /* We can safely free list of IE from sptr */
ASN_STRUCT_FREE_CONTENTS_ONLY(*td, sptr); ASN_STRUCT_FREE_CONTENTS_ONLY(*td, sptr);
if ((encoded = aper_encode_to_new_buffer(&asn_DEF_X2AP_PDU, 0, &pdu, if ((encoded = aper_encode_to_new_buffer(&asn_DEF_X2AP_X2AP_PDU, 0, &pdu,
(void **)buffer)) < 0) { (void **)buffer)) < 0) {
return -1; return -1;
} }
*length = encoded; *length = encoded;
return encoded; return encoded;
} }
ssize_t x2ap_generate_unsuccessfull_outcome( ssize_t x2ap_generate_unsuccessfull_outcome(
uint8_t **buffer, uint8_t **buffer,
uint32_t *length, uint32_t *length,
X2ap_ProcedureCode_t procedureCode, X2AP_ProcedureCode_t procedureCode,
X2ap_Criticality_t criticality, X2AP_Criticality_t criticality,
asn_TYPE_descriptor_t *td, asn_TYPE_descriptor_t *td,
void *sptr) void *sptr)
{ {
X2AP_PDU_t pdu; X2AP_X2AP_PDU_t pdu;
ssize_t encoded; ssize_t encoded;
memset(&pdu, 0, sizeof(X2AP_X2AP_PDU_t));
memset(&pdu, 0, sizeof(X2AP_PDU_t)); pdu.present = X2AP_X2AP_PDU_PR_unsuccessfulOutcome;
pdu.present = X2AP_PDU_PR_unsuccessfulOutcome;
pdu.choice.successfulOutcome.procedureCode = procedureCode; pdu.choice.successfulOutcome.procedureCode = procedureCode;
pdu.choice.successfulOutcome.criticality = criticality; pdu.choice.successfulOutcome.criticality = criticality;
ANY_fromType_aper(&pdu.choice.successfulOutcome.value, td, sptr); ANY_fromType_aper(&pdu.choice.successfulOutcome.value, td, sptr);
if (asn1_xer_print) { if (asn1_xer_print) {
xer_fprint(stdout, &asn_DEF_X2AP_PDU, (void *)&pdu); xer_fprint(stdout, &asn_DEF_X2AP_X2AP_PDU, (void *)&pdu);
} }
/* We can safely free list of IE from sptr */ /* We can safely free list of IE from sptr */
ASN_STRUCT_FREE_CONTENTS_ONLY(*td, sptr); ASN_STRUCT_FREE_CONTENTS_ONLY(*td, sptr);
if ((encoded = aper_encode_to_new_buffer(&asn_DEF_X2AP_PDU, 0, &pdu, if ((encoded = aper_encode_to_new_buffer(&asn_DEF_X2AP_X2AP_PDU, 0, &pdu,
(void **)buffer)) < 0) { (void **)buffer)) < 0) {
return -1; return -1;
} }
*length = encoded; *length = encoded;
return encoded; return encoded;
} }
X2ap_IE_t *x2ap_new_ie( void x2ap_handle_criticality(X2AP_Criticality_t criticality)
X2ap_ProtocolIE_ID_t id,
X2ap_Criticality_t criticality,
asn_TYPE_descriptor_t *type,
void *sptr)
{
X2ap_IE_t *buff;
if ((buff = malloc(sizeof(X2ap_IE_t))) == NULL) {
// Possible error on malloc
return NULL;
}
memset((void *)buff, 0, sizeof(X2ap_IE_t));
buff->id = id;
buff->criticality = criticality;
if (ANY_fromType_aper(&buff->value, type, sptr) < 0) {
fprintf(stderr, "Encoding of %s failed\n", type->name);
free(buff);
return NULL;
}
if (asn1_xer_print)
if (xer_fprint(stdout, &asn_DEF_X2ap_IE, buff) < 0) {
free(buff);
return NULL;
}
return buff;
}
void x2ap_handle_criticality(X2ap_Criticality_t criticality)
{ {
} }
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -20,12 +20,12 @@ ...@@ -20,12 +20,12 @@
*/ */
#include <stdint.h> #include <stdint.h>
#include "s1ap_ies_defs.h"
#ifndef S1AP_ENB_DECODER_H_ #ifndef S1AP_ENB_DECODER_H_
#define S1AP_ENB_DECODER_H_ #define S1AP_ENB_DECODER_H_
int s1ap_eNB_decode_pdu(s1ap_message *message, const uint8_t * const buffer, int s1ap_eNB_decode_pdu(S1AP_S1AP_PDU_t *pdu, const uint8_t *const buffer,
const uint32_t length) __attribute__ ((warn_unused_result)); const uint32_t length) __attribute__ ((warn_unused_result));
#endif /* S1AP_ENB_DECODER_H_ */ #endif /* S1AP_ENB_DECODER_H_ */
This diff is collapsed.
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#ifndef S1AP_ENB_ENCODER_H_ #ifndef S1AP_ENB_ENCODER_H_
#define S1AP_ENB_ENCODER_H_ #define S1AP_ENB_ENCODER_H_
int s1ap_eNB_encode_pdu(s1ap_message *message, uint8_t **buffer, uint32_t *len) int s1ap_eNB_encode_pdu(S1AP_S1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *len)
__attribute__ ((warn_unused_result)); __attribute__ ((warn_unused_result));
#endif /* S1AP_ENB_ENCODER_H_ */ #endif /* S1AP_ENB_ENCODER_H_ */
This diff is collapsed.
This diff is collapsed.
...@@ -23,14 +23,14 @@ ...@@ -23,14 +23,14 @@
#define S1AP_ENB_NAS_PROCEDURES_H_ #define S1AP_ENB_NAS_PROCEDURES_H_
int s1ap_eNB_handle_nas_downlink( int s1ap_eNB_handle_nas_downlink(
const uint32_t assoc_id, uint32_t assoc_id,
const uint32_t stream, uint32_t stream,
struct s1ap_message_s* message_p); S1AP_S1AP_PDU_t *pdu);
int s1ap_eNB_nas_uplink(instance_t instance, s1ap_uplink_nas_t *s1ap_uplink_nas_p); int s1ap_eNB_nas_uplink(instance_t instance, s1ap_uplink_nas_t *s1ap_uplink_nas_p);
void s1ap_eNB_nas_non_delivery_ind(instance_t instance, int s1ap_eNB_nas_non_delivery_ind(instance_t instance,
s1ap_nas_non_delivery_ind_t *s1ap_nas_non_delivery_ind); s1ap_nas_non_delivery_ind_t *s1ap_nas_non_delivery_ind);
int s1ap_eNB_handle_nas_first_req( int s1ap_eNB_handle_nas_first_req(
instance_t instance, s1ap_nas_first_req_t *s1ap_nas_first_req_p); instance_t instance, s1ap_nas_first_req_t *s1ap_nas_first_req_p);
...@@ -45,8 +45,8 @@ int s1ap_eNB_e_rab_setup_resp(instance_t instance, ...@@ -45,8 +45,8 @@ int s1ap_eNB_e_rab_setup_resp(instance_t instance,
s1ap_e_rab_setup_resp_t *e_rab_setup_resp_p); s1ap_e_rab_setup_resp_t *e_rab_setup_resp_p);
int s1ap_eNB_e_rab_modify_resp(instance_t instance, int s1ap_eNB_e_rab_modify_resp(instance_t instance,
s1ap_e_rab_modify_resp_t *e_rab_modify_resp_p); s1ap_e_rab_modify_resp_t *e_rab_modify_resp_p);
int s1ap_eNB_e_rab_release_resp(instance_t instance, int s1ap_eNB_e_rab_release_resp(instance_t instance,
s1ap_e_rab_release_resp_t *e_rab_release_resp_p); s1ap_e_rab_release_resp_t *e_rab_release_resp_p);
#endif /* S1AP_ENB_NAS_PROCEDURES_H_ */ #endif /* S1AP_ENB_NAS_PROCEDURES_H_ */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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