Merge remote-tracking branch 'origin/parallel-asn1' into integration_2022_wk49

This commit is contained in:
Robert Schmidt
2022-12-07 19:04:59 +01:00
98 changed files with 16271 additions and 77086 deletions
+212 -362
View File
File diff suppressed because it is too large Load Diff
-15
View File
@@ -82,21 +82,6 @@ function(make_version VERSION_VALUE)
set(${VERSION_VALUE} "${RESULT}" PARENT_SCOPE)
endfunction()
macro(compile_asn1 asn1Source asn1cCmd ResultFlag)
# Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make
execute_process(COMMAND ${asn1cCmd} ${asn1Source} RESULT_VARIABLE ret)
if (NOT ${ret} STREQUAL 0)
message(FATAL_ERROR "${ret}: error")
endif (NOT ${ret} STREQUAL 0)
add_custom_target (
${ResultFlag} ALL
${asn1cCmd} ${asn1Source}
DEPENDS ${asn1Source}
)
endmacro(compile_asn1)
macro(eval_boolean VARIABLE)
if(${ARGN})
set(${VARIABLE} ON)
-697
View File
@@ -1,697 +0,0 @@
import re, os, sys, string
import datetime
import getopt
import getpass
version = "1.0.2"
lines = ""
iesDefs = {}
ieofielist = {}
outdir = './'
filenames = []
verbosity = 0
prefix = ""
FAIL = '\033[91m'
WARN = '\033[93m'
ENDC = '\033[0m'
fileprefix = ""
fileprefix_first_upper = ""
def printFail(string):
sys.stderr.write(FAIL + string + ENDC + "\n")
def printWarning(string):
print WARN + string + ENDC
def printDebug(string):
if verbosity > 0:
print string
def outputHeaderToFile(f, filename):
now = datetime.datetime.now()
f.write("""/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
""")
f.write("/*******************************************************************************\n")
f.write(" * This file had been created by asn1tostruct.py script v%s\n" % (version))
f.write(" * Please do not modify this file but regenerate it via script.\n")
f.write(" * Created on: %s by %s\n * from %s\n" % (str(now), getpass.getuser(), filenames))
f.write(" ******************************************************************************/\n")
def lowerFirstCamelWord(word):
""" puts the first word in a CamelCase Word in lowercase.
I.e. CustomerID becomes customerID, XMLInfoTest becomes xmlInfoTest
"""
newstr = ''
swapped = word.swapcase()
idx = 0
# if it's all-caps, return an all-lowered version
lowered = word.lower()
if swapped == lowered:
return lowered
for c in swapped:
if c in string.lowercase:
newstr += c
idx += 1
else:
break
if idx < 2:
newstr += word[idx:]
else:
newstr = newstr[:-1]+ word[idx-1:]
return newstr
def usage():
print "Python parser for asn1 v%s" % (version)
print "Usage: python asn1tostruct.py [options]"
print "Available options:"
print "-d Enable script debug"
print "-f [file] Input file to parse"
print "-o [dir] Output files to given directory"
print "-h Print this help and return"
try:
opts, args = getopt.getopt(sys.argv[1:], "df:ho:", ["debug", "file", "help", "outdir"])
except getopt.GetoptError as err:
# print help information and exit:
usage()
sys.exit(2)
for o, a in opts:
if o in ("-f", "--file"):
filenames.append(a)
if o in ("-d", "--debug"):
verbosity = 1
if o in ("-o", "--outdir"):
outdir = a
if outdir.rfind('/') != len(outdir):
outdir += '/'
if o in ("-h", "--help"):
usage()
sys.exit(2)
for filename in filenames:
file = open(filename, 'r')
for line in file:
# Removing any comment
if line.find('--') >= 0:
line = line[:line.find('--')]
# Removing any carriage return
lines += re.sub('\r', '', line)
for m in re.findall(r'([a-zA-Z0-9-]+)\s*::=\s+SEQUENCE\s+\(\s*SIZE\s*\(\s*\d+\s*\.\.\s*[0-9a-zA-Z-]+\s*\)\s*\)\s*OF\s+[a-zA-Z-]+\s*\{\s*\{\s*([0-9a-zA-Z-]+)\s*\}\s*\}', lines, re.MULTILINE):
ieofielist[m[0]] = m[1]
for m in re.findall(r'([a-zA-Z0-9-]+)\s*::=\s+E-RAB-IE-ContainerList\s*\{\s*\{\s*([a-zA-Z0-9-]+)\s*\}\s*\}', lines, re.MULTILINE):
ieofielist[m[0]] = m[1]
for i in re.findall(r'([a-zA-Z0-9-]+)\s+([A-Z0-9-]+)\s*::=\s*\{\s+([\,\|\{\}\t\n\.{3}\ \-a-zA-Z0-9]+)\s+}\n', lines, re.MULTILINE):
ies = []
maxLength = 0
# TODO: handle extensions
if i[1].find('EXTENSION') >= 0:
continue
if fileprefix == "":
fileprefix = i[1][:i[1].find('-')].lower()
for j in re.findall(r'\s*\{\s*([a-zA-Z0-9-\ \t]+)\s*\}\s*[\|,]*', i[2], re.MULTILINE):
for k in re.findall(r'ID\s*([a-zA-Z0-9\-]+)\s*CRITICALITY\s*([a-zA-Z0-9\-]+)\s+[A-Z]+\s+([a-zA-Z0-9\-]+)\s*PRESENCE\s*([a-zA-Z0-9\-]+)', j, re.MULTILINE):
printDebug("Got new ie for message " + i[0] + ": " + str(k))
if len(k[2]) > maxLength:
maxLength = len(k[2])
ies.append(k)
if len(ies) > 0:
iesDefs[i[0]] = { "length": maxLength, "ies": ies }
else:
printWarning("Didn't find any information element for message: " + i[0])
if len(iesDefs) == 0:
printFail("No Information Element parsed, exiting")
sys.exit(0)
fileprefix_first_upper = fileprefix[0].upper() + fileprefix[1:]
f = open(outdir + fileprefix + '_ies_defs.h', 'w')
outputHeaderToFile(f, filename)
f.write("#include \"%s_common.h\"\n\n" % (fileprefix))
f.write("#ifndef %s_IES_DEFS_H_\n#define %s_IES_DEFS_H_\n\n" % (fileprefix.upper(), fileprefix.upper()))
f.write("/* Define the version of script used to generate this file */\n")
f.write("#define %s_SCRIPT_VERSION (%s)\n\n" % (fileprefix.upper(), re.sub('\.', '', version)))
for key in iesDefs:
if key not in ieofielist.values():
continue
for (i, j) in ieofielist.items():
if j == key:
break
f.write("typedef struct %sIEs_s {\n" % (re.sub('-', '_', i)))
f.write(" A_SEQUENCE_OF(struct %s_s) %s;\n" % (re.sub('IEs', '', re.sub('-', '_', ieofielist[i])), lowerFirstCamelWord(re.sub('IEs', '', re.sub('-', '_', ieofielist[i])))))
f.write("} %sIEs_t;\n\n" % (re.sub('-', '_', i)))
for key in iesDefs:
keyupperunderscore = re.sub('-', '_', key.upper())
keylowerunderscore = re.sub('-', '_', key.lower())
shift = 0
if len(iesDefs[key]["ies"]) == 0:
continue
# Presence mask
for ie in iesDefs[key]["ies"]:
ieupperunderscore = re.sub('-', '_', re.sub('id-', '', ie[0])).upper()
if ie[3] == "optional" or ie[3] == "conditional":
f.write("#define {0:<{pad}} {1}\n".format("%s_%s_PRESENT" % (keyupperunderscore, ieupperunderscore), "(1 << %d)" % shift,
pad=iesDefs[key]["length"] + len(keyupperunderscore) + 9))
shift += 1
if (shift > 0):
f.write("\n")
f.write("typedef struct %s_s {\n" % (re.sub('-', '_', key)))
if (shift > 0):
f.write(" {0:<{pad}} {1};\n".format("uint16_t", "presenceMask", pad=iesDefs[key]["length"] + 2))
for ie in iesDefs[key]["ies"]:
ieunderscore = re.sub('-', '_', ie[2])
iename = re.sub('id-', '', ie[0])
ienameunderscore = lowerFirstCamelWord(re.sub('-', '_', iename))
if ie[2] in ieofielist:
f.write(" %sIEs_t %s;" % (re.sub('-', '_', ie[2]), ienameunderscore))
else:
f.write(" {0:<{pad}} {1};".format("%s_t" % ieunderscore, ienameunderscore, pad=iesDefs[key]["length"] + 2))
if ie[3] == "optional":
f.write(" ///< Optional field")
elif ie[3] == "conditional":
f.write(" ///< Conditional field")
f.write("\n")
f.write("} %s_t;\n\n" % (re.sub('-', '_', key)))
f.write("typedef struct %s_message_s {\n" % (fileprefix))
f.write(" %s_ProcedureCode_t procedureCode;\n" % (fileprefix_first_upper))
f.write(" %s_Criticality_t criticality;\n" % (fileprefix_first_upper))
f.write(" uint8_t direction;\n")
f.write(" union {\n")
messageList = iesDefs.keys()
messageList.sort()
for message in messageList:
if message in ieofielist.values():
continue
if len(iesDefs[message]["ies"]) == 0:
continue
f.write(" %s_t %s;\n" % (re.sub('-', '_', message), lowerFirstCamelWord(re.sub('-', '_', message))))
f.write(" } msg;\n")
f.write("} %s_message;\n\n" % (fileprefix))
for key in iesDefs:
if key in ieofielist.values():
continue
structName = re.sub('ies', '', key)
asn1cStruct = re.sub('-', '_', re.sub('IEs', '', re.sub('-IEs', '', key)))
asn1cStruct = re.sub('Item', 'List', asn1cStruct)
keylowerunderscore = re.sub('-', '_', key.lower())
firstlower = re.sub('Item', 'List', re.sub('enb', 'eNB', lowerFirstCamelWord(asn1cStruct)))
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")
if len(iesDefs[key]["ies"]) == 0:
continue
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("int %s_encode_%s(\n" % (fileprefix, re.sub('-', '_', structName.lower())))
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("/** \\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("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))
f.write("/** \\brief Decode function for %s ies.\n" % (key))
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("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)))
for key in iesDefs:
asn1cStruct = re.sub('-', '_', re.sub('IEs', '', key))
asn1cStruct = re.sub('Item', 'List', asn1cStruct)
firstlower = re.sub('Item', 'List', re.sub('enb', 'eNB', lowerFirstCamelWord(asn1cStruct)))
if key in ieofielist.values():
f.write("/** \\brief Display %s encapsulated IE using XER encoding.\n" % (asn1cStruct))
f.write(" * \\param %s Pointer to the IES structure.\n" % (lowerFirstCamelWord(re.sub('-', '_', key))))
f.write(" * \\param file File descriptor to write output.\n")
f.write(" **/\n")
f.write("asn_enc_rval_t %s_xer_print_%s(\n" % (fileprefix, re.sub('item', 'list', firstlower.lower())))
f.write(" asn_app_consume_bytes_f *cb,\n")
f.write(" void *app_key,\n")
f.write(" %sIEs_t *%sIEs);\n\n" % (re.sub('item', 'list', asn1cStruct), firstlower))
else:
f.write("/** \\brief Display %s message using XER encoding.\n" % (asn1cStruct))
f.write(" * \\param message_p Pointer to root message.\n")
f.write(" * \\param file File descriptor to write output.\n")
f.write(" **/\n")
f.write("asn_enc_rval_t %s_xer_print_%s(\n" % (fileprefix, firstlower.lower()))
f.write(" asn_app_consume_bytes_f *cb,\n")
f.write(" void *app_key,\n")
f.write(" %s_message *message_p);\n\n" % (fileprefix))
f.write("int %s_xer__print2sp(const void *buffer, size_t size, void *app_key);\n\n" % (fileprefix.lower()))
f.write("int %s_xer__print2fp(const void *buffer, size_t size, void *app_key);\n\n" % (fileprefix.lower()))
f.write("extern size_t %s_string_total_size;\n\n" % (fileprefix.lower()))
f.write("#endif /* %s_IES_DEFS_H_ */\n\n" % (fileprefix.upper()))
#Generate Decode functions
f = open(outdir + fileprefix + '_decoder.c', 'w')
outputHeaderToFile(f, filename)
f.write("#include \"%s_common.h\"\n#include \"%s_ies_defs.h\"\n\n" % (fileprefix, fileprefix))
for key in iesDefs:
if key in ieofielist.values():
continue
structName = re.sub('ies', '', key)
asn1cStruct = re.sub('-', '_', re.sub('IEs', '', key))
if asn1cStruct.rfind('_') == len(asn1cStruct) - 1:
asn1cStruct = asn1cStruct[:-1]
asn1cStruct = re.sub('Item', 'List', asn1cStruct)
ielistname = re.sub('UE', 'ue', asn1cStruct)
ielistnamefirstlower = ielistname[:1].lower() + ielistname[1:]
asn1cStructfirstlower = asn1cStruct[:1].lower() + asn1cStruct[1:]
keyName = re.sub('-', '_', key)
keyupperunderscore = keyName.upper()
firstlower = re.sub('Item', 'List', re.sub('enb', 'eNB', lowerFirstCamelWord(asn1cStruct)))
iesaccess = ""
if key not in ieofielist.values():
iesaccess = "%s_ies." % (firstlower)
f.write("int %s_decode_%s(\n" % (fileprefix, re.sub('-', '_', structName.lower())))
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_t %s;\n %s_t *%s_p = &%s;\n" % (asn1cStruct, asn1cStructfirstlower, asn1cStruct, asn1cStructfirstlower, asn1cStructfirstlower))
f.write(" int i, decoded = 0;\n")
if len(iesDefs[key]["ies"]) != 0:
f.write(" int tempDecoded = 0;\n")
f.write(" assert(any_p != NULL);\n")
if len(iesDefs[key]["ies"]) != 0:
f.write(" assert(%s != NULL);\n\n" % (lowerFirstCamelWord(re.sub('-', '_', key))))
f.write(" %s_DEBUG(\"Decoding message %s (%%s:%%d)\\n\", __FILE__, __LINE__);\n\n" % (fileprefix.upper(), re.sub('-', '_', keyName)))
f.write(" ANY_to_type_aper(any_p, &asn_DEF_%s, (void**)&%s_p);\n\n" % (asn1cStruct, asn1cStructfirstlower))
f.write(" for (i = 0; i < %s_p->%slist.count; i++) {\n" % (asn1cStructfirstlower, iesaccess))
f.write(" %s_IE_t *ie_p;\n" % (fileprefix[0].upper() + fileprefix[1:]))
f.write(" ie_p = %s_p->%slist.array[i];\n" % (asn1cStructfirstlower, iesaccess))
f.write(" switch(ie_p->id) {\n")
for ie in iesDefs[key]["ies"]:
iename = re.sub('id-', '', ie[0])
ienameunderscore = lowerFirstCamelWord(re.sub('-', '_', iename))
ienameunderscorefirstlower = lowerFirstCamelWord(ienameunderscore)
ietypesubst = re.sub('-', '', ie[2])
ietypeunderscore = re.sub('-', '_', ie[2])
ieupperunderscore = re.sub('-', '_', re.sub('id-', '', ie[0])).upper()
if ie[3] == "optional":
f.write(" /* Optional field */\n")
elif ie[3] == "conditional":
f.write(" /* Conditional field */\n")
f.write(" case %s_ProtocolIE_ID_%s:\n" % (fileprefix_first_upper, re.sub('-', '_', ie[0])))
f.write(" {\n")
f.write(" %s_t *%s_p = NULL;\n" % (ietypeunderscore, lowerFirstCamelWord(ietypesubst)))
if ie[3] != "mandatory":
f.write(" %s->presenceMask |= %s_%s_PRESENT;\n" % (lowerFirstCamelWord(re.sub('-', '_', key)), keyupperunderscore, ieupperunderscore))
f.write(" tempDecoded = ANY_to_type_aper(&ie_p->value, &asn_DEF_%s, (void**)&%s_p);\n" % (ietypeunderscore, lowerFirstCamelWord(ietypesubst)))
f.write(" if (tempDecoded < 0 || %s_p == NULL) {\n" % (lowerFirstCamelWord(ietypesubst)))
f.write(" %s_ERROR(\"Decoding of IE %s failed\\n\");\n" % (fileprefix.upper(), ienameunderscore))
f.write(" if (%s_p)\n" % (lowerFirstCamelWord(ietypesubst)))
f.write(" ASN_STRUCT_FREE(asn_DEF_%s, %s_p);\n" % (ietypeunderscore, lowerFirstCamelWord(ietypesubst)))
f.write(" return -1;\n")
f.write(" }\n")
f.write(" decoded += tempDecoded;\n")
f.write(" if (asn1_xer_print)\n")
f.write(" xer_fprint(stdout, &asn_DEF_%s, %s_p);\n" % (ietypeunderscore, lowerFirstCamelWord(ietypesubst)))
if ie[2] in ieofielist.keys():
f.write(" if (%s_decode_%s(&%s->%s, %s_p) < 0) {\n" % (fileprefix, ietypeunderscore.lower(), lowerFirstCamelWord(re.sub('-', '_', key)), ienameunderscore, lowerFirstCamelWord(ietypesubst)))
f.write(" %s_ERROR(\"Decoding of encapsulated IE %s failed\\n\");\n" % (fileprefix.upper(), lowerFirstCamelWord(ietypesubst)))
f.write(" ASN_STRUCT_FREE(asn_DEF_%s, %s_p);\n" % (ietypeunderscore, lowerFirstCamelWord(ietypesubst)))
f.write(" }\n")
else:
f.write(" memcpy(&%s->%s, %s_p, sizeof(%s_t));\n" % (lowerFirstCamelWord(re.sub('-', '_', key)), ienameunderscore, lowerFirstCamelWord(ietypesubst), ietypeunderscore))
#f.write(" ASN_STRUCT_FREE(asn_DEF_%s, %s_p);\n" % (ietypeunderscore, lowerFirstCamelWord(ietypesubst)))
f.write(" } break;\n")
f.write(" default:\n")
f.write(" %s_ERROR(\"Unknown protocol IE id (%%d) for message %s\\n\", (int)ie_p->id);\n" % (fileprefix.upper(), re.sub('-', '_', structName.lower())))
f.write(" return -1;\n")
f.write(" }\n")
f.write(" }\n")
f.write(" return decoded;\n")
f.write("}\n\n")
for key in iesDefs:
if key not in ieofielist.values():
continue
keyname = re.sub('IEs', '', re.sub('Item', 'List', key))
f.write("int %s_decode_%s(\n" % (fileprefix, re.sub('-', '_', keyname).lower()))
f.write(" %sIEs_t *%sIEs,\n" % (re.sub('-', '_', keyname), lowerFirstCamelWord(re.sub('-', '_', keyname))))
f.write(" %s_t *%s) {\n\n" % (re.sub('-', '_', keyname), lowerFirstCamelWord(re.sub('-', '_', keyname))))
f.write(" int i, decoded = 0;\n")
f.write(" int tempDecoded = 0;\n\n")
f.write(" assert(%s != NULL);\n" % (lowerFirstCamelWord(re.sub('-', '_', keyname))));
f.write(" assert(%sIEs != NULL);\n\n" % (lowerFirstCamelWord(re.sub('-', '_', keyname))));
f.write(" for (i = 0; i < %s->list.count; i++) {\n" % (lowerFirstCamelWord(re.sub('-', '_', keyname))))
f.write(" %s_IE_t *ie_p = %s->list.array[i];\n" % (fileprefix[0].upper() + fileprefix[1:], lowerFirstCamelWord(re.sub('-', '_', keyname))))
f.write(" switch (ie_p->id) {\n")
for ie in iesDefs[key]["ies"]:
iename = re.sub('id-', '', ie[0])
ienameunderscore = lowerFirstCamelWord(re.sub('-', '_', iename))
f.write(" case %s_ProtocolIE_ID_%s:\n" % (fileprefix_first_upper, re.sub('-', '_', ie[0])))
f.write(" {\n")
f.write(" %s_t *%s_p = NULL;\n" % (re.sub('-', '_', ie[2]), lowerFirstCamelWord(re.sub('-', '', ie[2]))))
f.write(" tempDecoded = ANY_to_type_aper(&ie_p->value, &asn_DEF_%s, (void**)&%s_p);\n" % (re.sub('-', '_', ie[2]), lowerFirstCamelWord(re.sub('-', '', ie[2]))))
f.write(" if (tempDecoded < 0 || %s_p == NULL) {\n" % (lowerFirstCamelWord(re.sub('-', '', ie[2]))))
f.write(" %s_ERROR(\"Decoding of IE %s for message %s failed\\n\");\n" % (fileprefix.upper(), ienameunderscore, re.sub('-', '_', keyname)))
f.write(" if (%s_p)\n" % (lowerFirstCamelWord(re.sub('-', '', ie[2]))))
#f.write(" free(%s_p);\n" % (lowerFirstCamelWord(re.sub('-', '', ie[2]))))
f.write(" ASN_STRUCT_FREE(asn_DEF_%s, %s_p);\n" % (re.sub('-', '_', ie[2]), lowerFirstCamelWord(re.sub('-', '', ie[2]))))
f.write(" return -1;\n")
f.write(" }\n")
f.write(" decoded += tempDecoded;\n")
f.write(" if (asn1_xer_print)\n")
f.write(" xer_fprint(stdout, &asn_DEF_%s, %s_p);\n" % (re.sub('-', '_', ie[2]), lowerFirstCamelWord(re.sub('-', '', ie[2]))))
f.write(" ASN_SEQUENCE_ADD(&%sIEs->%s, %s_p);\n" % (lowerFirstCamelWord(re.sub('-', '_', keyname)),
re.sub('IEs', '', lowerFirstCamelWord(re.sub('-', '_', key))), lowerFirstCamelWord(re.sub('-', '', ie[2]))))
f.write(" } break;\n")
f.write(" default:\n")
f.write(" %s_ERROR(\"Unknown protocol IE id (%%d) for message %s\\n\", (int)ie_p->id);\n" % (fileprefix.upper(), re.sub('-', '_', structName.lower())))
f.write(" return -1;\n")
f.write(" }\n")
f.write(" }\n")
f.write(" return decoded;\n")
f.write("}\n\n")
#Generate IES Encode functions
f = open(outdir + fileprefix + '_encoder.c', 'w')
outputHeaderToFile(f,filename)
f.write("#include \"%s_common.h\"\n" % (fileprefix))
f.write("#include \"%s_ies_defs.h\"\n\n" % (fileprefix))
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("int %s_encode_%s(\n" % (fileprefix, re.sub('-', '_', structName.lower())))
f.write(" %s_t *%s,\n" % (asn1cStruct, firstwordlower))
f.write(" %s_t *%s) {\n\n" % (re.sub('-', '_', key), lowerFirstCamelWord(re.sub('-', '_', key))))
f.write(" %s_IE_t *ie;\n\n" % (fileprefix_first_upper))
f.write(" assert(%s != NULL);\n" % (firstwordlower));
f.write(" assert(%s != NULL);\n\n" % (lowerFirstCamelWord(re.sub('-', '_', key))));
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":
if ie[3] == "optional":
f.write(" /* Optional field */\n")
elif ie[3] == "conditional":
f.write(" /* Conditional field */\n")
f.write(" if (%s->presenceMask & %s_%s_PRESENT) {\n" % (lowerFirstCamelWord(re.sub('-', '_', key)), keyupperunderscore, ieupperunderscore))
#f.write(" == %s_%s_PRESENT) {\n" % (keyupperunderscore, ieupperunderscore))
f.write(" if ((ie = %s_new_ie(%s_ProtocolIE_ID_%s,\n" % (fileprefix, fileprefix_first_upper, re.sub('-', '_', ie[0])))
f.write(" %s_Criticality_%s,\n" % (fileprefix_first_upper, ie[1]))
f.write(" &asn_DEF_%s,\n" % (ietypeunderscore))
f.write(" &%s->%s)) == NULL) {\n" % (lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower))
f.write(" return -1;\n")
f.write(" }\n")
f.write(" ASN_SEQUENCE_ADD(&%s->%slist, ie);\n" % (firstwordlower, iesaccess))
f.write(" }\n\n")
else:
if ie[2] in ieofielist.keys():
f.write(" %s_t %s;\n\n" % (ietypeunderscore, ienamefirstwordlower))
f.write(" memset(&%s, 0, sizeof(%s_t));\n" % (ienamefirstwordlower, ietypeunderscore))
f.write("\n")
f.write(" if (%s_encode_%s(&%s, &%s->%s) < 0) return -1;\n" % (fileprefix, ietypeunderscore.lower(), ienamefirstwordlower, lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower))
f.write(" if ((ie = %s_new_ie(%s_ProtocolIE_ID_%s,\n" % (fileprefix, fileprefix_first_upper, re.sub('-', '_', ie[0])))
f.write(" %s_Criticality_%s,\n" % (fileprefix_first_upper, ie[1]))
f.write(" &asn_DEF_%s,\n" % (ietypeunderscore))
if ie[2] in ieofielist.keys():
f.write(" &%s)) == NULL) {\n" % (ienamefirstwordlower))
else:
f.write(" &%s->%s)) == NULL) {\n" % (lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower))
f.write(" return -1;\n")
f.write(" }\n")
f.write(" ASN_SEQUENCE_ADD(&%s->%slist, ie);\n\n" % (firstwordlower, iesaccess))
if ie[2] in ieofielist.keys():
f.write(" /* Free any dynamic allocation that is no more used */\n")
f.write(" ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_%s, &%s);\n\n" % (ietypeunderscore, ienamefirstwordlower))
f.write(" return 0;\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("int %s_encode_%s(\n" % (fileprefix, re.sub('-', '_', i).lower()))
f.write(" %s_t *%s,\n" % (asn1cStruct, firstwordlower))
f.write(" %sIEs_t *%sIEs) {\n\n" % (re.sub('-', '_', i), lowerFirstCamelWord(re.sub('-', '_', i))))
f.write(" int i;\n")
f.write(" %s_IE_t *ie;\n\n" % (fileprefix_first_upper))
f.write(" assert(%s != NULL);\n" % (firstwordlower));
f.write(" assert(%sIEs != NULL);\n\n" % (lowerFirstCamelWord(re.sub('-', '_', i))));
f.write(" for (i = 0; i < %sIEs->%s.count; i++) {\n" % (firstwordlower, re.sub('IEs', '', lowerFirstCamelWord(re.sub('-', '_', key)))))
f.write(" if ((ie = %s_new_ie(%s_ProtocolIE_ID_%s,\n" % (fileprefix, fileprefix_first_upper, re.sub('-', '_', ie[0])))
f.write(" %s_Criticality_%s,\n" % (fileprefix_first_upper, ie[1]))
f.write(" &asn_DEF_%s,\n" % (ietypeunderscore))
f.write(" %sIEs->%s.array[i])) == NULL) {\n" % (firstwordlower, re.sub('IEs', '', lowerFirstCamelWord(re.sub('-', '_', key)))))
f.write(" return -1;\n")
f.write(" }\n")
f.write(" ASN_SEQUENCE_ADD(&%s->list, ie);\n" % (firstwordlower))
f.write(" }\n")
f.write(" return 0;\n")
f.write("}\n\n")
#Generate xer print functions
f = open(outdir + fileprefix + '_xer_print.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\n" % (fileprefix, fileprefix))
f.write("size_t %s_string_total_size = 0;\n\n" % (fileprefix.lower()))
f.write("""int
%s_xer__print2fp(const void *buffer, size_t size, void *app_key) {
FILE *stream = (FILE *)app_key;
if(fwrite(buffer, 1, size, stream) != size)
return -1;
return 0;
}
""" % (fileprefix.lower()))
f.write("""int %s_xer__print2sp(const void *buffer, size_t size, void *app_key) {
char *string = (char *)app_key;
/* Copy buffer to the formatted string */
memcpy(&string[%s_string_total_size], buffer, size);
%s_string_total_size += size;
return 0;
}
""" % (fileprefix.lower(), fileprefix.lower(), fileprefix.lower()))
f.write("""static asn_enc_rval_t
xer_encode_local(asn_TYPE_descriptor_t *td, void *sptr,
asn_app_consume_bytes_f *cb, void *app_key, int indent) {
asn_enc_rval_t er, tmper;
const char *mname;
size_t mlen;
int xcan = 2;
if(!td || !sptr) goto cb_failed;
mname = td->xml_tag;
mlen = strlen(mname);
_i_ASN_TEXT_INDENT(0, indent);
_ASN_CALLBACK3("<", 1, mname, mlen, ">", 1);
tmper = td->xer_encoder(td, sptr, indent + 1, XER_F_BASIC, cb, app_key);
if(tmper.encoded == -1) return tmper;
_ASN_CALLBACK3("</", 2, mname, mlen, ">\\n", xcan);
er.encoded = 4 + xcan + (2 * mlen) + tmper.encoded;
_ASN_ENCODED_OK(er);
cb_failed:
_ASN_ENCODE_FAILED;
}
""")
for (key, value) in iesDefs.items():
keyName = re.sub('-', '_', key)
keyupperunderscore = keyName.upper()
iesStructName = lowerFirstCamelWord(re.sub('-', '_', key))
ie = value["ies"][0]
ietypeunderscore = re.sub('-', '_', ie[2])
if key in ieofielist.values():
f.write("asn_enc_rval_t %s_xer_print_%s(\n" % (fileprefix, re.sub('ies', '', re.sub('item', 'list', re.sub('-', '_', key).lower()))))
else:
f.write("asn_enc_rval_t %s_xer_print_%s(\n" % (fileprefix, re.sub('ies', '', re.sub('-', '_', key).lower())))
#f.write(" FILE *file,\n")
f.write(" asn_app_consume_bytes_f *cb,\n")
f.write(" void *app_key,\n")
if key in ieofielist.values():
iesStructName = lowerFirstCamelWord(re.sub('Item', 'List', re.sub('-', '_', key)))
f.write(" %sIEs_t *%s) {\n\n" % (re.sub('IEs', '', re.sub('Item', 'List', re.sub('-', '_', key))), iesStructName))
f.write(" int i;\n")
f.write(" asn_enc_rval_t er;\n")
else:
f.write(" %s_message *message_p)\n{\n" % (fileprefix))
f.write(" %s_t *%s;\n" % (re.sub('-', '_', key), iesStructName))
f.write(" asn_enc_rval_t er;\n")
#f.write(" void *app_key = (void *)file;\n")
#f.write(" asn_app_consume_bytes_f *cb = %s_xer__print2fp;\n\n" % (fileprefix.lower()))
f.write(" %s = &message_p->msg.%s;\n\n" % (iesStructName, iesStructName))
if key in ieofielist.values():
# Increase indentation level
f.write(" for (i = 0; i < %s->%s.count; i++) {\n" % (iesStructName, re.sub('IEs', '', lowerFirstCamelWord(re.sub('-', '_', key)))))
#f.write(" xer_fprint(file, &asn_DEF_%s, %s->%s.array[i]);\n" % (ietypeunderscore, iesStructName, re.sub('IEs', '', lowerFirstCamelWord(re.sub('-', '_', key)))))
f.write(" er = xer_encode(&asn_DEF_%s, %s->%s.array[i], XER_F_BASIC, cb, app_key);\n" % (ietypeunderscore, iesStructName, re.sub('IEs', '', lowerFirstCamelWord(re.sub('-', '_', key)))))
f.write(" }\n")
else:
f.write(" cb(\"<%s-PDU>\\n\", %d, app_key);\n" % (key, len("<%s-PDU>\n" % (key))))
f.write(" xer_encode_local(&asn_DEF_%s_Criticality, &message_p->criticality, cb, app_key, 1);\n" % fileprefix_first_upper)
f.write(" xer_encode_local(&asn_DEF_%s_ProcedureCode, &message_p->procedureCode, cb, app_key, 1);\n" % fileprefix_first_upper)
f.write(" cb(\" <%s>\\n\", %d, app_key);\n" % (key, len(" <%s>\n" % (key))))
for ie in iesDefs[key]["ies"]:
iename = re.sub('-', '_', re.sub('id-', '', ie[0]))
ienameunderscore = re.sub('-', '_', iename)
ienamefirstwordlower = lowerFirstCamelWord(iename)
ietypeunderscore = re.sub('-', '_', ie[2])
ieupperunderscore = re.sub('-', '_', re.sub('id-', '', ie[0])).upper()
if ie[3] != "mandatory":
if ie[3] == "optional":
f.write(" /* Optional field */\n")
elif ie[3] == "conditional":
f.write(" /* Conditional field */\n")
f.write(" if (%s->presenceMask & %s_%s_PRESENT)\n " % (iesStructName, keyupperunderscore, ieupperunderscore))
# Is it an encapsulated IE ?
if ie[2] in ieofielist.keys():
f.write(" %s_xer_print_%s(cb, app_key, &%s->%s);\n" % (fileprefix, re.sub('ies', '', re.sub('-', '_', ie[2]).lower()), iesStructName, ienamefirstwordlower))
else:
f.write(" xer_encode_local(&asn_DEF_%s, &%s->%s, cb, app_key, 2);\n" % (ietypeunderscore, iesStructName, ienamefirstwordlower))
f.write(" cb(\" </%s>\\n\", %d, app_key);\n" % (key, len(" </%s>\n" % (key))))
f.write(" cb(\"</%s-PDU>\\n\", %d, app_key);\n" % (key, len("</%s-PDU>\n" % (key))))
f.write(" _ASN_ENCODED_OK(er);\n")
#if key not in ieofielist.values():
#f.write("cb_failed:\n")
#f.write(" return er;\n")
f.write("}\n\n")
-221
View File
@@ -1,221 +0,0 @@
#!/bin/bash
# in those arrays, each line is:
# <file> <sha1sum of file (without line 4 which changes depending on the location of the files)> <patch to apply to file>
RRC_Rel14=(
"SystemInformation-r8-IEs.h" 4df485c5ddf2540eca271876cdc512caa19b0890 "fix_asn1.data/RRC.rel14/SystemInformation-r8-IEs.h.diff"
"SystemInformation-NB-r13-IEs.h" 6d91332d5c39205819b06e5e36efe62ff8e5b33b "fix_asn1.data/RRC.rel14/SystemInformation-NB-r13-IEs.h.diff"
)
RRC_Rel10=(
"SystemInformation-r8-IEs.h" 603cd6615cff36ec7020692d72c0d6de7c4859cb "fix_asn1.data/RRC.rel10/SystemInformation-r8-IEs.h.diff"
)
X2AP_Rel11_2=(
"X2ap-CriticalityDiagnostics-IE-List.h" ae96308b37fcbcbf39da5012e42968135fc5f27b "fix_asn1.data/X2AP.rel11.2/X2ap-CriticalityDiagnostics-IE-List.h.diff"
)
red_color="$(tput setaf 1)"
green_color="$(tput setaf 2)"
reset_color="$(tput sgr0)"
function error()
{
echo -e "$red_color"ERROR: "$@""$reset_color"
# exit 1
}
function check_sha1()
{
local file="$1"
local target_sha1="$2"
if [ ! -f "$file" ]
then
error "$file: no such file"
fi
# we don't use the line 4 of the file
# it contains the location of the ASN1 grammar
# and this location is not the same on every
# installation (this is for *.h files, for *.c
# files it's no big deal to skip that line)
local computed_sha1=$(sed 4d "$file" | sha1sum | cut -f 1 -d ' ')
if [ "$target_sha1" != "$computed_sha1" ]
then
error "$file: wrong SHA1"
fi
}
function patch_file()
{
local patch="$1"
local file="$2"
echo -e "$green_color""patch file $file with $OPENAIR_DIR/cmake_targets/tools/$patch""$reset_color"
# patch "$file" "$OPENAIR_DIR/cmake_targets/tools/$patch"
# if [ $? -ne 0 ]
# then
# error "patching of $file with $OPENAIR_DIR/cmake_targets/tools/$patch failed"
# fi
}
function apply_patches()
{
local directory="$1"
local array=$2
local len=$3 # the length could be computed locally but the way to do it is not clear to me [CROUX]
local i
local file
local sha1
local patch
local item
for (( i = 0; i < $len; i += 3 ))
do
# special bash syntax to access the array
item=$array[$i]; file=${!item}
item=$array[$((i+1))]; sha1=${!item}
item=$array[$((i+2))]; patch=${!item}
check_sha1 "$directory/$file" "$sha1"
patch_file "$patch" "$directory/$file"
done
}
function patch_rrc()
{
local directory="$1"
local version="$2"
case "$version" in
Rel14 )
echo "patching RRC files release 14"
#apply_patches "$directory" RRC_Rel14 ${#RRC_Rel14[*]}
;;
Rel10 )
echo "patching RRC files release 10"
apply_patches "$directory" RRC_Rel10 ${#RRC_Rel10[*]}
;;
Rel8 )
echo "patching RRC files release 8 TODO?"
;;
* )
error unknwon/unhandled RRC version \'"$version"\'
;;
esac
}
function patch_nr_rrc()
{
local directory="$1"
local version="$2"
case "$version" in
NR_Rel15 )
echo "patching NR_RRC files release 15"
apply_patches "$directory" NR_RRC_Rel15 ${#NR_RRC_Rel15[*]}
;;
* )
error unknwon/unhandled NR_RRC version \'"$version"\'
;;
esac
}
function patch_x2ap()
{
local directory="$1"
local version="$2"
case "$version" in
R14 )
;;
R11 )
echo "patching X2AP files release 11.2"
apply_patches "$directory" X2AP_Rel11_2 ${#X2AP_Rel11_2[*]}
;;
* )
error unknwon/unhandled X2AP version \'"$version"\'
;;
esac
}
function patch_s1ap()
{
local directory="$1"
local version="$2"
case "$version" in
R14 )
;;
R10 )
#nothing to do anymore (fixes went to asn1c)
;;
* )
error unknwon/unhandled S1AP version \'"$version"\'
;;
esac
}
function patch_f1ap()
{
local directory="$1"
local version="$2"
case "$version" in
R15 )
#nothing to do anymore (fixes went to asn1c)
;;
* )
error unknwon/unhandled F1AP version \'"$version"\'
;;
esac
}
function main()
{
if [ $# -ne 3 ]
then
echo "ERROR: pass <output directory> <module> <version>"
exit 1
fi
if [ x"$OPENAIR_DIR" = x ]
then
error "the variable OPENAIR_DIR is not set"
fi
local directory="$1"
local module="$2"
local version="$3"
case "$module" in
RRC )
patch_rrc "$directory" "$version"
;;
NR_RRC )
patch_nr_rrc "$directory" "$version"
;;
X2AP )
patch_x2ap "$directory" "$version"
;;
S1AP )
patch_s1ap "$directory" "$version"
;;
F1AP )
patch_f1ap "$directory" "$version"
;;
* )
error unknown module "$module"
;;
esac
exit 0
}
main "$@"
@@ -1,23 +0,0 @@
57,61d56
< /* SystemInformation-r8-IEs */
< typedef struct SystemInformation_r8_IEs {
< struct SystemInformation_r8_IEs__sib_TypeAndInfo {
< A_SEQUENCE_OF(struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member {
< SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR present;
79c74,78
< } choice;
---
> };
>
> struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member {
> SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR present;
> union SystemInformation_r8_IEs__sib_TypeAndInfo__Member_u choice;
83c82,87
< } ) list;
---
> };
>
> /* SystemInformation-r8-IEs */
> typedef struct SystemInformation_r8_IEs {
> struct SystemInformation_r8_IEs__sib_TypeAndInfo {
> A_SEQUENCE_OF(struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member) list;
@@ -1,47 +0,0 @@
48a49,70
> struct SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member {
> SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member_PR present;
> union SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member_u {
> SystemInformationBlockType2_NB_r13_t sib2_r13;
> SystemInformationBlockType3_NB_r13_t sib3_r13;
> SystemInformationBlockType4_NB_r13_t sib4_r13;
> SystemInformationBlockType5_NB_r13_t sib5_r13;
> SystemInformationBlockType14_NB_r13_t sib14_r13;
> SystemInformationBlockType16_NB_r13_t sib16_r13;
> /*
> * This type is extensible,
> * possible extensions are below.
> */
> SystemInformationBlockType15_NB_r14_t sib15_v1430;
> SystemInformationBlockType20_NB_r14_t sib20_v1430;
> SystemInformationBlockType22_NB_r14_t sib22_v1430;
> } choice;
>
> /* Context for parsing across buffer boundaries */
> asn_struct_ctx_t _asn_ctx;
> };
>
52,72c74
< A_SEQUENCE_OF(struct SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member {
< SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member_PR present;
< union SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member_u {
< SystemInformationBlockType2_NB_r13_t sib2_r13;
< SystemInformationBlockType3_NB_r13_t sib3_r13;
< SystemInformationBlockType4_NB_r13_t sib4_r13;
< SystemInformationBlockType5_NB_r13_t sib5_r13;
< SystemInformationBlockType14_NB_r13_t sib14_r13;
< SystemInformationBlockType16_NB_r13_t sib16_r13;
< /*
< * This type is extensible,
< * possible extensions are below.
< */
< SystemInformationBlockType15_NB_r14_t sib15_v1430;
< SystemInformationBlockType20_NB_r14_t sib20_v1430;
< SystemInformationBlockType22_NB_r14_t sib22_v1430;
< } choice;
<
< /* Context for parsing across buffer boundaries */
< asn_struct_ctx_t _asn_ctx;
< } ) list;
---
> A_SEQUENCE_OF(struct SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member) list;
@@ -1,23 +0,0 @@
73,77d72
< /* SystemInformation-r8-IEs */
< typedef struct SystemInformation_r8_IEs {
< struct SystemInformation_r8_IEs__sib_TypeAndInfo {
< A_SEQUENCE_OF(struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member {
< SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR present;
103c98,102
< } choice;
---
> };
>
> struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member {
> SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR present;
> union SystemInformation_r8_IEs__sib_TypeAndInfo__Member_u choice;
107c106,111
< } ) list;
---
> };
>
> /* SystemInformation-r8-IEs */
> typedef struct SystemInformation_r8_IEs {
> struct SystemInformation_r8_IEs__sib_TypeAndInfo {
> A_SEQUENCE_OF(struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member) list;
@@ -1,15 +0,0 @@
29,31c29
< /* X2ap-CriticalityDiagnostics-IE-List */
< typedef struct X2ap_CriticalityDiagnostics_IE_List {
< A_SEQUENCE_OF(struct X2ap_CriticalityDiagnostics_IE_List__Member {
---
> struct X2ap_CriticalityDiagnostics_IE_List__Member {
43c41,46
< } ) list;
---
> };
>
> /* X2ap-CriticalityDiagnostics-IE-List */
> typedef struct X2ap_CriticalityDiagnostics_IE_List {
> A_SEQUENCE_OF(struct X2ap_CriticalityDiagnostics_IE_List__Member
> ) list;
-179
View File
@@ -1,179 +0,0 @@
#!/bin/bash
function main()
{
PROTOCOL_DIR=$1
mkdir -p ${PROTOCOL_DIR}
cd ${PROTOCOL_DIR}
# Because use $* also include directory, so we need shift
shift
local module="$2"
#if this script is called with only 2 arguments (so 1 here after the shift), it's for RRC
#(there may be a better way...)
if [ $# -eq 2 ]; then
#asn1c does not work well with extension groups, we need the following fix:
# replace [[ by '<name> SEQUENCE {'
# and ]] by '} OPTIONAL'
#<name> is ext<N> with N starting from 1 and incremented at each new [[ ]] just
#following another [[ ]]
#
#this is what the following C program does
echo generate asnfix.c
cat << EOF > asnfix.c
/* transforms:
* '[[' to 'name SEQUENCE {'
* ']]' to '} OPTIONAL'
* name is ext1, ext2, ..., for each [[ at the same level
* levels are delimited by { and }
* -- to end of line is a comment and unprocessed
* nested [[ ]] not handled
* { and } must be balanced
* [[ and ]] can be whatever, every combination is valid
*/
#include <stdio.h>
#include <stdlib.h>
void level(int toplevel)
{
int c;
int next_name = 1;
while (1) {
c = getchar();
next:
if (c == EOF) { if (toplevel) break; abort(); }
if (c == '-') {
c = getchar();
if (c != '-') { putchar('-'); goto next; }
putchar(c); putchar(c);
while (1) {
c = getchar(); if (c == EOF) abort();
putchar(c);
if (c == '\n') break;
}
continue;
}
if (c == '[') {
c = getchar();
if (c != '[') { putchar('['); goto next; }
printf("ext%d SEQUENCE {", next_name);
next_name++;
continue;
}
if (c == ']') {
c = getchar();
if (c != ']') { putchar(']'); goto next; }
printf("} OPTIONAL");
continue;
}
putchar(c);
if (c == '}') { if (toplevel) abort(); break; }
if (c == '{') level(0);
}
}
int main(void)
{
level(1);
fflush(stdout);
return 0;
}
EOF
echo compile asnfix.c
gcc -Wall -o asnfix asnfix.c
echo run asnfix on $1
./asnfix < $1 > fixed_grammar.asn
rm -f asnfix asnfix.c
echo done with asnfix
echo running asn1c
case "$module" in
RRC )
asn1c -gen-PER -fcompound-names -no-gen-example fixed_grammar.asn 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample
;;
NR_RRC )
export ASN1C_PREFIX=NR_
asn1c -gen-PER -fcompound-names -findirect-choice -no-gen-example fixed_grammar.asn 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample
;;
S1AP )
export ASN1C_PREFIX=S1AP_
asn1c -gen-PER -fcompound-names -no-gen-example fixed_grammar.asn 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample
;;
X2AP )
export ASN1C_PREFIX=X2AP_
asn1c -gen-PER -fcompound-names -no-gen-example fixed_grammar.asn 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample
;;
esac
rm -f fixed_grammar.asn
echo asn1c done
elif echo ${PROTOCOL_DIR} | grep -q "F1AP"; then
asn1c -gen-PER -fcompound-names -no-gen-example -findirect-choice -fno-include-deps $* 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample
else
case "$module" in
RRC )
asn1c -pdu=all -fcompound-names -gen-PER -no-gen-OER -no-gen-example $* 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample
;;
NR_RRC )
export ASN1C_PREFIX=NR_
asn1c -fcompound-names -findirect-choice -fno-include-deps -gen-PER -no-gen-OER -no-gen-example $* 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample
;;
S1AP )
export ASN1C_PREFIX=S1AP_
asn1c -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example $* 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample
;;
X2AP )
export ASN1C_PREFIX=X2AP_
asn1c -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example $* 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample
;;
esac
fi
awk '
BEGIN {
print "#ifndef __ASN1_CONSTANTS_H__"
print "#define __ASN1_CONSTANTS_H__"
}
/INTEGER ::=/ {
gsub("INTEGER ::=","")
gsub("--","//")
gsub("-1","_minus_1")
gsub("-","_")
printf("#define %s\n",$0)
}
/::=.*INTEGER.*[(]/ {
nb_fields=split($0,val,"[:=().]+");
gsub("-","_",val[1]);
printf("#define min_val_%s %s\n",val[1],val[nb_fields-2]);
printf("#define max_val_%s %s\n",val[1],val[nb_fields-1]);
}
END {
print "#endif ";
} ' $1 > asn1_constants.h
}
main "$@"
@@ -1,34 +0,0 @@
#!/bin/bash
export ASN1C_PREFIX=$1
shift
options=$1
shift
GENERATED_FULL_DIR=$1
shift
ASN1_SOURCE_DIR=$*
done_flag="$GENERATED_FULL_DIR"/done
rebuild=0
for f in $ASN1_SOURCE_DIR ; do
if [ "$done_flag" -ot "$f" ] ; then
rebuild=1
fi
done
if [ $rebuild -eq 1 ] ; then
rm -f "$GENERATED_FULL_DIR"/${ASN1C_PREFIX}*.c "$GENERATED_FULL_DIR"/${ASN1C_PREFIX}*.h
mkdir -p "$GENERATED_FULL_DIR"
asn1c -pdu=all -fcompound-names -gen-PER -no-gen-OER -no-gen-example $options -D $GENERATED_FULL_DIR $ASN1_SOURCE_DIR |& egrep -v "^Copied|^Compiled" | sort -u
if [ "$ASN1C_PREFIX" = "X2AP_" ] ; then
sed -i 's/18446744073709551615))/18446744073709551615U))/g' "$GENERATED_FULL_DIR"/${ASN1C_PREFIX}E-RABUsageReport-Item.c
sed -i 's/18446744073709551615 }/18446744073709551615U }/g' "$GENERATED_FULL_DIR"/${ASN1C_PREFIX}E-RABUsageReport-Item.c
fi
if [ "$ASN1C_PREFIX" = "S1AP_" ] ; then
sed -i 's/18446744073709551615))/18446744073709551615U))/g' "$GENERATED_FULL_DIR"/${ASN1C_PREFIX}E-RABUsageReportItem.c
sed -i 's/18446744073709551615 }/18446744073709551615U }/g' "$GENERATED_FULL_DIR"/${ASN1C_PREFIX}E-RABUsageReportItem.c
fi
if [ "$ASN1C_PREFIX" = "NGAP_" ] ; then
sed -i 's/18446744073709551615))/18446744073709551615U))/g' "$GENERATED_FULL_DIR"/${ASN1C_PREFIX}VolumeTimedReport-Item.c
sed -i 's/18446744073709551615 }/18446744073709551615U }/g' "$GENERATED_FULL_DIR"/${ASN1C_PREFIX}VolumeTimedReport-Item.c
fi
fi
touch $done_flag
@@ -9,6 +9,7 @@ set(TELNETSRV_SOURCE
add_library(telnetsrv MODULE ${TELNETSRV_SOURCE} )
target_link_libraries(telnetsrv PRIVATE history ncurses form )
target_link_libraries(telnetsrv PRIVATE asn1_nr_rrc asn1_lte_rrc)
foreach(TELNETLIB enb gnb 4Gue 5Gue)
set(TELNETLIB_SRCS "")
@@ -22,6 +23,7 @@ foreach(TELNETLIB enb gnb 4Gue 5Gue)
message("Add ${TELNETLIB} specific telnet functions in libtelnetsrv_${TELNETLIB}.so")
add_library(telnetsrv_${TELNETLIB} MODULE ${TELNETLIB_SRCS} )
add_dependencies(telnetsrv telnetsrv_${TELNETLIB})
target_link_libraries(telnetsrv_${TELNETLIB} PRIVATE asn1_nr_rrc asn1_lte_rrc)
install(TARGETS telnetsrv_${TELNETLIB} DESTINATION bin)
else()
message("No specific telnet functions for ${TELNETLIB}")
+4
View File
@@ -1 +1,5 @@
add_subdirectory(E1AP)
add_subdirectory(F1AP)
add_subdirectory(M2AP)
add_subdirectory(X2AP)
add_subdirectory(RRC)
+1 -1
View File
@@ -3,5 +3,5 @@ add_subdirectory(MESSAGES)
add_library(E1AP e1ap.c)
target_link_libraries(E1AP
PUBLIC asn1_e1ap
PRIVATE UTIL)
PRIVATE UTIL asn1_nr_rrc asn1_lte_rrc)
target_include_directories(E1AP PUBLIC ${CMAKE_CURRENT_DIR})
+1
View File
@@ -0,0 +1 @@
add_subdirectory(MESSAGES)
@@ -10511,20 +10511,20 @@ id-SRSConfiguration ProtocolIE-ID ::= 407
id-PosReportCharacteristics ProtocolIE-ID ::= 408
id-PosMeasurementPeriodicity ProtocolIE-ID ::= 409
id-TRPList ProtocolIE-ID ::= 410
id-RAN-MeasurementID ProtocolIE-ID ::= 411
id-RAN-MeasurementID ProtocolIE-ID ::= 411
id-LMF-UE-MeasurementID ProtocolIE-ID ::= 412
id-RAN-UE-MeasurementID ProtocolIE-ID ::= 413
id-E-CID-MeasurementQuantities ProtocolIE-ID ::= 414
id-E-CID-MeasurementQuantities-Item ProtocolIE-ID ::= 415
id-E-CID-MeasurementPeriodicity ProtocolIE-ID ::= 416
id-E-CID-MeasurementResult ProtocolIE-ID ::= 417
id-Cell-Portion-ID ProtocolIE-ID ::= 418
id-SFNInitialisationTime ProtocolIE-ID ::= 419
id-SystemFrameNumber ProtocolIE-ID ::= 420
id-SlotNumber ProtocolIE-ID ::= 421
id-TRP-MeasurementRequestList ProtocolIE-ID ::= 422
id-MeasurementBeamInfoRequest ProtocolIE-ID ::= 423
id-E-CID-ReportCharacteristics ProtocolIE-ID ::= 424
id-RAN-UE-MeasurementID ProtocolIE-ID ::= 413
id-E-CID-MeasurementQuantities ProtocolIE-ID ::= 414
id-E-CID-MeasurementQuantities-Item ProtocolIE-ID ::= 415
id-E-CID-MeasurementPeriodicity ProtocolIE-ID ::= 416
id-E-CID-MeasurementResult ProtocolIE-ID ::= 417
id-Cell-Portion-ID ProtocolIE-ID ::= 418
id-SFNInitialisationTime ProtocolIE-ID ::= 419
id-SystemFrameNumber ProtocolIE-ID ::= 420
id-SlotNumber ProtocolIE-ID ::= 421
id-TRP-MeasurementRequestList ProtocolIE-ID ::= 422
id-MeasurementBeamInfoRequest ProtocolIE-ID ::= 423
id-E-CID-ReportCharacteristics ProtocolIE-ID ::= 424
id-ConfiguredTACIndication ProtocolIE-ID ::= 425
id-Extended-GNB-DU-Name ProtocolIE-ID ::= 426
id-Extended-GNB-CU-Name ProtocolIE-ID ::= 427
File diff suppressed because it is too large Load Diff
+19
View File
@@ -0,0 +1,19 @@
set(F1AP_VERSION 16 3 1)
make_version(F1AP_cc ${F1AP_VERSION})
string(REPLACE ";" "." F1AP_RELEASE "${F1AP_VERSION}")
if(F1AP_RELEASE VERSION_EQUAL "16.3.1")
include(ASN1/f1ap-16.3.1.cmake)
else()
message(FATAL_ERROR "unknown F1AP_RELEASE ${F1AP_RELEASE}")
endif()
add_custom_command(OUTPUT ${f1ap_source} ${f1ap_headers}
COMMAND ASN1C_PREFIX=F1AP_ asn1c -gen-PER -no-gen-OER -fcompound-names -no-gen-example -findirect-choice -fno-include-deps -D ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${F1AP_GRAMMAR}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${F1AP_GRAMMAR}
COMMENT "Generating F1AP source files from ${CMAKE_CURRENT_SOURCE_DIR}/${F1AP_GRAMMAR}"
)
add_library(asn1_f1ap ${f1ap_source})
target_include_directories(asn1_f1ap PUBLIC "${CMAKE_CURRENT_BINARY_DIR}")
target_compile_options(asn1_f1ap PRIVATE -DASN_DISABLE_OER_SUPPORT -w)
+6 -6
View File
@@ -346,9 +346,9 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance,
/* - gNB-CU System Information */
if (1) {
/* 3.1.2 gNB-CUSystem Information */
F1AP_ProtocolExtensionContainer_154P112_t *p_154P112=calloc(1, sizeof(* p_154P112));
cells_to_be_activated_item->iE_Extensions = (struct F1AP_ProtocolExtensionContainer *)p_154P112;
asn1cSequenceAdd(p_154P112->list, F1AP_Cells_to_be_Activated_List_ItemExtIEs_t, cells_to_be_activated_itemExtIEs);
F1AP_ProtocolExtensionContainer_10696P112_t *p = calloc(1, sizeof(* p));
cells_to_be_activated_item->iE_Extensions = (struct F1AP_ProtocolExtensionContainer *) p;
asn1cSequenceAdd(p->list, F1AP_Cells_to_be_Activated_List_ItemExtIEs_t, cells_to_be_activated_itemExtIEs);
cells_to_be_activated_itemExtIEs->id = F1AP_ProtocolIE_ID_id_gNB_CUSystemInformation;
cells_to_be_activated_itemExtIEs->criticality = F1AP_Criticality_reject;
cells_to_be_activated_itemExtIEs->extensionValue.present = F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_GNB_CUSystemInformation;
@@ -523,10 +523,10 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu
*tmp = f1ap_gnb_cu_configuration_update->cells_to_activate[i].nrpci; // int 0..1007
// optional
// 3.1.2 gNB-CUSystem Information
F1AP_ProtocolExtensionContainer_154P112_t *p_154P112=(F1AP_ProtocolExtensionContainer_154P112_t *) calloc(1,sizeof(*p_154P112));
cells_to_be_activated_list_item->iE_Extensions = (struct F1AP_ProtocolExtensionContainer *)p_154P112;
F1AP_ProtocolExtensionContainer_10696P112_t *p = calloc(1,sizeof(*p));
cells_to_be_activated_list_item->iE_Extensions = (struct F1AP_ProtocolExtensionContainer *) p;
//F1AP_ProtocolExtensionContainer_154P112_t
asn1cSequenceAdd(p_154P112->list,F1AP_Cells_to_be_Activated_List_ItemExtIEs_t, cells_to_be_activated_itemExtIEs);
asn1cSequenceAdd(p->list, F1AP_Cells_to_be_Activated_List_ItemExtIEs_t, cells_to_be_activated_itemExtIEs);
cells_to_be_activated_itemExtIEs->id = F1AP_ProtocolIE_ID_id_gNB_CUSystemInformation;
cells_to_be_activated_itemExtIEs->criticality = F1AP_Criticality_reject;
cells_to_be_activated_itemExtIEs->extensionValue.present = F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_GNB_CUSystemInformation;
+5 -5
View File
@@ -174,9 +174,9 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) {
MCC_MNC_TO_PLMNID(cell->mcc, cell->mnc, cell->mnc_digit_length, &servedPLMN_item->pLMN_Identity);
// // /* - CHOICE NR-MODE-Info */
F1AP_NR_Mode_Info_t *nR_Mode_Info= &served_cell_information->nR_Mode_Info;
F1AP_ProtocolExtensionContainer_154P34_t *p_154P34=calloc(1,sizeof(* p_154P34));
servedPLMN_item->iE_Extensions = (struct F1AP_ProtocolExtensionContainer *)p_154P34;
asn1cSequenceAdd(p_154P34->list, F1AP_ServedPLMNs_ItemExtIEs_t , served_plmns_itemExtIEs);
F1AP_ProtocolExtensionContainer_10696P34_t *p = calloc(1, sizeof(*p));
servedPLMN_item->iE_Extensions = (struct F1AP_ProtocolExtensionContainer *) p;
asn1cSequenceAdd(p->list, F1AP_ServedPLMNs_ItemExtIEs_t , served_plmns_itemExtIEs);
served_plmns_itemExtIEs->criticality = F1AP_Criticality_ignore;
served_plmns_itemExtIEs->id = F1AP_ProtocolIE_ID_id_TAISliceSupportList;
served_plmns_itemExtIEs->extensionValue.present = F1AP_ServedPLMNs_ItemExtIEs__extensionValue_PR_SliceSupportList;
@@ -432,7 +432,7 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance,
cell->nRCGI.nRCellIdentity.buf[4]);
BIT_STRING_TO_NR_CELL_IDENTITY(&cell->nRCGI.nRCellIdentity,
F1AP_SETUP_RESP (msg_p).cells_to_activate[i].nr_cellid);
F1AP_ProtocolExtensionContainer_154P112_t *ext = (F1AP_ProtocolExtensionContainer_154P112_t *)cell->iE_Extensions;
F1AP_ProtocolExtensionContainer_10696P112_t *ext = (F1AP_ProtocolExtensionContainer_10696P112_t *)cell->iE_Extensions;
if (ext==NULL)
continue;
@@ -859,7 +859,7 @@ int DU_handle_gNB_CU_CONFIGURATION_UPDATE(instance_t instance,
cell->nRCGI.nRCellIdentity.buf[4]);
BIT_STRING_TO_NR_CELL_IDENTITY(&cell->nRCGI.nRCellIdentity,
F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].nr_cellid);
F1AP_ProtocolExtensionContainer_154P112_t *ext = (F1AP_ProtocolExtensionContainer_154P112_t *)cell->iE_Extensions;
F1AP_ProtocolExtensionContainer_10696P112_t *ext = (F1AP_ProtocolExtensionContainer_10696P112_t *)cell->iE_Extensions;
if (ext==NULL)
continue;
@@ -1133,11 +1133,7 @@ void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu,
AssertFatal(1==0,"Couldn't fine pucch resource indicator %d in PUCCH resource set %d for %d UCI bits",pucch_resource,i,O_uci);
}
if (pucchresset->pucch_ResourceSetId == 1 && O_uci>2) {
#if (NR_RRC_VERSION >= MAKE_VERSION(16, 0, 0))
N3 = pucchresset->maxPayloadSize!= NULL ? *pucchresset->maxPayloadSize : 1706;
#else
N3 = pucchresset->maxPayloadMinus1!= NULL ? *pucchresset->maxPayloadMinus1 : 1706;
#endif
if (N2<O_uci && N3>O_uci) {
if (pucch_resource < n_list)
resource_id = pucchresset->resourceList.list.array[pucch_resource];
+1
View File
@@ -0,0 +1 @@
add_subdirectory(MESSAGES)
@@ -0,0 +1,343 @@
set(M2AP_GRAMMAR ASN1/m2ap-14.0.0.asn)
set(m2ap_source
ANY.c
asn_application.c
asn_bit_data.c
asn_codecs_prim.c
asn_internal.c
asn_random_fill.c
asn_SEQUENCE_OF.c
asn_SET_OF.c
ber_decoder.c
ber_tlv_length.c
ber_tlv_tag.c
BIT_STRING.c
constraints.c
constr_CHOICE.c
constr_SEQUENCE.c
constr_SEQUENCE_OF.c
constr_SET_OF.c
constr_TYPE.c
der_encoder.c
INTEGER.c
M2AP_Active-MBMS-Session-List.c
M2AP_AllocatedSubframesEnd.c
M2AP_AllocationAndRetentionPriority.c
M2AP_BitRate.c
M2AP_Cause.c
M2AP_CauseMisc.c
M2AP_CauseNAS.c
M2AP_CauseProtocol.c
M2AP_CauseRadioNetwork.c
M2AP_CauseTransport.c
M2AP_Cell-Information.c
M2AP_Cell-Information-List.c
M2AP_Common-Subframe-Allocation-Period.c
M2AP_CountingResult.c
M2AP_Criticality.c
M2AP_CriticalityDiagnostics.c
M2AP_CriticalityDiagnostics-IE-List.c
M2AP_ECGI.c
M2AP_ENBConfigurationUpdateAcknowledge.c
M2AP_ENBConfigurationUpdate.c
M2AP_ENBConfigurationUpdateFailure.c
M2AP_ENB-ID.c
M2AP_ENB-MBMS-Configuration-data-ConfigUpdate-Item.c
M2AP_ENB-MBMS-Configuration-data-Item.c
M2AP_ENB-MBMS-Configuration-data-List.c
M2AP_ENB-MBMS-Configuration-data-List-ConfigUpdate.c
M2AP_ENB-MBMS-M2AP-ID.c
M2AP_ENBname.c
M2AP_ErrorIndication.c
M2AP_EUTRANCellIdentifier.c
M2AP_GBR-QosInformation.c
M2AP_GlobalENB-ID.c
M2AP_GlobalMCE-ID.c
M2AP_GTP-TEID.c
M2AP_InitiatingMessage.c
M2AP_IPAddress.c
M2AP_LCID.c
M2AP_M2AP-PDU.c
M2AP_M2SetupFailure.c
M2AP_M2SetupRequest.c
M2AP_M2SetupResponse.c
M2AP_MBMS-Cell-List.c
M2AP_MBMS-Counting-Request-Session.c
M2AP_MBMS-Counting-Request-SessionIE.c
M2AP_MBMS-Counting-Result.c
M2AP_MBMS-Counting-Result-List.c
M2AP_MBMS-E-RAB-QoS-Parameters.c
M2AP_MbmsOverloadNotification.c
M2AP_MbmsSchedulingInformation.c
M2AP_MbmsSchedulingInformationResponse.c
M2AP_MBMS-Service-Area.c
M2AP_MBMS-Service-Area-ID-List.c
M2AP_MBMS-Service-associatedLogicalM2-ConnectionItem.c
M2AP_MBMS-Service-associatedLogicalM2-ConnectionListResAck.c
M2AP_MBMS-Service-associatedLogicalM2-ConnectionListRes.c
M2AP_MbmsServiceCountingFailure.c
M2AP_MbmsServiceCountingRequest.c
M2AP_MbmsServiceCountingResponse.c
M2AP_MbmsServiceCountingResultsReport.c
M2AP_MBMS-Session-ID.c
M2AP_MBMSsessionListPerPMCH-Item.c
M2AP_MBMSsessionsToBeSuspendedListPerPMCH-Item.c
M2AP_MBMS-Suspension-Notification-Item.c
M2AP_MBMS-Suspension-Notification-List.c
M2AP_MBSFN-Area-Configuration-List.c
M2AP_MBSFN-Area-ID.c
M2AP_MBSFN-Subframe-Configuration.c
M2AP_MBSFN-Subframe-ConfigurationList.c
M2AP_MBSFN-SynchronisationArea-ID.c
M2AP_MCCHrelatedBCCH-ConfigPerMBSFNArea.c
M2AP_MCCHrelatedBCCH-ConfigPerMBSFNArea-Item.c
M2AP_MCCH-Update-Time.c
M2AP_MCEConfigurationUpdateAcknowledge.c
M2AP_MCEConfigurationUpdate.c
M2AP_MCEConfigurationUpdateFailure.c
M2AP_MCE-ID.c
M2AP_MCE-MBMS-M2AP-ID.c
M2AP_MCEname.c
M2AP_MCH-Scheduling-Period.c
M2AP_MCH-Scheduling-PeriodExtended2.c
M2AP_MCH-Scheduling-PeriodExtended.c
M2AP_Modification-PeriodExtended.c
M2AP_Modulation-Coding-Scheme2.c
M2AP_Overload-Status-Per-PMCH-List.c
M2AP_PLMN-Identity.c
M2AP_PMCH-Configuration.c
M2AP_PMCH-Configuration-Item.c
M2AP_PMCH-Configuration-List.c
M2AP_PMCH-Overload-Status.c
M2AP_Pre-emptionCapability.c
M2AP_Pre-emptionVulnerability.c
M2AP_Presence.c
M2AP_PriorityLevel.c
M2AP_PrivateIE-Container.c
M2AP_PrivateIE-Field.c
M2AP_PrivateIE-ID.c
M2AP_PrivateMessage.c
M2AP_ProcedureCode.c
M2AP_ProtocolExtensionContainer.c
M2AP_ProtocolExtensionField.c
M2AP_ProtocolIE-Container.c
M2AP_ProtocolIE-ContainerList.c
M2AP_ProtocolIE-ContainerPair.c
M2AP_ProtocolIE-ContainerPairList.c
M2AP_ProtocolIE-Field.c
M2AP_ProtocolIE-FieldPair.c
M2AP_ProtocolIE-ID.c
M2AP_ProtocolIE-Single-Container.c
M2AP_QCI.c
M2AP_Repetition-PeriodExtended.c
M2AP_ResetAcknowledge.c
M2AP_ResetAll.c
M2AP_Reset.c
M2AP_ResetType.c
M2AP_SC-PTM-Information.c
M2AP_SessionStartFailure.c
M2AP_SessionStartRequest.c
M2AP_SessionStartResponse.c
M2AP_SessionStopRequest.c
M2AP_SessionStopResponse.c
M2AP_SessionUpdateFailure.c
M2AP_SessionUpdateRequest.c
M2AP_SessionUpdateResponse.c
M2AP_SFN.c
M2AP_Subcarrier-SpacingMBMS.c
M2AP_SubframeAllocationExtended.c
M2AP_SuccessfulOutcome.c
M2AP_TimeToWait.c
M2AP_TMGI.c
M2AP_TNL-Information.c
M2AP_TriggeringMessage.c
M2AP_TypeOfError.c
M2AP_UnsuccessfulOutcome.c
NativeEnumerated.c
NativeInteger.c
OBJECT_IDENTIFIER.c
OCTET_STRING.c
OPEN_TYPE.c
per_decoder.c
per_encoder.c
per_opentype.c
per_support.c
PrintableString.c
xer_decoder.c
xer_encoder.c
xer_support.c
)
set(m2ap_headers
ANY.h
asn_application.h
asn_bit_data.h
asn_codecs.h
asn_codecs_prim.h
asn_internal.h
asn_ioc.h
asn_random_fill.h
asn_SEQUENCE_OF.h
asn_SET_OF.h
asn_system.h
ber_decoder.h
ber_tlv_length.h
ber_tlv_tag.h
BIT_STRING.h
constraints.h
constr_CHOICE.h
constr_SEQUENCE.h
constr_SEQUENCE_OF.h
constr_SET_OF.h
constr_TYPE.h
der_encoder.h
INTEGER.h
M2AP_Active-MBMS-Session-List.h
M2AP_AllocatedSubframesEnd.h
M2AP_AllocationAndRetentionPriority.h
M2AP_asn_constant.h
M2AP_BitRate.h
M2AP_Cause.h
M2AP_CauseMisc.h
M2AP_CauseNAS.h
M2AP_CauseProtocol.h
M2AP_CauseRadioNetwork.h
M2AP_CauseTransport.h
M2AP_Cell-Information.h
M2AP_Cell-Information-List.h
M2AP_Common-Subframe-Allocation-Period.h
M2AP_CountingResult.h
M2AP_CriticalityDiagnostics.h
M2AP_CriticalityDiagnostics-IE-List.h
M2AP_Criticality.h
M2AP_ECGI.h
M2AP_ENBConfigurationUpdateAcknowledge.h
M2AP_ENBConfigurationUpdateFailure.h
M2AP_ENBConfigurationUpdate.h
M2AP_ENB-ID.h
M2AP_ENB-MBMS-Configuration-data-ConfigUpdate-Item.h
M2AP_ENB-MBMS-Configuration-data-Item.h
M2AP_ENB-MBMS-Configuration-data-List-ConfigUpdate.h
M2AP_ENB-MBMS-Configuration-data-List.h
M2AP_ENB-MBMS-M2AP-ID.h
M2AP_ENBname.h
M2AP_ErrorIndication.h
M2AP_EUTRANCellIdentifier.h
M2AP_GBR-QosInformation.h
M2AP_GlobalENB-ID.h
M2AP_GlobalMCE-ID.h
M2AP_GTP-TEID.h
M2AP_InitiatingMessage.h
M2AP_IPAddress.h
M2AP_LCID.h
M2AP_M2AP-PDU.h
M2AP_M2SetupFailure.h
M2AP_M2SetupRequest.h
M2AP_M2SetupResponse.h
M2AP_MBMS-Cell-List.h
M2AP_MBMS-Counting-Request-Session.h
M2AP_MBMS-Counting-Request-SessionIE.h
M2AP_MBMS-Counting-Result.h
M2AP_MBMS-Counting-Result-List.h
M2AP_MBMS-E-RAB-QoS-Parameters.h
M2AP_MbmsOverloadNotification.h
M2AP_MbmsSchedulingInformation.h
M2AP_MbmsSchedulingInformationResponse.h
M2AP_MBMS-Service-Area.h
M2AP_MBMS-Service-Area-ID-List.h
M2AP_MBMS-Service-associatedLogicalM2-ConnectionItem.h
M2AP_MBMS-Service-associatedLogicalM2-ConnectionListResAck.h
M2AP_MBMS-Service-associatedLogicalM2-ConnectionListRes.h
M2AP_MbmsServiceCountingFailure.h
M2AP_MbmsServiceCountingRequest.h
M2AP_MbmsServiceCountingResponse.h
M2AP_MbmsServiceCountingResultsReport.h
M2AP_MBMS-Session-ID.h
M2AP_MBMSsessionListPerPMCH-Item.h
M2AP_MBMSsessionsToBeSuspendedListPerPMCH-Item.h
M2AP_MBMS-Suspension-Notification-Item.h
M2AP_MBMS-Suspension-Notification-List.h
M2AP_MBSFN-Area-Configuration-List.h
M2AP_MBSFN-Area-ID.h
M2AP_MBSFN-Subframe-Configuration.h
M2AP_MBSFN-Subframe-ConfigurationList.h
M2AP_MBSFN-SynchronisationArea-ID.h
M2AP_MCCHrelatedBCCH-ConfigPerMBSFNArea.h
M2AP_MCCHrelatedBCCH-ConfigPerMBSFNArea-Item.h
M2AP_MCCH-Update-Time.h
M2AP_MCEConfigurationUpdateAcknowledge.h
M2AP_MCEConfigurationUpdateFailure.h
M2AP_MCEConfigurationUpdate.h
M2AP_MCE-ID.h
M2AP_MCE-MBMS-M2AP-ID.h
M2AP_MCEname.h
M2AP_MCH-Scheduling-PeriodExtended2.h
M2AP_MCH-Scheduling-PeriodExtended.h
M2AP_MCH-Scheduling-Period.h
M2AP_Modification-PeriodExtended.h
M2AP_Modulation-Coding-Scheme2.h
M2AP_Overload-Status-Per-PMCH-List.h
M2AP_PLMN-Identity.h
M2AP_PMCH-Configuration.h
M2AP_PMCH-Configuration-Item.h
M2AP_PMCH-Configuration-List.h
M2AP_PMCH-Overload-Status.h
M2AP_Pre-emptionCapability.h
M2AP_Pre-emptionVulnerability.h
M2AP_Presence.h
M2AP_PriorityLevel.h
M2AP_PrivateIE-Container.h
M2AP_PrivateIE-Field.h
M2AP_PrivateIE-ID.h
M2AP_PrivateMessage.h
M2AP_ProcedureCode.h
M2AP_ProtocolExtensionContainer.h
M2AP_ProtocolExtensionField.h
M2AP_ProtocolIE-Container.h
M2AP_ProtocolIE-ContainerList.h
M2AP_ProtocolIE-ContainerPair.h
M2AP_ProtocolIE-ContainerPairList.h
M2AP_ProtocolIE-Field.h
M2AP_ProtocolIE-FieldPair.h
M2AP_ProtocolIE-ID.h
M2AP_ProtocolIE-Single-Container.h
M2AP_QCI.h
M2AP_Repetition-PeriodExtended.h
M2AP_ResetAcknowledge.h
M2AP_ResetAll.h
M2AP_Reset.h
M2AP_ResetType.h
M2AP_SC-PTM-Information.h
M2AP_SessionStartFailure.h
M2AP_SessionStartRequest.h
M2AP_SessionStartResponse.h
M2AP_SessionStopRequest.h
M2AP_SessionStopResponse.h
M2AP_SessionUpdateFailure.h
M2AP_SessionUpdateRequest.h
M2AP_SessionUpdateResponse.h
M2AP_SFN.h
M2AP_Subcarrier-SpacingMBMS.h
M2AP_SubframeAllocationExtended.h
M2AP_SuccessfulOutcome.h
M2AP_TimeToWait.h
M2AP_TMGI.h
M2AP_TNL-Information.h
M2AP_TriggeringMessage.h
M2AP_TypeOfError.h
M2AP_UnsuccessfulOutcome.h
NativeEnumerated.h
NativeInteger.h
OBJECT_IDENTIFIER.h
OCTET_STRING.h
OPEN_TYPE.h
per_decoder.h
per_encoder.h
per_opentype.h
per_support.h
PrintableString.h
xer_decoder.h
xer_encoder.h
xer_support.h
)
+29
View File
@@ -0,0 +1,29 @@
set(M2AP_VERSION 14 0 0)
make_version(M2AP_cc ${M2AP_VERSION})
string(REPLACE ";" "." M2AP_RELEASE "${M2AP_VERSION}")
if(M2AP_RELEASE VERSION_EQUAL "16.3.1")
include(ASN1/m2ap-16.3.1.cmake)
elseif(M2AP_RELEASE VERSION_EQUAL "8.9.0")
include(ASN1/m2ap-8.9.0.cmake)
elseif(M2AP_RELEASE VERSION_EQUAL "11.9.0")
include(ASN1/m2ap-11.9.0.cmake)
elseif(M2AP_RELEASE VERSION_EQUAL "12.9.0")
include(ASN1/m2ap-12.9.0.cmake)
elseif(M2AP_RELEASE VERSION_EQUAL "14.0.0")
include(ASN1/m2ap-14.0.0.cmake)
elseif(M2AP_RELEASE VERSION_EQUAL "15.1.0")
include(ASN1/m2ap-15.1.0.cmake)
else()
message(FATAL_ERROR "unknown M2AP_RELEASE ${M2AP_RELEASE}")
endif()
add_custom_command(OUTPUT ${m2ap_source} ${m2ap_headers}
COMMAND ASN1C_PREFIX=M2AP_ asn1c -gen-PER -no-gen-OER -fcompound-names -no-gen-example -fno-include-deps -D ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${M2AP_GRAMMAR}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${M2AP_GRAMMAR}
COMMENT "Generating M2AP source files from ${CMAKE_CURRENT_SOURCE_DIR}/${M2AP_GRAMMAR}"
)
add_library(asn1_m2ap ${m2ap_source})
target_include_directories(asn1_m2ap PUBLIC "${CMAKE_CURRENT_BINARY_DIR}")
target_compile_options(asn1_m2ap PRIVATE -DASN_DISABLE_OER_SUPPORT -w)
+2
View File
@@ -0,0 +1,2 @@
add_subdirectory(LTE)
add_subdirectory(NR)
+1
View File
@@ -0,0 +1 @@
add_subdirectory(MESSAGES)
File diff suppressed because it is too large Load Diff
+21
View File
@@ -0,0 +1,21 @@
set(LTE_RRC_VERSION 15 6 0)
make_version(LTE_RRC_cc ${LTE_RRC_VERSION})
string(REPLACE ";" "." LTE_RRC_RELEASE "${LTE_RRC_VERSION}")
if(LTE_RRC_RELEASE VERSION_EQUAL "15.6.0")
include(ASN.1/lte-rrc-15.6.0.cmake)
else()
message(FATAL_ERROR "unknown LTE_RRC_RELEASE ${LTE_RRC_RELEASE}")
endif()
add_custom_command(OUTPUT ${lte_rrc_source} ${lte_rrc_headers}
COMMAND ASN1C_PREFIX=LTE_ asn1c -pdu=all -fcompound-names -gen-PER -no-gen-OER -no-gen-example -D ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${LTE_RRC_GRAMMAR}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${LTE_RRC_GRAMMAR}
COMMENT "Generating LTE RRC source file from ${CMAKE_CURRENT_SOURCE_DIR}/${LTE_RRC_GRAMMAR}"
)
add_library(asn1_lte_rrc ${lte_rrc_source})
target_include_directories(asn1_lte_rrc PUBLIC "${CMAKE_CURRENT_BINARY_DIR}")
target_compile_options(asn1_lte_rrc
PRIVATE -DASN_DISABLE_OER_SUPPORT -w
PUBLIC -DLTE_RRC_VERSION=${LTE_RRC_RELEASE})
+46
View File
@@ -0,0 +1,46 @@
This directory contains the necessary schema files to generate all the LTE configuration data structures based on the ASN.1 RRC
source code from the 36.331 RRC specifications. These structures are used by MAC and PHY for configuration purposes.
It contains the following files
```
README.txt : This file
ASN.1 : Directory to place asn1c package
ASN.1/extract_asn1_from_spec.pl : Pearl script to extract ASN.1 source from 36311-860.txt
ASN.1/*.asn1 : Extracted ASN.1 sources
ASN.1/*.cmake : Definitions of which files the corresponding *.asn1 will generate
CMakeLists.txt : The "driver" to generate and build generated source files at build time
```
Instructions to build data structures from ASN1 sources
The asn.1 files have already been built using the `extract_asn1_from_spec.pl`
Pearl script. This should be used again if a newer version of the RRC spec is
used to synthesize the data structures and encoding/decoding routines. To do
this:
1. use Microsoft WORD to generate a text version of the 3GPP 36.331 document
2. run the script on the text file to generate the `*.asn1` file
You should install the asn1c utility using `./build_oai -I`.
Run
```bash
ASN1C_PREFIX=LTE_ asn1c -pdu=all -fcompound-names -gen-PER -no-gen-OER -no-gen-example -D <dir> <asn.1-file>
```
to generate the files that result from the asn.1-file. Create an `ASN.1/*.cmake` file
with the following structure:
```
set(LTE_RRC_GRAMMAR <path-to-asn.1-file>)
set(lte_rrc_source
<list-of-c-files>
)
set(lte_rrc_headers
<list-of-h-files>
)
```
Modify the CMakeLists.txt to point to the newly generated .cmake file. On the
next LTE RRC compilation, the source files will be automatically generated from
the ASN.1 file and built henceforth.
-45
View File
@@ -1,45 +0,0 @@
This directory contains the necessary scripts and Makefiles to generate all the LTE configuration data structures based on the ASN.1 RRC
source code from the 36.331 RRC specifications. These structures are used by MAC and PHY for configuration purposes.
It contains the following files
README.txt : This file
Makefile.inc : Makefile to be included by OpenAir compilation scripts for LTE Data structures
asn1c : Directory to place asn1c package
asn1c/ASN1_files/36331-860.txt : Text file containing 36.331-860 specifications used to generate ASN1 source
asn1c/ASN1_files/extract_asn1_from_spec.pl : Pearl script to extract ASN.1 source from 36311-860.txt
asn1c/ASN1_files/EUTRA-RRC-Definitions.asn : First ASN.1 source (generated from above .txt file)
asn1c/ASN1_files/EUTRA-InterNodeDefinitions.asn .asn : Second ASN.1 source (generated from above .txt file)
asn1c/ASN1_files/EUTRA-UE-Variables.asn : Third ASN.1 source (generated from above .txt file)
Instructions to build data structures from ASN1 sources
The three files have already been built using the extract_asn1_from_spec.pl Pearl script. This should be used again if a newer version
of the RRC spec is used to synthesize the data structures and encoding/decoding routines. To do this:
1. use Microsoft WORD to generate a text version of the 3GPP 36.331 document
2. run the script on the text file to generate the three files.
Now download the asn1c utility (version 0.9.22) from
http://lionet.info/asn1c/blog/
or via svn from sourceforge (version 0.9.22)
For version 0.9.2:
svn co https://asn1c.svn.sourceforge.net/svnroot/asn1c/trunk asn1c
For the latest version:
svn co https://github.com/vlm/asn1c/trunk asn1c
and put it in the asn1c directory (you should have a second asn1c directory now). Compile it and install it locally
(or make sure your $PATH can find the asn1c executable) according to the instructions given (see INSTALL file)
by the author. We have validated that 0.9.22 works on Linux and Cygwin. To generate the data structures do the following from the
current directory
asn1c -gen-PER -fcompound-names -fnative-types -fskeletons-copy ./asn1c/ASN1_files/EUTRA-RRC-Definitions.asn
Note this only uses one of the three files from 36.331 (the core of the RRC). After this step you should have many .c and .h files
and one new Makefile, the latter of which is not used.
If you want to compile the ASN1 sources as a kernel module you need to apply the patch asn1_patch
patch -p1 < asn1_patch
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,121 +0,0 @@
EUTRA-InterNodeDefinitions DEFINITIONS AUTOMATIC TAGS ::=
BEGIN
HandoverCommand ::= SEQUENCE {
criticalExtensions CHOICE {
c1 CHOICE{
handoverCommand-r8 HandoverCommand-r8-IEs,
spare7 NULL,
spare6 NULL, spare5 NULL, spare4 NULL,
spare3 NULL, spare2 NULL, spare1 NULL
},
criticalExtensionsFuture SEQUENCE {}
}
}
HandoverCommand-r8-IEs ::= SEQUENCE {
handoverCommandMessage OCTET STRING (CONTAINING DL-DCCH-Message),
nonCriticalExtension SEQUENCE {} OPTIONAL
}
HandoverPreparationInformation ::= SEQUENCE {
criticalExtensions CHOICE {
c1 CHOICE{
handoverPreparationInformation-r8 HandoverPreparationInformation-r8-IEs,
spare7 NULL,
spare6 NULL, spare5 NULL, spare4 NULL,
spare3 NULL, spare2 NULL, spare1 NULL
},
criticalExtensionsFuture SEQUENCE {}
}
}
HandoverPreparationInformation-r8-IEs ::= SEQUENCE {
ue-RadioAccessCapabilityInfo UE-CapabilityRAT-ContainerList,
as-Config AS-Config OPTIONAL, -- Cond HO
rrm-Config RRM-Config OPTIONAL,
as-Context AS-Context OPTIONAL, -- Cond HO
nonCriticalExtension SEQUENCE {} OPTIONAL
}
UERadioAccessCapabilityInformation ::= SEQUENCE {
criticalExtensions CHOICE {
c1 CHOICE{
ueRadioAccessCapabilityInformation-r8
UERadioAccessCapabilityInformation-r8-IEs,
spare7 NULL,
spare6 NULL, spare5 NULL, spare4 NULL,
spare3 NULL, spare2 NULL, spare1 NULL
},
criticalExtensionsFuture SEQUENCE {}
}
}
UERadioAccessCapabilityInformation-r8-IEs ::= SEQUENCE {
ue-RadioAccessCapabilityInfo OCTET STRING (CONTAINING UECapabilityInformation),
nonCriticalExtension SEQUENCE {} OPTIONAL
}
AS-Config ::= SEQUENCE {
sourceMeasConfig MeasConfig,
sourceRadioResourceConfig RadioResourceConfigDedicated,
sourceSecurityAlgorithmConfig SecurityAlgorithmConfig,
sourceUE-Identity C-RNTI,
sourceMasterInformationBlock MasterInformationBlock,
sourceSystemInformationBlockType1 SystemInformationBlockType1,
sourceSystemInformationBlockType2 SystemInformationBlockType2,
antennaInfoCommon AntennaInfoCommon,
sourceDl-CarrierFreq ARFCN-ValueEUTRA,
...
}
AS-Context ::= SEQUENCE {
reestablishmentInfo ReestablishmentInfo OPTIONAL -- Cond HO
}
ReestablishmentInfo ::= SEQUENCE {
sourcePhysCellId PhysCellId,
targetCellShortMAC-I ShortMAC-I,
additionalReestabInfoList AdditionalReestabInfoList OPTIONAL,
...
}
AdditionalReestabInfoList ::= SEQUENCE ( SIZE (1..maxReestabInfo) ) OF AdditionalReestabInfo
AdditionalReestabInfo ::= SEQUENCE{
cellIdentity CellIdentity,
key-eNodeB-Star Key-eNodeB-Star,
shortMAC-I ShortMAC-I
}
Key-eNodeB-Star ::= BIT STRING (SIZE (256))
RRM-Config ::= SEQUENCE {
ue-InactiveTime ENUMERATED {
s1, s2, s3, s5, s7, s10, s15, s20,
s25, s30, s40, s50, min1, min1s20c, min1s40,
min2, min2s30, min3, min3s30, min4, min5, min6,
min7, min8, min9, min10, min12, min14, min17, min20,
min24, min28, min33, min38, min44, min50, hr1,
hr1min30, hr2, hr2min30, hr3, hr3min30, hr4, hr5, hr6,
hr8, hr10, hr13, hr16, hr20, day1, day1hr12, day2,
day2hr12, day3, day4, day5, day7, day10, day14, day19,
day24, day30, dayMoreThan30} OPTIONAL,
...
}
maxReestabInfo INTEGER ::= 32 -- Maximum number of KeNB* and shortMAC-I forwarded
-- at handover for re-establishment preparation
END
@@ -1,149 +0,0 @@
EUTRA-InterNodeDefinitions DEFINITIONS AUTOMATIC TAGS ::=
BEGIN
HandoverCommand ::= SEQUENCE {
criticalExtensions CHOICE {
c1 CHOICE{
handoverCommand-r8 HandoverCommand-r8-IEs,
spare7 NULL,
spare6 NULL, spare5 NULL, spare4 NULL,
spare3 NULL, spare2 NULL, spare1 NULL
},
criticalExtensionsFuture SEQUENCE {}
}
}
HandoverCommand-r8-IEs ::= SEQUENCE {
handoverCommandMessage OCTET STRING (CONTAINING DL-DCCH-Message),
nonCriticalExtension SEQUENCE {} OPTIONAL
}
HandoverPreparationInformation ::= SEQUENCE {
criticalExtensions CHOICE {
c1 CHOICE{
handoverPreparationInformation-r8 HandoverPreparationInformation-r8-IEs,
spare7 NULL,
spare6 NULL, spare5 NULL, spare4 NULL,
spare3 NULL, spare2 NULL, spare1 NULL
},
criticalExtensionsFuture SEQUENCE {}
}
}
HandoverPreparationInformation-r8-IEs ::= SEQUENCE {
ue-RadioAccessCapabilityInfo UE-CapabilityRAT-ContainerList,
as-Config AS-Config OPTIONAL, -- Cond HO
rrm-Config RRM-Config OPTIONAL,
as-Context AS-Context OPTIONAL, -- Cond HO
nonCriticalExtension HandoverPreparationInformation-v920-IEs OPTIONAL
}
HandoverPreparationInformation-v920-IEs ::= SEQUENCE {
ue-ConfigRelease-r9 ENUMERATED {
rel9, rel10, spare6, spare5, spare4, spare3,
spare2, spare1, ...} OPTIONAL, -- Cond HO2
nonCriticalExtension SEQUENCE {} OPTIONAL
}
UERadioAccessCapabilityInformation ::= SEQUENCE {
criticalExtensions CHOICE {
c1 CHOICE{
ueRadioAccessCapabilityInformation-r8
UERadioAccessCapabilityInformation-r8-IEs,
spare7 NULL,
spare6 NULL, spare5 NULL, spare4 NULL,
spare3 NULL, spare2 NULL, spare1 NULL
},
criticalExtensionsFuture SEQUENCE {}
}
}
UERadioAccessCapabilityInformation-r8-IEs ::= SEQUENCE {
ue-RadioAccessCapabilityInfo OCTET STRING (CONTAINING UECapabilityInformation),
nonCriticalExtension SEQUENCE {} OPTIONAL
}
AS-Config ::= SEQUENCE {
sourceMeasConfig MeasConfig,
sourceRadioResourceConfig RadioResourceConfigDedicated,
sourceSecurityAlgorithmConfig SecurityAlgorithmConfig,
sourceUE-Identity C-RNTI,
sourceMasterInformationBlock MasterInformationBlock,
sourceSystemInformationBlockType1 SystemInformationBlockType1(WITH COMPONENTS
{..., nonCriticalExtension ABSENT}),
sourceSystemInformationBlockType2 SystemInformationBlockType2,
antennaInfoCommon AntennaInfoCommon,
sourceDl-CarrierFreq ARFCN-ValueEUTRA,
...,
[[ sourceSystemInformationBlockType1Ext OCTET STRING (CONTAINING
SystemInformationBlockType1-v890-IEs) OPTIONAL,
sourceOtherConfig-r9 OtherConfig-r9
]],
[[ sourceSCellConfigList-r10 SCellToAddModList-r10 OPTIONAL
]]
}
AS-Context ::= SEQUENCE {
reestablishmentInfo ReestablishmentInfo OPTIONAL -- Cond HO
}
ReestablishmentInfo ::= SEQUENCE {
sourcePhysCellId PhysCellId,
targetCellShortMAC-I ShortMAC-I,
additionalReestabInfoList AdditionalReestabInfoList OPTIONAL,
...
}
AdditionalReestabInfoList ::= SEQUENCE ( SIZE (1..maxReestabInfo) ) OF AdditionalReestabInfo
AdditionalReestabInfo ::= SEQUENCE{
cellIdentity CellIdentity,
key-eNodeB-Star Key-eNodeB-Star,
shortMAC-I ShortMAC-I
}
Key-eNodeB-Star ::= BIT STRING (SIZE (256))
RRM-Config ::= SEQUENCE {
ue-InactiveTime ENUMERATED {
s1, s2, s3, s5, s7, s10, s15, s20,
s25, s30, s40, s50, min1, min1s20c, min1s40,
min2, min2s30, min3, min3s30, min4, min5, min6,
min7, min8, min9, min10, min12, min14, min17, min20,
min24, min28, min33, min38, min44, min50, hr1,
hr1min30, hr2, hr2min30, hr3, hr3min30, hr4, hr5, hr6,
hr8, hr10, hr13, hr16, hr20, day1, day1hr12, day2,
day2hr12, day3, day4, day5, day7, day10, day14, day19,
day24, day30, dayMoreThan30} OPTIONAL,
...,
[[ candidateCellInfoList-r10 CandidateCellInfoList-r10 OPTIONAL
]]
}
CandidateCellInfoList-r10 ::= SEQUENCE (SIZE (1..maxFreq)) OF CandidateCellInfo-r10
CandidateCellInfo-r10 ::= SEQUENCE {
-- cellIdentification
physCellId-r10 PhysCellId,
dl-CarrierFreq-r10 ARFCN-ValueEUTRA,
-- available measurement results
rsrpResult-r10 RSRP-Range OPTIONAL,
rsrqResult-r10 RSRQ-Range OPTIONAL,
...
}
maxReestabInfo INTEGER ::= 32 -- Maximum number of KeNB* and shortMAC-I forwarded
-- at handover for re-establishment preparation
END
@@ -1,165 +0,0 @@
EUTRA-InterNodeDefinitions DEFINITIONS AUTOMATIC TAGS ::=
BEGIN
HandoverCommand ::= SEQUENCE {
criticalExtensions CHOICE {
c1 CHOICE{
handoverCommand-r8 HandoverCommand-r8-IEs,
spare7 NULL,
spare6 NULL, spare5 NULL, spare4 NULL,
spare3 NULL, spare2 NULL, spare1 NULL
},
criticalExtensionsFuture SEQUENCE {}
}
}
HandoverCommand-r8-IEs ::= SEQUENCE {
handoverCommandMessage OCTET STRING (CONTAINING DL-DCCH-Message),
nonCriticalExtension SEQUENCE {} OPTIONAL
}
HandoverPreparationInformation ::= SEQUENCE {
criticalExtensions CHOICE {
c1 CHOICE{
handoverPreparationInformation-r8 HandoverPreparationInformation-r8-IEs,
spare7 NULL,
spare6 NULL, spare5 NULL, spare4 NULL,
spare3 NULL, spare2 NULL, spare1 NULL
},
criticalExtensionsFuture SEQUENCE {}
}
}
HandoverPreparationInformation-r8-IEs ::= SEQUENCE {
ue-RadioAccessCapabilityInfo UE-CapabilityRAT-ContainerList,
as-Config AS-Config OPTIONAL, -- Cond HO
rrm-Config RRM-Config OPTIONAL,
as-Context AS-Context OPTIONAL, -- Cond HO
nonCriticalExtension HandoverPreparationInformation-v920-IEs OPTIONAL
}
HandoverPreparationInformation-v920-IEs ::= SEQUENCE {
ue-ConfigRelease-r9 ENUMERATED {
rel9, rel10, spare6, spare5, spare4, spare3,
spare2, spare1, ...} OPTIONAL, -- Cond HO2
nonCriticalExtension HandoverPreparationInformation-v9d0-IEs OPTIONAL
}
HandoverPreparationInformation-v9d0-IEs ::= SEQUENCE {
lateNonCriticalExtension OCTET STRING OPTIONAL,
nonCriticalExtension HandoverPreparationInformation-v9e0-IEs OPTIONAL
}
HandoverPreparationInformation-v9e0-IEs ::= SEQUENCE {
as-Config-v9e0 AS-Config-v9e0 OPTIONAL, -- Cond HO2
nonCriticalExtension SEQUENCE {} OPTIONAL
}
UERadioAccessCapabilityInformation ::= SEQUENCE {
criticalExtensions CHOICE {
c1 CHOICE{
ueRadioAccessCapabilityInformation-r8
UERadioAccessCapabilityInformation-r8-IEs,
spare7 NULL,
spare6 NULL, spare5 NULL, spare4 NULL,
spare3 NULL, spare2 NULL, spare1 NULL
},
criticalExtensionsFuture SEQUENCE {}
}
}
UERadioAccessCapabilityInformation-r8-IEs ::= SEQUENCE {
ue-RadioAccessCapabilityInfo OCTET STRING (CONTAINING UECapabilityInformation),
nonCriticalExtension SEQUENCE {} OPTIONAL
}
AS-Config ::= SEQUENCE {
sourceMeasConfig MeasConfig,
sourceRadioResourceConfig RadioResourceConfigDedicated,
sourceSecurityAlgorithmConfig SecurityAlgorithmConfig,
sourceUE-Identity C-RNTI,
sourceMasterInformationBlock MasterInformationBlock,
sourceSystemInformationBlockType1 SystemInformationBlockType1(WITH COMPONENTS
{..., nonCriticalExtension ABSENT}),
sourceSystemInformationBlockType2 SystemInformationBlockType2,
antennaInfoCommon AntennaInfoCommon,
sourceDl-CarrierFreq ARFCN-ValueEUTRA,
...,
[[ sourceSystemInformationBlockType1Ext OCTET STRING (CONTAINING
SystemInformationBlockType1-v890-IEs) OPTIONAL,
sourceOtherConfig-r9 OtherConfig-r9
]],
[[ sourceSCellConfigList-r10 SCellToAddModList-r10 OPTIONAL
]]
}
AS-Config-v9e0 ::= SEQUENCE {
sourceDl-CarrierFreq-v9e0 ARFCN-ValueEUTRA-v9e0
}
AS-Context ::= SEQUENCE {
reestablishmentInfo ReestablishmentInfo OPTIONAL -- Cond HO
}
ReestablishmentInfo ::= SEQUENCE {
sourcePhysCellId PhysCellId,
targetCellShortMAC-I ShortMAC-I,
additionalReestabInfoList AdditionalReestabInfoList OPTIONAL,
...
}
AdditionalReestabInfoList ::= SEQUENCE ( SIZE (1..maxReestabInfo) ) OF AdditionalReestabInfo
AdditionalReestabInfo ::= SEQUENCE{
cellIdentity CellIdentity,
key-eNodeB-Star Key-eNodeB-Star,
shortMAC-I ShortMAC-I
}
Key-eNodeB-Star ::= BIT STRING (SIZE (256))
RRM-Config ::= SEQUENCE {
ue-InactiveTime ENUMERATED {
s1, s2, s3, s5, s7, s10, s15, s20,
s25, s30, s40, s50, min1, min1s20c, min1s40,
min2, min2s30, min3, min3s30, min4, min5, min6,
min7, min8, min9, min10, min12, min14, min17, min20,
min24, min28, min33, min38, min44, min50, hr1,
hr1min30, hr2, hr2min30, hr3, hr3min30, hr4, hr5, hr6,
hr8, hr10, hr13, hr16, hr20, day1, day1hr12, day2,
day2hr12, day3, day4, day5, day7, day10, day14, day19,
day24, day30, dayMoreThan30} OPTIONAL,
...,
[[ candidateCellInfoList-r10 CandidateCellInfoList-r10 OPTIONAL
]]
}
CandidateCellInfoList-r10 ::= SEQUENCE (SIZE (1..maxFreq)) OF CandidateCellInfo-r10
CandidateCellInfo-r10 ::= SEQUENCE {
-- cellIdentification
physCellId-r10 PhysCellId,
dl-CarrierFreq-r10 ARFCN-ValueEUTRA,
-- available measurement results
rsrpResult-r10 RSRP-Range OPTIONAL,
rsrqResult-r10 RSRQ-Range OPTIONAL,
...,
[[ dl-CarrierFreq-v1090 ARFCN-ValueEUTRA-v9e0 OPTIONAL
]]
}
maxReestabInfo INTEGER ::= 32 -- Maximum number of KeNB* and shortMAC-I forwarded
-- at handover for re-establishment preparation
END
@@ -1,310 +0,0 @@
EUTRA-InterNodeDefinitions DEFINITIONS AUTOMATIC TAGS ::=
BEGIN
HandoverCommand ::= SEQUENCE {
criticalExtensions CHOICE {
c1 CHOICE{
handoverCommand-r8 HandoverCommand-r8-IEs,
spare7 NULL,
spare6 NULL, spare5 NULL, spare4 NULL,
spare3 NULL, spare2 NULL, spare1 NULL
},
criticalExtensionsFuture SEQUENCE {}
}
}
HandoverCommand-r8-IEs ::= SEQUENCE {
handoverCommandMessage OCTET STRING (CONTAINING DL-DCCH-Message),
nonCriticalExtension SEQUENCE {} OPTIONAL
}
HandoverPreparationInformation ::= SEQUENCE {
criticalExtensions CHOICE {
c1 CHOICE{
handoverPreparationInformation-r8 HandoverPreparationInformation-r8-IEs,
spare7 NULL,
spare6 NULL, spare5 NULL, spare4 NULL,
spare3 NULL, spare2 NULL, spare1 NULL
},
criticalExtensionsFuture SEQUENCE {}
}
}
HandoverPreparationInformation-r8-IEs ::= SEQUENCE {
ue-RadioAccessCapabilityInfo UE-CapabilityRAT-ContainerList,
as-Config AS-Config OPTIONAL, -- Cond HO
rrm-Config RRM-Config OPTIONAL,
as-Context AS-Context OPTIONAL, -- Cond HO
nonCriticalExtension HandoverPreparationInformation-v920-IEs OPTIONAL
}
HandoverPreparationInformation-v920-IEs ::= SEQUENCE {
ue-ConfigRelease-r9 ENUMERATED {
rel9, rel10, rel11, rel12, spare4, spare3,
spare2, spare1, ...} OPTIONAL, -- Cond HO2
nonCriticalExtension HandoverPreparationInformation-v9d0-IEs OPTIONAL
}
HandoverPreparationInformation-v9d0-IEs ::= SEQUENCE {
lateNonCriticalExtension OCTET STRING OPTIONAL,
nonCriticalExtension HandoverPreparationInformation-v9e0-IEs OPTIONAL
}
HandoverPreparationInformation-v9e0-IEs ::= SEQUENCE {
as-Config-v9e0 AS-Config-v9e0 OPTIONAL, -- Cond HO2
nonCriticalExtension HandoverPreparationInformation-v1130-IEs OPTIONAL
}
HandoverPreparationInformation-v1130-IEs ::= SEQUENCE {
as-Context-v1130 AS-Context-v1130 OPTIONAL, -- Cond HO2
nonCriticalExtension HandoverPreparationInformation-v1250-IEs OPTIONAL
}
HandoverPreparationInformation-v1250-IEs ::= SEQUENCE {
ue-SupportedEARFCN-r12 ARFCN-ValueEUTRA-r9 OPTIONAL, -- Cond HO3
as-Config-v1250 AS-Config-v1250 OPTIONAL, -- Cond HO2
nonCriticalExtension SEQUENCE {} OPTIONAL
}
SCG-Config-r12 ::= SEQUENCE {
criticalExtensions CHOICE {
c1 CHOICE{
scg-Config-r12 SCG-Config-r12-IEs,
spare7 NULL,
spare6 NULL, spare5 NULL, spare4 NULL,
spare3 NULL, spare2 NULL, spare1 NULL
},
criticalExtensionsFuture SEQUENCE {}
}
}
SCG-Config-r12-IEs ::= SEQUENCE {
scg-RadioConfig-r12 SCG-ConfigPartSCG-r12 OPTIONAL,
nonCriticalExtension SEQUENCE {} OPTIONAL
}
SCG-ConfigInfo-r12 ::= SEQUENCE {
criticalExtensions CHOICE {
c1 CHOICE{
scg-ConfigInfo-r12 SCG-ConfigInfo-r12-IEs,
spare7 NULL,
spare6 NULL, spare5 NULL, spare4 NULL,
spare3 NULL, spare2 NULL, spare1 NULL
},
criticalExtensionsFuture SEQUENCE {}
}
}
SCG-ConfigInfo-r12-IEs ::= SEQUENCE {
radioResourceConfigDedMCG-r12 RadioResourceConfigDedicated OPTIONAL,
sCellToAddModListMCG-r12 SCellToAddModList-r10 OPTIONAL,
measGapConfig-r12 MeasGapConfig OPTIONAL,
powerCoordinationInfo-r12 PowerCoordinationInfo-r12 OPTIONAL,
scg-RadioConfig-r12 SCG-ConfigPartSCG-r12 OPTIONAL,
eutra-CapabilityInfo-r12 OCTET STRING (CONTAINING UECapabilityInformation) OPTIONAL,
scg-ConfigRestrictInfo-r12 SCG-ConfigRestrictInfo-r12 OPTIONAL,
mbmsInterestIndication-r12 OCTET STRING (CONTAINING
MBMSInterestIndication-r11) OPTIONAL,
measResultServCellListSCG-r12 MeasResultServCellListSCG-r12 OPTIONAL,
drb-ToAddModListSCG-r12 DRB-InfoListSCG-r12 OPTIONAL,
drb-ToReleaseListSCG-r12 DRB-ToReleaseList OPTIONAL,
sCellToAddModListSCG-r12 SCellToAddModListSCG-r12 OPTIONAL,
sCellToReleaseListSCG-r12 SCellToReleaseList-r10 OPTIONAL,
p-Max-r12 P-Max OPTIONAL,
nonCriticalExtension SEQUENCE {} OPTIONAL
}
DRB-InfoListSCG-r12 ::= SEQUENCE (SIZE (1..maxDRB)) OF DRB-InfoSCG-r12
DRB-InfoSCG-r12 ::= SEQUENCE {
eps-BearerIdentity-r12 INTEGER (0..15) OPTIONAL, -- Cond DRB-Setup
drb-Identity-r12 DRB-Identity,
drb-Type-r12 ENUMERATED {split, scg} OPTIONAL, -- Cond DRB-Setup
...
}
SCellToAddModListSCG-r12 ::= SEQUENCE (SIZE (1..maxSCell-r10)) OF Cell-ToAddMod-r12
Cell-ToAddMod-r12 ::= SEQUENCE {
sCellIndex-r12 SCellIndex-r10,
cellIdentification-r12 SEQUENCE {
physCellId-r12 PhysCellId,
dl-CarrierFreq-r12 ARFCN-ValueEUTRA-r9
} OPTIONAL, -- Cond SCellAdd
measResultCellToAdd-r12 SEQUENCE {
rsrpResult-r12 RSRP-Range,
rsrqResult-r12 RSRQ-Range
} OPTIONAL, -- Cond SCellAdd2
...
}
MeasResultServCellListSCG-r12 ::= SEQUENCE (SIZE (1..maxServCell-r10)) OF MeasResultServCellSCG-r12
MeasResultServCellSCG-r12 ::= SEQUENCE {
servCellId-r12 ServCellIndex-r10,
measResultSCell-r12 SEQUENCE {
rsrpResultSCell-r12 RSRP-Range,
rsrqResultSCell-r12 RSRQ-Range
},
...
}
SCG-ConfigRestrictInfo-r12 ::= SEQUENCE {
maxSCH-TB-BitsDL-r12 INTEGER (1..100),
maxSCH-TB-BitsUL-r12 INTEGER (1..100)
}
UERadioAccessCapabilityInformation ::= SEQUENCE {
criticalExtensions CHOICE {
c1 CHOICE{
ueRadioAccessCapabilityInformation-r8
UERadioAccessCapabilityInformation-r8-IEs,
spare7 NULL,
spare6 NULL, spare5 NULL, spare4 NULL,
spare3 NULL, spare2 NULL, spare1 NULL
},
criticalExtensionsFuture SEQUENCE {}
}
}
UERadioAccessCapabilityInformation-r8-IEs ::= SEQUENCE {
ue-RadioAccessCapabilityInfo OCTET STRING (CONTAINING UECapabilityInformation),
nonCriticalExtension SEQUENCE {} OPTIONAL
}
UERadioPagingInformation ::= SEQUENCE {
criticalExtensions CHOICE {
c1 CHOICE{
ueRadioPagingInformation-r12 UERadioPagingInformation-r12-IEs,
spare7 NULL,
spare6 NULL, spare5 NULL, spare4 NULL,
spare3 NULL, spare2 NULL, spare1 NULL
},
criticalExtensionsFuture SEQUENCE {}
}
}
UERadioPagingInformation-r12-IEs ::= SEQUENCE {
ue-RadioPagingInfo-r12 OCTET STRING (CONTAINING UE-RadioPagingInfo-r12),
nonCriticalExtension SEQUENCE {} OPTIONAL
}
AS-Config ::= SEQUENCE {
sourceMeasConfig MeasConfig,
sourceRadioResourceConfig RadioResourceConfigDedicated,
sourceSecurityAlgorithmConfig SecurityAlgorithmConfig,
sourceUE-Identity C-RNTI,
sourceMasterInformationBlock MasterInformationBlock,
sourceSystemInformationBlockType1 SystemInformationBlockType1(WITH COMPONENTS
{..., nonCriticalExtension ABSENT}),
sourceSystemInformationBlockType2 SystemInformationBlockType2,
antennaInfoCommon AntennaInfoCommon,
sourceDl-CarrierFreq ARFCN-ValueEUTRA,
...,
[[ sourceSystemInformationBlockType1Ext OCTET STRING (CONTAINING
SystemInformationBlockType1-v890-IEs) OPTIONAL,
sourceOtherConfig-r9 OtherConfig-r9
-- sourceOtherConfig-r9 should have been optional. A target eNB compliant with this transfer
-- syntax should support receiving an AS-Config not including this extension addition group
-- e.g. from a legacy source eNB
]],
[[ sourceSCellConfigList-r10 SCellToAddModList-r10 OPTIONAL
]],
[[ sourceConfigSCG-r12 SCG-Config-r12 OPTIONAL
]]
}
AS-Config-v9e0 ::= SEQUENCE {
sourceDl-CarrierFreq-v9e0 ARFCN-ValueEUTRA-v9e0
}
AS-Config-v1250 ::= SEQUENCE {
sourceWlan-OffloadConfig-r12 WLAN-OffloadConfig-r12 OPTIONAL,
sourceSL-CommConfig-r12 SL-CommConfig-r12 OPTIONAL,
sourceSL-DiscConfig-r12 SL-DiscConfig-r12 OPTIONAL
}
AS-Context ::= SEQUENCE {
reestablishmentInfo ReestablishmentInfo OPTIONAL -- Cond HO
}
AS-Context-v1130 ::= SEQUENCE {
idc-Indication-r11 OCTET STRING (CONTAINING
InDeviceCoexIndication-r11) OPTIONAL, -- Cond HO2
mbmsInterestIndication-r11 OCTET STRING (CONTAINING
MBMSInterestIndication-r11) OPTIONAL, -- Cond HO2
powerPrefIndication-r11 OCTET STRING (CONTAINING
UEAssistanceInformation-r11) OPTIONAL, -- Cond HO2
...,
[[ sidelinkUEInformation-r12 OCTET STRING (CONTAINING
SidelinkUEInformation-r12) OPTIONAL -- Cond HO2
]]
}
ReestablishmentInfo ::= SEQUENCE {
sourcePhysCellId PhysCellId,
targetCellShortMAC-I ShortMAC-I,
additionalReestabInfoList AdditionalReestabInfoList OPTIONAL,
...
}
AdditionalReestabInfoList ::= SEQUENCE ( SIZE (1..maxReestabInfo) ) OF AdditionalReestabInfo
AdditionalReestabInfo ::= SEQUENCE{
cellIdentity CellIdentity,
key-eNodeB-Star Key-eNodeB-Star,
shortMAC-I ShortMAC-I
}
Key-eNodeB-Star ::= BIT STRING (SIZE (256))
RRM-Config ::= SEQUENCE {
ue-InactiveTime ENUMERATED {
s1, s2, s3, s5, s7, s10, s15, s20,
s25, s30, s40, s50, min1, min1s20c, min1s40,
min2, min2s30, min3, min3s30, min4, min5, min6,
min7, min8, min9, min10, min12, min14, min17, min20,
min24, min28, min33, min38, min44, min50, hr1,
hr1min30, hr2, hr2min30, hr3, hr3min30, hr4, hr5, hr6,
hr8, hr10, hr13, hr16, hr20, day1, day1hr12, day2,
day2hr12, day3, day4, day5, day7, day10, day14, day19,
day24, day30, dayMoreThan30} OPTIONAL,
...,
[[ candidateCellInfoList-r10 CandidateCellInfoList-r10 OPTIONAL
]]
}
CandidateCellInfoList-r10 ::= SEQUENCE (SIZE (1..maxFreq)) OF CandidateCellInfo-r10
CandidateCellInfo-r10 ::= SEQUENCE {
-- cellIdentification
physCellId-r10 PhysCellId,
dl-CarrierFreq-r10 ARFCN-ValueEUTRA,
-- available measurement results
rsrpResult-r10 RSRP-Range OPTIONAL,
rsrqResult-r10 RSRQ-Range OPTIONAL,
...,
[[ dl-CarrierFreq-v1090 ARFCN-ValueEUTRA-v9e0 OPTIONAL
]],
[[ rsrqResult-v1250 RSRQ-Range-v1250 OPTIONAL
]]
}
maxReestabInfo INTEGER ::= 32 -- Maximum number of KeNB* and shortMAC-I forwarded
-- at handover for re-establishment preparation
END
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -1,47 +0,0 @@
EUTRA-UE-Variables DEFINITIONS AUTOMATIC TAGS ::=
BEGIN
VarMeasConfig ::= SEQUENCE {
-- Measurement identities
measIdList MeasIdToAddModList OPTIONAL,
-- Measurement objects
measObjectList MeasObjectToAddModList OPTIONAL,
-- Reporting configurations
reportConfigList ReportConfigToAddModList OPTIONAL,
-- Other parameters
quantityConfig QuantityConfig OPTIONAL,
s-Measure RSRP-Range OPTIONAL,
speedStatePars CHOICE {
release NULL,
setup SEQUENCE {
mobilityStateParameters MobilityStateParameters,
timeToTrigger-SF SpeedStateScaleFactors
}
} OPTIONAL
}
VarMeasReportList ::= SEQUENCE (SIZE (1..maxMeasId)) OF VarMeasReport
VarMeasReport ::= SEQUENCE {
-- List of measurement that have been triggered
measId MeasId,
cellsTriggeredList CellsTriggeredList OPTIONAL,
numberOfReportsSent INTEGER
}
CellsTriggeredList ::= SEQUENCE (SIZE (1..maxCellMeas)) OF PhysCellId
VarShortMAC-Input ::= SEQUENCE {
cellIdentity CellIdentity,
physCellId PhysCellId,
c-RNTI C-RNTI
}
END
@@ -1,84 +0,0 @@
EUTRA-UE-Variables DEFINITIONS AUTOMATIC TAGS ::=
BEGIN
VarLogMeasConfig-r10 ::= SEQUENCE {
areaConfiguration-r10 AreaConfiguration-r10 OPTIONAL,
loggingDuration-r10 LoggingDuration-r10,
loggingInterval-r10 LoggingInterval-r10
}
VarLogMeasReport-r10 ::= SEQUENCE {
traceReference-r10 TraceReference-r10,
traceRecordingSessionRef-r10 OCTET STRING (SIZE (2)),
tce-Id-r10 OCTET STRING (SIZE (1)),
plmn-Identity-r10 PLMN-Identity,
absoluteTimeInfo-r10 AbsoluteTimeInfo-r10,
logMeasInfoList-r10 LogMeasInfoList-r10
}
LogMeasInfoList-r10 ::= SEQUENCE (SIZE (1..maxLogMeas-r10)) OF LogMeasInfo-r10
VarMeasConfig ::= SEQUENCE {
-- Measurement identities
measIdList MeasIdToAddModList OPTIONAL,
-- Measurement objects
measObjectList MeasObjectToAddModList OPTIONAL,
-- Reporting configurations
reportConfigList ReportConfigToAddModList OPTIONAL,
-- Other parameters
quantityConfig QuantityConfig OPTIONAL,
s-Measure INTEGER (-140..-44) OPTIONAL,
speedStatePars CHOICE {
release NULL,
setup SEQUENCE {
mobilityStateParameters MobilityStateParameters,
timeToTrigger-SF SpeedStateScaleFactors
}
} OPTIONAL
}
VarMeasReportList ::= SEQUENCE (SIZE (1..maxMeasId)) OF VarMeasReport
VarMeasReport ::= SEQUENCE {
-- List of measurement that have been triggered
measId MeasId,
cellsTriggeredList CellsTriggeredList OPTIONAL,
numberOfReportsSent INTEGER
}
CellsTriggeredList ::= SEQUENCE (SIZE (1..maxCellMeas)) OF CHOICE {
physCellIdEUTRA PhysCellId,
physCellIdUTRA CHOICE {
fdd PhysCellIdUTRA-FDD,
tdd PhysCellIdUTRA-TDD
},
physCellIdGERAN SEQUENCE {
carrierFreq CarrierFreqGERAN,
physCellId PhysCellIdGERAN
},
physCellIdCDMA2000 PhysCellIdCDMA2000
}
VarRLF-Report-r10 ::= SEQUENCE {
rlf-Report-r10 RLF-Report-r9,
plmn-Identity-r10 PLMN-Identity
}
VarShortMAC-Input ::= SEQUENCE {
cellIdentity CellIdentity,
physCellId PhysCellId,
c-RNTI C-RNTI
}
maxLogMeas-r10 INTEGER ::= 4060-- Maximum number of logged measurement entries
-- that can be stored by the UE
END
@@ -1,85 +0,0 @@
EUTRA-UE-Variables DEFINITIONS AUTOMATIC TAGS ::=
BEGIN
VarLogMeasConfig-r10 ::= SEQUENCE {
areaConfiguration-r10 AreaConfiguration-r10 OPTIONAL,
loggingDuration-r10 LoggingDuration-r10,
loggingInterval-r10 LoggingInterval-r10
}
VarLogMeasReport-r10 ::= SEQUENCE {
traceReference-r10 TraceReference-r10,
traceRecordingSessionRef-r10 OCTET STRING (SIZE (2)),
tce-Id-r10 OCTET STRING (SIZE (1)),
plmn-Identity-r10 PLMN-Identity,
absoluteTimeInfo-r10 AbsoluteTimeInfo-r10,
logMeasInfoList-r10 LogMeasInfoList2-r10
}
LogMeasInfoList2-r10 ::= SEQUENCE (SIZE (1..maxLogMeas-r10)) OF LogMeasInfo-r10
VarMeasConfig ::= SEQUENCE {
-- Measurement identities
measIdList MeasIdToAddModList OPTIONAL,
-- Measurement objects
measObjectList MeasObjectToAddModList OPTIONAL,
measObjectList-v9i0 MeasObjectToAddModList-v9e0 OPTIONAL,
-- Reporting configurations
reportConfigList ReportConfigToAddModList OPTIONAL,
-- Other parameters
quantityConfig QuantityConfig OPTIONAL,
s-Measure INTEGER (-140..-44) OPTIONAL,
speedStatePars CHOICE {
release NULL,
setup SEQUENCE {
mobilityStateParameters MobilityStateParameters,
timeToTrigger-SF SpeedStateScaleFactors
}
} OPTIONAL
}
VarMeasReportList ::= SEQUENCE (SIZE (1..maxMeasId)) OF VarMeasReport
VarMeasReport ::= SEQUENCE {
-- List of measurement that have been triggered
measId MeasId,
cellsTriggeredList CellsTriggeredList OPTIONAL,
numberOfReportsSent INTEGER
}
CellsTriggeredList ::= SEQUENCE (SIZE (1..maxCellMeas)) OF CHOICE {
physCellIdEUTRA PhysCellId,
physCellIdUTRA CHOICE {
fdd PhysCellIdUTRA-FDD,
tdd PhysCellIdUTRA-TDD
},
physCellIdGERAN SEQUENCE {
carrierFreq CarrierFreqGERAN,
physCellId PhysCellIdGERAN
},
physCellIdCDMA2000 PhysCellIdCDMA2000
}
VarRLF-Report-r10 ::= SEQUENCE {
rlf-Report-r10 RLF-Report-r9,
plmn-Identity-r10 PLMN-Identity
}
VarShortMAC-Input ::= SEQUENCE {
cellIdentity CellIdentity,
physCellId PhysCellId,
c-RNTI C-RNTI
}
maxLogMeas-r10 INTEGER ::= 4060-- Maximum number of logged measurement entries
-- that can be stored by the UE
END
@@ -1,131 +0,0 @@
EUTRA-UE-Variables DEFINITIONS AUTOMATIC TAGS ::=
BEGIN
VarConnEstFailReport-r11 ::= SEQUENCE {
connEstFailReport-r11 ConnEstFailReport-r11,
plmn-Identity-r11 PLMN-Identity
}
VarLogMeasConfig-r10 ::= SEQUENCE {
areaConfiguration-r10 AreaConfiguration-r10 OPTIONAL,
loggingDuration-r10 LoggingDuration-r10,
loggingInterval-r10 LoggingInterval-r10
}
VarLogMeasConfig-r11 ::= SEQUENCE {
areaConfiguration-r10 AreaConfiguration-r10 OPTIONAL,
areaConfiguration-v1130 AreaConfiguration-v1130 OPTIONAL,
loggingDuration-r10 LoggingDuration-r10,
loggingInterval-r10 LoggingInterval-r10
}
VarLogMeasConfig-r12 ::= SEQUENCE {
areaConfiguration-r10 AreaConfiguration-r10 OPTIONAL,
areaConfiguration-v1130 AreaConfiguration-v1130 OPTIONAL,
loggingDuration-r10 LoggingDuration-r10,
loggingInterval-r10 LoggingInterval-r10,
targetMBSFN-AreaList-r12 TargetMBSFN-AreaList-r12 OPTIONAL
}
VarLogMeasReport-r10 ::= SEQUENCE {
traceReference-r10 TraceReference-r10,
traceRecordingSessionRef-r10 OCTET STRING (SIZE (2)),
tce-Id-r10 OCTET STRING (SIZE (1)),
plmn-Identity-r10 PLMN-Identity,
absoluteTimeInfo-r10 AbsoluteTimeInfo-r10,
logMeasInfoList-r10 LogMeasInfoList2-r10
}
VarLogMeasReport-r11 ::= SEQUENCE {
traceReference-r10 TraceReference-r10,
traceRecordingSessionRef-r10 OCTET STRING (SIZE (2)),
tce-Id-r10 OCTET STRING (SIZE (1)),
plmn-IdentityList-r11 PLMN-IdentityList3-r11,
absoluteTimeInfo-r10 AbsoluteTimeInfo-r10,
logMeasInfoList-r10 LogMeasInfoList2-r10
}
LogMeasInfoList2-r10 ::= SEQUENCE (SIZE (1..maxLogMeas-r10)) OF LogMeasInfo-r10
VarMeasConfig ::= SEQUENCE {
-- Measurement identities
measIdList MeasIdToAddModList OPTIONAL,
measIdListExt-r12 MeasIdToAddModListExt-r12 OPTIONAL,
-- Measurement objects
measObjectList MeasObjectToAddModList OPTIONAL,
measObjectList-v9i0 MeasObjectToAddModList-v9e0 OPTIONAL,
-- Reporting configurations
reportConfigList ReportConfigToAddModList OPTIONAL,
-- Other parameters
quantityConfig QuantityConfig OPTIONAL,
measScaleFactor-r12 MeasScaleFactor-r12 OPTIONAL,
s-Measure INTEGER (-140..-44) OPTIONAL,
speedStatePars CHOICE {
release NULL,
setup SEQUENCE {
mobilityStateParameters MobilityStateParameters,
timeToTrigger-SF SpeedStateScaleFactors
}
} OPTIONAL,
allowInterruptions-r11 BOOLEAN OPTIONAL
}
VarMeasReportList ::= SEQUENCE (SIZE (1..maxMeasId)) OF VarMeasReport
VarMeasReportList-r12 ::= SEQUENCE (SIZE (1..maxMeasId-r12)) OF VarMeasReport
VarMeasReport ::= SEQUENCE {
-- List of measurement that have been triggered
measId MeasId,
measId-v1250 MeasId-v1250 OPTIONAL,
cellsTriggeredList CellsTriggeredList OPTIONAL,
csi-RS-TriggeredList-r12 CSI-RS-TriggeredList-r12 OPTIONAL,
numberOfReportsSent INTEGER
}
CellsTriggeredList ::= SEQUENCE (SIZE (1..maxCellMeas)) OF CHOICE {
physCellIdEUTRA PhysCellId,
physCellIdUTRA CHOICE {
fdd PhysCellIdUTRA-FDD,
tdd PhysCellIdUTRA-TDD
},
physCellIdGERAN SEQUENCE {
carrierFreq CarrierFreqGERAN,
physCellId PhysCellIdGERAN
},
physCellIdCDMA2000 PhysCellIdCDMA2000
}
CSI-RS-TriggeredList-r12 ::= SEQUENCE (SIZE (1..maxCSI-RS-Meas-r12)) OF MeasCSI-RS-Id-r12
VarMobilityHistoryReport-r12 ::= VisitedCellInfoList-r12
VarRLF-Report-r10 ::= SEQUENCE {
rlf-Report-r10 RLF-Report-r9,
plmn-Identity-r10 PLMN-Identity
}
VarRLF-Report-r11 ::= SEQUENCE {
rlf-Report-r10 RLF-Report-r9,
plmn-IdentityList-r11 PLMN-IdentityList3-r11
}
VarShortMAC-Input ::= SEQUENCE {
cellIdentity CellIdentity,
physCellId PhysCellId,
c-RNTI C-RNTI
}
maxLogMeas-r10 INTEGER ::= 4060-- Maximum number of logged measurement entries
-- that can be stored by the UE
END
+1
View File
@@ -0,0 +1 @@
add_subdirectory(MESSAGES)
File diff suppressed because it is too large Load Diff
+21
View File
@@ -0,0 +1,21 @@
set(NR_RRC_VERSION 16 4 1)
make_version(NR_RRC_cc ${NR_RRC_VERSION})
string(REPLACE ";" "." NR_RRC_RELEASE "${NR_RRC_VERSION}")
if(NR_RRC_RELEASE VERSION_EQUAL "16.4.1")
include(ASN.1/nr-rrc-16.4.1.cmake)
else()
message(FATAL_ERROR "unknown NR_RRC_RELEASE ${NR_RRC_RELEASE}")
endif()
add_custom_command(OUTPUT ${nr_rrc_source} ${nr_rrc_headers}
COMMAND ASN1C_PREFIX=NR_ asn1c -pdu=all -fcompound-names -gen-PER -no-gen-OER -no-gen-example -findirect-choice -D ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${NR_RRC_GRAMMAR}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${NR_RRC_GRAMMAR}
COMMENT "Generating NR RRC source file from ${CMAKE_CURRENT_SOURCE_DIR}/${NR_RRC_GRAMMAR}"
)
add_library(asn1_nr_rrc ${nr_rrc_source})
target_include_directories(asn1_nr_rrc PUBLIC "${CMAKE_CURRENT_BINARY_DIR}")
target_compile_options(asn1_nr_rrc
PRIVATE -DASN_DISABLE_OER_SUPPORT -w
PUBLIC -DNR_RRC_VERSION=${NR_RRC_RELEASE})
+1
View File
@@ -0,0 +1 @@
add_subdirectory(MESSAGES)
File diff suppressed because it is too large Load Diff
+21
View File
@@ -0,0 +1,21 @@
set(X2AP_VERSION 15 6 0)
make_version(X2AP_cc ${X2AP_VERSION})
#add_definitions(-DX2AP_VERSION=${X2AP_cc})
string(REPLACE ";" "." X2AP_RELEASE "${X2AP_VERSION}")
if(X2AP_RELEASE VERSION_EQUAL "15.6.0")
include(ASN1/R15/x2ap-15.6.0.cmake)
else()
message(FATAL_ERROR "unknown X2AP_RELEASE ${X2AP_RELEASE}")
endif()
add_custom_command(OUTPUT ${x2ap_source} ${x2ap_headers}
COMMAND ASN1C_PREFIX=X2AP_ asn1c -pdu=all -gen-PER -no-gen-OER -fcompound-names -no-gen-example -fno-include-deps -D ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${X2AP_GRAMMAR}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${X2AP_GRAMMAR}
COMMENT "Generating X2AP source files from ${CMAKE_CURRENT_SOURCE_DIR}/${X2AP_GRAMMAR}"
)
add_library(asn1_x2ap ${x2ap_source})
target_include_directories(asn1_x2ap PUBLIC "${CMAKE_CURRENT_BINARY_DIR}")
target_compile_options(asn1_x2ap PRIVATE -DASN_DISABLE_OER_SUPPORT -w)
+4
View File
@@ -0,0 +1,4 @@
add_subdirectory(LPP)
add_subdirectory(M3AP)
add_subdirectory(S1AP)
add_subdirectory(NGAP)
+1
View File
@@ -0,0 +1 @@
add_subdirectory(MESSAGES)
File diff suppressed because it is too large Load Diff
+20
View File
@@ -0,0 +1,20 @@
#set(LPP_VERSION 16 78 0)
#make_version(LPP_cc ${LPP_VERSION})
#add_definitions(-DLPP_VERSION=${LPP_cc})
#string(REPLACE ";" "." LPP_RELEASE "${LPP_VERSION}")
#if(LPP_RELEASE VERSION_EQUAL "16.78.0")
include(ASN1/37355-g60.cmake)
#else()
# message(FATAL_ERROR "unknown LPP_RELEASE ${LPP_RELEASE}")
#endif()
add_custom_command(OUTPUT ${lpp_source} ${lpp_headers}
COMMAND ASN1C_PREFIX=LPP_ asn1c -gen-PER -no-gen-OER -fcompound-names -no-gen-example -findirect-choice -fno-include-deps -D ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${LPP_GRAMMAR}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${LPP_GRAMMAR}
COMMENT "Generating LPP source files from ${CMAKE_CURRENT_SOURCE_DIR}/${LPP_GRAMMAR}"
)
add_library(asn1_lpp ${lpp_source})
target_include_directories(asn1_lpp PUBLIC "${CMAKE_CURRENT_BINARY_DIR}")
target_compile_options(asn1_lpp PRIVATE -DASN_DISABLE_OER_SUPPORT -w)
+1
View File
@@ -0,0 +1 @@
add_subdirectory(MESSAGES)
File diff suppressed because it is too large Load Diff
-732
View File
@@ -1,732 +0,0 @@
import re, os, sys, string
import datetime
import getopt
import getpass
version = "1.0.2"
lines = ""
iesDefs = {}
ieofielist = {}
outdir = './'
filenames = []
verbosity = 0
prefix = ""
FAIL = '\033[91m'
WARN = '\033[93m'
ENDC = '\033[0m'
fileprefix = ""
fileprefix_first_upper = ""
def printFail(string):
sys.stderr.write(FAIL + string + ENDC + "\n")
def printWarning(string):
print WARN + string + ENDC
def printDebug(string):
if verbosity > 0:
print string
def outputHeaderToFile(f, filename):
now = datetime.datetime.now()
f.write("""/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
""")
f.write("/*******************************************************************************\n")
f.write(" * This file had been created by asn1tostruct.py script v%s\n" % (version))
f.write(" * Please do not modify this file but regenerate it via script.\n")
f.write(" * Created on: %s by %s\n * from %s\n" % (str(now), getpass.getuser(), filenames))
f.write(" ******************************************************************************/\n")
def lowerFirstCamelWord(word):
""" puts the first word in a CamelCase Word in lowercase.
I.e. CustomerID becomes customerID, XMLInfoTest becomes xmlInfoTest
"""
newstr = ''
swapped = word.swapcase()
idx = 0
# if it's all-caps, return an all-lowered version
lowered = word.lower()
if swapped == lowered:
return lowered
for c in swapped:
if c in string.lowercase:
newstr += c
idx += 1
else:
break
if idx < 2:
newstr += word[idx:]
else:
newstr = newstr[:-1]+ word[idx-1:]
return newstr
def usage():
print "Python parser for asn1 v%s" % (version)
print "Usage: python asn1tostruct.py [options]"
print "Available options:"
print "-d Enable script debug"
print "-f [file] Input file to parse"
print "-o [dir] Output files to given directory"
print "-h Print this help and return"
try:
opts, args = getopt.getopt(sys.argv[1:], "df:ho:", ["debug", "file", "help", "outdir"])
except getopt.GetoptError as err:
# print help information and exit:
usage()
sys.exit(2)
for o, a in opts:
if o in ("-f", "--file"):
filenames.append(a)
if o in ("-d", "--debug"):
verbosity = 1
if o in ("-o", "--outdir"):
outdir = a
if outdir.rfind('/') != len(outdir):
outdir += '/'
if o in ("-h", "--help"):
usage()
sys.exit(2)
for filename in filenames:
file = open(filename, 'r')
for line in file:
# Removing any comment
if line.find('--') >= 0:
line = line[:line.find('--')]
# Removing any carriage return
lines += re.sub('\r', '', line)
for m in re.findall(r'([a-zA-Z0-9-]+)\s*::=\s+SEQUENCE\s+\(\s*SIZE\s*\(\s*\d+\s*\.\.\s*[0-9a-zA-Z-]+\s*\)\s*\)\s*OF\s+[a-zA-Z-]+\s*\{\s*\{\s*([0-9a-zA-Z-]+)\s*\}\s*\}', lines, re.MULTILINE):
ieofielist[m[0]] = m[1]
for m in re.findall(r'([a-zA-Z0-9-]+)\s*::=\s+E-RAB-IE-ContainerList\s*\{\s*\{\s*([a-zA-Z0-9-]+)\s*\}\s*\}', lines, re.MULTILINE):
ieofielist[m[0]] = m[1]
for i in re.findall(r'([a-zA-Z0-9-]+)\s+([A-Z0-9-]+)\s*::=\s*\{\s+([\,\|\{\}\t\n\.{3}\ \-a-zA-Z0-9]+)\s+}\n', lines, re.MULTILINE):
ies = []
maxLength = 0
# TODO: handle extensions
if i[1].find('EXTENSION') >= 0:
continue
if fileprefix == "":
fileprefix = i[1][:i[1].find('-')].lower()
for j in re.findall(r'\s*\{\s*([a-zA-Z0-9-\ \t]+)\s*\}\s*[\|,]*', i[2], re.MULTILINE):
for k in re.findall(r'ID\s*([a-zA-Z0-9\-]+)\s*CRITICALITY\s*([a-zA-Z0-9\-]+)\s+[A-Z]+\s+([a-zA-Z0-9\-]+)\s*PRESENCE\s*([a-zA-Z0-9\-]+)', j, re.MULTILINE):
printDebug("Got new ie for message " + i[0] + ": " + str(k))
if len(k[2]) > maxLength:
maxLength = len(k[2])
ies.append(k)
if len(ies) > 0:
iesDefs[i[0]] = { "length": maxLength, "ies": ies }
else:
printWarning("Didn't find any information element for message: " + i[0])
if len(iesDefs) == 0:
printFail("No Information Element parsed, exiting")
sys.exit(0)
fileprefix_first_upper = fileprefix[0].upper() + fileprefix[1:]
f = open(outdir + fileprefix + '_ies_defs.h', 'w')
outputHeaderToFile(f, filename)
f.write("#include \"%s_common.h\"\n\n" % (fileprefix))
f.write("#ifndef %s_IES_DEFS_H_\n#define %s_IES_DEFS_H_\n\n" % (fileprefix.upper(), fileprefix.upper()))
f.write("/* Define the version of script used to generate this file */\n")
f.write("#define %s_SCRIPT_VERSION (%s)\n\n" % (fileprefix.upper(), re.sub('\.', '', version)))
for key in iesDefs:
if key not in ieofielist.values():
continue
for (i, j) in ieofielist.items():
if j == key:
break
f.write("typedef struct %sIEs_s {\n" % (re.sub('-', '_', i)))
f.write(" A_SEQUENCE_OF(struct %s_s) %s;\n" % (re.sub('IEs', '', re.sub('-', '_', ieofielist[i])), lowerFirstCamelWord(re.sub('IEs', '', re.sub('-', '_', ieofielist[i])))))
f.write("} %sIEs_t;\n\n" % (re.sub('-', '_', i)))
for key in iesDefs:
keyupperunderscore = re.sub('-', '_', key.upper())
keylowerunderscore = re.sub('-', '_', key.lower())
shift = 0
if len(iesDefs[key]["ies"]) == 0:
continue
# Presence mask
for ie in iesDefs[key]["ies"]:
ieupperunderscore = re.sub('-', '_', re.sub('id-', '', ie[0])).upper()
if ie[3] == "optional" or ie[3] == "conditional":
f.write("#define {0:<{pad}} {1}\n".format("%s_%s_PRESENT" % (keyupperunderscore, ieupperunderscore), "(1 << %d)" % shift,
pad=iesDefs[key]["length"] + len(keyupperunderscore) + 9))
shift += 1
if (shift > 0):
f.write("\n")
f.write("typedef struct %s_s {\n" % (re.sub('-', '_', key)))
if (shift > 0):
f.write(" {0:<{pad}} {1};\n".format("uint16_t", "presenceMask", pad=iesDefs[key]["length"] + 2))
for ie in iesDefs[key]["ies"]:
ieunderscore = re.sub('-', '_', ie[2])
iename = re.sub('id-', '', ie[0])
ienameunderscore = lowerFirstCamelWord(re.sub('-', '_', iename))
if ie[2] in ieofielist:
f.write(" %sIEs_t %s;" % (re.sub('-', '_', ie[2]), ienameunderscore))
else:
f.write(" {0:<{pad}} {1};".format("%s_t" % ieunderscore, ienameunderscore, pad=iesDefs[key]["length"] + 2))
if ie[3] == "optional":
f.write(" ///< Optional field")
elif ie[3] == "conditional":
f.write(" ///< Conditional field")
f.write("\n")
f.write("} %s_t;\n\n" % (re.sub('-', '_', key)))
f.write("typedef struct %s_message_s {\n" % (fileprefix))
f.write(" %s_ProcedureCode_t procedureCode;\n" % (fileprefix_first_upper))
f.write(" %s_Criticality_t criticality;\n" % (fileprefix_first_upper))
f.write(" uint8_t direction;\n")
f.write(" union {\n")
messageList = iesDefs.keys()
messageList.sort()
for message in messageList:
if message in ieofielist.values():
continue
if len(iesDefs[message]["ies"]) == 0:
continue
f.write(" %s_t %s;\n" % (re.sub('-', '_', message), lowerFirstCamelWord(re.sub('-', '_', message))))
f.write(" } msg;\n")
f.write("} %s_message;\n\n" % (fileprefix))
for key in iesDefs:
if key in ieofielist.values():
continue
structName = re.sub('ies', '', key)
asn1cStruct = re.sub('-', '_', re.sub('IEs', '', re.sub('-IEs', '', key)))
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")
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))))
f.write(" **/\n")
f.write("int %s_encode_%s(\n" % (fileprefix, re.sub('-', '_', structName.lower())))
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))
f.write("/** \\brief Decode function for %s ies.\n" % (key))
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)))
for key in iesDefs:
asn1cStruct = re.sub('-', '_', re.sub('IEs', '', key))
asn1cStruct = re.sub('Item', 'List', asn1cStruct)
firstlower = re.sub('Item', 'List', re.sub('enb', 'eNB', lowerFirstCamelWord(asn1cStruct)))
if key in ieofielist.values():
f.write("/** \\brief Display %s encapsulated IE using XER encoding.\n" % (asn1cStruct))
f.write(" * \\param %s Pointer to the IES structure.\n" % (lowerFirstCamelWord(re.sub('-', '_', key))))
f.write(" * \\param file File descriptor to write output.\n")
f.write(" **/\n")
f.write("asn_enc_rval_t %s_xer_print_%s(\n" % (fileprefix, re.sub('item', 'list', firstlower.lower())))
f.write(" asn_app_consume_bytes_f *cb,\n")
f.write(" void *app_key,\n")
f.write(" %sIEs_t *%sIEs);\n\n" % (re.sub('item', 'list', asn1cStruct), firstlower))
else:
f.write("/** \\brief Display %s message using XER encoding.\n" % (asn1cStruct))
f.write(" * \\param message_p Pointer to root message.\n")
f.write(" * \\param file File descriptor to write output.\n")
f.write(" **/\n")
f.write("asn_enc_rval_t %s_xer_print_%s(\n" % (fileprefix, firstlower.lower()))
f.write(" asn_app_consume_bytes_f *cb,\n")
f.write(" void *app_key,\n")
f.write(" %s_message *message_p);\n\n" % (fileprefix))
f.write("int %s_xer__print2sp(const void *buffer, size_t size, void *app_key);\n\n" % (fileprefix.lower()))
f.write("int %s_xer__print2fp(const void *buffer, size_t size, void *app_key);\n\n" % (fileprefix.lower()))
f.write("extern size_t %s_string_total_size;\n\n" % (fileprefix.lower()))
f.write("#endif /* %s_IES_DEFS_H_ */\n\n" % (fileprefix.upper()))
#Generate Decode functions
f = open(outdir + fileprefix + '_decoder.c', 'w')
outputHeaderToFile(f, filename)
f.write("#include \"%s_common.h\"\n#include \"%s_ies_defs.h\"\n\n" % (fileprefix, fileprefix))
for key in iesDefs:
if key in ieofielist.values():
continue
structName = re.sub('ies', '', key)
asn1cStruct = re.sub('-', '_', re.sub('IEs', '', key))
if asn1cStruct.rfind('_') == len(asn1cStruct) - 1:
asn1cStruct = asn1cStruct[:-1]
asn1cStruct = re.sub('Item', 'List', asn1cStruct)
ielistname = re.sub('UE', 'ue', asn1cStruct)
ielistnamefirstlower = ielistname[:1].lower() + ielistname[1:]
asn1cStructfirstlower = asn1cStruct[:1].lower() + asn1cStruct[1:]
keyName = re.sub('-', '_', key)
keyupperunderscore = keyName.upper()
firstlower = re.sub('Item', 'List', re.sub('enb', 'eNB', lowerFirstCamelWord(asn1cStruct)))
iesaccess = ""
if key not in ieofielist.values():
iesaccess = "%s_ies." % (firstlower)
f.write("int %s_decode_%s(\n" % (fileprefix, re.sub('-', '_', structName.lower())))
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_t %s;\n %s_t *%s_p = &%s;\n" % (asn1cStruct, asn1cStructfirstlower, asn1cStruct, asn1cStructfirstlower, asn1cStructfirstlower))
f.write(" int i, decoded = 0;\n")
if len(iesDefs[key]["ies"]) != 0:
f.write(" int tempDecoded = 0;\n")
f.write(" assert(any_p != NULL);\n")
if len(iesDefs[key]["ies"]) != 0:
f.write(" assert(%s != NULL);\n\n" % (lowerFirstCamelWord(re.sub('-', '_', key))))
f.write(" %s_DEBUG(\"Decoding message %s (%%s:%%d)\\n\", __FILE__, __LINE__);\n\n" % (fileprefix.upper(), re.sub('-', '_', keyName)))
f.write(" ANY_to_type_aper(any_p, &asn_DEF_%s, (void**)&%s_p);\n\n" % (asn1cStruct, asn1cStructfirstlower))
f.write(" for (i = 0; i < %s_p->%slist.count; i++) {\n" % (asn1cStructfirstlower, iesaccess))
f.write(" %s_IE_t *ie_p;\n" % (fileprefix[0].upper() + fileprefix[1:]))
f.write(" ie_p = %s_p->%slist.array[i];\n" % (asn1cStructfirstlower, iesaccess))
f.write(" switch(ie_p->id) {\n")
for ie in iesDefs[key]["ies"]:
iename = re.sub('id-', '', ie[0])
ienameunderscore = lowerFirstCamelWord(re.sub('-', '_', iename))
ienameunderscorefirstlower = lowerFirstCamelWord(ienameunderscore)
ietypesubst = re.sub('-', '', ie[2])
ietypeunderscore = re.sub('-', '_', ie[2])
ieupperunderscore = re.sub('-', '_', re.sub('id-', '', ie[0])).upper()
if ie[3] == "optional":
f.write(" /* Optional field */\n")
elif ie[3] == "conditional":
f.write(" /* Conditional field */\n")
f.write(" case %s_ProtocolIE_ID_%s:\n" % (fileprefix_first_upper, re.sub('-', '_', ie[0])))
f.write(" {\n")
f.write(" %s_t *%s_p = NULL;\n" % (ietypeunderscore, lowerFirstCamelWord(ietypesubst)))
if ie[3] != "mandatory":
f.write(" %s->presenceMask |= %s_%s_PRESENT;\n" % (lowerFirstCamelWord(re.sub('-', '_', key)), keyupperunderscore, ieupperunderscore))
f.write(" tempDecoded = ANY_to_type_aper(&ie_p->value, &asn_DEF_%s, (void**)&%s_p);\n" % (ietypeunderscore, lowerFirstCamelWord(ietypesubst)))
f.write(" if (tempDecoded < 0 || %s_p == NULL) {\n" % (lowerFirstCamelWord(ietypesubst)))
f.write(" %s_ERROR(\"Decoding of IE %s failed\\n\");\n" % (fileprefix.upper(), ienameunderscore))
f.write(" if (%s_p)\n" % (lowerFirstCamelWord(ietypesubst)))
f.write(" ASN_STRUCT_FREE(asn_DEF_%s, %s_p);\n" % (ietypeunderscore, lowerFirstCamelWord(ietypesubst)))
f.write(" return -1;\n")
f.write(" }\n")
f.write(" decoded += tempDecoded;\n")
f.write(" if (asn1_xer_print)\n")
f.write(" xer_fprint(stdout, &asn_DEF_%s, %s_p);\n" % (ietypeunderscore, lowerFirstCamelWord(ietypesubst)))
if ie[2] in ieofielist.keys():
f.write(" if (%s_decode_%s(&%s->%s, %s_p) < 0) {\n" % (fileprefix, ietypeunderscore.lower(), lowerFirstCamelWord(re.sub('-', '_', key)), ienameunderscore, lowerFirstCamelWord(ietypesubst)))
f.write(" %s_ERROR(\"Decoding of encapsulated IE %s failed\\n\");\n" % (fileprefix.upper(), lowerFirstCamelWord(ietypesubst)))
f.write(" ASN_STRUCT_FREE(asn_DEF_%s, %s_p);\n" % (ietypeunderscore, lowerFirstCamelWord(ietypesubst)))
f.write(" }\n")
else:
f.write(" memcpy(&%s->%s, %s_p, sizeof(%s_t));\n" % (lowerFirstCamelWord(re.sub('-', '_', key)), ienameunderscore, lowerFirstCamelWord(ietypesubst), ietypeunderscore))
#f.write(" ASN_STRUCT_FREE(asn_DEF_%s, %s_p);\n" % (ietypeunderscore, lowerFirstCamelWord(ietypesubst)))
f.write(" } break;\n")
f.write(" default:\n")
f.write(" %s_ERROR(\"Unknown protocol IE id (%%d) for message %s\\n\", (int)ie_p->id);\n" % (fileprefix.upper(), re.sub('-', '_', structName.lower())))
f.write(" return -1;\n")
f.write(" }\n")
f.write(" }\n")
f.write(" return decoded;\n")
f.write("}\n\n")
for key in iesDefs:
if key not in ieofielist.values():
continue
keyname = re.sub('IEs', '', re.sub('Item', 'List', key))
f.write("int %s_decode_%s(\n" % (fileprefix, re.sub('-', '_', keyname).lower()))
f.write(" %sIEs_t *%sIEs,\n" % (re.sub('-', '_', keyname), lowerFirstCamelWord(re.sub('-', '_', keyname))))
f.write(" %s_t *%s) {\n\n" % (re.sub('-', '_', keyname), lowerFirstCamelWord(re.sub('-', '_', keyname))))
f.write(" int i, decoded = 0;\n")
f.write(" int tempDecoded = 0;\n\n")
f.write(" assert(%s != NULL);\n" % (lowerFirstCamelWord(re.sub('-', '_', keyname))));
f.write(" assert(%sIEs != NULL);\n\n" % (lowerFirstCamelWord(re.sub('-', '_', keyname))));
f.write(" for (i = 0; i < %s->list.count; i++) {\n" % (lowerFirstCamelWord(re.sub('-', '_', keyname))))
f.write(" %s_IE_t *ie_p = %s->list.array[i];\n" % (fileprefix[0].upper() + fileprefix[1:], lowerFirstCamelWord(re.sub('-', '_', keyname))))
f.write(" switch (ie_p->id) {\n")
for ie in iesDefs[key]["ies"]:
iename = re.sub('id-', '', ie[0])
ienameunderscore = lowerFirstCamelWord(re.sub('-', '_', iename))
f.write(" case %s_ProtocolIE_ID_%s:\n" % (fileprefix_first_upper, re.sub('-', '_', ie[0])))
f.write(" {\n")
f.write(" %s_t *%s_p = NULL;\n" % (re.sub('-', '_', ie[2]), lowerFirstCamelWord(re.sub('-', '', ie[2]))))
f.write(" tempDecoded = ANY_to_type_aper(&ie_p->value, &asn_DEF_%s, (void**)&%s_p);\n" % (re.sub('-', '_', ie[2]), lowerFirstCamelWord(re.sub('-', '', ie[2]))))
f.write(" if (tempDecoded < 0 || %s_p == NULL) {\n" % (lowerFirstCamelWord(re.sub('-', '', ie[2]))))
f.write(" %s_ERROR(\"Decoding of IE %s for message %s failed\\n\");\n" % (fileprefix.upper(), ienameunderscore, re.sub('-', '_', keyname)))
f.write(" if (%s_p)\n" % (lowerFirstCamelWord(re.sub('-', '', ie[2]))))
#f.write(" free(%s_p);\n" % (lowerFirstCamelWord(re.sub('-', '', ie[2]))))
f.write(" ASN_STRUCT_FREE(asn_DEF_%s, %s_p);\n" % (re.sub('-', '_', ie[2]), lowerFirstCamelWord(re.sub('-', '', ie[2]))))
f.write(" return -1;\n")
f.write(" }\n")
f.write(" decoded += tempDecoded;\n")
f.write(" if (asn1_xer_print)\n")
f.write(" xer_fprint(stdout, &asn_DEF_%s, %s_p);\n" % (re.sub('-', '_', ie[2]), lowerFirstCamelWord(re.sub('-', '', ie[2]))))
f.write(" ASN_SEQUENCE_ADD(&%sIEs->%s, %s_p);\n" % (lowerFirstCamelWord(re.sub('-', '_', keyname)),
re.sub('IEs', '', lowerFirstCamelWord(re.sub('-', '_', key))), lowerFirstCamelWord(re.sub('-', '', ie[2]))))
f.write(" } break;\n")
f.write(" default:\n")
f.write(" %s_ERROR(\"Unknown protocol IE id (%%d) for message %s\\n\", (int)ie_p->id);\n" % (fileprefix.upper(), re.sub('-', '_', structName.lower())))
f.write(" return -1;\n")
f.write(" }\n")
f.write(" }\n")
f.write(" return decoded;\n")
f.write("}\n\n")
#Generate IES Encode functions
f = open(outdir + fileprefix + '_encoder.c', 'w')
outputHeaderToFile(f,filename)
f.write("#include \"%s_common.h\"\n" % (fileprefix))
f.write("#include \"%s_ies_defs.h\"\n\n" % (fileprefix))
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("int %s_encode_%s(\n" % (fileprefix, re.sub('-', '_', structName.lower())))
f.write(" %s_t *%s,\n" % (asn1cStruct, firstwordlower))
f.write(" %s_t *%s) {\n\n" % (re.sub('-', '_', key), lowerFirstCamelWord(re.sub('-', '_', key))))
f.write(" %s_IE_t *ie;\n\n" % (fileprefix_first_upper))
f.write(" assert(%s != NULL);\n" % (firstwordlower));
f.write(" assert(%s != NULL);\n\n" % (lowerFirstCamelWord(re.sub('-', '_', key))));
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":
if ie[3] == "optional":
f.write(" /* Optional field */\n")
elif ie[3] == "conditional":
f.write(" /* Conditional field */\n")
f.write(" if (%s->presenceMask & %s_%s_PRESENT) {\n" % (lowerFirstCamelWord(re.sub('-', '_', key)), keyupperunderscore, ieupperunderscore))
#f.write(" == %s_%s_PRESENT) {\n" % (keyupperunderscore, ieupperunderscore))
f.write(" if ((ie = %s_new_ie(%s_ProtocolIE_ID_%s,\n" % (fileprefix, fileprefix_first_upper, re.sub('-', '_', ie[0])))
f.write(" %s_Criticality_%s,\n" % (fileprefix_first_upper, ie[1]))
f.write(" &asn_DEF_%s,\n" % (ietypeunderscore))
f.write(" &%s->%s)) == NULL) {\n" % (lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower))
f.write(" return -1;\n")
f.write(" }\n")
f.write(" ASN_SEQUENCE_ADD(&%s->%slist, ie);\n" % (firstwordlower, iesaccess))
f.write(" }\n\n")
else:
if ie[2] in ieofielist.keys():
f.write(" %s_t %s;\n\n" % (ietypeunderscore, ienamefirstwordlower))
f.write(" memset(&%s, 0, sizeof(%s_t));\n" % (ienamefirstwordlower, ietypeunderscore))
f.write("\n")
f.write(" if (%s_encode_%s(&%s, &%s->%s) < 0) return -1;\n" % (fileprefix, ietypeunderscore.lower(), ienamefirstwordlower, lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower))
f.write(" if ((ie = %s_new_ie(%s_ProtocolIE_ID_%s,\n" % (fileprefix, fileprefix_first_upper, re.sub('-', '_', ie[0])))
f.write(" %s_Criticality_%s,\n" % (fileprefix_first_upper, ie[1]))
f.write(" &asn_DEF_%s,\n" % (ietypeunderscore))
if ie[2] in ieofielist.keys():
f.write(" &%s)) == NULL) {\n" % (ienamefirstwordlower))
else:
f.write(" &%s->%s)) == NULL) {\n" % (lowerFirstCamelWord(re.sub('-', '_', key)), ienamefirstwordlower))
f.write(" return -1;\n")
f.write(" }\n")
f.write(" ASN_SEQUENCE_ADD(&%s->%slist, ie);\n\n" % (firstwordlower, iesaccess))
if ie[2] in ieofielist.keys():
f.write(" /* Free any dynamic allocation that is no more used */\n")
f.write(" ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_%s, &%s);\n\n" % (ietypeunderscore, ienamefirstwordlower))
f.write(" return 0;\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("int %s_encode_%s(\n" % (fileprefix, re.sub('-', '_', i).lower()))
f.write(" %s_t *%s,\n" % (asn1cStruct, firstwordlower))
f.write(" %sIEs_t *%sIEs) {\n\n" % (re.sub('-', '_', i), lowerFirstCamelWord(re.sub('-', '_', i))))
f.write(" int i;\n")
f.write(" %s_IE_t *ie;\n\n" % (fileprefix_first_upper))
f.write(" assert(%s != NULL);\n" % (firstwordlower));
f.write(" assert(%sIEs != NULL);\n\n" % (lowerFirstCamelWord(re.sub('-', '_', i))));
f.write(" for (i = 0; i < %sIEs->%s.count; i++) {\n" % (firstwordlower, re.sub('IEs', '', lowerFirstCamelWord(re.sub('-', '_', key)))))
f.write(" if ((ie = %s_new_ie(%s_ProtocolIE_ID_%s,\n" % (fileprefix, fileprefix_first_upper, re.sub('-', '_', ie[0])))
f.write(" %s_Criticality_%s,\n" % (fileprefix_first_upper, ie[1]))
f.write(" &asn_DEF_%s,\n" % (ietypeunderscore))
f.write(" %sIEs->%s.array[i])) == NULL) {\n" % (firstwordlower, re.sub('IEs', '', lowerFirstCamelWord(re.sub('-', '_', key)))))
f.write(" return -1;\n")
f.write(" }\n")
f.write(" ASN_SEQUENCE_ADD(&%s->list, ie);\n" % (firstwordlower))
f.write(" }\n")
f.write(" return 0;\n")
f.write("}\n\n")
#Generate xer print functions
f = open(outdir + fileprefix + '_xer_print.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\n" % (fileprefix, fileprefix))
f.write("size_t %s_string_total_size = 0;\n\n" % (fileprefix.lower()))
f.write("""int
%s_xer__print2fp(const void *buffer, size_t size, void *app_key) {
FILE *stream = (FILE *)app_key;
if(fwrite(buffer, 1, size, stream) != size)
return -1;
return 0;
}
""" % (fileprefix.lower()))
f.write("""int %s_xer__print2sp(const void *buffer, size_t size, void *app_key) {
char *string = (char *)app_key;
/* Copy buffer to the formatted string */
memcpy(&string[%s_string_total_size], buffer, size);
%s_string_total_size += size;
return 0;
}
""" % (fileprefix.lower(), fileprefix.lower(), fileprefix.lower()))
f.write("""static asn_enc_rval_t
xer_encode_local(asn_TYPE_descriptor_t *td, void *sptr,
asn_app_consume_bytes_f *cb, void *app_key, int indent) {
asn_enc_rval_t er, tmper;
const char *mname;
size_t mlen;
int xcan = 2;
if(!td || !sptr) goto cb_failed;
mname = td->xml_tag;
mlen = strlen(mname);
ASN__TEXT_INDENT(0, indent);
ASN__CALLBACK3("<", 1, mname, mlen, ">", 1);
tmper = td->op->xer_encoder(td, sptr, indent + 1, XER_F_BASIC, cb, app_key);
if(tmper.encoded == -1) return tmper;
ASN__CALLBACK3("</", 2, mname, mlen, ">\\n", xcan);
er.encoded = 4 + xcan + (2 * mlen) + tmper.encoded;
ASN__ENCODED_OK(er);
cb_failed:
ASN__ENCODE_FAILED;
}
""")
for (key, value) in iesDefs.items():
keyName = re.sub('-', '_', key)
keyupperunderscore = keyName.upper()
iesStructName = lowerFirstCamelWord(re.sub('-', '_', key))
ie = value["ies"][0]
ietypeunderscore = re.sub('-', '_', ie[2])
if key in ieofielist.values():
f.write("asn_enc_rval_t %s_xer_print_%s(\n" % (fileprefix, re.sub('ies', '', re.sub('item', 'list', re.sub('-', '_', key).lower()))))
else:
f.write("asn_enc_rval_t %s_xer_print_%s(\n" % (fileprefix, re.sub('ies', '', re.sub('-', '_', key).lower())))
#f.write(" FILE *file,\n")
f.write(" asn_app_consume_bytes_f *cb,\n")
f.write(" void *app_key,\n")
if key in ieofielist.values():
iesStructName = lowerFirstCamelWord(re.sub('Item', 'List', re.sub('-', '_', key)))
f.write(" %sIEs_t *%s) {\n\n" % (re.sub('IEs', '', re.sub('Item', 'List', re.sub('-', '_', key))), iesStructName))
f.write(" int i;\n")
f.write(" asn_enc_rval_t er;\n")
else:
f.write(" %s_message *message_p)\n{\n" % (fileprefix))
f.write(" %s_t *%s;\n" % (re.sub('-', '_', key), iesStructName))
f.write(" asn_enc_rval_t er;\n")
#f.write(" void *app_key = (void *)file;\n")
#f.write(" asn_app_consume_bytes_f *cb = %s_xer__print2fp;\n\n" % (fileprefix.lower()))
f.write(" %s = &message_p->msg.%s;\n\n" % (iesStructName, iesStructName))
if key in ieofielist.values():
# Increase indentation level
f.write(" for (i = 0; i < %s->%s.count; i++) {\n" % (iesStructName, re.sub('IEs', '', lowerFirstCamelWord(re.sub('-', '_', key)))))
#f.write(" xer_fprint(file, &asn_DEF_%s, %s->%s.array[i]);\n" % (ietypeunderscore, iesStructName, re.sub('IEs', '', lowerFirstCamelWord(re.sub('-', '_', key)))))
f.write(" er = xer_encode(&asn_DEF_%s, %s->%s.array[i], XER_F_BASIC, cb, app_key);\n" % (ietypeunderscore, iesStructName, re.sub('IEs', '', lowerFirstCamelWord(re.sub('-', '_', key)))))
f.write(" }\n")
else:
f.write(" cb(\"<%s-PDU>\\n\", %d, app_key);\n" % (key, len("<%s-PDU>\n" % (key))))
f.write(" xer_encode_local(&asn_DEF_%s_Criticality, &message_p->criticality, cb, app_key, 1);\n" % fileprefix_first_upper)
f.write(" xer_encode_local(&asn_DEF_%s_ProcedureCode, &message_p->procedureCode, cb, app_key, 1);\n" % fileprefix_first_upper)
f.write(" cb(\" <%s>\\n\", %d, app_key);\n" % (key, len(" <%s>\n" % (key))))
for ie in iesDefs[key]["ies"]:
iename = re.sub('-', '_', re.sub('id-', '', ie[0]))
ienameunderscore = re.sub('-', '_', iename)
ienamefirstwordlower = lowerFirstCamelWord(iename)
ietypeunderscore = re.sub('-', '_', ie[2])
ieupperunderscore = re.sub('-', '_', re.sub('id-', '', ie[0])).upper()
if ie[3] != "mandatory":
if ie[3] == "optional":
f.write(" /* Optional field */\n")
elif ie[3] == "conditional":
f.write(" /* Conditional field */\n")
f.write(" if (%s->presenceMask & %s_%s_PRESENT)\n " % (iesStructName, keyupperunderscore, ieupperunderscore))
# Is it an encapsulated IE ?
if ie[2] in ieofielist.keys():
f.write(" %s_xer_print_%s(cb, app_key, &%s->%s);\n" % (fileprefix, re.sub('ies', '', re.sub('-', '_', ie[2]).lower()), iesStructName, ienamefirstwordlower))
else:
f.write(" xer_encode_local(&asn_DEF_%s, &%s->%s, cb, app_key, 2);\n" % (ietypeunderscore, iesStructName, ienamefirstwordlower))
f.write(" cb(\" </%s>\\n\", %d, app_key);\n" % (key, len(" </%s>\n" % (key))))
f.write(" cb(\"</%s-PDU>\\n\", %d, app_key);\n" % (key, len("</%s-PDU>\n" % (key))))
f.write(" ASN__ENCODED_OK(er);\n")
#if key not in ieofielist.values():
#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, 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))
@@ -0,0 +1,245 @@
set(M3AP_GRAMMAR ASN1/m3ap-14.0.0.asn)
set(m3ap_source
ANY.c
asn_application.c
asn_bit_data.c
asn_codecs_prim.c
asn_internal.c
asn_random_fill.c
asn_SEQUENCE_OF.c
asn_SET_OF.c
ber_decoder.c
ber_tlv_length.c
ber_tlv_tag.c
BIT_STRING.c
constraints.c
constr_CHOICE.c
constr_SEQUENCE.c
constr_SEQUENCE_OF.c
constr_SET_OF.c
constr_TYPE.c
der_encoder.c
INTEGER.c
M3AP_Absolute-Time-ofMBMS-Data.c
M3AP_AllocationAndRetentionPriority.c
M3AP_BitRate.c
M3AP_Cause.c
M3AP_CauseMisc.c
M3AP_CauseNAS.c
M3AP_CauseProtocol.c
M3AP_CauseRadioNetwork.c
M3AP_CauseTransport.c
M3AP_Criticality.c
M3AP_CriticalityDiagnostics.c
M3AP_CriticalityDiagnostics-IE-List.c
M3AP_ECGI.c
M3AP_ErrorIndication.c
M3AP_EUTRANCellIdentifier.c
M3AP_ExtendedMCE-ID.c
M3AP_GBR-QosInformation.c
M3AP_Global-MCE-ID.c
M3AP_GTP-TEID.c
M3AP_InitiatingMessage.c
M3AP_IPAddress.c
M3AP_M3AP-PDU.c
M3AP_M3SetupFailure.c
M3AP_M3SetupRequest.c
M3AP_M3SetupResponse.c
M3AP_MBMS-Cell-List.c
M3AP_MBMS-E-RAB-QoS-Parameters.c
M3AP_MBMSServiceArea1.c
M3AP_MBMS-Service-Area.c
M3AP_MBMSServiceAreaListItem.c
M3AP_MBMS-Service-associatedLogicalM3-ConnectionItem.c
M3AP_MBMS-Service-associatedLogicalM3-ConnectionListResAck.c
M3AP_MBMS-Service-associatedLogicalM3-ConnectionListRes.c
M3AP_MBMS-Session-Duration.c
M3AP_MBMS-Session-ID.c
M3AP_MBMSSessionStartFailure.c
M3AP_MBMSSessionStartRequest.c
M3AP_MBMSSessionStartResponse.c
M3AP_MBMSSessionStopRequest.c
M3AP_MBMSSessionStopResponse.c
M3AP_MBMSSessionUpdateFailure.c
M3AP_MBMSSessionUpdateRequest.c
M3AP_MBMSSessionUpdateResponse.c
M3AP_MCEConfigurationUpdateAcknowledge.c
M3AP_MCEConfigurationUpdate.c
M3AP_MCEConfigurationUpdateFailure.c
M3AP_MCE-ID.c
M3AP_MCE-MBMS-M3AP-ID.c
M3AP_MCEname.c
M3AP_MinimumTimeToMBMSDataTransfer.c
M3AP_MME-MBMS-M3AP-ID.c
M3AP_PLMN-Identity.c
M3AP_Pre-emptionCapability.c
M3AP_Pre-emptionVulnerability.c
M3AP_Presence.c
M3AP_PriorityLevel.c
M3AP_PrivateIE-Container.c
M3AP_PrivateIE-Field.c
M3AP_PrivateIE-ID.c
M3AP_PrivateMessage.c
M3AP_ProcedureCode.c
M3AP_ProtocolExtensionContainer.c
M3AP_ProtocolExtensionField.c
M3AP_ProtocolIE-Container.c
M3AP_ProtocolIE-ContainerList.c
M3AP_ProtocolIE-ContainerPair.c
M3AP_ProtocolIE-ContainerPairList.c
M3AP_ProtocolIE-Field.c
M3AP_ProtocolIE-FieldPair.c
M3AP_ProtocolIE-ID.c
M3AP_ProtocolIE-Single-Container.c
M3AP_QCI.c
M3AP_Reestablishment.c
M3AP_ResetAcknowledge.c
M3AP_ResetAll.c
M3AP_Reset.c
M3AP_ResetType.c
M3AP_SuccessfulOutcome.c
M3AP_TimeToWait.c
M3AP_TMGI.c
M3AP_TNL-Information.c
M3AP_TriggeringMessage.c
M3AP_TypeOfError.c
M3AP_UnsuccessfulOutcome.c
NativeEnumerated.c
NativeInteger.c
OBJECT_IDENTIFIER.c
OCTET_STRING.c
OPEN_TYPE.c
per_decoder.c
per_encoder.c
per_opentype.c
per_support.c
PrintableString.c
xer_decoder.c
xer_encoder.c
xer_support.c
)
set(m3ap_headers
ANY.h
asn_application.h
asn_bit_data.h
asn_codecs.h
asn_codecs_prim.h
asn_internal.h
asn_ioc.h
asn_random_fill.h
asn_SEQUENCE_OF.h
asn_SET_OF.h
asn_system.h
ber_decoder.h
ber_tlv_length.h
ber_tlv_tag.h
BIT_STRING.h
constraints.h
constr_CHOICE.h
constr_SEQUENCE.h
constr_SEQUENCE_OF.h
constr_SET_OF.h
constr_TYPE.h
der_encoder.h
INTEGER.h
M3AP_Absolute-Time-ofMBMS-Data.h
M3AP_AllocationAndRetentionPriority.h
M3AP_asn_constant.h
M3AP_BitRate.h
M3AP_Cause.h
M3AP_CauseMisc.h
M3AP_CauseNAS.h
M3AP_CauseProtocol.h
M3AP_CauseRadioNetwork.h
M3AP_CauseTransport.h
M3AP_CriticalityDiagnostics.h
M3AP_CriticalityDiagnostics-IE-List.h
M3AP_Criticality.h
M3AP_ECGI.h
M3AP_ErrorIndication.h
M3AP_EUTRANCellIdentifier.h
M3AP_ExtendedMCE-ID.h
M3AP_GBR-QosInformation.h
M3AP_Global-MCE-ID.h
M3AP_GTP-TEID.h
M3AP_InitiatingMessage.h
M3AP_IPAddress.h
M3AP_M3AP-PDU.h
M3AP_M3SetupFailure.h
M3AP_M3SetupRequest.h
M3AP_M3SetupResponse.h
M3AP_MBMS-Cell-List.h
M3AP_MBMS-E-RAB-QoS-Parameters.h
M3AP_MBMSServiceArea1.h
M3AP_MBMS-Service-Area.h
M3AP_MBMSServiceAreaListItem.h
M3AP_MBMS-Service-associatedLogicalM3-ConnectionItem.h
M3AP_MBMS-Service-associatedLogicalM3-ConnectionListResAck.h
M3AP_MBMS-Service-associatedLogicalM3-ConnectionListRes.h
M3AP_MBMS-Session-Duration.h
M3AP_MBMS-Session-ID.h
M3AP_MBMSSessionStartFailure.h
M3AP_MBMSSessionStartRequest.h
M3AP_MBMSSessionStartResponse.h
M3AP_MBMSSessionStopRequest.h
M3AP_MBMSSessionStopResponse.h
M3AP_MBMSSessionUpdateFailure.h
M3AP_MBMSSessionUpdateRequest.h
M3AP_MBMSSessionUpdateResponse.h
M3AP_MCEConfigurationUpdateAcknowledge.h
M3AP_MCEConfigurationUpdateFailure.h
M3AP_MCEConfigurationUpdate.h
M3AP_MCE-ID.h
M3AP_MCE-MBMS-M3AP-ID.h
M3AP_MCEname.h
M3AP_MinimumTimeToMBMSDataTransfer.h
M3AP_MME-MBMS-M3AP-ID.h
M3AP_PLMN-Identity.h
M3AP_Pre-emptionCapability.h
M3AP_Pre-emptionVulnerability.h
M3AP_Presence.h
M3AP_PriorityLevel.h
M3AP_PrivateIE-Container.h
M3AP_PrivateIE-Field.h
M3AP_PrivateIE-ID.h
M3AP_PrivateMessage.h
M3AP_ProcedureCode.h
M3AP_ProtocolExtensionContainer.h
M3AP_ProtocolExtensionField.h
M3AP_ProtocolIE-Container.h
M3AP_ProtocolIE-ContainerList.h
M3AP_ProtocolIE-ContainerPair.h
M3AP_ProtocolIE-ContainerPairList.h
M3AP_ProtocolIE-Field.h
M3AP_ProtocolIE-FieldPair.h
M3AP_ProtocolIE-ID.h
M3AP_ProtocolIE-Single-Container.h
M3AP_QCI.h
M3AP_Reestablishment.h
M3AP_ResetAcknowledge.h
M3AP_ResetAll.h
M3AP_Reset.h
M3AP_ResetType.h
M3AP_SuccessfulOutcome.h
M3AP_TimeToWait.h
M3AP_TMGI.h
M3AP_TNL-Information.h
M3AP_TriggeringMessage.h
M3AP_TypeOfError.h
M3AP_UnsuccessfulOutcome.h
NativeEnumerated.h
NativeInteger.h
OBJECT_IDENTIFIER.h
OCTET_STRING.h
OPEN_TYPE.h
per_decoder.h
per_encoder.h
per_opentype.h
per_support.h
PrintableString.h
xer_decoder.h
xer_encoder.h
xer_support.h
)
+27
View File
@@ -0,0 +1,27 @@
set(M3AP_VERSION 14 0 0)
make_version(M3AP_cc ${M3AP_VERSION})
string(REPLACE ";" "." M3AP_RELEASE "${M3AP_VERSION}")
if(M3AP_RELEASE VERSION_EQUAL "8.9.0")
include(ASN1/m3ap-8.9.0.cmake)
elseif(M3AP_RELEASE VERSION_EQUAL "11.9.0")
include(ASN1/m3ap-11.9.0.cmake)
elseif(M3AP_RELEASE VERSION_EQUAL "12.9.0")
include(ASN1/m3ap-12.9.0.cmake)
elseif(M3AP_RELEASE VERSION_EQUAL "14.0.0")
include(ASN1/m3ap-14.0.0.cmake)
elseif(M3AP_RELEASE VERSION_EQUAL "15.1.0")
include(ASN1/m3ap-15.1.0.cmake)
else()
message(FATAL_ERROR "unknown M3AP_RELEASE ${M3AP_RELEASE}")
endif()
add_custom_command(OUTPUT ${m3ap_source} ${m3ap_headers}
COMMAND ASN1C_PREFIX=M3AP_ asn1c -gen-PER -no-gen-OER -fcompound-names -no-gen-example -fno-include-deps -D ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${M3AP_GRAMMAR}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${M3AP_GRAMMAR}
COMMENT "Generating M3AP source files from ${CMAKE_CURRENT_SOURCE_DIR}/${M3AP_GRAMMAR}"
)
add_library(asn1_m3ap ${m3ap_source})
target_include_directories(asn1_m3ap PUBLIC "${CMAKE_CURRENT_BINARY_DIR}")
target_compile_options(asn1_m3ap PRIVATE -DASN_DISABLE_OER_SUPPORT -w)
+1
View File
@@ -0,0 +1 @@
add_subdirectory(MESSAGES)
File diff suppressed because it is too large Load Diff
+20
View File
@@ -0,0 +1,20 @@
set(NGAP_VERSION 15 8 0)
make_version(NGAP_cc ${NGAP_VERSION})
#add_definitions(-DNGAP_VERSION=${NGAP_cc})
string(REPLACE ";" "." NGAP_RELEASE "${NGAP_VERSION}")
if(NGAP_RELEASE VERSION_EQUAL "15.8.0")
include(ASN1/ngap-15.8.0.cmake)
else()
message(FATAL_ERROR "unknown NGAP_RELEASE ${NGAP_RELEASE}")
endif()
add_custom_command(OUTPUT ${ngap_source} ${ngap_headers}
COMMAND ASN1C_PREFIX=NGAP_ asn1c -pdu=all -fcompound-names -gen-PER -no-gen-OER -no-gen-example -fno-include-deps -findirect-choice -D ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${NGAP_GRAMMAR}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${NGAP_GRAMMAR}
COMMENT "Generating NGAP source files from ${CMAKE_CURRENT_SOURCE_DIR}/${NGAP_GRAMMAR}"
)
add_library(asn1_ngap ${ngap_source})
target_include_directories(asn1_ngap PUBLIC "${CMAKE_CURRENT_BINARY_DIR}")
target_compile_options(asn1_ngap PRIVATE -DASN_DISABLE_OER_SUPPORT -w)
+1
View File
@@ -0,0 +1 @@
add_subdirectory(MESSAGES)
View File
File diff suppressed because it is too large Load Diff
+20
View File
@@ -0,0 +1,20 @@
set(S1AP_VERSION 15 6 0)
make_version(S1AP_cc ${S1AP_VERSION})
#add_definitions(-DS1AP_VERSION=${S1AP_cc})
string(REPLACE ";" "." S1AP_RELEASE "${S1AP_VERSION}")
if(S1AP_RELEASE VERSION_EQUAL "15.6.0")
include(ASN1/R15/s1ap-15.6.0.cmake)
else()
message(FATAL_ERROR "unknown S1AP_RELEASE ${S1AP_RELEASE}")
endif()
add_custom_command(OUTPUT ${s1ap_source} ${s1ap_headers}
COMMAND ASN1C_PREFIX=S1AP_ asn1c -gen-PER -no-gen-OER -fcompound-names -no-gen-example -fno-include-deps -D ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${S1AP_GRAMMAR}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${S1AP_GRAMMAR}
COMMENT "Generating S1AP source files from ${CMAKE_CURRENT_SOURCE_DIR}/${S1AP_GRAMMAR}"
)
add_library(asn1_s1ap ${s1ap_source})
target_include_directories(asn1_s1ap PUBLIC "${CMAKE_CURRENT_BINARY_DIR}")
target_compile_options(asn1_s1ap PRIVATE -DASN_DISABLE_OER_SUPPORT -w)