Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
oai
openairinterface5G
Commits
31965637
Commit
31965637
authored
Mar 16, 2016
by
Rohit Gupta
Browse files
Merge branch 'develop' into feature-34-test_framework
parents
ef6f2e2a
c4cb8f47
Changes
31
Expand all
Hide whitespace changes
Inline
Side-by-side
cmake_targets/CMakeLists.txt
View file @
31965637
...
...
@@ -176,42 +176,65 @@ add_definitions(-DCMAKER)
set
(
CMAKE_C_FLAGS_DEBUG
"
${
CMAKE_C_FLAGS
}
-g -DMALLOC_CHECK_=3"
)
set
(
CMAKE_C_FLAGS_RELWITHDEBINFO
"
${
CMAKE_C_FLAGS
}
-g -DMALLOC_CHECK_=3 -O2"
)
Message
(
"RF_BOARD is
${
RF_BOARD
}
"
)
# Below has been put in comment because does not work with
# SVN authentication.
#
#find_package(Subversion)
#if(SUBVERSION_FOUND)
# Subversion_WC_INFO(${OPENAIR_DIR} openair)
# set (FIRMWARE_VERSION "${openair_WC_REVISION} - ${openair_WC_LAST_CHANGED_DATE}")
# Subversion_WC_LOG(${OPENAIR_DIR} Project)
#else()
# set (FIRMWARE_VERSION "No svn information")
#endif()
#add_definitions("-DFIRMWARE_VERSION=\"${FIRMWARE_VERSION}\"")
set
(
GIT_BRANCH
"UNKNOWN"
)
set
(
GIT_COMMIT_HASH
"UNKNOWN"
)
set
(
GIT_COMMIT_DATE
"UNKNOWN"
)
find_package
(
Git
)
if
(
GIT_FOUND
)
message
(
"git found:
${
GIT_EXECUTABLE
}
"
)
# Get the current working branch
execute_process
(
COMMAND git rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY
${
CMAKE_SOURCE_DIR
}
OUTPUT_VARIABLE GIT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# Get the latest abbreviated commit hash of the working branch
execute_process
(
COMMAND git log -1 --format=%h
WORKING_DIRECTORY
${
CMAKE_SOURCE_DIR
}
OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# Get the latest commit date of the working branch
execute_process
(
COMMAND git log -1 --format=%cd
WORKING_DIRECTORY
${
CMAKE_SOURCE_DIR
}
OUTPUT_VARIABLE GIT_COMMIT_DATE
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif
()
# Below is a hard-coded info
set
(
FIRMWARE_VERSION
"No svn information"
)
add_definitions
(
"-DFIRMWARE_VERSION=
\"
${
FIRMWARE_VERSION
}
\"
"
)
add_definitions
(
"-DPACKAGE_VERSION=
\"
${
FIRMWARE_VERSION
}
\"
"
)
add_definitions
(
"-DPACKAGE_BUGREPORT=
\"
O
pen
A
ir
Interface web site
\"
"
)
add_definitions
(
"-DPACKAGE_VERSION=
\"
Branch:
${
GIT_BRANCH
}
Abrev. Hash:
${
GIT_COMMIT_HASH
}
Date:
${
GIT_COMMIT_DATE
}
\"
"
)
add_definitions
(
"-DPACKAGE_BUGREPORT=
\"
o
pen
a
ir
4g-devel@lists.eurecom.fr
\"
"
)
# Debug related options
#########################################
add_boolean_option
(
MSG_PRINT False
"print debug messages"
)
add_boolean_option
(
DISABLE_XER_PRINT False
"print XER Format"
)
add_boolean_option
(
XER_PRINT False
"print XER Format"
)
add_boolean_option
(
RRC_MSG_PRINT False
"print RRC messages"
)
add_boolean_option
(
PDCP_MSG_PRINT False
"print PDCP messages to /tmp/pdcp.log"
)
add_boolean_option
(
DEBUG_PDCP_PAYLOAD False
"print PDCP PDU to stdout"
)
# if true, make sure that global and PDCP log levels are trace
add_boolean_option
(
ASN_DEBUG False
"ASN1 coder/decoder Debug"
)
add_boolean_option
(
EMIT_ASN_DEBUG False
"ASN1 coder/decoder Debug"
)
add_boolean_option
(
MSG_PRINT False
"print debug messages"
)
add_boolean_option
(
DISABLE_XER_PRINT False
"print XER Format"
)
add_boolean_option
(
XER_PRINT False
"print XER Format"
)
add_boolean_option
(
RRC_MSG_PRINT False
"print RRC messages"
)
add_boolean_option
(
PDCP_MSG_PRINT False
"print PDCP messages to /tmp/pdcp.log"
)
add_boolean_option
(
DEBUG_PDCP_PAYLOAD False
"print PDCP PDU to stdout"
)
# if true, make sure that global and PDCP log levels are trace
add_boolean_option
(
DEBUG_MAC_INTERFACE False
"print MAC-RLC PDU exchange to stdout"
)
# if true, make sure that global and PDCP log levels are trace
add_boolean_option
(
TRACE_RLC_PAYLOAD False
"print RLC PDU to stdout"
)
# if true, make sure that global and PDCP log levels are trace
add_boolean_option
(
TEST_OMG False
"???"
)
add_boolean_option
(
DEBUG_OMG False
"???"
)
add_boolean_option
(
XFORMS False
"This adds the possibility to see the signal oscilloscope"
)
add_boolean_option
(
PRINT_STATS False
"This adds the possibility to see the status"
)
add_boolean_option
(
TRACE_RLC_PAYLOAD
False
"print RLC PDU to stdout"
)
# if true, make sure that global and PDCP log levels are trace
add_boolean_option
(
TEST_OMG
False
"???"
)
add_boolean_option
(
DEBUG_OMG
False
"???"
)
add_boolean_option
(
XFORMS
False
"This adds the possibility to see the signal oscilloscope"
)
add_boolean_option
(
PRINT_STATS
False
"This adds the possibility to see the status"
)
add_boolean_option
(
DEBUG_CONSOLE False
"makes debugging easier, disables stdout/stderr buffering"
)
...
...
@@ -322,6 +345,7 @@ 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
)
...
...
@@ -1086,7 +1110,6 @@ add_library(CN_UTILS
${
OPENAIR3_DIR
}
/UTILS/conversions.c
${
OPENAIR3_DIR
}
/UTILS/enum_string.c
${
OPENAIR3_DIR
}
/UTILS/log.c
${
OPENAIR3_DIR
}
/UTILS/mme_config.c
${
OPENAIR3_DIR
}
/UTILS/mcc_mnc_itu.c
)
...
...
@@ -1427,6 +1450,9 @@ include(FindPkgConfig)
pkg_search_module
(
LIBXML2 libxml-2.0 REQUIRED
)
include_directories
(
${
LIBXML2_INCLUDE_DIRS
}
)
pkg_search_module
(
LIBXSLT libxslt REQUIRED
)
include_directories
(
${
LIBXSLT_INCLUDE_DIRS
}
)
pkg_search_module
(
OPENSSL openssl REQUIRED
)
include_directories
(
${
OPENSSL_INCLUDE_DIRS
}
)
...
...
@@ -1718,6 +1744,7 @@ endforeach(myExe)
add_executable
(
test_epc_generate_scenario
${
OPENAIR3_DIR
}
/TEST/EPC_TEST/generate_scenario.c
${
OPENAIR3_DIR
}
/TEST/EPC_TEST/generate_scenario.h
${
OPENAIR2_DIR
}
/ENB_APP/enb_config.h
${
OPENAIR2_DIR
}
/COMMON/commonDef.h
${
OPENAIR2_DIR
}
/COMMON/messages_def.h
...
...
@@ -1726,7 +1753,28 @@ add_executable(test_epc_generate_scenario
${
OPENAIR_BIN_DIR
}
/messages_xml.h
)
target_link_libraries
(
test_epc_generate_scenario
-Wl,--start-group RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS
${
MSC_LIB
}
L2 -Wl,--end-group pthread m rt crypt sctp
${
LIBXML2_LIBRARIES
}
${
CRYPTO_LIBRARIES
}
${
OPENSSL_LIBRARIES
}
${
NETTLE_LIBRARIES
}
${
CONFIG_LIBRARIES
}
-Wl,--start-group RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS
${
ITTI_LIB
}
${
MSC_LIB
}
L2 -Wl,--end-group pthread m rt crypt sctp
${
LIBXML2_LIBRARIES
}
${
LIBXSLT_LIBRARIES
}
${
CRYPTO_LIBRARIES
}
${
OPENSSL_LIBRARIES
}
${
NETTLE_LIBRARIES
}
${
CONFIG_LIBRARIES
}
)
add_executable
(
test_epc_play_scenario
${
OPENAIR3_DIR
}
/TEST/EPC_TEST/play_scenario.c
${
OPENAIR3_DIR
}
/TEST/EPC_TEST/play_scenario_decode.c
${
OPENAIR3_DIR
}
/TEST/EPC_TEST/play_scenario_display.c
${
OPENAIR3_DIR
}
/TEST/EPC_TEST/play_scenario_fsm.c
${
OPENAIR3_DIR
}
/TEST/EPC_TEST/play_scenario_parse.c
${
OPENAIR3_DIR
}
/TEST/EPC_TEST/play_scenario_s1ap.c
${
OPENAIR3_DIR
}
/TEST/EPC_TEST/play_scenario_s1ap_compare_ie.c
${
OPENAIR3_DIR
}
/TEST/EPC_TEST/play_scenario_s1ap_eNB_defs.h
${
OPENAIR3_DIR
}
/TEST/EPC_TEST/play_scenario_sctp.c
${
OPENAIR3_DIR
}
/TEST/EPC_TEST/play_scenario.h
${
OPENAIR2_DIR
}
/COMMON/commonDef.h
${
OPENAIR2_DIR
}
/COMMON/messages_def.h
${
OPENAIR2_DIR
}
/COMMON/messages_types.h
${
OPENAIR_BIN_DIR
}
/messages_xml.h
)
target_include_directories
(
test_epc_play_scenario PUBLIC /usr/local/share/asn1c
)
target_link_libraries
(
test_epc_play_scenario
-Wl,--start-group RRC_LIB S1AP_LIB X2AP_LIB GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS
${
ITTI_LIB
}
${
MSC_LIB
}
-Wl,--end-group pthread m rt crypt sctp
${
LIBXML2_LIBRARIES
}
${
LIBXSLT_LIBRARIES
}
${
CRYPTO_LIBRARIES
}
${
OPENSSL_LIBRARIES
}
${
NETTLE_LIBRARIES
}
${
CONFIG_LIBRARIES
}
)
...
...
cmake_targets/epc_test/CMakeLists.template
View file @
31965637
cmake_minimum_required(VERSION 2.8)
set ( CMAKE_BUILD_TYPE "RelWithDebInfo" )
set ( ASN_DEBUG False)
set ( ADDR_CONF False )
set ( DEBUG_OMG False )
set ( DISABLE_XER_PRINT False )
set ( DRIVER2013 True )
set ( EMOS False )
set ( EMIT_ASN_DEBUG False )
set ( ENABLE_FXP True )
set ( ENABLE_ITTI True )
set ( ENABLE_NAS_UE_LOGGING True )
...
...
@@ -47,9 +49,9 @@ set ( OAI_EMU False )
set ( OAISIM False )
set ( OAI_NW_DRIVER_TYPE_ETHERNET False )
set ( OAI_NW_DRIVER_USE_NETLINK True )
set ( OPENAIR1
Fals
e )
set ( OPENAIR2
Fals
e )
set ( OPENAIR_LTE
F
)
set ( OPENAIR1
Tru
e )
set ( OPENAIR2
Tru
e )
set ( OPENAIR_LTE
True
)
set ( PACKAGE_NAME "epc_test" )
set ( PBS_SIM False )
set ( PDCP_USE_NETLINK True )
...
...
@@ -74,4 +76,4 @@ set ( SMBV False )
set ( TEST_OMG False )
set ( USE_MME "R10" )
set ( USER_MODE True )
set ( XER_PRINT
Fals
e )
set ( XER_PRINT
Tru
e )
cmake_targets/tools/build_helper
View file @
31965637
...
...
@@ -30,7 +30,7 @@
################################################################################
# file build_helper
# brief
# author Laurent Thomas
# author
s
Laurent Thomas
, Lionel GAUTHIER
#
#######################################
SUDO='sudo -E'
...
...
@@ -269,7 +269,9 @@ check_install_oai_software() {
pydb \
wvdial \
python-numpy \
sshpass
sshpass \
libxslt1-dev
$SUDO update-alternatives --set liblapack.so /usr/lib/atlas-base/atlas/liblapack.so
if [ `lsb_release -rs` = '12.04' ] ; then
install_nettle_from_source
...
...
@@ -291,10 +293,12 @@ install_asn1c_from_source(){
$SUDO rm -rf /tmp/asn1c-r1516
mkdir -p /tmp/asn1c-r1516
cd /tmp/asn1c-r1516
svn co https://github.com/vlm/asn1c/trunk /tmp/asn1c-r1516 -r 1516
patch -p0 < $OPENAIR_DIR/openair3/S1AP/MESSAGES/ASN1/asn1cpatch.p0
patch -p0 < $OPENAIR_DIR/openair3/S1AP/MESSAGES/ASN1/asn1cpatch_2.p0
patch -p0 < $OPENAIR_DIR/openair2/RRC/LITE/MESSAGES/asn1c/asn1cpatch.p0
rm -rf /tmp/asn1c-r1516/*
svn co https://github.com/vlm/asn1c/trunk /tmp/asn1c-r1516 -r 1516 > /tmp/log_compile_asn1c
patch -p0 < $OPENAIR_DIR/openair3/S1AP/MESSAGES/ASN1/asn1cpatch.p0 >> /tmp/log_compile_asn1c
patch -p0 < $OPENAIR_DIR/openair3/S1AP/MESSAGES/ASN1/asn1cpatch_2.p0 >> /tmp/log_compile_asn1c
patch -p0 < $OPENAIR_DIR/openair2/RRC/LITE/MESSAGES/asn1c/asn1cpatch.p0 >> /tmp/log_compile_asn1c
patch -p0 < $OPENAIR_DIR/openair3/S1AP/MESSAGES/ASN1/asn1cpatch_3.p0 >> /tmp/log_compile_asn1c
./configure
make -j`nproc`
$SUDO make install
...
...
@@ -324,7 +328,6 @@ install_nas_tools() {
}
################################
# set_openair_env
###############################
...
...
cmake_targets/tools/build_test_epc_tools
View file @
31965637
...
...
@@ -22,7 +22,7 @@
# Contact Information
# OpenAirInterface Admin: openair_admin@eurecom.fr
# OpenAirInterface Tech : openair_tech@eurecom.fr
# OpenAirInterface Dev : openair4g-devel@eurecom.fr
# OpenAirInterface Dev : openair4g-devel@
lists.
eurecom.fr
#
# Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
#
...
...
@@ -121,6 +121,7 @@ function main()
echo
"Cleaning TEST_EPC"
fi
rm
-f
$OPENAIR_DIR
/targets/bin/test_epc_generate_scenario
rm
-f
$OPENAIR_DIR
/targets/bin/test_epc_play_scenario
rm
-Rf
build 2>&1
mkdir
-m
777
-p
-v
build
fi
...
...
@@ -140,6 +141,13 @@ function main()
compilations
\
epc_test test_epc_generate_scenario
\
test_epc_generate_scenario
$dbin
/test_epc_generate_scenario
compilations
\
epc_test test_epc_play_scenario
\
test_epc_play_scenario
$dbin
/test_epc_play_scenario
$SUDO
cp
-upv
test_epc_generate_scenario /usr/local/bin
$SUDO
cp
-upv
test_epc_play_scenario /usr/local/bin
}
...
...
openair2/COMMON/commonDef.h
View file @
31965637
...
...
@@ -48,7 +48,19 @@ Description Contains global common definitions
#include
<stdint.h>
#include
<stddef.h>
#include
<stdbool.h>
typedef
signed
char
boolean_t
;
#if !defined(TRUE)
#define TRUE (boolean_t)0x01
#endif
#if !defined(FALSE)
#define FALSE (boolean_t)0x00
#endif
#define BOOL_NOT(b) (b^TRUE)
#define NAS_UE_ID_FMT "0x%06x"
...
...
@@ -59,13 +71,6 @@ Description Contains global common definitions
#define RETURNok (0)
#define RETURNerror (-1)
#ifndef FALSE
#define FALSE (0)
#endif
#ifndef TRUE
#define TRUE (1)
#endif
/*
* Name of the environment variable which defines the default directory
* where the NAS application is executed and where are located files
...
...
openair2/COMMON/s1ap_messages_types.h
View file @
31965637
...
...
@@ -112,7 +112,7 @@ typedef struct net_ip_address_s {
unsigned
ipv4
:
1
;
unsigned
ipv6
:
1
;
char
ipv4_address
[
16
];
char
ipv6_address
[
4
0
];
char
ipv6_address
[
4
6
];
}
net_ip_address_t
;
typedef
uint64_t
bitrate_t
;
...
...
openair2/ENB_APP/enb_config.c
View file @
31965637
...
...
@@ -265,7 +265,7 @@ static const eutra_band_t eutra_bands[] = {
Enb_properties_array_t
enb_properties
;
static
void
enb_config_display
(
void
)
void
enb_config_display
(
void
)
{
int
i
,
j
;
...
...
openair2/ENB_APP/enb_config.h
View file @
31965637
...
...
@@ -264,6 +264,7 @@ typedef struct Enb_properties_array_s {
Enb_properties_t
*
properties
[
MAX_ENB
];
}
Enb_properties_array_t
;
void
enb_config_display
(
void
);
const
Enb_properties_array_t
*
enb_config_init
(
char
*
lib_config_file_name_pP
);
const
Enb_properties_array_t
*
enb_config_get
(
void
);
...
...
openair2/LAYER2/RLC/rlc.h
View file @
31965637
...
...
@@ -60,6 +60,8 @@
# include "DRB-ToAddModList.h"
# include "SRB-ToAddMod.h"
# include "SRB-ToAddModList.h"
# include "DRB-ToReleaseList.h"
#ifdef Rel10
#include
"PMCH-InfoList-r9.h"
#endif
...
...
openair2/UTIL/OCG/OCG_parse_XML.c
View file @
31965637
...
...
@@ -51,10 +51,6 @@
#include
"UTIL/OPT/opt.h"
/*----------------------------------------------------------------------------*/
#ifndef HAVE_STRNDUP
char
*
strndup
(
const
char
*
s
,
size_t
size
);
#endif
static
int
oai_emulation_
;
/*!< \brief indicating that the parsing position is now within OAI_Emulation_*/
static
int
environment_system_config_
;
/*!< \brief indicating that the parsing position is now within Envi_Config_*/
...
...
openair3/S1AP/MESSAGES/ASN1/asn1cpatch_3.p0
0 → 100644
View file @
31965637
This diff is collapsed.
Click to expand it.
openair3/S1AP/MESSAGES/ASN1/asn1tostruct.py
View file @
31965637
...
...
@@ -36,7 +36,7 @@ def outputHeaderToFile(f, filename):
f
.
write
(
"""/*******************************************************************************
Eurecom OpenAirInterface
Copyright(c) 1999 - 201
3
Eurecom
Copyright(c) 1999 - 201
5
Eurecom
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
...
...
@@ -250,20 +250,31 @@ for key in iesDefs:
asn1cStruct
=
re
.
sub
(
'Item'
,
'List'
,
asn1cStruct
)
keylowerunderscore
=
re
.
sub
(
'-'
,
'_'
,
key
.
lower
())
firstlower
=
re
.
sub
(
'Item'
,
'List'
,
re
.
sub
(
'enb'
,
'eNB'
,
lowerFirstCamelWord
(
asn1cStruct
)))
f
.
write
(
"/* %s in iesDefs not in ieofielist.values() */
\n
"
%
(
key
))
f
.
write
(
"/**
\\
brief Decode function for %s ies.
\n
"
%
(
key
))
if
len
(
iesDefs
[
key
][
"ies"
])
!=
0
:
f
.
write
(
" *
\\
param %s Pointer to ASN1 structure in which data will be stored
\n
"
%
(
lowerFirstCamelWord
(
re
.
sub
(
'-'
,
'_'
,
key
))))
f
.
write
(
" *
\\
param any_p Pointer to the ANY value to decode.
\n
"
)
f
.
write
(
" **/
\n
"
)
f
.
write
(
"int %s_decode_%s(
\n
"
%
(
fileprefix
,
keylowerunderscore
))
if
len
(
iesDefs
[
key
][
"ies"
])
!=
0
:
f
.
write
(
" %s_t *%s,
\n
"
%
(
re
.
sub
(
'-'
,
'_'
,
key
),
lowerFirstCamelWord
(
re
.
sub
(
'-'
,
'_'
,
key
))))
f
.
write
(
" ANY_t *any_p);
\n\n
"
)
f
.
write
(
"/* %s in iesDefs not in ieofielist.values() */
\n
"
%
(
key
))
f
.
write
(
"/**
\\
brief Compare function for %s ies.
\n
"
%
(
key
))
f
.
write
(
" *
\\
param %s Pointer to the ASN1 structure.
\n
"
%
(
firstlower
))
f
.
write
(
" *
\\
param %s Pointer to the ASN1 structure.
\n
"
%
(
firstlower
))
f
.
write
(
" **/
\n
"
)
f
.
write
(
"asn_comp_rval_t * %s_compare_%s(
\n
"
%
(
fileprefix
,
keylowerunderscore
))
f
.
write
(
" %s_t *%s1,
\n
"
%
(
re
.
sub
(
'-'
,
'_'
,
key
),
lowerFirstCamelWord
(
re
.
sub
(
'-'
,
'_'
,
key
))))
f
.
write
(
" %s_t *%s2);
\n\n
"
%
(
re
.
sub
(
'-'
,
'_'
,
key
),
lowerFirstCamelWord
(
re
.
sub
(
'-'
,
'_'
,
key
))))
if
len
(
iesDefs
[
key
][
"ies"
])
==
0
:
continue
f
.
write
(
"/* %s in iesDefs not in ieofielist.values() */
\n
"
%
(
key
))
f
.
write
(
"/**
\\
brief Encode function for %s ies.
\n
"
%
(
key
))
f
.
write
(
" *
\\
param %s Pointer to the ASN1 structure.
\n
"
%
(
firstlower
))
f
.
write
(
" *
\\
param %s Pointer to the IES structure.
\n
"
%
(
lowerFirstCamelWord
(
re
.
sub
(
'-'
,
'_'
,
key
))))
...
...
@@ -272,16 +283,19 @@ for key in iesDefs:
f
.
write
(
" %s_t *%s,
\n
"
%
(
asn1cStruct
,
firstlower
))
f
.
write
(
" %s_t *%s);
\n\n
"
%
(
re
.
sub
(
'-'
,
'_'
,
key
),
lowerFirstCamelWord
(
re
.
sub
(
'-'
,
'_'
,
key
))))
for
key
in
iesDefs
:
if
key
not
in
ieofielist
.
values
():
continue
asn1cStruct
=
re
.
sub
(
'-'
,
'_'
,
re
.
sub
(
'IEs'
,
''
,
key
))
asn1cStruct
=
re
.
sub
(
'Item'
,
'List'
,
asn1cStruct
)
firstlower
=
re
.
sub
(
'Item'
,
'List'
,
re
.
sub
(
'enb'
,
'eNB'
,
lowerFirstCamelWord
(
asn1cStruct
)))
f
.
write
(
"/* %s in iesDefs in ieofielist.values() */
\n
"
%
(
key
))
f
.
write
(
"/**
\\
brief Encode function for %s ies.
\n
"
%
(
key
))
f
.
write
(
" *
\\
param %s Pointer to the ASN1 structure.
\n
"
%
(
firstlower
))
f
.
write
(
" *
\\
param %s Pointer to the IES structure.
\n
"
%
(
lowerFirstCamelWord
(
re
.
sub
(
'-'
,
'_'
,
key
))))
f
.
write
(
" **/
\n
"
)
f
.
write
(
"/* %s in iesDefs in ieofielist.values() */
\n
"
%
(
key
))
f
.
write
(
"int %s_encode_%s(
\n
"
%
(
fileprefix
,
firstlower
.
lower
()))
f
.
write
(
" %s_t *%s,
\n
"
%
(
asn1cStruct
,
firstlower
))
f
.
write
(
" %sIEs_t *%sIEs);
\n\n
"
%
(
asn1cStruct
,
firstlower
))
...
...
@@ -289,9 +303,19 @@ for key in iesDefs:
f
.
write
(
" *
\\
param any_p Pointer to the ANY value to decode.
\n
"
)
f
.
write
(
" *
\\
param callback Callback function called when any_p is successfully decoded.
\n
"
)
f
.
write
(
" **/
\n
"
)
f
.
write
(
"/* %s in iesDefs in ieofielist.values() */
\n
"
%
(
key
))
f
.
write
(
"int %s_decode_%s(
\n
"
%
(
fileprefix
,
firstlower
.
lower
()))
f
.
write
(
" %sIEs_t *%sIEs,
\n
"
%
(
asn1cStruct
,
firstlower
))
f
.
write
(
" %s_t *%s);
\n\n
"
%
(
asn1cStruct
,
lowerFirstCamelWord
(
asn1cStruct
)))
f
.
write
(
"/**
\\
brief Compare function for %s ies.
\n
"
%
(
key
))
f
.
write
(
" *
\\
param %s Pointer to the IES structure.
\n
"
%
(
firstlower
))
f
.
write
(
" *
\\
param %s Pointer to the IES structure.
\n
"
%
(
firstlower
))
f
.
write
(
" **/
\n
"
)
f
.
write
(
"asn_comp_rval_t * %s_compare_%s(
\n
"
%
(
fileprefix
,
firstlower
.
lower
()))
f
.
write
(
" %sIEs_t *%s1,
\n
"
%
(
asn1cStruct
,
firstlower
))
f
.
write
(
" %sIEs_t *%s2);
\n\n
"
%
(
asn1cStruct
,
firstlower
))
for
key
in
iesDefs
:
asn1cStruct
=
re
.
sub
(
'-'
,
'_'
,
re
.
sub
(
'IEs'
,
''
,
key
))
...
...
@@ -704,3 +728,170 @@ for (key, value) in iesDefs.items():
#f.write("cb_failed:\n")
#f.write(" return er;\n")
f
.
write
(
"}
\n\n
"
)
#Generate xer print functions
f
=
open
(
outdir
+
fileprefix
+
'_compare.c'
,
'w'
)
outputHeaderToFile
(
f
,
filename
)
f
.
write
(
"#include <stdlib.h>
\n
"
)
f
.
write
(
"#include <stdio.h>
\n\n
"
)
f
.
write
(
"#include <asn_application.h>
\n
#include <asn_internal.h>
\n\n
"
)
f
.
write
(
"#include
\"
%s_common.h
\"\n
#include
\"
%s_ies_defs.h
\"\n
"
%
(
fileprefix
,
fileprefix
))
f
.
write
(
"#include
\"
%s-ProtocolIE-ID.h
\"\n\n
"
%
(
fileprefix_first_upper
))
for
key
in
iesDefs
:
if
key
in
ieofielist
.
values
():
continue
structName
=
re
.
sub
(
'ies'
,
''
,
key
)
asn1cStruct
=
re
.
sub
(
'-'
,
'_'
,
re
.
sub
(
'IEs'
,
''
,
key
))
asn1cStruct
=
re
.
sub
(
'Item'
,
'List'
,
asn1cStruct
)
if
asn1cStruct
.
rfind
(
'_'
)
==
len
(
asn1cStruct
)
-
1
:
asn1cStruct
=
asn1cStruct
[:
-
1
]
asn1cStructfirstlower
=
asn1cStruct
[:
1
].
lower
()
+
asn1cStruct
[
1
:]
firstwordlower
=
re
.
sub
(
'Item'
,
'List'
,
re
.
sub
(
'enb'
,
'eNB'
,
lowerFirstCamelWord
(
asn1cStruct
)))
iesaccess
=
""
if
key
not
in
ieofielist
.
values
():
iesaccess
=
"%s_ies."
%
(
firstwordlower
)
keyName
=
re
.
sub
(
'-'
,
'_'
,
key
)
keyupperunderscore
=
keyName
.
upper
()
# No IE to encode...
if
len
(
iesDefs
[
key
][
"ies"
])
==
0
:
continue
f
.
write
(
"asn_comp_rval_t * %s_compare_%s(
\n
"
%
(
fileprefix
,
re
.
sub
(
'-'
,
'_'
,
structName
.
lower
())))
f
.
write
(
" %s_t *%s1,
\n
"
%
(
re
.
sub
(
'-'
,
'_'
,
key
),
lowerFirstCamelWord
(
re
.
sub
(
'-'
,
'_'
,
key
))))
f
.
write
(
" %s_t *%s2) {
\n\n
"
%
(
re
.
sub
(
'-'
,
'_'
,
key
),
lowerFirstCamelWord
(
re
.
sub
(
'-'
,
'_'
,
key
))))
f
.
write
(
" asn_comp_rval_t *rv = NULL;
\n\n
"
)
f
.
write
(
" asn_comp_rval_t *rv2 = NULL;
\n\n
"
)
f
.
write
(
" assert(%s1 != NULL);
\n
"
%
(
lowerFirstCamelWord
(
re
.
sub
(
'-'
,
'_'
,
key
))));
f
.
write
(
" assert(%s2 != NULL);
\n
"
%
(
lowerFirstCamelWord
(
re
.
sub
(
'-'
,
'_'
,
key
))));
loop
=
0
for
ie
in
iesDefs
[
key
][
"ies"
]:
iename
=
re
.
sub
(
'-'
,
'_'
,
re
.
sub
(
'id-'
,
''
,
ie
[
0
]))
ienameunderscore
=
re
.
sub
(
'-'
,
'_'
,
iename
)
ienamefirstwordlower
=
lowerFirstCamelWord
(
iename
)
ieupperunderscore
=
re
.
sub
(
'-'
,
'_'
,
re
.
sub
(
'id-'
,
''
,
ie
[
0
])).
upper
()
ietypeunderscore
=
re
.
sub
(
'-'
,
'_'
,
ie
[
2
])
if
ie
[
3
]
!=
"mandatory"
:
loop
=
loop
+
1
if
loop
==
1
:
#f.write(" %s_IE_t *ie1 = NULL;\n" % (fileprefix_first_upper))
#f.write(" %s_IE_t *ie2 = NULL;\n" % (fileprefix_first_upper))
f
.
write
(
" if (%s1->presenceMask != %s2->presenceMask) {rv=calloc(1,sizeof(asn_comp_rval_t));rv->name = asn_DEF_%s.name;rv->structure1 = %s1;rv->structure2 = %s2;rv->err_code = COMPARE_ERR_CODE_VALUE_NULL; return rv;}
\n
"
%
(
lowerFirstCamelWord
(
re
.
sub
(
'-'
,
'_'
,
key
)),
lowerFirstCamelWord
(
re
.
sub
(
'-'
,
'_'
,
key
)),
ietypeunderscore
,
lowerFirstCamelWord
(
re
.
sub
(
'-'
,
'_'
,
key
)),
lowerFirstCamelWord
(
re
.
sub
(
'-'
,
'_'
,
key
))))
if
ie
[
3
]
==
"optional"
:
f
.
write
(
" /* Optional field */
\n
"
)
elif
ie
[
3
]
==
"conditional"
:
f
.
write
(
" /* Conditional field */
\n
"
)
f
.
write
(
" if (%s1->presenceMask & %s_%s_PRESENT) {
\n
"
%
(
lowerFirstCamelWord
(
re
.
sub
(
'-'
,
'_'
,
key
)),
keyupperunderscore
,
ieupperunderscore
))
if
ie
[
2
]
in
ieofielist
.
keys
():
f
.
write
(
" /* collection field */
\n
"
)
f
.
write
(
" rv2 = %s_compare_%s(&%s1->%s, &%s2->%s);
\n
"
%
(
fileprefix
,
ietypeunderscore
.
lower
(),
lowerFirstCamelWord
(
re
.
sub
(
'-'
,
'_'
,
key
)),
ienamefirstwordlower
,
lowerFirstCamelWord
(
re
.
sub
(
'-'
,
'_'
,
key
)),
ienamefirstwordlower
))
f
.
write
(
" if(rv2) {"
)
f
.
write
(
" if (NULL == rv) {"
)
f
.
write
(
" rv = rv2;"
)
f
.
write
(
" } else {"
)
f
.
write
(
" rv2->next = rv;"
)
f
.
write
(
" rv = rv2;"
)
f
.
write
(
" }"
)
f
.
write
(
" rv2 = NULL;"
)
f
.
write
(
" }"
)
else
:
f
.
write
(
" /* simple field */
\n
"
)
f
.
write
(
" rv2 = asn_DEF_%s.compare(&asn_DEF_%s, &%s1->%s, &asn_DEF_%s, &%s2->%s);
\n
"
%
(
ietypeunderscore
,
ietypeunderscore
,
lowerFirstCamelWord
(
re
.
sub
(
'-'
,
'_'
,
key
)),
ienamefirstwordlower
,
ietypeunderscore
,
lowerFirstCamelWord
(
re
.
sub
(
'-'
,
'_'
,
key
)),
ienamefirstwordlower
))
f
.
write
(
" if (rv2) {"
)
f
.
write
(
" if (NULL == rv) {"
)
f
.
write
(
" rv = rv2;"
)
f
.
write
(
" } else {"
)
f
.
write
(
" rv2->next = rv;"
)
f
.
write
(
" rv = rv2;"
)
f
.
write
(
" }"
)
f
.
write
(
" rv2 = NULL;"
)
f
.
write
(
" if (!rv->name) rv->name = asn_DEF_%s.name;"
%
(
ietypeunderscore
))
f
.
write
(
" }"
)
f
.
write
(
" assert(0);
\n
"
);
f
.
write
(
" }
\n\n
"
)
else
:
if
ie
[
2
]
in
ieofielist
.
keys
():
f
.
write
(
" /* Mandatory collection field */
\n
"
)
f
.
write
(
" rv2 = %s_compare_%s(&%s1->%s, &%s2->%s);
\n
"
%
(
fileprefix
,
ietypeunderscore
.
lower
(),
lowerFirstCamelWord
(
re
.
sub
(
'-'
,
'_'
,
key
)),
ienamefirstwordlower
,
lowerFirstCamelWord
(
re
.
sub
(
'-'
,
'_'
,
key
)),
ienamefirstwordlower
))
f
.
write
(
" if (rv2) {
\n
"
)
f
.
write
(
" if (NULL == rv) {
\n
"
)
f
.
write
(
" rv = rv2;
\n
"
)
f
.
write
(
" } else {
\n
"
)
f
.
write
(
" rv2->next = rv;
\n
"
)
f
.
write
(
" rv = rv2;
\n
"
)
f
.
write
(
" }
\n
"
)
f
.
write
(
" rv2 = NULL;
\n
"
)
f
.
write
(
" }
\n
"
)
else
:
f
.
write
(
" /* Mandatory simple field */
\n
"
)
f
.
write
(
" rv2 = asn_DEF_%s.compare(&asn_DEF_%s, &%s1->%s, &asn_DEF_%s, &%s2->%s);
\n
"
%
(
ietypeunderscore
,
ietypeunderscore
,
lowerFirstCamelWord
(
re
.
sub
(
'-'
,
'_'
,
key
)),
ienamefirstwordlower
,
ietypeunderscore
,
lowerFirstCamelWord
(
re
.
sub
(
'-'
,
'_'
,
key
)),
ienamefirstwordlower
))
f
.
write
(
" if(rv2) {
\n
"
)
f
.
write
(
" if (NULL == rv) {
\n
"
)
f
.
write
(
" rv = rv2;
\n
"
)
f
.
write
(
" } else {
\n
"
)
f
.
write
(
" rv2->next = rv;
\n
"
)
f
.
write
(
" rv = rv2;
\n
"
)
f
.
write
(
" }
\n
"
)
f
.
write
(
" rv2 = NULL;
\n
"
)
f
.
write
(
" if (!rv->name) rv->name = asn_DEF_%s.name;
\n
"
%
(
ietypeunderscore
))
f
.
write
(
" }
\n
"
)
f
.
write
(
" return rv;
\n
"
)
f
.
write
(
"}
\n\n
"
)
for
(
key
,
value
)
in
iesDefs
.
items
():
if
key
not
in
ieofielist
.
values
():
continue
ie
=
value
[
"ies"
][
0
]
ietypeunderscore
=
re
.
sub
(
'-'
,
'_'
,
ie
[
2
])
asn1cStruct
=
re
.
sub
(
'-'
,
'_'
,
re
.
sub
(
'IEs'
,
''
,
re
.
sub
(
'-IEs'
,
''
,
key
)))
asn1cStruct
=
re
.
sub
(
'Item'
,
'List'
,
asn1cStruct
)
firstwordlower
=
re
.
sub
(
'Item'
,
'List'
,
re
.
sub
(
'enb'
,
'eNB'
,
lowerFirstCamelWord
(
asn1cStruct
)))
for
(
i
,
j
)
in
ieofielist
.
items
():
if
j
==
key
:
break
f
.
write
(
"extern asn_TYPE_descriptor_t asn_DEF_%s;
\n
"
%
(
ietypeunderscore
))
f
.
write
(
"asn_comp_rval_t * %s_compare_%s(
\n
"
%
(
fileprefix
,
re
.
sub
(
'-'
,
'_'
,
i
).
lower
()))
f
.
write
(
" %sIEs_t *%sIEs1,
\n
"
%
(
re
.
sub
(
'-'
,
'_'
,
i
),
lowerFirstCamelWord
(
re
.
sub
(
'-'
,
'_'
,
i
))))
f
.
write
(
" %sIEs_t *%sIEs2) {
\n\n
"
%
(
re
.
sub
(
'-'
,
'_'
,
i
),
lowerFirstCamelWord
(
re
.
sub
(
'-'
,
'_'
,
i
))))
f
.
write
(
" int i;
\n
"
)
f
.
write
(
" asn_comp_rval_t *rv = NULL;
\n\n
"
)
f
.
write
(
" asn_comp_rval_t *rv2 = NULL;
\n\n
"
)
f
.
write
(
" assert(%sIEs1 != NULL);
\n
"
%
(
lowerFirstCamelWord
(
re
.
sub
(
'-'
,
'_'
,
i
))));
f
.
write
(
" assert(%sIEs2 != NULL);
\n\n
"
%
(
lowerFirstCamelWord
(
re
.
sub
(
'-'
,
'_'
,
i
))));
f
.
write
(
" for (i = 0; i < %sIEs1->%s.count; i++) {
\n
"
%
(
lowerFirstCamelWord
(
re
.
sub
(
'-'
,
'_'
,
i
)),
re
.
sub
(
'IEs'
,
''
,
lowerFirstCamelWord
(
re
.
sub
(
'-'
,
'_'
,
key
)))))
f
.
write
(
" rv2 = asn_DEF_%s.compare(&asn_DEF_%s, %sIEs1->%s.array[i], &asn_DEF_%s, %sIEs2->%s.array[i]);
\n
"
%
(
ietypeunderscore
,
ietypeunderscore
,
lowerFirstCamelWord
(
re
.
sub
(
'-'
,
'_'
,
i
)),
re
.
sub
(
'IEs'
,
''
,
lowerFirstCamelWord
(
re
.
sub
(
'-'
,
'_'
,
key
))),
ietypeunderscore
,
lowerFirstCamelWord
(
re
.
sub
(
'-'
,
'_'
,
i
)),
re
.
sub
(
'IEs'
,
''
,
lowerFirstCamelWord
(
re
.
sub
(
'-'
,
'_'
,
key
)))))
f
.
write
(
" if(rv2) {"
)
f
.
write
(
" if (NULL == rv) {"
)
f
.
write
(
" rv = rv2;"
)
f
.
write
(
" } else {"
)
f
.
write
(
" rv2->next = rv;"
)
f
.
write
(
" rv = rv2;"
)
f
.
write