Commit a247907d authored by Bi-Ruei, Chiu's avatar Bi-Ruei, Chiu
Browse files

Use an un-official community collaboration version of asn1c

1. It's no need to modify LTE-RRC's ASN.1 file for enabling option group
   feature in generate_asn1.
2. It's no need to patch the C header files generated from
   LTE-RRC/S1AP/X2AP's ASN.1 in fix_asn1.
3. It's no need to pre-process S1AP/X2AP's ASN.1 for enabling information
   object class feature by asn1tostruct.py.

This commit requires an un-official version of asn1c which are
collaboration of asn1c community members and `build_helper` is modified
in this commit accordingly :

  https://github.com/brchiu/asn1c/tree/velichkov_s1ap_plus_option_group

This asn1c can also convert ASN.1 of 5G NR RRC (38.331, v15.1.0) and
generate C files with -findirect-choice command line option without
tweaking ASN.1 file.

Examples for how to use this asn1c for S1AP are in S1AP files, e.g.
s1ap_eNB_nas_procedures.c and s1ap_eNB_handler.c.

There is an modified openair-cn (based on tag 0.5.0) with this new asn1c at :

  https://github.com/brchiu/openair-cn/tree...
parent df1e5b21
......@@ -170,7 +170,7 @@ set(CMAKE_C_FLAGS
"${CMAKE_C_FLAGS} ${C_FLAGS_PROCESSOR} -std=gnu99 -Wall -Wstrict-prototypes -fno-strict-aliasing -rdynamic -funroll-loops -Wno-packed-bitfield-compat -fPIC ")
# add autotools definitions that were maybe used!
set(CMAKE_C_FLAGS
"${CMAKE_C_FLAGS} -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_STRERROR=1 -DHAVE_SOCKET=1 -DHAVE_MEMSET=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_LIBSCTP -D'MAKE_VERSION(a,b,c)=((a)*256+(b)*16+c)'"
"${CMAKE_C_FLAGS} -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_STRERROR=1 -DHAVE_SOCKET=1 -DHAVE_MEMSET=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_LIBSCTP -DASN_DISABLE_OER_SUPPORT -D'MAKE_VERSION(a,b,c)=((a)*256+(b)*16+c)'"
)
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} ${C_FLAGS_PROCESSOR} -std=c++11 "
......@@ -281,8 +281,8 @@ endif (${ENABLE_ITTI})
# (so creating new asn.1 objects instead of modifying the object attributes)
# New C code source file, cmake must be re-run (instead of re-running make only)
#############
set(asn1c_call "${OPENAIR_CMAKE}/tools/generate_asn1")
set(fix_asn1c_call "${OPENAIR_CMAKE}/tools/fix_asn1")
# set(asn1c_call "${OPENAIR_CMAKE}/tools/generate_asn1")
# set(fix_asn1c_call "${OPENAIR_CMAKE}/tools/fix_asn1")
set(asn1_generated_dir ${OPENAIR_BIN_DIR})
set(protoc_call "${OPENAIR_CMAKE}/tools/generate_protobuf")
......@@ -302,28 +302,32 @@ elseif (${RRC_ASN1_VERSION} STREQUAL "CBA")
elseif (${RRC_ASN1_VERSION} STREQUAL "Rel10")
make_version(RRC_VERSION 10 2 0)
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20.asn)
else()
make_version(RRC_VERSION 14 3 0)
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/RRC-e30.asn)
elseif (${RRC_ASN1_VERSION} STREQUAL "Rel11")
make_version(RRC_VERSION 11 18 0)
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-11.18.0.asn1)
elseif (${RRC_ASN1_VERSION} STREQUAL "Rel12")
make_version(RRC_VERSION 12 16 0)
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-12.16.0.asn1)
elseif (${RRC_ASN1_VERSION} STREQUAL "Rel13")
make_version(RRC_VERSION 13 9 1)
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-13.9.1.asn1)
elseif (${RRC_ASN1_VERSION} STREQUAL "Rel14")
make_version(RRC_VERSION 14 6 2)
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-14.6.2.asn1)
elseif (${RRC_ASN1_VERSION} STREQUAL "Rel15")
make_version(RRC_VERSION 15 1 0)
set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1c/ASN1_files/lte-rrc-15.1.0.asn1)
endif (${RRC_ASN1_VERSION} STREQUAL "Rel8")
add_definitions(-DRRC_VERSION=${RRC_VERSION})
set (RRC_FULL_DIR ${asn1_generated_dir}/RRC_${RRC_ASN1_VERSION})
if(NOT EXISTS ${asn1c_call})
message( FATAL_ERROR "The script ${asn1c_call} must be present" )
endif(NOT EXISTS ${asn1c_call})
execute_process(COMMAND ${asn1c_call} ${RRC_FULL_DIR} ${RRC_GRAMMAR}
RESULT_VARIABLE ret)
if (NOT ${ret} STREQUAL 0)
message(FATAL_ERROR "${asn1c_call}: error")
endif (NOT ${ret} STREQUAL 0)
if(NOT EXISTS ${fix_asn1c_call})
message( FATAL_ERROR "The script ${fix_asn1c_call} must be present" )
endif(NOT EXISTS ${fix_asn1c_call})
execute_process(COMMAND ${fix_asn1c_call} ${RRC_FULL_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)
if (NOT ${ret} STREQUAL 0)
message(FATAL_ERROR "${fix_asn1c_call}: error")
message(FATAL_ERROR "${ret}: error")
endif (NOT ${ret} STREQUAL 0)
file(GLOB rrc_source ${RRC_FULL_DIR}/*.c)
file(GLOB rrc_h ${RRC_FULL_DIR}/*.h)
set(rrc_h ${rrc_h} ${RRC_FULL_DIR}/asn1_constants.h)
......@@ -337,8 +341,8 @@ include_directories ("${RRC_FULL_DIR}")
# Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make
add_custom_command (
OUTPUT ${RRC_FULL_DIR}/asn1_constants.h
COMMAND ${asn1c_call} ${RRC_FULL_DIR} ${RRC_GRAMMAR}
COMMAND ${fix_asn1c_call} ${RRC_FULL_DIR} RRC ${RRC_ASN1_VERSION}
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}
DEPENDS ${RRC_GRAMMAR}
)
......@@ -346,65 +350,56 @@ add_custom_command (
# Same limitation as described in RRC: unknown generated file list
# so we generate it at cmake time
##############
add_list1_option(S1AP_RELEASE R10 "S1AP ASN.1 grammar version" R8 R9 R10)
add_list1_option(S1AP_RELEASE R14 "S1AP ASN.1 grammar version" R8 R9 R10 R14 R15)
set(S1AP_DIR ${OPENAIR3_DIR}/S1AP)
if (${S1AP_RELEASE} STREQUAL "R8")
make_version(S1AP_VERSION 8 10 0)
set (ASN1RELDIR R8.10)
set(S1AP_ASN_FILES "s1ap-8.10.0.asn1")
elseif (${S1AP_RELEASE} STREQUAL "R9")
make_version(S1AP_VERSION 9 8 0)
set (ASN1RELDIR R9.8)
make_version(S1AP_VERSION 9 10 0)
set(S1AP_ASN_FILES "s1ap-9.10.0.asn1")
elseif (${S1AP_RELEASE} STREQUAL "R10")
make_version(S1AP_VERSION 10 5 0)
set (ASN1RELDIR R10.5)
make_version(S1AP_VERSION 10 9 0)
set(S1AP_ASN_FILES "s1ap-10.9.0.asn1")
elseif (${S1AP_RELEASE} STREQUAL "R11")
make_version(S1AP_VERSION 11 8 0)
set(S1AP_ASN_FILES "s1ap-11.8.0.asn1")
elseif (${S1AP_RELEASE} STREQUAL "R12")
make_version(S1AP_VERSION 12 7 0)
set(S1AP_ASN_FILES "s1ap-12.7.0.asn1")
elseif (${S1AP_RELEASE} STREQUAL "R13")
make_version(S1AP_VERSION 13 6 0)
set(S1AP_ASN_FILES "s1ap-13.6.0.asn1")
elseif (${S1AP_RELEASE} STREQUAL "R14")
make_version(S1AP_VERSION 14 5 0)
set(S1AP_ASN_FILES "s1ap-14.5.0.asn1")
else (${S1AP_RELEASE} STREQUAL "R15")
make_version(S1AP_VERSION 15 1 0)
set(S1AP_ASN_FILES "s1ap-15.1.0.asn1")
endif(${S1AP_RELEASE} STREQUAL "R8")
add_definitions(-DS1AP_VERSION=${S1AP_VERSION})
set(S1AP_ASN_DIR ${S1AP_DIR}/MESSAGES/ASN1/${ASN1RELDIR})
set(S1AP_ASN_FILES
${S1AP_ASN_DIR}/S1AP-CommonDataTypes.asn
${S1AP_ASN_DIR}/S1AP-Constants.asn
${S1AP_ASN_DIR}/S1AP-IEs.asn
${S1AP_ASN_DIR}/S1AP-PDU.asn
)
set(S1AP_C_DIR ${asn1_generated_dir}/S1AP_${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)
if (NOT ${ret} STREQUAL 0)
message(FATAL_ERROR "asn1tostruct.py: error")
endif (NOT ${ret} STREQUAL 0)
execute_process(COMMAND ${fix_asn1c_call} ${S1AP_C_DIR} S1AP ${S1AP_RELEASE}
set(S1AP_ASN_DIR ${S1AP_DIR}/MESSAGES/ASN1/${S1AP_RELEASE})
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)
if (NOT ${ret} STREQUAL 0)
message(FATAL_ERROR "${fix_asn1c_call}: error")
message(FATAL_ERROR "${ret}: error")
endif (NOT ${ret} STREQUAL 0)
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)
set(s1ap_h ${s1ap_h} )
set(s1ap_h ${s1ap_h})
add_custom_command (
OUTPUT ${S1AP_OAI_generated}
COMMAND ${asn1c_call} ${S1AP_C_DIR} ${S1AP_ASN_FILES}
COMMAND python ${S1AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f${S1AP_ASN_DIR}/S1AP-PDU-Contents.asn -o${S1AP_C_DIR}
COMMAND ${fix_asn1c_call} ${S1AP_C_DIR} S1AP ${S1AP_RELEASE}
DEPENDS ${S1AP_ASN_FILES}
)
OUTPUT ${S1AP_C_DIR}/S1AP_asn_constant.h
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}
DEPENDS ${S1AP_ASN_DIR}/${S1AP_ASN_FILES}
)
add_library(S1AP_LIB
${S1AP_OAI_generated}
${S1AP_source}
${S1AP_DIR}/s1ap_common.c
)
......@@ -413,7 +408,6 @@ include_directories ("${S1AP_C_DIR}")
include_directories ("${S1AP_DIR}")
add_library(S1AP_ENB
${S1AP_C_DIR}/s1ap_ies_defs.h
${S1AP_DIR}/s1ap_eNB.c
${S1AP_DIR}/s1ap_eNB_context_management_procedures.c
${S1AP_DIR}/s1ap_eNB_decoder.c
......@@ -428,70 +422,52 @@ add_library(S1AP_ENB
${S1AP_DIR}/s1ap_eNB_ue_context.c
)
#X2AP
# Same limitation as described in RRC/S1AP: unknown generated file list
# so we generate it at cmake time
##############
add_list1_option(X2AP_RELEASE R11 "X2AP ASN.1 grammar version" R10 R11)
add_list1_option(X2AP_RELEASE R14 "X2AP ASN.1 grammar version" R8 R11 R12 R14 R15)
set(X2AP_DIR ${OPENAIR2_DIR}/X2AP)
if (${X2AP_RELEASE} STREQUAL "R10")
make_version(S1AP_VERSION 10 0 0)
set (ASN1RELDIR R.UNKNOWN)
if (${X2AP_RELEASE} STREQUAL "R8")
make_version(X2AP_VERSION 8 9 0)
set(X2AP_ASN_FILES x2ap-8.9.0.asn1)
elseif (${X2AP_RELEASE} STREQUAL "R11")
make_version(S1AP_VERSION 11 2 0)
set (ASN1RELDIR R11.2)
endif(${X2AP_RELEASE} STREQUAL "R10")
make_version(X2AP_VERSION 11 9 0)
set(X2AP_ASN_FILES x2ap-11.9.0.asn1)
elseif (${X2AP_RELEASE} STREQUAL "R12")
make_version(X2AP_VERSION 12 9 0)
set(X2AP_ASN_FILES x2ap-12.9.0.asn1)
elseif (${X2AP_RELEASE} STREQUAL "R14")
make_version(X2AP_VERSION 14 6 0)
set(X2AP_ASN_FILES x2ap-14.6.0.asn1)
elseif (${X2AP_RELEASE} STREQUAL "R15")
make_version(X2AP_VERSION 15 1 0)
set(X2AP_ASN_FILES x2ap-15.1.0.asn1)
endif(${X2AP_RELEASE} STREQUAL "R8")
add_definitions(-DX2AP_VERSION=${X2AP_VERSION})
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}/X2AP_${ASN1RELDIR})
#message("calling ${asn1c_call} ${X2AP_C_DIR} ${X2AP_ASN_FILES}")
execute_process(COMMAND ${asn1c_call} ${X2AP_C_DIR} ${X2AP_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 ${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_RELEASE}
set(X2AP_ASN_DIR ${X2AP_DIR}/MESSAGES/ASN1/${X2AP_RELEASE})
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)
if (NOT ${ret} STREQUAL 0)
message(FATAL_ERROR "${fix_asn1c_call}: error")
message(FATAL_ERROR "${ret}: error")
endif (NOT ${ret} STREQUAL 0)
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)
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 (
OUTPUT ${X2AP_OAI_generated}
COMMAND ${asn1c_call} ${X2AP_C_DIR} ${X2AP_ASN_FILES}
COMMAND python ${X2AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f ${X2AP_ASN_DIR}/X2AP-PDU-Contents.asn -o ${X2AP_C_DIR}
COMMAND ${fix_asn1c_call} ${X2AP_C_DIR} X2AP ${X2AP_RELEASE}
DEPENDS ${X2AP_ASN_FILES}
OUTPUT ${X2AP_C_DIR}/X2AP_asn_constant.h
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}
DEPENDS ${X2AP_ASN_DIR}/${X2AP_ASN_FILES}
)
add_library(X2AP_LIB
${X2AP_OAI_generated}
${X2AP_source}
${X2AP_DIR}/x2ap_common.c
)
......@@ -2304,7 +2280,7 @@ endforeach()
# castxml doesn't work with c11 (gcc 5 default)
# force castxml and clang compilation with gnu89 standard
# we can't use cXX standard as pthread_rwlock_t is gnu standard
list(APPEND itti_compiler_options "-std=gnu89;-D'MAKE_VERSION(a,b,c)=((a)*256+(b)*16+c)'")
list(APPEND itti_compiler_options "-std=gnu89;-DASN_DISABLE_OER_SUPPORT;-D'MAKE_VERSION(a,b,c)=((a)*256+(b)*16+c)'")
set (ITTI_H ${ITTI_DIR}/intertask_interface_types.h)
if(EXISTS /usr/bin/gccxml)
set(xml_command gccxml ${itti_compiler_options} -fxml=${OPENAIR_BIN_DIR}/messages.xml ${ITTI_H})
......
......@@ -678,8 +678,10 @@ install_asn1c_from_source(){
echo_info "\nInstalling ASN1. The log file for ASN1 installation is here: $asn1_install_log "
(
$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 https://github.com/brchiu/asn1c /tmp/asn1c
cd /tmp/asn1c
git checkout velichkov_s1ap_plus_option_group
./configure
make -j`nproc`
$SUDO make install
......
......@@ -22,7 +22,7 @@
#ifndef GTPV1_U_MESSAGES_TYPES_H_
#define GTPV1_U_MESSAGES_TYPES_H_
#include "asn1_constants.h"
#include "asn_constant.h"
#define GTPV1U_MAX_BEARERS_PER_UE max_val_DRB_Identity
......
......@@ -29,7 +29,7 @@
***************************************************************************/
#ifdef CMAKER
#include "asn1_constants.h"
#include "asn_constant.h"
#else
#include "RRC/LTE/MESSAGES/asn1_constants.h"
#endif
......
......@@ -21,7 +21,7 @@
#ifndef RAL_MESSAGES_TYPES_H_
#define RAL_MESSAGES_TYPES_H_
#include "asn1_constants.h"
#include "asn_constant.h"
#include "platform_types.h"
#include "commonDef.h"
/* 802.21 mappings with the RRC protocol :
......
......@@ -38,7 +38,7 @@ MESSAGE_DEF(S1AP_E_RAB_MODIFY_RESPONSE_LOG , MESSAGE_PRIORITY_MED, IttiMsgTex
MESSAGE_DEF(S1AP_PAGING_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_paging_log)
MESSAGE_DEF(S1AP_E_RAB_RELEASE_REQUEST_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_e_rab_release_request_log)
MESSAGE_DEF(S1AP_E_RAB_RELEASE_RESPONSE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_e_rab_release_response_log)
MESSAGE_DEF(S1AP_E_RAB_ERROR_INDICATION_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_error_indication_log)
MESSAGE_DEF(S1AP_ERROR_INDICATION_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_error_indication_log)
/* eNB application layer -> S1AP messages */
MESSAGE_DEF(S1AP_REGISTER_ENB_REQ , MESSAGE_PRIORITY_MED, s1ap_register_enb_req_t , s1ap_register_enb_req)
......
......@@ -44,7 +44,7 @@
# include "rlc_am_structs.h"
# include "rlc_tm_structs.h"
# include "rlc_um_structs.h"
# include "asn1_constants.h"
# include "asn_constant.h"
# include "UTIL/LOG/log.h"
# include "mem_block.h"
//# include "PHY/defs.h"
......
......@@ -99,15 +99,29 @@ void *ue_ip_interrupt(void)
}
#endif //NETLINK
//---------------------------------------------------------------------------
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0))
void ue_ip_timer(struct timer_list *t)
#else
void ue_ip_timer(unsigned long dataP)
#endif
{
//---------------------------------------------------------------------------
ue_ip_priv_t *priv_p=(ue_ip_priv_t *)dataP;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0))
ue_ip_priv_t *priv_p = from_timer(priv_p, t, timer);
#else
ue_ip_priv_t *priv_p = (ue_ip_priv_t *)dataP;
#endif
spin_lock(&priv_p->lock);
(priv_p->timer).function=ue_ip_timer;
(priv_p->timer).expires=jiffies+UE_IP_TIMER_TICK;
(priv_p->timer).data=dataP;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0))
mod_timer(&priv_p->timer, jiffies + UE_IP_TIMER_TICK);
#else
(priv_p->timer).function = ue_ip_timer;
(priv_p->timer).expires = jiffies + UE_IP_TIMER_TICK;
(priv_p->timer).data = dataP;
add_timer(&priv_p->timer);
#endif
spin_unlock(&priv_p->lock);
return;
// add_timer(&gpriv->timer);
......@@ -137,10 +151,15 @@ int ue_ip_open(struct net_device *dev_pP)
netif_wake_queue(dev_pP);
}
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0))
timer_setup(&(priv_p->timer), ue_ip_timer, 0);
(priv_p->timer).expires = jiffies+UE_IP_TIMER_TICK;
#else
init_timer(&priv_p->timer);
(priv_p->timer).expires = jiffies+UE_IP_TIMER_TICK;
(priv_p->timer).data = (unsigned long)priv_p;
(priv_p->timer).function = ue_ip_timer;
#endif
//add_timer(&priv_p->timer);
printk("[UE_IP_DRV][%s] name = %s\n", __FUNCTION__, dev_pP->name);
......
......@@ -131,6 +131,7 @@ mac_rrc_data_req(
mib->message.systemFrameNumber.buf = &sfn;
enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_BCH_Message,
NULL,
(void*)mib,
carrier->MIB,
24);
......
......@@ -241,6 +241,7 @@ uint8_t do_MIB(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_t phich
#endif
enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_BCH_Message,
NULL,
(void*)mib,
carrier->MIB,
24);
......@@ -320,6 +321,7 @@ uint8_t do_MIB_SL(const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index,
enc_rval = uper_encode_to_buffer(&asn_DEF_SBCCH_SL_BCH_Message,
NULL,
(void*)mib_sl,
UE_rrc_inst[ctxt_pP->module_id].MIB,
24);
......@@ -509,6 +511,7 @@ uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier,
xer_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message, (void*)bcch_message);
#endif
enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_DL_SCH_Message,
NULL,
(void*)bcch_message,
buffer,
100);
......@@ -1354,6 +1357,7 @@ uint8_t do_SIB23(uint8_t Mod_id,
xer_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message, (void*)bcch_message);
#endif
enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_DL_SCH_Message,
NULL,
(void*)bcch_message,
buffer,
900);
......@@ -1442,6 +1446,7 @@ uint8_t do_RRCConnectionRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv)
enc_rval = uper_encode_to_buffer(&asn_DEF_UL_CCCH_Message,
NULL,
(void*)&ul_ccch_msg,
buffer,
100);
......@@ -1609,6 +1614,7 @@ uint8_t do_SidelinkUEInformation(uint8_t Mod_id, uint8_t *buffer, SL_Destinatio
enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message,
NULL,
(void*)&ul_dcch_msg,
buffer,
100);
......@@ -1693,6 +1699,7 @@ uint8_t do_RRCConnectionSetupComplete(uint8_t Mod_id, uint8_t *buffer, const uin
*/
enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message,
NULL,
(void*)&ul_dcch_msg,
buffer,
100);
......@@ -1753,6 +1760,7 @@ do_RRCConnectionReconfigurationComplete(
rrcConnectionReconfigurationComplete->criticalExtensions.choice.rrcConnectionReconfigurationComplete_r8.nonCriticalExtension=NULL;
enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message,
NULL,
(void*)&ul_dcch_msg,
buffer,
100);
......@@ -2163,6 +2171,7 @@ do_RRCConnectionSetup(
xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void*)&dl_ccch_msg);
#endif
enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message,
NULL,
(void*)&dl_ccch_msg,
buffer,
100);
......@@ -2237,6 +2246,7 @@ do_SecurityModeCommand(
xer_fprint(stdout, &asn_DEF_DL_DCCH_Message, (void*)&dl_dcch_msg);
#endif
enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message,
NULL,
(void*)&dl_dcch_msg,
buffer,
100);
......@@ -2316,6 +2326,7 @@ do_UECapabilityEnquiry(
xer_fprint(stdout, &asn_DEF_DL_DCCH_Message, (void*)&dl_dcch_msg);
#endif
enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message,
NULL,
(void*)&dl_dcch_msg,
buffer,
100);
......@@ -2520,6 +2531,7 @@ do_RRCConnectionReconfiguration(
}
enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message,
NULL,
(void*)&dl_dcch_msg,
buffer,
RRC_BUF_SIZE);
......@@ -2736,6 +2748,7 @@ do_RRCConnectionReestablishment(
xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void*)&dl_ccch_msg);
#endif
enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message,
NULL,
(void*)&dl_ccch_msg,
buffer,
100);
......@@ -2797,6 +2810,7 @@ do_RRCConnectionReestablishmentReject(
xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void*)&dl_ccch_msg);
#endif
enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message,
NULL,
(void*)&dl_ccch_msg,
buffer,
100);
......@@ -2859,6 +2873,7 @@ do_RRCConnectionReject(
xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void*)&dl_ccch_msg);
#endif
enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message,
NULL,
(void*)&dl_ccch_msg,
buffer,
100);
......@@ -2924,6 +2939,7 @@ uint8_t do_RRCConnectionRelease(
sizeof(*rrcConnectionRelease->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r8.nonCriticalExtension));
enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message,
NULL,
(void*)&dl_dcch_msg,
buffer,
RRC_BUF_SIZE);
......@@ -3051,6 +3067,7 @@ uint8_t do_MBSFNAreaConfig(uint8_t Mod_id,
xer_fprint(stdout,&asn_DEF_MCCH_Message,(void*)mcch_message);
#endif
enc_rval = uper_encode_to_buffer(&asn_DEF_MCCH_Message,
NULL,
(void*)mcch_message,
buffer,
100);
......@@ -3183,6 +3200,7 @@ uint8_t do_MeasurementReport(uint8_t Mod_id, uint8_t *buffer,int measid,int phy_
measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultNeighCells->choice.measResultListEUTRA=*(measResultListEUTRA2);
enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message,
NULL,
(void*)&ul_dcch_msg,
buffer,
100);
......@@ -3316,7 +3334,7 @@ uint8_t do_Paging(uint8_t Mod_id, uint8_t *buffer, ue_paging_identity_t ue_pagin
LOG_D(RRC, "[eNB %d] do_Paging paging_record: cn_Domain %ld, ue_paging_identity.presenceMask %d, PagingRecordList.count %d\n",
Mod_id, paging_record_p->cn_Domain, ue_paging_identity.presenceMask, pcch_msg.message.choice.c1.choice.paging.pagingRecordList->list.count);
enc_rval = uper_encode_to_buffer(&asn_DEF_PCCH_Message, (void*)&pcch_msg, buffer, RRC_BUF_SIZE);
enc_rval = uper_encode_to_buffer(&asn_DEF_PCCH_Message, NULL, (void*)&pcch_msg, buffer, RRC_BUF_SIZE);
if(enc_rval.encoded == -1)
{
LOG_I(RRC, "[eNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n",
......@@ -3492,6 +3510,7 @@ OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname)
xer_fprint(stdout,&asn_DEF_UE_EUTRA_Capability,(void *)UE_EUTRA_Capability);
#endif
enc_rval = uper_encode_to_buffer(&asn_DEF_UE_EUTRA_Capability,
NULL,
(void*)UE_EUTRA_Capability,
&UECapability.sdu[0],
MAX_UE_CAPABILITY_SIZE);
......
......@@ -131,6 +131,7 @@ uint8_t do_MIB_NB_IoT(
(uint32_t)hsfn_LSB);
enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_BCH_Message_NB,
NULL,
(void*)mib_NB_IoT,
carrier->MIB_NB_IoT,
100);
......@@ -387,6 +388,7 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id,
enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_DL_SCH_Message_NB,
NULL,
(void*)bcch_message,
carrier->SIB1_NB_IoT,
100);
......@@ -669,6 +671,7 @@ uint8_t do_SIB23_NB_IoT(uint8_t Mod_id,
xer_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message_NB, (void*)bcch_message);
#endif
enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_DL_SCH_Message_NB,
NULL,
(void*)bcch_message,
carrier->SIB23_NB_IoT,
900);
......@@ -888,6 +891,7 @@ uint8_t do_RRCConnectionSetup_NB_IoT(
xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void*)&dl_ccch_msg);
#endif
enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message_NB,
NULL,
(void*)&dl_ccch_msg_NB_IoT,
buffer,
100);
......@@ -939,6 +943,7 @@ uint8_t do_SecurityModeCommand_NB_IoT(
xer_fprint(stdout, &asn_DEF_DL_DCCH_Message_NB, (void*)&dl_dcch_msg_NB_IoT);
#endif
enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message_NB,
NULL,
(void*)&dl_dcch_msg_NB_IoT,
buffer,
100);
......@@ -1000,6 +1005,7 @@ uint8_t do_UECapabilityEnquiry_NB_IoT(
xer_fprint(stdout, &asn_DEF_DL_DCCH_Message_NB, (void*)&dl_dcch_msg_NB_IoT);
#endif
enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message_NB,
NULL,