asn1c-0.9.28+dfsg/0000755000000000000000000000000013065714043012237 5ustar rootrootasn1c-0.9.28+dfsg/.gitignore0000644000000000000000000000144213065714043014230 0ustar rootroot*~ *.o *.la *.lo *.libs *.deps *.log *.trs *.core .tmp.* # Generated by `autoreconf` config/ aclocal.m4 config.h.in configure /autom4te.cache Makefile Makefile.in ylwrap m4/* # Generated by `./configure` config.h config.log config.status libtool stamp-h* /asn1c-*.tar.gz /asn1c-*.*.* /asn1c.spec # /asn1c/ /asn1c/asn1c /asn1c/unber /asn1c/enber # /asn1c/tests/ /asn1c/tests/test-* # /doc/docsrc doc/docsrc/*.aux doc/docsrc/*.dvi doc/docsrc/*.log doc/docsrc/*.out doc/docsrc/*.toc doc/docsrc/*.xdv # /examples/ /examples/*.asn1 # /examples/*/ /examples/*/*.c /examples/*/*.h /examples/*/*dump /examples/*/.tmp.* # /libasn1compiler/ /libasn1compiler/check_compiler # /libasn1fix/ /libasn1fix/check_* # /libasn1parser/ /libasn1parser/check_parser # /skeletons/tests/ /skeletons/tests/check-* asn1c-0.9.28+dfsg/INSTALL.md0000644000000000000000000000214413065714043013670 0ustar rootroot ## Compiling From Sources ### Configure Configure with the default settings: test -f configure || autoreconf -iv ./configure make Configure with non-standard settings: asn1c specific ./configure options include: --enable-Werror --enable-ASN_DEBUG invoke `./configure --help` for details. ### Build Build the libraries and the compiler: make Ensure asn1c is still behaving well after compiling on your platform: make check ### Install Install the compiler into a standard location: make install # Use ./configure --prefix to override install location. Display the `asn1c` manual page: man asn1c ## Quick Usage Guide For a usage guide and more information please refer to: * the [README.md](README.md) file * the asn1c manual page `man asn1c` * the included quick start PDF [doc/asn1c-quick.pdf](doc/asn1c-quick.pdf) * the comprehensive usage documentation [doc/asn1c-usage.pdf](doc/asn1c-usage.pdf) In case of any difficulties with installing the compiler, consider using the Online ASN.1 Compiler at http://lionet.info/asn1c. -- Lev Walkin vlm@lionet.info asn1c-0.9.28+dfsg/Makefile.am0000644000000000000000000000043313065714043014273 0ustar rootroot ACLOCAL_AMFLAGS = -I m4 SUBDIRS = \ libasn1parser libasn1fix \ libasn1print libasn1compiler \ skeletons examples \ doc tests asn1c docsdir = $(datadir)/doc/asn1c docs_DATA = README.md INSTALL.md FAQ ChangeLog BUGS TODO EXTRA_DIST = README.md INSTALL.md FAQ LICENSE BUGS asn1c-0.9.28+dfsg/m4/0000755000000000000000000000000013065714043012557 5ustar rootrootasn1c-0.9.28+dfsg/m4/ax_check_compile_flag.m40000644000000000000000000000641113065714043017271 0ustar rootroot# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html # =========================================================================== # # SYNOPSIS # # AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) # # DESCRIPTION # # Check whether the given FLAG works with the current language's compiler # or gives an error. (Warnings, however, are ignored) # # ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on # success/failure. # # If EXTRA-FLAGS is defined, it is added to the current language's default # flags (e.g. CFLAGS) when the check is done. The check is thus made with # the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to # force the compiler to issue an error when a bad flag is given. # # INPUT gives an alternative input source to AC_COMPILE_IFELSE. # # NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this # macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. # # LICENSE # # Copyright (c) 2008 Guido U. Draheim # Copyright (c) 2011 Maarten Bosmans # # This program is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation, either version 3 of the License, or (at your # option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General # Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure # scripts that are the output of Autoconf when processing the Macro. You # need not follow the terms of the GNU General Public License when using # or distributing such scripts, even though portions of the text of the # Macro appear in them. The GNU General Public License (GPL) does govern # all other use of the material that constitutes the Autoconf Macro. # # This special exception to the GPL applies to versions of the Autoconf # Macro released by the Autoconf Archive. When you make and distribute a # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. #serial 3 AC_DEFUN([AX_CHECK_COMPILE_FLAG], [AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], [AS_VAR_SET(CACHEVAR,[yes])], [AS_VAR_SET(CACHEVAR,[no])]) _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes], [m4_default([$2], :)], [m4_default([$3], :)]) AS_VAR_POPDEF([CACHEVAR])dnl ])dnl AX_CHECK_COMPILE_FLAGS asn1c-0.9.28+dfsg/.travis.yml0000644000000000000000000000023413065714043014347 0ustar rootrootlanguage: c compiler: - gcc - clang script: - autoreconf -iv - ./configure --enable-Werror - make -j8 - make check - make distcheck asn1c-0.9.28+dfsg/FAQ0000644000000000000000000000232313065714043012571 0ustar rootroot 1.Q: Is it possible to build the asn1c compiler on Win32? 1.A: At this point, the asn1c source code is tied to GCC-specific extensions in several key places. The CYGWIN environment with gcc compiler may be what are you looking for. Please also consider using the Online ASN.1 compiler at http://lionet.info/asn1c which generates platform-independent code. 2.Q: How to build a simplest BER (XER) encoder or decoder? 2.A: Please check the "Quick Start Guide" on ./doc/asn1c-quick.pdf Please check the "Examples" section of ./doc/asn1c-usage.pdf Also, try the following to build the X.509v3 parser: cd ./examples/sample.source.PKIX1 make ./x509dump -h 3.Q: Your compiler supplies a der_encode() procedure. How do I encode BER? 3.A: The DER (and CER) are stricter subsets of a more generic BER encoding method. If you encode data with DER or CER, all BER-conformant decoders will easily understand that. Hence, to encode data in the BER format, simply use the DER encoder, der_encode(). See also: ISO/IEC 8825-1 / X.690: "ASN.1 encoding rules: Specification of Basic Encoding Rules (BER), Canonical Encoding Rules (CER) and Distinguished Encoding Rules (DER)" -- Lev Walkin vlm@lionet.info asn1c-0.9.28+dfsg/depcomp0000755000000000000000000004224613065714043013624 0ustar rootroot#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2006-10-15.18 # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 Free Software # Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputing dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> $depfile echo >> $depfile # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> $depfile else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` tmpdepfile="$stripped.u" if test "$libtool" = yes; then "$@" -Wc,-M else "$@" -M fi stat=$? if test -f "$tmpdepfile"; then : else stripped=`echo "$stripped" | sed 's,^.*/,,'` tmpdepfile="$stripped.u" fi if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi if test -f "$tmpdepfile"; then outname="$stripped.o" # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler understands `-MD -MF file'. However on # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want: # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using \ : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" # Add `dependent.h:' lines. sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # With Tru64 cc, shared objects can also be used to make a # static library. This mechanism is used in libtool 1.4 series to # handle both shared and static libraries in a single compilation. # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. # # With libtool 1.5 this exception was removed, and libtool now # generates 2 separate objects for the 2 libraries. These two # compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 tmpdepfile2=$dir$base.o.d # libtool 1.5 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.o.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for `:' # in the target name. This is to cope with DOS-style filenames: # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. "$@" $dashmflag | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # X makedepend shift cleared=no for arg in "$@"; do case $cleared in no) set ""; shift cleared=yes ;; esac case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix="`echo $object | sed 's/^.*\././'`" touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. "$@" || exit $? IFS=" " for arg do case "$arg" in "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: asn1c-0.9.28+dfsg/skeletons/0000755000000000000000000000000013065714043014246 5ustar rootrootasn1c-0.9.28+dfsg/skeletons/asn_SET_OF.h0000644000000000000000000000323313065714043016300 0ustar rootroot/*- * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef ASN_SET_OF_H #define ASN_SET_OF_H #ifdef __cplusplus extern "C" { #endif #define A_SET_OF(type) \ struct { \ type **array; \ int count; /* Meaningful size */ \ int size; /* Allocated size */ \ void (*free)(type *); \ } #define ASN_SET_ADD(headptr, ptr) \ asn_set_add((headptr), (ptr)) /******************************************* * Implementation of the SET OF structure. */ /* * Add another structure into the set by its pointer. * RETURN VALUES: * 0 for success and -1/errno for failure. */ int asn_set_add(void *asn_set_of_x, void *ptr); /* * Delete the element from the set by its number (base 0). * This is a constant-time operation. The order of elements before the * deleted ones is guaranteed, the order of elements after the deleted * one is NOT guaranteed. * If _do_free is given AND the (*free) is initialized, the element * will be freed using the custom (*free) function as well. */ void asn_set_del(void *asn_set_of_x, int number, int _do_free); /* * Empty the contents of the set. Will free the elements, if (*free) is given. * Will NOT free the set itself. */ void asn_set_empty(void *asn_set_of_x); /* * Cope with different conversions requirements to/from void in C and C++. * This is mostly useful for support library. */ typedef A_SET_OF(void) asn_anonymous_set_; #define _A_SET_FROM_VOID(ptr) ((asn_anonymous_set_ *)(ptr)) #define _A_CSET_FROM_VOID(ptr) ((const asn_anonymous_set_ *)(ptr)) #ifdef __cplusplus } #endif #endif /* ASN_SET_OF_H */ asn1c-0.9.28+dfsg/skeletons/per_encoder.c0000644000000000000000000000716513065714043016710 0ustar rootroot#include #include #include static asn_enc_rval_t uper_encode_internal(asn_TYPE_descriptor_t *td, asn_per_constraints_t *, void *sptr, asn_app_consume_bytes_f *cb, void *app_key); asn_enc_rval_t uper_encode(asn_TYPE_descriptor_t *td, void *sptr, asn_app_consume_bytes_f *cb, void *app_key) { return uper_encode_internal(td, 0, sptr, cb, app_key); } /* * Argument type and callback necessary for uper_encode_to_buffer(). */ typedef struct enc_to_buf_arg { void *buffer; size_t left; } enc_to_buf_arg; static int encode_to_buffer_cb(const void *buffer, size_t size, void *key) { enc_to_buf_arg *arg = (enc_to_buf_arg *)key; if(arg->left < size) return -1; /* Data exceeds the available buffer size */ memcpy(arg->buffer, buffer, size); arg->buffer = ((char *)arg->buffer) + size; arg->left -= size; return 0; } asn_enc_rval_t uper_encode_to_buffer(asn_TYPE_descriptor_t *td, void *sptr, void *buffer, size_t buffer_size) { enc_to_buf_arg key; key.buffer = buffer; key.left = buffer_size; if(td) ASN_DEBUG("Encoding \"%s\" using UNALIGNED PER", td->name); return uper_encode_internal(td, 0, sptr, encode_to_buffer_cb, &key); } typedef struct enc_dyn_arg { void *buffer; size_t length; size_t allocated; } enc_dyn_arg; static int encode_dyn_cb(const void *buffer, size_t size, void *key) { enc_dyn_arg *arg = key; if(arg->length + size >= arg->allocated) { void *p; arg->allocated = arg->allocated ? (arg->allocated << 2) : size; p = REALLOC(arg->buffer, arg->allocated); if(!p) { FREEMEM(arg->buffer); memset(arg, 0, sizeof(*arg)); return -1; } arg->buffer = p; } memcpy(((char *)arg->buffer) + arg->length, buffer, size); arg->length += size; return 0; } ssize_t uper_encode_to_new_buffer(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, void **buffer_r) { asn_enc_rval_t er; enc_dyn_arg key; memset(&key, 0, sizeof(key)); er = uper_encode_internal(td, constraints, sptr, encode_dyn_cb, &key); switch(er.encoded) { case -1: FREEMEM(key.buffer); return -1; case 0: FREEMEM(key.buffer); key.buffer = MALLOC(1); if(key.buffer) { *(char *)key.buffer = '\0'; *buffer_r = key.buffer; return 1; } else { return -1; } default: *buffer_r = key.buffer; ASN_DEBUG("Complete encoded in %ld bits", (long)er.encoded); return ((er.encoded + 7) >> 3); } } /* * Internally useful functions. */ /* Flush partially filled buffer */ static int _uper_encode_flush_outp(asn_per_outp_t *po) { uint8_t *buf; if(po->nboff == 0 && po->buffer == po->tmpspace) return 0; buf = po->buffer + (po->nboff >> 3); /* Make sure we account for the last, partially filled */ if(po->nboff & 0x07) { buf[0] &= 0xff << (8 - (po->nboff & 0x07)); buf++; } return po->outper(po->tmpspace, buf - po->tmpspace, po->op_key); } static asn_enc_rval_t uper_encode_internal(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_app_consume_bytes_f *cb, void *app_key) { asn_per_outp_t po; asn_enc_rval_t er; /* * Invoke type-specific encoder. */ if(!td || !td->uper_encoder) ASN__ENCODE_FAILED; /* PER is not compiled in */ po.buffer = po.tmpspace; po.nboff = 0; po.nbits = 8 * sizeof(po.tmpspace); po.outper = cb; po.op_key = app_key; po.flushed_bytes = 0; er = td->uper_encoder(td, constraints, sptr, &po); if(er.encoded != -1) { size_t bits_to_flush; bits_to_flush = ((po.buffer - po.tmpspace) << 3) + po.nboff; /* Set number of bits encoded to a firm value */ er.encoded = (po.flushed_bytes << 3) + bits_to_flush; if(_uper_encode_flush_outp(&po)) ASN__ENCODE_FAILED; } return er; } asn1c-0.9.28+dfsg/skeletons/constr_SEQUENCE.h0000644000000000000000000000300613065714043017216 0ustar rootroot/*- * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef _CONSTR_SEQUENCE_H_ #define _CONSTR_SEQUENCE_H_ #include #ifdef __cplusplus extern "C" { #endif typedef const struct asn_SEQUENCE_specifics_s { /* * Target structure description. */ int struct_size; /* Size of the target structure. */ int ctx_offset; /* Offset of the asn_struct_ctx_t member */ /* * Tags to members mapping table (sorted). */ const asn_TYPE_tag2member_t *tag2el; int tag2el_count; /* * Optional members of the extensions root (roms) or additions (aoms). * Meaningful for PER. */ const int *oms; /* Optional MemberS */ int roms_count; /* Root optional members count */ int aoms_count; /* Additions optional members count */ /* * Description of an extensions group. */ int ext_after; /* Extensions start after this member */ int ext_before; /* Extensions stop before this member */ } asn_SEQUENCE_specifics_t; /* * A set specialized functions dealing with the SEQUENCE type. */ asn_struct_free_f SEQUENCE_free; asn_struct_print_f SEQUENCE_print; asn_constr_check_f SEQUENCE_constraint; ber_type_decoder_f SEQUENCE_decode_ber; der_type_encoder_f SEQUENCE_encode_der; xer_type_decoder_f SEQUENCE_decode_xer; xer_type_encoder_f SEQUENCE_encode_xer; per_type_decoder_f SEQUENCE_decode_uper; per_type_encoder_f SEQUENCE_encode_uper; #ifdef __cplusplus } #endif #endif /* _CONSTR_SEQUENCE_H_ */ asn1c-0.9.28+dfsg/skeletons/Makefile.am0000644000000000000000000000435613065714043016312 0ustar rootroot SUBDIRS = . tests dist_pkgdata_DATA = \ ${srcdir}/README \ ${srcdir}/*.[ch] \ ${srcdir}/file-dependencies smodsdir=$(pkgdatadir) nobase_dist_smods_DATA = \ standard-modules/README \ standard-modules/ASN1-Object-Identifier-Module.asn1 \ standard-modules/ASN1C-UsefulInformationObjectClasses.asn1 uninstall-local: -@echo -n " " -rm -f -r $(DESTDIR)$(pkgdatadir) check_LTLIBRARIES = libasn1cskeletons.la libasn1cskeletons_la_CFLAGS = $(SKELETONS_CFLAGS) libasn1cskeletons_la_SOURCES = \ ANY.c ANY.h \ BIT_STRING.c BIT_STRING.h \ BMPString.c BMPString.h \ BOOLEAN.c BOOLEAN.h \ ENUMERATED.c ENUMERATED.h \ GeneralString.c GeneralString.h \ GeneralizedTime.c GeneralizedTime.h \ GraphicString.c GraphicString.h \ IA5String.c IA5String.h \ INTEGER.c INTEGER.h \ ISO646String.c ISO646String.h \ NULL.c NULL.h \ NativeEnumerated.c NativeEnumerated.h \ NativeInteger.c NativeInteger.h \ NativeReal.c NativeReal.h \ NumericString.c NumericString.h \ OBJECT_IDENTIFIER.c OBJECT_IDENTIFIER.h \ OCTET_STRING.c OCTET_STRING.h \ ObjectDescriptor.c ObjectDescriptor.h \ PrintableString.c PrintableString.h \ REAL.c REAL.h \ RELATIVE-OID.c RELATIVE-OID.h \ T61String.c T61String.h \ TeletexString.c TeletexString.h \ UTCTime.c UTCTime.h \ UTF8String.c UTF8String.h \ UniversalString.c UniversalString.h \ VideotexString.c VideotexString.h \ VisibleString.c VisibleString.h \ asn_SEQUENCE_OF.c asn_SEQUENCE_OF.h \ asn_SET_OF.c asn_SET_OF.h \ asn_application.h asn_codecs.h \ asn_codecs_prim.c asn_codecs_prim.h \ asn_internal.h asn_system.h \ ber_decoder.c ber_decoder.h \ ber_tlv_length.c ber_tlv_length.h \ ber_tlv_tag.c ber_tlv_tag.h \ constr_CHOICE.c constr_CHOICE.h \ constr_SEQUENCE.c constr_SEQUENCE.h \ constr_SEQUENCE_OF.c constr_SEQUENCE_OF.h \ constr_SET.c constr_SET.h \ constr_SET_OF.c constr_SET_OF.h \ constr_TYPE.c constr_TYPE.h \ constraints.c constraints.h \ der_encoder.c der_encoder.h \ per_decoder.c per_decoder.h \ per_encoder.c per_encoder.h \ per_opentype.c per_opentype.h \ per_support.c per_support.h \ xer_decoder.c xer_decoder.h \ xer_encoder.c xer_encoder.h \ xer_support.c xer_support.h asn1c-0.9.28+dfsg/skeletons/NativeInteger.c0000644000000000000000000002111313065714043017154 0ustar rootroot/*- * Copyright (c) 2004, 2005, 2006 Lev Walkin . * All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ /* * Read the NativeInteger.h for the explanation wrt. differences between * INTEGER and NativeInteger. * Basically, both are decoders and encoders of ASN.1 INTEGER type, but this * implementation deals with the standard (machine-specific) representation * of them instead of using the platform-independent buffer. */ #include #include /* * NativeInteger basic type description. */ static const ber_tlv_tag_t asn_DEF_NativeInteger_tags[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_NativeInteger = { "INTEGER", /* The ASN.1 type is still INTEGER */ "INTEGER", NativeInteger_free, NativeInteger_print, asn_generic_no_constraint, NativeInteger_decode_ber, NativeInteger_encode_der, NativeInteger_decode_xer, NativeInteger_encode_xer, NativeInteger_decode_uper, /* Unaligned PER decoder */ NativeInteger_encode_uper, /* Unaligned PER encoder */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NativeInteger_tags, sizeof(asn_DEF_NativeInteger_tags) / sizeof(asn_DEF_NativeInteger_tags[0]), asn_DEF_NativeInteger_tags, /* Same as above */ sizeof(asn_DEF_NativeInteger_tags) / sizeof(asn_DEF_NativeInteger_tags[0]), 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /* * Decode INTEGER type. */ asn_dec_rval_t NativeInteger_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **nint_ptr, const void *buf_ptr, size_t size, int tag_mode) { asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; long *native = (long *)*nint_ptr; asn_dec_rval_t rval; ber_tlv_len_t length; /* * If the structure is not there, allocate it. */ if(native == NULL) { native = (long *)(*nint_ptr = CALLOC(1, sizeof(*native))); if(native == NULL) { rval.code = RC_FAIL; rval.consumed = 0; return rval; } } ASN_DEBUG("Decoding %s as INTEGER (tm=%d)", td->name, tag_mode); /* * Check tags. */ rval = ber_check_tags(opt_codec_ctx, td, 0, buf_ptr, size, tag_mode, 0, &length, 0); if(rval.code != RC_OK) return rval; ASN_DEBUG("%s length is %d bytes", td->name, (int)length); /* * Make sure we have this length. */ buf_ptr = ((const char *)buf_ptr) + rval.consumed; size -= rval.consumed; if(length > (ber_tlv_len_t)size) { rval.code = RC_WMORE; rval.consumed = 0; return rval; } /* * ASN.1 encoded INTEGER: buf_ptr, length * Fill the native, at the same time checking for overflow. * If overflow occured, return with RC_FAIL. */ { INTEGER_t tmp; union { const void *constbuf; void *nonconstbuf; } unconst_buf; long l; unconst_buf.constbuf = buf_ptr; tmp.buf = (uint8_t *)unconst_buf.nonconstbuf; tmp.size = length; if((specs&&specs->field_unsigned) ? asn_INTEGER2ulong(&tmp, (unsigned long *)&l) /* sic */ : asn_INTEGER2long(&tmp, &l)) { rval.code = RC_FAIL; rval.consumed = 0; return rval; } *native = l; } rval.code = RC_OK; rval.consumed += length; ASN_DEBUG("Took %ld/%ld bytes to encode %s (%ld)", (long)rval.consumed, (long)length, td->name, (long)*native); return rval; } /* * Encode the NativeInteger using the standard INTEGER type DER encoder. */ asn_enc_rval_t NativeInteger_encode_der(asn_TYPE_descriptor_t *sd, void *ptr, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { unsigned long native = *(unsigned long *)ptr; /* Disable sign ext. */ asn_enc_rval_t erval; INTEGER_t tmp; #ifdef WORDS_BIGENDIAN /* Opportunistic optimization */ tmp.buf = (uint8_t *)&native; tmp.size = sizeof(native); #else /* Works even if WORDS_BIGENDIAN is not set where should've been */ uint8_t buf[sizeof(native)]; uint8_t *p; /* Prepare a fake INTEGER */ for(p = buf + sizeof(buf) - 1; p >= buf; p--, native >>= 8) *p = (uint8_t)native; tmp.buf = buf; tmp.size = sizeof(buf); #endif /* WORDS_BIGENDIAN */ /* Encode fake INTEGER */ erval = INTEGER_encode_der(sd, &tmp, tag_mode, tag, cb, app_key); if(erval.encoded == -1) { assert(erval.structure_ptr == &tmp); erval.structure_ptr = ptr; } return erval; } /* * Decode the chunk of XML text encoding INTEGER. */ asn_dec_rval_t NativeInteger_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, const char *opt_mname, const void *buf_ptr, size_t size) { asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; asn_dec_rval_t rval; INTEGER_t st; void *st_ptr = (void *)&st; long *native = (long *)*sptr; if(!native) { native = (long *)(*sptr = CALLOC(1, sizeof(*native))); if(!native) ASN__DECODE_FAILED; } memset(&st, 0, sizeof(st)); rval = INTEGER_decode_xer(opt_codec_ctx, td, &st_ptr, opt_mname, buf_ptr, size); if(rval.code == RC_OK) { long l; if((specs&&specs->field_unsigned) ? asn_INTEGER2ulong(&st, (unsigned long *)&l) /* sic */ : asn_INTEGER2long(&st, &l)) { rval.code = RC_FAIL; rval.consumed = 0; } else { *native = l; } } else { /* * Cannot restart from the middle; * there is no place to save state in the native type. * Request a continuation from the very beginning. */ rval.consumed = 0; } ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &st); return rval; } asn_enc_rval_t NativeInteger_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; char scratch[32]; /* Enough for 64-bit int */ asn_enc_rval_t er; const long *native = (const long *)sptr; (void)ilevel; (void)flags; if(!native) ASN__ENCODE_FAILED; er.encoded = snprintf(scratch, sizeof(scratch), (specs && specs->field_unsigned) ? "%lu" : "%ld", *native); if(er.encoded <= 0 || (size_t)er.encoded >= sizeof(scratch) || cb(scratch, er.encoded, app_key) < 0) ASN__ENCODE_FAILED; ASN__ENCODED_OK(er); } asn_dec_rval_t NativeInteger_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; asn_dec_rval_t rval; long *native = (long *)*sptr; INTEGER_t tmpint; void *tmpintptr = &tmpint; (void)opt_codec_ctx; ASN_DEBUG("Decoding NativeInteger %s (UPER)", td->name); if(!native) { native = (long *)(*sptr = CALLOC(1, sizeof(*native))); if(!native) ASN__DECODE_FAILED; } memset(&tmpint, 0, sizeof tmpint); rval = INTEGER_decode_uper(opt_codec_ctx, td, constraints, &tmpintptr, pd); if(rval.code == RC_OK) { if((specs&&specs->field_unsigned) ? asn_INTEGER2ulong(&tmpint, (unsigned long *)native) : asn_INTEGER2long(&tmpint, native)) rval.code = RC_FAIL; else ASN_DEBUG("NativeInteger %s got value %ld", td->name, *native); } ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &tmpint); return rval; } asn_enc_rval_t NativeInteger_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; asn_enc_rval_t er; long native; INTEGER_t tmpint; if(!sptr) ASN__ENCODE_FAILED; native = *(long *)sptr; ASN_DEBUG("Encoding NativeInteger %s %ld (UPER)", td->name, native); memset(&tmpint, 0, sizeof(tmpint)); if((specs&&specs->field_unsigned) ? asn_ulong2INTEGER(&tmpint, native) : asn_long2INTEGER(&tmpint, native)) ASN__ENCODE_FAILED; er = INTEGER_encode_uper(td, constraints, &tmpint, po); ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &tmpint); return er; } /* * INTEGER specific human-readable output. */ int NativeInteger_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; const long *native = (const long *)sptr; char scratch[32]; /* Enough for 64-bit int */ int ret; (void)td; /* Unused argument */ (void)ilevel; /* Unused argument */ if(native) { ret = snprintf(scratch, sizeof(scratch), (specs && specs->field_unsigned) ? "%lu" : "%ld", *native); assert(ret > 0 && (size_t)ret < sizeof(scratch)); return (cb(scratch, ret, app_key) < 0) ? -1 : 0; } else { return (cb("", 8, app_key) < 0) ? -1 : 0; } } void NativeInteger_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) { if(!td || !ptr) return; ASN_DEBUG("Freeing %s as INTEGER (%d, %p, Native)", td->name, contents_only, ptr); if(!contents_only) { FREEMEM(ptr); } } asn1c-0.9.28+dfsg/skeletons/xer_support.c0000644000000000000000000001264013065714043017007 0ustar rootroot/* * Copyright (c) 2003, 2004 X/IO Labs, xiolabs.com. * Copyright (c) 2003, 2004, 2005 Lev Walkin . * All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #include #include /* Parser states */ typedef enum { ST_TEXT, ST_TAG_START, ST_TAG_BODY, ST_TAG_QUOTE_WAIT, ST_TAG_QUOTED_STRING, ST_TAG_UNQUOTED_STRING, ST_COMMENT_WAIT_DASH1, /* ""[0] */ ST_COMMENT_CLO_RT /* "-->"[1] */ } pstate_e; static const int _charclass[256] = { 0,0,0,0,0,0,0,0, 0,1,1,0,1,1,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 1,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 2,2,2,2,2,2,2,2, 2,2,0,0,0,0,0,0, /* 01234567 89 */ 0,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, /* ABCDEFG HIJKLMNO */ 3,3,3,3,3,3,3,3, 3,3,3,0,0,0,0,0, /* PQRSTUVW XYZ */ 0,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, /* abcdefg hijklmno */ 3,3,3,3,3,3,3,3, 3,3,3,0,0,0,0,0 /* pqrstuvw xyz */ }; #define WHITESPACE(c) (_charclass[(unsigned char)(c)] == 1) #define ALNUM(c) (_charclass[(unsigned char)(c)] >= 2) #define ALPHA(c) (_charclass[(unsigned char)(c)] == 3) /* Aliases for characters, ASCII/UTF-8 */ #define EXCLAM 0x21 /* '!' */ #define CQUOTE 0x22 /* '"' */ #define CDASH 0x2d /* '-' */ #define CSLASH 0x2f /* '/' */ #define LANGLE 0x3c /* '<' */ #define CEQUAL 0x3d /* '=' */ #define RANGLE 0x3e /* '>' */ #define CQUEST 0x3f /* '?' */ /* Invoke token callback */ #define TOKEN_CB_CALL(type, _ns, _current_too, _final) do { \ int _ret; \ pstate_e ns = _ns; \ ssize_t _sz = (p - chunk_start) + _current_too; \ if (!_sz) { \ /* Shortcut */ \ state = _ns; \ break; \ } \ _ret = cb(type, chunk_start, _sz, key); \ if(_ret < _sz) { \ if(_current_too && _ret == -1) \ state = ns; \ goto finish; \ } \ chunk_start = p + _current_too; \ state = ns; \ } while(0) #define TOKEN_CB(_type, _ns, _current_too) \ TOKEN_CB_CALL(_type, _ns, _current_too, 0) #define PXML_TAG_FINAL_CHUNK_TYPE PXML_TAG_END #define PXML_COMMENT_FINAL_CHUNK_TYPE PXML_COMMENT_END #define TOKEN_CB_FINAL(_type, _ns, _current_too) \ TOKEN_CB_CALL( _type ## _FINAL_CHUNK_TYPE , _ns, _current_too, 1) /* * Parser itself */ ssize_t pxml_parse(int *stateContext, const void *xmlbuf, size_t size, pxml_callback_f *cb, void *key) { pstate_e state = (pstate_e)*stateContext; const char *chunk_start = (const char *)xmlbuf; const char *p = chunk_start; const char *end = p + size; for(; p < end; p++) { int C = *(const unsigned char *)p; switch(state) { case ST_TEXT: /* * Initial state: we're in the middle of some text, * or just have started. */ if (C == LANGLE) /* We're now in the tag, probably */ TOKEN_CB(PXML_TEXT, ST_TAG_START, 0); break; case ST_TAG_START: if (ALPHA(C) || (C == CSLASH)) state = ST_TAG_BODY; else if (C == EXCLAM) state = ST_COMMENT_WAIT_DASH1; else /* * Not characters and not whitespace. * Must be something like "3 < 4". */ TOKEN_CB(PXML_TEXT, ST_TEXT, 1);/* Flush as data */ break; case ST_TAG_BODY: switch(C) { case RANGLE: /* End of the tag */ TOKEN_CB_FINAL(PXML_TAG, ST_TEXT, 1); break; case LANGLE: /* * The previous tag wasn't completed, but still * recognized as valid. (Mozilla-compatible) */ TOKEN_CB_FINAL(PXML_TAG, ST_TAG_START, 0); break; case CEQUAL: state = ST_TAG_QUOTE_WAIT; break; } break; case ST_TAG_QUOTE_WAIT: /* * State after the equal sign ("=") in the tag. */ switch(C) { case CQUOTE: state = ST_TAG_QUOTED_STRING; break; case RANGLE: /* End of the tag */ TOKEN_CB_FINAL(PXML_TAG, ST_TEXT, 1); break; default: if(!WHITESPACE(C)) /* Unquoted string value */ state = ST_TAG_UNQUOTED_STRING; } break; case ST_TAG_QUOTED_STRING: /* * Tag attribute's string value in quotes. */ if(C == CQUOTE) { /* Return back to the tag state */ state = ST_TAG_BODY; } break; case ST_TAG_UNQUOTED_STRING: if(C == RANGLE) { /* End of the tag */ TOKEN_CB_FINAL(PXML_TAG, ST_TEXT, 1); } else if(WHITESPACE(C)) { /* Return back to the tag state */ state = ST_TAG_BODY; } break; case ST_COMMENT_WAIT_DASH1: if(C == CDASH) { state = ST_COMMENT_WAIT_DASH2; } else { /* Some ordinary tag. */ state = ST_TAG_BODY; } break; case ST_COMMENT_WAIT_DASH2: if(C == CDASH) { /* Seen "<--" */ state = ST_COMMENT; } else { /* Some ordinary tag */ state = ST_TAG_BODY; } break; case ST_COMMENT: if(C == CDASH) { state = ST_COMMENT_CLO_DASH2; } break; case ST_COMMENT_CLO_DASH2: if(C == CDASH) { state = ST_COMMENT_CLO_RT; } else { /* This is not an end of a comment */ state = ST_COMMENT; } break; case ST_COMMENT_CLO_RT: if(C == RANGLE) { TOKEN_CB_FINAL(PXML_COMMENT, ST_TEXT, 1); } else if(C == CDASH) { /* Maintain current state, still waiting for '>' */ } else { state = ST_COMMENT; } break; } /* switch(*ptr) */ } /* for() */ /* * Flush the partially processed chunk, state permitting. */ if(p - chunk_start) { switch (state) { case ST_COMMENT: TOKEN_CB(PXML_COMMENT, state, 0); break; case ST_TEXT: TOKEN_CB(PXML_TEXT, state, 0); break; default: break; /* a no-op */ } } finish: *stateContext = (int)state; return chunk_start - (const char *)xmlbuf; } asn1c-0.9.28+dfsg/skeletons/per_support.c0000644000000000000000000002623313065714043017002 0ustar rootroot/* * Copyright (c) 2005-2014 Lev Walkin . * All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #include #include #include char * per_data_string(asn_per_data_t *pd) { static char buf[2][32]; static int n; n = (n+1) % 2; snprintf(buf[n], sizeof(buf[n]), "{m=%ld span %+ld[%d..%d] (%d)}", (long)pd->moved, (((long)pd->buffer) & 0xf), (int)pd->nboff, (int)pd->nbits, (int)(pd->nbits - pd->nboff)); return buf[n]; } void per_get_undo(asn_per_data_t *pd, int nbits) { if((ssize_t)pd->nboff < nbits) { assert((ssize_t)pd->nboff < nbits); } else { pd->nboff -= nbits; pd->moved -= nbits; } } /* * Extract a small number of bits (<= 31) from the specified PER data pointer. */ int32_t per_get_few_bits(asn_per_data_t *pd, int nbits) { size_t off; /* Next after last bit offset */ ssize_t nleft; /* Number of bits left in this stream */ uint32_t accum; const uint8_t *buf; if(nbits < 0) return -1; nleft = pd->nbits - pd->nboff; if(nbits > nleft) { int32_t tailv, vhead; if(!pd->refill || nbits > 31) return -1; /* Accumulate unused bytes before refill */ ASN_DEBUG("Obtain the rest %d bits (want %d)", (int)nleft, (int)nbits); tailv = per_get_few_bits(pd, nleft); if(tailv < 0) return -1; /* Refill (replace pd contents with new data) */ if(pd->refill(pd)) return -1; nbits -= nleft; vhead = per_get_few_bits(pd, nbits); /* Combine the rest of previous pd with the head of new one */ tailv = (tailv << nbits) | vhead; /* Could == -1 */ return tailv; } /* * Normalize position indicator. */ if(pd->nboff >= 8) { pd->buffer += (pd->nboff >> 3); pd->nbits -= (pd->nboff & ~0x07); pd->nboff &= 0x07; } pd->moved += nbits; pd->nboff += nbits; off = pd->nboff; buf = pd->buffer; /* * Extract specified number of bits. */ if(off <= 8) accum = nbits ? (buf[0]) >> (8 - off) : 0; else if(off <= 16) accum = ((buf[0] << 8) + buf[1]) >> (16 - off); else if(off <= 24) accum = ((buf[0] << 16) + (buf[1] << 8) + buf[2]) >> (24 - off); else if(off <= 31) accum = ((buf[0] << 24) + (buf[1] << 16) + (buf[2] << 8) + (buf[3])) >> (32 - off); else if(nbits <= 31) { asn_per_data_t tpd = *pd; /* Here are we with our 31-bits limit plus 1..7 bits offset. */ per_get_undo(&tpd, nbits); /* The number of available bits in the stream allow * for the following operations to take place without * invoking the ->refill() function */ accum = per_get_few_bits(&tpd, nbits - 24) << 24; accum |= per_get_few_bits(&tpd, 24); } else { per_get_undo(pd, nbits); return -1; } accum &= (((uint32_t)1 << nbits) - 1); ASN_DEBUG(" [PER got %2d<=%2d bits => span %d %+ld[%d..%d]:%02x (%d) => 0x%x]", (int)nbits, (int)nleft, (int)pd->moved, (((long)pd->buffer) & 0xf), (int)pd->nboff, (int)pd->nbits, ((pd->buffer != NULL)?pd->buffer[0]:0), (int)(pd->nbits - pd->nboff), (int)accum); return accum; } /* * Extract a large number of bits from the specified PER data pointer. */ int per_get_many_bits(asn_per_data_t *pd, uint8_t *dst, int alright, int nbits) { int32_t value; if(alright && (nbits & 7)) { /* Perform right alignment of a first few bits */ value = per_get_few_bits(pd, nbits & 0x07); if(value < 0) return -1; *dst++ = value; /* value is already right-aligned */ nbits &= ~7; } while(nbits) { if(nbits >= 24) { value = per_get_few_bits(pd, 24); if(value < 0) return -1; *(dst++) = value >> 16; *(dst++) = value >> 8; *(dst++) = value; nbits -= 24; } else { value = per_get_few_bits(pd, nbits); if(value < 0) return -1; if(nbits & 7) { /* implies left alignment */ value <<= 8 - (nbits & 7), nbits += 8 - (nbits & 7); if(nbits > 24) *dst++ = value >> 24; } if(nbits > 16) *dst++ = value >> 16; if(nbits > 8) *dst++ = value >> 8; *dst++ = value; break; } } return 0; } /* * Get the length "n" from the stream. */ ssize_t uper_get_length(asn_per_data_t *pd, int ebits, int *repeat) { ssize_t value; *repeat = 0; if(ebits >= 0) return per_get_few_bits(pd, ebits); value = per_get_few_bits(pd, 8); if(value < 0) return -1; if((value & 128) == 0) /* #10.9.3.6 */ return (value & 0x7F); if((value & 64) == 0) { /* #10.9.3.7 */ value = ((value & 63) << 8) | per_get_few_bits(pd, 8); if(value < 0) return -1; return value; } value &= 63; /* this is "m" from X.691, #10.9.3.8 */ if(value < 1 || value > 4) return -1; *repeat = 1; return (16384 * value); } /* * Get the normally small length "n". * This procedure used to decode length of extensions bit-maps * for SET and SEQUENCE types. */ ssize_t uper_get_nslength(asn_per_data_t *pd) { ssize_t length; ASN_DEBUG("Getting normally small length"); if(per_get_few_bits(pd, 1) == 0) { length = per_get_few_bits(pd, 6) + 1; if(length <= 0) return -1; ASN_DEBUG("l=%d", (int)length); return length; } else { int repeat; length = uper_get_length(pd, -1, &repeat); if(length >= 0 && !repeat) return length; return -1; /* Error, or do not support >16K extensions */ } } /* * Get the normally small non-negative whole number. * X.691, #10.6 */ ssize_t uper_get_nsnnwn(asn_per_data_t *pd) { ssize_t value; value = per_get_few_bits(pd, 7); if(value & 64) { /* implicit (value < 0) */ value &= 63; value <<= 2; value |= per_get_few_bits(pd, 2); if(value & 128) /* implicit (value < 0) */ return -1; if(value == 0) return 0; if(value >= 3) return -1; value = per_get_few_bits(pd, 8 * value); return value; } return value; } /* * X.691-11/2008, #11.6 * Encoding of a normally small non-negative whole number */ int uper_put_nsnnwn(asn_per_outp_t *po, int n) { int bytes; if(n <= 63) { if(n < 0) return -1; return per_put_few_bits(po, n, 7); } if(n < 256) bytes = 1; else if(n < 65536) bytes = 2; else if(n < 256 * 65536) bytes = 3; else return -1; /* This is not a "normally small" value */ if(per_put_few_bits(po, bytes, 8)) return -1; return per_put_few_bits(po, n, 8 * bytes); } /* X.691-2008/11, #11.5.6 -> #11.3 */ int uper_get_constrained_whole_number(asn_per_data_t *pd, unsigned long *out_value, int nbits) { unsigned long lhalf; /* Lower half of the number*/ long half; if(nbits <= 31) { half = per_get_few_bits(pd, nbits); if(half < 0) return -1; *out_value = half; return 0; } if((size_t)nbits > 8 * sizeof(*out_value)) return -1; /* RANGE */ half = per_get_few_bits(pd, 31); if(half < 0) return -1; if(uper_get_constrained_whole_number(pd, &lhalf, nbits - 31)) return -1; *out_value = ((unsigned long)half << (nbits - 31)) | lhalf; return 0; } /* X.691-2008/11, #11.5.6 -> #11.3 */ int uper_put_constrained_whole_number_s(asn_per_outp_t *po, long v, int nbits) { /* * Assume signed number can be safely coerced into * unsigned of the same range. * The following testing code will likely be optimized out * by compiler if it is true. */ unsigned long uvalue1 = ULONG_MAX; long svalue = uvalue1; unsigned long uvalue2 = svalue; assert(uvalue1 == uvalue2); return uper_put_constrained_whole_number_u(po, v, nbits); } int uper_put_constrained_whole_number_u(asn_per_outp_t *po, unsigned long v, int nbits) { if(nbits <= 31) { return per_put_few_bits(po, v, nbits); } else { /* Put higher portion first, followed by lower 31-bit */ if(uper_put_constrained_whole_number_u(po, v >> 31, nbits - 31)) return -1; return per_put_few_bits(po, v, 31); } } /* * Put a small number of bits (<= 31). */ int per_put_few_bits(asn_per_outp_t *po, uint32_t bits, int obits) { size_t off; /* Next after last bit offset */ size_t omsk; /* Existing last byte meaningful bits mask */ uint8_t *buf; if(obits <= 0 || obits >= 32) return obits ? -1 : 0; ASN_DEBUG("[PER put %d bits %x to %p+%d bits]", obits, (int)bits, po->buffer, (int)po->nboff); /* * Normalize position indicator. */ if(po->nboff >= 8) { po->buffer += (po->nboff >> 3); po->nbits -= (po->nboff & ~0x07); po->nboff &= 0x07; } /* * Flush whole-bytes output, if necessary. */ if(po->nboff + obits > po->nbits) { int complete_bytes = (po->buffer - po->tmpspace); ASN_DEBUG("[PER output %ld complete + %ld]", (long)complete_bytes, (long)po->flushed_bytes); if(po->outper(po->tmpspace, complete_bytes, po->op_key) < 0) return -1; if(po->nboff) po->tmpspace[0] = po->buffer[0]; po->buffer = po->tmpspace; po->nbits = 8 * sizeof(po->tmpspace); po->flushed_bytes += complete_bytes; } /* * Now, due to sizeof(tmpspace), we are guaranteed large enough space. */ buf = po->buffer; omsk = ~((1 << (8 - po->nboff)) - 1); off = (po->nboff + obits); /* Clear data of debris before meaningful bits */ bits &= (((uint32_t)1 << obits) - 1); ASN_DEBUG("[PER out %d %u/%x (t=%d,o=%d) %x&%x=%x]", obits, (int)bits, (int)bits, (int)po->nboff, (int)off, buf[0], (int)(omsk&0xff), (int)(buf[0] & omsk)); if(off <= 8) /* Completely within 1 byte */ po->nboff = off, bits <<= (8 - off), buf[0] = (buf[0] & omsk) | bits; else if(off <= 16) po->nboff = off, bits <<= (16 - off), buf[0] = (buf[0] & omsk) | (bits >> 8), buf[1] = bits; else if(off <= 24) po->nboff = off, bits <<= (24 - off), buf[0] = (buf[0] & omsk) | (bits >> 16), buf[1] = bits >> 8, buf[2] = bits; else if(off <= 31) po->nboff = off, bits <<= (32 - off), buf[0] = (buf[0] & omsk) | (bits >> 24), buf[1] = bits >> 16, buf[2] = bits >> 8, buf[3] = bits; else { per_put_few_bits(po, bits >> (obits - 24), 24); per_put_few_bits(po, bits, obits - 24); } ASN_DEBUG("[PER out %u/%x => %02x buf+%ld]", (int)bits, (int)bits, buf[0], (long)(po->buffer - po->tmpspace)); return 0; } /* * Output a large number of bits. */ int per_put_many_bits(asn_per_outp_t *po, const uint8_t *src, int nbits) { while(nbits) { uint32_t value; if(nbits >= 24) { value = (src[0] << 16) | (src[1] << 8) | src[2]; src += 3; nbits -= 24; if(per_put_few_bits(po, value, 24)) return -1; } else { value = src[0]; if(nbits > 8) value = (value << 8) | src[1]; if(nbits > 16) value = (value << 8) | src[2]; if(nbits & 0x07) value >>= (8 - (nbits & 0x07)); if(per_put_few_bits(po, value, nbits)) return -1; break; } } return 0; } /* * Put the length "n" (or part of it) into the stream. */ ssize_t uper_put_length(asn_per_outp_t *po, size_t length) { if(length <= 127) /* #10.9.3.6 */ return per_put_few_bits(po, length, 8) ? -1 : (ssize_t)length; else if(length < 16384) /* #10.9.3.7 */ return per_put_few_bits(po, length|0x8000, 16) ? -1 : (ssize_t)length; length >>= 14; if(length > 4) length = 4; return per_put_few_bits(po, 0xC0 | length, 8) ? -1 : (ssize_t)(length << 14); } /* * Put the normally small length "n" into the stream. * This procedure used to encode length of extensions bit-maps * for SET and SEQUENCE types. */ int uper_put_nslength(asn_per_outp_t *po, size_t length) { if(length <= 64) { /* #10.9.3.4 */ if(length == 0) return -1; return per_put_few_bits(po, length-1, 7) ? -1 : 0; } else { if(uper_put_length(po, length) != (ssize_t)length) { /* This might happen in case of >16K extensions */ return -1; } } return 0; } asn1c-0.9.28+dfsg/skeletons/constr_TYPE.h0000644000000000000000000001513313065714043016573 0ustar rootroot/*- * Copyright (c) 2003, 2004, 2005, 2006 Lev Walkin . * All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ /* * This file contains the declaration structure called "ASN.1 Type Definition", * which holds all information necessary for encoding and decoding routines. * This structure even contains pointer to these encoding and decoding routines * for each defined ASN.1 type. */ #ifndef _CONSTR_TYPE_H_ #define _CONSTR_TYPE_H_ #include #include #ifdef __cplusplus extern "C" { #endif struct asn_TYPE_descriptor_s; /* Forward declaration */ struct asn_TYPE_member_s; /* Forward declaration */ /* * This type provides the context information for various ASN.1 routines, * primarily ones doing decoding. A member _asn_ctx of this type must be * included into certain target language's structures, such as compound types. */ typedef struct asn_struct_ctx_s { short phase; /* Decoding phase */ short step; /* Elementary step of a phase */ int context; /* Other context information */ void *ptr; /* Decoder-specific stuff (stack elements) */ ber_tlv_len_t left; /* Number of bytes left, -1 for indefinite */ } asn_struct_ctx_t; #include /* Basic Encoding Rules decoder */ #include /* Distinguished Encoding Rules encoder */ #include /* Decoder of XER (XML, text) */ #include /* Encoder into XER (XML, text) */ #include /* Packet Encoding Rules decoder */ #include /* Packet Encoding Rules encoder */ #include /* Subtype constraints support */ /* * Free the structure according to its specification. * If (free_contents_only) is set, the wrapper structure itself (struct_ptr) * will not be freed. (It may be useful in case the structure is allocated * statically or arranged on the stack, yet its elements are allocated * dynamically.) */ typedef void (asn_struct_free_f)( struct asn_TYPE_descriptor_s *type_descriptor, void *struct_ptr, int free_contents_only); #define ASN_STRUCT_FREE(asn_DEF, ptr) (asn_DEF).free_struct(&(asn_DEF),ptr,0) #define ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF, ptr) \ (asn_DEF).free_struct(&(asn_DEF),ptr,1) /* * Print the structure according to its specification. */ typedef int (asn_struct_print_f)( struct asn_TYPE_descriptor_s *type_descriptor, const void *struct_ptr, int level, /* Indentation level */ asn_app_consume_bytes_f *callback, void *app_key); /* * Return the outmost tag of the type. * If the type is untagged CHOICE, the dynamic operation is performed. * NOTE: This function pointer type is only useful internally. * Do not use it in your application. */ typedef ber_tlv_tag_t (asn_outmost_tag_f)( const struct asn_TYPE_descriptor_s *type_descriptor, const void *struct_ptr, int tag_mode, ber_tlv_tag_t tag); /* The instance of the above function type; used internally. */ asn_outmost_tag_f asn_TYPE_outmost_tag; /* * The definitive description of the destination language's structure. */ typedef struct asn_TYPE_descriptor_s { const char *name; /* A name of the ASN.1 type. "" in some cases. */ const char *xml_tag; /* Name used in XML tag */ /* * Generalized functions for dealing with the specific type. * May be directly invoked by applications. */ asn_struct_free_f *free_struct; /* Free the structure */ asn_struct_print_f *print_struct; /* Human readable output */ asn_constr_check_f *check_constraints; /* Constraints validator */ ber_type_decoder_f *ber_decoder; /* Generic BER decoder */ der_type_encoder_f *der_encoder; /* Canonical DER encoder */ xer_type_decoder_f *xer_decoder; /* Generic XER decoder */ xer_type_encoder_f *xer_encoder; /* [Canonical] XER encoder */ per_type_decoder_f *uper_decoder; /* Unaligned PER decoder */ per_type_encoder_f *uper_encoder; /* Unaligned PER encoder */ /*********************************************************************** * Internally useful members. Not to be used by applications directly. * **********************************************************************/ /* * Tags that are expected to occur. */ asn_outmost_tag_f *outmost_tag; /* */ const ber_tlv_tag_t *tags; /* Effective tags sequence for this type */ int tags_count; /* Number of tags which are expected */ const ber_tlv_tag_t *all_tags; /* Every tag for BER/containment */ int all_tags_count; /* Number of tags */ asn_per_constraints_t *per_constraints; /* PER compiled constraints */ /* * An ASN.1 production type members (members of SEQUENCE, SET, CHOICE). */ struct asn_TYPE_member_s *elements; int elements_count; /* * Additional information describing the type, used by appropriate * functions above. */ const void *specifics; } asn_TYPE_descriptor_t; /* * This type describes an element of the constructed type, * i.e. SEQUENCE, SET, CHOICE, etc. */ enum asn_TYPE_flags_e { ATF_NOFLAGS, ATF_POINTER = 0x01, /* Represented by the pointer */ ATF_OPEN_TYPE = 0x02 /* ANY type, without meaningful tag */ }; typedef struct asn_TYPE_member_s { enum asn_TYPE_flags_e flags; /* Element's presentation flags */ int optional; /* Following optional members, including current */ int memb_offset; /* Offset of the element */ ber_tlv_tag_t tag; /* Outmost (most immediate) tag */ int tag_mode; /* IMPLICIT/no/EXPLICIT tag at current level */ asn_TYPE_descriptor_t *type; /* Member type descriptor */ asn_constr_check_f *memb_constraints; /* Constraints validator */ asn_per_constraints_t *per_constraints; /* PER compiled constraints */ int (*default_value)(int setval, void **sptr); /* DEFAULT */ const char *name; /* ASN.1 identifier of the element */ } asn_TYPE_member_t; /* * BER tag to element number mapping. */ typedef struct asn_TYPE_tag2member_s { ber_tlv_tag_t el_tag; /* Outmost tag of the member */ int el_no; /* Index of the associated member, base 0 */ int toff_first; /* First occurence of the el_tag, relative */ int toff_last; /* Last occurence of the el_tag, relatvie */ } asn_TYPE_tag2member_t; /* * This function is a wrapper around (td)->print_struct, which prints out * the contents of the target language's structure (struct_ptr) into the * file pointer (stream) in human readable form. * RETURN VALUES: * 0: The structure is printed. * -1: Problem dumping the structure. * (See also xer_fprint() in xer_encoder.h) */ int asn_fprint(FILE *stream, /* Destination stream descriptor */ asn_TYPE_descriptor_t *td, /* ASN.1 type descriptor */ const void *struct_ptr); /* Structure to be printed */ #ifdef __cplusplus } #endif #endif /* _CONSTR_TYPE_H_ */ asn1c-0.9.28+dfsg/skeletons/ENUMERATED.c0000644000000000000000000000413213065714043016043 0ustar rootroot/*- * Copyright (c) 2003, 2005, 2006 Lev Walkin . * All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #include #include #include #include /* Encoder and decoder of a primitive type */ /* * ENUMERATED basic type description. */ static const ber_tlv_tag_t asn_DEF_ENUMERATED_tags[] = { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) }; asn_TYPE_descriptor_t asn_DEF_ENUMERATED = { "ENUMERATED", "ENUMERATED", ASN__PRIMITIVE_TYPE_free, INTEGER_print, /* Implemented in terms of INTEGER */ asn_generic_no_constraint, ber_decode_primitive, INTEGER_encode_der, /* Implemented in terms of INTEGER */ INTEGER_decode_xer, /* This is temporary! */ INTEGER_encode_xer, ENUMERATED_decode_uper, /* Unaligned PER decoder */ ENUMERATED_encode_uper, /* Unaligned PER encoder */ 0, /* Use generic outmost tag fetcher */ asn_DEF_ENUMERATED_tags, sizeof(asn_DEF_ENUMERATED_tags) / sizeof(asn_DEF_ENUMERATED_tags[0]), asn_DEF_ENUMERATED_tags, /* Same as above */ sizeof(asn_DEF_ENUMERATED_tags) / sizeof(asn_DEF_ENUMERATED_tags[0]), 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; asn_dec_rval_t ENUMERATED_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { asn_dec_rval_t rval; ENUMERATED_t *st = (ENUMERATED_t *)*sptr; long value; void *vptr = &value; if(!st) { st = (ENUMERATED_t *)(*sptr = CALLOC(1, sizeof(*st))); if(!st) ASN__DECODE_FAILED; } rval = NativeEnumerated_decode_uper(opt_codec_ctx, td, constraints, (void **)&vptr, pd); if(rval.code == RC_OK) if(asn_long2INTEGER(st, value)) rval.code = RC_FAIL; return rval; } asn_enc_rval_t ENUMERATED_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { ENUMERATED_t *st = (ENUMERATED_t *)sptr; long value; if(asn_INTEGER2long(st, &value)) ASN__ENCODE_FAILED; return NativeEnumerated_encode_uper(td, constraints, &value, po); } asn1c-0.9.28+dfsg/skeletons/REAL.h0000644000000000000000000000215113065714043015141 0ustar rootroot/*- * Copyright (c) 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef ASN_TYPE_REAL_H #define ASN_TYPE_REAL_H #include #include #ifdef __cplusplus extern "C" { #endif typedef ASN__PRIMITIVE_TYPE_t REAL_t; extern asn_TYPE_descriptor_t asn_DEF_REAL; asn_struct_print_f REAL_print; xer_type_decoder_f REAL_decode_xer; xer_type_encoder_f REAL_encode_xer; per_type_decoder_f REAL_decode_uper; per_type_encoder_f REAL_encode_uper; /*********************************** * Some handy conversion routines. * ***********************************/ ssize_t REAL__dump(double d, int canonical, asn_app_consume_bytes_f *cb, void *app_key); /* * Convert between native double type and REAL representation (DER). * RETURN VALUES: * 0: Value converted successfully * -1: An error occured while converting the value: invalid format. */ int asn_REAL2double(const REAL_t *real_ptr, double *d); int asn_double2REAL(REAL_t *real_ptr, double d); #ifdef __cplusplus } #endif #endif /* ASN_TYPE_REAL_H */ asn1c-0.9.28+dfsg/skeletons/NativeReal.h0000644000000000000000000000175313065714043016457 0ustar rootroot/*- * Copyright (c) 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ /* * This type differs from the standard REAL in that it is modelled using * the fixed machine type (double), so it can hold only values of * limited precision. There is no explicit type (i.e., NativeReal_t). * Use of this type is normally enabled by -fnative-types. */ #ifndef ASN_TYPE_NativeReal_H #define ASN_TYPE_NativeReal_H #include #ifdef __cplusplus extern "C" { #endif extern asn_TYPE_descriptor_t asn_DEF_NativeReal; asn_struct_free_f NativeReal_free; asn_struct_print_f NativeReal_print; ber_type_decoder_f NativeReal_decode_ber; der_type_encoder_f NativeReal_encode_der; xer_type_decoder_f NativeReal_decode_xer; xer_type_encoder_f NativeReal_encode_xer; per_type_decoder_f NativeReal_decode_uper; per_type_encoder_f NativeReal_encode_uper; #ifdef __cplusplus } #endif #endif /* ASN_TYPE_NativeReal_H */ asn1c-0.9.28+dfsg/skeletons/GeneralString.h0000644000000000000000000000072013065714043017162 0ustar rootroot/*- * Copyright (c) 2003 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef _GeneralString_H_ #define _GeneralString_H_ #include #ifdef __cplusplus extern "C" { #endif typedef OCTET_STRING_t GeneralString_t; /* Implemented via OCTET STRING */ extern asn_TYPE_descriptor_t asn_DEF_GeneralString; #ifdef __cplusplus } #endif #endif /* _GeneralString_H_ */ asn1c-0.9.28+dfsg/skeletons/asn_codecs.h0000644000000000000000000000656313065714043016532 0ustar rootroot/*- * Copyright (c) 2003, 2004, 2005 Lev Walkin . * All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef ASN_CODECS_H #define ASN_CODECS_H #ifdef __cplusplus extern "C" { #endif struct asn_TYPE_descriptor_s; /* Forward declaration */ /* * This structure defines a set of parameters that may be passed * to every ASN.1 encoder or decoder function. * WARNING: if max_stack_size member is set, and you are calling the * function pointers of the asn_TYPE_descriptor_t directly, * this structure must be ALLOCATED ON THE STACK! * If you can't always satisfy this requirement, use ber_decode(), * xer_decode() and uper_decode() functions instead. */ typedef struct asn_codec_ctx_s { /* * Limit the decoder routines to use no (much) more stack than a given * number of bytes. Most of decoders are stack-based, and this * would protect against stack overflows if the number of nested * encodings is high. * The OCTET STRING, BIT STRING and ANY BER decoders are heap-based, * and are safe from this kind of overflow. * A value from getrlimit(RLIMIT_STACK) may be used to initialize * this variable. Be careful in multithreaded environments, as the * stack size is rather limited. */ size_t max_stack_size; /* 0 disables stack bounds checking */ } asn_codec_ctx_t; /* * Type of the return value of the encoding functions (der_encode, xer_encode). */ typedef struct asn_enc_rval_s { /* * Number of bytes encoded. * -1 indicates failure to encode the structure. * In this case, the members below this one are meaningful. */ ssize_t encoded; /* * Members meaningful when (encoded == -1), for post mortem analysis. */ /* Type which cannot be encoded */ struct asn_TYPE_descriptor_s *failed_type; /* Pointer to the structure of that type */ void *structure_ptr; } asn_enc_rval_t; #define ASN__ENCODE_FAILED do { \ asn_enc_rval_t tmp_error; \ tmp_error.encoded = -1; \ tmp_error.failed_type = td; \ tmp_error.structure_ptr = sptr; \ ASN_DEBUG("Failed to encode element %s", td ? td->name : ""); \ return tmp_error; \ } while(0) #define ASN__ENCODED_OK(rval) do { \ rval.structure_ptr = 0; \ rval.failed_type = 0; \ return rval; \ } while(0) /* * Type of the return value of the decoding functions (ber_decode, xer_decode) * * Please note that the number of consumed bytes is ALWAYS meaningful, * even if code==RC_FAIL. This is to indicate the number of successfully * decoded bytes, hence providing a possibility to fail with more diagnostics * (i.e., print the offending remainder of the buffer). */ enum asn_dec_rval_code_e { RC_OK, /* Decoded successfully */ RC_WMORE, /* More data expected, call again */ RC_FAIL /* Failure to decode data */ }; typedef struct asn_dec_rval_s { enum asn_dec_rval_code_e code; /* Result code */ size_t consumed; /* Number of bytes consumed */ } asn_dec_rval_t; #define ASN__DECODE_FAILED do { \ asn_dec_rval_t tmp_error; \ tmp_error.code = RC_FAIL; \ tmp_error.consumed = 0; \ ASN_DEBUG("Failed to decode element %s", td ? td->name : ""); \ return tmp_error; \ } while(0) #define ASN__DECODE_STARVED do { \ asn_dec_rval_t tmp_error; \ tmp_error.code = RC_WMORE; \ tmp_error.consumed = 0; \ return tmp_error; \ } while(0) #ifdef __cplusplus } #endif #endif /* ASN_CODECS_H */ asn1c-0.9.28+dfsg/skeletons/per_decoder.c0000644000000000000000000000477613065714043016703 0ustar rootroot#include #include #include /* * Decode a "Production of a complete encoding", X.691#10.1. * The complete encoding contains at least one byte, and is an integral * multiple of 8 bytes. */ asn_dec_rval_t uper_decode_complete(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, const void *buffer, size_t size) { asn_dec_rval_t rval; rval = uper_decode(opt_codec_ctx, td, sptr, buffer, size, 0, 0); if(rval.consumed) { /* * We've always given 8-aligned data, * so convert bits to integral bytes. */ rval.consumed += 7; rval.consumed >>= 3; } else if(rval.code == RC_OK) { if(size) { if(((const uint8_t *)buffer)[0] == 0) { rval.consumed = 1; /* 1 byte */ } else { ASN_DEBUG("Expecting single zeroed byte"); rval.code = RC_FAIL; } } else { /* Must contain at least 8 bits. */ rval.code = RC_WMORE; } } return rval; } asn_dec_rval_t uper_decode(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, const void *buffer, size_t size, int skip_bits, int unused_bits) { asn_codec_ctx_t s_codec_ctx; asn_dec_rval_t rval; asn_per_data_t pd; if(skip_bits < 0 || skip_bits > 7 || unused_bits < 0 || unused_bits > 7 || (unused_bits > 0 && !size)) ASN__DECODE_FAILED; /* * Stack checker requires that the codec context * must be allocated on the stack. */ if(opt_codec_ctx) { if(opt_codec_ctx->max_stack_size) { s_codec_ctx = *opt_codec_ctx; opt_codec_ctx = &s_codec_ctx; } } else { /* If context is not given, be security-conscious anyway */ memset(&s_codec_ctx, 0, sizeof(s_codec_ctx)); s_codec_ctx.max_stack_size = ASN__DEFAULT_STACK_MAX; opt_codec_ctx = &s_codec_ctx; } /* Fill in the position indicator */ memset(&pd, 0, sizeof(pd)); pd.buffer = (const uint8_t *)buffer; pd.nboff = skip_bits; pd.nbits = 8 * size - unused_bits; /* 8 is CHAR_BIT from */ if(pd.nboff > pd.nbits) ASN__DECODE_FAILED; /* * Invoke type-specific decoder. */ if(!td->uper_decoder) ASN__DECODE_FAILED; /* PER is not compiled in */ rval = td->uper_decoder(opt_codec_ctx, td, 0, sptr, &pd); if(rval.code == RC_OK) { /* Return the number of consumed bits */ rval.consumed = ((pd.buffer - (const uint8_t *)buffer) << 3) + pd.nboff - skip_bits; ASN_DEBUG("PER decoding consumed %ld, counted %ld", (long)rval.consumed, (long)pd.moved); assert(rval.consumed == pd.moved); } else { /* PER codec is not a restartable */ rval.consumed = 0; } return rval; } asn1c-0.9.28+dfsg/skeletons/IA5String.h0000644000000000000000000000102213065714043016157 0ustar rootroot/*- * Copyright (c) 2003 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef _IA5String_H_ #define _IA5String_H_ #include #ifdef __cplusplus extern "C" { #endif typedef OCTET_STRING_t IA5String_t; /* Implemented via OCTET STRING */ /* * IA5String ASN.1 type definition. */ extern asn_TYPE_descriptor_t asn_DEF_IA5String; asn_constr_check_f IA5String_constraint; #ifdef __cplusplus } #endif #endif /* _IA5String_H_ */ asn1c-0.9.28+dfsg/skeletons/GraphicString.h0000644000000000000000000000072013065714043017162 0ustar rootroot/*- * Copyright (c) 2003 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef _GraphicString_H_ #define _GraphicString_H_ #include #ifdef __cplusplus extern "C" { #endif typedef OCTET_STRING_t GraphicString_t; /* Implemented via OCTET STRING */ extern asn_TYPE_descriptor_t asn_DEF_GraphicString; #ifdef __cplusplus } #endif #endif /* _GraphicString_H_ */ asn1c-0.9.28+dfsg/skeletons/BMPString.c0000644000000000000000000001130713065714043016221 0ustar rootroot/*- * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #include #include #include /* * BMPString basic type description. */ static const ber_tlv_tag_t asn_DEF_BMPString_tags[] = { (ASN_TAG_CLASS_UNIVERSAL | (30 << 2)), /* [UNIVERSAL 30] IMPLICIT ...*/ (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */ }; static asn_OCTET_STRING_specifics_t asn_DEF_BMPString_specs = { sizeof(BMPString_t), offsetof(BMPString_t, _asn_ctx), ASN_OSUBV_U16 /* 16-bits character */ }; static asn_per_constraints_t asn_DEF_BMPString_constraints = { { APC_CONSTRAINED, 16, 16, 0, 65535 }, { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 }, 0, 0 }; asn_TYPE_descriptor_t asn_DEF_BMPString = { "BMPString", "BMPString", OCTET_STRING_free, /* Implemented in terms of OCTET STRING */ BMPString_print, asn_generic_no_constraint, /* No constraint by default */ OCTET_STRING_decode_ber, OCTET_STRING_encode_der, BMPString_decode_xer, /* Convert from UTF-8 */ BMPString_encode_xer, /* Convert to UTF-8 */ OCTET_STRING_decode_uper, OCTET_STRING_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_BMPString_tags, sizeof(asn_DEF_BMPString_tags) / sizeof(asn_DEF_BMPString_tags[0]) - 1, asn_DEF_BMPString_tags, sizeof(asn_DEF_BMPString_tags) / sizeof(asn_DEF_BMPString_tags[0]), &asn_DEF_BMPString_constraints, 0, 0, /* No members */ &asn_DEF_BMPString_specs }; /* * BMPString specific contents printer. */ static ssize_t BMPString__dump(const BMPString_t *st, asn_app_consume_bytes_f *cb, void *app_key) { char scratch[128]; /* Scratchpad buffer */ char *p = scratch; ssize_t wrote = 0; uint8_t *ch; uint8_t *end; ch = st->buf; end = (st->buf + st->size); for(end--; ch < end; ch += 2) { uint16_t wc = (ch[0] << 8) | ch[1]; /* 2 bytes */ if(sizeof(scratch) - (p - scratch) < 3) { wrote += p - scratch; if(cb(scratch, p - scratch, app_key) < 0) return -1; p = scratch; } if(wc < 0x80) { *p++ = (char)wc; } else if(wc < 0x800) { *p++ = 0xc0 | ((wc >> 6)); *p++ = 0x80 | ((wc & 0x3f)); } else { *p++ = 0xe0 | ((wc >> 12)); *p++ = 0x80 | ((wc >> 6) & 0x3f); *p++ = 0x80 | ((wc & 0x3f)); } } wrote += p - scratch; if(cb(scratch, p - scratch, app_key) < 0) return -1; return wrote; } asn_dec_rval_t BMPString_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, const char *opt_mname, const void *buf_ptr, size_t size) { asn_dec_rval_t rc; rc = OCTET_STRING_decode_xer_utf8(opt_codec_ctx, td, sptr, opt_mname, buf_ptr, size); if(rc.code == RC_OK) { /* * Now we have a whole string in UTF-8 format. * Convert it into UCS-2. */ uint32_t *wcs; size_t wcs_len; UTF8String_t *st; assert(*sptr); st = (UTF8String_t *)*sptr; assert(st->buf); wcs_len = UTF8String_to_wcs(st, 0, 0); wcs = (uint32_t *)MALLOC(4 * (wcs_len + 1)); if(wcs == 0 || UTF8String_to_wcs(st, wcs, wcs_len) != wcs_len) { rc.code = RC_FAIL; rc.consumed = 0; return rc; } else { wcs[wcs_len] = 0; /* nul-terminate */ } if(1) { /* Swap byte order and trim encoding to 2 bytes */ uint32_t *wc = wcs; uint32_t *wc_end = wcs + wcs_len; uint16_t *dstwc = (uint16_t *)wcs; for(; wc < wc_end; wc++, dstwc++) { uint32_t wch = *wc; if(wch > 0xffff) { FREEMEM(wcs); rc.code = RC_FAIL; rc.consumed = 0; return rc; } *((uint8_t *)dstwc + 0) = wch >> 8; *((uint8_t *)dstwc + 1) = wch; } dstwc = (uint16_t *)REALLOC(wcs, 2 * (wcs_len + 1)); if(!dstwc) { FREEMEM(wcs); rc.code = RC_FAIL; rc.consumed = 0; return rc; } else { dstwc[wcs_len] = 0; /* nul-terminate */ wcs = (uint32_t *)(void *)dstwc; /* Alignment OK */ } } FREEMEM(st->buf); st->buf = (uint8_t *)wcs; st->size = 2 * wcs_len; } return rc; } asn_enc_rval_t BMPString_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { const BMPString_t *st = (const BMPString_t *)sptr; asn_enc_rval_t er; (void)ilevel; (void)flags; if(!st || !st->buf) ASN__ENCODE_FAILED; er.encoded = BMPString__dump(st, cb, app_key); if(er.encoded < 0) ASN__ENCODE_FAILED; ASN__ENCODED_OK(er); } int BMPString_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { const BMPString_t *st = (const BMPString_t *)sptr; (void)td; /* Unused argument */ (void)ilevel; /* Unused argument */ if(!st || !st->buf) return (cb("", 8, app_key) < 0) ? -1 : 0; if(BMPString__dump(st, cb, app_key) < 0) return -1; return 0; } asn1c-0.9.28+dfsg/skeletons/constraints.c0000644000000000000000000000425713065714043016771 0ustar rootroot#include "asn_internal.h" #include "constraints.h" int asn_generic_no_constraint(asn_TYPE_descriptor_t *type_descriptor, const void *struct_ptr, asn_app_constraint_failed_f *cb, void *key) { (void)type_descriptor; /* Unused argument */ (void)struct_ptr; /* Unused argument */ (void)cb; /* Unused argument */ (void)key; /* Unused argument */ /* Nothing to check */ return 0; } int asn_generic_unknown_constraint(asn_TYPE_descriptor_t *type_descriptor, const void *struct_ptr, asn_app_constraint_failed_f *cb, void *key) { (void)type_descriptor; /* Unused argument */ (void)struct_ptr; /* Unused argument */ (void)cb; /* Unused argument */ (void)key; /* Unused argument */ /* Unknown how to check */ return 0; } struct errbufDesc { asn_TYPE_descriptor_t *failed_type; const void *failed_struct_ptr; char *errbuf; size_t errlen; }; static void _asn_i_ctfailcb(void *key, asn_TYPE_descriptor_t *td, const void *sptr, const char *fmt, ...) { struct errbufDesc *arg = key; va_list ap; ssize_t vlen; ssize_t maxlen; arg->failed_type = td; arg->failed_struct_ptr = sptr; maxlen = arg->errlen; if(maxlen <= 0) return; va_start(ap, fmt); vlen = vsnprintf(arg->errbuf, maxlen, fmt, ap); va_end(ap); if(vlen >= maxlen) { arg->errbuf[maxlen-1] = '\0'; /* Ensuring libc correctness */ arg->errlen = maxlen - 1; /* Not counting termination */ return; } else if(vlen >= 0) { arg->errbuf[vlen] = '\0'; /* Ensuring libc correctness */ arg->errlen = vlen; /* Not counting termination */ } else { /* * The libc on this system is broken. */ vlen = sizeof("") - 1; maxlen--; arg->errlen = vlen < maxlen ? vlen : maxlen; memcpy(arg->errbuf, "", arg->errlen); arg->errbuf[arg->errlen] = 0; } return; } int asn_check_constraints(asn_TYPE_descriptor_t *type_descriptor, const void *struct_ptr, char *errbuf, size_t *errlen) { struct errbufDesc arg; int ret; arg.failed_type = 0; arg.failed_struct_ptr = 0; arg.errbuf = errbuf; arg.errlen = errlen ? *errlen : 0; ret = type_descriptor->check_constraints(type_descriptor, struct_ptr, _asn_i_ctfailcb, &arg); if(ret == -1 && errlen) *errlen = arg.errlen; return ret; } asn1c-0.9.28+dfsg/skeletons/ISO646String.c0000644000000000000000000000252613065714043016500 0ustar rootroot/*- * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #include #include /* * ISO646String basic type description. */ static const ber_tlv_tag_t asn_DEF_ISO646String_tags[] = { (ASN_TAG_CLASS_UNIVERSAL | (26 << 2)), /* [UNIVERSAL 26] IMPLICIT ...*/ (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */ }; static asn_per_constraints_t asn_DEF_ISO646String_constraints = { { APC_CONSTRAINED, 7, 7, 0x20, 0x7e }, /* Value */ { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 }, /* Size */ 0, 0 }; asn_TYPE_descriptor_t asn_DEF_ISO646String = { "ISO646String", "ISO646String", OCTET_STRING_free, OCTET_STRING_print_utf8, /* ASCII subset */ VisibleString_constraint, OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */ OCTET_STRING_encode_der, OCTET_STRING_decode_xer_utf8, OCTET_STRING_encode_xer_utf8, OCTET_STRING_decode_uper, OCTET_STRING_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_ISO646String_tags, sizeof(asn_DEF_ISO646String_tags) / sizeof(asn_DEF_ISO646String_tags[0]) - 1, asn_DEF_ISO646String_tags, sizeof(asn_DEF_ISO646String_tags) / sizeof(asn_DEF_ISO646String_tags[0]), &asn_DEF_ISO646String_constraints, 0, 0, /* No members */ 0 /* No specifics */ }; asn1c-0.9.28+dfsg/skeletons/xer_encoder.h0000644000000000000000000000324113065714043016714 0ustar rootroot/*- * Copyright (c) 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef _XER_ENCODER_H_ #define _XER_ENCODER_H_ #include #ifdef __cplusplus extern "C" { #endif struct asn_TYPE_descriptor_s; /* Forward declaration */ /* Flags used by the xer_encode() and (*xer_type_encoder_f), defined below */ enum xer_encoder_flags_e { /* Mode of encoding */ XER_F_BASIC = 0x01, /* BASIC-XER (pretty-printing) */ XER_F_CANONICAL = 0x02 /* Canonical XER (strict rules) */ }; /* * The XER encoder of any type. May be invoked by the application. */ asn_enc_rval_t xer_encode(struct asn_TYPE_descriptor_s *type_descriptor, void *struct_ptr, /* Structure to be encoded */ enum xer_encoder_flags_e xer_flags, asn_app_consume_bytes_f *consume_bytes_cb, void *app_key /* Arbitrary callback argument */ ); /* * The variant of the above function which dumps the BASIC-XER (XER_F_BASIC) * output into the chosen file pointer. * RETURN VALUES: * 0: The structure is printed. * -1: Problem printing the structure. * WARNING: No sensible errno value is returned. */ int xer_fprint(FILE *stream, struct asn_TYPE_descriptor_s *td, void *sptr); /* * Type of the generic XER encoder. */ typedef asn_enc_rval_t (xer_type_encoder_f)( struct asn_TYPE_descriptor_s *type_descriptor, void *struct_ptr, /* Structure to be encoded */ int ilevel, /* Level of indentation */ enum xer_encoder_flags_e xer_flags, asn_app_consume_bytes_f *consume_bytes_cb, /* Callback */ void *app_key /* Arbitrary callback argument */ ); #ifdef __cplusplus } #endif #endif /* _XER_ENCODER_H_ */ asn1c-0.9.28+dfsg/skeletons/UniversalString.h0000644000000000000000000000120613065714043017555 0ustar rootroot/*- * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef _UniversalString_H_ #define _UniversalString_H_ #include #ifdef __cplusplus extern "C" { #endif typedef OCTET_STRING_t UniversalString_t; /* Implemented via OCTET STRING */ extern asn_TYPE_descriptor_t asn_DEF_UniversalString; asn_struct_print_f UniversalString_print; /* Human-readable output */ xer_type_decoder_f UniversalString_decode_xer; xer_type_encoder_f UniversalString_encode_xer; #ifdef __cplusplus } #endif #endif /* _UniversalString_H_ */ asn1c-0.9.28+dfsg/skeletons/constraints.h0000644000000000000000000000365113065714043016773 0ustar rootroot/*- * Copyright (c) 2004, 2006 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef ASN1_CONSTRAINTS_VALIDATOR_H #define ASN1_CONSTRAINTS_VALIDATOR_H #include /* Platform-dependent types */ #ifdef __cplusplus extern "C" { #endif struct asn_TYPE_descriptor_s; /* Forward declaration */ /* * Validate the structure according to the ASN.1 constraints. * If errbuf and errlen are given, they shall be pointing to the appropriate * buffer space and its length before calling this function. Alternatively, * they could be passed as NULL's. If constraints validation fails, * errlen will contain the actual number of bytes taken from the errbuf * to encode an error message (properly 0-terminated). * * RETURN VALUES: * This function returns 0 in case all ASN.1 constraints are met * and -1 if one or more constraints were failed. */ int asn_check_constraints(struct asn_TYPE_descriptor_s *type_descriptor, const void *struct_ptr, /* Target language's structure */ char *errbuf, /* Returned error description */ size_t *errlen /* Length of the error description */ ); /* * Generic type for constraint checking callback, * associated with every type descriptor. */ typedef int (asn_constr_check_f)( struct asn_TYPE_descriptor_s *type_descriptor, const void *struct_ptr, asn_app_constraint_failed_f *optional_callback, /* Log the error */ void *optional_app_key /* Opaque key passed to a callback */ ); /******************************* * INTERNALLY USEFUL FUNCTIONS * *******************************/ asn_constr_check_f asn_generic_no_constraint; /* No constraint whatsoever */ asn_constr_check_f asn_generic_unknown_constraint; /* Not fully supported */ /* * Invoke the callback with a complete error message. */ #define ASN__CTFAIL if(ctfailcb) ctfailcb #ifdef __cplusplus } #endif #endif /* ASN1_CONSTRAINTS_VALIDATOR_H */ asn1c-0.9.28+dfsg/skeletons/T61String.h0000644000000000000000000000067413065714043016167 0ustar rootroot/*- * Copyright (c) 2003 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef _T61String_H_ #define _T61String_H_ #include #ifdef __cplusplus extern "C" { #endif typedef OCTET_STRING_t T61String_t; /* Implemented via OCTET STRING */ extern asn_TYPE_descriptor_t asn_DEF_T61String; #ifdef __cplusplus } #endif #endif /* _T61String_H_ */ asn1c-0.9.28+dfsg/skeletons/NativeEnumerated.h0000644000000000000000000000160113065714043017655 0ustar rootroot/*- * Copyright (c) 2004, 2005, 2006 Lev Walkin . * All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ /* * This type differs from the standard ENUMERATED in that it is modelled using * the fixed machine type (long, int, short), so it can hold only values of * limited length. There is no type (i.e., NativeEnumerated_t, any integer type * will do). * This type may be used when integer range is limited by subtype constraints. */ #ifndef _NativeEnumerated_H_ #define _NativeEnumerated_H_ #include #ifdef __cplusplus extern "C" { #endif extern asn_TYPE_descriptor_t asn_DEF_NativeEnumerated; xer_type_encoder_f NativeEnumerated_encode_xer; per_type_decoder_f NativeEnumerated_decode_uper; per_type_encoder_f NativeEnumerated_encode_uper; #ifdef __cplusplus } #endif #endif /* _NativeEnumerated_H_ */ asn1c-0.9.28+dfsg/skeletons/ber_decoder.c0000644000000000000000000001676713065714043016670 0ustar rootroot/*- * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #include #undef ADVANCE #define ADVANCE(num_bytes) do { \ size_t num = num_bytes; \ ptr = ((const char *)ptr) + num; \ size -= num; \ consumed_myself += num; \ } while(0) #undef RETURN #define RETURN(_code) do { \ asn_dec_rval_t rval; \ rval.code = _code; \ if(opt_ctx) opt_ctx->step = step; /* Save context */ \ if(_code == RC_OK || opt_ctx) \ rval.consumed = consumed_myself; \ else \ rval.consumed = 0; /* Context-free */ \ return rval; \ } while(0) /* * The BER decoder of any type. */ asn_dec_rval_t ber_decode(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *type_descriptor, void **struct_ptr, const void *ptr, size_t size) { asn_codec_ctx_t s_codec_ctx; /* * Stack checker requires that the codec context * must be allocated on the stack. */ if(opt_codec_ctx) { if(opt_codec_ctx->max_stack_size) { s_codec_ctx = *opt_codec_ctx; opt_codec_ctx = &s_codec_ctx; } } else { /* If context is not given, be security-conscious anyway */ memset(&s_codec_ctx, 0, sizeof(s_codec_ctx)); s_codec_ctx.max_stack_size = ASN__DEFAULT_STACK_MAX; opt_codec_ctx = &s_codec_ctx; } /* * Invoke type-specific decoder. */ return type_descriptor->ber_decoder(opt_codec_ctx, type_descriptor, struct_ptr, /* Pointer to the destination structure */ ptr, size, /* Buffer and its size */ 0 /* Default tag mode is 0 */ ); } /* * Check the set of >> tags matches the definition. */ asn_dec_rval_t ber_check_tags(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_struct_ctx_t *opt_ctx, const void *ptr, size_t size, int tag_mode, int last_tag_form, ber_tlv_len_t *last_length, int *opt_tlv_form) { ssize_t consumed_myself = 0; ssize_t tag_len; ssize_t len_len; ber_tlv_tag_t tlv_tag; ber_tlv_len_t tlv_len; ber_tlv_len_t limit_len = -1; int expect_00_terminators = 0; int tlv_constr = -1; /* If CHOICE, opt_tlv_form is not given */ int step = opt_ctx ? opt_ctx->step : 0; /* Where we left previously */ int tagno; /* * Make sure we didn't exceed the maximum stack size. */ if(ASN__STACK_OVERFLOW_CHECK(opt_codec_ctx)) RETURN(RC_FAIL); /* * So what does all this implicit skip stuff mean? * Imagine two types, * A ::= [5] IMPLICIT T * B ::= [2] EXPLICIT T * Where T is defined as * T ::= [4] IMPLICIT SEQUENCE { ... } * * Let's say, we are starting to decode type A, given the * following TLV stream: <5> <0>. What does this mean? * It means that the type A contains type T which is, * in turn, empty. * Remember though, that we are still in A. We cannot * just pass control to the type T decoder. Why? Because * the type T decoder expects <4> <0>, not <5> <0>. * So, we must make sure we are going to receive <5> while * still in A, then pass control to the T decoder, indicating * that the tag <4> was implicitly skipped. The decoder of T * hence will be prepared to treat <4> as valid tag, and decode * it appropriately. */ tagno = step /* Continuing where left previously */ + (tag_mode==1?-1:0) ; ASN_DEBUG("ber_check_tags(%s, size=%ld, tm=%d, step=%d, tagno=%d)", td->name, (long)size, tag_mode, step, tagno); /* assert(td->tags_count >= 1) May not be the case for CHOICE or ANY */ if(tag_mode == 0 && tagno == td->tags_count) { /* * This must be the _untagged_ ANY type, * which outermost tag isn't known in advance. * Fetch the tag and length separately. */ tag_len = ber_fetch_tag(ptr, size, &tlv_tag); switch(tag_len) { case -1: RETURN(RC_FAIL); case 0: RETURN(RC_WMORE); } tlv_constr = BER_TLV_CONSTRUCTED(ptr); len_len = ber_fetch_length(tlv_constr, (const char *)ptr + tag_len, size - tag_len, &tlv_len); switch(len_len) { case -1: RETURN(RC_FAIL); case 0: RETURN(RC_WMORE); } ASN_DEBUG("Advancing %ld in ANY case", (long)(tag_len + len_len)); ADVANCE(tag_len + len_len); } else { assert(tagno < td->tags_count); /* At least one loop */ } for((void)tagno; tagno < td->tags_count; tagno++, step++) { /* * Fetch and process T from TLV. */ tag_len = ber_fetch_tag(ptr, size, &tlv_tag); ASN_DEBUG("Fetching tag from {%p,%ld}: " "len %ld, step %d, tagno %d got %s", ptr, (long)size, (long)tag_len, step, tagno, ber_tlv_tag_string(tlv_tag)); switch(tag_len) { case -1: RETURN(RC_FAIL); case 0: RETURN(RC_WMORE); } tlv_constr = BER_TLV_CONSTRUCTED(ptr); /* * If {I}, don't check anything. * If {I,B,C}, check B and C unless we're at I. */ if(tag_mode != 0 && step == 0) { /* * We don't expect tag to match here. * It's just because we don't know how the tag * is supposed to look like. */ } else { assert(tagno >= 0); /* Guaranteed by the code above */ if(tlv_tag != td->tags[tagno]) { /* * Unexpected tag. Too bad. */ ASN_DEBUG("Expected: %s, " "expectation failed (tn=%d, tm=%d)", ber_tlv_tag_string(td->tags[tagno]), tagno, tag_mode ); RETURN(RC_FAIL); } } /* * Attention: if there are more tags expected, * ensure that the current tag is presented * in constructed form (it contains other tags!). * If this one is the last one, check that the tag form * matches the one given in descriptor. */ if(tagno < (td->tags_count - 1)) { if(tlv_constr == 0) { ASN_DEBUG("tlv_constr = %d, expfail", tlv_constr); RETURN(RC_FAIL); } } else { if(last_tag_form != tlv_constr && last_tag_form != -1) { ASN_DEBUG("last_tag_form %d != %d", last_tag_form, tlv_constr); RETURN(RC_FAIL); } } /* * Fetch and process L from TLV. */ len_len = ber_fetch_length(tlv_constr, (const char *)ptr + tag_len, size - tag_len, &tlv_len); ASN_DEBUG("Fetching len = %ld", (long)len_len); switch(len_len) { case -1: RETURN(RC_FAIL); case 0: RETURN(RC_WMORE); } /* * FIXME * As of today, the chain of tags * must either contain several indefinite length TLVs, * or several definite length ones. * No mixing is allowed. */ if(tlv_len == -1) { /* * Indefinite length. */ if(limit_len == -1) { expect_00_terminators++; } else { ASN_DEBUG("Unexpected indefinite length " "in a chain of definite lengths"); RETURN(RC_FAIL); } ADVANCE(tag_len + len_len); continue; } else { if(expect_00_terminators) { ASN_DEBUG("Unexpected definite length " "in a chain of indefinite lengths"); RETURN(RC_FAIL); } } /* * Check that multiple TLVs specify ever decreasing length, * which is consistent. */ if(limit_len == -1) { limit_len = tlv_len + tag_len + len_len; if(limit_len < 0) { /* Too great tlv_len value? */ RETURN(RC_FAIL); } } else if(limit_len != tlv_len + tag_len + len_len) { /* * Inner TLV specifies length which is inconsistent * with the outer TLV's length value. */ ASN_DEBUG("Outer TLV is %ld and inner is %ld", (long)limit_len, (long)tlv_len); RETURN(RC_FAIL); } ADVANCE(tag_len + len_len); limit_len -= (tag_len + len_len); if((ssize_t)size > limit_len) { /* * Make sure that we won't consume more bytes * from the parent frame than the inferred limit. */ size = limit_len; } } if(opt_tlv_form) *opt_tlv_form = tlv_constr; if(expect_00_terminators) *last_length = -expect_00_terminators; else *last_length = tlv_len; RETURN(RC_OK); } asn1c-0.9.28+dfsg/skeletons/per_encoder.h0000644000000000000000000000417713065714043016715 0ustar rootroot/*- * Copyright (c) 2006, 2007 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef _PER_ENCODER_H_ #define _PER_ENCODER_H_ #include #include #ifdef __cplusplus extern "C" { #endif struct asn_TYPE_descriptor_s; /* Forward declaration */ /* * Unaligned PER encoder of any ASN.1 type. May be invoked by the application. * WARNING: This function returns the number of encoded bits in the .encoded * field of the return value. Use the following formula to convert to bytes: * bytes = ((.encoded + 7) / 8) */ asn_enc_rval_t uper_encode(struct asn_TYPE_descriptor_s *type_descriptor, void *struct_ptr, /* Structure to be encoded */ asn_app_consume_bytes_f *consume_bytes_cb, /* Data collector */ void *app_key /* Arbitrary callback argument */ ); /* * A variant of uper_encode() which encodes data into the existing buffer * WARNING: This function returns the number of encoded bits in the .encoded * field of the return value. */ asn_enc_rval_t uper_encode_to_buffer( struct asn_TYPE_descriptor_s *type_descriptor, void *struct_ptr, /* Structure to be encoded */ void *buffer, /* Pre-allocated buffer */ size_t buffer_size /* Initial buffer size (max) */ ); /* * A variant of uper_encode_to_buffer() which allocates buffer itself. * Returns the number of bytes in the buffer or -1 in case of failure. * WARNING: This function produces a "Production of the complete encoding", * with length of at least one octet. Contrast this to precise bit-packing * encoding of uper_encode() and uper_encode_to_buffer(). */ ssize_t uper_encode_to_new_buffer( struct asn_TYPE_descriptor_s *type_descriptor, asn_per_constraints_t *constraints, void *struct_ptr, /* Structure to be encoded */ void **buffer_r /* Buffer allocated and returned */ ); /* * Type of the generic PER encoder function. */ typedef asn_enc_rval_t (per_type_encoder_f)( struct asn_TYPE_descriptor_s *type_descriptor, asn_per_constraints_t *constraints, void *struct_ptr, asn_per_outp_t *per_output ); #ifdef __cplusplus } #endif #endif /* _PER_ENCODER_H_ */ asn1c-0.9.28+dfsg/skeletons/BOOLEAN.c0000644000000000000000000001415113065714043015473 0ustar rootroot/*- * Copyright (c) 2003, 2005 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #include #include #include /* * BOOLEAN basic type description. */ static const ber_tlv_tag_t asn_DEF_BOOLEAN_tags[] = { (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)) }; asn_TYPE_descriptor_t asn_DEF_BOOLEAN = { "BOOLEAN", "BOOLEAN", BOOLEAN_free, BOOLEAN_print, asn_generic_no_constraint, BOOLEAN_decode_ber, BOOLEAN_encode_der, BOOLEAN_decode_xer, BOOLEAN_encode_xer, BOOLEAN_decode_uper, /* Unaligned PER decoder */ BOOLEAN_encode_uper, /* Unaligned PER encoder */ 0, /* Use generic outmost tag fetcher */ asn_DEF_BOOLEAN_tags, sizeof(asn_DEF_BOOLEAN_tags) / sizeof(asn_DEF_BOOLEAN_tags[0]), asn_DEF_BOOLEAN_tags, /* Same as above */ sizeof(asn_DEF_BOOLEAN_tags) / sizeof(asn_DEF_BOOLEAN_tags[0]), 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /* * Decode BOOLEAN type. */ asn_dec_rval_t BOOLEAN_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **bool_value, const void *buf_ptr, size_t size, int tag_mode) { BOOLEAN_t *st = (BOOLEAN_t *)*bool_value; asn_dec_rval_t rval; ber_tlv_len_t length; ber_tlv_len_t lidx; if(st == NULL) { st = (BOOLEAN_t *)(*bool_value = CALLOC(1, sizeof(*st))); if(st == NULL) { rval.code = RC_FAIL; rval.consumed = 0; return rval; } } ASN_DEBUG("Decoding %s as BOOLEAN (tm=%d)", td->name, tag_mode); /* * Check tags. */ rval = ber_check_tags(opt_codec_ctx, td, 0, buf_ptr, size, tag_mode, 0, &length, 0); if(rval.code != RC_OK) return rval; ASN_DEBUG("Boolean length is %d bytes", (int)length); buf_ptr = ((const char *)buf_ptr) + rval.consumed; size -= rval.consumed; if(length > (ber_tlv_len_t)size) { rval.code = RC_WMORE; rval.consumed = 0; return rval; } /* * Compute boolean value. */ for(*st = 0, lidx = 0; (lidx < length) && *st == 0; lidx++) { /* * Very simple approach: read bytes until the end or * value is already TRUE. * BOOLEAN is not supposed to contain meaningful data anyway. */ *st |= ((const uint8_t *)buf_ptr)[lidx]; } rval.code = RC_OK; rval.consumed += length; ASN_DEBUG("Took %ld/%ld bytes to encode %s, value=%d", (long)rval.consumed, (long)length, td->name, *st); return rval; } asn_enc_rval_t BOOLEAN_encode_der(asn_TYPE_descriptor_t *td, void *sptr, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { asn_enc_rval_t erval; BOOLEAN_t *st = (BOOLEAN_t *)sptr; erval.encoded = der_write_tags(td, 1, tag_mode, 0, tag, cb, app_key); if(erval.encoded == -1) { erval.failed_type = td; erval.structure_ptr = sptr; return erval; } if(cb) { uint8_t bool_value; bool_value = *st ? 0xff : 0; /* 0xff mandated by DER */ if(cb(&bool_value, 1, app_key) < 0) { erval.encoded = -1; erval.failed_type = td; erval.structure_ptr = sptr; return erval; } } erval.encoded += 1; ASN__ENCODED_OK(erval); } /* * Decode the chunk of XML text encoding INTEGER. */ static enum xer_pbd_rval BOOLEAN__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chunk_buf, size_t chunk_size) { BOOLEAN_t *st = (BOOLEAN_t *)sptr; const char *p = (const char *)chunk_buf; (void)td; if(chunk_size && p[0] == 0x3c /* '<' */) { switch(xer_check_tag(chunk_buf, chunk_size, "false")) { case XCT_BOTH: /* "" */ *st = 0; break; case XCT_UNKNOWN_BO: if(xer_check_tag(chunk_buf, chunk_size, "true") != XCT_BOTH) return XPBD_BROKEN_ENCODING; /* "" */ *st = 1; /* Or 0xff as in DER?.. */ break; default: return XPBD_BROKEN_ENCODING; } return XPBD_BODY_CONSUMED; } else { return XPBD_BROKEN_ENCODING; } } asn_dec_rval_t BOOLEAN_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, const char *opt_mname, const void *buf_ptr, size_t size) { return xer_decode_primitive(opt_codec_ctx, td, sptr, sizeof(BOOLEAN_t), opt_mname, buf_ptr, size, BOOLEAN__xer_body_decode); } asn_enc_rval_t BOOLEAN_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { const BOOLEAN_t *st = (const BOOLEAN_t *)sptr; asn_enc_rval_t er; (void)ilevel; (void)flags; if(!st) ASN__ENCODE_FAILED; if(*st) { ASN__CALLBACK("", 7); er.encoded = 7; } else { ASN__CALLBACK("", 8); er.encoded = 8; } ASN__ENCODED_OK(er); cb_failed: ASN__ENCODE_FAILED; } int BOOLEAN_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { const BOOLEAN_t *st = (const BOOLEAN_t *)sptr; const char *buf; size_t buflen; (void)td; /* Unused argument */ (void)ilevel; /* Unused argument */ if(st) { if(*st) { buf = "TRUE"; buflen = 4; } else { buf = "FALSE"; buflen = 5; } } else { buf = ""; buflen = 8; } return (cb(buf, buflen, app_key) < 0) ? -1 : 0; } void BOOLEAN_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) { if(td && ptr && !contents_only) { FREEMEM(ptr); } } asn_dec_rval_t BOOLEAN_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { asn_dec_rval_t rv; BOOLEAN_t *st = (BOOLEAN_t *)*sptr; (void)opt_codec_ctx; (void)constraints; if(!st) { st = (BOOLEAN_t *)(*sptr = MALLOC(sizeof(*st))); if(!st) ASN__DECODE_FAILED; } /* * Extract a single bit */ switch(per_get_few_bits(pd, 1)) { case 1: *st = 1; break; case 0: *st = 0; break; case -1: default: ASN__DECODE_STARVED; } ASN_DEBUG("%s decoded as %s", td->name, *st ? "TRUE" : "FALSE"); rv.code = RC_OK; rv.consumed = 1; return rv; } asn_enc_rval_t BOOLEAN_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { const BOOLEAN_t *st = (const BOOLEAN_t *)sptr; asn_enc_rval_t er = { 0, 0, 0 }; (void)constraints; if(!st) ASN__ENCODE_FAILED; if(per_put_few_bits(po, *st ? 1 : 0, 1)) ASN__ENCODE_FAILED; ASN__ENCODED_OK(er); } asn1c-0.9.28+dfsg/skeletons/UTCTime.h0000644000000000000000000000161613065714043015675 0ustar rootroot/*- * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef _UTCTime_H_ #define _UTCTime_H_ #include #ifdef __cplusplus extern "C" { #endif typedef OCTET_STRING_t UTCTime_t; /* Implemented via OCTET STRING */ extern asn_TYPE_descriptor_t asn_DEF_UTCTime; asn_struct_print_f UTCTime_print; asn_constr_check_f UTCTime_constraint; xer_type_encoder_f UTCTime_encode_xer; /*********************** * Some handy helpers. * ***********************/ struct tm; /* */ /* See asn_GT2time() in GeneralizedTime.h */ time_t asn_UT2time(const UTCTime_t *, struct tm *_optional_tm4fill, int as_gmt); /* See asn_time2GT() in GeneralizedTime.h */ UTCTime_t *asn_time2UT(UTCTime_t *__opt_ut, const struct tm *, int force_gmt); #ifdef __cplusplus } #endif #endif /* _UTCTime_H_ */ asn1c-0.9.28+dfsg/skeletons/REAL.c0000644000000000000000000004414613065714043015146 0ustar rootroot/*- * Copyright (c) 2004-2013 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #define _ISOC99_SOURCE /* For ilogb() and quiet NAN */ #define _BSD_SOURCE /* To reintroduce finite(3) */ #if defined(__alpha) #include /* For INFINITY */ #endif #include #include /* for strtod(3) */ #include #include #include #include #undef INT_MAX #define INT_MAX ((int)(((unsigned int)-1) >> 1)) #if !(defined(NAN) || defined(INFINITY)) static volatile double real_zero GCC_NOTUSED = 0.0; #endif #ifndef NAN #define NAN (real_zero/real_zero) #endif #ifndef INFINITY #define INFINITY (1.0/real_zero) #endif #ifdef isfinite #define _asn_isfinite(d) isfinite(d) /* ISO C99 */ #else #define _asn_isfinite(d) finite(d) /* Deprecated on Mac OS X 10.9 */ #endif /* * REAL basic type description. */ static const ber_tlv_tag_t asn_DEF_REAL_tags[] = { (ASN_TAG_CLASS_UNIVERSAL | (9 << 2)) }; asn_TYPE_descriptor_t asn_DEF_REAL = { "REAL", "REAL", ASN__PRIMITIVE_TYPE_free, REAL_print, asn_generic_no_constraint, ber_decode_primitive, der_encode_primitive, REAL_decode_xer, REAL_encode_xer, REAL_decode_uper, REAL_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_REAL_tags, sizeof(asn_DEF_REAL_tags) / sizeof(asn_DEF_REAL_tags[0]), asn_DEF_REAL_tags, /* Same as above */ sizeof(asn_DEF_REAL_tags) / sizeof(asn_DEF_REAL_tags[0]), 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; typedef enum specialRealValue { SRV__NOT_A_NUMBER, SRV__MINUS_INFINITY, SRV__PLUS_INFINITY } specialRealValue_e; static struct specialRealValue_s { char *string; size_t length; long dv; } specialRealValue[] = { #define SRV_SET(foo, val) { foo, sizeof(foo) - 1, val } SRV_SET("", 0), SRV_SET("", -1), SRV_SET("", 1), #undef SRV_SET }; ssize_t REAL__dump(double d, int canonical, asn_app_consume_bytes_f *cb, void *app_key) { char local_buf[64]; char *buf = local_buf; ssize_t buflen = sizeof(local_buf); const char *fmt = canonical?"%.15E":"%.15f"; ssize_t ret; /* * Check whether it is a special value. */ /* fpclassify(3) is not portable yet */ if(isnan(d)) { buf = specialRealValue[SRV__NOT_A_NUMBER].string; buflen = specialRealValue[SRV__NOT_A_NUMBER].length; return (cb(buf, buflen, app_key) < 0) ? -1 : buflen; } else if(!_asn_isfinite(d)) { if(copysign(1.0, d) < 0.0) { buf = specialRealValue[SRV__MINUS_INFINITY].string; buflen = specialRealValue[SRV__MINUS_INFINITY].length; } else { buf = specialRealValue[SRV__PLUS_INFINITY].string; buflen = specialRealValue[SRV__PLUS_INFINITY].length; } return (cb(buf, buflen, app_key) < 0) ? -1 : buflen; } else if(ilogb(d) <= -INT_MAX) { if(copysign(1.0, d) < 0.0) { buf = "-0"; buflen = 2; } else { buf = "0"; buflen = 1; } return (cb(buf, buflen, app_key) < 0) ? -1 : buflen; } /* * Use the libc's double printing, hopefully they got it right. */ do { ret = snprintf(buf, buflen, fmt, d); if(ret < 0) { buflen <<= 1; } else if(ret >= buflen) { buflen = ret + 1; } else { buflen = ret; break; } if(buf != local_buf) FREEMEM(buf); buf = (char *)MALLOC(buflen); if(!buf) return -1; } while(1); if(canonical) { /* * Transform the "[-]d.dddE+-dd" output into "[-]d.dddE[-]d" * Check that snprintf() constructed the output correctly. */ char *dot; char *end = buf + buflen; char *last_zero; char *prev_zero; char *s; enum { LZSTATE_NOTHING, LZSTATE_SEEN_ZERO } lz_state = LZSTATE_NOTHING; dot = (buf[0] == 0x2d /* '-' */) ? (buf + 2) : (buf + 1); if(*dot >= 0x30) { if(buf != local_buf) FREEMEM(buf); errno = EINVAL; return -1; /* Not a dot, really */ } *dot = 0x2e; /* Replace possible comma */ for(prev_zero = last_zero = s = dot + 2; s < end; s++) { switch(*s) { case 0x45: /* 'E' */ if(lz_state == LZSTATE_SEEN_ZERO) last_zero = prev_zero; break; case 0x30: /* '0' */ if(lz_state == LZSTATE_NOTHING) prev_zero = s; lz_state = LZSTATE_SEEN_ZERO; continue; default: lz_state = LZSTATE_NOTHING; continue; } break; } if(s == end) { if(buf != local_buf) FREEMEM(buf); errno = EINVAL; return -1; /* No promised E */ } assert(*s == 0x45); { char *E = s; char *expptr = ++E; char *s = expptr; int sign; if(*expptr == 0x2b /* '+' */) { /* Skip the "+" */ buflen -= 1; sign = 0; } else { sign = 1; s++; } expptr++; if(expptr > end) { if(buf != local_buf) FREEMEM(buf); errno = EINVAL; return -1; } if(*expptr == 0x30) { buflen--; expptr++; } if(*last_zero == 0x30) { *last_zero = 0x45; /* E */ buflen -= s - (last_zero + 1); s = last_zero + 1; if(sign) { *s++ = 0x2d /* '-' */; buflen++; } } for(; expptr <= end; s++, expptr++) *s = *expptr; } } else { /* * Remove trailing zeros. */ char *end = buf + buflen; char *last_zero = end; int stoplooking = 0; char *z; for(z = end - 1; z > buf; z--) { switch(*z) { case 0x30: if(!stoplooking) last_zero = z; continue; case 0x31: case 0x32: case 0x33: case 0x34: case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: stoplooking = 1; continue; default: /* Catch dot and other separators */ /* * Replace possible comma (which may even * be not a comma at all: locale-defined). */ *z = 0x2e; if(last_zero == z + 1) { /* leave x.0 */ last_zero++; } buflen = last_zero - buf; *last_zero = '\0'; break; } break; } } ret = cb(buf, buflen, app_key); if(buf != local_buf) FREEMEM(buf); return (ret < 0) ? -1 : buflen; } int REAL_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { const REAL_t *st = (const REAL_t *)sptr; ssize_t ret; double d; (void)td; /* Unused argument */ (void)ilevel; /* Unused argument */ if(!st || !st->buf) ret = cb("", 8, app_key); else if(asn_REAL2double(st, &d)) ret = cb("", 7, app_key); else ret = REAL__dump(d, 0, cb, app_key); return (ret < 0) ? -1 : 0; } asn_enc_rval_t REAL_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { REAL_t *st = (REAL_t *)sptr; asn_enc_rval_t er; double d; (void)ilevel; if(!st || !st->buf || asn_REAL2double(st, &d)) ASN__ENCODE_FAILED; er.encoded = REAL__dump(d, flags & XER_F_CANONICAL, cb, app_key); if(er.encoded < 0) ASN__ENCODE_FAILED; ASN__ENCODED_OK(er); } /* * Decode the chunk of XML text encoding REAL. */ static enum xer_pbd_rval REAL__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chunk_buf, size_t chunk_size) { REAL_t *st = (REAL_t *)sptr; double value; const char *xerdata = (const char *)chunk_buf; char *endptr = 0; char *b; (void)td; if(!chunk_size) return XPBD_BROKEN_ENCODING; /* * Decode an XMLSpecialRealValue: , etc. */ if(xerdata[0] == 0x3c /* '<' */) { size_t i; for(i = 0; i < sizeof(specialRealValue) / sizeof(specialRealValue[0]); i++) { struct specialRealValue_s *srv = &specialRealValue[i]; double dv; if(srv->length != chunk_size || memcmp(srv->string, chunk_buf, chunk_size)) continue; /* * It could've been done using * (double)srv->dv / real_zero, * but it summons fp exception on some platforms. */ switch(srv->dv) { case -1: dv = - INFINITY; break; case 0: dv = NAN; break; case 1: dv = INFINITY; break; default: return XPBD_SYSTEM_FAILURE; } if(asn_double2REAL(st, dv)) return XPBD_SYSTEM_FAILURE; return XPBD_BODY_CONSUMED; } ASN_DEBUG("Unknown XMLSpecialRealValue"); return XPBD_BROKEN_ENCODING; } /* * Copy chunk into the nul-terminated string, and run strtod. */ b = (char *)MALLOC(chunk_size + 1); if(!b) return XPBD_SYSTEM_FAILURE; memcpy(b, chunk_buf, chunk_size); b[chunk_size] = 0; /* nul-terminate */ value = strtod(b, &endptr); FREEMEM(b); if(endptr == b) return XPBD_BROKEN_ENCODING; if(asn_double2REAL(st, value)) return XPBD_SYSTEM_FAILURE; return XPBD_BODY_CONSUMED; } asn_dec_rval_t REAL_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, const char *opt_mname, const void *buf_ptr, size_t size) { return xer_decode_primitive(opt_codec_ctx, td, sptr, sizeof(REAL_t), opt_mname, buf_ptr, size, REAL__xer_body_decode); } asn_dec_rval_t REAL_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { (void)constraints; /* No PER visible constraints */ return OCTET_STRING_decode_uper(opt_codec_ctx, td, 0, sptr, pd); } asn_enc_rval_t REAL_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { (void)constraints; /* No PER visible constraints */ return OCTET_STRING_encode_uper(td, 0, sptr, po); } int asn_REAL2double(const REAL_t *st, double *dbl_value) { unsigned int octv; if(!st || !st->buf) { errno = EINVAL; return -1; } if(st->size == 0) { *dbl_value = 0; return 0; } octv = st->buf[0]; /* unsigned byte */ switch(octv & 0xC0) { case 0x40: /* X.690: 8.5.6 a) => 8.5.9 */ /* "SpecialRealValue" */ /* Be liberal in what you accept... * http://en.wikipedia.org/wiki/Robustness_principle if(st->size != 1) ... */ switch(st->buf[0]) { case 0x40: /* 01000000: PLUS-INFINITY */ *dbl_value = INFINITY; return 0; case 0x41: /* 01000001: MINUS-INFINITY */ *dbl_value = - INFINITY; return 0; case 0x42: /* 01000010: NOT-A-NUMBER */ *dbl_value = NAN; return 0; case 0x43: /* 01000011: minus zero */ *dbl_value = -0.0; return 0; } errno = EINVAL; return -1; case 0x00: { /* X.690: 8.5.7 */ /* * Decimal. NR{1,2,3} format from ISO 6093. * NR1: [ ]*[+-]?[0-9]+ * NR2: [ ]*[+-]?([0-9]+\.[0-9]*|[0-9]*\.[0-9]+) * NR3: [ ]*[+-]?([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)[Ee][+-]?[0-9]+ */ double d; char *buf; char *endptr; int used_malloc = 0; if(octv == 0 || (octv & 0x3C)) { /* Remaining values of bits 6 to 1 are Reserved. */ errno = EINVAL; return -1; } /* 1. By contract, an input buffer should be null-terminated. * OCTET STRING decoder ensures that, as is asn_double2REAL(). * 2. ISO 6093 specifies COMMA as a possible decimal separator. * However, strtod() can't always deal with COMMA. * So her we fix both by reallocating, copying and fixing. */ if(st->buf[st->size] || memchr(st->buf, ',', st->size)) { uint8_t *p, *end; char *b; if(st->size > 100) { /* Avoid malicious stack overflow in alloca() */ buf = (char *)MALLOC(st->size); if(!buf) return -1; used_malloc = 1; } else { buf = alloca(st->size); } b = buf; /* Copy without the first byte and with 0-termination */ for(p = st->buf + 1, end = st->buf + st->size; p < end; b++, p++) *b = (*p == ',') ? '.' : *p; *b = '\0'; } else { buf = (char *)&st->buf[1]; } endptr = buf; d = strtod(buf, &endptr); if(*endptr != '\0') { /* Format is not consistent with ISO 6093 */ if(used_malloc) FREEMEM(buf); errno = EINVAL; return -1; } if(used_malloc) FREEMEM(buf); if(_asn_isfinite(d)) { *dbl_value = d; return 0; } else { errno = ERANGE; return -1; } } } /* * Binary representation. */ { double m; int expval; /* exponent value */ unsigned int elen; /* exponent value length, in octets */ unsigned int scaleF; unsigned int baseF; uint8_t *ptr; uint8_t *end; int sign; switch((octv & 0x30) >> 4) { case 0x00: baseF = 1; break; /* base 2 */ case 0x01: baseF = 3; break; /* base 8 */ case 0x02: baseF = 4; break; /* base 16 */ default: /* Reserved field, can't parse now. */ errno = EINVAL; return -1; } sign = (octv & 0x40); /* bit 7 */ scaleF = (octv & 0x0C) >> 2; /* bits 4 to 3 */ if(st->size <= (int)(1 + (octv & 0x03))) { errno = EINVAL; return -1; } elen = (octv & 0x03); /* bits 2 to 1; 8.5.6.4 */ if(elen == 0x03) { /* bits 2 to 1 = 11; 8.5.6.4, case d) */ elen = st->buf[1]; /* unsigned binary number */ if(elen == 0 || st->size <= (int)(2 + elen)) { errno = EINVAL; return -1; } /* FIXME: verify constraints of case d) */ ptr = &st->buf[2]; } else { ptr = &st->buf[1]; } /* Fetch the multibyte exponent */ expval = (int)(*(int8_t *)ptr); end = ptr + elen + 1; for(ptr++; ptr < end; ptr++) expval = (expval * 256) + *ptr; m = 0.0; /* Initial mantissa value */ /* Okay, the exponent is here. Now, what about mantissa? */ end = st->buf + st->size; for(; ptr < end; ptr++) m = ldexp(m, 8) + *ptr; if(0) ASN_DEBUG("m=%.10f, scF=%d, bF=%d, expval=%d, ldexp()=%f, ldexp()=%f\n", m, scaleF, baseF, expval, ldexp(m, expval * baseF + scaleF), ldexp(m, scaleF) * pow(pow(2, baseF), expval) ); /* * (S * N * 2^F) * B^E * Essentially: m = ldexp(m, scaleF) * pow(pow(2, base), expval); */ m = ldexp(m, expval * baseF + scaleF); if(_asn_isfinite(m)) { *dbl_value = sign ? -m : m; } else { errno = ERANGE; return -1; } } /* if(binary_format) */ return 0; } /* * Assume IEEE 754 floating point: standard 64 bit double. * [1 bit sign] [11 bits exponent] [52 bits mantissa] */ int asn_double2REAL(REAL_t *st, double dbl_value) { #ifdef WORDS_BIGENDIAN /* Known to be big-endian */ int littleEndian = 0; #else /* need to test: have no explicit information */ unsigned int LE = 1; int littleEndian = *(unsigned char *)&LE; #endif uint8_t buf[16]; /* More than enough for 8-byte dbl_value */ uint8_t dscr[sizeof(dbl_value)]; /* double value scratch pad */ /* Assertion guards: won't even compile, if unexpected double size */ char assertion_buffer1[9 - sizeof(dbl_value)] GCC_NOTUSED; char assertion_buffer2[sizeof(dbl_value) - 7] GCC_NOTUSED; uint8_t *ptr = buf; uint8_t *mstop; /* Last byte of mantissa */ unsigned int mval; /* Value of the last byte of mantissa */ unsigned int bmsign; /* binary mask with sign */ unsigned int buflen; unsigned int accum; int expval; if(!st) { errno = EINVAL; return -1; } /* * ilogb(+-0) returns -INT_MAX or INT_MIN (platform-dependent) * ilogb(+-inf) returns INT_MAX, logb(+-inf) returns +inf * ilogb(NaN) returns INT_MIN or INT_MAX (platform-dependent) */ expval = ilogb(dbl_value); if(expval <= -INT_MAX /* Also catches +-0 and maybe isnan() */ || expval == INT_MAX /* catches isfin() and maybe isnan() */ ) { if(!st->buf || st->size < 2) { ptr = (uint8_t *)MALLOC(2); if(!ptr) return -1; st->buf = ptr; } /* fpclassify(3) is not portable yet */ if(isnan(dbl_value)) { st->buf[0] = 0x42; /* NaN */ st->buf[1] = 0; st->size = 1; } else if(!_asn_isfinite(dbl_value)) { if(copysign(1.0, dbl_value) < 0.0) { st->buf[0] = 0x41; /* MINUS-INFINITY */ } else { st->buf[0] = 0x40; /* PLUS-INFINITY */ } st->buf[1] = 0; st->size = 1; } else { if(copysign(1.0, dbl_value) >= 0.0) { /* no content octets: positive zero */ st->buf[0] = 0; /* JIC */ st->size = 0; } else { /* Negative zero. #8.5.3, 8.5.9 */ st->buf[0] = 0x43; st->size = 1; } } return 0; } if(littleEndian) { uint8_t *s = ((uint8_t *)&dbl_value) + sizeof(dbl_value) - 2; uint8_t *start = ((uint8_t *)&dbl_value); uint8_t *d; bmsign = 0x80 | ((s[1] >> 1) & 0x40); /* binary mask & - */ for(mstop = d = dscr; s >= start; d++, s--) { *d = *s; if(*d) mstop = d; } } else { uint8_t *s = ((uint8_t *)&dbl_value) + 1; uint8_t *end = ((uint8_t *)&dbl_value) + sizeof(double); uint8_t *d; bmsign = 0x80 | ((s[-1] >> 1) & 0x40); /* binary mask & - */ for(mstop = d = dscr; s < end; d++, s++) { *d = *s; if(*d) mstop = d; } } /* Remove parts of the exponent, leave mantissa and explicit 1. */ dscr[0] = 0x10 | (dscr[0] & 0x0f); /* Adjust exponent in a very unobvious way */ expval -= 8 * ((mstop - dscr) + 1) - 4; /* This loop ensures DER conformance by forcing mantissa odd: 11.3.1 */ mval = *mstop; if(mval && !(mval & 1)) { unsigned int shift_count = 1; unsigned int ishift; uint8_t *mptr; /* * Figure out what needs to be done to make mantissa odd. */ if(!(mval & 0x0f)) /* Speed-up a little */ shift_count = 4; while(((mval >> shift_count) & 1) == 0) shift_count++; ishift = 8 - shift_count; accum = 0; /* Go over the buffer, shifting it shift_count bits right. */ for(mptr = dscr; mptr <= mstop; mptr++) { mval = *mptr; *mptr = accum | (mval >> shift_count); accum = mval << ishift; } /* Adjust exponent appropriately. */ expval += shift_count; } if(expval < 0) { if((expval >> 7) == -1) { *ptr++ = bmsign | 0x00; *ptr++ = expval; } else if((expval >> 15) == -1) { *ptr++ = bmsign | 0x01; *ptr++ = expval >> 8; *ptr++ = expval; } else { *ptr++ = bmsign | 0x02; *ptr++ = expval >> 16; *ptr++ = expval >> 8; *ptr++ = expval; } } else if(expval <= 0x7f) { *ptr++ = bmsign | 0x00; *ptr++ = expval; } else if(expval <= 0x7fff) { *ptr++ = bmsign | 0x01; *ptr++ = expval >> 8; *ptr++ = expval; } else { assert(expval <= 0x7fffff); *ptr++ = bmsign | 0x02; *ptr++ = expval >> 16; *ptr++ = expval >> 8; *ptr++ = expval; } buflen = (mstop - dscr) + 1; memcpy(ptr, dscr, buflen); ptr += buflen; buflen = ptr - buf; ptr = (uint8_t *)MALLOC(buflen + 1); if(!ptr) return -1; memcpy(ptr, buf, buflen); buf[buflen] = 0; /* JIC */ if(st->buf) FREEMEM(st->buf); st->buf = ptr; st->size = buflen; return 0; } asn1c-0.9.28+dfsg/skeletons/ber_tlv_length.h0000644000000000000000000000277513065714043017430 0ustar rootroot/*- * Copyright (c) 2003 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef _BER_TLV_LENGTH_H_ #define _BER_TLV_LENGTH_H_ #ifdef __cplusplus extern "C" { #endif typedef ssize_t ber_tlv_len_t; /* * This function tries to fetch the length of the BER TLV value and place it * in *len_r. * RETURN VALUES: * 0: More data expected than bufptr contains. * -1: Fatal error deciphering length. * >0: Number of bytes used from bufptr. * On return with >0, len_r is constrained as -1..MAX, where -1 mean * that the value is of indefinite length. */ ssize_t ber_fetch_length(int _is_constructed, const void *bufptr, size_t size, ber_tlv_len_t *len_r); /* * This function expects bufptr to be positioned over L in TLV. * It returns number of bytes occupied by L and V together, suitable * for skipping. The function properly handles indefinite length. * RETURN VALUES: * Standard {-1,0,>0} convention. */ ssize_t ber_skip_length( struct asn_codec_ctx_s *opt_codec_ctx, /* optional context */ int _is_constructed, const void *bufptr, size_t size); /* * This function serializes the length (L from TLV) in DER format. * It always returns number of bytes necessary to represent the length, * it is a caller's responsibility to check the return value * against the supplied buffer's size. */ size_t der_tlv_length_serialize(ber_tlv_len_t len, void *bufptr, size_t size); #ifdef __cplusplus } #endif #endif /* _BER_TLV_LENGTH_H_ */ asn1c-0.9.28+dfsg/skeletons/constr_SET.c0000644000000000000000000005706313065714043016450 0ustar rootroot/*- * Copyright (c) 2003, 2004, 2005, 2006 Lev Walkin . * All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #include #include /* Check that all the mandatory members are present */ static int _SET_is_populated(asn_TYPE_descriptor_t *td, void *st); /* * Number of bytes left for this structure. * (ctx->left) indicates the number of bytes _transferred_ for the structure. * (size) contains the number of bytes in the buffer passed. */ #define LEFT ((size<(size_t)ctx->left)?size:(size_t)ctx->left) /* * If the subprocessor function returns with an indication that it wants * more data, it may well be a fatal decoding problem, because the * size is constrained by the 's L, even if the buffer size allows * reading more data. * For example, consider the buffer containing the following TLVs: * ... * The TLV length clearly indicates that one byte is expected in V, but * if the V processor returns with "want more data" even if the buffer * contains way more data than the V processor have seen. */ #define SIZE_VIOLATION (ctx->left >= 0 && (size_t)ctx->left <= size) /* * This macro "eats" the part of the buffer which is definitely "consumed", * i.e. was correctly converted into local representation or rightfully skipped. */ #undef ADVANCE #define ADVANCE(num_bytes) do { \ size_t num = num_bytes; \ ptr = ((const char *)ptr) + num;\ size -= num; \ if(ctx->left >= 0) \ ctx->left -= num; \ consumed_myself += num; \ } while(0) /* * Switch to the next phase of parsing. */ #undef NEXT_PHASE #define NEXT_PHASE(ctx) do { \ ctx->phase++; \ ctx->step = 0; \ } while(0) /* * Return a standardized complex structure. */ #undef RETURN #define RETURN(_code) do { \ rval.code = _code; \ rval.consumed = consumed_myself;\ return rval; \ } while(0) /* * Tags are canonically sorted in the tag2element map. */ static int _t2e_cmp(const void *ap, const void *bp) { const asn_TYPE_tag2member_t *a = (const asn_TYPE_tag2member_t *)ap; const asn_TYPE_tag2member_t *b = (const asn_TYPE_tag2member_t *)bp; int a_class = BER_TAG_CLASS(a->el_tag); int b_class = BER_TAG_CLASS(b->el_tag); if(a_class == b_class) { ber_tlv_tag_t a_value = BER_TAG_VALUE(a->el_tag); ber_tlv_tag_t b_value = BER_TAG_VALUE(b->el_tag); if(a_value == b_value) return 0; else if(a_value < b_value) return -1; else return 1; } else if(a_class < b_class) { return -1; } else { return 1; } } /* * The decoder of the SET type. */ asn_dec_rval_t SET_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **struct_ptr, const void *ptr, size_t size, int tag_mode) { /* * Bring closer parts of structure description. */ asn_SET_specifics_t *specs = (asn_SET_specifics_t *)td->specifics; asn_TYPE_member_t *elements = td->elements; /* * Parts of the structure being constructed. */ void *st = *struct_ptr; /* Target structure. */ asn_struct_ctx_t *ctx; /* Decoder context */ ber_tlv_tag_t tlv_tag; /* T from TLV */ asn_dec_rval_t rval; /* Return code from subparsers */ ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ int edx; /* SET element's index */ ASN_DEBUG("Decoding %s as SET", td->name); if(ASN__STACK_OVERFLOW_CHECK(opt_codec_ctx)) ASN__DECODE_FAILED; /* * Create the target structure if it is not present already. */ if(st == 0) { st = *struct_ptr = CALLOC(1, specs->struct_size); if(st == 0) { RETURN(RC_FAIL); } } /* * Restore parsing context. */ ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); /* * Start to parse where left previously */ switch(ctx->phase) { case 0: /* * PHASE 0. * Check that the set of tags associated with given structure * perfectly fits our expectations. */ rval = ber_check_tags(opt_codec_ctx, td, ctx, ptr, size, tag_mode, 1, &ctx->left, 0); if(rval.code != RC_OK) { ASN_DEBUG("%s tagging check failed: %d", td->name, rval.code); return rval; } if(ctx->left >= 0) ctx->left += rval.consumed; /* ?Substracted below! */ ADVANCE(rval.consumed); NEXT_PHASE(ctx); ASN_DEBUG("Structure advertised %ld bytes, " "buffer contains %ld", (long)ctx->left, (long)size); /* Fall through */ case 1: /* * PHASE 1. * From the place where we've left it previously, * try to decode the next member from the list of * this structure's elements. * Note that elements in BER may arrive out of * order, yet DER mandates that they shall arive in the * canonical order of their tags. So, there is a room * for optimization. */ for(;; ctx->step = 0) { const asn_TYPE_tag2member_t *t2m; asn_TYPE_tag2member_t key; void *memb_ptr; /* Pointer to the member */ void **memb_ptr2; /* Pointer to that pointer */ ssize_t tag_len; /* Length of TLV's T */ if(ctx->step & 1) { edx = ctx->step >> 1; goto microphase2; } /* * MICROPHASE 1: Synchronize decoding. */ if(ctx->left == 0) /* * No more things to decode. * Exit out of here and check whether all mandatory * elements have been received (in the next phase). */ break; /* * Fetch the T from TLV. */ tag_len = ber_fetch_tag(ptr, LEFT, &tlv_tag); switch(tag_len) { case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); /* Fall through */ case -1: RETURN(RC_FAIL); } if(ctx->left < 0 && ((const uint8_t *)ptr)[0] == 0) { if(LEFT < 2) { if(SIZE_VIOLATION) RETURN(RC_FAIL); else RETURN(RC_WMORE); } else if(((const uint8_t *)ptr)[1] == 0) { /* * Found the terminator of the * indefinite length structure. * Invoke the generic finalization function. */ goto phase3; } } key.el_tag = tlv_tag; t2m = (const asn_TYPE_tag2member_t *)bsearch(&key, specs->tag2el, specs->tag2el_count, sizeof(specs->tag2el[0]), _t2e_cmp); if(t2m) { /* * Found the element corresponding to the tag. */ edx = t2m->el_no; ctx->step = (edx << 1) + 1; ASN_DEBUG("Got tag %s (%s), edx %d", ber_tlv_tag_string(tlv_tag), td->name, edx); } else if(specs->extensible == 0) { ASN_DEBUG("Unexpected tag %s " "in non-extensible SET %s", ber_tlv_tag_string(tlv_tag), td->name); RETURN(RC_FAIL); } else { /* Skip this tag */ ssize_t skip; ASN_DEBUG("Skipping unknown tag %s", ber_tlv_tag_string(tlv_tag)); skip = ber_skip_length(opt_codec_ctx, BER_TLV_CONSTRUCTED(ptr), (const char *)ptr + tag_len, LEFT - tag_len); switch(skip) { case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); /* Fall through */ case -1: RETURN(RC_FAIL); } ADVANCE(skip + tag_len); continue; /* Try again with the next tag */ } /* * MICROPHASE 2: Invoke the member-specific decoder. */ microphase2: /* * Check for duplications: must not overwrite * already decoded elements. */ if(ASN_SET_ISPRESENT2((char *)st + specs->pres_offset, edx)) { ASN_DEBUG("SET %s: Duplicate element %s (%d)", td->name, elements[edx].name, edx); RETURN(RC_FAIL); } /* * Compute the position of the member inside a structure, * and also a type of containment (it may be contained * as pointer or using inline inclusion). */ if(elements[edx].flags & ATF_POINTER) { /* Member is a pointer to another structure */ memb_ptr2 = (void **)((char *)st + elements[edx].memb_offset); } else { /* * A pointer to a pointer * holding the start of the structure */ memb_ptr = (char *)st + elements[edx].memb_offset; memb_ptr2 = &memb_ptr; } /* * Invoke the member fetch routine according to member's type */ rval = elements[edx].type->ber_decoder(opt_codec_ctx, elements[edx].type, memb_ptr2, ptr, LEFT, elements[edx].tag_mode); switch(rval.code) { case RC_OK: ASN_SET_MKPRESENT((char *)st + specs->pres_offset, edx); break; case RC_WMORE: /* More data expected */ if(!SIZE_VIOLATION) { ADVANCE(rval.consumed); RETURN(RC_WMORE); } /* Fail through */ case RC_FAIL: /* Fatal error */ RETURN(RC_FAIL); } /* switch(rval) */ ADVANCE(rval.consumed); } /* for(all structure members) */ phase3: ctx->phase = 3; /* Fall through */ case 3: case 4: /* Only 00 is expected */ ASN_DEBUG("SET %s Leftover: %ld, size = %ld", td->name, (long)ctx->left, (long)size); /* * Skip everything until the end of the SET. */ while(ctx->left) { ssize_t tl, ll; tl = ber_fetch_tag(ptr, LEFT, &tlv_tag); switch(tl) { case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); /* Fall through */ case -1: RETURN(RC_FAIL); } /* * If expected <0><0>... */ if(ctx->left < 0 && ((const uint8_t *)ptr)[0] == 0) { if(LEFT < 2) { if(SIZE_VIOLATION) RETURN(RC_FAIL); else RETURN(RC_WMORE); } else if(((const uint8_t *)ptr)[1] == 0) { /* * Correctly finished with <0><0>. */ ADVANCE(2); ctx->left++; ctx->phase = 4; continue; } } if(specs->extensible == 0 || ctx->phase == 4) { ASN_DEBUG("Unexpected continuation " "of a non-extensible type %s " "(ptr=%02x)", td->name, *(const uint8_t *)ptr); RETURN(RC_FAIL); } ll = ber_skip_length(opt_codec_ctx, BER_TLV_CONSTRUCTED(ptr), (const char *)ptr + tl, LEFT - tl); switch(ll) { case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); /* Fall through */ case -1: RETURN(RC_FAIL); } ADVANCE(tl + ll); } ctx->phase = 5; case 5: /* Check that all mandatory elements are present. */ if(!_SET_is_populated(td, st)) RETURN(RC_FAIL); NEXT_PHASE(ctx); } RETURN(RC_OK); } static int _SET_is_populated(asn_TYPE_descriptor_t *td, void *st) { asn_SET_specifics_t *specs = (asn_SET_specifics_t *)td->specifics; int edx; /* * Check that all mandatory elements are present. */ for(edx = 0; edx < td->elements_count; edx += (8 * sizeof(specs->_mandatory_elements[0]))) { unsigned int midx, pres, must; midx = edx/(8 * sizeof(specs->_mandatory_elements[0])); pres = ((unsigned int *)((char *)st + specs->pres_offset))[midx]; must = sys_ntohl(specs->_mandatory_elements[midx]); if((pres & must) == must) { /* * Yes, everything seems to be in place. */ } else { ASN_DEBUG("One or more mandatory elements " "of a SET %s %d (%08x.%08x)=%08x " "are not present", td->name, midx, pres, must, (~(pres & must) & must) ); return 0; } } return 1; } /* * The DER encoder of the SET type. */ asn_enc_rval_t SET_encode_der(asn_TYPE_descriptor_t *td, void *sptr, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { asn_SET_specifics_t *specs = (asn_SET_specifics_t *)td->specifics; size_t computed_size = 0; asn_enc_rval_t er; int t2m_build_own = (specs->tag2el_count != td->elements_count); const asn_TYPE_tag2member_t *t2m; asn_TYPE_tag2member_t *t2m_build; int t2m_count; ssize_t ret; int edx; /* * Use existing, or build our own tags map. */ if(t2m_build_own) { t2m_build = (asn_TYPE_tag2member_t *)alloca( td->elements_count * sizeof(t2m_build[0])); if(!t2m_build) ASN__ENCODE_FAILED; /* There are such platforms */ t2m_count = 0; } else { t2m_build = NULL; /* * There is no untagged CHOICE in this SET. * Employ existing table. */ } /* * Gather the length of the underlying members sequence. */ for(edx = 0; edx < td->elements_count; edx++) { asn_TYPE_member_t *elm = &td->elements[edx]; asn_enc_rval_t tmper; void *memb_ptr; /* * Compute the length of the encoding of this member. */ if(elm->flags & ATF_POINTER) { memb_ptr = *(void **)((char *)sptr + elm->memb_offset); if(!memb_ptr) { if(!elm->optional) /* Mandatory elements missing */ ASN__ENCODE_FAILED; if(t2m_build_own) { t2m_build[t2m_count].el_no = edx; t2m_build[t2m_count].el_tag = 0; t2m_count++; } continue; } } else { memb_ptr = (void *)((char *)sptr + elm->memb_offset); } tmper = elm->type->der_encoder(elm->type, memb_ptr, elm->tag_mode, elm->tag, 0, 0); if(tmper.encoded == -1) return tmper; computed_size += tmper.encoded; /* * Remember the outmost tag of this member. */ if(t2m_build_own) { t2m_build[t2m_count].el_no = edx; t2m_build[t2m_count].el_tag = asn_TYPE_outmost_tag( elm->type, memb_ptr, elm->tag_mode, elm->tag); t2m_count++; } else { /* * No dynamic sorting is necessary. */ } } /* * Finalize order of the components. */ if(t2m_build_own) { /* * Sort the underlying members according to their * canonical tags order. DER encoding mandates it. */ qsort(t2m_build, t2m_count, sizeof(specs->tag2el[0]), _t2e_cmp); t2m = t2m_build; } else { /* * Tags are already sorted by the compiler. */ t2m = specs->tag2el; t2m_count = specs->tag2el_count; } assert(t2m_count == td->elements_count); /* * Encode the TLV for the sequence itself. */ ret = der_write_tags(td, computed_size, tag_mode, 1, tag, cb, app_key); if(ret == -1) ASN__ENCODE_FAILED; er.encoded = computed_size + ret; if(!cb) ASN__ENCODED_OK(er); /* * Encode all members. */ for(edx = 0; edx < td->elements_count; edx++) { asn_TYPE_member_t *elm; asn_enc_rval_t tmper; void *memb_ptr; /* Encode according to the tag order */ elm = &td->elements[t2m[edx].el_no]; if(elm->flags & ATF_POINTER) { memb_ptr = *(void **)((char *)sptr + elm->memb_offset); if(!memb_ptr) continue; } else { memb_ptr = (void *)((char *)sptr + elm->memb_offset); } tmper = elm->type->der_encoder(elm->type, memb_ptr, elm->tag_mode, elm->tag, cb, app_key); if(tmper.encoded == -1) return tmper; computed_size -= tmper.encoded; } if(computed_size != 0) { /* * Encoded size is not equal to the computed size. */ ASN__ENCODE_FAILED; } ASN__ENCODED_OK(er); } #undef XER_ADVANCE #define XER_ADVANCE(num_bytes) do { \ size_t num = num_bytes; \ buf_ptr = ((const char *)buf_ptr) + num;\ size -= num; \ consumed_myself += num; \ } while(0) /* * Decode the XER (XML) data. */ asn_dec_rval_t SET_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **struct_ptr, const char *opt_mname, const void *buf_ptr, size_t size) { /* * Bring closer parts of structure description. */ asn_SET_specifics_t *specs = (asn_SET_specifics_t *)td->specifics; asn_TYPE_member_t *elements = td->elements; const char *xml_tag = opt_mname ? opt_mname : td->xml_tag; /* * ... and parts of the structure being constructed. */ void *st = *struct_ptr; /* Target structure. */ asn_struct_ctx_t *ctx; /* Decoder context */ asn_dec_rval_t rval; /* Return value from a decoder */ ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ int edx; /* Element index */ /* * Create the target structure if it is not present already. */ if(st == 0) { st = *struct_ptr = CALLOC(1, specs->struct_size); if(st == 0) RETURN(RC_FAIL); } /* * Restore parsing context. */ ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); /* * Phases of XER/XML processing: * Phase 0: Check that the opening tag matches our expectations. * Phase 1: Processing body and reacting on closing tag. * Phase 2: Processing inner type. * Phase 3: Skipping unknown extensions. * Phase 4: PHASED OUT */ for(edx = ctx->step; ctx->phase <= 3;) { pxer_chunk_type_e ch_type; /* XER chunk type */ ssize_t ch_size; /* Chunk size */ xer_check_tag_e tcv; /* Tag check value */ asn_TYPE_member_t *elm; /* * Go inside the inner member of a set. */ if(ctx->phase == 2) { asn_dec_rval_t tmprval; void *memb_ptr; /* Pointer to the member */ void **memb_ptr2; /* Pointer to that pointer */ if(ASN_SET_ISPRESENT2((char *)st + specs->pres_offset, edx)) { ASN_DEBUG("SET %s: Duplicate element %s (%d)", td->name, elements[edx].name, edx); RETURN(RC_FAIL); } elm = &elements[edx]; if(elm->flags & ATF_POINTER) { /* Member is a pointer to another structure */ memb_ptr2 = (void **)((char *)st + elm->memb_offset); } else { memb_ptr = (char *)st + elm->memb_offset; memb_ptr2 = &memb_ptr; } /* Invoke the inner type decoder, m.b. multiple times */ tmprval = elm->type->xer_decoder(opt_codec_ctx, elm->type, memb_ptr2, elm->name, buf_ptr, size); XER_ADVANCE(tmprval.consumed); if(tmprval.code != RC_OK) RETURN(tmprval.code); ctx->phase = 1; /* Back to body processing */ ASN_SET_MKPRESENT((char *)st + specs->pres_offset, edx); ASN_DEBUG("XER/SET phase => %d", ctx->phase); /* Fall through */ } /* * Get the next part of the XML stream. */ ch_size = xer_next_token(&ctx->context, buf_ptr, size, &ch_type); if(ch_size == -1) { RETURN(RC_FAIL); } else { switch(ch_type) { case PXER_WMORE: RETURN(RC_WMORE); case PXER_COMMENT: /* Got XML comment */ case PXER_TEXT: /* Ignore free-standing text */ XER_ADVANCE(ch_size); /* Skip silently */ continue; case PXER_TAG: break; /* Check the rest down there */ } } tcv = xer_check_tag(buf_ptr, ch_size, xml_tag); ASN_DEBUG("XER/SET: tcv = %d, ph=%d", tcv, ctx->phase); /* Skip the extensions section */ if(ctx->phase == 3) { switch(xer_skip_unknown(tcv, &ctx->left)) { case -1: ctx->phase = 4; RETURN(RC_FAIL); case 1: ctx->phase = 1; /* Fall through */ case 0: XER_ADVANCE(ch_size); continue; case 2: ctx->phase = 1; break; } } switch(tcv) { case XCT_CLOSING: if(ctx->phase == 0) break; ctx->phase = 0; /* Fall through */ case XCT_BOTH: if(ctx->phase == 0) { if(_SET_is_populated(td, st)) { XER_ADVANCE(ch_size); ctx->phase = 4; /* Phase out */ RETURN(RC_OK); } else { ASN_DEBUG("Premature end of XER SET"); RETURN(RC_FAIL); } } /* Fall through */ case XCT_OPENING: if(ctx->phase == 0) { XER_ADVANCE(ch_size); ctx->phase = 1; /* Processing body phase */ continue; } /* Fall through */ case XCT_UNKNOWN_OP: case XCT_UNKNOWN_BO: ASN_DEBUG("XER/SET: tcv=%d, ph=%d", tcv, ctx->phase); if(ctx->phase != 1) break; /* Really unexpected */ /* * Search which member corresponds to this tag. */ for(edx = 0; edx < td->elements_count; edx++) { switch(xer_check_tag(buf_ptr, ch_size, elements[edx].name)) { case XCT_BOTH: case XCT_OPENING: /* * Process this member. */ ctx->step = edx; ctx->phase = 2; break; case XCT_UNKNOWN_OP: case XCT_UNKNOWN_BO: continue; default: edx = td->elements_count; break; /* Phase out */ } break; } if(edx != td->elements_count) continue; /* It is expected extension */ if(specs->extensible) { ASN_DEBUG("Got anticipated extension"); /* * Check for (XCT_BOTH or XCT_UNKNOWN_BO) * By using a mask. Only record a pure * tags. */ if(tcv & XCT_CLOSING) { /* Found without body */ } else { ctx->left = 1; ctx->phase = 3; /* Skip ...'s */ } XER_ADVANCE(ch_size); continue; } /* Fall through */ default: break; } ASN_DEBUG("Unexpected XML tag in SET, expected \"%s\"", xml_tag); break; } ctx->phase = 4; /* "Phase out" on hard failure */ RETURN(RC_FAIL); } asn_enc_rval_t SET_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { asn_SET_specifics_t *specs = (asn_SET_specifics_t *)td->specifics; asn_enc_rval_t er; int xcan = (flags & XER_F_CANONICAL); const asn_TYPE_tag2member_t *t2m = specs->tag2el_cxer; int t2m_count = specs->tag2el_cxer_count; int edx; if(!sptr) ASN__ENCODE_FAILED; assert(t2m_count == td->elements_count); er.encoded = 0; for(edx = 0; edx < t2m_count; edx++) { asn_enc_rval_t tmper; asn_TYPE_member_t *elm; void *memb_ptr; const char *mname; unsigned int mlen; elm = &td->elements[t2m[edx].el_no]; mname = elm->name; mlen = strlen(elm->name); if(elm->flags & ATF_POINTER) { memb_ptr = *(void **)((char *)sptr + elm->memb_offset); if(!memb_ptr) { if(elm->optional) continue; /* Mandatory element missing */ ASN__ENCODE_FAILED; } } else { memb_ptr = (void *)((char *)sptr + elm->memb_offset); } if(!xcan) ASN__TEXT_INDENT(1, ilevel); ASN__CALLBACK3("<", 1, mname, mlen, ">", 1); /* Print the member itself */ tmper = elm->type->xer_encoder(elm->type, memb_ptr, ilevel + 1, flags, cb, app_key); if(tmper.encoded == -1) return tmper; ASN__CALLBACK3("", 1); er.encoded += 5 + (2 * mlen) + tmper.encoded; } if(!xcan) ASN__TEXT_INDENT(1, ilevel - 1); ASN__ENCODED_OK(er); cb_failed: ASN__ENCODE_FAILED; } int SET_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { int edx; int ret; if(!sptr) return (cb("", 8, app_key) < 0) ? -1 : 0; /* Dump preamble */ if(cb(td->name, strlen(td->name), app_key) < 0 || cb(" ::= {", 6, app_key) < 0) return -1; for(edx = 0; edx < td->elements_count; edx++) { asn_TYPE_member_t *elm = &td->elements[edx]; const void *memb_ptr; if(elm->flags & ATF_POINTER) { memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset); if(!memb_ptr) { if(elm->optional) continue; /* Print line */ /* Fall through */ } } else { memb_ptr = (const void *)((const char *)sptr + elm->memb_offset); } _i_INDENT(1); /* Print the member's name and stuff */ if(cb(elm->name, strlen(elm->name), app_key) < 0 || cb(": ", 2, app_key) < 0) return -1; /* Print the member itself */ ret = elm->type->print_struct(elm->type, memb_ptr, ilevel + 1, cb, app_key); if(ret) return ret; } ilevel--; _i_INDENT(1); return (cb("}", 1, app_key) < 0) ? -1 : 0; } void SET_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) { int edx; if(!td || !ptr) return; ASN_DEBUG("Freeing %s as SET", td->name); for(edx = 0; edx < td->elements_count; edx++) { asn_TYPE_member_t *elm = &td->elements[edx]; void *memb_ptr; if(elm->flags & ATF_POINTER) { memb_ptr = *(void **)((char *)ptr + elm->memb_offset); if(memb_ptr) ASN_STRUCT_FREE(*elm->type, memb_ptr); } else { memb_ptr = (void *)((char *)ptr + elm->memb_offset); ASN_STRUCT_FREE_CONTENTS_ONLY(*elm->type, memb_ptr); } } if(!contents_only) { FREEMEM(ptr); } } int SET_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { int edx; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } /* * Iterate over structure members and check their validity. */ for(edx = 0; edx < td->elements_count; edx++) { asn_TYPE_member_t *elm = &td->elements[edx]; const void *memb_ptr; if(elm->flags & ATF_POINTER) { memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset); if(!memb_ptr) { if(elm->optional) continue; ASN__CTFAIL(app_key, td, sptr, "%s: mandatory element %s absent (%s:%d)", td->name, elm->name, __FILE__, __LINE__); return -1; } } else { memb_ptr = (const void *)((const char *)sptr + elm->memb_offset); } if(elm->memb_constraints) { int ret = elm->memb_constraints(elm->type, memb_ptr, ctfailcb, app_key); if(ret) return ret; } else { int ret = elm->type->check_constraints(elm->type, memb_ptr, ctfailcb, app_key); if(ret) return ret; /* * Cannot inherit it earlier: * need to make sure we get the updated version. */ elm->memb_constraints = elm->type->check_constraints; } } return 0; } asn1c-0.9.28+dfsg/skeletons/asn_codecs_prim.c0000644000000000000000000001643413065714043017552 0ustar rootroot/*- * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #include #include #include /* * Decode an always-primitive type. */ asn_dec_rval_t ber_decode_primitive(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, const void *buf_ptr, size_t size, int tag_mode) { ASN__PRIMITIVE_TYPE_t *st = (ASN__PRIMITIVE_TYPE_t *)*sptr; asn_dec_rval_t rval; ber_tlv_len_t length = 0; /* =0 to avoid [incorrect] warning. */ /* * If the structure is not there, allocate it. */ if(st == NULL) { st = (ASN__PRIMITIVE_TYPE_t *)CALLOC(1, sizeof(*st)); if(st == NULL) ASN__DECODE_FAILED; *sptr = (void *)st; } ASN_DEBUG("Decoding %s as plain primitive (tm=%d)", td->name, tag_mode); /* * Check tags and extract value length. */ rval = ber_check_tags(opt_codec_ctx, td, 0, buf_ptr, size, tag_mode, 0, &length, 0); if(rval.code != RC_OK) return rval; ASN_DEBUG("%s length is %d bytes", td->name, (int)length); /* * Make sure we have this length. */ buf_ptr = ((const char *)buf_ptr) + rval.consumed; size -= rval.consumed; if(length > (ber_tlv_len_t)size) { rval.code = RC_WMORE; rval.consumed = 0; return rval; } st->size = (int)length; /* The following better be optimized away. */ if(sizeof(st->size) != sizeof(length) && (ber_tlv_len_t)st->size != length) { st->size = 0; ASN__DECODE_FAILED; } st->buf = (uint8_t *)MALLOC(length + 1); if(!st->buf) { st->size = 0; ASN__DECODE_FAILED; } memcpy(st->buf, buf_ptr, length); st->buf[length] = '\0'; /* Just in case */ rval.code = RC_OK; rval.consumed += length; ASN_DEBUG("Took %ld/%ld bytes to encode %s", (long)rval.consumed, (long)length, td->name); return rval; } /* * Encode an always-primitive type using DER. */ asn_enc_rval_t der_encode_primitive(asn_TYPE_descriptor_t *td, void *sptr, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { asn_enc_rval_t erval; ASN__PRIMITIVE_TYPE_t *st = (ASN__PRIMITIVE_TYPE_t *)sptr; ASN_DEBUG("%s %s as a primitive type (tm=%d)", cb?"Encoding":"Estimating", td->name, tag_mode); erval.encoded = der_write_tags(td, st->size, tag_mode, 0, tag, cb, app_key); ASN_DEBUG("%s wrote tags %d", td->name, (int)erval.encoded); if(erval.encoded == -1) { erval.failed_type = td; erval.structure_ptr = sptr; return erval; } if(cb && st->buf) { if(cb(st->buf, st->size, app_key) < 0) { erval.encoded = -1; erval.failed_type = td; erval.structure_ptr = sptr; return erval; } } else { assert(st->buf || st->size == 0); } erval.encoded += st->size; ASN__ENCODED_OK(erval); } void ASN__PRIMITIVE_TYPE_free(asn_TYPE_descriptor_t *td, void *sptr, int contents_only) { ASN__PRIMITIVE_TYPE_t *st = (ASN__PRIMITIVE_TYPE_t *)sptr; if(!td || !sptr) return; ASN_DEBUG("Freeing %s as a primitive type", td->name); if(st->buf) FREEMEM(st->buf); if(!contents_only) FREEMEM(st); } /* * Local internal type passed around as an argument. */ struct xdp_arg_s { asn_TYPE_descriptor_t *type_descriptor; void *struct_key; xer_primitive_body_decoder_f *prim_body_decoder; int decoded_something; int want_more; }; /* * Since some kinds of primitive values can be encoded using value-specific * tags (, , etc), the primitive decoder must * be supplied with such tags to parse them as needed. */ static int xer_decode__unexpected_tag(void *key, const void *chunk_buf, size_t chunk_size) { struct xdp_arg_s *arg = (struct xdp_arg_s *)key; enum xer_pbd_rval bret; /* * The chunk_buf is guaranteed to start at '<'. */ assert(chunk_size && ((const char *)chunk_buf)[0] == 0x3c); /* * Decoding was performed once already. Prohibit doing it again. */ if(arg->decoded_something) return -1; bret = arg->prim_body_decoder(arg->type_descriptor, arg->struct_key, chunk_buf, chunk_size); switch(bret) { case XPBD_SYSTEM_FAILURE: case XPBD_DECODER_LIMIT: case XPBD_BROKEN_ENCODING: break; case XPBD_BODY_CONSUMED: /* Tag decoded successfully */ arg->decoded_something = 1; /* Fall through */ case XPBD_NOT_BODY_IGNORE: /* Safe to proceed further */ return 0; } return -1; } static ssize_t xer_decode__primitive_body(void *key, const void *chunk_buf, size_t chunk_size, int have_more) { struct xdp_arg_s *arg = (struct xdp_arg_s *)key; enum xer_pbd_rval bret; size_t lead_wsp_size; if(arg->decoded_something) { if(xer_whitespace_span(chunk_buf, chunk_size) == chunk_size) { /* * Example: * "123 " * ^- chunk_buf position. */ return chunk_size; } /* * Decoding was done once already. Prohibit doing it again. */ return -1; } if(!have_more) { /* * If we've received something like "1", we can't really * tell whether it is really `1` or `123`, until we know * that there is no more data coming. * The have_more argument will be set to 1 once something * like this is available to the caller of this callback: * "1want_more = 1; return -1; } lead_wsp_size = xer_whitespace_span(chunk_buf, chunk_size); chunk_buf = (const char *)chunk_buf + lead_wsp_size; chunk_size -= lead_wsp_size; bret = arg->prim_body_decoder(arg->type_descriptor, arg->struct_key, chunk_buf, chunk_size); switch(bret) { case XPBD_SYSTEM_FAILURE: case XPBD_DECODER_LIMIT: case XPBD_BROKEN_ENCODING: break; case XPBD_BODY_CONSUMED: /* Tag decoded successfully */ arg->decoded_something = 1; /* Fall through */ case XPBD_NOT_BODY_IGNORE: /* Safe to proceed further */ return lead_wsp_size + chunk_size; } return -1; } asn_dec_rval_t xer_decode_primitive(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, size_t struct_size, const char *opt_mname, const void *buf_ptr, size_t size, xer_primitive_body_decoder_f *prim_body_decoder ) { const char *xml_tag = opt_mname ? opt_mname : td->xml_tag; asn_struct_ctx_t s_ctx; struct xdp_arg_s s_arg; asn_dec_rval_t rc; /* * Create the structure if does not exist. */ if(!*sptr) { *sptr = CALLOC(1, struct_size); if(!*sptr) ASN__DECODE_FAILED; } memset(&s_ctx, 0, sizeof(s_ctx)); s_arg.type_descriptor = td; s_arg.struct_key = *sptr; s_arg.prim_body_decoder = prim_body_decoder; s_arg.decoded_something = 0; s_arg.want_more = 0; rc = xer_decode_general(opt_codec_ctx, &s_ctx, &s_arg, xml_tag, buf_ptr, size, xer_decode__unexpected_tag, xer_decode__primitive_body); switch(rc.code) { case RC_OK: if(!s_arg.decoded_something) { char ch; ASN_DEBUG("Primitive body is not recognized, " "supplying empty one"); /* * Decoding opportunity has come and gone. * Where's the result? * Try to feed with empty body, see if it eats it. */ if(prim_body_decoder(s_arg.type_descriptor, s_arg.struct_key, &ch, 0) != XPBD_BODY_CONSUMED) { /* * This decoder does not like empty stuff. */ ASN__DECODE_FAILED; } } break; case RC_WMORE: /* * Redo the whole thing later. * We don't have a context to save intermediate parsing state. */ rc.consumed = 0; break; case RC_FAIL: rc.consumed = 0; if(s_arg.want_more) rc.code = RC_WMORE; else ASN__DECODE_FAILED; break; } return rc; } asn1c-0.9.28+dfsg/skeletons/asn_codecs_prim.h0000644000000000000000000000313513065714043017551 0ustar rootroot/*- * Copyright (c) 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef ASN_CODECS_PRIM_H #define ASN_CODECS_PRIM_H #include #ifdef __cplusplus extern "C" { #endif typedef struct ASN__PRIMITIVE_TYPE_s { uint8_t *buf; /* Buffer with consecutive primitive encoding bytes */ int size; /* Size of the buffer */ } ASN__PRIMITIVE_TYPE_t; /* Do not use this type directly! */ asn_struct_free_f ASN__PRIMITIVE_TYPE_free; ber_type_decoder_f ber_decode_primitive; der_type_encoder_f der_encode_primitive; /* * A callback specification for the xer_decode_primitive() function below. */ enum xer_pbd_rval { XPBD_SYSTEM_FAILURE, /* System failure (memory shortage, etc) */ XPBD_DECODER_LIMIT, /* Hit some decoder limitation or deficiency */ XPBD_BROKEN_ENCODING, /* Encoding of a primitive body is broken */ XPBD_NOT_BODY_IGNORE, /* Not a body format, but safe to ignore */ XPBD_BODY_CONSUMED /* Body is recognized and consumed */ }; typedef enum xer_pbd_rval (xer_primitive_body_decoder_f) (asn_TYPE_descriptor_t *td, void *struct_ptr, const void *chunk_buf, size_t chunk_size); /* * Specific function to decode simple primitive types. * Also see xer_decode_general() in xer_decoder.h */ asn_dec_rval_t xer_decode_primitive(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *type_descriptor, void **struct_ptr, size_t struct_size, const char *opt_mname, const void *buf_ptr, size_t size, xer_primitive_body_decoder_f *prim_body_decoder ); #ifdef __cplusplus } #endif #endif /* ASN_CODECS_PRIM_H */ asn1c-0.9.28+dfsg/skeletons/per_opentype.h0000644000000000000000000000123213065714043017126 0ustar rootroot/* * Copyright (c) 2007 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef _PER_OPENTYPE_H_ #define _PER_OPENTYPE_H_ #ifdef __cplusplus extern "C" { #endif asn_dec_rval_t uper_open_type_get(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd); int uper_open_type_skip(asn_codec_ctx_t *opt_codec_ctx, asn_per_data_t *pd); int uper_open_type_put(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po); #ifdef __cplusplus } #endif #endif /* _PER_OPENTYPE_H_ */ asn1c-0.9.28+dfsg/skeletons/der_encoder.c0000644000000000000000000001175213065714043016671 0ustar rootroot/*- * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #include #include static ssize_t der_write_TL(ber_tlv_tag_t tag, ber_tlv_len_t len, asn_app_consume_bytes_f *cb, void *app_key, int constructed); /* * The DER encoder of any type. */ asn_enc_rval_t der_encode(asn_TYPE_descriptor_t *type_descriptor, void *struct_ptr, asn_app_consume_bytes_f *consume_bytes, void *app_key) { ASN_DEBUG("DER encoder invoked for %s", type_descriptor->name); /* * Invoke type-specific encoder. */ return type_descriptor->der_encoder(type_descriptor, struct_ptr, /* Pointer to the destination structure */ 0, 0, consume_bytes, app_key); } /* * Argument type and callback necessary for der_encode_to_buffer(). */ typedef struct enc_to_buf_arg { void *buffer; size_t left; } enc_to_buf_arg; static int encode_to_buffer_cb(const void *buffer, size_t size, void *key) { enc_to_buf_arg *arg = (enc_to_buf_arg *)key; if(arg->left < size) return -1; /* Data exceeds the available buffer size */ memcpy(arg->buffer, buffer, size); arg->buffer = ((char *)arg->buffer) + size; arg->left -= size; return 0; } /* * A variant of the der_encode() which encodes the data into the provided buffer */ asn_enc_rval_t der_encode_to_buffer(asn_TYPE_descriptor_t *type_descriptor, void *struct_ptr, void *buffer, size_t buffer_size) { enc_to_buf_arg arg; asn_enc_rval_t ec; arg.buffer = buffer; arg.left = buffer_size; ec = type_descriptor->der_encoder(type_descriptor, struct_ptr, /* Pointer to the destination structure */ 0, 0, encode_to_buffer_cb, &arg); if(ec.encoded != -1) { assert(ec.encoded == (ssize_t)(buffer_size - arg.left)); /* Return the encoded contents size */ } return ec; } /* * Write out leading TL[v] sequence according to the type definition. */ ssize_t der_write_tags(asn_TYPE_descriptor_t *sd, size_t struct_length, int tag_mode, int last_tag_form, ber_tlv_tag_t tag, /* EXPLICIT or IMPLICIT tag */ asn_app_consume_bytes_f *cb, void *app_key) { const ber_tlv_tag_t *tags; /* Copy of tags stream */ int tags_count; /* Number of tags */ size_t overall_length; ssize_t *lens; int i; ASN_DEBUG("Writing tags (%s, tm=%d, tc=%d, tag=%s, mtc=%d)", sd->name, tag_mode, sd->tags_count, ber_tlv_tag_string(tag), tag_mode ?(sd->tags_count+1 -((tag_mode == -1) && sd->tags_count)) :sd->tags_count ); if(tag_mode) { /* * Instead of doing shaman dance like we do in ber_check_tags(), * allocate a small array on the stack * and initialize it appropriately. */ int stag_offset; ber_tlv_tag_t *tags_buf; tags_buf = (ber_tlv_tag_t *)alloca((sd->tags_count + 1) * sizeof(ber_tlv_tag_t)); if(!tags_buf) { /* Can fail on !x86 */ errno = ENOMEM; return -1; } tags_count = sd->tags_count + 1 /* EXPLICIT or IMPLICIT tag is given */ - ((tag_mode == -1) && sd->tags_count); /* Copy tags over */ tags_buf[0] = tag; stag_offset = -1 + ((tag_mode == -1) && sd->tags_count); for(i = 1; i < tags_count; i++) tags_buf[i] = sd->tags[i + stag_offset]; tags = tags_buf; } else { tags = sd->tags; tags_count = sd->tags_count; } /* No tags to write */ if(tags_count == 0) return 0; lens = (ssize_t *)alloca(tags_count * sizeof(lens[0])); if(!lens) { errno = ENOMEM; return -1; } /* * Array of tags is initialized. * Now, compute the size of the TLV pairs, from right to left. */ overall_length = struct_length; for(i = tags_count - 1; i >= 0; --i) { lens[i] = der_write_TL(tags[i], overall_length, 0, 0, 0); if(lens[i] == -1) return -1; overall_length += lens[i]; lens[i] = overall_length - lens[i]; } if(!cb) return overall_length - struct_length; ASN_DEBUG("%s %s TL sequence (%d elements)", cb?"Encoding":"Estimating", sd->name, tags_count); /* * Encode the TL sequence for real. */ for(i = 0; i < tags_count; i++) { ssize_t len; int _constr; /* Check if this tag happens to be constructed */ _constr = (last_tag_form || i < (tags_count - 1)); len = der_write_TL(tags[i], lens[i], cb, app_key, _constr); if(len == -1) return -1; } return overall_length - struct_length; } static ssize_t der_write_TL(ber_tlv_tag_t tag, ber_tlv_len_t len, asn_app_consume_bytes_f *cb, void *app_key, int constructed) { uint8_t buf[32]; size_t size = 0; int buf_size = cb?sizeof(buf):0; ssize_t tmp; /* Serialize tag (T from TLV) into possibly zero-length buffer */ tmp = ber_tlv_tag_serialize(tag, buf, buf_size); if(tmp == -1 || tmp > (ssize_t)sizeof(buf)) return -1; size += tmp; /* Serialize length (L from TLV) into possibly zero-length buffer */ tmp = der_tlv_length_serialize(len, buf+size, buf_size?buf_size-size:0); if(tmp == -1) return -1; size += tmp; if(size > sizeof(buf)) return -1; /* * If callback is specified, invoke it, and check its return value. */ if(cb) { if(constructed) *buf |= 0x20; if(cb(buf, size, app_key) < 0) return -1; } return size; } asn1c-0.9.28+dfsg/skeletons/asn_SET_OF.c0000644000000000000000000000325213065714043016274 0ustar rootroot/*- * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #include #include #include /* * Add another element into the set. */ int asn_set_add(void *asn_set_of_x, void *ptr) { asn_anonymous_set_ *as = _A_SET_FROM_VOID(asn_set_of_x); if(as == 0 || ptr == 0) { errno = EINVAL; /* Invalid arguments */ return -1; } /* * Make sure there's enough space to insert an element. */ if(as->count == as->size) { int _newsize = as->size ? (as->size << 1) : 4; void *_new_arr; _new_arr = REALLOC(as->array, _newsize * sizeof(as->array[0])); if(_new_arr) { as->array = (void **)_new_arr; as->size = _newsize; } else { /* ENOMEM */ return -1; } } as->array[as->count++] = ptr; return 0; } void asn_set_del(void *asn_set_of_x, int number, int _do_free) { asn_anonymous_set_ *as = _A_SET_FROM_VOID(asn_set_of_x); if(as) { void *ptr; if(number < 0 || number >= as->count) return; if(_do_free && as->free) { ptr = as->array[number]; } else { ptr = 0; } as->array[number] = as->array[--as->count]; /* * Invoke the third-party function only when the state * of the parent structure is consistent. */ if(ptr) as->free(ptr); } } /* * Free the contents of the set, do not free the set itself. */ void asn_set_empty(void *asn_set_of_x) { asn_anonymous_set_ *as = _A_SET_FROM_VOID(asn_set_of_x); if(as) { if(as->array) { if(as->free) { while(as->count--) as->free(as->array[as->count]); } FREEMEM(as->array); as->array = 0; } as->count = 0; as->size = 0; } } asn1c-0.9.28+dfsg/skeletons/asn_SEQUENCE_OF.h0000644000000000000000000000273513065714043017063 0ustar rootroot/*- * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef ASN_SEQUENCE_OF_H #define ASN_SEQUENCE_OF_H #include #ifdef __cplusplus extern "C" { #endif /* * SEQUENCE OF is the same as SET OF with a tiny difference: * the delete operation preserves the initial order of elements * and thus MAY operate in non-constant time. */ #define A_SEQUENCE_OF(type) A_SET_OF(type) #define ASN_SEQUENCE_ADD(headptr, ptr) \ asn_sequence_add((headptr), (ptr)) /*********************************************** * Implementation of the SEQUENCE OF structure. */ #define asn_sequence_add asn_set_add #define asn_sequence_empty asn_set_empty /* * Delete the element from the set by its number (base 0). * This is NOT a constant-time operation. * The order of elements is preserved. * If _do_free is given AND the (*free) is initialized, the element * will be freed using the custom (*free) function as well. */ void asn_sequence_del(void *asn_sequence_of_x, int number, int _do_free); /* * Cope with different conversions requirements to/from void in C and C++. * This is mostly useful for support library. */ typedef A_SEQUENCE_OF(void) asn_anonymous_sequence_; #define _A_SEQUENCE_FROM_VOID(ptr) ((asn_anonymous_sequence_ *)(ptr)) #define _A_CSEQUENCE_FROM_VOID(ptr) ((const asn_anonymous_sequence_ *)(ptr)) #ifdef __cplusplus } #endif #endif /* ASN_SEQUENCE_OF_H */ asn1c-0.9.28+dfsg/skeletons/NumericString.h0000644000000000000000000000077613065714043017222 0ustar rootroot/*- * Copyright (c) 2003 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef _NumericString_H_ #define _NumericString_H_ #include #ifdef __cplusplus extern "C" { #endif typedef OCTET_STRING_t NumericString_t; /* Implemented via OCTET STRING */ extern asn_TYPE_descriptor_t asn_DEF_NumericString; asn_constr_check_f NumericString_constraint; #ifdef __cplusplus } #endif #endif /* _NumericString_H_ */ asn1c-0.9.28+dfsg/skeletons/BOOLEAN.h0000644000000000000000000000157313065714043015504 0ustar rootroot/*- * Copyright (c) 2003 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef _BOOLEAN_H_ #define _BOOLEAN_H_ #include #ifdef __cplusplus extern "C" { #endif /* * The underlying integer may contain various values, but everything * non-zero is capped to 0xff by the DER encoder. The BER decoder may * yield non-zero values different from 1, beware. */ typedef int BOOLEAN_t; extern asn_TYPE_descriptor_t asn_DEF_BOOLEAN; asn_struct_free_f BOOLEAN_free; asn_struct_print_f BOOLEAN_print; ber_type_decoder_f BOOLEAN_decode_ber; der_type_encoder_f BOOLEAN_encode_der; xer_type_decoder_f BOOLEAN_decode_xer; xer_type_encoder_f BOOLEAN_encode_xer; per_type_decoder_f BOOLEAN_decode_uper; per_type_encoder_f BOOLEAN_encode_uper; #ifdef __cplusplus } #endif #endif /* _BOOLEAN_H_ */ asn1c-0.9.28+dfsg/skeletons/UniversalString.c0000644000000000000000000001237413065714043017560 0ustar rootroot/*- * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #include #include #include /* * UniversalString basic type description. */ static const ber_tlv_tag_t asn_DEF_UniversalString_tags[] = { (ASN_TAG_CLASS_UNIVERSAL | (28 << 2)), /* [UNIVERSAL 28] IMPLICIT ...*/ (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */ }; static asn_OCTET_STRING_specifics_t asn_DEF_UniversalString_specs = { sizeof(UniversalString_t), offsetof(UniversalString_t, _asn_ctx), ASN_OSUBV_U32 /* 32-bits character */ }; static asn_per_constraints_t asn_DEF_UniversalString_constraints = { { APC_CONSTRAINED, 32, 32, 0, 2147483647 }, { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 }, 0, 0 }; asn_TYPE_descriptor_t asn_DEF_UniversalString = { "UniversalString", "UniversalString", OCTET_STRING_free, UniversalString_print, /* Convert into UTF8 and print */ asn_generic_no_constraint, OCTET_STRING_decode_ber, OCTET_STRING_encode_der, UniversalString_decode_xer, /* Convert from UTF-8 */ UniversalString_encode_xer, /* Convert into UTF-8 */ OCTET_STRING_decode_uper, OCTET_STRING_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_UniversalString_tags, sizeof(asn_DEF_UniversalString_tags) / sizeof(asn_DEF_UniversalString_tags[0]) - 1, asn_DEF_UniversalString_tags, sizeof(asn_DEF_UniversalString_tags) / sizeof(asn_DEF_UniversalString_tags[0]), &asn_DEF_UniversalString_constraints, 0, 0, /* No members */ &asn_DEF_UniversalString_specs }; static ssize_t UniversalString__dump(const UniversalString_t *st, asn_app_consume_bytes_f *cb, void *app_key) { char scratch[128]; /* Scratchpad buffer */ char *p = scratch; ssize_t wrote = 0; uint8_t *ch; uint8_t *end; ch = st->buf; end = (st->buf + st->size); for(end -= 3; ch < end; ch += 4) { uint32_t wc = (ch[0] << 24) | (ch[1] << 16) | (ch[2] << 8) | ch[3]; /* 4 bytes */ if(sizeof(scratch) - (p - scratch) < 6) { wrote += p - scratch; if(cb(scratch, p - scratch, app_key) < 0) return -1; p = scratch; } if(wc < 0x80) { *p++ = (char)wc; } else if(wc < 0x800) { *p++ = 0xc0 | ((wc >> 6)); *p++ = 0x80 | ((wc & 0x3f)); } else if(wc < 0x10000) { *p++ = 0xe0 | ((wc >> 12)); *p++ = 0x80 | ((wc >> 6) & 0x3f); *p++ = 0x80 | ((wc & 0x3f)); } else if(wc < 0x200000) { *p++ = 0xf0 | ((wc >> 18)); *p++ = 0x80 | ((wc >> 12) & 0x3f); *p++ = 0x80 | ((wc >> 6) & 0x3f); *p++ = 0x80 | ((wc & 0x3f)); } else if(wc < 0x4000000) { *p++ = 0xf8 | ((wc >> 24)); *p++ = 0x80 | ((wc >> 18) & 0x3f); *p++ = 0x80 | ((wc >> 12) & 0x3f); *p++ = 0x80 | ((wc >> 6) & 0x3f); *p++ = 0x80 | ((wc & 0x3f)); } else { *p++ = 0xfc | ((wc >> 30) & 0x1); *p++ = 0x80 | ((wc >> 24) & 0x3f); *p++ = 0x80 | ((wc >> 18) & 0x3f); *p++ = 0x80 | ((wc >> 12) & 0x3f); *p++ = 0x80 | ((wc >> 6) & 0x3f); *p++ = 0x80 | ((wc & 0x3f)); } } wrote += p - scratch; if(cb(scratch, p - scratch, app_key) < 0) return -1; return wrote; } asn_dec_rval_t UniversalString_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, const char *opt_mname, const void *buf_ptr, size_t size) { asn_dec_rval_t rc; rc = OCTET_STRING_decode_xer_utf8(opt_codec_ctx, td, sptr, opt_mname, buf_ptr, size); if(rc.code == RC_OK) { /* * Now we have a whole string in UTF-8 format. * Convert it into UCS-4. */ uint32_t *wcs; size_t wcs_len; UTF8String_t *st; #ifndef WORDS_BIGENDIAN int little_endian = 1; #endif assert(*sptr); st = (UTF8String_t *)*sptr; assert(st->buf); wcs_len = UTF8String_to_wcs(st, 0, 0); wcs = (uint32_t *)MALLOC(4 * (wcs_len + 1)); if(wcs == 0 || UTF8String_to_wcs(st, wcs, wcs_len) != wcs_len) { rc.code = RC_FAIL; rc.consumed = 0; return rc; } else { wcs[wcs_len] = 0; /* nul-terminate */ } #ifndef WORDS_BIGENDIAN if(*(char *)&little_endian) { /* Swap byte order in encoding */ uint32_t *wc = wcs; uint32_t *wc_end = wcs + wcs_len; for(; wc < wc_end; wc++) { /* *wc = htonl(*wc); */ uint32_t wch = *wc; *((uint8_t *)wc + 0) = wch >> 24; *((uint8_t *)wc + 1) = wch >> 16; *((uint8_t *)wc + 2) = wch >> 8; *((uint8_t *)wc + 3) = wch; } } #endif /* WORDS_BIGENDIAN */ FREEMEM(st->buf); st->buf = (uint8_t *)wcs; st->size = 4 * wcs_len; } return rc; } asn_enc_rval_t UniversalString_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { const UniversalString_t *st = (const UniversalString_t *)sptr; asn_enc_rval_t er; (void)ilevel; (void)flags; if(!st || !st->buf) ASN__ENCODE_FAILED; er.encoded = UniversalString__dump(st, cb, app_key); if(er.encoded < 0) ASN__ENCODE_FAILED; ASN__ENCODED_OK(er); } int UniversalString_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { const UniversalString_t *st = (const UniversalString_t *)sptr; (void)td; /* Unused argument */ (void)ilevel; /* Unused argument */ if(!st || !st->buf) return (cb("", 8, app_key) < 0) ? -1 : 0; if(UniversalString__dump(st, cb, app_key) < 0) return -1; return 0; } asn1c-0.9.28+dfsg/skeletons/xer_decoder.c0000644000000000000000000002120513065714043016675 0ustar rootroot/* * Copyright (c) 2004, 2005 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #include #include #include /* XER/XML parsing support */ /* * Decode the XER encoding of a given type. */ asn_dec_rval_t xer_decode(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **struct_ptr, const void *buffer, size_t size) { asn_codec_ctx_t s_codec_ctx; /* * Stack checker requires that the codec context * must be allocated on the stack. */ if(opt_codec_ctx) { if(opt_codec_ctx->max_stack_size) { s_codec_ctx = *opt_codec_ctx; opt_codec_ctx = &s_codec_ctx; } } else { /* If context is not given, be security-conscious anyway */ memset(&s_codec_ctx, 0, sizeof(s_codec_ctx)); s_codec_ctx.max_stack_size = ASN__DEFAULT_STACK_MAX; opt_codec_ctx = &s_codec_ctx; } /* * Invoke type-specific decoder. */ return td->xer_decoder(opt_codec_ctx, td, struct_ptr, 0, buffer, size); } struct xer__cb_arg { pxml_chunk_type_e chunk_type; size_t chunk_size; const void *chunk_buf; int callback_not_invoked; }; static int xer__token_cb(pxml_chunk_type_e type, const void *_chunk_data, size_t _chunk_size, void *key) { struct xer__cb_arg *arg = (struct xer__cb_arg *)key; arg->chunk_type = type; arg->chunk_size = _chunk_size; arg->chunk_buf = _chunk_data; arg->callback_not_invoked = 0; return -1; /* Terminate the XML parsing */ } /* * Fetch the next token from the XER/XML stream. */ ssize_t xer_next_token(int *stateContext, const void *buffer, size_t size, pxer_chunk_type_e *ch_type) { struct xer__cb_arg arg; int new_stateContext = *stateContext; ssize_t ret; arg.callback_not_invoked = 1; ret = pxml_parse(&new_stateContext, buffer, size, xer__token_cb, &arg); if(ret < 0) return -1; if(arg.callback_not_invoked) { assert(ret == 0); /* No data was consumed */ *ch_type = PXER_WMORE; return 0; /* Try again with more data */ } else { assert(arg.chunk_size); assert(arg.chunk_buf == buffer); } /* * Translate the XML chunk types into more convenient ones. */ switch(arg.chunk_type) { case PXML_TEXT: *ch_type = PXER_TEXT; break; case PXML_TAG: *ch_type = PXER_WMORE; return 0; /* Want more */ case PXML_TAG_END: *ch_type = PXER_TAG; break; case PXML_COMMENT: case PXML_COMMENT_END: *ch_type = PXER_COMMENT; break; } *stateContext = new_stateContext; return arg.chunk_size; } #define CSLASH 0x2f /* '/' */ #define LANGLE 0x3c /* '<' */ #define RANGLE 0x3e /* '>' */ xer_check_tag_e xer_check_tag(const void *buf_ptr, int size, const char *need_tag) { const char *buf = (const char *)buf_ptr; const char *end; xer_check_tag_e ct = XCT_OPENING; if(size < 2 || buf[0] != LANGLE || buf[size-1] != RANGLE) { if(size >= 2) ASN_DEBUG("Broken XML tag: \"%c...%c\"", buf[0], buf[size - 1]); return XCT_BROKEN; } /* * Determine the tag class. */ if(buf[1] == CSLASH) { buf += 2; /* advance past "" */ ct = XCT_CLOSING; if(size > 0 && buf[size-1] == CSLASH) return XCT_BROKEN; /* */ } else { buf++; /* advance past "<" */ size -= 2; /* strip "<" and ">" */ if(size > 0 && buf[size-1] == CSLASH) { ct = XCT_BOTH; size--; /* One more, for "/" */ } } /* Sometimes we don't care about the tag */ if(!need_tag || !*need_tag) return (xer_check_tag_e)(XCT__UNK__MASK | ct); /* * Determine the tag name. */ for(end = buf + size; buf < end; buf++, need_tag++) { int b = *buf, n = *need_tag; if(b != n) { if(n == 0) { switch(b) { case 0x09: case 0x0a: case 0x0c: case 0x0d: case 0x20: /* "": whitespace is normal */ return ct; } } return (xer_check_tag_e)(XCT__UNK__MASK | ct); } if(b == 0) return XCT_BROKEN; /* Embedded 0 in buf?! */ } if(*need_tag) return (xer_check_tag_e)(XCT__UNK__MASK | ct); return ct; } #undef ADVANCE #define ADVANCE(num_bytes) do { \ size_t num = (num_bytes); \ buf_ptr = ((const char *)buf_ptr) + num; \ size -= num; \ consumed_myself += num; \ } while(0) #undef RETURN #define RETURN(_code) do { \ rval.code = _code; \ rval.consumed = consumed_myself; \ if(rval.code != RC_OK) \ ASN_DEBUG("Failed with %d", rval.code); \ return rval; \ } while(0) #define XER_GOT_BODY(chunk_buf, chunk_size, size) do { \ ssize_t converted_size = body_receiver \ (struct_key, chunk_buf, chunk_size, \ (size_t)chunk_size < size); \ if(converted_size == -1) RETURN(RC_FAIL); \ if(converted_size == 0 \ && size == (size_t)chunk_size) \ RETURN(RC_WMORE); \ chunk_size = converted_size; \ } while(0) #define XER_GOT_EMPTY() do { \ if(body_receiver(struct_key, 0, 0, size > 0) == -1) \ RETURN(RC_FAIL); \ } while(0) /* * Generalized function for decoding the primitive values. */ asn_dec_rval_t xer_decode_general(asn_codec_ctx_t *opt_codec_ctx, asn_struct_ctx_t *ctx, /* Type decoder context */ void *struct_key, const char *xml_tag, /* Expected XML tag */ const void *buf_ptr, size_t size, int (*opt_unexpected_tag_decoder) (void *struct_key, const void *chunk_buf, size_t chunk_size), ssize_t (*body_receiver) (void *struct_key, const void *chunk_buf, size_t chunk_size, int have_more) ) { asn_dec_rval_t rval; ssize_t consumed_myself = 0; (void)opt_codec_ctx; /* * Phases of XER/XML processing: * Phase 0: Check that the opening tag matches our expectations. * Phase 1: Processing body and reacting on closing tag. */ if(ctx->phase > 1) RETURN(RC_FAIL); for(;;) { pxer_chunk_type_e ch_type; /* XER chunk type */ ssize_t ch_size; /* Chunk size */ xer_check_tag_e tcv; /* Tag check value */ /* * Get the next part of the XML stream. */ ch_size = xer_next_token(&ctx->context, buf_ptr, size, &ch_type); if(ch_size == -1) { RETURN(RC_FAIL); } else { switch(ch_type) { case PXER_WMORE: RETURN(RC_WMORE); case PXER_COMMENT: /* Got XML comment */ ADVANCE(ch_size); /* Skip silently */ continue; case PXER_TEXT: if(ctx->phase == 0) { /* * We have to ignore whitespace here, * but in order to be forward compatible * with EXTENDED-XER (EMBED-VALUES, #25) * any text is just ignored here. */ } else { XER_GOT_BODY(buf_ptr, ch_size, size); } ADVANCE(ch_size); continue; case PXER_TAG: break; /* Check the rest down there */ } } assert(ch_type == PXER_TAG && size); tcv = xer_check_tag(buf_ptr, ch_size, xml_tag); /* * Phase 0: * Expecting the opening tag * for the type being processed. * Phase 1: * Waiting for the closing XML tag. */ switch(tcv) { case XCT_BOTH: if(ctx->phase) break; /* Finished decoding of an empty element */ XER_GOT_EMPTY(); ADVANCE(ch_size); ctx->phase = 2; /* Phase out */ RETURN(RC_OK); case XCT_OPENING: if(ctx->phase) break; ADVANCE(ch_size); ctx->phase = 1; /* Processing body phase */ continue; case XCT_CLOSING: if(!ctx->phase) break; ADVANCE(ch_size); ctx->phase = 2; /* Phase out */ RETURN(RC_OK); case XCT_UNKNOWN_BO: /* * Certain tags in the body may be expected. */ if(opt_unexpected_tag_decoder && opt_unexpected_tag_decoder(struct_key, buf_ptr, ch_size) >= 0) { /* Tag's processed fine */ ADVANCE(ch_size); if(!ctx->phase) { /* We are not expecting * the closing tag anymore. */ ctx->phase = 2; /* Phase out */ RETURN(RC_OK); } continue; } /* Fall through */ default: break; /* Unexpected tag */ } ASN_DEBUG("Unexpected XML tag (expected \"%s\")", xml_tag); break; /* Dark and mysterious things have just happened */ } RETURN(RC_FAIL); } size_t xer_whitespace_span(const void *chunk_buf, size_t chunk_size) { const char *p = (const char *)chunk_buf; const char *pend = p + chunk_size; for(; p < pend; p++) { switch(*p) { /* X.693, #8.1.4 * HORISONTAL TAB (9) * LINE FEED (10) * CARRIAGE RETURN (13) * SPACE (32) */ case 0x09: case 0x0a: case 0x0d: case 0x20: continue; default: break; } break; } return (p - (const char *)chunk_buf); } /* * This is a vastly simplified, non-validating XML tree skipper. */ int xer_skip_unknown(xer_check_tag_e tcv, ber_tlv_len_t *depth) { assert(*depth > 0); switch(tcv) { case XCT_BOTH: case XCT_UNKNOWN_BO: /* These negate each other. */ return 0; case XCT_OPENING: case XCT_UNKNOWN_OP: ++(*depth); return 0; case XCT_CLOSING: case XCT_UNKNOWN_CL: if(--(*depth) == 0) return (tcv == XCT_CLOSING) ? 2 : 1; return 0; default: return -1; } } asn1c-0.9.28+dfsg/skeletons/constr_CHOICE.c0000644000000000000000000007006213065714043016741 0ustar rootroot/* * Copyright (c) 2003, 2004, 2005, 2006, 2007 Lev Walkin . * All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #include #include #include /* * Number of bytes left for this structure. * (ctx->left) indicates the number of bytes _transferred_ for the structure. * (size) contains the number of bytes in the buffer passed. */ #define LEFT ((size<(size_t)ctx->left)?size:(size_t)ctx->left) /* * If the subprocessor function returns with an indication that it wants * more data, it may well be a fatal decoding problem, because the * size is constrained by the 's L, even if the buffer size allows * reading more data. * For example, consider the buffer containing the following TLVs: * ... * The TLV length clearly indicates that one byte is expected in V, but * if the V processor returns with "want more data" even if the buffer * contains way more data than the V processor have seen. */ #define SIZE_VIOLATION (ctx->left >= 0 && (size_t)ctx->left <= size) /* * This macro "eats" the part of the buffer which is definitely "consumed", * i.e. was correctly converted into local representation or rightfully skipped. */ #undef ADVANCE #define ADVANCE(num_bytes) do { \ size_t num = num_bytes; \ ptr = ((const char *)ptr) + num;\ size -= num; \ if(ctx->left >= 0) \ ctx->left -= num; \ consumed_myself += num; \ } while(0) /* * Switch to the next phase of parsing. */ #undef NEXT_PHASE #define NEXT_PHASE(ctx) do { \ ctx->phase++; \ ctx->step = 0; \ } while(0) /* * Return a standardized complex structure. */ #undef RETURN #define RETURN(_code) do { \ rval.code = _code; \ rval.consumed = consumed_myself;\ return rval; \ } while(0) /* * See the definitions. */ static int _fetch_present_idx(const void *struct_ptr, int off, int size); static void _set_present_idx(void *sptr, int offset, int size, int pres); /* * Tags are canonically sorted in the tag to member table. */ static int _search4tag(const void *ap, const void *bp) { const asn_TYPE_tag2member_t *a = (const asn_TYPE_tag2member_t *)ap; const asn_TYPE_tag2member_t *b = (const asn_TYPE_tag2member_t *)bp; int a_class = BER_TAG_CLASS(a->el_tag); int b_class = BER_TAG_CLASS(b->el_tag); if(a_class == b_class) { ber_tlv_tag_t a_value = BER_TAG_VALUE(a->el_tag); ber_tlv_tag_t b_value = BER_TAG_VALUE(b->el_tag); if(a_value == b_value) return 0; else if(a_value < b_value) return -1; else return 1; } else if(a_class < b_class) { return -1; } else { return 1; } } /* * The decoder of the CHOICE type. */ asn_dec_rval_t CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **struct_ptr, const void *ptr, size_t size, int tag_mode) { /* * Bring closer parts of structure description. */ asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; asn_TYPE_member_t *elements = td->elements; /* * Parts of the structure being constructed. */ void *st = *struct_ptr; /* Target structure. */ asn_struct_ctx_t *ctx; /* Decoder context */ ber_tlv_tag_t tlv_tag; /* T from TLV */ ssize_t tag_len; /* Length of TLV's T */ asn_dec_rval_t rval; /* Return code from subparsers */ ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ ASN_DEBUG("Decoding %s as CHOICE", td->name); /* * Create the target structure if it is not present already. */ if(st == 0) { st = *struct_ptr = CALLOC(1, specs->struct_size); if(st == 0) { RETURN(RC_FAIL); } } /* * Restore parsing context. */ ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); /* * Start to parse where left previously */ switch(ctx->phase) { case 0: /* * PHASE 0. * Check that the set of tags associated with given structure * perfectly fits our expectations. */ if(tag_mode || td->tags_count) { rval = ber_check_tags(opt_codec_ctx, td, ctx, ptr, size, tag_mode, -1, &ctx->left, 0); if(rval.code != RC_OK) { ASN_DEBUG("%s tagging check failed: %d", td->name, rval.code); return rval; } if(ctx->left >= 0) { /* ?Substracted below! */ ctx->left += rval.consumed; } ADVANCE(rval.consumed); } else { ctx->left = -1; } NEXT_PHASE(ctx); ASN_DEBUG("Structure consumes %ld bytes, buffer %ld", (long)ctx->left, (long)size); /* Fall through */ case 1: /* * Fetch the T from TLV. */ tag_len = ber_fetch_tag(ptr, LEFT, &tlv_tag); ASN_DEBUG("In %s CHOICE tag length %d", td->name, (int)tag_len); switch(tag_len) { case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); /* Fall through */ case -1: RETURN(RC_FAIL); } do { const asn_TYPE_tag2member_t *t2m; asn_TYPE_tag2member_t key; key.el_tag = tlv_tag; t2m = (const asn_TYPE_tag2member_t *)bsearch(&key, specs->tag2el, specs->tag2el_count, sizeof(specs->tag2el[0]), _search4tag); if(t2m) { /* * Found the element corresponding to the tag. */ NEXT_PHASE(ctx); ctx->step = t2m->el_no; break; } else if(specs->ext_start == -1) { ASN_DEBUG("Unexpected tag %s " "in non-extensible CHOICE %s", ber_tlv_tag_string(tlv_tag), td->name); RETURN(RC_FAIL); } else { /* Skip this tag */ ssize_t skip; ASN_DEBUG("Skipping unknown tag %s", ber_tlv_tag_string(tlv_tag)); skip = ber_skip_length(opt_codec_ctx, BER_TLV_CONSTRUCTED(ptr), (const char *)ptr + tag_len, LEFT - tag_len); switch(skip) { case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); /* Fall through */ case -1: RETURN(RC_FAIL); } ADVANCE(skip + tag_len); RETURN(RC_OK); } } while(0); case 2: /* * PHASE 2. * Read in the element. */ do { asn_TYPE_member_t *elm;/* CHOICE's element */ void *memb_ptr; /* Pointer to the member */ void **memb_ptr2; /* Pointer to that pointer */ elm = &elements[ctx->step]; /* * Compute the position of the member inside a structure, * and also a type of containment (it may be contained * as pointer or using inline inclusion). */ if(elm->flags & ATF_POINTER) { /* Member is a pointer to another structure */ memb_ptr2 = (void **)((char *)st + elm->memb_offset); } else { /* * A pointer to a pointer * holding the start of the structure */ memb_ptr = (char *)st + elm->memb_offset; memb_ptr2 = &memb_ptr; } /* Set presence to be able to free it properly at any time */ _set_present_idx(st, specs->pres_offset, specs->pres_size, ctx->step + 1); /* * Invoke the member fetch routine according to member's type */ rval = elm->type->ber_decoder(opt_codec_ctx, elm->type, memb_ptr2, ptr, LEFT, elm->tag_mode); switch(rval.code) { case RC_OK: break; case RC_WMORE: /* More data expected */ if(!SIZE_VIOLATION) { ADVANCE(rval.consumed); RETURN(RC_WMORE); } RETURN(RC_FAIL); case RC_FAIL: /* Fatal error */ RETURN(rval.code); } /* switch(rval) */ ADVANCE(rval.consumed); } while(0); NEXT_PHASE(ctx); /* Fall through */ case 3: ASN_DEBUG("CHOICE %s Leftover: %ld, size = %ld, tm=%d, tc=%d", td->name, (long)ctx->left, (long)size, tag_mode, td->tags_count); if(ctx->left > 0) { /* * The type must be fully decoded * by the CHOICE member-specific decoder. */ RETURN(RC_FAIL); } if(ctx->left == -1 && !(tag_mode || td->tags_count)) { /* * This is an untagged CHOICE. * It doesn't contain nothing * except for the member itself, including all its tags. * The decoding is completed. */ NEXT_PHASE(ctx); break; } /* * Read in the "end of data chunks"'s. */ while(ctx->left < 0) { ssize_t tl; tl = ber_fetch_tag(ptr, LEFT, &tlv_tag); switch(tl) { case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); /* Fall through */ case -1: RETURN(RC_FAIL); } /* * Expected <0><0>... */ if(((const uint8_t *)ptr)[0] == 0) { if(LEFT < 2) { if(SIZE_VIOLATION) RETURN(RC_FAIL); else RETURN(RC_WMORE); } else if(((const uint8_t *)ptr)[1] == 0) { /* * Correctly finished with <0><0>. */ ADVANCE(2); ctx->left++; continue; } } else { ASN_DEBUG("Unexpected continuation in %s", td->name); RETURN(RC_FAIL); } /* UNREACHABLE */ } NEXT_PHASE(ctx); case 4: /* No meaningful work here */ break; } RETURN(RC_OK); } asn_enc_rval_t CHOICE_encode_der(asn_TYPE_descriptor_t *td, void *sptr, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; asn_TYPE_member_t *elm; /* CHOICE element */ asn_enc_rval_t erval; void *memb_ptr; size_t computed_size = 0; int present; if(!sptr) ASN__ENCODE_FAILED; ASN_DEBUG("%s %s as CHOICE", cb?"Encoding":"Estimating", td->name); present = _fetch_present_idx(sptr, specs->pres_offset, specs->pres_size); /* * If the structure was not initialized, it cannot be encoded: * can't deduce what to encode in the choice type. */ if(present <= 0 || present > td->elements_count) { if(present == 0 && td->elements_count == 0) { /* The CHOICE is empty?! */ erval.encoded = 0; ASN__ENCODED_OK(erval); } ASN__ENCODE_FAILED; } /* * Seek over the present member of the structure. */ elm = &td->elements[present-1]; if(elm->flags & ATF_POINTER) { memb_ptr = *(void **)((char *)sptr + elm->memb_offset); if(memb_ptr == 0) { if(elm->optional) { erval.encoded = 0; ASN__ENCODED_OK(erval); } /* Mandatory element absent */ ASN__ENCODE_FAILED; } } else { memb_ptr = (void *)((char *)sptr + elm->memb_offset); } /* * If the CHOICE itself is tagged EXPLICIT: * T ::= [2] EXPLICIT CHOICE { ... } * Then emit the appropriate tags. */ if(tag_mode == 1 || td->tags_count) { /* * For this, we need to pre-compute the member. */ ssize_t ret; /* Encode member with its tag */ erval = elm->type->der_encoder(elm->type, memb_ptr, elm->tag_mode, elm->tag, 0, 0); if(erval.encoded == -1) return erval; /* Encode CHOICE with parent or my own tag */ ret = der_write_tags(td, erval.encoded, tag_mode, 1, tag, cb, app_key); if(ret == -1) ASN__ENCODE_FAILED; computed_size += ret; } /* * Encode the single underlying member. */ erval = elm->type->der_encoder(elm->type, memb_ptr, elm->tag_mode, elm->tag, cb, app_key); if(erval.encoded == -1) return erval; ASN_DEBUG("Encoded CHOICE member in %ld bytes (+%ld)", (long)erval.encoded, (long)computed_size); erval.encoded += computed_size; return erval; } ber_tlv_tag_t CHOICE_outmost_tag(const asn_TYPE_descriptor_t *td, const void *ptr, int tag_mode, ber_tlv_tag_t tag) { asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; int present; assert(tag_mode == 0); (void)tag_mode; assert(tag == 0); (void)tag; /* * Figure out which CHOICE element is encoded. */ present = _fetch_present_idx(ptr, specs->pres_offset, specs->pres_size); if(present > 0 || present <= td->elements_count) { const asn_TYPE_member_t *elm = &td->elements[present-1]; const void *memb_ptr; if(elm->flags & ATF_POINTER) { memb_ptr = *(const void * const *) ((const char *)ptr + elm->memb_offset); } else { memb_ptr = (const void *) ((const char *)ptr + elm->memb_offset); } return asn_TYPE_outmost_tag(elm->type, memb_ptr, elm->tag_mode, elm->tag); } else { return (ber_tlv_tag_t)-1; } } int CHOICE_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; int present; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } /* * Figure out which CHOICE element is encoded. */ present = _fetch_present_idx(sptr, specs->pres_offset,specs->pres_size); if(present > 0 && present <= td->elements_count) { asn_TYPE_member_t *elm = &td->elements[present-1]; const void *memb_ptr; if(elm->flags & ATF_POINTER) { memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset); if(!memb_ptr) { if(elm->optional) return 0; ASN__CTFAIL(app_key, td, sptr, "%s: mandatory CHOICE element %s absent (%s:%d)", td->name, elm->name, __FILE__, __LINE__); return -1; } } else { memb_ptr = (const void *)((const char *)sptr + elm->memb_offset); } if(elm->memb_constraints) { return elm->memb_constraints(elm->type, memb_ptr, ctfailcb, app_key); } else { int ret = elm->type->check_constraints(elm->type, memb_ptr, ctfailcb, app_key); /* * Cannot inherit it eralier: * need to make sure we get the updated version. */ elm->memb_constraints = elm->type->check_constraints; return ret; } } else { ASN__CTFAIL(app_key, td, sptr, "%s: no CHOICE element given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } #undef XER_ADVANCE #define XER_ADVANCE(num_bytes) do { \ size_t num = num_bytes; \ buf_ptr = (const void *)(((const char *)buf_ptr) + num); \ size -= num; \ consumed_myself += num; \ } while(0) /* * Decode the XER (XML) data. */ asn_dec_rval_t CHOICE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **struct_ptr, const char *opt_mname, const void *buf_ptr, size_t size) { /* * Bring closer parts of structure description. */ asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; const char *xml_tag = opt_mname ? opt_mname : td->xml_tag; /* * Parts of the structure being constructed. */ void *st = *struct_ptr; /* Target structure. */ asn_struct_ctx_t *ctx; /* Decoder context */ asn_dec_rval_t rval; /* Return value of a decoder */ ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ int edx; /* Element index */ /* * Create the target structure if it is not present already. */ if(st == 0) { st = *struct_ptr = CALLOC(1, specs->struct_size); if(st == 0) RETURN(RC_FAIL); } /* * Restore parsing context. */ ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); if(ctx->phase == 0 && !*xml_tag) ctx->phase = 1; /* Skip the outer tag checking phase */ /* * Phases of XER/XML processing: * Phase 0: Check that the opening tag matches our expectations. * Phase 1: Processing body and reacting on closing tag. * Phase 2: Processing inner type. * Phase 3: Only waiting for closing tag. * Phase 4: Skipping unknown extensions. * Phase 5: PHASED OUT */ for(edx = ctx->step; ctx->phase <= 4;) { pxer_chunk_type_e ch_type; /* XER chunk type */ ssize_t ch_size; /* Chunk size */ xer_check_tag_e tcv; /* Tag check value */ asn_TYPE_member_t *elm; /* * Go inside the member. */ if(ctx->phase == 2) { asn_dec_rval_t tmprval; void *memb_ptr; /* Pointer to the member */ void **memb_ptr2; /* Pointer to that pointer */ elm = &td->elements[edx]; if(elm->flags & ATF_POINTER) { /* Member is a pointer to another structure */ memb_ptr2 = (void **)((char *)st + elm->memb_offset); } else { memb_ptr = (char *)st + elm->memb_offset; memb_ptr2 = &memb_ptr; } /* Start/Continue decoding the inner member */ tmprval = elm->type->xer_decoder(opt_codec_ctx, elm->type, memb_ptr2, elm->name, buf_ptr, size); XER_ADVANCE(tmprval.consumed); ASN_DEBUG("XER/CHOICE: itdf: [%s] code=%d", elm->type->name, tmprval.code); if(tmprval.code != RC_OK) RETURN(tmprval.code); assert(_fetch_present_idx(st, specs->pres_offset, specs->pres_size) == 0); /* Record what we've got */ _set_present_idx(st, specs->pres_offset, specs->pres_size, edx + 1); ctx->phase = 3; /* Fall through */ } /* No need to wait for closing tag; special mode. */ if(ctx->phase == 3 && !*xml_tag) { ctx->phase = 5; /* Phase out */ RETURN(RC_OK); } /* * Get the next part of the XML stream. */ ch_size = xer_next_token(&ctx->context, buf_ptr, size, &ch_type); if(ch_size == -1) { RETURN(RC_FAIL); } else { switch(ch_type) { case PXER_WMORE: RETURN(RC_WMORE); case PXER_COMMENT: /* Got XML comment */ case PXER_TEXT: /* Ignore free-standing text */ XER_ADVANCE(ch_size); /* Skip silently */ continue; case PXER_TAG: break; /* Check the rest down there */ } } tcv = xer_check_tag(buf_ptr, ch_size, xml_tag); ASN_DEBUG("XER/CHOICE checked [%c%c%c%c] vs [%s], tcv=%d", ch_size>0?((const uint8_t *)buf_ptr)[0]:'?', ch_size>1?((const uint8_t *)buf_ptr)[1]:'?', ch_size>2?((const uint8_t *)buf_ptr)[2]:'?', ch_size>3?((const uint8_t *)buf_ptr)[3]:'?', xml_tag, tcv); /* Skip the extensions section */ if(ctx->phase == 4) { ASN_DEBUG("skip_unknown(%d, %ld)", tcv, (long)ctx->left); switch(xer_skip_unknown(tcv, &ctx->left)) { case -1: ctx->phase = 5; RETURN(RC_FAIL); continue; case 1: ctx->phase = 3; /* Fall through */ case 0: XER_ADVANCE(ch_size); continue; case 2: ctx->phase = 3; break; } } switch(tcv) { case XCT_BOTH: break; /* No CHOICE? */ case XCT_CLOSING: if(ctx->phase != 3) break; XER_ADVANCE(ch_size); ctx->phase = 5; /* Phase out */ RETURN(RC_OK); case XCT_OPENING: if(ctx->phase == 0) { XER_ADVANCE(ch_size); ctx->phase = 1; /* Processing body phase */ continue; } /* Fall through */ case XCT_UNKNOWN_OP: case XCT_UNKNOWN_BO: if(ctx->phase != 1) break; /* Really unexpected */ /* * Search which inner member corresponds to this tag. */ for(edx = 0; edx < td->elements_count; edx++) { elm = &td->elements[edx]; tcv = xer_check_tag(buf_ptr,ch_size,elm->name); switch(tcv) { case XCT_BOTH: case XCT_OPENING: /* * Process this member. */ ctx->step = edx; ctx->phase = 2; break; case XCT_UNKNOWN_OP: case XCT_UNKNOWN_BO: continue; default: edx = td->elements_count; break; /* Phase out */ } break; } if(edx != td->elements_count) continue; /* It is expected extension */ if(specs->ext_start != -1) { ASN_DEBUG("Got anticipated extension"); /* * Check for (XCT_BOTH or XCT_UNKNOWN_BO) * By using a mask. Only record a pure * tags. */ if(tcv & XCT_CLOSING) { /* Found without body */ ctx->phase = 3; /* Terminating */ } else { ctx->left = 1; ctx->phase = 4; /* Skip ...'s */ } XER_ADVANCE(ch_size); continue; } /* Fall through */ default: break; } ASN_DEBUG("Unexpected XML tag [%c%c%c%c] in CHOICE [%s]" " (ph=%d, tag=%s)", ch_size>0?((const uint8_t *)buf_ptr)[0]:'?', ch_size>1?((const uint8_t *)buf_ptr)[1]:'?', ch_size>2?((const uint8_t *)buf_ptr)[2]:'?', ch_size>3?((const uint8_t *)buf_ptr)[3]:'?', td->name, ctx->phase, xml_tag); break; } ctx->phase = 5; /* Phase out, just in case */ RETURN(RC_FAIL); } asn_enc_rval_t CHOICE_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { asn_CHOICE_specifics_t *specs=(asn_CHOICE_specifics_t *)td->specifics; asn_enc_rval_t er; int present; if(!sptr) ASN__ENCODE_FAILED; /* * Figure out which CHOICE element is encoded. */ present = _fetch_present_idx(sptr, specs->pres_offset,specs->pres_size); if(present <= 0 || present > td->elements_count) { ASN__ENCODE_FAILED; } else { asn_enc_rval_t tmper; asn_TYPE_member_t *elm = &td->elements[present-1]; void *memb_ptr; const char *mname = elm->name; unsigned int mlen = strlen(mname); if(elm->flags & ATF_POINTER) { memb_ptr = *(void **)((char *)sptr + elm->memb_offset); if(!memb_ptr) ASN__ENCODE_FAILED; } else { memb_ptr = (void *)((char *)sptr + elm->memb_offset); } er.encoded = 0; if(!(flags & XER_F_CANONICAL)) ASN__TEXT_INDENT(1, ilevel); ASN__CALLBACK3("<", 1, mname, mlen, ">", 1); tmper = elm->type->xer_encoder(elm->type, memb_ptr, ilevel + 1, flags, cb, app_key); if(tmper.encoded == -1) return tmper; ASN__CALLBACK3("", 1); er.encoded += 5 + (2 * mlen) + tmper.encoded; } if(!(flags & XER_F_CANONICAL)) ASN__TEXT_INDENT(1, ilevel - 1); ASN__ENCODED_OK(er); cb_failed: ASN__ENCODE_FAILED; } asn_dec_rval_t CHOICE_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; asn_dec_rval_t rv; asn_per_constraint_t *ct; asn_TYPE_member_t *elm; /* CHOICE's element */ void *memb_ptr; void **memb_ptr2; void *st = *sptr; int value; if(ASN__STACK_OVERFLOW_CHECK(opt_codec_ctx)) ASN__DECODE_FAILED; /* * Create the target structure if it is not present already. */ if(!st) { st = *sptr = CALLOC(1, specs->struct_size); if(!st) ASN__DECODE_FAILED; } if(constraints) ct = &constraints->value; else if(td->per_constraints) ct = &td->per_constraints->value; else ct = 0; if(ct && ct->flags & APC_EXTENSIBLE) { value = per_get_few_bits(pd, 1); if(value < 0) ASN__DECODE_STARVED; if(value) ct = 0; /* Not restricted */ } if(ct && ct->range_bits >= 0) { value = per_get_few_bits(pd, ct->range_bits); if(value < 0) ASN__DECODE_STARVED; ASN_DEBUG("CHOICE %s got index %d in range %d", td->name, value, ct->range_bits); if(value > ct->upper_bound) ASN__DECODE_FAILED; } else { if(specs->ext_start == -1) ASN__DECODE_FAILED; value = uper_get_nsnnwn(pd); if(value < 0) ASN__DECODE_STARVED; value += specs->ext_start; if(value >= td->elements_count) ASN__DECODE_FAILED; } /* Adjust if canonical order is different from natural order */ if(specs->canonical_order) value = specs->canonical_order[value]; /* Set presence to be able to free it later */ _set_present_idx(st, specs->pres_offset, specs->pres_size, value + 1); elm = &td->elements[value]; if(elm->flags & ATF_POINTER) { /* Member is a pointer to another structure */ memb_ptr2 = (void **)((char *)st + elm->memb_offset); } else { memb_ptr = (char *)st + elm->memb_offset; memb_ptr2 = &memb_ptr; } ASN_DEBUG("Discovered CHOICE %s encodes %s", td->name, elm->name); if(ct && ct->range_bits >= 0) { rv = elm->type->uper_decoder(opt_codec_ctx, elm->type, elm->per_constraints, memb_ptr2, pd); } else { rv = uper_open_type_get(opt_codec_ctx, elm->type, elm->per_constraints, memb_ptr2, pd); } if(rv.code != RC_OK) ASN_DEBUG("Failed to decode %s in %s (CHOICE) %d", elm->name, td->name, rv.code); return rv; } asn_enc_rval_t CHOICE_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; asn_TYPE_member_t *elm; /* CHOICE's element */ asn_per_constraint_t *ct; void *memb_ptr; int present; int present_enc; if(!sptr) ASN__ENCODE_FAILED; ASN_DEBUG("Encoding %s as CHOICE", td->name); if(constraints) ct = &constraints->value; else if(td->per_constraints) ct = &td->per_constraints->value; else ct = 0; present = _fetch_present_idx(sptr, specs->pres_offset, specs->pres_size); /* * If the structure was not initialized properly, it cannot be encoded: * can't deduce what to encode in the choice type. */ if(present <= 0 || present > td->elements_count) ASN__ENCODE_FAILED; else present--; ASN_DEBUG("Encoding %s CHOICE element %d", td->name, present); /* Adjust if canonical order is different from natural order */ if(specs->canonical_order) present_enc = specs->canonical_order[present]; else present_enc = present; if(ct && ct->range_bits >= 0) { if(present_enc < ct->lower_bound || present_enc > ct->upper_bound) { if(ct->flags & APC_EXTENSIBLE) { if(per_put_few_bits(po, 1, 1)) ASN__ENCODE_FAILED; } else { ASN__ENCODE_FAILED; } ct = 0; } } if(ct && ct->flags & APC_EXTENSIBLE) if(per_put_few_bits(po, 0, 1)) ASN__ENCODE_FAILED; elm = &td->elements[present]; if(elm->flags & ATF_POINTER) { /* Member is a pointer to another structure */ memb_ptr = *(void **)((char *)sptr + elm->memb_offset); if(!memb_ptr) ASN__ENCODE_FAILED; } else { memb_ptr = (char *)sptr + elm->memb_offset; } if(ct && ct->range_bits >= 0) { if(per_put_few_bits(po, present_enc, ct->range_bits)) ASN__ENCODE_FAILED; return elm->type->uper_encoder(elm->type, elm->per_constraints, memb_ptr, po); } else { asn_enc_rval_t rval; if(specs->ext_start == -1) ASN__ENCODE_FAILED; if(uper_put_nsnnwn(po, present_enc - specs->ext_start)) ASN__ENCODE_FAILED; if(uper_open_type_put(elm->type, elm->per_constraints, memb_ptr, po)) ASN__ENCODE_FAILED; rval.encoded = 0; ASN__ENCODED_OK(rval); } } int CHOICE_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; int present; if(!sptr) return (cb("", 8, app_key) < 0) ? -1 : 0; /* * Figure out which CHOICE element is encoded. */ present = _fetch_present_idx(sptr, specs->pres_offset,specs->pres_size); /* * Print that element. */ if(present > 0 && present <= td->elements_count) { asn_TYPE_member_t *elm = &td->elements[present-1]; const void *memb_ptr; if(elm->flags & ATF_POINTER) { memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset); if(!memb_ptr) return (cb("", 8, app_key) < 0) ? -1 : 0; } else { memb_ptr = (const void *)((const char *)sptr + elm->memb_offset); } /* Print member's name and stuff */ if(0) { if(cb(elm->name, strlen(elm->name), app_key) < 0 || cb(": ", 2, app_key) < 0) return -1; } return elm->type->print_struct(elm->type, memb_ptr, ilevel, cb, app_key); } else { return (cb("", 8, app_key) < 0) ? -1 : 0; } } void CHOICE_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) { asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; int present; if(!td || !ptr) return; ASN_DEBUG("Freeing %s as CHOICE", td->name); /* * Figure out which CHOICE element is encoded. */ present = _fetch_present_idx(ptr, specs->pres_offset, specs->pres_size); /* * Free that element. */ if(present > 0 && present <= td->elements_count) { asn_TYPE_member_t *elm = &td->elements[present-1]; void *memb_ptr; if(elm->flags & ATF_POINTER) { memb_ptr = *(void **)((char *)ptr + elm->memb_offset); if(memb_ptr) ASN_STRUCT_FREE(*elm->type, memb_ptr); } else { memb_ptr = (void *)((char *)ptr + elm->memb_offset); ASN_STRUCT_FREE_CONTENTS_ONLY(*elm->type, memb_ptr); } } if(!contents_only) { FREEMEM(ptr); } } /* * The following functions functions offer protection against -fshort-enums, * compatible with little- and big-endian machines. * If assertion is triggered, either disable -fshort-enums, or add an entry * here with the ->pres_size of your target stracture. * Unless the target structure is packed, the ".present" member * is guaranteed to be aligned properly. ASN.1 compiler itself does not * produce packed code. */ static int _fetch_present_idx(const void *struct_ptr, int pres_offset, int pres_size) { const void *present_ptr; int present; present_ptr = ((const char *)struct_ptr) + pres_offset; switch(pres_size) { case sizeof(int): present = *(const int *)present_ptr; break; case sizeof(short): present = *(const short *)present_ptr; break; case sizeof(char): present = *(const char *)present_ptr; break; default: /* ANSI C mandates enum to be equivalent to integer */ assert(pres_size != sizeof(int)); return 0; /* If not aborted, pass back safe value */ } return present; } static void _set_present_idx(void *struct_ptr, int pres_offset, int pres_size, int present) { void *present_ptr; present_ptr = ((char *)struct_ptr) + pres_offset; switch(pres_size) { case sizeof(int): *(int *)present_ptr = present; break; case sizeof(short): *(short *)present_ptr = present; break; case sizeof(char): *(char *)present_ptr = present; break; default: /* ANSI C mandates enum to be equivalent to integer */ assert(pres_size != sizeof(int)); } } asn1c-0.9.28+dfsg/skeletons/BIT_STRING.c0000644000000000000000000001074013065714043016120 0ustar rootroot/*- * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #include #include #include /* * BIT STRING basic type description. */ static const ber_tlv_tag_t asn_DEF_BIT_STRING_tags[] = { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)) }; static asn_OCTET_STRING_specifics_t asn_DEF_BIT_STRING_specs = { sizeof(BIT_STRING_t), offsetof(BIT_STRING_t, _asn_ctx), ASN_OSUBV_BIT }; asn_TYPE_descriptor_t asn_DEF_BIT_STRING = { "BIT STRING", "BIT_STRING", OCTET_STRING_free, /* Implemented in terms of OCTET STRING */ BIT_STRING_print, BIT_STRING_constraint, OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */ OCTET_STRING_encode_der, /* Implemented in terms of OCTET STRING */ OCTET_STRING_decode_xer_binary, BIT_STRING_encode_xer, OCTET_STRING_decode_uper, /* Unaligned PER decoder */ OCTET_STRING_encode_uper, /* Unaligned PER encoder */ 0, /* Use generic outmost tag fetcher */ asn_DEF_BIT_STRING_tags, sizeof(asn_DEF_BIT_STRING_tags) / sizeof(asn_DEF_BIT_STRING_tags[0]), asn_DEF_BIT_STRING_tags, /* Same as above */ sizeof(asn_DEF_BIT_STRING_tags) / sizeof(asn_DEF_BIT_STRING_tags[0]), 0, /* No PER visible constraints */ 0, 0, /* No members */ &asn_DEF_BIT_STRING_specs }; /* * BIT STRING generic constraint. */ int BIT_STRING_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; if(st && st->buf) { if((st->size == 0 && st->bits_unused) || st->bits_unused < 0 || st->bits_unused > 7) { ASN__CTFAIL(app_key, td, sptr, "%s: invalid padding byte (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } else { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } return 0; } static char *_bit_pattern[16] = { "0000", "0001", "0010", "0011", "0100", "0101", "0110", "0111", "1000", "1001", "1010", "1011", "1100", "1101", "1110", "1111" }; asn_enc_rval_t BIT_STRING_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { asn_enc_rval_t er; char scratch[128]; char *p = scratch; char *scend = scratch + (sizeof(scratch) - 10); const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; int xcan = (flags & XER_F_CANONICAL); uint8_t *buf; uint8_t *end; if(!st || !st->buf) ASN__ENCODE_FAILED; er.encoded = 0; buf = st->buf; end = buf + st->size - 1; /* Last byte is special */ /* * Binary dump */ for(; buf < end; buf++) { int v = *buf; int nline = xcan?0:(((buf - st->buf) % 8) == 0); if(p >= scend || nline) { er.encoded += p - scratch; ASN__CALLBACK(scratch, p - scratch); p = scratch; if(nline) ASN__TEXT_INDENT(1, ilevel); } memcpy(p + 0, _bit_pattern[v >> 4], 4); memcpy(p + 4, _bit_pattern[v & 0x0f], 4); p += 8; } if(!xcan && ((buf - st->buf) % 8) == 0) ASN__TEXT_INDENT(1, ilevel); er.encoded += p - scratch; ASN__CALLBACK(scratch, p - scratch); p = scratch; if(buf == end) { int v = *buf; int ubits = st->bits_unused; int i; for(i = 7; i >= ubits; i--) *p++ = (v & (1 << i)) ? 0x31 : 0x30; er.encoded += p - scratch; ASN__CALLBACK(scratch, p - scratch); } if(!xcan) ASN__TEXT_INDENT(1, ilevel - 1); ASN__ENCODED_OK(er); cb_failed: ASN__ENCODE_FAILED; } /* * BIT STRING specific contents printer. */ int BIT_STRING_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { const char * const h2c = "0123456789ABCDEF"; char scratch[64]; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; uint8_t *buf; uint8_t *end; char *p = scratch; (void)td; /* Unused argument */ if(!st || !st->buf) return (cb("", 8, app_key) < 0) ? -1 : 0; ilevel++; buf = st->buf; end = buf + st->size; /* * Hexadecimal dump. */ for(; buf < end; buf++) { if((buf - st->buf) % 16 == 0 && (st->size > 16) && buf != st->buf) { _i_INDENT(1); /* Dump the string */ if(cb(scratch, p - scratch, app_key) < 0) return -1; p = scratch; } *p++ = h2c[*buf >> 4]; *p++ = h2c[*buf & 0x0F]; *p++ = 0x20; } if(p > scratch) { p--; /* Eat the tailing space */ if((st->size > 16)) { _i_INDENT(1); } /* Dump the incomplete 16-bytes row */ if(cb(scratch, p - scratch, app_key) < 0) return -1; } return 0; } asn1c-0.9.28+dfsg/skeletons/xer_encoder.c0000644000000000000000000000300513065714043016705 0ustar rootroot/*- * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #include #include #include /* * The XER encoder of any type. May be invoked by the application. */ asn_enc_rval_t xer_encode(asn_TYPE_descriptor_t *td, void *sptr, enum xer_encoder_flags_e xer_flags, asn_app_consume_bytes_f *cb, void *app_key) { asn_enc_rval_t er, tmper; const char *mname; size_t mlen; int xcan = (xer_flags & XER_F_CANONICAL) ? 1 : 2; if(!td || !sptr) goto cb_failed; mname = td->xml_tag; mlen = strlen(mname); ASN__CALLBACK3("<", 1, mname, mlen, ">", 1); tmper = td->xer_encoder(td, sptr, 1, xer_flags, cb, app_key); if(tmper.encoded == -1) return tmper; ASN__CALLBACK3("\n", xcan); er.encoded = 4 + xcan + (2 * mlen) + tmper.encoded; ASN__ENCODED_OK(er); cb_failed: ASN__ENCODE_FAILED; } /* * This is a helper function for xer_fprint, which directs all incoming data * into the provided file descriptor. */ static int 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; } int xer_fprint(FILE *stream, asn_TYPE_descriptor_t *td, void *sptr) { asn_enc_rval_t er; if(!stream) stream = stdout; if(!td || !sptr) return -1; er = xer_encode(td, sptr, XER_F_BASIC, xer__print2fp, stream); if(er.encoded == -1) return -1; return fflush(stream); } asn1c-0.9.28+dfsg/skeletons/NativeInteger.h0000644000000000000000000000210413065714043017160 0ustar rootroot/*- * Copyright (c) 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ /* * This type differs from the standard INTEGER in that it is modelled using * the fixed machine type (long, int, short), so it can hold only values of * limited length. There is no type (i.e., NativeInteger_t, any integer type * will do). * This type may be used when integer range is limited by subtype constraints. */ #ifndef _NativeInteger_H_ #define _NativeInteger_H_ #include #include #ifdef __cplusplus extern "C" { #endif extern asn_TYPE_descriptor_t asn_DEF_NativeInteger; asn_struct_free_f NativeInteger_free; asn_struct_print_f NativeInteger_print; ber_type_decoder_f NativeInteger_decode_ber; der_type_encoder_f NativeInteger_encode_der; xer_type_decoder_f NativeInteger_decode_xer; xer_type_encoder_f NativeInteger_encode_xer; per_type_decoder_f NativeInteger_decode_uper; per_type_encoder_f NativeInteger_encode_uper; #ifdef __cplusplus } #endif #endif /* _NativeInteger_H_ */ asn1c-0.9.28+dfsg/skeletons/PrintableString.c0000644000000000000000000000667213065714043017534 0ustar rootroot/*- * Copyright (c) 2003, 2004, 2006 Lev Walkin . * All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #include #include /* * ASN.1:1984 (X.409) */ static const int _PrintableString_alphabet[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 1, 0, 0, 0, 0, 0, 0, 2, 3, 4, 0, 5, 6, 7, 8, 9, /* . '() +,-./ */ 10,11,12,13,14,15,16,17,18,19,20, 0, 0,21, 0,22, /* 0123456789: = ? */ 0,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37, /* ABCDEFGHIJKLMNO */ 38,39,40,41,42,43,44,45,46,47,48, 0, 0, 0, 0, 0, /* PQRSTUVWXYZ */ 0,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, /* abcdefghijklmno */ 64,65,66,67,68,69,70,71,72,73,74, 0, 0, 0, 0, 0, /* pqrstuvwxyz */ }; static const int _PrintableString_code2value[74] = { 32,39,40,41,43,44,45,46,47,48,49,50,51,52,53,54, 55,56,57,58,61,63,65,66,67,68,69,70,71,72,73,74, 75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90, 97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112, 113,114,115,116,117,118,119,120,121,122}; /* * PrintableString basic type description. */ static const ber_tlv_tag_t asn_DEF_PrintableString_tags[] = { (ASN_TAG_CLASS_UNIVERSAL | (19 << 2)), /* [UNIVERSAL 19] IMPLICIT ...*/ (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */ }; static int asn_DEF_PrintableString_v2c(unsigned int value) { return _PrintableString_alphabet[value > 255 ? 0 : value] - 1; } static int asn_DEF_PrintableString_c2v(unsigned int code) { if(code < 74) return _PrintableString_code2value[code]; return -1; } static const asn_per_constraints_t asn_DEF_PrintableString_constraints = { { APC_CONSTRAINED, 4, 4, 0x20, 0x39 }, /* Value */ { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 }, /* Size */ asn_DEF_PrintableString_v2c, asn_DEF_PrintableString_c2v }; asn_TYPE_descriptor_t asn_DEF_PrintableString = { "PrintableString", "PrintableString", OCTET_STRING_free, OCTET_STRING_print_utf8, /* ASCII subset */ PrintableString_constraint, OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */ OCTET_STRING_encode_der, OCTET_STRING_decode_xer_utf8, OCTET_STRING_encode_xer_utf8, OCTET_STRING_decode_uper, OCTET_STRING_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_PrintableString_tags, sizeof(asn_DEF_PrintableString_tags) / sizeof(asn_DEF_PrintableString_tags[0]) - 1, asn_DEF_PrintableString_tags, sizeof(asn_DEF_PrintableString_tags) / sizeof(asn_DEF_PrintableString_tags[0]), &asn_DEF_PrintableString_constraints, 0, 0, /* No members */ 0 /* No specifics */ }; int PrintableString_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const PrintableString_t *st = (const PrintableString_t *)sptr; if(st && st->buf) { uint8_t *buf = st->buf; uint8_t *end = buf + st->size; /* * Check the alphabet of the PrintableString. * ASN.1:1984 (X.409) */ for(; buf < end; buf++) { if(!_PrintableString_alphabet[*buf]) { ASN__CTFAIL(app_key, td, sptr, "%s: value byte %ld (%d) " "not in PrintableString alphabet " "(%s:%d)", td->name, (long)((buf - st->buf) + 1), *buf, __FILE__, __LINE__); return -1; } } } else { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } return 0; } asn1c-0.9.28+dfsg/skeletons/OBJECT_IDENTIFIER.c0000644000000000000000000004610213065714043017065 0ustar rootroot/*- * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #include #include #include #include #include /* for CHAR_BIT */ #include /* * OBJECT IDENTIFIER basic type description. */ static const ber_tlv_tag_t asn_DEF_OBJECT_IDENTIFIER_tags[] = { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)) }; asn_TYPE_descriptor_t asn_DEF_OBJECT_IDENTIFIER = { "OBJECT IDENTIFIER", "OBJECT_IDENTIFIER", ASN__PRIMITIVE_TYPE_free, OBJECT_IDENTIFIER_print, OBJECT_IDENTIFIER_constraint, ber_decode_primitive, der_encode_primitive, OBJECT_IDENTIFIER_decode_xer, OBJECT_IDENTIFIER_encode_xer, OCTET_STRING_decode_uper, OCTET_STRING_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_OBJECT_IDENTIFIER_tags, sizeof(asn_DEF_OBJECT_IDENTIFIER_tags) / sizeof(asn_DEF_OBJECT_IDENTIFIER_tags[0]), asn_DEF_OBJECT_IDENTIFIER_tags, /* Same as above */ sizeof(asn_DEF_OBJECT_IDENTIFIER_tags) / sizeof(asn_DEF_OBJECT_IDENTIFIER_tags[0]), 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; int OBJECT_IDENTIFIER_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const OBJECT_IDENTIFIER_t *st = (const OBJECT_IDENTIFIER_t *)sptr; if(st && st->buf) { if(st->size < 1) { ASN__CTFAIL(app_key, td, sptr, "%s: at least one numerical value " "expected (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } else { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } return 0; } int OBJECT_IDENTIFIER_get_single_arc(const uint8_t *arcbuf, unsigned int arclen, signed int add, void *rvbufp, unsigned int rvsize) { unsigned LE GCC_NOTUSED = 1; /* Little endian (x86) */ const uint8_t *arcend = arcbuf + arclen; /* End of arc */ unsigned int cache = 0; /* No more than 14 significant bits */ unsigned char *rvbuf = (unsigned char *)rvbufp; unsigned char *rvstart = rvbuf; /* Original start of the value buffer */ int inc; /* Return value growth direction */ rvsize *= CHAR_BIT; /* bytes to bits */ arclen *= 7; /* bytes to bits */ /* * The arc has the number of bits * cannot be represented using supplied return value type. */ if(arclen > rvsize) { if(arclen > (rvsize + CHAR_BIT)) { errno = ERANGE; /* Overflow */ return -1; } else { /* * Even if the number of bits in the arc representation * is higher than the width of supplied * return value * type, there is still possible to fit it when there * are few unused high bits in the arc value * representaion. * * Moreover, there is a possibility that the * number could actually fit the arc space, given * that add is negative, but we don't handle * such "temporary lack of precision" situation here. * May be considered as a bug. */ uint8_t mask = (0xff << (7-(arclen - rvsize))) & 0x7f; if((*arcbuf & mask)) { errno = ERANGE; /* Overflow */ return -1; } /* Fool the routine computing unused bits */ arclen -= 7; cache = *arcbuf & 0x7f; arcbuf++; } } /* Faster path for common size */ if(rvsize == (CHAR_BIT * sizeof(unsigned long))) { unsigned long accum; /* Gather all bits into the accumulator */ for(accum = cache; arcbuf < arcend; arcbuf++) accum = (accum << 7) | (*arcbuf & ~0x80); if(accum < (unsigned)-add) { errno = ERANGE; /* Overflow */ return -1; } *(unsigned long *)(void *)rvbuf = accum + add; /* alignment OK! */ return 0; } #ifndef WORDS_BIGENDIAN if(*(unsigned char *)&LE) { /* Little endian (x86) */ /* "Convert" to big endian */ rvbuf += rvsize / CHAR_BIT - 1; rvstart--; inc = -1; /* Descending */ } else #endif /* !WORDS_BIGENDIAN */ inc = +1; /* Big endian is known [at compile time] */ { int bits; /* typically no more than 3-4 bits */ /* Clear the high unused bits */ for(bits = rvsize - arclen; bits > CHAR_BIT; rvbuf += inc, bits -= CHAR_BIT) *rvbuf = 0; /* Fill the body of a value */ for(; arcbuf < arcend; arcbuf++) { cache = (cache << 7) | (*arcbuf & 0x7f); bits += 7; if(bits >= CHAR_BIT) { bits -= CHAR_BIT; *rvbuf = (cache >> bits); rvbuf += inc; } } if(bits) { *rvbuf = cache; rvbuf += inc; } } if(add) { for(rvbuf -= inc; rvbuf != rvstart; rvbuf -= inc) { int v = add + *rvbuf; if(v & ((unsigned)~0 << CHAR_BIT)) { *rvbuf = (unsigned char)(v + (1 << CHAR_BIT)); add = -1; } else { *rvbuf = v; break; } } if(rvbuf == rvstart) { /* No space to carry over */ errno = ERANGE; /* Overflow */ return -1; } } return 0; } ssize_t OBJECT_IDENTIFIER__dump_arc(const uint8_t *arcbuf, int arclen, int add, asn_app_consume_bytes_f *cb, void *app_key) { char scratch[64]; /* Conservative estimate */ unsigned long accum; /* Bits accumulator */ char *p; /* Position in the scratch buffer */ if(OBJECT_IDENTIFIER_get_single_arc(arcbuf, arclen, add, &accum, sizeof(accum))) return -1; if(accum) { ssize_t len; /* Fill the scratch buffer in reverse. */ p = scratch + sizeof(scratch); for(; accum; accum /= 10) *(--p) = (char)(accum % 10) + 0x30; /* Put a digit */ len = sizeof(scratch) - (p - scratch); if(cb(p, len, app_key) < 0) return -1; return len; } else { *scratch = 0x30; if(cb(scratch, 1, app_key) < 0) return -1; return 1; } } int OBJECT_IDENTIFIER_print_arc(const uint8_t *arcbuf, int arclen, int add, asn_app_consume_bytes_f *cb, void *app_key) { if(OBJECT_IDENTIFIER__dump_arc(arcbuf, arclen, add, cb, app_key) < 0) return -1; return 0; } static ssize_t OBJECT_IDENTIFIER__dump_body(const OBJECT_IDENTIFIER_t *st, asn_app_consume_bytes_f *cb, void *app_key) { ssize_t wrote_len = 0; int startn; int add = 0; int i; for(i = 0, startn = 0; i < st->size; i++) { uint8_t b = st->buf[i]; if((b & 0x80)) /* Continuation expected */ continue; if(startn == 0) { /* * First two arcs are encoded through the backdoor. */ if(i) { add = -80; if(cb("2", 1, app_key) < 0) return -1; } else if(b <= 39) { add = 0; if(cb("0", 1, app_key) < 0) return -1; } else if(b < 79) { add = -40; if(cb("1", 1, app_key) < 0) return -1; } else { add = -80; if(cb("2", 1, app_key) < 0) return -1; } wrote_len += 1; } if(cb(".", 1, app_key) < 0) /* Separate arcs */ return -1; add = OBJECT_IDENTIFIER__dump_arc(&st->buf[startn], i - startn + 1, add, cb, app_key); if(add < 0) return -1; wrote_len += 1 + add; startn = i + 1; add = 0; } return wrote_len; } static enum xer_pbd_rval OBJECT_IDENTIFIER__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chunk_buf, size_t chunk_size) { OBJECT_IDENTIFIER_t *st = (OBJECT_IDENTIFIER_t *)sptr; const char *chunk_end = (const char *)chunk_buf + chunk_size; const char *endptr; long s_arcs[10]; long *arcs = s_arcs; int arcs_count; int ret; (void)td; arcs_count = OBJECT_IDENTIFIER_parse_arcs( (const char *)chunk_buf, chunk_size, arcs, sizeof(s_arcs)/sizeof(s_arcs[0]), &endptr); if(arcs_count < 0) { /* Expecting more than zero arcs */ return XPBD_BROKEN_ENCODING; } else if(arcs_count == 0) { return XPBD_NOT_BODY_IGNORE; } assert(endptr == chunk_end); if((size_t)arcs_count > sizeof(s_arcs)/sizeof(s_arcs[0])) { arcs = (long *)MALLOC(arcs_count * sizeof(long)); if(!arcs) return XPBD_SYSTEM_FAILURE; ret = OBJECT_IDENTIFIER_parse_arcs( (const char *)chunk_buf, chunk_size, arcs, arcs_count, &endptr); if(ret != arcs_count) return XPBD_SYSTEM_FAILURE; /* assert?.. */ } /* * Convert arcs into BER representation. */ ret = OBJECT_IDENTIFIER_set_arcs(st, arcs, sizeof(*arcs), arcs_count); if(arcs != s_arcs) FREEMEM(arcs); return ret ? XPBD_SYSTEM_FAILURE : XPBD_BODY_CONSUMED; } asn_dec_rval_t OBJECT_IDENTIFIER_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, const char *opt_mname, const void *buf_ptr, size_t size) { return xer_decode_primitive(opt_codec_ctx, td, sptr, sizeof(OBJECT_IDENTIFIER_t), opt_mname, buf_ptr, size, OBJECT_IDENTIFIER__xer_body_decode); } asn_enc_rval_t OBJECT_IDENTIFIER_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { const OBJECT_IDENTIFIER_t *st = (const OBJECT_IDENTIFIER_t *)sptr; asn_enc_rval_t er; (void)ilevel; (void)flags; if(!st || !st->buf) ASN__ENCODE_FAILED; er.encoded = OBJECT_IDENTIFIER__dump_body(st, cb, app_key); if(er.encoded < 0) ASN__ENCODE_FAILED; ASN__ENCODED_OK(er); } int OBJECT_IDENTIFIER_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { const OBJECT_IDENTIFIER_t *st = (const OBJECT_IDENTIFIER_t *)sptr; (void)td; /* Unused argument */ (void)ilevel; /* Unused argument */ if(!st || !st->buf) return (cb("", 8, app_key) < 0) ? -1 : 0; /* Dump preamble */ if(cb("{ ", 2, app_key) < 0) return -1; if(OBJECT_IDENTIFIER__dump_body(st, cb, app_key) < 0) return -1; return (cb(" }", 2, app_key) < 0) ? -1 : 0; } int OBJECT_IDENTIFIER_get_arcs(const OBJECT_IDENTIFIER_t *oid, void *arcs, unsigned int arc_type_size, unsigned int arc_slots) { void *arcs_end = (char *)arcs + (arc_type_size * arc_slots); int num_arcs = 0; int startn = 0; int add = 0; int i; if(!oid || !oid->buf || (arc_slots && arc_type_size <= 1)) { errno = EINVAL; return -1; } for(i = 0; i < oid->size; i++) { uint8_t b = oid->buf[i]; if((b & 0x80)) /* Continuation expected */ continue; if(num_arcs == 0) { /* * First two arcs are encoded through the backdoor. */ unsigned LE = 1; /* Little endian */ int first_arc; num_arcs++; if(!arc_slots) { num_arcs++; continue; } if(i) first_arc = 2; else if(b <= 39) first_arc = 0; else if(b < 79) first_arc = 1; else first_arc = 2; add = -40 * first_arc; memset(arcs, 0, arc_type_size); *(unsigned char *)((char *)arcs + ((*(char *)&LE)?0:(arc_type_size - 1))) = first_arc; arcs = ((char *)arcs) + arc_type_size; } /* Decode, if has space */ if(arcs < arcs_end) { if(OBJECT_IDENTIFIER_get_single_arc(&oid->buf[startn], i - startn + 1, add, arcs, arc_type_size)) return -1; startn = i + 1; arcs = ((char *)arcs) + arc_type_size; add = 0; } num_arcs++; } return num_arcs; } /* * Save the single value as an object identifier arc. */ int OBJECT_IDENTIFIER_set_single_arc(uint8_t *arcbuf, const void *arcval, unsigned int arcval_size, int prepared_order) { /* * The following conditions must hold: * assert(arcval); * assert(arcval_size > 0); * assert(arcval_size <= 16); * assert(arcbuf); */ #ifdef WORDS_BIGENDIAN const unsigned isLittleEndian = 0; #else unsigned LE = 1; unsigned isLittleEndian = *(char *)&LE; #endif const uint8_t *tend, *tp; unsigned int cache; uint8_t *bp = arcbuf; int bits; uint8_t buffer[16]; if(isLittleEndian && !prepared_order) { const uint8_t *a = (const unsigned char *)arcval + arcval_size - 1; const uint8_t *aend = (const uint8_t *)arcval; uint8_t *msb = buffer + arcval_size - 1; uint8_t *tb; for(tb = buffer; a >= aend; tb++, a--) if((*tb = *a) && (tb < msb)) msb = tb; tend = &buffer[arcval_size]; tp = msb; /* Most significant non-zero byte */ } else { /* Look for most significant non-zero byte */ tend = (const unsigned char *)arcval + arcval_size; for(tp = (const uint8_t *)arcval; tp < tend - 1; tp++) if(*tp) break; } /* * Split the value in 7-bits chunks. */ bits = ((tend - tp) * CHAR_BIT) % 7; if(bits) { cache = *tp >> (CHAR_BIT - bits); if(cache) { *bp++ = cache | 0x80; cache = *tp++; bits = CHAR_BIT - bits; } else { bits = -bits; } } else { cache = 0; } for(; tp < tend; tp++) { cache = (cache << CHAR_BIT) + *tp; bits += CHAR_BIT; while(bits >= 7) { bits -= 7; *bp++ = 0x80 | (cache >> bits); } } if(bits) *bp++ = cache; bp[-1] &= 0x7f; /* Clear the last bit */ return bp - arcbuf; } int OBJECT_IDENTIFIER_set_arcs(OBJECT_IDENTIFIER_t *oid, const void *arcs, unsigned int arc_type_size, unsigned int arc_slots) { uint8_t *buf; uint8_t *bp; unsigned LE = 1; /* Little endian (x86) */ unsigned isLittleEndian = *((char *)&LE); unsigned int arc0; unsigned int arc1; unsigned size; unsigned i; if(!oid || !arcs || arc_type_size < 1 || arc_type_size > 16 || arc_slots < 2) { errno = EINVAL; return -1; } switch(arc_type_size) { case sizeof(char): arc0 = ((const unsigned char *)arcs)[0]; arc1 = ((const unsigned char *)arcs)[1]; break; case sizeof(short): arc0 = ((const unsigned short *)arcs)[0]; arc1 = ((const unsigned short *)arcs)[1]; break; case sizeof(int): arc0 = ((const unsigned int *)arcs)[0]; arc1 = ((const unsigned int *)arcs)[1]; break; default: arc1 = arc0 = 0; if(isLittleEndian) { /* Little endian (x86) */ const unsigned char *ps, *pe; /* If more significant bytes are present, * make them > 255 quick */ for(ps = (const unsigned char *)arcs + 1, pe = ps+arc_type_size; ps < pe; ps++) arc0 |= *ps, arc1 |= *(ps + arc_type_size); arc0 <<= CHAR_BIT, arc1 <<= CHAR_BIT; arc0 = *((const unsigned char *)arcs + 0); arc1 = *((const unsigned char *)arcs + arc_type_size); } else { const unsigned char *ps, *pe; /* If more significant bytes are present, * make them > 255 quick */ for(ps = (const unsigned char *)arcs, pe = ps+arc_type_size - 1; ps < pe; ps++) arc0 |= *ps, arc1 |= *(ps + arc_type_size); arc0 = *((const unsigned char *)arcs + arc_type_size - 1); arc1 = *((const unsigned char *)arcs +(arc_type_size<< 1)-1); } } /* * The previous chapter left us with the first and the second arcs. * The values are not precise (that is, they are valid only if * they're less than 255), but OK for the purposes of making * the sanity test below. */ if(arc0 <= 1) { if(arc1 >= 39) { /* 8.19.4: At most 39 subsequent values (including 0) */ errno = ERANGE; return -1; } } else if(arc0 > 2) { /* 8.19.4: Only three values are allocated from the root node */ errno = ERANGE; return -1; } /* * After above tests it is known that the value of arc0 is completely * trustworthy (0..2). However, the arc1's value is still meaningless. */ /* * Roughly estimate the maximum size necessary to encode these arcs. * This estimation implicitly takes in account the following facts, * that cancel each other: * * the first two arcs are encoded in a single value. * * the first value may require more space (+1 byte) * * the value of the first arc which is in range (0..2) */ size = ((arc_type_size * CHAR_BIT + 6) / 7) * arc_slots; bp = buf = (uint8_t *)MALLOC(size + 1); if(!buf) { /* ENOMEM */ return -1; } /* * Encode the first two arcs. * These require special treatment. */ { uint8_t *tp; uint8_t first_value[1 + 16]; /* of two arcs */ uint8_t *fv = first_value; /* * Simulate first_value = arc0 * 40 + arc1; */ /* Copy the second (1'st) arcs[1] into the first_value */ *fv++ = 0; arcs = ((const char *)arcs) + arc_type_size; if(isLittleEndian) { const uint8_t *aend = (const unsigned char *)arcs - 1; const uint8_t *a1 = (const unsigned char *)arcs + arc_type_size - 1; for(; a1 > aend; fv++, a1--) *fv = *a1; } else { const uint8_t *a1 = (const uint8_t *)arcs; const uint8_t *aend = a1 + arc_type_size; for(; a1 < aend; fv++, a1++) *fv = *a1; } /* Increase the first_value by arc0 */ arc0 *= 40; /* (0..80) */ for(tp = first_value + arc_type_size; tp >= first_value; tp--) { unsigned int v = *tp; v += arc0; *tp = v; if(v >= (1 << CHAR_BIT)) arc0 = v >> CHAR_BIT; else break; } assert(tp >= first_value); bp += OBJECT_IDENTIFIER_set_single_arc(bp, first_value, fv - first_value, 1); } /* * Save the rest of arcs. */ for(arcs = ((const char *)arcs) + arc_type_size, i = 2; i < arc_slots; i++, arcs = ((const char *)arcs) + arc_type_size) { bp += OBJECT_IDENTIFIER_set_single_arc(bp, arcs, arc_type_size, 0); } assert((unsigned)(bp - buf) <= size); /* * Replace buffer. */ oid->size = bp - buf; bp = oid->buf; oid->buf = buf; if(bp) FREEMEM(bp); return 0; } int OBJECT_IDENTIFIER_parse_arcs(const char *oid_text, ssize_t oid_txt_length, long *arcs, unsigned int arcs_slots, const char **opt_oid_text_end) { unsigned int arcs_count = 0; const char *oid_end; enum { ST_LEADSPACE, ST_TAILSPACE, ST_AFTERVALUE, /* Next character ought to be '.' or a space */ ST_WAITDIGITS /* Next character is expected to be a digit */ } state = ST_LEADSPACE; if(!oid_text || oid_txt_length < -1 || (arcs_slots && !arcs)) { if(opt_oid_text_end) *opt_oid_text_end = oid_text; errno = EINVAL; return -1; } if(oid_txt_length == -1) oid_txt_length = strlen(oid_text); #define _OID_CAPTURE_ARC(oid_text, oid_end) do { \ const char *endp = oid_end; \ long value; \ switch(asn_strtol_lim(oid_text, &endp, &value)) { \ case ASN_STRTOL_EXTRA_DATA: \ case ASN_STRTOL_OK: \ if(arcs_count < arcs_slots) \ arcs[arcs_count] = value; \ arcs_count++; \ oid_text = endp - 1; \ break; \ case ASN_STRTOL_ERROR_RANGE: \ if(opt_oid_text_end) \ *opt_oid_text_end = oid_text; \ errno = ERANGE; \ return -1; \ case ASN_STRTOL_ERROR_INVAL: \ case ASN_STRTOL_EXPECT_MORE: \ if(opt_oid_text_end) \ *opt_oid_text_end = oid_text; \ errno = EINVAL; \ return -1; \ } \ } while(0) for(oid_end = oid_text + oid_txt_length; oid_text broken OID */ return -1; case ST_LEADSPACE: case ST_WAITDIGITS: _OID_CAPTURE_ARC(oid_text, oid_end); state = ST_AFTERVALUE; continue; } break; default: /* Unexpected symbols */ state = ST_WAITDIGITS; break; } /* switch() */ break; } /* for() */ if(opt_oid_text_end) *opt_oid_text_end = oid_text; /* Finalize last arc */ switch(state) { case ST_LEADSPACE: return 0; /* No OID found in input data */ case ST_WAITDIGITS: errno = EINVAL; /* Broken OID */ return -1; case ST_AFTERVALUE: case ST_TAILSPACE: return arcs_count; } errno = EINVAL; /* Broken OID */ return -1; } asn1c-0.9.28+dfsg/skeletons/GeneralizedTime.c0000644000000000000000000003704613065714043017474 0ustar rootroot/*- * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #define _POSIX_PTHREAD_SEMANTICS /* for Sun */ #define _REENTRANT /* for Sun */ #define _BSD_SOURCE /* for timegm(3) */ #include #include #ifdef __CYGWIN__ #include "/usr/include/time.h" #else #include #endif /* __CYGWIN__ */ #include #include #if defined(_WIN32) #pragma message( "PLEASE STOP AND READ!") #pragma message( " localtime_r is implemented via localtime(), which may be not thread-safe.") #pragma message( " gmtime_r is implemented via gmtime(), which may be not thread-safe.") #pragma message( " ") #pragma message( " You must fix the code by inserting appropriate locking") #pragma message( " if you want to use asn_GT2time() or asn_UT2time().") #pragma message( "PLEASE STOP AND READ!") static struct tm *localtime_r(const time_t *tloc, struct tm *result) { struct tm *tm; if((tm = localtime(tloc))) return memcpy(result, tm, sizeof(struct tm)); return 0; } static struct tm *gmtime_r(const time_t *tloc, struct tm *result) { struct tm *tm; if((tm = gmtime(tloc))) return memcpy(result, tm, sizeof(struct tm)); return 0; } #define tzset() _tzset() #define putenv(c) _putenv(c) #define _EMULATE_TIMEGM #endif /* _WIN32 */ #if defined(sun) || defined(_sun_) || defined(__solaris__) #define _EMULATE_TIMEGM #endif /* * Where to look for offset from GMT, Phase I. * Several platforms are known. */ #if defined(__FreeBSD__) \ || (defined(__GNUC__) && defined(__APPLE_CC__)) \ || (defined __GLIBC__ && __GLIBC__ >= 2) #undef HAVE_TM_GMTOFF #define HAVE_TM_GMTOFF #endif /* BSDs and newer glibc */ /* * Where to look for offset from GMT, Phase II. */ #ifdef HAVE_TM_GMTOFF #define GMTOFF(tm) ((tm).tm_gmtoff) #else /* HAVE_TM_GMTOFF */ #define GMTOFF(tm) (-timezone) #endif /* HAVE_TM_GMTOFF */ #if defined(_WIN32) #pragma message( "PLEASE STOP AND READ!") #pragma message( " timegm() is implemented via getenv(\"TZ\")/setenv(\"TZ\"), which may be not thread-safe.") #pragma message( " ") #pragma message( " You must fix the code by inserting appropriate locking") #pragma message( " if you want to use asn_GT2time() or asn_UT2time().") #pragma message( "PLEASE STOP AND READ!") #else #if (defined(_EMULATE_TIMEGM) || !defined(HAVE_TM_GMTOFF)) #warning "PLEASE STOP AND READ!" #warning " timegm() is implemented via getenv(\"TZ\")/setenv(\"TZ\"), which may be not thread-safe." #warning " " #warning " You must fix the code by inserting appropriate locking" #warning " if you want to use asn_GT2time() or asn_UT2time()." #warning "PLEASE STOP AND READ!" #endif /* _EMULATE_TIMEGM */ #endif /* * Override our GMTOFF decision for other known platforms. */ #ifdef __CYGWIN__ #undef GMTOFF static long GMTOFF(struct tm a){ struct tm *lt; time_t local_time, gmt_time; long zone; tzset(); gmt_time = time (NULL); lt = gmtime(&gmt_time); local_time = mktime(lt); return (gmt_time - local_time); } #define _EMULATE_TIMEGM #endif /* __CYGWIN__ */ #define ATZVARS do { \ char tzoldbuf[64]; \ char *tzold #define ATZSAVETZ do { \ tzold = getenv("TZ"); \ if(tzold) { \ size_t tzlen = strlen(tzold); \ if(tzlen < sizeof(tzoldbuf)) { \ tzold = memcpy(tzoldbuf, tzold, tzlen + 1); \ } else { \ char *dupptr = tzold; \ tzold = MALLOC(tzlen + 1); \ if(tzold) memcpy(tzold, dupptr, tzlen + 1); \ } \ setenv("TZ", "UTC", 1); \ } \ tzset(); \ } while(0) #define ATZOLDTZ do { \ if (tzold) { \ setenv("TZ", tzold, 1); \ *tzoldbuf = 0; \ if(tzold != tzoldbuf) \ FREEMEM(tzold); \ } else { \ unsetenv("TZ"); \ } \ tzset(); \ } while(0); } while(0); #ifndef HAVE_TIMEGM #ifdef _EMULATE_TIMEGM static time_t timegm(struct tm *tm) { time_t tloc; ATZVARS; ATZSAVETZ; tloc = mktime(tm); ATZOLDTZ; return tloc; } #endif /* _EMULATE_TIMEGM */ #endif #ifndef ASN___INTERNAL_TEST_MODE /* * GeneralizedTime basic type description. */ static const ber_tlv_tag_t asn_DEF_GeneralizedTime_tags[] = { (ASN_TAG_CLASS_UNIVERSAL | (24 << 2)), /* [UNIVERSAL 24] IMPLICIT ...*/ (ASN_TAG_CLASS_UNIVERSAL | (26 << 2)), /* [UNIVERSAL 26] IMPLICIT ...*/ (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */ }; static asn_per_constraints_t asn_DEF_GeneralizedTime_constraints = { { APC_CONSTRAINED, 7, 7, 0x20, 0x7e }, /* Value */ { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 }, /* Size */ 0, 0 }; asn_TYPE_descriptor_t asn_DEF_GeneralizedTime = { "GeneralizedTime", "GeneralizedTime", OCTET_STRING_free, GeneralizedTime_print, GeneralizedTime_constraint, /* Check validity of time */ OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */ GeneralizedTime_encode_der, OCTET_STRING_decode_xer_utf8, GeneralizedTime_encode_xer, OCTET_STRING_decode_uper, OCTET_STRING_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_GeneralizedTime_tags, sizeof(asn_DEF_GeneralizedTime_tags) / sizeof(asn_DEF_GeneralizedTime_tags[0]) - 2, asn_DEF_GeneralizedTime_tags, sizeof(asn_DEF_GeneralizedTime_tags) / sizeof(asn_DEF_GeneralizedTime_tags[0]), &asn_DEF_GeneralizedTime_constraints, 0, 0, /* No members */ 0 /* No specifics */ }; #endif /* ASN___INTERNAL_TEST_MODE */ /* * Check that the time looks like the time. */ int GeneralizedTime_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const GeneralizedTime_t *st = (const GeneralizedTime_t *)sptr; time_t tloc; errno = EPERM; /* Just an unlikely error code */ tloc = asn_GT2time(st, 0, 0); if(tloc == -1 && errno != EPERM) { ASN__CTFAIL(app_key, td, sptr, "%s: Invalid time format: %s (%s:%d)", td->name, strerror(errno), __FILE__, __LINE__); return -1; } return 0; } asn_enc_rval_t GeneralizedTime_encode_der(asn_TYPE_descriptor_t *td, void *sptr, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { GeneralizedTime_t *st = (GeneralizedTime_t *)sptr; asn_enc_rval_t erval; int fv, fd; /* seconds fraction value and number of digits */ struct tm tm; time_t tloc; /* * Encode as a canonical DER. */ errno = EPERM; tloc = asn_GT2time_frac(st, &fv, &fd, &tm, 1); /* Recognize time */ if(tloc == -1 && errno != EPERM) /* Failed to recognize time. Fail completely. */ ASN__ENCODE_FAILED; st = asn_time2GT_frac(0, &tm, fv, fd, 1); /* Save time canonically */ if(!st) ASN__ENCODE_FAILED; /* Memory allocation failure. */ erval = OCTET_STRING_encode_der(td, st, tag_mode, tag, cb, app_key); FREEMEM(st->buf); FREEMEM(st); return erval; } #ifndef ASN___INTERNAL_TEST_MODE asn_enc_rval_t GeneralizedTime_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { if(flags & XER_F_CANONICAL) { GeneralizedTime_t *gt; asn_enc_rval_t rv; int fv, fd; /* fractional parts */ struct tm tm; errno = EPERM; if(asn_GT2time_frac((GeneralizedTime_t *)sptr, &fv, &fd, &tm, 1) == -1 && errno != EPERM) ASN__ENCODE_FAILED; gt = asn_time2GT_frac(0, &tm, fv, fd, 1); if(!gt) ASN__ENCODE_FAILED; rv = OCTET_STRING_encode_xer_utf8(td, sptr, ilevel, flags, cb, app_key); ASN_STRUCT_FREE(asn_DEF_GeneralizedTime, gt); return rv; } else { return OCTET_STRING_encode_xer_utf8(td, sptr, ilevel, flags, cb, app_key); } } #endif /* ASN___INTERNAL_TEST_MODE */ int GeneralizedTime_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { const GeneralizedTime_t *st = (const GeneralizedTime_t *)sptr; (void)td; /* Unused argument */ (void)ilevel; /* Unused argument */ if(st && st->buf) { char buf[32]; struct tm tm; int ret; errno = EPERM; if(asn_GT2time(st, &tm, 1) == -1 && errno != EPERM) return (cb("", 11, app_key) < 0) ? -1 : 0; ret = snprintf(buf, sizeof(buf), "%04d-%02d-%02d %02d:%02d:%02d (GMT)", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec); assert(ret > 0 && ret < (int)sizeof(buf)); return (cb(buf, ret, app_key) < 0) ? -1 : 0; } else { return (cb("", 8, app_key) < 0) ? -1 : 0; } } time_t asn_GT2time(const GeneralizedTime_t *st, struct tm *ret_tm, int as_gmt) { return asn_GT2time_frac(st, 0, 0, ret_tm, as_gmt); } time_t asn_GT2time_prec(const GeneralizedTime_t *st, int *frac_value, int frac_digits, struct tm *ret_tm, int as_gmt) { time_t tloc; int fv, fd = 0; if(frac_value) tloc = asn_GT2time_frac(st, &fv, &fd, ret_tm, as_gmt); else return asn_GT2time_frac(st, 0, 0, ret_tm, as_gmt); if(fd == 0 || frac_digits <= 0) { *frac_value = 0; } else { while(fd > frac_digits) fv /= 10, fd--; while(fd < frac_digits) { if(fv < INT_MAX / 10) { fv *= 10; fd++; } else { /* Too long precision request */ fv = 0; break; } } *frac_value = fv; } return tloc; } time_t asn_GT2time_frac(const GeneralizedTime_t *st, int *frac_value, int *frac_digits, struct tm *ret_tm, int as_gmt) { struct tm tm_s; uint8_t *buf; uint8_t *end; int gmtoff_h = 0; int gmtoff_m = 0; int gmtoff = 0; /* h + m */ int offset_specified = 0; int fvalue = 0; int fdigits = 0; time_t tloc; if(!st || !st->buf) { errno = EINVAL; return -1; } else { buf = st->buf; end = buf + st->size; } if(st->size < 10) { errno = EINVAL; return -1; } /* * Decode first 10 bytes: "AAAAMMJJhh" */ memset(&tm_s, 0, sizeof(tm_s)); #undef B2F #undef B2T #define B2F(var) do { \ unsigned ch = *buf; \ if(ch < 0x30 || ch > 0x39) { \ errno = EINVAL; \ return -1; \ } else { \ var = var * 10 + (ch - 0x30); \ buf++; \ } \ } while(0) #define B2T(var) B2F(tm_s.var) B2T(tm_year); /* 1: A */ B2T(tm_year); /* 2: A */ B2T(tm_year); /* 3: A */ B2T(tm_year); /* 4: A */ B2T(tm_mon); /* 5: M */ B2T(tm_mon); /* 6: M */ B2T(tm_mday); /* 7: J */ B2T(tm_mday); /* 8: J */ B2T(tm_hour); /* 9: h */ B2T(tm_hour); /* 0: h */ if(buf == end) goto local_finish; /* * Parse [mm[ss[(.|,)ffff]]] * ^^ */ switch(*buf) { case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: tm_s.tm_min = (*buf++) - 0x30; if(buf == end) { errno = EINVAL; return -1; } B2T(tm_min); break; case 0x2B: case 0x2D: /* +, - */ goto offset; case 0x5A: /* Z */ goto utc_finish; default: errno = EINVAL; return -1; } if(buf == end) goto local_finish; /* * Parse [mm[ss[(.|,)ffff]]] * ^^ */ switch(*buf) { case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: tm_s.tm_sec = (*buf++) - 0x30; if(buf == end) { errno = EINVAL; return -1; } B2T(tm_sec); break; case 0x2B: case 0x2D: /* +, - */ goto offset; case 0x5A: /* Z */ goto utc_finish; default: errno = EINVAL; return -1; } if(buf == end) goto local_finish; /* * Parse [mm[ss[(.|,)ffff]]] * ^ ^ */ switch(*buf) { case 0x2C: case 0x2E: /* (.|,) */ /* * Process fractions of seconds. */ for(buf++; buf < end; buf++) { int v = *buf; /* GCC 4.x is being too smart without volatile */ switch(v) { case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: if(fvalue < INT_MAX/10) { fvalue = fvalue * 10 + (v - 0x30); fdigits++; } else { /* Not enough precision, ignore */ } continue; default: break; } break; } } if(buf == end) goto local_finish; switch(*buf) { case 0x2B: case 0x2D: /* +, - */ goto offset; case 0x5A: /* Z */ goto utc_finish; default: errno = EINVAL; return -1; } offset: if(end - buf < 3) { errno = EINVAL; return -1; } buf++; B2F(gmtoff_h); B2F(gmtoff_h); if(buf[-3] == 0x2D) /* Negative */ gmtoff = -1; else gmtoff = 1; if((end - buf) == 2) { B2F(gmtoff_m); B2F(gmtoff_m); } else if(end != buf) { errno = EINVAL; return -1; } gmtoff = gmtoff * (3600 * gmtoff_h + 60 * gmtoff_m); /* Fall through */ utc_finish: offset_specified = 1; /* Fall through */ local_finish: /* * Validation. */ if((tm_s.tm_mon > 12 || tm_s.tm_mon < 1) || (tm_s.tm_mday > 31 || tm_s.tm_mday < 1) || (tm_s.tm_hour > 23) || (tm_s.tm_sec > 60) ) { errno = EINVAL; return -1; } /* Canonicalize */ tm_s.tm_mon -= 1; /* 0 - 11 */ tm_s.tm_year -= 1900; tm_s.tm_isdst = -1; tm_s.tm_sec -= gmtoff; /*** AT THIS POINT tm_s is either GMT or local (unknown) ****/ if(offset_specified) { tloc = timegm(&tm_s); } else { /* * Without an offset (or "Z"), * we can only guess that it is a local zone. * Interpret it in this fashion. */ tloc = mktime(&tm_s); } if(tloc == -1) { errno = EINVAL; return -1; } if(ret_tm) { if(as_gmt) { if(offset_specified) { *ret_tm = tm_s; } else { if(gmtime_r(&tloc, ret_tm) == 0) { errno = EINVAL; return -1; } } } else { if(localtime_r(&tloc, ret_tm) == 0) { errno = EINVAL; return -1; } } } /* Fractions of seconds */ if(frac_value) *frac_value = fvalue; if(frac_digits) *frac_digits = fdigits; return tloc; } GeneralizedTime_t * asn_time2GT(GeneralizedTime_t *opt_gt, const struct tm *tm, int force_gmt) { return asn_time2GT_frac(opt_gt, tm, 0, 0, force_gmt); } GeneralizedTime_t * asn_time2GT_frac(GeneralizedTime_t *opt_gt, const struct tm *tm, int frac_value, int frac_digits, int force_gmt) { struct tm tm_s; long gmtoff; const unsigned int buf_size = 4 + 2 + 2 /* yyyymmdd */ + 2 + 2 + 2 /* hhmmss */ + 1 + 6 /* .ffffff */ + 1 + 4 /* +hhmm */ + 1 /* '\0' */ ; char *buf; char *p; int size; /* Check arguments */ if(!tm) { errno = EINVAL; return 0; } /* Pre-allocate a buffer of sufficient yet small length */ buf = (char *)MALLOC(buf_size); if(!buf) return 0; gmtoff = GMTOFF(*tm); if(force_gmt && gmtoff) { tm_s = *tm; tm_s.tm_sec -= gmtoff; timegm(&tm_s); /* Fix the time */ tm = &tm_s; #ifdef HAVE_TM_GMTOFF assert(!GMTOFF(tm_s)); /* Will fix itself */ #else /* !HAVE_TM_GMTOFF */ gmtoff = 0; #endif } size = snprintf(buf, buf_size, "%04d%02d%02d%02d%02d%02d", tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec ); if(size != 14) { /* Could be assert(size == 14); */ FREEMEM(buf); errno = EINVAL; return 0; } p = buf + size; /* * Deal with fractions. */ if(frac_value > 0 && frac_digits > 0) { char *end = p + 1 + 6; /* '.' + maximum 6 digits */ char *z = p; long fbase; *z++ = '.'; /* Place bounds on precision */ while(frac_digits-- > 6) frac_value /= 10; /* emulate fbase = pow(10, frac_digits) */ for(fbase = 1; frac_digits--;) fbase *= 10; do { int digit = frac_value / fbase; if(digit > 9) { z = 0; break; } *z++ = digit + 0x30; frac_value %= fbase; fbase /= 10; } while(fbase > 0 && frac_value > 0 && z < end); if(z) { for(--z; *z == 0x30; --z); /* Strip zeroes */ p = z + (*z != '.'); size = p - buf; } } if(force_gmt) { *p++ = 0x5a; /* "Z" */ *p++ = 0; size++; } else { int ret; gmtoff %= 86400; ret = snprintf(p, buf_size - size, "%+03ld%02ld", gmtoff / 3600, labs(gmtoff % 3600) / 60); if(ret != 5) { FREEMEM(buf); errno = EINVAL; return 0; } size += ret; } if(opt_gt) { if(opt_gt->buf) FREEMEM(opt_gt->buf); } else { opt_gt = (GeneralizedTime_t *)CALLOC(1, sizeof *opt_gt); if(!opt_gt) { FREEMEM(buf); return 0; } } opt_gt->buf = (unsigned char *)buf; opt_gt->size = size; return opt_gt; } asn1c-0.9.28+dfsg/skeletons/README0000644000000000000000000000044613065714043015132 0ustar rootrootThis directory contains encoder/decoder code for various encoding rules (PER, DER, BER, XER) that work with the tables constructed by the compiler. The compiler itself does not generate much code. It creates parsing tables and then copies (links) over these files which contain generic codecs. asn1c-0.9.28+dfsg/skeletons/tests/0000755000000000000000000000000013065714043015410 5ustar rootrootasn1c-0.9.28+dfsg/skeletons/tests/check-OIDs.c0000644000000000000000000002572113065714043017434 0ustar rootroot#include #include #include #include #include static int _print(const void *buffer, size_t size, void *app_key) { (void)app_key; fwrite(buffer, size, 1, stdout); return 0; } static void check_OID(uint8_t *buf, size_t len, int *ck_buf, int ck_len) { OBJECT_IDENTIFIER_t *oid; asn_dec_rval_t rval; unsigned long arcs[10]; int alen; int i; printf("Checking {"); for(i = 0; i < (int)len; i++) { printf("%s%02x", i?" ":"", buf[i]); } printf("} against {"); for(i = 0; i < ck_len; i++) { printf("%s%d", i?" ":"", ck_buf[i]); } printf("}\n"); oid = NULL; rval = ber_decode(0, &asn_DEF_OBJECT_IDENTIFIER, (void *)&oid, buf, len); assert(rval.code == RC_OK); assert(oid->size == (ssize_t)len - 2); /* * Print the contents for visual debugging. */ printf("OBJECT_IDENTIFIER_print() => "); OBJECT_IDENTIFIER_print(&asn_DEF_OBJECT_IDENTIFIER, oid, 0, _print, 0); printf("\n"); memset(arcs, 'A', sizeof(arcs)); alen = OBJECT_IDENTIFIER_get_arcs(oid, arcs, sizeof(arcs[0]), sizeof(arcs)/sizeof(arcs[0])); assert(alen > 0); printf("OBJECT_IDENTIFIER_get_arcs() => {"); /* * Make sure they are equivalent. */ for(i = 0; i < alen; i++) { printf(" %lu", arcs[i]); if(alen == ck_len) { assert(arcs[i] == (unsigned long)ck_buf[i]); } } printf(" }\n"); assert(alen == ck_len); } static void check_ROID(uint8_t *buf, size_t len, int *ck_buf, int ck_len) { RELATIVE_OID_t *oid; asn_dec_rval_t rval; unsigned long arcs[10]; int alen; int i; printf("Checking {"); for(i = 0; i < (ssize_t)len; i++) { printf("%s%02x", i?" ":"", buf[i]); } printf("} against {"); for(i = 0; i < ck_len; i++) { printf("%s%d", i?" ":"", ck_buf[i]); } printf("}\n"); oid = NULL; rval = ber_decode(0, &asn_DEF_RELATIVE_OID, (void *)&oid, buf, len); assert(rval.code == RC_OK); assert(oid->size == (ssize_t)len - 2); /* * Print the contents for visual debugging. */ printf("RELATIVE_OID_print() => "); RELATIVE_OID_print(&asn_DEF_RELATIVE_OID, oid, 0, _print, 0); printf("\n"); memset(arcs, 'A', sizeof(arcs)); alen = RELATIVE_OID_get_arcs(oid, arcs, sizeof(arcs[0]), sizeof(arcs)/sizeof(arcs[0])); assert(alen > 0); assert(alen == ck_len); /* * Make sure they are equivalent. */ printf("RELATIVE_OID_get_arcs() => {"); for(i = 0; i < alen; i++) { printf(" %lu", (unsigned long)arcs[i]); assert(arcs[i] == (unsigned long)ck_buf[i]); } printf(" }\n"); } /* * Encode the specified array of arcs as RELATIVE-OID, decode it and compare. */ static void check_REGEN(int *arcs, int acount) { static RELATIVE_OID_t oid; unsigned long tmp_arcs[10]; int tmp_alen = 10; int alen; int ret; int i; if(0) { fprintf(stderr, "Encoding (R) {"); for(i = 0; i < acount; i++) { fprintf(stderr, " %u", arcs[i]); } fprintf(stderr, " }\n"); } ret = RELATIVE_OID_set_arcs(&oid, arcs, sizeof(arcs[0]), acount); assert(ret == 0); memset(tmp_arcs, 'A', sizeof(tmp_arcs)); alen = RELATIVE_OID_get_arcs(&oid, tmp_arcs, sizeof(tmp_arcs[0]), tmp_alen); assert(alen >= 0); assert(alen <= tmp_alen); assert(alen == acount); if(0) { fprintf(stderr, "Encoded (R) { "); for(i = 0; i < alen; i++) { fprintf(stderr, "%lu ", tmp_arcs[i]); fflush(stdout); assert(arcs[i] == (int)tmp_arcs[i]); } fprintf(stderr, "}\n"); } } /* * Encode the specified array of arcs as OBJECT IDENTIFIER, * decode it and compare. */ static void check_REGEN_OID(int *arcs, int acount) { static OBJECT_IDENTIFIER_t oid; unsigned long tmp_arcs[10]; int tmp_alen = 10; int alen; int ret; int i; if(0) { fprintf(stderr, "Encoding (O) {"); for(i = 0; i < acount; i++) { fprintf(stderr, " %u", arcs[i]); } fprintf(stderr, " }\n"); } ret = OBJECT_IDENTIFIER_set_arcs(&oid, arcs, sizeof(arcs[0]), acount); assert(ret == 0); memset(tmp_arcs, 'A', sizeof(tmp_arcs)); alen = OBJECT_IDENTIFIER_get_arcs(&oid, tmp_arcs, sizeof(tmp_arcs[0]), tmp_alen); assert(alen >= 0); assert(alen <= tmp_alen); assert(alen == acount); if(0) { fprintf(stderr, "Encoded (O) { "); for(i = 0; i < alen; i++) { fprintf(stderr, "%lu ", tmp_arcs[i]); fflush(stdout); assert(arcs[i] == (int)tmp_arcs[i]); } fprintf(stderr, "}\n"); } } static int check_speed() { uint8_t buf[] = { 0x80 | 7, 0x80 | 2, 0x80 | 3, 0x80 | 4, 13 }; int ret = 0; int cycles = 100000000; double a, b, c; struct timeval tv; unsigned long value; int i; ret = OBJECT_IDENTIFIER_get_single_arc(buf, sizeof(buf), 0, &value, sizeof(value)); assert(ret == 0); assert(value == 0x7040c20d); gettimeofday(&tv, 0); a = tv.tv_sec + tv.tv_usec / 1000000.0; for(i = 0; i < cycles; i++) { ret = OBJECT_IDENTIFIER_get_single_arc(buf, sizeof(buf), 0, &value, sizeof(value)); } assert(ret == 0); assert(value == 0x7040c20d); gettimeofday(&tv, 0); b = tv.tv_sec + tv.tv_usec / 1000000.0; for(i = 0; i < cycles; i++) { ret = OBJECT_IDENTIFIER_get_single_arc(buf, sizeof(buf), 0, &value, sizeof(value)); } assert(ret == 0); assert(value == 0x7040c20d); gettimeofday(&tv, 0); c = tv.tv_sec + tv.tv_usec / 1000000.0; a = b - a; b = c - b; printf("Time for single_arc(): %f\n", a); printf("Time for get_arc_l(): %f\n", b); return 0; } static void check_parse(const char *oid_txt, int retval) { int ret; long l[2]; const char *p = oid_txt - 13; assert(p < oid_txt); ret = OBJECT_IDENTIFIER_parse_arcs(oid_txt, -1, l, 2, &p); printf("[%s] => %d == %d\n", oid_txt, ret, retval); assert(ret == retval); assert(p >= oid_txt); } static void check_xer(int expect_arcs, char *xer) { asn_dec_rval_t rc; RELATIVE_OID_t *st = 0; RELATIVE_OID_t **stp = &st; long arcs[10]; int ret; int i; printf("[%s] => ", xer); fflush(stdout); rc = asn_DEF_RELATIVE_OID.xer_decoder(0, &asn_DEF_RELATIVE_OID, (void **)stp, "t", xer, strlen(xer)); if(expect_arcs == -1) { if(rc.code != RC_OK) { printf("-1\n"); return; } } assert(rc.code == RC_OK); ret = RELATIVE_OID_get_arcs(st, arcs, sizeof(arcs[0]), sizeof(arcs)/sizeof(arcs[0])); assert(ret < 10); if(expect_arcs == -1) { assert(ret == -1); return; } for(i = 0; i < ret; i++) { if(i) printf("."); printf("%ld", arcs[i]); if(arcs[i] != i + 1) printf(" != %d\n", i + 1); assert(arcs[i] == i + 1); } printf(": %d == %d\n", ret, expect_arcs); assert(ret == expect_arcs); } #define CHECK_OID(n) check_OID(buf ## n, sizeof(buf ## n), \ buf ## n ## _check, \ sizeof(buf ## n ## _check)/sizeof(buf ## n ## _check[0])) #define CHECK_ROID(n) check_ROID(buf ## n, sizeof(buf ## n), \ buf ## n ## _check, \ sizeof(buf ## n ## _check)/sizeof(buf ## n ## _check[0])) #define CHECK_REGEN(n) check_REGEN(buf ## n ## _check, \ sizeof(buf ## n ## _check)/sizeof(buf ## n ## _check[0])) #define CHECK_REGEN_OID(n) check_REGEN_OID(buf ## n ## _check, \ sizeof(buf ## n ## _check)/sizeof(buf ## n ## _check[0])) int main() { int i; /* {joint-iso-itu-t 230 3} */ uint8_t buf1[] = { 0x06, /* OBJECT IDENTIFIER */ 0x03, /* Length */ 0x82, 0x36, 0x03 }; int buf1_check[] = { 2, 230, 3 }; /* {8571 3 2} */ uint8_t buf2[] = { 0x0D, /* RELATIVE-OID */ 0x04, /* Length */ 0xC2, 0x7B, 0x03, 0x02 }; int buf2_check[] = { 8571, 3, 2 }; /* {joint-iso-itu-t 42 } */ uint8_t buf3[] = { 0x06, /* OBJECT IDENTIFIER */ 0x01, /* Length */ 0x7A }; int buf3_check[] = { 2, 42 }; /* {joint-iso-itu-t 25957 } */ uint8_t buf4[] = { 0x06, /* OBJECT IDENTIFIER */ 0x03, /* Length */ 0x81, 0x80 + 0x4B, 0x35 }; int buf4_check[] = { 2, 25957 }; int buf5_check[] = { 0 }; int buf6_check[] = { 1 }; int buf7_check[] = { 80, 40 }; int buf8_check[] = { 127 }; int buf9_check[] = { 128 }; int buf10_check[] = { 65535, 65536 }; int buf11_check[] = { 100000, 0x20000, 1234, 256, 127, 128 }; int buf12_check[] = { 0, 0xffffffff, 0xff00ff00, 0 }; int buf13_check[] = { 0, 1, 2 }; int buf14_check[] = { 1, 38, 3 }; int buf15_check[] = { 0, 0, 0xf000 }; int buf16_check[] = { 0, 0, 0, 1, 0 }; int buf17_check[] = { 2, 0xffffffAf, 0xff00ff00, 0 }; int buf18_check[] = { 2, 2, 1, 1 }; /* { joint-iso-itu-t 2 1 1 } */ uint8_t buf19[] = { 0x06, /* OBJECT IDENTIFIER */ 0x03, /* Length */ 0x52, 0x01, 0x01 }; int buf19_check[] = { 2, 2, 1, 1 }; /* { joint-iso-itu-t 2 1 0 1 } */ uint8_t buf20[] = { 0x06, /* OBJECT IDENTIFIER */ 0x04, /* Length */ 0x52, 0x01, 0x00, 0x01 }; int buf20_check[] = { 2, 2, 1, 0, 1 }; CHECK_OID(1); /* buf1, buf1_check */ CHECK_ROID(2); /* buf2, buf2_check */ CHECK_OID(3); /* buf3, buf3_check */ CHECK_OID(4); /* buf4, buf4_check */ CHECK_OID(19); /* buf19, buf19_check */ CHECK_OID(20); /* buf20, buf20_check */ CHECK_REGEN(5); /* Regenerate RELATIVE-OID */ CHECK_REGEN(6); CHECK_REGEN(7); CHECK_REGEN(8); CHECK_REGEN(9); CHECK_REGEN(10); CHECK_REGEN(11); CHECK_REGEN(12); CHECK_REGEN(13); CHECK_REGEN(14); CHECK_REGEN(15); CHECK_REGEN(16); CHECK_REGEN(17); CHECK_REGEN_OID(1); /* Regenerate OBJECT IDENTIFIER */ CHECK_REGEN_OID(3); /* Regenerate OBJECT IDENTIFIER */ CHECK_REGEN_OID(4); /* Regenerate OBJECT IDENTIFIER */ CHECK_REGEN_OID(13); CHECK_REGEN_OID(14); CHECK_REGEN_OID(15); CHECK_REGEN_OID(16); CHECK_REGEN_OID(17); CHECK_REGEN_OID(18); CHECK_REGEN_OID(19); CHECK_REGEN_OID(20); check_parse("", 0); check_parse(" ", 0); check_parse(".", -1); check_parse(" .", -1); check_parse(".1", -1); check_parse("1.", -1); check_parse("1. ", -1); check_parse(".1. ", -1); check_parse(" .1. ", -1); check_parse(" 1", 1); check_parse(" 1.2", 2); check_parse(" 1.", -1); check_parse(" 1. ", -1); check_parse("1. ", -1); check_parse("1.2", 2); check_parse("1.2 ", 2); check_parse("1.2 ", 2); check_parse(" 1.2 ", 2); check_parse("1. 2", -1); check_parse("1 .2", -1); check_parse(" 1 .2", -1); check_parse(" 1 .2 ", -1); check_parse("1 .2 ", -1); check_parse("1.+1", -1); check_parse("10.30.234.234", 4); check_parse("10.30.234.234 ", 4); check_parse("10.30.234. 234 ", -1); check_parse("10.30.234.234.", -1); check_parse("1.2000000000.3", 3); check_parse("1.2147483647.3", 3); if(sizeof(long) == 4) { check_parse("1.2147483648.3", -1); /* overflow on ILP32 */ check_parse("1.2147483649.3", -1); /* overflow on ILP32 */ check_parse("1.3000000000.3", -1); check_parse("1.4000000000.3", -1); check_parse("1.5000000000.3", -1); check_parse("1.6000000000.3", -1); check_parse("1.9000000000.3", -1); } else if(sizeof(long) == 8) { check_parse("1.2147483648.3", 3); check_parse("1.9223372036854775807.3", 3); check_parse("1.9223372036854775808.3", -1); } check_parse("1.900a0000000.3", -1); check_parse("1.900a.3", -1); check_xer(-1, ""); check_xer(2, "1.2"); check_xer(3, "1.2.3"); check_xer(3, " 1.2.3 "); check_xer(-1, "1.2.3 1"); for(i = 0; i < 100000; i++) { int bufA_check[3] = { 2, i, rand() }; int bufB_check[2] = { rand(), i * 121 }; CHECK_REGEN(A); CHECK_REGEN_OID(A); CHECK_REGEN(B); if(i > 100) i++; if(i > 500) i++; if(i > 1000) i += 3; if(i > 5000) i += 151; } if(getenv("CHECK_SPEED")) { /* Useful for developers only */ check_speed(); } return 0; } asn1c-0.9.28+dfsg/skeletons/tests/Makefile.am0000644000000000000000000000061513065714043017446 0ustar rootrootcheck_PROGRAMS = \ check-ber_tlv_tag \ check-length \ check-OIDs \ check-GeneralizedTime \ check-OCTET_STRING \ check-UTF8String \ check-UTCTime \ check-INTEGER \ check-REAL \ check-XER \ check-PER \ check-PER-INTEGER AM_CPPFLAGS = -I$(top_srcdir)/skeletons $(TESTSUITE_CFLAGS) AM_LDFLAGS = $(top_builddir)/skeletons/libasn1cskeletons.la LDADD = -lm TESTS = $(check_PROGRAMS) asn1c-0.9.28+dfsg/skeletons/tests/check-OCTET_STRING.c0000644000000000000000000000745213065714043020603 0ustar rootroot#include #include #include #include #include #include enum encoding_type { HEX, BINARY, UTF8 }; static void check(enum encoding_type type, char *tagname, char *xmlbuf, char *verify) { int xmllen = strlen(xmlbuf); int verlen = verify ? strlen(verify) : 0; asn_TYPE_descriptor_t *td = &asn_DEF_OCTET_STRING; OCTET_STRING_t *st = 0; OCTET_STRING_t **stp = &st; asn_dec_rval_t rc; xer_type_decoder_f *decoder = 0; switch(type) { case HEX: decoder = OCTET_STRING_decode_xer_hex; break; case BINARY: td = &asn_DEF_BIT_STRING; decoder = OCTET_STRING_decode_xer_binary; break; case UTF8: decoder = OCTET_STRING_decode_xer_utf8; break; } rc = decoder(0, td, (void **)stp, tagname, xmlbuf, xmllen); printf("[%s] => [%s]:%d vs [%s]:%d, code %d\n", xmlbuf, st ? (const char *)st->buf : "", st ? st->size : 0, verify ? verify : "", verlen, rc.code); if(verify) { assert(rc.code == RC_OK); assert(st); assert(st->buf); assert(st->size == verlen); assert(!memcmp(st->buf, verify, verlen)); } else { assert(rc.code != RC_OK); } } static char buf[1024]; static int write_buf(const void *buffer, size_t size, void *key) { size_t *off = key; assert(*off + size < sizeof(buf)); memcpy(buf + *off, buffer, size); *off += size; return 0; } static void encode(char *orig, char *encoded) { OCTET_STRING_t os; size_t written = 0; asn_enc_rval_t er; memset(&os, 0, sizeof(os)); OCTET_STRING_fromString(&os, orig); er = OCTET_STRING_encode_xer_utf8(&asn_DEF_OCTET_STRING, &os, 0, 0, write_buf, &written); assert(er.encoded >= 0); buf[er.encoded] = '\0'; printf("Orig: [%s], encoded: [%s], check [%s]\n", orig, buf, encoded); assert(strcmp(buf, encoded) == 0); } int main() { check(HEX, 0, "41424", "AB@"); check(HEX, 0, "\n" "41424", "AB@"); check(HEX, 0, " 4 1 4 2 4 5 44 ", "ABED"); /* Some hard cases */ check(HEX, "z", "40", "@"); check(HEX, "z", "40", "@"); check(HEX, "z", ">40", 0); check(HEX, "z", "40", "@"); check(HEX, "z", ">40", 0); check(HEX, "z", "ignored40stuff", "@"); check(HEX, "tag", "4", "@"); check(HEX, "a-z", "7 375 73 6c6 96 b", "suslik"); /* This one has a comment in a not-yet-supported place */ /* check(HEX, "a-z", "73 75 73 6c 69 6b", "suslik"); */ check(BINARY, "tag", "", ""); check(BINARY, "tag", "blah", 0); check(BINARY, "tag", "01000001", "A"); check(BINARY, "tag", "01000 00 101 00001", "AB"); check(UTF8, 0, "one, two, three", "one, two, three"); check(UTF8, "z", "", ""); check(UTF8, "z", "<&>", "<&>"); check(UTF8, "z", "a<b&c>d", "ad"); check(UTF8, "z", "a<", "a<"); check(UTF8, "z", "a&sdfsdfsdf;b", "a&sdfsdfsdf;b"); check(UTF8, "z", "a b", "a b"); check(UTF8, "z", "a b", "a b"); check(UTF8, "z", "a繃b", "a\347\271\203b"); check(UTF8, "z", "a�b", "a�b"); check(UTF8, "z", "a�b", "a�b"); check(UTF8, "z", "", "aĬ"); check(UTF8, "z", "a&#-300;", "a&#-300;"); check(UTF8, "z", "ab", "a\014b"); check(UTF8, "z", "ab", "a\001b"); check(UTF8, "z", "a", "a\007"); encode("", ""); encode("a", "a"); encode("a\nb", "a\nb"); encode("a\bc", "ac"); encode("ab\01c\ndef\r\n", "abc\ndef\r\n"); return 0; } asn1c-0.9.28+dfsg/skeletons/tests/check-REAL.c0000644000000000000000000006233513065714043017363 0ustar rootroot#include #include #include #include /* C11 specifies DBL_TRUE_MIN, might not be immediately available. */ #ifndef DBL_TRUE_MIN #define DBL_TRUE_MIN 4.9406564584124654E-324 #endif #include static char reconstructed[2][512]; static int reconstr_lens[2]; static int callback(const void *buffer, size_t size, void *app_key) { char *buf = reconstructed[app_key ? 1 : 0]; int *len = &reconstr_lens[app_key ? 1 : 0]; if(*len + size >= sizeof(reconstructed[0])) return -1; memcpy(buf + *len, buffer, size); *len += size; return 0; } static char * d2s(double d, int canonical) { ssize_t s; reconstr_lens[canonical] = 0; s = REAL__dump(d, canonical, callback, (void *)(ptrdiff_t)canonical); assert(s > 0 && (size_t)s < sizeof(reconstructed[canonical])); assert(s == reconstr_lens[canonical]); reconstructed[canonical][s] = '\0'; // ASCIIZ return reconstructed[canonical]; } /* * Verify that a string representation of a given floating point value * is as given in the (sample) and (canonical_sample) arguments. */ static void check_str_representation(double d, const char *sample, const char *canonical_sample, int lineno) { char *s0, *s1; s0 = d2s(d, 0); s1 = d2s(d, 1); if(sample) { printf("%03d: Checking %g->[\"%s\"] against [\"%s\"]%s\n", lineno, d, s0, sample, canonical_sample ? " (canonical follows...)" : "" ); assert(!strcmp(s0, sample)); } if(canonical_sample) { printf("%03d: Checking %g->[\"%s\"] against [\"%s\"] (canonical)\n", lineno, d, s1, canonical_sample); assert(!strcmp(s1, canonical_sample)); } } #define check(rn, d, str1, str2) \ check_impl(rn, d, str1, str2, __LINE__) static void check_impl(REAL_t *rn, double orig_dbl, const char *sample, const char *canonical_sample, int lineno) { double val; uint8_t *p, *end; int ret; printf("Line %d: double value %.12f [", lineno, orig_dbl); for(p = (uint8_t *)&orig_dbl, end = p + sizeof(double); p < end ; p++) printf("%02x", *p); printf("] (ilogb %d)\n", ilogb(orig_dbl)); val = frexp(orig_dbl, &ret); printf("frexp(%f, %d): [", val, ret); for(p = (uint8_t *)&val, end = p + sizeof(double); p < end ; p++) printf("%02x", *p); printf("]\n"); ret = asn_double2REAL(rn, orig_dbl); assert(ret == 0); printf("converted into ["); for(p = rn->buf, end = p + rn->size; p < end; p++) printf("%02x", *p); printf("]: %d\n", rn->size); ret = asn_REAL2double(rn, &val); assert(ret == 0); printf("and back to double: ["); for(p = (uint8_t *)&val, end = p + sizeof(double); p < end ; p++) printf("%02x", *p); printf("] (ilogb %d)\n", ilogb(val)); printf("%.12f vs %.12f\n", val, orig_dbl); assert((isnan(orig_dbl) && isnan(val)) || val == orig_dbl); printf("OK\n"); check_str_representation(val, sample, canonical_sample, lineno); } static void check_xer(int fuzzy, double orig_value) { asn_enc_rval_t er; asn_dec_rval_t rc; REAL_t st; REAL_t *newst0 = 0; REAL_t *newst1 = 0; REAL_t **newst0p = &newst0; REAL_t **newst1p = &newst1; double value0, value1; int ret; memset(&st, 0, sizeof(st)); ret = asn_double2REAL(&st, orig_value); assert(ret == 0); reconstr_lens[0] = 0; reconstr_lens[1] = 0; er = xer_encode(&asn_DEF_REAL, &st, XER_F_BASIC, callback, 0); assert(er.encoded == reconstr_lens[0]); er = xer_encode(&asn_DEF_REAL, &st, XER_F_CANONICAL, callback, (void *)1); assert(er.encoded == reconstr_lens[1]); reconstructed[0][reconstr_lens[0]] = 0; reconstructed[1][reconstr_lens[1]] = 0; printf("%f vs (%d)[%s] & (%d)%s", orig_value, reconstr_lens[1], reconstructed[1], reconstr_lens[0], reconstructed[0] ); rc = xer_decode(0, &asn_DEF_REAL, (void **)newst0p, reconstructed[0], reconstr_lens[0]); assert(rc.code == RC_OK); assert(reconstr_lens[0] > 0 && rc.consumed < (size_t)reconstr_lens[0]); rc = xer_decode(0, &asn_DEF_REAL, (void **)newst1p, reconstructed[1], reconstr_lens[1]); assert(rc.code == RC_OK); assert(rc.consumed == (size_t)reconstr_lens[1]); ret = asn_REAL2double(newst0, &value0); assert(ret == 0); ret = asn_REAL2double(newst1, &value1); assert(ret == 0); assert((isnan(value0) && isnan(orig_value)) || value0 == orig_value || fuzzy); assert((isnan(value1) && isnan(orig_value)) || value1 == orig_value); assert(newst0->size == st.size || fuzzy); assert(newst1->size == st.size); assert(fuzzy || memcmp(newst0->buf, st.buf, st.size) == 0); assert(memcmp(newst1->buf, st.buf, st.size) == 0); } static void check_ber_buffer_twoway(double d, const char *sample, const char *canonical_sample, uint8_t *inbuf, size_t insize, uint8_t *outbuf, size_t outsize, int lineno) { REAL_t rn; double val; int ret; /* * Decode our expected buffer and check that it matches the given (d). */ rn.buf = inbuf; rn.size = insize; asn_REAL2double(&rn, &val); if(isnan(val)) assert(isnan(d)); if(isnan(d)) assert(isnan(val)); if(!isnan(val) && !isnan(d)) { assert(copysign(1.0, d) == copysign(1.0, val)); assert(d == val); } /* * Encode value and check that it matches our expected buffer. */ memset(&rn, 0, sizeof(rn)); ret = asn_double2REAL(&rn, d); assert(ret == 0); if((size_t)rn.size != outsize) { printf("Encoded %f into %d expected %ld\n", d, (int)rn.size, outsize); assert((size_t)rn.size == outsize); } assert(memcmp(rn.buf, outbuf, rn.size) == 0); check_str_representation(d, sample, canonical_sample, lineno); } static void check_ber_buffer_oneway(double d, const char *sample, const char *canonical_sample, uint8_t *buf, size_t bufsize, int lineno) { REAL_t rn; double val; uint8_t *p, *end; int ret; memset(&rn, 0, sizeof(rn)); printf("verify double value %.12f [", d); for(p = (uint8_t *)&d, end = p + sizeof(double); p < end ; p++) printf("%02x", *p); printf("] (ilogb %d)\n", ilogb(d)); ret = asn_double2REAL(&rn, d); assert(ret == 0); printf("canonical DER: ["); for(p = rn.buf, end = p + rn.size; p < end; p++) printf("%02x", *p); printf("]\n"); rn.buf = buf; rn.size = bufsize; printf("received as: ["); for(p = rn.buf, end = p + rn.size; p < end; p++) printf("%02x", *p); printf("]\n"); ret = asn_REAL2double(&rn, &val); assert(ret == 0); printf("%.12f vs %.12f\n", d, val); assert(val == d); check_str_representation(val, sample, canonical_sample, lineno); } /* * 8.5.7 Verify binary encoding, two-way. */ static void check_ber_857_encoding(int base, int sign, int scaling_factor, int exponent, int mantissa) { uint8_t buf[100]; uint8_t *b = buf; int explen, mantlen; REAL_t rn; static REAL_t rn_check; double d; double verify; int baseF = 0; int ret; #define BIT(b) (1<<(b - 1)) switch(base) { case 0: baseF = 1; break; case 1: baseF = 3; break; case 2: baseF = 4; break; default: assert(base >= 0 && base <= 2); } if(exponent >= -128 && exponent <= 127) { explen = 1; } else { assert(exponent > -60000 && exponent < 60000); explen = 2; } if(mantissa == 0) { mantlen = 0; } else if(mantissa >= 0 && mantissa <= 255) { mantlen = 1; } else if(mantissa >= 0 && mantissa <= 65535) { mantlen = 2; } else { assert(mantissa >= 0 && mantissa <= 256 * 65536); mantlen = 3; } *b = BIT(8) | (sign ? BIT(7) : 0); *b |= (base & 0x03) << 4; /* 8.5.7.2 */ *b |= (scaling_factor & 0x03) << 2; /* 8.5.7.3 */ *b |= ((explen - 1) & 0x03); /* 8.5.7.4 */ b++; switch(explen) { case 2: *b++ = (int8_t)(exponent >> 8); case 1: *b++ = (int8_t)exponent; } switch(mantlen) { case 3: *b++ = (mantissa >> 16) & 0xff; case 2: *b++ = (mantissa >> 8) & 0xff; case 1: *b++ = (mantissa & 0xff); } verify = (sign ? -1.0 : 1.0) * ldexp(mantissa, exponent * baseF + scaling_factor); /* Verify than encoding of this double value round-trips */ if(!isinf(verify)) { d = verify; verify = 0.0; ret = asn_double2REAL(&rn_check, d); assert(ret == 0); ret = asn_REAL2double(&rn_check, &verify); assert(ret == 0); assert(d == verify); /* Verify with a slight non-friendly offset. Not too easy. */ d = verify - 0.13; verify = 0.0; ret = asn_double2REAL(&rn_check, d); assert(ret == 0); ret = asn_REAL2double(&rn_check, &verify); assert(ret == 0); assert(ret == 0); assert(d == verify); } verify = (sign ? -1.0 : 1.0) * ldexp(mantissa, exponent * baseF + scaling_factor); rn.buf = buf; rn.size = b - buf; ret = asn_REAL2double(&rn, &d); if(!isinf(verify) && (ret != 0 || d != verify)) { printf("Converting B=%d, S=%d, F=%d, E=%d/%d, M=%d/%d\n", (1 << baseF), sign, scaling_factor, exponent, explen, mantissa, mantlen); printf("Verify: %e\n", verify); uint8_t *p; printf("received as: ["); for(p = buf; p < b; p++) printf("%02x", *p); printf("]\n"); assert(ret == 0); printf("Converted: %e\n", d); assert(d == verify); } } static void check_ber_encoding() { static const double zero = 0.0; #define CHECK_BER_STRICT(v, nocan, can, inbuf, outbuf) \ check_ber_buffer_twoway(v, nocan, can, inbuf, sizeof(inbuf), \ outbuf, sizeof(outbuf), __LINE__) #define CHECK_BER_NONSTRICT(v, nocan, can, buf) \ check_ber_buffer_oneway(v, nocan, can, buf, sizeof(buf), __LINE__) /* * X.690 8.4 Encoding of an enumerated value. */ /* 8.5.2 If the real value is the value plus zero, * there shall be no contents octet in the encoding */ { uint8_t b_0[] = {}; CHECK_BER_STRICT(0.0, "0", "0", b_0, b_0); } /* 8.5.3 When -0 is to be encoded, there shall be only one contents octet */ { uint8_t b_m0[] = { 0x43 }; CHECK_BER_STRICT(-0.0, "-0", "-0", b_m0, b_m0); } /* Old way of encoding -0.0: 8.5.6 a) */ { uint8_t b_m0[] = { 0x43 }; uint8_t b_m0_856a[] = { 0xC0, 0x00 }; /* #8.5.6 a) */ uint8_t b_m0_856a_1[] = { 0xC0, 0x00, 0x00 }; uint8_t b_m0_856a_2[] = { 0xC0, 0x00, 0x00, 0x00 }; uint8_t b_m0_856a_3[] = { 0xC0, 0x00, 0x00, 0x00, 0x00 }; CHECK_BER_STRICT(-0.0, "-0", "-0", b_m0_856a, b_m0); CHECK_BER_STRICT(-0.0, "-0", "-0", b_m0_856a_1, b_m0); CHECK_BER_STRICT(-0.0, "-0", "-0", b_m0_856a_2, b_m0); CHECK_BER_STRICT(-0.0, "-0", "-0", b_m0_856a_3, b_m0); } /* 8.5.6 c) => 8.5.9 SpecialRealValue */ { uint8_t b_pinf[] = { 0x40 }; uint8_t b_minf[] = { 0x41 }; uint8_t b_nan[] = { 0x42 }; CHECK_BER_STRICT(1.0/zero, "", "", b_pinf, b_pinf); CHECK_BER_STRICT(-1.0/zero, "", "", b_minf, b_minf); CHECK_BER_STRICT(zero/zero, "", "", b_nan, b_nan); } /* 8.5.6 b) => 8.5.8 Decimal encoding is used; NR1 form */ { uint8_t b_0_nr1[] = { 0x01, '0' }; uint8_t b_0[] = { }; CHECK_BER_STRICT(0.0, "0", "0", b_0_nr1, b_0); } { uint8_t b_0_nr1[] = { 0x01, '0', '0' }; uint8_t b_0[] = { }; CHECK_BER_STRICT(0.0, "0", "0", b_0_nr1, b_0); } { uint8_t b_0_nr1[] = { 0x01, ' ', '0' }; uint8_t b_0[] = { }; CHECK_BER_STRICT(0.0, "0", "0", b_0_nr1, b_0); } { uint8_t b_p0_nr1[] = { 0x01, '+', '0' }; uint8_t b_0[] = { }; CHECK_BER_STRICT(0.0, "0", "0", b_p0_nr1, b_0); } { uint8_t b_p0_nr1[] = { 0x01, ' ', '+', '0' }; uint8_t b_0[] = { }; CHECK_BER_STRICT(0.0, "0", "0", b_p0_nr1, b_0); } { uint8_t b_m0_nr1[] = { 0x01, '-', '0' }; uint8_t b_m0[] = { 0x43 }; CHECK_BER_STRICT(-0.0, "-0", "-0", b_m0_nr1, b_m0); } { uint8_t b_m0_nr1[] = { 0x01, ' ', '-', '0' }; uint8_t b_m0[] = { 0x43 }; CHECK_BER_STRICT(-0.0, "-0", "-0", b_m0_nr1, b_m0); } { uint8_t b_1_nr1[] = { 0x01, '1' }; uint8_t b_1[] = { 0x80, 0x00, 0x01 }; CHECK_BER_STRICT(1.0, "1.0", "1.0E0", b_1_nr1, b_1); } { uint8_t b_1_nr1[] = { 0x01, '0', '1' }; uint8_t b_1[] = { 0x80, 0x00, 0x01 }; CHECK_BER_STRICT(1.0, "1.0", "1.0E0", b_1_nr1, b_1); } { uint8_t b_1_nr1[] = { 0x01, ' ', '1' }; uint8_t b_1[] = { 0x80, 0x00, 0x01 }; CHECK_BER_STRICT(1.0, "1.0", "1.0E0", b_1_nr1, b_1); } { uint8_t b_p1_nr1[] = { 0x01, '+', '1' }; uint8_t b_1[] = { 0x80, 0x00, 0x01 }; CHECK_BER_STRICT(1.0, "1.0", "1.0E0", b_p1_nr1, b_1); } { uint8_t b_p1_nr1[] = { 0x01, ' ', '+', '1' }; uint8_t b_1[] = { 0x80, 0x00, 0x01 }; CHECK_BER_STRICT(1.0, "1.0", "1.0E0", b_p1_nr1, b_1); } { uint8_t b_m1_nr1[] = { 0x01, '-', '1' }; uint8_t b_m1[] = { 0xC0, 0x00, 0x01 }; CHECK_BER_STRICT(-1.0, "-1.0", "-1.0E0", b_m1_nr1, b_m1); } { uint8_t b_m1_nr1[] = { 0x01, ' ', '-', '1' }; uint8_t b_m1[] = { 0xC0, 0x00, 0x01 }; CHECK_BER_STRICT(-1.0, "-1.0", "-1.0E0", b_m1_nr1, b_m1); } { uint8_t comma_symbol[] = { '.', ',' }; int csi; for(csi = 0; csi < 2; csi++) { uint8_t CS = comma_symbol[csi]; /* 8.5.6 b) => 8.5.8 Decimal encoding is used; NR2 form */ { uint8_t b_0_nr2[] = { 0x02, '0', CS, '0' }; uint8_t b_0[] = { }; CHECK_BER_STRICT(0.0, "0", "0", b_0_nr2, b_0); } { uint8_t b_0_nr2[] = { 0x02, '0', '0', CS, '0' }; uint8_t b_0[] = { }; CHECK_BER_STRICT(0.0, "0", "0", b_0_nr2, b_0); } { uint8_t b_0_nr2[] = { 0x02, ' ', '0', CS, '0' }; uint8_t b_0[] = { }; CHECK_BER_STRICT(0.0, "0", "0", b_0_nr2, b_0); } { uint8_t b_p0_nr2[] = { 0x02, '+', '0', CS, '0' }; uint8_t b_0[] = { }; CHECK_BER_STRICT(0.0, "0", "0", b_p0_nr2, b_0); } { uint8_t b_p0_nr2[] = { 0x02, ' ', '+', '0', CS, '0' }; uint8_t b_0[] = { }; CHECK_BER_STRICT(0.0, "0", "0", b_p0_nr2, b_0); } { uint8_t b_m0_nr2[] = { 0x02, '-', '0', CS, '0' }; uint8_t b_m0[] = { 0x43 }; CHECK_BER_STRICT(-0.0, "-0", "-0", b_m0_nr2, b_m0); } { uint8_t b_m0_nr2[] = { 0x02, ' ', '-', '0', CS, '0' }; uint8_t b_m0[] = { 0x43 }; CHECK_BER_STRICT(-0.0, "-0", "-0", b_m0_nr2, b_m0); } /* 8.5.6 b) => 8.5.8 NR2 "1." */ { uint8_t b_1_nr2[] = { 0x02, '1', CS }; uint8_t b_1[] = { 0x80, 0x00, 0x01 }; CHECK_BER_STRICT(1.0, "1.0", "1.0E0", b_1_nr2, b_1); } { uint8_t b_1_nr2[] = { 0x02, '0', '1', CS }; uint8_t b_1[] = { 0x80, 0x00, 0x01 }; CHECK_BER_STRICT(1.0, "1.0", "1.0E0", b_1_nr2, b_1); } { uint8_t b_1_nr2[] = { 0x02, ' ', '1', CS }; uint8_t b_1[] = { 0x80, 0x00, 0x01 }; CHECK_BER_STRICT(1.0, "1.0", "1.0E0", b_1_nr2, b_1); } { uint8_t b_p1_nr2[] = { 0x02, '+', '1', CS }; uint8_t b_1[] = { 0x80, 0x00, 0x01 }; CHECK_BER_STRICT(1.0, "1.0", "1.0E0", b_p1_nr2, b_1); } { uint8_t b_p1_nr2[] = { 0x02, ' ', '+', '1', CS }; uint8_t b_1[] = { 0x80, 0x00, 0x01 }; CHECK_BER_STRICT(1.0, "1.0", "1.0E0", b_p1_nr2, b_1); } { uint8_t b_m1_nr2[] = { 0x02, '-', '1', CS }; uint8_t b_m1[] = { 0xC0, 0x00, 0x01 }; CHECK_BER_STRICT(-1.0, "-1.0", "-1.0E0", b_m1_nr2, b_m1); } { uint8_t b_m1_nr2[] = { 0x02, ' ', '-', '1', CS }; uint8_t b_m1[] = { 0xC0, 0x00, 0x01 }; CHECK_BER_STRICT(-1.0, "-1.0", "-1.0E0", b_m1_nr2, b_m1); } /* 8.5.6 b) => 8.5.8 NR2 ".5" */ { uint8_t b_05_nr2[] = { 0x02, CS, '5' }; uint8_t b_05[] = { 0x80, 0xff, 0x01 }; CHECK_BER_STRICT(0.5, "0.5", "5.0E-1", b_05_nr2, b_05); } { uint8_t b_05_nr2[] = { 0x02, '0', CS, '5' }; uint8_t b_05[] = { 0x80, 0xff, 0x01 }; CHECK_BER_STRICT(0.5, "0.5", "5.0E-1", b_05_nr2, b_05); } { uint8_t b_05_nr2[] = { 0x02, ' ', CS, '5' }; uint8_t b_05[] = { 0x80, 0xff, 0x01 }; CHECK_BER_STRICT(0.5, "0.5", "5.0E-1", b_05_nr2, b_05); } { uint8_t b_p1_nr2[] = { 0x02, '+', CS, '5' }; uint8_t b_05[] = { 0x80, 0xff, 0x01 }; CHECK_BER_STRICT(0.5, "0.5", "5.0E-1", b_p1_nr2, b_05); } { uint8_t b_p1_nr2[] = { 0x02, ' ', '+', CS, '5' }; uint8_t b_05[] = { 0x80, 0xff, 0x01 }; CHECK_BER_STRICT(0.5, "0.5", "5.0E-1", b_p1_nr2, b_05); } { uint8_t b_m05_nr2[] = { 0x02, '-', CS, '5' }; uint8_t b_m05[] = { 0xC0, 0xff, 0x01 }; CHECK_BER_STRICT(-0.5, "-0.5", "-5.0E-1", b_m05_nr2, b_m05); } { uint8_t b_m05_nr2[] = { 0x02, ' ', '-', CS, '5' }; uint8_t b_m05[] = { 0xC0, 0xff, 0x01 }; CHECK_BER_STRICT(-0.5, "-0.5", "-5.0E-1", b_m05_nr2, b_m05); } /* 8.5.6 b) => 8.5.8 Decimal encoding is used; NR3 form */ { uint8_t b_0_nr3[] = { 0x03, '0', CS, '0', 'e', '0' }; uint8_t b_0[] = { }; CHECK_BER_STRICT(0.0, "0", "0", b_0_nr3, b_0); } { uint8_t b_0_nr3[] = { 0x03, '0', '0', CS, '0', 'E', '0' }; uint8_t b_0[] = { }; CHECK_BER_STRICT(0.0, "0", "0", b_0_nr3, b_0); } { uint8_t b_0_nr3[] = { 0x03, ' ', '0', CS, '0', 'e', '0' }; uint8_t b_0[] = { }; CHECK_BER_STRICT(0.0, "0", "0", b_0_nr3, b_0); } { uint8_t b_p0_nr3[] = { 0x03, '+', '0', CS, '0', 'E', '+', '0' }; uint8_t b_0[] = { }; CHECK_BER_STRICT(0.0, "0", "0", b_p0_nr3, b_0); } { uint8_t b_p0_nr3[] = { 0x03, ' ', '+', '0', CS, '0', 'e', '+', '0' }; uint8_t b_0[] = { }; CHECK_BER_STRICT(0.0, "0", "0", b_p0_nr3, b_0); } { uint8_t b_m0_nr3[] = { 0x03, '-', '0', CS, '0', 'E', '-', '0' }; uint8_t b_m0[] = { 0x43 }; CHECK_BER_STRICT(-0.0, "-0", "-0", b_m0_nr3, b_m0); } { uint8_t b_m0_nr3[] = { 0x03, ' ', '-', '0', CS, '0', 'e', '-', '0' }; uint8_t b_m0[] = { 0x43 }; CHECK_BER_STRICT(-0.0, "-0", "-0", b_m0_nr3, b_m0); } /* 8.5.6 b) => 8.5.8 NR3 "5.e-1" */ { uint8_t b_5_nr3[] = { 0x03, '5', CS, 'e', '-', '1' }; uint8_t b_5[] = { 0x80, 0xff, 0x01 }; CHECK_BER_STRICT(0.5, "0.5", "5.0E-1", b_5_nr3, b_5); } { uint8_t b_5_nr3[] = { 0x03, '0', '5', CS, 'E', '-', '1' }; uint8_t b_5[] = { 0x80, 0xff, 0x01 }; CHECK_BER_STRICT(0.5, "0.5", "5.0E-1", b_5_nr3, b_5); } { uint8_t b_5_nr3[] = { 0x03, ' ', '5', CS, 'e', '-', '1' }; uint8_t b_5[] = { 0x80, 0xff, 0x01 }; CHECK_BER_STRICT(0.5, "0.5", "5.0E-1", b_5_nr3, b_5); } { uint8_t b_p5_nr3[] = { 0x03, '+', '5', CS, 'E', '-', '1' }; uint8_t b_5[] = { 0x80, 0xff, 0x01 }; CHECK_BER_STRICT(0.5, "0.5", "5.0E-1", b_p5_nr3, b_5); } { uint8_t b_p5_nr3[] = { 0x03, ' ', '+', '5', CS, 'e', '-', '1' }; uint8_t b_5[] = { 0x80, 0xff, 0x01 }; CHECK_BER_STRICT(0.5, "0.5", "5.0E-1", b_p5_nr3, b_5); } { uint8_t b_m5_nr3[] = { 0x03, '-', '5', CS, 'E', '-', '1' }; uint8_t b_m5[] = { 0xC0, 0xff, 0x01 }; CHECK_BER_STRICT(-0.5, "-0.5", "-5.0E-1", b_m5_nr3, b_m5); } { uint8_t b_m5_nr3[] = { 0x03, ' ', '-', '5', CS, 'e', '-', '1' }; uint8_t b_m5[] = { 0xC0, 0xff, 0x01 }; CHECK_BER_STRICT(-0.5, "-0.5", "-5.0E-1", b_m5_nr3, b_m5); } /* 8.5.6 b) => 8.5.8 NR3 ".5e1" */ { uint8_t b_05_nr3[] = { 0x03, CS, '5', 'e', '+', '1' }; uint8_t b_05[] = { 0x80, 0x00, 0x05 }; CHECK_BER_STRICT(5.0, "5.0", "5.0E0", b_05_nr3, b_05); } { uint8_t b_05_nr3[] = { 0x03, '0', CS, '5', 'E', '+', '1'}; uint8_t b_05[] = { 0x80, 0x00, 0x05 }; CHECK_BER_STRICT(5.0, "5.0", "5.0E0", b_05_nr3, b_05); } { uint8_t b_05_nr3[] = { 0x03, ' ', CS, '5', 'e', '1'}; uint8_t b_05[] = { 0x80, 0x00, 0x05 }; CHECK_BER_STRICT(5.0, "5.0", "5.0E0", b_05_nr3, b_05); } { uint8_t b_p1_nr3[] = { 0x03, '+', CS, '5', 'E', '1' }; uint8_t b_05[] = { 0x80, 0x00, 0x05 }; CHECK_BER_STRICT(5.0, "5.0", "5.0E0", b_p1_nr3, b_05); } { uint8_t b_p1_nr3[] = { 0x03, ' ', '+', CS, '5', 'e', '+', '1' }; uint8_t b_05[] = { 0x80, 0x00, 0x05 }; CHECK_BER_STRICT(5.0, "5.0", "5.0E0", b_p1_nr3, b_05); } { uint8_t b_m05_nr3[] = { 0x03, '-', CS, '5', 'E', '+', '1' }; uint8_t b_m05[] = { 0xC0, 0x00, 0x05 }; CHECK_BER_STRICT(-5.0, "-5.0", "-5.0E0", b_m05_nr3, b_m05); } { uint8_t b_m05_nr3[] = { 0x03, ' ', '-', CS, '5', 'e', '1' }; uint8_t b_m05[] = { 0xC0, 0x00, 0x05 }; CHECK_BER_STRICT(-5.0, "-5.0", "-5.0E0", b_m05_nr3, b_m05); } } /* for(comma symbol) */ } /* Scan through the range of bits, construct the valid base-2 numbers, and * try two-way conversion with them */ { int base, sign, scaling_factor, exponent, mantissa; for(base = 0; base <= 2; base++) { for(sign = 0; sign <= 1; sign++) { for(scaling_factor = 0; scaling_factor <= 3; scaling_factor++) { for(exponent = -1000; exponent < 1000; exponent += (exponent > -990 && exponent < 990) ? 100 : 1) { for(mantissa = 0; mantissa < 66000; mantissa += (mantissa > 300 && mantissa < 65400) ? 100 : 1) { check_ber_857_encoding(base, sign, scaling_factor, exponent, mantissa); } } } } } } { uint8_t b_1_0[] = { 0x80, 0xcc, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; uint8_t b_1_1[] = { 0x80, 0xcc, 0x11, 0x99, 0x99, 0x99, 0x99, 0x99, 0x9a }; uint8_t b_3_14[] = { 0x80, 0xcd, 0x19, 0x1e, 0xb8, 0x51, 0xeb, 0x85, 0x1f }; uint8_t b_3_14_mo1[] = { 0xC0, 0xc5, 0x19, 0x1e, 0xb8, 0x51, 0xeb, 0x85, 0x1f,3}; uint8_t b_3_14_mo2[] = { 0x80, 0xbd, 0x19, 0x1e, 0xb8, 0x51, 0xeb, 0x85, 0x1f,3,2}; CHECK_BER_NONSTRICT(1.0, "1.0", "1.0E0", b_1_0); CHECK_BER_NONSTRICT(1.1, "1.1", "1.1E0", b_1_1); CHECK_BER_NONSTRICT(3.14, "3.14", "3.14E0", b_3_14); /* These two are very interesting! They check mantissa overflow! */ CHECK_BER_NONSTRICT(-3.14, "-3.14", "-3.14E0", b_3_14_mo1); CHECK_BER_NONSTRICT(3.14, "3.14", "3.14E0", b_3_14_mo2); } } int main() { REAL_t rn; static const double zero = 0.0; memset(&rn, 0, sizeof(rn)); check_ber_encoding(); check(&rn, 0.0, "0", "0"); check(&rn, -0.0, "-0", "-0"); /* minus-zero */ check(&rn, zero/zero, "", ""); check(&rn, 1.0/zero, "", ""); check(&rn, -1.0/zero, "", ""); check(&rn, 1.0, "1.0", "1.0E0"); check(&rn, -1.0, "-1.0", "-1.0E0"); check(&rn, 0.1, "0.1", "1.0E-1"); check(&rn, 0.01, "0.01", "1.0E-2"); check(&rn, 0.02, "0.02", "2.0E-2"); check(&rn, 0.09, "0.09", "9.0E-2"); check(&rn, 1.5, "1.5", "1.5E0"); check(&rn, 0.33333, "0.33333", "3.3333E-1"); check(&rn, 2, "2.0", "2.0E0"); check(&rn, 2.1, "2.1", "2.1E0"); check(&rn, 3, "3.0", "3.0E0"); check(&rn, 3.1, "3.1", "3.1E0"); check(&rn, 3.14, "3.14", "3.14E0"); check(&rn, 3.1415, "3.1415", "3.1415E0"); check(&rn, 3.141592, "3.141592", "3.141592E0"); check(&rn, 3.14159265, "3.14159265", "3.14159265E0"); check(&rn, -3.14159265, "-3.14159265", "-3.14159265E0"); check(&rn, 14159265.0, "14159265.0", "1.4159265E7"); check(&rn, -123456789123456789.0, "-123456789123456784.0", "-1.234567891234568E17"); check(&rn, 0.00000000001, "0.00000000001", "9.999999999999999E-12"); check(&rn, 0.00000000002, "0.00000000002", "2.0E-11"); check(&rn, 0.00000000009, "0.00000000009", "9.0E-11"); check(&rn, 0.000000000002, "0.000000000002", "2.0E-12"); check(&rn, 0.0000000000002, "0.0000000000002", "2.0E-13"); check(&rn, 0.00000000000002, "0.00000000000002", "2.0E-14"); check(&rn, 0.000000000000002, "0.000000000000002", "2.0E-15"); check(&rn, 0.0000000000000002, "0.0", "2.0E-16"); check(&rn, 0.0000000000000000000001, "0.0", "1.0E-22"); check(&rn, 0.000000000000000000000000000001, "0.0", "1.0E-30"); /* proved 2B a problem */ check(&rn,-0.000000000000000000000000000001, "-0.0", "-1.0E-30"); /* proved 2B a problem */ check(&rn, 0.0000000000010000000001000000000001, 0, 0); check(&rn, 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001, 0, 0); check(&rn, 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001, 0, 0); check(&rn,-0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001, 0, 0); check(&rn,-3.33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333, 0, 0); check(&rn, 0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000033333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333, 0, 0); check(&rn, 0.25, "0.25", "2.5E-1"); check(&rn, -0.25, "-0.25", "-2.5E-1"); check(&rn, 0.03, "0.03", "3.0E-2"); check(&rn, -0.03, "-0.03", "-3.0E-2"); check(&rn, 4.01E-50, "0.0", "4.01E-50"); check(&rn, -4.01E-50, "-0.0", "-4.01E-50"); check(&rn, -4.9406564584124654E-324, "-0.0", "-4.940656458412465E-324"); /* MIN */ check(&rn, DBL_MIN, "0.0", "2.225073858507201E-308"); /* MIN */ check(&rn, -DBL_MIN, "-0.0", "-2.225073858507201E-308"); /* -MIN */ check(&rn, DBL_MAX, "179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0", "1.797693134862316E308"); /* MAX */ check(&rn, -DBL_MAX, "-179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0", "-1.797693134862316E308"); /* MAX */ check(&rn, -DBL_TRUE_MIN, "-0.0", "-4.940656458412465E-324"); /* subnorm */ check(&rn, DBL_TRUE_MIN, "0.0", "4.940656458412465E-324"); /* subnorm */ #ifdef NAN check_xer(0, NAN); /* "" */ #else check_xer(0, zero/zero); /* "" */ #endif #ifdef INFINITY check_xer(0, INFINITY); /* "" */ check_xer(0, -INFINITY); /* "" */ #else check_xer(0, 1.0/zero); /* "" */ check_xer(0, -1.0/zero); /* "" */ #endif check_xer(0, 1.0); check_xer(0, -1.0); check_xer(0, 1.5); check_xer(0, 123); check_xer(1, 0.0000000000000000000001); check_xer(1, -0.0000000000000000000001); return 0; } asn1c-0.9.28+dfsg/skeletons/tests/check-GeneralizedTime.c0000644000000000000000000001646513065714043021713 0ustar rootroot#include #include #include #include #include /* for pow(3) */ static void recognize(char *time_str, time_t expect, int as_gmt) { GeneralizedTime_t gt; struct tm tm; time_t tloc; int fv, fp; gt.buf = (uint8_t *)time_str; gt.size = strlen(time_str); tloc = asn_GT2time_frac(>, &fv, &fp, &tm, as_gmt); printf("%s: [%s] -> %ld == %ld\n", as_gmt?"GMT":"ofs", time_str, (long)tloc, (long)expect); if(tloc != -1) { printf("\t%04d-%02d-%02dT%02d:%02d:%02d.%f(%d/%d)%+03ld%02ld\n", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, (double)fv * pow(0.1, fp), fv, fp, (GMTOFF(tm) / 3600), labs(GMTOFF(tm) % 3600) ); } assert(tloc == expect); #ifdef HAVE_TM_GMTOFF assert(tloc == -1 || as_gmt == 0 || GMTOFF(tm) == 0); #endif if(!as_gmt) recognize(time_str, expect, 1); } static void encode(time_t tloc, const char *expect, int force_gmt) { GeneralizedTime_t *gt; struct tm tm, *tmp; tmp = localtime_r(&tloc, &tm); assert(tmp); gt = asn_time2GT(0, &tm, force_gmt); if(gt) { assert(expect); printf("[%s] vs [%s] (%d)\n", gt->buf, expect, force_gmt); assert(gt->size == (int)strlen((char *)gt->buf)); assert(!strcmp((char *)gt->buf, expect)); } else { assert(!expect); } } #define RECODE(foo, bar) recode(__LINE__, foo, bar) static void recode(int lineno, char *time_str, const char *expect) { int frac_value, frac_digits; GeneralizedTime_t gt; struct tm tm; time_t tloc; char *tz; gt.buf = (uint8_t *)time_str; gt.size = strlen(time_str); tloc = asn_GT2time_frac(>, &frac_value, &frac_digits, &tm, 1); assert(tloc != -1); gt.buf = 0; asn_time2GT_frac(>, &tm, frac_value, frac_digits, 1); assert(gt.buf); tz = getenv("TZ"); printf("%d: [%s] (%ld) => [%s] == [%s] (%d, %d) (TZ=%s)\n", lineno, time_str, (long)tloc, gt.buf, expect, frac_value, frac_digits, tz ? tz : ""); assert(strcmp((char *)gt.buf, expect) == 0); FREEMEM(gt.buf); } static void check_fractions() { GeneralizedTime_t *gt = 0; struct tm tm; int fv, fd; time_t tloc; memset(&tm, 0, sizeof tm); tm.tm_year = 70; tm.tm_mday = 1; gt = asn_time2GT_frac(gt, &tm, -1, -1, 1); assert(gt); printf("[%s]\n", gt->buf); assert(strcmp((char *)gt->buf, "19700101000000Z") == 0); gt = asn_time2GT_frac(gt, &tm, 0, 0, 1); assert(gt); printf("[%s]\n", gt->buf); assert(strcmp((char *)gt->buf, "19700101000000Z") == 0); gt = asn_time2GT_frac(gt, &tm, 0, -1, 1); assert(gt); printf("[%s]\n", gt->buf); assert(strcmp((char *)gt->buf, "19700101000000Z") == 0); gt = asn_time2GT_frac(gt, &tm, -1, 0, 1); assert(gt); printf("[%s]\n", gt->buf); assert(strcmp((char *)gt->buf, "19700101000000Z") == 0); gt = asn_time2GT_frac(gt, &tm, 10, 0, 1); assert(gt); printf("[%s]\n", gt->buf); assert(strcmp((char *)gt->buf, "19700101000000Z") == 0); /* Normalization should happen prior to calling the _frac() */ gt = asn_time2GT_frac(gt, &tm, 55, 2, 1); assert(gt); printf("[%s]\n", gt->buf); assert(strcmp((char *)gt->buf, "19700101000000.55Z") == 0); gt = asn_time2GT_frac(gt, &tm, 5, 2, 1); assert(gt); printf("[%s]\n", gt->buf); assert(strcmp((char *)gt->buf, "19700101000000.05Z") == 0); /* Normalization should happen prior calling the _frac() */ gt = asn_time2GT_frac(gt, &tm, 900, 2, 1); assert(gt); printf("[%s]\n", gt->buf); assert(strcmp((char *)gt->buf, "19700101000000Z") == 0); gt = asn_time2GT_frac(gt, &tm, 90, 2, 1); assert(gt); printf("[%s]\n", gt->buf); assert(strcmp((char *)gt->buf, "19700101000000.9Z") == 0); tloc = asn_GT2time_prec(gt, &fv, 0, 0, 1); assert(tloc == 0); assert(fv == 0); tloc = asn_GT2time_prec(gt, &fv, 1, 0, 1); assert(tloc == 0); assert(fv == 9); tloc = asn_GT2time_prec(gt, &fv, 2, 0, 1); assert(tloc == 0); assert(fv == 90); tloc = asn_GT2time_frac(gt, &fv, &fd, 0, 1); assert(tloc == 0); assert(fv == 9); assert(fd == 1); gt->buf[gt->size-1] = '0'; gt->buf[gt->size++] = 'Z'; gt->buf[gt->size] = '\0'; tloc = asn_GT2time_frac(gt, &fv, &fd, 0, 1); assert(tloc == 0); assert(fd == 2); assert(fv == 90); tloc = asn_GT2time_prec(gt, &fv, 1, 0, 1); assert(tloc == 0); assert(fv == 9); tloc = asn_GT2time_prec(gt, &fv, 100, 0, 1); assert(tloc == 0); assert(fv == 0); FREEMEM(gt->buf); FREEMEM(gt); } int main(int ac, char **av) { char *tz = getenv("TZ"); (void)av; printf("TZ = [%s]\n", tz ? tz : ""); check_fractions(); recognize("200401250", -1, 0); recognize("2004012509300", -1, 0); recognize("20040125093000-", -1, 0); recognize("20040125093007-0", -1, 0); recognize("20040125093007-080", -1, 0); recognize("200401250930.01Z", -1, 0); /* These six are from X.690:11.7.5 */ recognize("19920520240000Z", -1, 0); /* midnight represented incorrectly */ recognize("19920622123421.0Z", 709216461, 0); /* spurious trailing zeros */ recognize("19920722132100.30Z", 711811260, 0); /* spurious trailing zeros */ recognize("19920521000000Z", 706406400, 0); recognize("19920622123421Z", 709216461, 0); recognize("19920722132100.3Z", 711811260, 0); recognize("20040125093007Z", 1075023007, 0); recognize("20040125093007+00", 1075023007, 0); recognize("20040125093007.01+0000", 1075023007, 0); recognize("20040125093007,1+0000", 1075023007, 0); recognize("20040125093007-0800", 1075051807, 0); recognize("19920722132100.123000123Z", 711811260, 0); recognize("19920722132100.1230000123Z", 711811260, 0); recognize("19920722132100.12300000123Z", 711811260, 0); encode(1075023007, "20040125093007Z", 1); if(ac > 1) { /* These will be valid only inside PST time zone */ recognize("20040125093007", 1075051807, 0); recognize("200401250930", 1075051800, 0); recognize("20040125093000,01", 1075051800, 0); recognize("20040125093000,1234", 1075051800, 0); encode(1075023007, "20040125013007-0800", 0); RECODE("20050702123312", "20050702193312Z"); } #if defined(sun) || defined(__sun) || defined(_sun_) || defined(__solaris__) printf("Solaris does not have a decent timegm() function.\n"); #else /* !solaris */ RECODE("20050702123312Z", "20050702123312Z"); RECODE("20050702123312+01", "20050702113312Z"); RECODE("20050702123312,0+01", "20050702113312Z"); RECODE("20050702123312,1+01", "20050702113312.1Z"); RECODE("20050702123312.01+01", "20050702113312.01Z"); RECODE("20050702123312.00+01", "20050702113312Z"); RECODE("20050702123312.30+01", "20050702113312.3Z"); RECODE("20050702123312,30000+01", "20050702113312.3Z"); RECODE("20050702123312,300000000+01", "20050702113312.3Z"); RECODE("20050702123312.123456+01", "20050702113312.123456Z"); RECODE("20050702123312.1234567+01", "20050702113312.123456Z"); RECODE("20050702123312.12345678+01", "20050702113312.123456Z"); RECODE("20050702123312.123456789+01", "20050702113312.123456Z"); RECODE("20050702123312.2000000000+01", "20050702113312.2Z"); RECODE("20050702123312.3000000000+01", "20050702113312.3Z"); RECODE("20050702123312.4000000000+01", "20050702113312.4Z"); RECODE("20050702123312.5000000000+01", "20050702113312.5Z"); RECODE("20050702123312.5000000001+01", "20050702113312.5Z"); RECODE("20050702123312.5000010001+01", "20050702113312.500001Z"); RECODE("20050702123312.5000001001+01", "20050702113312.5Z"); RECODE("20050702123312.000001+01", "20050702113312.000001Z"); RECODE("20050702123312.0000001Z", "20050702123312Z"); RECODE("20050702123312.0080010+1056", "20050702013712.008001Z"); #endif return 0; } asn1c-0.9.28+dfsg/skeletons/tests/check-XER.c0000644000000000000000000000454113065714043017271 0ustar rootroot#include #include #include #include static void check(char *tag, char *name, xer_check_tag_e value) { xer_check_tag_e xct; xct = xer_check_tag(tag, strlen(tag), name); printf("[%s] vs [%s]: %d == %d\n", tag, name, xct, value); assert(xct == value); } static void check_next(char *xerbuf, int expected_chunk_size, pxer_chunk_type_e expected_chunk_type) { int xerbuf_len = strlen(xerbuf); pxer_chunk_type_e ch_type; ssize_t ch_size; int state = 0; if(expected_chunk_size == -1) expected_chunk_size = xerbuf_len; ch_size = xer_next_token(&state, xerbuf, xerbuf_len, &ch_type); printf("[%s]:%d\n", xerbuf, xerbuf_len); printf("chunk sizes: %ld vs %ld, chunk types: %d vs %ld\n", (long)ch_size, (long)expected_chunk_size, ch_type, (long)expected_chunk_type ); if(expected_chunk_type == PXER_WMORE) { assert(ch_size == 0); } else { assert(ch_size == expected_chunk_size); assert(ch_type == expected_chunk_type); } } int main() { check("", "", XCT_BROKEN); check("<", "", XCT_BROKEN); check(">", "", XCT_BROKEN); check("", "", XCT_BROKEN); check("<>", "", XCT_UNKNOWN_OP); check("", "", XCT_UNKNOWN_CL); check("", "a", XCT_BROKEN); check("<>", "a", XCT_UNKNOWN_OP); check("", "a", XCT_UNKNOWN_CL); check("a", "a", XCT_BROKEN); check("", "a", XCT_OPENING); check("", "a", XCT_CLOSING); check("", "a", XCT_BROKEN); check("", "a", XCT_BOTH); check("", "a", XCT_OPENING); check("", "a", XCT_CLOSING); check("", "a", XCT_BROKEN); check("", "a", XCT_BOTH); check("", "a", XCT_UNKNOWN_OP); check("", "tag", XCT_OPENING); check("", "tag", XCT_CLOSING); check("", "tag", XCT_BROKEN); check("", "tag", XCT_BOTH); check("", "ta", XCT_UNKNOWN_OP); check("", "ta", XCT_UNKNOWN_CL); check("", "ta", XCT_BROKEN); check("", "ta", XCT_UNKNOWN_BO); check("", "tag", XCT_BOTH); check_next("", -1, PXER_TAG); check_next("la", 5, PXER_TAG); check_next("", -1, PXER_COMMENT); return 0; } asn1c-0.9.28+dfsg/skeletons/tests/check-ber_tlv_tag.c0000644000000000000000000000732313065714043021124 0ustar rootroot#include #include #include #include #include struct tag_control_s { int taglen; uint8_t tagbuf[8]; int correctly_decodable; int tclass; /* Tag class */ ber_tlv_tag_t tvalue; /* Tag value */ int constr; /* Is it constructed? */ } control[] = { { 1, { 0x2 << 6 }, 1, ASN_TAG_CLASS_CONTEXT, 0, 0 }, { 1, { 0x2 << 6 | 32 | 1 }, 1, ASN_TAG_CLASS_CONTEXT, 1, 1 }, { 1, { 0x3 << 6 | 30 }, 1, ASN_TAG_CLASS_PRIVATE, 30, 0 }, { 1, { 29 }, 1, ASN_TAG_CLASS_UNIVERSAL, 29, 0 }, { 1, { 0xbf, 31 }, 0, ASN_TAG_CLASS_CONTEXT, 31, 1 }, { 2, { 0xbf, 31 }, 1, ASN_TAG_CLASS_CONTEXT, 31, 1 }, { 2, { 0xbf, 83 }, 1, ASN_TAG_CLASS_CONTEXT, 83, 1 }, { 2, { 0xbf, 127 }, 1, ASN_TAG_CLASS_CONTEXT, 127, 1 }, { 2, { 0xbf, 129 }, 0, ASN_TAG_CLASS_CONTEXT, 127, 1 }, { 3, { 0xbf, 129, 0 }, 1, ASN_TAG_CLASS_CONTEXT, 128, 1 }, { 3, { 0xbf, 129, 1 }, 1, ASN_TAG_CLASS_CONTEXT, 129, 1 }, { 3, { 0xbf, 130, 0 }, 1, ASN_TAG_CLASS_CONTEXT, 256, 1 }, { 3, { 0xbf, 130, 1 }, 1, ASN_TAG_CLASS_CONTEXT, 257, 1 }, { 3, { 0xbf, 130, 0x81 }, 0, 0, 0, 0 }, { 4, { 0xbf, 130, 0x81, 2 }, 1, ASN_TAG_CLASS_CONTEXT, 32898, 1 }, { 4, { 0xbf, 130, 0x81, 0x82 }, 0, ASN_TAG_CLASS_CONTEXT, 32898, 1 }, { 5, { 0x1f, 130, 0x81, 0x82, 1 }, 1, 0, 4210945, 0 }, { 5, { 0x1f, 130, 0x81, 0x82, 2 }, 1, 0, 4210946, 0 }, { 5, { 0x1f, 0xff, 0x81, 0x82, 2 }, 1, 0, 266354946, 0 }, { 6, { 0x1f, 0xff, 0xff, 0x82, 0x80, 1 }, -1, 0, 266354946, 0 }, { 7, { 0x1f, 0x8E, 0x87, 0xAA, 0x95, 0x99, 3}, -1, 0, 4000000000UL, 0 }, }; static void check_decode(struct tag_control_s *ctrl); static void check_encode(struct tag_control_s *ctrl); int main() { size_t i; for(i = 0; i < sizeof(control) / sizeof(control[0]); i++) { check_decode(&control[i]); check_encode(&control[i]); } return 0; } static void check_decode(struct tag_control_s *ctrl) { ber_tlv_tag_t tag = 123; ber_tlv_tag_t tag1 = 124; ber_tlv_tag_t tag2 = 125; ssize_t size; if(ctrl->correctly_decodable < 1) { size = ber_fetch_tag(ctrl->tagbuf, ctrl->taglen, &tag1); assert(size == ctrl->correctly_decodable); return; } printf("Expecting "); tag = (ctrl->tvalue << 2) | ctrl->tclass; ber_tlv_tag_fwrite(tag, stdout); printf(", got "); size = ber_fetch_tag(ctrl->tagbuf, 0, &tag1); assert(size == 0); size = ber_fetch_tag(ctrl->tagbuf, ctrl->taglen, &tag1); assert(size == ctrl->taglen); size = ber_fetch_tag(ctrl->tagbuf, ctrl->taglen + 10, &tag2); assert(size == ctrl->taglen); ber_tlv_tag_fwrite(tag1, stdout); printf("\n"); assert(tag1 == tag2); assert(tag == tag1); assert(ctrl->constr == BER_TLV_CONSTRUCTED(ctrl->tagbuf)); } static void check_encode(struct tag_control_s *ctrl) { uint8_t buf[16]; ber_tlv_tag_t tag; int Filler = 0xDA; ssize_t size; ssize_t i; tag = ctrl->tvalue << 2 | ctrl->tclass; /* * Testing buffer overruns. */ for(i = 0; i < (int)sizeof(buf); i++) { int j; memset(buf, Filler, sizeof(buf)); size = ber_tlv_tag_serialize(tag, buf, i); assert(size < (int)sizeof(buf)); if(size <= i) { for(j = 0; j < size; j++) assert(buf[j] != Filler); } else { j = i; } for(; j < (int)sizeof(buf); j++) assert(buf[j] == Filler); } memset(buf, Filler, sizeof(buf)); size = ber_tlv_tag_serialize(tag, buf, sizeof(buf)); assert(size < (int)sizeof(buf)); for(i = 0; i < size; i++) assert(buf[i] != Filler); for(; i < (int)sizeof(buf); i++) assert(buf[i] == Filler); if(ctrl->correctly_decodable == 1) { assert(size == ctrl->taglen); } if(ctrl->constr) *buf |= 0x20; ber_tlv_tag_fwrite(tag, stdout); printf(":"); for(i = 0; i < size; i++) { printf(" %02x", buf[i]); if(ctrl->correctly_decodable == 1) { assert(ctrl->tagbuf[i] == buf[i]); } } printf("\n"); } asn1c-0.9.28+dfsg/skeletons/tests/check-INTEGER.c0000644000000000000000000002165513065714043017735 0ustar rootroot#include #include #include static char *shared_scratch_start; static int _print2buf(const void *buf, size_t size, void *key) { (void)key; memcpy(shared_scratch_start, buf, size); shared_scratch_start += size; *shared_scratch_start = '\0'; /* 0-termination */ return 0; } static void check(uint8_t *buf, int size, long check_long, int check_ret) { char scratch[128]; char verify[32]; INTEGER_t val; uint8_t *buf_end = buf + size; int ret; long rlong = 123; assert(buf); assert(size >= 0); val.buf = buf; val.size = size; printf("Testing: ["); for(; buf < buf_end; buf++) { if(buf != val.buf) printf(":"); printf("%02x", *buf); } printf("]: "); ret = asn_INTEGER2long(&val, &rlong); printf(" (%ld, %d) vs (%ld, %d)\n", rlong, ret, check_long, check_ret); assert(ret == check_ret); printf("%ld %ld\n", rlong, check_long); assert(rlong == check_long); if(check_ret == 0) { INTEGER_t val2; long rlong2; val2.buf = 0; val2.size = 0; ret = asn_long2INTEGER(&val2, rlong); assert(ret == 0); assert(val2.buf); assert(val2.size <= val.size); /* At least as compact */ ret = asn_INTEGER2long(&val, &rlong2); assert(ret == 0); assert(rlong == rlong2); } shared_scratch_start = scratch; ret = INTEGER_print(&asn_DEF_INTEGER, &val, 0, _print2buf, scratch); assert(shared_scratch_start < scratch + sizeof(scratch)); assert(ret == 0); ret = snprintf(verify, sizeof(verify), "%ld", check_long); assert(ret < 0 || (size_t)ret < sizeof(verify)); ret = strcmp(scratch, verify); printf(" [%s] vs [%s]: %d%s\n", scratch, verify, ret, (check_ret == -1)?" (expected to fail)":"" ); if(check_ret == -1) { assert(strcmp(scratch, verify)); } else { assert(strcmp(scratch, verify) == 0); } } static void check_unsigned(uint8_t *buf, int size, unsigned long check_long, int check_ret) { char scratch[128]; char verify[32]; INTEGER_t val; uint8_t *buf_end = buf + size; int ret; unsigned long rlong = 123; assert(buf); assert(size >= 0); val.buf = buf; val.size = size; printf("Testing: ["); for(; buf < buf_end; buf++) { if(buf != val.buf) printf(":"); printf("%02x", *buf); } printf("]: "); ret = asn_INTEGER2ulong(&val, &rlong); printf(" (%lu, %d) vs (%lu, %d)\n", rlong, ret, check_long, check_ret); assert(ret == check_ret); assert(rlong == check_long); if(check_ret == 0) { INTEGER_t val2; unsigned long rlong2; val2.buf = 0; val2.size = 0; ret = asn_ulong2INTEGER(&val2, rlong); assert(ret == 0); assert(val2.buf); if(val2.size > val.size) { /* At least as compact */ printf("val2.size=%d, val.size=%d\n", (int)val2.size, (int)val.size); assert(val2.size <= val.size); } ret = asn_INTEGER2ulong(&val, &rlong2); assert(ret == 0); assert(rlong == rlong2); } return; shared_scratch_start = scratch; ret = INTEGER_print(&asn_DEF_INTEGER, &val, 0, _print2buf, scratch); assert(shared_scratch_start < scratch + sizeof(scratch)); assert(ret == 0); ret = snprintf(verify, sizeof(verify), "%lu", check_long); assert(ret < sizeof(verify)); ret = strcmp(scratch, verify); printf(" [%s] vs [%s]: %d%s\n", scratch, verify, ret, (check_ret == -1)?" (expected to fail)":"" ); if(check_ret == -1) { assert(strcmp(scratch, verify)); } else { assert(strcmp(scratch, verify) == 0); } } static void check_xer(int tofail, char *xmldata, long orig_value) { INTEGER_t *st = 0; asn_dec_rval_t rc; long value; int ret; printf("[%s] vs %ld: ", xmldata, orig_value); rc = xer_decode(0, &asn_DEF_INTEGER, (void *)&st, xmldata, strlen(xmldata)); if(rc.code != RC_OK) { assert(tofail); printf("\tfailed, as expected\n"); return; } assert(!tofail); ret = asn_INTEGER2long(st, &value); assert(ret == 0); printf("\t%ld\n", value); assert(value == orig_value); asn_DEF_INTEGER.free_struct(&asn_DEF_INTEGER, st, 0); } int main() { uint8_t buf1[] = { 1 }; uint8_t buf2[] = { 0xff }; uint8_t buf3[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; uint8_t buf4[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0 }; uint8_t buf5[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1 }; uint8_t buf6[] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; uint8_t buf7[] = { 0xff, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; uint8_t buf8[] = { 0x7f, 0x7e, 0x7d, 0x7c }; uint8_t buf9[] = { 0, 0x7f, 0x7e, 0x7d, 0x7c }; uint8_t buf10[] = { 0, 0, 0, 0, 0, 0, 0x7f, 0x7e, 0x7d, 0x7c }; uint8_t buf11[] = { 0x80, 0, 0, 0 }; uint8_t buf12[] = { 0x80, 0 }; uint8_t buf13[] = { 0x80 }; uint8_t buf14[] = { 0x00, 0x80, 0x00, 0x00 }; uint8_t buf15[] = { 0x00, 0x80, 0x00, 0x00, 0x00 }; uint8_t buf16[] = { 0x00, 0xff, 0xff, 0x00, 0x00 }; #define UCHECK(buf, val, ret) check_unsigned(buf, sizeof(buf), val, ret) #define CHECK(buf, val, ret) check(buf, sizeof(buf), val, ret) CHECK(buf1, 1, 0); CHECK(buf2, -1, 0); CHECK(buf3, -1, 0); CHECK(buf4, -16, 0); CHECK(buf5, 257, 0); CHECK(buf6, 123, -1); CHECK(buf7, 123, -1); CHECK(buf8, 0x7F7E7D7C, 0); CHECK(buf9, 0x7F7E7D7C, 0); CHECK(buf10, 0x7F7E7D7C, 0); UCHECK(buf10, 0x7F7E7D7C, 0); CHECK(buf11, -2147483647-1, 0); /* 0x80000000 */ CHECK(buf12, -32768, 0); CHECK(buf13, -128, 0); UCHECK(buf14, 0x800000, 0); UCHECK(buf15, 0x80000000UL, 0); UCHECK(buf16, 0xffff0000UL, 0); check_xer(-1, "", 0); check_xer(-1, "", 0); check_xer(-1, " ", 0); check_xer(-1, "-", 0); check_xer(-1, "+", 0); check_xer(-1, "+-", 0); check_xer(-1, " -", 0); check_xer(-1, " +", 0); check_xer(-1, " +-", 0); check_xer(-1, "- ", 0); check_xer(-1, "+ ", 0); check_xer(-1, "+- ", 0); check_xer(-1, " - ", 0); check_xer(-1, " + ", 0); check_xer(-1, " +- ", 0); check_xer(0, "+0", 0); check_xer(0, "-0", 0); check_xer(0, "+1", 1); check_xer(0, "-1", -1); check_xer(0, "1", 1); check_xer(0, "-15", -15); check_xer(0, "+15", 15); check_xer(0, "15", 15); check_xer(0, " 15", 15); check_xer(0, " 15 ", 15); check_xer(0, "15 ", 15); check_xer(0, " +15 ", 15); check_xer(-1, " +15 -", 0); check_xer(-1, " +15 1", 0); check_xer(-1, "+ 15", 0); check_xer(-1, "1234", 0); check_xer(-1, "12 34", 0); check_xer(-1, "12 ", 0); check_xer(0, "1234", 1234); check_xer(-1, "1234 5678", 0); check_xer(0, "-2147483647", -2147483647); check_xer(0, "-2147483648", -2147483647-1); check_xer(0, "+2147483647", 2147483647); check_xer(0, "2147483647", 2147483647); if(sizeof(long) == 4) { check_xer( 0, "-2147483648", -2147483648); check_xer(-1, "-2147483649", 0); check_xer(-1, "2147483648", 0); check_xer(-1, "2147483649", 0); check_xer(-1, "3147483649", 0); check_xer(-1, "4147483649", 0); check_xer(-1, "5147483649", 0); /* special */ check_xer(-1, "9147483649", 0); check_xer(-1, "9999999999", 0); check_xer(-1, "-5147483649", 0);/* special */ check_xer(-1, "-9147483649", 0); check_xer(-1, "-9999999999", 0); } if(sizeof(long) == 8) { check_xer(0, "2147483648", 2147483648); check_xer(0, "2147483649", 2147483649); check_xer(0, "3147483649", 3147483649); check_xer(0, "4147483649", 4147483649); check_xer(0, "5147483649", 5147483649); check_xer(0, "9147483649", 9147483649); check_xer(0, "9999999999", 9999999999); check_xer(0, "9223372036854775807", 9223372036854775807); check_xer(-1, "9223372036854775808", 0); check_xer(-1, "10223372036854775807", 0); check_xer(-1, "50223372036854775807", 0); check_xer(-1, "100223372036854775807", 0); check_xer(-1, "500223372036854775807", 0); check_xer(0, "-9223372036854775808", -9223372036854775807-1); check_xer(-1, "-9223372036854775809", 0); check_xer(-1, "-10223372036854775807", 0); check_xer(-1, "-50223372036854775807", 0); check_xer(-1, "-100223372036854775807", 0); check_xer(-1, "-500223372036854775807", 0); } return 0; } asn1c-0.9.28+dfsg/skeletons/tests/check-PER-INTEGER.c0000644000000000000000000001437213065714043020357 0ustar rootroot#include #include #include #include #include #include static int FailOut(const void *data, size_t size, void *op_key) { (void)data; (void)size; (void)op_key; assert(!"UNREACHABLE"); return 0; } static void normalize(asn_per_outp_t *po) { if(po->nboff >= 8) { po->buffer += (po->nboff >> 3); po->nbits -= (po->nboff & ~0x07); po->nboff &= 0x07; } } static void check_per_encode_constrained(int lineno, int unsigned_, long value, long lbound, unsigned long ubound, int bit_range) { INTEGER_t st; INTEGER_t *reconstructed_st = 0; struct asn_INTEGER_specifics_s specs; struct asn_per_constraints_s cts; asn_enc_rval_t enc_rval; asn_dec_rval_t dec_rval; asn_per_outp_t po; asn_per_data_t pd; if(unsigned_) printf("%d: Recoding %s %lu [%ld..%lu]\n", lineno, unsigned_ ? "unsigned" : "signed", value, lbound, ubound); else printf("%d: Recoding %s %ld [%ld..%lu]\n", lineno, unsigned_ ? "unsigned" : "signed", value, lbound, ubound); memset(&st, 0, sizeof(st)); memset(&po, 0, sizeof(po)); memset(&pd, 0, sizeof(pd)); memset(&cts, 0, sizeof(cts)); memset(&specs, 0, sizeof(specs)); cts.value.flags = APC_CONSTRAINED; cts.value.range_bits = bit_range; cts.value.effective_bits = bit_range; cts.value.lower_bound = lbound; cts.value.upper_bound = ubound; if(unsigned_) asn_ulong2INTEGER(&st, (unsigned long)value); else asn_long2INTEGER(&st, value); po.buffer = po.tmpspace; po.nboff = 0; po.nbits = 8 * sizeof(po.tmpspace); po.outper = FailOut; specs.field_width = sizeof(long); specs.field_unsigned = unsigned_; asn_DEF_INTEGER.specifics = &specs; enc_rval = INTEGER_encode_uper(&asn_DEF_INTEGER, &cts, &st, &po); assert(enc_rval.encoded == 0); normalize(&po); assert(po.buffer == &po.tmpspace[bit_range / 8]); if(unsigned_) { unsigned long recovered_value = ((uint32_t)po.tmpspace[0] << 24) | ((uint32_t)po.tmpspace[1] << 16) | ((uint32_t)po.tmpspace[2] << 8) | ((uint32_t)po.tmpspace[3] << 0); recovered_value >>= (32 - bit_range); recovered_value += cts.value.lower_bound; assert(recovered_value == (unsigned long)value); } else { long recovered_value = ((uint32_t)po.tmpspace[0] << 24) | ((uint32_t)po.tmpspace[1] << 16) | ((uint32_t)po.tmpspace[2] << 8) | ((uint32_t)po.tmpspace[3] << 0); recovered_value = (unsigned long)recovered_value >> (32 - bit_range); recovered_value += cts.value.lower_bound; assert((long)recovered_value == value); } assert(po.nboff == (size_t)((bit_range == 32) ? 0 : (8 - (32 - bit_range)))); assert(po.nbits == 8 * (sizeof(po.tmpspace) - (po.buffer-po.tmpspace))); assert(po.flushed_bytes == 0); pd.buffer = po.tmpspace; pd.nboff = 0; pd.nbits = 8 * (po.buffer - po.tmpspace) + po.nboff; pd.moved = 0; dec_rval = INTEGER_decode_uper(0, &asn_DEF_INTEGER, &cts, (void **)&reconstructed_st, &pd); assert(dec_rval.code == RC_OK); if(unsigned_) { unsigned long reconstructed_value = 0; asn_INTEGER2ulong(reconstructed_st, &reconstructed_value); assert(reconstructed_value == (unsigned long)value); } else { long reconstructed_value = 0; asn_INTEGER2long(reconstructed_st, &reconstructed_value); assert(reconstructed_value == value); } } #define CHECK(u, v, l, r, b) \ check_per_encode_constrained(__LINE__, u, v, l, r, b) int main() { int unsigned_; for(unsigned_ = 0; unsigned_ < 2; unsigned_++) { int u = unsigned_; /* Encode a signed 0x8babab into a range constrained by 0..2^29-1 */ CHECK(u, 0x8babab, 0, 536870911UL, 29); CHECK(u, 0x8babab, 0, 1073741823UL, 30); CHECK(u, 0x8babab, 0, 2147483647UL, 31); CHECK(u, 0x8babab, 10, 536870901UL, 29); CHECK(u, 0x8babab, 10, 1073741803UL, 30); CHECK(u, 0x8babab, 10, 2147483607UL, 31); CHECK(0, 0x8babab, -10, 536870901UL, 29); CHECK(0, 0x8babab, -10, 1073741803UL, 30); CHECK(0, 0x8babab, -10, 2147483607UL, 31); CHECK(u, 11, 10, 536870901UL, 29); CHECK(u, 11, 10, 1073741803UL, 30); CHECK(u, 11, 10, 2147483607UL, 31); CHECK(0, 1, -10, 536870901UL, 29); CHECK(0, 1, -10, 1073741803UL, 30); CHECK(0, 1, -10, 2147483607UL, 31); CHECK(u, 10, 10, 536870901UL, 29); CHECK(u, 10, 10, 1073741803UL, 30); CHECK(u, 10, 10, 2147483607UL, 31); CHECK(0, 0, -10, 536870901UL, 29); CHECK(0, 0, -10, 1073741803UL, 30); CHECK(0, 0, -10, 2147483607UL, 31); CHECK(0, -1, -10, 536870901UL, 29); CHECK(0, -1, -10, 1073741803UL, 30); CHECK(0, -1, -10, 2147483607UL, 31); CHECK(0, -10, -10, 536870901UL, 29); CHECK(0, -10, -10, 1073741803UL, 30); CHECK(0, -10, -10, 2147483607UL, 31); CHECK(u, 536870901UL, 10, 536870901UL, 29); CHECK(u, 1073741803UL, 10, 1073741803UL, 30); CHECK(u, 2147483607UL, 10, 2147483607UL, 31); CHECK(0, 536870901UL, -10, 536870901UL, 29); CHECK(0, 1073741803UL, -10, 1073741803UL, 30); CHECK(0, 2147483607UL, -10, 2147483607UL, 31); CHECK(0, -2147483648, -2147483648, 2147483647, 32); CHECK(0, -10, -2147483648, 2147483647, 32); CHECK(0, -1, -2147483648, 2147483647, 32); CHECK(0, 0, -2147483648, 2147483647, 32); CHECK(0, 1, -2147483648, 2147483647, 32); CHECK(0, 10, -2147483648, 2147483647, 32); CHECK(0, 2147483647, -2147483648, 2147483647, 32); CHECK(1, 0, 0, 4294967295UL, 32); CHECK(1, 1, 0, 4294967295UL, 32); CHECK(1, 10, 0, 4294967295UL, 32); CHECK(1, 2000000000, 0, 4294967295UL, 32); CHECK(1, 2147483647, 0, 4294967295UL, 32); CHECK(1, 2147483648, 0, 4294967295UL, 32); CHECK(1, 4000000000, 0, 4294967295UL, 32); CHECK(1, 4294967295UL, 0, 4294967295UL, 32); CHECK(1, 10, 10, 4294967285UL, 32); CHECK(1, 11, 10, 4294967285UL, 32); if(sizeof(long) > sizeof(uint32_t)) { CHECK(0, 0, -10, 4294967285UL, 32); CHECK(0, 1, -10, 4294967285UL, 32); CHECK(0, -1, -10, 4294967285UL, 32); CHECK(0, -10, -10, 4294967285UL, 32); CHECK(0, -10, -10, 4294967285UL, 32); CHECK(0, 0x8babab, -10, 4294967285UL, 32); CHECK(u, 0x8babab, 0, 4294967295UL, 32); CHECK(u, 11, 10, 4294967205UL, 32); CHECK(u, 10, 10, 4294967205UL, 32); CHECK(u, 4294967205UL, 10, 4294967285UL, 32); CHECK(0, 4294967205UL, -10, 4294967285UL, 32); CHECK(u, 4294967295UL, 1, 4294967295UL, 32); CHECK(u, 2000000000, 0, 4294967295UL, 32); CHECK(u, 2147483647, 0, 4294967295UL, 32); CHECK(u, 2147483648, 0, 4294967295UL, 32); CHECK(u, 4000000000, 0, 4294967295UL, 32); } } return 0; } asn1c-0.9.28+dfsg/skeletons/tests/check-UTCTime.c0000644000000000000000000000245113065714043020103 0ustar rootroot#include #include #include #include #include static void check(char *time_str, time_t sample, int as_gmt) { UTCTime_t gt; struct tm tm; time_t tloc; gt.buf = (uint8_t *)time_str; gt.size = strlen(time_str); tloc = asn_UT2time(>, &tm, as_gmt); printf("[%s] -> %ld == %ld\n", time_str, (long)tloc, (long)sample); if(tloc != -1) printf("\t%d-%d-%dT%02d:%02d:%02d %ld\n", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, GMTOFF(tm) ); assert(tloc == sample); assert(tloc == -1 || as_gmt == 0 || GMTOFF(tm) == 0); if(as_gmt) check(time_str, sample, as_gmt); } int main(int ac, char **av) { (void)av; check("0401250", -1, 0); check("0401250930", -1, 0); /* "Z" or "(+|-)hhmm" required */ check("04012509300", -1, 0); check("040125093000-", -1, 0); check("040125093007-0", -1, 0); check("040125093007-080", -1, 0); check("0401250930.01Z", -1, 0); check("040125093007Z", 1075023007, 0); check("040125093007+00", 1075023007, 0); check("040125093007-0800", 1075051807, 0); if(ac > 1) { /* These will be valid only inside PST time zone */ check("040125093007", 1075051807, 0); check("040125093000,01", 1075051800, 0); check("040125093000,1234", 1075051800, 0); } return 0; } asn1c-0.9.28+dfsg/skeletons/tests/check-PER.c0000644000000000000000000002255313065714043017264 0ustar rootroot#include #include #include #include static void check_per_decoding() { uint8_t buf[] = { 0xB7, 0x19, 0x2F, 0xEE, 0xAD }; uint8_t tmpbuf[10]; int32_t z; asn_per_data_t pos; memset(&pos, 0, sizeof(pos)); pos.buffer = buf; pos.nboff = 0; pos.nbits = sizeof(buf) * 8; z = per_get_few_bits(&pos, 32); assert(z == -1); assert(pos.nbits == sizeof(buf) * 8); z = per_get_few_bits(&pos, 0); assert(z == 0); assert(pos.nboff == 0); assert(pos.nbits == sizeof(buf) * 8); z = per_get_few_bits(&pos, 1); assert(z == 1); assert(pos.nboff == 1); assert(pos.nbits == sizeof(buf) * 8); z = per_get_few_bits(&pos, 2); assert(z == 1); assert(pos.nboff == 3); assert(pos.nbits == sizeof(buf) * 8); z = per_get_few_bits(&pos, 2); assert(z == 2); assert(pos.nboff == 5); assert(pos.nbits == sizeof(buf) * 8); z = per_get_few_bits(&pos, 3); assert(z == 7); assert(pos.nboff == 8); assert(pos.nbits == sizeof(buf) * 8); z = per_get_few_bits(&pos, 8); assert(z == 0x19); assert(pos.nboff == 8); assert(pos.nbits == (sizeof(buf) - 1) * 8); z = per_get_few_bits(&pos, 1); assert(z == 0); assert(pos.nboff == 1); assert(pos.nbits == (sizeof(buf) - 2) * 8); z = per_get_few_bits(&pos, 3); assert(z == 2); assert(pos.nboff == 4); assert(pos.nbits == (sizeof(buf) - 2) * 8); z = per_get_few_bits(&pos, 8); assert(z == 254); assert(pos.nboff == 12); pos.buffer = buf; pos.nboff = 2; pos.nbits = sizeof(buf) * 8; z = per_get_few_bits(&pos, 24); assert(z == 14443711); pos.buffer = (unsigned char *)"\001"; pos.nboff = 7; pos.nbits = 7; z = per_get_few_bits(&pos, 1); assert(pos.nboff == 7); assert(pos.nbits == 7); assert(z == -1); pos.buffer = (unsigned char *)"\001"; pos.nboff = 7; pos.nbits = 8; z = per_get_few_bits(&pos, 1); assert(pos.nboff == 8); assert(pos.nbits == 8); assert(z == 1); pos.buffer = (unsigned char *)"\000"; pos.nboff = 7; pos.nbits = 8; z = per_get_few_bits(&pos, 1); assert(pos.nboff == 8); assert(pos.nbits == 8); assert(z == 0); z = per_get_few_bits(&pos, 1); assert(pos.nboff == 8); assert(pos.nbits == 8); assert(z == -1); pos.buffer = (unsigned char *)"\000"; pos.nboff = 7; pos.nbits = 9; z = per_get_few_bits(&pos, 1); assert(pos.nboff == 8); assert(pos.nbits == 9); assert(z == 0); z = per_get_few_bits(&pos, 1); assert(pos.nboff == 1); assert(pos.nbits == 1); assert(z == 0); pos.buffer = (unsigned char *)"\001"; pos.nboff = 7; pos.nbits = 9; z = per_get_few_bits(&pos, 1); assert(pos.nboff == 8); assert(pos.nbits == 9); assert(z == 1); z = per_get_few_bits(&pos, 1); assert(pos.nboff == 1); assert(pos.nbits == 1); assert(z == 0); /* Get full 31-bit range */ pos.buffer = buf; pos.nboff = 7; pos.nbits = sizeof(buf) * 8; z = per_get_few_bits(&pos, 31); assert(z == 1179384747); /* Get a bit shifted range */ pos.buffer = buf; pos.nboff = 6; pos.nbits = sizeof(buf) * 8; z = per_get_few_bits(&pos, 31); assert(z == 1663434197); pos.buffer = buf; pos.nboff = 0; pos.nbits = sizeof(buf) * 8; z = per_get_many_bits(&pos, tmpbuf, 0, sizeof(buf) * 8); assert(z == 0); assert(buf[0] == tmpbuf[0]); assert(buf[1] == tmpbuf[1]); assert(buf[2] == tmpbuf[2]); assert(buf[3] == tmpbuf[3]); assert(buf[4] == tmpbuf[4]); pos.buffer = buf; pos.nboff = 1; pos.nbits = sizeof(buf) * 8; z = per_get_many_bits(&pos, tmpbuf, 0, sizeof(buf) * 8); assert(z == -1); pos.buffer = buf; pos.nboff = 1; pos.nbits = sizeof(buf) * 8; z = per_get_many_bits(&pos, tmpbuf, 0, sizeof(buf) * 8 - 1); assert(z == 0); assert(tmpbuf[0] == 110); assert(tmpbuf[1] == 50); assert(tmpbuf[2] == 95); assert(tmpbuf[3] == 221); assert(tmpbuf[4] == 90); pos.buffer = buf; pos.nboff = 1; pos.nbits = sizeof(buf) * 8; z = per_get_many_bits(&pos, tmpbuf, 1, sizeof(buf) * 8 - 1); assert(z == 0); assert(tmpbuf[0] == 55); assert(tmpbuf[0] != buf[0]); assert(tmpbuf[1] == buf[1]); assert(tmpbuf[2] == buf[2]); assert(tmpbuf[3] == buf[3]); assert(tmpbuf[4] == buf[4]); } static int Ignore(const void *data, size_t size, void *op_key) { (void)data; (void)size; (void)op_key; return 0; } static void check_per_encoding() { asn_per_outp_t po; int ret; po.buffer = po.tmpspace; po.nboff = 0; po.nbits = 0; po.outper = Ignore; po.op_key = 0; po.tmpspace[0] = 0xff; ret = per_put_few_bits(&po, 0, 0); assert(ret == 0); assert(po.nboff == 0); assert(po.buffer == po.tmpspace); assert(po.tmpspace[0] == 0xff); ret = per_put_few_bits(&po, 0, 1); assert(ret == 0); assert(po.nboff == 1); assert(po.nbits == 8 * sizeof(po.tmpspace)); assert(po.buffer == po.tmpspace); assert(po.tmpspace[0] == 0x00); ret = per_put_few_bits(&po, 1, 1); assert(ret == 0); assert(po.nboff == 2); assert(po.nbits == 8 * sizeof(po.tmpspace)); assert(po.buffer == po.tmpspace); assert(po.tmpspace[0] == 0x40); ret = per_put_few_bits(&po, 1, 1); assert(ret == 0); assert(po.nboff == 3); assert(po.nbits == 8 * sizeof(po.tmpspace)); assert(po.buffer == po.tmpspace); assert(po.tmpspace[0] == 0x60); ret = per_put_few_bits(&po, 15, 5); assert(ret == 0); assert(po.nboff == 8); assert(po.nbits == 8 * sizeof(po.tmpspace)); assert(po.buffer == po.tmpspace); assert(po.tmpspace[0] == 0x6F); ret = per_put_few_bits(&po, 0xf0ff, 16); assert(ret == 0); assert(po.nboff == 16); assert(po.nbits == 8 * sizeof(po.tmpspace) - 8); assert(po.buffer == po.tmpspace + 1); assert(po.tmpspace[0] == 0x6F); assert(po.tmpspace[1] == 0xf0); assert(po.tmpspace[2] == 0xff); po.nboff--; ret = per_put_few_bits(&po, 2, 1); assert(ret == 0); assert(po.nboff == 8); assert(po.nbits == 8 * sizeof(po.tmpspace) - 16); assert(po.buffer == po.tmpspace + 2); assert(po.tmpspace[0] == 0x6F); assert(po.tmpspace[1] == 0xf0); assert(po.tmpspace[2] == 0xfe); ret = per_put_few_bits(&po, 2, 32); assert(ret == -1); ret = per_put_few_bits(&po, 2, -1); assert(ret == -1); ret = per_put_few_bits(&po, -1, 31); assert(ret == 0); assert(po.nboff == 31); assert(po.nbits == 8 * sizeof(po.tmpspace) - 24); assert(po.buffer == po.tmpspace + 3); assert(po.tmpspace[0] == 0x6F); assert(po.tmpspace[1] == 0xf0); assert(po.tmpspace[2] == 0xfe); assert(po.tmpspace[3] == 0xff); assert(po.tmpspace[4] == 0xff); assert(po.tmpspace[5] == 0xff); assert(po.tmpspace[6] == 0xfe); } /* * Add N bits after P bits. Should result in N+P bits added. */ static void check_per_encoding_auto() { int prior, next; int ret, i; for(prior = 0; prior <= 31; prior++) { for(next = 0; next <= 31; next++) { asn_per_outp_t po; po.buffer = po.tmpspace; po.nboff = 0; po.nbits = 0; po.outper = Ignore; po.op_key = 0; po.tmpspace[0] = 0xff; ret = per_put_few_bits(&po, -1, prior); assert(ret == 0); ASN_DEBUG(" (out{nboff=%d,nbits=%d,buf_offset=%d})", (int)po.nboff, (int)po.nbits, (int)(po.buffer - po.tmpspace)); ret = per_put_few_bits(&po, -1, next); assert(ret == 0); ASN_DEBUG(" (out{nboff=%d,nbits=%d,buf_offset=%d})", (int)po.nboff, (int)po.nbits, (int)(po.buffer - po.tmpspace)); ASN_DEBUG("Putting %d + %d bits (%d/%d), got %d bytes and %d bits", prior, next, (prior + next) / 8, (prior + next) % 8, (int)(po.buffer - po.tmpspace), (int)po.nboff); assert((po.buffer - po.tmpspace) * 8 + po.nboff == (size_t)(prior + next)); for(i = 0; i < (po.buffer - po.tmpspace); i++) assert(po.tmpspace[0] == (unsigned char)-1); } } } static void check_per_encoding_sweep_with(uint8_t buf[], int already_bits, int add_bits) { size_t buf_size = 8; asn_per_data_t pos; asn_per_outp_t out; int32_t d_already; int32_t d_add; int32_t d_left; int left_bits; memset(&pos, 0, sizeof(pos)); pos.buffer = buf; pos.nboff = 0; pos.nbits = buf_size * 8; memset(&out, 0, sizeof(out)); out.buffer = out.tmpspace; out.nbits = 8 * sizeof(out.tmpspace); assert(sizeof(out.tmpspace) >= buf_size); memcpy(out.buffer, buf, buf_size); d_already = per_get_few_bits(&pos, already_bits); d_add = per_get_few_bits(&pos, add_bits); per_put_few_bits(&out, d_already, already_bits); per_put_few_bits(&out, d_add, add_bits); if(out.nboff % 8) { left_bits = 8 - (out.nboff % 8); d_left = per_get_few_bits(&pos, left_bits); } else { left_bits = 0; d_left = 0; } per_put_few_bits(&out, d_left, left_bits); assert(0 == (out.nboff % 8)); if(0 != memcmp(out.tmpspace, buf, buf_size)) { printf("IN: "); for(size_t i = 0; i < buf_size; i++) printf(" %02x", buf[i]); printf("\nOUT:"); for(size_t i = 0; i < buf_size; i++) printf(" %02x", out.tmpspace[i]); printf(" (out{nboff=%d,left=%d,%02x})\n", (int)out.nboff, left_bits, (int)d_left); assert(0 == memcmp(out.tmpspace, buf, buf_size)); } } static void check_per_encoding_sweep() { uint8_t buf[3][8] = { { 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA }, { 0xB7, 0x19, 0x2F, 0xEE, 0xAD, 0x11, 0xAA, 0x55 }, { 0xEE, 0xAD, 0x11, 0xAA, 0x55, 0xB7, 0x19, 0x2F } }; int already_bits; int add_bits; int buf_idx; for(buf_idx = 0; buf_idx < 3; buf_idx++) { for(already_bits = 0; already_bits < 24; already_bits++) { for(add_bits = 0; add_bits <= 31; add_bits++) { /*fprintf(stderr, "PER %d += %d\n", already_bits, add_bits);*/ check_per_encoding_sweep_with(buf[buf_idx], already_bits, add_bits); } } } } int main() { check_per_decoding(); check_per_encoding(); check_per_encoding_auto(); check_per_encoding_sweep(); return 0; } asn1c-0.9.28+dfsg/skeletons/tests/check-length.c0000644000000000000000000000555113065714043020116 0ustar rootroot#include #include #include #include #include #include #include uint8_t *buf; size_t buf_size; size_t buf_off; static int write_to_buf(const void *buffer, size_t size, void *key) { (void)key; if(buf_off + size > buf_size) { size_t n = buf_size?:16; while(n < buf_off + size) n <<= 2; buf = realloc(buf, n); assert(buf); buf_size = n; } memcpy(buf + buf_off, buffer, size); buf_off += size; return 0; } static void check(size_t size) { OCTET_STRING_t *os; OCTET_STRING_t *nos = 0; OCTET_STRING_t **nosp = &nos; asn_enc_rval_t erval; asn_dec_rval_t rval; os = OCTET_STRING_new_fromBuf(&asn_DEF_OCTET_STRING, 0, size); assert(os); assert(os->size == 0); os->buf = malloc(size); assert(os->buf); os->size = size; for(size_t i = 0; i < size; i++) { os->buf[i] = i; } buf_off = 0; erval = der_encode(&asn_DEF_OCTET_STRING, os, write_to_buf, 0); assert(erval.encoded >= 0 && (size_t)erval.encoded == buf_off); assert(buf_off > size); rval = ber_decode(0, &asn_DEF_OCTET_STRING, (void **)nosp, buf, buf_off); assert(rval.code == RC_OK); assert(rval.consumed == buf_off); assert(os->size == nos->size); for(size_t i = 0; i < size; i++) { assert(os->buf[i] == nos->buf[i]); } if(0) { fprintf(stderr, "new(%zd):", size); for(size_t i = 0; i < (buf_off<10?buf_off:10); i++) fprintf(stderr, " %02x", buf[i]); printf("\n"); } asn_DEF_OCTET_STRING.free_struct(&asn_DEF_OCTET_STRING, os, 0); asn_DEF_OCTET_STRING.free_struct(&asn_DEF_OCTET_STRING, nos, 0); } int main() { uint8_t buf1[] = { 0x85, 0x00, 0x01, 0x02, 0x03, 0x04 }; uint8_t buf2[] = { 0x85, 0x00, 0x7f, 0xff, 0x03, 0x04 }; uint8_t buf3[] = { 0x85, 0x00, 0x7f, 0xff, 0xff, 0x04 }; uint8_t buf4[] = { 0x89, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x04 }; ber_tlv_len_t tlv_len; ssize_t ret; for(size_t i = 0; i < 66000; i++) { if(i == 4500) i = 64000; /* Jump */ check(i); } ret = ber_fetch_length(0, buf1, sizeof(buf1), &tlv_len); printf("ret=%ld, len=%ld\n", (long)ret, (long)tlv_len); assert(ret == sizeof(buf1)); assert(tlv_len == 0x01020304); ret = ber_fetch_length(0, buf2, sizeof(buf2), &tlv_len); printf("ret=%ld, len=%ld\n", (long)ret, (long)tlv_len); assert(ret == sizeof(buf2)); assert(tlv_len == 0x7fff0304); /* * Here although tlv_len is not greater than 2^31, * we ought to hit an embedded length exploitation preventive check. */ printf("sizeof(tlv_len) = %d\n", (int)sizeof(tlv_len)); if(sizeof(tlv_len) <= 4) { ret = ber_fetch_length(0, buf3, sizeof(buf3), &tlv_len); printf("ret=%ld\n", (long)ret); printf("len=0x%x\n", (unsigned int)tlv_len); assert(ret == -1); } if(sizeof(tlv_len) <= 8) { ret = ber_fetch_length(0, buf4, sizeof(buf4), &tlv_len); printf("ret=%lld\n", (long long)ret); assert(ret == -1); } return 0; } asn1c-0.9.28+dfsg/skeletons/tests/check-UTF8String.c0000644000000000000000000000355513065714043020554 0ustar rootroot#include #include #include #include static void check(int expect_length, char *buf, int buflen) { UTF8String_t st; int ret; if(buflen < 0) buflen = strlen(buf); st.buf = (uint8_t *)buf; st.size = buflen; printf("["); for(ret = 0; ret < buflen; ret++) printf("%c", buf[ret]); ret = UTF8String_length(&st); printf("]: size=%d, expect=%d, got=%d\n", buflen, expect_length, ret); assert(ret == expect_length); } static int check_speed() { int cycles = 1000000; double start, stop; struct timeval tv; UTF8String_t st; char long_test[] = "a\303\237a\303\237a\303\237a\303\237" "a\303\237a\303\237a\303\237a\303\237" "a\303\237a\303\237a\303\237a\303\237" "a\303\237a\303\237a\303\237a\303\237" "a\303\237a\303\237a\303\237a\303\237"; int ret; int i; st.buf = (uint8_t *)long_test; st.size = sizeof(long_test) - 1; ret = UTF8String_length(&st); assert(ret == 40); printf("Now wait a bit...\n"); gettimeofday(&tv, 0); start = tv.tv_sec + tv.tv_usec / 1000000.0; for(i = 0; i < cycles; i++) { ret += UTF8String_length(&st); } gettimeofday(&tv, 0); stop = tv.tv_sec + tv.tv_usec / 1000000.0; printf("%d cycles in %.3fms\n", cycles, stop - start); return ret; } int main() { check(0, "", 0); check(1, "\0", 1); check(1, "a", 1); check(2, "ab", 2); check(3, "abc", 3); assert(sizeof("a\303\237cd") == 6); check(4, "a\303\237cd", 5); check(3, "a\370\211\200\201\257c", 7); check(3, "\320\273\320\265\320\262", 6); check(-1, "a\303", 2); /* Truncated */ check(-2, "\377", 1); /* Invalid UTF-8 sequence start */ check(-2, "\200", 1); check(-2, "\320\273\265\320\262", 5); check(-3, "\320c", 2); /* Not continuation */ check(-3, "a\370\200\200\200c", 6); check(-4, "a\370\200\200\200\257c", 7); check(-4, "\320\273\320\265\340\200\262", 7); check(-5, 0, 0); check_speed(); return 0; } asn1c-0.9.28+dfsg/skeletons/asn_internal.h0000644000000000000000000001012113065714043017067 0ustar rootroot/*- * Copyright (c) 2003, 2004, 2005, 2007 Lev Walkin . * All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ /* * Declarations internally useful for the ASN.1 support code. */ #ifndef ASN_INTERNAL_H #define ASN_INTERNAL_H #include "asn_application.h" /* Application-visible API */ #ifndef __NO_ASSERT_H__ /* Include assert.h only for internal use. */ #include /* for assert() macro */ #endif #ifdef __cplusplus extern "C" { #endif /* Environment version might be used to avoid running with the old library */ #define ASN1C_ENVIRONMENT_VERSION 923 /* Compile-time version */ int get_asn1c_environment_version(void); /* Run-time version */ #define CALLOC(nmemb, size) calloc(nmemb, size) #define MALLOC(size) malloc(size) #define REALLOC(oldptr, size) realloc(oldptr, size) #define FREEMEM(ptr) free(ptr) #define asn_debug_indent 0 #define ASN_DEBUG_INDENT_ADD(i) do{}while(0) /* * A macro for debugging the ASN.1 internals. * You may enable or override it. */ #ifndef ASN_DEBUG /* If debugging code is not defined elsewhere... */ #if EMIT_ASN_DEBUG == 1 /* And it was asked to emit this code... */ #ifdef __GNUC__ #ifdef ASN_THREAD_SAFE /* Thread safety requires sacrifice in output indentation: * Retain empty definition of ASN_DEBUG_INDENT_ADD. */ #else /* !ASN_THREAD_SAFE */ #undef ASN_DEBUG_INDENT_ADD #undef asn_debug_indent int asn_debug_indent; #define ASN_DEBUG_INDENT_ADD(i) do { asn_debug_indent += i; } while(0) #endif /* ASN_THREAD_SAFE */ #define ASN_DEBUG(fmt, args...) do { \ int adi = asn_debug_indent; \ while(adi--) fprintf(stderr, " "); \ fprintf(stderr, fmt, ##args); \ fprintf(stderr, " (%s:%d)\n", \ __FILE__, __LINE__); \ } while(0) #else /* !__GNUC__ */ void ASN_DEBUG_f(const char *fmt, ...); #define ASN_DEBUG ASN_DEBUG_f #endif /* __GNUC__ */ #else /* EMIT_ASN_DEBUG != 1 */ static void ASN_DEBUG(const char *fmt, ...) { (void)fmt; } #endif /* EMIT_ASN_DEBUG */ #endif /* ASN_DEBUG */ /* * Invoke the application-supplied callback and fail, if something is wrong. */ #define ASN__E_cbc(buf, size) (cb((buf), (size), app_key) < 0) #define ASN__E_CALLBACK(foo) do { \ if(foo) goto cb_failed; \ } while(0) #define ASN__CALLBACK(buf, size) \ ASN__E_CALLBACK(ASN__E_cbc(buf, size)) #define ASN__CALLBACK2(buf1, size1, buf2, size2) \ ASN__E_CALLBACK(ASN__E_cbc(buf1, size1) || ASN__E_cbc(buf2, size2)) #define ASN__CALLBACK3(buf1, size1, buf2, size2, buf3, size3) \ ASN__E_CALLBACK(ASN__E_cbc(buf1, size1) \ || ASN__E_cbc(buf2, size2) \ || ASN__E_cbc(buf3, size3)) #define ASN__TEXT_INDENT(nl, level) do { \ int tmp_level = (level); \ int tmp_nl = ((nl) != 0); \ int tmp_i; \ if(tmp_nl) ASN__CALLBACK("\n", 1); \ if(tmp_level < 0) tmp_level = 0; \ for(tmp_i = 0; tmp_i < tmp_level; tmp_i++) \ ASN__CALLBACK(" ", 4); \ er.encoded += tmp_nl + 4 * tmp_level; \ } while(0) #define _i_INDENT(nl) do { \ int tmp_i; \ if((nl) && cb("\n", 1, app_key) < 0) \ return -1; \ for(tmp_i = 0; tmp_i < ilevel; tmp_i++) \ if(cb(" ", 4, app_key) < 0) \ return -1; \ } while(0) /* * Check stack against overflow, if limit is set. */ #define ASN__DEFAULT_STACK_MAX (30000) static int __attribute__((unused)) ASN__STACK_OVERFLOW_CHECK(asn_codec_ctx_t *ctx) { if(ctx && ctx->max_stack_size) { /* ctx MUST be allocated on the stack */ ptrdiff_t usedstack = ((char *)ctx - (char *)&ctx); if(usedstack > 0) usedstack = -usedstack; /* grows up! */ /* double negative required to avoid int wrap-around */ if(usedstack < -(ptrdiff_t)ctx->max_stack_size) { ASN_DEBUG("Stack limit %ld reached", (long)ctx->max_stack_size); return -1; } } return 0; } #ifdef __cplusplus } #endif #endif /* ASN_INTERNAL_H */ asn1c-0.9.28+dfsg/skeletons/OCTET_STRING.c0000644000000000000000000013331313065714043016362 0ustar rootroot/*- * Copyright (c) 2003, 2004, 2005, 2006 Lev Walkin . * All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #include #include #include /* for .bits_unused member */ #include /* * OCTET STRING basic type description. */ static const ber_tlv_tag_t asn_DEF_OCTET_STRING_tags[] = { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) }; static const asn_OCTET_STRING_specifics_t asn_DEF_OCTET_STRING_specs = { sizeof(OCTET_STRING_t), offsetof(OCTET_STRING_t, _asn_ctx), ASN_OSUBV_STR }; static const asn_per_constraints_t asn_DEF_OCTET_STRING_constraints = { { APC_CONSTRAINED, 8, 8, 0, 255 }, { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 }, 0, 0 }; asn_TYPE_descriptor_t asn_DEF_OCTET_STRING = { "OCTET STRING", /* Canonical name */ "OCTET_STRING", /* XML tag name */ OCTET_STRING_free, OCTET_STRING_print, /* non-ascii stuff, generally */ asn_generic_no_constraint, OCTET_STRING_decode_ber, OCTET_STRING_encode_der, OCTET_STRING_decode_xer_hex, OCTET_STRING_encode_xer, OCTET_STRING_decode_uper, /* Unaligned PER decoder */ OCTET_STRING_encode_uper, /* Unaligned PER encoder */ 0, /* Use generic outmost tag fetcher */ asn_DEF_OCTET_STRING_tags, sizeof(asn_DEF_OCTET_STRING_tags) / sizeof(asn_DEF_OCTET_STRING_tags[0]), asn_DEF_OCTET_STRING_tags, /* Same as above */ sizeof(asn_DEF_OCTET_STRING_tags) / sizeof(asn_DEF_OCTET_STRING_tags[0]), 0, /* No PER visible constraints */ 0, 0, /* No members */ &asn_DEF_OCTET_STRING_specs }; #undef _CH_PHASE #undef NEXT_PHASE #undef PREV_PHASE #define _CH_PHASE(ctx, inc) do { \ if(ctx->phase == 0) \ ctx->context = 0; \ ctx->phase += inc; \ } while(0) #define NEXT_PHASE(ctx) _CH_PHASE(ctx, +1) #define PREV_PHASE(ctx) _CH_PHASE(ctx, -1) #undef ADVANCE #define ADVANCE(num_bytes) do { \ size_t num = (num_bytes); \ buf_ptr = ((const char *)buf_ptr) + num; \ size -= num; \ consumed_myself += num; \ } while(0) #undef RETURN #define RETURN(_code) do { \ asn_dec_rval_t tmprval; \ tmprval.code = _code; \ tmprval.consumed = consumed_myself; \ return tmprval; \ } while(0) #undef APPEND #define APPEND(bufptr, bufsize) do { \ size_t _bs = (bufsize); /* Append size */ \ size_t _ns = ctx->context; /* Allocated now */ \ size_t _es = st->size + _bs; /* Expected size */ \ /* int is really a typeof(st->size): */ \ if((int)_es < 0) RETURN(RC_FAIL); \ if(_ns <= _es) { \ void *ptr; \ /* Be nice and round to the memory allocator */ \ do { _ns = _ns ? _ns << 1 : 16; } \ while(_ns <= _es); \ /* int is really a typeof(st->size): */ \ if((int)_ns < 0) RETURN(RC_FAIL); \ ptr = REALLOC(st->buf, _ns); \ if(ptr) { \ st->buf = (uint8_t *)ptr; \ ctx->context = _ns; \ } else { \ RETURN(RC_FAIL); \ } \ ASN_DEBUG("Reallocating into %ld", (long)_ns); \ } \ memcpy(st->buf + st->size, bufptr, _bs); \ /* Convenient nul-termination */ \ st->buf[_es] = '\0'; \ st->size = _es; \ } while(0) /* * The main reason why ASN.1 is still alive is that too much time and effort * is necessary for learning it more or less adequately, thus creating a gut * necessity to demonstrate that aquired skill everywhere afterwards. * No, I am not going to explain what the following stuff is. */ struct _stack_el { ber_tlv_len_t left; /* What's left to read (or -1) */ ber_tlv_len_t got; /* What was actually processed */ int cont_level; /* Depth of subcontainment */ int want_nulls; /* Want null "end of content" octets? */ int bits_chopped; /* Flag in BIT STRING mode */ ber_tlv_tag_t tag; /* For debugging purposes */ struct _stack_el *prev; struct _stack_el *next; }; struct _stack { struct _stack_el *tail; struct _stack_el *cur_ptr; }; static struct _stack_el * OS__add_stack_el(struct _stack *st) { struct _stack_el *nel; /* * Reuse the old stack frame or allocate a new one. */ if(st->cur_ptr && st->cur_ptr->next) { nel = st->cur_ptr->next; nel->bits_chopped = 0; nel->got = 0; /* Retain the nel->cont_level, it's correct. */ } else { nel = (struct _stack_el *)CALLOC(1, sizeof(struct _stack_el)); if(nel == NULL) return NULL; if(st->tail) { /* Increase a subcontainment depth */ nel->cont_level = st->tail->cont_level + 1; st->tail->next = nel; } nel->prev = st->tail; st->tail = nel; } st->cur_ptr = nel; return nel; } static struct _stack * _new_stack() { return (struct _stack *)CALLOC(1, sizeof(struct _stack)); } /* * Decode OCTET STRING type. */ asn_dec_rval_t OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, const void *buf_ptr, size_t size, int tag_mode) { asn_OCTET_STRING_specifics_t *specs = td->specifics ? (asn_OCTET_STRING_specifics_t *)td->specifics : &asn_DEF_OCTET_STRING_specs; BIT_STRING_t *st = (BIT_STRING_t *)*sptr; asn_dec_rval_t rval; asn_struct_ctx_t *ctx; ssize_t consumed_myself = 0; struct _stack *stck; /* Expectations stack structure */ struct _stack_el *sel = 0; /* Stack element */ int tlv_constr; enum asn_OS_Subvariant type_variant = specs->subvariant; ASN_DEBUG("Decoding %s as %s (frame %ld)", td->name, (type_variant == ASN_OSUBV_STR) ? "OCTET STRING" : "OS-SpecialCase", (long)size); /* * Create the string if does not exist. */ if(st == NULL) { st = (BIT_STRING_t *)(*sptr = CALLOC(1, specs->struct_size)); if(st == NULL) RETURN(RC_FAIL); } /* Restore parsing context */ ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); switch(ctx->phase) { case 0: /* * Check tags. */ rval = ber_check_tags(opt_codec_ctx, td, ctx, buf_ptr, size, tag_mode, -1, &ctx->left, &tlv_constr); if(rval.code != RC_OK) return rval; if(tlv_constr) { /* * Complex operation, requires stack of expectations. */ ctx->ptr = _new_stack(); if(ctx->ptr) { stck = (struct _stack *)ctx->ptr; } else { RETURN(RC_FAIL); } } else { /* * Jump into stackless primitive decoding. */ _CH_PHASE(ctx, 3); if(type_variant == ASN_OSUBV_ANY && tag_mode != 1) APPEND(buf_ptr, rval.consumed); ADVANCE(rval.consumed); goto phase3; } NEXT_PHASE(ctx); /* Fall through */ case 1: phase1: /* * Fill the stack with expectations. */ stck = (struct _stack *)ctx->ptr; sel = stck->cur_ptr; do { ber_tlv_tag_t tlv_tag; ber_tlv_len_t tlv_len; ber_tlv_tag_t expected_tag; ssize_t tl, ll, tlvl; /* This one works even if (sel->left == -1) */ ssize_t Left = ((!sel||(size_t)sel->left >= size) ?(ssize_t)size:sel->left); ASN_DEBUG("%p, s->l=%ld, s->wn=%ld, s->g=%ld\n", sel, (long)(sel?sel->left:0), (long)(sel?sel->want_nulls:0), (long)(sel?sel->got:0) ); if(sel && sel->left <= 0 && sel->want_nulls == 0) { if(sel->prev) { struct _stack_el *prev = sel->prev; if(prev->left != -1) { if(prev->left < sel->got) RETURN(RC_FAIL); prev->left -= sel->got; } prev->got += sel->got; sel = stck->cur_ptr = prev; if(!sel) break; tlv_constr = 1; continue; } else { sel = stck->cur_ptr = 0; break; /* Nothing to wait */ } } tl = ber_fetch_tag(buf_ptr, Left, &tlv_tag); ASN_DEBUG("fetch tag(size=%ld,L=%ld), %sstack, left=%ld, wn=%ld, tl=%ld", (long)size, (long)Left, sel?"":"!", (long)(sel?sel->left:0), (long)(sel?sel->want_nulls:0), (long)tl); switch(tl) { case -1: RETURN(RC_FAIL); case 0: RETURN(RC_WMORE); } tlv_constr = BER_TLV_CONSTRUCTED(buf_ptr); ll = ber_fetch_length(tlv_constr, (const char *)buf_ptr + tl,Left - tl,&tlv_len); ASN_DEBUG("Got tag=%s, tc=%d, left=%ld, tl=%ld, len=%ld, ll=%ld", ber_tlv_tag_string(tlv_tag), tlv_constr, (long)Left, (long)tl, (long)tlv_len, (long)ll); switch(ll) { case -1: RETURN(RC_FAIL); case 0: RETURN(RC_WMORE); } if(sel && sel->want_nulls && ((const uint8_t *)buf_ptr)[0] == 0 && ((const uint8_t *)buf_ptr)[1] == 0) { ASN_DEBUG("Eat EOC; wn=%d--", sel->want_nulls); if(type_variant == ASN_OSUBV_ANY && (tag_mode != 1 || sel->cont_level)) APPEND("\0\0", 2); ADVANCE(2); sel->got += 2; if(sel->left != -1) { sel->left -= 2; /* assert(sel->left >= 2) */ } sel->want_nulls--; if(sel->want_nulls == 0) { /* Move to the next expectation */ sel->left = 0; tlv_constr = 1; } continue; } /* * Set up expected tags, * depending on ASN.1 type being decoded. */ switch(type_variant) { case ASN_OSUBV_BIT: /* X.690: 8.6.4.1, NOTE 2 */ /* Fall through */ case ASN_OSUBV_STR: default: if(sel) { int level = sel->cont_level; if(level < td->all_tags_count) { expected_tag = td->all_tags[level]; break; } else if(td->all_tags_count) { expected_tag = td->all_tags [td->all_tags_count - 1]; break; } /* else, Fall through */ } /* Fall through */ case ASN_OSUBV_ANY: expected_tag = tlv_tag; break; } if(tlv_tag != expected_tag) { char buf[2][32]; ber_tlv_tag_snprint(tlv_tag, buf[0], sizeof(buf[0])); ber_tlv_tag_snprint(td->tags[td->tags_count-1], buf[1], sizeof(buf[1])); ASN_DEBUG("Tag does not match expectation: %s != %s", buf[0], buf[1]); RETURN(RC_FAIL); } tlvl = tl + ll; /* Combined length of T and L encoding */ if((tlv_len + tlvl) < 0) { /* tlv_len value is too big */ ASN_DEBUG("TLV encoding + length (%ld) is too big", (long)tlv_len); RETURN(RC_FAIL); } /* * Append a new expectation. */ sel = OS__add_stack_el(stck); if(!sel) RETURN(RC_FAIL); sel->tag = tlv_tag; sel->want_nulls = (tlv_len==-1); if(sel->prev && sel->prev->left != -1) { /* Check that the parent frame is big enough */ if(sel->prev->left < tlvl + (tlv_len==-1?0:tlv_len)) RETURN(RC_FAIL); if(tlv_len == -1) sel->left = sel->prev->left - tlvl; else sel->left = tlv_len; } else { sel->left = tlv_len; } if(type_variant == ASN_OSUBV_ANY && (tag_mode != 1 || sel->cont_level)) APPEND(buf_ptr, tlvl); sel->got += tlvl; ADVANCE(tlvl); ASN_DEBUG("+EXPECT2 got=%ld left=%ld, wn=%d, clvl=%d", (long)sel->got, (long)sel->left, sel->want_nulls, sel->cont_level); } while(tlv_constr); if(sel == NULL) { /* Finished operation, "phase out" */ ASN_DEBUG("Phase out"); _CH_PHASE(ctx, +3); break; } NEXT_PHASE(ctx); /* Fall through */ case 2: stck = (struct _stack *)ctx->ptr; sel = stck->cur_ptr; ASN_DEBUG("Phase 2: Need %ld bytes, size=%ld, alrg=%ld, wn=%d", (long)sel->left, (long)size, (long)sel->got, sel->want_nulls); { ber_tlv_len_t len; assert(sel->left >= 0); len = ((ber_tlv_len_t)size < sel->left) ? (ber_tlv_len_t)size : sel->left; if(len > 0) { if(type_variant == ASN_OSUBV_BIT && sel->bits_chopped == 0) { /* Put the unused-bits-octet away */ st->bits_unused = *(const uint8_t *)buf_ptr; APPEND(((const char *)buf_ptr+1), (len - 1)); sel->bits_chopped = 1; } else { APPEND(buf_ptr, len); } ADVANCE(len); sel->left -= len; sel->got += len; } if(sel->left) { ASN_DEBUG("OS left %ld, size = %ld, wn=%d\n", (long)sel->left, (long)size, sel->want_nulls); RETURN(RC_WMORE); } PREV_PHASE(ctx); goto phase1; } break; case 3: phase3: /* * Primitive form, no stack required. */ assert(ctx->left >= 0); if(size < (size_t)ctx->left) { if(!size) RETURN(RC_WMORE); if(type_variant == ASN_OSUBV_BIT && !ctx->context) { st->bits_unused = *(const uint8_t *)buf_ptr; ctx->left--; ADVANCE(1); } APPEND(buf_ptr, size); assert(ctx->context > 0); ctx->left -= size; ADVANCE(size); RETURN(RC_WMORE); } else { if(type_variant == ASN_OSUBV_BIT && !ctx->context && ctx->left) { st->bits_unused = *(const uint8_t *)buf_ptr; ctx->left--; ADVANCE(1); } APPEND(buf_ptr, ctx->left); ADVANCE(ctx->left); ctx->left = 0; NEXT_PHASE(ctx); } break; } if(sel) { ASN_DEBUG("3sel p=%p, wn=%d, l=%ld, g=%ld, size=%ld", sel->prev, sel->want_nulls, (long)sel->left, (long)sel->got, (long)size); if(sel->prev || sel->want_nulls > 1 || sel->left > 0) { RETURN(RC_WMORE); } } /* * BIT STRING-specific processing. */ if(type_variant == ASN_OSUBV_BIT && st->size) { /* Finalize BIT STRING: zero out unused bits. */ st->buf[st->size-1] &= 0xff << st->bits_unused; } ASN_DEBUG("Took %ld bytes to encode %s: [%s]:%ld", (long)consumed_myself, td->name, (type_variant == ASN_OSUBV_STR) ? (char *)st->buf : "", (long)st->size); RETURN(RC_OK); } /* * Encode OCTET STRING type using DER. */ asn_enc_rval_t OCTET_STRING_encode_der(asn_TYPE_descriptor_t *td, void *sptr, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { asn_enc_rval_t er; asn_OCTET_STRING_specifics_t *specs = td->specifics ? (asn_OCTET_STRING_specifics_t *)td->specifics : &asn_DEF_OCTET_STRING_specs; BIT_STRING_t *st = (BIT_STRING_t *)sptr; enum asn_OS_Subvariant type_variant = specs->subvariant; int fix_last_byte = 0; ASN_DEBUG("%s %s as OCTET STRING", cb?"Estimating":"Encoding", td->name); /* * Write tags. */ if(type_variant != ASN_OSUBV_ANY || tag_mode == 1) { er.encoded = der_write_tags(td, (type_variant == ASN_OSUBV_BIT) + st->size, tag_mode, type_variant == ASN_OSUBV_ANY, tag, cb, app_key); if(er.encoded == -1) { er.failed_type = td; er.structure_ptr = sptr; return er; } } else { /* Disallow: [] IMPLICIT ANY */ assert(type_variant != ASN_OSUBV_ANY || tag_mode != -1); er.encoded = 0; } if(!cb) { er.encoded += (type_variant == ASN_OSUBV_BIT) + st->size; ASN__ENCODED_OK(er); } /* * Prepare to deal with the last octet of BIT STRING. */ if(type_variant == ASN_OSUBV_BIT) { uint8_t b = st->bits_unused & 0x07; if(b && st->size) fix_last_byte = 1; ASN__CALLBACK(&b, 1); er.encoded++; } /* Invoke callback for the main part of the buffer */ ASN__CALLBACK(st->buf, st->size - fix_last_byte); /* The last octet should be stripped off the unused bits */ if(fix_last_byte) { uint8_t b = st->buf[st->size-1] & (0xff << st->bits_unused); ASN__CALLBACK(&b, 1); } er.encoded += st->size; ASN__ENCODED_OK(er); cb_failed: ASN__ENCODE_FAILED; } asn_enc_rval_t OCTET_STRING_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { const char * const h2c = "0123456789ABCDEF"; const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; asn_enc_rval_t er; char scratch[16 * 3 + 4]; char *p = scratch; uint8_t *buf; uint8_t *end; size_t i; if(!st || (!st->buf && st->size)) ASN__ENCODE_FAILED; er.encoded = 0; /* * Dump the contents of the buffer in hexadecimal. */ buf = st->buf; end = buf + st->size; if(flags & XER_F_CANONICAL) { char *scend = scratch + (sizeof(scratch) - 2); for(; buf < end; buf++) { if(p >= scend) { ASN__CALLBACK(scratch, p - scratch); er.encoded += p - scratch; p = scratch; } *p++ = h2c[(*buf >> 4) & 0x0F]; *p++ = h2c[*buf & 0x0F]; } ASN__CALLBACK(scratch, p-scratch); /* Dump the rest */ er.encoded += p - scratch; } else { for(i = 0; buf < end; buf++, i++) { if(!(i % 16) && (i || st->size > 16)) { ASN__CALLBACK(scratch, p-scratch); er.encoded += (p-scratch); p = scratch; ASN__TEXT_INDENT(1, ilevel); } *p++ = h2c[(*buf >> 4) & 0x0F]; *p++ = h2c[*buf & 0x0F]; *p++ = 0x20; } if(p - scratch) { p--; /* Remove the tail space */ ASN__CALLBACK(scratch, p-scratch); /* Dump the rest */ er.encoded += p - scratch; if(st->size > 16) ASN__TEXT_INDENT(1, ilevel-1); } } ASN__ENCODED_OK(er); cb_failed: ASN__ENCODE_FAILED; } static const struct OCTET_STRING__xer_escape_table_s { const char *string; int size; } OCTET_STRING__xer_escape_table[] = { #define OSXET(s) { s, sizeof(s) - 1 } OSXET("\074\156\165\154\057\076"), /* */ OSXET("\074\163\157\150\057\076"), /* */ OSXET("\074\163\164\170\057\076"), /* */ OSXET("\074\145\164\170\057\076"), /* */ OSXET("\074\145\157\164\057\076"), /* */ OSXET("\074\145\156\161\057\076"), /* */ OSXET("\074\141\143\153\057\076"), /* */ OSXET("\074\142\145\154\057\076"), /* */ OSXET("\074\142\163\057\076"), /* */ OSXET("\011"), /* \t */ OSXET("\012"), /* \n */ OSXET("\074\166\164\057\076"), /* */ OSXET("\074\146\146\057\076"), /* */ OSXET("\015"), /* \r */ OSXET("\074\163\157\057\076"), /* */ OSXET("\074\163\151\057\076"), /* */ OSXET("\074\144\154\145\057\076"), /* */ OSXET("\074\144\143\061\057\076"), /* */ OSXET("\074\144\143\062\057\076"), /* */ OSXET("\074\144\143\063\057\076"), /* */ OSXET("\074\144\143\064\057\076"), /* */ OSXET("\074\156\141\153\057\076"), /* */ OSXET("\074\163\171\156\057\076"), /* */ OSXET("\074\145\164\142\057\076"), /* */ OSXET("\074\143\141\156\057\076"), /* */ OSXET("\074\145\155\057\076"), /* */ OSXET("\074\163\165\142\057\076"), /* */ OSXET("\074\145\163\143\057\076"), /* */ OSXET("\074\151\163\064\057\076"), /* */ OSXET("\074\151\163\063\057\076"), /* */ OSXET("\074\151\163\062\057\076"), /* */ OSXET("\074\151\163\061\057\076"), /* */ { 0, 0 }, /* " " */ { 0, 0 }, /* ! */ { 0, 0 }, /* \" */ { 0, 0 }, /* # */ { 0, 0 }, /* $ */ { 0, 0 }, /* % */ OSXET("\046\141\155\160\073"), /* & */ { 0, 0 }, /* ' */ {0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, /* ()*+,-./ */ {0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}, /* 01234567 */ {0,0},{0,0},{0,0},{0,0}, /* 89:; */ OSXET("\046\154\164\073"), /* < */ { 0, 0 }, /* = */ OSXET("\046\147\164\073"), /* > */ }; static int OS__check_escaped_control_char(const void *buf, int size) { size_t i; /* * Inefficient algorithm which translates the escape sequences * defined above into characters. Returns -1 if not found. * TODO: replace by a faster algorithm (bsearch(), hash or * nested table lookups). */ for(i = 0; i < 32 /* Don't spend time on the bottom half */; i++) { const struct OCTET_STRING__xer_escape_table_s *el; el = &OCTET_STRING__xer_escape_table[i]; if(el->size == size && memcmp(buf, el->string, size) == 0) return i; } return -1; } static int OCTET_STRING__handle_control_chars(void *struct_ptr, const void *chunk_buf, size_t chunk_size) { /* * This might be one of the escape sequences * for control characters. Check it out. * #11.15.5 */ int control_char = OS__check_escaped_control_char(chunk_buf,chunk_size); if(control_char >= 0) { OCTET_STRING_t *st = (OCTET_STRING_t *)struct_ptr; void *p = REALLOC(st->buf, st->size + 2); if(p) { st->buf = (uint8_t *)p; st->buf[st->size++] = control_char; st->buf[st->size] = '\0'; /* nul-termination */ return 0; } } return -1; /* No, it's not */ } asn_enc_rval_t OCTET_STRING_encode_xer_utf8(asn_TYPE_descriptor_t *td, void *sptr, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; asn_enc_rval_t er; uint8_t *buf, *end; uint8_t *ss; /* Sequence start */ ssize_t encoded_len = 0; (void)ilevel; /* Unused argument */ (void)flags; /* Unused argument */ if(!st || (!st->buf && st->size)) ASN__ENCODE_FAILED; buf = st->buf; end = buf + st->size; for(ss = buf; buf < end; buf++) { unsigned int ch = *buf; int s_len; /* Special encoding sequence length */ /* * Escape certain characters: X.680/11.15 */ if(ch < sizeof(OCTET_STRING__xer_escape_table) /sizeof(OCTET_STRING__xer_escape_table[0]) && (s_len = OCTET_STRING__xer_escape_table[ch].size)) { if(((buf - ss) && cb(ss, buf - ss, app_key) < 0) || cb(OCTET_STRING__xer_escape_table[ch].string, s_len, app_key) < 0) ASN__ENCODE_FAILED; encoded_len += (buf - ss) + s_len; ss = buf + 1; } } encoded_len += (buf - ss); if((buf - ss) && cb(ss, buf - ss, app_key) < 0) ASN__ENCODE_FAILED; er.encoded = encoded_len; ASN__ENCODED_OK(er); } /* * Convert from hexadecimal format (cstring): "AB CD EF" */ static ssize_t OCTET_STRING__convert_hexadecimal(void *sptr, const void *chunk_buf, size_t chunk_size, int have_more) { OCTET_STRING_t *st = (OCTET_STRING_t *)sptr; const char *chunk_stop = (const char *)chunk_buf; const char *p = chunk_stop; const char *pend = p + chunk_size; unsigned int clv = 0; int half = 0; /* Half bit */ uint8_t *buf; /* Reallocate buffer according to high cap estimation */ ssize_t _ns = st->size + (chunk_size + 1) / 2; void *nptr = REALLOC(st->buf, _ns + 1); if(!nptr) return -1; st->buf = (uint8_t *)nptr; buf = st->buf + st->size; /* * If something like " a b c " appears here, the " a b":3 will be * converted, and the rest skipped. That is, unless buf_size is greater * than chunk_size, then it'll be equivalent to "ABC0". */ for(; p < pend; p++) { int ch = *(const unsigned char *)p; switch(ch) { case 0x09: case 0x0a: case 0x0c: case 0x0d: case 0x20: /* Ignore whitespace */ continue; case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: /*01234*/ case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: /*56789*/ clv = (clv << 4) + (ch - 0x30); break; case 0x41: case 0x42: case 0x43: /* ABC */ case 0x44: case 0x45: case 0x46: /* DEF */ clv = (clv << 4) + (ch - 0x41 + 10); break; case 0x61: case 0x62: case 0x63: /* abc */ case 0x64: case 0x65: case 0x66: /* def */ clv = (clv << 4) + (ch - 0x61 + 10); break; default: *buf = 0; /* JIC */ return -1; } if(half++) { half = 0; *buf++ = clv; chunk_stop = p + 1; } } /* * Check partial decoding. */ if(half) { if(have_more) { /* * Partial specification is fine, * because no more more PXER_TEXT data is available. */ *buf++ = clv << 4; chunk_stop = p; } } else { chunk_stop = p; } st->size = buf - st->buf; /* Adjust the buffer size */ assert(st->size <= _ns); st->buf[st->size] = 0; /* Courtesy termination */ return (chunk_stop - (const char *)chunk_buf); /* Converted size */ } /* * Convert from binary format: "00101011101" */ static ssize_t OCTET_STRING__convert_binary(void *sptr, const void *chunk_buf, size_t chunk_size, int have_more) { BIT_STRING_t *st = (BIT_STRING_t *)sptr; const char *p = (const char *)chunk_buf; const char *pend = p + chunk_size; int bits_unused = st->bits_unused & 0x7; uint8_t *buf; /* Reallocate buffer according to high cap estimation */ ssize_t _ns = st->size + (chunk_size + 7) / 8; void *nptr = REALLOC(st->buf, _ns + 1); if(!nptr) return -1; st->buf = (uint8_t *)nptr; buf = st->buf + st->size; (void)have_more; if(bits_unused == 0) bits_unused = 8; else if(st->size) buf--; /* * Convert series of 0 and 1 into the octet string. */ for(; p < pend; p++) { int ch = *(const unsigned char *)p; switch(ch) { case 0x09: case 0x0a: case 0x0c: case 0x0d: case 0x20: /* Ignore whitespace */ break; case 0x30: case 0x31: if(bits_unused-- <= 0) { *++buf = 0; /* Clean the cell */ bits_unused = 7; } *buf |= (ch&1) << bits_unused; break; default: st->bits_unused = bits_unused; return -1; } } if(bits_unused == 8) { st->size = buf - st->buf; st->bits_unused = 0; } else { st->size = buf - st->buf + 1; st->bits_unused = bits_unused; } assert(st->size <= _ns); st->buf[st->size] = 0; /* Courtesy termination */ return chunk_size; /* Converted in full */ } /* * Something like strtod(), but with stricter rules. */ static int OS__strtoent(int base, const char *buf, const char *end, int32_t *ret_value) { int32_t val = 0; const char *p; for(p = buf; p < end; p++) { int ch = *p; /* Strange huge value */ if((val * base + base) < 0) return -1; switch(ch) { case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: /*01234*/ case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: /*56789*/ val = val * base + (ch - 0x30); break; case 0x41: case 0x42: case 0x43: /* ABC */ case 0x44: case 0x45: case 0x46: /* DEF */ val = val * base + (ch - 0x41 + 10); break; case 0x61: case 0x62: case 0x63: /* abc */ case 0x64: case 0x65: case 0x66: /* def */ val = val * base + (ch - 0x61 + 10); break; case 0x3b: /* ';' */ *ret_value = val; return (p - buf) + 1; default: return -1; /* Character set error */ } } *ret_value = -1; return (p - buf); } /* * Convert from the plain UTF-8 format, expanding entity references: "2 < 3" */ static ssize_t OCTET_STRING__convert_entrefs(void *sptr, const void *chunk_buf, size_t chunk_size, int have_more) { OCTET_STRING_t *st = (OCTET_STRING_t *)sptr; const char *p = (const char *)chunk_buf; const char *pend = p + chunk_size; uint8_t *buf; /* Reallocate buffer */ ssize_t _ns = st->size + chunk_size; void *nptr = REALLOC(st->buf, _ns + 1); if(!nptr) return -1; st->buf = (uint8_t *)nptr; buf = st->buf + st->size; /* * Convert series of 0 and 1 into the octet string. */ for(; p < pend; p++) { int ch = *(const unsigned char *)p; int len; /* Length of the rest of the chunk */ if(ch != 0x26 /* '&' */) { *buf++ = ch; continue; /* That was easy... */ } /* * Process entity reference. */ len = chunk_size - (p - (const char *)chunk_buf); if(len == 1 /* "&" */) goto want_more; if(p[1] == 0x23 /* '#' */) { const char *pval; /* Pointer to start of digits */ int32_t val = 0; /* Entity reference value */ int base; if(len == 2 /* "&#" */) goto want_more; if(p[2] == 0x78 /* 'x' */) pval = p + 3, base = 16; else pval = p + 2, base = 10; len = OS__strtoent(base, pval, p + len, &val); if(len == -1) { /* Invalid charset. Just copy verbatim. */ *buf++ = ch; continue; } if(!len || pval[len-1] != 0x3b) goto want_more; assert(val > 0); p += (pval - p) + len - 1; /* Advance past entref */ if(val < 0x80) { *buf++ = (char)val; } else if(val < 0x800) { *buf++ = 0xc0 | ((val >> 6)); *buf++ = 0x80 | ((val & 0x3f)); } else if(val < 0x10000) { *buf++ = 0xe0 | ((val >> 12)); *buf++ = 0x80 | ((val >> 6) & 0x3f); *buf++ = 0x80 | ((val & 0x3f)); } else if(val < 0x200000) { *buf++ = 0xf0 | ((val >> 18)); *buf++ = 0x80 | ((val >> 12) & 0x3f); *buf++ = 0x80 | ((val >> 6) & 0x3f); *buf++ = 0x80 | ((val & 0x3f)); } else if(val < 0x4000000) { *buf++ = 0xf8 | ((val >> 24)); *buf++ = 0x80 | ((val >> 18) & 0x3f); *buf++ = 0x80 | ((val >> 12) & 0x3f); *buf++ = 0x80 | ((val >> 6) & 0x3f); *buf++ = 0x80 | ((val & 0x3f)); } else { *buf++ = 0xfc | ((val >> 30) & 0x1); *buf++ = 0x80 | ((val >> 24) & 0x3f); *buf++ = 0x80 | ((val >> 18) & 0x3f); *buf++ = 0x80 | ((val >> 12) & 0x3f); *buf++ = 0x80 | ((val >> 6) & 0x3f); *buf++ = 0x80 | ((val & 0x3f)); } } else { /* * Ugly, limited parsing of & > < */ char *sc = (char *)memchr(p, 0x3b, len > 5 ? 5 : len); if(!sc) goto want_more; if((sc - p) == 4 && p[1] == 0x61 /* 'a' */ && p[2] == 0x6d /* 'm' */ && p[3] == 0x70 /* 'p' */) { *buf++ = 0x26; p = sc; continue; } if((sc - p) == 3) { if(p[1] == 0x6c) { *buf = 0x3c; /* '<' */ } else if(p[1] == 0x67) { *buf = 0x3e; /* '>' */ } else { /* Unsupported entity reference */ *buf++ = ch; continue; } if(p[2] != 0x74) { /* Unsupported entity reference */ *buf++ = ch; continue; } buf++; p = sc; continue; } /* Unsupported entity reference */ *buf++ = ch; } continue; want_more: if(have_more) { /* * We know that no more data (of the same type) * is coming. Copy the rest verbatim. */ *buf++ = ch; continue; } chunk_size = (p - (const char *)chunk_buf); /* Processing stalled: need more data */ break; } st->size = buf - st->buf; assert(st->size <= _ns); st->buf[st->size] = 0; /* Courtesy termination */ return chunk_size; /* Converted in full */ } /* * Decode OCTET STRING from the XML element's body. */ static asn_dec_rval_t OCTET_STRING__decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, const char *opt_mname, const void *buf_ptr, size_t size, int (*opt_unexpected_tag_decoder) (void *struct_ptr, const void *chunk_buf, size_t chunk_size), ssize_t (*body_receiver) (void *struct_ptr, const void *chunk_buf, size_t chunk_size, int have_more) ) { OCTET_STRING_t *st = (OCTET_STRING_t *)*sptr; asn_OCTET_STRING_specifics_t *specs = td->specifics ? (asn_OCTET_STRING_specifics_t *)td->specifics : &asn_DEF_OCTET_STRING_specs; const char *xml_tag = opt_mname ? opt_mname : td->xml_tag; asn_struct_ctx_t *ctx; /* Per-structure parser context */ asn_dec_rval_t rval; /* Return value from the decoder */ int st_allocated; /* * Create the string if does not exist. */ if(!st) { st = (OCTET_STRING_t *)CALLOC(1, specs->struct_size); *sptr = (void *)st; if(!st) goto sta_failed; st_allocated = 1; } else { st_allocated = 0; } if(!st->buf) { /* This is separate from above section */ st->buf = (uint8_t *)CALLOC(1, 1); if(!st->buf) { if(st_allocated) { *sptr = 0; goto stb_failed; } else { goto sta_failed; } } } /* Restore parsing context */ ctx = (asn_struct_ctx_t *)(((char *)*sptr) + specs->ctx_offset); return xer_decode_general(opt_codec_ctx, ctx, *sptr, xml_tag, buf_ptr, size, opt_unexpected_tag_decoder, body_receiver); stb_failed: FREEMEM(st); sta_failed: rval.code = RC_FAIL; rval.consumed = 0; return rval; } /* * Decode OCTET STRING from the hexadecimal data. */ asn_dec_rval_t OCTET_STRING_decode_xer_hex(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, const char *opt_mname, const void *buf_ptr, size_t size) { return OCTET_STRING__decode_xer(opt_codec_ctx, td, sptr, opt_mname, buf_ptr, size, 0, OCTET_STRING__convert_hexadecimal); } /* * Decode OCTET STRING from the binary (0/1) data. */ asn_dec_rval_t OCTET_STRING_decode_xer_binary(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, const char *opt_mname, const void *buf_ptr, size_t size) { return OCTET_STRING__decode_xer(opt_codec_ctx, td, sptr, opt_mname, buf_ptr, size, 0, OCTET_STRING__convert_binary); } /* * Decode OCTET STRING from the string (ASCII/UTF-8) data. */ asn_dec_rval_t OCTET_STRING_decode_xer_utf8(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, const char *opt_mname, const void *buf_ptr, size_t size) { return OCTET_STRING__decode_xer(opt_codec_ctx, td, sptr, opt_mname, buf_ptr, size, OCTET_STRING__handle_control_chars, OCTET_STRING__convert_entrefs); } static int OCTET_STRING_per_get_characters(asn_per_data_t *po, uint8_t *buf, size_t units, unsigned int bpc, unsigned int unit_bits, long lb, long ub, asn_per_constraints_t *pc) { uint8_t *end = buf + units * bpc; ASN_DEBUG("Expanding %d characters into (%ld..%ld):%d", (int)units, lb, ub, unit_bits); /* X.691: 27.5.4 */ if((unsigned long)ub <= ((unsigned long)2 << (unit_bits - 1))) { /* Decode without translation */ lb = 0; } else if(pc && pc->code2value) { if(unit_bits > 16) return 1; /* FATAL: can't have constrained * UniversalString with more than * 16 million code points */ for(; buf < end; buf += bpc) { int value; int code = per_get_few_bits(po, unit_bits); if(code < 0) return -1; /* WMORE */ value = pc->code2value(code); if(value < 0) { ASN_DEBUG("Code %d (0x%02x) is" " not in map (%ld..%ld)", code, code, lb, ub); return 1; /* FATAL */ } switch(bpc) { case 1: *buf = value; break; case 2: buf[0] = value >> 8; buf[1] = value; break; case 4: buf[0] = value >> 24; buf[1] = value >> 16; buf[2] = value >> 8; buf[3] = value; break; } } return 0; } /* Shortcut the no-op copying to the aligned structure */ if(lb == 0 && (unit_bits == 8 * bpc)) { return per_get_many_bits(po, buf, 0, unit_bits * units); } for(; buf < end; buf += bpc) { int code = per_get_few_bits(po, unit_bits); int ch = code + lb; if(code < 0) return -1; /* WMORE */ if(ch > ub) { ASN_DEBUG("Code %d is out of range (%ld..%ld)", ch, lb, ub); return 1; /* FATAL */ } switch(bpc) { case 1: *buf = ch; break; case 2: buf[0] = ch >> 8; buf[1] = ch; break; case 4: buf[0] = ch >> 24; buf[1] = ch >> 16; buf[2] = ch >> 8; buf[3] = ch; break; } } return 0; } static int OCTET_STRING_per_put_characters(asn_per_outp_t *po, const uint8_t *buf, size_t units, unsigned int bpc, unsigned int unit_bits, long lb, long ub, asn_per_constraints_t *pc) { const uint8_t *end = buf + units * bpc; ASN_DEBUG("Squeezing %d characters into (%ld..%ld):%d (%d bpc)", (int)units, lb, ub, unit_bits, bpc); /* X.691: 27.5.4 */ if((unsigned long)ub <= ((unsigned long)2 << (unit_bits - 1))) { /* Encode as is */ lb = 0; } else if(pc && pc->value2code) { for(; buf < end; buf += bpc) { int code; uint32_t value; switch(bpc) { case 1: value = *(const uint8_t *)buf; break; case 2: value = (buf[0] << 8) | buf[1]; break; case 4: value = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3]; break; default: return -1; } code = pc->value2code(value); if(code < 0) { ASN_DEBUG("Character %d (0x%02x) is" " not in map (%ld..%ld)", *buf, *buf, lb, ub); return -1; } if(per_put_few_bits(po, code, unit_bits)) return -1; } } /* Shortcut the no-op copying to the aligned structure */ if(lb == 0 && (unit_bits == 8 * bpc)) { return per_put_many_bits(po, buf, unit_bits * units); } for(ub -= lb; buf < end; buf += bpc) { int ch; uint32_t value; switch(bpc) { case 1: value = *(const uint8_t *)buf; break; case 2: value = (buf[0] << 8) | buf[1]; break; case 4: value = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3]; break; default: return -1; } ch = value - lb; if(ch < 0 || ch > ub) { ASN_DEBUG("Character %d (0x%02x)" " is out of range (%ld..%ld)", *buf, *buf, lb, ub + lb); return -1; } if(per_put_few_bits(po, ch, unit_bits)) return -1; } return 0; } asn_dec_rval_t OCTET_STRING_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { asn_OCTET_STRING_specifics_t *specs = td->specifics ? (asn_OCTET_STRING_specifics_t *)td->specifics : &asn_DEF_OCTET_STRING_specs; asn_per_constraints_t *pc = constraints ? constraints : td->per_constraints; asn_per_constraint_t *cval; asn_per_constraint_t *csiz; asn_dec_rval_t rval = { RC_OK, 0 }; BIT_STRING_t *st = (BIT_STRING_t *)*sptr; ssize_t consumed_myself = 0; int repeat; enum { OS__BPC_BIT = 0, OS__BPC_CHAR = 1, OS__BPC_U16 = 2, OS__BPC_U32 = 4 } bpc; /* Bytes per character */ unsigned int unit_bits; unsigned int canonical_unit_bits; (void)opt_codec_ctx; if(pc) { cval = &pc->value; csiz = &pc->size; } else { cval = &asn_DEF_OCTET_STRING_constraints.value; csiz = &asn_DEF_OCTET_STRING_constraints.size; } switch(specs->subvariant) { default: case ASN_OSUBV_ANY: ASN_DEBUG("Unrecognized subvariant %d", specs->subvariant); RETURN(RC_FAIL); case ASN_OSUBV_BIT: canonical_unit_bits = unit_bits = 1; bpc = OS__BPC_BIT; break; case ASN_OSUBV_STR: canonical_unit_bits = unit_bits = 8; if(cval->flags & APC_CONSTRAINED) unit_bits = cval->range_bits; bpc = OS__BPC_CHAR; break; case ASN_OSUBV_U16: canonical_unit_bits = unit_bits = 16; if(cval->flags & APC_CONSTRAINED) unit_bits = cval->range_bits; bpc = OS__BPC_U16; break; case ASN_OSUBV_U32: canonical_unit_bits = unit_bits = 32; if(cval->flags & APC_CONSTRAINED) unit_bits = cval->range_bits; bpc = OS__BPC_U32; break; } /* * Allocate the string. */ if(!st) { st = (BIT_STRING_t *)(*sptr = CALLOC(1, specs->struct_size)); if(!st) RETURN(RC_FAIL); } ASN_DEBUG("PER Decoding %s size %ld .. %ld bits %d", csiz->flags & APC_EXTENSIBLE ? "extensible" : "non-extensible", csiz->lower_bound, csiz->upper_bound, csiz->effective_bits); if(csiz->flags & APC_EXTENSIBLE) { int inext = per_get_few_bits(pd, 1); if(inext < 0) RETURN(RC_WMORE); if(inext) { csiz = &asn_DEF_OCTET_STRING_constraints.size; cval = &asn_DEF_OCTET_STRING_constraints.value; unit_bits = canonical_unit_bits; } } if(csiz->effective_bits >= 0) { FREEMEM(st->buf); if(bpc) { st->size = csiz->upper_bound * bpc; } else { st->size = (csiz->upper_bound + 7) >> 3; } st->buf = (uint8_t *)MALLOC(st->size + 1); if(!st->buf) { st->size = 0; RETURN(RC_FAIL); } } /* X.691, #16.5: zero-length encoding */ /* X.691, #16.6: short fixed length encoding (up to 2 octets) */ /* X.691, #16.7: long fixed length encoding (up to 64K octets) */ if(csiz->effective_bits == 0) { int ret; if(bpc) { ASN_DEBUG("Encoding OCTET STRING size %ld", csiz->upper_bound); ret = OCTET_STRING_per_get_characters(pd, st->buf, csiz->upper_bound, bpc, unit_bits, cval->lower_bound, cval->upper_bound, pc); if(ret > 0) RETURN(RC_FAIL); } else { ASN_DEBUG("Encoding BIT STRING size %ld", csiz->upper_bound); ret = per_get_many_bits(pd, st->buf, 0, unit_bits * csiz->upper_bound); } if(ret < 0) RETURN(RC_WMORE); consumed_myself += unit_bits * csiz->upper_bound; st->buf[st->size] = 0; if(bpc == 0) { int ubs = (csiz->upper_bound & 0x7); st->bits_unused = ubs ? 8 - ubs : 0; } RETURN(RC_OK); } st->size = 0; do { ssize_t raw_len; ssize_t len_bytes; ssize_t len_bits; void *p; int ret; /* Get the PER length */ raw_len = uper_get_length(pd, csiz->effective_bits, &repeat); if(raw_len < 0) RETURN(RC_WMORE); raw_len += csiz->lower_bound; ASN_DEBUG("Got PER length eb %ld, len %ld, %s (%s)", (long)csiz->effective_bits, (long)raw_len, repeat ? "repeat" : "once", td->name); if(bpc) { len_bytes = raw_len * bpc; len_bits = len_bytes * unit_bits; } else { len_bits = raw_len; len_bytes = (len_bits + 7) >> 3; if(len_bits & 0x7) st->bits_unused = 8 - (len_bits & 0x7); /* len_bits be multiple of 16K if repeat is set */ } p = REALLOC(st->buf, st->size + len_bytes + 1); if(!p) RETURN(RC_FAIL); st->buf = (uint8_t *)p; if(bpc) { ret = OCTET_STRING_per_get_characters(pd, &st->buf[st->size], raw_len, bpc, unit_bits, cval->lower_bound, cval->upper_bound, pc); if(ret > 0) RETURN(RC_FAIL); } else { ret = per_get_many_bits(pd, &st->buf[st->size], 0, len_bits); } if(ret < 0) RETURN(RC_WMORE); st->size += len_bytes; } while(repeat); st->buf[st->size] = 0; /* nul-terminate */ return rval; } asn_enc_rval_t OCTET_STRING_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { asn_OCTET_STRING_specifics_t *specs = td->specifics ? (asn_OCTET_STRING_specifics_t *)td->specifics : &asn_DEF_OCTET_STRING_specs; asn_per_constraints_t *pc = constraints ? constraints : td->per_constraints; asn_per_constraint_t *cval; asn_per_constraint_t *csiz; const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; asn_enc_rval_t er = { 0, 0, 0 }; int inext = 0; /* Lies not within extension root */ unsigned int unit_bits; unsigned int canonical_unit_bits; unsigned int sizeinunits; const uint8_t *buf; int ret; enum { OS__BPC_BIT = 0, OS__BPC_CHAR = 1, OS__BPC_U16 = 2, OS__BPC_U32 = 4 } bpc; /* Bytes per character */ int ct_extensible; if(!st || (!st->buf && st->size)) ASN__ENCODE_FAILED; if(pc) { cval = &pc->value; csiz = &pc->size; } else { cval = &asn_DEF_OCTET_STRING_constraints.value; csiz = &asn_DEF_OCTET_STRING_constraints.size; } ct_extensible = csiz->flags & APC_EXTENSIBLE; switch(specs->subvariant) { default: case ASN_OSUBV_ANY: ASN__ENCODE_FAILED; case ASN_OSUBV_BIT: canonical_unit_bits = unit_bits = 1; bpc = OS__BPC_BIT; sizeinunits = st->size * 8 - (st->bits_unused & 0x07); ASN_DEBUG("BIT STRING of %d bytes, %d bits unused", sizeinunits, st->bits_unused); break; case ASN_OSUBV_STR: canonical_unit_bits = unit_bits = 8; if(cval->flags & APC_CONSTRAINED) unit_bits = cval->range_bits; bpc = OS__BPC_CHAR; sizeinunits = st->size; break; case ASN_OSUBV_U16: canonical_unit_bits = unit_bits = 16; if(cval->flags & APC_CONSTRAINED) unit_bits = cval->range_bits; bpc = OS__BPC_U16; sizeinunits = st->size / 2; break; case ASN_OSUBV_U32: canonical_unit_bits = unit_bits = 32; if(cval->flags & APC_CONSTRAINED) unit_bits = cval->range_bits; bpc = OS__BPC_U32; sizeinunits = st->size / 4; break; } ASN_DEBUG("Encoding %s into %d units of %d bits" " (%ld..%ld, effective %d)%s", td->name, sizeinunits, unit_bits, csiz->lower_bound, csiz->upper_bound, csiz->effective_bits, ct_extensible ? " EXT" : ""); /* Figure out whether size lies within PER visible constraint */ if(csiz->effective_bits >= 0) { if((int)sizeinunits < csiz->lower_bound || (int)sizeinunits > csiz->upper_bound) { if(ct_extensible) { cval = &asn_DEF_OCTET_STRING_constraints.value; csiz = &asn_DEF_OCTET_STRING_constraints.size; unit_bits = canonical_unit_bits; inext = 1; } else ASN__ENCODE_FAILED; } } else { inext = 0; } if(ct_extensible) { /* Declare whether length is [not] within extension root */ if(per_put_few_bits(po, inext, 1)) ASN__ENCODE_FAILED; } /* X.691, #16.5: zero-length encoding */ /* X.691, #16.6: short fixed length encoding (up to 2 octets) */ /* X.691, #16.7: long fixed length encoding (up to 64K octets) */ if(csiz->effective_bits >= 0) { ASN_DEBUG("Encoding %d bytes (%ld), length in %d bits", st->size, sizeinunits - csiz->lower_bound, csiz->effective_bits); ret = per_put_few_bits(po, sizeinunits - csiz->lower_bound, csiz->effective_bits); if(ret) ASN__ENCODE_FAILED; if(bpc) { ret = OCTET_STRING_per_put_characters(po, st->buf, sizeinunits, bpc, unit_bits, cval->lower_bound, cval->upper_bound, pc); } else { ret = per_put_many_bits(po, st->buf, sizeinunits * unit_bits); } if(ret) ASN__ENCODE_FAILED; ASN__ENCODED_OK(er); } ASN_DEBUG("Encoding %d bytes", st->size); if(sizeinunits == 0) { if(uper_put_length(po, 0)) ASN__ENCODE_FAILED; ASN__ENCODED_OK(er); } buf = st->buf; while(sizeinunits) { ssize_t maySave = uper_put_length(po, sizeinunits); if(maySave < 0) ASN__ENCODE_FAILED; ASN_DEBUG("Encoding %ld of %ld", (long)maySave, (long)sizeinunits); if(bpc) { ret = OCTET_STRING_per_put_characters(po, buf, maySave, bpc, unit_bits, cval->lower_bound, cval->upper_bound, pc); } else { ret = per_put_many_bits(po, buf, maySave * unit_bits); } if(ret) ASN__ENCODE_FAILED; if(bpc) buf += maySave * bpc; else buf += maySave >> 3; sizeinunits -= maySave; assert(!(maySave & 0x07) || !sizeinunits); } ASN__ENCODED_OK(er); } int OCTET_STRING_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { const char * const h2c = "0123456789ABCDEF"; const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; char scratch[16 * 3 + 4]; char *p = scratch; uint8_t *buf; uint8_t *end; size_t i; (void)td; /* Unused argument */ if(!st || (!st->buf && st->size)) return (cb("", 8, app_key) < 0) ? -1 : 0; /* * Dump the contents of the buffer in hexadecimal. */ buf = st->buf; end = buf + st->size; for(i = 0; buf < end; buf++, i++) { if(!(i % 16) && (i || st->size > 16)) { if(cb(scratch, p - scratch, app_key) < 0) return -1; _i_INDENT(1); p = scratch; } *p++ = h2c[(*buf >> 4) & 0x0F]; *p++ = h2c[*buf & 0x0F]; *p++ = 0x20; } if(p > scratch) { p--; /* Remove the tail space */ if(cb(scratch, p - scratch, app_key) < 0) return -1; } return 0; } int OCTET_STRING_print_utf8(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; (void)td; /* Unused argument */ (void)ilevel; /* Unused argument */ if(st && (st->buf || !st->size)) { return (cb(st->buf, st->size, app_key) < 0) ? -1 : 0; } else { return (cb("", 8, app_key) < 0) ? -1 : 0; } } void OCTET_STRING_free(asn_TYPE_descriptor_t *td, void *sptr, int contents_only) { OCTET_STRING_t *st = (OCTET_STRING_t *)sptr; asn_OCTET_STRING_specifics_t *specs; asn_struct_ctx_t *ctx; struct _stack *stck; if(!td || !st) return; specs = td->specifics ? (asn_OCTET_STRING_specifics_t *)td->specifics : &asn_DEF_OCTET_STRING_specs; ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); ASN_DEBUG("Freeing %s as OCTET STRING", td->name); if(st->buf) { FREEMEM(st->buf); st->buf = 0; } /* * Remove decode-time stack. */ stck = (struct _stack *)ctx->ptr; if(stck) { while(stck->tail) { struct _stack_el *sel = stck->tail; stck->tail = sel->prev; FREEMEM(sel); } FREEMEM(stck); } if(!contents_only) { FREEMEM(st); } } /* * Conversion routines. */ int OCTET_STRING_fromBuf(OCTET_STRING_t *st, const char *str, int len) { void *buf; if(st == 0 || (str == 0 && len)) { errno = EINVAL; return -1; } /* * Clear the OCTET STRING. */ if(str == NULL) { FREEMEM(st->buf); st->buf = 0; st->size = 0; return 0; } /* Determine the original string size, if not explicitly given */ if(len < 0) len = strlen(str); /* Allocate and fill the memory */ buf = MALLOC(len + 1); if(buf == NULL) return -1; memcpy(buf, str, len); ((uint8_t *)buf)[len] = '\0'; /* Couldn't use memcpy(len+1)! */ FREEMEM(st->buf); st->buf = (uint8_t *)buf; st->size = len; return 0; } OCTET_STRING_t * OCTET_STRING_new_fromBuf(asn_TYPE_descriptor_t *td, const char *str, int len) { asn_OCTET_STRING_specifics_t *specs = td->specifics ? (asn_OCTET_STRING_specifics_t *)td->specifics : &asn_DEF_OCTET_STRING_specs; OCTET_STRING_t *st; st = (OCTET_STRING_t *)CALLOC(1, specs->struct_size); if(st && str && OCTET_STRING_fromBuf(st, str, len)) { FREEMEM(st); st = NULL; } return st; } asn1c-0.9.28+dfsg/skeletons/NumericString.c0000644000000000000000000000531013065714043017202 0ustar rootroot/*- * Copyright (c) 2003, 2006 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #include #include /* * NumericString basic type description. */ static const ber_tlv_tag_t asn_DEF_NumericString_tags[] = { (ASN_TAG_CLASS_UNIVERSAL | (18 << 2)), /* [UNIVERSAL 18] IMPLICIT ...*/ (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */ }; static int asn_DEF_NumericString_v2c(unsigned int value) { switch(value) { case 0x20: return 0; case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: return value - (0x30 - 1); } return -1; } static int asn_DEF_NumericString_c2v(unsigned int code) { if(code > 0) { if(code <= 10) return code + (0x30 - 1); else return -1; } else { return 0x20; } } static asn_per_constraints_t asn_DEF_NumericString_constraints = { { APC_CONSTRAINED, 4, 4, 0x20, 0x39 }, /* Value */ { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 }, /* Size */ asn_DEF_NumericString_v2c, asn_DEF_NumericString_c2v }; asn_TYPE_descriptor_t asn_DEF_NumericString = { "NumericString", "NumericString", OCTET_STRING_free, OCTET_STRING_print_utf8, /* ASCII subset */ NumericString_constraint, OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */ OCTET_STRING_encode_der, OCTET_STRING_decode_xer_utf8, OCTET_STRING_encode_xer_utf8, OCTET_STRING_decode_uper, OCTET_STRING_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_NumericString_tags, sizeof(asn_DEF_NumericString_tags) / sizeof(asn_DEF_NumericString_tags[0]) - 1, asn_DEF_NumericString_tags, sizeof(asn_DEF_NumericString_tags) / sizeof(asn_DEF_NumericString_tags[0]), &asn_DEF_NumericString_constraints, 0, 0, /* No members */ 0 /* No specifics */ }; int NumericString_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const NumericString_t *st = (const NumericString_t *)sptr; if(st && st->buf) { uint8_t *buf = st->buf; uint8_t *end = buf + st->size; /* * Check the alphabet of the NumericString. * ASN.1:1984 (X.409) */ for(; buf < end; buf++) { switch(*buf) { case 0x20: case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: continue; } ASN__CTFAIL(app_key, td, sptr, "%s: value byte %ld (%d) " "not in NumericString alphabet (%s:%d)", td->name, (long)((buf - st->buf) + 1), *buf, __FILE__, __LINE__); return -1; } } else { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } return 0; } asn1c-0.9.28+dfsg/skeletons/NULL.h0000644000000000000000000000131113065714043015165 0ustar rootroot/*- * Copyright (c) 2003 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef ASN_TYPE_NULL_H #define ASN_TYPE_NULL_H #include #ifdef __cplusplus extern "C" { #endif /* * The value of the NULL type is meaningless: see BOOLEAN if you want to * carry true/false semantics. */ typedef int NULL_t; extern asn_TYPE_descriptor_t asn_DEF_NULL; asn_struct_print_f NULL_print; der_type_encoder_f NULL_encode_der; xer_type_decoder_f NULL_decode_xer; xer_type_encoder_f NULL_encode_xer; per_type_decoder_f NULL_decode_uper; per_type_encoder_f NULL_encode_uper; #ifdef __cplusplus } #endif #endif /* NULL_H */ asn1c-0.9.28+dfsg/skeletons/BMPString.h0000644000000000000000000000112613065714043016224 0ustar rootroot/*- * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef _BMPString_H_ #define _BMPString_H_ #include #ifdef __cplusplus extern "C" { #endif typedef OCTET_STRING_t BMPString_t; /* Implemented via OCTET STRING */ extern asn_TYPE_descriptor_t asn_DEF_BMPString; asn_struct_print_f BMPString_print; /* Human-readable output */ xer_type_decoder_f BMPString_decode_xer; xer_type_encoder_f BMPString_encode_xer; #ifdef __cplusplus } #endif #endif /* _BMPString_H_ */ asn1c-0.9.28+dfsg/skeletons/UTF8String.c0000644000000000000000000001126013065714043016327 0ustar rootroot/*- * Copyright (c) 2003, 2004, 2006 Lev Walkin . * All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #include #include /* * UTF8String basic type description. */ static const ber_tlv_tag_t asn_DEF_UTF8String_tags[] = { (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)), /* [UNIVERSAL 12] IMPLICIT ...*/ (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), /* ... OCTET STRING */ }; asn_TYPE_descriptor_t asn_DEF_UTF8String = { "UTF8String", "UTF8String", OCTET_STRING_free, UTF8String_print, UTF8String_constraint, /* Check for invalid codes, etc. */ OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */ OCTET_STRING_encode_der, OCTET_STRING_decode_xer_utf8, OCTET_STRING_encode_xer_utf8, OCTET_STRING_decode_uper, OCTET_STRING_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_UTF8String_tags, sizeof(asn_DEF_UTF8String_tags) / sizeof(asn_DEF_UTF8String_tags[0]) - 1, asn_DEF_UTF8String_tags, sizeof(asn_DEF_UTF8String_tags) / sizeof(asn_DEF_UTF8String_tags[0]), 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /* * This is the table of length expectations. * The second half of this table is only applicable to the long sequences. */ static const int UTF8String_ht[2][16] = { { /* 0x0 ... 0x7 */ /* 0000..0111 */ 1, 1, 1, 1, 1, 1, 1, 1, /* 1000..1011(0), 1100..1101(2), 1110(3), 1111(-1) */ 0, 0, 0, 0, 2, 2, 3, -1 }, { /* 0xF0 .. 0xF7 */ /* 11110000..11110111 */ 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, -1, -1 } }; static const int32_t UTF8String_mv[7] = { 0, 0, 0x00000080, 0x00000800, 0x00010000, 0x00200000, 0x04000000 }; /* Internal aliases for return codes */ #define U8E_TRUNC -1 /* UTF-8 sequence truncated */ #define U8E_ILLSTART -2 /* Illegal UTF-8 sequence start */ #define U8E_NOTCONT -3 /* Continuation expectation failed */ #define U8E_NOTMIN -4 /* Not minimal length encoding */ #define U8E_EINVAL -5 /* Invalid arguments */ int UTF8String_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { ssize_t len = UTF8String_length((const UTF8String_t *)sptr); switch(len) { case U8E_EINVAL: ASN__CTFAIL(app_key, td, sptr, "%s: value not given", td->name); break; case U8E_TRUNC: ASN__CTFAIL(app_key, td, sptr, "%s: truncated UTF-8 sequence (%s:%d)", td->name, __FILE__, __LINE__); break; case U8E_ILLSTART: ASN__CTFAIL(app_key, td, sptr, "%s: UTF-8 illegal start of encoding (%s:%d)", td->name, __FILE__, __LINE__); break; case U8E_NOTCONT: ASN__CTFAIL(app_key, td, sptr, "%s: UTF-8 not continuation (%s:%d)", td->name, __FILE__, __LINE__); break; case U8E_NOTMIN: ASN__CTFAIL(app_key, td, sptr, "%s: UTF-8 not minimal sequence (%s:%d)", td->name, __FILE__, __LINE__); break; } return (len < 0) ? -1 : 0; } static ssize_t UTF8String__process(const UTF8String_t *st, uint32_t *dst, size_t dstlen) { size_t length; uint8_t *buf = st->buf; uint8_t *end = buf + st->size; uint32_t *dstend = dst + dstlen; for(length = 0; buf < end; length++) { int ch = *buf; uint8_t *cend; int32_t value; int want; /* Compute the sequence length */ want = UTF8String_ht[0][ch >> 4]; switch(want) { case -1: /* Second half of the table, long sequence */ want = UTF8String_ht[1][ch & 0x0F]; if(want != -1) break; /* Fall through */ case 0: return U8E_ILLSTART; } /* assert(want >= 1 && want <= 6) */ /* Check character sequence length */ if(buf + want > end) return U8E_TRUNC; value = ch & (0xff >> want); cend = buf + want; for(buf++; buf < cend; buf++) { ch = *buf; if(ch < 0x80 || ch > 0xbf) return U8E_NOTCONT; value = (value << 6) | (ch & 0x3F); } if(value < UTF8String_mv[want]) return U8E_NOTMIN; if(dst < dstend) *dst++ = value; /* Record value */ } if(dst < dstend) *dst = 0; /* zero-terminate */ return length; } ssize_t UTF8String_length(const UTF8String_t *st) { if(st && st->buf) { return UTF8String__process(st, 0, 0); } else { return U8E_EINVAL; } } size_t UTF8String_to_wcs(const UTF8String_t *st, uint32_t *dst, size_t dstlen) { if(st && st->buf) { ssize_t ret = UTF8String__process(st, dst, dstlen); return (ret < 0) ? 0 : ret; } else { return 0; } } int UTF8String_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { const UTF8String_t *st = (const UTF8String_t *)sptr; (void)td; /* Unused argument */ (void)ilevel; /* Unused argument */ if(st && st->buf) { return (cb(st->buf, st->size, app_key) < 0) ? -1 : 0; } else { return (cb("", 8, app_key) < 0) ? -1 : 0; } } asn1c-0.9.28+dfsg/skeletons/constr_SEQUENCE_OF.c0000644000000000000000000001237713065714043017610 0ustar rootroot/*- * Copyright (c) 2003, 2004, 2006 Lev Walkin . * All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #include #include #include /* * The DER encoder of the SEQUENCE OF type. */ asn_enc_rval_t SEQUENCE_OF_encode_der(asn_TYPE_descriptor_t *td, void *ptr, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { asn_TYPE_member_t *elm = td->elements; asn_anonymous_sequence_ *list = _A_SEQUENCE_FROM_VOID(ptr); size_t computed_size = 0; ssize_t encoding_size = 0; asn_enc_rval_t erval; int edx; ASN_DEBUG("Estimating size of SEQUENCE OF %s", td->name); /* * Gather the length of the underlying members sequence. */ for(edx = 0; edx < list->count; edx++) { void *memb_ptr = list->array[edx]; if(!memb_ptr) continue; erval = elm->type->der_encoder(elm->type, memb_ptr, 0, elm->tag, 0, 0); if(erval.encoded == -1) return erval; computed_size += erval.encoded; } /* * Encode the TLV for the sequence itself. */ encoding_size = der_write_tags(td, computed_size, tag_mode, 1, tag, cb, app_key); if(encoding_size == -1) { erval.encoded = -1; erval.failed_type = td; erval.structure_ptr = ptr; return erval; } computed_size += encoding_size; if(!cb) { erval.encoded = computed_size; ASN__ENCODED_OK(erval); } ASN_DEBUG("Encoding members of SEQUENCE OF %s", td->name); /* * Encode all members. */ for(edx = 0; edx < list->count; edx++) { void *memb_ptr = list->array[edx]; if(!memb_ptr) continue; erval = elm->type->der_encoder(elm->type, memb_ptr, 0, elm->tag, cb, app_key); if(erval.encoded == -1) return erval; encoding_size += erval.encoded; } if(computed_size != (size_t)encoding_size) { /* * Encoded size is not equal to the computed size. */ erval.encoded = -1; erval.failed_type = td; erval.structure_ptr = ptr; } else { erval.encoded = computed_size; erval.structure_ptr = 0; erval.failed_type = 0; } return erval; } asn_enc_rval_t SEQUENCE_OF_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { asn_enc_rval_t er; asn_SET_OF_specifics_t *specs = (asn_SET_OF_specifics_t *)td->specifics; asn_TYPE_member_t *elm = td->elements; asn_anonymous_sequence_ *list = _A_SEQUENCE_FROM_VOID(sptr); const char *mname = specs->as_XMLValueList ? 0 : ((*elm->name) ? elm->name : elm->type->xml_tag); unsigned int mlen = mname ? strlen(mname) : 0; int xcan = (flags & XER_F_CANONICAL); int i; if(!sptr) ASN__ENCODE_FAILED; er.encoded = 0; for(i = 0; i < list->count; i++) { asn_enc_rval_t tmper; void *memb_ptr = list->array[i]; if(!memb_ptr) continue; if(mname) { if(!xcan) ASN__TEXT_INDENT(1, ilevel); ASN__CALLBACK3("<", 1, mname, mlen, ">", 1); } tmper = elm->type->xer_encoder(elm->type, memb_ptr, ilevel + 1, flags, cb, app_key); if(tmper.encoded == -1) return tmper; if(tmper.encoded == 0 && specs->as_XMLValueList) { const char *name = elm->type->xml_tag; size_t len = strlen(name); if(!xcan) ASN__TEXT_INDENT(1, ilevel + 1); ASN__CALLBACK3("<", 1, name, len, "/>", 2); } if(mname) { ASN__CALLBACK3("", 1); er.encoded += 5; } er.encoded += (2 * mlen) + tmper.encoded; } if(!xcan) ASN__TEXT_INDENT(1, ilevel - 1); ASN__ENCODED_OK(er); cb_failed: ASN__ENCODE_FAILED; } asn_enc_rval_t SEQUENCE_OF_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { asn_anonymous_sequence_ *list; asn_per_constraint_t *ct; asn_enc_rval_t er; asn_TYPE_member_t *elm = td->elements; int seq; if(!sptr) ASN__ENCODE_FAILED; list = _A_SEQUENCE_FROM_VOID(sptr); er.encoded = 0; ASN_DEBUG("Encoding %s as SEQUENCE OF (%d)", td->name, list->count); if(constraints) ct = &constraints->size; else if(td->per_constraints) ct = &td->per_constraints->size; else ct = 0; /* If extensible constraint, check if size is in root */ if(ct) { int not_in_root = (list->count < ct->lower_bound || list->count > ct->upper_bound); ASN_DEBUG("lb %ld ub %ld %s", ct->lower_bound, ct->upper_bound, ct->flags & APC_EXTENSIBLE ? "ext" : "fix"); if(ct->flags & APC_EXTENSIBLE) { /* Declare whether size is in extension root */ if(per_put_few_bits(po, not_in_root, 1)) ASN__ENCODE_FAILED; if(not_in_root) ct = 0; } else if(not_in_root && ct->effective_bits >= 0) ASN__ENCODE_FAILED; } if(ct && ct->effective_bits >= 0) { /* X.691, #19.5: No length determinant */ if(per_put_few_bits(po, list->count - ct->lower_bound, ct->effective_bits)) ASN__ENCODE_FAILED; } for(seq = -1; seq < list->count;) { ssize_t mayEncode; if(seq < 0) seq = 0; if(ct && ct->effective_bits >= 0) { mayEncode = list->count; } else { mayEncode = uper_put_length(po, list->count - seq); if(mayEncode < 0) ASN__ENCODE_FAILED; } while(mayEncode--) { void *memb_ptr = list->array[seq++]; if(!memb_ptr) ASN__ENCODE_FAILED; er = elm->type->uper_encoder(elm->type, elm->per_constraints, memb_ptr, po); if(er.encoded == -1) ASN__ENCODE_FAILED; } } ASN__ENCODED_OK(er); } asn1c-0.9.28+dfsg/skeletons/asn_system.h0000644000000000000000000000667313065714043016620 0ustar rootroot/*- * Copyright (c) 2003, 2004, 2007 Lev Walkin . * All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ /* * Miscellaneous system-dependent types. */ #ifndef ASN_SYSTEM_H #define ASN_SYSTEM_H #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifndef _BSD_SOURCE #define _BSD_SOURCE /* for snprintf() on some linux systems */ #endif #include /* For snprintf(3) */ #include /* For *alloc(3) */ #include /* For memcpy(3) */ #include /* For size_t */ #include /* For LONG_MAX */ #include /* For va_start */ #include /* for offsetof and ptrdiff_t */ #ifdef HAVE_ALLOCA_H #include /* For alloca(3) */ #endif #ifdef _WIN32 #include #define snprintf _snprintf #define vsnprintf _vsnprintf /* To avoid linking with ws2_32.lib, here's the definition of ntohl() */ #define sys_ntohl(l) ((((l) << 24) & 0xff000000) \ | (((l) << 8) & 0xff0000) \ | (((l) >> 8) & 0xff00) \ | ((l >> 24) & 0xff)) #ifdef _MSC_VER /* MSVS.Net */ #ifndef __cplusplus #define inline __inline #endif #ifndef ASSUMESTDTYPES /* Standard types have been defined elsewhere */ #define ssize_t SSIZE_T typedef char int8_t; typedef short int16_t; typedef int int32_t; typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned int uint32_t; #endif /* ASSUMESTDTYPES */ #define WIN32_LEAN_AND_MEAN #include #include #define isnan _isnan #define finite _finite #define copysign _copysign #define ilogb _logb #else /* !_MSC_VER */ #include #endif /* _MSC_VER */ #else /* !_WIN32 */ #if defined(__vxworks) #include #else /* !defined(__vxworks) */ #include /* C99 specifies this file */ /* * 1. Earlier FreeBSD version didn't have , * but was present. * 2. Sun Solaris requires for alloca(3), * but does not have . */ #if (!defined(__FreeBSD__) || !defined(_SYS_INTTYPES_H_)) #if defined(sun) #include /* For alloca(3) */ #include /* for finite(3) */ #elif defined(__hpux) #ifdef __GNUC__ #include /* For alloca(3) */ #else /* !__GNUC__ */ #define inline #endif /* __GNUC__ */ #else #include /* SUSv2+ and C99 specify this file, for uintXX_t */ #endif /* defined(sun) */ #endif #include /* for ntohl() */ #define sys_ntohl(foo) ntohl(foo) #endif /* defined(__vxworks) */ #endif /* _WIN32 */ #if __GNUC__ >= 3 #ifndef GCC_PRINTFLIKE #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) #endif #ifndef GCC_NOTUSED #define GCC_NOTUSED __attribute__((unused)) #endif #else #ifndef GCC_PRINTFLIKE #define GCC_PRINTFLIKE(fmt,var) /* nothing */ #endif #ifndef GCC_NOTUSED #define GCC_NOTUSED #endif #endif /* Figure out if thread safety is requested */ #if !defined(ASN_THREAD_SAFE) && (defined(THREAD_SAFE) || defined(_REENTRANT)) #define ASN_THREAD_SAFE #endif /* Thread safety */ #ifndef offsetof /* If not defined by */ #define offsetof(s, m) ((ptrdiff_t)&(((s *)0)->m) - (ptrdiff_t)((s *)0)) #endif /* offsetof */ #ifndef MIN /* Suitable for comparing primitive types (integers) */ #if defined(__GNUC__) #define MIN(a,b) ({ __typeof a _a = a; __typeof b _b = b; \ ((_a)<(_b)?(_a):(_b)); }) #else /* !__GNUC__ */ #define MIN(a,b) ((a)<(b)?(a):(b)) /* Unsafe variant */ #endif /* __GNUC__ */ #endif /* MIN */ #endif /* ASN_SYSTEM_H */ asn1c-0.9.28+dfsg/skeletons/xer_support.h0000644000000000000000000000342413065714043017014 0ustar rootroot/* * Copyright (c) 2003, 2004 X/IO Labs, xiolabs.com. * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef _XER_SUPPORT_H_ #define _XER_SUPPORT_H_ #include /* Platform-specific types */ #ifdef __cplusplus extern "C" { #endif /* * Types of data transferred to the application. */ typedef enum { PXML_TEXT, /* Plain text between XML tags. */ PXML_TAG, /* A tag, starting with '<'. */ PXML_COMMENT, /* An XML comment, including "". */ /* * The following chunk types are reported if the chunk * terminates the specified XML element. */ PXML_TAG_END, /* Tag ended */ PXML_COMMENT_END /* Comment ended */ } pxml_chunk_type_e; /* * Callback function that is called by the parser when parsed data is * available. The _opaque is the pointer to a field containing opaque user * data specified in pxml_create() call. The chunk type is _type and the text * data is the piece of buffer identified by _bufid (as supplied to * pxml_feed() call) starting at offset _offset and of _size bytes size. * The chunk is NOT '\0'-terminated. */ typedef int (pxml_callback_f)(pxml_chunk_type_e _type, const void *_chunk_data, size_t _chunk_size, void *_key); /* * Parse the given buffer as it were a chunk of XML data. * Invoke the specified callback each time the meaninful data is found. * This function returns number of bytes consumed from the bufer. * It will always be lesser than or equal to the specified _size. * The next invocation of this function must account the difference. */ ssize_t pxml_parse(int *_stateContext, const void *_buf, size_t _size, pxml_callback_f *cb, void *_key); #ifdef __cplusplus } #endif #endif /* _XER_SUPPORT_H_ */ asn1c-0.9.28+dfsg/skeletons/PrintableString.h0000644000000000000000000000101313065714043017521 0ustar rootroot/*- * Copyright (c) 2003 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef _PrintableString_H_ #define _PrintableString_H_ #include #ifdef __cplusplus extern "C" { #endif typedef OCTET_STRING_t PrintableString_t; /* Implemented via OCTET STRING */ extern asn_TYPE_descriptor_t asn_DEF_PrintableString; asn_constr_check_f PrintableString_constraint; #ifdef __cplusplus } #endif #endif /* _PrintableString_H_ */ asn1c-0.9.28+dfsg/skeletons/ObjectDescriptor.h0000644000000000000000000000075113065714043017667 0ustar rootroot/*- * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef _ObjectDescriptor_H_ #define _ObjectDescriptor_H_ #include #ifdef __cplusplus extern "C" { #endif typedef GraphicString_t ObjectDescriptor_t; /* Implemented via GraphicString */ extern asn_TYPE_descriptor_t asn_DEF_ObjectDescriptor; #ifdef __cplusplus } #endif #endif /* _ObjectDescriptor_H_ */ asn1c-0.9.28+dfsg/skeletons/GraphicString.c0000644000000000000000000000240713065714043017161 0ustar rootroot/*- * Copyright (c) 2003 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #include #include /* * GraphicString basic type description. */ static const ber_tlv_tag_t asn_DEF_GraphicString_tags[] = { (ASN_TAG_CLASS_UNIVERSAL | (25 << 2)), /* [UNIVERSAL 25] IMPLICIT ...*/ (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */ }; asn_TYPE_descriptor_t asn_DEF_GraphicString = { "GraphicString", "GraphicString", OCTET_STRING_free, OCTET_STRING_print, /* non-ascii string */ asn_generic_unknown_constraint, OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */ OCTET_STRING_encode_der, OCTET_STRING_decode_xer_hex, OCTET_STRING_encode_xer, /* Can't expect it to be ASCII/UTF8 */ OCTET_STRING_decode_uper, /* Implemented in terms of OCTET STRING */ OCTET_STRING_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_GraphicString_tags, sizeof(asn_DEF_GraphicString_tags) / sizeof(asn_DEF_GraphicString_tags[0]) - 1, asn_DEF_GraphicString_tags, sizeof(asn_DEF_GraphicString_tags) / sizeof(asn_DEF_GraphicString_tags[0]), 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; asn1c-0.9.28+dfsg/skeletons/xer_decoder.h0000644000000000000000000000652013065714043016705 0ustar rootroot/*- * Copyright (c) 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef _XER_DECODER_H_ #define _XER_DECODER_H_ #include #ifdef __cplusplus extern "C" { #endif struct asn_TYPE_descriptor_s; /* Forward declaration */ /* * The XER decoder of any ASN.1 type. May be invoked by the application. */ asn_dec_rval_t xer_decode(struct asn_codec_ctx_s *opt_codec_ctx, struct asn_TYPE_descriptor_s *type_descriptor, void **struct_ptr, /* Pointer to a target structure's pointer */ const void *buffer, /* Data to be decoded */ size_t size /* Size of data buffer */ ); /* * Type of the type-specific XER decoder function. */ typedef asn_dec_rval_t (xer_type_decoder_f)(asn_codec_ctx_t *opt_codec_ctx, struct asn_TYPE_descriptor_s *type_descriptor, void **struct_ptr, const char *opt_mname, /* Member name */ const void *buf_ptr, size_t size ); /******************************* * INTERNALLY USEFUL FUNCTIONS * *******************************/ /* * Generalized function for decoding the primitive values. * Used by more specialized functions, such as OCTET_STRING_decode_xer_utf8 * and others. This function should not be used by applications, as its API * is subject to changes. */ asn_dec_rval_t xer_decode_general(asn_codec_ctx_t *opt_codec_ctx, asn_struct_ctx_t *ctx, /* Type decoder context */ void *struct_key, /* Treated as opaque pointer */ const char *xml_tag, /* Expected XML tag name */ const void *buf_ptr, size_t size, int (*opt_unexpected_tag_decoder) (void *struct_key, const void *chunk_buf, size_t chunk_size), ssize_t (*body_receiver) (void *struct_key, const void *chunk_buf, size_t chunk_size, int have_more) ); /* * Fetch the next XER (XML) token from the stream. * The function returns the number of bytes occupied by the chunk type, * returned in the _ch_type. The _ch_type is only set (and valid) when * the return value is >= 0. */ typedef enum pxer_chunk_type { PXER_WMORE, /* Chunk type is not clear, more data expected. */ PXER_TAG, /* Complete XER tag */ PXER_TEXT, /* Plain text between XER tags */ PXER_COMMENT /* A comment, may be part of */ } pxer_chunk_type_e; ssize_t xer_next_token(int *stateContext, const void *buffer, size_t size, pxer_chunk_type_e *_ch_type); /* * This function checks the buffer against the tag name is expected to occur. */ typedef enum xer_check_tag { XCT_BROKEN = 0, /* The tag is broken */ XCT_OPENING = 1, /* This is the tag */ XCT_CLOSING = 2, /* This is the tag */ XCT_BOTH = 3, /* This is the tag */ XCT__UNK__MASK = 4, /* Mask of everything unexpected */ XCT_UNKNOWN_OP = 5, /* Unexpected tag */ XCT_UNKNOWN_CL = 6, /* Unexpected tag */ XCT_UNKNOWN_BO = 7 /* Unexpected tag */ } xer_check_tag_e; xer_check_tag_e xer_check_tag(const void *buf_ptr, int size, const char *need_tag); /* * Get the number of bytes consisting entirely of XER whitespace characters. * RETURN VALUES: * >=0: Number of whitespace characters in the string. */ size_t xer_whitespace_span(const void *chunk_buf, size_t chunk_size); /* * Skip the series of anticipated extensions. */ int xer_skip_unknown(xer_check_tag_e tcv, ber_tlv_len_t *depth); #ifdef __cplusplus } #endif #endif /* _XER_DECODER_H_ */ asn1c-0.9.28+dfsg/skeletons/INTEGER.c0000644000000000000000000006132313065714043015514 0ustar rootroot/*- * Copyright (c) 2003-2014 Lev Walkin . * All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #include #include #include /* Encoder and decoder of a primitive type */ #include /* * INTEGER basic type description. */ static const ber_tlv_tag_t asn_DEF_INTEGER_tags[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_INTEGER = { "INTEGER", "INTEGER", ASN__PRIMITIVE_TYPE_free, INTEGER_print, asn_generic_no_constraint, ber_decode_primitive, INTEGER_encode_der, INTEGER_decode_xer, INTEGER_encode_xer, #ifdef ASN_DISABLE_PER_SUPPORT 0, 0, #else INTEGER_decode_uper, /* Unaligned PER decoder */ INTEGER_encode_uper, /* Unaligned PER encoder */ #endif /* ASN_DISABLE_PER_SUPPORT */ 0, /* Use generic outmost tag fetcher */ asn_DEF_INTEGER_tags, sizeof(asn_DEF_INTEGER_tags) / sizeof(asn_DEF_INTEGER_tags[0]), asn_DEF_INTEGER_tags, /* Same as above */ sizeof(asn_DEF_INTEGER_tags) / sizeof(asn_DEF_INTEGER_tags[0]), 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /* * Encode INTEGER type using DER. */ asn_enc_rval_t INTEGER_encode_der(asn_TYPE_descriptor_t *td, void *sptr, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { INTEGER_t *st = (INTEGER_t *)sptr; ASN_DEBUG("%s %s as INTEGER (tm=%d)", cb?"Encoding":"Estimating", td->name, tag_mode); /* * Canonicalize integer in the buffer. * (Remove too long sign extension, remove some first 0x00 bytes) */ if(st->buf) { uint8_t *buf = st->buf; uint8_t *end1 = buf + st->size - 1; int shift; /* Compute the number of superfluous leading bytes */ for(; buf < end1; buf++) { /* * If the contents octets of an integer value encoding * consist of more than one octet, then the bits of the * first octet and bit 8 of the second octet: * a) shall not all be ones; and * b) shall not all be zero. */ switch(*buf) { case 0x00: if((buf[1] & 0x80) == 0) continue; break; case 0xff: if((buf[1] & 0x80)) continue; break; } break; } /* Remove leading superfluous bytes from the integer */ shift = buf - st->buf; if(shift) { uint8_t *nb = st->buf; uint8_t *end; st->size -= shift; /* New size, minus bad bytes */ end = nb + st->size; for(; nb < end; nb++, buf++) *nb = *buf; } } /* if(1) */ return der_encode_primitive(td, sptr, tag_mode, tag, cb, app_key); } static const asn_INTEGER_enum_map_t *INTEGER_map_enum2value(asn_INTEGER_specifics_t *specs, const char *lstart, const char *lstop); /* * INTEGER specific human-readable output. */ static ssize_t INTEGER__dump(const asn_TYPE_descriptor_t *td, const INTEGER_t *st, asn_app_consume_bytes_f *cb, void *app_key, int plainOrXER) { asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; char scratch[32]; /* Enough for 64-bit integer */ uint8_t *buf = st->buf; uint8_t *buf_end = st->buf + st->size; signed long value; ssize_t wrote = 0; char *p; int ret; if(specs && specs->field_unsigned) ret = asn_INTEGER2ulong(st, (unsigned long *)&value); else ret = asn_INTEGER2long(st, &value); /* Simple case: the integer size is small */ if(ret == 0) { const asn_INTEGER_enum_map_t *el; size_t scrsize; char *scr; el = (value >= 0 || !specs || !specs->field_unsigned) ? INTEGER_map_value2enum(specs, value) : 0; if(el) { scrsize = el->enum_len + 32; scr = (char *)alloca(scrsize); if(plainOrXER == 0) ret = snprintf(scr, scrsize, "%ld (%s)", value, el->enum_name); else ret = snprintf(scr, scrsize, "<%s/>", el->enum_name); } else if(plainOrXER && specs && specs->strict_enumeration) { ASN_DEBUG("ASN.1 forbids dealing with " "unknown value of ENUMERATED type"); errno = EPERM; return -1; } else { scrsize = sizeof(scratch); scr = scratch; ret = snprintf(scr, scrsize, (specs && specs->field_unsigned) ?"%lu":"%ld", value); } assert(ret > 0 && (size_t)ret < scrsize); return (cb(scr, ret, app_key) < 0) ? -1 : ret; } else if(plainOrXER && specs && specs->strict_enumeration) { /* * Here and earlier, we cannot encode the ENUMERATED values * if there is no corresponding identifier. */ ASN_DEBUG("ASN.1 forbids dealing with " "unknown value of ENUMERATED type"); errno = EPERM; return -1; } /* Output in the long xx:yy:zz... format */ /* TODO: replace with generic algorithm (Knuth TAOCP Vol 2, 4.3.1) */ for(p = scratch; buf < buf_end; buf++) { const char * const h2c = "0123456789ABCDEF"; if((p - scratch) >= (ssize_t)(sizeof(scratch) - 4)) { /* Flush buffer */ if(cb(scratch, p - scratch, app_key) < 0) return -1; wrote += p - scratch; p = scratch; } *p++ = h2c[*buf >> 4]; *p++ = h2c[*buf & 0x0F]; *p++ = 0x3a; /* ":" */ } if(p != scratch) p--; /* Remove the last ":" */ wrote += p - scratch; return (cb(scratch, p - scratch, app_key) < 0) ? -1 : wrote; } /* * INTEGER specific human-readable output. */ int INTEGER_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; ssize_t ret; (void)td; (void)ilevel; if(!st || !st->buf) ret = cb("", 8, app_key); else ret = INTEGER__dump(td, st, cb, app_key, 0); return (ret < 0) ? -1 : 0; } struct e2v_key { const char *start; const char *stop; const asn_INTEGER_enum_map_t *vemap; const unsigned int *evmap; }; static int INTEGER__compar_enum2value(const void *kp, const void *am) { const struct e2v_key *key = (const struct e2v_key *)kp; const asn_INTEGER_enum_map_t *el = (const asn_INTEGER_enum_map_t *)am; const char *ptr, *end, *name; /* Remap the element (sort by different criterion) */ el = key->vemap + key->evmap[el - key->vemap]; /* Compare strings */ for(ptr = key->start, end = key->stop, name = el->enum_name; ptr < end; ptr++, name++) { if(*ptr != *name) return *(const unsigned char *)ptr - *(const unsigned char *)name; } return name[0] ? -1 : 0; } static const asn_INTEGER_enum_map_t * INTEGER_map_enum2value(asn_INTEGER_specifics_t *specs, const char *lstart, const char *lstop) { const asn_INTEGER_enum_map_t *el_found; int count = specs ? specs->map_count : 0; struct e2v_key key; const char *lp; if(!count) return NULL; /* Guaranteed: assert(lstart < lstop); */ /* Figure out the tag name */ for(lstart++, lp = lstart; lp < lstop; lp++) { switch(*lp) { case 9: case 10: case 11: case 12: case 13: case 32: /* WSP */ case 0x2f: /* '/' */ case 0x3e: /* '>' */ break; default: continue; } break; } if(lp == lstop) return NULL; /* No tag found */ lstop = lp; key.start = lstart; key.stop = lstop; key.vemap = specs->value2enum; key.evmap = specs->enum2value; el_found = (asn_INTEGER_enum_map_t *)bsearch(&key, specs->value2enum, count, sizeof(specs->value2enum[0]), INTEGER__compar_enum2value); if(el_found) { /* Remap enum2value into value2enum */ el_found = key.vemap + key.evmap[el_found - key.vemap]; } return el_found; } static int INTEGER__compar_value2enum(const void *kp, const void *am) { long a = *(const long *)kp; const asn_INTEGER_enum_map_t *el = (const asn_INTEGER_enum_map_t *)am; long b = el->nat_value; if(a < b) return -1; else if(a == b) return 0; else return 1; } const asn_INTEGER_enum_map_t * INTEGER_map_value2enum(asn_INTEGER_specifics_t *specs, long value) { int count = specs ? specs->map_count : 0; if(!count) return 0; return (asn_INTEGER_enum_map_t *)bsearch(&value, specs->value2enum, count, sizeof(specs->value2enum[0]), INTEGER__compar_value2enum); } static int INTEGER_st_prealloc(INTEGER_t *st, int min_size) { void *p = MALLOC(min_size + 1); if(p) { void *b = st->buf; st->size = 0; st->buf = p; FREEMEM(b); return 0; } else { return -1; } } /* * Decode the chunk of XML text encoding INTEGER. */ static enum xer_pbd_rval INTEGER__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chunk_buf, size_t chunk_size) { INTEGER_t *st = (INTEGER_t *)sptr; long dec_value; long hex_value = 0; const char *lp; const char *lstart = (const char *)chunk_buf; const char *lstop = lstart + chunk_size; enum { ST_LEADSPACE, ST_SKIPSPHEX, ST_WAITDIGITS, ST_DIGITS, ST_DIGITS_TRAILSPACE, ST_HEXDIGIT1, ST_HEXDIGIT2, ST_HEXDIGITS_TRAILSPACE, ST_HEXCOLON, ST_END_ENUM, ST_UNEXPECTED } state = ST_LEADSPACE; const char *dec_value_start = 0; /* INVARIANT: always !0 in ST_DIGITS */ const char *dec_value_end = 0; if(chunk_size) ASN_DEBUG("INTEGER body %ld 0x%2x..0x%2x", (long)chunk_size, *lstart, lstop[-1]); if(INTEGER_st_prealloc(st, (chunk_size/3) + 1)) return XPBD_SYSTEM_FAILURE; /* * We may have received a tag here. It will be processed inline. * Use strtoul()-like code and serialize the result. */ for(lp = lstart; lp < lstop; lp++) { int lv = *lp; switch(lv) { case 0x09: case 0x0a: case 0x0d: case 0x20: switch(state) { case ST_LEADSPACE: case ST_DIGITS_TRAILSPACE: case ST_HEXDIGITS_TRAILSPACE: case ST_SKIPSPHEX: continue; case ST_DIGITS: dec_value_end = lp; state = ST_DIGITS_TRAILSPACE; continue; case ST_HEXCOLON: state = ST_HEXDIGITS_TRAILSPACE; continue; default: break; } break; case 0x2d: /* '-' */ if(state == ST_LEADSPACE) { dec_value = 0; dec_value_start = lp; state = ST_WAITDIGITS; continue; } break; case 0x2b: /* '+' */ if(state == ST_LEADSPACE) { dec_value = 0; dec_value_start = lp; state = ST_WAITDIGITS; continue; } break; case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: switch(state) { case ST_DIGITS: continue; case ST_SKIPSPHEX: /* Fall through */ case ST_HEXDIGIT1: hex_value = (lv - 0x30) << 4; state = ST_HEXDIGIT2; continue; case ST_HEXDIGIT2: hex_value += (lv - 0x30); state = ST_HEXCOLON; st->buf[st->size++] = (uint8_t)hex_value; continue; case ST_HEXCOLON: return XPBD_BROKEN_ENCODING; case ST_LEADSPACE: dec_value = 0; dec_value_start = lp; /* FALL THROUGH */ case ST_WAITDIGITS: state = ST_DIGITS; continue; default: break; } break; case 0x3c: /* '<', start of XML encoded enumeration */ if(state == ST_LEADSPACE) { const asn_INTEGER_enum_map_t *el; el = INTEGER_map_enum2value( (asn_INTEGER_specifics_t *) td->specifics, lstart, lstop); if(el) { ASN_DEBUG("Found \"%s\" => %ld", el->enum_name, el->nat_value); dec_value = el->nat_value; state = ST_END_ENUM; lp = lstop - 1; continue; } ASN_DEBUG("Unknown identifier for INTEGER"); } return XPBD_BROKEN_ENCODING; case 0x3a: /* ':' */ if(state == ST_HEXCOLON) { /* This colon is expected */ state = ST_HEXDIGIT1; continue; } else if(state == ST_DIGITS) { /* The colon here means that we have * decoded the first two hexadecimal * places as a decimal value. * Switch decoding mode. */ ASN_DEBUG("INTEGER re-evaluate as hex form"); state = ST_SKIPSPHEX; dec_value_start = 0; lp = lstart - 1; continue; } else { ASN_DEBUG("state %d at %ld", state, (long)(lp - lstart)); break; } /* [A-Fa-f] */ case 0x41:case 0x42:case 0x43:case 0x44:case 0x45:case 0x46: case 0x61:case 0x62:case 0x63:case 0x64:case 0x65:case 0x66: switch(state) { case ST_SKIPSPHEX: case ST_LEADSPACE: /* Fall through */ case ST_HEXDIGIT1: hex_value = lv - ((lv < 0x61) ? 0x41 : 0x61); hex_value += 10; hex_value <<= 4; state = ST_HEXDIGIT2; continue; case ST_HEXDIGIT2: hex_value += lv - ((lv < 0x61) ? 0x41 : 0x61); hex_value += 10; st->buf[st->size++] = (uint8_t)hex_value; state = ST_HEXCOLON; continue; case ST_DIGITS: ASN_DEBUG("INTEGER re-evaluate as hex form"); state = ST_SKIPSPHEX; dec_value_start = 0; lp = lstart - 1; continue; default: break; } break; } /* Found extra non-numeric stuff */ ASN_DEBUG("INTEGER :: Found non-numeric 0x%2x at %ld", lv, (long)(lp - lstart)); state = ST_UNEXPECTED; break; } switch(state) { case ST_END_ENUM: /* Got a complete and valid enumeration encoded as a tag. */ break; case ST_DIGITS: dec_value_end = lstop; /* FALL THROUGH */ case ST_DIGITS_TRAILSPACE: /* The last symbol encountered was a digit. */ switch(asn_strtol_lim(dec_value_start, &dec_value_end, &dec_value)) { case ASN_STRTOL_OK: break; case ASN_STRTOL_ERROR_RANGE: return XPBD_DECODER_LIMIT; case ASN_STRTOL_ERROR_INVAL: case ASN_STRTOL_EXPECT_MORE: case ASN_STRTOL_EXTRA_DATA: return XPBD_BROKEN_ENCODING; } break; case ST_HEXCOLON: case ST_HEXDIGITS_TRAILSPACE: st->buf[st->size] = 0; /* Just in case termination */ return XPBD_BODY_CONSUMED; case ST_HEXDIGIT1: case ST_HEXDIGIT2: case ST_SKIPSPHEX: return XPBD_BROKEN_ENCODING; case ST_LEADSPACE: /* Content not found */ return XPBD_NOT_BODY_IGNORE; case ST_WAITDIGITS: case ST_UNEXPECTED: ASN_DEBUG("INTEGER: No useful digits (state %d)", state); return XPBD_BROKEN_ENCODING; /* No digits */ } /* * Convert the result of parsing of enumeration or a straight * decimal value into a BER representation. */ if(asn_long2INTEGER(st, dec_value)) return XPBD_SYSTEM_FAILURE; return XPBD_BODY_CONSUMED; } asn_dec_rval_t INTEGER_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, const char *opt_mname, const void *buf_ptr, size_t size) { return xer_decode_primitive(opt_codec_ctx, td, sptr, sizeof(INTEGER_t), opt_mname, buf_ptr, size, INTEGER__xer_body_decode); } asn_enc_rval_t INTEGER_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; asn_enc_rval_t er; (void)ilevel; (void)flags; if(!st || !st->buf) ASN__ENCODE_FAILED; er.encoded = INTEGER__dump(td, st, cb, app_key, 1); if(er.encoded < 0) ASN__ENCODE_FAILED; ASN__ENCODED_OK(er); } #ifndef ASN_DISABLE_PER_SUPPORT asn_dec_rval_t INTEGER_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; asn_dec_rval_t rval = { RC_OK, 0 }; INTEGER_t *st = (INTEGER_t *)*sptr; asn_per_constraint_t *ct; int repeat; (void)opt_codec_ctx; if(!st) { st = (INTEGER_t *)(*sptr = CALLOC(1, sizeof(*st))); if(!st) ASN__DECODE_FAILED; } if(!constraints) constraints = td->per_constraints; ct = constraints ? &constraints->value : 0; if(ct && ct->flags & APC_EXTENSIBLE) { int inext = per_get_few_bits(pd, 1); if(inext < 0) ASN__DECODE_STARVED; if(inext) ct = 0; } FREEMEM(st->buf); st->buf = 0; st->size = 0; if(ct) { if(ct->flags & APC_SEMI_CONSTRAINED) { st->buf = (uint8_t *)CALLOC(1, 2); if(!st->buf) ASN__DECODE_FAILED; st->size = 1; } else if(ct->flags & APC_CONSTRAINED && ct->range_bits >= 0) { size_t size = (ct->range_bits + 7) >> 3; st->buf = (uint8_t *)MALLOC(1 + size + 1); if(!st->buf) ASN__DECODE_FAILED; st->size = size; } } /* X.691-2008/11, #13.2.2, constrained whole number */ if(ct && ct->flags != APC_UNCONSTRAINED) { /* #11.5.6 */ ASN_DEBUG("Integer with range %d bits", ct->range_bits); if(ct->range_bits >= 0) { if((size_t)ct->range_bits > 8 * sizeof(unsigned long)) ASN__DECODE_FAILED; if(specs && specs->field_unsigned) { unsigned long uvalue; if(uper_get_constrained_whole_number(pd, &uvalue, ct->range_bits)) ASN__DECODE_STARVED; ASN_DEBUG("Got value %lu + low %ld", uvalue, ct->lower_bound); uvalue += ct->lower_bound; if(asn_ulong2INTEGER(st, uvalue)) ASN__DECODE_FAILED; } else { unsigned long svalue; if(uper_get_constrained_whole_number(pd, &svalue, ct->range_bits)) ASN__DECODE_STARVED; ASN_DEBUG("Got value %ld + low %ld", svalue, ct->lower_bound); svalue += ct->lower_bound; if(asn_long2INTEGER(st, svalue)) ASN__DECODE_FAILED; } return rval; } } else { ASN_DEBUG("Decoding unconstrained integer %s", td->name); } /* X.691, #12.2.3, #12.2.4 */ do { ssize_t len; void *p; int ret; /* Get the PER length */ len = uper_get_length(pd, -1, &repeat); if(len < 0) ASN__DECODE_STARVED; p = REALLOC(st->buf, st->size + len + 1); if(!p) ASN__DECODE_FAILED; st->buf = (uint8_t *)p; ret = per_get_many_bits(pd, &st->buf[st->size], 0, 8 * len); if(ret < 0) ASN__DECODE_STARVED; st->size += len; } while(repeat); st->buf[st->size] = 0; /* JIC */ /* #12.2.3 */ if(ct && ct->lower_bound) { /* * TODO: replace by in-place arithmetics. */ long value; if(asn_INTEGER2long(st, &value)) ASN__DECODE_FAILED; if(asn_long2INTEGER(st, value + ct->lower_bound)) ASN__DECODE_FAILED; } return rval; } asn_enc_rval_t INTEGER_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; asn_enc_rval_t er; INTEGER_t *st = (INTEGER_t *)sptr; const uint8_t *buf; const uint8_t *end; asn_per_constraint_t *ct; long value = 0; unsigned long v = 0; if(!st || st->size == 0) ASN__ENCODE_FAILED; if(!constraints) constraints = td->per_constraints; ct = constraints ? &constraints->value : 0; er.encoded = 0; if(ct) { int inext = 0; if(specs && specs->field_unsigned) { unsigned long uval; if(asn_INTEGER2ulong(st, &uval)) ASN__ENCODE_FAILED; /* Check proper range */ if(ct->flags & APC_SEMI_CONSTRAINED) { if(uval < (unsigned long)ct->lower_bound) inext = 1; } else if(ct->range_bits >= 0) { if(uval < (unsigned long)ct->lower_bound || uval > (unsigned long)ct->upper_bound) inext = 1; } ASN_DEBUG("Value %lu (%02x/%d) lb %lu ub %lu %s", uval, st->buf[0], st->size, ct->lower_bound, ct->upper_bound, inext ? "ext" : "fix"); value = uval; } else { if(asn_INTEGER2long(st, &value)) ASN__ENCODE_FAILED; /* Check proper range */ if(ct->flags & APC_SEMI_CONSTRAINED) { if(value < ct->lower_bound) inext = 1; } else if(ct->range_bits >= 0) { if(value < ct->lower_bound || value > ct->upper_bound) inext = 1; } ASN_DEBUG("Value %ld (%02x/%d) lb %ld ub %ld %s", value, st->buf[0], st->size, ct->lower_bound, ct->upper_bound, inext ? "ext" : "fix"); } if(ct->flags & APC_EXTENSIBLE) { if(per_put_few_bits(po, inext, 1)) ASN__ENCODE_FAILED; if(inext) ct = 0; } else if(inext) { ASN__ENCODE_FAILED; } } /* X.691-11/2008, #13.2.2, test if constrained whole number */ if(ct && ct->range_bits >= 0) { /* #11.5.6 -> #11.3 */ ASN_DEBUG("Encoding integer %ld (%lu) with range %d bits", value, value - ct->lower_bound, ct->range_bits); v = value - ct->lower_bound; if(uper_put_constrained_whole_number_u(po, v, ct->range_bits)) ASN__ENCODE_FAILED; ASN__ENCODED_OK(er); } if(ct && ct->lower_bound) { ASN_DEBUG("Adjust lower bound to %ld", ct->lower_bound); /* TODO: adjust lower bound */ ASN__ENCODE_FAILED; } for(buf = st->buf, end = st->buf + st->size; buf < end;) { ssize_t mayEncode = uper_put_length(po, end - buf); if(mayEncode < 0) ASN__ENCODE_FAILED; if(per_put_many_bits(po, buf, 8 * mayEncode)) ASN__ENCODE_FAILED; buf += mayEncode; } ASN__ENCODED_OK(er); } #endif /* ASN_DISABLE_PER_SUPPORT */ int asn_INTEGER2long(const INTEGER_t *iptr, long *lptr) { uint8_t *b, *end; size_t size; long l; /* Sanity checking */ if(!iptr || !iptr->buf || !lptr) { errno = EINVAL; return -1; } /* Cache the begin/end of the buffer */ b = iptr->buf; /* Start of the INTEGER buffer */ size = iptr->size; end = b + size; /* Where to stop */ if(size > sizeof(long)) { uint8_t *end1 = end - 1; /* * Slightly more advanced processing, * able to >sizeof(long) bytes, * when the actual value is small * (0x0000000000abcdef would yield a fine 0x00abcdef) */ /* Skip out the insignificant leading bytes */ for(; b < end1; b++) { switch(*b) { case 0x00: if((b[1] & 0x80) == 0) continue; break; case 0xff: if((b[1] & 0x80) != 0) continue; break; } break; } size = end - b; if(size > sizeof(long)) { /* Still cannot fit the long */ errno = ERANGE; return -1; } } /* Shortcut processing of a corner case */ if(end == b) { *lptr = 0; return 0; } /* Perform the sign initialization */ /* Actually l = -(*b >> 7); gains nothing, yet unreadable! */ if((*b >> 7)) l = -1; else l = 0; /* Conversion engine */ for(; b < end; b++) l = (l << 8) | *b; *lptr = l; return 0; } int asn_INTEGER2ulong(const INTEGER_t *iptr, unsigned long *lptr) { uint8_t *b, *end; unsigned long l; size_t size; if(!iptr || !iptr->buf || !lptr) { errno = EINVAL; return -1; } b = iptr->buf; size = iptr->size; end = b + size; /* If all extra leading bytes are zeroes, ignore them */ for(; size > sizeof(unsigned long); b++, size--) { if(*b) { /* Value won't fit unsigned long */ errno = ERANGE; return -1; } } /* Conversion engine */ for(l = 0; b < end; b++) l = (l << 8) | *b; *lptr = l; return 0; } int asn_ulong2INTEGER(INTEGER_t *st, unsigned long value) { uint8_t *buf; uint8_t *end; uint8_t *b; int shr; if(value <= LONG_MAX) return asn_long2INTEGER(st, value); buf = (uint8_t *)MALLOC(1 + sizeof(value)); if(!buf) return -1; end = buf + (sizeof(value) + 1); buf[0] = 0; for(b = buf + 1, shr = (sizeof(long)-1)*8; b < end; shr -= 8, b++) *b = (uint8_t)(value >> shr); if(st->buf) FREEMEM(st->buf); st->buf = buf; st->size = 1 + sizeof(value); return 0; } int asn_long2INTEGER(INTEGER_t *st, long value) { uint8_t *buf, *bp; uint8_t *p; uint8_t *pstart; uint8_t *pend1; int littleEndian = 1; /* Run-time detection */ int add; if(!st) { errno = EINVAL; return -1; } buf = (uint8_t *)MALLOC(sizeof(value)); if(!buf) return -1; if(*(char *)&littleEndian) { pstart = (uint8_t *)&value + sizeof(value) - 1; pend1 = (uint8_t *)&value; add = -1; } else { pstart = (uint8_t *)&value; pend1 = pstart + sizeof(value) - 1; add = 1; } /* * If the contents octet consists of more than one octet, * then bits of the first octet and bit 8 of the second octet: * a) shall not all be ones; and * b) shall not all be zero. */ for(p = pstart; p != pend1; p += add) { switch(*p) { case 0x00: if((*(p+add) & 0x80) == 0) continue; break; case 0xff: if((*(p+add) & 0x80)) continue; break; } break; } /* Copy the integer body */ for(pstart = p, bp = buf, pend1 += add; p != pend1; p += add) *bp++ = *p; if(st->buf) FREEMEM(st->buf); st->buf = buf; st->size = bp - buf; return 0; } /* * This function is going to be DEPRECATED soon. */ enum asn_strtol_result_e asn_strtol(const char *str, const char *end, long *lp) { const char *endp = end; switch(asn_strtol_lim(str, &endp, lp)) { case ASN_STRTOL_ERROR_RANGE: return ASN_STRTOL_ERROR_RANGE; case ASN_STRTOL_ERROR_INVAL: return ASN_STRTOL_ERROR_INVAL; case ASN_STRTOL_EXPECT_MORE: return ASN_STRTOL_ERROR_INVAL; /* Retain old behavior */ case ASN_STRTOL_OK: return ASN_STRTOL_OK; case ASN_STRTOL_EXTRA_DATA: return ASN_STRTOL_ERROR_INVAL; /* Retain old behavior */ } return ASN_STRTOL_ERROR_INVAL; /* Retain old behavior */ } /* * Parse the number in the given string until the given *end position, * returning the position after the last parsed character back using the * same (*end) pointer. * WARNING: This behavior is different from the standard strtol(3). */ enum asn_strtol_result_e asn_strtol_lim(const char *str, const char **end, long *lp) { int sign = 1; long l; const long upper_boundary = LONG_MAX / 10; long last_digit_max = LONG_MAX % 10; if(str >= *end) return ASN_STRTOL_ERROR_INVAL; switch(*str) { case '-': last_digit_max++; sign = -1; /* FALL THROUGH */ case '+': str++; if(str >= *end) { *end = str; return ASN_STRTOL_EXPECT_MORE; } } for(l = 0; str < (*end); str++) { switch(*str) { case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: { int d = *str - '0'; if(l < upper_boundary) { l = l * 10 + d; } else if(l == upper_boundary) { if(d <= last_digit_max) { if(sign > 0) { l = l * 10 + d; } else { sign = 1; l = -l * 10 - d; } } else { *end = str; return ASN_STRTOL_ERROR_RANGE; } } else { *end = str; return ASN_STRTOL_ERROR_RANGE; } } continue; default: *end = str; *lp = sign * l; return ASN_STRTOL_EXTRA_DATA; } } *end = str; *lp = sign * l; return ASN_STRTOL_OK; } asn1c-0.9.28+dfsg/skeletons/per_decoder.h0000644000000000000000000000330013065714043016666 0ustar rootroot/*- * Copyright (c) 2005, 2007 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef _PER_DECODER_H_ #define _PER_DECODER_H_ #include #include #ifdef __cplusplus extern "C" { #endif struct asn_TYPE_descriptor_s; /* Forward declaration */ /* * Unaligned PER decoder of a "complete encoding" as per X.691#10.1. * On success, this call always returns (.consumed >= 1), as per X.691#10.1.3. */ asn_dec_rval_t uper_decode_complete(struct asn_codec_ctx_s *opt_codec_ctx, struct asn_TYPE_descriptor_s *type_descriptor, /* Type to decode */ void **struct_ptr, /* Pointer to a target structure's pointer */ const void *buffer, /* Data to be decoded */ size_t size /* Size of data buffer */ ); /* * Unaligned PER decoder of any ASN.1 type. May be invoked by the application. * WARNING: This call returns the number of BITS read from the stream. Beware. */ asn_dec_rval_t uper_decode(struct asn_codec_ctx_s *opt_codec_ctx, struct asn_TYPE_descriptor_s *type_descriptor, /* Type to decode */ void **struct_ptr, /* Pointer to a target structure's pointer */ const void *buffer, /* Data to be decoded */ size_t size, /* Size of data buffer */ int skip_bits, /* Number of unused leading bits, 0..7 */ int unused_bits /* Number of unused tailing bits, 0..7 */ ); /* * Type of the type-specific PER decoder function. */ typedef asn_dec_rval_t (per_type_decoder_f)(asn_codec_ctx_t *opt_codec_ctx, struct asn_TYPE_descriptor_s *type_descriptor, asn_per_constraints_t *constraints, void **struct_ptr, asn_per_data_t *per_data ); #ifdef __cplusplus } #endif #endif /* _PER_DECODER_H_ */ asn1c-0.9.28+dfsg/skeletons/NULL.c0000644000000000000000000000670713065714043015176 0ustar rootroot/*- * Copyright (c) 2003, 2005 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #include #include #include #include /* Implemented in terms of BOOLEAN type */ /* * NULL basic type description. */ static const ber_tlv_tag_t asn_DEF_NULL_tags[] = { (ASN_TAG_CLASS_UNIVERSAL | (5 << 2)) }; asn_TYPE_descriptor_t asn_DEF_NULL = { "NULL", "NULL", BOOLEAN_free, NULL_print, asn_generic_no_constraint, BOOLEAN_decode_ber, /* Implemented in terms of BOOLEAN */ NULL_encode_der, /* Special handling of DER encoding */ NULL_decode_xer, NULL_encode_xer, NULL_decode_uper, /* Unaligned PER decoder */ NULL_encode_uper, /* Unaligned PER encoder */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NULL_tags, sizeof(asn_DEF_NULL_tags) / sizeof(asn_DEF_NULL_tags[0]), asn_DEF_NULL_tags, /* Same as above */ sizeof(asn_DEF_NULL_tags) / sizeof(asn_DEF_NULL_tags[0]), 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; asn_enc_rval_t NULL_encode_der(asn_TYPE_descriptor_t *td, void *ptr, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { asn_enc_rval_t erval; erval.encoded = der_write_tags(td, 0, tag_mode, 0, tag, cb, app_key); if(erval.encoded == -1) { erval.failed_type = td; erval.structure_ptr = ptr; } ASN__ENCODED_OK(erval); } asn_enc_rval_t NULL_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { asn_enc_rval_t er; (void)td; (void)sptr; (void)ilevel; (void)flags; (void)cb; (void)app_key; /* XMLNullValue is empty */ er.encoded = 0; ASN__ENCODED_OK(er); } static enum xer_pbd_rval NULL__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chunk_buf, size_t chunk_size) { (void)td; (void)sptr; (void)chunk_buf; /* Going to be empty according to the rules below. */ /* * There must be no content in self-terminating tag. */ if(chunk_size) return XPBD_BROKEN_ENCODING; else return XPBD_BODY_CONSUMED; } asn_dec_rval_t NULL_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, const char *opt_mname, const void *buf_ptr, size_t size) { return xer_decode_primitive(opt_codec_ctx, td, sptr, sizeof(NULL_t), opt_mname, buf_ptr, size, NULL__xer_body_decode); } int NULL_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { (void)td; /* Unused argument */ (void)ilevel; /* Unused argument */ if(sptr) { return (cb("", 9, app_key) < 0) ? -1 : 0; } else { return (cb("", 8, app_key) < 0) ? -1 : 0; } } asn_dec_rval_t NULL_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { asn_dec_rval_t rv; (void)opt_codec_ctx; (void)td; (void)constraints; (void)pd; if(!*sptr) { *sptr = MALLOC(sizeof(NULL_t)); if(*sptr) { *(NULL_t *)*sptr = 0; } else { ASN__DECODE_FAILED; } } /* * NULL type does not have content octets. */ rv.code = RC_OK; rv.consumed = 0; return rv; } asn_enc_rval_t NULL_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { asn_enc_rval_t er; (void)td; (void)constraints; (void)sptr; (void)po; er.encoded = 0; ASN__ENCODED_OK(er); } asn1c-0.9.28+dfsg/skeletons/GeneralizedTime.h0000644000000000000000000000424113065714043017470 0ustar rootroot/*- * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef _GeneralizedTime_H_ #define _GeneralizedTime_H_ #include #ifdef __cplusplus extern "C" { #endif typedef OCTET_STRING_t GeneralizedTime_t; /* Implemented via OCTET STRING */ extern asn_TYPE_descriptor_t asn_DEF_GeneralizedTime; asn_struct_print_f GeneralizedTime_print; asn_constr_check_f GeneralizedTime_constraint; der_type_encoder_f GeneralizedTime_encode_der; xer_type_encoder_f GeneralizedTime_encode_xer; /*********************** * Some handy helpers. * ***********************/ struct tm; /* */ /* * Convert a GeneralizedTime structure into time_t * and optionally into struct tm. * If as_gmt is given, the resulting _optional_tm4fill will have a GMT zone, * instead of default local one. * On error returns -1 and errno set to EINVAL */ time_t asn_GT2time(const GeneralizedTime_t *, struct tm *_optional_tm4fill, int as_gmt); /* A version of the above function also returning the fractions of seconds */ time_t asn_GT2time_frac(const GeneralizedTime_t *, int *frac_value, int *frac_digits, /* (value / (10 ^ digits)) */ struct tm *_optional_tm4fill, int as_gmt); /* * Another version returning fractions with defined precision * For example, parsing of the time ending with ".1" seconds * with frac_digits=3 (msec) would yield frac_value = 100. */ time_t asn_GT2time_prec(const GeneralizedTime_t *, int *frac_value, int frac_digits, struct tm *_optional_tm4fill, int as_gmt); /* * Convert a struct tm into GeneralizedTime. * If _optional_gt is not given, this function will try to allocate one. * If force_gmt is given, the resulting GeneralizedTime will be forced * into a GMT time zone (encoding ends with a "Z"). * On error, this function returns 0 and sets errno. */ GeneralizedTime_t *asn_time2GT(GeneralizedTime_t *_optional_gt, const struct tm *, int force_gmt); GeneralizedTime_t *asn_time2GT_frac(GeneralizedTime_t *_optional_gt, const struct tm *, int frac_value, int frac_digits, int force_gmt); #ifdef __cplusplus } #endif #endif /* _GeneralizedTime_H_ */ asn1c-0.9.28+dfsg/skeletons/RELATIVE-OID.c0000644000000000000000000001327613065714043016247 0ustar rootroot/*- * Copyright (c) 2003, 2004, 2005 Lev Walkin . * All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #include #include #include #include /* Encoder and decoder of a primitive type */ #include /* for CHAR_BIT */ #include /* * RELATIVE-OID basic type description. */ static const ber_tlv_tag_t asn_DEF_RELATIVE_OID_tags[] = { (ASN_TAG_CLASS_UNIVERSAL | (13 << 2)) }; asn_TYPE_descriptor_t asn_DEF_RELATIVE_OID = { "RELATIVE-OID", "RELATIVE_OID", ASN__PRIMITIVE_TYPE_free, RELATIVE_OID_print, asn_generic_no_constraint, ber_decode_primitive, der_encode_primitive, RELATIVE_OID_decode_xer, RELATIVE_OID_encode_xer, OCTET_STRING_decode_uper, OCTET_STRING_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_RELATIVE_OID_tags, sizeof(asn_DEF_RELATIVE_OID_tags) / sizeof(asn_DEF_RELATIVE_OID_tags[0]), asn_DEF_RELATIVE_OID_tags, /* Same as above */ sizeof(asn_DEF_RELATIVE_OID_tags) / sizeof(asn_DEF_RELATIVE_OID_tags[0]), 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; static ssize_t RELATIVE_OID__dump_body(const RELATIVE_OID_t *st, asn_app_consume_bytes_f *cb, void *app_key) { ssize_t wrote = 0; ssize_t ret; int startn; int i; for(i = 0, startn = 0; i < st->size; i++) { uint8_t b = st->buf[i]; if((b & 0x80)) /* Continuation expected */ continue; if(startn) { /* Separate arcs */ if(cb(".", 1, app_key) < 0) return -1; wrote++; } ret = OBJECT_IDENTIFIER__dump_arc(&st->buf[startn], i - startn + 1, 0, cb, app_key); if(ret < 0) return -1; wrote += ret; startn = i + 1; } return wrote; } int RELATIVE_OID_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { const RELATIVE_OID_t *st = (const RELATIVE_OID_t *)sptr; (void)td; /* Unused argument */ (void)ilevel; /* Unused argument */ if(!st || !st->buf) return (cb("", 8, app_key) < 0) ? -1 : 0; /* Dump preamble */ if(cb("{ ", 2, app_key) < 0) return -1; if(RELATIVE_OID__dump_body(st, cb, app_key) < 0) return -1; return (cb(" }", 2, app_key) < 0) ? -1 : 0; } static enum xer_pbd_rval RELATIVE_OID__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chunk_buf, size_t chunk_size) { RELATIVE_OID_t *st = (RELATIVE_OID_t *)sptr; const char *chunk_end = (const char *)chunk_buf + chunk_size; const char *endptr; long s_arcs[6]; long *arcs = s_arcs; int arcs_count; int ret; (void)td; arcs_count = OBJECT_IDENTIFIER_parse_arcs( (const char *)chunk_buf, chunk_size, arcs, sizeof(s_arcs)/sizeof(s_arcs[0]), &endptr); if(arcs_count < 0) { /* Expecting at least one arc arcs */ return XPBD_BROKEN_ENCODING; } else if(arcs_count == 0) { return XPBD_NOT_BODY_IGNORE; } assert(endptr == chunk_end); if((size_t)arcs_count > sizeof(s_arcs)/sizeof(s_arcs[0])) { arcs = (long *)MALLOC(arcs_count * sizeof(long)); if(!arcs) return XPBD_SYSTEM_FAILURE; ret = OBJECT_IDENTIFIER_parse_arcs( (const char *)chunk_buf, chunk_size, arcs, arcs_count, &endptr); if(ret != arcs_count) return XPBD_SYSTEM_FAILURE; /* assert?.. */ } /* * Convert arcs into BER representation. */ ret = RELATIVE_OID_set_arcs(st, arcs, sizeof(*arcs), arcs_count); if(arcs != s_arcs) FREEMEM(arcs); return ret ? XPBD_SYSTEM_FAILURE : XPBD_BODY_CONSUMED; } asn_dec_rval_t RELATIVE_OID_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, const char *opt_mname, const void *buf_ptr, size_t size) { return xer_decode_primitive(opt_codec_ctx, td, sptr, sizeof(RELATIVE_OID_t), opt_mname, buf_ptr, size, RELATIVE_OID__xer_body_decode); } asn_enc_rval_t RELATIVE_OID_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { RELATIVE_OID_t *st = (RELATIVE_OID_t *)sptr; asn_enc_rval_t er; (void)ilevel; /* Unused argument */ (void)flags; /* Unused argument */ if(!st || !st->buf) ASN__ENCODE_FAILED; er.encoded = RELATIVE_OID__dump_body(st, cb, app_key); if(er.encoded < 0) ASN__ENCODE_FAILED; ASN__ENCODED_OK(er); } int RELATIVE_OID_get_arcs(const RELATIVE_OID_t *roid, void *arcs, unsigned int arc_type_size, unsigned int arc_slots) { void *arcs_end = (char *)arcs + (arc_slots * arc_type_size); int num_arcs = 0; int startn = 0; int i; if(!roid || !roid->buf) { errno = EINVAL; return -1; } for(i = 0; i < roid->size; i++) { uint8_t b = roid->buf[i]; if((b & 0x80)) /* Continuation expected */ continue; if(arcs < arcs_end) { if(OBJECT_IDENTIFIER_get_single_arc( &roid->buf[startn], i - startn + 1, 0, arcs, arc_type_size)) return -1; arcs = ((char *)arcs) + arc_type_size; num_arcs++; } startn = i + 1; } return num_arcs; } int RELATIVE_OID_set_arcs(RELATIVE_OID_t *roid, void *arcs, unsigned int arc_type_size, unsigned int arcs_slots) { uint8_t *buf; uint8_t *bp; unsigned int size; unsigned int i; if(roid == NULL || arcs == NULL || arc_type_size < 1) { errno = EINVAL; return -1; } /* * Roughly estimate the maximum size necessary to encode these arcs. */ size = ((arc_type_size * CHAR_BIT + 6) / 7) * arcs_slots; bp = buf = (uint8_t *)MALLOC(size + 1); if(!buf) { /* ENOMEM */ return -1; } /* * Encode the arcs. */ for(i = 0; i < arcs_slots; i++, arcs = ((char *)arcs) + arc_type_size) { bp += OBJECT_IDENTIFIER_set_single_arc(bp, arcs, arc_type_size, 0); } assert((unsigned)(bp - buf) <= size); /* * Replace buffer. */ roid->size = (int)(bp - buf); bp = roid->buf; roid->buf = buf; if(bp) FREEMEM(bp); return 0; } asn1c-0.9.28+dfsg/skeletons/constr_SEQUENCE_OF.h0000644000000000000000000000164213065714043017606 0ustar rootroot/*- * Copyright (c) 2003, 2005 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef _CONSTR_SEQUENCE_OF_H_ #define _CONSTR_SEQUENCE_OF_H_ #include #include /* Implemented using SET OF */ #ifdef __cplusplus extern "C" { #endif /* * A set specialized functions dealing with the SEQUENCE OF type. * Generally implemented using SET OF. */ #define SEQUENCE_OF_free SET_OF_free #define SEQUENCE_OF_print SET_OF_print #define SEQUENCE_OF_constraint SET_OF_constraint #define SEQUENCE_OF_decode_ber SET_OF_decode_ber #define SEQUENCE_OF_decode_xer SET_OF_decode_xer #define SEQUENCE_OF_decode_uper SET_OF_decode_uper der_type_encoder_f SEQUENCE_OF_encode_der; xer_type_encoder_f SEQUENCE_OF_encode_xer; per_type_encoder_f SEQUENCE_OF_encode_uper; #ifdef __cplusplus } #endif #endif /* _CONSTR_SET_OF_H_ */ asn1c-0.9.28+dfsg/skeletons/constr_SET_OF.h0000644000000000000000000000205413065714043017027 0ustar rootroot/*- * Copyright (c) 2003 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef _CONSTR_SET_OF_H_ #define _CONSTR_SET_OF_H_ #include #ifdef __cplusplus extern "C" { #endif typedef const struct asn_SET_OF_specifics_s { /* * Target structure description. */ int struct_size; /* Size of the target structure. */ int ctx_offset; /* Offset of the asn_struct_ctx_t member */ /* XER-specific stuff */ int as_XMLValueList; /* The member type must be encoded like this */ } asn_SET_OF_specifics_t; /* * A set specialized functions dealing with the SET OF type. */ asn_struct_free_f SET_OF_free; asn_struct_print_f SET_OF_print; asn_constr_check_f SET_OF_constraint; ber_type_decoder_f SET_OF_decode_ber; der_type_encoder_f SET_OF_encode_der; xer_type_decoder_f SET_OF_decode_xer; xer_type_encoder_f SET_OF_encode_xer; per_type_decoder_f SET_OF_decode_uper; per_type_encoder_f SET_OF_encode_uper; #ifdef __cplusplus } #endif #endif /* _CONSTR_SET_OF_H_ */ asn1c-0.9.28+dfsg/skeletons/file-dependencies0000644000000000000000000000513313065714043017536 0ustar rootroot# This file contains dependency information for the asn1c compiler's skeletons. # Feel free to edit this file. # The format is like this: # ... # # $Id$ # ANY.h ANY.c BMPString.h BMPString.c UTF8String.h BOOLEAN.h BOOLEAN.c ENUMERATED.h ENUMERATED.c INTEGER.h NativeEnumerated.h GeneralString.h GeneralString.c GeneralizedTime.h GeneralizedTime.c GraphicString.h GraphicString.c IA5String.h IA5String.c INTEGER.h INTEGER.c ISO646String.h ISO646String.c NULL.h NULL.c BOOLEAN.h NativeEnumerated.h NativeEnumerated.c NativeInteger.h NativeInteger.h NativeInteger.c INTEGER.h NativeReal.h NativeReal.c REAL.h NumericString.h NumericString.c OBJECT_IDENTIFIER.h OBJECT_IDENTIFIER.c INTEGER.h ObjectDescriptor.h ObjectDescriptor.c GraphicString.h PrintableString.h PrintableString.c REAL.h REAL.c INTEGER.h RELATIVE-OID.h RELATIVE-OID.c OBJECT_IDENTIFIER.h T61String.h T61String.c TeletexString.h TeletexString.c UTCTime.h UTCTime.c GeneralizedTime.h UTF8String.h UTF8String.c UniversalString.h UniversalString.c UTF8String.h VideotexString.h VideotexString.c VisibleString.h VisibleString.c asn_SEQUENCE_OF.h asn_SEQUENCE_OF.c asn_SET_OF.h asn_SET_OF.h asn_SET_OF.c constr_CHOICE.h constr_CHOICE.c constr_SEQUENCE.h constr_SEQUENCE.c constr_SEQUENCE_OF.h constr_SEQUENCE_OF.c asn_SEQUENCE_OF.h constr_SET_OF.h constr_SET.h constr_SET.c constr_SET_OF.h constr_SET_OF.c asn_SET_OF.h COMMON-FILES: # THIS IS A SPECIAL SECTION asn_application.h # Applications should include this file asn_system.h # Platform-dependent types asn_codecs.h # Return types of encoders and decoders asn_internal.h # Internal stuff OCTET_STRING.h OCTET_STRING.c # This one is used too widely BIT_STRING.h BIT_STRING.c # This one is necessary for the above one asn_codecs_prim.c asn_codecs_prim.h # enc/decoders for primitive types ber_tlv_length.h ber_tlv_length.c # BER TLV L (length) ber_tlv_tag.h ber_tlv_tag.c # BER TLV T (tag) ber_decoder.h ber_decoder.c # BER decoder support code der_encoder.h der_encoder.c # DER encoder support code constr_TYPE.h constr_TYPE.c # Description of a type constraints.h constraints.c # Subtype constraints support xer_support.h xer_support.c # XML parsing xer_decoder.h xer_decoder.c # XER decoding support xer_encoder.h xer_encoder.c # XER encoding support per_support.h per_support.c # PER parsing per_decoder.h per_decoder.c # PER decoding support per_encoder.h per_encoder.c # PER encoding support per_opentype.h per_opentype.c # PER "open type" handling CONVERTER: # THIS IS A SPECIAL SECTION converter-sample.c # A default name for sample transcoder CODEC-PER: # THIS IS A SPECIAL SECTION asn1c-0.9.28+dfsg/skeletons/VideotexString.c0000644000000000000000000000235113065714043017371 0ustar rootroot/*- * Copyright (c) 2003 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #include #include /* * VideotexString basic type description. */ static const ber_tlv_tag_t asn_DEF_VideotexString_tags[] = { (ASN_TAG_CLASS_UNIVERSAL | (21 << 2)), /* [UNIVERSAL 21] IMPLICIT */ (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */ }; asn_TYPE_descriptor_t asn_DEF_VideotexString = { "VideotexString", "VideotexString", OCTET_STRING_free, OCTET_STRING_print, /* non-ascii string */ asn_generic_unknown_constraint, OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */ OCTET_STRING_encode_der, OCTET_STRING_decode_xer_hex, OCTET_STRING_encode_xer, OCTET_STRING_decode_uper, /* Implemented in terms of OCTET STRING */ OCTET_STRING_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_VideotexString_tags, sizeof(asn_DEF_VideotexString_tags) / sizeof(asn_DEF_VideotexString_tags[0]) - 1, asn_DEF_VideotexString_tags, sizeof(asn_DEF_VideotexString_tags) / sizeof(asn_DEF_VideotexString_tags[0]), 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; asn1c-0.9.28+dfsg/skeletons/asn_SEQUENCE_OF.c0000644000000000000000000000156013065714043017051 0ustar rootroot/*- * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #include #include typedef A_SEQUENCE_OF(void) asn_sequence; void asn_sequence_del(void *asn_sequence_of_x, int number, int _do_free) { asn_sequence *as = (asn_sequence *)asn_sequence_of_x; if(as) { void *ptr; int n; if(number < 0 || number >= as->count) return; /* Nothing to delete */ if(_do_free && as->free) { ptr = as->array[number]; } else { ptr = 0; } /* * Shift all elements to the left to hide the gap. */ --as->count; for(n = number; n < as->count; n++) as->array[n] = as->array[n+1]; /* * Invoke the third-party function only when the state * of the parent structure is consistent. */ if(ptr) as->free(ptr); } } asn1c-0.9.28+dfsg/skeletons/constr_SET.h0000644000000000000000000000444313065714043016447 0ustar rootroot/*- * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef _CONSTR_SET_H_ #define _CONSTR_SET_H_ #include #ifdef __cplusplus extern "C" { #endif typedef const struct asn_SET_specifics_s { /* * Target structure description. */ int struct_size; /* Size of the target structure. */ int ctx_offset; /* Offset of the asn_struct_ctx_t member */ int pres_offset; /* Offset of _presence_map member */ /* * Tags to members mapping table (sorted). * Sometimes suitable for DER encoding (untagged CHOICE is present); * if so, tag2el_count will be greater than td->elements_count. */ const asn_TYPE_tag2member_t *tag2el; int tag2el_count; /* * Tags to members mapping table, second edition. * Suitable for CANONICAL-XER encoding. */ const asn_TYPE_tag2member_t *tag2el_cxer; int tag2el_cxer_count; /* * Extensions-related stuff. */ int extensible; /* Whether SET is extensible */ const unsigned int *_mandatory_elements; /* Bitmask of mandatory ones */ } asn_SET_specifics_t; /* * A set specialized functions dealing with the SET type. */ asn_struct_free_f SET_free; asn_struct_print_f SET_print; asn_constr_check_f SET_constraint; ber_type_decoder_f SET_decode_ber; der_type_encoder_f SET_encode_der; xer_type_decoder_f SET_decode_xer; xer_type_encoder_f SET_encode_xer; per_type_decoder_f SET_decode_uper; per_type_encoder_f SET_encode_uper; /*********************** * Some handy helpers. * ***********************/ /* * Figure out whether the SET member indicated by PR_x has already been decoded. * It is very simple bitfield test, despite its visual complexity. */ #define ASN_SET_ISPRESENT(set_ptr, PR_x) \ ASN_SET_ISPRESENT2(&((set_ptr)->_presence_map), PR_x) #define ASN_SET_ISPRESENT2(map_ptr, PR_x) \ (((unsigned int *)(map_ptr)) \ [(PR_x) / (8 * sizeof(unsigned int))] \ & (1 << ((8 * sizeof(unsigned int)) - 1 \ - ((PR_x) % (8 * sizeof(unsigned int)))))) #define ASN_SET_MKPRESENT(map_ptr, PR_x) \ (((unsigned int *)(map_ptr)) \ [(PR_x) / (8 * sizeof(unsigned int))] \ |= (1 << ((8 * sizeof(unsigned int)) - 1 \ - ((PR_x) % (8 * sizeof(unsigned int)))))) #ifdef __cplusplus } #endif #endif /* _CONSTR_SET_H_ */ asn1c-0.9.28+dfsg/skeletons/IA5String.c0000644000000000000000000000407213065714043016162 0ustar rootroot/*- * Copyright (c) 2003 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #include #include /* * IA5String basic type description. */ static const ber_tlv_tag_t asn_DEF_IA5String_tags[] = { (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)), /* [UNIVERSAL 22] IMPLICIT ...*/ (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */ }; static asn_per_constraints_t asn_DEF_IA5String_constraints = { { APC_CONSTRAINED, 7, 7, 0, 0x7f }, /* Value */ { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 }, /* Size */ 0, 0 }; asn_TYPE_descriptor_t asn_DEF_IA5String = { "IA5String", "IA5String", OCTET_STRING_free, OCTET_STRING_print_utf8, /* ASCII subset */ IA5String_constraint, /* Constraint on the alphabet */ OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */ OCTET_STRING_encode_der, OCTET_STRING_decode_xer_utf8, OCTET_STRING_encode_xer_utf8, OCTET_STRING_decode_uper, OCTET_STRING_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_IA5String_tags, sizeof(asn_DEF_IA5String_tags) / sizeof(asn_DEF_IA5String_tags[0]) - 1, asn_DEF_IA5String_tags, sizeof(asn_DEF_IA5String_tags) / sizeof(asn_DEF_IA5String_tags[0]), &asn_DEF_IA5String_constraints, 0, 0, /* No members */ 0 /* No specifics */ }; int IA5String_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const IA5String_t *st = (const IA5String_t *)sptr; if(st && st->buf) { uint8_t *buf = st->buf; uint8_t *end = buf + st->size; /* * IA5String is generally equivalent to 7bit ASCII. * ISO/ITU-T T.50, 1963. */ for(; buf < end; buf++) { if(*buf > 0x7F) { ASN__CTFAIL(app_key, td, sptr, "%s: value byte %ld out of range: " "%d > 127 (%s:%d)", td->name, (long)((buf - st->buf) + 1), *buf, __FILE__, __LINE__); return -1; } } } else { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } return 0; } asn1c-0.9.28+dfsg/skeletons/standard-modules/0000755000000000000000000000000013065714043017514 5ustar rootrootasn1c-0.9.28+dfsg/skeletons/standard-modules/ASN1-Object-Identifier-Module.asn10000644000000000000000000000431313065714043025512 0ustar rootrootASN1-Object-Identifier-Module { joint-iso-itu-t asn1(1) specification(0) modules(0) object-identifiers(1) } DEFINITIONS ::= BEGIN -- NumericString ASN.1 type (see 37.3) -- numericString OBJECT IDENTIFIER ::= { joint-iso-itu-t asn1(1) specification(0) characterStrings(1) numericString(0) } -- PrintableString ASN.1 type (see 37.5) -- printableString OBJECT IDENTIFIER ::= { joint-iso-itu-t asn1(1) specification(0) characterStrings(1) printableString(1) } -- ASN.1 Character Module (see 38.1) -- asn1CharacterModule OBJECT IDENTIFIER ::= { joint-iso-itu-t asn1(1) specification(0) modules(0) iso10646(0) } -- ASN.1 Object Identifier Module (this module) -- asn1ObjectIdentifierModule OBJECT IDENTIFIER ::= { joint-iso-itu-t asn1(1) specification(0) modules(0) object-identifiers(1) } -- BER encoding of a single ASN.1 type -- ber OBJECT IDENTIFIER ::= { joint-iso-itu-t asn1(1) basic-encoding(1) } -- CER encoding of a single ASN.1 type -- cer OBJECT IDENTIFIER ::= { joint-iso-itu-t asn1(1) ber-derived(2) canonical-encoding(0) } -- DER encoding of a single ASN.1 type -- der OBJECT IDENTIFIER ::= { joint-iso-itu-t asn1(1) ber-derived(2) distinguished-encoding(1) } -- PER encoding of a single ASN.1 type (basic aligned) -- perBasicAligned OBJECT IDENTIFIER ::= { joint-iso-itu-t asn1(1) packed-encoding(3) basic(0) aligned(0) } -- PER encoding of a single ASN.1 type (basic unaligned) -- perBasicUnaligned OBJECT IDENTIFIER ::= { joint-iso-itu-t asn1(1) packed-encoding(3) basic(0) unaligned(1) } -- PER encoding of a single ASN.1 type (canonical aligned) -- perCanonicalAligned OBJECT IDENTIFIER ::= { joint-iso-itu-t asn1(1) packed-encoding(3) canonical(1) aligned(0) } -- PER encoding of a single ASN.1 type (canonical unaligned) -- perCanonicalUnaligned OBJECT IDENTIFIER ::= { joint-iso-itu-t asn1(1) packed-encoding(3) canonical(1) unaligned(1) } -- XER encoding of a single ASN.1 type (basic) -- xerBasic OBJECT IDENTIFIER ::= {joint-iso-itu-t asn1(1) xml-encoding(5) basic(0) } -- XER encoding of a single ASN.1 type (canonical) -- xerCanonical OBJECT IDENTIFIER ::= {joint-iso-itu-t asn1(1) xml-encoding(5) canonical(1) } END -- ASN1-Object-Identifier-Module -- asn1c-0.9.28+dfsg/skeletons/standard-modules/README0000644000000000000000000000020113065714043020365 0ustar rootrootAll *.asn1 files in this directory will be automatically picked up by the asn1c during compilation of any user specified module. asn1c-0.9.28+dfsg/skeletons/standard-modules/ASN1C-UsefulInformationObjectClasses.asn10000644000000000000000000000161313065714043027222 0ustar rootroot/* * This specification contains pervasive ASN.1 information object classes. * These classes are defined as "useful", and are available in any module * without the necessity for explicit import. */ ASN1C-UsefulInformationObjectClasses { iso(1) org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) standard-modules(3) auto-imported(0) 1 } DEFINITIONS ::= BEGIN /* * X.681-0207, Annex A * The TYPE-IDENTIFIER information object class */ TYPE-IDENTIFIER ::= CLASS { &id OBJECT IDENTIFIER UNIQUE, &Type } WITH SYNTAX { &Type IDENTIFIED BY &id } /* * X.681-0207, Annex B * The ABSTRACT-SYNTAX information object class */ ABSTRACT-SYNTAX ::= CLASS { &id OBJECT IDENTIFIER UNIQUE, &Type, &property BIT STRING { handles-invalid-encodings(0) } DEFAULT {} } WITH SYNTAX { &Type IDENTIFIED BY &id [HAS PROPERTY &property] } END asn1c-0.9.28+dfsg/skeletons/constr_SEQUENCE.c0000644000000000000000000010737213065714043017224 0ustar rootroot/*- * Copyright (c) 2003, 2004, 2005, 2006, 2007 Lev Walkin . * All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #include #include #include /* * Number of bytes left for this structure. * (ctx->left) indicates the number of bytes _transferred_ for the structure. * (size) contains the number of bytes in the buffer passed. */ #define LEFT ((size<(size_t)ctx->left)?size:(size_t)ctx->left) /* * If the subprocessor function returns with an indication that it wants * more data, it may well be a fatal decoding problem, because the * size is constrained by the 's L, even if the buffer size allows * reading more data. * For example, consider the buffer containing the following TLVs: * ... * The TLV length clearly indicates that one byte is expected in V, but * if the V processor returns with "want more data" even if the buffer * contains way more data than the V processor have seen. */ #define SIZE_VIOLATION (ctx->left >= 0 && (size_t)ctx->left <= size) /* * This macro "eats" the part of the buffer which is definitely "consumed", * i.e. was correctly converted into local representation or rightfully skipped. */ #undef ADVANCE #define ADVANCE(num_bytes) do { \ size_t num = num_bytes; \ ptr = ((const char *)ptr) + num; \ size -= num; \ if(ctx->left >= 0) \ ctx->left -= num; \ consumed_myself += num; \ } while(0) /* * Switch to the next phase of parsing. */ #undef NEXT_PHASE #undef PHASE_OUT #define NEXT_PHASE(ctx) do { \ ctx->phase++; \ ctx->step = 0; \ } while(0) #define PHASE_OUT(ctx) do { ctx->phase = 10; } while(0) /* * Return a standardized complex structure. */ #undef RETURN #define RETURN(_code) do { \ rval.code = _code; \ rval.consumed = consumed_myself;\ return rval; \ } while(0) /* * Check whether we are inside the extensions group. */ #define IN_EXTENSION_GROUP(specs, memb_idx) \ ( ((memb_idx) > (specs)->ext_after) \ &&((memb_idx) < (specs)->ext_before)) /* * Tags are canonically sorted in the tag2element map. */ static int _t2e_cmp(const void *ap, const void *bp) { const asn_TYPE_tag2member_t *a = (const asn_TYPE_tag2member_t *)ap; const asn_TYPE_tag2member_t *b = (const asn_TYPE_tag2member_t *)bp; int a_class = BER_TAG_CLASS(a->el_tag); int b_class = BER_TAG_CLASS(b->el_tag); if(a_class == b_class) { ber_tlv_tag_t a_value = BER_TAG_VALUE(a->el_tag); ber_tlv_tag_t b_value = BER_TAG_VALUE(b->el_tag); if(a_value == b_value) { if(a->el_no > b->el_no) return 1; /* * Important: we do not check * for a->el_no <= b->el_no! */ return 0; } else if(a_value < b_value) return -1; else return 1; } else if(a_class < b_class) { return -1; } else { return 1; } } /* * The decoder of the SEQUENCE type. */ asn_dec_rval_t SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **struct_ptr, const void *ptr, size_t size, int tag_mode) { /* * Bring closer parts of structure description. */ asn_SEQUENCE_specifics_t *specs = (asn_SEQUENCE_specifics_t *)td->specifics; asn_TYPE_member_t *elements = td->elements; /* * Parts of the structure being constructed. */ void *st = *struct_ptr; /* Target structure. */ asn_struct_ctx_t *ctx; /* Decoder context */ ber_tlv_tag_t tlv_tag; /* T from TLV */ asn_dec_rval_t rval; /* Return code from subparsers */ ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ int edx; /* SEQUENCE element's index */ ASN_DEBUG("Decoding %s as SEQUENCE", td->name); /* * Create the target structure if it is not present already. */ if(st == 0) { st = *struct_ptr = CALLOC(1, specs->struct_size); if(st == 0) { RETURN(RC_FAIL); } } /* * Restore parsing context. */ ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); /* * Start to parse where left previously */ switch(ctx->phase) { case 0: /* * PHASE 0. * Check that the set of tags associated with given structure * perfectly fits our expectations. */ rval = ber_check_tags(opt_codec_ctx, td, ctx, ptr, size, tag_mode, 1, &ctx->left, 0); if(rval.code != RC_OK) { ASN_DEBUG("%s tagging check failed: %d", td->name, rval.code); return rval; } if(ctx->left >= 0) ctx->left += rval.consumed; /* ?Substracted below! */ ADVANCE(rval.consumed); NEXT_PHASE(ctx); ASN_DEBUG("Structure consumes %ld bytes, buffer %ld", (long)ctx->left, (long)size); /* Fall through */ case 1: /* * PHASE 1. * From the place where we've left it previously, * try to decode the next member from the list of * this structure's elements. * (ctx->step) stores the member being processed * between invocations and the microphase {0,1} of parsing * that member: * step = ( * 2 + ). */ for(edx = (ctx->step >> 1); edx < td->elements_count; edx++, ctx->step = (ctx->step & ~1) + 2) { void *memb_ptr; /* Pointer to the member */ void **memb_ptr2; /* Pointer to that pointer */ ssize_t tag_len; /* Length of TLV's T */ int opt_edx_end; /* Next non-optional element */ int use_bsearch; int n; if(ctx->step & 1) goto microphase2; /* * MICROPHASE 1: Synchronize decoding. */ ASN_DEBUG("In %s SEQUENCE left %d, edx=%d flags=%d" " opt=%d ec=%d", td->name, (int)ctx->left, edx, elements[edx].flags, elements[edx].optional, td->elements_count); if(ctx->left == 0 /* No more stuff is expected */ && ( /* Explicit OPTIONAL specification reaches the end */ (edx + elements[edx].optional == td->elements_count) || /* All extensions are optional */ (IN_EXTENSION_GROUP(specs, edx) && specs->ext_before > td->elements_count) ) ) { ASN_DEBUG("End of SEQUENCE %s", td->name); /* * Found the legitimate end of the structure. */ PHASE_OUT(ctx); RETURN(RC_OK); } /* * Fetch the T from TLV. */ tag_len = ber_fetch_tag(ptr, LEFT, &tlv_tag); ASN_DEBUG("Current tag in %s SEQUENCE for element %d " "(%s) is %s encoded in %d bytes, of frame %ld", td->name, edx, elements[edx].name, ber_tlv_tag_string(tlv_tag), (int)tag_len, (long)LEFT); switch(tag_len) { case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); /* Fall through */ case -1: RETURN(RC_FAIL); } if(ctx->left < 0 && ((const uint8_t *)ptr)[0] == 0) { if(LEFT < 2) { if(SIZE_VIOLATION) RETURN(RC_FAIL); else RETURN(RC_WMORE); } else if(((const uint8_t *)ptr)[1] == 0) { ASN_DEBUG("edx = %d, opt = %d, ec=%d", edx, elements[edx].optional, td->elements_count); if((edx + elements[edx].optional == td->elements_count) || (IN_EXTENSION_GROUP(specs, edx) && specs->ext_before > td->elements_count)) { /* * Yeah, baby! Found the terminator * of the indefinite length structure. */ /* * Proceed to the canonical * finalization function. * No advancing is necessary. */ goto phase3; } } } /* * Find the next available type with this tag. */ use_bsearch = 0; opt_edx_end = edx + elements[edx].optional + 1; if(opt_edx_end > td->elements_count) opt_edx_end = td->elements_count; /* Cap */ else if(opt_edx_end - edx > 8) { /* Limit the scope of linear search... */ opt_edx_end = edx + 8; use_bsearch = 1; /* ... and resort to bsearch() */ } for(n = edx; n < opt_edx_end; n++) { if(BER_TAGS_EQUAL(tlv_tag, elements[n].tag)) { /* * Found element corresponding to the tag * being looked at. * Reposition over the right element. */ edx = n; ctx->step = 1 + 2 * edx; /* Remember! */ goto microphase2; } else if(elements[n].flags & ATF_OPEN_TYPE) { /* * This is the ANY type, which may bear * any flag whatsoever. */ edx = n; ctx->step = 1 + 2 * edx; /* Remember! */ goto microphase2; } else if(elements[n].tag == (ber_tlv_tag_t)-1) { use_bsearch = 1; break; } } if(use_bsearch) { /* * Resort to a binary search over * sorted array of tags. */ const asn_TYPE_tag2member_t *t2m; asn_TYPE_tag2member_t key; key.el_tag = tlv_tag; key.el_no = edx; t2m = (const asn_TYPE_tag2member_t *)bsearch(&key, specs->tag2el, specs->tag2el_count, sizeof(specs->tag2el[0]), _t2e_cmp); if(t2m) { const asn_TYPE_tag2member_t *best = 0; const asn_TYPE_tag2member_t *t2m_f, *t2m_l; int edx_max = edx + elements[edx].optional; /* * Rewind to the first element with that tag, * `cause bsearch() does not guarantee order. */ t2m_f = t2m + t2m->toff_first; t2m_l = t2m + t2m->toff_last; for(t2m = t2m_f; t2m <= t2m_l; t2m++) { if(t2m->el_no > edx_max) break; if(t2m->el_no < edx) continue; best = t2m; } if(best) { edx = best->el_no; ctx->step = 1 + 2 * edx; goto microphase2; } } n = opt_edx_end; } if(n == opt_edx_end) { /* * If tag is unknown, it may be either * an unknown (thus, incorrect) tag, * or an extension (...), * or an end of the indefinite-length structure. */ if(!IN_EXTENSION_GROUP(specs, edx + elements[edx].optional)) { ASN_DEBUG("Unexpected tag %s (at %d)", ber_tlv_tag_string(tlv_tag), edx); ASN_DEBUG("Expected tag %s (%s)%s", ber_tlv_tag_string(elements[edx].tag), elements[edx].name, elements[edx].optional ?" or alternatives":""); RETURN(RC_FAIL); } else { /* Skip this tag */ ssize_t skip; edx += elements[edx].optional; ASN_DEBUG("Skipping unexpected %s (at %d)", ber_tlv_tag_string(tlv_tag), edx); skip = ber_skip_length(opt_codec_ctx, BER_TLV_CONSTRUCTED(ptr), (const char *)ptr + tag_len, LEFT - tag_len); ASN_DEBUG("Skip length %d in %s", (int)skip, td->name); switch(skip) { case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); /* Fall through */ case -1: RETURN(RC_FAIL); } ADVANCE(skip + tag_len); ctx->step -= 2; edx--; continue; /* Try again with the next tag */ } } /* * MICROPHASE 2: Invoke the member-specific decoder. */ ctx->step |= 1; /* Confirm entering next microphase */ microphase2: ASN_DEBUG("Inside SEQUENCE %s MF2", td->name); /* * Compute the position of the member inside a structure, * and also a type of containment (it may be contained * as pointer or using inline inclusion). */ if(elements[edx].flags & ATF_POINTER) { /* Member is a pointer to another structure */ memb_ptr2 = (void **)((char *)st + elements[edx].memb_offset); } else { /* * A pointer to a pointer * holding the start of the structure */ memb_ptr = (char *)st + elements[edx].memb_offset; memb_ptr2 = &memb_ptr; } /* * Invoke the member fetch routine according to member's type */ rval = elements[edx].type->ber_decoder(opt_codec_ctx, elements[edx].type, memb_ptr2, ptr, LEFT, elements[edx].tag_mode); ASN_DEBUG("In %s SEQUENCE decoded %d %s of %d " "in %d bytes rval.code %d, size=%d", td->name, edx, elements[edx].type->name, (int)LEFT, (int)rval.consumed, rval.code, (int)size); switch(rval.code) { case RC_OK: break; case RC_WMORE: /* More data expected */ if(!SIZE_VIOLATION) { ADVANCE(rval.consumed); RETURN(RC_WMORE); } ASN_DEBUG("Size violation (c->l=%ld <= s=%ld)", (long)ctx->left, (long)size); /* Fall through */ case RC_FAIL: /* Fatal error */ RETURN(RC_FAIL); } /* switch(rval) */ ADVANCE(rval.consumed); } /* for(all structure members) */ phase3: ctx->phase = 3; case 3: /* 00 and other tags expected */ case 4: /* only 00's expected */ ASN_DEBUG("SEQUENCE %s Leftover: %ld, size = %ld", td->name, (long)ctx->left, (long)size); /* * Skip everything until the end of the SEQUENCE. */ while(ctx->left) { ssize_t tl, ll; tl = ber_fetch_tag(ptr, LEFT, &tlv_tag); switch(tl) { case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); /* Fall through */ case -1: RETURN(RC_FAIL); } /* * If expected <0><0>... */ if(ctx->left < 0 && ((const uint8_t *)ptr)[0] == 0) { if(LEFT < 2) { if(SIZE_VIOLATION) RETURN(RC_FAIL); else RETURN(RC_WMORE); } else if(((const uint8_t *)ptr)[1] == 0) { /* * Correctly finished with <0><0>. */ ADVANCE(2); ctx->left++; ctx->phase = 4; continue; } } if(!IN_EXTENSION_GROUP(specs, td->elements_count) || ctx->phase == 4) { ASN_DEBUG("Unexpected continuation " "of a non-extensible type " "%s (SEQUENCE): %s", td->name, ber_tlv_tag_string(tlv_tag)); RETURN(RC_FAIL); } ll = ber_skip_length(opt_codec_ctx, BER_TLV_CONSTRUCTED(ptr), (const char *)ptr + tl, LEFT - tl); switch(ll) { case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); /* Fall through */ case -1: RETURN(RC_FAIL); } ADVANCE(tl + ll); } PHASE_OUT(ctx); } RETURN(RC_OK); } /* * The DER encoder of the SEQUENCE type. */ asn_enc_rval_t SEQUENCE_encode_der(asn_TYPE_descriptor_t *td, void *sptr, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { size_t computed_size = 0; asn_enc_rval_t erval; ssize_t ret; int edx; ASN_DEBUG("%s %s as SEQUENCE", cb?"Encoding":"Estimating", td->name); /* * Gather the length of the underlying members sequence. */ for(edx = 0; edx < td->elements_count; edx++) { asn_TYPE_member_t *elm = &td->elements[edx]; void *memb_ptr; if(elm->flags & ATF_POINTER) { memb_ptr = *(void **)((char *)sptr + elm->memb_offset); if(!memb_ptr) { if(elm->optional) continue; /* Mandatory element is missing */ ASN__ENCODE_FAILED; } } else { memb_ptr = (void *)((char *)sptr + elm->memb_offset); } erval = elm->type->der_encoder(elm->type, memb_ptr, elm->tag_mode, elm->tag, 0, 0); if(erval.encoded == -1) return erval; computed_size += erval.encoded; ASN_DEBUG("Member %d %s estimated %ld bytes", edx, elm->name, (long)erval.encoded); } /* * Encode the TLV for the sequence itself. */ ret = der_write_tags(td, computed_size, tag_mode, 1, tag, cb, app_key); ASN_DEBUG("Wrote tags: %ld (+%ld)", (long)ret, (long)computed_size); if(ret == -1) ASN__ENCODE_FAILED; erval.encoded = computed_size + ret; if(!cb) ASN__ENCODED_OK(erval); /* * Encode all members. */ for(edx = 0; edx < td->elements_count; edx++) { asn_TYPE_member_t *elm = &td->elements[edx]; asn_enc_rval_t tmperval; void *memb_ptr; if(elm->flags & ATF_POINTER) { memb_ptr = *(void **)((char *)sptr + elm->memb_offset); if(!memb_ptr) continue; } else { memb_ptr = (void *)((char *)sptr + elm->memb_offset); } tmperval = elm->type->der_encoder(elm->type, memb_ptr, elm->tag_mode, elm->tag, cb, app_key); if(tmperval.encoded == -1) return tmperval; computed_size -= tmperval.encoded; ASN_DEBUG("Member %d %s of SEQUENCE %s encoded in %ld bytes", edx, elm->name, td->name, (long)tmperval.encoded); } if(computed_size != 0) /* * Encoded size is not equal to the computed size. */ ASN__ENCODE_FAILED; ASN__ENCODED_OK(erval); } #undef XER_ADVANCE #define XER_ADVANCE(num_bytes) do { \ size_t num = num_bytes; \ buf_ptr = ((const char *)buf_ptr) + num;\ size -= num; \ consumed_myself += num; \ } while(0) /* * Decode the XER (XML) data. */ asn_dec_rval_t SEQUENCE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **struct_ptr, const char *opt_mname, const void *buf_ptr, size_t size) { /* * Bring closer parts of structure description. */ asn_SEQUENCE_specifics_t *specs = (asn_SEQUENCE_specifics_t *)td->specifics; asn_TYPE_member_t *elements = td->elements; const char *xml_tag = opt_mname ? opt_mname : td->xml_tag; /* * ... and parts of the structure being constructed. */ void *st = *struct_ptr; /* Target structure. */ asn_struct_ctx_t *ctx; /* Decoder context */ asn_dec_rval_t rval; /* Return value from a decoder */ ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ int edx; /* Element index */ int edx_end; /* * Create the target structure if it is not present already. */ if(st == 0) { st = *struct_ptr = CALLOC(1, specs->struct_size); if(st == 0) RETURN(RC_FAIL); } /* * Restore parsing context. */ ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); /* * Phases of XER/XML processing: * Phase 0: Check that the opening tag matches our expectations. * Phase 1: Processing body and reacting on closing tag. * Phase 2: Processing inner type. * Phase 3: Skipping unknown extensions. * Phase 4: PHASED OUT */ for(edx = ctx->step; ctx->phase <= 3;) { pxer_chunk_type_e ch_type; /* XER chunk type */ ssize_t ch_size; /* Chunk size */ xer_check_tag_e tcv; /* Tag check value */ asn_TYPE_member_t *elm; int n; /* * Go inside the inner member of a sequence. */ if(ctx->phase == 2) { asn_dec_rval_t tmprval; void *memb_ptr; /* Pointer to the member */ void **memb_ptr2; /* Pointer to that pointer */ elm = &td->elements[edx]; if(elm->flags & ATF_POINTER) { /* Member is a pointer to another structure */ memb_ptr2 = (void **)((char *)st + elm->memb_offset); } else { memb_ptr = (char *)st + elm->memb_offset; memb_ptr2 = &memb_ptr; } /* Invoke the inner type decoder, m.b. multiple times */ tmprval = elm->type->xer_decoder(opt_codec_ctx, elm->type, memb_ptr2, elm->name, buf_ptr, size); XER_ADVANCE(tmprval.consumed); if(tmprval.code != RC_OK) RETURN(tmprval.code); ctx->phase = 1; /* Back to body processing */ ctx->step = ++edx; ASN_DEBUG("XER/SEQUENCE phase => %d, step => %d", ctx->phase, ctx->step); /* Fall through */ } /* * Get the next part of the XML stream. */ ch_size = xer_next_token(&ctx->context, buf_ptr, size, &ch_type); if(ch_size == -1) { RETURN(RC_FAIL); } else { switch(ch_type) { case PXER_WMORE: RETURN(RC_WMORE); case PXER_COMMENT: /* Got XML comment */ case PXER_TEXT: /* Ignore free-standing text */ XER_ADVANCE(ch_size); /* Skip silently */ continue; case PXER_TAG: break; /* Check the rest down there */ } } tcv = xer_check_tag(buf_ptr, ch_size, xml_tag); ASN_DEBUG("XER/SEQUENCE: tcv = %d, ph=%d [%s]", tcv, ctx->phase, xml_tag); /* Skip the extensions section */ if(ctx->phase == 3) { switch(xer_skip_unknown(tcv, &ctx->left)) { case -1: ctx->phase = 4; RETURN(RC_FAIL); case 0: XER_ADVANCE(ch_size); continue; case 1: XER_ADVANCE(ch_size); ctx->phase = 1; continue; case 2: ctx->phase = 1; break; } } switch(tcv) { case XCT_CLOSING: if(ctx->phase == 0) break; ctx->phase = 0; /* Fall through */ case XCT_BOTH: if(ctx->phase == 0) { if(edx >= td->elements_count || /* Explicit OPTIONAL specs reaches the end */ (edx + elements[edx].optional == td->elements_count) || /* All extensions are optional */ (IN_EXTENSION_GROUP(specs, edx) && specs->ext_before > td->elements_count) ) { XER_ADVANCE(ch_size); ctx->phase = 4; /* Phase out */ RETURN(RC_OK); } else { ASN_DEBUG("Premature end of XER SEQUENCE"); RETURN(RC_FAIL); } } /* Fall through */ case XCT_OPENING: if(ctx->phase == 0) { XER_ADVANCE(ch_size); ctx->phase = 1; /* Processing body phase */ continue; } /* Fall through */ case XCT_UNKNOWN_OP: case XCT_UNKNOWN_BO: ASN_DEBUG("XER/SEQUENCE: tcv=%d, ph=%d, edx=%d", tcv, ctx->phase, edx); if(ctx->phase != 1) { break; /* Really unexpected */ } if(edx < td->elements_count) { /* * Search which member corresponds to this tag. */ edx_end = edx + elements[edx].optional + 1; if(edx_end > td->elements_count) edx_end = td->elements_count; for(n = edx; n < edx_end; n++) { elm = &td->elements[n]; tcv = xer_check_tag(buf_ptr, ch_size, elm->name); switch(tcv) { case XCT_BOTH: case XCT_OPENING: /* * Process this member. */ ctx->step = edx = n; ctx->phase = 2; break; case XCT_UNKNOWN_OP: case XCT_UNKNOWN_BO: continue; default: n = edx_end; break; /* Phase out */ } break; } if(n != edx_end) continue; } else { ASN_DEBUG("Out of defined members: %d/%d", edx, td->elements_count); } /* It is expected extension */ if(IN_EXTENSION_GROUP(specs, edx + (edx < td->elements_count ? elements[edx].optional : 0))) { ASN_DEBUG("Got anticipated extension at %d", edx); /* * Check for (XCT_BOTH or XCT_UNKNOWN_BO) * By using a mask. Only record a pure * tags. */ if(tcv & XCT_CLOSING) { /* Found without body */ } else { ctx->left = 1; ctx->phase = 3; /* Skip ...'s */ } XER_ADVANCE(ch_size); continue; } /* Fall through */ default: break; } ASN_DEBUG("Unexpected XML tag in SEQUENCE [%c%c%c%c%c%c]", size>0?((const char *)buf_ptr)[0]:'.', size>1?((const char *)buf_ptr)[1]:'.', size>2?((const char *)buf_ptr)[2]:'.', size>3?((const char *)buf_ptr)[3]:'.', size>4?((const char *)buf_ptr)[4]:'.', size>5?((const char *)buf_ptr)[5]:'.'); break; } ctx->phase = 4; /* "Phase out" on hard failure */ RETURN(RC_FAIL); } asn_enc_rval_t SEQUENCE_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { asn_enc_rval_t er; int xcan = (flags & XER_F_CANONICAL); int edx; if(!sptr) ASN__ENCODE_FAILED; er.encoded = 0; for(edx = 0; edx < td->elements_count; edx++) { asn_enc_rval_t tmper; asn_TYPE_member_t *elm = &td->elements[edx]; void *memb_ptr; const char *mname = elm->name; unsigned int mlen = strlen(mname); if(elm->flags & ATF_POINTER) { memb_ptr = *(void **)((char *)sptr + elm->memb_offset); if(!memb_ptr) { if(elm->optional) continue; /* Mandatory element is missing */ ASN__ENCODE_FAILED; } } else { memb_ptr = (void *)((char *)sptr + elm->memb_offset); } if(!xcan) ASN__TEXT_INDENT(1, ilevel); ASN__CALLBACK3("<", 1, mname, mlen, ">", 1); /* Print the member itself */ tmper = elm->type->xer_encoder(elm->type, memb_ptr, ilevel + 1, flags, cb, app_key); if(tmper.encoded == -1) return tmper; ASN__CALLBACK3("", 1); er.encoded += 5 + (2 * mlen) + tmper.encoded; } if(!xcan) ASN__TEXT_INDENT(1, ilevel - 1); ASN__ENCODED_OK(er); cb_failed: ASN__ENCODE_FAILED; } int SEQUENCE_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { int edx; int ret; if(!sptr) return (cb("", 8, app_key) < 0) ? -1 : 0; /* Dump preamble */ if(cb(td->name, strlen(td->name), app_key) < 0 || cb(" ::= {", 6, app_key) < 0) return -1; for(edx = 0; edx < td->elements_count; edx++) { asn_TYPE_member_t *elm = &td->elements[edx]; const void *memb_ptr; if(elm->flags & ATF_POINTER) { memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset); if(!memb_ptr) { if(elm->optional) continue; /* Print line */ /* Fall through */ } } else { memb_ptr = (const void *)((const char *)sptr + elm->memb_offset); } /* Indentation */ _i_INDENT(1); /* Print the member's name and stuff */ if(cb(elm->name, strlen(elm->name), app_key) < 0 || cb(": ", 2, app_key) < 0) return -1; /* Print the member itself */ ret = elm->type->print_struct(elm->type, memb_ptr, ilevel + 1, cb, app_key); if(ret) return ret; } ilevel--; _i_INDENT(1); return (cb("}", 1, app_key) < 0) ? -1 : 0; } void SEQUENCE_free(asn_TYPE_descriptor_t *td, void *sptr, int contents_only) { int edx; if(!td || !sptr) return; ASN_DEBUG("Freeing %s as SEQUENCE", td->name); for(edx = 0; edx < td->elements_count; edx++) { asn_TYPE_member_t *elm = &td->elements[edx]; void *memb_ptr; if(elm->flags & ATF_POINTER) { memb_ptr = *(void **)((char *)sptr + elm->memb_offset); if(memb_ptr) ASN_STRUCT_FREE(*elm->type, memb_ptr); } else { memb_ptr = (void *)((char *)sptr + elm->memb_offset); ASN_STRUCT_FREE_CONTENTS_ONLY(*elm->type, memb_ptr); } } if(!contents_only) { FREEMEM(sptr); } } int SEQUENCE_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { int edx; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } /* * Iterate over structure members and check their validity. */ for(edx = 0; edx < td->elements_count; edx++) { asn_TYPE_member_t *elm = &td->elements[edx]; const void *memb_ptr; if(elm->flags & ATF_POINTER) { memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset); if(!memb_ptr) { if(elm->optional) continue; ASN__CTFAIL(app_key, td, sptr, "%s: mandatory element %s absent (%s:%d)", td->name, elm->name, __FILE__, __LINE__); return -1; } } else { memb_ptr = (const void *)((const char *)sptr + elm->memb_offset); } if(elm->memb_constraints) { int ret = elm->memb_constraints(elm->type, memb_ptr, ctfailcb, app_key); if(ret) return ret; } else { int ret = elm->type->check_constraints(elm->type, memb_ptr, ctfailcb, app_key); if(ret) return ret; /* * Cannot inherit it earlier: * need to make sure we get the updated version. */ elm->memb_constraints = elm->type->check_constraints; } } return 0; } asn_dec_rval_t SEQUENCE_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { asn_SEQUENCE_specifics_t *specs = (asn_SEQUENCE_specifics_t *)td->specifics; void *st = *sptr; /* Target structure. */ int extpresent; /* Extension additions are present */ uint8_t *opres; /* Presence of optional root members */ asn_per_data_t opmd; asn_dec_rval_t rv; int edx; (void)constraints; if(ASN__STACK_OVERFLOW_CHECK(opt_codec_ctx)) ASN__DECODE_FAILED; if(!st) { st = *sptr = CALLOC(1, specs->struct_size); if(!st) ASN__DECODE_FAILED; } ASN_DEBUG("Decoding %s as SEQUENCE (UPER)", td->name); /* Handle extensions */ if(specs->ext_before >= 0) { extpresent = per_get_few_bits(pd, 1); if(extpresent < 0) ASN__DECODE_STARVED; } else { extpresent = 0; } /* Prepare a place and read-in the presence bitmap */ memset(&opmd, 0, sizeof(opmd)); if(specs->roms_count) { opres = (uint8_t *)MALLOC(((specs->roms_count + 7) >> 3) + 1); if(!opres) ASN__DECODE_FAILED; /* Get the presence map */ if(per_get_many_bits(pd, opres, 0, specs->roms_count)) { FREEMEM(opres); ASN__DECODE_STARVED; } opmd.buffer = opres; opmd.nbits = specs->roms_count; ASN_DEBUG("Read in presence bitmap for %s of %d bits (%x..)", td->name, specs->roms_count, *opres); } else { opres = 0; } /* * Get the sequence ROOT elements. */ for(edx = 0; edx < td->elements_count; edx++) { asn_TYPE_member_t *elm = &td->elements[edx]; void *memb_ptr; /* Pointer to the member */ void **memb_ptr2; /* Pointer to that pointer */ if(IN_EXTENSION_GROUP(specs, edx)) continue; /* Fetch the pointer to this member */ if(elm->flags & ATF_POINTER) { memb_ptr2 = (void **)((char *)st + elm->memb_offset); } else { memb_ptr = (char *)st + elm->memb_offset; memb_ptr2 = &memb_ptr; } /* Deal with optionality */ if(elm->optional) { int present = per_get_few_bits(&opmd, 1); ASN_DEBUG("Member %s->%s is optional, p=%d (%d->%d)", td->name, elm->name, present, (int)opmd.nboff, (int)opmd.nbits); if(present == 0) { /* This element is not present */ if(elm->default_value) { /* Fill-in DEFAULT */ if(elm->default_value(1, memb_ptr2)) { FREEMEM(opres); ASN__DECODE_FAILED; } ASN_DEBUG("Filled-in default"); } /* The member is just not present */ continue; } /* Fall through */ } /* Fetch the member from the stream */ ASN_DEBUG("Decoding member %s in %s", elm->name, td->name); rv = elm->type->uper_decoder(opt_codec_ctx, elm->type, elm->per_constraints, memb_ptr2, pd); if(rv.code != RC_OK) { ASN_DEBUG("Failed decode %s in %s", elm->name, td->name); FREEMEM(opres); return rv; } } /* Optionality map is not needed anymore */ FREEMEM(opres); /* * Deal with extensions. */ if(extpresent) { ssize_t bmlength; uint8_t *epres; /* Presence of extension members */ asn_per_data_t epmd; bmlength = uper_get_nslength(pd); if(bmlength < 0) ASN__DECODE_STARVED; ASN_DEBUG("Extensions %ld present in %s", (long)bmlength, td->name); epres = (uint8_t *)MALLOC((bmlength + 15) >> 3); if(!epres) ASN__DECODE_STARVED; /* Get the extensions map */ if(per_get_many_bits(pd, epres, 0, bmlength)) { FREEMEM(epres); ASN__DECODE_STARVED; } memset(&epmd, 0, sizeof(epmd)); epmd.buffer = epres; epmd.nbits = bmlength; ASN_DEBUG("Read in extensions bitmap for %s of %ld bits (%x..)", td->name, (long)bmlength, *epres); /* Go over extensions and read them in */ for(edx = specs->ext_after + 1; edx < td->elements_count; edx++) { asn_TYPE_member_t *elm = &td->elements[edx]; void *memb_ptr; /* Pointer to the member */ void **memb_ptr2; /* Pointer to that pointer */ int present; if(!IN_EXTENSION_GROUP(specs, edx)) { ASN_DEBUG("%d is not extension", edx); continue; } /* Fetch the pointer to this member */ if(elm->flags & ATF_POINTER) { memb_ptr2 = (void **)((char *)st + elm->memb_offset); } else { memb_ptr = (void *)((char *)st + elm->memb_offset); memb_ptr2 = &memb_ptr; } present = per_get_few_bits(&epmd, 1); if(present <= 0) { if(present < 0) break; /* No more extensions */ continue; } ASN_DEBUG("Decoding member %s in %s %p", elm->name, td->name, *memb_ptr2); rv = uper_open_type_get(opt_codec_ctx, elm->type, elm->per_constraints, memb_ptr2, pd); if(rv.code != RC_OK) { FREEMEM(epres); return rv; } } /* Skip over overflow extensions which aren't present * in this system's version of the protocol */ for(;;) { ASN_DEBUG("Getting overflow extensions"); switch(per_get_few_bits(&epmd, 1)) { case -1: break; case 0: continue; default: if(uper_open_type_skip(opt_codec_ctx, pd)) { FREEMEM(epres); ASN__DECODE_STARVED; } } break; } FREEMEM(epres); } /* Fill DEFAULT members in extensions */ for(edx = specs->roms_count; edx < specs->roms_count + specs->aoms_count; edx++) { asn_TYPE_member_t *elm = &td->elements[edx]; void **memb_ptr2; /* Pointer to member pointer */ if(!elm->default_value) continue; /* Fetch the pointer to this member */ if(elm->flags & ATF_POINTER) { memb_ptr2 = (void **)((char *)st + elm->memb_offset); if(*memb_ptr2) continue; } else { continue; /* Extensions are all optionals */ } /* Set default value */ if(elm->default_value(1, memb_ptr2)) { ASN__DECODE_FAILED; } } rv.consumed = 0; rv.code = RC_OK; return rv; } static int SEQUENCE_handle_extensions(asn_TYPE_descriptor_t *td, void *sptr, asn_per_outp_t *po1, asn_per_outp_t *po2) { asn_SEQUENCE_specifics_t *specs = (asn_SEQUENCE_specifics_t *)td->specifics; int exts_present = 0; int exts_count = 0; int edx; if(specs->ext_before < 0) return 0; /* Find out which extensions are present */ for(edx = specs->ext_after + 1; edx < td->elements_count; edx++) { asn_TYPE_member_t *elm = &td->elements[edx]; void *memb_ptr; /* Pointer to the member */ void **memb_ptr2; /* Pointer to that pointer */ int present; if(!IN_EXTENSION_GROUP(specs, edx)) { ASN_DEBUG("%s (@%d) is not extension", elm->type->name, edx); continue; } /* Fetch the pointer to this member */ if(elm->flags & ATF_POINTER) { memb_ptr2 = (void **)((char *)sptr + elm->memb_offset); present = (*memb_ptr2 != 0); } else { memb_ptr = (void *)((char *)sptr + elm->memb_offset); memb_ptr2 = &memb_ptr; present = 1; } ASN_DEBUG("checking %s (@%d) present => %d", elm->type->name, edx, present); exts_count++; exts_present += present; /* Encode as presence marker */ if(po1 && per_put_few_bits(po1, present, 1)) return -1; /* Encode as open type field */ if(po2 && present && uper_open_type_put(elm->type, elm->per_constraints, *memb_ptr2, po2)) return -1; } return exts_present ? exts_count : 0; } asn_enc_rval_t SEQUENCE_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { asn_SEQUENCE_specifics_t *specs = (asn_SEQUENCE_specifics_t *)td->specifics; asn_enc_rval_t er; int n_extensions; int edx; int i; (void)constraints; if(!sptr) ASN__ENCODE_FAILED; er.encoded = 0; ASN_DEBUG("Encoding %s as SEQUENCE (UPER)", td->name); /* * X.691#18.1 Whether structure is extensible * and whether to encode extensions */ if(specs->ext_before >= 0) { n_extensions = SEQUENCE_handle_extensions(td, sptr, 0, 0); per_put_few_bits(po, n_extensions ? 1 : 0, 1); } else { n_extensions = 0; /* There are no extensions to encode */ } /* Encode a presence bitmap */ for(i = 0; i < specs->roms_count; i++) { asn_TYPE_member_t *elm; void *memb_ptr; /* Pointer to the member */ void **memb_ptr2; /* Pointer to that pointer */ int present; edx = specs->oms[i]; elm = &td->elements[edx]; /* Fetch the pointer to this member */ if(elm->flags & ATF_POINTER) { memb_ptr2 = (void **)((char *)sptr + elm->memb_offset); present = (*memb_ptr2 != 0); } else { memb_ptr = (void *)((char *)sptr + elm->memb_offset); memb_ptr2 = &memb_ptr; present = 1; } /* Eliminate default values */ if(present && elm->default_value && elm->default_value(0, memb_ptr2) == 1) present = 0; ASN_DEBUG("Element %s %s %s->%s is %s", elm->flags & ATF_POINTER ? "ptr" : "inline", elm->default_value ? "def" : "wtv", td->name, elm->name, present ? "present" : "absent"); if(per_put_few_bits(po, present, 1)) ASN__ENCODE_FAILED; } /* * Encode the sequence ROOT elements. */ ASN_DEBUG("ext_after = %d, ec = %d, eb = %d", specs->ext_after, td->elements_count, specs->ext_before); for(edx = 0; edx < ((specs->ext_after < 0) ? td->elements_count : specs->ext_before - 1); edx++) { asn_TYPE_member_t *elm = &td->elements[edx]; void *memb_ptr; /* Pointer to the member */ void **memb_ptr2; /* Pointer to that pointer */ if(IN_EXTENSION_GROUP(specs, edx)) continue; ASN_DEBUG("About to encode %s", elm->type->name); /* Fetch the pointer to this member */ if(elm->flags & ATF_POINTER) { memb_ptr2 = (void **)((char *)sptr + elm->memb_offset); if(!*memb_ptr2) { ASN_DEBUG("Element %s %d not present", elm->name, edx); if(elm->optional) continue; /* Mandatory element is missing */ ASN__ENCODE_FAILED; } } else { memb_ptr = (void *)((char *)sptr + elm->memb_offset); memb_ptr2 = &memb_ptr; } /* Eliminate default values */ if(elm->default_value && elm->default_value(0, memb_ptr2) == 1) continue; ASN_DEBUG("Encoding %s->%s", td->name, elm->name); er = elm->type->uper_encoder(elm->type, elm->per_constraints, *memb_ptr2, po); if(er.encoded == -1) return er; } /* No extensions to encode */ if(!n_extensions) ASN__ENCODED_OK(er); ASN_DEBUG("Length of %d bit-map", n_extensions); /* #18.8. Write down the presence bit-map length. */ if(uper_put_nslength(po, n_extensions)) ASN__ENCODE_FAILED; ASN_DEBUG("Bit-map of %d elements", n_extensions); /* #18.7. Encoding the extensions presence bit-map. */ /* TODO: act upon NOTE in #18.7 for canonical PER */ if(SEQUENCE_handle_extensions(td, sptr, po, 0) != n_extensions) ASN__ENCODE_FAILED; ASN_DEBUG("Writing %d extensions", n_extensions); /* #18.9. Encode extensions as open type fields. */ if(SEQUENCE_handle_extensions(td, sptr, 0, po) != n_extensions) ASN__ENCODE_FAILED; ASN__ENCODED_OK(er); } asn1c-0.9.28+dfsg/skeletons/VisibleString.h0000644000000000000000000000077713065714043017216 0ustar rootroot/*- * Copyright (c) 2003 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef _VisibleString_H_ #define _VisibleString_H_ #include #ifdef __cplusplus extern "C" { #endif typedef OCTET_STRING_t VisibleString_t; /* Implemented via OCTET STRING */ extern asn_TYPE_descriptor_t asn_DEF_VisibleString; asn_constr_check_f VisibleString_constraint; #ifdef __cplusplus } #endif #endif /* _VisibleString_H_ */ asn1c-0.9.28+dfsg/skeletons/ANY.c0000644000000000000000000000613013065714043015041 0ustar rootroot/*- * Copyright (c) 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #include #include #include static asn_OCTET_STRING_specifics_t asn_DEF_ANY_specs = { sizeof(ANY_t), offsetof(ANY_t, _asn_ctx), ASN_OSUBV_ANY }; asn_TYPE_descriptor_t asn_DEF_ANY = { "ANY", "ANY", OCTET_STRING_free, OCTET_STRING_print, asn_generic_no_constraint, OCTET_STRING_decode_ber, OCTET_STRING_encode_der, OCTET_STRING_decode_xer_hex, ANY_encode_xer, 0, 0, 0, /* Use generic outmost tag fetcher */ 0, 0, 0, 0, 0, /* No PER visible constraints */ 0, 0, /* No members */ &asn_DEF_ANY_specs, }; asn_enc_rval_t ANY_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { if(flags & XER_F_CANONICAL) { /* * Canonical XER-encoding of ANY type is not supported. */ ASN__ENCODE_FAILED; } /* Dump as binary */ return OCTET_STRING_encode_xer(td, sptr, ilevel, flags, cb, app_key); } struct _callback_arg { uint8_t *buffer; size_t offset; size_t size; }; static int ANY__consume_bytes(const void *buffer, size_t size, void *key); int ANY_fromType(ANY_t *st, asn_TYPE_descriptor_t *td, void *sptr) { struct _callback_arg arg; asn_enc_rval_t erval; if(!st || !td) { errno = EINVAL; return -1; } if(!sptr) { if(st->buf) FREEMEM(st->buf); st->size = 0; return 0; } arg.offset = arg.size = 0; arg.buffer = 0; erval = der_encode(td, sptr, ANY__consume_bytes, &arg); if(erval.encoded == -1) { if(arg.buffer) FREEMEM(arg.buffer); return -1; } assert((size_t)erval.encoded == arg.offset); if(st->buf) FREEMEM(st->buf); st->buf = arg.buffer; st->size = arg.offset; return 0; } ANY_t * ANY_new_fromType(asn_TYPE_descriptor_t *td, void *sptr) { ANY_t tmp; ANY_t *st; if(!td || !sptr) { errno = EINVAL; return 0; } memset(&tmp, 0, sizeof(tmp)); if(ANY_fromType(&tmp, td, sptr)) return 0; st = (ANY_t *)CALLOC(1, sizeof(ANY_t)); if(st) { *st = tmp; return st; } else { FREEMEM(tmp.buf); return 0; } } int ANY_to_type(ANY_t *st, asn_TYPE_descriptor_t *td, void **struct_ptr) { asn_dec_rval_t rval; void *newst = 0; if(!st || !td || !struct_ptr) { errno = EINVAL; return -1; } if(st->buf == 0) { /* Nothing to convert, make it empty. */ *struct_ptr = (void *)0; return 0; } rval = ber_decode(0, td, (void **)&newst, st->buf, st->size); if(rval.code == RC_OK) { *struct_ptr = newst; return 0; } else { /* Remove possibly partially decoded data. */ ASN_STRUCT_FREE(*td, newst); return -1; } } static int ANY__consume_bytes(const void *buffer, size_t size, void *key) { struct _callback_arg *arg = (struct _callback_arg *)key; if((arg->offset + size) >= arg->size) { size_t nsize = (arg->size ? arg->size << 2 : 16) + size; void *p = REALLOC(arg->buffer, nsize); if(!p) return -1; arg->buffer = (uint8_t *)p; arg->size = nsize; } memcpy(arg->buffer + arg->offset, buffer, size); arg->offset += size; assert(arg->offset < arg->size); return 0; } asn1c-0.9.28+dfsg/skeletons/TeletexString.h0000644000000000000000000000072013065714043017217 0ustar rootroot/*- * Copyright (c) 2003 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef _TeletexString_H_ #define _TeletexString_H_ #include #ifdef __cplusplus extern "C" { #endif typedef OCTET_STRING_t TeletexString_t; /* Implemented via OCTET STRING */ extern asn_TYPE_descriptor_t asn_DEF_TeletexString; #ifdef __cplusplus } #endif #endif /* _TeletexString_H_ */ asn1c-0.9.28+dfsg/skeletons/VisibleString.c0000644000000000000000000000430313065714043017176 0ustar rootroot/*- * Copyright (c) 2003, 2006 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #include #include /* * VisibleString basic type description. */ static const ber_tlv_tag_t asn_DEF_VisibleString_tags[] = { (ASN_TAG_CLASS_UNIVERSAL | (26 << 2)), /* [UNIVERSAL 26] IMPLICIT ...*/ (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */ }; static asn_per_constraints_t asn_DEF_VisibleString_constraints = { { APC_CONSTRAINED, 7, 7, 0x20, 0x7e }, /* Value */ { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 }, /* Size */ 0, 0 }; asn_TYPE_descriptor_t asn_DEF_VisibleString = { "VisibleString", "VisibleString", OCTET_STRING_free, OCTET_STRING_print_utf8, /* ASCII subset */ VisibleString_constraint, OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */ OCTET_STRING_encode_der, OCTET_STRING_decode_xer_utf8, OCTET_STRING_encode_xer_utf8, OCTET_STRING_decode_uper, OCTET_STRING_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_VisibleString_tags, sizeof(asn_DEF_VisibleString_tags) / sizeof(asn_DEF_VisibleString_tags[0]) - 1, asn_DEF_VisibleString_tags, sizeof(asn_DEF_VisibleString_tags) / sizeof(asn_DEF_VisibleString_tags[0]), &asn_DEF_VisibleString_constraints, 0, 0, /* No members */ 0 /* No specifics */ }; int VisibleString_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const VisibleString_t *st = (const VisibleString_t *)sptr; if(st && st->buf) { uint8_t *buf = st->buf; uint8_t *end = buf + st->size; /* * Check the alphabet of the VisibleString. * ISO646, ISOReg#6 * The alphabet is a subset of ASCII between the space * and "~" (tilde). */ for(; buf < end; buf++) { if(*buf < 0x20 || *buf > 0x7e) { ASN__CTFAIL(app_key, td, sptr, "%s: value byte %ld (%d) " "not in VisibleString alphabet (%s:%d)", td->name, (long)((buf - st->buf) + 1), *buf, __FILE__, __LINE__); return -1; } } } else { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } return 0; } asn1c-0.9.28+dfsg/skeletons/per_opentype.c0000644000000000000000000002253613065714043017133 0ustar rootroot/* * Copyright (c) 2007 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #include #include #include #include typedef struct uper_ugot_key { asn_per_data_t oldpd; /* Old per data source */ size_t unclaimed; size_t ot_moved; /* Number of bits moved by OT processing */ int repeat; } uper_ugot_key; static int uper_ugot_refill(asn_per_data_t *pd); static int per_skip_bits(asn_per_data_t *pd, int skip_nbits); static asn_dec_rval_t uper_sot_suck(asn_codec_ctx_t *, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd); /* * Encode an "open type field". * #10.1, #10.2 */ int uper_open_type_put(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { void *buf; void *bptr; ssize_t size; size_t toGo; ASN_DEBUG("Open type put %s ...", td->name); size = uper_encode_to_new_buffer(td, constraints, sptr, &buf); if(size <= 0) return -1; for(bptr = buf, toGo = size; toGo;) { ssize_t maySave = uper_put_length(po, toGo); ASN_DEBUG("Prepending length %d to %s and allowing to save %d", (int)size, td->name, (int)maySave); if(maySave < 0) break; if(per_put_many_bits(po, bptr, maySave * 8)) break; bptr = (char *)bptr + maySave; toGo -= maySave; } FREEMEM(buf); if(toGo) return -1; ASN_DEBUG("Open type put %s of length %ld + overhead (1byte?)", td->name, (long)size); return 0; } static asn_dec_rval_t uper_open_type_get_simple(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { asn_dec_rval_t rv; ssize_t chunk_bytes; int repeat; uint8_t *buf = 0; size_t bufLen = 0; size_t bufSize = 0; asn_per_data_t spd; size_t padding; ASN__STACK_OVERFLOW_CHECK(ctx); ASN_DEBUG("Getting open type %s...", td->name); do { chunk_bytes = uper_get_length(pd, -1, &repeat); if(chunk_bytes < 0) { FREEMEM(buf); ASN__DECODE_STARVED; } if(bufLen + chunk_bytes > bufSize) { void *ptr; bufSize = chunk_bytes + (bufSize << 2); ptr = REALLOC(buf, bufSize); if(!ptr) { FREEMEM(buf); ASN__DECODE_FAILED; } buf = ptr; } if(per_get_many_bits(pd, buf + bufLen, 0, chunk_bytes << 3)) { FREEMEM(buf); ASN__DECODE_STARVED; } bufLen += chunk_bytes; } while(repeat); ASN_DEBUG("Getting open type %s encoded in %ld bytes", td->name, (long)bufLen); memset(&spd, 0, sizeof(spd)); spd.buffer = buf; spd.nbits = bufLen << 3; ASN_DEBUG_INDENT_ADD(+4); rv = td->uper_decoder(ctx, td, constraints, sptr, &spd); ASN_DEBUG_INDENT_ADD(-4); if(rv.code == RC_OK) { /* Check padding validity */ padding = spd.nbits - spd.nboff; if ((padding < 8 || /* X.691#10.1.3 */ (spd.nboff == 0 && spd.nbits == 8 && spd.buffer == buf)) && per_get_few_bits(&spd, padding) == 0) { /* Everything is cool */ FREEMEM(buf); return rv; } FREEMEM(buf); if(padding >= 8) { ASN_DEBUG("Too large padding %d in open type", (int)padding); ASN__DECODE_FAILED; } else { ASN_DEBUG("Non-zero padding"); ASN__DECODE_FAILED; } } else { FREEMEM(buf); /* rv.code could be RC_WMORE, nonsense in this context */ rv.code = RC_FAIL; /* Noone would give us more */ } return rv; } static asn_dec_rval_t GCC_NOTUSED uper_open_type_get_complex(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { uper_ugot_key arg; asn_dec_rval_t rv; ssize_t padding; ASN__STACK_OVERFLOW_CHECK(ctx); ASN_DEBUG("Getting open type %s from %s", td->name, per_data_string(pd)); arg.oldpd = *pd; arg.unclaimed = 0; arg.ot_moved = 0; arg.repeat = 1; pd->refill = uper_ugot_refill; pd->refill_key = &arg; pd->nbits = pd->nboff; /* 0 good bits at this point, will refill */ pd->moved = 0; /* This now counts the open type size in bits */ ASN_DEBUG_INDENT_ADD(+4); rv = td->uper_decoder(ctx, td, constraints, sptr, pd); ASN_DEBUG_INDENT_ADD(-4); #define UPDRESTOREPD do { \ /* buffer and nboff are valid, preserve them. */ \ pd->nbits = arg.oldpd.nbits - (pd->moved - arg.ot_moved); \ pd->moved = arg.oldpd.moved + (pd->moved - arg.ot_moved); \ pd->refill = arg.oldpd.refill; \ pd->refill_key = arg.oldpd.refill_key; \ } while(0) if(rv.code != RC_OK) { UPDRESTOREPD; return rv; } ASN_DEBUG("OpenType %s pd%s old%s unclaimed=%d, repeat=%d", td->name, per_data_string(pd), per_data_string(&arg.oldpd), (int)arg.unclaimed, (int)arg.repeat); padding = pd->moved % 8; if(padding) { int32_t pvalue; if(padding > 7) { ASN_DEBUG("Too large padding %d in open type", (int)padding); rv.code = RC_FAIL; UPDRESTOREPD; return rv; } padding = 8 - padding; ASN_DEBUG("Getting padding of %d bits", (int)padding); pvalue = per_get_few_bits(pd, padding); switch(pvalue) { case -1: ASN_DEBUG("Padding skip failed"); UPDRESTOREPD; ASN__DECODE_STARVED; case 0: break; default: ASN_DEBUG("Non-blank padding (%d bits 0x%02x)", (int)padding, (int)pvalue); UPDRESTOREPD; ASN__DECODE_FAILED; } } if(pd->nboff != pd->nbits) { ASN_DEBUG("Open type %s overhead pd%s old%s", td->name, per_data_string(pd), per_data_string(&arg.oldpd)); if(1) { UPDRESTOREPD; ASN__DECODE_FAILED; } else { arg.unclaimed += pd->nbits - pd->nboff; } } /* Adjust pd back so it points to original data */ UPDRESTOREPD; /* Skip data not consumed by the decoder */ if(arg.unclaimed) { ASN_DEBUG("Getting unclaimed %d", (int)arg.unclaimed); switch(per_skip_bits(pd, arg.unclaimed)) { case -1: ASN_DEBUG("Claim of %d failed", (int)arg.unclaimed); ASN__DECODE_STARVED; case 0: ASN_DEBUG("Got claim of %d", (int)arg.unclaimed); break; default: /* Padding must be blank */ ASN_DEBUG("Non-blank unconsumed padding"); ASN__DECODE_FAILED; } arg.unclaimed = 0; } if(arg.repeat) { ASN_DEBUG("Not consumed the whole thing"); rv.code = RC_FAIL; return rv; } return rv; } asn_dec_rval_t uper_open_type_get(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { return uper_open_type_get_simple(ctx, td, constraints, sptr, pd); } int uper_open_type_skip(asn_codec_ctx_t *ctx, asn_per_data_t *pd) { asn_TYPE_descriptor_t s_td; asn_dec_rval_t rv; s_td.name = ""; s_td.uper_decoder = uper_sot_suck; rv = uper_open_type_get(ctx, &s_td, 0, 0, pd); if(rv.code != RC_OK) return -1; else return 0; } /* * Internal functions. */ static asn_dec_rval_t uper_sot_suck(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { asn_dec_rval_t rv; (void)ctx; (void)td; (void)constraints; (void)sptr; while(per_get_few_bits(pd, 24) >= 0); rv.code = RC_OK; rv.consumed = pd->moved; return rv; } static int uper_ugot_refill(asn_per_data_t *pd) { uper_ugot_key *arg = pd->refill_key; ssize_t next_chunk_bytes, next_chunk_bits; ssize_t avail; asn_per_data_t *oldpd = &arg->oldpd; ASN_DEBUG("REFILLING pd->moved=%ld, oldpd->moved=%ld", (long)pd->moved, (long)oldpd->moved); /* Advance our position to where pd is */ oldpd->buffer = pd->buffer; oldpd->nboff = pd->nboff; oldpd->nbits -= pd->moved - arg->ot_moved; oldpd->moved += pd->moved - arg->ot_moved; arg->ot_moved = pd->moved; if(arg->unclaimed) { /* Refill the container */ if(per_get_few_bits(oldpd, 1)) return -1; if(oldpd->nboff == 0) { assert(0); return -1; } pd->buffer = oldpd->buffer; pd->nboff = oldpd->nboff - 1; pd->nbits = oldpd->nbits; ASN_DEBUG("UNCLAIMED <- return from (pd->moved=%ld)", (long)pd->moved); return 0; } if(!arg->repeat) { ASN_DEBUG("Want more but refill doesn't have it"); return -1; } next_chunk_bytes = uper_get_length(oldpd, -1, &arg->repeat); ASN_DEBUG("Open type LENGTH %ld bytes at off %ld, repeat %ld", (long)next_chunk_bytes, (long)oldpd->moved, (long)arg->repeat); if(next_chunk_bytes < 0) return -1; if(next_chunk_bytes == 0) { pd->refill = 0; /* No more refills, naturally */ assert(!arg->repeat); /* Implementation guarantee */ } next_chunk_bits = next_chunk_bytes << 3; avail = oldpd->nbits - oldpd->nboff; if(avail >= next_chunk_bits) { pd->nbits = oldpd->nboff + next_chunk_bits; arg->unclaimed = 0; ASN_DEBUG("!+Parent frame %ld bits, alloting %ld [%ld..%ld] (%ld)", (long)next_chunk_bits, (long)oldpd->moved, (long)oldpd->nboff, (long)oldpd->nbits, (long)(oldpd->nbits - oldpd->nboff)); } else { pd->nbits = oldpd->nbits; arg->unclaimed = next_chunk_bits - avail; ASN_DEBUG("!-Parent frame %ld, require %ld, will claim %ld", (long)avail, (long)next_chunk_bits, (long)arg->unclaimed); } pd->buffer = oldpd->buffer; pd->nboff = oldpd->nboff; ASN_DEBUG("Refilled pd%s old%s", per_data_string(pd), per_data_string(oldpd)); return 0; } static int per_skip_bits(asn_per_data_t *pd, int skip_nbits) { int hasNonZeroBits = 0; while(skip_nbits > 0) { int skip; /* per_get_few_bits() is more efficient when nbits <= 24 */ if(skip_nbits < 24) skip = skip_nbits; else skip = 24; skip_nbits -= skip; switch(per_get_few_bits(pd, skip)) { case -1: return -1; /* Starving */ case 0: continue; /* Skipped empty space */ default: hasNonZeroBits = 1; continue; } } return hasNonZeroBits; } asn1c-0.9.28+dfsg/skeletons/ber_tlv_tag.h0000644000000000000000000000345413065714043016715 0ustar rootroot/*- * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef _BER_TLV_TAG_H_ #define _BER_TLV_TAG_H_ #ifdef __cplusplus extern "C" { #endif enum asn_tag_class { ASN_TAG_CLASS_UNIVERSAL = 0, /* 0b00 */ ASN_TAG_CLASS_APPLICATION = 1, /* 0b01 */ ASN_TAG_CLASS_CONTEXT = 2, /* 0b10 */ ASN_TAG_CLASS_PRIVATE = 3 /* 0b11 */ }; typedef unsigned ber_tlv_tag_t; /* BER TAG from Tag-Length-Value */ /* * Tag class is encoded together with tag value for optimization purposes. */ #define BER_TAG_CLASS(tag) ((tag) & 0x3) #define BER_TAG_VALUE(tag) ((tag) >> 2) #define BER_TLV_CONSTRUCTED(tagptr) (((*(const uint8_t *)tagptr)&0x20)?1:0) #define BER_TAGS_EQUAL(tag1, tag2) ((tag1) == (tag2)) /* * Several functions for printing the TAG in the canonical form * (i.e. "[PRIVATE 0]"). * Return values correspond to their libc counterparts (if any). */ ssize_t ber_tlv_tag_snprint(ber_tlv_tag_t tag, char *buf, size_t buflen); ssize_t ber_tlv_tag_fwrite(ber_tlv_tag_t tag, FILE *); char *ber_tlv_tag_string(ber_tlv_tag_t tag); /* * This function tries to fetch the tag from the input stream. * RETURN VALUES: * 0: More data expected than bufptr contains. * -1: Fatal error deciphering tag. * >0: Number of bytes used from bufptr. tag_r will contain the tag. */ ssize_t ber_fetch_tag(const void *bufptr, size_t size, ber_tlv_tag_t *tag_r); /* * This function serializes the tag (T from TLV) in BER format. * It always returns number of bytes necessary to represent the tag, * it is a caller's responsibility to check the return value * against the supplied buffer's size. */ size_t ber_tlv_tag_serialize(ber_tlv_tag_t tag, void *bufptr, size_t size); #ifdef __cplusplus } #endif #endif /* _BER_TLV_TAG_H_ */ asn1c-0.9.28+dfsg/skeletons/BIT_STRING.h0000644000000000000000000000147013065714043016125 0ustar rootroot/*- * Copyright (c) 2003 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef _BIT_STRING_H_ #define _BIT_STRING_H_ #include /* Some help from OCTET STRING */ #ifdef __cplusplus extern "C" { #endif typedef struct BIT_STRING_s { uint8_t *buf; /* BIT STRING body */ int size; /* Size of the above buffer */ int bits_unused;/* Unused trailing bits in the last octet (0..7) */ asn_struct_ctx_t _asn_ctx; /* Parsing across buffer boundaries */ } BIT_STRING_t; extern asn_TYPE_descriptor_t asn_DEF_BIT_STRING; asn_struct_print_f BIT_STRING_print; /* Human-readable output */ asn_constr_check_f BIT_STRING_constraint; xer_type_encoder_f BIT_STRING_encode_xer; #ifdef __cplusplus } #endif #endif /* _BIT_STRING_H_ */ asn1c-0.9.28+dfsg/skeletons/NativeReal.c0000644000000000000000000001756413065714043016461 0ustar rootroot/*- * Copyright (c) 2004, 2006 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ /* * Read the NativeReal.h for the explanation wrt. differences between * REAL and NativeReal. * Basically, both are decoders and encoders of ASN.1 REAL type, but this * implementation deals with the standard (machine-specific) representation * of them instead of using the platform-independent buffer. */ #include #include #include #include /* * NativeReal basic type description. */ static const ber_tlv_tag_t asn_DEF_NativeReal_tags[] = { (ASN_TAG_CLASS_UNIVERSAL | (9 << 2)) }; asn_TYPE_descriptor_t asn_DEF_NativeReal = { "REAL", /* The ASN.1 type is still REAL */ "REAL", NativeReal_free, NativeReal_print, asn_generic_no_constraint, NativeReal_decode_ber, NativeReal_encode_der, NativeReal_decode_xer, NativeReal_encode_xer, NativeReal_decode_uper, NativeReal_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_NativeReal_tags, sizeof(asn_DEF_NativeReal_tags) / sizeof(asn_DEF_NativeReal_tags[0]), asn_DEF_NativeReal_tags, /* Same as above */ sizeof(asn_DEF_NativeReal_tags) / sizeof(asn_DEF_NativeReal_tags[0]), 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /* * Decode REAL type. */ asn_dec_rval_t NativeReal_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **dbl_ptr, const void *buf_ptr, size_t size, int tag_mode) { double *Dbl = (double *)*dbl_ptr; asn_dec_rval_t rval; ber_tlv_len_t length; /* * If the structure is not there, allocate it. */ if(Dbl == NULL) { *dbl_ptr = CALLOC(1, sizeof(*Dbl)); Dbl = (double *)*dbl_ptr; if(Dbl == NULL) { rval.code = RC_FAIL; rval.consumed = 0; return rval; } } ASN_DEBUG("Decoding %s as REAL (tm=%d)", td->name, tag_mode); /* * Check tags. */ rval = ber_check_tags(opt_codec_ctx, td, 0, buf_ptr, size, tag_mode, 0, &length, 0); if(rval.code != RC_OK) return rval; ASN_DEBUG("%s length is %d bytes", td->name, (int)length); /* * Make sure we have this length. */ buf_ptr = ((const char *)buf_ptr) + rval.consumed; size -= rval.consumed; if(length > (ber_tlv_len_t)size) { rval.code = RC_WMORE; rval.consumed = 0; return rval; } /* * ASN.1 encoded REAL: buf_ptr, length * Fill the Dbl, at the same time checking for overflow. * If overflow occured, return with RC_FAIL. */ { REAL_t tmp; union { const void *constbuf; void *nonconstbuf; } unconst_buf; double d; unconst_buf.constbuf = buf_ptr; tmp.buf = (uint8_t *)unconst_buf.nonconstbuf; tmp.size = length; if(length < (ber_tlv_len_t)size) { int ret; uint8_t saved_byte = tmp.buf[tmp.size]; tmp.buf[tmp.size] = '\0'; ret = asn_REAL2double(&tmp, &d); tmp.buf[tmp.size] = saved_byte; if(ret) { rval.code = RC_FAIL; rval.consumed = 0; return rval; } } else if(length < 48 /* Enough for longish %f value. */) { tmp.buf = alloca(length + 1); tmp.size = length; memcpy(tmp.buf, buf_ptr, length); tmp.buf[tmp.size] = '\0'; if(asn_REAL2double(&tmp, &d)) { rval.code = RC_FAIL; rval.consumed = 0; return rval; } } else { /* This should probably never happen: impractically long value */ tmp.buf = CALLOC(1, length + 1); tmp.size = length; if(tmp.buf) memcpy(tmp.buf, buf_ptr, length); if(!tmp.buf || asn_REAL2double(&tmp, &d)) { FREEMEM(tmp.buf); rval.code = RC_FAIL; rval.consumed = 0; return rval; } FREEMEM(tmp.buf); } *Dbl = d; } rval.code = RC_OK; rval.consumed += length; ASN_DEBUG("Took %ld/%ld bytes to encode %s (%f)", (long)rval.consumed, (long)length, td->name, *Dbl); return rval; } /* * Encode the NativeReal using the standard REAL type DER encoder. */ asn_enc_rval_t NativeReal_encode_der(asn_TYPE_descriptor_t *td, void *ptr, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { double Dbl = *(const double *)ptr; asn_enc_rval_t erval; REAL_t tmp; /* Prepare a temporary clean structure */ memset(&tmp, 0, sizeof(tmp)); if(asn_double2REAL(&tmp, Dbl)) { erval.encoded = -1; erval.failed_type = td; erval.structure_ptr = ptr; return erval; } /* Encode a fake REAL */ erval = der_encode_primitive(td, &tmp, tag_mode, tag, cb, app_key); if(erval.encoded == -1) { assert(erval.structure_ptr == &tmp); erval.structure_ptr = ptr; } /* Free possibly allocated members of the temporary structure */ ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_REAL, &tmp); return erval; } /* * Decode REAL type using PER. */ asn_dec_rval_t NativeReal_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **dbl_ptr, asn_per_data_t *pd) { double *Dbl = (double *)*dbl_ptr; asn_dec_rval_t rval; REAL_t tmp; void *ptmp = &tmp; int ret; (void)constraints; /* * If the structure is not there, allocate it. */ if(Dbl == NULL) { *dbl_ptr = CALLOC(1, sizeof(*Dbl)); Dbl = (double *)*dbl_ptr; if(Dbl == NULL) ASN__DECODE_FAILED; } memset(&tmp, 0, sizeof(tmp)); rval = OCTET_STRING_decode_uper(opt_codec_ctx, td, NULL, &ptmp, pd); if(rval.code != RC_OK) { ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_REAL, &tmp); return rval; } ret = asn_REAL2double(&tmp, Dbl); ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_REAL, &tmp); if(ret) ASN__DECODE_FAILED; return rval; } /* * Encode the NativeReal using the OCTET STRING PER encoder. */ asn_enc_rval_t NativeReal_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { double Dbl = *(const double *)sptr; asn_enc_rval_t erval; REAL_t tmp; (void)constraints; /* Prepare a temporary clean structure */ memset(&tmp, 0, sizeof(tmp)); if(asn_double2REAL(&tmp, Dbl)) ASN__ENCODE_FAILED; /* Encode a DER REAL */ erval = OCTET_STRING_encode_uper(td, NULL, &tmp, po); if(erval.encoded == -1) erval.structure_ptr = sptr; /* Free possibly allocated members of the temporary structure */ ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_REAL, &tmp); return erval; } /* * Decode the chunk of XML text encoding REAL. */ asn_dec_rval_t NativeReal_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, const char *opt_mname, const void *buf_ptr, size_t size) { asn_dec_rval_t rval; REAL_t *st = 0; REAL_t **stp = &st; double *Dbl = (double *)*sptr; if(!Dbl) { *sptr = CALLOC(1, sizeof(double)); Dbl = (double *)*sptr; if(!Dbl) { rval.code = RC_FAIL; rval.consumed = 0; return rval; } } rval = REAL_decode_xer(opt_codec_ctx, td, (void **)stp, opt_mname, buf_ptr, size); if(rval.code == RC_OK) { if(asn_REAL2double(st, Dbl)) { rval.code = RC_FAIL; rval.consumed = 0; } } else { rval.consumed = 0; } ASN_STRUCT_FREE(asn_DEF_REAL, st); return rval; } asn_enc_rval_t NativeReal_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { const double *Dbl = (const double *)sptr; asn_enc_rval_t er; (void)ilevel; if(!Dbl) ASN__ENCODE_FAILED; er.encoded = REAL__dump(*Dbl, flags & XER_F_CANONICAL, cb, app_key); if(er.encoded < 0) ASN__ENCODE_FAILED; ASN__ENCODED_OK(er); } /* * REAL specific human-readable output. */ int NativeReal_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { const double *Dbl = (const double *)sptr; (void)td; /* Unused argument */ (void)ilevel; /* Unused argument */ if(!Dbl) return (cb("", 8, app_key) < 0) ? -1 : 0; return (REAL__dump(*Dbl, 0, cb, app_key) < 0) ? -1 : 0; } void NativeReal_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) { if(!td || !ptr) return; ASN_DEBUG("Freeing %s as REAL (%d, %p, Native)", td->name, contents_only, ptr); if(!contents_only) { FREEMEM(ptr); } } asn1c-0.9.28+dfsg/skeletons/ber_tlv_length.c0000644000000000000000000000731013065714043017411 0ustar rootroot/*- * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #include #include #include ssize_t ber_fetch_length(int _is_constructed, const void *bufptr, size_t size, ber_tlv_len_t *len_r) { const uint8_t *buf = (const uint8_t *)bufptr; unsigned oct; if(size == 0) return 0; /* Want more */ oct = *(const uint8_t *)buf; if((oct & 0x80) == 0) { /* * Short definite length. */ *len_r = oct; /* & 0x7F */ return 1; } else { ber_tlv_len_t len; size_t skipped; if(_is_constructed && oct == 0x80) { *len_r = -1; /* Indefinite length */ return 1; } if(oct == 0xff) { /* Reserved in standard for future use. */ return -1; } oct &= 0x7F; /* Leave only the 7 LS bits */ for(len = 0, buf++, skipped = 1; oct && (++skipped <= size); buf++, oct--) { len = (len << 8) | *buf; if(len < 0 || (len >> ((8 * sizeof(len)) - 8) && oct > 1)) { /* * Too large length value. */ return -1; } } if(oct == 0) { ber_tlv_len_t lenplusepsilon = (size_t)len + 1024; /* * Here length may be very close or equal to 2G. * However, the arithmetics used in some decoders * may add some (small) quantities to the length, * to check the resulting value against some limits. * This may result in integer wrap-around, which * we try to avoid by checking it earlier here. */ if(lenplusepsilon < 0) { /* Too large length value */ return -1; } *len_r = len; return skipped; } return 0; /* Want more */ } } ssize_t ber_skip_length(asn_codec_ctx_t *opt_codec_ctx, int _is_constructed, const void *ptr, size_t size) { ber_tlv_len_t vlen; /* Length of V in TLV */ ssize_t tl; /* Length of L in TLV */ ssize_t ll; /* Length of L in TLV */ size_t skip; /* * Make sure we didn't exceed the maximum stack size. */ if(ASN__STACK_OVERFLOW_CHECK(opt_codec_ctx)) return -1; /* * Determine the size of L in TLV. */ ll = ber_fetch_length(_is_constructed, ptr, size, &vlen); if(ll <= 0) return ll; /* * Definite length. */ if(vlen >= 0) { skip = ll + vlen; if(skip > size) return 0; /* Want more */ return skip; } /* * Indefinite length! */ ASN_DEBUG("Skipping indefinite length"); for(skip = ll, ptr = ((const char *)ptr) + ll, size -= ll;;) { ber_tlv_tag_t tag; /* Fetch the tag */ tl = ber_fetch_tag(ptr, size, &tag); if(tl <= 0) return tl; ll = ber_skip_length(opt_codec_ctx, BER_TLV_CONSTRUCTED(ptr), ((const char *)ptr) + tl, size - tl); if(ll <= 0) return ll; skip += tl + ll; /* * This may be the end of the indefinite length structure, * two consecutive 0 octets. * Check if it is true. */ if(((const uint8_t *)ptr)[0] == 0 && ((const uint8_t *)ptr)[1] == 0) return skip; ptr = ((const char *)ptr) + tl + ll; size -= tl + ll; } /* UNREACHABLE */ } size_t der_tlv_length_serialize(ber_tlv_len_t len, void *bufp, size_t size) { size_t required_size; /* Size of len encoding */ uint8_t *buf = (uint8_t *)bufp; uint8_t *end; size_t i; if(len <= 127) { /* Encoded in 1 octet */ if(size) *buf = (uint8_t)len; return 1; } /* * Compute the size of the subsequent bytes. */ for(required_size = 1, i = 8; i < 8 * sizeof(len); i += 8) { if(len >> i) required_size++; else break; } if(size <= required_size) return required_size + 1; *buf++ = (uint8_t)(0x80 | required_size); /* Length of the encoding */ /* * Produce the len encoding, space permitting. */ end = buf + required_size; for(i -= 8; buf < end; i -= 8, buf++) *buf = (uint8_t)(len >> i); return required_size + 1; } asn1c-0.9.28+dfsg/skeletons/TeletexString.c0000644000000000000000000001536013065714043017220 0ustar rootroot/*- * Copyright (c) 2003, 2006 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #include #include /* * TeletexString basic type description. */ static const ber_tlv_tag_t asn_DEF_TeletexString_tags[] = { (ASN_TAG_CLASS_UNIVERSAL | (20 << 2)), /* [UNIVERSAL 20] IMPLICIT ...*/ (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), /* ... OCTET STRING */ }; asn_TYPE_descriptor_t asn_DEF_TeletexString = { "TeletexString", "TeletexString", OCTET_STRING_free, OCTET_STRING_print, /* non-ascii string */ asn_generic_unknown_constraint, OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */ OCTET_STRING_encode_der, OCTET_STRING_decode_xer_hex, OCTET_STRING_encode_xer, OCTET_STRING_decode_uper, OCTET_STRING_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_TeletexString_tags, sizeof(asn_DEF_TeletexString_tags) / sizeof(asn_DEF_TeletexString_tags[0]) - 1, asn_DEF_TeletexString_tags, sizeof(asn_DEF_TeletexString_tags) / sizeof(asn_DEF_TeletexString_tags[0]), 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /* * Here is a formal attempt at creating a mapping from TeletexString * (T61String) of the latest ASN.1 standard (X.680:2002) into the Unicode * character set. -- Lev Walkin * * The first thing to keep in mind is that TeletexString (T61String) * is defined in ASN.1, and is not really a T.61 string. * The T.61 standard is withdrawn by ITU-T and is no longer an authoritative * reference. See http://www.itu.int/rec/T-REC-T.61 * * The X.680 specifies TeletexString (T61String) as a combination of the * character sets specified by the registration numbers listed in * ISO International Register of Coded Character Sets to be used with * Escape Sequences (ISO-2375): * 6, 87, 102, 103, 106, 107, 126, 144, 150, 153, 156, 164, 165, 168, * plus SPACE and DELETE characters. * In addition to that, the X.680 Table 6 NOTE 2 allows using register entries * 6 and 156 instead of 102 and 103. * * The ISO Register itself is available at http://www.itscj.ipsj.or.jp/ISO-IR/ * * #6 is ASCII. http://www.itscj.ipsj.or.jp/ISO-IR/006.pdf * Escapes into: * G0: ESC 2/8 4/2 ("(B") * G1: ESC 2/9 4/2 (")B") * The range is [0x21 .. 0x7e]. Conversion into Unicode * is simple, because it has one-to-one correspondence. * #87 is a "Japanese Graphic Character Set for Information Interchange". * Is a multiple-byte set of 6877 characters. * The character set is JIS X 0208-1983 (originally JIS C 6226-1983). * Escapes into: * G0: ESC 2/4 4/2 ("$B") * G1: ESC 2/4 2/9 4/2 ("$)B") * G2: ESC 2/4 2/10 4/2 ("$*B") * G3: ESC 2/4 2/11 4/2 ("$+B") * #102 is "Teletex Primary Set of Graphic Characters" and is almost ASCII. * Escapes into: * G0: ESC 2/8 7/5 ("(u") * G1: ESC 2/9 7/5 (")u") * G2: ESC 2/10 7/5 ("*u") * G3: ESC 2/11 7/5 ("+u") * It is almost identical to ASCII, except for ASCII position for '$' * (DOLLAR SIGN) is filled with 'ツ、' (CURRENCY SIGN), which is U+00A4. * Also, ASCII positions for '`', '\', '^', '{', '}', '~' are marked * as "should not be used". * #103 is a supplementary set of characters used in combination with #102. * Escapes into: * G0: ESC 2/8 7/6 ("(v") * G1: ESC 2/9 7/6 (")v") * G2: ESC 2/10 7/6 ("*v") * G3: ESC 2/11 7/6 ("+v") * Some characters in that character set are combining characters, * which can only be restrictively used with certain basic Latin letters. * It can be thought of as a subset of #156 with the exception of 4/12 * which is UNDERLINE in #103 and absent in #156. * #106 is a primary set of control functions, used in combination with #107. * Escapes into: * C0: ESC 2/1 4/5 ("!E") * This set is so short I can list it here: * 0x08 BS BACKSPACE -- same as Unicode * 0x0a LF LINE FEED -- same as Unicode * 0x0c FF FORM FEED -- same as Unicode * 0x0d CR CARRIAGE RETURN -- same as Unicode * 0x0e LS1 LOCKING SHIFT ONE * 0x0f LS0 LOCKING SHIFT ZERO * 0x19 SS2 SINGLE SHIFT TWO * 0x1a SUB SUBSTITUTE CHARACTER * 0x1b ESC ESCAPE -- same as Unicode * 0x1d SS3 SINGLE SHIFT THREE * The LS1 and LS0 are two magical functions which, respectively, invoke * the currently designated G1 or G0 set into positions 2/1 to 7/14 * The SS2 and SS3, respectively, invoke one character of the * currently designated set G2 and G3. * The SUB is wholly equivalent to U+001a (SUBSTITUTE) * #107 is a supplementary set of control functions, used with #106. * Escapes into: * C1: ESC 2/2 4/8 ('"H') * This set contains three special control codes: * 0x8b PLD PARTIAL LINE DOWN -- similar to * 0x8c PLU PARTIAL LINE UP -- sumilar to * 0x9b CSI CONTROL SEQUENCE INTRODUCER * This set is so out of world we can probably safely ignore it. * #126 is a "Right-hand Part of the Latin/Greek Alphabet". * Comprises of 90 characters, including accented letters. * Escapes into: * G1: ESC 2/13 4/6 ("-F") * G2: ESC 2/14 4/6 (".F") * G3: ESC 2/15 4/6 ("/F") * Note: This Registration is a subset of ISO-IR 227. * #144 is a "Cyrillic part of the Latin/Cyrillic Alphabet". * Comprises of 95 characters. * Escapes into: * G1: ESC 2/13 4/12 ("-L") * G2: ESC 2/14 4/12 (".L") * G3: ESC 2/15 4/12 ("/L") * #150 is a "Greek Primary Set of Graphic Characters". * Comprises of 94 characters. * Escapes into: * G0: ESC 2/8 2/1 4/0 ("(!@") * G1: ESC 2/9 2/1 4/0 (")!@") * G2: ESC 2/10 2/1 4/0 ("*!@") * G3: ESC 2/11 2/1 4/0 ("+!@") * #153 is a "Basic Cyrillic Character Set for 8-bit codes". * Comprises of 68 characters. * Escapes into: * G1: ESC 2/13 4/15 ("-O") * G2: ESC 2/14 4/15 (".O") * G3: ESC 2/15 4/15 ("/O") * #156 is a "Supplementary Set of ISO/IEC 6937:1992" for use with #6 * Comprises of 87 characters. * Escapes into: * G1: ESC 2/13 5/2 ("-R") * G2: ESC 2/14 5/2 (".R") * G3: ESC 2/15 5/2 ("/R") * #164 is a "Hebrew Supplementary Set of Graphic Characters" * Comprises of 27 characters. * Escapes into: * G1: ESC 2/13 5/3 ("-S") * G2: ESC 2/14 5/3 (".S") * G3: ESC 2/15 5/3 ("/S") * #165 is a set of "Codes of the Chinese graphic character set" * Is a multiple-byte set of 8446 characters. * Escapes into: * G0: ESC 2/4 2/8 4/5 ("$(E") * G1: ESC 2/4 2/9 4/5 ("$)E") * G2: ESC 2/4 2/10 4/5 ("$*E") * G3: ESC 2/4 2/11 4/5 ("$+E") * #168 is a "Japanese Graphic Character Set for Information Interchange" * A multiple-byte set of 6879 characters updated from #87. * Escapes into: * G0: ESC 2/6 4/0 ESC 2/4 4/2 ("&@" "$B") * G1: ESC 2/6 4/0 ESC 2/4 2/9 4/2 ("&@" "$)B") * G2: ESC 2/6 4/0 ESC 2/4 2/10 4/2 ("&@" "$*B") * G3: ESC 2/6 4/0 ESC 2/4 2/11 4/2 ("&@" "$+B") */ asn1c-0.9.28+dfsg/skeletons/UTF8String.h0000644000000000000000000000242113065714043016333 0ustar rootroot/*- * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef _UTF8String_H_ #define _UTF8String_H_ #include #ifdef __cplusplus extern "C" { #endif typedef OCTET_STRING_t UTF8String_t; /* Implemented via OCTET STRING */ extern asn_TYPE_descriptor_t asn_DEF_UTF8String; asn_struct_print_f UTF8String_print; asn_constr_check_f UTF8String_constraint; /* * Returns length of the given UTF-8 string in characters, * or a negative error code: * -1: UTF-8 sequence truncated * -2: Illegal UTF-8 sequence start * -3: Continuation expectation failed * -4: Not minimal length encoding * -5: Invalid arguments */ ssize_t UTF8String_length(const UTF8String_t *st); /* * Convert the UTF-8 string into a sequence of wide characters. * Returns the number of characters necessary. * Returned value might be greater than dstlen. * In case of conversion error, 0 is returned. * * If st points to a valid UTF-8 string, calling * UTF8String_to_wcs(st, 0, 0); * is equivalent to * UTF8String_length(const UTF8String_t *st); */ size_t UTF8String_to_wcs(const UTF8String_t *st, uint32_t *dst, size_t dstlen); #ifdef __cplusplus } #endif #endif /* _UTF8String_H_ */ asn1c-0.9.28+dfsg/skeletons/VideotexString.h0000644000000000000000000000072613065714043017402 0ustar rootroot/*- * Copyright (c) 2003 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef _VideotexString_H_ #define _VideotexString_H_ #include #ifdef __cplusplus extern "C" { #endif typedef OCTET_STRING_t VideotexString_t; /* Implemented via OCTET STRING */ extern asn_TYPE_descriptor_t asn_DEF_VideotexString; #ifdef __cplusplus } #endif #endif /* _VideotexString_H_ */ asn1c-0.9.28+dfsg/skeletons/INTEGER.h0000644000000000000000000000563513065714043015525 0ustar rootroot/*- * Copyright (c) 2003, 2005 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef _INTEGER_H_ #define _INTEGER_H_ #include #include #ifdef __cplusplus extern "C" { #endif typedef ASN__PRIMITIVE_TYPE_t INTEGER_t; extern asn_TYPE_descriptor_t asn_DEF_INTEGER; /* Map with to integer value association */ typedef struct asn_INTEGER_enum_map_s { long nat_value; /* associated native integer value */ size_t enum_len; /* strlen("tag") */ const char *enum_name; /* "tag" */ } asn_INTEGER_enum_map_t; /* This type describes an enumeration for INTEGER and ENUMERATED types */ typedef const struct asn_INTEGER_specifics_s { const asn_INTEGER_enum_map_t *value2enum; /* N -> "tag"; sorted by N */ const unsigned int *enum2value; /* "tag" => N; sorted by tag */ int map_count; /* Elements in either map */ int extension; /* This map is extensible */ int strict_enumeration; /* Enumeration set is fixed */ int field_width; /* Size of native integer */ int field_unsigned; /* Signed=0, unsigned=1 */ } asn_INTEGER_specifics_t; asn_struct_print_f INTEGER_print; ber_type_decoder_f INTEGER_decode_ber; der_type_encoder_f INTEGER_encode_der; xer_type_decoder_f INTEGER_decode_xer; xer_type_encoder_f INTEGER_encode_xer; per_type_decoder_f INTEGER_decode_uper; per_type_encoder_f INTEGER_encode_uper; /*********************************** * Some handy conversion routines. * ***********************************/ /* * Returns 0 if it was possible to convert, -1 otherwise. * -1/EINVAL: Mandatory argument missing * -1/ERANGE: Value encoded is out of range for long representation * -1/ENOMEM: Memory allocation failed (in asn_long2INTEGER()). */ int asn_INTEGER2long(const INTEGER_t *i, long *l); int asn_INTEGER2ulong(const INTEGER_t *i, unsigned long *l); int asn_long2INTEGER(INTEGER_t *i, long l); int asn_ulong2INTEGER(INTEGER_t *i, unsigned long l); /* A a reified version of strtol(3) with nicer error reporting. */ enum asn_strtol_result_e { ASN_STRTOL_ERROR_RANGE = -3, /* Input outside of numeric range for long type */ ASN_STRTOL_ERROR_INVAL = -2, /* Invalid data encountered (e.g., "+-") */ ASN_STRTOL_EXPECT_MORE = -1, /* More data expected (e.g. "+") */ ASN_STRTOL_OK = 0, /* Conversion succeded, number ends at (*end) */ ASN_STRTOL_EXTRA_DATA = 1 /* Conversion succeded, but the string has extra stuff */ }; enum asn_strtol_result_e asn_strtol_lim(const char *str, const char **end, long *l); /* The asn_strtol is going to be DEPRECATED soon */ enum asn_strtol_result_e asn_strtol(const char *str, const char *end, long *l); /* * Convert the integer value into the corresponding enumeration map entry. */ const asn_INTEGER_enum_map_t *INTEGER_map_value2enum(asn_INTEGER_specifics_t *specs, long value); #ifdef __cplusplus } #endif #endif /* _INTEGER_H_ */ asn1c-0.9.28+dfsg/skeletons/per_support.h0000644000000000000000000001025713065714043017006 0ustar rootroot/* * Copyright (c) 2005-2014 Lev Walkin . * All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef _PER_SUPPORT_H_ #define _PER_SUPPORT_H_ #include /* Platform-specific types */ #ifdef __cplusplus extern "C" { #endif /* * Pre-computed PER constraints. */ typedef const struct asn_per_constraint_s { enum asn_per_constraint_flags { APC_UNCONSTRAINED = 0x0, /* No PER visible constraints */ APC_SEMI_CONSTRAINED = 0x1, /* Constrained at "lb" */ APC_CONSTRAINED = 0x2, /* Fully constrained */ APC_EXTENSIBLE = 0x4 /* May have extension */ } flags; int range_bits; /* Full number of bits in the range */ int effective_bits; /* Effective bits */ long lower_bound; /* "lb" value */ long upper_bound; /* "ub" value */ } asn_per_constraint_t; typedef const struct asn_per_constraints_s { struct asn_per_constraint_s value; struct asn_per_constraint_s size; int (*value2code)(unsigned int value); int (*code2value)(unsigned int code); } asn_per_constraints_t; /* * This structure describes a position inside an incoming PER bit stream. */ typedef struct asn_per_data_s { const uint8_t *buffer; /* Pointer to the octet stream */ size_t nboff; /* Bit offset to the meaningful bit */ size_t nbits; /* Number of bits in the stream */ size_t moved; /* Number of bits moved through this bit stream */ int (*refill)(struct asn_per_data_s *); void *refill_key; } asn_per_data_t; /* * Extract a small number of bits (<= 31) from the specified PER data pointer. * This function returns -1 if the specified number of bits could not be * extracted due to EOD or other conditions. */ int32_t per_get_few_bits(asn_per_data_t *per_data, int get_nbits); /* Undo the immediately preceeding "get_few_bits" operation */ void per_get_undo(asn_per_data_t *per_data, int get_nbits); /* * Extract a large number of bits from the specified PER data pointer. * This function returns -1 if the specified number of bits could not be * extracted due to EOD or other conditions. */ int per_get_many_bits(asn_per_data_t *pd, uint8_t *dst, int right_align, int get_nbits); /* * Get the length "n" from the Unaligned PER stream. */ ssize_t uper_get_length(asn_per_data_t *pd, int effective_bound_bits, int *repeat); /* * Get the normally small length "n". */ ssize_t uper_get_nslength(asn_per_data_t *pd); /* * Get the normally small non-negative whole number. */ ssize_t uper_get_nsnnwn(asn_per_data_t *pd); /* X.691-2008/11, #11.5.6 */ int uper_get_constrained_whole_number(asn_per_data_t *pd, unsigned long *v, int nbits); /* Non-thread-safe debugging function, don't use it */ char *per_data_string(asn_per_data_t *pd); /* * This structure supports forming PER output. */ typedef struct asn_per_outp_s { uint8_t *buffer; /* Pointer into the (tmpspace) */ size_t nboff; /* Bit offset to the meaningful bit */ size_t nbits; /* Number of bits left in (tmpspace) */ uint8_t tmpspace[32]; /* Preliminary storage to hold data */ int (*outper)(const void *data, size_t size, void *op_key); void *op_key; /* Key for (outper) data callback */ size_t flushed_bytes; /* Bytes already flushed through (outper) */ } asn_per_outp_t; /* Output a small number of bits (<= 31) */ int per_put_few_bits(asn_per_outp_t *per_data, uint32_t bits, int obits); /* Output a large number of bits */ int per_put_many_bits(asn_per_outp_t *po, const uint8_t *src, int put_nbits); /* X.691-2008/11, #11.5 */ int uper_put_constrained_whole_number_s(asn_per_outp_t *po, long v, int nbits); int uper_put_constrained_whole_number_u(asn_per_outp_t *po, unsigned long v, int nbits); /* * Put the length "n" to the Unaligned PER stream. * This function returns the number of units which may be flushed * in the next units saving iteration. */ ssize_t uper_put_length(asn_per_outp_t *po, size_t whole_length); /* * Put the normally small length "n" to the Unaligned PER stream. * Returns 0 or -1. */ int uper_put_nslength(asn_per_outp_t *po, size_t length); /* * Put the normally small non-negative whole number. */ int uper_put_nsnnwn(asn_per_outp_t *po, int n); #ifdef __cplusplus } #endif #endif /* _PER_SUPPORT_H_ */ asn1c-0.9.28+dfsg/skeletons/ObjectDescriptor.c0000644000000000000000000000236013065714043017660 0ustar rootroot/*- * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #include #include /* * ObjectDescriptor basic type description. */ static const ber_tlv_tag_t asn_DEF_ObjectDescriptor_tags[] = { (ASN_TAG_CLASS_UNIVERSAL | (7 << 2)), /* [UNIVERSAL 7] IMPLICIT ... */ (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */ }; asn_TYPE_descriptor_t asn_DEF_ObjectDescriptor = { "ObjectDescriptor", "ObjectDescriptor", OCTET_STRING_free, OCTET_STRING_print_utf8, /* Treat as ASCII subset (it's not) */ asn_generic_unknown_constraint, OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */ OCTET_STRING_encode_der, OCTET_STRING_decode_xer_utf8, OCTET_STRING_encode_xer_utf8, OCTET_STRING_decode_uper, OCTET_STRING_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_ObjectDescriptor_tags, sizeof(asn_DEF_ObjectDescriptor_tags) / sizeof(asn_DEF_ObjectDescriptor_tags[0]) - 1, asn_DEF_ObjectDescriptor_tags, sizeof(asn_DEF_ObjectDescriptor_tags) / sizeof(asn_DEF_ObjectDescriptor_tags[0]), 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; asn1c-0.9.28+dfsg/skeletons/ISO646String.h0000644000000000000000000000076313065714043016506 0ustar rootroot/*- * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef _ISO646String_H_ #define _ISO646String_H_ #include #include #ifdef __cplusplus extern "C" { #endif typedef VisibleString_t ISO646String_t; /* Implemented using VisibleString */ extern asn_TYPE_descriptor_t asn_DEF_ISO646String; #ifdef __cplusplus } #endif #endif /* _ISO646String_H_ */ asn1c-0.9.28+dfsg/skeletons/UTCTime.c0000644000000000000000000001065713065714043015675 0ustar rootroot/*- * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #include #include #include #include #ifdef __CYGWIN__ #include "/usr/include/time.h" #else #include #endif /* __CYGWIN__ */ #ifndef ASN___INTERNAL_TEST_MODE /* * UTCTime basic type description. */ static const ber_tlv_tag_t asn_DEF_UTCTime_tags[] = { (ASN_TAG_CLASS_UNIVERSAL | (23 << 2)), /* [UNIVERSAL 23] IMPLICIT ...*/ (ASN_TAG_CLASS_UNIVERSAL | (26 << 2)), /* [UNIVERSAL 26] IMPLICIT ...*/ (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */ }; static asn_per_constraints_t asn_DEF_UTCTime_constraints = { { APC_CONSTRAINED, 7, 7, 0x20, 0x7e }, /* Value */ { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 }, /* Size */ 0, 0 }; asn_TYPE_descriptor_t asn_DEF_UTCTime = { "UTCTime", "UTCTime", OCTET_STRING_free, UTCTime_print, UTCTime_constraint, OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */ OCTET_STRING_encode_der, /* Implemented in terms of OCTET STRING */ OCTET_STRING_decode_xer_utf8, UTCTime_encode_xer, OCTET_STRING_decode_uper, OCTET_STRING_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_UTCTime_tags, sizeof(asn_DEF_UTCTime_tags) / sizeof(asn_DEF_UTCTime_tags[0]) - 2, asn_DEF_UTCTime_tags, sizeof(asn_DEF_UTCTime_tags) / sizeof(asn_DEF_UTCTime_tags[0]), &asn_DEF_UTCTime_constraints, 0, 0, /* No members */ 0 /* No specifics */ }; #endif /* ASN___INTERNAL_TEST_MODE */ /* * Check that the time looks like the time. */ int UTCTime_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const UTCTime_t *st = (const UTCTime_t *)sptr; time_t tloc; errno = EPERM; /* Just an unlikely error code */ tloc = asn_UT2time(st, 0, 0); if(tloc == -1 && errno != EPERM) { ASN__CTFAIL(app_key, td, sptr, "%s: Invalid time format: %s (%s:%d)", td->name, strerror(errno), __FILE__, __LINE__); return -1; } return 0; } #ifndef ASN___INTERNAL_TEST_MODE asn_enc_rval_t UTCTime_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { if(flags & XER_F_CANONICAL) { asn_enc_rval_t rv; UTCTime_t *ut; struct tm tm; errno = EPERM; if(asn_UT2time((UTCTime_t *)sptr, &tm, 1) == -1 && errno != EPERM) ASN__ENCODE_FAILED; /* Fractions are not allowed in UTCTime */ ut = asn_time2GT(0, 0, 1); if(!ut) ASN__ENCODE_FAILED; rv = OCTET_STRING_encode_xer_utf8(td, sptr, ilevel, flags, cb, app_key); OCTET_STRING_free(&asn_DEF_UTCTime, ut, 0); return rv; } else { return OCTET_STRING_encode_xer_utf8(td, sptr, ilevel, flags, cb, app_key); } } #endif /* ASN___INTERNAL_TEST_MODE */ int UTCTime_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { const UTCTime_t *st = (const UTCTime_t *)sptr; (void)td; /* Unused argument */ (void)ilevel; /* Unused argument */ if(st && st->buf) { char buf[32]; struct tm tm; int ret; errno = EPERM; if(asn_UT2time(st, &tm, 1) == -1 && errno != EPERM) return (cb("", 11, app_key) < 0) ? -1 : 0; ret = snprintf(buf, sizeof(buf), "%04d-%02d-%02d %02d:%02d:%02d (GMT)", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec); assert(ret > 0 && ret < (int)sizeof(buf)); return (cb(buf, ret, app_key) < 0) ? -1 : 0; } else { return (cb("", 8, app_key) < 0) ? -1 : 0; } } time_t asn_UT2time(const UTCTime_t *st, struct tm *_tm, int as_gmt) { char buf[24]; /* "AAMMJJhhmmss+hhmm" + cushion */ GeneralizedTime_t gt; if(!st || !st->buf || st->size < 11 || st->size >= ((int)sizeof(buf) - 2)) { errno = EINVAL; return -1; } gt.buf = (unsigned char *)buf; gt.size = st->size + 2; memcpy(gt.buf + 2, st->buf, st->size); if(st->buf[0] > 0x35) { /* 19xx */ gt.buf[0] = 0x31; gt.buf[1] = 0x39; } else { /* 20xx */ gt.buf[0] = 0x32; gt.buf[1] = 0x30; } return asn_GT2time(>, _tm, as_gmt); } UTCTime_t * asn_time2UT(UTCTime_t *opt_ut, const struct tm *tm, int force_gmt) { GeneralizedTime_t *gt = (GeneralizedTime_t *)opt_ut; gt = asn_time2GT(gt, tm, force_gmt); if(gt == 0) return 0; assert(gt->size >= 2); gt->size -= 2; memmove(gt->buf, gt->buf + 2, gt->size + 1); return (UTCTime_t *)gt; } asn1c-0.9.28+dfsg/skeletons/ber_tlv_tag.c0000644000000000000000000000615613065714043016712 0ustar rootroot/*- * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #include #include #include ssize_t ber_fetch_tag(const void *ptr, size_t size, ber_tlv_tag_t *tag_r) { ber_tlv_tag_t val; ber_tlv_tag_t tclass; size_t skipped; if(size == 0) return 0; val = *(const uint8_t *)ptr; tclass = (val >> 6); if((val &= 0x1F) != 0x1F) { /* * Simple form: everything encoded in a single octet. * Tag Class is encoded using two least significant bits. */ *tag_r = (val << 2) | tclass; return 1; } /* * Each octet contains 7 bits of useful information. * The MSB is 0 if it is the last octet of the tag. */ for(val = 0, ptr = ((const char *)ptr) + 1, skipped = 2; skipped <= size; ptr = ((const char *)ptr) + 1, skipped++) { unsigned int oct = *(const uint8_t *)ptr; if(oct & 0x80) { val = (val << 7) | (oct & 0x7F); /* * Make sure there are at least 9 bits spare * at the MS side of a value. */ if(val >> ((8 * sizeof(val)) - 9)) { /* * We would not be able to accomodate * any more tag bits. */ return -1; } } else { val = (val << 7) | oct; *tag_r = (val << 2) | tclass; return skipped; } } return 0; /* Want more */ } ssize_t ber_tlv_tag_fwrite(ber_tlv_tag_t tag, FILE *f) { char buf[sizeof("[APPLICATION ]") + 32]; ssize_t ret; ret = ber_tlv_tag_snprint(tag, buf, sizeof(buf)); if(ret >= (ssize_t)sizeof(buf) || ret < 2) { errno = EPERM; return -1; } return fwrite(buf, 1, ret, f); } ssize_t ber_tlv_tag_snprint(ber_tlv_tag_t tag, char *buf, size_t size) { char *type = 0; int ret; switch(tag & 0x3) { case ASN_TAG_CLASS_UNIVERSAL: type = "UNIVERSAL "; break; case ASN_TAG_CLASS_APPLICATION: type = "APPLICATION "; break; case ASN_TAG_CLASS_CONTEXT: type = ""; break; case ASN_TAG_CLASS_PRIVATE: type = "PRIVATE "; break; } ret = snprintf(buf, size, "[%s%u]", type, ((unsigned)tag) >> 2); if(ret <= 0 && size) buf[0] = '\0'; /* against broken libc's */ return ret; } char * ber_tlv_tag_string(ber_tlv_tag_t tag) { static char buf[sizeof("[APPLICATION ]") + 32]; (void)ber_tlv_tag_snprint(tag, buf, sizeof(buf)); return buf; } size_t ber_tlv_tag_serialize(ber_tlv_tag_t tag, void *bufp, size_t size) { int tclass = BER_TAG_CLASS(tag); ber_tlv_tag_t tval = BER_TAG_VALUE(tag); uint8_t *buf = (uint8_t *)bufp; uint8_t *end; size_t required_size; size_t i; if(tval <= 30) { /* Encoded in 1 octet */ if(size) buf[0] = (tclass << 6) | tval; return 1; } else if(size) { *buf++ = (tclass << 6) | 0x1F; size--; } /* * Compute the size of the subsequent bytes. */ for(required_size = 1, i = 7; i < 8 * sizeof(tval); i += 7) { if(tval >> i) required_size++; else break; } if(size < required_size) return required_size + 1; /* * Fill in the buffer, space permitting. */ end = buf + required_size - 1; for(i -= 7; buf < end; i -= 7, buf++) *buf = 0x80 | ((tval >> i) & 0x7F); *buf = (tval & 0x7F); /* Last octet without high bit */ return required_size + 1; } asn1c-0.9.28+dfsg/skeletons/asn_application.h0000644000000000000000000000271013065714043017563 0ustar rootroot/*- * Copyright (c) 2004, 2006 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ /* * Application-level ASN.1 callbacks. */ #ifndef ASN_APPLICATION_H #define ASN_APPLICATION_H #include "asn_system.h" /* for platform-dependent types */ #include "asn_codecs.h" /* for ASN.1 codecs specifics */ #ifdef __cplusplus extern "C" { #endif /* * Generic type of an application-defined callback to return various * types of data to the application. * EXPECTED RETURN VALUES: * -1: Failed to consume bytes. Abort the mission. * Non-negative return values indicate success, and ignored. */ typedef int (asn_app_consume_bytes_f)(const void *buffer, size_t size, void *application_specific_key); /* * A callback of this type is called whenever constraint validation fails * on some ASN.1 type. See "constraints.h" for more details on constraint * validation. * This callback specifies a descriptor of the ASN.1 type which failed * the constraint check, as well as human readable message on what * particular constraint has failed. */ typedef void (asn_app_constraint_failed_f)(void *application_specific_key, struct asn_TYPE_descriptor_s *type_descriptor_which_failed, const void *structure_which_failed_ptr, const char *error_message_format, ...) GCC_PRINTFLIKE(4, 5); #ifdef __cplusplus } #endif #include "constr_TYPE.h" /* for asn_TYPE_descriptor_t */ #endif /* ASN_APPLICATION_H */ asn1c-0.9.28+dfsg/skeletons/constr_CHOICE.h0000644000000000000000000000260213065714043016741 0ustar rootroot/*- * Copyright (c) 2003, 2004, 2005 Lev Walkin . * All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef _CONSTR_CHOICE_H_ #define _CONSTR_CHOICE_H_ #include #ifdef __cplusplus extern "C" { #endif typedef const struct asn_CHOICE_specifics_s { /* * Target structure description. */ int struct_size; /* Size of the target structure. */ int ctx_offset; /* Offset of the asn_codec_ctx_t member */ int pres_offset; /* Identifier of the present member */ int pres_size; /* Size of the identifier (enum) */ /* * Tags to members mapping table. */ const asn_TYPE_tag2member_t *tag2el; int tag2el_count; /* Canonical ordering of CHOICE elements, for PER */ int *canonical_order; /* * Extensions-related stuff. */ int ext_start; /* First member of extensions, or -1 */ } asn_CHOICE_specifics_t; /* * A set specialized functions dealing with the CHOICE type. */ asn_struct_free_f CHOICE_free; asn_struct_print_f CHOICE_print; asn_constr_check_f CHOICE_constraint; ber_type_decoder_f CHOICE_decode_ber; der_type_encoder_f CHOICE_encode_der; xer_type_decoder_f CHOICE_decode_xer; xer_type_encoder_f CHOICE_encode_xer; per_type_decoder_f CHOICE_decode_uper; per_type_encoder_f CHOICE_encode_uper; asn_outmost_tag_f CHOICE_outmost_tag; #ifdef __cplusplus } #endif #endif /* _CONSTR_CHOICE_H_ */ asn1c-0.9.28+dfsg/skeletons/NativeEnumerated.c0000644000000000000000000001344213065714043017656 0ustar rootroot/*- * Copyright (c) 2004, 2007 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ /* * Read the NativeInteger.h for the explanation wrt. differences between * INTEGER and NativeInteger. * Basically, both are decoders and encoders of ASN.1 INTEGER type, but this * implementation deals with the standard (machine-specific) representation * of them instead of using the platform-independent buffer. */ #include #include /* * NativeEnumerated basic type description. */ static const ber_tlv_tag_t asn_DEF_NativeEnumerated_tags[] = { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) }; asn_TYPE_descriptor_t asn_DEF_NativeEnumerated = { "ENUMERATED", /* The ASN.1 type is still ENUMERATED */ "ENUMERATED", NativeInteger_free, NativeInteger_print, asn_generic_no_constraint, NativeInteger_decode_ber, NativeInteger_encode_der, NativeInteger_decode_xer, NativeEnumerated_encode_xer, NativeEnumerated_decode_uper, NativeEnumerated_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_NativeEnumerated_tags, sizeof(asn_DEF_NativeEnumerated_tags) / sizeof(asn_DEF_NativeEnumerated_tags[0]), asn_DEF_NativeEnumerated_tags, /* Same as above */ sizeof(asn_DEF_NativeEnumerated_tags) / sizeof(asn_DEF_NativeEnumerated_tags[0]), 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; asn_enc_rval_t NativeEnumerated_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; asn_enc_rval_t er; const long *native = (const long *)sptr; const asn_INTEGER_enum_map_t *el; (void)ilevel; (void)flags; if(!native) ASN__ENCODE_FAILED; el = INTEGER_map_value2enum(specs, *native); if(el) { size_t srcsize = el->enum_len + 5; char *src = (char *)alloca(srcsize); er.encoded = snprintf(src, srcsize, "<%s/>", el->enum_name); assert(er.encoded > 0 && (size_t)er.encoded < srcsize); if(cb(src, er.encoded, app_key) < 0) ASN__ENCODE_FAILED; ASN__ENCODED_OK(er); } else { ASN_DEBUG("ASN.1 forbids dealing with " "unknown value of ENUMERATED type"); ASN__ENCODE_FAILED; } } asn_dec_rval_t NativeEnumerated_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics; asn_dec_rval_t rval = { RC_OK, 0 }; long *native = (long *)*sptr; asn_per_constraint_t *ct; long value; (void)opt_codec_ctx; if(constraints) ct = &constraints->value; else if(td->per_constraints) ct = &td->per_constraints->value; else ASN__DECODE_FAILED; /* Mandatory! */ if(!specs) ASN__DECODE_FAILED; if(!native) { native = (long *)(*sptr = CALLOC(1, sizeof(*native))); if(!native) ASN__DECODE_FAILED; } ASN_DEBUG("Decoding %s as NativeEnumerated", td->name); if(ct->flags & APC_EXTENSIBLE) { int inext = per_get_few_bits(pd, 1); if(inext < 0) ASN__DECODE_STARVED; if(inext) ct = 0; } if(ct && ct->range_bits >= 0) { value = per_get_few_bits(pd, ct->range_bits); if(value < 0) ASN__DECODE_STARVED; if(value >= (specs->extension ? specs->extension - 1 : specs->map_count)) ASN__DECODE_FAILED; } else { if(!specs->extension) ASN__DECODE_FAILED; /* * X.691, #10.6: normally small non-negative whole number; */ value = uper_get_nsnnwn(pd); if(value < 0) ASN__DECODE_STARVED; value += specs->extension - 1; if(value >= specs->map_count) ASN__DECODE_FAILED; } *native = specs->value2enum[value].nat_value; ASN_DEBUG("Decoded %s = %ld", td->name, *native); return rval; } static int NativeEnumerated__compar_value2enum(const void *ap, const void *bp) { const asn_INTEGER_enum_map_t *a = ap; const asn_INTEGER_enum_map_t *b = bp; if(a->nat_value == b->nat_value) return 0; if(a->nat_value < b->nat_value) return -1; return 1; } asn_enc_rval_t NativeEnumerated_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics; asn_enc_rval_t er; long native, value; asn_per_constraint_t *ct; int inext = 0; asn_INTEGER_enum_map_t key; const asn_INTEGER_enum_map_t *kf; if(!sptr) ASN__ENCODE_FAILED; if(!specs) ASN__ENCODE_FAILED; if(constraints) ct = &constraints->value; else if(td->per_constraints) ct = &td->per_constraints->value; else ASN__ENCODE_FAILED; /* Mandatory! */ ASN_DEBUG("Encoding %s as NativeEnumerated", td->name); er.encoded = 0; native = *(long *)sptr; if(native < 0) ASN__ENCODE_FAILED; key.nat_value = native; kf = bsearch(&key, specs->value2enum, specs->map_count, sizeof(key), NativeEnumerated__compar_value2enum); if(!kf) { ASN_DEBUG("No element corresponds to %ld", native); ASN__ENCODE_FAILED; } value = kf - specs->value2enum; if(ct->range_bits >= 0) { int cmpWith = specs->extension ? specs->extension - 1 : specs->map_count; if(value >= cmpWith) inext = 1; } if(ct->flags & APC_EXTENSIBLE) { if(per_put_few_bits(po, inext, 1)) ASN__ENCODE_FAILED; if(inext) ct = 0; } else if(inext) { ASN__ENCODE_FAILED; } if(ct && ct->range_bits >= 0) { if(per_put_few_bits(po, value, ct->range_bits)) ASN__ENCODE_FAILED; ASN__ENCODED_OK(er); } if(!specs->extension) ASN__ENCODE_FAILED; /* * X.691, #10.6: normally small non-negative whole number; */ ASN_DEBUG("value = %ld, ext = %d, inext = %d, res = %ld", value, specs->extension, inext, value - (inext ? (specs->extension - 1) : 0)); if(uper_put_nsnnwn(po, value - (inext ? (specs->extension - 1) : 0))) ASN__ENCODE_FAILED; ASN__ENCODED_OK(er); } asn1c-0.9.28+dfsg/skeletons/OCTET_STRING.h0000644000000000000000000000541113065714043016364 0ustar rootroot/*- * Copyright (c) 2003 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef _OCTET_STRING_H_ #define _OCTET_STRING_H_ #include #ifdef __cplusplus extern "C" { #endif typedef struct OCTET_STRING { uint8_t *buf; /* Buffer with consecutive OCTET_STRING bits */ int size; /* Size of the buffer */ asn_struct_ctx_t _asn_ctx; /* Parsing across buffer boundaries */ } OCTET_STRING_t; extern asn_TYPE_descriptor_t asn_DEF_OCTET_STRING; asn_struct_free_f OCTET_STRING_free; asn_struct_print_f OCTET_STRING_print; asn_struct_print_f OCTET_STRING_print_utf8; ber_type_decoder_f OCTET_STRING_decode_ber; der_type_encoder_f OCTET_STRING_encode_der; xer_type_decoder_f OCTET_STRING_decode_xer_hex; /* Hexadecimal */ xer_type_decoder_f OCTET_STRING_decode_xer_binary; /* 01010111010 */ xer_type_decoder_f OCTET_STRING_decode_xer_utf8; /* ASCII/UTF-8 */ xer_type_encoder_f OCTET_STRING_encode_xer; xer_type_encoder_f OCTET_STRING_encode_xer_utf8; per_type_decoder_f OCTET_STRING_decode_uper; per_type_encoder_f OCTET_STRING_encode_uper; /****************************** * Handy conversion routines. * ******************************/ /* * This function clears the previous value of the OCTET STRING (if any) * and then allocates a new memory with the specified content (str/size). * If size = -1, the size of the original string will be determined * using strlen(str). * If str equals to NULL, the function will silently clear the * current contents of the OCTET STRING. * Returns 0 if it was possible to perform operation, -1 otherwise. */ int OCTET_STRING_fromBuf(OCTET_STRING_t *s, const char *str, int size); /* Handy conversion from the C string into the OCTET STRING. */ #define OCTET_STRING_fromString(s, str) OCTET_STRING_fromBuf(s, str, -1) /* * Allocate and fill the new OCTET STRING and return a pointer to the newly * allocated object. NULL is permitted in str: the function will just allocate * empty OCTET STRING. */ OCTET_STRING_t *OCTET_STRING_new_fromBuf(asn_TYPE_descriptor_t *td, const char *str, int size); /**************************** * Internally useful stuff. * ****************************/ typedef const struct asn_OCTET_STRING_specifics_s { /* * Target structure description. */ int struct_size; /* Size of the structure */ int ctx_offset; /* Offset of the asn_struct_ctx_t member */ enum asn_OS_Subvariant { ASN_OSUBV_ANY, /* The open type (ANY) */ ASN_OSUBV_BIT, /* BIT STRING */ ASN_OSUBV_STR, /* String types, not {BMP,Universal}String */ ASN_OSUBV_U16, /* 16-bit character (BMPString) */ ASN_OSUBV_U32 /* 32-bit character (UniversalString) */ } subvariant; } asn_OCTET_STRING_specifics_t; #ifdef __cplusplus } #endif #endif /* _OCTET_STRING_H_ */ asn1c-0.9.28+dfsg/skeletons/constr_SET_OF.c0000644000000000000000000005604513065714043017033 0ustar rootroot/*- * Copyright (c) 2003, 2004, 2005 Lev Walkin . * All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #include #include #include /* * Number of bytes left for this structure. * (ctx->left) indicates the number of bytes _transferred_ for the structure. * (size) contains the number of bytes in the buffer passed. */ #define LEFT ((size<(size_t)ctx->left)?size:(size_t)ctx->left) /* * If the subprocessor function returns with an indication that it wants * more data, it may well be a fatal decoding problem, because the * size is constrained by the 's L, even if the buffer size allows * reading more data. * For example, consider the buffer containing the following TLVs: * ... * The TLV length clearly indicates that one byte is expected in V, but * if the V processor returns with "want more data" even if the buffer * contains way more data than the V processor have seen. */ #define SIZE_VIOLATION (ctx->left >= 0 && (size_t)ctx->left <= size) /* * This macro "eats" the part of the buffer which is definitely "consumed", * i.e. was correctly converted into local representation or rightfully skipped. */ #undef ADVANCE #define ADVANCE(num_bytes) do { \ size_t num = num_bytes; \ ptr = ((const char *)ptr) + num;\ size -= num; \ if(ctx->left >= 0) \ ctx->left -= num; \ consumed_myself += num; \ } while(0) /* * Switch to the next phase of parsing. */ #undef NEXT_PHASE #undef PHASE_OUT #define NEXT_PHASE(ctx) do { \ ctx->phase++; \ ctx->step = 0; \ } while(0) #define PHASE_OUT(ctx) do { ctx->phase = 10; } while(0) /* * Return a standardized complex structure. */ #undef RETURN #define RETURN(_code) do { \ rval.code = _code; \ rval.consumed = consumed_myself;\ return rval; \ } while(0) /* * The decoder of the SET OF type. */ asn_dec_rval_t SET_OF_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **struct_ptr, const void *ptr, size_t size, int tag_mode) { /* * Bring closer parts of structure description. */ asn_SET_OF_specifics_t *specs = (asn_SET_OF_specifics_t *)td->specifics; asn_TYPE_member_t *elm = td->elements; /* Single one */ /* * Parts of the structure being constructed. */ void *st = *struct_ptr; /* Target structure. */ asn_struct_ctx_t *ctx; /* Decoder context */ ber_tlv_tag_t tlv_tag; /* T from TLV */ asn_dec_rval_t rval; /* Return code from subparsers */ ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ ASN_DEBUG("Decoding %s as SET OF", td->name); /* * Create the target structure if it is not present already. */ if(st == 0) { st = *struct_ptr = CALLOC(1, specs->struct_size); if(st == 0) { RETURN(RC_FAIL); } } /* * Restore parsing context. */ ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); /* * Start to parse where left previously */ switch(ctx->phase) { case 0: /* * PHASE 0. * Check that the set of tags associated with given structure * perfectly fits our expectations. */ rval = ber_check_tags(opt_codec_ctx, td, ctx, ptr, size, tag_mode, 1, &ctx->left, 0); if(rval.code != RC_OK) { ASN_DEBUG("%s tagging check failed: %d", td->name, rval.code); return rval; } if(ctx->left >= 0) ctx->left += rval.consumed; /* ?Substracted below! */ ADVANCE(rval.consumed); ASN_DEBUG("Structure consumes %ld bytes, " "buffer %ld", (long)ctx->left, (long)size); NEXT_PHASE(ctx); /* Fall through */ case 1: /* * PHASE 1. * From the place where we've left it previously, * try to decode the next item. */ for(;; ctx->step = 0) { ssize_t tag_len; /* Length of TLV's T */ if(ctx->step & 1) goto microphase2; /* * MICROPHASE 1: Synchronize decoding. */ if(ctx->left == 0) { ASN_DEBUG("End of SET OF %s", td->name); /* * No more things to decode. * Exit out of here. */ PHASE_OUT(ctx); RETURN(RC_OK); } /* * Fetch the T from TLV. */ tag_len = ber_fetch_tag(ptr, LEFT, &tlv_tag); switch(tag_len) { case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); /* Fall through */ case -1: RETURN(RC_FAIL); } if(ctx->left < 0 && ((const uint8_t *)ptr)[0] == 0) { if(LEFT < 2) { if(SIZE_VIOLATION) RETURN(RC_FAIL); else RETURN(RC_WMORE); } else if(((const uint8_t *)ptr)[1] == 0) { /* * Found the terminator of the * indefinite length structure. */ break; } } /* Outmost tag may be unknown and cannot be fetched/compared */ if(elm->tag != (ber_tlv_tag_t)-1) { if(BER_TAGS_EQUAL(tlv_tag, elm->tag)) { /* * The new list member of expected type has arrived. */ } else { ASN_DEBUG("Unexpected tag %s fixed SET OF %s", ber_tlv_tag_string(tlv_tag), td->name); ASN_DEBUG("%s SET OF has tag %s", td->name, ber_tlv_tag_string(elm->tag)); RETURN(RC_FAIL); } } /* * MICROPHASE 2: Invoke the member-specific decoder. */ ctx->step |= 1; /* Confirm entering next microphase */ microphase2: /* * Invoke the member fetch routine according to member's type */ rval = elm->type->ber_decoder(opt_codec_ctx, elm->type, &ctx->ptr, ptr, LEFT, 0); ASN_DEBUG("In %s SET OF %s code %d consumed %d", td->name, elm->type->name, rval.code, (int)rval.consumed); switch(rval.code) { case RC_OK: { asn_anonymous_set_ *list = _A_SET_FROM_VOID(st); if(ASN_SET_ADD(list, ctx->ptr) != 0) RETURN(RC_FAIL); else ctx->ptr = 0; } break; case RC_WMORE: /* More data expected */ if(!SIZE_VIOLATION) { ADVANCE(rval.consumed); RETURN(RC_WMORE); } /* Fall through */ case RC_FAIL: /* Fatal error */ ASN_STRUCT_FREE(*elm->type, ctx->ptr); ctx->ptr = 0; RETURN(RC_FAIL); } /* switch(rval) */ ADVANCE(rval.consumed); } /* for(all list members) */ NEXT_PHASE(ctx); case 2: /* * Read in all "end of content" TLVs. */ while(ctx->left < 0) { if(LEFT < 2) { if(LEFT > 0 && ((const char *)ptr)[0] != 0) { /* Unexpected tag */ RETURN(RC_FAIL); } else { RETURN(RC_WMORE); } } if(((const char *)ptr)[0] == 0 && ((const char *)ptr)[1] == 0) { ADVANCE(2); ctx->left++; } else { RETURN(RC_FAIL); } } PHASE_OUT(ctx); } RETURN(RC_OK); } /* * Internally visible buffer holding a single encoded element. */ struct _el_buffer { uint8_t *buf; size_t length; size_t size; }; /* Append bytes to the above structure */ static int _el_addbytes(const void *buffer, size_t size, void *el_buf_ptr) { struct _el_buffer *el_buf = (struct _el_buffer *)el_buf_ptr; if(el_buf->length + size > el_buf->size) return -1; memcpy(el_buf->buf + el_buf->length, buffer, size); el_buf->length += size; return 0; } static int _el_buf_cmp(const void *ap, const void *bp) { const struct _el_buffer *a = (const struct _el_buffer *)ap; const struct _el_buffer *b = (const struct _el_buffer *)bp; int ret; size_t common_len; if(a->length < b->length) common_len = a->length; else common_len = b->length; ret = memcmp(a->buf, b->buf, common_len); if(ret == 0) { if(a->length < b->length) ret = -1; else if(a->length > b->length) ret = 1; } return ret; } /* * The DER encoder of the SET OF type. */ asn_enc_rval_t SET_OF_encode_der(asn_TYPE_descriptor_t *td, void *ptr, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { asn_TYPE_member_t *elm = td->elements; asn_TYPE_descriptor_t *elm_type = elm->type; der_type_encoder_f *der_encoder = elm_type->der_encoder; asn_anonymous_set_ *list = _A_SET_FROM_VOID(ptr); size_t computed_size = 0; ssize_t encoding_size = 0; struct _el_buffer *encoded_els; ssize_t eels_count = 0; size_t max_encoded_len = 1; asn_enc_rval_t erval; int ret; int edx; ASN_DEBUG("Estimating size for SET OF %s", td->name); /* * Gather the length of the underlying members sequence. */ for(edx = 0; edx < list->count; edx++) { void *memb_ptr = list->array[edx]; if(!memb_ptr) continue; erval = der_encoder(elm_type, memb_ptr, 0, elm->tag, 0, 0); if(erval.encoded == -1) return erval; computed_size += erval.encoded; /* Compute maximum encoding's size */ if(max_encoded_len < (size_t)erval.encoded) max_encoded_len = erval.encoded; } /* * Encode the TLV for the sequence itself. */ encoding_size = der_write_tags(td, computed_size, tag_mode, 1, tag, cb, app_key); if(encoding_size == -1) { erval.encoded = -1; erval.failed_type = td; erval.structure_ptr = ptr; return erval; } computed_size += encoding_size; if(!cb || list->count == 0) { erval.encoded = computed_size; ASN__ENCODED_OK(erval); } /* * DER mandates dynamic sorting of the SET OF elements * according to their encodings. Build an array of the * encoded elements. */ encoded_els = (struct _el_buffer *)MALLOC( list->count * sizeof(encoded_els[0])); if(encoded_els == NULL) { erval.encoded = -1; erval.failed_type = td; erval.structure_ptr = ptr; return erval; } ASN_DEBUG("Encoding members of %s SET OF", td->name); /* * Encode all members. */ for(edx = 0; edx < list->count; edx++) { void *memb_ptr = list->array[edx]; struct _el_buffer *encoded_el = &encoded_els[eels_count]; if(!memb_ptr) continue; /* * Prepare space for encoding. */ encoded_el->buf = (uint8_t *)MALLOC(max_encoded_len); if(encoded_el->buf) { encoded_el->length = 0; encoded_el->size = max_encoded_len; } else { for(edx--; edx >= 0; edx--) FREEMEM(encoded_els[edx].buf); FREEMEM(encoded_els); erval.encoded = -1; erval.failed_type = td; erval.structure_ptr = ptr; return erval; } /* * Encode the member into the prepared space. */ erval = der_encoder(elm_type, memb_ptr, 0, elm->tag, _el_addbytes, encoded_el); if(erval.encoded == -1) { for(; edx >= 0; edx--) FREEMEM(encoded_els[edx].buf); FREEMEM(encoded_els); return erval; } encoding_size += erval.encoded; eels_count++; } /* * Sort the encoded elements according to their encoding. */ qsort(encoded_els, eels_count, sizeof(encoded_els[0]), _el_buf_cmp); /* * Report encoded elements to the application. * Dispose of temporary sorted members table. */ ret = 0; for(edx = 0; edx < eels_count; edx++) { struct _el_buffer *encoded_el = &encoded_els[edx]; /* Report encoded chunks to the application */ if(ret == 0 && cb(encoded_el->buf, encoded_el->length, app_key) < 0) ret = -1; FREEMEM(encoded_el->buf); } FREEMEM(encoded_els); if(ret || computed_size != (size_t)encoding_size) { /* * Standard callback failed, or * encoded size is not equal to the computed size. */ erval.encoded = -1; erval.failed_type = td; erval.structure_ptr = ptr; } else { erval.encoded = computed_size; } ASN__ENCODED_OK(erval); } #undef XER_ADVANCE #define XER_ADVANCE(num_bytes) do { \ size_t num = num_bytes; \ buf_ptr = ((const char *)buf_ptr) + num;\ size -= num; \ consumed_myself += num; \ } while(0) /* * Decode the XER (XML) data. */ asn_dec_rval_t SET_OF_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **struct_ptr, const char *opt_mname, const void *buf_ptr, size_t size) { /* * Bring closer parts of structure description. */ asn_SET_OF_specifics_t *specs = (asn_SET_OF_specifics_t *)td->specifics; asn_TYPE_member_t *element = td->elements; const char *elm_tag; const char *xml_tag = opt_mname ? opt_mname : td->xml_tag; /* * ... and parts of the structure being constructed. */ void *st = *struct_ptr; /* Target structure. */ asn_struct_ctx_t *ctx; /* Decoder context */ asn_dec_rval_t rval; /* Return value from a decoder */ ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ /* * Create the target structure if it is not present already. */ if(st == 0) { st = *struct_ptr = CALLOC(1, specs->struct_size); if(st == 0) RETURN(RC_FAIL); } /* Which tag is expected for the downstream */ if(specs->as_XMLValueList) { elm_tag = (specs->as_XMLValueList == 1) ? 0 : ""; } else { elm_tag = (*element->name) ? element->name : element->type->xml_tag; } /* * Restore parsing context. */ ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); /* * Phases of XER/XML processing: * Phase 0: Check that the opening tag matches our expectations. * Phase 1: Processing body and reacting on closing tag. * Phase 2: Processing inner type. */ for(; ctx->phase <= 2;) { pxer_chunk_type_e ch_type; /* XER chunk type */ ssize_t ch_size; /* Chunk size */ xer_check_tag_e tcv; /* Tag check value */ /* * Go inside the inner member of a set. */ if(ctx->phase == 2) { asn_dec_rval_t tmprval; /* Invoke the inner type decoder, m.b. multiple times */ ASN_DEBUG("XER/SET OF element [%s]", elm_tag); tmprval = element->type->xer_decoder(opt_codec_ctx, element->type, &ctx->ptr, elm_tag, buf_ptr, size); if(tmprval.code == RC_OK) { asn_anonymous_set_ *list = _A_SET_FROM_VOID(st); if(ASN_SET_ADD(list, ctx->ptr) != 0) RETURN(RC_FAIL); ctx->ptr = 0; XER_ADVANCE(tmprval.consumed); } else { XER_ADVANCE(tmprval.consumed); RETURN(tmprval.code); } ctx->phase = 1; /* Back to body processing */ ASN_DEBUG("XER/SET OF phase => %d", ctx->phase); /* Fall through */ } /* * Get the next part of the XML stream. */ ch_size = xer_next_token(&ctx->context, buf_ptr, size, &ch_type); if(ch_size == -1) { RETURN(RC_FAIL); } else { switch(ch_type) { case PXER_WMORE: RETURN(RC_WMORE); case PXER_COMMENT: /* Got XML comment */ case PXER_TEXT: /* Ignore free-standing text */ XER_ADVANCE(ch_size); /* Skip silently */ continue; case PXER_TAG: break; /* Check the rest down there */ } } tcv = xer_check_tag(buf_ptr, ch_size, xml_tag); ASN_DEBUG("XER/SET OF: tcv = %d, ph=%d t=%s", tcv, ctx->phase, xml_tag); switch(tcv) { case XCT_CLOSING: if(ctx->phase == 0) break; ctx->phase = 0; /* Fall through */ case XCT_BOTH: if(ctx->phase == 0) { /* No more things to decode */ XER_ADVANCE(ch_size); ctx->phase = 3; /* Phase out */ RETURN(RC_OK); } /* Fall through */ case XCT_OPENING: if(ctx->phase == 0) { XER_ADVANCE(ch_size); ctx->phase = 1; /* Processing body phase */ continue; } /* Fall through */ case XCT_UNKNOWN_OP: case XCT_UNKNOWN_BO: ASN_DEBUG("XER/SET OF: tcv=%d, ph=%d", tcv, ctx->phase); if(ctx->phase == 1) { /* * Process a single possible member. */ ctx->phase = 2; continue; } /* Fall through */ default: break; } ASN_DEBUG("Unexpected XML tag in SET OF"); break; } ctx->phase = 3; /* "Phase out" on hard failure */ RETURN(RC_FAIL); } typedef struct xer_tmp_enc_s { void *buffer; size_t offset; size_t size; } xer_tmp_enc_t; static int SET_OF_encode_xer_callback(const void *buffer, size_t size, void *key) { xer_tmp_enc_t *t = (xer_tmp_enc_t *)key; if(t->offset + size >= t->size) { size_t newsize = (t->size << 2) + size; void *p = REALLOC(t->buffer, newsize); if(!p) return -1; t->buffer = p; t->size = newsize; } memcpy((char *)t->buffer + t->offset, buffer, size); t->offset += size; return 0; } static int SET_OF_xer_order(const void *aptr, const void *bptr) { const xer_tmp_enc_t *a = (const xer_tmp_enc_t *)aptr; const xer_tmp_enc_t *b = (const xer_tmp_enc_t *)bptr; size_t minlen = a->offset; int ret; if(b->offset < minlen) minlen = b->offset; /* Well-formed UTF-8 has this nice lexicographical property... */ ret = memcmp(a->buffer, b->buffer, minlen); if(ret != 0) return ret; if(a->offset == b->offset) return 0; if(a->offset == minlen) return -1; return 1; } asn_enc_rval_t SET_OF_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { asn_enc_rval_t er; asn_SET_OF_specifics_t *specs = (asn_SET_OF_specifics_t *)td->specifics; asn_TYPE_member_t *elm = td->elements; asn_anonymous_set_ *list = _A_SET_FROM_VOID(sptr); const char *mname = specs->as_XMLValueList ? 0 : ((*elm->name) ? elm->name : elm->type->xml_tag); size_t mlen = mname ? strlen(mname) : 0; int xcan = (flags & XER_F_CANONICAL); xer_tmp_enc_t *encs = 0; size_t encs_count = 0; void *original_app_key = app_key; asn_app_consume_bytes_f *original_cb = cb; int i; if(!sptr) ASN__ENCODE_FAILED; if(xcan) { encs = (xer_tmp_enc_t *)MALLOC(list->count * sizeof(encs[0])); if(!encs) ASN__ENCODE_FAILED; cb = SET_OF_encode_xer_callback; } er.encoded = 0; for(i = 0; i < list->count; i++) { asn_enc_rval_t tmper; void *memb_ptr = list->array[i]; if(!memb_ptr) continue; if(encs) { memset(&encs[encs_count], 0, sizeof(encs[0])); app_key = &encs[encs_count]; encs_count++; } if(mname) { if(!xcan) ASN__TEXT_INDENT(1, ilevel); ASN__CALLBACK3("<", 1, mname, mlen, ">", 1); } if(!xcan && specs->as_XMLValueList == 1) ASN__TEXT_INDENT(1, ilevel + 1); tmper = elm->type->xer_encoder(elm->type, memb_ptr, ilevel + (specs->as_XMLValueList != 2), flags, cb, app_key); if(tmper.encoded == -1) { td = tmper.failed_type; sptr = tmper.structure_ptr; goto cb_failed; } if(tmper.encoded == 0 && specs->as_XMLValueList) { const char *name = elm->type->xml_tag; size_t len = strlen(name); ASN__CALLBACK3("<", 1, name, len, "/>", 2); } if(mname) { ASN__CALLBACK3("", 1); er.encoded += 5; } er.encoded += (2 * mlen) + tmper.encoded; } if(!xcan) ASN__TEXT_INDENT(1, ilevel - 1); if(encs) { xer_tmp_enc_t *enc = encs; xer_tmp_enc_t *end = encs + encs_count; ssize_t control_size = 0; cb = original_cb; app_key = original_app_key; qsort(encs, encs_count, sizeof(encs[0]), SET_OF_xer_order); for(; enc < end; enc++) { ASN__CALLBACK(enc->buffer, enc->offset); FREEMEM(enc->buffer); enc->buffer = 0; control_size += enc->offset; } assert(control_size == er.encoded); } goto cleanup; cb_failed: er.encoded = -1; er.failed_type = td; er.structure_ptr = sptr; cleanup: if(encs) { while(encs_count-- > 0) { if(encs[encs_count].buffer) FREEMEM(encs[encs_count].buffer); } FREEMEM(encs); } ASN__ENCODED_OK(er); } int SET_OF_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { asn_TYPE_member_t *elm = td->elements; const asn_anonymous_set_ *list = _A_CSET_FROM_VOID(sptr); int ret; int i; if(!sptr) return (cb("", 8, app_key) < 0) ? -1 : 0; /* Dump preamble */ if(cb(td->name, strlen(td->name), app_key) < 0 || cb(" ::= {", 6, app_key) < 0) return -1; for(i = 0; i < list->count; i++) { const void *memb_ptr = list->array[i]; if(!memb_ptr) continue; _i_INDENT(1); ret = elm->type->print_struct(elm->type, memb_ptr, ilevel + 1, cb, app_key); if(ret) return ret; } ilevel--; _i_INDENT(1); return (cb("}", 1, app_key) < 0) ? -1 : 0; } void SET_OF_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) { if(td && ptr) { asn_SET_OF_specifics_t *specs; asn_TYPE_member_t *elm = td->elements; asn_anonymous_set_ *list = _A_SET_FROM_VOID(ptr); asn_struct_ctx_t *ctx; /* Decoder context */ int i; /* * Could not use set_of_empty() because of (*free) * incompatibility. */ for(i = 0; i < list->count; i++) { void *memb_ptr = list->array[i]; if(memb_ptr) ASN_STRUCT_FREE(*elm->type, memb_ptr); } list->count = 0; /* No meaningful elements left */ asn_set_empty(list); /* Remove (list->array) */ specs = (asn_SET_OF_specifics_t *)td->specifics; ctx = (asn_struct_ctx_t *)((char *)ptr + specs->ctx_offset); if(ctx->ptr) { ASN_STRUCT_FREE(*elm->type, ctx->ptr); ctx->ptr = 0; } if(!contents_only) { FREEMEM(ptr); } } } int SET_OF_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { asn_TYPE_member_t *elm = td->elements; asn_constr_check_f *constr; const asn_anonymous_set_ *list = _A_CSET_FROM_VOID(sptr); int i; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } constr = elm->memb_constraints; if(!constr) constr = elm->type->check_constraints; /* * Iterate over the members of an array. * Validate each in turn, until one fails. */ for(i = 0; i < list->count; i++) { const void *memb_ptr = list->array[i]; int ret; if(!memb_ptr) continue; ret = constr(elm->type, memb_ptr, ctfailcb, app_key); if(ret) return ret; } /* * Cannot inherit it eralier: * need to make sure we get the updated version. */ if(!elm->memb_constraints) elm->memb_constraints = elm->type->check_constraints; return 0; } asn_dec_rval_t SET_OF_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { asn_dec_rval_t rv; asn_SET_OF_specifics_t *specs = (asn_SET_OF_specifics_t *)td->specifics; asn_TYPE_member_t *elm = td->elements; /* Single one */ void *st = *sptr; asn_anonymous_set_ *list; asn_per_constraint_t *ct; int repeat = 0; ssize_t nelems; if(ASN__STACK_OVERFLOW_CHECK(opt_codec_ctx)) ASN__DECODE_FAILED; /* * Create the target structure if it is not present already. */ if(!st) { st = *sptr = CALLOC(1, specs->struct_size); if(!st) ASN__DECODE_FAILED; } list = _A_SET_FROM_VOID(st); /* Figure out which constraints to use */ if(constraints) ct = &constraints->size; else if(td->per_constraints) ct = &td->per_constraints->size; else ct = 0; if(ct && ct->flags & APC_EXTENSIBLE) { int value = per_get_few_bits(pd, 1); if(value < 0) ASN__DECODE_STARVED; if(value) ct = 0; /* Not restricted! */ } if(ct && ct->effective_bits >= 0) { /* X.691, #19.5: No length determinant */ nelems = per_get_few_bits(pd, ct->effective_bits); ASN_DEBUG("Preparing to fetch %ld+%ld elements from %s", (long)nelems, ct->lower_bound, td->name); if(nelems < 0) ASN__DECODE_STARVED; nelems += ct->lower_bound; } else { nelems = -1; } do { int i; if(nelems < 0) { nelems = uper_get_length(pd, ct ? ct->effective_bits : -1, &repeat); ASN_DEBUG("Got to decode %d elements (eff %d)", (int)nelems, (int)(ct ? ct->effective_bits : -1)); if(nelems < 0) ASN__DECODE_STARVED; } for(i = 0; i < nelems; i++) { void *ptr = 0; ASN_DEBUG("SET OF %s decoding", elm->type->name); rv = elm->type->uper_decoder(opt_codec_ctx, elm->type, elm->per_constraints, &ptr, pd); ASN_DEBUG("%s SET OF %s decoded %d, %p", td->name, elm->type->name, rv.code, ptr); if(rv.code == RC_OK) { if(ASN_SET_ADD(list, ptr) == 0) continue; ASN_DEBUG("Failed to add element into %s", td->name); /* Fall through */ rv.code = RC_FAIL; } else { ASN_DEBUG("Failed decoding %s of %s (SET OF)", elm->type->name, td->name); } if(ptr) ASN_STRUCT_FREE(*elm->type, ptr); return rv; } nelems = -1; /* Allow uper_get_length() */ } while(repeat); ASN_DEBUG("Decoded %s as SET OF", td->name); rv.code = RC_OK; rv.consumed = 0; return rv; } asn1c-0.9.28+dfsg/skeletons/converter-sample.c0000644000000000000000000005371613065714043017714 0ustar rootroot/* * Generic converter template for a selected ASN.1 type. * Copyright (c) 2005, 2006, 2007 Lev Walkin . * All rights reserved. * * To compile with your own ASN.1 type, please redefine the PDU as shown: * * cc -DPDU=MyCustomType -o myDecoder.o -c converter-sample.c */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include /* for atoi(3) */ #include /* for getopt(3) */ #include /* for strerror(3) */ #include /* for EX_* exit codes */ #include /* for errno */ #include #include /* for ASN__DEFAULT_STACK_MAX */ /* Convert "Type" defined by -DPDU into "asn_DEF_Type" */ #define ASN_DEF_PDU(t) asn_DEF_ ## t #define DEF_PDU_Type(t) ASN_DEF_PDU(t) #define PDU_Type DEF_PDU_Type(PDU) extern asn_TYPE_descriptor_t PDU_Type; /* ASN.1 type to be decoded */ #ifdef ASN_PDU_COLLECTION /* Generated by asn1c: -pdu=... */ extern asn_TYPE_descriptor_t *asn_pdu_collection[]; #endif /* * Open file and parse its contens. */ static void *data_decode_from_file(asn_TYPE_descriptor_t *asnTypeOfPDU, FILE *file, const char *name, ssize_t suggested_bufsize, int first_pdu); static int write_out(const void *buffer, size_t size, void *key); static FILE *argument_to_file(char *av[], int idx); static char *argument_to_name(char *av[], int idx); int opt_debug; /* -d (or -dd) */ static int opt_check; /* -c (constraints checking) */ static int opt_stack; /* -s (maximum stack size) */ static int opt_nopad; /* -per-nopad (PER input is not padded) */ static int opt_onepdu; /* -1 (decode single PDU) */ /* Input data format selector */ static enum input_format { INP_BER, /* -iber: BER input */ INP_XER, /* -ixer: XER input */ INP_PER /* -iper: Unaligned PER input */ } iform; /* -i */ /* Output data format selector */ static enum output_format { OUT_XER, /* -oxer: XER (XML) output */ OUT_DER, /* -oder: DER (BER) output */ OUT_PER, /* -oper: Unaligned PER output */ OUT_TEXT, /* -otext: semi-structured text */ OUT_NULL /* -onull: No pretty-printing */ } oform; /* -o */ #ifdef JUNKTEST /* Enable -J */ #define JUNKOPT "J:" static double opt_jprob; /* Junk bit probability */ static int junk_failures; static void junk_bytes_with_probability(uint8_t *, size_t, double prob); #else #define JUNKOPT #endif /* Debug output function */ static inline void DEBUG(const char *fmt, ...) { va_list ap; if(!opt_debug) return; fprintf(stderr, "AD: "); va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); fprintf(stderr, "\n"); } int main(int ac, char *av[]) { static asn_TYPE_descriptor_t *pduType = &PDU_Type; ssize_t suggested_bufsize = 8192; /* close or equal to stdio buffer */ int number_of_iterations = 1; int num; int ch; /* Figure out if Unaligned PER needs to be default */ if(pduType->uper_decoder) iform = INP_PER; /* * Pocess the command-line argments. */ while((ch = getopt(ac, av, "i:o:1b:cdn:p:hs:" JUNKOPT)) != -1) switch(ch) { case 'i': if(optarg[0] == 'b') { iform = INP_BER; break; } if(optarg[0] == 'x') { iform = INP_XER; break; } if(pduType->uper_decoder && optarg[0] == 'p') { iform = INP_PER; break; } fprintf(stderr, "-i: '%s': improper format selector\n", optarg); exit(EX_UNAVAILABLE); case 'o': if(optarg[0] == 'd') { oform = OUT_DER; break; } if(pduType->uper_encoder && optarg[0] == 'p') { oform = OUT_PER; break; } if(optarg[0] == 'x') { oform = OUT_XER; break; } if(optarg[0] == 't') { oform = OUT_TEXT; break; } if(optarg[0] == 'n') { oform = OUT_NULL; break; } fprintf(stderr, "-o: '%s': improper format selector\n", optarg); exit(EX_UNAVAILABLE); case '1': opt_onepdu = 1; break; case 'b': suggested_bufsize = atoi(optarg); if(suggested_bufsize < 1 || suggested_bufsize > 16 * 1024 * 1024) { fprintf(stderr, "-b %s: Improper buffer size (1..16M)\n", optarg); exit(EX_UNAVAILABLE); } break; case 'c': opt_check = 1; break; case 'd': opt_debug++; /* Double -dd means ASN.1 debug */ break; case 'n': number_of_iterations = atoi(optarg); if(number_of_iterations < 1) { fprintf(stderr, "-n %s: Improper iterations count\n", optarg); exit(EX_UNAVAILABLE); } break; case 'p': if(strcmp(optarg, "er-nopad") == 0) { opt_nopad = 1; break; } #ifdef ASN_PDU_COLLECTION if(strcmp(optarg, "list") == 0) { asn_TYPE_descriptor_t **pdu = asn_pdu_collection; fprintf(stderr, "Available PDU types:\n"); for(; *pdu; pdu++) printf("%s\n", (*pdu)->name); exit(0); } else if(optarg[0] >= 'A' && optarg[0] <= 'Z') { asn_TYPE_descriptor_t **pdu = asn_pdu_collection; while(*pdu && strcmp((*pdu)->name, optarg)) pdu++; if(*pdu) { pduType = *pdu; break; } fprintf(stderr, "-p %s: Unrecognized PDU\n", optarg); } #endif /* ASN_PDU_COLLECTION */ fprintf(stderr, "-p %s: Unrecognized option\n", optarg); exit(EX_UNAVAILABLE); case 's': opt_stack = atoi(optarg); if(opt_stack < 0) { fprintf(stderr, "-s %s: Non-negative value expected\n", optarg); exit(EX_UNAVAILABLE); } break; #ifdef JUNKTEST case 'J': opt_jprob = strtod(optarg, 0); if(opt_jprob <= 0.0 || opt_jprob > 1.0) { fprintf(stderr, "-J %s: Probability range 0..1 expected \n", optarg); exit(EX_UNAVAILABLE); } break; #endif /* JUNKTEST */ case 'h': default: #ifdef ASN_CONVERTER_TITLE #define _AXS(x) #x #define _ASX(x) _AXS(x) fprintf(stderr, "%s\n", _ASX(ASN_CONVERTER_TITLE)); #endif fprintf(stderr, "Usage: %s [options] ...\n", av[0]); fprintf(stderr, "Where options are:\n"); if(pduType->uper_decoder) fprintf(stderr, " -iper Input is in Unaligned PER (Packed Encoding Rules) (DEFAULT)\n"); fprintf(stderr, " -iber Input is in BER (Basic Encoding Rules)%s\n", iform == INP_PER ? "" : " (DEFAULT)"); fprintf(stderr, " -ixer Input is in XER (XML Encoding Rules)\n"); if(pduType->uper_encoder) fprintf(stderr, " -oper Output in Unaligned PER (Packed Encoding Rules)\n"); fprintf(stderr, " -oder Output in DER (Distinguished Encoding Rules)\n" " -oxer Output in XER (XML Encoding Rules) (DEFAULT)\n" " -otext Output in plain semi-structured text (dump)\n" " -onull Verify (decode) input, but do not output\n"); if(pduType->uper_decoder) fprintf(stderr, " -per-nopad Assume PER PDUs are not padded (-iper)\n"); #ifdef ASN_PDU_COLLECTION fprintf(stderr, " -p Specify PDU type to decode\n" " -p list List available PDUs\n"); #endif /* ASN_PDU_COLLECTION */ fprintf(stderr, " -1 Decode only the first PDU in file\n" " -b Set the i/o buffer size (default is %ld)\n" " -c Check ASN.1 constraints after decoding\n" " -d Enable debugging (-dd is even better)\n" " -n Process files times\n" " -s Set the stack usage limit (default is %d)\n" #ifdef JUNKTEST " -J Set random junk test bit garbaging probability\n" #endif , (long)suggested_bufsize, ASN__DEFAULT_STACK_MAX); exit(EX_USAGE); } ac -= optind; av += optind; if(ac < 1) { fprintf(stderr, "%s: No input files specified. " "Try '-h' for more information\n", av[-optind]); exit(EX_USAGE); } setvbuf(stdout, 0, _IOLBF, 0); for(num = 0; num < number_of_iterations; num++) { int ac_i; /* * Process all files in turn. */ for(ac_i = 0; ac_i < ac; ac_i++) { asn_enc_rval_t erv; void *structure; /* Decoded structure */ FILE *file = argument_to_file(av, ac_i); char *name = argument_to_name(av, ac_i); int first_pdu; for(first_pdu = 1; first_pdu || !opt_onepdu; first_pdu = 0) { /* * Decode the encoded structure from file. */ structure = data_decode_from_file(pduType, file, name, suggested_bufsize, first_pdu); if(!structure) { if(errno) { /* Error message is already printed */ exit(EX_DATAERR); } else { /* EOF */ break; } } /* Check ASN.1 constraints */ if(opt_check) { char errbuf[128]; size_t errlen = sizeof(errbuf); if(asn_check_constraints(pduType, structure, errbuf, &errlen)) { fprintf(stderr, "%s: ASN.1 constraint " "check failed: %s\n", name, errbuf); exit(EX_DATAERR); } } switch(oform) { case OUT_NULL: #ifdef JUNKTEST if(opt_jprob == 0.0) #endif fprintf(stderr, "%s: decoded successfully\n", name); break; case OUT_TEXT: /* -otext */ asn_fprint(stdout, pduType, structure); break; case OUT_XER: /* -oxer */ if(xer_fprint(stdout, pduType, structure)) { fprintf(stderr, "%s: Cannot convert %s into XML\n", name, pduType->name); exit(EX_UNAVAILABLE); } break; case OUT_DER: erv = der_encode(pduType, structure, write_out, stdout); if(erv.encoded < 0) { fprintf(stderr, "%s: Cannot convert %s into DER\n", name, pduType->name); exit(EX_UNAVAILABLE); } DEBUG("Encoded in %ld bytes of DER", (long)erv.encoded); break; case OUT_PER: erv = uper_encode(pduType, structure, write_out, stdout); if(erv.encoded < 0) { fprintf(stderr, "%s: Cannot convert %s into Unaligned PER\n", name, pduType->name); exit(EX_UNAVAILABLE); } DEBUG("Encoded in %ld bits of UPER", (long)erv.encoded); break; } ASN_STRUCT_FREE(*pduType, structure); } if(file && file != stdin) fclose(file); } } #ifdef JUNKTEST if(opt_jprob > 0.0) { fprintf(stderr, "Junked %f OK (%d/%d)\n", opt_jprob, junk_failures, number_of_iterations); } #endif /* JUNKTEST */ return 0; } static struct dynamic_buffer { uint8_t *data; /* Pointer to the data bytes */ size_t offset; /* Offset from the start */ size_t length; /* Length of meaningful contents */ size_t unbits; /* Unused bits in the last byte */ size_t allocated; /* Allocated memory for data */ int nreallocs; /* Number of data reallocations */ off_t bytes_shifted; /* Number of bytes ever shifted */ } DynamicBuffer; static void buffer_dump() { uint8_t *p = DynamicBuffer.data + DynamicBuffer.offset; uint8_t *e = p + DynamicBuffer.length - (DynamicBuffer.unbits ? 1 : 0); if(!opt_debug) return; DEBUG("Buffer: { d=%p, o=%ld, l=%ld, u=%ld, a=%ld, s=%ld }", DynamicBuffer.data, (long)DynamicBuffer.offset, (long)DynamicBuffer.length, (long)DynamicBuffer.unbits, (long)DynamicBuffer.allocated, (long)DynamicBuffer.bytes_shifted); for(; p < e; p++) { fprintf(stderr, " %c%c%c%c%c%c%c%c", ((*p >> 7) & 1) ? '1' : '0', ((*p >> 6) & 1) ? '1' : '0', ((*p >> 5) & 1) ? '1' : '0', ((*p >> 4) & 1) ? '1' : '0', ((*p >> 3) & 1) ? '1' : '0', ((*p >> 2) & 1) ? '1' : '0', ((*p >> 1) & 1) ? '1' : '0', ((*p >> 0) & 1) ? '1' : '0'); } if(DynamicBuffer.unbits) { unsigned int shift; fprintf(stderr, " "); for(shift = 7; shift >= DynamicBuffer.unbits; shift--) fprintf(stderr, "%c", ((*p >> shift) & 1) ? '1' : '0'); fprintf(stderr, " %ld:%ld\n", (long)DynamicBuffer.length - 1, (long)8 - DynamicBuffer.unbits); } else { fprintf(stderr, " %ld\n", (long)DynamicBuffer.length); } } /* * Move the buffer content left N bits, possibly joining it with * preceeding content. */ static void buffer_shift_left(size_t offset, int bits) { uint8_t *ptr = DynamicBuffer.data + DynamicBuffer.offset + offset; uint8_t *end = DynamicBuffer.data + DynamicBuffer.offset + DynamicBuffer.length - 1; if(!bits) return; DEBUG("Shifting left %d bits off %ld (o=%ld, u=%ld, l=%ld)", bits, (long)offset, (long)DynamicBuffer.offset, (long)DynamicBuffer.unbits, (long)DynamicBuffer.length); if(offset) { int right; right = ptr[0] >> (8 - bits); DEBUG("oleft: %c%c%c%c%c%c%c%c", ((ptr[-1] >> 7) & 1) ? '1' : '0', ((ptr[-1] >> 6) & 1) ? '1' : '0', ((ptr[-1] >> 5) & 1) ? '1' : '0', ((ptr[-1] >> 4) & 1) ? '1' : '0', ((ptr[-1] >> 3) & 1) ? '1' : '0', ((ptr[-1] >> 2) & 1) ? '1' : '0', ((ptr[-1] >> 1) & 1) ? '1' : '0', ((ptr[-1] >> 0) & 1) ? '1' : '0'); DEBUG("oriht: %c%c%c%c%c%c%c%c", ((ptr[0] >> 7) & 1) ? '1' : '0', ((ptr[0] >> 6) & 1) ? '1' : '0', ((ptr[0] >> 5) & 1) ? '1' : '0', ((ptr[0] >> 4) & 1) ? '1' : '0', ((ptr[0] >> 3) & 1) ? '1' : '0', ((ptr[0] >> 2) & 1) ? '1' : '0', ((ptr[0] >> 1) & 1) ? '1' : '0', ((ptr[0] >> 0) & 1) ? '1' : '0'); DEBUG("mriht: %c%c%c%c%c%c%c%c", ((right >> 7) & 1) ? '1' : '0', ((right >> 6) & 1) ? '1' : '0', ((right >> 5) & 1) ? '1' : '0', ((right >> 4) & 1) ? '1' : '0', ((right >> 3) & 1) ? '1' : '0', ((right >> 2) & 1) ? '1' : '0', ((right >> 1) & 1) ? '1' : '0', ((right >> 0) & 1) ? '1' : '0'); ptr[-1] = (ptr[-1] & (0xff << bits)) | right; DEBUG("after: %c%c%c%c%c%c%c%c", ((ptr[-1] >> 7) & 1) ? '1' : '0', ((ptr[-1] >> 6) & 1) ? '1' : '0', ((ptr[-1] >> 5) & 1) ? '1' : '0', ((ptr[-1] >> 4) & 1) ? '1' : '0', ((ptr[-1] >> 3) & 1) ? '1' : '0', ((ptr[-1] >> 2) & 1) ? '1' : '0', ((ptr[-1] >> 1) & 1) ? '1' : '0', ((ptr[-1] >> 0) & 1) ? '1' : '0'); } buffer_dump(); for(; ptr < end; ptr++) { int right = ptr[1] >> (8 - bits); *ptr = (*ptr << bits) | right; } *ptr <<= bits; DEBUG("Unbits [%d=>", (int)DynamicBuffer.unbits); if(DynamicBuffer.unbits == 0) { DynamicBuffer.unbits += bits; } else { DynamicBuffer.unbits += bits; if(DynamicBuffer.unbits > 7) { DynamicBuffer.unbits -= 8; DynamicBuffer.length--; DynamicBuffer.bytes_shifted++; } } DEBUG("Unbits =>%d]", (int)DynamicBuffer.unbits); buffer_dump(); DEBUG("Shifted. Now (o=%ld, u=%ld l=%ld)", (long)DynamicBuffer.offset, (long)DynamicBuffer.unbits, (long)DynamicBuffer.length); } /* * Ensure that the buffer contains at least this amount of free space. */ static void add_bytes_to_buffer(const void *data2add, size_t bytes) { if(bytes == 0) return; DEBUG("=> add_bytes(%ld) { o=%ld l=%ld u=%ld, s=%ld }", (long)bytes, (long)DynamicBuffer.offset, (long)DynamicBuffer.length, (long)DynamicBuffer.unbits, (long)DynamicBuffer.allocated); if(DynamicBuffer.allocated >= (DynamicBuffer.offset + DynamicBuffer.length + bytes)) { DEBUG("\tNo buffer reallocation is necessary"); } else if(bytes <= DynamicBuffer.offset) { DEBUG("\tContents shifted by %ld", DynamicBuffer.offset); /* Shift the buffer contents */ memmove(DynamicBuffer.data, DynamicBuffer.data + DynamicBuffer.offset, DynamicBuffer.length); DynamicBuffer.bytes_shifted += DynamicBuffer.offset; DynamicBuffer.offset = 0; } else { size_t newsize = (DynamicBuffer.allocated << 2) + bytes; void *p = MALLOC(newsize); if(!p) { perror("malloc()"); exit(EX_OSERR); } memcpy(p, DynamicBuffer.data + DynamicBuffer.offset, DynamicBuffer.length); FREEMEM(DynamicBuffer.data); DynamicBuffer.data = (uint8_t *)p; DynamicBuffer.offset = 0; DynamicBuffer.allocated = newsize; DynamicBuffer.nreallocs++; DEBUG("\tBuffer reallocated to %ld (%d time)", newsize, DynamicBuffer.nreallocs); } memcpy(DynamicBuffer.data + DynamicBuffer.offset + DynamicBuffer.length, data2add, bytes); DynamicBuffer.length += bytes; if(DynamicBuffer.unbits) { int bits = DynamicBuffer.unbits; DynamicBuffer.unbits = 0; buffer_shift_left(DynamicBuffer.length - bytes, bits); } DEBUG("<= add_bytes(%ld) { o=%ld l=%ld u=%ld, s=%ld }", (long)bytes, (long)DynamicBuffer.offset, (long)DynamicBuffer.length, (long)DynamicBuffer.unbits, (long)DynamicBuffer.allocated); } static void * data_decode_from_file(asn_TYPE_descriptor_t *pduType, FILE *file, const char *name, ssize_t suggested_bufsize, int on_first_pdu) { static uint8_t *fbuf; static ssize_t fbuf_size; static asn_codec_ctx_t s_codec_ctx; asn_codec_ctx_t *opt_codec_ctx = 0; void *structure = 0; asn_dec_rval_t rval; size_t old_offset; size_t new_offset; int tolerate_eof; size_t rd; if(!file) { fprintf(stderr, "%s: %s\n", name, strerror(errno)); errno = EINVAL; return 0; } if(opt_stack) { s_codec_ctx.max_stack_size = opt_stack; opt_codec_ctx = &s_codec_ctx; } DEBUG("Processing %s", name); /* prepare the file buffer */ if(fbuf_size != suggested_bufsize) { fbuf = (uint8_t *)REALLOC(fbuf, suggested_bufsize); if(!fbuf) { perror("realloc()"); exit(EX_OSERR); } fbuf_size = suggested_bufsize; } if(on_first_pdu) { DynamicBuffer.offset = 0; DynamicBuffer.length = 0; DynamicBuffer.unbits = 0; DynamicBuffer.allocated = 0; DynamicBuffer.bytes_shifted = 0; DynamicBuffer.nreallocs = 0; } old_offset = DynamicBuffer.bytes_shifted + DynamicBuffer.offset; /* Pretend immediate EOF */ rval.code = RC_WMORE; rval.consumed = 0; for(tolerate_eof = 1; /* Allow EOF first time buffer is non-empty */ (rd = fread(fbuf, 1, fbuf_size, file)) || feof(file) == 0 || (tolerate_eof && DynamicBuffer.length) ;) { int ecbits = 0; /* Extra consumed bits in case of PER */ uint8_t *i_bptr; size_t i_size; /* * Copy the data over, or use the original buffer. */ if(DynamicBuffer.allocated) { /* Append new data into the existing dynamic buffer */ add_bytes_to_buffer(fbuf, rd); i_bptr = DynamicBuffer.data + DynamicBuffer.offset; i_size = DynamicBuffer.length; } else { i_bptr = fbuf; i_size = rd; } DEBUG("Decoding %ld bytes", (long)i_size); #ifdef JUNKTEST junk_bytes_with_probability(i_bptr, i_size, opt_jprob); #endif switch(iform) { case INP_BER: rval = ber_decode(opt_codec_ctx, pduType, (void **)&structure, i_bptr, i_size); break; case INP_XER: rval = xer_decode(opt_codec_ctx, pduType, (void **)&structure, i_bptr, i_size); break; case INP_PER: if(opt_nopad) rval = uper_decode(opt_codec_ctx, pduType, (void **)&structure, i_bptr, i_size, 0, DynamicBuffer.unbits); else rval = uper_decode_complete(opt_codec_ctx, pduType, (void **)&structure, i_bptr, i_size); switch(rval.code) { case RC_OK: /* Fall through */ case RC_FAIL: if(opt_nopad) { /* uper_decode() returns bits! */ /* Extra bits */ ecbits = rval.consumed % 8; /* Convert into bytes! */ rval.consumed /= 8; } break; case RC_WMORE: /* PER does not support restartability */ ASN_STRUCT_FREE(*pduType, structure); structure = 0; rval.consumed = 0; /* Continue accumulating data */ break; } break; } DEBUG("decode(%ld) consumed %ld+%db (%ld), code %d", (long)DynamicBuffer.length, (long)rval.consumed, ecbits, (long)i_size, rval.code); if(DynamicBuffer.allocated == 0) { /* * Flush remainder into the intermediate buffer. */ if(rval.code != RC_FAIL && rval.consumed < rd) { add_bytes_to_buffer(fbuf + rval.consumed, rd - rval.consumed); buffer_shift_left(0, ecbits); DynamicBuffer.bytes_shifted = rval.consumed; rval.consumed = 0; ecbits = 0; } } /* * Adjust position inside the source buffer. */ if(DynamicBuffer.allocated) { DynamicBuffer.offset += rval.consumed; DynamicBuffer.length -= rval.consumed; } else { DynamicBuffer.bytes_shifted += rval.consumed; } switch(rval.code) { case RC_OK: if(ecbits) buffer_shift_left(0, ecbits); DEBUG("RC_OK, finishing up with %ld+%d", (long)rval.consumed, ecbits); return structure; case RC_WMORE: DEBUG("RC_WMORE, continuing read=%ld, cons=%ld " " with %ld..%ld-%ld..%ld", (long)rd, (long)rval.consumed, (long)DynamicBuffer.offset, (long)DynamicBuffer.length, (long)DynamicBuffer.unbits, (long)DynamicBuffer.allocated); if(!rd) tolerate_eof--; continue; case RC_FAIL: break; } break; } DEBUG("Clean up partially decoded structure"); ASN_STRUCT_FREE(*pduType, structure); new_offset = DynamicBuffer.bytes_shifted + DynamicBuffer.offset; /* * Print a message and return failure only if not EOF, * unless this is our first PDU (empty file). */ if(on_first_pdu || DynamicBuffer.length || new_offset - old_offset > ((iform == INP_XER)?sizeof("\r\n")-1:0) ) { #ifdef JUNKTEST /* * Nothing's wrong with being unable to decode junk. * Simulate EOF. */ if(opt_jprob != 0.0) { junk_failures++; errno = 0; return 0; } #endif DEBUG("ofp %d, no=%ld, oo=%ld, dbl=%ld", on_first_pdu, (long)new_offset, (long)old_offset, (long)DynamicBuffer.length); fprintf(stderr, "%s: " "Decode failed past byte %ld: %s\n", name, (long)new_offset, (rval.code == RC_WMORE) ? "Unexpected end of input" : "Input processing error"); #ifndef ENOMSG #define ENOMSG EINVAL #endif #ifndef EBADMSG #define EBADMSG EINVAL #endif errno = (rval.code == RC_WMORE) ? ENOMSG : EBADMSG; } else { /* Got EOF after a few successful PDUs */ errno = 0; } return 0; } /* Dump the buffer out to the specified FILE */ static int write_out(const void *buffer, size_t size, void *key) { FILE *fp = (FILE *)key; return (fwrite(buffer, 1, size, fp) == size) ? 0 : -1; } static int argument_is_stdin(char *av[], int idx) { if(strcmp(av[idx], "-")) { return 0; /* Certainly not */ } else { /* This might be , unless `./program -- -` */ if(strcmp(av[-1], "--")) return 1; else return 0; } } static FILE *argument_to_file(char *av[], int idx) { return argument_is_stdin(av, idx) ? stdin : fopen(av[idx], "rb"); } static char *argument_to_name(char *av[], int idx) { return argument_is_stdin(av, idx) ? "standard input" : av[idx]; } #ifdef JUNKTEST /* * Fill bytes with some garbage with specified probability (more or less). */ static void junk_bytes_with_probability(uint8_t *buf, size_t size, double prob) { static int junkmode; uint8_t *ptr; uint8_t *end; if(opt_jprob <= 0.0) return; for(ptr = buf, end = ptr + size; ptr < end; ptr++) { int byte = *ptr; if(junkmode++ & 1) { if((((double)random() / RAND_MAX) < prob)) byte = random() & 0xff; } else { #define BPROB(b) ((((double)random() / RAND_MAX) < prob) ? b : 0) byte ^= BPROB(0x80); byte ^= BPROB(0x40); byte ^= BPROB(0x20); byte ^= BPROB(0x10); byte ^= BPROB(0x08); byte ^= BPROB(0x04); byte ^= BPROB(0x02); byte ^= BPROB(0x01); } if(byte != *ptr) { DEBUG("Junk buf[%d] %02x -> %02x", ptr - buf, *ptr, byte); *ptr = byte; } } } #endif /* JUNKTEST */ asn1c-0.9.28+dfsg/skeletons/T61String.c0000644000000000000000000000220213065714043016147 0ustar rootroot/*- * Copyright (c) 2003 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #include #include /* * T61String basic type description. */ static const ber_tlv_tag_t asn_DEF_T61String_tags[] = { (ASN_TAG_CLASS_UNIVERSAL | (20 << 2)), /* [UNIVERSAL 20] IMPLICIT ...*/ (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */ }; asn_TYPE_descriptor_t asn_DEF_T61String = { "T61String", "T61String", OCTET_STRING_free, OCTET_STRING_print, /* non-ascii string */ asn_generic_unknown_constraint, OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */ OCTET_STRING_encode_der, OCTET_STRING_decode_xer_hex, OCTET_STRING_encode_xer, OCTET_STRING_decode_uper, OCTET_STRING_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_T61String_tags, sizeof(asn_DEF_T61String_tags) / sizeof(asn_DEF_T61String_tags[0]) - 1, asn_DEF_T61String_tags, sizeof(asn_DEF_T61String_tags) / sizeof(asn_DEF_T61String_tags[0]), 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; asn1c-0.9.28+dfsg/skeletons/ber_decoder.h0000644000000000000000000000377713065714043016672 0ustar rootroot/*- * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef _BER_DECODER_H_ #define _BER_DECODER_H_ #include #ifdef __cplusplus extern "C" { #endif struct asn_TYPE_descriptor_s; /* Forward declaration */ struct asn_codec_ctx_s; /* Forward declaration */ /* * The BER decoder of any type. * This function may be invoked directly from the application. * The der_encode() function (der_encoder.h) is an opposite to ber_decode(). */ asn_dec_rval_t ber_decode(struct asn_codec_ctx_s *opt_codec_ctx, struct asn_TYPE_descriptor_s *type_descriptor, void **struct_ptr, /* Pointer to a target structure's pointer */ const void *buffer, /* Data to be decoded */ size_t size /* Size of that buffer */ ); /* * Type of generic function which decodes the byte stream into the structure. */ typedef asn_dec_rval_t (ber_type_decoder_f)( struct asn_codec_ctx_s *opt_codec_ctx, struct asn_TYPE_descriptor_s *type_descriptor, void **struct_ptr, const void *buf_ptr, size_t size, int tag_mode); /******************************* * INTERNALLY USEFUL FUNCTIONS * *******************************/ /* * Check that all tags correspond to the type definition (as given in head). * On return, last_length would contain either a non-negative length of the * value part of the last TLV, or the negative number of expected * "end of content" sequences. The number may only be negative if the * head->last_tag_form is non-zero. */ asn_dec_rval_t ber_check_tags( struct asn_codec_ctx_s *opt_codec_ctx, /* codec options */ struct asn_TYPE_descriptor_s *type_descriptor, asn_struct_ctx_t *opt_ctx, /* saved decoding context */ const void *ptr, size_t size, int tag_mode, /* {-1,0,1}: IMPLICIT, no, EXPLICIT */ int last_tag_form, /* {-1,0:1}: any, primitive, constr */ ber_tlv_len_t *last_length, int *opt_tlv_form /* optional tag form */ ); #ifdef __cplusplus } #endif #endif /* _BER_DECODER_H_ */ asn1c-0.9.28+dfsg/skeletons/ENUMERATED.h0000644000000000000000000000102013065714043016041 0ustar rootroot/*- * Copyright (c) 2003, 2005 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef _ENUMERATED_H_ #define _ENUMERATED_H_ #include #ifdef __cplusplus extern "C" { #endif typedef INTEGER_t ENUMERATED_t; /* Implemented via INTEGER */ extern asn_TYPE_descriptor_t asn_DEF_ENUMERATED; per_type_decoder_f ENUMERATED_decode_uper; per_type_encoder_f ENUMERATED_encode_uper; #ifdef __cplusplus } #endif #endif /* _ENUMERATED_H_ */ asn1c-0.9.28+dfsg/skeletons/ANY.h0000644000000000000000000000255613065714043015056 0ustar rootroot/*- * Copyright (c) 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef ASN_TYPE_ANY_H #define ASN_TYPE_ANY_H #include /* Implemented via OCTET STRING type */ #ifdef __cplusplus extern "C" { #endif typedef struct ANY { uint8_t *buf; /* BER-encoded ANY contents */ int size; /* Size of the above buffer */ asn_struct_ctx_t _asn_ctx; /* Parsing across buffer boundaries */ } ANY_t; extern asn_TYPE_descriptor_t asn_DEF_ANY; asn_struct_free_f ANY_free; asn_struct_print_f ANY_print; ber_type_decoder_f ANY_decode_ber; der_type_encoder_f ANY_encode_der; xer_type_encoder_f ANY_encode_xer; /****************************** * Handy conversion routines. * ******************************/ /* Convert another ASN.1 type into the ANY. This implies DER encoding. */ int ANY_fromType(ANY_t *, asn_TYPE_descriptor_t *td, void *struct_ptr); ANY_t *ANY_new_fromType(asn_TYPE_descriptor_t *td, void *struct_ptr); /* Convert the contents of the ANY type into the specified type. */ int ANY_to_type(ANY_t *, asn_TYPE_descriptor_t *td, void **struct_ptr); #define ANY_fromBuf(s, buf, size) OCTET_STRING_fromBuf((s), (buf), (size)) #define ANY_new_fromBuf(buf, size) OCTET_STRING_new_fromBuf( \ &asn_DEF_ANY, (buf), (size)) #ifdef __cplusplus } #endif #endif /* ASN_TYPE_ANY_H */ asn1c-0.9.28+dfsg/skeletons/constr_TYPE.c0000644000000000000000000000335013065714043016564 0ustar rootroot/*- * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #include #include #include /* * Version of the ASN.1 infrastructure shipped with compiler. */ int get_asn1c_environment_version() { return ASN1C_ENVIRONMENT_VERSION; } static asn_app_consume_bytes_f _print2fp; /* * Return the outmost tag of the type. */ ber_tlv_tag_t asn_TYPE_outmost_tag(const asn_TYPE_descriptor_t *type_descriptor, const void *struct_ptr, int tag_mode, ber_tlv_tag_t tag) { if(tag_mode) return tag; if(type_descriptor->tags_count) return type_descriptor->tags[0]; return type_descriptor->outmost_tag(type_descriptor, struct_ptr, 0, 0); } /* * Print the target language's structure in human readable form. */ int asn_fprint(FILE *stream, asn_TYPE_descriptor_t *td, const void *struct_ptr) { if(!stream) stream = stdout; if(!td || !struct_ptr) { errno = EINVAL; return -1; } /* Invoke type-specific printer */ if(td->print_struct(td, struct_ptr, 1, _print2fp, stream)) return -1; /* Terminate the output */ if(_print2fp("\n", 1, stream)) return -1; return fflush(stream); } /* Dump the data into the specified stdio stream */ static int _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; } /* * Some compilers do not support variable args macros. * This function is a replacement of ASN_DEBUG() macro. */ void ASN_DEBUG_f(const char *fmt, ...); void ASN_DEBUG_f(const char *fmt, ...) { va_list ap; va_start(ap, fmt); vfprintf(stderr, fmt, ap); fprintf(stderr, "\n"); va_end(ap); } asn1c-0.9.28+dfsg/skeletons/der_encoder.h0000644000000000000000000000363113065714043016673 0ustar rootroot/*- * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef _DER_ENCODER_H_ #define _DER_ENCODER_H_ #include #ifdef __cplusplus extern "C" { #endif struct asn_TYPE_descriptor_s; /* Forward declaration */ /* * The DER encoder of any type. May be invoked by the application. * The ber_decode() function (ber_decoder.h) is an opposite of der_encode(). */ asn_enc_rval_t der_encode(struct asn_TYPE_descriptor_s *type_descriptor, void *struct_ptr, /* Structure to be encoded */ asn_app_consume_bytes_f *consume_bytes_cb, void *app_key /* Arbitrary callback argument */ ); /* A variant of der_encode() which encodes data into the pre-allocated buffer */ asn_enc_rval_t der_encode_to_buffer( struct asn_TYPE_descriptor_s *type_descriptor, void *struct_ptr, /* Structure to be encoded */ void *buffer, /* Pre-allocated buffer */ size_t buffer_size /* Initial buffer size (maximum) */ ); /* * Type of the generic DER encoder. */ typedef asn_enc_rval_t (der_type_encoder_f)( struct asn_TYPE_descriptor_s *type_descriptor, void *struct_ptr, /* Structure to be encoded */ int tag_mode, /* {-1,0,1}: IMPLICIT, no, EXPLICIT */ ber_tlv_tag_t tag, asn_app_consume_bytes_f *consume_bytes_cb, /* Callback */ void *app_key /* Arbitrary callback argument */ ); /******************************* * INTERNALLY USEFUL FUNCTIONS * *******************************/ /* * Write out leading TL[v] sequence according to the type definition. */ ssize_t der_write_tags( struct asn_TYPE_descriptor_s *type_descriptor, size_t struct_length, int tag_mode, /* {-1,0,1}: IMPLICIT, no, EXPLICIT */ int last_tag_form, /* {0,!0}: prim, constructed */ ber_tlv_tag_t tag, asn_app_consume_bytes_f *consume_bytes_cb, void *app_key ); #ifdef __cplusplus } #endif #endif /* _DER_ENCODER_H_ */ asn1c-0.9.28+dfsg/skeletons/RELATIVE-OID.h0000644000000000000000000000211313065714043016240 0ustar rootroot/*- * Copyright (c) 2003, 2004 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef _RELATIVE_OID_H_ #define _RELATIVE_OID_H_ #include #ifdef __cplusplus extern "C" { #endif /* Implemented via OBJECT IDENTIFIER */ typedef OBJECT_IDENTIFIER_t RELATIVE_OID_t; extern asn_TYPE_descriptor_t asn_DEF_RELATIVE_OID; asn_struct_print_f RELATIVE_OID_print; xer_type_decoder_f RELATIVE_OID_decode_xer; xer_type_encoder_f RELATIVE_OID_encode_xer; /********************************** * Some handy conversion routines * **********************************/ /* See OBJECT_IDENTIFIER_get_arcs() function in OBJECT_IDENTIFIER.h */ int RELATIVE_OID_get_arcs(const RELATIVE_OID_t *_roid, void *arcs, unsigned int arc_type_size, unsigned int arc_slots); /* See OBJECT_IDENTIFIER_set_arcs() function in OBJECT_IDENTIFIER.h */ int RELATIVE_OID_set_arcs(RELATIVE_OID_t *_roid, void *arcs, unsigned int arc_type_size, unsigned int arcs_slots); #ifdef __cplusplus } #endif #endif /* _RELATIVE_OID_H_ */ asn1c-0.9.28+dfsg/skeletons/GeneralString.c0000644000000000000000000000234013065714043017155 0ustar rootroot/*- * Copyright (c) 2003 Lev Walkin . All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #include #include /* * GeneralString basic type description. */ static const ber_tlv_tag_t asn_DEF_GeneralString_tags[] = { (ASN_TAG_CLASS_UNIVERSAL | (27 << 2)), /* [UNIVERSAL 27] IMPLICIT ...*/ (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */ }; asn_TYPE_descriptor_t asn_DEF_GeneralString = { "GeneralString", "GeneralString", OCTET_STRING_free, OCTET_STRING_print, /* non-ascii string */ asn_generic_unknown_constraint, OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */ OCTET_STRING_encode_der, OCTET_STRING_decode_xer_hex, OCTET_STRING_encode_xer, OCTET_STRING_decode_uper, /* Implemented in terms of OCTET STRING */ OCTET_STRING_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_GeneralString_tags, sizeof(asn_DEF_GeneralString_tags) / sizeof(asn_DEF_GeneralString_tags[0]) - 1, asn_DEF_GeneralString_tags, sizeof(asn_DEF_GeneralString_tags) / sizeof(asn_DEF_GeneralString_tags[0]), 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; asn1c-0.9.28+dfsg/skeletons/OBJECT_IDENTIFIER.h0000644000000000000000000001141713065714043017073 0ustar rootroot/*- * Copyright (c) 2003, 2004, 2005 Lev Walkin . * All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #ifndef _OBJECT_IDENTIFIER_H_ #define _OBJECT_IDENTIFIER_H_ #include #include #ifdef __cplusplus extern "C" { #endif typedef ASN__PRIMITIVE_TYPE_t OBJECT_IDENTIFIER_t; extern asn_TYPE_descriptor_t asn_DEF_OBJECT_IDENTIFIER; asn_struct_print_f OBJECT_IDENTIFIER_print; asn_constr_check_f OBJECT_IDENTIFIER_constraint; der_type_encoder_f OBJECT_IDENTIFIER_encode_der; xer_type_decoder_f OBJECT_IDENTIFIER_decode_xer; xer_type_encoder_f OBJECT_IDENTIFIER_encode_xer; /********************************** * Some handy conversion routines * **********************************/ /* * This function fills an (_arcs) array with OBJECT IDENTIFIER arcs * up to specified (_arc_slots) elements. * * EXAMPLE: * void print_arcs(OBJECT_IDENTIFIER_t *oid) { * unsigned long fixed_arcs[10]; // Try with fixed space first * unsigned long *arcs = fixed_arcs; * int arc_type_size = sizeof(fixed_arcs[0]); // sizeof(long) * int arc_slots = sizeof(fixed_arcs)/sizeof(fixed_arcs[0]); // 10 * int count; // Real number of arcs. * int i; * * count = OBJECT_IDENTIFIER_get_arcs(oid, arcs, * arc_type_size, arc_slots); * // If necessary, reallocate arcs array and try again. * if(count > arc_slots) { * arc_slots = count; * arcs = malloc(arc_type_size * arc_slots); * if(!arcs) return; * count = OBJECT_IDENTIFIER_get_arcs(oid, arcs, * arc_type_size, arc_slots); * assert(count == arc_slots); * } * * // Print the contents of the arcs array. * for(i = 0; i < count; i++) * printf("%d\n", arcs[i]); * * // Avoid memory leak. * if(arcs != fixed_arcs) free(arcs); * } * * RETURN VALUES: * -1/EINVAL: Invalid arguments (oid is missing) * -1/ERANGE: One or more arcs have value out of array cell type range. * >=0: Number of arcs contained in the OBJECT IDENTIFIER * * WARNING: The function always returns the real number of arcs, * even if there is no sufficient (_arc_slots) provided. */ int OBJECT_IDENTIFIER_get_arcs(const OBJECT_IDENTIFIER_t *_oid, void *_arcs, /* e.g., unsigned int arcs[N] */ unsigned int _arc_type_size, /* e.g., sizeof(arcs[0]) */ unsigned int _arc_slots /* e.g., N */); /* * This functions initializes the OBJECT IDENTIFIER object with * the given set of arcs. * The minimum of two arcs must be present; some restrictions apply. * RETURN VALUES: * -1/EINVAL: Invalid arguments * -1/ERANGE: The first two arcs do not conform to ASN.1 restrictions. * -1/ENOMEM: Memory allocation failed * 0: The object was initialized with new arcs. */ int OBJECT_IDENTIFIER_set_arcs(OBJECT_IDENTIFIER_t *_oid, const void *_arcs, /* e.g., unsigned int arcs[N] */ unsigned int _arc_type_size, /* e.g., sizeof(arcs[0]) */ unsigned int _arc_slots /* e.g., N */); /* * Print the specified OBJECT IDENTIFIER arc. */ int OBJECT_IDENTIFIER_print_arc(const uint8_t *arcbuf, int arclen, int add, /* Arbitrary offset, required to process the first two arcs */ asn_app_consume_bytes_f *cb, void *app_key); /* Same as above, but returns the number of written digits, instead of 0 */ ssize_t OBJECT_IDENTIFIER__dump_arc(const uint8_t *arcbuf, int arclen, int add, asn_app_consume_bytes_f *cb, void *app_key); /* * Parse the OBJECT IDENTIFIER textual representation ("1.3.6.1.4.1.9363"). * No arc can exceed the (0..signed_long_max) range (typically, 0..2G if L32). * This function is not specific to OBJECT IDENTIFIER, it may be used to parse * the RELATIVE-OID data, or any other data consisting of dot-separated * series of numeric values. * * If (oid_txt_length == -1), the strlen() will be invoked to determine the * size of the (oid_text) string. * * After return, the optional (opt_oid_text_end) is set to the character after * the last parsed one. (opt_oid_text_end) is never less than (oid_text). * * RETURN VALUES: * -1: Parse error. * >= 0: Number of arcs contained in the OBJECT IDENTIFIER. * * WARNING: The function always returns the real number of arcs, * even if there is no sufficient (_arc_slots) provided. * This is useful for (_arc_slots) value estimation. */ int OBJECT_IDENTIFIER_parse_arcs(const char *oid_text, ssize_t oid_txt_length, long arcs[], unsigned int arcs_slots, const char **opt_oid_text_end); /* * Internal functions. * Used by RELATIVE-OID implementation in particular. */ int OBJECT_IDENTIFIER_get_single_arc(const uint8_t *arcbuf, unsigned int arclen, signed int add, void *value, unsigned int value_size); int OBJECT_IDENTIFIER_set_single_arc(uint8_t *arcbuf, const void *arcval, unsigned int arcval_size, int _prepared_order); #ifdef __cplusplus } #endif #endif /* _OBJECT_IDENTIFIER_H_ */ asn1c-0.9.28+dfsg/config.sub0000755000000000000000000007746013065714043014240 0ustar rootroot#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. timestamp='2006-09-20' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64vr | mips64vrel \ | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | mt \ | msp430 \ | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | score \ | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64vr-* | mips64vrel-* \ | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa-* \ | ymp-* \ | z8k-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; c90) basic_machine=c90-cray os=-unicos ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16c) basic_machine=cr16c-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tic55x | c55x*) basic_machine=tic55x-unknown os=-coff ;; tic6x | c6x*) basic_machine=tic6x-unknown os=-coff ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: asn1c-0.9.28+dfsg/doc/0000755000000000000000000000000013133744516013010 5ustar rootrootasn1c-0.9.28+dfsg/doc/Makefile.am0000644000000000000000000000017613065714043015044 0ustar rootroot SUBDIRS = docsrc man docsdir = $(datadir)/doc/asn1c docs_DATA = $(srcdir)/asn1c-*.pdf EXTRA_DIST = $(srcdir)/asn1c-*.pdf asn1c-0.9.28+dfsg/doc/man/0000755000000000000000000000000013065714043013557 5ustar rootrootasn1c-0.9.28+dfsg/doc/man/Makefile.am0000644000000000000000000000047513065714043015621 0ustar rootroot dist_man1_MANS = asn1c.1 unber.1 enber.1 if HAVE_PANDOC PANDOC_OPTIONS= --from markdown --to man \ --variable header="Version ${VERSION}" \ --variable adjusting:l \ --variable hyphenate:"" \ --standalone %.1: %.man.md ${PANDOC} ${PANDOC_OPTIONS} -o $@ $< endif asn1c-0.9.28+dfsg/doc/man/unber.10000644000000000000000000001046513065714043014762 0ustar rootroot.\" Automatically generated by Pandoc 1.16.0.2 .\" .ad l .TH "unber" "1" "2016\-01\-23" "ASN.1 BER Decoder" "Version 0.9.28" .nh \" Turn off hyphenation by default. .SH NAME .PP unber \-\- the ASN.1 BER Decoder .SH SYNOPSIS .PP unber [\f[B]\-1\f[]] [\f[B]\-i\f[]\f[I]indent\f[]] [\f[B]\-m\f[]] [\f[B]\-p\f[]] [\f[B]\-s\f[]\f[I]skip\f[]] [\f[B]\-t\f[]\f[I]hex\-string\f[]] [\f[B]\-\f[]] [\f[I]input\-filenames\f[]...] .SH DESCRIPTION .PP unber presents the internal structure of BER\-encoded files as a human readable text. A single dash denotes the standard input. .PP (The DER and CER formats are subsets of the BER and are also supported.) .SH OPTIONS .TP .B \-1 Do \f[I]not\f[] attempt to read the next BER structure after the first one. This may be useful if the input contains garbage past the single BER sequence. By default, unber continues decoding until the end of file (input stream). .RS .RE .TP .B \-i \f[I]indent\f[] Use the specified number of spaces for output indentation. Default is 4 spaces. .RS .RE .TP .B \-m Generate shorter output while still preserving BER encoding information. .RS .RE .TP .B \-p Do \f[I]not\f[] attempt to pretty\-print known ASN.1 types (\f[C]BOOLEAN\f[], \f[C]INTEGER\f[], \f[C]OBJECT\ IDENTIFIER\f[], etc). By default, some ASN.1 types are converted into the text representation. .RS .PP This option is required if the \f[C]unber\f[](1) output is used as an input to \f[C]enber\f[](1). .RE .TP .B \-s \f[I]skip\f[] Ignore the first \f[I]skip\f[] bytes in the input stream; useful for stripping off lower level protocol framing data. .RS .RE .TP .B \-t \f[I]hex\-string\f[] Interpret the hex\-string as a sequence of hexadecimal values representing the start of BER TLV encoding. Print the human readable explanation. .RS .RE .SH XML FORMAT .PP unber dumps the output in the regular XML format which preserves most of the information from the underlying binary encoding. .PP The XML opening tag format is as follows: .PP <\f[B]tform\f[] O="\f[B]off\f[]" T="\f[B]tag\f[]" TL="\f[B]t_len\f[]" V="{Indefinite|\f[B]v_len\f[]}" [A="\f[B]type\f[]"] [\f[B]F\f[]]> .PP Where: .TP .B \f[B]tform\f[] Encoding form the value is in: primitive ("P") or constructed ("C") or constructed with indefinite length ("I") .RS .RE .TP .B \f[B]off\f[] Offset of the encoded element in the unber input stream. .RS .RE .TP .B \f[B]tag\f[] The tag class and value in human readable form. .RS .RE .TP .B \f[B]t_len\f[] The length of the TL (BER Tag and Length) encoding. .RS .RE .TP .B \f[B]v_len\f[] The length of the value (V, encoded by the L), may be "Indefinite". .RS .RE .TP .B \f[B]type\f[] Likely name of the underlying ASN.1 type (for UNIVERSAL tags). .RS .RE .TP .B [\f[B]F\f[]] Indicates that the value was reformatted (pretty\-printed). This will never appear in the output produced using the \f[B]\-p\f[] command line option. .RS .RE .SS Example XML output: .PP .PD 0 .P .PD \

US

.PD 0 .P .PD \ \ .PD 0 .P .PD \ \ \ \

832970823

.PD 0 .P .PD \ \
.PD 0 .P .PD
.SH EXAMPLES .PP Decode the given Tag/Length sequence specified in hexadecimal form: .RS .PP unber\ \f[B]\-t\f[] "\f[I]bf 20\f[]" .RE .PP Decode the DER file using two\-spaces indentation: .RS .PP unber\ \f[B]\-i\f[] \f[I]2\f[]\ \f[I]filename.der\f[] .RE .PP Decode the binary stream taken from the standard input: .RS .PP cat \f[I]filename.der\f[] | unber \f[B]\-\f[] .RE .PP Decode the binary stream and encode it back into an identical stream (see \f[C]enber\f[](1)): .RS .PP cat \f[I]filename.der\f[] | unber \f[B]\-p\f[] \f[B]\-\f[] | enber \f[B]\-\f[] > \f[I]filename.ber\f[] .RE .SH FOOTNOTES .PP The constructed XML output is not necessarily well\-formed. .PP When indefinite length encoding is being used, the BER sequence which is not terminated with the end\-of\-content octets will cause the terminating \f[B]\f[] XML tag to disappear. Thus, invalid BER framing directly causes invalid XML output. .PP The \f[C]enber\f[](1) utility understands such XML correctly. .SH SEE ALSO .PP \f[C]enber\f[](1), \f[C]asn1c\f[](1). .SH AUTHORS Lev Walkin . asn1c-0.9.28+dfsg/doc/man/asn1c.10000644000000000000000000001117513065714043014653 0ustar rootroot.\" Automatically generated by Pandoc 1.16.0.2 .\" .ad l .TH "asn1c" "1" "2016\-01\-23" "ASN.1 Compiler" "Version 0.9.28" .nh \" Turn off hyphenation by default. .SH NAME .PP asn1c \-\- the ASN.1 Compiler .SH SYNOPSIS .PP asn1c [\f[B]\-E\f[] [\f[B]\-F\f[]] | \f[B]\-P\f[] | \f[B]\-R\f[]] .PD 0 .P .PD [\f[B]\-S\f[]\f[I]dir\f[]] [\f[B]\-X\f[]] .PD 0 .P .PD [\f[B]\-W\f[]\f[I]debug\-\f[]...] [\f[B]\-f\f[]\f[I]option\f[]] [\f[B]\-gen\-\f[]\f[I]option\f[]] [\f[B]\-pdu\f[]={\f[B]all\f[]|\f[B]auto\f[]|\f[I]Type\f[]}] .PD 0 .P .PD [\f[B]\-print\-\f[]\f[I]option\f[]] .PD 0 .P .PD \f[I]input\-filenames\f[]... .SH DESCRIPTION .PP asn1c compiles ASN.1 specifications into a set of target language (C/C++) encoders and decoders for BER, DER, PER, XER and other encoding rules. .SH OPTIONS .SS Stage Selection Options .TP .B \-E Run the parsing stage only. Print the reconstructed ASN.1 text. .RS .RE .TP .B \-F Used together with \f[B]\-E\f[], instructs the compiler to stop after the ASN.1 syntax tree fixing stage and dump the reconstructed ASN.1 specification to the standard output. .RS .RE .TP .B \-P Dump the compiled output to the standard output instead of creating the target language files on disk. .RS .RE .TP .B \-R Restrict the compiler to generate only the ASN.1 tables, omitting the usual support code. .RS .RE .TP .B \-S \f[I]directory\f[] Use the specified directory with ASN.1 skeleton files. .RS .RE .TP .B \-X Generate an XML DTD schema for the specified ASN.1 files. .RS .RE .SS Warning Options .TP .B \-Werror Treat warnings as errors; abort if any warning is produced. .RS .RE .TP .B \-Wdebug\-lexer Enable lexer debugging during the ASN.1 parsing stage. .RS .RE .TP .B \-Wdebug\-fixer Enable ASN.1 syntax tree fixer debugging during the fixing stage. .RS .RE .TP .B \-Wdebug\-compiler Enable debugging during the actual compile time. .RS .RE .SS Language Options .TP .B \-fbless\-SIZE Allow \f[C]SIZE()\f[] constraint for \f[C]INTEGER\f[], \f[C]ENUMERATED\f[], and other types for which this constraint is normally prohibited by the standard. This is a violation of ASN.1 standard, and the compiler may fail to produce a meaningful code. .RS .RE .TP .B \-fcompound\-names Using this option prevents name collisions in the target source code by using complex names for target language structures. (Name collisions may occur if the ASN.1 module reuses the same identifiers in multiple contexts). .RS .RE .TP .B \-findirect\-choice When generating code for a \f[C]CHOICE\f[] type, compile the \f[C]CHOICE\f[] members as indirect pointers instead of declaring them inline. Consider using this option together with \f[B]\-fno\-include\-deps\f[] to prevent circular references. .RS .RE .TP .B \-fincludes\-quoted Refer to header files in \f[C]#include\f[]s using \f[B]"\f[]double\f[B]"\f[] instead of \f[B]<\f[]angle\f[B]>\f[] quotes. .RS .RE .TP .B \-fknown\-extern\-type=\f[I]name\f[] Pretend the specified type is known. The compiler will assume the target language source files for the given type have been provided manually. .RS .RE .TP .B \-fline\-refs Include ASN.1 module\[aq]s line numbers in generated code comments. .RS .RE .TP .B \-fno\-constraints Do not generate ASN.1 subtype constraint checking code. This may make a shorter executable. .RS .RE .TP .B \-fno\-include\-deps Do not generate courtesy #include lines for non\-critical type dependencies. Helps prevent namespace collisions. .RS .RE .TP .B \-funnamed\-unions Enable unnamed unions in the definitions of target language\[aq]s structures. .RS .RE .TP .B \-fwide\-types Use the unbounded size data types (\f[C]INTEGER_t\f[], \f[C]ENUMERATED_t\f[], \f[C]REAL_t\f[]) by default, instead of using the native machine\[aq]s data types (long, double). .RS .RE .SS Codecs Generation Options .TP .B \-gen\-PER Generate the Packed Encoding Rules (PER) support code. .RS .RE .TP .B \-pdu={all|auto|\f[I]Type\f[]} Create a PDU table for specified types, or discover Protocol Data Units automatically. In case of \f[B]\-pdu=all\f[], all ASN.1 types defined in all modules will form a PDU table. In case of \f[B]\-pdu=auto\f[], all types not referenced by any other type will form a PDU table. If \f[I]Type\f[] is an ASN.1 type identifier, the identifier is added to the generated PDU table. The last form may be specified multiple times to add any number of PDUs. .RS .RE .SS Output Options .TP .B \-print\-constraints When \f[B]\-EF\f[] options are also specified, this option forces the compiler to explain its internal understanding of subtype constraints. .RS .RE .TP .B \-print\-lines Generate "\f[C]\-\-\ #line\f[]" comments in \f[B]\-E\f[] output. .RS .RE .SH SEE ALSO .PP \f[C]unber\f[](1), \f[C]enber\f[](1). .SH AUTHORS Lev Walkin . asn1c-0.9.28+dfsg/doc/man/enber.10000644000000000000000000000322313065714043014734 0ustar rootroot.\" Automatically generated by Pandoc 1.16.0.2 .\" .ad l .TH "enber" "1" "2016\-01\-23" "unber(1) counterpart" "Version 0.9.28" .nh \" Turn off hyphenation by default. .SH NAME .PP enber \-\- Convert the unber XML output back into BER .SH SYNOPSIS .PP enber [\f[B]\-n\f[]] [\f[B]\-\f[]] [\f[I]input\-filenames\f[]...] .SH DESCRIPTION .PP enber converts the XML\-formatted files produced by \f[C]unber\f[](1) back into the BER format. A single dash denotes the standard input. .SH OPTIONS .TP .B \-n Disable input validation. By default, enber performs some basic validity checks against XML input. .RS .RE .SH EXAMPLES .PP Decode a BER sequence and immediately encode it back .RS .PP unber \f[B]\-p\f[] \f[I]filename.ber\f[] | enber \f[B]\-\f[] > \f[I]reconstructed.ber\f[] .RE .SH FOOTNOTES .PP This program does not attempt to perform full\-fledged XML parsing. It is merely compatible with \f[C]unber\f[](1)\[aq]s output. In particular, the XML style comments are not supported. A hash "\f[B]#\f[]" or two dashes "\f[B]\-\-\f[]" following a whitespace is treated as a beginning of a comment line, which is ignored completely. Empty lines are ignored as well. .PP The following example \f[C]enber\f[](1) input demostrates the use of comments: .PP .PD 0 .P .PD \ \ \ \ .PD 0 .P .PD \ \ \ \ \f[B]\-\-\f[] .PD 0 .P .PD \ \ \ \ \f[B]#\f[] Do not terminate: .PD 0 .P .PD \ \ \ \ \f[B]#\f[] the absence of end\-of\-content octets is intentional! .PD 0 .P .PD .SH SEE ALSO .PP \f[C]unber\f[](1), \f[C]asn1c\f[](1). .SH AUTHORS Lev Walkin . asn1c-0.9.28+dfsg/doc/man/unber.man.md0000644000000000000000000000712313065714043015771 0ustar rootroot% unber(1) ASN.1 BER Decoder % Lev Walkin % 2016-01-23 # NAME unber -- the ASN.1 BER Decoder # SYNOPSIS unber [**-1**] [**-i***indent*] [**-m**] [**-p**] [**-s***skip*] [**-t***hex-string*] [**-**] [*input-filenames*...] # DESCRIPTION unber presents the internal structure of BER-encoded files as a human readable text. A single dash denotes the standard input. (The DER and CER formats are subsets of the BER and are also supported.) # OPTIONS -1 : Do *not* attempt to read the next BER structure after the first one. This may be useful if the input contains garbage past the single BER sequence. By default, unber continues decoding until the end of file (input stream). -i *indent* : Use the specified number of spaces for output indentation. Default is 4 spaces. -m : Generate shorter output while still preserving BER encoding information. -p : Do *not* attempt to pretty-print known ASN.1 types (`BOOLEAN`, `INTEGER`, `OBJECT IDENTIFIER`, etc). By default, some ASN.1 types are converted into the text representation. This option is required if the `unber`(1) output is used as an input to `enber`(1). -s *skip* : Ignore the first *skip* bytes in the input stream; useful for stripping off lower level protocol framing data. -t *hex-string* : Interpret the hex-string as a sequence of hexadecimal values representing the start of BER TLV encoding. Print the human readable explanation. # XML FORMAT unber dumps the output in the regular XML format which preserves most of the information from the underlying binary encoding. The XML opening tag format is as follows: <**tform** O="**off**" T="**tag**" TL="**t_len**" V="{Indefinite|**v_len**}" [A="**type**"] [**F**]> Where: **tform** : Encoding form the value is in: primitive ("P") or constructed ("C") or constructed with indefinite length ("I") **off** : Offset of the encoded element in the unber input stream. **tag** : The tag class and value in human readable form. **t_len** : The length of the TL (BER Tag and Length) encoding. **v_len** : The length of the value (V, encoded by the L), may be "Indefinite". **type** : Likely name of the underlying ASN.1 type (for UNIVERSAL tags). [**F**] : Indicates that the value was reformatted (pretty-printed). This will never appear in the output produced using the **-p** command line option. ## Example XML output: | \ | \

US\

| \ | \

832970823\

| \
| \
# EXAMPLES Decode the given Tag/Length sequence specified in hexadecimal form: > unber\ **-t** "*bf 20*" Decode the DER file using two-spaces indentation: > unber\ **-i** *2*\ *filename.der* Decode the binary stream taken from the standard input: > cat *filename.der* | unber **-** Decode the binary stream and encode it back into an identical stream (see `enber`(1)): > cat *filename.der* | unber **-p** **-** | enber **-** > *filename.ber* # FOOTNOTES The constructed XML output is not necessarily well-formed. When indefinite length encoding is being used, the BER sequence which is not terminated with the end-of-content octets will cause the terminating **\** XML tag to disappear. Thus, invalid BER framing directly causes invalid XML output. The `enber`(1) utility understands such XML correctly. # SEE ALSO `enber`(1), `asn1c`(1). asn1c-0.9.28+dfsg/doc/man/enber.man.md0000644000000000000000000000244113065714043015747 0ustar rootroot% enber(1) unber(1) counterpart % Lev Walkin % 2016-01-23 # NAME enber -- Convert the unber XML output back into BER # SYNOPSIS enber [**-n**] [**-**] [*input-filenames*...] # DESCRIPTION enber converts the XML-formatted files produced by `unber`(1) back into the BER format. A single dash denotes the standard input. # OPTIONS -n : Disable input validation. By default, enber performs some basic validity checks against XML input. # EXAMPLES Decode a BER sequence and immediately encode it back > unber **-p** *filename.ber* | enber **-** > *reconstructed.ber* # FOOTNOTES This program does not attempt to perform full-fledged XML parsing. It is merely compatible with `unber`(1)'s output. In particular, the XML style comments are not supported. A hash "**#**" or two dashes "**--**" following a whitespace is treated as a beginning of a comment line, which is ignored completely. Empty lines are ignored as well. The following example `enber`(1) input demostrates the use of comments: | \ | \ | **--** \ | **#** Do not terminate: | **#** the absence of end-of-content octets is intentional! | \ # SEE ALSO `unber`(1), `asn1c`(1). asn1c-0.9.28+dfsg/doc/man/asn1c.man.md0000644000000000000000000000777013065714043015673 0ustar rootroot% asn1c(1) ASN.1 Compiler % Lev Walkin % 2016-01-23 # NAME asn1c -- the ASN.1 Compiler # SYNOPSIS asn1c [**-E** [**-F**] | **-P** | **-R**] \ [**-S***dir*] [**-X**] \ [**-W***debug-*...] [**-f***option*] [**-gen-***option*] [**-pdu**={**all**|**auto**|*Type*}] \ [**-print-***option*] \ *input-filenames*... # DESCRIPTION asn1c compiles ASN.1 specifications into a set of target language (C/C++) encoders and decoders for BER, DER, PER, XER and other encoding rules. # OPTIONS ## Stage Selection Options -E : Run the parsing stage only. Print the reconstructed ASN.1 text. -F : Used together with **-E**, instructs the compiler to stop after the ASN.1 syntax tree fixing stage and dump the reconstructed ASN.1 specification to the standard output. -P : Dump the compiled output to the standard output instead of creating the target language files on disk. -R : Restrict the compiler to generate only the ASN.1 tables, omitting the usual support code. -S *directory* : Use the specified directory with ASN.1 skeleton files. -X : Generate an XML DTD schema for the specified ASN.1 files. ## Warning Options -Werror : Treat warnings as errors; abort if any warning is produced. -Wdebug-lexer : Enable lexer debugging during the ASN.1 parsing stage. -Wdebug-fixer : Enable ASN.1 syntax tree fixer debugging during the fixing stage. -Wdebug-compiler : Enable debugging during the actual compile time. ## Language Options -fbless-SIZE : Allow `SIZE()` constraint for `INTEGER`, `ENUMERATED`, and other types for which this constraint is normally prohibited by the standard. This is a violation of ASN.1 standard, and the compiler may fail to produce a meaningful code. -fcompound-names : Using this option prevents name collisions in the target source code by using complex names for target language structures. (Name collisions may occur if the ASN.1 module reuses the same identifiers in multiple contexts). -findirect-choice : When generating code for a `CHOICE` type, compile the `CHOICE` members as indirect pointers instead of declaring them inline. Consider using this option together with **-fno-include-deps** to prevent circular references. -fincludes-quoted : Refer to header files in `#include`s using **"**double**"** instead of **\<**angle**>** quotes. -fknown-extern-type=*name* : Pretend the specified type is known. The compiler will assume the target language source files for the given type have been provided manually. -fline-refs : Include ASN.1 module's line numbers in generated code comments. -fno-constraints : Do not generate ASN.1 subtype constraint checking code. This may make a shorter executable. -fno-include-deps : Do not generate courtesy #include lines for non-critical type dependencies. Helps prevent namespace collisions. -funnamed-unions : Enable unnamed unions in the definitions of target language's structures. -fwide-types : Use the unbounded size data types (`INTEGER_t`, `ENUMERATED_t`, `REAL_t`) by default, instead of using the native machine's data types (long, double). ## Codecs Generation Options -gen-PER : Generate the Packed Encoding Rules (PER) support code. -pdu={all|auto|*Type*} : Create a PDU table for specified types, or discover Protocol Data Units automatically. In case of **-pdu=all**, all ASN.1 types defined in all modules will form a PDU table. In case of **-pdu=auto**, all types not referenced by any other type will form a PDU table. If *Type* is an ASN.1 type identifier, the identifier is added to the generated PDU table. The last form may be specified multiple times to add any number of PDUs. ## Output Options -print-constraints : When **-EF** options are also specified, this option forces the compiler to explain its internal understanding of subtype constraints. -print-lines : Generate "`-- #line`" comments in **-E** output. # SEE ALSO `unber`(1), `enber`(1). asn1c-0.9.28+dfsg/doc/docsrc/0000755000000000000000000000000013065714043014261 5ustar rootrootasn1c-0.9.28+dfsg/doc/docsrc/Makefile.am0000644000000000000000000000052413065714043016316 0ustar rootroot XELATEX_FLAGS = -halt-on-error -file-line-error XELATEX = xelatex TEXSRC = '\def\asnver{@VERSION@}\input{asn1c-usage}' regen: $(XELATEX) $(XELATEX_FLAGS) -no-pdf $(TEXSRC) $(XELATEX) $(XELATEX_FLAGS) -no-pdf $(TEXSRC) $(XELATEX) $(XELATEX_FLAGS) $(TEXSRC) EXTRA_DIST = $(srcdir)/*.tex CLEANFILES = *.*~ *.aux *.dvi *.log *.out *.toc asn1c-0.9.28+dfsg/doc/docsrc/asn1c-usage.tex0000644000000000000000000013504013065714043017115 0ustar rootroot\batchmode \documentclass[english,oneside,12pt]{book} \usepackage[no-math]{fontspec} \usepackage{MnSymbol} \usepackage{xunicode} \usepackage{xltxtra} \usepackage[hmargin={1in,1in},vmargin={1.5in,1.5in}]{geometry} \defaultfontfeatures{Mapping=tex-text} \setmainfont{PT Sans} \setsansfont{PT Sans} \setmonofont{Consolas} \usepackage{fancyhdr} \usepackage{longtable} \usepackage{booktabs} \usepackage{varioref} \usepackage{url} \usepackage{xcolor} \usepackage{listings} \usepackage{setspace} \usepackage{unicode-math} \usepackage{perpage} \MakePerPage{footnote} \setstretch{1.1} % Courier 10 Pitch \def\courierFont{Courier10 BT WGL4} %\def\courierFont{Consolas} \setmonofont[Scale=1.05]{\courierFont} \setmathfont[Scale=1.05]{Cambria Math} \makeatletter %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands. \lstloadlanguages{C,bash} \newfontfamily\listingfont[Scale=1.05]{\courierFont} \newfontfamily\inlinelistingfont[Scale=1.05]{\courierFont} \definecolor{clrlcomment}{gray}{0.3} \definecolor{clrlkeyword}{rgb}{0.588,0.145,0.18} \newcommand{\listingkeyword}[1]{\color{clrlkeyword}{#1}} \newcommand{\listingstring}[1]{\color{clrlcomment}{#1}} \newcommand{\listingcomment}[1]{\color{clrlcomment}{#1}} \lstset{tabsize=4, showstringspaces=false, showtabs=false, showspaces=false, keywordstyle=\listingkeyword, stringstyle=\listingstring, commentstyle=\listingcomment, xleftmargin=\parindent, columns=fixed, escapechar=\%, texcl } \lstdefinestyle{listingStyle}{ basicstyle=\small\listingfont, stringstyle=\listingstring, breaklines=true, breakatwhitespace=true, flexiblecolumns=false } \lstdefinelanguage{asn1}{ morekeywords={DEFINITIONS,BEGIN,END,SEQUENCE,SET,OF,CHOICE,OPTIONAL}, morecomment=[l]{--}, morecomment=[n]{/*}{*/} } \lstnewenvironment{codesample}[1][]{\lstset{style=listingStyle,language=C,#1}}{} \lstnewenvironment{bash}[1][]{\lstset{style=listingStyle,language=bash,#1}}{} \lstnewenvironment{asn}[1][]{\lstset{style=listingStyle,language=asn1,#1}}{} \def\code{lstinline} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands. \usepackage{extramarks} \lhead{\firstxmark} \rfoot{\lastxmark} \definecolor{clrlink}{rgb}{0,0.4,0} \definecolor{clrurl}{rgb}{0,0,.6} \usepackage[colorlinks=true, linkcolor={clrlink}, citecolor={clrlink}, urlcolor={clrurl}, pdfauthor={Lev Walkin}, pdftitle={Using the Open Source ASN.1 Compiler}, pdfkeywords={ASN.1,asn1c,compiler}, bookmarksopen,bookmarksopenlevel=1, pdffitwindow, xetex ]{hyperref} \makeatother \usepackage{babel} \begin{document} \title{Using the Open Source ASN.1 Compiler\\ \vspace*{0.4cm} \Large Documentation for asn1c version \asnver{}} \author{Lev Walkin <\href{mailto:vlm@lionet.info?Subject=asn1c}{vlm@lionet.info}>} \pagestyle{fancy} \fancyhead[L]{\leftmark} \fancyhead[R]{\href{http://lionet.info/asn1c}{asn1c-\asnver}} \maketitle \tableofcontents{} \part{Using the ASN.1 Compiler} \chapter{Introduction to the ASN.1 Compiler} The purpose of the ASN.1 compiler is to convert the specifications in ASN.1 notation into some other language. At this moment, only C and C++ target languages are supported, the latter is in upward compatibility mode. The compiler reads the specification and emits a series of target language structures (C structs, unions, enums) describing the corresponding ASN.1 types. The compiler also creates the code which allows automatic serialization and deserialization of these structures using several standardized encoding rules (BER, DER, XER, PER). For example, suppose the following ASN.1 module is given% \footnote{Part \ref{par:ASN.1-Basics} provides a quick reference on the ASN.1 notation.}: \begin{asn} RectangleTest DEFINITIONS ::= BEGIN Rectangle ::= SEQUENCE { height INTEGER, -- Height of the rectangle width INTEGER -- Width of the rectangle } END \end{asn} The compiler would read this ASN.1 definition and produce the following C type: \begin{codesample} typedef struct Rectangle_s { long height; long width; } Rectangle_t; \end{codesample} It would also create the code for converting this structure into platform-independent wire representation (a serializer API) and the decoder of such wire representation back into local, machine-specific type (a deserializer API). \section{Quick start with asn1c} After building and installing the compiler, the \emph{asn1c} command may be used to compile the ASN.1 modules% \footnote{This is probably \textbf{not} what you want to try out right now. Read through the rest of this chapter and check the Section~\ref{sec:Command-line-options} to find out about \textbf{-P} and \textbf{-R} options.% }: \begin{bash} asn1c %\emph{}% \end{bash} If several ASN.1 modules contain interdependencies, all of the files must be specified altogether: \begin{bash} asn1c %\emph{ ...}% \end{bash} The compiler \textbf{-E} and \textbf{-EF} options are used for testing the parser and the semantic fixer, respectively. These options will instruct the compiler to dump out the parsed (and fixed, if \textbf{-F} is involved) ASN.1 specification as it was understood by the compiler. It might be useful to check whether a particular syntactic construct is properly supported by the compiler. \begin{bash} asn1c %\textbf{-EF} \emph{}% \end{bash} The \textbf{-P} option is used to dump the compiled output on the screen instead of creating a bunch of .c and .h files on disk in the current directory. You would probably want to start with \textbf{-P} option instead of creating a mess in your current directory. Another option, \textbf{-R}, asks compiler to only generate the files which need to be generated, and supress linking in the numerous support files. Print the compiled output instead of creating multiple source files: \begin{bash} asn1c %\textbf{-P} \emph{}% \end{bash} \clearpage{} \section{Recognizing compiler output} The asn1c compiler produces a number of files: \begin{itemize} \item A set of .c and .h files for each type defined in the ASN.1 specification. These files will be named similarly to the ASN.1 types (\emph{Rectangle.c} and \emph{Rectangle.h} for the RectangleTest ASN.1 module defined in the beginning of this document). \item A set of helper .c and .h files which contain the generic encoders, decoders and other useful routines. There will be quite a few of them, some of them are not even always necessary, but the overall amount of code after compilation will be rather small anyway. \item A \emph{converter-sample.c} file containing the \emph{int main()} function with a fully functioning decoder. It can convert a given PDU between BER, XER and possibly PER (if -gen-PER option to asn1c was in effect). At some point you will want to replace this file with your own file containing the \emph{int main()} function. \item A \emph{Makefile.am.sample} file mentioning all the files created at the earlier steps. This file is suitable for either automake suite or the plain `make` utility. Just rename it into \emph{Makefile}. \end{itemize} It is possible to compile everything with just a couple of instructions: \begin{bash} asn1c -pdu=%\emph{Rectangle}% *.asn1 make -f Makefile.am.sample # If you use `make` \end{bash} or \begin{bash} asn1c *.asn1 cc -I. -DPDU=%\emph{Rectangle}% -o rectangle.exe *.c # ... or like this \end{bash} Refer to the Chapter \ref{cha:Step-by-step-examples} for a sample \emph{int main()} function if you want some custom logic and not satisfied with the supplied \emph{converter-sample.c}. \clearpage{} \section{\label{sec:Command-line-options}Command line options} The following table summarizes the asn1c command line options. \renewcommand{\arraystretch}{1.33} \begin{longtable}{lp{4in}} \textbf{Stage Selection Options} & \textbf{Description}\\ \midrule {\ttfamily -E} & {\small Stop after the parsing stage and print the reconstructed ASN.1 specification code to the standard output.}\\ {\ttfamily -F} & {\small Used together with \texttt{-E}, instructs the compiler to stop after the ASN.1 syntax tree fixing stage and dump the reconstructed ASN.1 specification to the standard output.}\\ {\ttfamily -P} & {\small Dump the compiled output to the standard output instead of creating the target language files on disk.}\\ {\ttfamily -R} & {\small Restrict the compiler to generate only the ASN.1 tables, omitting the usual support code.}\\ {\ttfamily -S~\emph{}} & {\small Use the specified directory with ASN.1 skeleton files.}\\ {\ttfamily -X} & {\small Generate the XML DTD for the specified ASN.1 modules.}\\\\ \textbf{Warning Options} & \textbf{Description}\\ \midrule {\ttfamily -Werror} & {\small Treat warnings as errors; abort if any warning is produced.}\\ {\ttfamily -Wdebug-lexer} & {\small Enable lexer debugging during the ASN.1 parsing stage.}\\ {\ttfamily -Wdebug-fixer} & {\small Enable ASN.1 syntax tree fixer debugging during the fixing stage.}\\ {\ttfamily -Wdebug-compiler} & {\small Enable debugging during the actual compile time.}\\ \\ \textbf{Language Options} & \textbf{Description}\\ \midrule {\ttfamily -fbless-SIZE} & {\small Allow SIZE() constraint for INTEGER, ENUMERATED, and other types for which this constraint is normally prohibited by the standard. This is a violation of an ASN.1 standard and compiler may fail to produce the meaningful code.}\\ {\ttfamily -fcompound-names} & {\small Use complex names for C structures. Using complex names prevents name clashes in case the module reuses the same identifiers in multiple contexts.}\\ {\ttfamily -findirect-choice} & {\small When generating code for a CHOICE type, compile the CHOICE members as indirect pointers instead of declaring them inline. Consider using this option together with \texttt{-fno-include-deps} to prevent circular references.}\\ {\ttfamily -fincludes-quoted} & {\small Generate \#include lines in "double" instead of quotes.}\\ {\ttfamily -fknown-extern-type=\emph{}} & {\small Pretend the specified type is known. The compiler will assume the target language source files for the given type have been provided manually. }\\ {\ttfamily -fline-refs} & {\small Include ASN.1 module's line numbers in generated code comments.}\\ {\ttfamily -fno-constraints} & {\small Do not generate ASN.1 subtype constraint checking code. This may produce a shorter executable.}\\ {\ttfamily -fno-include-deps} & {\small Do not generate courtesy \#include lines for non-critical dependencies.}\\ {\ttfamily -funnamed-unions} & {\small Enable unnamed unions in the definitions of target language's structures.}\\ {\ttfamily -fwide-types} & {\small Use the wide integer types (INTEGER\_t, REAL\_t) instead of machine's native data types (long, double). }\\\\ \textbf{Codecs Generation Options} & \textbf{Description}\\ \midrule {\ttfamily -gen-PER} & {\small Generate the Packed Encoding Rules (PER) support code.}\\ {\ttfamily -pdu=\{\textbf{all}|\textbf{auto}|\emph{Type}\}} & {\small Create a PDU table for specified types, or discover the Protocol Data Units automatically. In case of \texttt{-pdu=\textbf{all}}, all ASN.1 types defined in all modules wil form a PDU table. In case of \texttt{-pdu=\textbf{auto}}, all types not referenced by any other type will form a PDU table. If \texttt{\emph{Type}} is an ASN.1 type identifier, it is added to a PDU table. The last form may be specified multiple times.}\\ \\ \textbf{Output Options} & \textbf{Description}\\ \midrule {\ttfamily -print-constraints} & {\small When \texttt{-EF} are also specified, this option forces the compiler to explain its internal understanding of subtype constraints.}\\ {\ttfamily -print-lines} & {\small Generate \texttt{``-{}- \#line''} comments in \texttt{-E} output.}\\ \end{longtable} \renewcommand{\arraystretch}{1} \chapter{Using the ASN.1 Compiler} \section[Invoking the helper code]{Invoking the ASN.1 helper code} First of all, you should include one or more header files into your application. Typically, it is enough to include the header file of the main PDU type. For our Rectangle module, including the Rectangle.h file is sufficient: \begin{codesample} #include \end{codesample} The header files defines the C structure corresponding to the ASN.1 definition of a rectangle and the declaration of the ASN.1 type descriptor, which is used as an argument to most of the functions provided by the ASN.1 module. For example, here is the code which frees the Rectangle\_t structure: \begin{codesample} Rectangle_t *rect = ...; asn_DEF_Rectangle.free_struct(&asn_DEF_Rectangle, rect, 0); \end{codesample} This code defines a \emph{rect} pointer which points to the Rectangle\_t structure which needs to be freed. The second line invokes the generic \emph{free\_struct()} routine created specifically for this Rectangle\_t structure. The \emph{asn\_DEF\_Rectangle} is the type descriptor, which holds a collection of routines to deal with the Rectangle\_t structure. The following member functions of the asn\_DEF\_Rectangle type descriptor are of interest: \begin{description} \item [{ber\_decoder}] This is the generic \emph{restartable}% \footnote{Restartability mean that if the decoder encounters the end of the buffer it may be invoked again with the rest of the buffer to continue decoding.} BER decoder (Basic Encoding Rules). This decoder would create and/or fill the target structure for you. See Section~\ref{sub:Decoding-BER}. \item [{der\_encoder}] This is the generic DER encoder (Distinguished Encoding Rules). This encoder will take the target structure and encode it into a series of bytes. See Section~\ref{sub:Encoding-DER}. NOTE: DER encoding is a subset of BER. Any BER decoder should be able to handle DER input. \item [{xer\_decoder}] This is the generic XER decoder. It takes both BASIC-XER or CANONICAL-XER encodings and deserializes the data into a local, machine-dependent representation. See Section~\ref{sub:Decoding-XER}. \item [{xer\_encoder}] This is the XER encoder (XML Encoding Rules). This encoder will take the target structure and represent it as an XML (text) document using either BASIC-XER or CANONICAL-XER encoding rules. See Section~\ref{sub:Encoding-XER}. \item [{uper\_decoder}] This is the Unaligned PER decoder. \item [{uper\_encoder}] This is the Unaligned Basic PER encoder. This encoder will take the target structure and encode it into a series of bytes. \item [{check\_constraints}] Check that the contents of the target structure are semantically valid and constrained to appropriate implicit or explicit subtype constraints. See Section~\ref{sub:Validating-the-target}. \item [{print\_struct}] This function convert the contents of the passed target structure into human readable form. This form is not formal and cannot be converted back into the structure, but it may turn out to be useful for debugging or quick-n-dirty printing. See Section~\ref{sub:Printing-the-target}. \item [{free\_struct}] This is a generic disposal which frees the target structure. See Section~\ref{sub:Freeing-the-target}. \end{description} Each of the above function takes the type descriptor (\emph{asn\_DEF\_\ldots{}}) and the target structure (\emph{rect}, in the above example). \subsection{\label{sub:Decoding-BER}Decoding BER} The Basic Encoding Rules describe the most widely used (by the ASN.1 community) way to encode and decode a given structure in a machine-independent way. Several other encoding rules (CER, DER) define a more restrictive versions of BER, so the generic BER parser is also capable of decoding the data encoded by CER and DER encoders. The opposite is not true. \emph{The ASN.1 compiler provides the generic BER decoder which is capable of decoding BER, CER and DER encoded data.} The decoder is restartable (stream-oriented), which means that in case the buffer has less data than it is expected, the decoder will process whatever there is available and ask for more data to be provided. Please note that the decoder may actually process less data than it was given in the buffer, which means that you must be able to make the next buffer contain the unprocessed part of the previous buffer. Suppose, you have two buffers of encoded data: 100 bytes and 200 bytes. \begin{itemize} \item You can concatenate these buffers and feed the BER decoder with 300 bytes of data, or \item You can feed it the first buffer of 100 bytes of data, realize that the ber\_decoder consumed only 95 bytes from it and later feed the decoder with 205 bytes buffer which consists of 5 unprocessed bytes from the first buffer and the additional 200 bytes from the second buffer. \end{itemize} This is not as convenient as it could be (the BER encoder could consume the whole 100 bytes and keep these 5 bytes in some temporary storage), but in case of existing stream based processing it might actually fit well into existing algorithm. Suggestions are welcome. Here is the simplest example of BER decoding: \begin{codesample} Rectangle_t * simple_deserializer(const void *buffer, size_t buf_size) { asn_dec_rval_t rval; Rectangle_t *%$\underbracket{\textrm{\listingfont rect = 0}}$%; /* %\textbf{\color{red}Note this 0\footnote{Forgetting to properly initialize the pointer to a destination structure is a major source of support requests.}!}% */ rval = %\textbf{asn\_DEF\_Rectangle.ber\_decoder}%(0, &asn_DEF_Rectangle, (void **) %$\underbracket{\textrm{\listingfont \&rect}}$%, /* Decoder %\emph{moves}% the pointer */ buffer, buf_size, 0); if(rval%\textbf{.code}% == RC_OK) { return rect; /* Decoding succeeded */ } else { /* Free partially decoded rect */ asn_DEF_Rectangle.free_struct(&asn_DEF_Rectangle, rect, 0); return 0; } } \end{codesample} The code above defines a function, \emph{simple\_deserializer}, which takes a buffer and its length and is expected to return a pointer to the Rectangle\_t structure. Inside, it tries to convert the bytes passed into the target structure (rect) using the BER decoder and returns the rect pointer afterwards. If the structure cannot be deserialized, it frees the memory which might be left allocated by the unfinished \emph{ber\_decoder} routine and returns 0 (no data). (This \textbf{freeing is necessary} because the ber\_decoder is a restartable procedure, and may fail just because there is more data needs to be provided before decoding could be finalized). The code above obviously does not take into account the way the \emph{ber\_decoder()} failed, so the freeing is necessary because the part of the buffer may already be decoded into the structure by the time something goes wrong. A little less wordy would be to invoke a globally available \emph{ber\_decode()} function instead of dereferencing the asn\_DEF\_Rectangle type descriptor: \begin{codesample} rval = ber_decode(0, &asn_DEF_Rectangle, (void **)&rect, buffer, buf_size); \end{codesample} Note that the initial (asn\_DEF\_Rectangle.ber\_decoder) reference is gone, and also the last argument (0) is no longer necessary. These two ways of BER decoder invocations are fully equivalent. The BER de\emph{coder} may fail because of (\emph{the following RC\_\ldots{} codes are defined in ber\_decoder.h}): \begin{itemize} \item RC\_WMORE: There is more data expected than it is provided (stream mode continuation feature); \item RC\_FAIL: General failure to decode the buffer; \item \ldots{} other codes may be defined as well. \end{itemize} Together with the return code (.code) the asn\_dec\_rval\_t type contains the number of bytes which is consumed from the buffer. In the previous hypothetical example of two buffers (of 100 and 200 bytes), the first call to ber\_decode() would return with .code = RC\_WMORE and .consumed = 95. The .consumed field of the BER decoder return value is \textbf{always} valid, even if the decoder succeeds or fails with any other return code. Look into ber\_decoder.h for the precise definition of ber\_decode() and related types. \subsection{\label{sub:Encoding-DER}Encoding DER} The Distinguished Encoding Rules is the \emph{canonical} variant of BER encoding rules. The DER is best suited to encode the structures where all the lengths are known beforehand. This is probably exactly how you want to encode: either after a BER decoding or after a manual fill-up, the target structure contains the data which size is implicitly known before encoding. Among other uses, the DER encoding is used to encode X.509 certificates. As with BER decoder, the DER encoder may be invoked either directly from the ASN.1 type descriptor (asn\_DEF\_Rectangle) or from the stand-alone function, which is somewhat simpler: \begin{codesample} /* * This is the serializer itself. * It supplies the DER encoder with the * pointer to the custom output function. */ ssize_t simple_serializer(FILE *ostream, Rectangle_t *rect) { asn_enc_rval_t er; /* Encoder return value */ er = der_encode(&asn_DEF_Rect, rect, write_stream, ostream); if(er%\textbf{.encoded}% == -1) { fprintf(stderr, "Cannot encode %\%%s: %\%%s\n", er%\textbf{.failed\_type}%->name, strerror(errno)); return -1; } else { /* Return the number of bytes */ return er.encoded; } } \end{codesample} As you see, the DER encoder does not write into some sort of buffer or something. It just invokes the custom function (possible, multiple times) which would save the data into appropriate storage. The optional argument \emph{app\_key} is opaque for the DER encoder code and just used by \emph{\_write\_stream()} as the pointer to the appropriate output stream to be used. If the custom write function is not given (passed as 0), then the DER encoder will essentially do the same thing (i.~e., encode the data) but no callbacks will be invoked (so the data goes nowhere). It may prove useful to determine the size of the structure's encoding before actually doing the encoding% \footnote{It is actually faster too: the encoder might skip over some computations which aren't important for the size determination.% }. Look into der\_encoder.h for the precise definition of der\_encode() and related types. \subsection{\label{sub:Encoding-XER}Encoding XER} The XER stands for XML Encoding Rules, where XML, in turn, is eXtensible Markup Language, a text-based format for information exchange. The encoder routine API comes in two flavors: stdio-based and callback-based. With the callback-based encoder, the encoding process is very similar to the DER one, described in Section~\ref{sub:Encoding-DER}. The following example uses the definition of write\_stream() from up there. \begin{codesample} /* * This procedure generates the XML document * by invoking the XER encoder. * NOTE: Do not copy this code verbatim! * If the stdio output is necessary, * use the xer_fprint() procedure instead. * See Section~%\ref{sub:Printing-the-target}%. */ int print_as_XML(FILE *ostream, Rectangle_t *rect) { asn_enc_rval_t er; /* Encoder return value */ er = xer_encode(&asn_DEF_Rectangle, rect, XER_F_BASIC, /* BASIC-XER or CANONICAL-XER */ write_stream, ostream); return (er.encoded == -1) ? -1 : 0; } \end{codesample} Look into xer\_encoder.h for the precise definition of xer\_encode() and related types. See Section~\ref{sub:Printing-the-target} for the example of stdio-based XML encoder and other pretty-printing suggestions. \subsection{\label{sub:Decoding-XER}Decoding XER} The data encoded using the XER rules can be subsequently decoded using the xer\_decode() API call: \begin{codesample} Rectangle_t * XML_to_Rectangle(const void *buffer, size_t buf_size) { asn_dec_rval_t rval; Rectangle_t *%$\underbracket{\textrm{\listingfont rect = 0}}$%; /* %\textbf{\color{red}Note this 0\footnote{Forgetting to properly initialize the pointer to a destination structure is a major source of support requests.}!}% */ rval = xer_decode(0, &asn_DEF_Rectangle, (void **)&rect, buffer, buf_size); if(rval%\textbf{.code}% == RC_OK) { return rect; /* Decoding succeeded */ } else { /* Free partially decoded rect */ asn_DEF_Rectangle.free_struct(&asn_DEF_Rectangle, rect, 0); return 0; } } \end{codesample} The decoder takes both BASIC-XER and CANONICAL-XER encodings. The decoder shares its data consumption properties with BER decoder; please read the Section~\ref{sub:Decoding-BER} to know more. Look into xer\_decoder.h for the precise definition of xer\_decode() and related types. \subsection{\label{sub:Validating-the-target}Validating the target structure} Sometimes the target structure needs to be validated. For example, if the structure was created by the application (as opposed to being decoded from some external source), some important information required by the ASN.1 specification might be missing. On the other hand, the successful decoding of the data from some external source does not necessarily mean that the data is fully valid either. It might well be the case that the specification describes some subtype constraints that were not taken into account during decoding, and it would actually be useful to perform the last check when the data is ready to be encoded or when the data has just been decoded to ensure its validity according to some stricter rules. The asn\_check\_constraints() function checks the type for various implicit and explicit constraints. It is recommended to use asn\_check\_constraints() function after each decoding and before each encoding. Look into constraints.h for the precise definition of asn\_check\_constraints() and related types. \subsection{\label{sub:Printing-the-target}Printing the target structure} There are two ways to print the target structure: either invoke the print\_struct member of the ASN.1 type descriptor, or using the asn\_fprint() function, which is a simpler wrapper of the former: \begin{codesample} asn_fprint(stdout, &asn_DEF_Rectangle, rect); \end{codesample} Look into constr\_TYPE.h for the precise definition of asn\_fprint() and related types. Another practical alternative to this custom format printing would be to invoke XER encoder. The default BASIC-XER encoder performs reasonable formatting for the output to be useful and human readable. To invoke the XER decoder in a manner similar to asn\_fprint(), use the xer\_fprint() call: \begin{codesample} xer_fprint(stdout, &asn_DEF_Rectangle, rect); \end{codesample} See Section~\ref{sub:Encoding-XER} for XML-related details. \subsection{\label{sub:Freeing-the-target}Freeing the target structure} Freeing the structure is slightly more complex than it may seem to. When the ASN.1 structure is freed, all the members of the structure and their submembers are recursively freed as well. But it might not be feasible to free the structure itself. Consider the following case: \begin{codesample} struct my_figure { /* The custom structure */ int flags; /* */ /* The type is generated by the ASN.1 compiler */ Rectangle_t rect; /* other members of the structure */ }; \end{codesample} In this example, the application programmer defined a custom structure with one ASN.1-derived member (rect). This member is not a reference to the Rectangle\_t, but an in-place inclusion of the Rectangle\_t structure. If the freeing is necessary, the usual procedure of freeing everything must not be applied to the \&rect pointer itself, because it does not point to the memory block directly allocated by the memory allocation routine, but instead lies within a block allocated for the my\_figure structure. To solve this problem, the free\_struct routine has the additional argument (besides the obvious type descriptor and target structure pointers), which is the flag specifying whether the outer pointer itself must be freed (0, default) or it should be left intact (non-zero value). \begin{codesample} /* %\textbf{1. Rectangle\_t is defined within my\_figure}% */ struct my_figure { Rectangle_t rect; } *mf = ...; /* * Freeing the Rectangle_t * without freeing the mf->rect area. */ asn_DEF_Rectangle.free_struct( &asn_DEF_Rectangle, &mf->rect, %\textbf{1 /* !free */}%); /* %\textbf{2. Rectangle\_t is a stand-alone pointer}% */ Rectangle_t *rect = ...; /* * Freeing the Rectangle_t * and freeing the rect pointer. */ asn_DEF_Rectangle.free_struct( &asn_DEF_Rectangle, rect, %\textbf{0 /* free the pointer too */}%); \end{codesample} It is safe to invoke the \emph{free\_struct} function with the target structure pointer set to 0 (NULL), the function will do nothing. For the programmer's convenience, the following macros are available: \begin{codesample} ASN_STRUCT_FREE(asn_DEF, ptr); ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF, ptr); \end{codesample} These macros bear the same semantics as the \emph{free\_struct} function invocation, discussed above. \chapter{\label{cha:Step-by-step-examples}Step by step examples} \section{A ``Rectangle'' Encoder} This example will help you create a simple BER and XER encoder of a ``Rectangle'' type used throughout this document. \begin{enumerate} \item Create a file named \textbf{rectangle.asn1} with the following contents: \begin{asn} RectangleModule1 DEFINITIONS ::= BEGIN Rectangle ::= SEQUENCE { height INTEGER, width INTEGER } END \end{asn} \item Compile it into the set of .c and .h files using asn1c compiler \cite{ASN1C}: \begin{bash} asn1c %\textbf{rectangle.asn1}% \end{bash} \item Alternatively, use the Online ASN.1 compiler \cite{AONL} by uploading the \textbf{rectangle.asn1} file into the Web form and unpacking the produced archive on your computer. \item By this time, you should have gotten multiple files in the current directory, including the \textbf{Rectangle.c} and \textbf{Rectangle.h}. \item Create a main() routine which creates the Rectangle\_t structure in memory and encodes it using BER and XER encoding rules. Let's name the file \textbf{main.c}: \begin{codesample}[basicstyle=\scriptsize\listingfont] #include #include #include /* Rectangle ASN.1 type */ /* Write the encoded output into some FILE stream. */ static int write_out(const void *buffer, size_t size, void *app_key) { FILE *out_fp = app_key; size_t wrote = fwrite(buffer, 1, size, out_fp); return (wrote == size) ? 0 : -1; } int main(int ac, char **av) { Rectangle_t *rectangle; /* Type to encode */ asn_enc_rval_t ec; /* Encoder return value */ /* Allocate the Rectangle_t */ rectangle = calloc(1, sizeof(Rectangle_t)); /* not malloc! */ if(!rectangle) { perror("calloc() failed"); exit(1); } /* Initialize the Rectangle members */ rectangle->height = 42; /* any random value */ rectangle->width = 23; /* any random value */ /* BER encode the data if filename is given */ if(ac < 2) { fprintf(stderr, "Specify filename for BER output\n"); } else { const char *filename = av[1]; FILE *fp = fopen(filename, "wb"); /* for BER output */ if(!fp) { perror(filename); exit(1); } /* Encode the Rectangle type as BER (DER) */ ec = der_encode(&asn_DEF_Rectangle, rectangle, write_out, fp); fclose(fp); if(ec.encoded == -1) { fprintf(stderr, "Could not encode Rectangle (at %\%%s)\n", ec.failed_type ? ec.failed_type->name : "unknown"); exit(1); } else { fprintf(stderr, "Created %\%%s with BER encoded Rectangle\n", filename); } } /* Also print the constructed Rectangle XER encoded (XML) */ xer_fprint(stdout, &asn_DEF_Rectangle, rectangle); return 0; /* Encoding finished successfully */ } \end{codesample} \item Compile all files together using C compiler (varies by platform): \begin{bash} cc -I. -o %\textbf{\emph{rencode}} \emph{*.c}% \end{bash} \item Voila! You have just created the BER and XER encoder of a Rectangle type, named \textbf{rencode}! \end{enumerate} \section{\label{sec:A-Rectangle-Decoder}A ``Rectangle'' Decoder} This example will help you to create a simple BER decoder of a simple ``Rectangle'' type used throughout this document. \begin{enumerate} \item Create a file named \textbf{rectangle.asn1} with the following contents: \begin{asn} RectangleModule1 DEFINITIONS ::= BEGIN Rectangle ::= SEQUENCE { height INTEGER, width INTEGER } END \end{asn} \item Compile it into the set of .c and .h files using asn1c compiler \cite{ASN1C}: \begin{bash} asn1c %\textbf{rectangle.asn1}% \end{bash} \item Alternatively, use the Online ASN.1 compiler \cite{AONL} by uploading the \textbf{rectangle.asn1} file into the Web form and unpacking the produced archive on your computer. \item By this time, you should have gotten multiple files in the current directory, including the \textbf{Rectangle.c} and \textbf{Rectangle.h}. \item Create a main() routine which takes the binary input file, decodes it as it were a BER-encoded Rectangle type, and prints out the text (XML) representation of the Rectangle type. Let's name the file \textbf{main.c}: \begin{codesample}[basicstyle=\scriptsize\listingfont] #include #include #include /* Rectangle ASN.1 type */ int main(int ac, char **av) { char buf[1024]; /* Temporary buffer */ asn_dec_rval_t rval; /* Decoder return value */ Rectangle_t *%$\underbracket{\textrm{\listingfont rectangle = 0}}$%; /* Type to decode. %\textbf{\color{red}Note this 0\footnote{Forgetting to properly initialize the pointer to a destination structure is a major source of support requests.}!}% */ FILE *fp; /* Input file handler */ size_t size; /* Number of bytes read */ char *filename; /* Input file name */ /* Require a single filename argument */ if(ac != 2) { fprintf(stderr, "Usage: %\%%s \n", av[0]); exit(1); } else { filename = av[1]; } /* Open input file as read-only binary */ fp = fopen(filename, "rb"); if(!fp) { perror(filename); exit(1); } /* Read up to the buffer size */ size = fread(buf, 1, sizeof(buf), fp); fclose(fp); if(!size) { fprintf(stderr, "%\%%s: Empty or broken\n", filename); exit(1); } /* Decode the input buffer as Rectangle type */ rval = ber_decode(0, &asn_DEF_Rectangle, (void **)&rectangle, buf, size); if(rval.code != RC_OK) { fprintf(stderr, "%\%%s: Broken Rectangle encoding at byte %\%%ld\n", filename, (long)rval.consumed); exit(1); } /* Print the decoded Rectangle type as XML */ xer_fprint(stdout, &asn_DEF_Rectangle, rectangle); return 0; /* Decoding finished successfully */ } \end{codesample} \item Compile all files together using C compiler (varies by platform): \begin{bash} cc -I. -o %\textbf{\emph{rdecode}} \emph{*.c}% \end{bash} \item Voila! You have just created the BER decoder of a Rectangle type, named \textbf{rdecode}! \end{enumerate} \chapter{Constraint validation examples} This chapter shows how to define ASN.1 constraints and use the generated validation code. \section{Adding constraints into ``Rectangle'' type} This example shows how to add basic constraints to the ASN.1 specification and how to invoke the constraints validation code in your application. \begin{enumerate} \item Create a file named \textbf{rectangle.asn1} with the following contents: \begin{asn} RectangleModuleWithConstraints DEFINITIONS ::= BEGIN Rectangle ::= SEQUENCE { height INTEGER (0..100), -- Value range constraint width INTEGER (0..MAX) -- Makes width non-negative } END \end{asn} \item Compile the file according to procedures shown in the previous chapter. \item Modify the Rectangle type processing routine (you can start with the main() routine shown in the Section~\ref{sec:A-Rectangle-Decoder}) by placing the following snippet of code \emph{before} encoding and/or \emph{after} decoding the Rectangle type% \footnote{Placing the constraint checking code \emph{before encoding} helps to make sure the data is correct and within constraints before sharing the data with anyone else. Placing the constraint checking code \emph{after decoding} helps to make sure the application got the valid contents before making use of it.% }: \begin{codesample} int ret; /* Return value */ char errbuf[128]; /* Buffer for error message */ size_t errlen = sizeof(errbuf); /* Size of the buffer */ /* ... here goes the Rectangle %\emph{decoding}% code ... */ ret = asn_check_constraints(&asn_DEF_Rectangle, rectangle, errbuf, &errlen); /* assert(errlen < sizeof(errbuf)); // you may rely on that */ if(ret) { fprintf(stderr, "Constraint validation failed: %\%%s\n", errbuf /* errbuf is properly nul-terminated */ ); /* exit(...); // Replace with appropriate action */ } /* ... here goes the Rectangle %\emph{encoding}% code ... */ \end{codesample} \item Compile the resulting C code as shown in the previous chapters. \item Try to test the constraints checking code by assigning integer value 101 to the \textbf{.height} member of the Rectangle structure, or a negative value to the \textbf{.width} member. In either case, the program should print ``Constraint validation failed'' message, followed by a short explanation why validation did not succeed. \item Done. \end{enumerate} \part{\label{par:ASN.1-Basics}ASN.1 Basics} \chapter{\label{cha:Abstract-Syntax-Notation:}Abstract Syntax Notation: ASN.1} \emph{This chapter defines some basic ASN.1 concepts and describes several most widely used types. It is by no means an authoritative or complete reference. For more complete ASN.1 description, please refer to Olivier Dubuisson's book \cite{Dub00} or the ASN.1 body of standards itself \cite{ITU-T/ASN.1}.} The Abstract Syntax Notation One is used to formally describe the data transmitted across the network. Two communicating parties may employ different formats of their native data types (e.~g., different number of bits for the native integer type), thus it is important to have a way to describe the data in a manner which is independent from the particular machine's representation. The ASN.1 specifications are used to achieve the following: \begin{itemize} \item The specification expressed in the ASN.1 notation is a formal and precise way to communicate the structure of data to human readers; \item The ASN.1 specifications may be used as input for automatic compilers which produce the code for some target language (C, C++, Java, etc) to encode and decode the data according to some encoding formats. Several such encoding formats (called Transfer Encoding Rules) have been defined by the ASN.1 standard. \end{itemize} Consider the following example: \begin{asn} Rectangle ::= SEQUENCE { height INTEGER, width INTEGER } \end{asn} This ASN.1 specification describes a constructed type, \emph{Rectangle}, containing two integer fields. This specification may tell the reader that there exists this kind of data structure and that some entity may be prepared to send or receive it. The question on \emph{how} that entity is going to send or receive the \emph{encoded data} is outside the scope of ASN.1. For example, this data structure may be encoded according to some encoding rules and sent to the destination using the TCP protocol. The ASN.1 specifies several ways of encoding (or ``serializing'', or ``marshaling'') the data: BER, PER, XER and others, including CER and DER derivatives from BER. The complete specification must be wrapped in a module, which looks like this: \begin{asn} RectangleModule1 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) docs(2) rectangle(1) 1 } DEFINITIONS AUTOMATIC TAGS ::= BEGIN -- This is a comment which describes nothing. Rectangle ::= SEQUENCE { height INTEGER, -- Height of the rectangle width INTEGER -- Width of the rectangle } END \end{asn} The module header consists of module name (RectangleModule1), the module object identifier (\{...\}), a keyword ``DEFINITIONS'', a set of module flags (AUTOMATIC TAGS) and ``::= BEGIN''. The module ends with an ``END'' statement. \section{Some of the ASN.1 Basic Types} \subsection{The BOOLEAN type} The BOOLEAN type models the simple binary TRUE/FALSE, YES/NO, ON/OFF or a similar kind of two-way choice. \subsection{The INTEGER type} The INTEGER type is a signed natural number type without any restrictions on its size. If the automatic checking on INTEGER value bounds are necessary, the subtype constraints must be used. \begin{asn} SimpleInteger ::= INTEGER -- An integer with a very limited range SmallPositiveInt ::= INTEGER (0..127) -- Integer, negative NegativeInt ::= INTEGER (MIN..0) \end{asn} \subsection{The ENUMERATED type} The ENUMERATED type is semantically equivalent to the INTEGER type with some integer values explicitly named. \begin{asn} FruitId ::= ENUMERATED { apple(1), orange(2) } -- The numbers in braces are optional, -- the enumeration can be performed -- automatically by the compiler ComputerOSType ::= ENUMERATED { FreeBSD, -- acquires value 0 Windows, -- acquires value 1 Solaris(5), -- remains 5 Linux, -- becomes 6 MacOS -- becomes 7 } \end{asn} \subsection{The OCTET STRING type} This type models the sequence of 8-bit bytes. This may be used to transmit some opaque data or data serialized by other types of encoders (e.~g., video file, photo picture, etc). \subsection{The OBJECT IDENTIFIER type} The OBJECT IDENTIFIER is used to represent the unique identifier of any object, starting from the very root of the registration tree. If your organization needs to uniquely identify something (a router, a room, a person, a standard, or whatever), you are encouraged to get your own identification subtree at \url{http://www.iana.org/protocols/forms.htm}. For example, the very first ASN.1 module in this Chapter (RectangleModule1) has the following OBJECT IDENTIFIER: 1 3 6 1 4 1 9363 1 5 2 1 1. \begin{asn} ExampleOID ::= OBJECT IDENTIFIER rectangleModule1-oid ExampleOID ::= { 1 3 6 1 4 1 9363 1 5 2 1 1 } -- An identifier of the Internet. internet-id OBJECT IDENTIFIER ::= { iso(1) identified-organization(3) dod(6) internet(1) } \end{asn} As you see, names are optional. \subsection{The RELATIVE-OID type} The RELATIVE-OID type has the semantics of a subtree of an OBJECT IDENTIFIER. There may be no need to repeat the whole sequence of numbers from the root of the registration tree where the only thing of interest is some of the tree's subsequence. \begin{asn} this-document RELATIVE-OID ::= { docs(2) usage(1) } this-example RELATIVE-OID ::= { this-document assorted-examples(0) this-example(1) } \end{asn} \section{Some of the ASN.1 String Types} \subsection{The IA5String type} This is essentially the ASCII, with 128 character codes available (7 lower bits of an 8-bit byte). \subsection{The UTF8String type} This is the character string which encodes the full Unicode range (4 bytes) using multibyte character sequences. \subsection{The NumericString type} This type represents the character string with the alphabet consisting of numbers (``0'' to ``9'') and a space. \subsection{The PrintableString type} The character string with the following alphabet: space, ``\textbf{'}'' (single quote), ``\textbf{(}'', ``\textbf{)}'', ``\textbf{+}'', ``\textbf{,}'' (comma), ``\textbf{-}'', ``\textbf{.}'', ``\textbf{/}'', digits (``0'' to ``9''), ``\textbf{:}'', ``\textbf{=}'', ``\textbf{?}'', upper-case and lower-case letters (``A'' to ``Z'' and ``a'' to ``z''). \subsection{The VisibleString type} The character string with the alphabet which is more or less a subset of ASCII between the space and the ``\textbf{\textasciitilde{}}'' symbol (tilde). Alternatively, the alphabet may be described as the PrintableString alphabet presented earlier, plus the following characters: ``\textbf{!}'', ``\textbf{``}'', ``\textbf{\#}'', ``\textbf{\$}'', ``\textbf{\%}'', ``\textbf{\&}'', ``\textbf{*}'', ``\textbf{;}'', ``\textbf{<}'', ``\textbf{>}'', ``\textbf{{[}}'', ``\textbf{\textbackslash{}}'', ``\textbf{{]}}'', ``\textbf{\textasciicircum{}}'', ``\textbf{\_}'', ``\textbf{`}`` (single left quote), ``\textbf{\{}'', ``\textbf{|}'', ``\textbf{\}}'', ``\textbf{\textasciitilde{}}''. \section{ASN.1 Constructed Types} \subsection{The SEQUENCE type} This is an ordered collection of other simple or constructed types. The SEQUENCE constructed type resembles the C ``struct'' statement. \begin{asn} Address ::= SEQUENCE { -- The apartment number may be omitted apartmentNumber NumericString OPTIONAL, streetName PrintableString, cityName PrintableString, stateName PrintableString, -- This one may be omitted too zipNo NumericString OPTIONAL } \end{asn} \subsection{The SET type} This is a collection of other simple or constructed types. Ordering is not important. The data may arrive in the order which is different from the order of specification. Data is encoded in the order not necessarily corresponding to the order of specification. \subsection{The CHOICE type} This type is just a choice between the subtypes specified in it. The CHOICE type contains at most one of the subtypes specified, and it is always implicitly known which choice is being decoded or encoded. This one resembles the C ``union'' statement. The following type defines a response code, which may be either an integer code or a boolean ``true''/``false'' code. \begin{asn} ResponseCode ::= CHOICE { intCode INTEGER, boolCode BOOLEAN } \end{asn} \subsection{The SEQUENCE OF type} This one is the list (array) of simple or constructed types: \begin{asn} -- Example 1 ManyIntegers ::= SEQUENCE OF INTEGER -- Example 2 ManyRectangles ::= SEQUENCE OF Rectangle -- More complex example: -- an array of structures defined in place. ManyCircles ::= SEQUENCE OF SEQUENCE { radius INTEGER } \end{asn} \subsection{The SET OF type} The SET OF type models the bag of structures. It resembles the SEQUENCE OF type, but the order is not important. The elements may arrive in the order which is not necessarily the same as the in-memory order on the remote machines. \begin{asn} -- A set of structures defined elsewhere SetOfApples :: SET OF Apple -- Set of integers encoding the kind of a fruit FruitBag ::= SET OF ENUMERATED { apple, orange } \end{asn} \begin{thebibliography}{ITU-T/ASN.1} \bibitem[ASN1C]{ASN1C}The Open Source ASN.1 Compiler. \url{http://lionet.info/asn1c} \bibitem[AONL]{AONL}Online ASN.1 Compiler. \url{http://lionet.info/asn1c/asn1c.cgi} \bibitem[Dub00]{Dub00}Olivier Dubuisson --- \emph{ASN.1 Communication between heterogeneous systems} --- Morgan Kaufmann Publishers, 2000. \url{http://asn1.elibel.tm.fr/en/book/}. ISBN:0-12-6333361-0. \bibitem[ITU-T/ASN.1]{ITU-T/ASN.1}ITU-T Study Group 17 --- Languages for Telecommunication Systems \url{http://www.itu.int/ITU-T/studygroups/com17/languages/} \end{thebibliography} \end{document} asn1c-0.9.28+dfsg/tests/0000755000000000000000000000000013065714043013401 5ustar rootrootasn1c-0.9.28+dfsg/tests/20-constr-OK.asn10000644000000000000000000000104513065714043016223 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .20 ModuleTestConstr { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 20 } DEFINITIONS IMPLICIT TAGS EXTENSIBILITY IMPLIED ::= BEGIN ConstructedType1 ::= SEQUENCE { a [1] INTEGER, b [2] INTEGER, ...!ex1, c IA5String, ..., d UTF8String } ConstructedType2 ::= SET { a [1] INTEGER, b [2] INTEGER } ex1 INTEGER ::= 1 END asn1c-0.9.28+dfsg/tests/44-choice-in-sequence-OK.asn1.-P0000644000000000000000000002254413065714043020647 0ustar rootroot /*** <<< INCLUDES [T] >>> ***/ #include #include #include /*** <<< DEPS [T] >>> ***/ typedef enum b_PR { b_PR_NOTHING, /* No components present */ b_PR_c, b_PR_d, b_PR_e, b_PR_h } b_PR; typedef enum e_PR { e_PR_NOTHING, /* No components present */ e_PR_f, e_PR_g } e_PR; typedef enum h_PR { h_PR_NOTHING, /* No components present */ h_PR_i, h_PR_j } h_PR; /*** <<< TYPE-DECLS [T] >>> ***/ typedef struct T { NULL_t a; struct b { b_PR present; union T__b_u { NULL_t c; NULL_t d; struct e { e_PR present; union T__b__e_u { NULL_t f; NULL_t g; } choice; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } e; struct h { h_PR present; union T__b__h_u { NULL_t i; NULL_t j; } choice; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } h; } choice; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } b; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } T_t; /*** <<< FUNC-DECLS [T] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_T; /*** <<< STAT-DEFS [T] >>> ***/ static asn_TYPE_member_t asn_MBR_e_6[] = { { ATF_NOFLAGS, 0, offsetof(struct e, choice.f), .tag = (ASN_TAG_CLASS_PRIVATE | (7 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_NULL, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "f" }, { ATF_NOFLAGS, 0, offsetof(struct e, choice.g), .tag = (ASN_TAG_CLASS_PRIVATE | (8 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_NULL, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "g" }, }; static const asn_TYPE_tag2member_t asn_MAP_e_tag2el_6[] = { { (ASN_TAG_CLASS_PRIVATE | (7 << 2)), 0, 0, 0 }, /* f */ { (ASN_TAG_CLASS_PRIVATE | (8 << 2)), 1, 0, 0 } /* g */ }; static asn_CHOICE_specifics_t asn_SPC_e_specs_6 = { sizeof(struct e), offsetof(struct e, _asn_ctx), offsetof(struct e, present), sizeof(((struct e *)0)->present), asn_MAP_e_tag2el_6, 2, /* Count of tags in the map */ .canonical_order = 0, .ext_start = -1 /* Extensions start */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_e_6 = { "e", "e", CHOICE_free, CHOICE_print, CHOICE_constraint, CHOICE_decode_ber, CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ 0, /* No tags (pointer) */ 0, /* No tags (count) */ 0, /* No PER visible constraints */ asn_MBR_e_6, 2, /* Elements count */ &asn_SPC_e_specs_6 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_h_9[] = { { ATF_NOFLAGS, 0, offsetof(struct h, choice.i), .tag = (ASN_TAG_CLASS_PRIVATE | (1 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_NULL, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "i" }, { ATF_NOFLAGS, 0, offsetof(struct h, choice.j), .tag = (ASN_TAG_CLASS_PRIVATE | (2 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_NULL, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "j" }, }; static const asn_TYPE_tag2member_t asn_MAP_h_tag2el_9[] = { { (ASN_TAG_CLASS_PRIVATE | (1 << 2)), 0, 0, 0 }, /* i */ { (ASN_TAG_CLASS_PRIVATE | (2 << 2)), 1, 0, 0 } /* j */ }; static asn_CHOICE_specifics_t asn_SPC_h_specs_9 = { sizeof(struct h), offsetof(struct h, _asn_ctx), offsetof(struct h, present), sizeof(((struct h *)0)->present), asn_MAP_h_tag2el_9, 2, /* Count of tags in the map */ .canonical_order = 0, .ext_start = -1 /* Extensions start */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_h_9 = { "h", "h", CHOICE_free, CHOICE_print, CHOICE_constraint, CHOICE_decode_ber, CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ 0, /* No tags (pointer) */ 0, /* No tags (count) */ 0, /* No PER visible constraints */ asn_MBR_h_9, 2, /* Elements count */ &asn_SPC_h_specs_9 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_b_3[] = { { ATF_NOFLAGS, 0, offsetof(struct b, choice.c), .tag = (ASN_TAG_CLASS_PRIVATE | (5 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_NULL, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "c" }, { ATF_NOFLAGS, 0, offsetof(struct b, choice.d), .tag = (ASN_TAG_CLASS_PRIVATE | (6 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_NULL, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "d" }, { ATF_NOFLAGS, 0, offsetof(struct b, choice.e), .tag = -1 /* Ambiguous tag (CHOICE?) */, .tag_mode = 0, .type = &asn_DEF_e_6, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "e" }, { ATF_NOFLAGS, 0, offsetof(struct b, choice.h), .tag = (ASN_TAG_CLASS_PRIVATE | (9 << 2)), .tag_mode = +1, /* EXPLICIT tag at current level */ .type = &asn_DEF_h_9, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "h" }, }; static const asn_TYPE_tag2member_t asn_MAP_b_tag2el_3[] = { { (ASN_TAG_CLASS_PRIVATE | (5 << 2)), 0, 0, 0 }, /* c */ { (ASN_TAG_CLASS_PRIVATE | (6 << 2)), 1, 0, 0 }, /* d */ { (ASN_TAG_CLASS_PRIVATE | (7 << 2)), 2, 0, 0 }, /* f */ { (ASN_TAG_CLASS_PRIVATE | (8 << 2)), 2, 0, 0 }, /* g */ { (ASN_TAG_CLASS_PRIVATE | (9 << 2)), 3, 0, 0 } /* h */ }; static asn_CHOICE_specifics_t asn_SPC_b_specs_3 = { sizeof(struct b), offsetof(struct b, _asn_ctx), offsetof(struct b, present), sizeof(((struct b *)0)->present), asn_MAP_b_tag2el_3, 5, /* Count of tags in the map */ .canonical_order = 0, .ext_start = -1 /* Extensions start */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_b_3 = { "b", "b", CHOICE_free, CHOICE_print, CHOICE_constraint, CHOICE_decode_ber, CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ 0, /* No tags (pointer) */ 0, /* No tags (count) */ 0, /* No PER visible constraints */ asn_MBR_b_3, 4, /* Elements count */ &asn_SPC_b_specs_3 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_T_1[] = { { ATF_NOFLAGS, 0, offsetof(struct T, a), .tag = (ASN_TAG_CLASS_PRIVATE | (2 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_NULL, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "a" }, { ATF_NOFLAGS, 0, offsetof(struct T, b), .tag = -1 /* Ambiguous tag (CHOICE?) */, .tag_mode = 0, .type = &asn_DEF_b_3, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "b" }, }; static const ber_tlv_tag_t asn_DEF_T_tags_1[] = { (ASN_TAG_CLASS_PRIVATE | (1 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_T_tag2el_1[] = { { (ASN_TAG_CLASS_PRIVATE | (2 << 2)), 0, 0, 0 }, /* a */ { (ASN_TAG_CLASS_PRIVATE | (5 << 2)), 1, 0, 0 }, /* c */ { (ASN_TAG_CLASS_PRIVATE | (6 << 2)), 1, 0, 0 }, /* d */ { (ASN_TAG_CLASS_PRIVATE | (7 << 2)), 1, 0, 0 }, /* f */ { (ASN_TAG_CLASS_PRIVATE | (8 << 2)), 1, 0, 0 }, /* g */ { (ASN_TAG_CLASS_PRIVATE | (9 << 2)), 1, 0, 0 } /* h */ }; static asn_SEQUENCE_specifics_t asn_SPC_T_specs_1 = { sizeof(struct T), offsetof(struct T, _asn_ctx), asn_MAP_T_tag2el_1, 6, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_T = { "T", "T", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T_tags_1, sizeof(asn_DEF_T_tags_1) /sizeof(asn_DEF_T_tags_1[0]) - 1, /* 1 */ asn_DEF_T_tags_1, /* Same as above */ sizeof(asn_DEF_T_tags_1) /sizeof(asn_DEF_T_tags_1[0]), /* 2 */ 0, /* No PER visible constraints */ asn_MBR_T_1, 2, /* Elements count */ &asn_SPC_T_specs_1 /* Additional specs */ }; asn1c-0.9.28+dfsg/tests/99-class-sample-OK.asn1.-EFprint-class-matrix0000644000000000000000000000277013065714043023355 0ustar rootrootModuleClassSample { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 99 } DEFINITIONS ::= BEGIN SAMPLE-CLASS ::= CLASS { &id RELATIVE-OID UNIQUE, &code ENUMERATED { request(0), response(1), status(2) } DEFAULT 0, &Type OPTIONAL } WITH SYNTAX { [TYPE &Type] [WITH CODE &code] IDENTIFIED BY &id } -- Class matrix has 4 entries: -- [ &id][ &code][ &Type] -- [1] request-whatever -- [2] response-stuff 1 -- [3] request-id 2 SampleType -- [4] request-salt Salt SampleClassObjectSet SAMPLE-CLASS ::= {{ IDENTIFIED BY request-whatever } | { WITH CODE 1 IDENTIFIED BY response-stuff } | { TYPE SampleType WITH CODE 2 IDENTIFIED BY request-id } | { TYPE Salt IDENTIFIED BY request-salt }} request-Whatever SAMPLE-CLASS ::= { IDENTIFIED BY request-whatever } respond-Stuff SAMPLE-CLASS ::= { WITH CODE 1 IDENTIFIED BY response-stuff } request-Status SAMPLE-CLASS ::= { TYPE SampleType WITH CODE 2 IDENTIFIED BY request-id } request-Salt SAMPLE-CLASS ::= { TYPE Salt IDENTIFIED BY request-salt } request-id RELATIVE-OID ::= { 1 1 1 } request-salt RELATIVE-OID ::= { 1 1 1 } request-whatever RELATIVE-OID ::= { 1 1 5 } response-stuff RELATIVE-OID ::= { 2 0 1 } SampleType ::= SEQUENCE { ... } Salt ::= SET { ... } END asn1c-0.9.28+dfsg/tests/16-constraint-OK.asn1.-EFprint-constraints0000644000000000000000000000436113065714043023100 0ustar rootrootModuleTestConstraint1 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 16 1 } DEFINITIONS ::= BEGIN Type0 ::= IA5String (((SIZE(1..10))(FROM("a".."z" | "#")))) -- Combined constraints: (((SIZE(1..10))(FROM("a".."z" | "#")))) -- Practical constraints (Type0): (MIN..MAX) (SIZE(1..10)) (FROM("#" | "a".."z")) -- PER-visible constraints (Type0): (MIN..MAX) (SIZE(1..10)) (FROM("#" | "a".."z")) Type6 ::= IA5String ((SIZE(1..10))(FROM("a".."z" | "#"))) -- Combined constraints: ((SIZE(1..10))(FROM("a".."z" | "#"))) -- Practical constraints (Type6): (MIN..MAX) (SIZE(1..10)) (FROM("#" | "a".."z")) -- PER-visible constraints (Type6): (MIN..MAX) (SIZE(1..10)) (FROM("#" | "a".."z")) END ModuleTestConstraint2 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 16 2 } DEFINITIONS ::= BEGIN Type1 ::= IA5String (SIZE(1..10,...))(FROM("a".."z" | "#",...)) -- Combined constraints: (SIZE(1..10))(FROM("a".."z" | "#",...)) -- Practical constraints (Type1): (MIN..MAX) (SIZE(1..10)) (FROM("#" | "a".."z",...)) -- PER-visible constraints (Type1): (MIN..MAX) (SIZE(1..10)) (FROM("".."")) Type2 ::= IA5String (SIZE(MIN..4) | FROM("abc")) -- Combined constraints: (SIZE(MIN..4) | FROM("abc")) -- Practical constraints (Type2): (MIN..MAX) (SIZE(0..MAX)) (FROM("".."")) -- PER-visible constraints (Type2): (MIN..MAX) (SIZE(0..MAX)) (FROM("".."")) Type3 ::= BMPString (SIZE(1)) -- Combined constraints: (SIZE(1)) -- Practical constraints (Type3): (MIN..MAX) (SIZE(1)) (FROM("".."")) -- PER-visible constraints (Type3): (MIN..MAX) (SIZE(1)) (FROM("".."")) Type4 ::= INTEGER (1..MAX) -- Combined constraints: (1..MAX) -- Practical constraints (Type4): (1..MAX) -- PER-visible constraints (Type4): (1..MAX) Type5 ::= BOOLEAN (TRUE | FALSE) -- Combined constraints: (TRUE | FALSE) -- Practical constraints (Type5): (0..1) -- PER-visible constraints (Type5): (0..1) ten INTEGER ::= 10 -- Practical constraints (ten): (MIN..MAX) -- PER-visible constraints (ten): (MIN..MAX) v1 Type1 ::= "#value with ""double quotes""" -- Practical constraints (Type1): (MIN..MAX) (SIZE(0..MAX)) (FROM("".."")) -- PER-visible constraints (Type1): (MIN..MAX) (SIZE(0..MAX)) (FROM("".."")) END asn1c-0.9.28+dfsg/tests/60-any-OK.asn1.-EF0000644000000000000000000000051413065714043016054 0ustar rootrootModuleTestANY { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 60 } DEFINITIONS IMPLICIT TAGS ::= BEGIN T1 ::= SEQUENCE { i INTEGER, any ANY } T2 ::= SEQUENCE { i INTEGER, any [0] EXPLICIT ANY OPTIONAL } T3 ::= SEQUENCE { any1 ANY, any2 ANY } END asn1c-0.9.28+dfsg/tests/07-int-OK.asn1.-EF0000644000000000000000000000054613065714043016065 0ustar rootrootModuleTestInt1 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 7 } DEFINITIONS ::= BEGIN int123456 INTEGER ::= 123456 Interval ::= INTEGER (1..123456) SameInterval INTEGER ::= {1 | 2 | 3 | 4 | 5 | 6} Reason ::= INTEGER { no-reason(0), negative-reason(-10), some-large-value(1324324) } END asn1c-0.9.28+dfsg/tests/82-with-comps-OK.asn10000644000000000000000000000077613065714043017027 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .82 ModuleTestWithComponents { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 82 } DEFINITIONS ::= BEGIN BunchOfStrings ::= SEQUENCE OF VisibleString Address ::= BunchOfStrings (SIZE (1..6)) (WITH COMPONENT (SIZE (1..32))) Type ::= SEQUENCE { one INTEGER DEFAULT 1 } (WITH COMPONENTS { ..., one (1) PRESENT }) END asn1c-0.9.28+dfsg/tests/18-class-OK.asn10000644000000000000000000000146713065714043016037 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .18 ModuleTestClass { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 18 } DEFINITIONS ::= BEGIN AlphaNumeric ::= IA5String (FROM ("A".."Z"|"a".."z"|"0".."9")) FUNCTION ::= CLASS { &code INTEGER (0..MAX) UNIQUE, &Alphabet IA5String DEFAULT {AlphaNumeric}, &ArgType , &SupportedArguments &ArgType OPTIONAL, &ResultType DEFAULT NULL, &result-if-error &ResultType DEFAULT NULL, &associated-function FUNCTION OPTIONAL } operator-plus FUNCTION ::= { &ArgType Pair, &SupportedArguments { PosPair | NegPair } &ResultType INTEGER, &result-if-error 0, &code 1 } FunctionCodeType ::= FUNCTION.&code END asn1c-0.9.28+dfsg/tests/Makefile.am0000644000000000000000000000004713065714043015436 0ustar rootroot EXTRA_DIST = README $(srcdir)/*asn1* asn1c-0.9.28+dfsg/tests/61-any-1-SE.asn10000644000000000000000000000052513065714043015645 0ustar rootroot -- SE: Semantic error -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .61 ModuleTestBadANY1 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 61 } DEFINITIONS ::= BEGIN T ::= SEQUENCE { i1 INTEGER OPTIONAL, any ANY } END asn1c-0.9.28+dfsg/tests/16-constraint-OK.asn1.-EF0000644000000000000000000000130313065714043017447 0ustar rootrootModuleTestConstraint1 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 16 1 } DEFINITIONS ::= BEGIN Type0 ::= IA5String (((SIZE(1..10))(FROM("a".."z" | "#")))) Type6 ::= IA5String ((SIZE(1..10))(FROM("a".."z" | "#"))) END ModuleTestConstraint2 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 16 2 } DEFINITIONS ::= BEGIN Type1 ::= IA5String (SIZE(1..10,...))(FROM("a".."z" | "#",...)) Type2 ::= IA5String (SIZE(MIN..4) | FROM("abc")) Type3 ::= BMPString (SIZE(1)) Type4 ::= INTEGER (1..MAX) Type5 ::= BOOLEAN (TRUE | FALSE) ten INTEGER ::= 10 v1 Type1 ::= "#value with ""double quotes""" END asn1c-0.9.28+dfsg/tests/34-class-OK.asn1.-EFprint-class-matrix0000644000000000000000000000177013065714043022062 0ustar rootrootModuleTestClassSimple { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 34 } DEFINITIONS IMPLICIT TAGS ::= BEGIN EXTENSION ::= CLASS { &id [PRIVATE 0] INTEGER UNIQUE, &ExtnType } WITH SYNTAX { SYNTAX &ExtnType IDENTIFIED BY &id } -- Class matrix is empty Ext1 ::= SEQUENCE { extnId EXTENSION.&id } EXTENSION-ATTRIBUTE ::= CLASS { &id INTEGER (0..256) UNIQUE, &Type ANY } WITH SYNTAX {&Type IDENTIFIED BY &id} -- Class matrix has 1 entry: -- [ &id][ &Type] -- [1] 23 TerminalType terminal-type EXTENSION-ATTRIBUTE ::= {TerminalType IDENTIFIED BY 23} TerminalType ::= INTEGER { terminal(0) } ExtensionAttribute ::= SEQUENCE { extension-attribute-type [0] IMPLICIT EXTENSION-ATTRIBUTE.&id ({ExtensionAttributeTable}), extension-attribute-value [1] EXPLICIT EXTENSION-ATTRIBUTE.&Type ({ExtensionAttributeTable}{@extension-attribute-type}) } ub-extension-attributes INTEGER ::= 256 END asn1c-0.9.28+dfsg/tests/31-set-of-OK.asn10000644000000000000000000000143613065714043016116 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .31 ModuleTestSetOfSimple { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 31 } DEFINITIONS IMPLICIT TAGS ::= BEGIN Forest ::= SET OF Tree Tree ::= SEQUENCE { height INTEGER, width INTEGER } -- The following clause tests OPTIONAL. Stuff ::= SET { trees [1] SET OF Forest OPTIONAL, ..., other CHOICE { a [0] INTEGER, b [3] INTEGER }, ..., anything [2] SET OF SEQUENCE { cup-of-coffee BIT STRING, ... } OPTIONAL -- The above OPTIONAL applies to the "anything" -- member of the outer CHOICE, -- not to the SET OF's embedded SEQUENCE! } END asn1c-0.9.28+dfsg/tests/90-cond-int-type-OK.asn10000644000000000000000000000222513065714043017415 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .90 ModuleConditionalIntegerType { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 90 } DEFINITIONS ::= BEGIN CN-IntegerUnlimited ::= INTEGER CN-IntegerMinMax ::= INTEGER (MIN..MAX) CN-IntegerMinLow ::= INTEGER (MIN..1) NO-IntegerMinHigh ::= INTEGER (MIN..3000000000) NO-IntegerLowHigh ::= INTEGER (1..3000000000) CN-IntegerLowMax ::= INTEGER (1..MAX) NO-IntegerHighMax ::= INTEGER (3000000000..MAX) NO-IntegerLowestMax ::= INTEGER (-3000000000..MAX) NO-IntegerOutRange ::= INTEGER (3000000000..3000000001) NO-IntegerOutValue ::= INTEGER (3000000000) OK-IntegerInRange1 ::= INTEGER (-100..100) OK-IntegerInRange2 ::= INTEGER (-100|100) OK-IntegerInRange3 ::= INTEGER (-2147483648..2147483647) OK-IntegerInRange4 ::= INTEGER (-2147483648|2147483647) OK-IntegerInRange5 ::= INTEGER (-2147483648|2147483647,...) NO-IntegerInRange6 ::= INTEGER (0..4294967295) CN-IntegerEnumerated1 ::= INTEGER { a(1), b(2) } NO-IntegerEnumerated2 ::= INTEGER { a(1), b(3000000000) } END asn1c-0.9.28+dfsg/tests/125-bitstring-constraint-OK.asn1.-EF0000644000000000000000000000040213065714043021532 0ustar rootrootModuleBitStringConstraint { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 125 } DEFINITIONS ::= BEGIN T ::= BIT STRING { flag1(0), flag2(1), flag3(2) } ('000'B | '001'B | '010'B | '011'B) END asn1c-0.9.28+dfsg/tests/95-choice-per-order-OK.asn10000644000000000000000000000100213065714043020047 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .95 ModuleCHOICE-PER-Ordering { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 95 } DEFINITIONS ::= BEGIN Choice ::= CHOICE { roid RELATIVE-OID, bitstr BIT STRING, ch CHOICE { null NULL, int INTEGER }, ..., bool BOOLEAN } Choice2 ::= CHOICE { bitstr [0] BIT STRING, roid [1] RELATIVE-OID } END asn1c-0.9.28+dfsg/tests/106-param-constr-OK.asn1.-P0000644000000000000000000002204513065714043017664 0ustar rootroot /*** <<< INCLUDES [Narrow] >>> ***/ #include #include /*** <<< TYPE-DECLS [Narrow] >>> ***/ typedef struct Narrow_15P0 { long *narrow1 /* DEFAULT 3 */; long narrow2; long *narrow3 /* OPTIONAL */; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Narrow_15P0_t; /*** <<< FUNC-DECLS [Narrow] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Narrow_15P0; /*** <<< CODE [Narrow] >>> ***/ static int memb_narrow1_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if((value >= 1 && value <= 5)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } static int memb_narrow2_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if((value >= 2 && value <= 5)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } static int memb_narrow3_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if((value >= 3 && value <= 5)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /*** <<< STAT-DEFS [Narrow] >>> ***/ static int asn_DFL_2_set_3(int set_value, void **sptr) { long *st = *sptr; if(!st) { if(!set_value) return -1; /* Not a default value */ st = (*sptr = CALLOC(1, sizeof(*st))); if(!st) return -1; } if(set_value) { /* Install default value 3 */ *st = 3; return 0; } else { /* Test default value 3 */ return (*st == 3); } } static asn_TYPE_member_t asn_MBR_Narrow_15P0_1[] = { { ATF_POINTER, 1, offsetof(struct Narrow_15P0, narrow1), .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), .tag_mode = 0, .type = &asn_DEF_NativeInteger, .memb_constraints = memb_narrow1_constraint_1, .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = asn_DFL_2_set_3, /* DEFAULT 3 */ .name = "narrow1" }, { ATF_NOFLAGS, 0, offsetof(struct Narrow_15P0, narrow2), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = +1, /* EXPLICIT tag at current level */ .type = &asn_DEF_NativeInteger, .memb_constraints = memb_narrow2_constraint_1, .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "narrow2" }, { ATF_POINTER, 1, offsetof(struct Narrow_15P0, narrow3), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = +1, /* EXPLICIT tag at current level */ .type = &asn_DEF_NativeInteger, .memb_constraints = memb_narrow3_constraint_1, .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "narrow3" }, }; static const ber_tlv_tag_t asn_DEF_Narrow_15P0_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_Narrow_15P0_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 }, /* narrow1 */ { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 1, 0, 0 }, /* narrow2 */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 2, 0, 0 } /* narrow3 */ }; static asn_SEQUENCE_specifics_t asn_SPC_Narrow_15P0_specs_1 = { sizeof(struct Narrow_15P0), offsetof(struct Narrow_15P0, _asn_ctx), asn_MAP_Narrow_15P0_tag2el_1, 3, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Narrow_15P0 = { "Narrow", "Narrow", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Narrow_15P0_tags_1, sizeof(asn_DEF_Narrow_15P0_tags_1) /sizeof(asn_DEF_Narrow_15P0_tags_1[0]), /* 1 */ asn_DEF_Narrow_15P0_tags_1, /* Same as above */ sizeof(asn_DEF_Narrow_15P0_tags_1) /sizeof(asn_DEF_Narrow_15P0_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Narrow_15P0_1, 3, /* Elements count */ &asn_SPC_Narrow_15P0_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [NarrowInteger] >>> ***/ #include "Narrow.h" /*** <<< TYPE-DECLS [NarrowInteger] >>> ***/ typedef Narrow_15P0_t NarrowInteger_t; /*** <<< FUNC-DECLS [NarrowInteger] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_NarrowInteger; asn_struct_free_f NarrowInteger_free; asn_struct_print_f NarrowInteger_print; asn_constr_check_f NarrowInteger_constraint; ber_type_decoder_f NarrowInteger_decode_ber; der_type_encoder_f NarrowInteger_encode_der; xer_type_decoder_f NarrowInteger_decode_xer; xer_type_encoder_f NarrowInteger_encode_xer; /*** <<< CODE [NarrowInteger] >>> ***/ int NarrowInteger_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_Narrow_15P0.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using Narrow_15P0, * so here we adjust the DEF accordingly. */ static void NarrowInteger_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_Narrow_15P0.free_struct; td->print_struct = asn_DEF_Narrow_15P0.print_struct; td->check_constraints = asn_DEF_Narrow_15P0.check_constraints; td->ber_decoder = asn_DEF_Narrow_15P0.ber_decoder; td->der_encoder = asn_DEF_Narrow_15P0.der_encoder; td->xer_decoder = asn_DEF_Narrow_15P0.xer_decoder; td->xer_encoder = asn_DEF_Narrow_15P0.xer_encoder; td->uper_decoder = asn_DEF_Narrow_15P0.uper_decoder; td->uper_encoder = asn_DEF_Narrow_15P0.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Narrow_15P0.per_constraints; td->elements = asn_DEF_Narrow_15P0.elements; td->elements_count = asn_DEF_Narrow_15P0.elements_count; td->specifics = asn_DEF_Narrow_15P0.specifics; } void NarrowInteger_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { NarrowInteger_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int NarrowInteger_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { NarrowInteger_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t NarrowInteger_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { NarrowInteger_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t NarrowInteger_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { NarrowInteger_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t NarrowInteger_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { NarrowInteger_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t NarrowInteger_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { NarrowInteger_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [NarrowInteger] >>> ***/ static const ber_tlv_tag_t asn_DEF_NarrowInteger_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; asn_TYPE_descriptor_t asn_DEF_NarrowInteger = { "NarrowInteger", "NarrowInteger", NarrowInteger_free, NarrowInteger_print, NarrowInteger_constraint, NarrowInteger_decode_ber, NarrowInteger_encode_der, NarrowInteger_decode_xer, NarrowInteger_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NarrowInteger_tags_1, sizeof(asn_DEF_NarrowInteger_tags_1) /sizeof(asn_DEF_NarrowInteger_tags_1[0]), /* 1 */ asn_DEF_NarrowInteger_tags_1, /* Same as above */ sizeof(asn_DEF_NarrowInteger_tags_1) /sizeof(asn_DEF_NarrowInteger_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* Defined elsewhere */ 0 /* No specifics */ }; asn1c-0.9.28+dfsg/tests/31-set-of-OK.asn1.-Pfwide-types0000644000000000000000000003520413065714043020552 0ustar rootroot /*** <<< INCLUDES [Forest] >>> ***/ #include #include /*** <<< FWD-DECLS [Forest] >>> ***/ struct Tree; /*** <<< TYPE-DECLS [Forest] >>> ***/ typedef struct Forest { A_SET_OF(struct Tree) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Forest_t; /*** <<< FUNC-DECLS [Forest] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Forest; /*** <<< POST-INCLUDE [Forest] >>> ***/ #include "Tree.h" /*** <<< STAT-DEFS [Forest] >>> ***/ static asn_TYPE_member_t asn_MBR_Forest_1[] = { { ATF_POINTER, 0, 0, .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), .tag_mode = 0, .type = &asn_DEF_Tree, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "" }, }; static const ber_tlv_tag_t asn_DEF_Forest_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_Forest_specs_1 = { sizeof(struct Forest), offsetof(struct Forest, _asn_ctx), 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_Forest = { "Forest", "Forest", SET_OF_free, SET_OF_print, SET_OF_constraint, SET_OF_decode_ber, SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Forest_tags_1, sizeof(asn_DEF_Forest_tags_1) /sizeof(asn_DEF_Forest_tags_1[0]), /* 1 */ asn_DEF_Forest_tags_1, /* Same as above */ sizeof(asn_DEF_Forest_tags_1) /sizeof(asn_DEF_Forest_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Forest_1, 1, /* Single element */ &asn_SPC_Forest_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Tree] >>> ***/ #include #include /*** <<< TYPE-DECLS [Tree] >>> ***/ typedef struct Tree { INTEGER_t height; INTEGER_t width; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Tree_t; /*** <<< FUNC-DECLS [Tree] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Tree; /*** <<< STAT-DEFS [Tree] >>> ***/ static asn_TYPE_member_t asn_MBR_Tree_1[] = { { ATF_NOFLAGS, 0, offsetof(struct Tree, height), .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), .tag_mode = 0, .type = &asn_DEF_INTEGER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "height" }, { ATF_NOFLAGS, 0, offsetof(struct Tree, width), .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), .tag_mode = 0, .type = &asn_DEF_INTEGER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "width" }, }; static const ber_tlv_tag_t asn_DEF_Tree_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_Tree_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 1 }, /* height */ { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, -1, 0 } /* width */ }; static asn_SEQUENCE_specifics_t asn_SPC_Tree_specs_1 = { sizeof(struct Tree), offsetof(struct Tree, _asn_ctx), asn_MAP_Tree_tag2el_1, 2, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Tree = { "Tree", "Tree", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Tree_tags_1, sizeof(asn_DEF_Tree_tags_1) /sizeof(asn_DEF_Tree_tags_1[0]), /* 1 */ asn_DEF_Tree_tags_1, /* Same as above */ sizeof(asn_DEF_Tree_tags_1) /sizeof(asn_DEF_Tree_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Tree_1, 2, /* Elements count */ &asn_SPC_Tree_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Stuff] >>> ***/ #include #include #include #include #include #include #include /*** <<< DEPS [Stuff] >>> ***/ /* * Method of determining the components presence */ typedef enum Stuff_PR { Stuff_PR_trees, /* Member trees is present */ Stuff_PR_anything, /* Member anything is present */ Stuff_PR_other, /* Member other is present */ } Stuff_PR; typedef enum other_PR { other_PR_NOTHING, /* No components present */ other_PR_a, other_PR_b } other_PR; /*** <<< FWD-DECLS [Stuff] >>> ***/ struct Forest; /*** <<< TYPE-DECLS [Stuff] >>> ***/ typedef struct Stuff { struct trees { A_SET_OF(struct Forest) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } *trees; struct anything { A_SET_OF(struct Member { BIT_STRING_t cup_of_coffee; /* * This type is extensible, * possible extensions are below. */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } ) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } *anything; /* * This type is extensible, * possible extensions are below. */ struct other { other_PR present; union Stuff__other_u { INTEGER_t a; INTEGER_t b; } choice; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } *other; /* Presence bitmask: ASN_SET_ISPRESENT(pStuff, Stuff_PR_x) */ unsigned int _presence_map [((3+(8*sizeof(unsigned int))-1)/(8*sizeof(unsigned int)))]; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Stuff_t; /*** <<< FUNC-DECLS [Stuff] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Stuff; /*** <<< POST-INCLUDE [Stuff] >>> ***/ #include "Forest.h" /*** <<< STAT-DEFS [Stuff] >>> ***/ static asn_TYPE_member_t asn_MBR_trees_2[] = { { ATF_POINTER, 0, 0, .tag = (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), .tag_mode = 0, .type = &asn_DEF_Forest, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "" }, }; static const ber_tlv_tag_t asn_DEF_trees_tags_2[] = { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_trees_specs_2 = { sizeof(struct trees), offsetof(struct trees, _asn_ctx), 0, /* XER encoding is XMLDelimitedItemList */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_trees_2 = { "trees", "trees", SET_OF_free, SET_OF_print, SET_OF_constraint, SET_OF_decode_ber, SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_trees_tags_2, sizeof(asn_DEF_trees_tags_2) /sizeof(asn_DEF_trees_tags_2[0]) - 1, /* 1 */ asn_DEF_trees_tags_2, /* Same as above */ sizeof(asn_DEF_trees_tags_2) /sizeof(asn_DEF_trees_tags_2[0]), /* 2 */ 0, /* No PER visible constraints */ asn_MBR_trees_2, 1, /* Single element */ &asn_SPC_trees_specs_2 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_Member_5[] = { { ATF_NOFLAGS, 0, offsetof(struct Member, cup_of_coffee), .tag = (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), .tag_mode = 0, .type = &asn_DEF_BIT_STRING, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "cup-of-coffee" }, }; static const ber_tlv_tag_t asn_DEF_Member_tags_5[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_Member_tag2el_5[] = { { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 0, 0, 0 } /* cup-of-coffee */ }; static asn_SEQUENCE_specifics_t asn_SPC_Member_specs_5 = { sizeof(struct Member), offsetof(struct Member, _asn_ctx), asn_MAP_Member_tag2el_5, 1, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ 0, /* Start extensions */ 2 /* Stop extensions */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_Member_5 = { "SEQUENCE", "SEQUENCE", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Member_tags_5, sizeof(asn_DEF_Member_tags_5) /sizeof(asn_DEF_Member_tags_5[0]), /* 1 */ asn_DEF_Member_tags_5, /* Same as above */ sizeof(asn_DEF_Member_tags_5) /sizeof(asn_DEF_Member_tags_5[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Member_5, 1, /* Elements count */ &asn_SPC_Member_specs_5 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_anything_4[] = { { ATF_POINTER, 0, 0, .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), .tag_mode = 0, .type = &asn_DEF_Member_5, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "" }, }; static const ber_tlv_tag_t asn_DEF_anything_tags_4[] = { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_anything_specs_4 = { sizeof(struct anything), offsetof(struct anything, _asn_ctx), 0, /* XER encoding is XMLDelimitedItemList */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_anything_4 = { "anything", "anything", SET_OF_free, SET_OF_print, SET_OF_constraint, SET_OF_decode_ber, SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_anything_tags_4, sizeof(asn_DEF_anything_tags_4) /sizeof(asn_DEF_anything_tags_4[0]) - 1, /* 1 */ asn_DEF_anything_tags_4, /* Same as above */ sizeof(asn_DEF_anything_tags_4) /sizeof(asn_DEF_anything_tags_4[0]), /* 2 */ 0, /* No PER visible constraints */ asn_MBR_anything_4, 1, /* Single element */ &asn_SPC_anything_specs_4 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_other_9[] = { { ATF_NOFLAGS, 0, offsetof(struct other, choice.a), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_INTEGER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "a" }, { ATF_NOFLAGS, 0, offsetof(struct other, choice.b), .tag = (ASN_TAG_CLASS_CONTEXT | (3 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_INTEGER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "b" }, }; static const asn_TYPE_tag2member_t asn_MAP_other_tag2el_9[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* a */ { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 1, 0, 0 } /* b */ }; static asn_CHOICE_specifics_t asn_SPC_other_specs_9 = { sizeof(struct other), offsetof(struct other, _asn_ctx), offsetof(struct other, present), sizeof(((struct other *)0)->present), asn_MAP_other_tag2el_9, 2, /* Count of tags in the map */ .canonical_order = 0, .ext_start = -1 /* Extensions start */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_other_9 = { "other", "other", CHOICE_free, CHOICE_print, CHOICE_constraint, CHOICE_decode_ber, CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ 0, /* No tags (pointer) */ 0, /* No tags (count) */ 0, /* No PER visible constraints */ asn_MBR_other_9, 2, /* Elements count */ &asn_SPC_other_specs_9 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_Stuff_1[] = { { ATF_POINTER, 3, offsetof(struct Stuff, trees), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = 0, .type = &asn_DEF_trees_2, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "trees" }, { ATF_POINTER, 2, offsetof(struct Stuff, anything), .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), .tag_mode = 0, .type = &asn_DEF_anything_4, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "anything" }, { ATF_POINTER, 1, offsetof(struct Stuff, other), .tag = -1 /* Ambiguous tag (CHOICE?) */, .tag_mode = 0, .type = &asn_DEF_other_9, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "other" }, }; static const ber_tlv_tag_t asn_DEF_Stuff_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_Stuff_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 2, 0, 0 }, /* a */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 0, 0, 0 }, /* trees */ { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 1, 0, 0 }, /* anything */ { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 2, 0, 0 } /* b */ }; static const asn_TYPE_tag2member_t asn_MAP_Stuff_tag2el_cxer_1[] = { { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 0, 0, 0 }, /* trees */ { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 1, 0, 0 }, /* anything */ { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 2, 0, 0 } /* a */ }; static const uint8_t asn_MAP_Stuff_mmap_1[(3 + (8 * sizeof(unsigned int)) - 1) / 8] = { (0 << 7) | (0 << 6) | (0 << 5) }; static asn_SET_specifics_t asn_SPC_Stuff_specs_1 = { sizeof(struct Stuff), offsetof(struct Stuff, _asn_ctx), offsetof(struct Stuff, _presence_map), asn_MAP_Stuff_tag2el_1, 4, /* Count of tags in the map */ asn_MAP_Stuff_tag2el_cxer_1, 3, /* Count of tags in the CXER map */ 1, /* Whether extensible */ (unsigned int *)asn_MAP_Stuff_mmap_1 /* Mandatory elements map */ }; asn_TYPE_descriptor_t asn_DEF_Stuff = { "Stuff", "Stuff", SET_free, SET_print, SET_constraint, SET_decode_ber, SET_encode_der, SET_decode_xer, SET_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Stuff_tags_1, sizeof(asn_DEF_Stuff_tags_1) /sizeof(asn_DEF_Stuff_tags_1[0]), /* 1 */ asn_DEF_Stuff_tags_1, /* Same as above */ sizeof(asn_DEF_Stuff_tags_1) /sizeof(asn_DEF_Stuff_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Stuff_1, 3, /* Elements count */ &asn_SPC_Stuff_specs_1 /* Additional specs */ }; asn1c-0.9.28+dfsg/tests/58-param-OK.asn10000644000000000000000000000076313065714043016034 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .58 ModuleTestParam { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 58 } DEFINITIONS ::= BEGIN DirectoryString { INTEGER:maxSize } ::= CHOICE { teletexString TeletexString (SIZE(1..maxSize)), utf8String UTF8String (SIZE(1..maxSize)) } DS1 ::= DirectoryString { ub-name } ub-name INTEGER ::= 128 END asn1c-0.9.28+dfsg/tests/33-misc-OK.asn10000644000000000000000000000114213065714043015650 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .33 ModuleTestMiscComplex { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 33 } DEFINITIONS IMPLICIT TAGS ::= BEGIN T ::= SEQUENCE { a [1] INTEGER, ..., b [2] EXPLICIT BitString, c [8] IMPLICIT Label, d [10] IMPLICIT Int, e [12] T2 } BitString ::= [8] BIT STRING Label ::= [9] EXPLICIT UTF8String Label2 ::= [1] Label Int ::= [3] IMPLICIT INTEGER { a(1), b(2) } T2 ::= SEQUENCE { l Label2 } END asn1c-0.9.28+dfsg/tests/47-set-ext-OK.asn10000644000000000000000000000071313065714043016316 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .47 ModuleSetChoiceExtensibility { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 47 } DEFINITIONS IMPLICIT TAGS EXTENSIBILITY IMPLIED ::= BEGIN T1 ::= SET { i INTEGER } T2 ::= SET { i INTEGER, ... } T3 ::= CHOICE { i INTEGER } T4 ::= CHOICE { i INTEGER, ... } END asn1c-0.9.28+dfsg/tests/42-real-life-OK.asn1.-PR0000644000000000000000000006620213065714043017162 0ustar rootroot /*** <<< INCLUDES [LogLine] >>> ***/ #include #include #include #include /*** <<< FWD-DECLS [LogLine] >>> ***/ struct VariablePartSet; /*** <<< TYPE-DECLS [LogLine] >>> ***/ typedef struct LogLine { IA5String_t line_digest; struct varsets { A_SEQUENCE_OF(struct VariablePartSet) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } varsets; /* * This type is extensible, * possible extensions are below. */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } LogLine_t; /*** <<< FUNC-DECLS [LogLine] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_LogLine; /*** <<< POST-INCLUDE [LogLine] >>> ***/ #include "VariablePartSet.h" /*** <<< CODE [LogLine] >>> ***/ static int memb_varsets_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { size_t size; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } /* Determine the number of elements */ size = _A_CSEQUENCE_FROM_VOID(sptr)->count; if((size >= 1)) { /* Perform validation of the inner elements */ return td->check_constraints(td, sptr, ctfailcb, app_key); } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /*** <<< STAT-DEFS [LogLine] >>> ***/ static asn_TYPE_member_t asn_MBR_varsets_3[] = { { ATF_POINTER, 0, 0, .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), .tag_mode = 0, .type = &asn_DEF_VariablePartSet, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "" }, }; static const ber_tlv_tag_t asn_DEF_varsets_tags_3[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_varsets_specs_3 = { sizeof(struct varsets), offsetof(struct varsets, _asn_ctx), 0, /* XER encoding is XMLDelimitedItemList */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_varsets_3 = { "varsets", "varsets", SEQUENCE_OF_free, SEQUENCE_OF_print, SEQUENCE_OF_constraint, SEQUENCE_OF_decode_ber, SEQUENCE_OF_encode_der, SEQUENCE_OF_decode_xer, SEQUENCE_OF_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_varsets_tags_3, sizeof(asn_DEF_varsets_tags_3) /sizeof(asn_DEF_varsets_tags_3[0]), /* 1 */ asn_DEF_varsets_tags_3, /* Same as above */ sizeof(asn_DEF_varsets_tags_3) /sizeof(asn_DEF_varsets_tags_3[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_varsets_3, 1, /* Single element */ &asn_SPC_varsets_specs_3 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_LogLine_1[] = { { ATF_NOFLAGS, 0, offsetof(struct LogLine, line_digest), .tag = (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)), .tag_mode = 0, .type = &asn_DEF_IA5String, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "line-digest" }, { ATF_NOFLAGS, 0, offsetof(struct LogLine, varsets), .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), .tag_mode = 0, .type = &asn_DEF_varsets_3, .memb_constraints = memb_varsets_constraint_1, .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "varsets" }, }; static const ber_tlv_tag_t asn_DEF_LogLine_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_LogLine_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 1, 0, 0 }, /* varsets */ { (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)), 0, 0, 0 } /* line-digest */ }; static asn_SEQUENCE_specifics_t asn_SPC_LogLine_specs_1 = { sizeof(struct LogLine), offsetof(struct LogLine, _asn_ctx), asn_MAP_LogLine_tag2el_1, 2, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ 1, /* Start extensions */ 3 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_LogLine = { "LogLine", "LogLine", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_LogLine_tags_1, sizeof(asn_DEF_LogLine_tags_1) /sizeof(asn_DEF_LogLine_tags_1[0]), /* 1 */ asn_DEF_LogLine_tags_1, /* Same as above */ sizeof(asn_DEF_LogLine_tags_1) /sizeof(asn_DEF_LogLine_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_LogLine_1, 2, /* Elements count */ &asn_SPC_LogLine_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [VariablePartSet] >>> ***/ #include "ActionItem.h" #include #include #include /*** <<< FWD-DECLS [VariablePartSet] >>> ***/ struct VariablePart; /*** <<< TYPE-DECLS [VariablePartSet] >>> ***/ typedef struct VariablePartSet { struct vparts { A_SEQUENCE_OF(struct VariablePart) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } vparts; ActionItem_t resolution; /* * This type is extensible, * possible extensions are below. */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } VariablePartSet_t; /*** <<< FUNC-DECLS [VariablePartSet] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_VariablePartSet; /*** <<< POST-INCLUDE [VariablePartSet] >>> ***/ #include "VariablePart.h" /*** <<< CODE [VariablePartSet] >>> ***/ static int memb_vparts_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(1 /* No applicable constraints whatsoever */) { /* Nothing is here. See below */ } return td->check_constraints(td, sptr, ctfailcb, app_key); } /*** <<< STAT-DEFS [VariablePartSet] >>> ***/ static asn_TYPE_member_t asn_MBR_vparts_2[] = { { ATF_POINTER, 0, 0, .tag = -1 /* Ambiguous tag (CHOICE?) */, .tag_mode = 0, .type = &asn_DEF_VariablePart, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "" }, }; static const ber_tlv_tag_t asn_DEF_vparts_tags_2[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_vparts_specs_2 = { sizeof(struct vparts), offsetof(struct vparts, _asn_ctx), 2, /* XER encoding is XMLValueList */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_vparts_2 = { "vparts", "vparts", SEQUENCE_OF_free, SEQUENCE_OF_print, SEQUENCE_OF_constraint, SEQUENCE_OF_decode_ber, SEQUENCE_OF_encode_der, SEQUENCE_OF_decode_xer, SEQUENCE_OF_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_vparts_tags_2, sizeof(asn_DEF_vparts_tags_2) /sizeof(asn_DEF_vparts_tags_2[0]), /* 1 */ asn_DEF_vparts_tags_2, /* Same as above */ sizeof(asn_DEF_vparts_tags_2) /sizeof(asn_DEF_vparts_tags_2[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_vparts_2, 1, /* Single element */ &asn_SPC_vparts_specs_2 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_VariablePartSet_1[] = { { ATF_NOFLAGS, 0, offsetof(struct VariablePartSet, vparts), .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), .tag_mode = 0, .type = &asn_DEF_vparts_2, .memb_constraints = memb_vparts_constraint_1, .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "vparts" }, { ATF_NOFLAGS, 0, offsetof(struct VariablePartSet, resolution), .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), .tag_mode = 0, .type = &asn_DEF_ActionItem, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "resolution" }, }; static const ber_tlv_tag_t asn_DEF_VariablePartSet_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_VariablePartSet_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 1 }, /* vparts */ { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 1, -1, 0 } /* resolution */ }; static asn_SEQUENCE_specifics_t asn_SPC_VariablePartSet_specs_1 = { sizeof(struct VariablePartSet), offsetof(struct VariablePartSet, _asn_ctx), asn_MAP_VariablePartSet_tag2el_1, 2, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ 1, /* Start extensions */ 3 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_VariablePartSet = { "VariablePartSet", "VariablePartSet", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_VariablePartSet_tags_1, sizeof(asn_DEF_VariablePartSet_tags_1) /sizeof(asn_DEF_VariablePartSet_tags_1[0]), /* 1 */ asn_DEF_VariablePartSet_tags_1, /* Same as above */ sizeof(asn_DEF_VariablePartSet_tags_1) /sizeof(asn_DEF_VariablePartSet_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_VariablePartSet_1, 2, /* Elements count */ &asn_SPC_VariablePartSet_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [VariablePart] >>> ***/ #include #include #include #include #include /*** <<< DEPS [VariablePart] >>> ***/ typedef enum VariablePart_PR { VariablePart_PR_NOTHING, /* No components present */ VariablePart_PR_vset, VariablePart_PR_vrange, /* Extensions may appear below */ } VariablePart_PR; /*** <<< TYPE-DECLS [VariablePart] >>> ***/ typedef struct VariablePart { VariablePart_PR present; union VariablePart_u { struct vset { A_SET_OF(VisibleString_t) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } vset; struct vrange { VisibleString_t from; VisibleString_t to; /* * This type is extensible, * possible extensions are below. */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } vrange; /* * This type is extensible, * possible extensions are below. */ } choice; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } VariablePart_t; /*** <<< FUNC-DECLS [VariablePart] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_VariablePart; /*** <<< CODE [VariablePart] >>> ***/ static int memb_vset_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { size_t size; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } /* Determine the number of elements */ size = _A_CSET_FROM_VOID(sptr)->count; if((size >= 1)) { /* Perform validation of the inner elements */ return td->check_constraints(td, sptr, ctfailcb, app_key); } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /*** <<< STAT-DEFS [VariablePart] >>> ***/ static asn_TYPE_member_t asn_MBR_vset_2[] = { { ATF_POINTER, 0, 0, .tag = (ASN_TAG_CLASS_UNIVERSAL | (26 << 2)), .tag_mode = 0, .type = &asn_DEF_VisibleString, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "" }, }; static const ber_tlv_tag_t asn_DEF_vset_tags_2[] = { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_vset_specs_2 = { sizeof(struct vset), offsetof(struct vset, _asn_ctx), 0, /* XER encoding is XMLDelimitedItemList */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_vset_2 = { "vset", "vset", SET_OF_free, SET_OF_print, SET_OF_constraint, SET_OF_decode_ber, SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_vset_tags_2, sizeof(asn_DEF_vset_tags_2) /sizeof(asn_DEF_vset_tags_2[0]), /* 1 */ asn_DEF_vset_tags_2, /* Same as above */ sizeof(asn_DEF_vset_tags_2) /sizeof(asn_DEF_vset_tags_2[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_vset_2, 1, /* Single element */ &asn_SPC_vset_specs_2 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_vrange_4[] = { { ATF_NOFLAGS, 0, offsetof(struct vrange, from), .tag = (ASN_TAG_CLASS_UNIVERSAL | (26 << 2)), .tag_mode = 0, .type = &asn_DEF_VisibleString, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "from" }, { ATF_NOFLAGS, 0, offsetof(struct vrange, to), .tag = (ASN_TAG_CLASS_UNIVERSAL | (26 << 2)), .tag_mode = 0, .type = &asn_DEF_VisibleString, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "to" }, }; static const ber_tlv_tag_t asn_DEF_vrange_tags_4[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_vrange_tag2el_4[] = { { (ASN_TAG_CLASS_UNIVERSAL | (26 << 2)), 0, 0, 1 }, /* from */ { (ASN_TAG_CLASS_UNIVERSAL | (26 << 2)), 1, -1, 0 } /* to */ }; static asn_SEQUENCE_specifics_t asn_SPC_vrange_specs_4 = { sizeof(struct vrange), offsetof(struct vrange, _asn_ctx), asn_MAP_vrange_tag2el_4, 2, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ 1, /* Start extensions */ 3 /* Stop extensions */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_vrange_4 = { "vrange", "vrange", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_vrange_tags_4, sizeof(asn_DEF_vrange_tags_4) /sizeof(asn_DEF_vrange_tags_4[0]), /* 1 */ asn_DEF_vrange_tags_4, /* Same as above */ sizeof(asn_DEF_vrange_tags_4) /sizeof(asn_DEF_vrange_tags_4[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_vrange_4, 2, /* Elements count */ &asn_SPC_vrange_specs_4 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_VariablePart_1[] = { { ATF_NOFLAGS, 0, offsetof(struct VariablePart, choice.vset), .tag = (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), .tag_mode = 0, .type = &asn_DEF_vset_2, .memb_constraints = memb_vset_constraint_1, .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "vset" }, { ATF_NOFLAGS, 0, offsetof(struct VariablePart, choice.vrange), .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), .tag_mode = 0, .type = &asn_DEF_vrange_4, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "vrange" }, }; static const asn_TYPE_tag2member_t asn_MAP_VariablePart_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 1, 0, 0 }, /* vrange */ { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), 0, 0, 0 } /* vset */ }; static asn_CHOICE_specifics_t asn_SPC_VariablePart_specs_1 = { sizeof(struct VariablePart), offsetof(struct VariablePart, _asn_ctx), offsetof(struct VariablePart, present), sizeof(((struct VariablePart *)0)->present), asn_MAP_VariablePart_tag2el_1, 2, /* Count of tags in the map */ .canonical_order = 0, .ext_start = 2 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_VariablePart = { "VariablePart", "VariablePart", CHOICE_free, CHOICE_print, CHOICE_constraint, CHOICE_decode_ber, CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ 0, /* No tags (pointer) */ 0, /* No tags (count) */ 0, /* No PER visible constraints */ asn_MBR_VariablePart_1, 2, /* Elements count */ &asn_SPC_VariablePart_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [ActionItem] >>> ***/ #include #include #include #include #include #include /*** <<< DEPS [ActionItem] >>> ***/ typedef enum accept_as { accept_as_unknown = 0, accept_as_safe = 1, accept_as_unsafe = 2 /* * Enumeration is extensible */ } e_accept_as; /*** <<< TYPE-DECLS [ActionItem] >>> ***/ typedef struct ActionItem { long accept_as; struct notify { BOOLEAN_t critical; struct email { A_SET_OF(VisibleString_t) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } email; /* * This type is extensible, * possible extensions are below. */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } *notify; /* * This type is extensible, * possible extensions are below. */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } ActionItem_t; /*** <<< FUNC-DECLS [ActionItem] >>> ***/ /* extern asn_TYPE_descriptor_t asn_DEF_accept_as_2; // (Use -fall-defs-global to expose) */ extern asn_TYPE_descriptor_t asn_DEF_ActionItem; /*** <<< CODE [ActionItem] >>> ***/ static int accept_as_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using NativeEnumerated, * so here we adjust the DEF accordingly. */ static void accept_as_2_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeEnumerated.free_struct; td->print_struct = asn_DEF_NativeEnumerated.print_struct; td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; td->ber_decoder = asn_DEF_NativeEnumerated.ber_decoder; td->der_encoder = asn_DEF_NativeEnumerated.der_encoder; td->xer_decoder = asn_DEF_NativeEnumerated.xer_decoder; td->xer_encoder = asn_DEF_NativeEnumerated.xer_encoder; td->uper_decoder = asn_DEF_NativeEnumerated.uper_decoder; td->uper_encoder = asn_DEF_NativeEnumerated.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeEnumerated.per_constraints; td->elements = asn_DEF_NativeEnumerated.elements; td->elements_count = asn_DEF_NativeEnumerated.elements_count; /* td->specifics = asn_DEF_NativeEnumerated.specifics; // Defined explicitly */ } static void accept_as_2_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { accept_as_2_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } static int accept_as_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { accept_as_2_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } static asn_dec_rval_t accept_as_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { accept_as_2_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } static asn_enc_rval_t accept_as_2_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { accept_as_2_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } static asn_dec_rval_t accept_as_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { accept_as_2_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } static asn_enc_rval_t accept_as_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { accept_as_2_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [ActionItem] >>> ***/ static const asn_INTEGER_enum_map_t asn_MAP_accept_as_value2enum_2[] = { { 0, 7, "unknown" }, { 1, 4, "safe" }, { 2, 6, "unsafe" } /* This list is extensible */ }; static const unsigned int asn_MAP_accept_as_enum2value_2[] = { 1, /* safe(1) */ 0, /* unknown(0) */ 2 /* unsafe(2) */ /* This list is extensible */ }; static const asn_INTEGER_specifics_t asn_SPC_accept_as_specs_2 = { asn_MAP_accept_as_value2enum_2, /* "tag" => N; sorted by tag */ asn_MAP_accept_as_enum2value_2, /* N => "tag"; sorted by N */ 3, /* Number of elements in the maps */ 4, /* Extensions before this member */ 1, /* Strict enumeration */ 0, /* Native long size */ 0 }; static const ber_tlv_tag_t asn_DEF_accept_as_tags_2[] = { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_accept_as_2 = { "accept-as", "accept-as", accept_as_2_free, accept_as_2_print, accept_as_2_constraint, accept_as_2_decode_ber, accept_as_2_encode_der, accept_as_2_decode_xer, accept_as_2_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_accept_as_tags_2, sizeof(asn_DEF_accept_as_tags_2) /sizeof(asn_DEF_accept_as_tags_2[0]), /* 1 */ asn_DEF_accept_as_tags_2, /* Same as above */ sizeof(asn_DEF_accept_as_tags_2) /sizeof(asn_DEF_accept_as_tags_2[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* Defined elsewhere */ &asn_SPC_accept_as_specs_2 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_email_9[] = { { ATF_POINTER, 0, 0, .tag = (ASN_TAG_CLASS_UNIVERSAL | (26 << 2)), .tag_mode = 0, .type = &asn_DEF_VisibleString, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "" }, }; static const ber_tlv_tag_t asn_DEF_email_tags_9[] = { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_email_specs_9 = { sizeof(struct email), offsetof(struct email, _asn_ctx), 0, /* XER encoding is XMLDelimitedItemList */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_email_9 = { "email", "email", SET_OF_free, SET_OF_print, SET_OF_constraint, SET_OF_decode_ber, SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_email_tags_9, sizeof(asn_DEF_email_tags_9) /sizeof(asn_DEF_email_tags_9[0]), /* 1 */ asn_DEF_email_tags_9, /* Same as above */ sizeof(asn_DEF_email_tags_9) /sizeof(asn_DEF_email_tags_9[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_email_9, 1, /* Single element */ &asn_SPC_email_specs_9 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_notify_7[] = { { ATF_NOFLAGS, 0, offsetof(struct notify, critical), .tag = (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)), .tag_mode = 0, .type = &asn_DEF_BOOLEAN, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "critical" }, { ATF_NOFLAGS, 0, offsetof(struct notify, email), .tag = (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), .tag_mode = 0, .type = &asn_DEF_email_9, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "email" }, }; static const ber_tlv_tag_t asn_DEF_notify_tags_7[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_notify_tag2el_7[] = { { (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)), 0, 0, 0 }, /* critical */ { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), 1, 0, 0 } /* email */ }; static asn_SEQUENCE_specifics_t asn_SPC_notify_specs_7 = { sizeof(struct notify), offsetof(struct notify, _asn_ctx), asn_MAP_notify_tag2el_7, 2, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ 1, /* Start extensions */ 3 /* Stop extensions */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_notify_7 = { "notify", "notify", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_notify_tags_7, sizeof(asn_DEF_notify_tags_7) /sizeof(asn_DEF_notify_tags_7[0]), /* 1 */ asn_DEF_notify_tags_7, /* Same as above */ sizeof(asn_DEF_notify_tags_7) /sizeof(asn_DEF_notify_tags_7[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_notify_7, 2, /* Elements count */ &asn_SPC_notify_specs_7 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_ActionItem_1[] = { { ATF_NOFLAGS, 0, offsetof(struct ActionItem, accept_as), .tag = (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), .tag_mode = 0, .type = &asn_DEF_accept_as_2, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "accept-as" }, { ATF_POINTER, 1, offsetof(struct ActionItem, notify), .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), .tag_mode = 0, .type = &asn_DEF_notify_7, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "notify" }, }; static const ber_tlv_tag_t asn_DEF_ActionItem_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_ActionItem_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 0, 0, 0 }, /* accept-as */ { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 1, 0, 0 } /* notify */ }; static asn_SEQUENCE_specifics_t asn_SPC_ActionItem_specs_1 = { sizeof(struct ActionItem), offsetof(struct ActionItem, _asn_ctx), asn_MAP_ActionItem_tag2el_1, 2, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ 1, /* Start extensions */ 3 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_ActionItem = { "ActionItem", "ActionItem", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_ActionItem_tags_1, sizeof(asn_DEF_ActionItem_tags_1) /sizeof(asn_DEF_ActionItem_tags_1[0]), /* 1 */ asn_DEF_ActionItem_tags_1, /* Same as above */ sizeof(asn_DEF_ActionItem_tags_1) /sizeof(asn_DEF_ActionItem_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_ActionItem_1, 2, /* Elements count */ &asn_SPC_ActionItem_specs_1 /* Additional specs */ }; asn1c-0.9.28+dfsg/tests/70-xer-test-OK.asn10000644000000000000000000000356413065714043016503 0ustar rootroot -- OK: Everything is Fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .70 ModuleTestXERDecoding { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 70 } DEFINITIONS AUTOMATIC TAGS ::= BEGIN /* * This module defines several types for the XER decoder testing * environment (defined elsewhere). */ PDU ::= CHOICE { sequence Sequence, set Set, sequenceOf SequenceOf, extensibleSet ExtensibleSet, extensibleSequence ExtensibleSequence, extensibleSequence2 ExtensibleSequence2, setOfNULL SetOfNULL, setOfREAL SetOfREAL, setOfEnums SetOfEnums, namedSetOfNULL NamedSetOfNULL, namedSetOfREAL NamedSetOfREAL, namedSetOfEnums NamedSetOfEnums, seqOfZuka SeqOfZuka, setOfChoice SetOfChoice, namedSetOfChoice NamedSetOfChoice, ... } Sequence ::= SEQUENCE { integer INTEGER, sequence Sequence OPTIONAL, -- backreference bits BIT STRING OPTIONAL, string UTF8String } Set ::= SET { roid RELATIVE-OID, opaque OCTET STRING OPTIONAL } ExtensibleSet ::= SET { string UTF8String OPTIONAL, ..., enum ENUMERATED { b, a } } ExtensibleSequence ::= SEQUENCE { string UTF8String OPTIONAL, ..., integer INTEGER OPTIONAL, gtime GeneralizedTime } ExtensibleSequence2 ::= SEQUENCE { string UTF8String OPTIONAL, ..., integer INTEGER OPTIONAL } SetOfNULL ::= SET OF NULL SetOfREAL ::= SET OF REAL SetOfEnums ::= SET OF ENUMERATED { one, oneMore } NamedSetOfNULL ::= SET OF y NULL NamedSetOfREAL ::= SET OF name REAL NamedSetOfEnums ::= SET OF name ENUMERATED { one, oneMore } SequenceOf ::= SEQUENCE OF id INTEGER { one(1), two(2) } SeqOfZuka ::= SEQUENCE OF zuka NULL SetOfChoice ::= SET OF SimpleChoice NamedSetOfChoice ::= SET OF whatever SimpleChoice SimpleChoice ::= CHOICE { a NULL, b INTEGER } END asn1c-0.9.28+dfsg/tests/24-sequence-OK.asn10000644000000000000000000000071213065714043016527 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .24 ModuleTestSequence { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 24 } DEFINITIONS IMPLICIT TAGS ::= BEGIN T ::= [5] EXPLICIT SEQUENCE { a INTEGER, b [0] INTEGER OPTIONAL, c [1] INTEGER DEFAULT ten, d [5] EXPLICIT INTEGER } ten INTEGER ::= 10 END asn1c-0.9.28+dfsg/tests/17-tags-OK.asn10000644000000000000000000000067113065714043015663 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .17 ModuleTestTags { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 17 } DEFINITIONS ::= BEGIN T3 ::= [3] IMPLICIT T2 T1 ::= [1] INTEGER T2 ::= [2] EXPLICIT T1 T4 ::= [APPLICATION 1] SET { t1 [4] IMPLICIT T1, t2 [5] T2, t3 [6] T3 } END asn1c-0.9.28+dfsg/tests/119-per-strings-OK.asn1.-EF0000644000000000000000000000402113065714043017624 0ustar rootrootModulePERStrings { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 119 } DEFINITIONS AUTOMATIC TAGS ::= BEGIN PDU ::= SEQUENCE { many [0] IMPLICIT SEQUENCE OF PDU OPTIONAL, ia5 [1] IMPLICIT IA5String OPTIONAL, ia5-c [2] IMPLICIT IA5String (FROM("A".."Z")) OPTIONAL, ia5-ce [3] IMPLICIT IA5String (FROM("A".."Z",...)) OPTIONAL, ia5-ir [4] IMPLICIT IA5String (FROM("A".."B" | "X".."Z")) OPTIONAL, vs [5] IMPLICIT VisibleString OPTIONAL, vs-c [6] IMPLICIT VisibleString (FROM("A".."Z")) OPTIONAL, vs-ce [7] IMPLICIT VisibleString (FROM("A".."Z",...)) OPTIONAL, vs-ir [8] IMPLICIT VisibleString (FROM("A".."B" | "X".."Z")) OPTIONAL, pr [9] IMPLICIT PrintableString OPTIONAL, pr-c [10] IMPLICIT PrintableString (FROM("A".."Z")) OPTIONAL, pr-ir [11] IMPLICIT PrintableString (FROM("A".."B" | "X".."Z")) OPTIONAL, ns [12] IMPLICIT NumericString OPTIONAL, ns-c [13] IMPLICIT NumericString (FROM("5".."9")) OPTIONAL, ns-ce [14] IMPLICIT NumericString (FROM("5".."9",...)) OPTIONAL, ns-ir [15] IMPLICIT NumericString (FROM("1" | "9")) OPTIONAL, ut-c [16] IMPLICIT UTF8String (SIZE(6)) OPTIONAL, ut-ce [17] IMPLICIT UTF8String (SIZE(6,...)) OPTIONAL, ut-ir [18] IMPLICIT UTF8String (FROM("A" | "Z")) OPTIONAL, bm [19] IMPLICIT BMPString OPTIONAL, bm-c [20] IMPLICIT BMPString (FROM("A".."Z")) OPTIONAL, bm-cs [21] IMPLICIT BMPString (SIZE(6)) OPTIONAL, bm-ce [22] IMPLICIT BMPString (FROM("A".."Z",...)) OPTIONAL, bm-ir [23] IMPLICIT BMPString (FROM("A".."B" | "X".."Z")) OPTIONAL, us [24] IMPLICIT UniversalString OPTIONAL, us-c [25] IMPLICIT UniversalString (FROM("A".."Z")) OPTIONAL, us-cs [26] IMPLICIT UniversalString (SIZE(6)) OPTIONAL, us-ce [27] IMPLICIT UniversalString (FROM("A".."Z",...)) OPTIONAL, us-ir [28] IMPLICIT UniversalString (FROM("A".."B" | "X".."Z")) OPTIONAL, real [29] IMPLICIT REAL OPTIONAL, oid [30] IMPLICIT OBJECT IDENTIFIER OPTIONAL } END asn1c-0.9.28+dfsg/tests/82-with-comps-OK.asn1.-EF0000644000000000000000000000055713065714043017372 0ustar rootrootModuleTestWithComponents { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 82 } DEFINITIONS ::= BEGIN BunchOfStrings ::= SEQUENCE OF VisibleString Address ::= BunchOfStrings (SIZE(1..6))(WITH COMPONENT (SIZE(1..32))) Type ::= SEQUENCE { one INTEGER DEFAULT 1 } (WITH COMPONENTS { ..., one (1) PRESENT }) END asn1c-0.9.28+dfsg/tests/74-int-enum-constraints-OK.asn10000644000000000000000000000100613065714043021022 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .74 ModuleTestIntegerAndEnumeratedConstraints { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 74 } DEFINITIONS ::= BEGIN -- Enumeration constrained by the second choice. Enum ::= ENUMERATED { one, two } (two|one) -- Integer constrained by the only choice. Int ::= INTEGER { v1-0(123) } (v1-0) EnumRef ::= Enum (two) END asn1c-0.9.28+dfsg/tests/66-ref-simple-OK.asn1.-Pfwide-types0000644000000000000000000001460313065714043021430 0ustar rootroot /*** <<< INCLUDES [T] >>> ***/ #include "SimpleType.h" #include #include /*** <<< TYPE-DECLS [T] >>> ***/ typedef struct T { A_SET_OF(SimpleType_t) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } T_t; /*** <<< FUNC-DECLS [T] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_T; /*** <<< STAT-DEFS [T] >>> ***/ static asn_TYPE_member_t asn_MBR_T_1[] = { { ATF_POINTER, 0, 0, .tag = (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), .tag_mode = 0, .type = &asn_DEF_SimpleType, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "named" }, }; static const ber_tlv_tag_t asn_DEF_T_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_T_specs_1 = { sizeof(struct T), offsetof(struct T, _asn_ctx), 1, /* XER encoding is XMLValueList */ }; asn_TYPE_descriptor_t asn_DEF_T = { "T", "T", SET_OF_free, SET_OF_print, SET_OF_constraint, SET_OF_decode_ber, SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T_tags_1, sizeof(asn_DEF_T_tags_1) /sizeof(asn_DEF_T_tags_1[0]), /* 1 */ asn_DEF_T_tags_1, /* Same as above */ sizeof(asn_DEF_T_tags_1) /sizeof(asn_DEF_T_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_T_1, 1, /* Single element */ &asn_SPC_T_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [SimpleType] >>> ***/ #include /*** <<< DEPS [SimpleType] >>> ***/ typedef enum SimpleType { SimpleType_one = 0, SimpleType_two = 1, SimpleType_three = 2 } e_SimpleType; /*** <<< TYPE-DECLS [SimpleType] >>> ***/ typedef ENUMERATED_t SimpleType_t; /*** <<< FUNC-DECLS [SimpleType] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_SimpleType; asn_struct_free_f SimpleType_free; asn_struct_print_f SimpleType_print; asn_constr_check_f SimpleType_constraint; ber_type_decoder_f SimpleType_decode_ber; der_type_encoder_f SimpleType_encode_der; xer_type_decoder_f SimpleType_decode_xer; xer_type_encoder_f SimpleType_encode_xer; /*** <<< CODE [SimpleType] >>> ***/ int SimpleType_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ENUMERATED.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using ENUMERATED, * so here we adjust the DEF accordingly. */ static void SimpleType_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_ENUMERATED.free_struct; td->print_struct = asn_DEF_ENUMERATED.print_struct; td->check_constraints = asn_DEF_ENUMERATED.check_constraints; td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; td->der_encoder = asn_DEF_ENUMERATED.der_encoder; td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; td->elements = asn_DEF_ENUMERATED.elements; td->elements_count = asn_DEF_ENUMERATED.elements_count; /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ } void SimpleType_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { SimpleType_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int SimpleType_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { SimpleType_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t SimpleType_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { SimpleType_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t SimpleType_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { SimpleType_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t SimpleType_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { SimpleType_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t SimpleType_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { SimpleType_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [SimpleType] >>> ***/ static const asn_INTEGER_enum_map_t asn_MAP_SimpleType_value2enum_1[] = { { 0, 3, "one" }, { 1, 3, "two" }, { 2, 5, "three" } }; static const unsigned int asn_MAP_SimpleType_enum2value_1[] = { 0, /* one(0) */ 2, /* three(2) */ 1 /* two(1) */ }; static const asn_INTEGER_specifics_t asn_SPC_SimpleType_specs_1 = { asn_MAP_SimpleType_value2enum_1, /* "tag" => N; sorted by tag */ asn_MAP_SimpleType_enum2value_1, /* N => "tag"; sorted by N */ 3, /* Number of elements in the maps */ 0, /* Enumeration is not extensible */ 1, /* Strict enumeration */ 0, /* Native long size */ 0 }; static const ber_tlv_tag_t asn_DEF_SimpleType_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) }; asn_TYPE_descriptor_t asn_DEF_SimpleType = { "SimpleType", "SimpleType", SimpleType_free, SimpleType_print, SimpleType_constraint, SimpleType_decode_ber, SimpleType_encode_der, SimpleType_decode_xer, SimpleType_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_SimpleType_tags_1, sizeof(asn_DEF_SimpleType_tags_1) /sizeof(asn_DEF_SimpleType_tags_1[0]), /* 1 */ asn_DEF_SimpleType_tags_1, /* Same as above */ sizeof(asn_DEF_SimpleType_tags_1) /sizeof(asn_DEF_SimpleType_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* Defined elsewhere */ &asn_SPC_SimpleType_specs_1 /* Additional specs */ }; asn1c-0.9.28+dfsg/tests/124-multiconstraint-OK.asn1.-EF0000644000000000000000000000035413065714043020607 0ustar rootrootModuleMultiConstraint { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 124 } DEFINITIONS AUTOMATIC TAGS ::= BEGIN T ::= VisibleString (PATTERN "^[a-z]+$")(CONSTRAINED BY { ... }) END asn1c-0.9.28+dfsg/tests/30-set-OK.asn1.-Pfwide-types0000644000000000000000000000637713065714043020160 0ustar rootroot /*** <<< INCLUDES [T] >>> ***/ #include #include #include #include /*** <<< DEPS [T] >>> ***/ /* * Method of determining the components presence */ typedef enum T_PR { T_PR_i, /* Member i is present */ T_PR_s, /* Member s is present */ T_PR_b, /* Member b is present */ } T_PR; /*** <<< TYPE-DECLS [T] >>> ***/ typedef struct T { INTEGER_t i; IA5String_t s; /* * This type is extensible, * possible extensions are below. */ BOOLEAN_t *b; /* Presence bitmask: ASN_SET_ISPRESENT(pT, T_PR_x) */ unsigned int _presence_map [((3+(8*sizeof(unsigned int))-1)/(8*sizeof(unsigned int)))]; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } T_t; /*** <<< FUNC-DECLS [T] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_T; /*** <<< STAT-DEFS [T] >>> ***/ static asn_TYPE_member_t asn_MBR_T_1[] = { { ATF_NOFLAGS, 0, offsetof(struct T, i), .tag = (ASN_TAG_CLASS_APPLICATION | (3 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_INTEGER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "i" }, { ATF_NOFLAGS, 0, offsetof(struct T, s), .tag = (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)), .tag_mode = 0, .type = &asn_DEF_IA5String, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "s" }, { ATF_POINTER, 1, offsetof(struct T, b), .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_BOOLEAN, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "b" }, }; static const ber_tlv_tag_t asn_DEF_T_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_T_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)), 1, 0, 0 }, /* s */ { (ASN_TAG_CLASS_APPLICATION | (3 << 2)), 0, 0, 0 }, /* i */ { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* b */ }; static const uint8_t asn_MAP_T_mmap_1[(3 + (8 * sizeof(unsigned int)) - 1) / 8] = { (1 << 7) | (1 << 6) | (0 << 5) }; static asn_SET_specifics_t asn_SPC_T_specs_1 = { sizeof(struct T), offsetof(struct T, _asn_ctx), offsetof(struct T, _presence_map), asn_MAP_T_tag2el_1, 3, /* Count of tags in the map */ asn_MAP_T_tag2el_1, /* Same as above */ 3, /* Count of tags in the CXER map */ 1, /* Whether extensible */ (unsigned int *)asn_MAP_T_mmap_1 /* Mandatory elements map */ }; asn_TYPE_descriptor_t asn_DEF_T = { "T", "T", SET_free, SET_print, SET_constraint, SET_decode_ber, SET_encode_der, SET_decode_xer, SET_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T_tags_1, sizeof(asn_DEF_T_tags_1) /sizeof(asn_DEF_T_tags_1[0]), /* 1 */ asn_DEF_T_tags_1, /* Same as above */ sizeof(asn_DEF_T_tags_1) /sizeof(asn_DEF_T_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_T_1, 3, /* Elements count */ &asn_SPC_T_specs_1 /* Additional specs */ }; asn1c-0.9.28+dfsg/tests/131-per-empty-OK.asn1.-Pgen-PER0000644000000000000000000000234013065714043020310 0ustar rootroot /*** <<< INCLUDES [T] >>> ***/ #include /*** <<< TYPE-DECLS [T] >>> ***/ typedef struct T { /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } T_t; /*** <<< FUNC-DECLS [T] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_T; /*** <<< STAT-DEFS [T] >>> ***/ static const ber_tlv_tag_t asn_DEF_T_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static asn_SEQUENCE_specifics_t asn_SPC_T_specs_1 = { sizeof(struct T), offsetof(struct T, _asn_ctx), 0, /* No top level tags */ 0, /* No tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_T = { "T", "T", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_T_tags_1, sizeof(asn_DEF_T_tags_1) /sizeof(asn_DEF_T_tags_1[0]), /* 1 */ asn_DEF_T_tags_1, /* Same as above */ sizeof(asn_DEF_T_tags_1) /sizeof(asn_DEF_T_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ &asn_SPC_T_specs_1 /* Additional specs */ }; asn1c-0.9.28+dfsg/tests/93-asn1c-controls-OK.asn1.-EF0000644000000000000000000000114113065714043020136 0ustar rootrootModule-asn1c-controls { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 93 } DEFINITIONS AUTOMATIC TAGS ::= BEGIN Sequence ::= SEQUENCE { ainl [0] IMPLICIT INTEGER, ---- aptr [1] IMPLICIT INTEGER } Set ::= SET { ainl [0] IMPLICIT Sequence, ---- aptr [1] IMPLICIT Sequence } Choice ::= CHOICE { ---- setof [0] IMPLICIT SET OF INTEGER, ---- aptr [1] IMPLICIT Sequence, ainl [2] IMPLICIT Sequence } END asn1c-0.9.28+dfsg/tests/56-components-of-SE.asn10000644000000000000000000000065313065714043017515 0ustar rootroot -- SE: Semantic error -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .56 ModuleTestComponentsOfInvalidReference { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 56 } DEFINITIONS AUTOMATIC TAGS ::= BEGIN OneType ::= SEQUENCE { a IA5String, COMPONENTS OF INTEGER, -- Error is here b UniversalString } END asn1c-0.9.28+dfsg/tests/13-resolver-OK.asn10000644000000000000000000000204713065714043016561 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .13 1 -- .13 2 ModuleTestResolver1 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 13 1 } DEFINITIONS ::= BEGIN IMPORTS IntegerType, beta FROM Renamed { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 13 2 }; -- external reference alpha IntegerType ::= beta alpha2 Renamed.IntegerType ::= beta -- -- The following are for post-fix checking by the check_fixer. -- It will be able to pick-up these values if the file is parseable, -- even if it contains some semantic errors. -- check-alpha INTEGER ::= 123 check-alpha2 INTEGER ::= 123 END ModuleTestResolver2 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 13 2 } DEFINITIONS ::= BEGIN EXPORTS beta, IntegerType ; beta HiddenType ::= 123 HiddenType ::= INTEGER IntegerType ::= INTEGER END asn1c-0.9.28+dfsg/tests/28-tags-SE.asn10000644000000000000000000000063613065714043015664 0ustar rootroot -- SE: Semantic error -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .28 ModuleTestTagsDistinct { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 28 } DEFINITIONS IMPLICIT TAGS ::= BEGIN S ::= SET { a INTEGER, b CHOICE { c IA5String, ... }, d CHOICE { e BOOLEAN, ... } } END asn1c-0.9.28+dfsg/tests/10-int-OK.asn10000644000000000000000000000136613065714043015512 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .10 ModuleTestInt4 { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 10 } DEFINITIONS ::= BEGIN alpha INTEGER ::= 1 Type1 ::= INTEGER { alpha(2) } Type2 ::= INTEGER { alpha(3), beta(alpha) } gamma Type2 ::= beta -- equals 1 -- delta Type2 ::= alpha -- equals 3 -- /* * The following are for post-fix checking by the check_fixer. * It will be able to pick-up these values if the file is parseable, * even if it contains some semantic errors. */ check-gamma INTEGER ::= 1 -- check "gamma"'s value check-delta INTEGER ::= 3 -- check "delta"'s value END asn1c-0.9.28+dfsg/tests/59-choice-extended-OK.asn1.-Pfwide-types0000644000000000000000000000632113065714043022415 0ustar rootroot /*** <<< INCLUDES [Choice] >>> ***/ #include #include /*** <<< DEPS [Choice] >>> ***/ typedef enum Choice_PR { Choice_PR_NOTHING, /* No components present */ Choice_PR_a, /* Extensions may appear below */ Choice_PR_b, Choice_PR_c } Choice_PR; /*** <<< FWD-DECLS [Choice] >>> ***/ struct Choice; /*** <<< TYPE-DECLS [Choice] >>> ***/ typedef struct Choice { Choice_PR present; union Choice_u { INTEGER_t a; /* * This type is extensible, * possible extensions are below. */ INTEGER_t b; struct Choice *c; } choice; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Choice_t; /*** <<< FUNC-DECLS [Choice] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Choice; /*** <<< POST-INCLUDE [Choice] >>> ***/ #include "Choice.h" /*** <<< STAT-DEFS [Choice] >>> ***/ static asn_TYPE_member_t asn_MBR_Choice_1[] = { { ATF_NOFLAGS, 0, offsetof(struct Choice, choice.a), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_INTEGER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "a" }, { ATF_NOFLAGS, 0, offsetof(struct Choice, choice.b), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_INTEGER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "b" }, { ATF_POINTER, 0, offsetof(struct Choice, choice.c), .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Choice, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "c" }, }; static const ber_tlv_tag_t asn_DEF_Choice_tags_1[] = { (ASN_TAG_CLASS_CONTEXT | (123 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_Choice_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* a */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* b */ { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* c */ }; static asn_CHOICE_specifics_t asn_SPC_Choice_specs_1 = { sizeof(struct Choice), offsetof(struct Choice, _asn_ctx), offsetof(struct Choice, present), sizeof(((struct Choice *)0)->present), asn_MAP_Choice_tag2el_1, 3, /* Count of tags in the map */ .canonical_order = 0, .ext_start = 1 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_Choice = { "Choice", "Choice", CHOICE_free, CHOICE_print, CHOICE_constraint, CHOICE_decode_ber, CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, asn_DEF_Choice_tags_1, sizeof(asn_DEF_Choice_tags_1) /sizeof(asn_DEF_Choice_tags_1[0]), /* 1 */ asn_DEF_Choice_tags_1, /* Same as above */ sizeof(asn_DEF_Choice_tags_1) /sizeof(asn_DEF_Choice_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Choice_1, 3, /* Elements count */ &asn_SPC_Choice_specs_1 /* Additional specs */ }; asn1c-0.9.28+dfsg/tests/83-with-comps-OK.asn10000644000000000000000000000060213065714043017014 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .83 ModuleTestWithComponents2 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 83 } DEFINITIONS ::= BEGIN Type1 ::= SET {} Type2 ::= SET { COMPONENTS OF Type1 (WITH COMPONENTS { ... }) } END asn1c-0.9.28+dfsg/tests/108-param-constr-3-OK.asn10000644000000000000000000000063313065714043017552 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .108 ModuleParameterizationWithConstraints3 { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 108 } DEFINITIONS ::= BEGIN MinMax {Type, INTEGER:low-bound} ::= Type (low-bound..MAX) ThreePlus ::= MinMax {INTEGER, 3} END asn1c-0.9.28+dfsg/tests/84-param-tags-OK.asn1.-Pfwide-types0000644000000000000000000003634513065714043021430 0ustar rootroot /*** <<< INCLUDES [TestType] >>> ***/ #include #include #include /*** <<< TYPE-DECLS [TestType] >>> ***/ typedef struct TestType_16P0 { long common /* DEFAULT 0 */; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } TestType_16P0_t; typedef struct TestType_16P1 { BOOLEAN_t common /* DEFAULT 0 */; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } TestType_16P1_t; /*** <<< FUNC-DECLS [TestType] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_TestType_16P0; extern asn_TYPE_descriptor_t asn_DEF_TestType_16P1; /*** <<< CODE [TestType] >>> ***/ static int memb_common_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if((value >= 1 && value <= 10)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /*** <<< STAT-DEFS [TestType] >>> ***/ static int asn_DFL_2_set_0(int set_value, void **sptr) { long *st = *sptr; if(!st) { if(!set_value) return -1; /* Not a default value */ st = (*sptr = CALLOC(1, sizeof(*st))); if(!st) return -1; } if(set_value) { /* Install default value 0 */ *st = 0; return 0; } else { /* Test default value 0 */ return (*st == 0); } } static asn_TYPE_member_t asn_MBR_TestType_16P0_1[] = { { ATF_NOFLAGS, 1, offsetof(struct TestType_16P0, common), .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), .tag_mode = 0, .type = &asn_DEF_NativeInteger, .memb_constraints = memb_common_constraint_1, .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = asn_DFL_2_set_0, /* DEFAULT 0 */ .name = "common" }, }; static const ber_tlv_tag_t asn_DEF_TestType_16P0_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_TestType_16P0_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 } /* common */ }; static asn_SEQUENCE_specifics_t asn_SPC_TestType_16P0_specs_1 = { sizeof(struct TestType_16P0), offsetof(struct TestType_16P0, _asn_ctx), asn_MAP_TestType_16P0_tag2el_1, 1, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_TestType_16P0 = { "TestType", "TestType", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_TestType_16P0_tags_1, sizeof(asn_DEF_TestType_16P0_tags_1) /sizeof(asn_DEF_TestType_16P0_tags_1[0]), /* 1 */ asn_DEF_TestType_16P0_tags_1, /* Same as above */ sizeof(asn_DEF_TestType_16P0_tags_1) /sizeof(asn_DEF_TestType_16P0_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_TestType_16P0_1, 1, /* Elements count */ &asn_SPC_TestType_16P0_specs_1 /* Additional specs */ }; static int asn_DFL_4_set_0(int set_value, void **sptr) { BOOLEAN_t *st = *sptr; if(!st) { if(!set_value) return -1; /* Not a default value */ st = (*sptr = CALLOC(1, sizeof(*st))); if(!st) return -1; } if(set_value) { /* Install default value 0 */ *st = 0; return 0; } else { /* Test default value 0 */ return (*st == 0); } } static asn_TYPE_member_t asn_MBR_TestType_16P1_3[] = { { ATF_NOFLAGS, 1, offsetof(struct TestType_16P1, common), .tag = (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)), .tag_mode = 0, .type = &asn_DEF_BOOLEAN, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = asn_DFL_4_set_0, /* DEFAULT 0 */ .name = "common" }, }; static const ber_tlv_tag_t asn_DEF_TestType_16P1_tags_3[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_TestType_16P1_tag2el_3[] = { { (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)), 0, 0, 0 } /* common */ }; static asn_SEQUENCE_specifics_t asn_SPC_TestType_16P1_specs_3 = { sizeof(struct TestType_16P1), offsetof(struct TestType_16P1, _asn_ctx), asn_MAP_TestType_16P1_tag2el_3, 1, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_TestType_16P1 = { "TestType", "TestType", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_TestType_16P1_tags_3, sizeof(asn_DEF_TestType_16P1_tags_3) /sizeof(asn_DEF_TestType_16P1_tags_3[0]), /* 1 */ asn_DEF_TestType_16P1_tags_3, /* Same as above */ sizeof(asn_DEF_TestType_16P1_tags_3) /sizeof(asn_DEF_TestType_16P1_tags_3[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_TestType_16P1_3, 1, /* Elements count */ &asn_SPC_TestType_16P1_specs_3 /* Additional specs */ }; /*** <<< INCLUDES [TestChoice] >>> ***/ #include "TestType.h" #include /*** <<< DEPS [TestChoice] >>> ***/ typedef enum TestChoice_PR { TestChoice_PR_NOTHING, /* No components present */ TestChoice_PR_type1, TestChoice_PR_type2 } TestChoice_PR; /*** <<< TYPE-DECLS [TestChoice] >>> ***/ typedef struct TestChoice { TestChoice_PR present; union TestChoice_u { TestType_16P0_t type1; TestType_16P1_t type2; } choice; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } TestChoice_t; /*** <<< FUNC-DECLS [TestChoice] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_TestChoice; /*** <<< STAT-DEFS [TestChoice] >>> ***/ static asn_TYPE_member_t asn_MBR_TestChoice_1[] = { { ATF_NOFLAGS, 0, offsetof(struct TestChoice, choice.type1), .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), .tag_mode = 0, .type = &asn_DEF_TestType_16P0, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "type1" }, { ATF_NOFLAGS, 0, offsetof(struct TestChoice, choice.type2), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_TestType_16P1, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "type2" }, }; static const asn_TYPE_tag2member_t asn_MAP_TestChoice_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 0 }, /* type1 */ { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 1, 0, 0 } /* type2 */ }; static asn_CHOICE_specifics_t asn_SPC_TestChoice_specs_1 = { sizeof(struct TestChoice), offsetof(struct TestChoice, _asn_ctx), offsetof(struct TestChoice, present), sizeof(((struct TestChoice *)0)->present), asn_MAP_TestChoice_tag2el_1, 2, /* Count of tags in the map */ .canonical_order = 0, .ext_start = -1 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_TestChoice = { "TestChoice", "TestChoice", CHOICE_free, CHOICE_print, CHOICE_constraint, CHOICE_decode_ber, CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ 0, /* No tags (pointer) */ 0, /* No tags (count) */ 0, /* No PER visible constraints */ asn_MBR_TestChoice_1, 2, /* Elements count */ &asn_SPC_TestChoice_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [AutoType] >>> ***/ #include #include #include /*** <<< TYPE-DECLS [AutoType] >>> ***/ typedef struct AutoType_34P0 { long common; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } AutoType_34P0_t; typedef struct AutoType_34P1 { BOOLEAN_t common; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } AutoType_34P1_t; /*** <<< FUNC-DECLS [AutoType] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_AutoType_34P0; extern asn_TYPE_descriptor_t asn_DEF_AutoType_34P1; /*** <<< CODE [AutoType] >>> ***/ static int memb_common_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if((value == 0)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } static int memb_common_constraint_3(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { BOOLEAN_t value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = (*(const long *)sptr) ? 1 : 0; if((value <= 0)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /*** <<< STAT-DEFS [AutoType] >>> ***/ static asn_TYPE_member_t asn_MBR_AutoType_34P0_1[] = { { ATF_NOFLAGS, 0, offsetof(struct AutoType_34P0, common), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_NativeInteger, .memb_constraints = memb_common_constraint_1, .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "common" }, }; static const ber_tlv_tag_t asn_DEF_AutoType_34P0_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_AutoType_34P0_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* common */ }; static asn_SEQUENCE_specifics_t asn_SPC_AutoType_34P0_specs_1 = { sizeof(struct AutoType_34P0), offsetof(struct AutoType_34P0, _asn_ctx), asn_MAP_AutoType_34P0_tag2el_1, 1, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_AutoType_34P0 = { "AutoType", "AutoType", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_AutoType_34P0_tags_1, sizeof(asn_DEF_AutoType_34P0_tags_1) /sizeof(asn_DEF_AutoType_34P0_tags_1[0]), /* 1 */ asn_DEF_AutoType_34P0_tags_1, /* Same as above */ sizeof(asn_DEF_AutoType_34P0_tags_1) /sizeof(asn_DEF_AutoType_34P0_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_AutoType_34P0_1, 1, /* Elements count */ &asn_SPC_AutoType_34P0_specs_1 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_AutoType_34P1_3[] = { { ATF_NOFLAGS, 0, offsetof(struct AutoType_34P1, common), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_BOOLEAN, .memb_constraints = memb_common_constraint_3, .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "common" }, }; static const ber_tlv_tag_t asn_DEF_AutoType_34P1_tags_3[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_AutoType_34P1_tag2el_3[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* common */ }; static asn_SEQUENCE_specifics_t asn_SPC_AutoType_34P1_specs_3 = { sizeof(struct AutoType_34P1), offsetof(struct AutoType_34P1, _asn_ctx), asn_MAP_AutoType_34P1_tag2el_3, 1, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_AutoType_34P1 = { "AutoType", "AutoType", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_AutoType_34P1_tags_3, sizeof(asn_DEF_AutoType_34P1_tags_3) /sizeof(asn_DEF_AutoType_34P1_tags_3[0]), /* 1 */ asn_DEF_AutoType_34P1_tags_3, /* Same as above */ sizeof(asn_DEF_AutoType_34P1_tags_3) /sizeof(asn_DEF_AutoType_34P1_tags_3[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_AutoType_34P1_3, 1, /* Elements count */ &asn_SPC_AutoType_34P1_specs_3 /* Additional specs */ }; /*** <<< INCLUDES [AutoChoice] >>> ***/ #include "AutoType.h" #include /*** <<< DEPS [AutoChoice] >>> ***/ typedef enum AutoChoice_PR { AutoChoice_PR_NOTHING, /* No components present */ AutoChoice_PR_type1, AutoChoice_PR_type2 } AutoChoice_PR; /*** <<< TYPE-DECLS [AutoChoice] >>> ***/ typedef struct AutoChoice { AutoChoice_PR present; union AutoChoice_u { AutoType_34P0_t type1; AutoType_34P1_t type2; } choice; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } AutoChoice_t; /*** <<< FUNC-DECLS [AutoChoice] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_AutoChoice; /*** <<< STAT-DEFS [AutoChoice] >>> ***/ static asn_TYPE_member_t asn_MBR_AutoChoice_1[] = { { ATF_NOFLAGS, 0, offsetof(struct AutoChoice, choice.type1), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_AutoType_34P0, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "type1" }, { ATF_NOFLAGS, 0, offsetof(struct AutoChoice, choice.type2), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_AutoType_34P1, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "type2" }, }; static const asn_TYPE_tag2member_t asn_MAP_AutoChoice_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* type1 */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* type2 */ }; static asn_CHOICE_specifics_t asn_SPC_AutoChoice_specs_1 = { sizeof(struct AutoChoice), offsetof(struct AutoChoice, _asn_ctx), offsetof(struct AutoChoice, present), sizeof(((struct AutoChoice *)0)->present), asn_MAP_AutoChoice_tag2el_1, 2, /* Count of tags in the map */ .canonical_order = 0, .ext_start = -1 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_AutoChoice = { "AutoChoice", "AutoChoice", CHOICE_free, CHOICE_print, CHOICE_constraint, CHOICE_decode_ber, CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ 0, /* No tags (pointer) */ 0, /* No tags (count) */ 0, /* No PER visible constraints */ asn_MBR_AutoChoice_1, 2, /* Elements count */ &asn_SPC_AutoChoice_specs_1 /* Additional specs */ }; asn1c-0.9.28+dfsg/tests/95-choice-per-order-OK.asn1.-Pgen-PER0000644000000000000000000002122213065714043021446 0ustar rootroot /*** <<< INCLUDES [Choice] >>> ***/ #include #include #include #include #include #include /*** <<< DEPS [Choice] >>> ***/ typedef enum Choice_PR { Choice_PR_NOTHING, /* No components present */ Choice_PR_roid, Choice_PR_bitstr, Choice_PR_ch, /* Extensions may appear below */ Choice_PR_bool } Choice_PR; typedef enum ch_PR { ch_PR_NOTHING, /* No components present */ ch_PR_null, ch_PR_int } ch_PR; /*** <<< TYPE-DECLS [Choice] >>> ***/ typedef struct Choice { Choice_PR present; union Choice_u { RELATIVE_OID_t roid; BIT_STRING_t bitstr; struct ch { ch_PR present; union Choice__ch_u { NULL_t null; long Int; } choice; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } ch; /* * This type is extensible, * possible extensions are below. */ BOOLEAN_t Bool; } choice; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Choice_t; /*** <<< FUNC-DECLS [Choice] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Choice; /*** <<< CTDEFS [Choice] >>> ***/ static asn_per_constraints_t asn_PER_type_ch_constr_4 GCC_NOTUSED = { { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; static asn_per_constraints_t asn_PER_type_Choice_constr_1 GCC_NOTUSED = { { APC_CONSTRAINED | APC_EXTENSIBLE, 2, 2, 0, 2 } /* (0..2,...) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; /*** <<< STAT-DEFS [Choice] >>> ***/ static asn_TYPE_member_t asn_MBR_ch_4[] = { { ATF_NOFLAGS, 0, offsetof(struct ch, choice.null), .tag = (ASN_TAG_CLASS_UNIVERSAL | (5 << 2)), .tag_mode = 0, .type = &asn_DEF_NULL, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* No PER visible constraints */ .default_value = 0, .name = "null" }, { ATF_NOFLAGS, 0, offsetof(struct ch, choice.Int), .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), .tag_mode = 0, .type = &asn_DEF_NativeInteger, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* No PER visible constraints */ .default_value = 0, .name = "int" }, }; static const int asn_MAP_ch_cmap_4[] = { 1, 0 }; static const asn_TYPE_tag2member_t asn_MAP_ch_tag2el_4[] = { { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* int */ { (ASN_TAG_CLASS_UNIVERSAL | (5 << 2)), 0, 0, 0 } /* null */ }; static asn_CHOICE_specifics_t asn_SPC_ch_specs_4 = { sizeof(struct ch), offsetof(struct ch, _asn_ctx), offsetof(struct ch, present), sizeof(((struct ch *)0)->present), asn_MAP_ch_tag2el_4, 2, /* Count of tags in the map */ .canonical_order = asn_MAP_ch_cmap_4, /* Canonically sorted */ .ext_start = -1 /* Extensions start */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_ch_4 = { "ch", "ch", CHOICE_free, CHOICE_print, CHOICE_constraint, CHOICE_decode_ber, CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, CHOICE_decode_uper, CHOICE_encode_uper, CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ 0, /* No tags (pointer) */ 0, /* No tags (count) */ &asn_PER_type_ch_constr_4, asn_MBR_ch_4, 2, /* Elements count */ &asn_SPC_ch_specs_4 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_Choice_1[] = { { ATF_NOFLAGS, 0, offsetof(struct Choice, choice.roid), .tag = (ASN_TAG_CLASS_UNIVERSAL | (13 << 2)), .tag_mode = 0, .type = &asn_DEF_RELATIVE_OID, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* No PER visible constraints */ .default_value = 0, .name = "roid" }, { ATF_NOFLAGS, 0, offsetof(struct Choice, choice.bitstr), .tag = (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), .tag_mode = 0, .type = &asn_DEF_BIT_STRING, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* No PER visible constraints */ .default_value = 0, .name = "bitstr" }, { ATF_NOFLAGS, 0, offsetof(struct Choice, choice.ch), .tag = -1 /* Ambiguous tag (CHOICE?) */, .tag_mode = 0, .type = &asn_DEF_ch_4, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* No PER visible constraints */ .default_value = 0, .name = "ch" }, { ATF_NOFLAGS, 0, offsetof(struct Choice, choice.Bool), .tag = (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)), .tag_mode = 0, .type = &asn_DEF_BOOLEAN, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* No PER visible constraints */ .default_value = 0, .name = "bool" }, }; static const int asn_MAP_Choice_cmap_1[] = { 2, 1, 0, 3 }; static const asn_TYPE_tag2member_t asn_MAP_Choice_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)), 3, 0, 0 }, /* bool */ { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 2, 0, 0 }, /* int */ { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 1, 0, 0 }, /* bitstr */ { (ASN_TAG_CLASS_UNIVERSAL | (5 << 2)), 2, 0, 0 }, /* null */ { (ASN_TAG_CLASS_UNIVERSAL | (13 << 2)), 0, 0, 0 } /* roid */ }; static asn_CHOICE_specifics_t asn_SPC_Choice_specs_1 = { sizeof(struct Choice), offsetof(struct Choice, _asn_ctx), offsetof(struct Choice, present), sizeof(((struct Choice *)0)->present), asn_MAP_Choice_tag2el_1, 5, /* Count of tags in the map */ .canonical_order = asn_MAP_Choice_cmap_1, /* Canonically sorted */ .ext_start = 3 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_Choice = { "Choice", "Choice", CHOICE_free, CHOICE_print, CHOICE_constraint, CHOICE_decode_ber, CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, CHOICE_decode_uper, CHOICE_encode_uper, CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ 0, /* No tags (pointer) */ 0, /* No tags (count) */ &asn_PER_type_Choice_constr_1, asn_MBR_Choice_1, 4, /* Elements count */ &asn_SPC_Choice_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Choice2] >>> ***/ #include #include #include /*** <<< DEPS [Choice2] >>> ***/ typedef enum Choice2_PR { Choice2_PR_NOTHING, /* No components present */ Choice2_PR_bitstr, Choice2_PR_roid } Choice2_PR; /*** <<< TYPE-DECLS [Choice2] >>> ***/ typedef struct Choice2 { Choice2_PR present; union Choice2_u { BIT_STRING_t bitstr; RELATIVE_OID_t roid; } choice; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Choice2_t; /*** <<< FUNC-DECLS [Choice2] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Choice2; /*** <<< CTDEFS [Choice2] >>> ***/ static asn_per_constraints_t asn_PER_type_Choice2_constr_1 GCC_NOTUSED = { { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; /*** <<< STAT-DEFS [Choice2] >>> ***/ static asn_TYPE_member_t asn_MBR_Choice2_1[] = { { ATF_NOFLAGS, 0, offsetof(struct Choice2, choice.bitstr), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = +1, /* EXPLICIT tag at current level */ .type = &asn_DEF_BIT_STRING, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* No PER visible constraints */ .default_value = 0, .name = "bitstr" }, { ATF_NOFLAGS, 0, offsetof(struct Choice2, choice.roid), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = +1, /* EXPLICIT tag at current level */ .type = &asn_DEF_RELATIVE_OID, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* No PER visible constraints */ .default_value = 0, .name = "roid" }, }; static const asn_TYPE_tag2member_t asn_MAP_Choice2_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* bitstr */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* roid */ }; static asn_CHOICE_specifics_t asn_SPC_Choice2_specs_1 = { sizeof(struct Choice2), offsetof(struct Choice2, _asn_ctx), offsetof(struct Choice2, present), sizeof(((struct Choice2 *)0)->present), asn_MAP_Choice2_tag2el_1, 2, /* Count of tags in the map */ .canonical_order = 0, .ext_start = -1 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_Choice2 = { "Choice2", "Choice2", CHOICE_free, CHOICE_print, CHOICE_constraint, CHOICE_decode_ber, CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, CHOICE_decode_uper, CHOICE_encode_uper, CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ 0, /* No tags (pointer) */ 0, /* No tags (count) */ &asn_PER_type_Choice2_constr_1, asn_MBR_Choice2_1, 2, /* Elements count */ &asn_SPC_Choice2_specs_1 /* Additional specs */ }; asn1c-0.9.28+dfsg/tests/19-param-OK.asn1.-Pfwide-types0000644000000000000000000003747713065714043020501 0ustar rootroot /*** <<< INCLUDES [SIGNED] >>> ***/ #include #include #include #include "Name.h" #include /*** <<< TYPE-DECLS [SIGNED] >>> ***/ typedef struct SIGNED_15P0 { struct toBeSigned { INTEGER_t version; OBJECT_IDENTIFIER_t signature; Name_t issuer; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } toBeSigned; OBJECT_IDENTIFIER_t algorithm; BIT_STRING_t signature; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } SIGNED_15P0_t; /*** <<< FUNC-DECLS [SIGNED] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_SIGNED_15P0; /*** <<< CODE [SIGNED] >>> ***/ static int memb_signature_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; size_t size; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(st->size > 0) { /* Size in bits */ size = 8 * st->size - (st->bits_unused & 0x07); } else { size = 0; } if((size <= 256)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /*** <<< STAT-DEFS [SIGNED] >>> ***/ static asn_TYPE_member_t asn_MBR_toBeSigned_2[] = { { ATF_NOFLAGS, 0, offsetof(struct toBeSigned, version), .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), .tag_mode = 0, .type = &asn_DEF_INTEGER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "version" }, { ATF_NOFLAGS, 0, offsetof(struct toBeSigned, signature), .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), .tag_mode = 0, .type = &asn_DEF_OBJECT_IDENTIFIER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "signature" }, { ATF_NOFLAGS, 0, offsetof(struct toBeSigned, issuer), .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), .tag_mode = 0, .type = &asn_DEF_Name, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "issuer" }, }; static const ber_tlv_tag_t asn_DEF_toBeSigned_tags_2[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_toBeSigned_tag2el_2[] = { { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 }, /* version */ { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 1, 0, 0 }, /* signature */ { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 2, 0, 0 } /* issuer */ }; static asn_SEQUENCE_specifics_t asn_SPC_toBeSigned_specs_2 = { sizeof(struct toBeSigned), offsetof(struct toBeSigned, _asn_ctx), asn_MAP_toBeSigned_tag2el_2, 3, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_toBeSigned_2 = { "toBeSigned", "toBeSigned", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_toBeSigned_tags_2, sizeof(asn_DEF_toBeSigned_tags_2) /sizeof(asn_DEF_toBeSigned_tags_2[0]), /* 1 */ asn_DEF_toBeSigned_tags_2, /* Same as above */ sizeof(asn_DEF_toBeSigned_tags_2) /sizeof(asn_DEF_toBeSigned_tags_2[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_toBeSigned_2, 3, /* Elements count */ &asn_SPC_toBeSigned_specs_2 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_SIGNED_15P0_1[] = { { ATF_NOFLAGS, 0, offsetof(struct SIGNED_15P0, toBeSigned), .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), .tag_mode = 0, .type = &asn_DEF_toBeSigned_2, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "toBeSigned" }, { ATF_NOFLAGS, 0, offsetof(struct SIGNED_15P0, algorithm), .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), .tag_mode = 0, .type = &asn_DEF_OBJECT_IDENTIFIER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "algorithm" }, { ATF_NOFLAGS, 0, offsetof(struct SIGNED_15P0, signature), .tag = (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), .tag_mode = 0, .type = &asn_DEF_BIT_STRING, .memb_constraints = memb_signature_constraint_1, .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "signature" }, }; static const ber_tlv_tag_t asn_DEF_SIGNED_15P0_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_SIGNED_15P0_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 2, 0, 0 }, /* signature */ { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 1, 0, 0 }, /* algorithm */ { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 0 } /* toBeSigned */ }; static asn_SEQUENCE_specifics_t asn_SPC_SIGNED_15P0_specs_1 = { sizeof(struct SIGNED_15P0), offsetof(struct SIGNED_15P0, _asn_ctx), asn_MAP_SIGNED_15P0_tag2el_1, 3, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_SIGNED_15P0 = { "SIGNED", "SIGNED", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_SIGNED_15P0_tags_1, sizeof(asn_DEF_SIGNED_15P0_tags_1) /sizeof(asn_DEF_SIGNED_15P0_tags_1[0]), /* 1 */ asn_DEF_SIGNED_15P0_tags_1, /* Same as above */ sizeof(asn_DEF_SIGNED_15P0_tags_1) /sizeof(asn_DEF_SIGNED_15P0_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_SIGNED_15P0_1, 3, /* Elements count */ &asn_SPC_SIGNED_15P0_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Certificate] >>> ***/ #include "SIGNED.h" /*** <<< TYPE-DECLS [Certificate] >>> ***/ typedef SIGNED_15P0_t Certificate_t; /*** <<< FUNC-DECLS [Certificate] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Certificate; asn_struct_free_f Certificate_free; asn_struct_print_f Certificate_print; asn_constr_check_f Certificate_constraint; ber_type_decoder_f Certificate_decode_ber; der_type_encoder_f Certificate_encode_der; xer_type_decoder_f Certificate_decode_xer; xer_type_encoder_f Certificate_encode_xer; /*** <<< CODE [Certificate] >>> ***/ int Certificate_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_SIGNED_15P0.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using SIGNED_15P0, * so here we adjust the DEF accordingly. */ static void Certificate_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_SIGNED_15P0.free_struct; td->print_struct = asn_DEF_SIGNED_15P0.print_struct; td->check_constraints = asn_DEF_SIGNED_15P0.check_constraints; td->ber_decoder = asn_DEF_SIGNED_15P0.ber_decoder; td->der_encoder = asn_DEF_SIGNED_15P0.der_encoder; td->xer_decoder = asn_DEF_SIGNED_15P0.xer_decoder; td->xer_encoder = asn_DEF_SIGNED_15P0.xer_encoder; td->uper_decoder = asn_DEF_SIGNED_15P0.uper_decoder; td->uper_encoder = asn_DEF_SIGNED_15P0.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_SIGNED_15P0.per_constraints; td->elements = asn_DEF_SIGNED_15P0.elements; td->elements_count = asn_DEF_SIGNED_15P0.elements_count; td->specifics = asn_DEF_SIGNED_15P0.specifics; } void Certificate_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Certificate_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Certificate_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Certificate_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Certificate_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Certificate_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Certificate_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Certificate_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Certificate_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Certificate_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Certificate_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Certificate_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [Certificate] >>> ***/ static const ber_tlv_tag_t asn_DEF_Certificate_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Certificate = { "Certificate", "Certificate", Certificate_free, Certificate_print, Certificate_constraint, Certificate_decode_ber, Certificate_encode_der, Certificate_decode_xer, Certificate_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Certificate_tags_1, sizeof(asn_DEF_Certificate_tags_1) /sizeof(asn_DEF_Certificate_tags_1[0]), /* 1 */ asn_DEF_Certificate_tags_1, /* Same as above */ sizeof(asn_DEF_Certificate_tags_1) /sizeof(asn_DEF_Certificate_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* Defined elsewhere */ 0 /* No specifics */ }; /*** <<< INCLUDES [Name] >>> ***/ #include #include /*** <<< FWD-DECLS [Name] >>> ***/ struct RelativeDistinguishedName; /*** <<< TYPE-DECLS [Name] >>> ***/ typedef struct Name { A_SEQUENCE_OF(struct RelativeDistinguishedName) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Name_t; /*** <<< FUNC-DECLS [Name] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Name; /*** <<< POST-INCLUDE [Name] >>> ***/ #include "RelativeDistinguishedName.h" /*** <<< STAT-DEFS [Name] >>> ***/ static asn_TYPE_member_t asn_MBR_Name_1[] = { { ATF_POINTER, 0, 0, .tag = (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), .tag_mode = 0, .type = &asn_DEF_RelativeDistinguishedName, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "" }, }; static const ber_tlv_tag_t asn_DEF_Name_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_Name_specs_1 = { sizeof(struct Name), offsetof(struct Name, _asn_ctx), 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_Name = { "Name", "Name", SEQUENCE_OF_free, SEQUENCE_OF_print, SEQUENCE_OF_constraint, SEQUENCE_OF_decode_ber, SEQUENCE_OF_encode_der, SEQUENCE_OF_decode_xer, SEQUENCE_OF_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Name_tags_1, sizeof(asn_DEF_Name_tags_1) /sizeof(asn_DEF_Name_tags_1[0]), /* 1 */ asn_DEF_Name_tags_1, /* Same as above */ sizeof(asn_DEF_Name_tags_1) /sizeof(asn_DEF_Name_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Name_1, 1, /* Single element */ &asn_SPC_Name_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [RelativeDistinguishedName] >>> ***/ #include #include #include /*** <<< TYPE-DECLS [RelativeDistinguishedName] >>> ***/ typedef struct RelativeDistinguishedName { A_SET_OF(IA5String_t) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } RelativeDistinguishedName_t; /*** <<< FUNC-DECLS [RelativeDistinguishedName] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_RelativeDistinguishedName; /*** <<< CTABLES [RelativeDistinguishedName] >>> ***/ static const int permitted_alphabet_table_2[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 0, /* ,-. */ 4, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, /* 0 9 */ 0, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20, /* ABCDEFGHIJKLMNO */ 21,22,23,24,25,26,27,28,29,30,31, 0, 0, 0, 0, 0, /* PQRSTUVWXYZ */ 0,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46, /* abcdefghijklmno */ 47,48,49,50,51,52,53,54,55,56,57, 0, 0, 0, 0, 0, /* pqrstuvwxyz */ }; static int check_permitted_alphabet_2(const void *sptr) { const int *table = permitted_alphabet_table_2; /* The underlying type is IA5String */ const IA5String_t *st = (const IA5String_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(!table[cv]) return -1; } return 0; } /*** <<< CODE [RelativeDistinguishedName] >>> ***/ static int memb_IA5String_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const IA5String_t *st = (const IA5String_t *)sptr; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(!check_permitted_alphabet_2(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /*** <<< STAT-DEFS [RelativeDistinguishedName] >>> ***/ static asn_TYPE_member_t asn_MBR_RelativeDistinguishedName_1[] = { { ATF_POINTER, 0, 0, .tag = (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)), .tag_mode = 0, .type = &asn_DEF_IA5String, .memb_constraints = memb_IA5String_constraint_1, .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "" }, }; static const ber_tlv_tag_t asn_DEF_RelativeDistinguishedName_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_RelativeDistinguishedName_specs_1 = { sizeof(struct RelativeDistinguishedName), offsetof(struct RelativeDistinguishedName, _asn_ctx), 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_RelativeDistinguishedName = { "RelativeDistinguishedName", "RelativeDistinguishedName", SET_OF_free, SET_OF_print, SET_OF_constraint, SET_OF_decode_ber, SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_RelativeDistinguishedName_tags_1, sizeof(asn_DEF_RelativeDistinguishedName_tags_1) /sizeof(asn_DEF_RelativeDistinguishedName_tags_1[0]), /* 1 */ asn_DEF_RelativeDistinguishedName_tags_1, /* Same as above */ sizeof(asn_DEF_RelativeDistinguishedName_tags_1) /sizeof(asn_DEF_RelativeDistinguishedName_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_RelativeDistinguishedName_1, 1, /* Single element */ &asn_SPC_RelativeDistinguishedName_specs_1 /* Additional specs */ }; asn1c-0.9.28+dfsg/tests/11-int-SE.asn10000644000000000000000000000055313065714043015506 0ustar rootroot -- SE: Semantic error -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .11 ModuleTestInt5 { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 11 } DEFINITIONS ::= BEGIN -- recursive definition loop alpha INTEGER ::= beta beta INTEGER ::= alpha END asn1c-0.9.28+dfsg/tests/116-bit-string-SE.asn10000644000000000000000000000052313065714043017061 0ustar rootroot -- SE: Semantic error -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .116 ModuleBitStringSameValues { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 116 } DEFINITIONS ::= BEGIN T ::= BIT STRING { one(1), another(1) } END asn1c-0.9.28+dfsg/tests/60-any-OK.asn10000644000000000000000000000070313065714043015506 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .60 ModuleTestANY { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 60 } DEFINITIONS IMPLICIT TAGS ::= BEGIN T1 ::= SEQUENCE { i INTEGER, any ANY } T2 ::= SEQUENCE { i INTEGER, any [0] ANY OPTIONAL } T3 ::= SEQUENCE { any1 ANY, any2 ANY } END asn1c-0.9.28+dfsg/tests/80-chardefs-OK.asn10000644000000000000000000000132613065714043016502 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .80 ModuleCharacterDefinitions { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 80 } DEFINITIONS ::= BEGIN -- Elements taken from ASN1-CHARACTER-MODULE (X.680:07/2002) -- { joint-iso-itu-t asn1(1) specification(0) modules(0) iso10646(0) } nul IA5String ::= {0, 0} null BMPString ::= {0, 0, 0, 0} space BMPString ::= {0, 0, 0, 32} tilde BMPString ::= {0, 0, 0, 126} BasicLatin ::= BMPString(FROM (space..tilde)) BasicGreek ::= BMPString(FROM ({0, 0, 3, 112}..{0, 0, 3, 207})) NotSpace ::= BMPString (FROM(ALL EXCEPT space)) END asn1c-0.9.28+dfsg/tests/117-real-constraint-OK.asn1.-EF0000644000000000000000000000026413065714043020457 0ustar rootrootModuleRealConstraint { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 117 } DEFINITIONS ::= BEGIN R ::= REAL (0..3.141593) END asn1c-0.9.28+dfsg/tests/37-indirect-choice-OK.asn1.-Pfwide-types0000644000000000000000000006054413065714043022421 0ustar rootroot /*** <<< INCLUDES [T] >>> ***/ #include #include #include "Choice1.h" #include "Choice2.h" #include /*** <<< DEPS [T] >>> ***/ typedef enum T_PR { T_PR_NOTHING, /* No components present */ T_PR_t_a, T_PR_t_b, T_PR_t_c, T_PR_t_d } T_PR; /*** <<< TYPE-DECLS [T] >>> ***/ typedef struct T { T_PR present; union T_u { INTEGER_t t_a; OCTET_STRING_t t_b; Choice1_t t_c; Choice2_t t_d; } choice; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } T_t; /*** <<< FUNC-DECLS [T] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_T; /*** <<< STAT-DEFS [T] >>> ***/ static asn_TYPE_member_t asn_MBR_T_1[] = { { ATF_NOFLAGS, 0, offsetof(struct T, choice.t_a), .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), .tag_mode = 0, .type = &asn_DEF_INTEGER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "t-a" }, { ATF_NOFLAGS, 0, offsetof(struct T, choice.t_b), .tag = (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), .tag_mode = 0, .type = &asn_DEF_OCTET_STRING, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "t-b" }, { ATF_NOFLAGS, 0, offsetof(struct T, choice.t_c), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = +1, /* EXPLICIT tag at current level */ .type = &asn_DEF_Choice1, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "t-c" }, { ATF_NOFLAGS, 0, offsetof(struct T, choice.t_d), .tag = (ASN_TAG_CLASS_CONTEXT | (3 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Choice2, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "t-d" }, }; static const asn_TYPE_tag2member_t asn_MAP_T_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 }, /* t-a */ { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 1, 0, 0 }, /* t-b */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 2, 0, 0 }, /* t-c */ { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* t-d */ }; static asn_CHOICE_specifics_t asn_SPC_T_specs_1 = { sizeof(struct T), offsetof(struct T, _asn_ctx), offsetof(struct T, present), sizeof(((struct T *)0)->present), asn_MAP_T_tag2el_1, 4, /* Count of tags in the map */ .canonical_order = 0, .ext_start = -1 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_T = { "T", "T", CHOICE_free, CHOICE_print, CHOICE_constraint, CHOICE_decode_ber, CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ 0, /* No tags (pointer) */ 0, /* No tags (count) */ 0, /* No PER visible constraints */ asn_MBR_T_1, 4, /* Elements count */ &asn_SPC_T_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Choice1] >>> ***/ #include #include #include /*** <<< DEPS [Choice1] >>> ***/ typedef enum Choice1_PR { Choice1_PR_NOTHING, /* No components present */ Choice1_PR_c_a, Choice1_PR_c_b } Choice1_PR; /*** <<< TYPE-DECLS [Choice1] >>> ***/ typedef struct Choice1 { Choice1_PR present; union Choice1_u { OCTET_STRING_t c_a; INTEGER_t c_b; } choice; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Choice1_t; /*** <<< FUNC-DECLS [Choice1] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Choice1; /*** <<< STAT-DEFS [Choice1] >>> ***/ static asn_TYPE_member_t asn_MBR_Choice1_1[] = { { ATF_NOFLAGS, 0, offsetof(struct Choice1, choice.c_a), .tag = (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), .tag_mode = 0, .type = &asn_DEF_OCTET_STRING, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "c-a" }, { ATF_NOFLAGS, 0, offsetof(struct Choice1, choice.c_b), .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), .tag_mode = 0, .type = &asn_DEF_INTEGER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "c-b" }, }; static const asn_TYPE_tag2member_t asn_MAP_Choice1_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* c-b */ { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 0, 0, 0 } /* c-a */ }; static asn_CHOICE_specifics_t asn_SPC_Choice1_specs_1 = { sizeof(struct Choice1), offsetof(struct Choice1, _asn_ctx), offsetof(struct Choice1, present), sizeof(((struct Choice1 *)0)->present), asn_MAP_Choice1_tag2el_1, 2, /* Count of tags in the map */ .canonical_order = 0, .ext_start = -1 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_Choice1 = { "Choice1", "Choice1", CHOICE_free, CHOICE_print, CHOICE_constraint, CHOICE_decode_ber, CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ 0, /* No tags (pointer) */ 0, /* No tags (count) */ 0, /* No PER visible constraints */ asn_MBR_Choice1_1, 2, /* Elements count */ &asn_SPC_Choice1_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Choice2] >>> ***/ #include #include #include "Choice1.h" #include /*** <<< DEPS [Choice2] >>> ***/ typedef enum Choice2_PR { Choice2_PR_NOTHING, /* No components present */ Choice2_PR_c_a, Choice2_PR_c_b, Choice2_PR_c_d, Choice2_PR_c_e } Choice2_PR; /*** <<< TYPE-DECLS [Choice2] >>> ***/ typedef struct Choice2 { Choice2_PR present; union Choice2_u { OCTET_STRING_t c_a; INTEGER_t c_b; Choice1_t c_d; Choice1_t c_e; } choice; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Choice2_t; /*** <<< FUNC-DECLS [Choice2] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Choice2; /*** <<< STAT-DEFS [Choice2] >>> ***/ static asn_TYPE_member_t asn_MBR_Choice2_1[] = { { ATF_NOFLAGS, 0, offsetof(struct Choice2, choice.c_a), .tag = (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), .tag_mode = 0, .type = &asn_DEF_OCTET_STRING, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "c-a" }, { ATF_NOFLAGS, 0, offsetof(struct Choice2, choice.c_b), .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), .tag_mode = 0, .type = &asn_DEF_INTEGER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "c-b" }, { ATF_NOFLAGS, 0, offsetof(struct Choice2, choice.c_d), .tag = (ASN_TAG_CLASS_CONTEXT | (3 << 2)), .tag_mode = +1, /* EXPLICIT tag at current level */ .type = &asn_DEF_Choice1, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "c-d" }, { ATF_NOFLAGS, 0, offsetof(struct Choice2, choice.c_e), .tag = (ASN_TAG_CLASS_CONTEXT | (4 << 2)), .tag_mode = +1, /* EXPLICIT tag at current level */ .type = &asn_DEF_Choice1, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "c-e" }, }; static const ber_tlv_tag_t asn_DEF_Choice2_tags_1[] = { (ASN_TAG_CLASS_CONTEXT | (2 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_Choice2_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* c-b */ { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 0, 0, 0 }, /* c-a */ { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 2, 0, 0 }, /* c-d */ { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 3, 0, 0 } /* c-e */ }; static asn_CHOICE_specifics_t asn_SPC_Choice2_specs_1 = { sizeof(struct Choice2), offsetof(struct Choice2, _asn_ctx), offsetof(struct Choice2, present), sizeof(((struct Choice2 *)0)->present), asn_MAP_Choice2_tag2el_1, 4, /* Count of tags in the map */ .canonical_order = 0, .ext_start = -1 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_Choice2 = { "Choice2", "Choice2", CHOICE_free, CHOICE_print, CHOICE_constraint, CHOICE_decode_ber, CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, asn_DEF_Choice2_tags_1, sizeof(asn_DEF_Choice2_tags_1) /sizeof(asn_DEF_Choice2_tags_1[0]), /* 1 */ asn_DEF_Choice2_tags_1, /* Same as above */ sizeof(asn_DEF_Choice2_tags_1) /sizeof(asn_DEF_Choice2_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Choice2_1, 4, /* Elements count */ &asn_SPC_Choice2_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Choice3] >>> ***/ #include "Choice2.h" /*** <<< TYPE-DECLS [Choice3] >>> ***/ typedef Choice2_t Choice3_t; /*** <<< FUNC-DECLS [Choice3] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Choice3; asn_struct_free_f Choice3_free; asn_struct_print_f Choice3_print; asn_constr_check_f Choice3_constraint; ber_type_decoder_f Choice3_decode_ber; der_type_encoder_f Choice3_encode_der; xer_type_decoder_f Choice3_decode_xer; xer_type_encoder_f Choice3_encode_xer; /*** <<< CODE [Choice3] >>> ***/ int Choice3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_Choice2.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using Choice2, * so here we adjust the DEF accordingly. */ static void Choice3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_Choice2.free_struct; td->print_struct = asn_DEF_Choice2.print_struct; td->check_constraints = asn_DEF_Choice2.check_constraints; td->ber_decoder = asn_DEF_Choice2.ber_decoder; td->der_encoder = asn_DEF_Choice2.der_encoder; td->xer_decoder = asn_DEF_Choice2.xer_decoder; td->xer_encoder = asn_DEF_Choice2.xer_encoder; td->uper_decoder = asn_DEF_Choice2.uper_decoder; td->uper_encoder = asn_DEF_Choice2.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Choice2.per_constraints; td->elements = asn_DEF_Choice2.elements; td->elements_count = asn_DEF_Choice2.elements_count; td->specifics = asn_DEF_Choice2.specifics; } void Choice3_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Choice3_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Choice3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Choice3_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Choice3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Choice3_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Choice3_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Choice3_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Choice3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Choice3_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Choice3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Choice3_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [Choice3] >>> ***/ static const ber_tlv_tag_t asn_DEF_Choice3_tags_1[] = { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), (ASN_TAG_CLASS_CONTEXT | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Choice3 = { "Choice3", "Choice3", Choice3_free, Choice3_print, Choice3_constraint, Choice3_decode_ber, Choice3_encode_der, Choice3_decode_xer, Choice3_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, asn_DEF_Choice3_tags_1, sizeof(asn_DEF_Choice3_tags_1) /sizeof(asn_DEF_Choice3_tags_1[0]), /* 2 */ asn_DEF_Choice3_tags_1, /* Same as above */ sizeof(asn_DEF_Choice3_tags_1) /sizeof(asn_DEF_Choice3_tags_1[0]), /* 2 */ 0, /* No PER visible constraints */ 0, 0, /* Defined elsewhere */ 0 /* No specifics */ }; /*** <<< INCLUDES [Choice4] >>> ***/ #include "Choice2.h" /*** <<< TYPE-DECLS [Choice4] >>> ***/ typedef Choice2_t Choice4_t; /*** <<< FUNC-DECLS [Choice4] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Choice4; asn_struct_free_f Choice4_free; asn_struct_print_f Choice4_print; asn_constr_check_f Choice4_constraint; ber_type_decoder_f Choice4_decode_ber; der_type_encoder_f Choice4_encode_der; xer_type_decoder_f Choice4_decode_xer; xer_type_encoder_f Choice4_encode_xer; /*** <<< CODE [Choice4] >>> ***/ int Choice4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_Choice2.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using Choice2, * so here we adjust the DEF accordingly. */ static void Choice4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_Choice2.free_struct; td->print_struct = asn_DEF_Choice2.print_struct; td->check_constraints = asn_DEF_Choice2.check_constraints; td->ber_decoder = asn_DEF_Choice2.ber_decoder; td->der_encoder = asn_DEF_Choice2.der_encoder; td->xer_decoder = asn_DEF_Choice2.xer_decoder; td->xer_encoder = asn_DEF_Choice2.xer_encoder; td->uper_decoder = asn_DEF_Choice2.uper_decoder; td->uper_encoder = asn_DEF_Choice2.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Choice2.per_constraints; td->elements = asn_DEF_Choice2.elements; td->elements_count = asn_DEF_Choice2.elements_count; td->specifics = asn_DEF_Choice2.specifics; } void Choice4_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Choice4_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Choice4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Choice4_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Choice4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Choice4_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Choice4_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Choice4_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Choice4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Choice4_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Choice4_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Choice4_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [Choice4] >>> ***/ static const ber_tlv_tag_t asn_DEF_Choice4_tags_1[] = { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), (ASN_TAG_CLASS_CONTEXT | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Choice4 = { "Choice4", "Choice4", Choice4_free, Choice4_print, Choice4_constraint, Choice4_decode_ber, Choice4_encode_der, Choice4_decode_xer, Choice4_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, asn_DEF_Choice4_tags_1, sizeof(asn_DEF_Choice4_tags_1) /sizeof(asn_DEF_Choice4_tags_1[0]) - 1, /* 1 */ asn_DEF_Choice4_tags_1, /* Same as above */ sizeof(asn_DEF_Choice4_tags_1) /sizeof(asn_DEF_Choice4_tags_1[0]), /* 2 */ 0, /* No PER visible constraints */ 0, 0, /* Defined elsewhere */ 0 /* No specifics */ }; /*** <<< INCLUDES [Choice5] >>> ***/ #include "Choice2.h" /*** <<< TYPE-DECLS [Choice5] >>> ***/ typedef Choice2_t Choice5_t; /*** <<< FUNC-DECLS [Choice5] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Choice5; asn_struct_free_f Choice5_free; asn_struct_print_f Choice5_print; asn_constr_check_f Choice5_constraint; ber_type_decoder_f Choice5_decode_ber; der_type_encoder_f Choice5_encode_der; xer_type_decoder_f Choice5_decode_xer; xer_type_encoder_f Choice5_encode_xer; /*** <<< CODE [Choice5] >>> ***/ int Choice5_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_Choice2.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using Choice2, * so here we adjust the DEF accordingly. */ static void Choice5_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_Choice2.free_struct; td->print_struct = asn_DEF_Choice2.print_struct; td->check_constraints = asn_DEF_Choice2.check_constraints; td->ber_decoder = asn_DEF_Choice2.ber_decoder; td->der_encoder = asn_DEF_Choice2.der_encoder; td->xer_decoder = asn_DEF_Choice2.xer_decoder; td->xer_encoder = asn_DEF_Choice2.xer_encoder; td->uper_decoder = asn_DEF_Choice2.uper_decoder; td->uper_encoder = asn_DEF_Choice2.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Choice2.per_constraints; td->elements = asn_DEF_Choice2.elements; td->elements_count = asn_DEF_Choice2.elements_count; td->specifics = asn_DEF_Choice2.specifics; } void Choice5_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Choice5_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Choice5_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Choice5_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Choice5_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Choice5_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Choice5_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Choice5_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Choice5_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Choice5_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Choice5_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Choice5_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [Choice5] >>> ***/ static const ber_tlv_tag_t asn_DEF_Choice5_tags_1[] = { (ASN_TAG_CLASS_CONTEXT | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Choice5 = { "Choice5", "Choice5", Choice5_free, Choice5_print, Choice5_constraint, Choice5_decode_ber, Choice5_encode_der, Choice5_decode_xer, Choice5_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, asn_DEF_Choice5_tags_1, sizeof(asn_DEF_Choice5_tags_1) /sizeof(asn_DEF_Choice5_tags_1[0]), /* 1 */ asn_DEF_Choice5_tags_1, /* Same as above */ sizeof(asn_DEF_Choice5_tags_1) /sizeof(asn_DEF_Choice5_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* Defined elsewhere */ 0 /* No specifics */ }; /*** <<< INCLUDES [Choice6] >>> ***/ #include "Choice1.h" /*** <<< TYPE-DECLS [Choice6] >>> ***/ typedef Choice1_t Choice6_t; /*** <<< FUNC-DECLS [Choice6] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Choice6; asn_struct_free_f Choice6_free; asn_struct_print_f Choice6_print; asn_constr_check_f Choice6_constraint; ber_type_decoder_f Choice6_decode_ber; der_type_encoder_f Choice6_encode_der; xer_type_decoder_f Choice6_decode_xer; xer_type_encoder_f Choice6_encode_xer; /*** <<< CODE [Choice6] >>> ***/ int Choice6_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_Choice1.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using Choice1, * so here we adjust the DEF accordingly. */ static void Choice6_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_Choice1.free_struct; td->print_struct = asn_DEF_Choice1.print_struct; td->check_constraints = asn_DEF_Choice1.check_constraints; td->ber_decoder = asn_DEF_Choice1.ber_decoder; td->der_encoder = asn_DEF_Choice1.der_encoder; td->xer_decoder = asn_DEF_Choice1.xer_decoder; td->xer_encoder = asn_DEF_Choice1.xer_encoder; td->uper_decoder = asn_DEF_Choice1.uper_decoder; td->uper_encoder = asn_DEF_Choice1.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Choice1.per_constraints; td->elements = asn_DEF_Choice1.elements; td->elements_count = asn_DEF_Choice1.elements_count; td->specifics = asn_DEF_Choice1.specifics; } void Choice6_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Choice6_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Choice6_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Choice6_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Choice6_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Choice6_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Choice6_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Choice6_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Choice6_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Choice6_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Choice6_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Choice6_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [Choice6] >>> ***/ asn_TYPE_descriptor_t asn_DEF_Choice6 = { "Choice6", "Choice6", Choice6_free, Choice6_print, Choice6_constraint, Choice6_decode_ber, Choice6_encode_der, Choice6_decode_xer, Choice6_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ 0, /* No tags (pointer) */ 0, /* No tags (count) */ 0, /* No PER visible constraints */ 0, 0, /* Defined elsewhere */ 0 /* No specifics */ }; asn1c-0.9.28+dfsg/tests/32-sequence-of-OK.asn1.-EF0000644000000000000000000000102713065714043017476 0ustar rootrootModuleTestSequenceSimple { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 32 } DEFINITIONS IMPLICIT TAGS ::= BEGIN Programming ::= SEQUENCE SIZE(1..10) OF [0] IMPLICIT Fault Fault ::= SET OF Error Error ::= SEQUENCE { ... } maxSize INTEGER ::= 10 SeqWithMandatory ::= SEQUENCE { someString UTF8String, seqOfMan [0] EXPLICIT SEQUENCE OF Error } SeqWithOptional ::= SEQUENCE { someString UTF8String, seqOfOpt [0] EXPLICIT SEQUENCE OF Error OPTIONAL } END asn1c-0.9.28+dfsg/tests/78-str-default-SE.asn10000644000000000000000000000064113065714043017161 0ustar rootroot -- SE: Semantic error -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .78 ModuleTestStringDefault2 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 78 } DEFINITIONS AUTOMATIC TAGS ::= BEGIN Type ::= SEQUENCE { country UTF8String DEFAULT country1, ... } country1 GeneralString ::= "Cyprus" END asn1c-0.9.28+dfsg/tests/122-pattern-OK.asn10000644000000000000000000000126013065714043016452 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .122 ModulePatternConstraint { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 122 } DEFINITIONS AUTOMATIC TAGS ::= BEGIN Language ::= VisibleString (FROM ("a".."z" | "A".."Z" | "-" | "0".."9")) (PATTERN "[a-zA-Z]#(1,8)(-[a-zA-Z0-9]#(1,8))*") PatternByRef1 ::= VisibleString (PATTERN refPattern1) PatternByRef2 ::= VisibleString (PATTERN refPattern2) refPattern1 UniversalString ::= "[a-zA-Z]#(1,8)(-[a-zA-Z0-9]#(1,8))*" refPattern2 UTF8String ::= "[a-zA-Z]#(1,8)(-[a-zA-Z0-9]#(1,8))*" END asn1c-0.9.28+dfsg/tests/93-asn1c-controls-OK.asn1.-Pfwide-types0000644000000000000000000002340113065714043022227 0ustar rootroot /*** <<< INCLUDES [Sequence] >>> ***/ #include #include /*** <<< TYPE-DECLS [Sequence] >>> ***/ typedef struct Sequence { INTEGER_t ainl; INTEGER_t *aptr; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Sequence_t; /*** <<< FUNC-DECLS [Sequence] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Sequence; /*** <<< STAT-DEFS [Sequence] >>> ***/ static asn_TYPE_member_t asn_MBR_Sequence_1[] = { { ATF_NOFLAGS, 0, offsetof(struct Sequence, ainl), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_INTEGER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "ainl" }, { ATF_POINTER, 0, offsetof(struct Sequence, aptr), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_INTEGER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "aptr" }, }; static const ber_tlv_tag_t asn_DEF_Sequence_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_Sequence_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ainl */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* aptr */ }; static asn_SEQUENCE_specifics_t asn_SPC_Sequence_specs_1 = { sizeof(struct Sequence), offsetof(struct Sequence, _asn_ctx), asn_MAP_Sequence_tag2el_1, 2, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Sequence = { "Sequence", "Sequence", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Sequence_tags_1, sizeof(asn_DEF_Sequence_tags_1) /sizeof(asn_DEF_Sequence_tags_1[0]), /* 1 */ asn_DEF_Sequence_tags_1, /* Same as above */ sizeof(asn_DEF_Sequence_tags_1) /sizeof(asn_DEF_Sequence_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Sequence_1, 2, /* Elements count */ &asn_SPC_Sequence_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Set] >>> ***/ #include "Sequence.h" #include /*** <<< DEPS [Set] >>> ***/ /* * Method of determining the components presence */ typedef enum Set_PR { Set_PR_ainl, /* Member ainl is present */ Set_PR_aptr, /* Member aptr is present */ } Set_PR; /*** <<< FWD-DECLS [Set] >>> ***/ struct Sequence; /*** <<< TYPE-DECLS [Set] >>> ***/ typedef struct Set { Sequence_t ainl; struct Sequence *aptr; /* Presence bitmask: ASN_SET_ISPRESENT(pSet, Set_PR_x) */ unsigned int _presence_map [((2+(8*sizeof(unsigned int))-1)/(8*sizeof(unsigned int)))]; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Set_t; /*** <<< FUNC-DECLS [Set] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Set; /*** <<< POST-INCLUDE [Set] >>> ***/ #include "Sequence.h" /*** <<< STAT-DEFS [Set] >>> ***/ static asn_TYPE_member_t asn_MBR_Set_1[] = { { ATF_NOFLAGS, 0, offsetof(struct Set, ainl), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Sequence, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "ainl" }, { ATF_POINTER, 0, offsetof(struct Set, aptr), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Sequence, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "aptr" }, }; static const ber_tlv_tag_t asn_DEF_Set_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_Set_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ainl */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* aptr */ }; static const uint8_t asn_MAP_Set_mmap_1[(2 + (8 * sizeof(unsigned int)) - 1) / 8] = { (1 << 7) | (1 << 6) }; static asn_SET_specifics_t asn_SPC_Set_specs_1 = { sizeof(struct Set), offsetof(struct Set, _asn_ctx), offsetof(struct Set, _presence_map), asn_MAP_Set_tag2el_1, 2, /* Count of tags in the map */ asn_MAP_Set_tag2el_1, /* Same as above */ 2, /* Count of tags in the CXER map */ 0, /* Whether extensible */ (unsigned int *)asn_MAP_Set_mmap_1 /* Mandatory elements map */ }; asn_TYPE_descriptor_t asn_DEF_Set = { "Set", "Set", SET_free, SET_print, SET_constraint, SET_decode_ber, SET_encode_der, SET_decode_xer, SET_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Set_tags_1, sizeof(asn_DEF_Set_tags_1) /sizeof(asn_DEF_Set_tags_1[0]), /* 1 */ asn_DEF_Set_tags_1, /* Same as above */ sizeof(asn_DEF_Set_tags_1) /sizeof(asn_DEF_Set_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Set_1, 2, /* Elements count */ &asn_SPC_Set_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Choice] >>> ***/ #include "Sequence.h" #include #include #include #include /*** <<< DEPS [Choice] >>> ***/ typedef enum Choice_PR { Choice_PR_NOTHING, /* No components present */ Choice_PR_setof, Choice_PR_aptr, Choice_PR_ainl } Choice_PR; /*** <<< FWD-DECLS [Choice] >>> ***/ struct Sequence; /*** <<< TYPE-DECLS [Choice] >>> ***/ typedef struct Choice { Choice_PR present; union Choice_u { struct setof { A_SET_OF(INTEGER_t) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } *setof; struct Sequence *aptr; Sequence_t ainl; } choice; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Choice_t; /*** <<< FUNC-DECLS [Choice] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Choice; /*** <<< POST-INCLUDE [Choice] >>> ***/ #include "Sequence.h" /*** <<< STAT-DEFS [Choice] >>> ***/ static asn_TYPE_member_t asn_MBR_setof_2[] = { { ATF_POINTER, 0, 0, .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), .tag_mode = 0, .type = &asn_DEF_INTEGER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "" }, }; static const ber_tlv_tag_t asn_DEF_setof_tags_2[] = { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_setof_specs_2 = { sizeof(struct setof), offsetof(struct setof, _asn_ctx), 0, /* XER encoding is XMLDelimitedItemList */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_setof_2 = { "setof", "setof", SET_OF_free, SET_OF_print, SET_OF_constraint, SET_OF_decode_ber, SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_setof_tags_2, sizeof(asn_DEF_setof_tags_2) /sizeof(asn_DEF_setof_tags_2[0]) - 1, /* 1 */ asn_DEF_setof_tags_2, /* Same as above */ sizeof(asn_DEF_setof_tags_2) /sizeof(asn_DEF_setof_tags_2[0]), /* 2 */ 0, /* No PER visible constraints */ asn_MBR_setof_2, 1, /* Single element */ &asn_SPC_setof_specs_2 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_Choice_1[] = { { ATF_POINTER, 0, offsetof(struct Choice, choice.setof), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = 0, .type = &asn_DEF_setof_2, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "setof" }, { ATF_POINTER, 0, offsetof(struct Choice, choice.aptr), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Sequence, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "aptr" }, { ATF_NOFLAGS, 0, offsetof(struct Choice, choice.ainl), .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Sequence, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "ainl" }, }; static const asn_TYPE_tag2member_t asn_MAP_Choice_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* setof */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* aptr */ { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* ainl */ }; static asn_CHOICE_specifics_t asn_SPC_Choice_specs_1 = { sizeof(struct Choice), offsetof(struct Choice, _asn_ctx), offsetof(struct Choice, present), sizeof(((struct Choice *)0)->present), asn_MAP_Choice_tag2el_1, 3, /* Count of tags in the map */ .canonical_order = 0, .ext_start = -1 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_Choice = { "Choice", "Choice", CHOICE_free, CHOICE_print, CHOICE_constraint, CHOICE_decode_ber, CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ 0, /* No tags (pointer) */ 0, /* No tags (count) */ 0, /* No PER visible constraints */ asn_MBR_Choice_1, 3, /* Elements count */ &asn_SPC_Choice_specs_1 /* Additional specs */ }; asn1c-0.9.28+dfsg/tests/24-sequence-OK.asn1.-EF0000644000000000000000000000052413065714043017076 0ustar rootrootModuleTestSequence { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 24 } DEFINITIONS IMPLICIT TAGS ::= BEGIN T ::= [5] EXPLICIT SEQUENCE { a INTEGER, b [0] IMPLICIT INTEGER OPTIONAL, c [1] IMPLICIT INTEGER DEFAULT 10, d [5] EXPLICIT INTEGER } ten INTEGER ::= 10 END asn1c-0.9.28+dfsg/tests/25-misc-OK.asn10000644000000000000000000000075413065714043015661 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .25 ModuleTestMisc { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 25 } DEFINITIONS IMPLICIT TAGS ::= BEGIN T ::= SEQUENCE { a INTEGER, b [2] BOOLEAN, c NULL, ..., d ENUMERATED { a(1), b(2) }, e OCTET STRING, f [5] VisibleString, g BIT STRING, h [7] BIT STRING, ... } END asn1c-0.9.28+dfsg/tests/118-per-constraint-OK.asn1.-EFprint-constraints0000644000000000000000000000353213065714043023746 0ustar rootrootModuleConstraintPrecedence { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 118 } DEFINITIONS ::= BEGIN E1 ::= IA5String (SIZE(1..5,...) ^ FROM("A".."Z")) -- Combined constraints: (SIZE(1..5,...) ^ FROM("A".."Z")) -- Practical constraints (E1): (MIN..MAX) (SIZE(1..5,...)) (FROM("A".."Z")) -- PER-visible constraints (E1): (MIN..MAX) (SIZE(1..5,...)) (FROM("A".."Z")) E2 ::= IA5String (SIZE(1..5,...,5))(FROM("A".."Z")) -- Combined constraints: (SIZE(1..5))(FROM("A".."Z")) -- Practical constraints (E2): (MIN..MAX) (SIZE(1..5)) (FROM("A".."Z")) -- PER-visible constraints (E2): (MIN..MAX) (SIZE(1..5)) (FROM("A".."Z")) E3 ::= IA5String (SIZE(1..5) ^ FROM("A".."Z"),...) -- Combined constraints: (SIZE(1..5) ^ FROM("A".."Z"),...) -- Practical constraints (E3): (MIN..MAX,...) (SIZE(1..5,...)) (FROM("A".."Z",...)) -- PER-visible constraints (E3): (MIN..MAX,...) (SIZE(1..5,...)) (FROM("".."")) E4 ::= IA5String (FROM("A".."Z"),...)(SIZE(1..5)) -- Combined constraints: (FROM("A".."Z"))(SIZE(1..5)) -- Practical constraints (E4): (MIN..MAX) (SIZE(1..5)) (FROM("A".."Z")) -- PER-visible constraints (E4): (MIN..MAX) (SIZE(1..5)) (FROM("A".."Z")) C ::= IA5String (SIZE(10) ^ FROM("A".."D") | SIZE(20) ^ FROM("D".."F")) -- Combined constraints: (SIZE(10) ^ FROM("A".."D") | SIZE(20) ^ FROM("D".."F")) -- Practical constraints (C): (MIN..MAX) (SIZE(10 | 20)) (FROM("A".."F")) -- PER-visible constraints (C): (MIN..MAX) (SIZE(10 | 20)) (FROM("A".."F")) P ::= IA5String (FROM("AB") ^ SIZE(1..2) | FROM("DE") ^ SIZE(3) | FROM("AXE") ^ SIZE(1..5)) -- Combined constraints: (FROM("AB") ^ SIZE(1..2) | FROM("DE") ^ SIZE(3) | FROM("AXE") ^ SIZE(1..5)) -- Practical constraints (P): (MIN..MAX) (SIZE(1..5)) (FROM("A".."B" | "D".."E" | "X")) -- PER-visible constraints (P): (MIN..MAX) (SIZE(1..5)) (FROM("A".."B" | "D".."E" | "X")) END asn1c-0.9.28+dfsg/tests/129-enum-OK.asn1.-EF0000644000000000000000000000031213065714043016313 0ustar rootrootModuleTestEnum1 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 129 } DEFINITIONS ::= BEGIN A ::= ENUMERATED { a(-5), b(-4), c(0) } END asn1c-0.9.28+dfsg/tests/50-constraint-OK.asn1.-Pgen-PER0000644000000000000000000047351713065714043020514 0ustar rootroot /*** <<< INCLUDES [Int1] >>> ***/ #include /*** <<< TYPE-DECLS [Int1] >>> ***/ typedef long Int1_t; /*** <<< FUNC-DECLS [Int1] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Int1; asn_struct_free_f Int1_free; asn_struct_print_f Int1_print; asn_constr_check_f Int1_constraint; ber_type_decoder_f Int1_decode_ber; der_type_encoder_f Int1_encode_der; xer_type_decoder_f Int1_decode_xer; xer_type_encoder_f Int1_encode_xer; per_type_decoder_f Int1_decode_uper; per_type_encoder_f Int1_encode_uper; /*** <<< CODE [Int1] >>> ***/ int Int1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_NativeInteger.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void Int1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; td->specifics = asn_DEF_NativeInteger.specifics; } void Int1_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Int1_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Int1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Int1_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Int1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Int1_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Int1_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Int1_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Int1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Int1_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Int1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Int1_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t Int1_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { Int1_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t Int1_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { Int1_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } /*** <<< STAT-DEFS [Int1] >>> ***/ static const ber_tlv_tag_t asn_DEF_Int1_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Int1 = { "Int1", "Int1", Int1_free, Int1_print, Int1_constraint, Int1_decode_ber, Int1_encode_der, Int1_decode_xer, Int1_encode_xer, Int1_decode_uper, Int1_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Int1_tags_1, sizeof(asn_DEF_Int1_tags_1) /sizeof(asn_DEF_Int1_tags_1[0]), /* 1 */ asn_DEF_Int1_tags_1, /* Same as above */ sizeof(asn_DEF_Int1_tags_1) /sizeof(asn_DEF_Int1_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [Int2] >>> ***/ #include "Int1.h" /*** <<< TYPE-DECLS [Int2] >>> ***/ typedef Int1_t Int2_t; /*** <<< FUNC-DECLS [Int2] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Int2; asn_struct_free_f Int2_free; asn_struct_print_f Int2_print; asn_constr_check_f Int2_constraint; ber_type_decoder_f Int2_decode_ber; der_type_encoder_f Int2_encode_der; xer_type_decoder_f Int2_decode_xer; xer_type_encoder_f Int2_encode_xer; per_type_decoder_f Int2_decode_uper; per_type_encoder_f Int2_encode_uper; /*** <<< CODE [Int2] >>> ***/ int Int2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if((value >= 0)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using Int1, * so here we adjust the DEF accordingly. */ static void Int2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_Int1.free_struct; td->print_struct = asn_DEF_Int1.print_struct; td->check_constraints = asn_DEF_Int1.check_constraints; td->ber_decoder = asn_DEF_Int1.ber_decoder; td->der_encoder = asn_DEF_Int1.der_encoder; td->xer_decoder = asn_DEF_Int1.xer_decoder; td->xer_encoder = asn_DEF_Int1.xer_encoder; td->uper_decoder = asn_DEF_Int1.uper_decoder; td->uper_encoder = asn_DEF_Int1.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Int1.per_constraints; td->elements = asn_DEF_Int1.elements; td->elements_count = asn_DEF_Int1.elements_count; td->specifics = asn_DEF_Int1.specifics; } void Int2_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Int2_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Int2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Int2_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Int2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Int2_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Int2_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Int2_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Int2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Int2_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Int2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Int2_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t Int2_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { Int2_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t Int2_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { Int2_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } /*** <<< CTDEFS [Int2] >>> ***/ static asn_per_constraints_t asn_PER_type_Int2_constr_1 GCC_NOTUSED = { { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (0..MAX) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; /*** <<< STAT-DEFS [Int2] >>> ***/ static const ber_tlv_tag_t asn_DEF_Int2_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Int2 = { "Int2", "Int2", Int2_free, Int2_print, Int2_constraint, Int2_decode_ber, Int2_encode_der, Int2_decode_xer, Int2_encode_xer, Int2_decode_uper, Int2_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Int2_tags_1, sizeof(asn_DEF_Int2_tags_1) /sizeof(asn_DEF_Int2_tags_1[0]), /* 1 */ asn_DEF_Int2_tags_1, /* Same as above */ sizeof(asn_DEF_Int2_tags_1) /sizeof(asn_DEF_Int2_tags_1[0]), /* 1 */ &asn_PER_type_Int2_constr_1, 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [Int3] >>> ***/ #include "Int2.h" /*** <<< TYPE-DECLS [Int3] >>> ***/ typedef Int2_t Int3_t; /*** <<< FUNC-DECLS [Int3] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Int3; asn_struct_free_f Int3_free; asn_struct_print_f Int3_print; asn_constr_check_f Int3_constraint; ber_type_decoder_f Int3_decode_ber; der_type_encoder_f Int3_encode_der; xer_type_decoder_f Int3_decode_xer; xer_type_encoder_f Int3_encode_xer; per_type_decoder_f Int3_decode_uper; per_type_encoder_f Int3_encode_uper; /*** <<< CODE [Int3] >>> ***/ int Int3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if((value >= 0 && value <= 10)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using Int2, * so here we adjust the DEF accordingly. */ static void Int3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_Int2.free_struct; td->print_struct = asn_DEF_Int2.print_struct; td->check_constraints = asn_DEF_Int2.check_constraints; td->ber_decoder = asn_DEF_Int2.ber_decoder; td->der_encoder = asn_DEF_Int2.der_encoder; td->xer_decoder = asn_DEF_Int2.xer_decoder; td->xer_encoder = asn_DEF_Int2.xer_encoder; td->uper_decoder = asn_DEF_Int2.uper_decoder; td->uper_encoder = asn_DEF_Int2.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Int2.per_constraints; td->elements = asn_DEF_Int2.elements; td->elements_count = asn_DEF_Int2.elements_count; td->specifics = asn_DEF_Int2.specifics; } void Int3_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Int3_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Int3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Int3_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Int3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Int3_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Int3_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Int3_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Int3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Int3_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Int3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Int3_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t Int3_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { Int3_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t Int3_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { Int3_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } /*** <<< CTDEFS [Int3] >>> ***/ static asn_per_constraints_t asn_PER_type_Int3_constr_1 GCC_NOTUSED = { { APC_CONSTRAINED, 4, 4, 0, 10 } /* (0..10) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; /*** <<< STAT-DEFS [Int3] >>> ***/ static const ber_tlv_tag_t asn_DEF_Int3_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Int3 = { "Int3", "Int3", Int3_free, Int3_print, Int3_constraint, Int3_decode_ber, Int3_encode_der, Int3_decode_xer, Int3_encode_xer, Int3_decode_uper, Int3_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Int3_tags_1, sizeof(asn_DEF_Int3_tags_1) /sizeof(asn_DEF_Int3_tags_1[0]), /* 1 */ asn_DEF_Int3_tags_1, /* Same as above */ sizeof(asn_DEF_Int3_tags_1) /sizeof(asn_DEF_Int3_tags_1[0]), /* 1 */ &asn_PER_type_Int3_constr_1, 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [Int4] >>> ***/ #include "Int3.h" /*** <<< TYPE-DECLS [Int4] >>> ***/ typedef Int3_t Int4_t; /*** <<< FUNC-DECLS [Int4] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Int4; asn_struct_free_f Int4_free; asn_struct_print_f Int4_print; asn_constr_check_f Int4_constraint; ber_type_decoder_f Int4_decode_ber; der_type_encoder_f Int4_encode_der; xer_type_decoder_f Int4_decode_xer; xer_type_encoder_f Int4_encode_xer; per_type_decoder_f Int4_decode_uper; per_type_encoder_f Int4_encode_uper; /*** <<< CODE [Int4] >>> ***/ int Int4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if((value >= 1 && value <= 10)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using Int3, * so here we adjust the DEF accordingly. */ static void Int4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_Int3.free_struct; td->print_struct = asn_DEF_Int3.print_struct; td->check_constraints = asn_DEF_Int3.check_constraints; td->ber_decoder = asn_DEF_Int3.ber_decoder; td->der_encoder = asn_DEF_Int3.der_encoder; td->xer_decoder = asn_DEF_Int3.xer_decoder; td->xer_encoder = asn_DEF_Int3.xer_encoder; td->uper_decoder = asn_DEF_Int3.uper_decoder; td->uper_encoder = asn_DEF_Int3.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Int3.per_constraints; td->elements = asn_DEF_Int3.elements; td->elements_count = asn_DEF_Int3.elements_count; td->specifics = asn_DEF_Int3.specifics; } void Int4_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Int4_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Int4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Int4_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Int4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Int4_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Int4_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Int4_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Int4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Int4_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Int4_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Int4_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t Int4_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { Int4_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t Int4_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { Int4_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } /*** <<< CTDEFS [Int4] >>> ***/ static asn_per_constraints_t asn_PER_type_Int4_constr_1 GCC_NOTUSED = { { APC_CONSTRAINED | APC_EXTENSIBLE, 4, 4, 1, 10 } /* (1..10,...) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; /*** <<< STAT-DEFS [Int4] >>> ***/ static const ber_tlv_tag_t asn_DEF_Int4_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Int4 = { "Int4", "Int4", Int4_free, Int4_print, Int4_constraint, Int4_decode_ber, Int4_encode_der, Int4_decode_xer, Int4_encode_xer, Int4_decode_uper, Int4_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Int4_tags_1, sizeof(asn_DEF_Int4_tags_1) /sizeof(asn_DEF_Int4_tags_1[0]), /* 1 */ asn_DEF_Int4_tags_1, /* Same as above */ sizeof(asn_DEF_Int4_tags_1) /sizeof(asn_DEF_Int4_tags_1[0]), /* 1 */ &asn_PER_type_Int4_constr_1, 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [Int5] >>> ***/ #include "Int4.h" /*** <<< TYPE-DECLS [Int5] >>> ***/ typedef Int4_t Int5_t; /*** <<< FUNC-DECLS [Int5] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Int5; asn_struct_free_f Int5_free; asn_struct_print_f Int5_print; asn_constr_check_f Int5_constraint; ber_type_decoder_f Int5_decode_ber; der_type_encoder_f Int5_encode_der; xer_type_decoder_f Int5_decode_xer; xer_type_encoder_f Int5_encode_xer; per_type_decoder_f Int5_decode_uper; per_type_encoder_f Int5_encode_uper; /*** <<< CODE [Int5] >>> ***/ int Int5_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if((value == 5)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using Int4, * so here we adjust the DEF accordingly. */ static void Int5_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_Int4.free_struct; td->print_struct = asn_DEF_Int4.print_struct; td->check_constraints = asn_DEF_Int4.check_constraints; td->ber_decoder = asn_DEF_Int4.ber_decoder; td->der_encoder = asn_DEF_Int4.der_encoder; td->xer_decoder = asn_DEF_Int4.xer_decoder; td->xer_encoder = asn_DEF_Int4.xer_encoder; td->uper_decoder = asn_DEF_Int4.uper_decoder; td->uper_encoder = asn_DEF_Int4.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Int4.per_constraints; td->elements = asn_DEF_Int4.elements; td->elements_count = asn_DEF_Int4.elements_count; td->specifics = asn_DEF_Int4.specifics; } void Int5_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Int5_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Int5_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Int5_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Int5_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Int5_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Int5_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Int5_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Int5_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Int5_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Int5_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Int5_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t Int5_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { Int5_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t Int5_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { Int5_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } /*** <<< CTDEFS [Int5] >>> ***/ static asn_per_constraints_t asn_PER_type_Int5_constr_1 GCC_NOTUSED = { { APC_CONSTRAINED, 0, 0, 5, 5 } /* (5..5) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; /*** <<< STAT-DEFS [Int5] >>> ***/ static const ber_tlv_tag_t asn_DEF_Int5_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Int5 = { "Int5", "Int5", Int5_free, Int5_print, Int5_constraint, Int5_decode_ber, Int5_encode_der, Int5_decode_xer, Int5_encode_xer, Int5_decode_uper, Int5_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Int5_tags_1, sizeof(asn_DEF_Int5_tags_1) /sizeof(asn_DEF_Int5_tags_1[0]), /* 1 */ asn_DEF_Int5_tags_1, /* Same as above */ sizeof(asn_DEF_Int5_tags_1) /sizeof(asn_DEF_Int5_tags_1[0]), /* 1 */ &asn_PER_type_Int5_constr_1, 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [ExtensibleExtensions] >>> ***/ #include /*** <<< TYPE-DECLS [ExtensibleExtensions] >>> ***/ typedef long ExtensibleExtensions_t; /*** <<< FUNC-DECLS [ExtensibleExtensions] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_ExtensibleExtensions; asn_struct_free_f ExtensibleExtensions_free; asn_struct_print_f ExtensibleExtensions_print; asn_constr_check_f ExtensibleExtensions_constraint; ber_type_decoder_f ExtensibleExtensions_decode_ber; der_type_encoder_f ExtensibleExtensions_encode_der; xer_type_decoder_f ExtensibleExtensions_decode_xer; xer_type_encoder_f ExtensibleExtensions_encode_xer; per_type_decoder_f ExtensibleExtensions_decode_uper; per_type_encoder_f ExtensibleExtensions_encode_uper; /*** <<< CODE [ExtensibleExtensions] >>> ***/ int ExtensibleExtensions_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if((value >= 1 && value <= 256)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void ExtensibleExtensions_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; td->specifics = asn_DEF_NativeInteger.specifics; } void ExtensibleExtensions_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { ExtensibleExtensions_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int ExtensibleExtensions_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { ExtensibleExtensions_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t ExtensibleExtensions_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { ExtensibleExtensions_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t ExtensibleExtensions_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { ExtensibleExtensions_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t ExtensibleExtensions_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { ExtensibleExtensions_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t ExtensibleExtensions_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { ExtensibleExtensions_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t ExtensibleExtensions_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { ExtensibleExtensions_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t ExtensibleExtensions_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { ExtensibleExtensions_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } /*** <<< CTDEFS [ExtensibleExtensions] >>> ***/ static asn_per_constraints_t asn_PER_type_ExtensibleExtensions_constr_1 GCC_NOTUSED = { { APC_CONSTRAINED | APC_EXTENSIBLE, 8, 8, 1, 256 } /* (1..256,...) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; /*** <<< STAT-DEFS [ExtensibleExtensions] >>> ***/ static const ber_tlv_tag_t asn_DEF_ExtensibleExtensions_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_ExtensibleExtensions = { "ExtensibleExtensions", "ExtensibleExtensions", ExtensibleExtensions_free, ExtensibleExtensions_print, ExtensibleExtensions_constraint, ExtensibleExtensions_decode_ber, ExtensibleExtensions_encode_der, ExtensibleExtensions_decode_xer, ExtensibleExtensions_encode_xer, ExtensibleExtensions_decode_uper, ExtensibleExtensions_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_ExtensibleExtensions_tags_1, sizeof(asn_DEF_ExtensibleExtensions_tags_1) /sizeof(asn_DEF_ExtensibleExtensions_tags_1[0]), /* 1 */ asn_DEF_ExtensibleExtensions_tags_1, /* Same as above */ sizeof(asn_DEF_ExtensibleExtensions_tags_1) /sizeof(asn_DEF_ExtensibleExtensions_tags_1[0]), /* 1 */ &asn_PER_type_ExtensibleExtensions_constr_1, 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [Str1] >>> ***/ #include /*** <<< TYPE-DECLS [Str1] >>> ***/ typedef IA5String_t Str1_t; /*** <<< FUNC-DECLS [Str1] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Str1; asn_struct_free_f Str1_free; asn_struct_print_f Str1_print; asn_constr_check_f Str1_constraint; ber_type_decoder_f Str1_decode_ber; der_type_encoder_f Str1_encode_der; xer_type_decoder_f Str1_decode_xer; xer_type_encoder_f Str1_encode_xer; per_type_decoder_f Str1_decode_uper; per_type_encoder_f Str1_encode_uper; /*** <<< CODE [Str1] >>> ***/ int Str1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_IA5String.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using IA5String, * so here we adjust the DEF accordingly. */ static void Str1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_IA5String.free_struct; td->print_struct = asn_DEF_IA5String.print_struct; td->check_constraints = asn_DEF_IA5String.check_constraints; td->ber_decoder = asn_DEF_IA5String.ber_decoder; td->der_encoder = asn_DEF_IA5String.der_encoder; td->xer_decoder = asn_DEF_IA5String.xer_decoder; td->xer_encoder = asn_DEF_IA5String.xer_encoder; td->uper_decoder = asn_DEF_IA5String.uper_decoder; td->uper_encoder = asn_DEF_IA5String.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_IA5String.per_constraints; td->elements = asn_DEF_IA5String.elements; td->elements_count = asn_DEF_IA5String.elements_count; td->specifics = asn_DEF_IA5String.specifics; } void Str1_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Str1_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Str1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Str1_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Str1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Str1_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Str1_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Str1_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Str1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Str1_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Str1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Str1_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t Str1_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { Str1_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t Str1_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { Str1_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } /*** <<< STAT-DEFS [Str1] >>> ***/ static const ber_tlv_tag_t asn_DEF_Str1_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Str1 = { "Str1", "Str1", Str1_free, Str1_print, Str1_constraint, Str1_decode_ber, Str1_encode_der, Str1_decode_xer, Str1_encode_xer, Str1_decode_uper, Str1_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Str1_tags_1, sizeof(asn_DEF_Str1_tags_1) /sizeof(asn_DEF_Str1_tags_1[0]), /* 1 */ asn_DEF_Str1_tags_1, /* Same as above */ sizeof(asn_DEF_Str1_tags_1) /sizeof(asn_DEF_Str1_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [Str2] >>> ***/ #include "Str1.h" /*** <<< TYPE-DECLS [Str2] >>> ***/ typedef Str1_t Str2_t; /*** <<< FUNC-DECLS [Str2] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Str2; asn_struct_free_f Str2_free; asn_struct_print_f Str2_print; asn_constr_check_f Str2_constraint; ber_type_decoder_f Str2_decode_ber; der_type_encoder_f Str2_encode_der; xer_type_decoder_f Str2_decode_xer; xer_type_encoder_f Str2_encode_xer; per_type_decoder_f Str2_decode_uper; per_type_encoder_f Str2_encode_uper; /*** <<< CTABLES [Str2] >>> ***/ static int check_permitted_alphabet_1(const void *sptr) { /* The underlying type is IA5String */ const IA5String_t *st = (const IA5String_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(!(cv <= 127)) return -1; } return 0; } /*** <<< CODE [Str2] >>> ***/ int Str2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Str1_t *st = (const Str1_t *)sptr; size_t size; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } size = st->size; if(((size <= 20) || (size >= 25 && size <= 30)) && !check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using Str1, * so here we adjust the DEF accordingly. */ static void Str2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_Str1.free_struct; td->print_struct = asn_DEF_Str1.print_struct; td->check_constraints = asn_DEF_Str1.check_constraints; td->ber_decoder = asn_DEF_Str1.ber_decoder; td->der_encoder = asn_DEF_Str1.der_encoder; td->xer_decoder = asn_DEF_Str1.xer_decoder; td->xer_encoder = asn_DEF_Str1.xer_encoder; td->uper_decoder = asn_DEF_Str1.uper_decoder; td->uper_encoder = asn_DEF_Str1.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Str1.per_constraints; td->elements = asn_DEF_Str1.elements; td->elements_count = asn_DEF_Str1.elements_count; td->specifics = asn_DEF_Str1.specifics; } void Str2_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Str2_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Str2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Str2_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Str2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Str2_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Str2_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Str2_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Str2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Str2_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Str2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Str2_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t Str2_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { Str2_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t Str2_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { Str2_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } /*** <<< CTDEFS [Str2] >>> ***/ static asn_per_constraints_t asn_PER_type_Str2_constr_1 GCC_NOTUSED = { { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, { APC_CONSTRAINED, 5, 5, 0, 30 } /* (SIZE(0..30)) */, 0, 0 /* No PER character map necessary */ }; /*** <<< STAT-DEFS [Str2] >>> ***/ static const ber_tlv_tag_t asn_DEF_Str2_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Str2 = { "Str2", "Str2", Str2_free, Str2_print, Str2_constraint, Str2_decode_ber, Str2_encode_der, Str2_decode_xer, Str2_encode_xer, Str2_decode_uper, Str2_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Str2_tags_1, sizeof(asn_DEF_Str2_tags_1) /sizeof(asn_DEF_Str2_tags_1[0]), /* 1 */ asn_DEF_Str2_tags_1, /* Same as above */ sizeof(asn_DEF_Str2_tags_1) /sizeof(asn_DEF_Str2_tags_1[0]), /* 1 */ &asn_PER_type_Str2_constr_1, 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [Str3] >>> ***/ #include "Str2.h" /*** <<< TYPE-DECLS [Str3] >>> ***/ typedef Str2_t Str3_t; /*** <<< FUNC-DECLS [Str3] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Str3; asn_struct_free_f Str3_free; asn_struct_print_f Str3_print; asn_constr_check_f Str3_constraint; ber_type_decoder_f Str3_decode_ber; der_type_encoder_f Str3_encode_der; xer_type_decoder_f Str3_decode_xer; xer_type_encoder_f Str3_encode_xer; per_type_decoder_f Str3_decode_uper; per_type_encoder_f Str3_encode_uper; /*** <<< CTABLES [Str3] >>> ***/ static const int permitted_alphabet_table_1[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* ABC */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 4, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* def */ }; static const int permitted_alphabet_code2value_1[6] = { 65,66,67,100,101,102,}; static int check_permitted_alphabet_1(const void *sptr) { const int *table = permitted_alphabet_table_1; /* The underlying type is IA5String */ const IA5String_t *st = (const IA5String_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(!table[cv]) return -1; } return 0; } /*** <<< CODE [Str3] >>> ***/ int Str3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Str2_t *st = (const Str2_t *)sptr; size_t size; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } size = st->size; if(((size >= 10 && size <= 20) || (size >= 25 && size <= 27)) && !check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } static int asn_PER_MAP_Str3_1_v2c(unsigned int value) { if(value >= sizeof(permitted_alphabet_table_1)/sizeof(permitted_alphabet_table_1[0])) return -1; return permitted_alphabet_table_1[value] - 1; } static int asn_PER_MAP_Str3_1_c2v(unsigned int code) { if(code >= sizeof(permitted_alphabet_code2value_1)/sizeof(permitted_alphabet_code2value_1[0])) return -1; return permitted_alphabet_code2value_1[code]; } /* * This type is implemented using Str2, * so here we adjust the DEF accordingly. */ static void Str3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_Str2.free_struct; td->print_struct = asn_DEF_Str2.print_struct; td->check_constraints = asn_DEF_Str2.check_constraints; td->ber_decoder = asn_DEF_Str2.ber_decoder; td->der_encoder = asn_DEF_Str2.der_encoder; td->xer_decoder = asn_DEF_Str2.xer_decoder; td->xer_encoder = asn_DEF_Str2.xer_encoder; td->uper_decoder = asn_DEF_Str2.uper_decoder; td->uper_encoder = asn_DEF_Str2.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Str2.per_constraints; td->elements = asn_DEF_Str2.elements; td->elements_count = asn_DEF_Str2.elements_count; td->specifics = asn_DEF_Str2.specifics; } void Str3_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Str3_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Str3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Str3_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Str3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Str3_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Str3_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Str3_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Str3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Str3_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Str3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Str3_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t Str3_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { Str3_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t Str3_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { Str3_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } /*** <<< CTDEFS [Str3] >>> ***/ static asn_per_constraints_t asn_PER_type_Str3_constr_1 GCC_NOTUSED = { { APC_CONSTRAINED, 3, 3, 65, 102 } /* (65..102) */, { APC_CONSTRAINED, 5, 5, 10, 27 } /* (SIZE(10..27)) */, asn_PER_MAP_Str3_1_v2c, /* Value to PER code map */ asn_PER_MAP_Str3_1_c2v /* PER code to value map */ }; /*** <<< STAT-DEFS [Str3] >>> ***/ static const ber_tlv_tag_t asn_DEF_Str3_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Str3 = { "Str3", "Str3", Str3_free, Str3_print, Str3_constraint, Str3_decode_ber, Str3_encode_der, Str3_decode_xer, Str3_encode_xer, Str3_decode_uper, Str3_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Str3_tags_1, sizeof(asn_DEF_Str3_tags_1) /sizeof(asn_DEF_Str3_tags_1[0]), /* 1 */ asn_DEF_Str3_tags_1, /* Same as above */ sizeof(asn_DEF_Str3_tags_1) /sizeof(asn_DEF_Str3_tags_1[0]), /* 1 */ &asn_PER_type_Str3_constr_1, 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [Str4] >>> ***/ #include /*** <<< TYPE-DECLS [Str4] >>> ***/ typedef IA5String_t Str4_t; /*** <<< FUNC-DECLS [Str4] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Str4; asn_struct_free_f Str4_free; asn_struct_print_f Str4_print; asn_constr_check_f Str4_constraint; ber_type_decoder_f Str4_decode_ber; der_type_encoder_f Str4_encode_der; xer_type_decoder_f Str4_decode_xer; xer_type_encoder_f Str4_encode_xer; per_type_decoder_f Str4_decode_uper; per_type_encoder_f Str4_encode_uper; /*** <<< CTABLES [Str4] >>> ***/ static int check_permitted_alphabet_1(const void *sptr) { /* The underlying type is IA5String */ const IA5String_t *st = (const IA5String_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(!(cv <= 127)) return -1; } return 0; } /*** <<< CODE [Str4] >>> ***/ int Str4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const IA5String_t *st = (const IA5String_t *)sptr; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(!check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using IA5String, * so here we adjust the DEF accordingly. */ static void Str4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_IA5String.free_struct; td->print_struct = asn_DEF_IA5String.print_struct; td->check_constraints = asn_DEF_IA5String.check_constraints; td->ber_decoder = asn_DEF_IA5String.ber_decoder; td->der_encoder = asn_DEF_IA5String.der_encoder; td->xer_decoder = asn_DEF_IA5String.xer_decoder; td->xer_encoder = asn_DEF_IA5String.xer_encoder; td->uper_decoder = asn_DEF_IA5String.uper_decoder; td->uper_encoder = asn_DEF_IA5String.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_IA5String.per_constraints; td->elements = asn_DEF_IA5String.elements; td->elements_count = asn_DEF_IA5String.elements_count; td->specifics = asn_DEF_IA5String.specifics; } void Str4_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Str4_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Str4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Str4_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Str4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Str4_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Str4_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Str4_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Str4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Str4_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Str4_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Str4_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t Str4_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { Str4_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t Str4_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { Str4_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } /*** <<< CTDEFS [Str4] >>> ***/ static asn_per_constraints_t asn_PER_type_Str4_constr_1 GCC_NOTUSED = { { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, 0, 0 /* No PER character map necessary */ }; /*** <<< STAT-DEFS [Str4] >>> ***/ static const ber_tlv_tag_t asn_DEF_Str4_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Str4 = { "Str4", "Str4", Str4_free, Str4_print, Str4_constraint, Str4_decode_ber, Str4_encode_der, Str4_decode_xer, Str4_encode_xer, Str4_decode_uper, Str4_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Str4_tags_1, sizeof(asn_DEF_Str4_tags_1) /sizeof(asn_DEF_Str4_tags_1[0]), /* 1 */ asn_DEF_Str4_tags_1, /* Same as above */ sizeof(asn_DEF_Str4_tags_1) /sizeof(asn_DEF_Str4_tags_1[0]), /* 1 */ &asn_PER_type_Str4_constr_1, 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [PER-Visible] >>> ***/ #include /*** <<< TYPE-DECLS [PER-Visible] >>> ***/ typedef IA5String_t PER_Visible_t; /*** <<< FUNC-DECLS [PER-Visible] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_PER_Visible; asn_struct_free_f PER_Visible_free; asn_struct_print_f PER_Visible_print; asn_constr_check_f PER_Visible_constraint; ber_type_decoder_f PER_Visible_decode_ber; der_type_encoder_f PER_Visible_encode_der; xer_type_decoder_f PER_Visible_decode_xer; xer_type_encoder_f PER_Visible_encode_xer; per_type_decoder_f PER_Visible_decode_uper; per_type_encoder_f PER_Visible_encode_uper; /*** <<< CTABLES [PER-Visible] >>> ***/ static int check_permitted_alphabet_1(const void *sptr) { /* The underlying type is IA5String */ const IA5String_t *st = (const IA5String_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(!(cv >= 65 && cv <= 70)) return -1; } return 0; } /*** <<< CODE [PER-Visible] >>> ***/ int PER_Visible_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const IA5String_t *st = (const IA5String_t *)sptr; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(!check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using IA5String, * so here we adjust the DEF accordingly. */ static void PER_Visible_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_IA5String.free_struct; td->print_struct = asn_DEF_IA5String.print_struct; td->check_constraints = asn_DEF_IA5String.check_constraints; td->ber_decoder = asn_DEF_IA5String.ber_decoder; td->der_encoder = asn_DEF_IA5String.der_encoder; td->xer_decoder = asn_DEF_IA5String.xer_decoder; td->xer_encoder = asn_DEF_IA5String.xer_encoder; td->uper_decoder = asn_DEF_IA5String.uper_decoder; td->uper_encoder = asn_DEF_IA5String.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_IA5String.per_constraints; td->elements = asn_DEF_IA5String.elements; td->elements_count = asn_DEF_IA5String.elements_count; td->specifics = asn_DEF_IA5String.specifics; } void PER_Visible_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { PER_Visible_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int PER_Visible_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { PER_Visible_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t PER_Visible_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { PER_Visible_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t PER_Visible_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { PER_Visible_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t PER_Visible_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { PER_Visible_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t PER_Visible_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { PER_Visible_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t PER_Visible_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { PER_Visible_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t PER_Visible_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { PER_Visible_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } /*** <<< CTDEFS [PER-Visible] >>> ***/ static asn_per_constraints_t asn_PER_type_PER_Visible_constr_1 GCC_NOTUSED = { { APC_CONSTRAINED, 3, 3, 65, 70 } /* (65..70) */, { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, 0, 0 /* No PER character map necessary */ }; /*** <<< STAT-DEFS [PER-Visible] >>> ***/ static const ber_tlv_tag_t asn_DEF_PER_Visible_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) }; asn_TYPE_descriptor_t asn_DEF_PER_Visible = { "PER-Visible", "PER-Visible", PER_Visible_free, PER_Visible_print, PER_Visible_constraint, PER_Visible_decode_ber, PER_Visible_encode_der, PER_Visible_decode_xer, PER_Visible_encode_xer, PER_Visible_decode_uper, PER_Visible_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_PER_Visible_tags_1, sizeof(asn_DEF_PER_Visible_tags_1) /sizeof(asn_DEF_PER_Visible_tags_1[0]), /* 1 */ asn_DEF_PER_Visible_tags_1, /* Same as above */ sizeof(asn_DEF_PER_Visible_tags_1) /sizeof(asn_DEF_PER_Visible_tags_1[0]), /* 1 */ &asn_PER_type_PER_Visible_constr_1, 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [PER-Visible-2] >>> ***/ #include "PER-Visible.h" /*** <<< TYPE-DECLS [PER-Visible-2] >>> ***/ typedef PER_Visible_t PER_Visible_2_t; /*** <<< FUNC-DECLS [PER-Visible-2] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_PER_Visible_2; asn_struct_free_f PER_Visible_2_free; asn_struct_print_f PER_Visible_2_print; asn_constr_check_f PER_Visible_2_constraint; ber_type_decoder_f PER_Visible_2_decode_ber; der_type_encoder_f PER_Visible_2_encode_der; xer_type_decoder_f PER_Visible_2_decode_xer; xer_type_encoder_f PER_Visible_2_encode_xer; per_type_decoder_f PER_Visible_2_decode_uper; per_type_encoder_f PER_Visible_2_encode_uper; /*** <<< CTABLES [PER-Visible-2] >>> ***/ static int check_permitted_alphabet_1(const void *sptr) { /* The underlying type is IA5String */ const IA5String_t *st = (const IA5String_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(!(cv >= 69 && cv <= 70)) return -1; } return 0; } /*** <<< CODE [PER-Visible-2] >>> ***/ int PER_Visible_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const PER_Visible_t *st = (const PER_Visible_t *)sptr; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(!check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using PER_Visible, * so here we adjust the DEF accordingly. */ static void PER_Visible_2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_PER_Visible.free_struct; td->print_struct = asn_DEF_PER_Visible.print_struct; td->check_constraints = asn_DEF_PER_Visible.check_constraints; td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; td->der_encoder = asn_DEF_PER_Visible.der_encoder; td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_PER_Visible.per_constraints; td->elements = asn_DEF_PER_Visible.elements; td->elements_count = asn_DEF_PER_Visible.elements_count; td->specifics = asn_DEF_PER_Visible.specifics; } void PER_Visible_2_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { PER_Visible_2_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int PER_Visible_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { PER_Visible_2_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t PER_Visible_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { PER_Visible_2_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t PER_Visible_2_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { PER_Visible_2_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t PER_Visible_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { PER_Visible_2_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t PER_Visible_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { PER_Visible_2_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t PER_Visible_2_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { PER_Visible_2_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t PER_Visible_2_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { PER_Visible_2_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } /*** <<< CTDEFS [PER-Visible-2] >>> ***/ static asn_per_constraints_t asn_PER_type_PER_Visible_2_constr_1 GCC_NOTUSED = { { APC_CONSTRAINED, 1, 1, 69, 70 } /* (69..70) */, { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, 0, 0 /* No PER character map necessary */ }; /*** <<< STAT-DEFS [PER-Visible-2] >>> ***/ static const ber_tlv_tag_t asn_DEF_PER_Visible_2_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) }; asn_TYPE_descriptor_t asn_DEF_PER_Visible_2 = { "PER-Visible-2", "PER-Visible-2", PER_Visible_2_free, PER_Visible_2_print, PER_Visible_2_constraint, PER_Visible_2_decode_ber, PER_Visible_2_encode_der, PER_Visible_2_decode_xer, PER_Visible_2_encode_xer, PER_Visible_2_decode_uper, PER_Visible_2_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_PER_Visible_2_tags_1, sizeof(asn_DEF_PER_Visible_2_tags_1) /sizeof(asn_DEF_PER_Visible_2_tags_1[0]), /* 1 */ asn_DEF_PER_Visible_2_tags_1, /* Same as above */ sizeof(asn_DEF_PER_Visible_2_tags_1) /sizeof(asn_DEF_PER_Visible_2_tags_1[0]), /* 1 */ &asn_PER_type_PER_Visible_2_constr_1, 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [Not-PER-Visible-1] >>> ***/ #include "PER-Visible.h" /*** <<< TYPE-DECLS [Not-PER-Visible-1] >>> ***/ typedef PER_Visible_t Not_PER_Visible_1_t; /*** <<< FUNC-DECLS [Not-PER-Visible-1] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_1; asn_struct_free_f Not_PER_Visible_1_free; asn_struct_print_f Not_PER_Visible_1_print; asn_constr_check_f Not_PER_Visible_1_constraint; ber_type_decoder_f Not_PER_Visible_1_decode_ber; der_type_encoder_f Not_PER_Visible_1_encode_der; xer_type_decoder_f Not_PER_Visible_1_decode_xer; xer_type_encoder_f Not_PER_Visible_1_encode_xer; per_type_decoder_f Not_PER_Visible_1_decode_uper; per_type_encoder_f Not_PER_Visible_1_encode_uper; /*** <<< CTABLES [Not-PER-Visible-1] >>> ***/ static int check_permitted_alphabet_1(const void *sptr) { /* The underlying type is IA5String */ const IA5String_t *st = (const IA5String_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(!(cv >= 65 && cv <= 70)) return -1; } return 0; } /*** <<< CODE [Not-PER-Visible-1] >>> ***/ int Not_PER_Visible_1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const PER_Visible_t *st = (const PER_Visible_t *)sptr; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(!check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using PER_Visible, * so here we adjust the DEF accordingly. */ static void Not_PER_Visible_1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_PER_Visible.free_struct; td->print_struct = asn_DEF_PER_Visible.print_struct; td->check_constraints = asn_DEF_PER_Visible.check_constraints; td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; td->der_encoder = asn_DEF_PER_Visible.der_encoder; td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_PER_Visible.per_constraints; td->elements = asn_DEF_PER_Visible.elements; td->elements_count = asn_DEF_PER_Visible.elements_count; td->specifics = asn_DEF_PER_Visible.specifics; } void Not_PER_Visible_1_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Not_PER_Visible_1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Not_PER_Visible_1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Not_PER_Visible_1_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Not_PER_Visible_1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Not_PER_Visible_1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t Not_PER_Visible_1_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t Not_PER_Visible_1_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } /*** <<< CTDEFS [Not-PER-Visible-1] >>> ***/ static asn_per_constraints_t asn_PER_type_Not_PER_Visible_1_constr_1 GCC_NOTUSED = { { APC_CONSTRAINED, 3, 3, 65, 70 } /* (65..70) */, { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, 0, 0 /* No PER character map necessary */ }; /*** <<< STAT-DEFS [Not-PER-Visible-1] >>> ***/ static const ber_tlv_tag_t asn_DEF_Not_PER_Visible_1_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_1 = { "Not-PER-Visible-1", "Not-PER-Visible-1", Not_PER_Visible_1_free, Not_PER_Visible_1_print, Not_PER_Visible_1_constraint, Not_PER_Visible_1_decode_ber, Not_PER_Visible_1_encode_der, Not_PER_Visible_1_decode_xer, Not_PER_Visible_1_encode_xer, Not_PER_Visible_1_decode_uper, Not_PER_Visible_1_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Not_PER_Visible_1_tags_1, sizeof(asn_DEF_Not_PER_Visible_1_tags_1) /sizeof(asn_DEF_Not_PER_Visible_1_tags_1[0]), /* 1 */ asn_DEF_Not_PER_Visible_1_tags_1, /* Same as above */ sizeof(asn_DEF_Not_PER_Visible_1_tags_1) /sizeof(asn_DEF_Not_PER_Visible_1_tags_1[0]), /* 1 */ &asn_PER_type_Not_PER_Visible_1_constr_1, 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [Not-PER-Visible-2] >>> ***/ #include "PER-Visible.h" /*** <<< TYPE-DECLS [Not-PER-Visible-2] >>> ***/ typedef PER_Visible_t Not_PER_Visible_2_t; /*** <<< FUNC-DECLS [Not-PER-Visible-2] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_2; asn_struct_free_f Not_PER_Visible_2_free; asn_struct_print_f Not_PER_Visible_2_print; asn_constr_check_f Not_PER_Visible_2_constraint; ber_type_decoder_f Not_PER_Visible_2_decode_ber; der_type_encoder_f Not_PER_Visible_2_encode_der; xer_type_decoder_f Not_PER_Visible_2_decode_xer; xer_type_encoder_f Not_PER_Visible_2_encode_xer; per_type_decoder_f Not_PER_Visible_2_decode_uper; per_type_encoder_f Not_PER_Visible_2_encode_uper; /*** <<< CTABLES [Not-PER-Visible-2] >>> ***/ static int check_permitted_alphabet_1(const void *sptr) { /* The underlying type is IA5String */ const IA5String_t *st = (const IA5String_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(!(cv >= 65 && cv <= 66)) return -1; } return 0; } /*** <<< CODE [Not-PER-Visible-2] >>> ***/ int Not_PER_Visible_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const PER_Visible_t *st = (const PER_Visible_t *)sptr; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(!check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using PER_Visible, * so here we adjust the DEF accordingly. */ static void Not_PER_Visible_2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_PER_Visible.free_struct; td->print_struct = asn_DEF_PER_Visible.print_struct; td->check_constraints = asn_DEF_PER_Visible.check_constraints; td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; td->der_encoder = asn_DEF_PER_Visible.der_encoder; td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_PER_Visible.per_constraints; td->elements = asn_DEF_PER_Visible.elements; td->elements_count = asn_DEF_PER_Visible.elements_count; td->specifics = asn_DEF_PER_Visible.specifics; } void Not_PER_Visible_2_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Not_PER_Visible_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Not_PER_Visible_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Not_PER_Visible_2_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Not_PER_Visible_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Not_PER_Visible_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t Not_PER_Visible_2_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t Not_PER_Visible_2_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } /*** <<< CTDEFS [Not-PER-Visible-2] >>> ***/ static asn_per_constraints_t asn_PER_type_Not_PER_Visible_2_constr_1 GCC_NOTUSED = { { APC_UNCONSTRAINED, -1, -1, 0, 0 }, { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, 0, 0 /* No PER character map necessary */ }; /*** <<< STAT-DEFS [Not-PER-Visible-2] >>> ***/ static const ber_tlv_tag_t asn_DEF_Not_PER_Visible_2_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_2 = { "Not-PER-Visible-2", "Not-PER-Visible-2", Not_PER_Visible_2_free, Not_PER_Visible_2_print, Not_PER_Visible_2_constraint, Not_PER_Visible_2_decode_ber, Not_PER_Visible_2_encode_der, Not_PER_Visible_2_decode_xer, Not_PER_Visible_2_encode_xer, Not_PER_Visible_2_decode_uper, Not_PER_Visible_2_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Not_PER_Visible_2_tags_1, sizeof(asn_DEF_Not_PER_Visible_2_tags_1) /sizeof(asn_DEF_Not_PER_Visible_2_tags_1[0]), /* 1 */ asn_DEF_Not_PER_Visible_2_tags_1, /* Same as above */ sizeof(asn_DEF_Not_PER_Visible_2_tags_1) /sizeof(asn_DEF_Not_PER_Visible_2_tags_1[0]), /* 1 */ &asn_PER_type_Not_PER_Visible_2_constr_1, 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [Not-PER-Visible-3] >>> ***/ #include "PER-Visible.h" /*** <<< TYPE-DECLS [Not-PER-Visible-3] >>> ***/ typedef PER_Visible_t Not_PER_Visible_3_t; /*** <<< FUNC-DECLS [Not-PER-Visible-3] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_3; asn_struct_free_f Not_PER_Visible_3_free; asn_struct_print_f Not_PER_Visible_3_print; asn_constr_check_f Not_PER_Visible_3_constraint; ber_type_decoder_f Not_PER_Visible_3_decode_ber; der_type_encoder_f Not_PER_Visible_3_encode_der; xer_type_decoder_f Not_PER_Visible_3_decode_xer; xer_type_encoder_f Not_PER_Visible_3_encode_xer; per_type_decoder_f Not_PER_Visible_3_decode_uper; per_type_encoder_f Not_PER_Visible_3_encode_uper; /*** <<< CTABLES [Not-PER-Visible-3] >>> ***/ static int check_permitted_alphabet_1(const void *sptr) { /* The underlying type is IA5String */ const IA5String_t *st = (const IA5String_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(!(cv >= 65 && cv <= 66)) return -1; } return 0; } /*** <<< CODE [Not-PER-Visible-3] >>> ***/ int Not_PER_Visible_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const PER_Visible_t *st = (const PER_Visible_t *)sptr; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(!check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using PER_Visible, * so here we adjust the DEF accordingly. */ static void Not_PER_Visible_3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_PER_Visible.free_struct; td->print_struct = asn_DEF_PER_Visible.print_struct; td->check_constraints = asn_DEF_PER_Visible.check_constraints; td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; td->der_encoder = asn_DEF_PER_Visible.der_encoder; td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_PER_Visible.per_constraints; td->elements = asn_DEF_PER_Visible.elements; td->elements_count = asn_DEF_PER_Visible.elements_count; td->specifics = asn_DEF_PER_Visible.specifics; } void Not_PER_Visible_3_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Not_PER_Visible_3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Not_PER_Visible_3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Not_PER_Visible_3_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Not_PER_Visible_3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Not_PER_Visible_3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t Not_PER_Visible_3_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t Not_PER_Visible_3_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } /*** <<< CTDEFS [Not-PER-Visible-3] >>> ***/ static asn_per_constraints_t asn_PER_type_Not_PER_Visible_3_constr_1 GCC_NOTUSED = { { APC_UNCONSTRAINED, -1, -1, 0, 0 }, { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, 0, 0 /* No PER character map necessary */ }; /*** <<< STAT-DEFS [Not-PER-Visible-3] >>> ***/ static const ber_tlv_tag_t asn_DEF_Not_PER_Visible_3_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_3 = { "Not-PER-Visible-3", "Not-PER-Visible-3", Not_PER_Visible_3_free, Not_PER_Visible_3_print, Not_PER_Visible_3_constraint, Not_PER_Visible_3_decode_ber, Not_PER_Visible_3_encode_der, Not_PER_Visible_3_decode_xer, Not_PER_Visible_3_encode_xer, Not_PER_Visible_3_decode_uper, Not_PER_Visible_3_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Not_PER_Visible_3_tags_1, sizeof(asn_DEF_Not_PER_Visible_3_tags_1) /sizeof(asn_DEF_Not_PER_Visible_3_tags_1[0]), /* 1 */ asn_DEF_Not_PER_Visible_3_tags_1, /* Same as above */ sizeof(asn_DEF_Not_PER_Visible_3_tags_1) /sizeof(asn_DEF_Not_PER_Visible_3_tags_1[0]), /* 1 */ &asn_PER_type_Not_PER_Visible_3_constr_1, 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [SIZE-but-not-FROM] >>> ***/ #include "PER-Visible.h" /*** <<< TYPE-DECLS [SIZE-but-not-FROM] >>> ***/ typedef PER_Visible_t SIZE_but_not_FROM_t; /*** <<< FUNC-DECLS [SIZE-but-not-FROM] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_SIZE_but_not_FROM; asn_struct_free_f SIZE_but_not_FROM_free; asn_struct_print_f SIZE_but_not_FROM_print; asn_constr_check_f SIZE_but_not_FROM_constraint; ber_type_decoder_f SIZE_but_not_FROM_decode_ber; der_type_encoder_f SIZE_but_not_FROM_encode_der; xer_type_decoder_f SIZE_but_not_FROM_decode_xer; xer_type_encoder_f SIZE_but_not_FROM_encode_xer; per_type_decoder_f SIZE_but_not_FROM_decode_uper; per_type_encoder_f SIZE_but_not_FROM_encode_uper; /*** <<< CTABLES [SIZE-but-not-FROM] >>> ***/ static int check_permitted_alphabet_1(const void *sptr) { /* The underlying type is IA5String */ const IA5String_t *st = (const IA5String_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(!(cv >= 65 && cv <= 68)) return -1; } return 0; } /*** <<< CODE [SIZE-but-not-FROM] >>> ***/ int SIZE_but_not_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const PER_Visible_t *st = (const PER_Visible_t *)sptr; size_t size; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } size = st->size; if((size >= 1 && size <= 4) && !check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using PER_Visible, * so here we adjust the DEF accordingly. */ static void SIZE_but_not_FROM_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_PER_Visible.free_struct; td->print_struct = asn_DEF_PER_Visible.print_struct; td->check_constraints = asn_DEF_PER_Visible.check_constraints; td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; td->der_encoder = asn_DEF_PER_Visible.der_encoder; td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_PER_Visible.per_constraints; td->elements = asn_DEF_PER_Visible.elements; td->elements_count = asn_DEF_PER_Visible.elements_count; td->specifics = asn_DEF_PER_Visible.specifics; } void SIZE_but_not_FROM_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int SIZE_but_not_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t SIZE_but_not_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t SIZE_but_not_FROM_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t SIZE_but_not_FROM_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t SIZE_but_not_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t SIZE_but_not_FROM_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t SIZE_but_not_FROM_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } /*** <<< CTDEFS [SIZE-but-not-FROM] >>> ***/ static asn_per_constraints_t asn_PER_type_SIZE_but_not_FROM_constr_1 GCC_NOTUSED = { { APC_UNCONSTRAINED, -1, -1, 0, 0 }, { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */, 0, 0 /* No PER character map necessary */ }; /*** <<< STAT-DEFS [SIZE-but-not-FROM] >>> ***/ static const ber_tlv_tag_t asn_DEF_SIZE_but_not_FROM_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) }; asn_TYPE_descriptor_t asn_DEF_SIZE_but_not_FROM = { "SIZE-but-not-FROM", "SIZE-but-not-FROM", SIZE_but_not_FROM_free, SIZE_but_not_FROM_print, SIZE_but_not_FROM_constraint, SIZE_but_not_FROM_decode_ber, SIZE_but_not_FROM_encode_der, SIZE_but_not_FROM_decode_xer, SIZE_but_not_FROM_encode_xer, SIZE_but_not_FROM_decode_uper, SIZE_but_not_FROM_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_SIZE_but_not_FROM_tags_1, sizeof(asn_DEF_SIZE_but_not_FROM_tags_1) /sizeof(asn_DEF_SIZE_but_not_FROM_tags_1[0]), /* 1 */ asn_DEF_SIZE_but_not_FROM_tags_1, /* Same as above */ sizeof(asn_DEF_SIZE_but_not_FROM_tags_1) /sizeof(asn_DEF_SIZE_but_not_FROM_tags_1[0]), /* 1 */ &asn_PER_type_SIZE_but_not_FROM_constr_1, 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [SIZE-and-FROM] >>> ***/ #include "PER-Visible.h" /*** <<< TYPE-DECLS [SIZE-and-FROM] >>> ***/ typedef PER_Visible_t SIZE_and_FROM_t; /*** <<< FUNC-DECLS [SIZE-and-FROM] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_SIZE_and_FROM; asn_struct_free_f SIZE_and_FROM_free; asn_struct_print_f SIZE_and_FROM_print; asn_constr_check_f SIZE_and_FROM_constraint; ber_type_decoder_f SIZE_and_FROM_decode_ber; der_type_encoder_f SIZE_and_FROM_encode_der; xer_type_decoder_f SIZE_and_FROM_decode_xer; xer_type_encoder_f SIZE_and_FROM_encode_xer; per_type_decoder_f SIZE_and_FROM_decode_uper; per_type_encoder_f SIZE_and_FROM_encode_uper; /*** <<< CTABLES [SIZE-and-FROM] >>> ***/ static int check_permitted_alphabet_1(const void *sptr) { /* The underlying type is IA5String */ const IA5String_t *st = (const IA5String_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(!(cv >= 65 && cv <= 68)) return -1; } return 0; } /*** <<< CODE [SIZE-and-FROM] >>> ***/ int SIZE_and_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const PER_Visible_t *st = (const PER_Visible_t *)sptr; size_t size; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } size = st->size; if((size >= 1 && size <= 4) && !check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using PER_Visible, * so here we adjust the DEF accordingly. */ static void SIZE_and_FROM_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_PER_Visible.free_struct; td->print_struct = asn_DEF_PER_Visible.print_struct; td->check_constraints = asn_DEF_PER_Visible.check_constraints; td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; td->der_encoder = asn_DEF_PER_Visible.der_encoder; td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_PER_Visible.per_constraints; td->elements = asn_DEF_PER_Visible.elements; td->elements_count = asn_DEF_PER_Visible.elements_count; td->specifics = asn_DEF_PER_Visible.specifics; } void SIZE_and_FROM_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { SIZE_and_FROM_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int SIZE_and_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { SIZE_and_FROM_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t SIZE_and_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { SIZE_and_FROM_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t SIZE_and_FROM_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { SIZE_and_FROM_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t SIZE_and_FROM_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { SIZE_and_FROM_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t SIZE_and_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { SIZE_and_FROM_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t SIZE_and_FROM_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { SIZE_and_FROM_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t SIZE_and_FROM_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { SIZE_and_FROM_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } /*** <<< CTDEFS [SIZE-and-FROM] >>> ***/ static asn_per_constraints_t asn_PER_type_SIZE_and_FROM_constr_1 GCC_NOTUSED = { { APC_CONSTRAINED, 2, 2, 65, 68 } /* (65..68) */, { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */, 0, 0 /* No PER character map necessary */ }; /*** <<< STAT-DEFS [SIZE-and-FROM] >>> ***/ static const ber_tlv_tag_t asn_DEF_SIZE_and_FROM_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) }; asn_TYPE_descriptor_t asn_DEF_SIZE_and_FROM = { "SIZE-and-FROM", "SIZE-and-FROM", SIZE_and_FROM_free, SIZE_and_FROM_print, SIZE_and_FROM_constraint, SIZE_and_FROM_decode_ber, SIZE_and_FROM_encode_der, SIZE_and_FROM_decode_xer, SIZE_and_FROM_encode_xer, SIZE_and_FROM_decode_uper, SIZE_and_FROM_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_SIZE_and_FROM_tags_1, sizeof(asn_DEF_SIZE_and_FROM_tags_1) /sizeof(asn_DEF_SIZE_and_FROM_tags_1[0]), /* 1 */ asn_DEF_SIZE_and_FROM_tags_1, /* Same as above */ sizeof(asn_DEF_SIZE_and_FROM_tags_1) /sizeof(asn_DEF_SIZE_and_FROM_tags_1[0]), /* 1 */ &asn_PER_type_SIZE_and_FROM_constr_1, 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [Neither-SIZE-nor-FROM] >>> ***/ #include "PER-Visible.h" /*** <<< TYPE-DECLS [Neither-SIZE-nor-FROM] >>> ***/ typedef PER_Visible_t Neither_SIZE_nor_FROM_t; /*** <<< FUNC-DECLS [Neither-SIZE-nor-FROM] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Neither_SIZE_nor_FROM; asn_struct_free_f Neither_SIZE_nor_FROM_free; asn_struct_print_f Neither_SIZE_nor_FROM_print; asn_constr_check_f Neither_SIZE_nor_FROM_constraint; ber_type_decoder_f Neither_SIZE_nor_FROM_decode_ber; der_type_encoder_f Neither_SIZE_nor_FROM_encode_der; xer_type_decoder_f Neither_SIZE_nor_FROM_decode_xer; xer_type_encoder_f Neither_SIZE_nor_FROM_encode_xer; per_type_decoder_f Neither_SIZE_nor_FROM_decode_uper; per_type_encoder_f Neither_SIZE_nor_FROM_encode_uper; /*** <<< CTABLES [Neither-SIZE-nor-FROM] >>> ***/ static int check_permitted_alphabet_1(const void *sptr) { /* The underlying type is IA5String */ const IA5String_t *st = (const IA5String_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(!(cv >= 65 && cv <= 70)) return -1; } return 0; } /*** <<< CODE [Neither-SIZE-nor-FROM] >>> ***/ int Neither_SIZE_nor_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const PER_Visible_t *st = (const PER_Visible_t *)sptr; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(!check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using PER_Visible, * so here we adjust the DEF accordingly. */ static void Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_PER_Visible.free_struct; td->print_struct = asn_DEF_PER_Visible.print_struct; td->check_constraints = asn_DEF_PER_Visible.check_constraints; td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; td->der_encoder = asn_DEF_PER_Visible.der_encoder; td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_PER_Visible.per_constraints; td->elements = asn_DEF_PER_Visible.elements; td->elements_count = asn_DEF_PER_Visible.elements_count; td->specifics = asn_DEF_PER_Visible.specifics; } void Neither_SIZE_nor_FROM_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Neither_SIZE_nor_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Neither_SIZE_nor_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Neither_SIZE_nor_FROM_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Neither_SIZE_nor_FROM_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Neither_SIZE_nor_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t Neither_SIZE_nor_FROM_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t Neither_SIZE_nor_FROM_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } /*** <<< CTDEFS [Neither-SIZE-nor-FROM] >>> ***/ static asn_per_constraints_t asn_PER_type_Neither_SIZE_nor_FROM_constr_1 GCC_NOTUSED = { { APC_CONSTRAINED, 3, 3, 65, 70 } /* (65..70) */, { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, 0, 0 /* No PER character map necessary */ }; /*** <<< STAT-DEFS [Neither-SIZE-nor-FROM] >>> ***/ static const ber_tlv_tag_t asn_DEF_Neither_SIZE_nor_FROM_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Neither_SIZE_nor_FROM = { "Neither-SIZE-nor-FROM", "Neither-SIZE-nor-FROM", Neither_SIZE_nor_FROM_free, Neither_SIZE_nor_FROM_print, Neither_SIZE_nor_FROM_constraint, Neither_SIZE_nor_FROM_decode_ber, Neither_SIZE_nor_FROM_encode_der, Neither_SIZE_nor_FROM_decode_xer, Neither_SIZE_nor_FROM_encode_xer, Neither_SIZE_nor_FROM_decode_uper, Neither_SIZE_nor_FROM_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Neither_SIZE_nor_FROM_tags_1, sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags_1) /sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags_1[0]), /* 1 */ asn_DEF_Neither_SIZE_nor_FROM_tags_1, /* Same as above */ sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags_1) /sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags_1[0]), /* 1 */ &asn_PER_type_Neither_SIZE_nor_FROM_constr_1, 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [Utf8-4] >>> ***/ #include /*** <<< TYPE-DECLS [Utf8-4] >>> ***/ typedef UTF8String_t Utf8_4_t; /*** <<< FUNC-DECLS [Utf8-4] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Utf8_4; asn_struct_free_f Utf8_4_free; asn_struct_print_f Utf8_4_print; asn_constr_check_f Utf8_4_constraint; ber_type_decoder_f Utf8_4_decode_ber; der_type_encoder_f Utf8_4_encode_der; xer_type_decoder_f Utf8_4_decode_xer; xer_type_encoder_f Utf8_4_encode_xer; per_type_decoder_f Utf8_4_decode_uper; per_type_encoder_f Utf8_4_encode_uper; /*** <<< CTABLES [Utf8-4] >>> ***/ static int check_permitted_alphabet_1(const void *sptr) { if(UTF8String_length((const UTF8String_t *)sptr) < 0) return -1; /* Alphabet (sic!) test failed. */ return 0; } /*** <<< CODE [Utf8-4] >>> ***/ int Utf8_4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const UTF8String_t *st = (const UTF8String_t *)sptr; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(!check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using UTF8String, * so here we adjust the DEF accordingly. */ static void Utf8_4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_UTF8String.free_struct; td->print_struct = asn_DEF_UTF8String.print_struct; td->check_constraints = asn_DEF_UTF8String.check_constraints; td->ber_decoder = asn_DEF_UTF8String.ber_decoder; td->der_encoder = asn_DEF_UTF8String.der_encoder; td->xer_decoder = asn_DEF_UTF8String.xer_decoder; td->xer_encoder = asn_DEF_UTF8String.xer_encoder; td->uper_decoder = asn_DEF_UTF8String.uper_decoder; td->uper_encoder = asn_DEF_UTF8String.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_UTF8String.per_constraints; td->elements = asn_DEF_UTF8String.elements; td->elements_count = asn_DEF_UTF8String.elements_count; td->specifics = asn_DEF_UTF8String.specifics; } void Utf8_4_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Utf8_4_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Utf8_4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Utf8_4_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Utf8_4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Utf8_4_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Utf8_4_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Utf8_4_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Utf8_4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Utf8_4_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Utf8_4_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Utf8_4_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t Utf8_4_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { Utf8_4_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t Utf8_4_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { Utf8_4_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } /*** <<< CTDEFS [Utf8-4] >>> ***/ static asn_per_constraints_t asn_PER_type_Utf8_4_constr_1 GCC_NOTUSED = { { APC_UNCONSTRAINED, -1, -1, 0, 0 }, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; /*** <<< STAT-DEFS [Utf8-4] >>> ***/ static const ber_tlv_tag_t asn_DEF_Utf8_4_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Utf8_4 = { "Utf8-4", "Utf8-4", Utf8_4_free, Utf8_4_print, Utf8_4_constraint, Utf8_4_decode_ber, Utf8_4_encode_der, Utf8_4_decode_xer, Utf8_4_encode_xer, Utf8_4_decode_uper, Utf8_4_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Utf8_4_tags_1, sizeof(asn_DEF_Utf8_4_tags_1) /sizeof(asn_DEF_Utf8_4_tags_1[0]), /* 1 */ asn_DEF_Utf8_4_tags_1, /* Same as above */ sizeof(asn_DEF_Utf8_4_tags_1) /sizeof(asn_DEF_Utf8_4_tags_1[0]), /* 1 */ &asn_PER_type_Utf8_4_constr_1, 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [Utf8-3] >>> ***/ #include "Utf8-2.h" /*** <<< TYPE-DECLS [Utf8-3] >>> ***/ typedef Utf8_2_t Utf8_3_t; /*** <<< FUNC-DECLS [Utf8-3] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Utf8_3; asn_struct_free_f Utf8_3_free; asn_struct_print_f Utf8_3_print; asn_constr_check_f Utf8_3_constraint; ber_type_decoder_f Utf8_3_decode_ber; der_type_encoder_f Utf8_3_encode_der; xer_type_decoder_f Utf8_3_decode_xer; xer_type_encoder_f Utf8_3_encode_xer; per_type_decoder_f Utf8_3_decode_uper; per_type_encoder_f Utf8_3_encode_uper; /*** <<< CTABLES [Utf8-3] >>> ***/ static const int permitted_alphabet_table_1[128] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15, /* ABCDEFGHIJKLMNO */ 16,17,18,19,20,21,22,23,24,25,26, 0, 0, 0, 0, 0, /* PQRSTUVWXYZ */ 0,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41, /* abcdefghijklmno */ 42,43,44,45,46,47,48,49,50,51,52, 0, 0, 0, 0, 0, /* pqrstuvwxyz */ }; static int check_permitted_alphabet_1(const void *sptr) { const int *table = permitted_alphabet_table_1; /* The underlying type is UTF8String */ const UTF8String_t *st = (const UTF8String_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(cv >= 0x80) return -1; if(!table[cv]) return -1; } return 0; } /*** <<< CODE [Utf8-3] >>> ***/ int Utf8_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Utf8_2_t *st = (const Utf8_2_t *)sptr; size_t size; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } size = UTF8String_length(st); if((ssize_t)size < 0) { ASN__CTFAIL(app_key, td, sptr, "%s: UTF-8: broken encoding (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if((size >= 1 && size <= 2) && !check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using Utf8_2, * so here we adjust the DEF accordingly. */ static void Utf8_3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_Utf8_2.free_struct; td->print_struct = asn_DEF_Utf8_2.print_struct; td->check_constraints = asn_DEF_Utf8_2.check_constraints; td->ber_decoder = asn_DEF_Utf8_2.ber_decoder; td->der_encoder = asn_DEF_Utf8_2.der_encoder; td->xer_decoder = asn_DEF_Utf8_2.xer_decoder; td->xer_encoder = asn_DEF_Utf8_2.xer_encoder; td->uper_decoder = asn_DEF_Utf8_2.uper_decoder; td->uper_encoder = asn_DEF_Utf8_2.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Utf8_2.per_constraints; td->elements = asn_DEF_Utf8_2.elements; td->elements_count = asn_DEF_Utf8_2.elements_count; td->specifics = asn_DEF_Utf8_2.specifics; } void Utf8_3_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Utf8_3_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Utf8_3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Utf8_3_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Utf8_3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Utf8_3_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Utf8_3_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Utf8_3_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Utf8_3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Utf8_3_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Utf8_3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Utf8_3_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t Utf8_3_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { Utf8_3_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t Utf8_3_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { Utf8_3_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } /*** <<< CTDEFS [Utf8-3] >>> ***/ static asn_per_constraints_t asn_PER_type_Utf8_3_constr_1 GCC_NOTUSED = { { APC_UNCONSTRAINED, -1, -1, 0, 0 }, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; /*** <<< STAT-DEFS [Utf8-3] >>> ***/ static const ber_tlv_tag_t asn_DEF_Utf8_3_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Utf8_3 = { "Utf8-3", "Utf8-3", Utf8_3_free, Utf8_3_print, Utf8_3_constraint, Utf8_3_decode_ber, Utf8_3_encode_der, Utf8_3_decode_xer, Utf8_3_encode_xer, Utf8_3_decode_uper, Utf8_3_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Utf8_3_tags_1, sizeof(asn_DEF_Utf8_3_tags_1) /sizeof(asn_DEF_Utf8_3_tags_1[0]), /* 1 */ asn_DEF_Utf8_3_tags_1, /* Same as above */ sizeof(asn_DEF_Utf8_3_tags_1) /sizeof(asn_DEF_Utf8_3_tags_1[0]), /* 1 */ &asn_PER_type_Utf8_3_constr_1, 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [Utf8-2] >>> ***/ #include "Utf8-1.h" /*** <<< TYPE-DECLS [Utf8-2] >>> ***/ typedef Utf8_1_t Utf8_2_t; /*** <<< FUNC-DECLS [Utf8-2] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Utf8_2; asn_struct_free_f Utf8_2_free; asn_struct_print_f Utf8_2_print; asn_constr_check_f Utf8_2_constraint; ber_type_decoder_f Utf8_2_decode_ber; der_type_encoder_f Utf8_2_encode_der; xer_type_decoder_f Utf8_2_decode_xer; xer_type_encoder_f Utf8_2_encode_xer; per_type_decoder_f Utf8_2_decode_uper; per_type_encoder_f Utf8_2_encode_uper; /*** <<< CODE [Utf8-2] >>> ***/ int Utf8_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Utf8_1_t *st = (const Utf8_1_t *)sptr; size_t size; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } size = UTF8String_length(st); if((ssize_t)size < 0) { ASN__CTFAIL(app_key, td, sptr, "%s: UTF-8: broken encoding (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if((size >= 1 && size <= 2)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using Utf8_1, * so here we adjust the DEF accordingly. */ static void Utf8_2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_Utf8_1.free_struct; td->print_struct = asn_DEF_Utf8_1.print_struct; td->check_constraints = asn_DEF_Utf8_1.check_constraints; td->ber_decoder = asn_DEF_Utf8_1.ber_decoder; td->der_encoder = asn_DEF_Utf8_1.der_encoder; td->xer_decoder = asn_DEF_Utf8_1.xer_decoder; td->xer_encoder = asn_DEF_Utf8_1.xer_encoder; td->uper_decoder = asn_DEF_Utf8_1.uper_decoder; td->uper_encoder = asn_DEF_Utf8_1.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Utf8_1.per_constraints; td->elements = asn_DEF_Utf8_1.elements; td->elements_count = asn_DEF_Utf8_1.elements_count; td->specifics = asn_DEF_Utf8_1.specifics; } void Utf8_2_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Utf8_2_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Utf8_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Utf8_2_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Utf8_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Utf8_2_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Utf8_2_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Utf8_2_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Utf8_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Utf8_2_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Utf8_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Utf8_2_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t Utf8_2_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { Utf8_2_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t Utf8_2_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { Utf8_2_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } /*** <<< CTDEFS [Utf8-2] >>> ***/ static asn_per_constraints_t asn_PER_type_Utf8_2_constr_1 GCC_NOTUSED = { { APC_UNCONSTRAINED, -1, -1, 0, 0 }, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; /*** <<< STAT-DEFS [Utf8-2] >>> ***/ static const ber_tlv_tag_t asn_DEF_Utf8_2_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Utf8_2 = { "Utf8-2", "Utf8-2", Utf8_2_free, Utf8_2_print, Utf8_2_constraint, Utf8_2_decode_ber, Utf8_2_encode_der, Utf8_2_decode_xer, Utf8_2_encode_xer, Utf8_2_decode_uper, Utf8_2_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Utf8_2_tags_1, sizeof(asn_DEF_Utf8_2_tags_1) /sizeof(asn_DEF_Utf8_2_tags_1[0]), /* 1 */ asn_DEF_Utf8_2_tags_1, /* Same as above */ sizeof(asn_DEF_Utf8_2_tags_1) /sizeof(asn_DEF_Utf8_2_tags_1[0]), /* 1 */ &asn_PER_type_Utf8_2_constr_1, 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [Utf8-1] >>> ***/ #include /*** <<< TYPE-DECLS [Utf8-1] >>> ***/ typedef UTF8String_t Utf8_1_t; /*** <<< FUNC-DECLS [Utf8-1] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Utf8_1; asn_struct_free_f Utf8_1_free; asn_struct_print_f Utf8_1_print; asn_constr_check_f Utf8_1_constraint; ber_type_decoder_f Utf8_1_decode_ber; der_type_encoder_f Utf8_1_encode_der; xer_type_decoder_f Utf8_1_decode_xer; xer_type_encoder_f Utf8_1_encode_xer; per_type_decoder_f Utf8_1_decode_uper; per_type_encoder_f Utf8_1_encode_uper; /*** <<< CODE [Utf8-1] >>> ***/ int Utf8_1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_UTF8String.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using UTF8String, * so here we adjust the DEF accordingly. */ static void Utf8_1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_UTF8String.free_struct; td->print_struct = asn_DEF_UTF8String.print_struct; td->check_constraints = asn_DEF_UTF8String.check_constraints; td->ber_decoder = asn_DEF_UTF8String.ber_decoder; td->der_encoder = asn_DEF_UTF8String.der_encoder; td->xer_decoder = asn_DEF_UTF8String.xer_decoder; td->xer_encoder = asn_DEF_UTF8String.xer_encoder; td->uper_decoder = asn_DEF_UTF8String.uper_decoder; td->uper_encoder = asn_DEF_UTF8String.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_UTF8String.per_constraints; td->elements = asn_DEF_UTF8String.elements; td->elements_count = asn_DEF_UTF8String.elements_count; td->specifics = asn_DEF_UTF8String.specifics; } void Utf8_1_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Utf8_1_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Utf8_1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Utf8_1_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Utf8_1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Utf8_1_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Utf8_1_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Utf8_1_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Utf8_1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Utf8_1_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Utf8_1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Utf8_1_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t Utf8_1_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { Utf8_1_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t Utf8_1_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { Utf8_1_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } /*** <<< STAT-DEFS [Utf8-1] >>> ***/ static const ber_tlv_tag_t asn_DEF_Utf8_1_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Utf8_1 = { "Utf8-1", "Utf8-1", Utf8_1_free, Utf8_1_print, Utf8_1_constraint, Utf8_1_decode_ber, Utf8_1_encode_der, Utf8_1_decode_xer, Utf8_1_encode_xer, Utf8_1_decode_uper, Utf8_1_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Utf8_1_tags_1, sizeof(asn_DEF_Utf8_1_tags_1) /sizeof(asn_DEF_Utf8_1_tags_1[0]), /* 1 */ asn_DEF_Utf8_1_tags_1, /* Same as above */ sizeof(asn_DEF_Utf8_1_tags_1) /sizeof(asn_DEF_Utf8_1_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [VisibleIdentifier] >>> ***/ #include "Identifier.h" /*** <<< TYPE-DECLS [VisibleIdentifier] >>> ***/ typedef Identifier_t VisibleIdentifier_t; /*** <<< FUNC-DECLS [VisibleIdentifier] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_VisibleIdentifier; asn_struct_free_f VisibleIdentifier_free; asn_struct_print_f VisibleIdentifier_print; asn_constr_check_f VisibleIdentifier_constraint; ber_type_decoder_f VisibleIdentifier_decode_ber; der_type_encoder_f VisibleIdentifier_encode_der; xer_type_decoder_f VisibleIdentifier_decode_xer; xer_type_encoder_f VisibleIdentifier_encode_xer; per_type_decoder_f VisibleIdentifier_decode_uper; per_type_encoder_f VisibleIdentifier_encode_uper; /*** <<< CTABLES [VisibleIdentifier] >>> ***/ static const int permitted_alphabet_table_1[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* $ */ 2, 3, 4, 5, 6, 7, 8, 9,10,11, 0, 0, 0, 0, 0, 0, /* 0123456789 */ 0,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26, /* ABCDEFGHIJKLMNO */ 27,28,29,30,31,32,33,34,35,36,37, 0, 0, 0, 0,38, /* PQRSTUVWXYZ _ */ 0,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53, /* abcdefghijklmno */ 54,55,56,57,58,59,60,61,62,63,64, 0, 0, 0, 0, 0, /* pqrstuvwxyz */ }; static const int permitted_alphabet_code2value_1[64] = { 36,48,49,50,51,52,53,54,55,56,57,65,66,67,68,69, 70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85, 86,87,88,89,90,95,97,98,99,100,101,102,103,104,105,106, 107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122, }; static int check_permitted_alphabet_1(const void *sptr) { const int *table = permitted_alphabet_table_1; /* The underlying type is VisibleString */ const VisibleString_t *st = (const VisibleString_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(!table[cv]) return -1; } return 0; } /*** <<< CODE [VisibleIdentifier] >>> ***/ int VisibleIdentifier_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Identifier_t *st = (const Identifier_t *)sptr; size_t size; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } size = st->size; if((size >= 1 && size <= 32) && !check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using Identifier, * so here we adjust the DEF accordingly. */ static void VisibleIdentifier_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_Identifier.free_struct; td->print_struct = asn_DEF_Identifier.print_struct; td->check_constraints = asn_DEF_Identifier.check_constraints; td->ber_decoder = asn_DEF_Identifier.ber_decoder; td->der_encoder = asn_DEF_Identifier.der_encoder; td->xer_decoder = asn_DEF_Identifier.xer_decoder; td->xer_encoder = asn_DEF_Identifier.xer_encoder; td->uper_decoder = asn_DEF_Identifier.uper_decoder; td->uper_encoder = asn_DEF_Identifier.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Identifier.per_constraints; td->elements = asn_DEF_Identifier.elements; td->elements_count = asn_DEF_Identifier.elements_count; td->specifics = asn_DEF_Identifier.specifics; } void VisibleIdentifier_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { VisibleIdentifier_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int VisibleIdentifier_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { VisibleIdentifier_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t VisibleIdentifier_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { VisibleIdentifier_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t VisibleIdentifier_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { VisibleIdentifier_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t VisibleIdentifier_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { VisibleIdentifier_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t VisibleIdentifier_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { VisibleIdentifier_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t VisibleIdentifier_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { VisibleIdentifier_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t VisibleIdentifier_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { VisibleIdentifier_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } /*** <<< STAT-DEFS [VisibleIdentifier] >>> ***/ static const ber_tlv_tag_t asn_DEF_VisibleIdentifier_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (26 << 2)) }; asn_TYPE_descriptor_t asn_DEF_VisibleIdentifier = { "VisibleIdentifier", "VisibleIdentifier", VisibleIdentifier_free, VisibleIdentifier_print, VisibleIdentifier_constraint, VisibleIdentifier_decode_ber, VisibleIdentifier_encode_der, VisibleIdentifier_decode_xer, VisibleIdentifier_encode_xer, VisibleIdentifier_decode_uper, VisibleIdentifier_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_VisibleIdentifier_tags_1, sizeof(asn_DEF_VisibleIdentifier_tags_1) /sizeof(asn_DEF_VisibleIdentifier_tags_1[0]), /* 1 */ asn_DEF_VisibleIdentifier_tags_1, /* Same as above */ sizeof(asn_DEF_VisibleIdentifier_tags_1) /sizeof(asn_DEF_VisibleIdentifier_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [Sequence] >>> ***/ #include "Int1.h" #include "Int4.h" #include #include #include #include "Int5.h" #include /*** <<< DEPS [Sequence] >>> ***/ typedef enum enum_c { enum_c_one = 1, enum_c_two = 2, /* * Enumeration is extensible */ enum_c_three = 3 } e_enum_c; /*** <<< TYPE-DECLS [Sequence] >>> ***/ typedef struct Sequence { Int1_t *int1_c /* DEFAULT 3 */; Int4_t int4; Int4_t int4_c; BOOLEAN_t *Bool /* DEFAULT 1 */; long enum_c; NULL_t *null /* OPTIONAL */; /* * This type is extensible, * possible extensions are below. */ Int5_t *int5_c /* OPTIONAL */; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Sequence_t; /*** <<< FUNC-DECLS [Sequence] >>> ***/ /* extern asn_TYPE_descriptor_t asn_DEF_enum_c_6; // (Use -fall-defs-global to expose) */ extern asn_TYPE_descriptor_t asn_DEF_Sequence; /*** <<< CODE [Sequence] >>> ***/ static int enum_c_6_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using NativeEnumerated, * so here we adjust the DEF accordingly. */ static void enum_c_6_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeEnumerated.free_struct; td->print_struct = asn_DEF_NativeEnumerated.print_struct; td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; td->ber_decoder = asn_DEF_NativeEnumerated.ber_decoder; td->der_encoder = asn_DEF_NativeEnumerated.der_encoder; td->xer_decoder = asn_DEF_NativeEnumerated.xer_decoder; td->xer_encoder = asn_DEF_NativeEnumerated.xer_encoder; td->uper_decoder = asn_DEF_NativeEnumerated.uper_decoder; td->uper_encoder = asn_DEF_NativeEnumerated.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeEnumerated.per_constraints; td->elements = asn_DEF_NativeEnumerated.elements; td->elements_count = asn_DEF_NativeEnumerated.elements_count; /* td->specifics = asn_DEF_NativeEnumerated.specifics; // Defined explicitly */ } static void enum_c_6_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { enum_c_6_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } static int enum_c_6_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { enum_c_6_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } static asn_dec_rval_t enum_c_6_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { enum_c_6_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } static asn_enc_rval_t enum_c_6_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { enum_c_6_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } static asn_dec_rval_t enum_c_6_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { enum_c_6_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } static asn_enc_rval_t enum_c_6_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { enum_c_6_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } static asn_dec_rval_t enum_c_6_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { enum_c_6_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } static asn_enc_rval_t enum_c_6_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { enum_c_6_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static int memb_int1_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if((value >= -2)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } static int memb_int4_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if((value >= 5 && value <= 7)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } static int memb_int5_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if((value == 5)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /*** <<< CTDEFS [Sequence] >>> ***/ static asn_per_constraints_t asn_PER_type_enum_c_constr_6 GCC_NOTUSED = { { APC_CONSTRAINED | APC_EXTENSIBLE, 1, 1, 0, 1 } /* (0..1,...) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; static asn_per_constraints_t asn_PER_memb_int1_c_constr_2 GCC_NOTUSED = { { APC_SEMI_CONSTRAINED, -1, -1, -2, 0 } /* (-2..MAX) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; static asn_per_constraints_t asn_PER_memb_int4_c_constr_4 GCC_NOTUSED = { { APC_CONSTRAINED, 2, 2, 5, 7 } /* (5..7) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; static asn_per_constraints_t asn_PER_memb_int5_c_constr_13 GCC_NOTUSED = { { APC_CONSTRAINED, 0, 0, 5, 5 } /* (5..5) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; /*** <<< STAT-DEFS [Sequence] >>> ***/ static int asn_DFL_2_set_3(int set_value, void **sptr) { Int1_t *st = *sptr; if(!st) { if(!set_value) return -1; /* Not a default value */ st = (*sptr = CALLOC(1, sizeof(*st))); if(!st) return -1; } if(set_value) { /* Install default value 3 */ *st = 3; return 0; } else { /* Test default value 3 */ return (*st == 3); } } static int asn_DFL_5_set_1(int set_value, void **sptr) { BOOLEAN_t *st = *sptr; if(!st) { if(!set_value) return -1; /* Not a default value */ st = (*sptr = CALLOC(1, sizeof(*st))); if(!st) return -1; } if(set_value) { /* Install default value 1 */ *st = 1; return 0; } else { /* Test default value 1 */ return (*st == 1); } } static const asn_INTEGER_enum_map_t asn_MAP_enum_c_value2enum_6[] = { { 1, 3, "one" }, { 2, 3, "two" }, { 3, 5, "three" } /* This list is extensible */ }; static const unsigned int asn_MAP_enum_c_enum2value_6[] = { 0, /* one(1) */ 2, /* three(3) */ 1 /* two(2) */ /* This list is extensible */ }; static const asn_INTEGER_specifics_t asn_SPC_enum_c_specs_6 = { asn_MAP_enum_c_value2enum_6, /* "tag" => N; sorted by tag */ asn_MAP_enum_c_enum2value_6, /* N => "tag"; sorted by N */ 3, /* Number of elements in the maps */ 3, /* Extensions before this member */ 1, /* Strict enumeration */ 0, /* Native long size */ 0 }; static const ber_tlv_tag_t asn_DEF_enum_c_tags_6[] = { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_enum_c_6 = { "enum-c", "enum-c", enum_c_6_free, enum_c_6_print, enum_c_6_constraint, enum_c_6_decode_ber, enum_c_6_encode_der, enum_c_6_decode_xer, enum_c_6_encode_xer, enum_c_6_decode_uper, enum_c_6_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_enum_c_tags_6, sizeof(asn_DEF_enum_c_tags_6) /sizeof(asn_DEF_enum_c_tags_6[0]), /* 1 */ asn_DEF_enum_c_tags_6, /* Same as above */ sizeof(asn_DEF_enum_c_tags_6) /sizeof(asn_DEF_enum_c_tags_6[0]), /* 1 */ &asn_PER_type_enum_c_constr_6, 0, 0, /* Defined elsewhere */ &asn_SPC_enum_c_specs_6 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_Sequence_1[] = { { ATF_POINTER, 1, offsetof(struct Sequence, int1_c), .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), .tag_mode = 0, .type = &asn_DEF_Int1, .memb_constraints = memb_int1_c_constraint_1, .per_constraints = &asn_PER_memb_int1_c_constr_2, .default_value = asn_DFL_2_set_3, /* DEFAULT 3 */ .name = "int1-c" }, { ATF_NOFLAGS, 0, offsetof(struct Sequence, int4), .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), .tag_mode = +1, /* EXPLICIT tag at current level */ .type = &asn_DEF_Int4, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* No PER visible constraints */ .default_value = 0, .name = "int4" }, { ATF_NOFLAGS, 0, offsetof(struct Sequence, int4_c), .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), .tag_mode = 0, .type = &asn_DEF_Int4, .memb_constraints = memb_int4_c_constraint_1, .per_constraints = &asn_PER_memb_int4_c_constr_4, .default_value = 0, .name = "int4-c" }, { ATF_POINTER, 1, offsetof(struct Sequence, Bool), .tag = (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)), .tag_mode = 0, .type = &asn_DEF_BOOLEAN, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* No PER visible constraints */ .default_value = asn_DFL_5_set_1, /* DEFAULT 1 */ .name = "bool" }, { ATF_NOFLAGS, 0, offsetof(struct Sequence, enum_c), .tag = (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), .tag_mode = 0, .type = &asn_DEF_enum_c_6, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* No PER visible constraints */ .default_value = 0, .name = "enum-c" }, { ATF_POINTER, 2, offsetof(struct Sequence, null), .tag = (ASN_TAG_CLASS_UNIVERSAL | (5 << 2)), .tag_mode = 0, .type = &asn_DEF_NULL, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* No PER visible constraints */ .default_value = 0, .name = "null" }, { ATF_POINTER, 1, offsetof(struct Sequence, int5_c), .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), .tag_mode = 0, .type = &asn_DEF_Int5, .memb_constraints = memb_int5_c_constraint_1, .per_constraints = &asn_PER_memb_int5_c_constr_13, .default_value = 0, .name = "int5-c" }, }; static const int asn_MAP_Sequence_oms_1[] = { 0, 3, 5, 6 }; static const ber_tlv_tag_t asn_DEF_Sequence_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_Sequence_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)), 3, 0, 0 }, /* bool */ { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 2 }, /* int1-c */ { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 2, -1, 1 }, /* int4-c */ { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 6, -2, 0 }, /* int5-c */ { (ASN_TAG_CLASS_UNIVERSAL | (5 << 2)), 5, 0, 0 }, /* null */ { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 4, 0, 0 }, /* enum-c */ { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 1, 0, 0 } /* int4 */ }; static asn_SEQUENCE_specifics_t asn_SPC_Sequence_specs_1 = { sizeof(struct Sequence), offsetof(struct Sequence, _asn_ctx), asn_MAP_Sequence_tag2el_1, 7, /* Count of tags in the map */ asn_MAP_Sequence_oms_1, /* Optional members */ 3, 1, /* Root/Additions */ 5, /* Start extensions */ 8 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Sequence = { "Sequence", "Sequence", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Sequence_tags_1, sizeof(asn_DEF_Sequence_tags_1) /sizeof(asn_DEF_Sequence_tags_1[0]), /* 1 */ asn_DEF_Sequence_tags_1, /* Same as above */ sizeof(asn_DEF_Sequence_tags_1) /sizeof(asn_DEF_Sequence_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Sequence_1, 7, /* Elements count */ &asn_SPC_Sequence_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [SequenceOf] >>> ***/ #include #include /*** <<< FWD-DECLS [SequenceOf] >>> ***/ struct Sequence; /*** <<< TYPE-DECLS [SequenceOf] >>> ***/ typedef struct SequenceOf { A_SEQUENCE_OF(struct Sequence) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } SequenceOf_t; /*** <<< FUNC-DECLS [SequenceOf] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_SequenceOf; /*** <<< POST-INCLUDE [SequenceOf] >>> ***/ #include "Sequence.h" /*** <<< CTDEFS [SequenceOf] >>> ***/ static asn_per_constraints_t asn_PER_type_SequenceOf_constr_1 GCC_NOTUSED = { { APC_UNCONSTRAINED, -1, -1, 0, 0 }, { APC_CONSTRAINED, 1, 1, 1, 2 } /* (SIZE(1..2)) */, 0, 0 /* No PER value map */ }; /*** <<< STAT-DEFS [SequenceOf] >>> ***/ static asn_TYPE_member_t asn_MBR_SequenceOf_1[] = { { ATF_POINTER, 0, 0, .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), .tag_mode = 0, .type = &asn_DEF_Sequence, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* No PER visible constraints */ .default_value = 0, .name = "" }, }; static const ber_tlv_tag_t asn_DEF_SequenceOf_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_SequenceOf_specs_1 = { sizeof(struct SequenceOf), offsetof(struct SequenceOf, _asn_ctx), 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_SequenceOf = { "SequenceOf", "SequenceOf", SEQUENCE_OF_free, SEQUENCE_OF_print, SEQUENCE_OF_constraint, SEQUENCE_OF_decode_ber, SEQUENCE_OF_encode_der, SEQUENCE_OF_decode_xer, SEQUENCE_OF_encode_xer, SEQUENCE_OF_decode_uper, SEQUENCE_OF_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_SequenceOf_tags_1, sizeof(asn_DEF_SequenceOf_tags_1) /sizeof(asn_DEF_SequenceOf_tags_1[0]), /* 1 */ asn_DEF_SequenceOf_tags_1, /* Same as above */ sizeof(asn_DEF_SequenceOf_tags_1) /sizeof(asn_DEF_SequenceOf_tags_1[0]), /* 1 */ &asn_PER_type_SequenceOf_constr_1, asn_MBR_SequenceOf_1, 1, /* Single element */ &asn_SPC_SequenceOf_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Enum0] >>> ***/ #include /*** <<< DEPS [Enum0] >>> ***/ typedef enum Enum0 { Enum0_one = 0, Enum0_two = 1 } e_Enum0; /*** <<< TYPE-DECLS [Enum0] >>> ***/ typedef long Enum0_t; /*** <<< FUNC-DECLS [Enum0] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Enum0; asn_struct_free_f Enum0_free; asn_struct_print_f Enum0_print; asn_constr_check_f Enum0_constraint; ber_type_decoder_f Enum0_decode_ber; der_type_encoder_f Enum0_encode_der; xer_type_decoder_f Enum0_decode_xer; xer_type_encoder_f Enum0_encode_xer; per_type_decoder_f Enum0_decode_uper; per_type_encoder_f Enum0_encode_uper; /*** <<< CODE [Enum0] >>> ***/ int Enum0_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using NativeEnumerated, * so here we adjust the DEF accordingly. */ static void Enum0_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeEnumerated.free_struct; td->print_struct = asn_DEF_NativeEnumerated.print_struct; td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; td->ber_decoder = asn_DEF_NativeEnumerated.ber_decoder; td->der_encoder = asn_DEF_NativeEnumerated.der_encoder; td->xer_decoder = asn_DEF_NativeEnumerated.xer_decoder; td->xer_encoder = asn_DEF_NativeEnumerated.xer_encoder; td->uper_decoder = asn_DEF_NativeEnumerated.uper_decoder; td->uper_encoder = asn_DEF_NativeEnumerated.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeEnumerated.per_constraints; td->elements = asn_DEF_NativeEnumerated.elements; td->elements_count = asn_DEF_NativeEnumerated.elements_count; /* td->specifics = asn_DEF_NativeEnumerated.specifics; // Defined explicitly */ } void Enum0_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Enum0_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Enum0_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Enum0_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Enum0_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Enum0_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Enum0_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Enum0_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Enum0_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Enum0_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Enum0_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Enum0_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t Enum0_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { Enum0_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t Enum0_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { Enum0_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } /*** <<< CTDEFS [Enum0] >>> ***/ static asn_per_constraints_t asn_PER_type_Enum0_constr_1 GCC_NOTUSED = { { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; /*** <<< STAT-DEFS [Enum0] >>> ***/ static const asn_INTEGER_enum_map_t asn_MAP_Enum0_value2enum_1[] = { { 0, 3, "one" }, { 1, 3, "two" } }; static const unsigned int asn_MAP_Enum0_enum2value_1[] = { 0, /* one(0) */ 1 /* two(1) */ }; static const asn_INTEGER_specifics_t asn_SPC_Enum0_specs_1 = { asn_MAP_Enum0_value2enum_1, /* "tag" => N; sorted by tag */ asn_MAP_Enum0_enum2value_1, /* N => "tag"; sorted by N */ 2, /* Number of elements in the maps */ 0, /* Enumeration is not extensible */ 1, /* Strict enumeration */ 0, /* Native long size */ 0 }; static const ber_tlv_tag_t asn_DEF_Enum0_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Enum0 = { "Enum0", "Enum0", Enum0_free, Enum0_print, Enum0_constraint, Enum0_decode_ber, Enum0_encode_der, Enum0_decode_xer, Enum0_encode_xer, Enum0_decode_uper, Enum0_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Enum0_tags_1, sizeof(asn_DEF_Enum0_tags_1) /sizeof(asn_DEF_Enum0_tags_1[0]), /* 1 */ asn_DEF_Enum0_tags_1, /* Same as above */ sizeof(asn_DEF_Enum0_tags_1) /sizeof(asn_DEF_Enum0_tags_1[0]), /* 1 */ &asn_PER_type_Enum0_constr_1, 0, 0, /* Defined elsewhere */ &asn_SPC_Enum0_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Enum1] >>> ***/ #include /*** <<< DEPS [Enum1] >>> ***/ typedef enum Enum1 { Enum1_one = 0, Enum1_two = 1 } e_Enum1; /*** <<< TYPE-DECLS [Enum1] >>> ***/ typedef long Enum1_t; /*** <<< FUNC-DECLS [Enum1] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Enum1; asn_struct_free_f Enum1_free; asn_struct_print_f Enum1_print; asn_constr_check_f Enum1_constraint; ber_type_decoder_f Enum1_decode_ber; der_type_encoder_f Enum1_encode_der; xer_type_decoder_f Enum1_decode_xer; xer_type_encoder_f Enum1_encode_xer; per_type_decoder_f Enum1_decode_uper; per_type_encoder_f Enum1_encode_uper; /*** <<< CODE [Enum1] >>> ***/ int Enum1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if((value == 0)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using NativeEnumerated, * so here we adjust the DEF accordingly. */ static void Enum1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeEnumerated.free_struct; td->print_struct = asn_DEF_NativeEnumerated.print_struct; td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; td->ber_decoder = asn_DEF_NativeEnumerated.ber_decoder; td->der_encoder = asn_DEF_NativeEnumerated.der_encoder; td->xer_decoder = asn_DEF_NativeEnumerated.xer_decoder; td->xer_encoder = asn_DEF_NativeEnumerated.xer_encoder; td->uper_decoder = asn_DEF_NativeEnumerated.uper_decoder; td->uper_encoder = asn_DEF_NativeEnumerated.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeEnumerated.per_constraints; td->elements = asn_DEF_NativeEnumerated.elements; td->elements_count = asn_DEF_NativeEnumerated.elements_count; /* td->specifics = asn_DEF_NativeEnumerated.specifics; // Defined explicitly */ } void Enum1_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Enum1_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Enum1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Enum1_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Enum1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Enum1_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Enum1_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Enum1_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Enum1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Enum1_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Enum1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Enum1_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t Enum1_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { Enum1_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t Enum1_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { Enum1_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } /*** <<< CTDEFS [Enum1] >>> ***/ static asn_per_constraints_t asn_PER_type_Enum1_constr_1 GCC_NOTUSED = { { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; /*** <<< STAT-DEFS [Enum1] >>> ***/ static const asn_INTEGER_enum_map_t asn_MAP_Enum1_value2enum_1[] = { { 0, 3, "one" }, { 1, 3, "two" } }; static const unsigned int asn_MAP_Enum1_enum2value_1[] = { 0, /* one(0) */ 1 /* two(1) */ }; static const asn_INTEGER_specifics_t asn_SPC_Enum1_specs_1 = { asn_MAP_Enum1_value2enum_1, /* "tag" => N; sorted by tag */ asn_MAP_Enum1_enum2value_1, /* N => "tag"; sorted by N */ 2, /* Number of elements in the maps */ 0, /* Enumeration is not extensible */ 1, /* Strict enumeration */ 0, /* Native long size */ 0 }; static const ber_tlv_tag_t asn_DEF_Enum1_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Enum1 = { "Enum1", "Enum1", Enum1_free, Enum1_print, Enum1_constraint, Enum1_decode_ber, Enum1_encode_der, Enum1_decode_xer, Enum1_encode_xer, Enum1_decode_uper, Enum1_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Enum1_tags_1, sizeof(asn_DEF_Enum1_tags_1) /sizeof(asn_DEF_Enum1_tags_1[0]), /* 1 */ asn_DEF_Enum1_tags_1, /* Same as above */ sizeof(asn_DEF_Enum1_tags_1) /sizeof(asn_DEF_Enum1_tags_1[0]), /* 1 */ &asn_PER_type_Enum1_constr_1, 0, 0, /* Defined elsewhere */ &asn_SPC_Enum1_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Identifier] >>> ***/ #include /*** <<< TYPE-DECLS [Identifier] >>> ***/ typedef VisibleString_t Identifier_t; /*** <<< FUNC-DECLS [Identifier] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Identifier; asn_struct_free_f Identifier_free; asn_struct_print_f Identifier_print; asn_constr_check_f Identifier_constraint; ber_type_decoder_f Identifier_decode_ber; der_type_encoder_f Identifier_encode_der; xer_type_decoder_f Identifier_decode_xer; xer_type_encoder_f Identifier_encode_xer; per_type_decoder_f Identifier_decode_uper; per_type_encoder_f Identifier_encode_uper; /*** <<< CTABLES [Identifier] >>> ***/ static const int permitted_alphabet_table_1[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* $ */ 2, 3, 4, 5, 6, 7, 8, 9,10,11, 0, 0, 0, 0, 0, 0, /* 0123456789 */ 0,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26, /* ABCDEFGHIJKLMNO */ 27,28,29,30,31,32,33,34,35,36,37, 0, 0, 0, 0,38, /* PQRSTUVWXYZ _ */ 0,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53, /* abcdefghijklmno */ 54,55,56,57,58,59,60,61,62,63,64, 0, 0, 0, 0, 0, /* pqrstuvwxyz */ }; static const int permitted_alphabet_code2value_1[64] = { 36,48,49,50,51,52,53,54,55,56,57,65,66,67,68,69, 70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85, 86,87,88,89,90,95,97,98,99,100,101,102,103,104,105,106, 107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122, }; static int check_permitted_alphabet_1(const void *sptr) { const int *table = permitted_alphabet_table_1; /* The underlying type is VisibleString */ const VisibleString_t *st = (const VisibleString_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(!table[cv]) return -1; } return 0; } /*** <<< CODE [Identifier] >>> ***/ int Identifier_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const VisibleString_t *st = (const VisibleString_t *)sptr; size_t size; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } size = st->size; if((size >= 1 && size <= 32) && !check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } static int asn_PER_MAP_Identifier_1_v2c(unsigned int value) { if(value >= sizeof(permitted_alphabet_table_1)/sizeof(permitted_alphabet_table_1[0])) return -1; return permitted_alphabet_table_1[value] - 1; } static int asn_PER_MAP_Identifier_1_c2v(unsigned int code) { if(code >= sizeof(permitted_alphabet_code2value_1)/sizeof(permitted_alphabet_code2value_1[0])) return -1; return permitted_alphabet_code2value_1[code]; } /* * This type is implemented using VisibleString, * so here we adjust the DEF accordingly. */ static void Identifier_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_VisibleString.free_struct; td->print_struct = asn_DEF_VisibleString.print_struct; td->check_constraints = asn_DEF_VisibleString.check_constraints; td->ber_decoder = asn_DEF_VisibleString.ber_decoder; td->der_encoder = asn_DEF_VisibleString.der_encoder; td->xer_decoder = asn_DEF_VisibleString.xer_decoder; td->xer_encoder = asn_DEF_VisibleString.xer_encoder; td->uper_decoder = asn_DEF_VisibleString.uper_decoder; td->uper_encoder = asn_DEF_VisibleString.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_VisibleString.per_constraints; td->elements = asn_DEF_VisibleString.elements; td->elements_count = asn_DEF_VisibleString.elements_count; td->specifics = asn_DEF_VisibleString.specifics; } void Identifier_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Identifier_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Identifier_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Identifier_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Identifier_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Identifier_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Identifier_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Identifier_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Identifier_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Identifier_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Identifier_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Identifier_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t Identifier_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { Identifier_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t Identifier_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { Identifier_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } /*** <<< CTDEFS [Identifier] >>> ***/ static asn_per_constraints_t asn_PER_type_Identifier_constr_1 GCC_NOTUSED = { { APC_CONSTRAINED, 6, 6, 36, 122 } /* (36..122) */, { APC_CONSTRAINED, 5, 5, 1, 32 } /* (SIZE(1..32)) */, asn_PER_MAP_Identifier_1_v2c, /* Value to PER code map */ asn_PER_MAP_Identifier_1_c2v /* PER code to value map */ }; /*** <<< STAT-DEFS [Identifier] >>> ***/ static const ber_tlv_tag_t asn_DEF_Identifier_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (26 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Identifier = { "Identifier", "Identifier", Identifier_free, Identifier_print, Identifier_constraint, Identifier_decode_ber, Identifier_encode_der, Identifier_decode_xer, Identifier_encode_xer, Identifier_decode_uper, Identifier_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Identifier_tags_1, sizeof(asn_DEF_Identifier_tags_1) /sizeof(asn_DEF_Identifier_tags_1[0]), /* 1 */ asn_DEF_Identifier_tags_1, /* Same as above */ sizeof(asn_DEF_Identifier_tags_1) /sizeof(asn_DEF_Identifier_tags_1[0]), /* 1 */ &asn_PER_type_Identifier_constr_1, 0, 0, /* No members */ 0 /* No specifics */ }; asn1c-0.9.28+dfsg/tests/37-indirect-choice-OK.asn10000644000000000000000000000134413065714043017756 0ustar rootroot -- OK: Everything is Fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .37 ModuleTestIndirectChoiceFine { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 37 } DEFINITIONS IMPLICIT TAGS ::= BEGIN T ::= CHOICE { t-a INTEGER, t-b OCTET STRING, t-c [1] Choice1, t-d [3] Choice2 } Choice1 ::= CHOICE { c-a OCTET STRING, c-b INTEGER } Choice2 ::= [2] CHOICE { c-a OCTET STRING, c-b INTEGER, c-d [3] Choice1, c-e [4] Choice1 } Choice3 ::= [3] EXPLICIT Choice2 -- tags [3] [2] Choice4 ::= [4] IMPLICIT Choice2 -- tags [4] Choice5 ::= Choice2 -- tags [2] Choice6 ::= Choice1 -- tags END asn1c-0.9.28+dfsg/tests/60-any-OK.asn1.-Pfwide-types0000644000000000000000000001453713065714043020154 0ustar rootroot /*** <<< INCLUDES [T1] >>> ***/ #include #include #include /*** <<< TYPE-DECLS [T1] >>> ***/ typedef struct T1 { INTEGER_t i; ANY_t any; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } T1_t; /*** <<< FUNC-DECLS [T1] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_T1; /*** <<< STAT-DEFS [T1] >>> ***/ static asn_TYPE_member_t asn_MBR_T1_1[] = { { ATF_NOFLAGS, 0, offsetof(struct T1, i), .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), .tag_mode = 0, .type = &asn_DEF_INTEGER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "i" }, { ATF_OPEN_TYPE | ATF_NOFLAGS, 0, offsetof(struct T1, any), .tag = -1 /* Ambiguous tag (ANY?) */, .tag_mode = 0, .type = &asn_DEF_ANY, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "any" }, }; static const ber_tlv_tag_t asn_DEF_T1_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_T1_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 } /* i */ }; static asn_SEQUENCE_specifics_t asn_SPC_T1_specs_1 = { sizeof(struct T1), offsetof(struct T1, _asn_ctx), asn_MAP_T1_tag2el_1, 1, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_T1 = { "T1", "T1", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T1_tags_1, sizeof(asn_DEF_T1_tags_1) /sizeof(asn_DEF_T1_tags_1[0]), /* 1 */ asn_DEF_T1_tags_1, /* Same as above */ sizeof(asn_DEF_T1_tags_1) /sizeof(asn_DEF_T1_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_T1_1, 2, /* Elements count */ &asn_SPC_T1_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [T2] >>> ***/ #include #include #include /*** <<< TYPE-DECLS [T2] >>> ***/ typedef struct T2 { INTEGER_t i; ANY_t *any /* OPTIONAL */; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } T2_t; /*** <<< FUNC-DECLS [T2] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_T2; /*** <<< STAT-DEFS [T2] >>> ***/ static asn_TYPE_member_t asn_MBR_T2_1[] = { { ATF_NOFLAGS, 0, offsetof(struct T2, i), .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), .tag_mode = 0, .type = &asn_DEF_INTEGER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "i" }, { ATF_POINTER, 1, offsetof(struct T2, any), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = +1, /* EXPLICIT tag at current level */ .type = &asn_DEF_ANY, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "any" }, }; static const ber_tlv_tag_t asn_DEF_T2_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_T2_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 }, /* i */ { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 1, 0, 0 } /* any */ }; static asn_SEQUENCE_specifics_t asn_SPC_T2_specs_1 = { sizeof(struct T2), offsetof(struct T2, _asn_ctx), asn_MAP_T2_tag2el_1, 2, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_T2 = { "T2", "T2", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T2_tags_1, sizeof(asn_DEF_T2_tags_1) /sizeof(asn_DEF_T2_tags_1[0]), /* 1 */ asn_DEF_T2_tags_1, /* Same as above */ sizeof(asn_DEF_T2_tags_1) /sizeof(asn_DEF_T2_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_T2_1, 2, /* Elements count */ &asn_SPC_T2_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [T3] >>> ***/ #include #include /*** <<< TYPE-DECLS [T3] >>> ***/ typedef struct T3 { ANY_t any1; ANY_t any2; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } T3_t; /*** <<< FUNC-DECLS [T3] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_T3; /*** <<< STAT-DEFS [T3] >>> ***/ static asn_TYPE_member_t asn_MBR_T3_1[] = { { ATF_OPEN_TYPE | ATF_NOFLAGS, 0, offsetof(struct T3, any1), .tag = -1 /* Ambiguous tag (ANY?) */, .tag_mode = 0, .type = &asn_DEF_ANY, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "any1" }, { ATF_OPEN_TYPE | ATF_NOFLAGS, 0, offsetof(struct T3, any2), .tag = -1 /* Ambiguous tag (ANY?) */, .tag_mode = 0, .type = &asn_DEF_ANY, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "any2" }, }; static const ber_tlv_tag_t asn_DEF_T3_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static asn_SEQUENCE_specifics_t asn_SPC_T3_specs_1 = { sizeof(struct T3), offsetof(struct T3, _asn_ctx), 0, /* No top level tags */ 0, /* No tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_T3 = { "T3", "T3", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T3_tags_1, sizeof(asn_DEF_T3_tags_1) /sizeof(asn_DEF_T3_tags_1[0]), /* 1 */ asn_DEF_T3_tags_1, /* Same as above */ sizeof(asn_DEF_T3_tags_1) /sizeof(asn_DEF_T3_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_T3_1, 2, /* Elements count */ &asn_SPC_T3_specs_1 /* Additional specs */ }; asn1c-0.9.28+dfsg/tests/86-atags-OK.asn10000644000000000000000000000076513065714043016036 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .86 ModuleAutoTags { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 86 } DEFINITIONS AUTOMATIC TAGS ::= BEGIN A ::= SEQUENCE { a INTEGER } B ::= SEQUENCE { a [0] INTEGER } C ::= SEQUENCE { a [0] IMPLICIT INTEGER } D ::= SEQUENCE { a [0] EXPLICIT INTEGER } E ::= SEQUENCE { a [0] CHOICE { b INTEGER } } END asn1c-0.9.28+dfsg/tests/88-integer-enum-OK.asn10000644000000000000000000000051013065714043017324 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .88 ModuleIntegerEnumeration { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 88 } DEFINITIONS ::= BEGIN T ::= INTEGER { a(1), b(2) } END asn1c-0.9.28+dfsg/tests/134-per-long-OK.asn10000644000000000000000000000120413065714043016521 0ustar rootroot -- OK: Everything is fine -- Also see .127 for narrower integer types. -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .134 ModulePERLong { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 134 } DEFINITIONS AUTOMATIC TAGS ::= BEGIN -- Supported only on 64-bit platforms. T ::= SEQUENCE { unsigned33 INTEGER (0..5000000000), -- range 33 bits unsigned42 INTEGER (0..3153600000000), -- range 42 bits signed33 INTEGER (-4000000000..4000000000), -- 33 bits signed33ext INTEGER (-4000000000..4000000000,...) } END asn1c-0.9.28+dfsg/tests/43-recursion-OK.asn10000644000000000000000000000131013065714043016724 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .43 ModuleRecursion { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 43 } DEFINITIONS ::= BEGIN Test-structure-1 ::= SEQUENCE { t-member1 SET OF Test-structure-1, t-member2 SEQUENCE OF Test-structure-1, t-member3 Test-structure-1 OPTIONAL, t-member4 INTEGER } Choice-1 ::= CHOICE { and [1] Choice-1, or [2] IMPLICIT SET OF Choice-1, not [3] Choice-1, other [4] INTEGER } Test-structure-2 ::= SET { m1 Test-structure-3 OPTIONAL } Test-structure-3 ::= SET { m1 Test-structure-2 OPTIONAL } END asn1c-0.9.28+dfsg/tests/114-bit-string-SE.asn10000644000000000000000000000051513065714043017060 0ustar rootroot -- SE: Semantic error -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .114 ModuleBitStringNegativeInteger { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 114 } DEFINITIONS ::= BEGIN T ::= BIT STRING { one(-2) } END asn1c-0.9.28+dfsg/tests/65-multi-tag-OK.asn1.-Pfwide-types0000644000000000000000000007155413065714043021277 0ustar rootroot /*** <<< INCLUDES [T1] >>> ***/ #include "T2.h" /*** <<< TYPE-DECLS [T1] >>> ***/ typedef T2_t T1_t; /*** <<< FUNC-DECLS [T1] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_T1; asn_struct_free_f T1_free; asn_struct_print_f T1_print; asn_constr_check_f T1_constraint; ber_type_decoder_f T1_decode_ber; der_type_encoder_f T1_encode_der; xer_type_decoder_f T1_decode_xer; xer_type_encoder_f T1_encode_xer; /*** <<< CODE [T1] >>> ***/ int T1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_T2.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using T2, * so here we adjust the DEF accordingly. */ static void T1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_T2.free_struct; td->print_struct = asn_DEF_T2.print_struct; td->check_constraints = asn_DEF_T2.check_constraints; td->ber_decoder = asn_DEF_T2.ber_decoder; td->der_encoder = asn_DEF_T2.der_encoder; td->xer_decoder = asn_DEF_T2.xer_decoder; td->xer_encoder = asn_DEF_T2.xer_encoder; td->uper_decoder = asn_DEF_T2.uper_decoder; td->uper_encoder = asn_DEF_T2.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_T2.per_constraints; td->elements = asn_DEF_T2.elements; td->elements_count = asn_DEF_T2.elements_count; td->specifics = asn_DEF_T2.specifics; } void T1_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { T1_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int T1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { T1_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t T1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { T1_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t T1_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { T1_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t T1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { T1_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t T1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { T1_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [T1] >>> ***/ static const ber_tlv_tag_t asn_DEF_T1_tags_1[] = { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), (ASN_TAG_CLASS_CONTEXT | (3 << 2)), (ASN_TAG_CLASS_CONTEXT | (4 << 2)), (ASN_TAG_CLASS_CONTEXT | (6 << 2)) }; static const ber_tlv_tag_t asn_DEF_T1_all_tags_1[] = { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), (ASN_TAG_CLASS_CONTEXT | (3 << 2)), (ASN_TAG_CLASS_CONTEXT | (4 << 2)), (ASN_TAG_CLASS_CONTEXT | (5 << 2)), (ASN_TAG_CLASS_CONTEXT | (6 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (9 << 2)) }; asn_TYPE_descriptor_t asn_DEF_T1 = { "T1", "T1", T1_free, T1_print, T1_constraint, T1_decode_ber, T1_encode_der, T1_decode_xer, T1_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T1_tags_1, sizeof(asn_DEF_T1_tags_1) /sizeof(asn_DEF_T1_tags_1[0]), /* 4 */ asn_DEF_T1_all_tags_1, sizeof(asn_DEF_T1_all_tags_1) /sizeof(asn_DEF_T1_all_tags_1[0]), /* 6 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [T2] >>> ***/ #include "T3.h" /*** <<< TYPE-DECLS [T2] >>> ***/ typedef T3_t T2_t; /*** <<< FUNC-DECLS [T2] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_T2; asn_struct_free_f T2_free; asn_struct_print_f T2_print; asn_constr_check_f T2_constraint; ber_type_decoder_f T2_decode_ber; der_type_encoder_f T2_encode_der; xer_type_decoder_f T2_decode_xer; xer_type_encoder_f T2_encode_xer; /*** <<< CODE [T2] >>> ***/ int T2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_T3.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using T3, * so here we adjust the DEF accordingly. */ static void T2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_T3.free_struct; td->print_struct = asn_DEF_T3.print_struct; td->check_constraints = asn_DEF_T3.check_constraints; td->ber_decoder = asn_DEF_T3.ber_decoder; td->der_encoder = asn_DEF_T3.der_encoder; td->xer_decoder = asn_DEF_T3.xer_decoder; td->xer_encoder = asn_DEF_T3.xer_encoder; td->uper_decoder = asn_DEF_T3.uper_decoder; td->uper_encoder = asn_DEF_T3.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_T3.per_constraints; td->elements = asn_DEF_T3.elements; td->elements_count = asn_DEF_T3.elements_count; td->specifics = asn_DEF_T3.specifics; } void T2_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { T2_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int T2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { T2_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t T2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { T2_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t T2_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { T2_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t T2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { T2_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t T2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { T2_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [T2] >>> ***/ static const ber_tlv_tag_t asn_DEF_T2_tags_1[] = { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), (ASN_TAG_CLASS_CONTEXT | (4 << 2)), (ASN_TAG_CLASS_CONTEXT | (6 << 2)) }; static const ber_tlv_tag_t asn_DEF_T2_all_tags_1[] = { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), (ASN_TAG_CLASS_CONTEXT | (4 << 2)), (ASN_TAG_CLASS_CONTEXT | (5 << 2)), (ASN_TAG_CLASS_CONTEXT | (6 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (9 << 2)) }; asn_TYPE_descriptor_t asn_DEF_T2 = { "T2", "T2", T2_free, T2_print, T2_constraint, T2_decode_ber, T2_encode_der, T2_decode_xer, T2_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T2_tags_1, sizeof(asn_DEF_T2_tags_1) /sizeof(asn_DEF_T2_tags_1[0]), /* 3 */ asn_DEF_T2_all_tags_1, sizeof(asn_DEF_T2_all_tags_1) /sizeof(asn_DEF_T2_all_tags_1[0]), /* 5 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [T3] >>> ***/ #include "T4.h" /*** <<< TYPE-DECLS [T3] >>> ***/ typedef T4_t T3_t; /*** <<< FUNC-DECLS [T3] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_T3; asn_struct_free_f T3_free; asn_struct_print_f T3_print; asn_constr_check_f T3_constraint; ber_type_decoder_f T3_decode_ber; der_type_encoder_f T3_encode_der; xer_type_decoder_f T3_decode_xer; xer_type_encoder_f T3_encode_xer; /*** <<< CODE [T3] >>> ***/ int T3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_T4.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using T4, * so here we adjust the DEF accordingly. */ static void T3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_T4.free_struct; td->print_struct = asn_DEF_T4.print_struct; td->check_constraints = asn_DEF_T4.check_constraints; td->ber_decoder = asn_DEF_T4.ber_decoder; td->der_encoder = asn_DEF_T4.der_encoder; td->xer_decoder = asn_DEF_T4.xer_decoder; td->xer_encoder = asn_DEF_T4.xer_encoder; td->uper_decoder = asn_DEF_T4.uper_decoder; td->uper_encoder = asn_DEF_T4.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_T4.per_constraints; td->elements = asn_DEF_T4.elements; td->elements_count = asn_DEF_T4.elements_count; td->specifics = asn_DEF_T4.specifics; } void T3_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { T3_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int T3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { T3_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t T3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { T3_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t T3_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { T3_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t T3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { T3_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t T3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { T3_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [T3] >>> ***/ static const ber_tlv_tag_t asn_DEF_T3_tags_1[] = { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), (ASN_TAG_CLASS_CONTEXT | (6 << 2)) }; static const ber_tlv_tag_t asn_DEF_T3_all_tags_1[] = { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), (ASN_TAG_CLASS_CONTEXT | (5 << 2)), (ASN_TAG_CLASS_CONTEXT | (6 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (9 << 2)) }; asn_TYPE_descriptor_t asn_DEF_T3 = { "T3", "T3", T3_free, T3_print, T3_constraint, T3_decode_ber, T3_encode_der, T3_decode_xer, T3_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T3_tags_1, sizeof(asn_DEF_T3_tags_1) /sizeof(asn_DEF_T3_tags_1[0]), /* 2 */ asn_DEF_T3_all_tags_1, sizeof(asn_DEF_T3_all_tags_1) /sizeof(asn_DEF_T3_all_tags_1[0]), /* 4 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [T4] >>> ***/ #include "T5.h" /*** <<< TYPE-DECLS [T4] >>> ***/ typedef T5_t T4_t; /*** <<< FUNC-DECLS [T4] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_T4; asn_struct_free_f T4_free; asn_struct_print_f T4_print; asn_constr_check_f T4_constraint; ber_type_decoder_f T4_decode_ber; der_type_encoder_f T4_encode_der; xer_type_decoder_f T4_decode_xer; xer_type_encoder_f T4_encode_xer; /*** <<< CODE [T4] >>> ***/ int T4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_T5.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using T5, * so here we adjust the DEF accordingly. */ static void T4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_T5.free_struct; td->print_struct = asn_DEF_T5.print_struct; td->check_constraints = asn_DEF_T5.check_constraints; td->ber_decoder = asn_DEF_T5.ber_decoder; td->der_encoder = asn_DEF_T5.der_encoder; td->xer_decoder = asn_DEF_T5.xer_decoder; td->xer_encoder = asn_DEF_T5.xer_encoder; td->uper_decoder = asn_DEF_T5.uper_decoder; td->uper_encoder = asn_DEF_T5.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_T5.per_constraints; td->elements = asn_DEF_T5.elements; td->elements_count = asn_DEF_T5.elements_count; td->specifics = asn_DEF_T5.specifics; } void T4_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { T4_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int T4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { T4_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t T4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { T4_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t T4_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { T4_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t T4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { T4_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t T4_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { T4_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [T4] >>> ***/ static const ber_tlv_tag_t asn_DEF_T4_tags_1[] = { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), (ASN_TAG_CLASS_CONTEXT | (6 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (9 << 2)) }; asn_TYPE_descriptor_t asn_DEF_T4 = { "T4", "T4", T4_free, T4_print, T4_constraint, T4_decode_ber, T4_encode_der, T4_decode_xer, T4_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T4_tags_1, sizeof(asn_DEF_T4_tags_1) /sizeof(asn_DEF_T4_tags_1[0]) - 1, /* 2 */ asn_DEF_T4_tags_1, /* Same as above */ sizeof(asn_DEF_T4_tags_1) /sizeof(asn_DEF_T4_tags_1[0]), /* 3 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [T5] >>> ***/ #include "T6.h" /*** <<< TYPE-DECLS [T5] >>> ***/ typedef T6_t T5_t; /*** <<< FUNC-DECLS [T5] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_T5; asn_struct_free_f T5_free; asn_struct_print_f T5_print; asn_constr_check_f T5_constraint; ber_type_decoder_f T5_decode_ber; der_type_encoder_f T5_encode_der; xer_type_decoder_f T5_decode_xer; xer_type_encoder_f T5_encode_xer; /*** <<< CODE [T5] >>> ***/ int T5_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_T6.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using T6, * so here we adjust the DEF accordingly. */ static void T5_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_T6.free_struct; td->print_struct = asn_DEF_T6.print_struct; td->check_constraints = asn_DEF_T6.check_constraints; td->ber_decoder = asn_DEF_T6.ber_decoder; td->der_encoder = asn_DEF_T6.der_encoder; td->xer_decoder = asn_DEF_T6.xer_decoder; td->xer_encoder = asn_DEF_T6.xer_encoder; td->uper_decoder = asn_DEF_T6.uper_decoder; td->uper_encoder = asn_DEF_T6.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_T6.per_constraints; td->elements = asn_DEF_T6.elements; td->elements_count = asn_DEF_T6.elements_count; td->specifics = asn_DEF_T6.specifics; } void T5_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { T5_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int T5_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { T5_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t T5_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { T5_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t T5_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { T5_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t T5_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { T5_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t T5_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { T5_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [T5] >>> ***/ static const ber_tlv_tag_t asn_DEF_T5_tags_1[] = { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (9 << 2)) }; asn_TYPE_descriptor_t asn_DEF_T5 = { "T5", "T5", T5_free, T5_print, T5_constraint, T5_decode_ber, T5_encode_der, T5_decode_xer, T5_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T5_tags_1, sizeof(asn_DEF_T5_tags_1) /sizeof(asn_DEF_T5_tags_1[0]) - 1, /* 1 */ asn_DEF_T5_tags_1, /* Same as above */ sizeof(asn_DEF_T5_tags_1) /sizeof(asn_DEF_T5_tags_1[0]), /* 2 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [T6] >>> ***/ #include /*** <<< TYPE-DECLS [T6] >>> ***/ typedef REAL_t T6_t; /*** <<< FUNC-DECLS [T6] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_T6; asn_struct_free_f T6_free; asn_struct_print_f T6_print; asn_constr_check_f T6_constraint; ber_type_decoder_f T6_decode_ber; der_type_encoder_f T6_encode_der; xer_type_decoder_f T6_decode_xer; xer_type_encoder_f T6_encode_xer; /*** <<< CODE [T6] >>> ***/ int T6_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_REAL.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using REAL, * so here we adjust the DEF accordingly. */ static void T6_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_REAL.free_struct; td->print_struct = asn_DEF_REAL.print_struct; td->check_constraints = asn_DEF_REAL.check_constraints; td->ber_decoder = asn_DEF_REAL.ber_decoder; td->der_encoder = asn_DEF_REAL.der_encoder; td->xer_decoder = asn_DEF_REAL.xer_decoder; td->xer_encoder = asn_DEF_REAL.xer_encoder; td->uper_decoder = asn_DEF_REAL.uper_decoder; td->uper_encoder = asn_DEF_REAL.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_REAL.per_constraints; td->elements = asn_DEF_REAL.elements; td->elements_count = asn_DEF_REAL.elements_count; td->specifics = asn_DEF_REAL.specifics; } void T6_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { T6_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int T6_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { T6_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t T6_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { T6_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t T6_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { T6_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t T6_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { T6_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t T6_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { T6_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [T6] >>> ***/ static const ber_tlv_tag_t asn_DEF_T6_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (9 << 2)) }; asn_TYPE_descriptor_t asn_DEF_T6 = { "T6", "T6", T6_free, T6_print, T6_constraint, T6_decode_ber, T6_encode_der, T6_decode_xer, T6_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T6_tags_1, sizeof(asn_DEF_T6_tags_1) /sizeof(asn_DEF_T6_tags_1[0]), /* 1 */ asn_DEF_T6_tags_1, /* Same as above */ sizeof(asn_DEF_T6_tags_1) /sizeof(asn_DEF_T6_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [T] >>> ***/ #include "Ts.h" /*** <<< TYPE-DECLS [T] >>> ***/ typedef Ts_t T_t; /*** <<< FUNC-DECLS [T] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_T; asn_struct_free_f T_free; asn_struct_print_f T_print; asn_constr_check_f T_constraint; ber_type_decoder_f T_decode_ber; der_type_encoder_f T_encode_der; xer_type_decoder_f T_decode_xer; xer_type_encoder_f T_encode_xer; /*** <<< CODE [T] >>> ***/ int T_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_Ts.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using Ts, * so here we adjust the DEF accordingly. */ static void T_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_Ts.free_struct; td->print_struct = asn_DEF_Ts.print_struct; td->check_constraints = asn_DEF_Ts.check_constraints; td->ber_decoder = asn_DEF_Ts.ber_decoder; td->der_encoder = asn_DEF_Ts.der_encoder; td->xer_decoder = asn_DEF_Ts.xer_decoder; td->xer_encoder = asn_DEF_Ts.xer_encoder; td->uper_decoder = asn_DEF_Ts.uper_decoder; td->uper_encoder = asn_DEF_Ts.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Ts.per_constraints; td->elements = asn_DEF_Ts.elements; td->elements_count = asn_DEF_Ts.elements_count; td->specifics = asn_DEF_Ts.specifics; } void T_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { T_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int T_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { T_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t T_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { T_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t T_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { T_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t T_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { T_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t T_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { T_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [T] >>> ***/ static const ber_tlv_tag_t asn_DEF_T_tags_1[] = { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), (ASN_TAG_CLASS_CONTEXT | (123 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; asn_TYPE_descriptor_t asn_DEF_T = { "T", "T", T_free, T_print, T_constraint, T_decode_ber, T_encode_der, T_decode_xer, T_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T_tags_1, sizeof(asn_DEF_T_tags_1) /sizeof(asn_DEF_T_tags_1[0]) - 2, /* 1 */ asn_DEF_T_tags_1, /* Same as above */ sizeof(asn_DEF_T_tags_1) /sizeof(asn_DEF_T_tags_1[0]), /* 3 */ 0, /* No PER visible constraints */ 0, 0, /* Defined elsewhere */ 0 /* No specifics */ }; /*** <<< INCLUDES [Ts] >>> ***/ #include "T2.h" #include "T3.h" #include /*** <<< TYPE-DECLS [Ts] >>> ***/ typedef struct Ts { T2_t m1; T3_t *m2 /* OPTIONAL */; T3_t m3; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Ts_t; /*** <<< FUNC-DECLS [Ts] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Ts; /*** <<< STAT-DEFS [Ts] >>> ***/ static asn_TYPE_member_t asn_MBR_Ts_1[] = { { ATF_NOFLAGS, 0, offsetof(struct Ts, m1), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_T2, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "m1" }, { ATF_POINTER, 1, offsetof(struct Ts, m2), .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), .tag_mode = +1, /* EXPLICIT tag at current level */ .type = &asn_DEF_T3, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "m2" }, { ATF_NOFLAGS, 0, offsetof(struct Ts, m3), .tag = (ASN_TAG_CLASS_CONTEXT | (3 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_T3, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "m3" }, }; static const ber_tlv_tag_t asn_DEF_Ts_tags_1[] = { (ASN_TAG_CLASS_CONTEXT | (123 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_Ts_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 0, 0, 0 }, /* m1 */ { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 1, 0, 0 }, /* m2 */ { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 2, 0, 0 } /* m3 */ }; static asn_SEQUENCE_specifics_t asn_SPC_Ts_specs_1 = { sizeof(struct Ts), offsetof(struct Ts, _asn_ctx), asn_MAP_Ts_tag2el_1, 3, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Ts = { "Ts", "Ts", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Ts_tags_1, sizeof(asn_DEF_Ts_tags_1) /sizeof(asn_DEF_Ts_tags_1[0]) - 1, /* 1 */ asn_DEF_Ts_tags_1, /* Same as above */ sizeof(asn_DEF_Ts_tags_1) /sizeof(asn_DEF_Ts_tags_1[0]), /* 2 */ 0, /* No PER visible constraints */ asn_MBR_Ts_1, 3, /* Elements count */ &asn_SPC_Ts_specs_1 /* Additional specs */ }; asn1c-0.9.28+dfsg/tests/131-per-empty-OK.asn10000644000000000000000000000053013065714043016716 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .131 ModulePERLong { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 131 } DEFINITIONS AUTOMATIC TAGS ::= BEGIN T ::= SEQUENCE { } -- Empty sequence END asn1c-0.9.28+dfsg/tests/76-duplicate-modules-SW.asn10000644000000000000000000000074013065714043020367 0ustar rootroot -- SW: Semantically suspicious -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .76 1 -- .76 2 ModuleDuplicateModuleName { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 76 1 } DEFINITIONS ::= BEGIN END ModuleDuplicateModuleName { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 76 2 } DEFINITIONS ::= BEGIN END asn1c-0.9.28+dfsg/tests/14-resolver-OK.asn1.-EF0000644000000000000000000000154613065714043017133 0ustar rootrootModuleTestResolver2 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 14 1 } DEFINITIONS ::= BEGIN alpha Enumeration ::= 2 other Enumeration ::= 1 Struct ::= SEQUENCE { member1 [1] EXPLICIT ModuleTestResolver3.Enumeration OPTIONAL, member2 [2] EXPLICIT OtherModuleRenamed.Enumeration DEFAULT 2 } check-alpha INTEGER ::= 2 check-other INTEGER ::= 1 END ModuleTestResolver3 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 14 2 } DEFINITIONS ::= BEGIN beta HiddenEnum ::= 2 Enumeration ::= ENUMERATED { a(1), b(2) } END HiddenModule { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 14 3 } DEFINITIONS ::= BEGIN HiddenEnum ::= ENUMERATED { a(1), b(2) } gamma Enumeration ::= 1 END asn1c-0.9.28+dfsg/tests/39-sequence-of-OK.asn1.-Pfwide-types0000644000000000000000000001405213065714043021575 0ustar rootroot /*** <<< INCLUDES [T] >>> ***/ #include #include #include #include /*** <<< FWD-DECLS [T] >>> ***/ struct T2; /*** <<< TYPE-DECLS [T] >>> ***/ typedef struct T { INTEGER_t Int; struct collection { A_SEQUENCE_OF(struct T2) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } collection; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } T_t; /*** <<< FUNC-DECLS [T] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_T; /*** <<< POST-INCLUDE [T] >>> ***/ #include "T2.h" /*** <<< STAT-DEFS [T] >>> ***/ static asn_TYPE_member_t asn_MBR_collection_3[] = { { ATF_POINTER, 0, 0, .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), .tag_mode = 0, .type = &asn_DEF_T2, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "" }, }; static const ber_tlv_tag_t asn_DEF_collection_tags_3[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_collection_specs_3 = { sizeof(struct collection), offsetof(struct collection, _asn_ctx), 0, /* XER encoding is XMLDelimitedItemList */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_collection_3 = { "collection", "collection", SEQUENCE_OF_free, SEQUENCE_OF_print, SEQUENCE_OF_constraint, SEQUENCE_OF_decode_ber, SEQUENCE_OF_encode_der, SEQUENCE_OF_decode_xer, SEQUENCE_OF_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_collection_tags_3, sizeof(asn_DEF_collection_tags_3) /sizeof(asn_DEF_collection_tags_3[0]), /* 1 */ asn_DEF_collection_tags_3, /* Same as above */ sizeof(asn_DEF_collection_tags_3) /sizeof(asn_DEF_collection_tags_3[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_collection_3, 1, /* Single element */ &asn_SPC_collection_specs_3 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_T_1[] = { { ATF_NOFLAGS, 0, offsetof(struct T, Int), .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), .tag_mode = 0, .type = &asn_DEF_INTEGER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "int" }, { ATF_NOFLAGS, 0, offsetof(struct T, collection), .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), .tag_mode = 0, .type = &asn_DEF_collection_3, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "collection" }, }; static const ber_tlv_tag_t asn_DEF_T_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_T_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 }, /* int */ { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 1, 0, 0 } /* collection */ }; static asn_SEQUENCE_specifics_t asn_SPC_T_specs_1 = { sizeof(struct T), offsetof(struct T, _asn_ctx), asn_MAP_T_tag2el_1, 2, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_T = { "T", "T", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T_tags_1, sizeof(asn_DEF_T_tags_1) /sizeof(asn_DEF_T_tags_1[0]), /* 1 */ asn_DEF_T_tags_1, /* Same as above */ sizeof(asn_DEF_T_tags_1) /sizeof(asn_DEF_T_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_T_1, 2, /* Elements count */ &asn_SPC_T_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [T2] >>> ***/ #include #include #include /*** <<< TYPE-DECLS [T2] >>> ***/ typedef struct T2 { BOOLEAN_t flag; UTF8String_t str; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } T2_t; /*** <<< FUNC-DECLS [T2] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_T2; /*** <<< STAT-DEFS [T2] >>> ***/ static asn_TYPE_member_t asn_MBR_T2_1[] = { { ATF_NOFLAGS, 0, offsetof(struct T2, flag), .tag = (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)), .tag_mode = 0, .type = &asn_DEF_BOOLEAN, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "flag" }, { ATF_NOFLAGS, 0, offsetof(struct T2, str), .tag = (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)), .tag_mode = 0, .type = &asn_DEF_UTF8String, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "str" }, }; static const ber_tlv_tag_t asn_DEF_T2_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_T2_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)), 0, 0, 0 }, /* flag */ { (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)), 1, 0, 0 } /* str */ }; static asn_SEQUENCE_specifics_t asn_SPC_T2_specs_1 = { sizeof(struct T2), offsetof(struct T2, _asn_ctx), asn_MAP_T2_tag2el_1, 2, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_T2 = { "T2", "T2", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T2_tags_1, sizeof(asn_DEF_T2_tags_1) /sizeof(asn_DEF_T2_tags_1[0]), /* 1 */ asn_DEF_T2_tags_1, /* Same as above */ sizeof(asn_DEF_T2_tags_1) /sizeof(asn_DEF_T2_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_T2_1, 2, /* Elements count */ &asn_SPC_T2_specs_1 /* Additional specs */ }; asn1c-0.9.28+dfsg/tests/39-sequence-of-OK.asn10000644000000000000000000000064013065714043017137 0ustar rootroot -- OK: Everything is Fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .39 ModuleNestedSequenceOf { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 39 } DEFINITIONS ::= BEGIN T ::= SEQUENCE { int INTEGER, collection SEQUENCE OF T2 } T2 ::= SEQUENCE { flag BOOLEAN, str UTF8String } END asn1c-0.9.28+dfsg/tests/133-per-constraints-OK.asn10000644000000000000000000000070713065714043020137 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .133 ModulePERConstraints { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 133 } DEFINITIONS AUTOMATIC TAGS ::= BEGIN T ::= CHOICE { first [2] CHOICE { nothing INTEGER (5..MAX) }, second [0] INTEGER (MIN..10), ..., third [1] INTEGER (-10..MAX) } END asn1c-0.9.28+dfsg/tests/104-param-1-OK.asn10000644000000000000000000000065413065714043016241 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .104 ModuleParameterization1 { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 104 } DEFINITIONS ::= BEGIN Collection {T} ::= SET OF T Bunch ::= SEQUENCE { field-REAL Collection {REAL}, field-IA5String Collection {IA5String} } END asn1c-0.9.28+dfsg/tests/19-param-OK.asn1.-EF0000644000000000000000000000107713065714043016376 0ustar rootrootModuleTestParam { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 19 } DEFINITIONS ::= BEGIN SIGNED{ToBeSigned} ::= SEQUENCE { toBeSigned ToBeSigned, algorithm OBJECT IDENTIFIER, signature BIT STRING SIZE(0..256) } Certificate ::= SIGNED{ SEQUENCE { version INTEGER, signature OBJECT IDENTIFIER, issuer Name }} Name ::= SEQUENCE OF RelativeDistinguishedName RelativeDistinguishedName ::= SET SIZE(1..MAX) OF IA5String (FROM("A".."Z" | "a".."z" | "0-9" | ",-.")) END asn1c-0.9.28+dfsg/tests/132-per-choice-OK.asn10000644000000000000000000000063213065714043017016 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .132 ModulePERChoice { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 132 } DEFINITIONS AUTOMATIC TAGS ::= BEGIN T ::= CHOICE { first [1] CHOICE { nothing INTEGER (5..10) }, second [0] INTEGER (-10..10) } END asn1c-0.9.28+dfsg/tests/45-undefined-type-SE.asn10000644000000000000000000000053413065714043017642 0ustar rootroot -- SE: Semantic error -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .45 ModuleKnownExternType { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 45 } DEFINITIONS ::= BEGIN Type ::= KnownExt -- KnownExt is known to be external. END asn1c-0.9.28+dfsg/tests/110-param-3-OK.asn1.-Pfwide-types0000644000000000000000000004344113065714043020675 0ustar rootroot /*** <<< INCLUDES [Flag] >>> ***/ #include #include #include /*** <<< DEPS [Flag] >>> ***/ typedef enum field { field_red = 0, field_green = 1, field_blue = 5 } e_field; typedef enum field { field_red = 3, field_green = 4, field_blue = 5 } e_field; /*** <<< TYPE-DECLS [Flag] >>> ***/ typedef struct Flag_16P0 { INTEGER_t *field /* DEFAULT 5 */; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Flag_16P0_t; typedef struct Flag_16P1 { ENUMERATED_t *field /* DEFAULT 5 */; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Flag_16P1_t; /*** <<< FUNC-DECLS [Flag] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Flag_16P0; /* extern asn_TYPE_descriptor_t asn_DEF_field_7; // (Use -fall-defs-global to expose) */ extern asn_TYPE_descriptor_t asn_DEF_Flag_16P1; /*** <<< CODE [Flag] >>> ***/ static int field_7_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ENUMERATED.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using ENUMERATED, * so here we adjust the DEF accordingly. */ static void field_7_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_ENUMERATED.free_struct; td->print_struct = asn_DEF_ENUMERATED.print_struct; td->check_constraints = asn_DEF_ENUMERATED.check_constraints; td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; td->der_encoder = asn_DEF_ENUMERATED.der_encoder; td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; td->elements = asn_DEF_ENUMERATED.elements; td->elements_count = asn_DEF_ENUMERATED.elements_count; /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ } static void field_7_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { field_7_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } static int field_7_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { field_7_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } static asn_dec_rval_t field_7_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { field_7_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } static asn_enc_rval_t field_7_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { field_7_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } static asn_dec_rval_t field_7_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { field_7_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } static asn_enc_rval_t field_7_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { field_7_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [Flag] >>> ***/ static int asn_DFL_2_set_5(int set_value, void **sptr) { INTEGER_t *st = *sptr; if(!st) { if(!set_value) return -1; /* Not a default value */ st = (*sptr = CALLOC(1, sizeof(*st))); if(!st) return -1; } if(set_value) { /* Install default value 5 */ return asn_long2INTEGER(st, 5); } else { /* Test default value 5 */ long value; if(asn_INTEGER2long(st, &value)) return -1; return (value == 5); } } static asn_TYPE_member_t asn_MBR_Flag_16P0_1[] = { { ATF_POINTER, 1, offsetof(struct Flag_16P0, field), .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), .tag_mode = 0, .type = &asn_DEF_INTEGER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = asn_DFL_2_set_5, /* DEFAULT 5 */ .name = "field" }, }; static const ber_tlv_tag_t asn_DEF_Flag_16P0_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_Flag_16P0_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 } /* field */ }; static asn_SEQUENCE_specifics_t asn_SPC_Flag_16P0_specs_1 = { sizeof(struct Flag_16P0), offsetof(struct Flag_16P0, _asn_ctx), asn_MAP_Flag_16P0_tag2el_1, 1, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Flag_16P0 = { "Flag", "Flag", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Flag_16P0_tags_1, sizeof(asn_DEF_Flag_16P0_tags_1) /sizeof(asn_DEF_Flag_16P0_tags_1[0]), /* 1 */ asn_DEF_Flag_16P0_tags_1, /* Same as above */ sizeof(asn_DEF_Flag_16P0_tags_1) /sizeof(asn_DEF_Flag_16P0_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Flag_16P0_1, 1, /* Elements count */ &asn_SPC_Flag_16P0_specs_1 /* Additional specs */ }; static int asn_DFL_7_set_5(int set_value, void **sptr) { ENUMERATED_t *st = *sptr; if(!st) { if(!set_value) return -1; /* Not a default value */ st = (*sptr = CALLOC(1, sizeof(*st))); if(!st) return -1; } if(set_value) { /* Install default value 5 */ return asn_long2INTEGER(st, 5); } else { /* Test default value 5 */ long value; if(asn_INTEGER2long(st, &value)) return -1; return (value == 5); } } static const asn_INTEGER_enum_map_t asn_MAP_field_value2enum_7[] = { { 3, 3, "red" }, { 4, 5, "green" }, { 5, 4, "blue" } }; static const unsigned int asn_MAP_field_enum2value_7[] = { 2, /* blue(5) */ 1, /* green(4) */ 0 /* red(3) */ }; static const asn_INTEGER_specifics_t asn_SPC_field_specs_7 = { asn_MAP_field_value2enum_7, /* "tag" => N; sorted by tag */ asn_MAP_field_enum2value_7, /* N => "tag"; sorted by N */ 3, /* Number of elements in the maps */ 0, /* Enumeration is not extensible */ 1, /* Strict enumeration */ 0, /* Native long size */ 0 }; static const ber_tlv_tag_t asn_DEF_field_tags_7[] = { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_field_7 = { "field", "field", field_7_free, field_7_print, field_7_constraint, field_7_decode_ber, field_7_encode_der, field_7_decode_xer, field_7_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_field_tags_7, sizeof(asn_DEF_field_tags_7) /sizeof(asn_DEF_field_tags_7[0]), /* 1 */ asn_DEF_field_tags_7, /* Same as above */ sizeof(asn_DEF_field_tags_7) /sizeof(asn_DEF_field_tags_7[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* Defined elsewhere */ &asn_SPC_field_specs_7 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_Flag_16P1_6[] = { { ATF_POINTER, 1, offsetof(struct Flag_16P1, field), .tag = (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), .tag_mode = 0, .type = &asn_DEF_field_7, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = asn_DFL_7_set_5, /* DEFAULT 5 */ .name = "field" }, }; static const ber_tlv_tag_t asn_DEF_Flag_16P1_tags_6[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_Flag_16P1_tag2el_6[] = { { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 0, 0, 0 } /* field */ }; static asn_SEQUENCE_specifics_t asn_SPC_Flag_16P1_specs_6 = { sizeof(struct Flag_16P1), offsetof(struct Flag_16P1, _asn_ctx), asn_MAP_Flag_16P1_tag2el_6, 1, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Flag_16P1 = { "Flag", "Flag", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Flag_16P1_tags_6, sizeof(asn_DEF_Flag_16P1_tags_6) /sizeof(asn_DEF_Flag_16P1_tags_6[0]), /* 1 */ asn_DEF_Flag_16P1_tags_6, /* Same as above */ sizeof(asn_DEF_Flag_16P1_tags_6) /sizeof(asn_DEF_Flag_16P1_tags_6[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Flag_16P1_6, 1, /* Elements count */ &asn_SPC_Flag_16P1_specs_6 /* Additional specs */ }; /*** <<< INCLUDES [IntegerColorFlag] >>> ***/ #include "Flag.h" /*** <<< TYPE-DECLS [IntegerColorFlag] >>> ***/ typedef Flag_16P0_t IntegerColorFlag_t; /*** <<< FUNC-DECLS [IntegerColorFlag] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_IntegerColorFlag; asn_struct_free_f IntegerColorFlag_free; asn_struct_print_f IntegerColorFlag_print; asn_constr_check_f IntegerColorFlag_constraint; ber_type_decoder_f IntegerColorFlag_decode_ber; der_type_encoder_f IntegerColorFlag_encode_der; xer_type_decoder_f IntegerColorFlag_decode_xer; xer_type_encoder_f IntegerColorFlag_encode_xer; /*** <<< CODE [IntegerColorFlag] >>> ***/ int IntegerColorFlag_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_Flag_16P0.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using Flag_16P0, * so here we adjust the DEF accordingly. */ static void IntegerColorFlag_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_Flag_16P0.free_struct; td->print_struct = asn_DEF_Flag_16P0.print_struct; td->check_constraints = asn_DEF_Flag_16P0.check_constraints; td->ber_decoder = asn_DEF_Flag_16P0.ber_decoder; td->der_encoder = asn_DEF_Flag_16P0.der_encoder; td->xer_decoder = asn_DEF_Flag_16P0.xer_decoder; td->xer_encoder = asn_DEF_Flag_16P0.xer_encoder; td->uper_decoder = asn_DEF_Flag_16P0.uper_decoder; td->uper_encoder = asn_DEF_Flag_16P0.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Flag_16P0.per_constraints; td->elements = asn_DEF_Flag_16P0.elements; td->elements_count = asn_DEF_Flag_16P0.elements_count; td->specifics = asn_DEF_Flag_16P0.specifics; } void IntegerColorFlag_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { IntegerColorFlag_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int IntegerColorFlag_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { IntegerColorFlag_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t IntegerColorFlag_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { IntegerColorFlag_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t IntegerColorFlag_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { IntegerColorFlag_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t IntegerColorFlag_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { IntegerColorFlag_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t IntegerColorFlag_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { IntegerColorFlag_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [IntegerColorFlag] >>> ***/ static const ber_tlv_tag_t asn_DEF_IntegerColorFlag_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; asn_TYPE_descriptor_t asn_DEF_IntegerColorFlag = { "IntegerColorFlag", "IntegerColorFlag", IntegerColorFlag_free, IntegerColorFlag_print, IntegerColorFlag_constraint, IntegerColorFlag_decode_ber, IntegerColorFlag_encode_der, IntegerColorFlag_decode_xer, IntegerColorFlag_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_IntegerColorFlag_tags_1, sizeof(asn_DEF_IntegerColorFlag_tags_1) /sizeof(asn_DEF_IntegerColorFlag_tags_1[0]), /* 1 */ asn_DEF_IntegerColorFlag_tags_1, /* Same as above */ sizeof(asn_DEF_IntegerColorFlag_tags_1) /sizeof(asn_DEF_IntegerColorFlag_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* Defined elsewhere */ 0 /* No specifics */ }; /*** <<< INCLUDES [EnumeratedColorFlag] >>> ***/ #include "Flag.h" /*** <<< TYPE-DECLS [EnumeratedColorFlag] >>> ***/ typedef Flag_16P1_t EnumeratedColorFlag_t; /*** <<< FUNC-DECLS [EnumeratedColorFlag] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_EnumeratedColorFlag; asn_struct_free_f EnumeratedColorFlag_free; asn_struct_print_f EnumeratedColorFlag_print; asn_constr_check_f EnumeratedColorFlag_constraint; ber_type_decoder_f EnumeratedColorFlag_decode_ber; der_type_encoder_f EnumeratedColorFlag_encode_der; xer_type_decoder_f EnumeratedColorFlag_decode_xer; xer_type_encoder_f EnumeratedColorFlag_encode_xer; /*** <<< CODE [EnumeratedColorFlag] >>> ***/ int EnumeratedColorFlag_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_Flag_16P1.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using Flag_16P1, * so here we adjust the DEF accordingly. */ static void EnumeratedColorFlag_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_Flag_16P1.free_struct; td->print_struct = asn_DEF_Flag_16P1.print_struct; td->check_constraints = asn_DEF_Flag_16P1.check_constraints; td->ber_decoder = asn_DEF_Flag_16P1.ber_decoder; td->der_encoder = asn_DEF_Flag_16P1.der_encoder; td->xer_decoder = asn_DEF_Flag_16P1.xer_decoder; td->xer_encoder = asn_DEF_Flag_16P1.xer_encoder; td->uper_decoder = asn_DEF_Flag_16P1.uper_decoder; td->uper_encoder = asn_DEF_Flag_16P1.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Flag_16P1.per_constraints; td->elements = asn_DEF_Flag_16P1.elements; td->elements_count = asn_DEF_Flag_16P1.elements_count; td->specifics = asn_DEF_Flag_16P1.specifics; } void EnumeratedColorFlag_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { EnumeratedColorFlag_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int EnumeratedColorFlag_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { EnumeratedColorFlag_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t EnumeratedColorFlag_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { EnumeratedColorFlag_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t EnumeratedColorFlag_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { EnumeratedColorFlag_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t EnumeratedColorFlag_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { EnumeratedColorFlag_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t EnumeratedColorFlag_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { EnumeratedColorFlag_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [EnumeratedColorFlag] >>> ***/ static const ber_tlv_tag_t asn_DEF_EnumeratedColorFlag_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; asn_TYPE_descriptor_t asn_DEF_EnumeratedColorFlag = { "EnumeratedColorFlag", "EnumeratedColorFlag", EnumeratedColorFlag_free, EnumeratedColorFlag_print, EnumeratedColorFlag_constraint, EnumeratedColorFlag_decode_ber, EnumeratedColorFlag_encode_der, EnumeratedColorFlag_decode_xer, EnumeratedColorFlag_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_EnumeratedColorFlag_tags_1, sizeof(asn_DEF_EnumeratedColorFlag_tags_1) /sizeof(asn_DEF_EnumeratedColorFlag_tags_1[0]), /* 1 */ asn_DEF_EnumeratedColorFlag_tags_1, /* Same as above */ sizeof(asn_DEF_EnumeratedColorFlag_tags_1) /sizeof(asn_DEF_EnumeratedColorFlag_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* Defined elsewhere */ 0 /* No specifics */ }; asn1c-0.9.28+dfsg/tests/40-int-optional-SE.asn10000644000000000000000000000076113065714043017334 0ustar rootroot -- SE: Semantic error -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .40 ModuleTestIntOptional { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 40 } DEFINITIONS ::= BEGIN T ::= CHOICE { seq SEQUENCE { string UTF8String, alpha INTEGER OPTIONAL, beta INTEGER OPTIONAL }, set SET { string UTF8String, alpha INTEGER OPTIONAL, beta INTEGER OPTIONAL } } END asn1c-0.9.28+dfsg/tests/100-class-ref-OK.asn10000644000000000000000000000065713065714043016661 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .100 ModuleClassSample { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 100 } DEFINITIONS ::= BEGIN REF-ID ::= TYPE-IDENTIFIER RefID ::= SEQUENCE { field REF-ID.&id, params REF-ID.&Type } SupportedReferences REF-ID ::= { ... } END asn1c-0.9.28+dfsg/tests/101-class-ref-SE.asn10000644000000000000000000000063313065714043016652 0ustar rootroot -- SE: Semantic error -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .101 ModuleClassMisUse { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 101 } DEFINITIONS ::= BEGIN NOTCLASS ::= SEQUENCE { ... } REF-ID ::= NOTCLASS RefID ::= SEQUENCE { field REF-ID.&id, params REF-ID.&Type } END asn1c-0.9.28+dfsg/tests/62-any-OK.asn10000644000000000000000000000141513065714043015511 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .62 ModuleTestANYSyntax { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 62 } DEFINITIONS IMPLICIT TAGS ::= BEGIN T ::= CHOICE { s1 T1-ext, s2 T2, s3 T3, s4 T4 } T1-ext ::= SEQUENCE { i INTEGER OPTIONAL, any [1] ANY, -- Converted into [1] EXPLICIT ANY ... } T2 ::= [16] SEQUENCE { m1 [0] NumericString, m2 [1] BOOLEAN, m3 [3] SEQUENCE OF NumericString, o4 [4] BOOLEAN OPTIONAL, o5 [5] BOOLEAN OPTIONAL, o6 [6] BOOLEAN OPTIONAL } T3 ::= SET { m1 [0] NumericString, m2 [1] BOOLEAN } T4 ::= [53] CHOICE { m1 [1] IMPLICIT OCTET STRING } END asn1c-0.9.28+dfsg/tests/50-constraint-OK.asn1.-EFprint-constraints0000644000000000000000000002325213065714043023076 0ustar rootrootModuleNestedConstraintsCheck { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 50 1 } DEFINITIONS ::= BEGIN Int1 ::= INTEGER -- Practical constraints (Int1): (MIN..MAX) -- PER-visible constraints (Int1): (MIN..MAX) Int2 ::= Int1 (0..MAX) -- Combined constraints: (0..MAX) -- Practical constraints (Int1): (0..MAX) -- PER-visible constraints (Int1): (0..MAX) Int3 ::= Int2 (MIN..10) -- Combined constraints: (0..MAX)(MIN..10) -- Practical constraints (Int1): (0..10) -- PER-visible constraints (Int1): (0..10) Int4 ::= Int3 (5..MAX,...,1..4) -- Combined constraints: (0..MAX)(MIN..10)(5..MAX,...,1..4) -- Practical constraints (Int1): (1..10,...) -- PER-visible constraints (Int1): (1..10,...) Int5 ::= Int4 (MIN..5) -- Combined constraints: (0..MAX)(MIN..10)(5..MAX)(MIN..5) -- Practical constraints (Int1): (5) -- PER-visible constraints (Int1): (5) ten Int1 ::= 10 -- Practical constraints (Int1): (MIN..MAX) -- PER-visible constraints (Int1): (MIN..MAX) other-ten Int2 ::= 10 -- Practical constraints (Int1): (MIN..MAX) -- PER-visible constraints (Int1): (MIN..MAX) ExtensibleExtensions ::= INTEGER ((1..256,...) ^ (1..256)) -- Combined constraints: ((1..256,...) ^ (1..256)) -- Practical constraints (ExtensibleExtensions): (1..256,...) -- PER-visible constraints (ExtensibleExtensions): (1..256,...) Str1 ::= IA5String -- Practical constraints (Str1): (MIN..MAX) (SIZE(0..MAX)) (FROM("".."")) -- PER-visible constraints (Str1): (MIN..MAX) (SIZE(0..MAX)) (FROM("".."")) Str2 ::= Str1 (SIZE(MIN..20 | 25..30)) -- Combined constraints: (SIZE(MIN..20 | 25..30)) -- Practical constraints (Str1): (MIN..MAX) (SIZE(0..20 | 25..30)) (FROM("".."")) -- PER-visible constraints (Str1): (MIN..MAX) (SIZE(0..20 | 25..30)) (FROM("".."")) Str3 ::= Str2 (SIZE(10..27))(FROM("ABC" | "def")) -- Combined constraints: (SIZE(MIN..20 | 25..30))(SIZE(10..27))(FROM("ABC" | "def")) -- Practical constraints (Str1): (MIN..MAX) (SIZE(10..20 | 25..27)) (FROM("A".."C" | "d".."f")) -- PER-visible constraints (Str1): (MIN..MAX) (SIZE(10..20 | 25..27)) (FROM("A".."C" | "d".."f")) Str4 ::= IA5String ("ABCD" | SIZE(4)) -- Combined constraints: ("ABCD" | SIZE(4)) -- Practical constraints (Str4): (MIN..MAX) (SIZE(0..MAX)) (FROM("".."")) -- PER-visible constraints (Str4): (MIN..MAX) (SIZE(0..MAX)) (FROM("".."")) PER-Visible ::= IA5String (FROM("A".."F")) -- Combined constraints: (FROM("A".."F")) -- Practical constraints (PER-Visible): (MIN..MAX) (SIZE(0..MAX)) (FROM("A".."F")) -- PER-visible constraints (PER-Visible): (MIN..MAX) (SIZE(0..MAX)) (FROM("A".."F")) PER-Visible-2 ::= PER-Visible (FROM("E".."F")) -- Combined constraints: (FROM("A".."F"))(FROM("E".."F")) -- Practical constraints (PER-Visible): (MIN..MAX) (SIZE(0..MAX)) (FROM("E".."F")) -- PER-visible constraints (PER-Visible): (MIN..MAX) (SIZE(0..MAX)) (FROM("E".."F")) Not-PER-Visible-1 ::= PER-Visible (FROM("AB") | SIZE(1..2)) -- Combined constraints: (FROM("A".."F"))(FROM("AB") | SIZE(1..2)) -- Practical constraints (PER-Visible): (MIN..MAX) (SIZE(0..MAX)) (FROM("A".."F")) -- PER-visible constraints (PER-Visible): (MIN..MAX) (SIZE(0..MAX)) (FROM("A".."F")) Not-PER-Visible-2 ::= PER-Visible (FROM("AB",...)) -- Combined constraints: (FROM("A".."F"))(FROM("AB",...)) -- Practical constraints (PER-Visible): (MIN..MAX) (SIZE(0..MAX)) (FROM("A".."B",...)) -- PER-visible constraints (PER-Visible): (MIN..MAX) (SIZE(0..MAX)) (FROM("A".."F")) Not-PER-Visible-3 ::= PER-Visible (FROM("AB"),...) -- Combined constraints: (FROM("A".."F"))(FROM("AB"),...) -- Practical constraints (PER-Visible): (MIN..MAX) (SIZE(0..MAX)) (FROM("A".."B",...)) -- PER-visible constraints (PER-Visible): (MIN..MAX) (SIZE(0..MAX)) (FROM("A".."F")) SIZE-but-not-FROM ::= PER-Visible (SIZE(1..4) ^ FROM("ABCD",...)) -- Combined constraints: (FROM("A".."F"))(SIZE(1..4) ^ FROM("ABCD",...)) -- Practical constraints (PER-Visible): (MIN..MAX) (SIZE(1..4)) (FROM("A".."D",...)) -- PER-visible constraints (PER-Visible): (MIN..MAX) (SIZE(1..4)) (FROM("A".."F")) SIZE-and-FROM ::= PER-Visible (SIZE(1..4) ^ FROM("ABCD")) -- Combined constraints: (FROM("A".."F"))(SIZE(1..4) ^ FROM("ABCD")) -- Practical constraints (PER-Visible): (MIN..MAX) (SIZE(1..4)) (FROM("A".."D")) -- PER-visible constraints (PER-Visible): (MIN..MAX) (SIZE(1..4)) (FROM("A".."D")) Neither-SIZE-nor-FROM ::= PER-Visible (SIZE(1..4) | FROM("ABCD",...)) -- Combined constraints: (FROM("A".."F"))(SIZE(1..4) | FROM("ABCD",...)) -- Practical constraints (PER-Visible): (MIN..MAX) (SIZE(0..MAX)) (FROM("A".."F")) -- PER-visible constraints (PER-Visible): (MIN..MAX) (SIZE(0..MAX)) (FROM("A".."F")) Utf8-4 ::= UTF8String (FROM("A".."Z")) -- Combined constraints: (FROM("A".."Z")) -- Practical constraints (Utf8-4): (MIN..MAX) (SIZE(0..MAX)) (FROM("A".."Z")) -- PER-visible constraints (Utf8-4): Utf8-3 ::= Utf8-2 (FROM("A".."Z" | "a".."z")) -- Combined constraints: (SIZE(1..2))(FROM("A".."Z" | "a".."z")) -- Practical constraints (Utf8-1): (MIN..MAX) (SIZE(1..2)) (FROM("A".."Z" | "a".."z")) -- PER-visible constraints (Utf8-1): Utf8-2 ::= Utf8-1 (SIZE(1..2)) -- Combined constraints: (SIZE(1..2)) -- Practical constraints (Utf8-1): (MIN..MAX) (SIZE(1..2)) (FROM("".."")) -- PER-visible constraints (Utf8-1): Utf8-1 ::= UTF8String -- Practical constraints (Utf8-1): (MIN..MAX) (SIZE(0..MAX)) (FROM("".."")) -- PER-visible constraints (Utf8-1): VisibleIdentifier ::= Identifier -- Combined constraints: (FROM("A" | "a" | "B" | "b" | "C" | "c" | "D" | "d" | "E" | "e" | "F" | "f" | "G" | "g" | "H" | "h" | "I" | "i" | "J" | "j" | "K" | "k" | "L" | "l" | "M" | "m" | "N" | "n" | "O" | "o" | "P" | "p" | "Q" | "q" | "R" | "r" | "S" | "s" | "T" | "t" | "U" | "u" | "V" | "v" | "W" | "w" | "X" | "x" | "Y" | "y" | "Z" | "z" | "$" | "_" | "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"))(SIZE(1..32)) -- Practical constraints (Identifier): (MIN..MAX) (SIZE(1..32)) (FROM("$" | "0".."9" | "A".."Z" | "_" | "a".."z")) -- PER-visible constraints (Identifier): (MIN..MAX) (SIZE(1..32)) (FROM("$" | "0".."9" | "A".."Z" | "_" | "a".."z")) Sequence ::= SEQUENCE { int1-c Int1 (-2..MAX) -- Combined constraints: (-2..MAX) -- Practical constraints (Int1): (-2..MAX) -- PER-visible constraints (Int1): (-2..MAX) DEFAULT 3, int4 [2] EXPLICIT Int4 -- Combined constraints: (0..MAX)(MIN..10)(5..MAX,...,1..4) -- Practical constraints (Int1): (1..10,...) -- PER-visible constraints (Int1): (1..10,...) , int4-c Int4 (MIN..7) -- Combined constraints: (0..MAX)(MIN..10)(5..MAX)(MIN..7) -- Practical constraints (Int1): (5..7) -- PER-visible constraints (Int1): (5..7) , bool BOOLEAN -- Practical constraints (bool): (MIN..MAX) -- PER-visible constraints (bool): (MIN..MAX) DEFAULT 1, enum-c ENUMERATED { one(1) -- Practical constraints (one): -- PER-visible constraints (one): , two(2) -- Practical constraints (two): -- PER-visible constraints (two): , ..., three(3) -- Practical constraints (three): -- PER-visible constraints (three): } -- Practical constraints (enum-c): (MIN..MAX) -- PER-visible constraints (enum-c): (MIN..MAX) , null NULL -- Practical constraints (null): -- PER-visible constraints (null): OPTIONAL, ..., int5-c Int5 (5) -- Combined constraints: (0..MAX)(MIN..10)(5..MAX)(MIN..5)(5) -- Practical constraints (Int1): (5) -- PER-visible constraints (Int1): (5) OPTIONAL } -- Practical constraints (Sequence): -- PER-visible constraints (Sequence): SequenceOf ::= SEQUENCE (SIZE(1..2)) OF Sequence -- Practical constraints (Sequence): -- PER-visible constraints (Sequence): -- Combined constraints: (SIZE(1..2)) -- Practical constraints (SequenceOf): (SIZE(1..2)) -- PER-visible constraints (SequenceOf): (SIZE(1..2)) Enum0 ::= ENUMERATED { one(0) -- Practical constraints (one): -- PER-visible constraints (one): , two(1) -- Practical constraints (two): -- PER-visible constraints (two): } -- Practical constraints (Enum0): (MIN..MAX) -- PER-visible constraints (Enum0): (MIN..MAX) Enum1 ::= ENUMERATED { one(0) -- Practical constraints (one): -- PER-visible constraints (one): , two(1) -- Practical constraints (two): -- PER-visible constraints (two): } (0) -- Combined constraints: (0) -- Practical constraints (Enum1): (0) -- PER-visible constraints (Enum1): (0) END IdentifierModule { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 50 2 } DEFINITIONS ::= BEGIN maxIdentifier INTEGER ::= 32 -- Practical constraints (maxIdentifier): (MIN..MAX) -- PER-visible constraints (maxIdentifier): (MIN..MAX) Identifier ::= VisibleString (FROM("A" | "a" | "B" | "b" | "C" | "c" | "D" | "d" | "E" | "e" | "F" | "f" | "G" | "g" | "H" | "h" | "I" | "i" | "J" | "j" | "K" | "k" | "L" | "l" | "M" | "m" | "N" | "n" | "O" | "o" | "P" | "p" | "Q" | "q" | "R" | "r" | "S" | "s" | "T" | "t" | "U" | "u" | "V" | "v" | "W" | "w" | "X" | "x" | "Y" | "y" | "Z" | "z" | "$" | "_" | "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"))(SIZE(1..32)) -- Combined constraints: (FROM("A" | "a" | "B" | "b" | "C" | "c" | "D" | "d" | "E" | "e" | "F" | "f" | "G" | "g" | "H" | "h" | "I" | "i" | "J" | "j" | "K" | "k" | "L" | "l" | "M" | "m" | "N" | "n" | "O" | "o" | "P" | "p" | "Q" | "q" | "R" | "r" | "S" | "s" | "T" | "t" | "U" | "u" | "V" | "v" | "W" | "w" | "X" | "x" | "Y" | "y" | "Z" | "z" | "$" | "_" | "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"))(SIZE(1..32)) -- Practical constraints (Identifier): (MIN..MAX) (SIZE(1..32)) (FROM("$" | "0".."9" | "A".."Z" | "_" | "a".."z")) -- PER-visible constraints (Identifier): (MIN..MAX) (SIZE(1..32)) (FROM("$" | "0".."9" | "A".."Z" | "_" | "a".."z")) END asn1c-0.9.28+dfsg/tests/126-per-extensions-OK.asn10000644000000000000000000000110413065714043017761 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .126 ModulePERExtensions { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 126 } DEFINITIONS AUTOMATIC TAGS ::= BEGIN PDU ::= SEQUENCE { ..., str-o IA5String OPTIONAL, str-m IA5String, singl Singleton, pdu-2 PDU-2 OPTIONAL } Singleton ::= SEQUENCE { opt-z IA5String DEFAULT "z" } PDU-2 ::= CHOICE { main [3] INTEGER, ..., ext1 [1] INTEGER, ext0 [0] INTEGER } END asn1c-0.9.28+dfsg/tests/119-per-strings-OK.asn1.-Pgen-PER0000644000000000000000000014001413065714043020652 0ustar rootroot /*** <<< INCLUDES [PDU] >>> ***/ #include #include #include #include #include #include #include #include #include #include #include #include /*** <<< FWD-DECLS [PDU] >>> ***/ struct PDU; /*** <<< TYPE-DECLS [PDU] >>> ***/ typedef struct PDU { struct many { A_SEQUENCE_OF(struct PDU) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } *many; IA5String_t *ia5 /* OPTIONAL */; IA5String_t *ia5_c /* OPTIONAL */; IA5String_t *ia5_ce /* OPTIONAL */; IA5String_t *ia5_ir /* OPTIONAL */; VisibleString_t *vs /* OPTIONAL */; VisibleString_t *vs_c /* OPTIONAL */; VisibleString_t *vs_ce /* OPTIONAL */; VisibleString_t *vs_ir /* OPTIONAL */; PrintableString_t *pr /* OPTIONAL */; PrintableString_t *pr_c /* OPTIONAL */; PrintableString_t *pr_ir /* OPTIONAL */; NumericString_t *ns /* OPTIONAL */; NumericString_t *ns_c /* OPTIONAL */; NumericString_t *ns_ce /* OPTIONAL */; NumericString_t *ns_ir /* OPTIONAL */; UTF8String_t *ut_c /* OPTIONAL */; UTF8String_t *ut_ce /* OPTIONAL */; UTF8String_t *ut_ir /* OPTIONAL */; BMPString_t *bm /* OPTIONAL */; BMPString_t *bm_c /* OPTIONAL */; BMPString_t *bm_cs /* OPTIONAL */; BMPString_t *bm_ce /* OPTIONAL */; BMPString_t *bm_ir /* OPTIONAL */; UniversalString_t *us /* OPTIONAL */; UniversalString_t *us_c /* OPTIONAL */; UniversalString_t *us_cs /* OPTIONAL */; UniversalString_t *us_ce /* OPTIONAL */; UniversalString_t *us_ir /* OPTIONAL */; double *real /* OPTIONAL */; OBJECT_IDENTIFIER_t *oid /* OPTIONAL */; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } PDU_t; /*** <<< FUNC-DECLS [PDU] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_PDU; /*** <<< POST-INCLUDE [PDU] >>> ***/ #include "PDU.h" /*** <<< CTABLES [PDU] >>> ***/ static int check_permitted_alphabet_5(const void *sptr) { /* The underlying type is IA5String */ const IA5String_t *st = (const IA5String_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(!(cv >= 65 && cv <= 90)) return -1; } return 0; } static int check_permitted_alphabet_6(const void *sptr) { /* The underlying type is IA5String */ const IA5String_t *st = (const IA5String_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(!(cv >= 65 && cv <= 90)) return -1; } return 0; } static const int permitted_alphabet_table_7[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* AB */ 0, 0, 0, 0, 0, 0, 0, 0, 3, 4, 5, 0, 0, 0, 0, 0, /* XYZ */ }; static const int permitted_alphabet_code2value_7[5] = { 65,66,88,89,90,}; static int check_permitted_alphabet_7(const void *sptr) { const int *table = permitted_alphabet_table_7; /* The underlying type is IA5String */ const IA5String_t *st = (const IA5String_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(!table[cv]) return -1; } return 0; } static int check_permitted_alphabet_9(const void *sptr) { /* The underlying type is VisibleString */ const VisibleString_t *st = (const VisibleString_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(!(cv >= 65 && cv <= 90)) return -1; } return 0; } static int check_permitted_alphabet_10(const void *sptr) { /* The underlying type is VisibleString */ const VisibleString_t *st = (const VisibleString_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(!(cv >= 65 && cv <= 90)) return -1; } return 0; } static const int permitted_alphabet_table_11[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* AB */ 0, 0, 0, 0, 0, 0, 0, 0, 3, 4, 5, 0, 0, 0, 0, 0, /* XYZ */ }; static const int permitted_alphabet_code2value_11[5] = { 65,66,88,89,90,}; static int check_permitted_alphabet_11(const void *sptr) { const int *table = permitted_alphabet_table_11; /* The underlying type is VisibleString */ const VisibleString_t *st = (const VisibleString_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(!table[cv]) return -1; } return 0; } static int check_permitted_alphabet_13(const void *sptr) { /* The underlying type is PrintableString */ const PrintableString_t *st = (const PrintableString_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(!(cv >= 65 && cv <= 90)) return -1; } return 0; } static const int permitted_alphabet_table_14[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* AB */ 0, 0, 0, 0, 0, 0, 0, 0, 3, 4, 5, 0, 0, 0, 0, 0, /* XYZ */ }; static const int permitted_alphabet_code2value_14[5] = { 65,66,88,89,90,}; static int check_permitted_alphabet_14(const void *sptr) { const int *table = permitted_alphabet_table_14; /* The underlying type is PrintableString */ const PrintableString_t *st = (const PrintableString_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(!table[cv]) return -1; } return 0; } static int check_permitted_alphabet_16(const void *sptr) { /* The underlying type is NumericString */ const NumericString_t *st = (const NumericString_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(!(cv >= 53 && cv <= 57)) return -1; } return 0; } static int check_permitted_alphabet_17(const void *sptr) { /* The underlying type is NumericString */ const NumericString_t *st = (const NumericString_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(!(cv >= 53 && cv <= 57)) return -1; } return 0; } static const int permitted_alphabet_table_18[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, /* 1 9 */ }; static const int permitted_alphabet_code2value_18[2] = { 49,57,}; static int check_permitted_alphabet_18(const void *sptr) { const int *table = permitted_alphabet_table_18; /* The underlying type is NumericString */ const NumericString_t *st = (const NumericString_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(!table[cv]) return -1; } return 0; } static const int permitted_alphabet_table_21[128] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* A */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, /* Z */ }; static int check_permitted_alphabet_21(const void *sptr) { const int *table = permitted_alphabet_table_21; /* The underlying type is UTF8String */ const UTF8String_t *st = (const UTF8String_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(cv >= 0x80) return -1; if(!table[cv]) return -1; } return 0; } static int check_permitted_alphabet_23(const void *sptr) { /* The underlying type is BMPString */ const BMPString_t *st = (const BMPString_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; if(st->size % 2) return -1; /* (size%2)! */ for(; ch < end; ch += 2) { uint16_t cv = (ch[0] << 8) | ch[1]; if(!(cv >= 65 && cv <= 90)) return -1; } return 0; } static int check_permitted_alphabet_24(const void *sptr) { /* The underlying type is BMPString */ const BMPString_t *st = (const BMPString_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; if(st->size % 2) return -1; /* (size%2)! */ for(; ch < end; ch += 2) { uint16_t cv = (ch[0] << 8) | ch[1]; if(!(cv <= 65533)) return -1; } return 0; } static int check_permitted_alphabet_25(const void *sptr) { /* The underlying type is BMPString */ const BMPString_t *st = (const BMPString_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; if(st->size % 2) return -1; /* (size%2)! */ for(; ch < end; ch += 2) { uint16_t cv = (ch[0] << 8) | ch[1]; if(!(cv >= 65 && cv <= 90)) return -1; } return 0; } static const int permitted_alphabet_table_26[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* AB */ 0, 0, 0, 0, 0, 0, 0, 0, 3, 4, 5, 0, 0, 0, 0, 0, /* XYZ */ }; static const int permitted_alphabet_code2value_26[5] = { 65,66,88,89,90,}; static int check_permitted_alphabet_26(const void *sptr) { const int *table = permitted_alphabet_table_26; /* The underlying type is BMPString */ const BMPString_t *st = (const BMPString_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; if(st->size % 2) return -1; /* (size%2)! */ for(; ch < end; ch += 2) { uint16_t cv = (ch[0] << 8) | ch[1]; if(cv > 255) return -1; if(!table[cv]) return -1; } return 0; } static int check_permitted_alphabet_28(const void *sptr) { /* The underlying type is UniversalString */ const UniversalString_t *st = (const UniversalString_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; if(st->size % 4) return -1; /* (size%4)! */ for(; ch < end; ch += 4) { uint32_t cv = (ch[0] << 24) | (ch[1] << 16) | (ch[2] << 8) | ch[3]; if(!(cv >= 65 && cv <= 90)) return -1; } return 0; } static int check_permitted_alphabet_29(const void *sptr) { /* The underlying type is UniversalString */ const UniversalString_t *st = (const UniversalString_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; if(st->size % 4) return -1; /* (size%4)! */ for(; ch < end; ch += 4) { uint32_t cv = (ch[0] << 24) | (ch[1] << 16) | (ch[2] << 8) | ch[3]; if(!(1 /* Constraint matches natural range of cv */)) return -1; } return 0; } static int check_permitted_alphabet_30(const void *sptr) { /* The underlying type is UniversalString */ const UniversalString_t *st = (const UniversalString_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; if(st->size % 4) return -1; /* (size%4)! */ for(; ch < end; ch += 4) { uint32_t cv = (ch[0] << 24) | (ch[1] << 16) | (ch[2] << 8) | ch[3]; if(!(cv >= 65 && cv <= 90)) return -1; } return 0; } static const int permitted_alphabet_table_31[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* AB */ 0, 0, 0, 0, 0, 0, 0, 0, 3, 4, 5, 0, 0, 0, 0, 0, /* XYZ */ }; static const int permitted_alphabet_code2value_31[5] = { 65,66,88,89,90,}; static int check_permitted_alphabet_31(const void *sptr) { const int *table = permitted_alphabet_table_31; /* The underlying type is UniversalString */ const UniversalString_t *st = (const UniversalString_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; if(st->size % 4) return -1; /* (size%4)! */ for(; ch < end; ch += 4) { uint32_t cv = (ch[0] << 24) | (ch[1] << 16) | (ch[2] << 8) | ch[3]; if(cv > 255) return -1; if(!table[cv]) return -1; } return 0; } /*** <<< CODE [PDU] >>> ***/ static int memb_ia5_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const IA5String_t *st = (const IA5String_t *)sptr; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(!check_permitted_alphabet_5(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } static int memb_ia5_ce_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const IA5String_t *st = (const IA5String_t *)sptr; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(!check_permitted_alphabet_6(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } static int memb_ia5_ir_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const IA5String_t *st = (const IA5String_t *)sptr; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(!check_permitted_alphabet_7(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } static int asn_PER_MAP_ia5_ir_7_v2c(unsigned int value) { if(value >= sizeof(permitted_alphabet_table_7)/sizeof(permitted_alphabet_table_7[0])) return -1; return permitted_alphabet_table_7[value] - 1; } static int asn_PER_MAP_ia5_ir_7_c2v(unsigned int code) { if(code >= sizeof(permitted_alphabet_code2value_7)/sizeof(permitted_alphabet_code2value_7[0])) return -1; return permitted_alphabet_code2value_7[code]; } static int memb_vs_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const VisibleString_t *st = (const VisibleString_t *)sptr; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(!check_permitted_alphabet_9(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } static int memb_vs_ce_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const VisibleString_t *st = (const VisibleString_t *)sptr; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(!check_permitted_alphabet_10(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } static int memb_vs_ir_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const VisibleString_t *st = (const VisibleString_t *)sptr; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(!check_permitted_alphabet_11(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } static int asn_PER_MAP_vs_ir_11_v2c(unsigned int value) { if(value >= sizeof(permitted_alphabet_table_11)/sizeof(permitted_alphabet_table_11[0])) return -1; return permitted_alphabet_table_11[value] - 1; } static int asn_PER_MAP_vs_ir_11_c2v(unsigned int code) { if(code >= sizeof(permitted_alphabet_code2value_11)/sizeof(permitted_alphabet_code2value_11[0])) return -1; return permitted_alphabet_code2value_11[code]; } static int memb_pr_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const PrintableString_t *st = (const PrintableString_t *)sptr; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(!check_permitted_alphabet_13(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } static int memb_pr_ir_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const PrintableString_t *st = (const PrintableString_t *)sptr; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(!check_permitted_alphabet_14(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } static int asn_PER_MAP_pr_ir_14_v2c(unsigned int value) { if(value >= sizeof(permitted_alphabet_table_14)/sizeof(permitted_alphabet_table_14[0])) return -1; return permitted_alphabet_table_14[value] - 1; } static int asn_PER_MAP_pr_ir_14_c2v(unsigned int code) { if(code >= sizeof(permitted_alphabet_code2value_14)/sizeof(permitted_alphabet_code2value_14[0])) return -1; return permitted_alphabet_code2value_14[code]; } static int memb_ns_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const NumericString_t *st = (const NumericString_t *)sptr; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(!check_permitted_alphabet_16(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } static int memb_ns_ce_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const NumericString_t *st = (const NumericString_t *)sptr; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(!check_permitted_alphabet_17(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } static int memb_ns_ir_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const NumericString_t *st = (const NumericString_t *)sptr; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(!check_permitted_alphabet_18(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } static int asn_PER_MAP_ns_ir_18_v2c(unsigned int value) { if(value >= sizeof(permitted_alphabet_table_18)/sizeof(permitted_alphabet_table_18[0])) return -1; return permitted_alphabet_table_18[value] - 1; } static int asn_PER_MAP_ns_ir_18_c2v(unsigned int code) { if(code >= sizeof(permitted_alphabet_code2value_18)/sizeof(permitted_alphabet_code2value_18[0])) return -1; return permitted_alphabet_code2value_18[code]; } static int memb_ut_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const UTF8String_t *st = (const UTF8String_t *)sptr; size_t size; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } size = UTF8String_length(st); if((ssize_t)size < 0) { ASN__CTFAIL(app_key, td, sptr, "%s: UTF-8: broken encoding (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if((size == 6)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } static int memb_ut_ce_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const UTF8String_t *st = (const UTF8String_t *)sptr; size_t size; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } size = UTF8String_length(st); if((ssize_t)size < 0) { ASN__CTFAIL(app_key, td, sptr, "%s: UTF-8: broken encoding (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if((size == 6)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } static int memb_ut_ir_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const UTF8String_t *st = (const UTF8String_t *)sptr; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(!check_permitted_alphabet_21(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } static int memb_bm_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const BMPString_t *st = (const BMPString_t *)sptr; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(!check_permitted_alphabet_23(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } static int memb_bm_cs_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const BMPString_t *st = (const BMPString_t *)sptr; size_t size; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } size = st->size >> 1; /* 2 byte per character */ if((size == 6) && !check_permitted_alphabet_24(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } static int memb_bm_ce_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const BMPString_t *st = (const BMPString_t *)sptr; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(!check_permitted_alphabet_25(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } static int memb_bm_ir_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const BMPString_t *st = (const BMPString_t *)sptr; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(!check_permitted_alphabet_26(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } static int asn_PER_MAP_bm_ir_26_v2c(unsigned int value) { if(value >= sizeof(permitted_alphabet_table_26)/sizeof(permitted_alphabet_table_26[0])) return -1; return permitted_alphabet_table_26[value] - 1; } static int asn_PER_MAP_bm_ir_26_c2v(unsigned int code) { if(code >= sizeof(permitted_alphabet_code2value_26)/sizeof(permitted_alphabet_code2value_26[0])) return -1; return permitted_alphabet_code2value_26[code]; } static int memb_us_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const UniversalString_t *st = (const UniversalString_t *)sptr; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(!check_permitted_alphabet_28(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } static int memb_us_cs_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const UniversalString_t *st = (const UniversalString_t *)sptr; size_t size; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } size = st->size >> 2; /* 4 byte per character */ if((size == 6) && !check_permitted_alphabet_29(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } static int memb_us_ce_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const UniversalString_t *st = (const UniversalString_t *)sptr; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(!check_permitted_alphabet_30(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } static int memb_us_ir_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const UniversalString_t *st = (const UniversalString_t *)sptr; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(!check_permitted_alphabet_31(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } static int asn_PER_MAP_us_ir_31_v2c(unsigned int value) { if(value >= sizeof(permitted_alphabet_table_31)/sizeof(permitted_alphabet_table_31[0])) return -1; return permitted_alphabet_table_31[value] - 1; } static int asn_PER_MAP_us_ir_31_c2v(unsigned int code) { if(code >= sizeof(permitted_alphabet_code2value_31)/sizeof(permitted_alphabet_code2value_31[0])) return -1; return permitted_alphabet_code2value_31[code]; } /*** <<< CTDEFS [PDU] >>> ***/ static asn_per_constraints_t asn_PER_memb_ia5_c_constr_5 GCC_NOTUSED = { { APC_CONSTRAINED, 5, 5, 65, 90 } /* (65..90) */, { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, 0, 0 /* No PER character map necessary */ }; static asn_per_constraints_t asn_PER_memb_ia5_ce_constr_6 GCC_NOTUSED = { { APC_UNCONSTRAINED, -1, -1, 0, 0 }, { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, 0, 0 /* No PER character map necessary */ }; static asn_per_constraints_t asn_PER_memb_ia5_ir_constr_7 GCC_NOTUSED = { { APC_CONSTRAINED, 3, 3, 65, 90 } /* (65..90) */, { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, asn_PER_MAP_ia5_ir_7_v2c, /* Value to PER code map */ asn_PER_MAP_ia5_ir_7_c2v /* PER code to value map */ }; static asn_per_constraints_t asn_PER_memb_vs_c_constr_9 GCC_NOTUSED = { { APC_CONSTRAINED, 5, 5, 65, 90 } /* (65..90) */, { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, 0, 0 /* No PER character map necessary */ }; static asn_per_constraints_t asn_PER_memb_vs_ce_constr_10 GCC_NOTUSED = { { APC_UNCONSTRAINED, -1, -1, 0, 0 }, { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, 0, 0 /* No PER character map necessary */ }; static asn_per_constraints_t asn_PER_memb_vs_ir_constr_11 GCC_NOTUSED = { { APC_CONSTRAINED, 3, 3, 65, 90 } /* (65..90) */, { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, asn_PER_MAP_vs_ir_11_v2c, /* Value to PER code map */ asn_PER_MAP_vs_ir_11_c2v /* PER code to value map */ }; static asn_per_constraints_t asn_PER_memb_pr_c_constr_13 GCC_NOTUSED = { { APC_CONSTRAINED, 5, 5, 65, 90 } /* (65..90) */, { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, 0, 0 /* No PER character map necessary */ }; static asn_per_constraints_t asn_PER_memb_pr_ir_constr_14 GCC_NOTUSED = { { APC_CONSTRAINED, 3, 3, 65, 90 } /* (65..90) */, { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, asn_PER_MAP_pr_ir_14_v2c, /* Value to PER code map */ asn_PER_MAP_pr_ir_14_c2v /* PER code to value map */ }; static asn_per_constraints_t asn_PER_memb_ns_c_constr_16 GCC_NOTUSED = { { APC_CONSTRAINED, 3, 3, 53, 57 } /* (53..57) */, { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, 0, 0 /* No PER character map necessary */ }; static asn_per_constraints_t asn_PER_memb_ns_ce_constr_17 GCC_NOTUSED = { { APC_UNCONSTRAINED, -1, -1, 0, 0 }, { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, 0, 0 /* No PER character map necessary */ }; static asn_per_constraints_t asn_PER_memb_ns_ir_constr_18 GCC_NOTUSED = { { APC_CONSTRAINED, 1, 1, 49, 57 } /* (49..57) */, { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, asn_PER_MAP_ns_ir_18_v2c, /* Value to PER code map */ asn_PER_MAP_ns_ir_18_c2v /* PER code to value map */ }; static asn_per_constraints_t asn_PER_memb_ut_c_constr_19 GCC_NOTUSED = { { APC_UNCONSTRAINED, -1, -1, 0, 0 }, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; static asn_per_constraints_t asn_PER_memb_ut_ce_constr_20 GCC_NOTUSED = { { APC_UNCONSTRAINED, -1, -1, 0, 0 }, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; static asn_per_constraints_t asn_PER_memb_ut_ir_constr_21 GCC_NOTUSED = { { APC_UNCONSTRAINED, -1, -1, 0, 0 }, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; static asn_per_constraints_t asn_PER_memb_bm_c_constr_23 GCC_NOTUSED = { { APC_CONSTRAINED, 5, 5, 65, 90 } /* (65..90) */, { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, 0, 0 /* No PER character map necessary */ }; static asn_per_constraints_t asn_PER_memb_bm_cs_constr_24 GCC_NOTUSED = { { APC_CONSTRAINED, 16, 16, 0, 65533 } /* (0..65533) */, { APC_CONSTRAINED, 0, 0, 6, 6 } /* (SIZE(6..6)) */, 0, 0 /* No PER character map necessary */ }; static asn_per_constraints_t asn_PER_memb_bm_ce_constr_25 GCC_NOTUSED = { { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */, { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, 0, 0 /* No PER character map necessary */ }; static asn_per_constraints_t asn_PER_memb_bm_ir_constr_26 GCC_NOTUSED = { { APC_CONSTRAINED, 3, 3, 65, 90 } /* (65..90) */, { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, asn_PER_MAP_bm_ir_26_v2c, /* Value to PER code map */ asn_PER_MAP_bm_ir_26_c2v /* PER code to value map */ }; static asn_per_constraints_t asn_PER_memb_us_c_constr_28 GCC_NOTUSED = { { APC_CONSTRAINED, 5, 5, 65, 90 } /* (65..90) */, { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, 0, 0 /* No PER character map necessary */ }; static asn_per_constraints_t asn_PER_memb_us_cs_constr_29 GCC_NOTUSED = { { APC_CONSTRAINED, 32, 32, 0, 2147483647 } /* (0..4294967295) */, { APC_CONSTRAINED, 0, 0, 6, 6 } /* (SIZE(6..6)) */, 0, 0 /* No PER character map necessary */ }; static asn_per_constraints_t asn_PER_memb_us_ce_constr_30 GCC_NOTUSED = { { APC_CONSTRAINED, 32, 32, 0, 2147483647 } /* special case 1 */ , { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, 0, 0 /* No PER character map necessary */ }; static asn_per_constraints_t asn_PER_memb_us_ir_constr_31 GCC_NOTUSED = { { APC_CONSTRAINED, 3, 3, 65, 90 } /* (65..90) */, { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, asn_PER_MAP_us_ir_31_v2c, /* Value to PER code map */ asn_PER_MAP_us_ir_31_c2v /* PER code to value map */ }; /*** <<< STAT-DEFS [PDU] >>> ***/ static asn_TYPE_member_t asn_MBR_many_2[] = { { ATF_POINTER, 0, 0, .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), .tag_mode = 0, .type = &asn_DEF_PDU, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* No PER visible constraints */ .default_value = 0, .name = "" }, }; static const ber_tlv_tag_t asn_DEF_many_tags_2[] = { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_many_specs_2 = { sizeof(struct many), offsetof(struct many, _asn_ctx), 0, /* XER encoding is XMLDelimitedItemList */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_many_2 = { "many", "many", SEQUENCE_OF_free, SEQUENCE_OF_print, SEQUENCE_OF_constraint, SEQUENCE_OF_decode_ber, SEQUENCE_OF_encode_der, SEQUENCE_OF_decode_xer, SEQUENCE_OF_encode_xer, SEQUENCE_OF_decode_uper, SEQUENCE_OF_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_many_tags_2, sizeof(asn_DEF_many_tags_2) /sizeof(asn_DEF_many_tags_2[0]) - 1, /* 1 */ asn_DEF_many_tags_2, /* Same as above */ sizeof(asn_DEF_many_tags_2) /sizeof(asn_DEF_many_tags_2[0]), /* 2 */ 0, /* No PER visible constraints */ asn_MBR_many_2, 1, /* Single element */ &asn_SPC_many_specs_2 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_PDU_1[] = { { ATF_POINTER, 31, offsetof(struct PDU, many), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = 0, .type = &asn_DEF_many_2, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* No PER visible constraints */ .default_value = 0, .name = "many" }, { ATF_POINTER, 30, offsetof(struct PDU, ia5), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_IA5String, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* No PER visible constraints */ .default_value = 0, .name = "ia5" }, { ATF_POINTER, 29, offsetof(struct PDU, ia5_c), .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_IA5String, .memb_constraints = memb_ia5_c_constraint_1, .per_constraints = &asn_PER_memb_ia5_c_constr_5, .default_value = 0, .name = "ia5-c" }, { ATF_POINTER, 28, offsetof(struct PDU, ia5_ce), .tag = (ASN_TAG_CLASS_CONTEXT | (3 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_IA5String, .memb_constraints = memb_ia5_ce_constraint_1, .per_constraints = &asn_PER_memb_ia5_ce_constr_6, .default_value = 0, .name = "ia5-ce" }, { ATF_POINTER, 27, offsetof(struct PDU, ia5_ir), .tag = (ASN_TAG_CLASS_CONTEXT | (4 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_IA5String, .memb_constraints = memb_ia5_ir_constraint_1, .per_constraints = &asn_PER_memb_ia5_ir_constr_7, .default_value = 0, .name = "ia5-ir" }, { ATF_POINTER, 26, offsetof(struct PDU, vs), .tag = (ASN_TAG_CLASS_CONTEXT | (5 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_VisibleString, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* No PER visible constraints */ .default_value = 0, .name = "vs" }, { ATF_POINTER, 25, offsetof(struct PDU, vs_c), .tag = (ASN_TAG_CLASS_CONTEXT | (6 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_VisibleString, .memb_constraints = memb_vs_c_constraint_1, .per_constraints = &asn_PER_memb_vs_c_constr_9, .default_value = 0, .name = "vs-c" }, { ATF_POINTER, 24, offsetof(struct PDU, vs_ce), .tag = (ASN_TAG_CLASS_CONTEXT | (7 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_VisibleString, .memb_constraints = memb_vs_ce_constraint_1, .per_constraints = &asn_PER_memb_vs_ce_constr_10, .default_value = 0, .name = "vs-ce" }, { ATF_POINTER, 23, offsetof(struct PDU, vs_ir), .tag = (ASN_TAG_CLASS_CONTEXT | (8 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_VisibleString, .memb_constraints = memb_vs_ir_constraint_1, .per_constraints = &asn_PER_memb_vs_ir_constr_11, .default_value = 0, .name = "vs-ir" }, { ATF_POINTER, 22, offsetof(struct PDU, pr), .tag = (ASN_TAG_CLASS_CONTEXT | (9 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_PrintableString, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* No PER visible constraints */ .default_value = 0, .name = "pr" }, { ATF_POINTER, 21, offsetof(struct PDU, pr_c), .tag = (ASN_TAG_CLASS_CONTEXT | (10 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_PrintableString, .memb_constraints = memb_pr_c_constraint_1, .per_constraints = &asn_PER_memb_pr_c_constr_13, .default_value = 0, .name = "pr-c" }, { ATF_POINTER, 20, offsetof(struct PDU, pr_ir), .tag = (ASN_TAG_CLASS_CONTEXT | (11 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_PrintableString, .memb_constraints = memb_pr_ir_constraint_1, .per_constraints = &asn_PER_memb_pr_ir_constr_14, .default_value = 0, .name = "pr-ir" }, { ATF_POINTER, 19, offsetof(struct PDU, ns), .tag = (ASN_TAG_CLASS_CONTEXT | (12 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_NumericString, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* No PER visible constraints */ .default_value = 0, .name = "ns" }, { ATF_POINTER, 18, offsetof(struct PDU, ns_c), .tag = (ASN_TAG_CLASS_CONTEXT | (13 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_NumericString, .memb_constraints = memb_ns_c_constraint_1, .per_constraints = &asn_PER_memb_ns_c_constr_16, .default_value = 0, .name = "ns-c" }, { ATF_POINTER, 17, offsetof(struct PDU, ns_ce), .tag = (ASN_TAG_CLASS_CONTEXT | (14 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_NumericString, .memb_constraints = memb_ns_ce_constraint_1, .per_constraints = &asn_PER_memb_ns_ce_constr_17, .default_value = 0, .name = "ns-ce" }, { ATF_POINTER, 16, offsetof(struct PDU, ns_ir), .tag = (ASN_TAG_CLASS_CONTEXT | (15 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_NumericString, .memb_constraints = memb_ns_ir_constraint_1, .per_constraints = &asn_PER_memb_ns_ir_constr_18, .default_value = 0, .name = "ns-ir" }, { ATF_POINTER, 15, offsetof(struct PDU, ut_c), .tag = (ASN_TAG_CLASS_CONTEXT | (16 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_UTF8String, .memb_constraints = memb_ut_c_constraint_1, .per_constraints = &asn_PER_memb_ut_c_constr_19, .default_value = 0, .name = "ut-c" }, { ATF_POINTER, 14, offsetof(struct PDU, ut_ce), .tag = (ASN_TAG_CLASS_CONTEXT | (17 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_UTF8String, .memb_constraints = memb_ut_ce_constraint_1, .per_constraints = &asn_PER_memb_ut_ce_constr_20, .default_value = 0, .name = "ut-ce" }, { ATF_POINTER, 13, offsetof(struct PDU, ut_ir), .tag = (ASN_TAG_CLASS_CONTEXT | (18 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_UTF8String, .memb_constraints = memb_ut_ir_constraint_1, .per_constraints = &asn_PER_memb_ut_ir_constr_21, .default_value = 0, .name = "ut-ir" }, { ATF_POINTER, 12, offsetof(struct PDU, bm), .tag = (ASN_TAG_CLASS_CONTEXT | (19 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_BMPString, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* No PER visible constraints */ .default_value = 0, .name = "bm" }, { ATF_POINTER, 11, offsetof(struct PDU, bm_c), .tag = (ASN_TAG_CLASS_CONTEXT | (20 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_BMPString, .memb_constraints = memb_bm_c_constraint_1, .per_constraints = &asn_PER_memb_bm_c_constr_23, .default_value = 0, .name = "bm-c" }, { ATF_POINTER, 10, offsetof(struct PDU, bm_cs), .tag = (ASN_TAG_CLASS_CONTEXT | (21 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_BMPString, .memb_constraints = memb_bm_cs_constraint_1, .per_constraints = &asn_PER_memb_bm_cs_constr_24, .default_value = 0, .name = "bm-cs" }, { ATF_POINTER, 9, offsetof(struct PDU, bm_ce), .tag = (ASN_TAG_CLASS_CONTEXT | (22 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_BMPString, .memb_constraints = memb_bm_ce_constraint_1, .per_constraints = &asn_PER_memb_bm_ce_constr_25, .default_value = 0, .name = "bm-ce" }, { ATF_POINTER, 8, offsetof(struct PDU, bm_ir), .tag = (ASN_TAG_CLASS_CONTEXT | (23 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_BMPString, .memb_constraints = memb_bm_ir_constraint_1, .per_constraints = &asn_PER_memb_bm_ir_constr_26, .default_value = 0, .name = "bm-ir" }, { ATF_POINTER, 7, offsetof(struct PDU, us), .tag = (ASN_TAG_CLASS_CONTEXT | (24 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_UniversalString, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* No PER visible constraints */ .default_value = 0, .name = "us" }, { ATF_POINTER, 6, offsetof(struct PDU, us_c), .tag = (ASN_TAG_CLASS_CONTEXT | (25 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_UniversalString, .memb_constraints = memb_us_c_constraint_1, .per_constraints = &asn_PER_memb_us_c_constr_28, .default_value = 0, .name = "us-c" }, { ATF_POINTER, 5, offsetof(struct PDU, us_cs), .tag = (ASN_TAG_CLASS_CONTEXT | (26 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_UniversalString, .memb_constraints = memb_us_cs_constraint_1, .per_constraints = &asn_PER_memb_us_cs_constr_29, .default_value = 0, .name = "us-cs" }, { ATF_POINTER, 4, offsetof(struct PDU, us_ce), .tag = (ASN_TAG_CLASS_CONTEXT | (27 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_UniversalString, .memb_constraints = memb_us_ce_constraint_1, .per_constraints = &asn_PER_memb_us_ce_constr_30, .default_value = 0, .name = "us-ce" }, { ATF_POINTER, 3, offsetof(struct PDU, us_ir), .tag = (ASN_TAG_CLASS_CONTEXT | (28 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_UniversalString, .memb_constraints = memb_us_ir_constraint_1, .per_constraints = &asn_PER_memb_us_ir_constr_31, .default_value = 0, .name = "us-ir" }, { ATF_POINTER, 2, offsetof(struct PDU, real), .tag = (ASN_TAG_CLASS_CONTEXT | (29 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_NativeReal, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* No PER visible constraints */ .default_value = 0, .name = "real" }, { ATF_POINTER, 1, offsetof(struct PDU, oid), .tag = (ASN_TAG_CLASS_CONTEXT | (30 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_OBJECT_IDENTIFIER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* No PER visible constraints */ .default_value = 0, .name = "oid" }, }; static const int asn_MAP_PDU_oms_1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30 }; static const ber_tlv_tag_t asn_DEF_PDU_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_PDU_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* many */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* ia5 */ { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* ia5-c */ { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* ia5-ce */ { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* ia5-ir */ { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* vs */ { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* vs-c */ { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 }, /* vs-ce */ { (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 }, /* vs-ir */ { (ASN_TAG_CLASS_CONTEXT | (9 << 2)), 9, 0, 0 }, /* pr */ { (ASN_TAG_CLASS_CONTEXT | (10 << 2)), 10, 0, 0 }, /* pr-c */ { (ASN_TAG_CLASS_CONTEXT | (11 << 2)), 11, 0, 0 }, /* pr-ir */ { (ASN_TAG_CLASS_CONTEXT | (12 << 2)), 12, 0, 0 }, /* ns */ { (ASN_TAG_CLASS_CONTEXT | (13 << 2)), 13, 0, 0 }, /* ns-c */ { (ASN_TAG_CLASS_CONTEXT | (14 << 2)), 14, 0, 0 }, /* ns-ce */ { (ASN_TAG_CLASS_CONTEXT | (15 << 2)), 15, 0, 0 }, /* ns-ir */ { (ASN_TAG_CLASS_CONTEXT | (16 << 2)), 16, 0, 0 }, /* ut-c */ { (ASN_TAG_CLASS_CONTEXT | (17 << 2)), 17, 0, 0 }, /* ut-ce */ { (ASN_TAG_CLASS_CONTEXT | (18 << 2)), 18, 0, 0 }, /* ut-ir */ { (ASN_TAG_CLASS_CONTEXT | (19 << 2)), 19, 0, 0 }, /* bm */ { (ASN_TAG_CLASS_CONTEXT | (20 << 2)), 20, 0, 0 }, /* bm-c */ { (ASN_TAG_CLASS_CONTEXT | (21 << 2)), 21, 0, 0 }, /* bm-cs */ { (ASN_TAG_CLASS_CONTEXT | (22 << 2)), 22, 0, 0 }, /* bm-ce */ { (ASN_TAG_CLASS_CONTEXT | (23 << 2)), 23, 0, 0 }, /* bm-ir */ { (ASN_TAG_CLASS_CONTEXT | (24 << 2)), 24, 0, 0 }, /* us */ { (ASN_TAG_CLASS_CONTEXT | (25 << 2)), 25, 0, 0 }, /* us-c */ { (ASN_TAG_CLASS_CONTEXT | (26 << 2)), 26, 0, 0 }, /* us-cs */ { (ASN_TAG_CLASS_CONTEXT | (27 << 2)), 27, 0, 0 }, /* us-ce */ { (ASN_TAG_CLASS_CONTEXT | (28 << 2)), 28, 0, 0 }, /* us-ir */ { (ASN_TAG_CLASS_CONTEXT | (29 << 2)), 29, 0, 0 }, /* real */ { (ASN_TAG_CLASS_CONTEXT | (30 << 2)), 30, 0, 0 } /* oid */ }; static asn_SEQUENCE_specifics_t asn_SPC_PDU_specs_1 = { sizeof(struct PDU), offsetof(struct PDU, _asn_ctx), asn_MAP_PDU_tag2el_1, 31, /* Count of tags in the map */ asn_MAP_PDU_oms_1, /* Optional members */ 31, 0, /* Root/Additions */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_PDU = { "PDU", "PDU", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_PDU_tags_1, sizeof(asn_DEF_PDU_tags_1) /sizeof(asn_DEF_PDU_tags_1[0]), /* 1 */ asn_DEF_PDU_tags_1, /* Same as above */ sizeof(asn_DEF_PDU_tags_1) /sizeof(asn_DEF_PDU_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_PDU_1, 31, /* Elements count */ &asn_SPC_PDU_specs_1 /* Additional specs */ }; asn1c-0.9.28+dfsg/tests/34-class-OK.asn10000644000000000000000000000221513065714043016025 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .34 ModuleTestClassSimple { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 34 } DEFINITIONS IMPLICIT TAGS ::= BEGIN -- First CLASS EXTENSION ::= CLASS { &id [PRIVATE 0] INTEGER UNIQUE, &ExtnType } WITH SYNTAX { SYNTAX &ExtnType IDENTIFIED BY &id } -- Basic CLASS extraction Ext1 ::= SEQUENCE { extnId EXTENSION.&id } -- Second CLASS EXTENSION-ATTRIBUTE ::= CLASS { &id INTEGER (0..ub-extension-attributes) UNIQUE, &Type } WITH SYNTAX {&Type IDENTIFIED BY &id} terminal-type EXTENSION-ATTRIBUTE ::= {TerminalType IDENTIFIED BY 23} TerminalType ::= INTEGER { terminal(0) } -- Advanced CLASS extraction ExtensionAttribute ::= SEQUENCE { extension-attribute-type [0] EXTENSION-ATTRIBUTE.&id ({ExtensionAttributeTable}), extension-attribute-value [1] EXTENSION-ATTRIBUTE.&Type ({ExtensionAttributeTable} {@extension-attribute-type}) } -- Variables referenced by subtype constraints ub-extension-attributes INTEGER ::= 256 END asn1c-0.9.28+dfsg/tests/21-tags-OK.asn1.-EF0000644000000000000000000000075513065714043016227 0ustar rootrootModuleTestTags1 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 21 1 } DEFINITIONS EXPLICIT TAGS ::= BEGIN T1 ::= CHOICE { first [0] EXPLICIT INTEGER, second [1] EXPLICIT INTEGER } END ModuleTestTags2 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 21 2 } DEFINITIONS IMPLICIT TAGS ::= BEGIN T2 ::= SEQUENCE { one [0] EXPLICIT T1, two [1] IMPLICIT IA5String } END asn1c-0.9.28+dfsg/tests/21-tags-OK.asn10000644000000000000000000000120313065714043015646 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .21 1 -- .21 2 ModuleTestTags1 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 21 1 } DEFINITIONS EXPLICIT TAGS ::= BEGIN T1 ::= CHOICE { first [0] INTEGER, second [1] INTEGER } END ModuleTestTags2 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 21 2 } DEFINITIONS IMPLICIT TAGS ::= BEGIN IMPORTS T1 FROM ModuleTestTags1; T2 ::= SEQUENCE { one [0] T1, two [1] IA5String } END asn1c-0.9.28+dfsg/tests/62-any-OK.asn1.-EF0000644000000000000000000000133513065714043016060 0ustar rootrootModuleTestANYSyntax { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 62 } DEFINITIONS IMPLICIT TAGS ::= BEGIN T ::= CHOICE { s1 T1-ext, s2 T2, s3 T3, s4 T4 } T1-ext ::= SEQUENCE { i INTEGER OPTIONAL, any [1] EXPLICIT ANY, ... } T2 ::= [16] IMPLICIT SEQUENCE { m1 [0] IMPLICIT NumericString, m2 [1] IMPLICIT BOOLEAN, m3 [3] IMPLICIT SEQUENCE OF NumericString, o4 [4] IMPLICIT BOOLEAN OPTIONAL, o5 [5] IMPLICIT BOOLEAN OPTIONAL, o6 [6] IMPLICIT BOOLEAN OPTIONAL } T3 ::= SET { m1 [0] IMPLICIT NumericString, m2 [1] IMPLICIT BOOLEAN } T4 ::= [53] EXPLICIT CHOICE { m1 [1] IMPLICIT OCTET STRING } END asn1c-0.9.28+dfsg/tests/64-oid-constr-OK.asn10000644000000000000000000000061313065714043017004 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .64 ModuleTestOIDConstraint { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 64 } DEFINITIONS ::= BEGIN void OBJECT IDENTIFIER ::= { v 1 3 6 1 4 1 9363 1 5 1 64 1 1 } Id ::= OBJECT IDENTIFIER (void) END asn1c-0.9.28+dfsg/tests/79-constrained-by-OK.asn1.-EF0000644000000000000000000000036013065714043020217 0ustar rootrootModuleTestConstrainedBy { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 79 } DEFINITIONS ::= BEGIN Type ::= SEQUENCE { int INTEGER, ... } (CONSTRAINED BY { -- nothing -- }) END asn1c-0.9.28+dfsg/tests/119-per-strings-OK.asn10000644000000000000000000000324113065714043017261 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .119 ModulePERStrings { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 119 } DEFINITIONS AUTOMATIC TAGS ::= BEGIN PDU ::= SEQUENCE { many SEQUENCE OF PDU OPTIONAL, ia5 IA5String OPTIONAL, ia5-c IA5String (FROM("A".."Z")) OPTIONAL, ia5-ce IA5String (FROM("A".."Z",...)) OPTIONAL, ia5-ir IA5String (FROM("A".."B"|"X".."Z")) OPTIONAL, vs VisibleString OPTIONAL, vs-c VisibleString (FROM("A".."Z")) OPTIONAL, vs-ce VisibleString (FROM("A".."Z",...)) OPTIONAL, vs-ir VisibleString (FROM("A".."B"|"X".."Z")) OPTIONAL, pr PrintableString OPTIONAL, pr-c PrintableString (FROM("A".."Z")) OPTIONAL, pr-ir PrintableString (FROM("A".."B"|"X".."Z")) OPTIONAL, ns NumericString OPTIONAL, ns-c NumericString (FROM("5".."9")) OPTIONAL, ns-ce NumericString (FROM("5".."9",...)) OPTIONAL, ns-ir NumericString (FROM("1"|"9")) OPTIONAL, ut-c UTF8String (SIZE(6)) OPTIONAL, ut-ce UTF8String (SIZE(6,...)) OPTIONAL, ut-ir UTF8String (FROM("A"|"Z")) OPTIONAL, bm BMPString OPTIONAL, bm-c BMPString (FROM("A".."Z")) OPTIONAL, bm-cs BMPString (SIZE(6)) OPTIONAL, bm-ce BMPString (FROM("A".."Z",...)) OPTIONAL, bm-ir BMPString (FROM("A".."B"|"X".."Z")) OPTIONAL, us UniversalString OPTIONAL, us-c UniversalString (FROM("A".."Z")) OPTIONAL, us-cs UniversalString (SIZE(6)) OPTIONAL, us-ce UniversalString (FROM("A".."Z",...)) OPTIONAL, us-ir UniversalString (FROM("A".."B"|"X".."Z")) OPTIONAL, real REAL OPTIONAL, oid OBJECT IDENTIFIER OPTIONAL } END asn1c-0.9.28+dfsg/tests/12-int-SE.asn10000644000000000000000000000051613065714043015506 0ustar rootroot -- SE: Semantic error -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .12 ModuleTestInt6 { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 12 } DEFINITIONS ::= BEGIN -- unresolved reference alpha INTEGER ::= beta END asn1c-0.9.28+dfsg/tests/102-class-ref-SE.asn10000644000000000000000000000061613065714043016654 0ustar rootroot -- SE: Semantic error -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .102 ModuleClassMisUse { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 102 } DEFINITIONS ::= BEGIN REF-ID ::= REF-ID2 REF-ID2 ::= REF-ID RefID ::= SEQUENCE { field REF-ID.&id, params REF-ID.&Type } END asn1c-0.9.28+dfsg/tests/31-set-of-OK.asn1.-EF0000644000000000000000000000105213065714043016456 0ustar rootrootModuleTestSetOfSimple { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 31 } DEFINITIONS IMPLICIT TAGS ::= BEGIN Forest ::= SET OF Tree Tree ::= SEQUENCE { height INTEGER, width INTEGER } Stuff ::= SET { trees [1] IMPLICIT SET OF Forest OPTIONAL, anything [2] IMPLICIT SET OF SEQUENCE { cup-of-coffee BIT STRING, ... } OPTIONAL, ..., other CHOICE { a [0] IMPLICIT INTEGER, b [3] IMPLICIT INTEGER } } END asn1c-0.9.28+dfsg/tests/67-embedded-choice-OK.asn10000644000000000000000000000100713065714043017705 0ustar rootroot -- OK: Everything is Fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .67 ModuleTestEmbeddedChoice { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 67 } DEFINITIONS AUTOMATIC TAGS ::= BEGIN A ::= CHOICE { a NULL, b NULL, ... } B ::= CHOICE { a NULL, b NULL, ..., other A -- Only AUTOMATIC TAGS make it right } C ::= SET { a NULL, b NULL, ..., other1 A, other2 B } END asn1c-0.9.28+dfsg/tests/90-cond-int-type-OK.asn1.-Pfwide-types0000644000000000000000000025143213065714043022057 0ustar rootroot /*** <<< INCLUDES [CN-IntegerUnlimited] >>> ***/ #include /*** <<< TYPE-DECLS [CN-IntegerUnlimited] >>> ***/ typedef INTEGER_t CN_IntegerUnlimited_t; /*** <<< FUNC-DECLS [CN-IntegerUnlimited] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_CN_IntegerUnlimited; asn_struct_free_f CN_IntegerUnlimited_free; asn_struct_print_f CN_IntegerUnlimited_print; asn_constr_check_f CN_IntegerUnlimited_constraint; ber_type_decoder_f CN_IntegerUnlimited_decode_ber; der_type_encoder_f CN_IntegerUnlimited_encode_der; xer_type_decoder_f CN_IntegerUnlimited_decode_xer; xer_type_encoder_f CN_IntegerUnlimited_encode_xer; /*** <<< CODE [CN-IntegerUnlimited] >>> ***/ int CN_IntegerUnlimited_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_INTEGER.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using INTEGER, * so here we adjust the DEF accordingly. */ static void CN_IntegerUnlimited_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_INTEGER.free_struct; td->print_struct = asn_DEF_INTEGER.print_struct; td->check_constraints = asn_DEF_INTEGER.check_constraints; td->ber_decoder = asn_DEF_INTEGER.ber_decoder; td->der_encoder = asn_DEF_INTEGER.der_encoder; td->xer_decoder = asn_DEF_INTEGER.xer_decoder; td->xer_encoder = asn_DEF_INTEGER.xer_encoder; td->uper_decoder = asn_DEF_INTEGER.uper_decoder; td->uper_encoder = asn_DEF_INTEGER.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; td->elements = asn_DEF_INTEGER.elements; td->elements_count = asn_DEF_INTEGER.elements_count; td->specifics = asn_DEF_INTEGER.specifics; } void CN_IntegerUnlimited_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { CN_IntegerUnlimited_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int CN_IntegerUnlimited_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerUnlimited_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t CN_IntegerUnlimited_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { CN_IntegerUnlimited_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t CN_IntegerUnlimited_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerUnlimited_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t CN_IntegerUnlimited_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { CN_IntegerUnlimited_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t CN_IntegerUnlimited_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerUnlimited_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [CN-IntegerUnlimited] >>> ***/ static const ber_tlv_tag_t asn_DEF_CN_IntegerUnlimited_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_CN_IntegerUnlimited = { "CN-IntegerUnlimited", "CN-IntegerUnlimited", CN_IntegerUnlimited_free, CN_IntegerUnlimited_print, CN_IntegerUnlimited_constraint, CN_IntegerUnlimited_decode_ber, CN_IntegerUnlimited_encode_der, CN_IntegerUnlimited_decode_xer, CN_IntegerUnlimited_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_CN_IntegerUnlimited_tags_1, sizeof(asn_DEF_CN_IntegerUnlimited_tags_1) /sizeof(asn_DEF_CN_IntegerUnlimited_tags_1[0]), /* 1 */ asn_DEF_CN_IntegerUnlimited_tags_1, /* Same as above */ sizeof(asn_DEF_CN_IntegerUnlimited_tags_1) /sizeof(asn_DEF_CN_IntegerUnlimited_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [CN-IntegerMinMax] >>> ***/ #include /*** <<< TYPE-DECLS [CN-IntegerMinMax] >>> ***/ typedef INTEGER_t CN_IntegerMinMax_t; /*** <<< FUNC-DECLS [CN-IntegerMinMax] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_CN_IntegerMinMax; asn_struct_free_f CN_IntegerMinMax_free; asn_struct_print_f CN_IntegerMinMax_print; asn_constr_check_f CN_IntegerMinMax_constraint; ber_type_decoder_f CN_IntegerMinMax_decode_ber; der_type_encoder_f CN_IntegerMinMax_encode_der; xer_type_decoder_f CN_IntegerMinMax_decode_xer; xer_type_encoder_f CN_IntegerMinMax_encode_xer; /*** <<< CODE [CN-IntegerMinMax] >>> ***/ int CN_IntegerMinMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(1 /* No applicable constraints whatsoever */) { /* Nothing is here. See below */ } /* Replace with underlying type checker */ td->check_constraints = asn_DEF_INTEGER.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using INTEGER, * so here we adjust the DEF accordingly. */ static void CN_IntegerMinMax_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_INTEGER.free_struct; td->print_struct = asn_DEF_INTEGER.print_struct; td->check_constraints = asn_DEF_INTEGER.check_constraints; td->ber_decoder = asn_DEF_INTEGER.ber_decoder; td->der_encoder = asn_DEF_INTEGER.der_encoder; td->xer_decoder = asn_DEF_INTEGER.xer_decoder; td->xer_encoder = asn_DEF_INTEGER.xer_encoder; td->uper_decoder = asn_DEF_INTEGER.uper_decoder; td->uper_encoder = asn_DEF_INTEGER.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; td->elements = asn_DEF_INTEGER.elements; td->elements_count = asn_DEF_INTEGER.elements_count; td->specifics = asn_DEF_INTEGER.specifics; } void CN_IntegerMinMax_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { CN_IntegerMinMax_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int CN_IntegerMinMax_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerMinMax_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t CN_IntegerMinMax_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { CN_IntegerMinMax_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t CN_IntegerMinMax_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerMinMax_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t CN_IntegerMinMax_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { CN_IntegerMinMax_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t CN_IntegerMinMax_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerMinMax_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [CN-IntegerMinMax] >>> ***/ static const ber_tlv_tag_t asn_DEF_CN_IntegerMinMax_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_CN_IntegerMinMax = { "CN-IntegerMinMax", "CN-IntegerMinMax", CN_IntegerMinMax_free, CN_IntegerMinMax_print, CN_IntegerMinMax_constraint, CN_IntegerMinMax_decode_ber, CN_IntegerMinMax_encode_der, CN_IntegerMinMax_decode_xer, CN_IntegerMinMax_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_CN_IntegerMinMax_tags_1, sizeof(asn_DEF_CN_IntegerMinMax_tags_1) /sizeof(asn_DEF_CN_IntegerMinMax_tags_1[0]), /* 1 */ asn_DEF_CN_IntegerMinMax_tags_1, /* Same as above */ sizeof(asn_DEF_CN_IntegerMinMax_tags_1) /sizeof(asn_DEF_CN_IntegerMinMax_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [CN-IntegerMinLow] >>> ***/ #include /*** <<< TYPE-DECLS [CN-IntegerMinLow] >>> ***/ typedef INTEGER_t CN_IntegerMinLow_t; /*** <<< FUNC-DECLS [CN-IntegerMinLow] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_CN_IntegerMinLow; asn_struct_free_f CN_IntegerMinLow_free; asn_struct_print_f CN_IntegerMinLow_print; asn_constr_check_f CN_IntegerMinLow_constraint; ber_type_decoder_f CN_IntegerMinLow_decode_ber; der_type_encoder_f CN_IntegerMinLow_encode_der; xer_type_decoder_f CN_IntegerMinLow_decode_xer; xer_type_encoder_f CN_IntegerMinLow_encode_xer; /*** <<< CODE [CN-IntegerMinLow] >>> ***/ int CN_IntegerMinLow_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(asn_INTEGER2long(st, &value)) { ASN__CTFAIL(app_key, td, sptr, "%s: value too large (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if((value <= 1)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using INTEGER, * so here we adjust the DEF accordingly. */ static void CN_IntegerMinLow_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_INTEGER.free_struct; td->print_struct = asn_DEF_INTEGER.print_struct; td->check_constraints = asn_DEF_INTEGER.check_constraints; td->ber_decoder = asn_DEF_INTEGER.ber_decoder; td->der_encoder = asn_DEF_INTEGER.der_encoder; td->xer_decoder = asn_DEF_INTEGER.xer_decoder; td->xer_encoder = asn_DEF_INTEGER.xer_encoder; td->uper_decoder = asn_DEF_INTEGER.uper_decoder; td->uper_encoder = asn_DEF_INTEGER.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; td->elements = asn_DEF_INTEGER.elements; td->elements_count = asn_DEF_INTEGER.elements_count; td->specifics = asn_DEF_INTEGER.specifics; } void CN_IntegerMinLow_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { CN_IntegerMinLow_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int CN_IntegerMinLow_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerMinLow_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t CN_IntegerMinLow_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { CN_IntegerMinLow_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t CN_IntegerMinLow_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerMinLow_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t CN_IntegerMinLow_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { CN_IntegerMinLow_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t CN_IntegerMinLow_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerMinLow_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [CN-IntegerMinLow] >>> ***/ static const ber_tlv_tag_t asn_DEF_CN_IntegerMinLow_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_CN_IntegerMinLow = { "CN-IntegerMinLow", "CN-IntegerMinLow", CN_IntegerMinLow_free, CN_IntegerMinLow_print, CN_IntegerMinLow_constraint, CN_IntegerMinLow_decode_ber, CN_IntegerMinLow_encode_der, CN_IntegerMinLow_decode_xer, CN_IntegerMinLow_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_CN_IntegerMinLow_tags_1, sizeof(asn_DEF_CN_IntegerMinLow_tags_1) /sizeof(asn_DEF_CN_IntegerMinLow_tags_1[0]), /* 1 */ asn_DEF_CN_IntegerMinLow_tags_1, /* Same as above */ sizeof(asn_DEF_CN_IntegerMinLow_tags_1) /sizeof(asn_DEF_CN_IntegerMinLow_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [NO-IntegerMinHigh] >>> ***/ #include /*** <<< TYPE-DECLS [NO-IntegerMinHigh] >>> ***/ typedef INTEGER_t NO_IntegerMinHigh_t; /*** <<< FUNC-DECLS [NO-IntegerMinHigh] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_NO_IntegerMinHigh; asn_struct_free_f NO_IntegerMinHigh_free; asn_struct_print_f NO_IntegerMinHigh_print; asn_constr_check_f NO_IntegerMinHigh_constraint; ber_type_decoder_f NO_IntegerMinHigh_decode_ber; der_type_encoder_f NO_IntegerMinHigh_encode_der; xer_type_decoder_f NO_IntegerMinHigh_decode_xer; xer_type_encoder_f NO_IntegerMinHigh_encode_xer; /*** <<< CODE [NO-IntegerMinHigh] >>> ***/ int NO_IntegerMinHigh_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(asn_INTEGER2long(st, &value)) { ASN__CTFAIL(app_key, td, sptr, "%s: value too large (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if((value <= 3000000000)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using INTEGER, * so here we adjust the DEF accordingly. */ static void NO_IntegerMinHigh_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_INTEGER.free_struct; td->print_struct = asn_DEF_INTEGER.print_struct; td->check_constraints = asn_DEF_INTEGER.check_constraints; td->ber_decoder = asn_DEF_INTEGER.ber_decoder; td->der_encoder = asn_DEF_INTEGER.der_encoder; td->xer_decoder = asn_DEF_INTEGER.xer_decoder; td->xer_encoder = asn_DEF_INTEGER.xer_encoder; td->uper_decoder = asn_DEF_INTEGER.uper_decoder; td->uper_encoder = asn_DEF_INTEGER.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; td->elements = asn_DEF_INTEGER.elements; td->elements_count = asn_DEF_INTEGER.elements_count; td->specifics = asn_DEF_INTEGER.specifics; } void NO_IntegerMinHigh_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { NO_IntegerMinHigh_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int NO_IntegerMinHigh_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerMinHigh_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t NO_IntegerMinHigh_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { NO_IntegerMinHigh_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t NO_IntegerMinHigh_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerMinHigh_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t NO_IntegerMinHigh_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { NO_IntegerMinHigh_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t NO_IntegerMinHigh_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerMinHigh_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [NO-IntegerMinHigh] >>> ***/ static const ber_tlv_tag_t asn_DEF_NO_IntegerMinHigh_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_NO_IntegerMinHigh = { "NO-IntegerMinHigh", "NO-IntegerMinHigh", NO_IntegerMinHigh_free, NO_IntegerMinHigh_print, NO_IntegerMinHigh_constraint, NO_IntegerMinHigh_decode_ber, NO_IntegerMinHigh_encode_der, NO_IntegerMinHigh_decode_xer, NO_IntegerMinHigh_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerMinHigh_tags_1, sizeof(asn_DEF_NO_IntegerMinHigh_tags_1) /sizeof(asn_DEF_NO_IntegerMinHigh_tags_1[0]), /* 1 */ asn_DEF_NO_IntegerMinHigh_tags_1, /* Same as above */ sizeof(asn_DEF_NO_IntegerMinHigh_tags_1) /sizeof(asn_DEF_NO_IntegerMinHigh_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [NO-IntegerLowHigh] >>> ***/ #include /*** <<< TYPE-DECLS [NO-IntegerLowHigh] >>> ***/ typedef unsigned long NO_IntegerLowHigh_t; /*** <<< FUNC-DECLS [NO-IntegerLowHigh] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_NO_IntegerLowHigh; asn_struct_free_f NO_IntegerLowHigh_free; asn_struct_print_f NO_IntegerLowHigh_print; asn_constr_check_f NO_IntegerLowHigh_constraint; ber_type_decoder_f NO_IntegerLowHigh_decode_ber; der_type_encoder_f NO_IntegerLowHigh_encode_der; xer_type_decoder_f NO_IntegerLowHigh_decode_xer; xer_type_encoder_f NO_IntegerLowHigh_encode_xer; /*** <<< CODE [NO-IntegerLowHigh] >>> ***/ int NO_IntegerLowHigh_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { unsigned long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const unsigned long *)sptr; if((value >= 1 && value <= 3000000000)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void NO_IntegerLowHigh_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; /* td->specifics = asn_DEF_NativeInteger.specifics; // Defined explicitly */ } void NO_IntegerLowHigh_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { NO_IntegerLowHigh_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int NO_IntegerLowHigh_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerLowHigh_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t NO_IntegerLowHigh_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { NO_IntegerLowHigh_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t NO_IntegerLowHigh_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerLowHigh_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t NO_IntegerLowHigh_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { NO_IntegerLowHigh_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t NO_IntegerLowHigh_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerLowHigh_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [NO-IntegerLowHigh] >>> ***/ static const asn_INTEGER_specifics_t asn_SPC_NO_IntegerLowHigh_specs_1 = { 0, 0, 0, 0, 0, 0, /* Native long size */ 1 /* Unsigned representation */ }; static const ber_tlv_tag_t asn_DEF_NO_IntegerLowHigh_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_NO_IntegerLowHigh = { "NO-IntegerLowHigh", "NO-IntegerLowHigh", NO_IntegerLowHigh_free, NO_IntegerLowHigh_print, NO_IntegerLowHigh_constraint, NO_IntegerLowHigh_decode_ber, NO_IntegerLowHigh_encode_der, NO_IntegerLowHigh_decode_xer, NO_IntegerLowHigh_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerLowHigh_tags_1, sizeof(asn_DEF_NO_IntegerLowHigh_tags_1) /sizeof(asn_DEF_NO_IntegerLowHigh_tags_1[0]), /* 1 */ asn_DEF_NO_IntegerLowHigh_tags_1, /* Same as above */ sizeof(asn_DEF_NO_IntegerLowHigh_tags_1) /sizeof(asn_DEF_NO_IntegerLowHigh_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ &asn_SPC_NO_IntegerLowHigh_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [CN-IntegerLowMax] >>> ***/ #include /*** <<< TYPE-DECLS [CN-IntegerLowMax] >>> ***/ typedef INTEGER_t CN_IntegerLowMax_t; /*** <<< FUNC-DECLS [CN-IntegerLowMax] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_CN_IntegerLowMax; asn_struct_free_f CN_IntegerLowMax_free; asn_struct_print_f CN_IntegerLowMax_print; asn_constr_check_f CN_IntegerLowMax_constraint; ber_type_decoder_f CN_IntegerLowMax_decode_ber; der_type_encoder_f CN_IntegerLowMax_encode_der; xer_type_decoder_f CN_IntegerLowMax_decode_xer; xer_type_encoder_f CN_IntegerLowMax_encode_xer; /*** <<< CODE [CN-IntegerLowMax] >>> ***/ int CN_IntegerLowMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(asn_INTEGER2long(st, &value)) { ASN__CTFAIL(app_key, td, sptr, "%s: value too large (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if((value >= 1)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using INTEGER, * so here we adjust the DEF accordingly. */ static void CN_IntegerLowMax_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_INTEGER.free_struct; td->print_struct = asn_DEF_INTEGER.print_struct; td->check_constraints = asn_DEF_INTEGER.check_constraints; td->ber_decoder = asn_DEF_INTEGER.ber_decoder; td->der_encoder = asn_DEF_INTEGER.der_encoder; td->xer_decoder = asn_DEF_INTEGER.xer_decoder; td->xer_encoder = asn_DEF_INTEGER.xer_encoder; td->uper_decoder = asn_DEF_INTEGER.uper_decoder; td->uper_encoder = asn_DEF_INTEGER.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; td->elements = asn_DEF_INTEGER.elements; td->elements_count = asn_DEF_INTEGER.elements_count; td->specifics = asn_DEF_INTEGER.specifics; } void CN_IntegerLowMax_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { CN_IntegerLowMax_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int CN_IntegerLowMax_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerLowMax_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t CN_IntegerLowMax_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { CN_IntegerLowMax_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t CN_IntegerLowMax_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerLowMax_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t CN_IntegerLowMax_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { CN_IntegerLowMax_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t CN_IntegerLowMax_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerLowMax_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [CN-IntegerLowMax] >>> ***/ static const ber_tlv_tag_t asn_DEF_CN_IntegerLowMax_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_CN_IntegerLowMax = { "CN-IntegerLowMax", "CN-IntegerLowMax", CN_IntegerLowMax_free, CN_IntegerLowMax_print, CN_IntegerLowMax_constraint, CN_IntegerLowMax_decode_ber, CN_IntegerLowMax_encode_der, CN_IntegerLowMax_decode_xer, CN_IntegerLowMax_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_CN_IntegerLowMax_tags_1, sizeof(asn_DEF_CN_IntegerLowMax_tags_1) /sizeof(asn_DEF_CN_IntegerLowMax_tags_1[0]), /* 1 */ asn_DEF_CN_IntegerLowMax_tags_1, /* Same as above */ sizeof(asn_DEF_CN_IntegerLowMax_tags_1) /sizeof(asn_DEF_CN_IntegerLowMax_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [NO-IntegerHighMax] >>> ***/ #include /*** <<< TYPE-DECLS [NO-IntegerHighMax] >>> ***/ typedef INTEGER_t NO_IntegerHighMax_t; /*** <<< FUNC-DECLS [NO-IntegerHighMax] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_NO_IntegerHighMax; asn_struct_free_f NO_IntegerHighMax_free; asn_struct_print_f NO_IntegerHighMax_print; asn_constr_check_f NO_IntegerHighMax_constraint; ber_type_decoder_f NO_IntegerHighMax_decode_ber; der_type_encoder_f NO_IntegerHighMax_encode_der; xer_type_decoder_f NO_IntegerHighMax_decode_xer; xer_type_encoder_f NO_IntegerHighMax_encode_xer; /*** <<< CODE [NO-IntegerHighMax] >>> ***/ int NO_IntegerHighMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(asn_INTEGER2long(st, &value)) { ASN__CTFAIL(app_key, td, sptr, "%s: value too large (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if((value >= 3000000000)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using INTEGER, * so here we adjust the DEF accordingly. */ static void NO_IntegerHighMax_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_INTEGER.free_struct; td->print_struct = asn_DEF_INTEGER.print_struct; td->check_constraints = asn_DEF_INTEGER.check_constraints; td->ber_decoder = asn_DEF_INTEGER.ber_decoder; td->der_encoder = asn_DEF_INTEGER.der_encoder; td->xer_decoder = asn_DEF_INTEGER.xer_decoder; td->xer_encoder = asn_DEF_INTEGER.xer_encoder; td->uper_decoder = asn_DEF_INTEGER.uper_decoder; td->uper_encoder = asn_DEF_INTEGER.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; td->elements = asn_DEF_INTEGER.elements; td->elements_count = asn_DEF_INTEGER.elements_count; td->specifics = asn_DEF_INTEGER.specifics; } void NO_IntegerHighMax_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { NO_IntegerHighMax_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int NO_IntegerHighMax_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerHighMax_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t NO_IntegerHighMax_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { NO_IntegerHighMax_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t NO_IntegerHighMax_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerHighMax_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t NO_IntegerHighMax_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { NO_IntegerHighMax_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t NO_IntegerHighMax_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerHighMax_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [NO-IntegerHighMax] >>> ***/ static const ber_tlv_tag_t asn_DEF_NO_IntegerHighMax_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_NO_IntegerHighMax = { "NO-IntegerHighMax", "NO-IntegerHighMax", NO_IntegerHighMax_free, NO_IntegerHighMax_print, NO_IntegerHighMax_constraint, NO_IntegerHighMax_decode_ber, NO_IntegerHighMax_encode_der, NO_IntegerHighMax_decode_xer, NO_IntegerHighMax_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerHighMax_tags_1, sizeof(asn_DEF_NO_IntegerHighMax_tags_1) /sizeof(asn_DEF_NO_IntegerHighMax_tags_1[0]), /* 1 */ asn_DEF_NO_IntegerHighMax_tags_1, /* Same as above */ sizeof(asn_DEF_NO_IntegerHighMax_tags_1) /sizeof(asn_DEF_NO_IntegerHighMax_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [NO-IntegerLowestMax] >>> ***/ #include /*** <<< TYPE-DECLS [NO-IntegerLowestMax] >>> ***/ typedef INTEGER_t NO_IntegerLowestMax_t; /*** <<< FUNC-DECLS [NO-IntegerLowestMax] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_NO_IntegerLowestMax; asn_struct_free_f NO_IntegerLowestMax_free; asn_struct_print_f NO_IntegerLowestMax_print; asn_constr_check_f NO_IntegerLowestMax_constraint; ber_type_decoder_f NO_IntegerLowestMax_decode_ber; der_type_encoder_f NO_IntegerLowestMax_encode_der; xer_type_decoder_f NO_IntegerLowestMax_decode_xer; xer_type_encoder_f NO_IntegerLowestMax_encode_xer; /*** <<< CODE [NO-IntegerLowestMax] >>> ***/ int NO_IntegerLowestMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(asn_INTEGER2long(st, &value)) { ASN__CTFAIL(app_key, td, sptr, "%s: value too large (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if((value >= -3000000000)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using INTEGER, * so here we adjust the DEF accordingly. */ static void NO_IntegerLowestMax_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_INTEGER.free_struct; td->print_struct = asn_DEF_INTEGER.print_struct; td->check_constraints = asn_DEF_INTEGER.check_constraints; td->ber_decoder = asn_DEF_INTEGER.ber_decoder; td->der_encoder = asn_DEF_INTEGER.der_encoder; td->xer_decoder = asn_DEF_INTEGER.xer_decoder; td->xer_encoder = asn_DEF_INTEGER.xer_encoder; td->uper_decoder = asn_DEF_INTEGER.uper_decoder; td->uper_encoder = asn_DEF_INTEGER.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; td->elements = asn_DEF_INTEGER.elements; td->elements_count = asn_DEF_INTEGER.elements_count; td->specifics = asn_DEF_INTEGER.specifics; } void NO_IntegerLowestMax_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { NO_IntegerLowestMax_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int NO_IntegerLowestMax_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerLowestMax_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t NO_IntegerLowestMax_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { NO_IntegerLowestMax_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t NO_IntegerLowestMax_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerLowestMax_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t NO_IntegerLowestMax_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { NO_IntegerLowestMax_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t NO_IntegerLowestMax_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerLowestMax_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [NO-IntegerLowestMax] >>> ***/ static const ber_tlv_tag_t asn_DEF_NO_IntegerLowestMax_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_NO_IntegerLowestMax = { "NO-IntegerLowestMax", "NO-IntegerLowestMax", NO_IntegerLowestMax_free, NO_IntegerLowestMax_print, NO_IntegerLowestMax_constraint, NO_IntegerLowestMax_decode_ber, NO_IntegerLowestMax_encode_der, NO_IntegerLowestMax_decode_xer, NO_IntegerLowestMax_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerLowestMax_tags_1, sizeof(asn_DEF_NO_IntegerLowestMax_tags_1) /sizeof(asn_DEF_NO_IntegerLowestMax_tags_1[0]), /* 1 */ asn_DEF_NO_IntegerLowestMax_tags_1, /* Same as above */ sizeof(asn_DEF_NO_IntegerLowestMax_tags_1) /sizeof(asn_DEF_NO_IntegerLowestMax_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [NO-IntegerOutRange] >>> ***/ #include /*** <<< TYPE-DECLS [NO-IntegerOutRange] >>> ***/ typedef unsigned long NO_IntegerOutRange_t; /*** <<< FUNC-DECLS [NO-IntegerOutRange] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_NO_IntegerOutRange; asn_struct_free_f NO_IntegerOutRange_free; asn_struct_print_f NO_IntegerOutRange_print; asn_constr_check_f NO_IntegerOutRange_constraint; ber_type_decoder_f NO_IntegerOutRange_decode_ber; der_type_encoder_f NO_IntegerOutRange_encode_der; xer_type_decoder_f NO_IntegerOutRange_decode_xer; xer_type_encoder_f NO_IntegerOutRange_encode_xer; /*** <<< CODE [NO-IntegerOutRange] >>> ***/ int NO_IntegerOutRange_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { unsigned long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const unsigned long *)sptr; if((value >= 3000000000 && value <= 3000000001)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void NO_IntegerOutRange_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; /* td->specifics = asn_DEF_NativeInteger.specifics; // Defined explicitly */ } void NO_IntegerOutRange_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { NO_IntegerOutRange_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int NO_IntegerOutRange_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerOutRange_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t NO_IntegerOutRange_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { NO_IntegerOutRange_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t NO_IntegerOutRange_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerOutRange_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t NO_IntegerOutRange_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { NO_IntegerOutRange_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t NO_IntegerOutRange_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerOutRange_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [NO-IntegerOutRange] >>> ***/ static const asn_INTEGER_specifics_t asn_SPC_NO_IntegerOutRange_specs_1 = { 0, 0, 0, 0, 0, 0, /* Native long size */ 1 /* Unsigned representation */ }; static const ber_tlv_tag_t asn_DEF_NO_IntegerOutRange_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_NO_IntegerOutRange = { "NO-IntegerOutRange", "NO-IntegerOutRange", NO_IntegerOutRange_free, NO_IntegerOutRange_print, NO_IntegerOutRange_constraint, NO_IntegerOutRange_decode_ber, NO_IntegerOutRange_encode_der, NO_IntegerOutRange_decode_xer, NO_IntegerOutRange_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerOutRange_tags_1, sizeof(asn_DEF_NO_IntegerOutRange_tags_1) /sizeof(asn_DEF_NO_IntegerOutRange_tags_1[0]), /* 1 */ asn_DEF_NO_IntegerOutRange_tags_1, /* Same as above */ sizeof(asn_DEF_NO_IntegerOutRange_tags_1) /sizeof(asn_DEF_NO_IntegerOutRange_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ &asn_SPC_NO_IntegerOutRange_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [NO-IntegerOutValue] >>> ***/ #include /*** <<< TYPE-DECLS [NO-IntegerOutValue] >>> ***/ typedef unsigned long NO_IntegerOutValue_t; /*** <<< FUNC-DECLS [NO-IntegerOutValue] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_NO_IntegerOutValue; asn_struct_free_f NO_IntegerOutValue_free; asn_struct_print_f NO_IntegerOutValue_print; asn_constr_check_f NO_IntegerOutValue_constraint; ber_type_decoder_f NO_IntegerOutValue_decode_ber; der_type_encoder_f NO_IntegerOutValue_encode_der; xer_type_decoder_f NO_IntegerOutValue_decode_xer; xer_type_encoder_f NO_IntegerOutValue_encode_xer; /*** <<< CODE [NO-IntegerOutValue] >>> ***/ int NO_IntegerOutValue_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { unsigned long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const unsigned long *)sptr; if((value == 3000000000)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void NO_IntegerOutValue_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; /* td->specifics = asn_DEF_NativeInteger.specifics; // Defined explicitly */ } void NO_IntegerOutValue_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { NO_IntegerOutValue_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int NO_IntegerOutValue_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerOutValue_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t NO_IntegerOutValue_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { NO_IntegerOutValue_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t NO_IntegerOutValue_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerOutValue_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t NO_IntegerOutValue_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { NO_IntegerOutValue_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t NO_IntegerOutValue_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerOutValue_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [NO-IntegerOutValue] >>> ***/ static const asn_INTEGER_specifics_t asn_SPC_NO_IntegerOutValue_specs_1 = { 0, 0, 0, 0, 0, 0, /* Native long size */ 1 /* Unsigned representation */ }; static const ber_tlv_tag_t asn_DEF_NO_IntegerOutValue_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_NO_IntegerOutValue = { "NO-IntegerOutValue", "NO-IntegerOutValue", NO_IntegerOutValue_free, NO_IntegerOutValue_print, NO_IntegerOutValue_constraint, NO_IntegerOutValue_decode_ber, NO_IntegerOutValue_encode_der, NO_IntegerOutValue_decode_xer, NO_IntegerOutValue_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerOutValue_tags_1, sizeof(asn_DEF_NO_IntegerOutValue_tags_1) /sizeof(asn_DEF_NO_IntegerOutValue_tags_1[0]), /* 1 */ asn_DEF_NO_IntegerOutValue_tags_1, /* Same as above */ sizeof(asn_DEF_NO_IntegerOutValue_tags_1) /sizeof(asn_DEF_NO_IntegerOutValue_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ &asn_SPC_NO_IntegerOutValue_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [OK-IntegerInRange1] >>> ***/ #include /*** <<< TYPE-DECLS [OK-IntegerInRange1] >>> ***/ typedef long OK_IntegerInRange1_t; /*** <<< FUNC-DECLS [OK-IntegerInRange1] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange1; asn_struct_free_f OK_IntegerInRange1_free; asn_struct_print_f OK_IntegerInRange1_print; asn_constr_check_f OK_IntegerInRange1_constraint; ber_type_decoder_f OK_IntegerInRange1_decode_ber; der_type_encoder_f OK_IntegerInRange1_encode_der; xer_type_decoder_f OK_IntegerInRange1_decode_xer; xer_type_encoder_f OK_IntegerInRange1_encode_xer; /*** <<< CODE [OK-IntegerInRange1] >>> ***/ int OK_IntegerInRange1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if((value >= -100 && value <= 100)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void OK_IntegerInRange1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; td->specifics = asn_DEF_NativeInteger.specifics; } void OK_IntegerInRange1_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { OK_IntegerInRange1_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int OK_IntegerInRange1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange1_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t OK_IntegerInRange1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { OK_IntegerInRange1_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t OK_IntegerInRange1_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange1_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t OK_IntegerInRange1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { OK_IntegerInRange1_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t OK_IntegerInRange1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange1_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [OK-IntegerInRange1] >>> ***/ static const ber_tlv_tag_t asn_DEF_OK_IntegerInRange1_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange1 = { "OK-IntegerInRange1", "OK-IntegerInRange1", OK_IntegerInRange1_free, OK_IntegerInRange1_print, OK_IntegerInRange1_constraint, OK_IntegerInRange1_decode_ber, OK_IntegerInRange1_encode_der, OK_IntegerInRange1_decode_xer, OK_IntegerInRange1_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_OK_IntegerInRange1_tags_1, sizeof(asn_DEF_OK_IntegerInRange1_tags_1) /sizeof(asn_DEF_OK_IntegerInRange1_tags_1[0]), /* 1 */ asn_DEF_OK_IntegerInRange1_tags_1, /* Same as above */ sizeof(asn_DEF_OK_IntegerInRange1_tags_1) /sizeof(asn_DEF_OK_IntegerInRange1_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [OK-IntegerInRange2] >>> ***/ #include /*** <<< TYPE-DECLS [OK-IntegerInRange2] >>> ***/ typedef long OK_IntegerInRange2_t; /*** <<< FUNC-DECLS [OK-IntegerInRange2] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange2; asn_struct_free_f OK_IntegerInRange2_free; asn_struct_print_f OK_IntegerInRange2_print; asn_constr_check_f OK_IntegerInRange2_constraint; ber_type_decoder_f OK_IntegerInRange2_decode_ber; der_type_encoder_f OK_IntegerInRange2_encode_der; xer_type_decoder_f OK_IntegerInRange2_decode_xer; xer_type_encoder_f OK_IntegerInRange2_encode_xer; /*** <<< CODE [OK-IntegerInRange2] >>> ***/ int OK_IntegerInRange2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if(((value == -100) || (value == 100))) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void OK_IntegerInRange2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; td->specifics = asn_DEF_NativeInteger.specifics; } void OK_IntegerInRange2_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { OK_IntegerInRange2_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int OK_IntegerInRange2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange2_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t OK_IntegerInRange2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { OK_IntegerInRange2_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t OK_IntegerInRange2_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange2_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t OK_IntegerInRange2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { OK_IntegerInRange2_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t OK_IntegerInRange2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange2_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [OK-IntegerInRange2] >>> ***/ static const ber_tlv_tag_t asn_DEF_OK_IntegerInRange2_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange2 = { "OK-IntegerInRange2", "OK-IntegerInRange2", OK_IntegerInRange2_free, OK_IntegerInRange2_print, OK_IntegerInRange2_constraint, OK_IntegerInRange2_decode_ber, OK_IntegerInRange2_encode_der, OK_IntegerInRange2_decode_xer, OK_IntegerInRange2_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_OK_IntegerInRange2_tags_1, sizeof(asn_DEF_OK_IntegerInRange2_tags_1) /sizeof(asn_DEF_OK_IntegerInRange2_tags_1[0]), /* 1 */ asn_DEF_OK_IntegerInRange2_tags_1, /* Same as above */ sizeof(asn_DEF_OK_IntegerInRange2_tags_1) /sizeof(asn_DEF_OK_IntegerInRange2_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [OK-IntegerInRange3] >>> ***/ #include /*** <<< TYPE-DECLS [OK-IntegerInRange3] >>> ***/ typedef long OK_IntegerInRange3_t; /*** <<< FUNC-DECLS [OK-IntegerInRange3] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange3; asn_struct_free_f OK_IntegerInRange3_free; asn_struct_print_f OK_IntegerInRange3_print; asn_constr_check_f OK_IntegerInRange3_constraint; ber_type_decoder_f OK_IntegerInRange3_decode_ber; der_type_encoder_f OK_IntegerInRange3_encode_der; xer_type_decoder_f OK_IntegerInRange3_decode_xer; xer_type_encoder_f OK_IntegerInRange3_encode_xer; /*** <<< CODE [OK-IntegerInRange3] >>> ***/ int OK_IntegerInRange3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if((value >= (-2147483647L - 1) && value <= 2147483647)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void OK_IntegerInRange3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; td->specifics = asn_DEF_NativeInteger.specifics; } void OK_IntegerInRange3_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { OK_IntegerInRange3_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int OK_IntegerInRange3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange3_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t OK_IntegerInRange3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { OK_IntegerInRange3_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t OK_IntegerInRange3_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange3_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t OK_IntegerInRange3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { OK_IntegerInRange3_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t OK_IntegerInRange3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange3_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [OK-IntegerInRange3] >>> ***/ static const ber_tlv_tag_t asn_DEF_OK_IntegerInRange3_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange3 = { "OK-IntegerInRange3", "OK-IntegerInRange3", OK_IntegerInRange3_free, OK_IntegerInRange3_print, OK_IntegerInRange3_constraint, OK_IntegerInRange3_decode_ber, OK_IntegerInRange3_encode_der, OK_IntegerInRange3_decode_xer, OK_IntegerInRange3_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_OK_IntegerInRange3_tags_1, sizeof(asn_DEF_OK_IntegerInRange3_tags_1) /sizeof(asn_DEF_OK_IntegerInRange3_tags_1[0]), /* 1 */ asn_DEF_OK_IntegerInRange3_tags_1, /* Same as above */ sizeof(asn_DEF_OK_IntegerInRange3_tags_1) /sizeof(asn_DEF_OK_IntegerInRange3_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [OK-IntegerInRange4] >>> ***/ #include /*** <<< TYPE-DECLS [OK-IntegerInRange4] >>> ***/ typedef long OK_IntegerInRange4_t; /*** <<< FUNC-DECLS [OK-IntegerInRange4] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange4; asn_struct_free_f OK_IntegerInRange4_free; asn_struct_print_f OK_IntegerInRange4_print; asn_constr_check_f OK_IntegerInRange4_constraint; ber_type_decoder_f OK_IntegerInRange4_decode_ber; der_type_encoder_f OK_IntegerInRange4_encode_der; xer_type_decoder_f OK_IntegerInRange4_decode_xer; xer_type_encoder_f OK_IntegerInRange4_encode_xer; /*** <<< CODE [OK-IntegerInRange4] >>> ***/ int OK_IntegerInRange4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if(((value == (-2147483647L - 1)) || (value == 2147483647))) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void OK_IntegerInRange4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; td->specifics = asn_DEF_NativeInteger.specifics; } void OK_IntegerInRange4_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { OK_IntegerInRange4_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int OK_IntegerInRange4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange4_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t OK_IntegerInRange4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { OK_IntegerInRange4_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t OK_IntegerInRange4_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange4_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t OK_IntegerInRange4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { OK_IntegerInRange4_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t OK_IntegerInRange4_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange4_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [OK-IntegerInRange4] >>> ***/ static const ber_tlv_tag_t asn_DEF_OK_IntegerInRange4_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange4 = { "OK-IntegerInRange4", "OK-IntegerInRange4", OK_IntegerInRange4_free, OK_IntegerInRange4_print, OK_IntegerInRange4_constraint, OK_IntegerInRange4_decode_ber, OK_IntegerInRange4_encode_der, OK_IntegerInRange4_decode_xer, OK_IntegerInRange4_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_OK_IntegerInRange4_tags_1, sizeof(asn_DEF_OK_IntegerInRange4_tags_1) /sizeof(asn_DEF_OK_IntegerInRange4_tags_1[0]), /* 1 */ asn_DEF_OK_IntegerInRange4_tags_1, /* Same as above */ sizeof(asn_DEF_OK_IntegerInRange4_tags_1) /sizeof(asn_DEF_OK_IntegerInRange4_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [OK-IntegerInRange5] >>> ***/ #include /*** <<< TYPE-DECLS [OK-IntegerInRange5] >>> ***/ typedef INTEGER_t OK_IntegerInRange5_t; /*** <<< FUNC-DECLS [OK-IntegerInRange5] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange5; asn_struct_free_f OK_IntegerInRange5_free; asn_struct_print_f OK_IntegerInRange5_print; asn_constr_check_f OK_IntegerInRange5_constraint; ber_type_decoder_f OK_IntegerInRange5_decode_ber; der_type_encoder_f OK_IntegerInRange5_encode_der; xer_type_decoder_f OK_IntegerInRange5_decode_xer; xer_type_encoder_f OK_IntegerInRange5_encode_xer; /*** <<< CODE [OK-IntegerInRange5] >>> ***/ int OK_IntegerInRange5_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(asn_INTEGER2long(st, &value)) { ASN__CTFAIL(app_key, td, sptr, "%s: value too large (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(((value == (-2147483647L - 1)) || (value == 2147483647))) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using INTEGER, * so here we adjust the DEF accordingly. */ static void OK_IntegerInRange5_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_INTEGER.free_struct; td->print_struct = asn_DEF_INTEGER.print_struct; td->check_constraints = asn_DEF_INTEGER.check_constraints; td->ber_decoder = asn_DEF_INTEGER.ber_decoder; td->der_encoder = asn_DEF_INTEGER.der_encoder; td->xer_decoder = asn_DEF_INTEGER.xer_decoder; td->xer_encoder = asn_DEF_INTEGER.xer_encoder; td->uper_decoder = asn_DEF_INTEGER.uper_decoder; td->uper_encoder = asn_DEF_INTEGER.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; td->elements = asn_DEF_INTEGER.elements; td->elements_count = asn_DEF_INTEGER.elements_count; td->specifics = asn_DEF_INTEGER.specifics; } void OK_IntegerInRange5_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { OK_IntegerInRange5_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int OK_IntegerInRange5_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange5_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t OK_IntegerInRange5_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { OK_IntegerInRange5_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t OK_IntegerInRange5_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange5_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t OK_IntegerInRange5_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { OK_IntegerInRange5_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t OK_IntegerInRange5_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange5_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [OK-IntegerInRange5] >>> ***/ static const ber_tlv_tag_t asn_DEF_OK_IntegerInRange5_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange5 = { "OK-IntegerInRange5", "OK-IntegerInRange5", OK_IntegerInRange5_free, OK_IntegerInRange5_print, OK_IntegerInRange5_constraint, OK_IntegerInRange5_decode_ber, OK_IntegerInRange5_encode_der, OK_IntegerInRange5_decode_xer, OK_IntegerInRange5_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_OK_IntegerInRange5_tags_1, sizeof(asn_DEF_OK_IntegerInRange5_tags_1) /sizeof(asn_DEF_OK_IntegerInRange5_tags_1[0]), /* 1 */ asn_DEF_OK_IntegerInRange5_tags_1, /* Same as above */ sizeof(asn_DEF_OK_IntegerInRange5_tags_1) /sizeof(asn_DEF_OK_IntegerInRange5_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [NO-IntegerInRange6] >>> ***/ #include /*** <<< TYPE-DECLS [NO-IntegerInRange6] >>> ***/ typedef unsigned long NO_IntegerInRange6_t; /*** <<< FUNC-DECLS [NO-IntegerInRange6] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_NO_IntegerInRange6; asn_struct_free_f NO_IntegerInRange6_free; asn_struct_print_f NO_IntegerInRange6_print; asn_constr_check_f NO_IntegerInRange6_constraint; ber_type_decoder_f NO_IntegerInRange6_decode_ber; der_type_encoder_f NO_IntegerInRange6_encode_der; xer_type_decoder_f NO_IntegerInRange6_decode_xer; xer_type_encoder_f NO_IntegerInRange6_encode_xer; /*** <<< CODE [NO-IntegerInRange6] >>> ***/ int NO_IntegerInRange6_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } /* Constraint check succeeded */ return 0; } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void NO_IntegerInRange6_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; /* td->specifics = asn_DEF_NativeInteger.specifics; // Defined explicitly */ } void NO_IntegerInRange6_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { NO_IntegerInRange6_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int NO_IntegerInRange6_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerInRange6_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t NO_IntegerInRange6_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { NO_IntegerInRange6_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t NO_IntegerInRange6_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerInRange6_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t NO_IntegerInRange6_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { NO_IntegerInRange6_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t NO_IntegerInRange6_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerInRange6_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [NO-IntegerInRange6] >>> ***/ static const asn_INTEGER_specifics_t asn_SPC_NO_IntegerInRange6_specs_1 = { 0, 0, 0, 0, 0, 0, /* Native long size */ 1 /* Unsigned representation */ }; static const ber_tlv_tag_t asn_DEF_NO_IntegerInRange6_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_NO_IntegerInRange6 = { "NO-IntegerInRange6", "NO-IntegerInRange6", NO_IntegerInRange6_free, NO_IntegerInRange6_print, NO_IntegerInRange6_constraint, NO_IntegerInRange6_decode_ber, NO_IntegerInRange6_encode_der, NO_IntegerInRange6_decode_xer, NO_IntegerInRange6_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerInRange6_tags_1, sizeof(asn_DEF_NO_IntegerInRange6_tags_1) /sizeof(asn_DEF_NO_IntegerInRange6_tags_1[0]), /* 1 */ asn_DEF_NO_IntegerInRange6_tags_1, /* Same as above */ sizeof(asn_DEF_NO_IntegerInRange6_tags_1) /sizeof(asn_DEF_NO_IntegerInRange6_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ &asn_SPC_NO_IntegerInRange6_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [CN-IntegerEnumerated1] >>> ***/ #include /*** <<< DEPS [CN-IntegerEnumerated1] >>> ***/ typedef enum CN_IntegerEnumerated1 { CN_IntegerEnumerated1_a = 1, CN_IntegerEnumerated1_b = 2 } e_CN_IntegerEnumerated1; /*** <<< TYPE-DECLS [CN-IntegerEnumerated1] >>> ***/ typedef INTEGER_t CN_IntegerEnumerated1_t; /*** <<< FUNC-DECLS [CN-IntegerEnumerated1] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_CN_IntegerEnumerated1; asn_struct_free_f CN_IntegerEnumerated1_free; asn_struct_print_f CN_IntegerEnumerated1_print; asn_constr_check_f CN_IntegerEnumerated1_constraint; ber_type_decoder_f CN_IntegerEnumerated1_decode_ber; der_type_encoder_f CN_IntegerEnumerated1_encode_der; xer_type_decoder_f CN_IntegerEnumerated1_decode_xer; xer_type_encoder_f CN_IntegerEnumerated1_encode_xer; /*** <<< CODE [CN-IntegerEnumerated1] >>> ***/ int CN_IntegerEnumerated1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_INTEGER.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using INTEGER, * so here we adjust the DEF accordingly. */ static void CN_IntegerEnumerated1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_INTEGER.free_struct; td->print_struct = asn_DEF_INTEGER.print_struct; td->check_constraints = asn_DEF_INTEGER.check_constraints; td->ber_decoder = asn_DEF_INTEGER.ber_decoder; td->der_encoder = asn_DEF_INTEGER.der_encoder; td->xer_decoder = asn_DEF_INTEGER.xer_decoder; td->xer_encoder = asn_DEF_INTEGER.xer_encoder; td->uper_decoder = asn_DEF_INTEGER.uper_decoder; td->uper_encoder = asn_DEF_INTEGER.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; td->elements = asn_DEF_INTEGER.elements; td->elements_count = asn_DEF_INTEGER.elements_count; td->specifics = asn_DEF_INTEGER.specifics; } void CN_IntegerEnumerated1_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { CN_IntegerEnumerated1_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int CN_IntegerEnumerated1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerEnumerated1_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t CN_IntegerEnumerated1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { CN_IntegerEnumerated1_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t CN_IntegerEnumerated1_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerEnumerated1_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t CN_IntegerEnumerated1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { CN_IntegerEnumerated1_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t CN_IntegerEnumerated1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerEnumerated1_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [CN-IntegerEnumerated1] >>> ***/ static const ber_tlv_tag_t asn_DEF_CN_IntegerEnumerated1_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_CN_IntegerEnumerated1 = { "CN-IntegerEnumerated1", "CN-IntegerEnumerated1", CN_IntegerEnumerated1_free, CN_IntegerEnumerated1_print, CN_IntegerEnumerated1_constraint, CN_IntegerEnumerated1_decode_ber, CN_IntegerEnumerated1_encode_der, CN_IntegerEnumerated1_decode_xer, CN_IntegerEnumerated1_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_CN_IntegerEnumerated1_tags_1, sizeof(asn_DEF_CN_IntegerEnumerated1_tags_1) /sizeof(asn_DEF_CN_IntegerEnumerated1_tags_1[0]), /* 1 */ asn_DEF_CN_IntegerEnumerated1_tags_1, /* Same as above */ sizeof(asn_DEF_CN_IntegerEnumerated1_tags_1) /sizeof(asn_DEF_CN_IntegerEnumerated1_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* Defined elsewhere */ 0 /* No specifics */ }; /*** <<< INCLUDES [NO-IntegerEnumerated2] >>> ***/ #include /*** <<< DEPS [NO-IntegerEnumerated2] >>> ***/ typedef enum NO_IntegerEnumerated2 { NO_IntegerEnumerated2_a = 1, NO_IntegerEnumerated2_b = 3000000000 } e_NO_IntegerEnumerated2; /*** <<< TYPE-DECLS [NO-IntegerEnumerated2] >>> ***/ typedef INTEGER_t NO_IntegerEnumerated2_t; /*** <<< FUNC-DECLS [NO-IntegerEnumerated2] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_NO_IntegerEnumerated2; asn_struct_free_f NO_IntegerEnumerated2_free; asn_struct_print_f NO_IntegerEnumerated2_print; asn_constr_check_f NO_IntegerEnumerated2_constraint; ber_type_decoder_f NO_IntegerEnumerated2_decode_ber; der_type_encoder_f NO_IntegerEnumerated2_encode_der; xer_type_decoder_f NO_IntegerEnumerated2_decode_xer; xer_type_encoder_f NO_IntegerEnumerated2_encode_xer; /*** <<< CODE [NO-IntegerEnumerated2] >>> ***/ int NO_IntegerEnumerated2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_INTEGER.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using INTEGER, * so here we adjust the DEF accordingly. */ static void NO_IntegerEnumerated2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_INTEGER.free_struct; td->print_struct = asn_DEF_INTEGER.print_struct; td->check_constraints = asn_DEF_INTEGER.check_constraints; td->ber_decoder = asn_DEF_INTEGER.ber_decoder; td->der_encoder = asn_DEF_INTEGER.der_encoder; td->xer_decoder = asn_DEF_INTEGER.xer_decoder; td->xer_encoder = asn_DEF_INTEGER.xer_encoder; td->uper_decoder = asn_DEF_INTEGER.uper_decoder; td->uper_encoder = asn_DEF_INTEGER.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; td->elements = asn_DEF_INTEGER.elements; td->elements_count = asn_DEF_INTEGER.elements_count; td->specifics = asn_DEF_INTEGER.specifics; } void NO_IntegerEnumerated2_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { NO_IntegerEnumerated2_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int NO_IntegerEnumerated2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerEnumerated2_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t NO_IntegerEnumerated2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { NO_IntegerEnumerated2_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t NO_IntegerEnumerated2_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerEnumerated2_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t NO_IntegerEnumerated2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { NO_IntegerEnumerated2_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t NO_IntegerEnumerated2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerEnumerated2_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [NO-IntegerEnumerated2] >>> ***/ static const ber_tlv_tag_t asn_DEF_NO_IntegerEnumerated2_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_NO_IntegerEnumerated2 = { "NO-IntegerEnumerated2", "NO-IntegerEnumerated2", NO_IntegerEnumerated2_free, NO_IntegerEnumerated2_print, NO_IntegerEnumerated2_constraint, NO_IntegerEnumerated2_decode_ber, NO_IntegerEnumerated2_encode_der, NO_IntegerEnumerated2_decode_xer, NO_IntegerEnumerated2_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerEnumerated2_tags_1, sizeof(asn_DEF_NO_IntegerEnumerated2_tags_1) /sizeof(asn_DEF_NO_IntegerEnumerated2_tags_1[0]), /* 1 */ asn_DEF_NO_IntegerEnumerated2_tags_1, /* Same as above */ sizeof(asn_DEF_NO_IntegerEnumerated2_tags_1) /sizeof(asn_DEF_NO_IntegerEnumerated2_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* Defined elsewhere */ 0 /* No specifics */ }; asn1c-0.9.28+dfsg/tests/53-constraint-SE.asn10000644000000000000000000000052713065714043017107 0ustar rootroot -- SE: Semantic error -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .53 ModuleInvalidConstraintApplicability1 { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 53 } DEFINITIONS ::= BEGIN Int ::= INTEGER (1..32) (MIN..63) END asn1c-0.9.28+dfsg/tests/90-cond-int-type-OK.asn1.-EFprint-constraints0000644000000000000000000001040613065714043023405 0ustar rootrootModuleConditionalIntegerType { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 90 } DEFINITIONS ::= BEGIN CN-IntegerUnlimited ::= INTEGER -- Practical constraints (CN-IntegerUnlimited): (MIN..MAX) -- PER-visible constraints (CN-IntegerUnlimited): (MIN..MAX) CN-IntegerMinMax ::= INTEGER (MIN..MAX) -- Combined constraints: (MIN..MAX) -- Practical constraints (CN-IntegerMinMax): (MIN..MAX) -- PER-visible constraints (CN-IntegerMinMax): (MIN..MAX) CN-IntegerMinLow ::= INTEGER (MIN..1) -- Combined constraints: (MIN..1) -- Practical constraints (CN-IntegerMinLow): (MIN..1) -- PER-visible constraints (CN-IntegerMinLow): (MIN..1) NO-IntegerMinHigh ::= INTEGER (MIN..3000000000) -- Combined constraints: (MIN..3000000000) -- Practical constraints (NO-IntegerMinHigh): (MIN..3000000000) -- PER-visible constraints (NO-IntegerMinHigh): (MIN..3000000000) NO-IntegerLowHigh ::= INTEGER (1..3000000000) -- Combined constraints: (1..3000000000) -- Practical constraints (NO-IntegerLowHigh): (1..3000000000) -- PER-visible constraints (NO-IntegerLowHigh): (1..3000000000) CN-IntegerLowMax ::= INTEGER (1..MAX) -- Combined constraints: (1..MAX) -- Practical constraints (CN-IntegerLowMax): (1..MAX) -- PER-visible constraints (CN-IntegerLowMax): (1..MAX) NO-IntegerHighMax ::= INTEGER (3000000000..MAX) -- Combined constraints: (3000000000..MAX) -- Practical constraints (NO-IntegerHighMax): (3000000000..MAX) -- PER-visible constraints (NO-IntegerHighMax): (3000000000..MAX) NO-IntegerLowestMax ::= INTEGER (-3000000000..MAX) -- Combined constraints: (-3000000000..MAX) -- Practical constraints (NO-IntegerLowestMax): (-3000000000..MAX) -- PER-visible constraints (NO-IntegerLowestMax): (-3000000000..MAX) NO-IntegerOutRange ::= INTEGER (3000000000..3000000001) -- Combined constraints: (3000000000..3000000001) -- Practical constraints (NO-IntegerOutRange): (3000000000..3000000001) -- PER-visible constraints (NO-IntegerOutRange): (3000000000..3000000001) NO-IntegerOutValue ::= INTEGER (3000000000) -- Combined constraints: (3000000000) -- Practical constraints (NO-IntegerOutValue): (3000000000) -- PER-visible constraints (NO-IntegerOutValue): (3000000000) OK-IntegerInRange1 ::= INTEGER (-100..100) -- Combined constraints: (-100..100) -- Practical constraints (OK-IntegerInRange1): (-100..100) -- PER-visible constraints (OK-IntegerInRange1): (-100..100) OK-IntegerInRange2 ::= INTEGER (-100 | 100) -- Combined constraints: (-100 | 100) -- Practical constraints (OK-IntegerInRange2): (-100 | 100) -- PER-visible constraints (OK-IntegerInRange2): (-100 | 100) OK-IntegerInRange3 ::= INTEGER (-2147483648..2147483647) -- Combined constraints: (-2147483648..2147483647) -- Practical constraints (OK-IntegerInRange3): (-2147483648..2147483647) -- PER-visible constraints (OK-IntegerInRange3): (-2147483648..2147483647) OK-IntegerInRange4 ::= INTEGER (-2147483648 | 2147483647) -- Combined constraints: (-2147483648 | 2147483647) -- Practical constraints (OK-IntegerInRange4): (-2147483648 | 2147483647) -- PER-visible constraints (OK-IntegerInRange4): (-2147483648 | 2147483647) OK-IntegerInRange5 ::= INTEGER (-2147483648 | 2147483647,...) -- Combined constraints: (-2147483648 | 2147483647,...) -- Practical constraints (OK-IntegerInRange5): (-2147483648 | 2147483647,...) -- PER-visible constraints (OK-IntegerInRange5): (-2147483648 | 2147483647,...) NO-IntegerInRange6 ::= INTEGER (0..4294967295) -- Combined constraints: (0..4294967295) -- Practical constraints (NO-IntegerInRange6): (0..4294967295) -- PER-visible constraints (NO-IntegerInRange6): (0..4294967295) CN-IntegerEnumerated1 ::= INTEGER { a(1) -- Practical constraints (a): -- PER-visible constraints (a): , b(2) -- Practical constraints (b): -- PER-visible constraints (b): } -- Practical constraints (CN-IntegerEnumerated1): (MIN..MAX) -- PER-visible constraints (CN-IntegerEnumerated1): (MIN..MAX) NO-IntegerEnumerated2 ::= INTEGER { a(1) -- Practical constraints (a): -- PER-visible constraints (a): , b(3000000000) -- Practical constraints (b): -- PER-visible constraints (b): } -- Practical constraints (NO-IntegerEnumerated2): (MIN..MAX) -- PER-visible constraints (NO-IntegerEnumerated2): (MIN..MAX) END asn1c-0.9.28+dfsg/tests/20-constr-OK.asn1.-EF0000644000000000000000000000067213065714043016576 0ustar rootrootModuleTestConstr { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 20 } DEFINITIONS IMPLICIT TAGS EXTENSIBILITY IMPLIED ::= BEGIN ConstructedType1 ::= SEQUENCE { a [1] IMPLICIT INTEGER, b [2] IMPLICIT INTEGER, d UTF8String, ...!ex1, c IA5String } ConstructedType2 ::= SET { a [1] IMPLICIT INTEGER, b [2] IMPLICIT INTEGER, ... } ex1 INTEGER ::= 1 END asn1c-0.9.28+dfsg/tests/68-enum-default-OK.asn10000644000000000000000000000070413065714043017316 0ustar rootroot -- OK: Everything is Fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .68 ModuleTestEnumeratedDefault { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 68 } DEFINITIONS ::= BEGIN Type ::= SEQUENCE { reportAmount ReportAmount DEFAULT ra-default, reportInterval INTEGER } ReportAmount ::= ENUMERATED { a, b, c, ra-default } END asn1c-0.9.28+dfsg/tests/08-int-SE.asn10000644000000000000000000000056313065714043015515 0ustar rootroot -- SE: Semantic error -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .8 ModuleTestInt2 { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 8 } DEFINITIONS ::= BEGIN Reason ::= INTEGER { value1(0), value1(2) -- identifiers must be distinct -- } END asn1c-0.9.28+dfsg/tests/69-reserved-words-OK.asn1.-Pfwide-types0000644000000000000000000001233213065714043022340 0ustar rootroot /*** <<< INCLUDES [T] >>> ***/ #include #include #include #include #include /*** <<< DEPS [T] >>> ***/ /* * Method of determining the components presence */ typedef enum class_PR { } class_PR; /*** <<< TYPE-DECLS [T] >>> ***/ typedef struct T { INTEGER_t Int; OCTET_STRING_t Char; struct Class { /* * This type is extensible, * possible extensions are below. */ /* Presence bitmask: ASN_SET_ISPRESENT(pclass, class_PR_x) */ unsigned int _presence_map [((0+(8*sizeof(unsigned int))-1)/(8*sizeof(unsigned int)))]; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Class; REAL_t Double; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } T_t; /*** <<< FUNC-DECLS [T] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_T; /*** <<< CODE [T] >>> ***/ static int memb_char_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; size_t size; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } size = st->size; if((size == 1)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /*** <<< STAT-DEFS [T] >>> ***/ static const ber_tlv_tag_t asn_DEF_class_tags_4[] = { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static const uint8_t asn_MAP_class_mmap_4[(0 + (8 * sizeof(unsigned int)) - 1) / 8] = { 0 }; static asn_SET_specifics_t asn_SPC_class_specs_4 = { sizeof(struct Class), offsetof(struct Class, _asn_ctx), offsetof(struct Class, _presence_map), asn_MAP_class_tag2el_4, 0, /* Count of tags in the map */ asn_MAP_class_tag2el_4, /* Same as above */ 0, /* Count of tags in the CXER map */ 1, /* Whether extensible */ (unsigned int *)asn_MAP_class_mmap_4 /* Mandatory elements map */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_class_4 = { "class", "class", SET_free, SET_print, SET_constraint, SET_decode_ber, SET_encode_der, SET_decode_xer, SET_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_class_tags_4, sizeof(asn_DEF_class_tags_4) /sizeof(asn_DEF_class_tags_4[0]), /* 1 */ asn_DEF_class_tags_4, /* Same as above */ sizeof(asn_DEF_class_tags_4) /sizeof(asn_DEF_class_tags_4[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ &asn_SPC_class_specs_4 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_T_1[] = { { ATF_NOFLAGS, 0, offsetof(struct T, Int), .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), .tag_mode = 0, .type = &asn_DEF_INTEGER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "int" }, { ATF_NOFLAGS, 0, offsetof(struct T, Char), .tag = (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), .tag_mode = 0, .type = &asn_DEF_OCTET_STRING, .memb_constraints = memb_char_constraint_1, .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "char" }, { ATF_NOFLAGS, 0, offsetof(struct T, Class), .tag = (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), .tag_mode = 0, .type = &asn_DEF_class_4, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "class" }, { ATF_NOFLAGS, 0, offsetof(struct T, Double), .tag = (ASN_TAG_CLASS_UNIVERSAL | (9 << 2)), .tag_mode = 0, .type = &asn_DEF_REAL, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "double" }, }; static const ber_tlv_tag_t asn_DEF_T_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_T_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 }, /* int */ { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 1, 0, 0 }, /* char */ { (ASN_TAG_CLASS_UNIVERSAL | (9 << 2)), 3, 0, 0 }, /* double */ { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), 2, 0, 0 } /* class */ }; static asn_SEQUENCE_specifics_t asn_SPC_T_specs_1 = { sizeof(struct T), offsetof(struct T, _asn_ctx), asn_MAP_T_tag2el_1, 4, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_T = { "T", "T", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T_tags_1, sizeof(asn_DEF_T_tags_1) /sizeof(asn_DEF_T_tags_1[0]), /* 1 */ asn_DEF_T_tags_1, /* Same as above */ sizeof(asn_DEF_T_tags_1) /sizeof(asn_DEF_T_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_T_1, 4, /* Elements count */ &asn_SPC_T_specs_1 /* Additional specs */ }; asn1c-0.9.28+dfsg/tests/94-set-optionals-OK.asn1.-P0000644000000000000000000001600513065714043020004 0ustar rootroot /*** <<< INCLUDES [TestSet] >>> ***/ #include #include /*** <<< DEPS [TestSet] >>> ***/ /* * Method of determining the components presence */ typedef enum TestSet_PR { TestSet_PR_m0, /* Member m0 is present */ TestSet_PR_m1, /* Member m1 is present */ TestSet_PR_m2, /* Member m2 is present */ TestSet_PR_m3, /* Member m3 is present */ TestSet_PR_m4, /* Member m4 is present */ TestSet_PR_m5, /* Member m5 is present */ TestSet_PR_m6, /* Member m6 is present */ TestSet_PR_m7, /* Member m7 is present */ TestSet_PR_m8, /* Member m8 is present */ TestSet_PR_m9, /* Member m9 is present */ } TestSet_PR; /*** <<< TYPE-DECLS [TestSet] >>> ***/ typedef struct TestSet { VisibleString_t m0; VisibleString_t *m1 /* OPTIONAL */; VisibleString_t m2; VisibleString_t m3; VisibleString_t *m4 /* OPTIONAL */; VisibleString_t m5; VisibleString_t m6; VisibleString_t m7; VisibleString_t *m8 /* OPTIONAL */; VisibleString_t m9; /* * This type is extensible, * possible extensions are below. */ /* Presence bitmask: ASN_SET_ISPRESENT(pTestSet, TestSet_PR_x) */ unsigned int _presence_map [((10+(8*sizeof(unsigned int))-1)/(8*sizeof(unsigned int)))]; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } TestSet_t; /*** <<< FUNC-DECLS [TestSet] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_TestSet; /*** <<< STAT-DEFS [TestSet] >>> ***/ static asn_TYPE_member_t asn_MBR_TestSet_1[] = { { ATF_NOFLAGS, 0, offsetof(struct TestSet, m0), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_VisibleString, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "m0" }, { ATF_POINTER, 1, offsetof(struct TestSet, m1), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_VisibleString, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "m1" }, { ATF_NOFLAGS, 0, offsetof(struct TestSet, m2), .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_VisibleString, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "m2" }, { ATF_NOFLAGS, 0, offsetof(struct TestSet, m3), .tag = (ASN_TAG_CLASS_CONTEXT | (3 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_VisibleString, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "m3" }, { ATF_POINTER, 1, offsetof(struct TestSet, m4), .tag = (ASN_TAG_CLASS_CONTEXT | (4 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_VisibleString, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "m4" }, { ATF_NOFLAGS, 0, offsetof(struct TestSet, m5), .tag = (ASN_TAG_CLASS_CONTEXT | (5 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_VisibleString, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "m5" }, { ATF_NOFLAGS, 0, offsetof(struct TestSet, m6), .tag = (ASN_TAG_CLASS_CONTEXT | (6 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_VisibleString, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "m6" }, { ATF_NOFLAGS, 0, offsetof(struct TestSet, m7), .tag = (ASN_TAG_CLASS_CONTEXT | (7 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_VisibleString, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "m7" }, { ATF_POINTER, 1, offsetof(struct TestSet, m8), .tag = (ASN_TAG_CLASS_CONTEXT | (8 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_VisibleString, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "m8" }, { ATF_NOFLAGS, 0, offsetof(struct TestSet, m9), .tag = (ASN_TAG_CLASS_CONTEXT | (9 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_VisibleString, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "m9" }, }; static const ber_tlv_tag_t asn_DEF_TestSet_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_TestSet_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* m0 */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* m1 */ { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* m2 */ { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* m3 */ { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* m4 */ { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* m5 */ { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* m6 */ { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 }, /* m7 */ { (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 }, /* m8 */ { (ASN_TAG_CLASS_CONTEXT | (9 << 2)), 9, 0, 0 } /* m9 */ }; static const uint8_t asn_MAP_TestSet_mmap_1[(10 + (8 * sizeof(unsigned int)) - 1) / 8] = { (1 << 7) | (0 << 6) | (1 << 5) | (1 << 4) | (0 << 3) | (1 << 2) | (1 << 1) | (1 << 0), (0 << 7) | (1 << 6) }; static asn_SET_specifics_t asn_SPC_TestSet_specs_1 = { sizeof(struct TestSet), offsetof(struct TestSet, _asn_ctx), offsetof(struct TestSet, _presence_map), asn_MAP_TestSet_tag2el_1, 10, /* Count of tags in the map */ asn_MAP_TestSet_tag2el_1, /* Same as above */ 10, /* Count of tags in the CXER map */ 1, /* Whether extensible */ (unsigned int *)asn_MAP_TestSet_mmap_1 /* Mandatory elements map */ }; asn_TYPE_descriptor_t asn_DEF_TestSet = { "TestSet", "TestSet", SET_free, SET_print, SET_constraint, SET_decode_ber, SET_encode_der, SET_decode_xer, SET_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_TestSet_tags_1, sizeof(asn_DEF_TestSet_tags_1) /sizeof(asn_DEF_TestSet_tags_1[0]), /* 1 */ asn_DEF_TestSet_tags_1, /* Same as above */ sizeof(asn_DEF_TestSet_tags_1) /sizeof(asn_DEF_TestSet_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_TestSet_1, 10, /* Elements count */ &asn_SPC_TestSet_specs_1 /* Additional specs */ }; asn1c-0.9.28+dfsg/tests/129-enum-OK.asn10000644000000000000000000000051013065714043015745 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .129 ModuleTestEnum1 { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 129 } DEFINITIONS ::= BEGIN A ::= ENUMERATED {a(-5), b(-4), c} END asn1c-0.9.28+dfsg/tests/05-enum-SE.asn10000644000000000000000000000065513065714043015666 0ustar rootroot -- SE: Semantic error -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .5 ModuleTestEnum3 { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 5 } DEFINITIONS ::= BEGIN enum1 Enum1 ::= red Enum1 ::= ENUMERATED { red(5), green(4), ..., blue(6), -- second extension marker is not allowed -- ..., white(7) } END asn1c-0.9.28+dfsg/tests/92-circular-loops-OK.asn10000644000000000000000000000264113065714043017665 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .92 ModuleCircularReferences { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 92 } DEFINITIONS AUTOMATIC TAGS ::= BEGIN Everything ::= SEQUENCE { ch1 Choice1, ch2 Choice2, ch3 Choice3, set Set, a Alpha, b Beta, g Gamma, ot OneTwo, tt TwoThree, to ThreeOne } -- This type refers to the type directly containing itself. Choice1 ::= CHOICE { something Everything, ..., some2 Everything } Choice2 ::= CHOICE { typeref TypeRef, ..., some3 Everything } Choice3 ::= CHOICE { a SEQUENCE { aa Everything }, b Everything, c SEQUENCE OF Choice3 } Set ::= SET OF SEQUENCE { int INTEGER, set Set, seq Sequence, set2 Set OPTIONAL, ..., set3 Set } Sequence ::= SEQUENCE { a INTEGER, seq Sequence OPTIONAL, ..., b INTEGER, set Set OPTIONAL } TypeRef ::= Sequence Alpha ::= SEQUENCE { a Beta, b SEQUENCE { b Beta OPTIONAL } } Beta ::= SEQUENCE { b Alpha OPTIONAL, g Gamma OPTIONAL } Gamma ::= SEQUENCE { o TwoThree, a Alpha, -- expected inline b Beta -- expected inline } -- This is a true superdependency. OneTwo ::= SET { m12 TwoThree } TwoThree ::= SET { m23 ThreeOne } ThreeOne ::= SET { m31 OneTwo, g Gamma } END asn1c-0.9.28+dfsg/tests/README0000644000000000000000000000146713065714043014271 0ustar rootroot This is a collection of various little ASN.1 modules, used independently by several different testing engines below the main tree (i.e. libasn1fix) for stressing various aspects of compiler operation. The files follow certain naming conventions: Source file: --{OK|SE|NP}.asn1 Regenerator test file: --{OK|SE|NP}.asn1.[] Where is arbitrary number (digits) is arbitrary string, without dots OK file syntax and semantics are absolutely correct SE file semantics is wrong SW file semantics is suspicious (warning) NP file syntax is incorrect, file not parseable command-line flags for compiler Example: 07-int-OK.asn1 # Correct ASN.1 file 07-int-OK.asn1.-EF # Test of file regeneration with -E -F flags. asn1c-0.9.28+dfsg/tests/03-enum-OK.asn1.-EF0000644000000000000000000000107513065714043016231 0ustar rootrootModuleTestEnum1 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 3 } DEFINITIONS ::= BEGIN Enum1 ::= ENUMERATED { red(0), green(1), blue(4), alpha(5), ... } Enum2 ::= ENUMERATED { red(0), green(1), blue(45), orange(23), alpha(46), ..., beta(12), gamma(103) } Enum3 ::= ENUMERATED { a(0), b(3), ..., c(1) } Enum4 ::= ENUMERATED { a(0), b(1), ..., c(3), d(4) } Enum5 ::= ENUMERATED { a(0), z(25), ..., d(26) } END asn1c-0.9.28+dfsg/tests/121-empty-imports-OK.asn10000644000000000000000000000054113065714043017626 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .121 ModuleEmptyIMPORTS { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 121 } DEFINITIONS AUTOMATIC TAGS ::= BEGIN IMPORTS -- nothing --; Type ::= INTEGER END asn1c-0.9.28+dfsg/tests/92-circular-loops-OK.asn1.-Pfindirect-choice0000644000000000000000000013743013065714043023265 0ustar rootroot /*** <<< INCLUDES [Everything] >>> ***/ #include "Set.h" #include "Alpha.h" #include "Beta.h" #include "Gamma.h" #include "OneTwo.h" #include "TwoThree.h" #include "ThreeOne.h" #include /*** <<< FWD-DECLS [Everything] >>> ***/ struct Choice1; struct Choice2; struct Choice3; /*** <<< TYPE-DECLS [Everything] >>> ***/ typedef struct Everything { struct Choice1 *ch1; struct Choice2 *ch2; struct Choice3 *ch3; Set_t set; Alpha_t a; Beta_t b; Gamma_t g; OneTwo_t ot; TwoThree_t tt; ThreeOne_t to; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Everything_t; /*** <<< FUNC-DECLS [Everything] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Everything; /*** <<< POST-INCLUDE [Everything] >>> ***/ #include "Choice1.h" #include "Choice2.h" #include "Choice3.h" /*** <<< STAT-DEFS [Everything] >>> ***/ static asn_TYPE_member_t asn_MBR_Everything_1[] = { { ATF_POINTER, 0, offsetof(struct Everything, ch1), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = +1, /* EXPLICIT tag at current level */ .type = &asn_DEF_Choice1, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "ch1" }, { ATF_POINTER, 0, offsetof(struct Everything, ch2), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = +1, /* EXPLICIT tag at current level */ .type = &asn_DEF_Choice2, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "ch2" }, { ATF_POINTER, 0, offsetof(struct Everything, ch3), .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), .tag_mode = +1, /* EXPLICIT tag at current level */ .type = &asn_DEF_Choice3, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "ch3" }, { ATF_NOFLAGS, 0, offsetof(struct Everything, set), .tag = (ASN_TAG_CLASS_CONTEXT | (3 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Set, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "set" }, { ATF_NOFLAGS, 0, offsetof(struct Everything, a), .tag = (ASN_TAG_CLASS_CONTEXT | (4 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Alpha, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "a" }, { ATF_NOFLAGS, 0, offsetof(struct Everything, b), .tag = (ASN_TAG_CLASS_CONTEXT | (5 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Beta, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "b" }, { ATF_NOFLAGS, 0, offsetof(struct Everything, g), .tag = (ASN_TAG_CLASS_CONTEXT | (6 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Gamma, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "g" }, { ATF_NOFLAGS, 0, offsetof(struct Everything, ot), .tag = (ASN_TAG_CLASS_CONTEXT | (7 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_OneTwo, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "ot" }, { ATF_NOFLAGS, 0, offsetof(struct Everything, tt), .tag = (ASN_TAG_CLASS_CONTEXT | (8 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_TwoThree, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "tt" }, { ATF_NOFLAGS, 0, offsetof(struct Everything, to), .tag = (ASN_TAG_CLASS_CONTEXT | (9 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_ThreeOne, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "to" }, }; static const ber_tlv_tag_t asn_DEF_Everything_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_Everything_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ch1 */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* ch2 */ { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* ch3 */ { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* set */ { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* a */ { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* b */ { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* g */ { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 }, /* ot */ { (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 }, /* tt */ { (ASN_TAG_CLASS_CONTEXT | (9 << 2)), 9, 0, 0 } /* to */ }; static asn_SEQUENCE_specifics_t asn_SPC_Everything_specs_1 = { sizeof(struct Everything), offsetof(struct Everything, _asn_ctx), asn_MAP_Everything_tag2el_1, 10, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Everything = { "Everything", "Everything", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Everything_tags_1, sizeof(asn_DEF_Everything_tags_1) /sizeof(asn_DEF_Everything_tags_1[0]), /* 1 */ asn_DEF_Everything_tags_1, /* Same as above */ sizeof(asn_DEF_Everything_tags_1) /sizeof(asn_DEF_Everything_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Everything_1, 10, /* Elements count */ &asn_SPC_Everything_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Choice1] >>> ***/ #include /*** <<< DEPS [Choice1] >>> ***/ typedef enum Choice1_PR { Choice1_PR_NOTHING, /* No components present */ Choice1_PR_something, /* Extensions may appear below */ Choice1_PR_some2 } Choice1_PR; /*** <<< FWD-DECLS [Choice1] >>> ***/ struct Everything; /*** <<< TYPE-DECLS [Choice1] >>> ***/ typedef struct Choice1 { Choice1_PR present; union Choice1_u { struct Everything *something; /* * This type is extensible, * possible extensions are below. */ struct Everything *some2; } choice; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Choice1_t; /*** <<< FUNC-DECLS [Choice1] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Choice1; /*** <<< POST-INCLUDE [Choice1] >>> ***/ #include "Everything.h" /*** <<< STAT-DEFS [Choice1] >>> ***/ static asn_TYPE_member_t asn_MBR_Choice1_1[] = { { ATF_POINTER, 0, offsetof(struct Choice1, choice.something), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Everything, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "something" }, { ATF_POINTER, 0, offsetof(struct Choice1, choice.some2), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Everything, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "some2" }, }; static const asn_TYPE_tag2member_t asn_MAP_Choice1_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* something */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* some2 */ }; static asn_CHOICE_specifics_t asn_SPC_Choice1_specs_1 = { sizeof(struct Choice1), offsetof(struct Choice1, _asn_ctx), offsetof(struct Choice1, present), sizeof(((struct Choice1 *)0)->present), asn_MAP_Choice1_tag2el_1, 2, /* Count of tags in the map */ .canonical_order = 0, .ext_start = 1 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_Choice1 = { "Choice1", "Choice1", CHOICE_free, CHOICE_print, CHOICE_constraint, CHOICE_decode_ber, CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ 0, /* No tags (pointer) */ 0, /* No tags (count) */ 0, /* No PER visible constraints */ asn_MBR_Choice1_1, 2, /* Elements count */ &asn_SPC_Choice1_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Choice2] >>> ***/ #include /*** <<< DEPS [Choice2] >>> ***/ typedef enum Choice2_PR { Choice2_PR_NOTHING, /* No components present */ Choice2_PR_typeref, /* Extensions may appear below */ Choice2_PR_some3 } Choice2_PR; /*** <<< FWD-DECLS [Choice2] >>> ***/ struct Sequence; struct Everything; /*** <<< TYPE-DECLS [Choice2] >>> ***/ typedef struct Choice2 { Choice2_PR present; union Choice2_u { struct Sequence *typeref; /* * This type is extensible, * possible extensions are below. */ struct Everything *some3; } choice; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Choice2_t; /*** <<< FUNC-DECLS [Choice2] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Choice2; /*** <<< POST-INCLUDE [Choice2] >>> ***/ #include "TypeRef.h" #include "Everything.h" /*** <<< STAT-DEFS [Choice2] >>> ***/ static asn_TYPE_member_t asn_MBR_Choice2_1[] = { { ATF_POINTER, 0, offsetof(struct Choice2, choice.typeref), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_TypeRef, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "typeref" }, { ATF_POINTER, 0, offsetof(struct Choice2, choice.some3), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Everything, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "some3" }, }; static const asn_TYPE_tag2member_t asn_MAP_Choice2_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* typeref */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* some3 */ }; static asn_CHOICE_specifics_t asn_SPC_Choice2_specs_1 = { sizeof(struct Choice2), offsetof(struct Choice2, _asn_ctx), offsetof(struct Choice2, present), sizeof(((struct Choice2 *)0)->present), asn_MAP_Choice2_tag2el_1, 2, /* Count of tags in the map */ .canonical_order = 0, .ext_start = 1 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_Choice2 = { "Choice2", "Choice2", CHOICE_free, CHOICE_print, CHOICE_constraint, CHOICE_decode_ber, CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ 0, /* No tags (pointer) */ 0, /* No tags (count) */ 0, /* No PER visible constraints */ asn_MBR_Choice2_1, 2, /* Elements count */ &asn_SPC_Choice2_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Choice3] >>> ***/ #include #include #include #include /*** <<< DEPS [Choice3] >>> ***/ typedef enum Choice3_PR { Choice3_PR_NOTHING, /* No components present */ Choice3_PR_a, Choice3_PR_b, Choice3_PR_c } Choice3_PR; /*** <<< FWD-DECLS [Choice3] >>> ***/ struct Everything; struct Choice3; /*** <<< TYPE-DECLS [Choice3] >>> ***/ typedef struct Choice3 { Choice3_PR present; union Choice3_u { struct a { struct Everything *aa; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } *a; struct Everything *b; struct c { A_SEQUENCE_OF(struct Choice3) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } *c; } choice; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Choice3_t; /*** <<< FUNC-DECLS [Choice3] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Choice3; /*** <<< POST-INCLUDE [Choice3] >>> ***/ #include "Everything.h" #include "Choice3.h" /*** <<< STAT-DEFS [Choice3] >>> ***/ static asn_TYPE_member_t asn_MBR_a_2[] = { { ATF_POINTER, 0, offsetof(struct a, aa), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Everything, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "aa" }, }; static const ber_tlv_tag_t asn_DEF_a_tags_2[] = { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_a_tag2el_2[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* aa */ }; static asn_SEQUENCE_specifics_t asn_SPC_a_specs_2 = { sizeof(struct a), offsetof(struct a, _asn_ctx), asn_MAP_a_tag2el_2, 1, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_a_2 = { "a", "a", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_a_tags_2, sizeof(asn_DEF_a_tags_2) /sizeof(asn_DEF_a_tags_2[0]) - 1, /* 1 */ asn_DEF_a_tags_2, /* Same as above */ sizeof(asn_DEF_a_tags_2) /sizeof(asn_DEF_a_tags_2[0]), /* 2 */ 0, /* No PER visible constraints */ asn_MBR_a_2, 1, /* Elements count */ &asn_SPC_a_specs_2 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_c_5[] = { { ATF_POINTER, 0, 0, .tag = -1 /* Ambiguous tag (CHOICE?) */, .tag_mode = 0, .type = &asn_DEF_Choice3, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "" }, }; static const ber_tlv_tag_t asn_DEF_c_tags_5[] = { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_c_specs_5 = { sizeof(struct c), offsetof(struct c, _asn_ctx), 2, /* XER encoding is XMLValueList */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_c_5 = { "c", "c", SEQUENCE_OF_free, SEQUENCE_OF_print, SEQUENCE_OF_constraint, SEQUENCE_OF_decode_ber, SEQUENCE_OF_encode_der, SEQUENCE_OF_decode_xer, SEQUENCE_OF_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_c_tags_5, sizeof(asn_DEF_c_tags_5) /sizeof(asn_DEF_c_tags_5[0]) - 1, /* 1 */ asn_DEF_c_tags_5, /* Same as above */ sizeof(asn_DEF_c_tags_5) /sizeof(asn_DEF_c_tags_5[0]), /* 2 */ 0, /* No PER visible constraints */ asn_MBR_c_5, 1, /* Single element */ &asn_SPC_c_specs_5 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_Choice3_1[] = { { ATF_POINTER, 0, offsetof(struct Choice3, choice.a), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = 0, .type = &asn_DEF_a_2, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "a" }, { ATF_POINTER, 0, offsetof(struct Choice3, choice.b), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Everything, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "b" }, { ATF_POINTER, 0, offsetof(struct Choice3, choice.c), .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), .tag_mode = 0, .type = &asn_DEF_c_5, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "c" }, }; static const asn_TYPE_tag2member_t asn_MAP_Choice3_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* a */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* b */ { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* c */ }; static asn_CHOICE_specifics_t asn_SPC_Choice3_specs_1 = { sizeof(struct Choice3), offsetof(struct Choice3, _asn_ctx), offsetof(struct Choice3, present), sizeof(((struct Choice3 *)0)->present), asn_MAP_Choice3_tag2el_1, 3, /* Count of tags in the map */ .canonical_order = 0, .ext_start = -1 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_Choice3 = { "Choice3", "Choice3", CHOICE_free, CHOICE_print, CHOICE_constraint, CHOICE_decode_ber, CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ 0, /* No tags (pointer) */ 0, /* No tags (count) */ 0, /* No PER visible constraints */ asn_MBR_Choice3_1, 3, /* Elements count */ &asn_SPC_Choice3_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Set] >>> ***/ #include #include #include #include /*** <<< FWD-DECLS [Set] >>> ***/ struct Set; struct Sequence; /*** <<< TYPE-DECLS [Set] >>> ***/ typedef struct Set { A_SET_OF(struct Member { long Int; struct Set *set; struct Sequence *seq; struct Set *set2 /* OPTIONAL */; /* * This type is extensible, * possible extensions are below. */ struct Set *set3; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } ) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Set_t; /*** <<< FUNC-DECLS [Set] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Set; /*** <<< POST-INCLUDE [Set] >>> ***/ #include "Set.h" #include "Sequence.h" /*** <<< STAT-DEFS [Set] >>> ***/ static asn_TYPE_member_t asn_MBR_Member_2[] = { { ATF_NOFLAGS, 0, offsetof(struct Member, Int), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_NativeInteger, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "int" }, { ATF_POINTER, 0, offsetof(struct Member, set), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Set, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "set" }, { ATF_POINTER, 0, offsetof(struct Member, seq), .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Sequence, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "seq" }, { ATF_POINTER, 2, offsetof(struct Member, set2), .tag = (ASN_TAG_CLASS_CONTEXT | (3 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Set, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "set2" }, { ATF_POINTER, 1, offsetof(struct Member, set3), .tag = (ASN_TAG_CLASS_CONTEXT | (4 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Set, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "set3" }, }; static const ber_tlv_tag_t asn_DEF_Member_tags_2[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_Member_tag2el_2[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* int */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* set */ { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* seq */ { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* set2 */ { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 } /* set3 */ }; static asn_SEQUENCE_specifics_t asn_SPC_Member_specs_2 = { sizeof(struct Member), offsetof(struct Member, _asn_ctx), asn_MAP_Member_tag2el_2, 5, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ 3, /* Start extensions */ 6 /* Stop extensions */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_Member_2 = { "SEQUENCE", "SEQUENCE", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Member_tags_2, sizeof(asn_DEF_Member_tags_2) /sizeof(asn_DEF_Member_tags_2[0]), /* 1 */ asn_DEF_Member_tags_2, /* Same as above */ sizeof(asn_DEF_Member_tags_2) /sizeof(asn_DEF_Member_tags_2[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Member_2, 5, /* Elements count */ &asn_SPC_Member_specs_2 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_Set_1[] = { { ATF_POINTER, 0, 0, .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), .tag_mode = 0, .type = &asn_DEF_Member_2, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "" }, }; static const ber_tlv_tag_t asn_DEF_Set_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_Set_specs_1 = { sizeof(struct Set), offsetof(struct Set, _asn_ctx), 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_Set = { "Set", "Set", SET_OF_free, SET_OF_print, SET_OF_constraint, SET_OF_decode_ber, SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Set_tags_1, sizeof(asn_DEF_Set_tags_1) /sizeof(asn_DEF_Set_tags_1[0]), /* 1 */ asn_DEF_Set_tags_1, /* Same as above */ sizeof(asn_DEF_Set_tags_1) /sizeof(asn_DEF_Set_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Set_1, 1, /* Single element */ &asn_SPC_Set_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Sequence] >>> ***/ #include #include /*** <<< FWD-DECLS [Sequence] >>> ***/ struct Sequence; struct Set; /*** <<< TYPE-DECLS [Sequence] >>> ***/ typedef struct Sequence { long a; struct Sequence *seq /* OPTIONAL */; /* * This type is extensible, * possible extensions are below. */ long *b; struct Set *set /* OPTIONAL */; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Sequence_t; /*** <<< FUNC-DECLS [Sequence] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Sequence; /*** <<< POST-INCLUDE [Sequence] >>> ***/ #include "Sequence.h" #include "Set.h" /*** <<< STAT-DEFS [Sequence] >>> ***/ static asn_TYPE_member_t asn_MBR_Sequence_1[] = { { ATF_NOFLAGS, 0, offsetof(struct Sequence, a), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_NativeInteger, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "a" }, { ATF_POINTER, 3, offsetof(struct Sequence, seq), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Sequence, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "seq" }, { ATF_POINTER, 2, offsetof(struct Sequence, b), .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_NativeInteger, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "b" }, { ATF_POINTER, 1, offsetof(struct Sequence, set), .tag = (ASN_TAG_CLASS_CONTEXT | (3 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Set, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "set" }, }; static const ber_tlv_tag_t asn_DEF_Sequence_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_Sequence_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* a */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* seq */ { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* b */ { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* set */ }; static asn_SEQUENCE_specifics_t asn_SPC_Sequence_specs_1 = { sizeof(struct Sequence), offsetof(struct Sequence, _asn_ctx), asn_MAP_Sequence_tag2el_1, 4, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ 1, /* Start extensions */ 5 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Sequence = { "Sequence", "Sequence", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Sequence_tags_1, sizeof(asn_DEF_Sequence_tags_1) /sizeof(asn_DEF_Sequence_tags_1[0]), /* 1 */ asn_DEF_Sequence_tags_1, /* Same as above */ sizeof(asn_DEF_Sequence_tags_1) /sizeof(asn_DEF_Sequence_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Sequence_1, 4, /* Elements count */ &asn_SPC_Sequence_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [TypeRef] >>> ***/ #include "Sequence.h" /*** <<< TYPE-DECLS [TypeRef] >>> ***/ typedef Sequence_t TypeRef_t; /*** <<< FUNC-DECLS [TypeRef] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_TypeRef; asn_struct_free_f TypeRef_free; asn_struct_print_f TypeRef_print; asn_constr_check_f TypeRef_constraint; ber_type_decoder_f TypeRef_decode_ber; der_type_encoder_f TypeRef_encode_der; xer_type_decoder_f TypeRef_decode_xer; xer_type_encoder_f TypeRef_encode_xer; /*** <<< CODE [TypeRef] >>> ***/ int TypeRef_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_Sequence.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using Sequence, * so here we adjust the DEF accordingly. */ static void TypeRef_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_Sequence.free_struct; td->print_struct = asn_DEF_Sequence.print_struct; td->check_constraints = asn_DEF_Sequence.check_constraints; td->ber_decoder = asn_DEF_Sequence.ber_decoder; td->der_encoder = asn_DEF_Sequence.der_encoder; td->xer_decoder = asn_DEF_Sequence.xer_decoder; td->xer_encoder = asn_DEF_Sequence.xer_encoder; td->uper_decoder = asn_DEF_Sequence.uper_decoder; td->uper_encoder = asn_DEF_Sequence.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Sequence.per_constraints; td->elements = asn_DEF_Sequence.elements; td->elements_count = asn_DEF_Sequence.elements_count; td->specifics = asn_DEF_Sequence.specifics; } void TypeRef_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { TypeRef_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int TypeRef_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { TypeRef_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t TypeRef_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { TypeRef_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t TypeRef_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { TypeRef_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t TypeRef_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { TypeRef_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t TypeRef_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { TypeRef_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [TypeRef] >>> ***/ static const ber_tlv_tag_t asn_DEF_TypeRef_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; asn_TYPE_descriptor_t asn_DEF_TypeRef = { "TypeRef", "TypeRef", TypeRef_free, TypeRef_print, TypeRef_constraint, TypeRef_decode_ber, TypeRef_encode_der, TypeRef_decode_xer, TypeRef_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_TypeRef_tags_1, sizeof(asn_DEF_TypeRef_tags_1) /sizeof(asn_DEF_TypeRef_tags_1[0]), /* 1 */ asn_DEF_TypeRef_tags_1, /* Same as above */ sizeof(asn_DEF_TypeRef_tags_1) /sizeof(asn_DEF_TypeRef_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* Defined elsewhere */ 0 /* No specifics */ }; /*** <<< INCLUDES [Alpha] >>> ***/ #include /*** <<< FWD-DECLS [Alpha] >>> ***/ struct Beta; /*** <<< TYPE-DECLS [Alpha] >>> ***/ typedef struct Alpha { struct Beta *a; struct b { struct Beta *b /* OPTIONAL */; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } b; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Alpha_t; /*** <<< FUNC-DECLS [Alpha] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Alpha; /*** <<< POST-INCLUDE [Alpha] >>> ***/ #include "Beta.h" /*** <<< STAT-DEFS [Alpha] >>> ***/ static asn_TYPE_member_t asn_MBR_b_3[] = { { ATF_POINTER, 1, offsetof(struct b, b), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Beta, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "b" }, }; static const ber_tlv_tag_t asn_DEF_b_tags_3[] = { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_b_tag2el_3[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* b */ }; static asn_SEQUENCE_specifics_t asn_SPC_b_specs_3 = { sizeof(struct b), offsetof(struct b, _asn_ctx), asn_MAP_b_tag2el_3, 1, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_b_3 = { "b", "b", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_b_tags_3, sizeof(asn_DEF_b_tags_3) /sizeof(asn_DEF_b_tags_3[0]) - 1, /* 1 */ asn_DEF_b_tags_3, /* Same as above */ sizeof(asn_DEF_b_tags_3) /sizeof(asn_DEF_b_tags_3[0]), /* 2 */ 0, /* No PER visible constraints */ asn_MBR_b_3, 1, /* Elements count */ &asn_SPC_b_specs_3 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_Alpha_1[] = { { ATF_POINTER, 0, offsetof(struct Alpha, a), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Beta, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "a" }, { ATF_NOFLAGS, 0, offsetof(struct Alpha, b), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = 0, .type = &asn_DEF_b_3, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "b" }, }; static const ber_tlv_tag_t asn_DEF_Alpha_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_Alpha_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* a */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* b */ }; static asn_SEQUENCE_specifics_t asn_SPC_Alpha_specs_1 = { sizeof(struct Alpha), offsetof(struct Alpha, _asn_ctx), asn_MAP_Alpha_tag2el_1, 2, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Alpha = { "Alpha", "Alpha", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Alpha_tags_1, sizeof(asn_DEF_Alpha_tags_1) /sizeof(asn_DEF_Alpha_tags_1[0]), /* 1 */ asn_DEF_Alpha_tags_1, /* Same as above */ sizeof(asn_DEF_Alpha_tags_1) /sizeof(asn_DEF_Alpha_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Alpha_1, 2, /* Elements count */ &asn_SPC_Alpha_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Beta] >>> ***/ #include /*** <<< FWD-DECLS [Beta] >>> ***/ struct Alpha; struct Gamma; /*** <<< TYPE-DECLS [Beta] >>> ***/ typedef struct Beta { struct Alpha *b /* OPTIONAL */; struct Gamma *g /* OPTIONAL */; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Beta_t; /*** <<< FUNC-DECLS [Beta] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Beta; /*** <<< POST-INCLUDE [Beta] >>> ***/ #include "Alpha.h" #include "Gamma.h" /*** <<< STAT-DEFS [Beta] >>> ***/ static asn_TYPE_member_t asn_MBR_Beta_1[] = { { ATF_POINTER, 2, offsetof(struct Beta, b), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Alpha, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "b" }, { ATF_POINTER, 1, offsetof(struct Beta, g), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Gamma, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "g" }, }; static const ber_tlv_tag_t asn_DEF_Beta_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_Beta_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* b */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* g */ }; static asn_SEQUENCE_specifics_t asn_SPC_Beta_specs_1 = { sizeof(struct Beta), offsetof(struct Beta, _asn_ctx), asn_MAP_Beta_tag2el_1, 2, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Beta = { "Beta", "Beta", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Beta_tags_1, sizeof(asn_DEF_Beta_tags_1) /sizeof(asn_DEF_Beta_tags_1[0]), /* 1 */ asn_DEF_Beta_tags_1, /* Same as above */ sizeof(asn_DEF_Beta_tags_1) /sizeof(asn_DEF_Beta_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Beta_1, 2, /* Elements count */ &asn_SPC_Beta_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Gamma] >>> ***/ #include /*** <<< FWD-DECLS [Gamma] >>> ***/ struct TwoThree; struct Alpha; struct Beta; /*** <<< TYPE-DECLS [Gamma] >>> ***/ typedef struct Gamma { struct TwoThree *o; struct Alpha *a; struct Beta *b; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Gamma_t; /*** <<< FUNC-DECLS [Gamma] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Gamma; /*** <<< POST-INCLUDE [Gamma] >>> ***/ #include "TwoThree.h" #include "Alpha.h" #include "Beta.h" /*** <<< STAT-DEFS [Gamma] >>> ***/ static asn_TYPE_member_t asn_MBR_Gamma_1[] = { { ATF_POINTER, 0, offsetof(struct Gamma, o), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_TwoThree, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "o" }, { ATF_POINTER, 0, offsetof(struct Gamma, a), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Alpha, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "a" }, { ATF_POINTER, 0, offsetof(struct Gamma, b), .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Beta, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "b" }, }; static const ber_tlv_tag_t asn_DEF_Gamma_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_Gamma_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* o */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* a */ { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* b */ }; static asn_SEQUENCE_specifics_t asn_SPC_Gamma_specs_1 = { sizeof(struct Gamma), offsetof(struct Gamma, _asn_ctx), asn_MAP_Gamma_tag2el_1, 3, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Gamma = { "Gamma", "Gamma", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Gamma_tags_1, sizeof(asn_DEF_Gamma_tags_1) /sizeof(asn_DEF_Gamma_tags_1[0]), /* 1 */ asn_DEF_Gamma_tags_1, /* Same as above */ sizeof(asn_DEF_Gamma_tags_1) /sizeof(asn_DEF_Gamma_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Gamma_1, 3, /* Elements count */ &asn_SPC_Gamma_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [OneTwo] >>> ***/ #include /*** <<< DEPS [OneTwo] >>> ***/ /* * Method of determining the components presence */ typedef enum OneTwo_PR { OneTwo_PR_m12, /* Member m12 is present */ } OneTwo_PR; /*** <<< FWD-DECLS [OneTwo] >>> ***/ struct TwoThree; /*** <<< TYPE-DECLS [OneTwo] >>> ***/ typedef struct OneTwo { struct TwoThree *m12; /* Presence bitmask: ASN_SET_ISPRESENT(pOneTwo, OneTwo_PR_x) */ unsigned int _presence_map [((1+(8*sizeof(unsigned int))-1)/(8*sizeof(unsigned int)))]; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } OneTwo_t; /*** <<< FUNC-DECLS [OneTwo] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_OneTwo; /*** <<< POST-INCLUDE [OneTwo] >>> ***/ #include "TwoThree.h" /*** <<< STAT-DEFS [OneTwo] >>> ***/ static asn_TYPE_member_t asn_MBR_OneTwo_1[] = { { ATF_POINTER, 0, offsetof(struct OneTwo, m12), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_TwoThree, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "m12" }, }; static const ber_tlv_tag_t asn_DEF_OneTwo_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_OneTwo_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* m12 */ }; static const uint8_t asn_MAP_OneTwo_mmap_1[(1 + (8 * sizeof(unsigned int)) - 1) / 8] = { (1 << 7) }; static asn_SET_specifics_t asn_SPC_OneTwo_specs_1 = { sizeof(struct OneTwo), offsetof(struct OneTwo, _asn_ctx), offsetof(struct OneTwo, _presence_map), asn_MAP_OneTwo_tag2el_1, 1, /* Count of tags in the map */ asn_MAP_OneTwo_tag2el_1, /* Same as above */ 1, /* Count of tags in the CXER map */ 0, /* Whether extensible */ (unsigned int *)asn_MAP_OneTwo_mmap_1 /* Mandatory elements map */ }; asn_TYPE_descriptor_t asn_DEF_OneTwo = { "OneTwo", "OneTwo", SET_free, SET_print, SET_constraint, SET_decode_ber, SET_encode_der, SET_decode_xer, SET_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_OneTwo_tags_1, sizeof(asn_DEF_OneTwo_tags_1) /sizeof(asn_DEF_OneTwo_tags_1[0]), /* 1 */ asn_DEF_OneTwo_tags_1, /* Same as above */ sizeof(asn_DEF_OneTwo_tags_1) /sizeof(asn_DEF_OneTwo_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_OneTwo_1, 1, /* Elements count */ &asn_SPC_OneTwo_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [TwoThree] >>> ***/ #include /*** <<< DEPS [TwoThree] >>> ***/ /* * Method of determining the components presence */ typedef enum TwoThree_PR { TwoThree_PR_m23, /* Member m23 is present */ } TwoThree_PR; /*** <<< FWD-DECLS [TwoThree] >>> ***/ struct ThreeOne; /*** <<< TYPE-DECLS [TwoThree] >>> ***/ typedef struct TwoThree { struct ThreeOne *m23; /* Presence bitmask: ASN_SET_ISPRESENT(pTwoThree, TwoThree_PR_x) */ unsigned int _presence_map [((1+(8*sizeof(unsigned int))-1)/(8*sizeof(unsigned int)))]; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } TwoThree_t; /*** <<< FUNC-DECLS [TwoThree] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_TwoThree; /*** <<< POST-INCLUDE [TwoThree] >>> ***/ #include "ThreeOne.h" /*** <<< STAT-DEFS [TwoThree] >>> ***/ static asn_TYPE_member_t asn_MBR_TwoThree_1[] = { { ATF_POINTER, 0, offsetof(struct TwoThree, m23), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_ThreeOne, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "m23" }, }; static const ber_tlv_tag_t asn_DEF_TwoThree_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_TwoThree_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* m23 */ }; static const uint8_t asn_MAP_TwoThree_mmap_1[(1 + (8 * sizeof(unsigned int)) - 1) / 8] = { (1 << 7) }; static asn_SET_specifics_t asn_SPC_TwoThree_specs_1 = { sizeof(struct TwoThree), offsetof(struct TwoThree, _asn_ctx), offsetof(struct TwoThree, _presence_map), asn_MAP_TwoThree_tag2el_1, 1, /* Count of tags in the map */ asn_MAP_TwoThree_tag2el_1, /* Same as above */ 1, /* Count of tags in the CXER map */ 0, /* Whether extensible */ (unsigned int *)asn_MAP_TwoThree_mmap_1 /* Mandatory elements map */ }; asn_TYPE_descriptor_t asn_DEF_TwoThree = { "TwoThree", "TwoThree", SET_free, SET_print, SET_constraint, SET_decode_ber, SET_encode_der, SET_decode_xer, SET_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_TwoThree_tags_1, sizeof(asn_DEF_TwoThree_tags_1) /sizeof(asn_DEF_TwoThree_tags_1[0]), /* 1 */ asn_DEF_TwoThree_tags_1, /* Same as above */ sizeof(asn_DEF_TwoThree_tags_1) /sizeof(asn_DEF_TwoThree_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_TwoThree_1, 1, /* Elements count */ &asn_SPC_TwoThree_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [ThreeOne] >>> ***/ #include /*** <<< DEPS [ThreeOne] >>> ***/ /* * Method of determining the components presence */ typedef enum ThreeOne_PR { ThreeOne_PR_m31, /* Member m31 is present */ ThreeOne_PR_g, /* Member g is present */ } ThreeOne_PR; /*** <<< FWD-DECLS [ThreeOne] >>> ***/ struct OneTwo; struct Gamma; /*** <<< TYPE-DECLS [ThreeOne] >>> ***/ typedef struct ThreeOne { struct OneTwo *m31; struct Gamma *g; /* Presence bitmask: ASN_SET_ISPRESENT(pThreeOne, ThreeOne_PR_x) */ unsigned int _presence_map [((2+(8*sizeof(unsigned int))-1)/(8*sizeof(unsigned int)))]; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } ThreeOne_t; /*** <<< FUNC-DECLS [ThreeOne] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_ThreeOne; /*** <<< POST-INCLUDE [ThreeOne] >>> ***/ #include "OneTwo.h" #include "Gamma.h" /*** <<< STAT-DEFS [ThreeOne] >>> ***/ static asn_TYPE_member_t asn_MBR_ThreeOne_1[] = { { ATF_POINTER, 0, offsetof(struct ThreeOne, m31), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_OneTwo, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "m31" }, { ATF_POINTER, 0, offsetof(struct ThreeOne, g), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Gamma, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "g" }, }; static const ber_tlv_tag_t asn_DEF_ThreeOne_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_ThreeOne_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* m31 */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* g */ }; static const uint8_t asn_MAP_ThreeOne_mmap_1[(2 + (8 * sizeof(unsigned int)) - 1) / 8] = { (1 << 7) | (1 << 6) }; static asn_SET_specifics_t asn_SPC_ThreeOne_specs_1 = { sizeof(struct ThreeOne), offsetof(struct ThreeOne, _asn_ctx), offsetof(struct ThreeOne, _presence_map), asn_MAP_ThreeOne_tag2el_1, 2, /* Count of tags in the map */ asn_MAP_ThreeOne_tag2el_1, /* Same as above */ 2, /* Count of tags in the CXER map */ 0, /* Whether extensible */ (unsigned int *)asn_MAP_ThreeOne_mmap_1 /* Mandatory elements map */ }; asn_TYPE_descriptor_t asn_DEF_ThreeOne = { "ThreeOne", "ThreeOne", SET_free, SET_print, SET_constraint, SET_decode_ber, SET_encode_der, SET_decode_xer, SET_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_ThreeOne_tags_1, sizeof(asn_DEF_ThreeOne_tags_1) /sizeof(asn_DEF_ThreeOne_tags_1[0]), /* 1 */ asn_DEF_ThreeOne_tags_1, /* Same as above */ sizeof(asn_DEF_ThreeOne_tags_1) /sizeof(asn_DEF_ThreeOne_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_ThreeOne_1, 2, /* Elements count */ &asn_SPC_ThreeOne_specs_1 /* Additional specs */ }; asn1c-0.9.28+dfsg/tests/55-components-of-OK.asn1.-EF0000644000000000000000000000135413065714043020063 0ustar rootrootModuleTestComponentsOf { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 55 } DEFINITIONS AUTOMATIC TAGS ::= BEGIN OneType ::= SEQUENCE { one-1 INTEGER, one-2 [1] IMPLICIT BOOLEAN, one-3 SEQUENCE { alpha [0] IMPLICIT INTEGER, beta [1] IMPLICIT INTEGER, ... }, one-4 INTEGER, ..., ignored-in-SecondType INTEGER } SecondType ::= SEQUENCE { a [0] IMPLICIT IA5String, one-1 [1] IMPLICIT INTEGER, one-2 [2] IMPLICIT BOOLEAN, one-3 [3] IMPLICIT SEQUENCE { alpha [0] IMPLICIT INTEGER, beta [1] IMPLICIT INTEGER }, one-4 [4] IMPLICIT INTEGER, b [5] IMPLICIT UniversalString } END asn1c-0.9.28+dfsg/tests/134-per-long-OK.asn1.-Pgen-PER0000644000000000000000000001552313065714043020123 0ustar rootroot /*** <<< INCLUDES [T] >>> ***/ #include #include /*** <<< TYPE-DECLS [T] >>> ***/ typedef struct T { INTEGER_t unsigned33; INTEGER_t unsigned42; INTEGER_t signed33; INTEGER_t signed33ext; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } T_t; /*** <<< FUNC-DECLS [T] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_T; /*** <<< CODE [T] >>> ***/ static int memb_unsigned33_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(asn_INTEGER2long(st, &value)) { ASN__CTFAIL(app_key, td, sptr, "%s: value too large (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if((value >= 0 && value <= 5000000000)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } static int memb_unsigned42_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(asn_INTEGER2long(st, &value)) { ASN__CTFAIL(app_key, td, sptr, "%s: value too large (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if((value >= 0 && value <= 3153600000000)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } static int memb_signed33_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(asn_INTEGER2long(st, &value)) { ASN__CTFAIL(app_key, td, sptr, "%s: value too large (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if((value >= -4000000000 && value <= 4000000000)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } static int memb_signed33ext_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(asn_INTEGER2long(st, &value)) { ASN__CTFAIL(app_key, td, sptr, "%s: value too large (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if((value >= -4000000000 && value <= 4000000000)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /*** <<< CTDEFS [T] >>> ***/ static asn_per_constraints_t asn_PER_memb_unsigned33_constr_2 GCC_NOTUSED = { { APC_CONSTRAINED, 33, -1, 0, 5000000000 } /* (0..5000000000) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; static asn_per_constraints_t asn_PER_memb_unsigned42_constr_3 GCC_NOTUSED = { { APC_CONSTRAINED, 42, -1, 0, 3153600000000 } /* (0..3153600000000) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; static asn_per_constraints_t asn_PER_memb_signed33_constr_4 GCC_NOTUSED = { { APC_CONSTRAINED, 33, -1, -4000000000, 4000000000 } /* (-4000000000..4000000000) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; static asn_per_constraints_t asn_PER_memb_signed33ext_constr_5 GCC_NOTUSED = { { APC_CONSTRAINED | APC_EXTENSIBLE, 33, -1, -4000000000, 4000000000 } /* (-4000000000..4000000000,...) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; /*** <<< STAT-DEFS [T] >>> ***/ static asn_TYPE_member_t asn_MBR_T_1[] = { { ATF_NOFLAGS, 0, offsetof(struct T, unsigned33), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_INTEGER, .memb_constraints = memb_unsigned33_constraint_1, .per_constraints = &asn_PER_memb_unsigned33_constr_2, .default_value = 0, .name = "unsigned33" }, { ATF_NOFLAGS, 0, offsetof(struct T, unsigned42), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_INTEGER, .memb_constraints = memb_unsigned42_constraint_1, .per_constraints = &asn_PER_memb_unsigned42_constr_3, .default_value = 0, .name = "unsigned42" }, { ATF_NOFLAGS, 0, offsetof(struct T, signed33), .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_INTEGER, .memb_constraints = memb_signed33_constraint_1, .per_constraints = &asn_PER_memb_signed33_constr_4, .default_value = 0, .name = "signed33" }, { ATF_NOFLAGS, 0, offsetof(struct T, signed33ext), .tag = (ASN_TAG_CLASS_CONTEXT | (3 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_INTEGER, .memb_constraints = memb_signed33ext_constraint_1, .per_constraints = &asn_PER_memb_signed33ext_constr_5, .default_value = 0, .name = "signed33ext" }, }; static const ber_tlv_tag_t asn_DEF_T_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_T_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* unsigned33 */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* unsigned42 */ { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* signed33 */ { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* signed33ext */ }; static asn_SEQUENCE_specifics_t asn_SPC_T_specs_1 = { sizeof(struct T), offsetof(struct T, _asn_ctx), asn_MAP_T_tag2el_1, 4, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_T = { "T", "T", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_T_tags_1, sizeof(asn_DEF_T_tags_1) /sizeof(asn_DEF_T_tags_1[0]), /* 1 */ asn_DEF_T_tags_1, /* Same as above */ sizeof(asn_DEF_T_tags_1) /sizeof(asn_DEF_T_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_T_1, 4, /* Elements count */ &asn_SPC_T_specs_1 /* Additional specs */ }; asn1c-0.9.28+dfsg/tests/110-param-3-OK.asn10000644000000000000000000000075113065714043016236 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .110 ModuleParameterization3 { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 110 } DEFINITIONS ::= BEGIN Flag{Color} ::= SEQUENCE { field Color DEFAULT blue } IntegerColorFlag ::= Flag{INTEGER{ red(0), green(1), blue(5) }} EnumeratedColorFlag ::= Flag{ENUMERATED{ red(3), green, blue }} END asn1c-0.9.28+dfsg/tests/63-any-2-SE.asn10000644000000000000000000000051313065714043015645 0ustar rootroot -- SE: Semantic error -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .63 ModuleTestBadANY2 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 62 } DEFINITIONS ::= BEGIN T ::= SEQUENCE { any [1] IMPLICIT ANY } END asn1c-0.9.28+dfsg/tests/96-type-identifier-OK.asn10000644000000000000000000000066213065714043020035 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .96 ModuleTypeIdentifier { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 96 } DEFINITIONS ::= BEGIN /* * TYPE-IDENTIFIER shall be automatically available. */ T ::= SEQUENCE { id TYPE-IDENTIFIER.&id, type TYPE-IDENTIFIER.&Type } END asn1c-0.9.28+dfsg/tests/98-attribute-class-OK.asn1.-P0000644000000000000000000000566013065714043020322 0ustar rootroot /*** <<< INCLUDES [Attribute] >>> ***/ #include #include #include /*** <<< TYPE-DECLS [Attribute] >>> ***/ typedef struct Attribute { RELATIVE_OID_t identifier; IA5String_t siAttributeValue; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Attribute_t; /*** <<< FUNC-DECLS [Attribute] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Attribute; /*** <<< CODE [Attribute] >>> ***/ static int memb_identifier_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(1 /* No applicable constraints whatsoever */) { /* Nothing is here. See below */ } return td->check_constraints(td, sptr, ctfailcb, app_key); } /*** <<< STAT-DEFS [Attribute] >>> ***/ static asn_TYPE_member_t asn_MBR_Attribute_1[] = { { ATF_NOFLAGS, 0, offsetof(struct Attribute, identifier), .tag = (ASN_TAG_CLASS_UNIVERSAL | (13 << 2)), .tag_mode = 0, .type = &asn_DEF_RELATIVE_OID, .memb_constraints = memb_identifier_constraint_1, .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "identifier" }, { ATF_NOFLAGS, 0, offsetof(struct Attribute, siAttributeValue), .tag = (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)), .tag_mode = 0, .type = &asn_DEF_IA5String, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "siAttributeValue" }, }; static const ber_tlv_tag_t asn_DEF_Attribute_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_Attribute_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (13 << 2)), 0, 0, 0 }, /* identifier */ { (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)), 1, 0, 0 } /* siAttributeValue */ }; static asn_SEQUENCE_specifics_t asn_SPC_Attribute_specs_1 = { sizeof(struct Attribute), offsetof(struct Attribute, _asn_ctx), asn_MAP_Attribute_tag2el_1, 2, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Attribute = { "Attribute", "Attribute", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Attribute_tags_1, sizeof(asn_DEF_Attribute_tags_1) /sizeof(asn_DEF_Attribute_tags_1[0]), /* 1 */ asn_DEF_Attribute_tags_1, /* Same as above */ sizeof(asn_DEF_Attribute_tags_1) /sizeof(asn_DEF_Attribute_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Attribute_1, 2, /* Elements count */ &asn_SPC_Attribute_specs_1 /* Additional specs */ }; asn1c-0.9.28+dfsg/tests/90-cond-int-type-OK.asn1.-P0000644000000000000000000025137113065714043017700 0ustar rootroot /*** <<< INCLUDES [CN-IntegerUnlimited] >>> ***/ #include /*** <<< TYPE-DECLS [CN-IntegerUnlimited] >>> ***/ typedef long CN_IntegerUnlimited_t; /*** <<< FUNC-DECLS [CN-IntegerUnlimited] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_CN_IntegerUnlimited; asn_struct_free_f CN_IntegerUnlimited_free; asn_struct_print_f CN_IntegerUnlimited_print; asn_constr_check_f CN_IntegerUnlimited_constraint; ber_type_decoder_f CN_IntegerUnlimited_decode_ber; der_type_encoder_f CN_IntegerUnlimited_encode_der; xer_type_decoder_f CN_IntegerUnlimited_decode_xer; xer_type_encoder_f CN_IntegerUnlimited_encode_xer; /*** <<< CODE [CN-IntegerUnlimited] >>> ***/ int CN_IntegerUnlimited_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_NativeInteger.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void CN_IntegerUnlimited_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; td->specifics = asn_DEF_NativeInteger.specifics; } void CN_IntegerUnlimited_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { CN_IntegerUnlimited_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int CN_IntegerUnlimited_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerUnlimited_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t CN_IntegerUnlimited_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { CN_IntegerUnlimited_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t CN_IntegerUnlimited_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerUnlimited_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t CN_IntegerUnlimited_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { CN_IntegerUnlimited_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t CN_IntegerUnlimited_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerUnlimited_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [CN-IntegerUnlimited] >>> ***/ static const ber_tlv_tag_t asn_DEF_CN_IntegerUnlimited_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_CN_IntegerUnlimited = { "CN-IntegerUnlimited", "CN-IntegerUnlimited", CN_IntegerUnlimited_free, CN_IntegerUnlimited_print, CN_IntegerUnlimited_constraint, CN_IntegerUnlimited_decode_ber, CN_IntegerUnlimited_encode_der, CN_IntegerUnlimited_decode_xer, CN_IntegerUnlimited_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_CN_IntegerUnlimited_tags_1, sizeof(asn_DEF_CN_IntegerUnlimited_tags_1) /sizeof(asn_DEF_CN_IntegerUnlimited_tags_1[0]), /* 1 */ asn_DEF_CN_IntegerUnlimited_tags_1, /* Same as above */ sizeof(asn_DEF_CN_IntegerUnlimited_tags_1) /sizeof(asn_DEF_CN_IntegerUnlimited_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [CN-IntegerMinMax] >>> ***/ #include /*** <<< TYPE-DECLS [CN-IntegerMinMax] >>> ***/ typedef long CN_IntegerMinMax_t; /*** <<< FUNC-DECLS [CN-IntegerMinMax] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_CN_IntegerMinMax; asn_struct_free_f CN_IntegerMinMax_free; asn_struct_print_f CN_IntegerMinMax_print; asn_constr_check_f CN_IntegerMinMax_constraint; ber_type_decoder_f CN_IntegerMinMax_decode_ber; der_type_encoder_f CN_IntegerMinMax_encode_der; xer_type_decoder_f CN_IntegerMinMax_decode_xer; xer_type_encoder_f CN_IntegerMinMax_encode_xer; /*** <<< CODE [CN-IntegerMinMax] >>> ***/ int CN_IntegerMinMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(1 /* No applicable constraints whatsoever */) { /* Nothing is here. See below */ } /* Replace with underlying type checker */ td->check_constraints = asn_DEF_NativeInteger.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void CN_IntegerMinMax_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; td->specifics = asn_DEF_NativeInteger.specifics; } void CN_IntegerMinMax_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { CN_IntegerMinMax_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int CN_IntegerMinMax_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerMinMax_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t CN_IntegerMinMax_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { CN_IntegerMinMax_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t CN_IntegerMinMax_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerMinMax_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t CN_IntegerMinMax_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { CN_IntegerMinMax_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t CN_IntegerMinMax_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerMinMax_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [CN-IntegerMinMax] >>> ***/ static const ber_tlv_tag_t asn_DEF_CN_IntegerMinMax_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_CN_IntegerMinMax = { "CN-IntegerMinMax", "CN-IntegerMinMax", CN_IntegerMinMax_free, CN_IntegerMinMax_print, CN_IntegerMinMax_constraint, CN_IntegerMinMax_decode_ber, CN_IntegerMinMax_encode_der, CN_IntegerMinMax_decode_xer, CN_IntegerMinMax_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_CN_IntegerMinMax_tags_1, sizeof(asn_DEF_CN_IntegerMinMax_tags_1) /sizeof(asn_DEF_CN_IntegerMinMax_tags_1[0]), /* 1 */ asn_DEF_CN_IntegerMinMax_tags_1, /* Same as above */ sizeof(asn_DEF_CN_IntegerMinMax_tags_1) /sizeof(asn_DEF_CN_IntegerMinMax_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [CN-IntegerMinLow] >>> ***/ #include /*** <<< TYPE-DECLS [CN-IntegerMinLow] >>> ***/ typedef long CN_IntegerMinLow_t; /*** <<< FUNC-DECLS [CN-IntegerMinLow] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_CN_IntegerMinLow; asn_struct_free_f CN_IntegerMinLow_free; asn_struct_print_f CN_IntegerMinLow_print; asn_constr_check_f CN_IntegerMinLow_constraint; ber_type_decoder_f CN_IntegerMinLow_decode_ber; der_type_encoder_f CN_IntegerMinLow_encode_der; xer_type_decoder_f CN_IntegerMinLow_decode_xer; xer_type_encoder_f CN_IntegerMinLow_encode_xer; /*** <<< CODE [CN-IntegerMinLow] >>> ***/ int CN_IntegerMinLow_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if((value <= 1)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void CN_IntegerMinLow_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; td->specifics = asn_DEF_NativeInteger.specifics; } void CN_IntegerMinLow_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { CN_IntegerMinLow_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int CN_IntegerMinLow_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerMinLow_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t CN_IntegerMinLow_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { CN_IntegerMinLow_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t CN_IntegerMinLow_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerMinLow_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t CN_IntegerMinLow_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { CN_IntegerMinLow_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t CN_IntegerMinLow_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerMinLow_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [CN-IntegerMinLow] >>> ***/ static const ber_tlv_tag_t asn_DEF_CN_IntegerMinLow_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_CN_IntegerMinLow = { "CN-IntegerMinLow", "CN-IntegerMinLow", CN_IntegerMinLow_free, CN_IntegerMinLow_print, CN_IntegerMinLow_constraint, CN_IntegerMinLow_decode_ber, CN_IntegerMinLow_encode_der, CN_IntegerMinLow_decode_xer, CN_IntegerMinLow_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_CN_IntegerMinLow_tags_1, sizeof(asn_DEF_CN_IntegerMinLow_tags_1) /sizeof(asn_DEF_CN_IntegerMinLow_tags_1[0]), /* 1 */ asn_DEF_CN_IntegerMinLow_tags_1, /* Same as above */ sizeof(asn_DEF_CN_IntegerMinLow_tags_1) /sizeof(asn_DEF_CN_IntegerMinLow_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [NO-IntegerMinHigh] >>> ***/ #include /*** <<< TYPE-DECLS [NO-IntegerMinHigh] >>> ***/ typedef INTEGER_t NO_IntegerMinHigh_t; /*** <<< FUNC-DECLS [NO-IntegerMinHigh] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_NO_IntegerMinHigh; asn_struct_free_f NO_IntegerMinHigh_free; asn_struct_print_f NO_IntegerMinHigh_print; asn_constr_check_f NO_IntegerMinHigh_constraint; ber_type_decoder_f NO_IntegerMinHigh_decode_ber; der_type_encoder_f NO_IntegerMinHigh_encode_der; xer_type_decoder_f NO_IntegerMinHigh_decode_xer; xer_type_encoder_f NO_IntegerMinHigh_encode_xer; /*** <<< CODE [NO-IntegerMinHigh] >>> ***/ int NO_IntegerMinHigh_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(asn_INTEGER2long(st, &value)) { ASN__CTFAIL(app_key, td, sptr, "%s: value too large (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if((value <= 3000000000)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using INTEGER, * so here we adjust the DEF accordingly. */ static void NO_IntegerMinHigh_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_INTEGER.free_struct; td->print_struct = asn_DEF_INTEGER.print_struct; td->check_constraints = asn_DEF_INTEGER.check_constraints; td->ber_decoder = asn_DEF_INTEGER.ber_decoder; td->der_encoder = asn_DEF_INTEGER.der_encoder; td->xer_decoder = asn_DEF_INTEGER.xer_decoder; td->xer_encoder = asn_DEF_INTEGER.xer_encoder; td->uper_decoder = asn_DEF_INTEGER.uper_decoder; td->uper_encoder = asn_DEF_INTEGER.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; td->elements = asn_DEF_INTEGER.elements; td->elements_count = asn_DEF_INTEGER.elements_count; td->specifics = asn_DEF_INTEGER.specifics; } void NO_IntegerMinHigh_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { NO_IntegerMinHigh_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int NO_IntegerMinHigh_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerMinHigh_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t NO_IntegerMinHigh_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { NO_IntegerMinHigh_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t NO_IntegerMinHigh_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerMinHigh_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t NO_IntegerMinHigh_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { NO_IntegerMinHigh_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t NO_IntegerMinHigh_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerMinHigh_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [NO-IntegerMinHigh] >>> ***/ static const ber_tlv_tag_t asn_DEF_NO_IntegerMinHigh_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_NO_IntegerMinHigh = { "NO-IntegerMinHigh", "NO-IntegerMinHigh", NO_IntegerMinHigh_free, NO_IntegerMinHigh_print, NO_IntegerMinHigh_constraint, NO_IntegerMinHigh_decode_ber, NO_IntegerMinHigh_encode_der, NO_IntegerMinHigh_decode_xer, NO_IntegerMinHigh_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerMinHigh_tags_1, sizeof(asn_DEF_NO_IntegerMinHigh_tags_1) /sizeof(asn_DEF_NO_IntegerMinHigh_tags_1[0]), /* 1 */ asn_DEF_NO_IntegerMinHigh_tags_1, /* Same as above */ sizeof(asn_DEF_NO_IntegerMinHigh_tags_1) /sizeof(asn_DEF_NO_IntegerMinHigh_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [NO-IntegerLowHigh] >>> ***/ #include /*** <<< TYPE-DECLS [NO-IntegerLowHigh] >>> ***/ typedef unsigned long NO_IntegerLowHigh_t; /*** <<< FUNC-DECLS [NO-IntegerLowHigh] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_NO_IntegerLowHigh; asn_struct_free_f NO_IntegerLowHigh_free; asn_struct_print_f NO_IntegerLowHigh_print; asn_constr_check_f NO_IntegerLowHigh_constraint; ber_type_decoder_f NO_IntegerLowHigh_decode_ber; der_type_encoder_f NO_IntegerLowHigh_encode_der; xer_type_decoder_f NO_IntegerLowHigh_decode_xer; xer_type_encoder_f NO_IntegerLowHigh_encode_xer; /*** <<< CODE [NO-IntegerLowHigh] >>> ***/ int NO_IntegerLowHigh_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { unsigned long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const unsigned long *)sptr; if((value >= 1 && value <= 3000000000)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void NO_IntegerLowHigh_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; /* td->specifics = asn_DEF_NativeInteger.specifics; // Defined explicitly */ } void NO_IntegerLowHigh_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { NO_IntegerLowHigh_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int NO_IntegerLowHigh_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerLowHigh_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t NO_IntegerLowHigh_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { NO_IntegerLowHigh_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t NO_IntegerLowHigh_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerLowHigh_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t NO_IntegerLowHigh_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { NO_IntegerLowHigh_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t NO_IntegerLowHigh_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerLowHigh_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [NO-IntegerLowHigh] >>> ***/ static const asn_INTEGER_specifics_t asn_SPC_NO_IntegerLowHigh_specs_1 = { 0, 0, 0, 0, 0, 0, /* Native long size */ 1 /* Unsigned representation */ }; static const ber_tlv_tag_t asn_DEF_NO_IntegerLowHigh_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_NO_IntegerLowHigh = { "NO-IntegerLowHigh", "NO-IntegerLowHigh", NO_IntegerLowHigh_free, NO_IntegerLowHigh_print, NO_IntegerLowHigh_constraint, NO_IntegerLowHigh_decode_ber, NO_IntegerLowHigh_encode_der, NO_IntegerLowHigh_decode_xer, NO_IntegerLowHigh_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerLowHigh_tags_1, sizeof(asn_DEF_NO_IntegerLowHigh_tags_1) /sizeof(asn_DEF_NO_IntegerLowHigh_tags_1[0]), /* 1 */ asn_DEF_NO_IntegerLowHigh_tags_1, /* Same as above */ sizeof(asn_DEF_NO_IntegerLowHigh_tags_1) /sizeof(asn_DEF_NO_IntegerLowHigh_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ &asn_SPC_NO_IntegerLowHigh_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [CN-IntegerLowMax] >>> ***/ #include /*** <<< TYPE-DECLS [CN-IntegerLowMax] >>> ***/ typedef long CN_IntegerLowMax_t; /*** <<< FUNC-DECLS [CN-IntegerLowMax] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_CN_IntegerLowMax; asn_struct_free_f CN_IntegerLowMax_free; asn_struct_print_f CN_IntegerLowMax_print; asn_constr_check_f CN_IntegerLowMax_constraint; ber_type_decoder_f CN_IntegerLowMax_decode_ber; der_type_encoder_f CN_IntegerLowMax_encode_der; xer_type_decoder_f CN_IntegerLowMax_decode_xer; xer_type_encoder_f CN_IntegerLowMax_encode_xer; /*** <<< CODE [CN-IntegerLowMax] >>> ***/ int CN_IntegerLowMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if((value >= 1)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void CN_IntegerLowMax_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; td->specifics = asn_DEF_NativeInteger.specifics; } void CN_IntegerLowMax_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { CN_IntegerLowMax_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int CN_IntegerLowMax_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerLowMax_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t CN_IntegerLowMax_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { CN_IntegerLowMax_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t CN_IntegerLowMax_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerLowMax_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t CN_IntegerLowMax_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { CN_IntegerLowMax_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t CN_IntegerLowMax_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerLowMax_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [CN-IntegerLowMax] >>> ***/ static const ber_tlv_tag_t asn_DEF_CN_IntegerLowMax_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_CN_IntegerLowMax = { "CN-IntegerLowMax", "CN-IntegerLowMax", CN_IntegerLowMax_free, CN_IntegerLowMax_print, CN_IntegerLowMax_constraint, CN_IntegerLowMax_decode_ber, CN_IntegerLowMax_encode_der, CN_IntegerLowMax_decode_xer, CN_IntegerLowMax_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_CN_IntegerLowMax_tags_1, sizeof(asn_DEF_CN_IntegerLowMax_tags_1) /sizeof(asn_DEF_CN_IntegerLowMax_tags_1[0]), /* 1 */ asn_DEF_CN_IntegerLowMax_tags_1, /* Same as above */ sizeof(asn_DEF_CN_IntegerLowMax_tags_1) /sizeof(asn_DEF_CN_IntegerLowMax_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [NO-IntegerHighMax] >>> ***/ #include /*** <<< TYPE-DECLS [NO-IntegerHighMax] >>> ***/ typedef INTEGER_t NO_IntegerHighMax_t; /*** <<< FUNC-DECLS [NO-IntegerHighMax] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_NO_IntegerHighMax; asn_struct_free_f NO_IntegerHighMax_free; asn_struct_print_f NO_IntegerHighMax_print; asn_constr_check_f NO_IntegerHighMax_constraint; ber_type_decoder_f NO_IntegerHighMax_decode_ber; der_type_encoder_f NO_IntegerHighMax_encode_der; xer_type_decoder_f NO_IntegerHighMax_decode_xer; xer_type_encoder_f NO_IntegerHighMax_encode_xer; /*** <<< CODE [NO-IntegerHighMax] >>> ***/ int NO_IntegerHighMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(asn_INTEGER2long(st, &value)) { ASN__CTFAIL(app_key, td, sptr, "%s: value too large (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if((value >= 3000000000)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using INTEGER, * so here we adjust the DEF accordingly. */ static void NO_IntegerHighMax_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_INTEGER.free_struct; td->print_struct = asn_DEF_INTEGER.print_struct; td->check_constraints = asn_DEF_INTEGER.check_constraints; td->ber_decoder = asn_DEF_INTEGER.ber_decoder; td->der_encoder = asn_DEF_INTEGER.der_encoder; td->xer_decoder = asn_DEF_INTEGER.xer_decoder; td->xer_encoder = asn_DEF_INTEGER.xer_encoder; td->uper_decoder = asn_DEF_INTEGER.uper_decoder; td->uper_encoder = asn_DEF_INTEGER.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; td->elements = asn_DEF_INTEGER.elements; td->elements_count = asn_DEF_INTEGER.elements_count; td->specifics = asn_DEF_INTEGER.specifics; } void NO_IntegerHighMax_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { NO_IntegerHighMax_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int NO_IntegerHighMax_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerHighMax_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t NO_IntegerHighMax_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { NO_IntegerHighMax_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t NO_IntegerHighMax_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerHighMax_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t NO_IntegerHighMax_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { NO_IntegerHighMax_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t NO_IntegerHighMax_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerHighMax_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [NO-IntegerHighMax] >>> ***/ static const ber_tlv_tag_t asn_DEF_NO_IntegerHighMax_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_NO_IntegerHighMax = { "NO-IntegerHighMax", "NO-IntegerHighMax", NO_IntegerHighMax_free, NO_IntegerHighMax_print, NO_IntegerHighMax_constraint, NO_IntegerHighMax_decode_ber, NO_IntegerHighMax_encode_der, NO_IntegerHighMax_decode_xer, NO_IntegerHighMax_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerHighMax_tags_1, sizeof(asn_DEF_NO_IntegerHighMax_tags_1) /sizeof(asn_DEF_NO_IntegerHighMax_tags_1[0]), /* 1 */ asn_DEF_NO_IntegerHighMax_tags_1, /* Same as above */ sizeof(asn_DEF_NO_IntegerHighMax_tags_1) /sizeof(asn_DEF_NO_IntegerHighMax_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [NO-IntegerLowestMax] >>> ***/ #include /*** <<< TYPE-DECLS [NO-IntegerLowestMax] >>> ***/ typedef INTEGER_t NO_IntegerLowestMax_t; /*** <<< FUNC-DECLS [NO-IntegerLowestMax] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_NO_IntegerLowestMax; asn_struct_free_f NO_IntegerLowestMax_free; asn_struct_print_f NO_IntegerLowestMax_print; asn_constr_check_f NO_IntegerLowestMax_constraint; ber_type_decoder_f NO_IntegerLowestMax_decode_ber; der_type_encoder_f NO_IntegerLowestMax_encode_der; xer_type_decoder_f NO_IntegerLowestMax_decode_xer; xer_type_encoder_f NO_IntegerLowestMax_encode_xer; /*** <<< CODE [NO-IntegerLowestMax] >>> ***/ int NO_IntegerLowestMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(asn_INTEGER2long(st, &value)) { ASN__CTFAIL(app_key, td, sptr, "%s: value too large (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if((value >= -3000000000)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using INTEGER, * so here we adjust the DEF accordingly. */ static void NO_IntegerLowestMax_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_INTEGER.free_struct; td->print_struct = asn_DEF_INTEGER.print_struct; td->check_constraints = asn_DEF_INTEGER.check_constraints; td->ber_decoder = asn_DEF_INTEGER.ber_decoder; td->der_encoder = asn_DEF_INTEGER.der_encoder; td->xer_decoder = asn_DEF_INTEGER.xer_decoder; td->xer_encoder = asn_DEF_INTEGER.xer_encoder; td->uper_decoder = asn_DEF_INTEGER.uper_decoder; td->uper_encoder = asn_DEF_INTEGER.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; td->elements = asn_DEF_INTEGER.elements; td->elements_count = asn_DEF_INTEGER.elements_count; td->specifics = asn_DEF_INTEGER.specifics; } void NO_IntegerLowestMax_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { NO_IntegerLowestMax_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int NO_IntegerLowestMax_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerLowestMax_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t NO_IntegerLowestMax_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { NO_IntegerLowestMax_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t NO_IntegerLowestMax_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerLowestMax_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t NO_IntegerLowestMax_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { NO_IntegerLowestMax_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t NO_IntegerLowestMax_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerLowestMax_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [NO-IntegerLowestMax] >>> ***/ static const ber_tlv_tag_t asn_DEF_NO_IntegerLowestMax_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_NO_IntegerLowestMax = { "NO-IntegerLowestMax", "NO-IntegerLowestMax", NO_IntegerLowestMax_free, NO_IntegerLowestMax_print, NO_IntegerLowestMax_constraint, NO_IntegerLowestMax_decode_ber, NO_IntegerLowestMax_encode_der, NO_IntegerLowestMax_decode_xer, NO_IntegerLowestMax_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerLowestMax_tags_1, sizeof(asn_DEF_NO_IntegerLowestMax_tags_1) /sizeof(asn_DEF_NO_IntegerLowestMax_tags_1[0]), /* 1 */ asn_DEF_NO_IntegerLowestMax_tags_1, /* Same as above */ sizeof(asn_DEF_NO_IntegerLowestMax_tags_1) /sizeof(asn_DEF_NO_IntegerLowestMax_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [NO-IntegerOutRange] >>> ***/ #include /*** <<< TYPE-DECLS [NO-IntegerOutRange] >>> ***/ typedef unsigned long NO_IntegerOutRange_t; /*** <<< FUNC-DECLS [NO-IntegerOutRange] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_NO_IntegerOutRange; asn_struct_free_f NO_IntegerOutRange_free; asn_struct_print_f NO_IntegerOutRange_print; asn_constr_check_f NO_IntegerOutRange_constraint; ber_type_decoder_f NO_IntegerOutRange_decode_ber; der_type_encoder_f NO_IntegerOutRange_encode_der; xer_type_decoder_f NO_IntegerOutRange_decode_xer; xer_type_encoder_f NO_IntegerOutRange_encode_xer; /*** <<< CODE [NO-IntegerOutRange] >>> ***/ int NO_IntegerOutRange_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { unsigned long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const unsigned long *)sptr; if((value >= 3000000000 && value <= 3000000001)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void NO_IntegerOutRange_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; /* td->specifics = asn_DEF_NativeInteger.specifics; // Defined explicitly */ } void NO_IntegerOutRange_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { NO_IntegerOutRange_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int NO_IntegerOutRange_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerOutRange_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t NO_IntegerOutRange_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { NO_IntegerOutRange_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t NO_IntegerOutRange_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerOutRange_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t NO_IntegerOutRange_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { NO_IntegerOutRange_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t NO_IntegerOutRange_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerOutRange_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [NO-IntegerOutRange] >>> ***/ static const asn_INTEGER_specifics_t asn_SPC_NO_IntegerOutRange_specs_1 = { 0, 0, 0, 0, 0, 0, /* Native long size */ 1 /* Unsigned representation */ }; static const ber_tlv_tag_t asn_DEF_NO_IntegerOutRange_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_NO_IntegerOutRange = { "NO-IntegerOutRange", "NO-IntegerOutRange", NO_IntegerOutRange_free, NO_IntegerOutRange_print, NO_IntegerOutRange_constraint, NO_IntegerOutRange_decode_ber, NO_IntegerOutRange_encode_der, NO_IntegerOutRange_decode_xer, NO_IntegerOutRange_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerOutRange_tags_1, sizeof(asn_DEF_NO_IntegerOutRange_tags_1) /sizeof(asn_DEF_NO_IntegerOutRange_tags_1[0]), /* 1 */ asn_DEF_NO_IntegerOutRange_tags_1, /* Same as above */ sizeof(asn_DEF_NO_IntegerOutRange_tags_1) /sizeof(asn_DEF_NO_IntegerOutRange_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ &asn_SPC_NO_IntegerOutRange_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [NO-IntegerOutValue] >>> ***/ #include /*** <<< TYPE-DECLS [NO-IntegerOutValue] >>> ***/ typedef unsigned long NO_IntegerOutValue_t; /*** <<< FUNC-DECLS [NO-IntegerOutValue] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_NO_IntegerOutValue; asn_struct_free_f NO_IntegerOutValue_free; asn_struct_print_f NO_IntegerOutValue_print; asn_constr_check_f NO_IntegerOutValue_constraint; ber_type_decoder_f NO_IntegerOutValue_decode_ber; der_type_encoder_f NO_IntegerOutValue_encode_der; xer_type_decoder_f NO_IntegerOutValue_decode_xer; xer_type_encoder_f NO_IntegerOutValue_encode_xer; /*** <<< CODE [NO-IntegerOutValue] >>> ***/ int NO_IntegerOutValue_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { unsigned long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const unsigned long *)sptr; if((value == 3000000000)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void NO_IntegerOutValue_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; /* td->specifics = asn_DEF_NativeInteger.specifics; // Defined explicitly */ } void NO_IntegerOutValue_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { NO_IntegerOutValue_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int NO_IntegerOutValue_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerOutValue_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t NO_IntegerOutValue_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { NO_IntegerOutValue_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t NO_IntegerOutValue_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerOutValue_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t NO_IntegerOutValue_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { NO_IntegerOutValue_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t NO_IntegerOutValue_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerOutValue_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [NO-IntegerOutValue] >>> ***/ static const asn_INTEGER_specifics_t asn_SPC_NO_IntegerOutValue_specs_1 = { 0, 0, 0, 0, 0, 0, /* Native long size */ 1 /* Unsigned representation */ }; static const ber_tlv_tag_t asn_DEF_NO_IntegerOutValue_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_NO_IntegerOutValue = { "NO-IntegerOutValue", "NO-IntegerOutValue", NO_IntegerOutValue_free, NO_IntegerOutValue_print, NO_IntegerOutValue_constraint, NO_IntegerOutValue_decode_ber, NO_IntegerOutValue_encode_der, NO_IntegerOutValue_decode_xer, NO_IntegerOutValue_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerOutValue_tags_1, sizeof(asn_DEF_NO_IntegerOutValue_tags_1) /sizeof(asn_DEF_NO_IntegerOutValue_tags_1[0]), /* 1 */ asn_DEF_NO_IntegerOutValue_tags_1, /* Same as above */ sizeof(asn_DEF_NO_IntegerOutValue_tags_1) /sizeof(asn_DEF_NO_IntegerOutValue_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ &asn_SPC_NO_IntegerOutValue_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [OK-IntegerInRange1] >>> ***/ #include /*** <<< TYPE-DECLS [OK-IntegerInRange1] >>> ***/ typedef long OK_IntegerInRange1_t; /*** <<< FUNC-DECLS [OK-IntegerInRange1] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange1; asn_struct_free_f OK_IntegerInRange1_free; asn_struct_print_f OK_IntegerInRange1_print; asn_constr_check_f OK_IntegerInRange1_constraint; ber_type_decoder_f OK_IntegerInRange1_decode_ber; der_type_encoder_f OK_IntegerInRange1_encode_der; xer_type_decoder_f OK_IntegerInRange1_decode_xer; xer_type_encoder_f OK_IntegerInRange1_encode_xer; /*** <<< CODE [OK-IntegerInRange1] >>> ***/ int OK_IntegerInRange1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if((value >= -100 && value <= 100)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void OK_IntegerInRange1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; td->specifics = asn_DEF_NativeInteger.specifics; } void OK_IntegerInRange1_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { OK_IntegerInRange1_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int OK_IntegerInRange1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange1_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t OK_IntegerInRange1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { OK_IntegerInRange1_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t OK_IntegerInRange1_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange1_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t OK_IntegerInRange1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { OK_IntegerInRange1_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t OK_IntegerInRange1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange1_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [OK-IntegerInRange1] >>> ***/ static const ber_tlv_tag_t asn_DEF_OK_IntegerInRange1_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange1 = { "OK-IntegerInRange1", "OK-IntegerInRange1", OK_IntegerInRange1_free, OK_IntegerInRange1_print, OK_IntegerInRange1_constraint, OK_IntegerInRange1_decode_ber, OK_IntegerInRange1_encode_der, OK_IntegerInRange1_decode_xer, OK_IntegerInRange1_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_OK_IntegerInRange1_tags_1, sizeof(asn_DEF_OK_IntegerInRange1_tags_1) /sizeof(asn_DEF_OK_IntegerInRange1_tags_1[0]), /* 1 */ asn_DEF_OK_IntegerInRange1_tags_1, /* Same as above */ sizeof(asn_DEF_OK_IntegerInRange1_tags_1) /sizeof(asn_DEF_OK_IntegerInRange1_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [OK-IntegerInRange2] >>> ***/ #include /*** <<< TYPE-DECLS [OK-IntegerInRange2] >>> ***/ typedef long OK_IntegerInRange2_t; /*** <<< FUNC-DECLS [OK-IntegerInRange2] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange2; asn_struct_free_f OK_IntegerInRange2_free; asn_struct_print_f OK_IntegerInRange2_print; asn_constr_check_f OK_IntegerInRange2_constraint; ber_type_decoder_f OK_IntegerInRange2_decode_ber; der_type_encoder_f OK_IntegerInRange2_encode_der; xer_type_decoder_f OK_IntegerInRange2_decode_xer; xer_type_encoder_f OK_IntegerInRange2_encode_xer; /*** <<< CODE [OK-IntegerInRange2] >>> ***/ int OK_IntegerInRange2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if(((value == -100) || (value == 100))) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void OK_IntegerInRange2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; td->specifics = asn_DEF_NativeInteger.specifics; } void OK_IntegerInRange2_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { OK_IntegerInRange2_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int OK_IntegerInRange2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange2_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t OK_IntegerInRange2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { OK_IntegerInRange2_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t OK_IntegerInRange2_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange2_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t OK_IntegerInRange2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { OK_IntegerInRange2_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t OK_IntegerInRange2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange2_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [OK-IntegerInRange2] >>> ***/ static const ber_tlv_tag_t asn_DEF_OK_IntegerInRange2_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange2 = { "OK-IntegerInRange2", "OK-IntegerInRange2", OK_IntegerInRange2_free, OK_IntegerInRange2_print, OK_IntegerInRange2_constraint, OK_IntegerInRange2_decode_ber, OK_IntegerInRange2_encode_der, OK_IntegerInRange2_decode_xer, OK_IntegerInRange2_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_OK_IntegerInRange2_tags_1, sizeof(asn_DEF_OK_IntegerInRange2_tags_1) /sizeof(asn_DEF_OK_IntegerInRange2_tags_1[0]), /* 1 */ asn_DEF_OK_IntegerInRange2_tags_1, /* Same as above */ sizeof(asn_DEF_OK_IntegerInRange2_tags_1) /sizeof(asn_DEF_OK_IntegerInRange2_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [OK-IntegerInRange3] >>> ***/ #include /*** <<< TYPE-DECLS [OK-IntegerInRange3] >>> ***/ typedef long OK_IntegerInRange3_t; /*** <<< FUNC-DECLS [OK-IntegerInRange3] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange3; asn_struct_free_f OK_IntegerInRange3_free; asn_struct_print_f OK_IntegerInRange3_print; asn_constr_check_f OK_IntegerInRange3_constraint; ber_type_decoder_f OK_IntegerInRange3_decode_ber; der_type_encoder_f OK_IntegerInRange3_encode_der; xer_type_decoder_f OK_IntegerInRange3_decode_xer; xer_type_encoder_f OK_IntegerInRange3_encode_xer; /*** <<< CODE [OK-IntegerInRange3] >>> ***/ int OK_IntegerInRange3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if((value >= (-2147483647L - 1) && value <= 2147483647)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void OK_IntegerInRange3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; td->specifics = asn_DEF_NativeInteger.specifics; } void OK_IntegerInRange3_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { OK_IntegerInRange3_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int OK_IntegerInRange3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange3_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t OK_IntegerInRange3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { OK_IntegerInRange3_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t OK_IntegerInRange3_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange3_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t OK_IntegerInRange3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { OK_IntegerInRange3_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t OK_IntegerInRange3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange3_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [OK-IntegerInRange3] >>> ***/ static const ber_tlv_tag_t asn_DEF_OK_IntegerInRange3_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange3 = { "OK-IntegerInRange3", "OK-IntegerInRange3", OK_IntegerInRange3_free, OK_IntegerInRange3_print, OK_IntegerInRange3_constraint, OK_IntegerInRange3_decode_ber, OK_IntegerInRange3_encode_der, OK_IntegerInRange3_decode_xer, OK_IntegerInRange3_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_OK_IntegerInRange3_tags_1, sizeof(asn_DEF_OK_IntegerInRange3_tags_1) /sizeof(asn_DEF_OK_IntegerInRange3_tags_1[0]), /* 1 */ asn_DEF_OK_IntegerInRange3_tags_1, /* Same as above */ sizeof(asn_DEF_OK_IntegerInRange3_tags_1) /sizeof(asn_DEF_OK_IntegerInRange3_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [OK-IntegerInRange4] >>> ***/ #include /*** <<< TYPE-DECLS [OK-IntegerInRange4] >>> ***/ typedef long OK_IntegerInRange4_t; /*** <<< FUNC-DECLS [OK-IntegerInRange4] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange4; asn_struct_free_f OK_IntegerInRange4_free; asn_struct_print_f OK_IntegerInRange4_print; asn_constr_check_f OK_IntegerInRange4_constraint; ber_type_decoder_f OK_IntegerInRange4_decode_ber; der_type_encoder_f OK_IntegerInRange4_encode_der; xer_type_decoder_f OK_IntegerInRange4_decode_xer; xer_type_encoder_f OK_IntegerInRange4_encode_xer; /*** <<< CODE [OK-IntegerInRange4] >>> ***/ int OK_IntegerInRange4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if(((value == (-2147483647L - 1)) || (value == 2147483647))) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void OK_IntegerInRange4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; td->specifics = asn_DEF_NativeInteger.specifics; } void OK_IntegerInRange4_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { OK_IntegerInRange4_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int OK_IntegerInRange4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange4_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t OK_IntegerInRange4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { OK_IntegerInRange4_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t OK_IntegerInRange4_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange4_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t OK_IntegerInRange4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { OK_IntegerInRange4_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t OK_IntegerInRange4_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange4_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [OK-IntegerInRange4] >>> ***/ static const ber_tlv_tag_t asn_DEF_OK_IntegerInRange4_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange4 = { "OK-IntegerInRange4", "OK-IntegerInRange4", OK_IntegerInRange4_free, OK_IntegerInRange4_print, OK_IntegerInRange4_constraint, OK_IntegerInRange4_decode_ber, OK_IntegerInRange4_encode_der, OK_IntegerInRange4_decode_xer, OK_IntegerInRange4_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_OK_IntegerInRange4_tags_1, sizeof(asn_DEF_OK_IntegerInRange4_tags_1) /sizeof(asn_DEF_OK_IntegerInRange4_tags_1[0]), /* 1 */ asn_DEF_OK_IntegerInRange4_tags_1, /* Same as above */ sizeof(asn_DEF_OK_IntegerInRange4_tags_1) /sizeof(asn_DEF_OK_IntegerInRange4_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [OK-IntegerInRange5] >>> ***/ #include /*** <<< TYPE-DECLS [OK-IntegerInRange5] >>> ***/ typedef long OK_IntegerInRange5_t; /*** <<< FUNC-DECLS [OK-IntegerInRange5] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange5; asn_struct_free_f OK_IntegerInRange5_free; asn_struct_print_f OK_IntegerInRange5_print; asn_constr_check_f OK_IntegerInRange5_constraint; ber_type_decoder_f OK_IntegerInRange5_decode_ber; der_type_encoder_f OK_IntegerInRange5_encode_der; xer_type_decoder_f OK_IntegerInRange5_decode_xer; xer_type_encoder_f OK_IntegerInRange5_encode_xer; /*** <<< CODE [OK-IntegerInRange5] >>> ***/ int OK_IntegerInRange5_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if(((value == (-2147483647L - 1)) || (value == 2147483647))) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void OK_IntegerInRange5_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; td->specifics = asn_DEF_NativeInteger.specifics; } void OK_IntegerInRange5_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { OK_IntegerInRange5_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int OK_IntegerInRange5_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange5_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t OK_IntegerInRange5_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { OK_IntegerInRange5_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t OK_IntegerInRange5_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange5_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t OK_IntegerInRange5_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { OK_IntegerInRange5_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t OK_IntegerInRange5_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange5_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [OK-IntegerInRange5] >>> ***/ static const ber_tlv_tag_t asn_DEF_OK_IntegerInRange5_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange5 = { "OK-IntegerInRange5", "OK-IntegerInRange5", OK_IntegerInRange5_free, OK_IntegerInRange5_print, OK_IntegerInRange5_constraint, OK_IntegerInRange5_decode_ber, OK_IntegerInRange5_encode_der, OK_IntegerInRange5_decode_xer, OK_IntegerInRange5_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_OK_IntegerInRange5_tags_1, sizeof(asn_DEF_OK_IntegerInRange5_tags_1) /sizeof(asn_DEF_OK_IntegerInRange5_tags_1[0]), /* 1 */ asn_DEF_OK_IntegerInRange5_tags_1, /* Same as above */ sizeof(asn_DEF_OK_IntegerInRange5_tags_1) /sizeof(asn_DEF_OK_IntegerInRange5_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [NO-IntegerInRange6] >>> ***/ #include /*** <<< TYPE-DECLS [NO-IntegerInRange6] >>> ***/ typedef unsigned long NO_IntegerInRange6_t; /*** <<< FUNC-DECLS [NO-IntegerInRange6] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_NO_IntegerInRange6; asn_struct_free_f NO_IntegerInRange6_free; asn_struct_print_f NO_IntegerInRange6_print; asn_constr_check_f NO_IntegerInRange6_constraint; ber_type_decoder_f NO_IntegerInRange6_decode_ber; der_type_encoder_f NO_IntegerInRange6_encode_der; xer_type_decoder_f NO_IntegerInRange6_decode_xer; xer_type_encoder_f NO_IntegerInRange6_encode_xer; /*** <<< CODE [NO-IntegerInRange6] >>> ***/ int NO_IntegerInRange6_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } /* Constraint check succeeded */ return 0; } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void NO_IntegerInRange6_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; /* td->specifics = asn_DEF_NativeInteger.specifics; // Defined explicitly */ } void NO_IntegerInRange6_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { NO_IntegerInRange6_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int NO_IntegerInRange6_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerInRange6_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t NO_IntegerInRange6_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { NO_IntegerInRange6_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t NO_IntegerInRange6_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerInRange6_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t NO_IntegerInRange6_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { NO_IntegerInRange6_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t NO_IntegerInRange6_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerInRange6_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [NO-IntegerInRange6] >>> ***/ static const asn_INTEGER_specifics_t asn_SPC_NO_IntegerInRange6_specs_1 = { 0, 0, 0, 0, 0, 0, /* Native long size */ 1 /* Unsigned representation */ }; static const ber_tlv_tag_t asn_DEF_NO_IntegerInRange6_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_NO_IntegerInRange6 = { "NO-IntegerInRange6", "NO-IntegerInRange6", NO_IntegerInRange6_free, NO_IntegerInRange6_print, NO_IntegerInRange6_constraint, NO_IntegerInRange6_decode_ber, NO_IntegerInRange6_encode_der, NO_IntegerInRange6_decode_xer, NO_IntegerInRange6_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerInRange6_tags_1, sizeof(asn_DEF_NO_IntegerInRange6_tags_1) /sizeof(asn_DEF_NO_IntegerInRange6_tags_1[0]), /* 1 */ asn_DEF_NO_IntegerInRange6_tags_1, /* Same as above */ sizeof(asn_DEF_NO_IntegerInRange6_tags_1) /sizeof(asn_DEF_NO_IntegerInRange6_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ &asn_SPC_NO_IntegerInRange6_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [CN-IntegerEnumerated1] >>> ***/ #include /*** <<< DEPS [CN-IntegerEnumerated1] >>> ***/ typedef enum CN_IntegerEnumerated1 { CN_IntegerEnumerated1_a = 1, CN_IntegerEnumerated1_b = 2 } e_CN_IntegerEnumerated1; /*** <<< TYPE-DECLS [CN-IntegerEnumerated1] >>> ***/ typedef long CN_IntegerEnumerated1_t; /*** <<< FUNC-DECLS [CN-IntegerEnumerated1] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_CN_IntegerEnumerated1; asn_struct_free_f CN_IntegerEnumerated1_free; asn_struct_print_f CN_IntegerEnumerated1_print; asn_constr_check_f CN_IntegerEnumerated1_constraint; ber_type_decoder_f CN_IntegerEnumerated1_decode_ber; der_type_encoder_f CN_IntegerEnumerated1_encode_der; xer_type_decoder_f CN_IntegerEnumerated1_decode_xer; xer_type_encoder_f CN_IntegerEnumerated1_encode_xer; /*** <<< CODE [CN-IntegerEnumerated1] >>> ***/ int CN_IntegerEnumerated1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_NativeInteger.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void CN_IntegerEnumerated1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; td->specifics = asn_DEF_NativeInteger.specifics; } void CN_IntegerEnumerated1_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { CN_IntegerEnumerated1_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int CN_IntegerEnumerated1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerEnumerated1_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t CN_IntegerEnumerated1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { CN_IntegerEnumerated1_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t CN_IntegerEnumerated1_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerEnumerated1_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t CN_IntegerEnumerated1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { CN_IntegerEnumerated1_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t CN_IntegerEnumerated1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerEnumerated1_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [CN-IntegerEnumerated1] >>> ***/ static const ber_tlv_tag_t asn_DEF_CN_IntegerEnumerated1_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_CN_IntegerEnumerated1 = { "CN-IntegerEnumerated1", "CN-IntegerEnumerated1", CN_IntegerEnumerated1_free, CN_IntegerEnumerated1_print, CN_IntegerEnumerated1_constraint, CN_IntegerEnumerated1_decode_ber, CN_IntegerEnumerated1_encode_der, CN_IntegerEnumerated1_decode_xer, CN_IntegerEnumerated1_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_CN_IntegerEnumerated1_tags_1, sizeof(asn_DEF_CN_IntegerEnumerated1_tags_1) /sizeof(asn_DEF_CN_IntegerEnumerated1_tags_1[0]), /* 1 */ asn_DEF_CN_IntegerEnumerated1_tags_1, /* Same as above */ sizeof(asn_DEF_CN_IntegerEnumerated1_tags_1) /sizeof(asn_DEF_CN_IntegerEnumerated1_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* Defined elsewhere */ 0 /* No specifics */ }; /*** <<< INCLUDES [NO-IntegerEnumerated2] >>> ***/ #include /*** <<< DEPS [NO-IntegerEnumerated2] >>> ***/ typedef enum NO_IntegerEnumerated2 { NO_IntegerEnumerated2_a = 1, NO_IntegerEnumerated2_b = 3000000000 } e_NO_IntegerEnumerated2; /*** <<< TYPE-DECLS [NO-IntegerEnumerated2] >>> ***/ typedef INTEGER_t NO_IntegerEnumerated2_t; /*** <<< FUNC-DECLS [NO-IntegerEnumerated2] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_NO_IntegerEnumerated2; asn_struct_free_f NO_IntegerEnumerated2_free; asn_struct_print_f NO_IntegerEnumerated2_print; asn_constr_check_f NO_IntegerEnumerated2_constraint; ber_type_decoder_f NO_IntegerEnumerated2_decode_ber; der_type_encoder_f NO_IntegerEnumerated2_encode_der; xer_type_decoder_f NO_IntegerEnumerated2_decode_xer; xer_type_encoder_f NO_IntegerEnumerated2_encode_xer; /*** <<< CODE [NO-IntegerEnumerated2] >>> ***/ int NO_IntegerEnumerated2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_INTEGER.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using INTEGER, * so here we adjust the DEF accordingly. */ static void NO_IntegerEnumerated2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_INTEGER.free_struct; td->print_struct = asn_DEF_INTEGER.print_struct; td->check_constraints = asn_DEF_INTEGER.check_constraints; td->ber_decoder = asn_DEF_INTEGER.ber_decoder; td->der_encoder = asn_DEF_INTEGER.der_encoder; td->xer_decoder = asn_DEF_INTEGER.xer_decoder; td->xer_encoder = asn_DEF_INTEGER.xer_encoder; td->uper_decoder = asn_DEF_INTEGER.uper_decoder; td->uper_encoder = asn_DEF_INTEGER.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; td->elements = asn_DEF_INTEGER.elements; td->elements_count = asn_DEF_INTEGER.elements_count; td->specifics = asn_DEF_INTEGER.specifics; } void NO_IntegerEnumerated2_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { NO_IntegerEnumerated2_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int NO_IntegerEnumerated2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerEnumerated2_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t NO_IntegerEnumerated2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { NO_IntegerEnumerated2_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t NO_IntegerEnumerated2_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerEnumerated2_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t NO_IntegerEnumerated2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { NO_IntegerEnumerated2_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t NO_IntegerEnumerated2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerEnumerated2_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [NO-IntegerEnumerated2] >>> ***/ static const ber_tlv_tag_t asn_DEF_NO_IntegerEnumerated2_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_NO_IntegerEnumerated2 = { "NO-IntegerEnumerated2", "NO-IntegerEnumerated2", NO_IntegerEnumerated2_free, NO_IntegerEnumerated2_print, NO_IntegerEnumerated2_constraint, NO_IntegerEnumerated2_decode_ber, NO_IntegerEnumerated2_encode_der, NO_IntegerEnumerated2_decode_xer, NO_IntegerEnumerated2_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerEnumerated2_tags_1, sizeof(asn_DEF_NO_IntegerEnumerated2_tags_1) /sizeof(asn_DEF_NO_IntegerEnumerated2_tags_1[0]), /* 1 */ asn_DEF_NO_IntegerEnumerated2_tags_1, /* Same as above */ sizeof(asn_DEF_NO_IntegerEnumerated2_tags_1) /sizeof(asn_DEF_NO_IntegerEnumerated2_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* Defined elsewhere */ 0 /* No specifics */ }; asn1c-0.9.28+dfsg/tests/49-real-life-OK.asn1.-E0000644000000000000000000000026013065714043017024 0ustar rootrootModuleSetChoiceExtensibility { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 49 } DEFINITIONS ::= BEGIN Z ::= INTEGER END asn1c-0.9.28+dfsg/tests/112-param-class-OK.asn1.-EF0000644000000000000000000000075513065714043017555 0ustar rootrootModuleParameterizationClass { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 112 } DEFINITIONS ::= BEGIN PCLASS{Type, INTEGER:value, INTEGER:ValueSet} ::= CLASS { &valueField1 Type, &valueField2 INTEGER DEFAULT value, &valueField3 INTEGER (ValueSet), &ValueSetField INTEGER DEFAULT {ValueSet} } WITH SYNTAX { &valueField1, &valueField2, &valueField3, &ValueSetField } SCLASS ::= PCLASS{ REAL, 111, {1 | 2 | 3}} END asn1c-0.9.28+dfsg/tests/93-asn1c-controls-OK.asn10000644000000000000000000000117313065714043017575 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .93 Module-asn1c-controls { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 93 } DEFINITIONS AUTOMATIC TAGS ::= BEGIN Sequence ::= SEQUENCE { ainl INTEGER, ---- aptr INTEGER } Set ::= SET { ainl Sequence, ---- aptr Sequence } Choice ::= CHOICE { ---- setof SET OF INTEGER, ---- aptr Sequence, ainl Sequence } END asn1c-0.9.28+dfsg/tests/126-per-extensions-OK.asn1.-Pgen-PER0000644000000000000000000002256013065714043021363 0ustar rootroot /*** <<< INCLUDES [PDU] >>> ***/ #include #include "Singleton.h" #include /*** <<< FWD-DECLS [PDU] >>> ***/ struct PDU_2; struct Singleton; /*** <<< TYPE-DECLS [PDU] >>> ***/ typedef struct PDU { /* * This type is extensible, * possible extensions are below. */ IA5String_t *str_o /* OPTIONAL */; IA5String_t *str_m; struct Singleton *singl; struct PDU_2 *pdu_2 /* OPTIONAL */; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } PDU_t; /*** <<< FUNC-DECLS [PDU] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_PDU; /*** <<< POST-INCLUDE [PDU] >>> ***/ #include "PDU-2.h" /*** <<< STAT-DEFS [PDU] >>> ***/ static asn_TYPE_member_t asn_MBR_PDU_1[] = { { ATF_POINTER, 4, offsetof(struct PDU, str_o), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_IA5String, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* No PER visible constraints */ .default_value = 0, .name = "str-o" }, { ATF_POINTER, 3, offsetof(struct PDU, str_m), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_IA5String, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* No PER visible constraints */ .default_value = 0, .name = "str-m" }, { ATF_POINTER, 2, offsetof(struct PDU, singl), .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Singleton, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* No PER visible constraints */ .default_value = 0, .name = "singl" }, { ATF_POINTER, 1, offsetof(struct PDU, pdu_2), .tag = (ASN_TAG_CLASS_CONTEXT | (3 << 2)), .tag_mode = +1, /* EXPLICIT tag at current level */ .type = &asn_DEF_PDU_2, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* No PER visible constraints */ .default_value = 0, .name = "pdu-2" }, }; static const int asn_MAP_PDU_oms_1[] = { 0, 1, 2, 3 }; static const ber_tlv_tag_t asn_DEF_PDU_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_PDU_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* str-o */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* str-m */ { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* singl */ { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* pdu-2 */ }; static asn_SEQUENCE_specifics_t asn_SPC_PDU_specs_1 = { sizeof(struct PDU), offsetof(struct PDU, _asn_ctx), asn_MAP_PDU_tag2el_1, 4, /* Count of tags in the map */ asn_MAP_PDU_oms_1, /* Optional members */ 0, 4, /* Root/Additions */ -1, /* Start extensions */ 5 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_PDU = { "PDU", "PDU", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_PDU_tags_1, sizeof(asn_DEF_PDU_tags_1) /sizeof(asn_DEF_PDU_tags_1[0]), /* 1 */ asn_DEF_PDU_tags_1, /* Same as above */ sizeof(asn_DEF_PDU_tags_1) /sizeof(asn_DEF_PDU_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_PDU_1, 4, /* Elements count */ &asn_SPC_PDU_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Singleton] >>> ***/ #include #include /*** <<< TYPE-DECLS [Singleton] >>> ***/ typedef struct Singleton { IA5String_t *opt_z /* DEFAULT z */; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Singleton_t; /*** <<< FUNC-DECLS [Singleton] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Singleton; /*** <<< STAT-DEFS [Singleton] >>> ***/ static int asn_DFL_2_set(int set_value, void **sptr) { static uint8_t defv[] = "z"; IA5String_t *st = *sptr; if(!st) { if(!set_value) return -1; /* Not a default value */ st = (*sptr = CALLOC(1, sizeof(*st))); if(!st) return -1; } if(set_value) { uint8_t *ptr = MALLOC(sizeof(defv)); if(!ptr) return -1; memcpy(ptr, &defv, sizeof(defv)); FREEMEM(st->buf); st->buf = ptr; st->size = sizeof(defv) - 1; return 0; } else { if(st->size != (sizeof(defv) - 1) || memcmp(st->buf, &defv, sizeof(defv) - 1)) return 0; return 1; } } static asn_TYPE_member_t asn_MBR_Singleton_1[] = { { ATF_POINTER, 1, offsetof(struct Singleton, opt_z), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_IA5String, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* No PER visible constraints */ .default_value = asn_DFL_2_set, /* DEFAULT "z" */ .name = "opt-z" }, }; static const int asn_MAP_Singleton_oms_1[] = { 0 }; static const ber_tlv_tag_t asn_DEF_Singleton_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_Singleton_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* opt-z */ }; static asn_SEQUENCE_specifics_t asn_SPC_Singleton_specs_1 = { sizeof(struct Singleton), offsetof(struct Singleton, _asn_ctx), asn_MAP_Singleton_tag2el_1, 1, /* Count of tags in the map */ asn_MAP_Singleton_oms_1, /* Optional members */ 1, 0, /* Root/Additions */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Singleton = { "Singleton", "Singleton", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Singleton_tags_1, sizeof(asn_DEF_Singleton_tags_1) /sizeof(asn_DEF_Singleton_tags_1[0]), /* 1 */ asn_DEF_Singleton_tags_1, /* Same as above */ sizeof(asn_DEF_Singleton_tags_1) /sizeof(asn_DEF_Singleton_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Singleton_1, 1, /* Elements count */ &asn_SPC_Singleton_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [PDU-2] >>> ***/ #include #include /*** <<< DEPS [PDU-2] >>> ***/ typedef enum PDU_2_PR { PDU_2_PR_NOTHING, /* No components present */ PDU_2_PR_main, /* Extensions may appear below */ PDU_2_PR_ext1, PDU_2_PR_ext0 } PDU_2_PR; /*** <<< TYPE-DECLS [PDU-2] >>> ***/ typedef struct PDU_2 { PDU_2_PR present; union PDU_2_u { long main; /* * This type is extensible, * possible extensions are below. */ long ext1; long ext0; } choice; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } PDU_2_t; /*** <<< FUNC-DECLS [PDU-2] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_PDU_2; /*** <<< CTDEFS [PDU-2] >>> ***/ static asn_per_constraints_t asn_PER_type_PDU_2_constr_1 GCC_NOTUSED = { { APC_CONSTRAINED | APC_EXTENSIBLE, 0, 0, 0, 0 } /* (0..0,...) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; /*** <<< STAT-DEFS [PDU-2] >>> ***/ static asn_TYPE_member_t asn_MBR_PDU_2_1[] = { { ATF_NOFLAGS, 0, offsetof(struct PDU_2, choice.main), .tag = (ASN_TAG_CLASS_CONTEXT | (3 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_NativeInteger, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* No PER visible constraints */ .default_value = 0, .name = "main" }, { ATF_NOFLAGS, 0, offsetof(struct PDU_2, choice.ext1), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_NativeInteger, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* No PER visible constraints */ .default_value = 0, .name = "ext1" }, { ATF_NOFLAGS, 0, offsetof(struct PDU_2, choice.ext0), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_NativeInteger, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* No PER visible constraints */ .default_value = 0, .name = "ext0" }, }; static const int asn_MAP_PDU_2_cmap_1[] = { 0, 2, 1 }; static const asn_TYPE_tag2member_t asn_MAP_PDU_2_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 2, 0, 0 }, /* ext0 */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* ext1 */ { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 0, 0, 0 } /* main */ }; static asn_CHOICE_specifics_t asn_SPC_PDU_2_specs_1 = { sizeof(struct PDU_2), offsetof(struct PDU_2, _asn_ctx), offsetof(struct PDU_2, present), sizeof(((struct PDU_2 *)0)->present), asn_MAP_PDU_2_tag2el_1, 3, /* Count of tags in the map */ .canonical_order = asn_MAP_PDU_2_cmap_1, /* Canonically sorted */ .ext_start = 1 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_PDU_2 = { "PDU-2", "PDU-2", CHOICE_free, CHOICE_print, CHOICE_constraint, CHOICE_decode_ber, CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, CHOICE_decode_uper, CHOICE_encode_uper, CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ 0, /* No tags (pointer) */ 0, /* No tags (count) */ &asn_PER_type_PDU_2_constr_1, asn_MBR_PDU_2_1, 3, /* Elements count */ &asn_SPC_PDU_2_specs_1 /* Additional specs */ }; asn1c-0.9.28+dfsg/tests/19-param-OK.asn10000644000000000000000000000125313065714043016024 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .19 ModuleTestParam { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 19 } DEFINITIONS ::= BEGIN SIGNED { ToBeSigned } ::= SEQUENCE { toBeSigned ToBeSigned, algorithm OBJECT IDENTIFIER, signature BIT STRING SIZE(0..256) } Certificate ::= SIGNED { SEQUENCE { version INTEGER, signature OBJECT IDENTIFIER, issuer Name } } Name ::= SEQUENCE OF RelativeDistinguishedName RelativeDistinguishedName ::= SET SIZE (1..MAX) OF IA5String (FROM("A".."Z"|"a".."z"|"0-9"|",-.")) END asn1c-0.9.28+dfsg/tests/58-param-OK.asn1.-EF0000644000000000000000000000054313065714043016376 0ustar rootrootModuleTestParam { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 58 } DEFINITIONS ::= BEGIN DirectoryString{INTEGER:maxSize} ::= CHOICE { teletexString TeletexString (SIZE(1..maxSize)), utf8String UTF8String (SIZE(1..maxSize)) } DS1 ::= DirectoryString{ub-name} ub-name INTEGER ::= 128 END asn1c-0.9.28+dfsg/tests/70-xer-test-OK.asn1.-Pfwide-types0000644000000000000000000016466213065714043021146 0ustar rootroot /*** <<< INCLUDES [PDU] >>> ***/ #include "Sequence.h" #include "Set.h" #include "SequenceOf.h" #include "ExtensibleSet.h" #include "ExtensibleSequence.h" #include "ExtensibleSequence2.h" #include "SetOfNULL.h" #include "SetOfREAL.h" #include "SetOfEnums.h" #include "NamedSetOfNULL.h" #include "NamedSetOfREAL.h" #include "NamedSetOfEnums.h" #include "SeqOfZuka.h" #include "SetOfChoice.h" #include "NamedSetOfChoice.h" #include /*** <<< DEPS [PDU] >>> ***/ typedef enum PDU_PR { PDU_PR_NOTHING, /* No components present */ PDU_PR_sequence, PDU_PR_set, PDU_PR_sequenceOf, PDU_PR_extensibleSet, PDU_PR_extensibleSequence, PDU_PR_extensibleSequence2, PDU_PR_setOfNULL, PDU_PR_setOfREAL, PDU_PR_setOfEnums, PDU_PR_namedSetOfNULL, PDU_PR_namedSetOfREAL, PDU_PR_namedSetOfEnums, PDU_PR_seqOfZuka, PDU_PR_setOfChoice, PDU_PR_namedSetOfChoice, /* Extensions may appear below */ } PDU_PR; /*** <<< TYPE-DECLS [PDU] >>> ***/ typedef struct PDU { PDU_PR present; union PDU_u { Sequence_t sequence; Set_t set; SequenceOf_t sequenceOf; ExtensibleSet_t extensibleSet; ExtensibleSequence_t extensibleSequence; ExtensibleSequence2_t extensibleSequence2; SetOfNULL_t setOfNULL; SetOfREAL_t setOfREAL; SetOfEnums_t setOfEnums; NamedSetOfNULL_t namedSetOfNULL; NamedSetOfREAL_t namedSetOfREAL; NamedSetOfEnums_t namedSetOfEnums; SeqOfZuka_t seqOfZuka; SetOfChoice_t setOfChoice; NamedSetOfChoice_t namedSetOfChoice; /* * This type is extensible, * possible extensions are below. */ } choice; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } PDU_t; /*** <<< FUNC-DECLS [PDU] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_PDU; /*** <<< STAT-DEFS [PDU] >>> ***/ static asn_TYPE_member_t asn_MBR_PDU_1[] = { { ATF_NOFLAGS, 0, offsetof(struct PDU, choice.sequence), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Sequence, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "sequence" }, { ATF_NOFLAGS, 0, offsetof(struct PDU, choice.set), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Set, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "set" }, { ATF_NOFLAGS, 0, offsetof(struct PDU, choice.sequenceOf), .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_SequenceOf, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "sequenceOf" }, { ATF_NOFLAGS, 0, offsetof(struct PDU, choice.extensibleSet), .tag = (ASN_TAG_CLASS_CONTEXT | (3 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_ExtensibleSet, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "extensibleSet" }, { ATF_NOFLAGS, 0, offsetof(struct PDU, choice.extensibleSequence), .tag = (ASN_TAG_CLASS_CONTEXT | (4 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_ExtensibleSequence, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "extensibleSequence" }, { ATF_NOFLAGS, 0, offsetof(struct PDU, choice.extensibleSequence2), .tag = (ASN_TAG_CLASS_CONTEXT | (5 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_ExtensibleSequence2, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "extensibleSequence2" }, { ATF_NOFLAGS, 0, offsetof(struct PDU, choice.setOfNULL), .tag = (ASN_TAG_CLASS_CONTEXT | (6 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_SetOfNULL, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "setOfNULL" }, { ATF_NOFLAGS, 0, offsetof(struct PDU, choice.setOfREAL), .tag = (ASN_TAG_CLASS_CONTEXT | (7 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_SetOfREAL, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "setOfREAL" }, { ATF_NOFLAGS, 0, offsetof(struct PDU, choice.setOfEnums), .tag = (ASN_TAG_CLASS_CONTEXT | (8 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_SetOfEnums, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "setOfEnums" }, { ATF_NOFLAGS, 0, offsetof(struct PDU, choice.namedSetOfNULL), .tag = (ASN_TAG_CLASS_CONTEXT | (9 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_NamedSetOfNULL, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "namedSetOfNULL" }, { ATF_NOFLAGS, 0, offsetof(struct PDU, choice.namedSetOfREAL), .tag = (ASN_TAG_CLASS_CONTEXT | (10 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_NamedSetOfREAL, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "namedSetOfREAL" }, { ATF_NOFLAGS, 0, offsetof(struct PDU, choice.namedSetOfEnums), .tag = (ASN_TAG_CLASS_CONTEXT | (11 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_NamedSetOfEnums, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "namedSetOfEnums" }, { ATF_NOFLAGS, 0, offsetof(struct PDU, choice.seqOfZuka), .tag = (ASN_TAG_CLASS_CONTEXT | (12 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_SeqOfZuka, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "seqOfZuka" }, { ATF_NOFLAGS, 0, offsetof(struct PDU, choice.setOfChoice), .tag = (ASN_TAG_CLASS_CONTEXT | (13 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_SetOfChoice, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "setOfChoice" }, { ATF_NOFLAGS, 0, offsetof(struct PDU, choice.namedSetOfChoice), .tag = (ASN_TAG_CLASS_CONTEXT | (14 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_NamedSetOfChoice, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "namedSetOfChoice" }, }; static const asn_TYPE_tag2member_t asn_MAP_PDU_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* sequence */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* set */ { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* sequenceOf */ { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* extensibleSet */ { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* extensibleSequence */ { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* extensibleSequence2 */ { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* setOfNULL */ { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 }, /* setOfREAL */ { (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 }, /* setOfEnums */ { (ASN_TAG_CLASS_CONTEXT | (9 << 2)), 9, 0, 0 }, /* namedSetOfNULL */ { (ASN_TAG_CLASS_CONTEXT | (10 << 2)), 10, 0, 0 }, /* namedSetOfREAL */ { (ASN_TAG_CLASS_CONTEXT | (11 << 2)), 11, 0, 0 }, /* namedSetOfEnums */ { (ASN_TAG_CLASS_CONTEXT | (12 << 2)), 12, 0, 0 }, /* seqOfZuka */ { (ASN_TAG_CLASS_CONTEXT | (13 << 2)), 13, 0, 0 }, /* setOfChoice */ { (ASN_TAG_CLASS_CONTEXT | (14 << 2)), 14, 0, 0 } /* namedSetOfChoice */ }; static asn_CHOICE_specifics_t asn_SPC_PDU_specs_1 = { sizeof(struct PDU), offsetof(struct PDU, _asn_ctx), offsetof(struct PDU, present), sizeof(((struct PDU *)0)->present), asn_MAP_PDU_tag2el_1, 15, /* Count of tags in the map */ .canonical_order = 0, .ext_start = 15 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_PDU = { "PDU", "PDU", CHOICE_free, CHOICE_print, CHOICE_constraint, CHOICE_decode_ber, CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ 0, /* No tags (pointer) */ 0, /* No tags (count) */ 0, /* No PER visible constraints */ asn_MBR_PDU_1, 15, /* Elements count */ &asn_SPC_PDU_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Sequence] >>> ***/ #include #include #include #include /*** <<< FWD-DECLS [Sequence] >>> ***/ struct Sequence; /*** <<< TYPE-DECLS [Sequence] >>> ***/ typedef struct Sequence { INTEGER_t integer; struct Sequence *sequence /* OPTIONAL */; BIT_STRING_t *bits /* OPTIONAL */; UTF8String_t string; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Sequence_t; /*** <<< FUNC-DECLS [Sequence] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Sequence; /*** <<< POST-INCLUDE [Sequence] >>> ***/ #include "Sequence.h" /*** <<< STAT-DEFS [Sequence] >>> ***/ static asn_TYPE_member_t asn_MBR_Sequence_1[] = { { ATF_NOFLAGS, 0, offsetof(struct Sequence, integer), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_INTEGER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "integer" }, { ATF_POINTER, 2, offsetof(struct Sequence, sequence), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Sequence, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "sequence" }, { ATF_POINTER, 1, offsetof(struct Sequence, bits), .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_BIT_STRING, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "bits" }, { ATF_NOFLAGS, 0, offsetof(struct Sequence, string), .tag = (ASN_TAG_CLASS_CONTEXT | (3 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_UTF8String, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "string" }, }; static const ber_tlv_tag_t asn_DEF_Sequence_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_Sequence_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* integer */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* sequence */ { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* bits */ { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* string */ }; static asn_SEQUENCE_specifics_t asn_SPC_Sequence_specs_1 = { sizeof(struct Sequence), offsetof(struct Sequence, _asn_ctx), asn_MAP_Sequence_tag2el_1, 4, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Sequence = { "Sequence", "Sequence", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Sequence_tags_1, sizeof(asn_DEF_Sequence_tags_1) /sizeof(asn_DEF_Sequence_tags_1[0]), /* 1 */ asn_DEF_Sequence_tags_1, /* Same as above */ sizeof(asn_DEF_Sequence_tags_1) /sizeof(asn_DEF_Sequence_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Sequence_1, 4, /* Elements count */ &asn_SPC_Sequence_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Set] >>> ***/ #include #include #include /*** <<< DEPS [Set] >>> ***/ /* * Method of determining the components presence */ typedef enum Set_PR { Set_PR_roid, /* Member roid is present */ Set_PR_opaque, /* Member opaque is present */ } Set_PR; /*** <<< TYPE-DECLS [Set] >>> ***/ typedef struct Set { RELATIVE_OID_t roid; OCTET_STRING_t *opaque /* OPTIONAL */; /* Presence bitmask: ASN_SET_ISPRESENT(pSet, Set_PR_x) */ unsigned int _presence_map [((2+(8*sizeof(unsigned int))-1)/(8*sizeof(unsigned int)))]; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Set_t; /*** <<< FUNC-DECLS [Set] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Set; /*** <<< STAT-DEFS [Set] >>> ***/ static asn_TYPE_member_t asn_MBR_Set_1[] = { { ATF_NOFLAGS, 0, offsetof(struct Set, roid), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_RELATIVE_OID, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "roid" }, { ATF_POINTER, 1, offsetof(struct Set, opaque), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_OCTET_STRING, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "opaque" }, }; static const ber_tlv_tag_t asn_DEF_Set_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_Set_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* roid */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* opaque */ }; static const uint8_t asn_MAP_Set_mmap_1[(2 + (8 * sizeof(unsigned int)) - 1) / 8] = { (1 << 7) | (0 << 6) }; static asn_SET_specifics_t asn_SPC_Set_specs_1 = { sizeof(struct Set), offsetof(struct Set, _asn_ctx), offsetof(struct Set, _presence_map), asn_MAP_Set_tag2el_1, 2, /* Count of tags in the map */ asn_MAP_Set_tag2el_1, /* Same as above */ 2, /* Count of tags in the CXER map */ 0, /* Whether extensible */ (unsigned int *)asn_MAP_Set_mmap_1 /* Mandatory elements map */ }; asn_TYPE_descriptor_t asn_DEF_Set = { "Set", "Set", SET_free, SET_print, SET_constraint, SET_decode_ber, SET_encode_der, SET_decode_xer, SET_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Set_tags_1, sizeof(asn_DEF_Set_tags_1) /sizeof(asn_DEF_Set_tags_1[0]), /* 1 */ asn_DEF_Set_tags_1, /* Same as above */ sizeof(asn_DEF_Set_tags_1) /sizeof(asn_DEF_Set_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Set_1, 2, /* Elements count */ &asn_SPC_Set_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [ExtensibleSet] >>> ***/ #include #include #include /*** <<< DEPS [ExtensibleSet] >>> ***/ /* * Method of determining the components presence */ typedef enum ExtensibleSet_PR { ExtensibleSet_PR_string, /* Member string is present */ ExtensibleSet_PR_enum, /* Member enum is present */ } ExtensibleSet_PR; typedef enum Enum { enum_b = 0, enum_a = 1 } e_enum; /*** <<< TYPE-DECLS [ExtensibleSet] >>> ***/ typedef struct ExtensibleSet { UTF8String_t *string /* OPTIONAL */; /* * This type is extensible, * possible extensions are below. */ ENUMERATED_t *Enum; /* Presence bitmask: ASN_SET_ISPRESENT(pExtensibleSet, ExtensibleSet_PR_x) */ unsigned int _presence_map [((2+(8*sizeof(unsigned int))-1)/(8*sizeof(unsigned int)))]; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } ExtensibleSet_t; /*** <<< FUNC-DECLS [ExtensibleSet] >>> ***/ /* extern asn_TYPE_descriptor_t asn_DEF_enum_4; // (Use -fall-defs-global to expose) */ extern asn_TYPE_descriptor_t asn_DEF_ExtensibleSet; /*** <<< CODE [ExtensibleSet] >>> ***/ static int enum_4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ENUMERATED.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using ENUMERATED, * so here we adjust the DEF accordingly. */ static void enum_4_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_ENUMERATED.free_struct; td->print_struct = asn_DEF_ENUMERATED.print_struct; td->check_constraints = asn_DEF_ENUMERATED.check_constraints; td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; td->der_encoder = asn_DEF_ENUMERATED.der_encoder; td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; td->elements = asn_DEF_ENUMERATED.elements; td->elements_count = asn_DEF_ENUMERATED.elements_count; /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ } static void enum_4_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { enum_4_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } static int enum_4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { enum_4_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } static asn_dec_rval_t enum_4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { enum_4_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } static asn_enc_rval_t enum_4_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { enum_4_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } static asn_dec_rval_t enum_4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { enum_4_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } static asn_enc_rval_t enum_4_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { enum_4_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [ExtensibleSet] >>> ***/ static const asn_INTEGER_enum_map_t asn_MAP_enum_value2enum_4[] = { { 0, 1, "b" }, { 1, 1, "a" } }; static const unsigned int asn_MAP_enum_enum2value_4[] = { 1, /* a(1) */ 0 /* b(0) */ }; static const asn_INTEGER_specifics_t asn_SPC_enum_specs_4 = { asn_MAP_enum_value2enum_4, /* "tag" => N; sorted by tag */ asn_MAP_enum_enum2value_4, /* N => "tag"; sorted by N */ 2, /* Number of elements in the maps */ 0, /* Enumeration is not extensible */ 1, /* Strict enumeration */ 0, /* Native long size */ 0 }; static const ber_tlv_tag_t asn_DEF_enum_tags_4[] = { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_enum_4 = { "enum", "enum", enum_4_free, enum_4_print, enum_4_constraint, enum_4_decode_ber, enum_4_encode_der, enum_4_decode_xer, enum_4_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_enum_tags_4, sizeof(asn_DEF_enum_tags_4) /sizeof(asn_DEF_enum_tags_4[0]) - 1, /* 1 */ asn_DEF_enum_tags_4, /* Same as above */ sizeof(asn_DEF_enum_tags_4) /sizeof(asn_DEF_enum_tags_4[0]), /* 2 */ 0, /* No PER visible constraints */ 0, 0, /* Defined elsewhere */ &asn_SPC_enum_specs_4 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_ExtensibleSet_1[] = { { ATF_POINTER, 2, offsetof(struct ExtensibleSet, string), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_UTF8String, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "string" }, { ATF_POINTER, 1, offsetof(struct ExtensibleSet, Enum), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_enum_4, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "enum" }, }; static const ber_tlv_tag_t asn_DEF_ExtensibleSet_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_ExtensibleSet_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* string */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* enum */ }; static const uint8_t asn_MAP_ExtensibleSet_mmap_1[(2 + (8 * sizeof(unsigned int)) - 1) / 8] = { (0 << 7) | (0 << 6) }; static asn_SET_specifics_t asn_SPC_ExtensibleSet_specs_1 = { sizeof(struct ExtensibleSet), offsetof(struct ExtensibleSet, _asn_ctx), offsetof(struct ExtensibleSet, _presence_map), asn_MAP_ExtensibleSet_tag2el_1, 2, /* Count of tags in the map */ asn_MAP_ExtensibleSet_tag2el_1, /* Same as above */ 2, /* Count of tags in the CXER map */ 1, /* Whether extensible */ (unsigned int *)asn_MAP_ExtensibleSet_mmap_1 /* Mandatory elements map */ }; asn_TYPE_descriptor_t asn_DEF_ExtensibleSet = { "ExtensibleSet", "ExtensibleSet", SET_free, SET_print, SET_constraint, SET_decode_ber, SET_encode_der, SET_decode_xer, SET_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_ExtensibleSet_tags_1, sizeof(asn_DEF_ExtensibleSet_tags_1) /sizeof(asn_DEF_ExtensibleSet_tags_1[0]), /* 1 */ asn_DEF_ExtensibleSet_tags_1, /* Same as above */ sizeof(asn_DEF_ExtensibleSet_tags_1) /sizeof(asn_DEF_ExtensibleSet_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_ExtensibleSet_1, 2, /* Elements count */ &asn_SPC_ExtensibleSet_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [ExtensibleSequence] >>> ***/ #include #include #include #include /*** <<< TYPE-DECLS [ExtensibleSequence] >>> ***/ typedef struct ExtensibleSequence { UTF8String_t *string /* OPTIONAL */; /* * This type is extensible, * possible extensions are below. */ INTEGER_t *integer /* OPTIONAL */; GeneralizedTime_t *gtime; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } ExtensibleSequence_t; /*** <<< FUNC-DECLS [ExtensibleSequence] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_ExtensibleSequence; /*** <<< STAT-DEFS [ExtensibleSequence] >>> ***/ static asn_TYPE_member_t asn_MBR_ExtensibleSequence_1[] = { { ATF_POINTER, 3, offsetof(struct ExtensibleSequence, string), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_UTF8String, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "string" }, { ATF_POINTER, 2, offsetof(struct ExtensibleSequence, integer), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_INTEGER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "integer" }, { ATF_POINTER, 1, offsetof(struct ExtensibleSequence, gtime), .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_GeneralizedTime, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "gtime" }, }; static const ber_tlv_tag_t asn_DEF_ExtensibleSequence_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_ExtensibleSequence_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* string */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* integer */ { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* gtime */ }; static asn_SEQUENCE_specifics_t asn_SPC_ExtensibleSequence_specs_1 = { sizeof(struct ExtensibleSequence), offsetof(struct ExtensibleSequence, _asn_ctx), asn_MAP_ExtensibleSequence_tag2el_1, 3, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ 0, /* Start extensions */ 4 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_ExtensibleSequence = { "ExtensibleSequence", "ExtensibleSequence", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_ExtensibleSequence_tags_1, sizeof(asn_DEF_ExtensibleSequence_tags_1) /sizeof(asn_DEF_ExtensibleSequence_tags_1[0]), /* 1 */ asn_DEF_ExtensibleSequence_tags_1, /* Same as above */ sizeof(asn_DEF_ExtensibleSequence_tags_1) /sizeof(asn_DEF_ExtensibleSequence_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_ExtensibleSequence_1, 3, /* Elements count */ &asn_SPC_ExtensibleSequence_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [ExtensibleSequence2] >>> ***/ #include #include #include /*** <<< TYPE-DECLS [ExtensibleSequence2] >>> ***/ typedef struct ExtensibleSequence2 { UTF8String_t *string /* OPTIONAL */; /* * This type is extensible, * possible extensions are below. */ INTEGER_t *integer /* OPTIONAL */; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } ExtensibleSequence2_t; /*** <<< FUNC-DECLS [ExtensibleSequence2] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_ExtensibleSequence2; /*** <<< STAT-DEFS [ExtensibleSequence2] >>> ***/ static asn_TYPE_member_t asn_MBR_ExtensibleSequence2_1[] = { { ATF_POINTER, 2, offsetof(struct ExtensibleSequence2, string), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_UTF8String, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "string" }, { ATF_POINTER, 1, offsetof(struct ExtensibleSequence2, integer), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_INTEGER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "integer" }, }; static const ber_tlv_tag_t asn_DEF_ExtensibleSequence2_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_ExtensibleSequence2_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* string */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* integer */ }; static asn_SEQUENCE_specifics_t asn_SPC_ExtensibleSequence2_specs_1 = { sizeof(struct ExtensibleSequence2), offsetof(struct ExtensibleSequence2, _asn_ctx), asn_MAP_ExtensibleSequence2_tag2el_1, 2, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ 0, /* Start extensions */ 3 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_ExtensibleSequence2 = { "ExtensibleSequence2", "ExtensibleSequence2", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_ExtensibleSequence2_tags_1, sizeof(asn_DEF_ExtensibleSequence2_tags_1) /sizeof(asn_DEF_ExtensibleSequence2_tags_1[0]), /* 1 */ asn_DEF_ExtensibleSequence2_tags_1, /* Same as above */ sizeof(asn_DEF_ExtensibleSequence2_tags_1) /sizeof(asn_DEF_ExtensibleSequence2_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_ExtensibleSequence2_1, 2, /* Elements count */ &asn_SPC_ExtensibleSequence2_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [SetOfNULL] >>> ***/ #include #include #include /*** <<< TYPE-DECLS [SetOfNULL] >>> ***/ typedef struct SetOfNULL { A_SET_OF(NULL_t) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } SetOfNULL_t; /*** <<< FUNC-DECLS [SetOfNULL] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_SetOfNULL; /*** <<< STAT-DEFS [SetOfNULL] >>> ***/ static asn_TYPE_member_t asn_MBR_SetOfNULL_1[] = { { ATF_POINTER, 0, 0, .tag = (ASN_TAG_CLASS_UNIVERSAL | (5 << 2)), .tag_mode = 0, .type = &asn_DEF_NULL, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "" }, }; static const ber_tlv_tag_t asn_DEF_SetOfNULL_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_SetOfNULL_specs_1 = { sizeof(struct SetOfNULL), offsetof(struct SetOfNULL, _asn_ctx), 1, /* XER encoding is XMLValueList */ }; asn_TYPE_descriptor_t asn_DEF_SetOfNULL = { "SetOfNULL", "SetOfNULL", SET_OF_free, SET_OF_print, SET_OF_constraint, SET_OF_decode_ber, SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_SetOfNULL_tags_1, sizeof(asn_DEF_SetOfNULL_tags_1) /sizeof(asn_DEF_SetOfNULL_tags_1[0]), /* 1 */ asn_DEF_SetOfNULL_tags_1, /* Same as above */ sizeof(asn_DEF_SetOfNULL_tags_1) /sizeof(asn_DEF_SetOfNULL_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_SetOfNULL_1, 1, /* Single element */ &asn_SPC_SetOfNULL_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [SetOfREAL] >>> ***/ #include #include #include /*** <<< TYPE-DECLS [SetOfREAL] >>> ***/ typedef struct SetOfREAL { A_SET_OF(REAL_t) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } SetOfREAL_t; /*** <<< FUNC-DECLS [SetOfREAL] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_SetOfREAL; /*** <<< STAT-DEFS [SetOfREAL] >>> ***/ static asn_TYPE_member_t asn_MBR_SetOfREAL_1[] = { { ATF_POINTER, 0, 0, .tag = (ASN_TAG_CLASS_UNIVERSAL | (9 << 2)), .tag_mode = 0, .type = &asn_DEF_REAL, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "" }, }; static const ber_tlv_tag_t asn_DEF_SetOfREAL_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_SetOfREAL_specs_1 = { sizeof(struct SetOfREAL), offsetof(struct SetOfREAL, _asn_ctx), 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_SetOfREAL = { "SetOfREAL", "SetOfREAL", SET_OF_free, SET_OF_print, SET_OF_constraint, SET_OF_decode_ber, SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_SetOfREAL_tags_1, sizeof(asn_DEF_SetOfREAL_tags_1) /sizeof(asn_DEF_SetOfREAL_tags_1[0]), /* 1 */ asn_DEF_SetOfREAL_tags_1, /* Same as above */ sizeof(asn_DEF_SetOfREAL_tags_1) /sizeof(asn_DEF_SetOfREAL_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_SetOfREAL_1, 1, /* Single element */ &asn_SPC_SetOfREAL_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [SetOfEnums] >>> ***/ #include #include #include /*** <<< DEPS [SetOfEnums] >>> ***/ typedef enum Member { Member_one = 0, Member_oneMore = 1 } e_Member; /*** <<< TYPE-DECLS [SetOfEnums] >>> ***/ typedef struct SetOfEnums { A_SET_OF(ENUMERATED_t) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } SetOfEnums_t; /*** <<< FUNC-DECLS [SetOfEnums] >>> ***/ /* extern asn_TYPE_descriptor_t asn_DEF_Member_2; // (Use -fall-defs-global to expose) */ extern asn_TYPE_descriptor_t asn_DEF_SetOfEnums; /*** <<< CODE [SetOfEnums] >>> ***/ static int Member_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ENUMERATED.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using ENUMERATED, * so here we adjust the DEF accordingly. */ static void Member_2_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_ENUMERATED.free_struct; td->print_struct = asn_DEF_ENUMERATED.print_struct; td->check_constraints = asn_DEF_ENUMERATED.check_constraints; td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; td->der_encoder = asn_DEF_ENUMERATED.der_encoder; td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; td->elements = asn_DEF_ENUMERATED.elements; td->elements_count = asn_DEF_ENUMERATED.elements_count; /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ } static void Member_2_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Member_2_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } static int Member_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Member_2_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } static asn_dec_rval_t Member_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Member_2_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } static asn_enc_rval_t Member_2_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Member_2_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } static asn_dec_rval_t Member_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Member_2_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } static asn_enc_rval_t Member_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Member_2_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [SetOfEnums] >>> ***/ static const asn_INTEGER_enum_map_t asn_MAP_Member_value2enum_2[] = { { 0, 3, "one" }, { 1, 7, "oneMore" } }; static const unsigned int asn_MAP_Member_enum2value_2[] = { 0, /* one(0) */ 1 /* oneMore(1) */ }; static const asn_INTEGER_specifics_t asn_SPC_Member_specs_2 = { asn_MAP_Member_value2enum_2, /* "tag" => N; sorted by tag */ asn_MAP_Member_enum2value_2, /* N => "tag"; sorted by N */ 2, /* Number of elements in the maps */ 0, /* Enumeration is not extensible */ 1, /* Strict enumeration */ 0, /* Native long size */ 0 }; static const ber_tlv_tag_t asn_DEF_Member_tags_2[] = { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_Member_2 = { "ENUMERATED", "ENUMERATED", Member_2_free, Member_2_print, Member_2_constraint, Member_2_decode_ber, Member_2_encode_der, Member_2_decode_xer, Member_2_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Member_tags_2, sizeof(asn_DEF_Member_tags_2) /sizeof(asn_DEF_Member_tags_2[0]), /* 1 */ asn_DEF_Member_tags_2, /* Same as above */ sizeof(asn_DEF_Member_tags_2) /sizeof(asn_DEF_Member_tags_2[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* Defined elsewhere */ &asn_SPC_Member_specs_2 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_SetOfEnums_1[] = { { ATF_POINTER, 0, 0, .tag = (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), .tag_mode = 0, .type = &asn_DEF_Member_2, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "" }, }; static const ber_tlv_tag_t asn_DEF_SetOfEnums_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_SetOfEnums_specs_1 = { sizeof(struct SetOfEnums), offsetof(struct SetOfEnums, _asn_ctx), 1, /* XER encoding is XMLValueList */ }; asn_TYPE_descriptor_t asn_DEF_SetOfEnums = { "SetOfEnums", "SetOfEnums", SET_OF_free, SET_OF_print, SET_OF_constraint, SET_OF_decode_ber, SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_SetOfEnums_tags_1, sizeof(asn_DEF_SetOfEnums_tags_1) /sizeof(asn_DEF_SetOfEnums_tags_1[0]), /* 1 */ asn_DEF_SetOfEnums_tags_1, /* Same as above */ sizeof(asn_DEF_SetOfEnums_tags_1) /sizeof(asn_DEF_SetOfEnums_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_SetOfEnums_1, 1, /* Single element */ &asn_SPC_SetOfEnums_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [NamedSetOfNULL] >>> ***/ #include #include #include /*** <<< TYPE-DECLS [NamedSetOfNULL] >>> ***/ typedef struct NamedSetOfNULL { A_SET_OF(NULL_t) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } NamedSetOfNULL_t; /*** <<< FUNC-DECLS [NamedSetOfNULL] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_NamedSetOfNULL; /*** <<< STAT-DEFS [NamedSetOfNULL] >>> ***/ static asn_TYPE_member_t asn_MBR_NamedSetOfNULL_1[] = { { ATF_POINTER, 0, 0, .tag = (ASN_TAG_CLASS_UNIVERSAL | (5 << 2)), .tag_mode = 0, .type = &asn_DEF_NULL, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "y" }, }; static const ber_tlv_tag_t asn_DEF_NamedSetOfNULL_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_NamedSetOfNULL_specs_1 = { sizeof(struct NamedSetOfNULL), offsetof(struct NamedSetOfNULL, _asn_ctx), 1, /* XER encoding is XMLValueList */ }; asn_TYPE_descriptor_t asn_DEF_NamedSetOfNULL = { "NamedSetOfNULL", "NamedSetOfNULL", SET_OF_free, SET_OF_print, SET_OF_constraint, SET_OF_decode_ber, SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NamedSetOfNULL_tags_1, sizeof(asn_DEF_NamedSetOfNULL_tags_1) /sizeof(asn_DEF_NamedSetOfNULL_tags_1[0]), /* 1 */ asn_DEF_NamedSetOfNULL_tags_1, /* Same as above */ sizeof(asn_DEF_NamedSetOfNULL_tags_1) /sizeof(asn_DEF_NamedSetOfNULL_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_NamedSetOfNULL_1, 1, /* Single element */ &asn_SPC_NamedSetOfNULL_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [NamedSetOfREAL] >>> ***/ #include #include #include /*** <<< TYPE-DECLS [NamedSetOfREAL] >>> ***/ typedef struct NamedSetOfREAL { A_SET_OF(REAL_t) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } NamedSetOfREAL_t; /*** <<< FUNC-DECLS [NamedSetOfREAL] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_NamedSetOfREAL; /*** <<< STAT-DEFS [NamedSetOfREAL] >>> ***/ static asn_TYPE_member_t asn_MBR_NamedSetOfREAL_1[] = { { ATF_POINTER, 0, 0, .tag = (ASN_TAG_CLASS_UNIVERSAL | (9 << 2)), .tag_mode = 0, .type = &asn_DEF_REAL, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "name" }, }; static const ber_tlv_tag_t asn_DEF_NamedSetOfREAL_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_NamedSetOfREAL_specs_1 = { sizeof(struct NamedSetOfREAL), offsetof(struct NamedSetOfREAL, _asn_ctx), 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_NamedSetOfREAL = { "NamedSetOfREAL", "NamedSetOfREAL", SET_OF_free, SET_OF_print, SET_OF_constraint, SET_OF_decode_ber, SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NamedSetOfREAL_tags_1, sizeof(asn_DEF_NamedSetOfREAL_tags_1) /sizeof(asn_DEF_NamedSetOfREAL_tags_1[0]), /* 1 */ asn_DEF_NamedSetOfREAL_tags_1, /* Same as above */ sizeof(asn_DEF_NamedSetOfREAL_tags_1) /sizeof(asn_DEF_NamedSetOfREAL_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_NamedSetOfREAL_1, 1, /* Single element */ &asn_SPC_NamedSetOfREAL_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [NamedSetOfEnums] >>> ***/ #include #include #include /*** <<< DEPS [NamedSetOfEnums] >>> ***/ typedef enum name { name_one = 0, name_oneMore = 1 } e_name; /*** <<< TYPE-DECLS [NamedSetOfEnums] >>> ***/ typedef struct NamedSetOfEnums { A_SET_OF(ENUMERATED_t) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } NamedSetOfEnums_t; /*** <<< FUNC-DECLS [NamedSetOfEnums] >>> ***/ /* extern asn_TYPE_descriptor_t asn_DEF_name_2; // (Use -fall-defs-global to expose) */ extern asn_TYPE_descriptor_t asn_DEF_NamedSetOfEnums; /*** <<< CODE [NamedSetOfEnums] >>> ***/ static int name_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ENUMERATED.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using ENUMERATED, * so here we adjust the DEF accordingly. */ static void name_2_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_ENUMERATED.free_struct; td->print_struct = asn_DEF_ENUMERATED.print_struct; td->check_constraints = asn_DEF_ENUMERATED.check_constraints; td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; td->der_encoder = asn_DEF_ENUMERATED.der_encoder; td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; td->elements = asn_DEF_ENUMERATED.elements; td->elements_count = asn_DEF_ENUMERATED.elements_count; /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ } static void name_2_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { name_2_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } static int name_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { name_2_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } static asn_dec_rval_t name_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { name_2_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } static asn_enc_rval_t name_2_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { name_2_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } static asn_dec_rval_t name_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { name_2_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } static asn_enc_rval_t name_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { name_2_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [NamedSetOfEnums] >>> ***/ static const asn_INTEGER_enum_map_t asn_MAP_name_value2enum_2[] = { { 0, 3, "one" }, { 1, 7, "oneMore" } }; static const unsigned int asn_MAP_name_enum2value_2[] = { 0, /* one(0) */ 1 /* oneMore(1) */ }; static const asn_INTEGER_specifics_t asn_SPC_name_specs_2 = { asn_MAP_name_value2enum_2, /* "tag" => N; sorted by tag */ asn_MAP_name_enum2value_2, /* N => "tag"; sorted by N */ 2, /* Number of elements in the maps */ 0, /* Enumeration is not extensible */ 1, /* Strict enumeration */ 0, /* Native long size */ 0 }; static const ber_tlv_tag_t asn_DEF_name_tags_2[] = { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_name_2 = { "ENUMERATED", "ENUMERATED", name_2_free, name_2_print, name_2_constraint, name_2_decode_ber, name_2_encode_der, name_2_decode_xer, name_2_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_name_tags_2, sizeof(asn_DEF_name_tags_2) /sizeof(asn_DEF_name_tags_2[0]), /* 1 */ asn_DEF_name_tags_2, /* Same as above */ sizeof(asn_DEF_name_tags_2) /sizeof(asn_DEF_name_tags_2[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* Defined elsewhere */ &asn_SPC_name_specs_2 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_NamedSetOfEnums_1[] = { { ATF_POINTER, 0, 0, .tag = (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), .tag_mode = 0, .type = &asn_DEF_name_2, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "name" }, }; static const ber_tlv_tag_t asn_DEF_NamedSetOfEnums_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_NamedSetOfEnums_specs_1 = { sizeof(struct NamedSetOfEnums), offsetof(struct NamedSetOfEnums, _asn_ctx), 1, /* XER encoding is XMLValueList */ }; asn_TYPE_descriptor_t asn_DEF_NamedSetOfEnums = { "NamedSetOfEnums", "NamedSetOfEnums", SET_OF_free, SET_OF_print, SET_OF_constraint, SET_OF_decode_ber, SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NamedSetOfEnums_tags_1, sizeof(asn_DEF_NamedSetOfEnums_tags_1) /sizeof(asn_DEF_NamedSetOfEnums_tags_1[0]), /* 1 */ asn_DEF_NamedSetOfEnums_tags_1, /* Same as above */ sizeof(asn_DEF_NamedSetOfEnums_tags_1) /sizeof(asn_DEF_NamedSetOfEnums_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_NamedSetOfEnums_1, 1, /* Single element */ &asn_SPC_NamedSetOfEnums_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [SequenceOf] >>> ***/ #include #include #include /*** <<< TYPE-DECLS [SequenceOf] >>> ***/ typedef struct SequenceOf { A_SEQUENCE_OF(INTEGER_t) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } SequenceOf_t; /*** <<< FUNC-DECLS [SequenceOf] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_SequenceOf; /*** <<< STAT-DEFS [SequenceOf] >>> ***/ static asn_TYPE_member_t asn_MBR_SequenceOf_1[] = { { ATF_POINTER, 0, 0, .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), .tag_mode = 0, .type = &asn_DEF_INTEGER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "id" }, }; static const ber_tlv_tag_t asn_DEF_SequenceOf_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_SequenceOf_specs_1 = { sizeof(struct SequenceOf), offsetof(struct SequenceOf, _asn_ctx), 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_SequenceOf = { "SequenceOf", "SequenceOf", SEQUENCE_OF_free, SEQUENCE_OF_print, SEQUENCE_OF_constraint, SEQUENCE_OF_decode_ber, SEQUENCE_OF_encode_der, SEQUENCE_OF_decode_xer, SEQUENCE_OF_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_SequenceOf_tags_1, sizeof(asn_DEF_SequenceOf_tags_1) /sizeof(asn_DEF_SequenceOf_tags_1[0]), /* 1 */ asn_DEF_SequenceOf_tags_1, /* Same as above */ sizeof(asn_DEF_SequenceOf_tags_1) /sizeof(asn_DEF_SequenceOf_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_SequenceOf_1, 1, /* Single element */ &asn_SPC_SequenceOf_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [SeqOfZuka] >>> ***/ #include #include #include /*** <<< TYPE-DECLS [SeqOfZuka] >>> ***/ typedef struct SeqOfZuka { A_SEQUENCE_OF(NULL_t) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } SeqOfZuka_t; /*** <<< FUNC-DECLS [SeqOfZuka] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_SeqOfZuka; /*** <<< STAT-DEFS [SeqOfZuka] >>> ***/ static asn_TYPE_member_t asn_MBR_SeqOfZuka_1[] = { { ATF_POINTER, 0, 0, .tag = (ASN_TAG_CLASS_UNIVERSAL | (5 << 2)), .tag_mode = 0, .type = &asn_DEF_NULL, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "zuka" }, }; static const ber_tlv_tag_t asn_DEF_SeqOfZuka_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_SeqOfZuka_specs_1 = { sizeof(struct SeqOfZuka), offsetof(struct SeqOfZuka, _asn_ctx), 1, /* XER encoding is XMLValueList */ }; asn_TYPE_descriptor_t asn_DEF_SeqOfZuka = { "SeqOfZuka", "SeqOfZuka", SEQUENCE_OF_free, SEQUENCE_OF_print, SEQUENCE_OF_constraint, SEQUENCE_OF_decode_ber, SEQUENCE_OF_encode_der, SEQUENCE_OF_decode_xer, SEQUENCE_OF_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_SeqOfZuka_tags_1, sizeof(asn_DEF_SeqOfZuka_tags_1) /sizeof(asn_DEF_SeqOfZuka_tags_1[0]), /* 1 */ asn_DEF_SeqOfZuka_tags_1, /* Same as above */ sizeof(asn_DEF_SeqOfZuka_tags_1) /sizeof(asn_DEF_SeqOfZuka_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_SeqOfZuka_1, 1, /* Single element */ &asn_SPC_SeqOfZuka_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [SetOfChoice] >>> ***/ #include #include /*** <<< FWD-DECLS [SetOfChoice] >>> ***/ struct SimpleChoice; /*** <<< TYPE-DECLS [SetOfChoice] >>> ***/ typedef struct SetOfChoice { A_SET_OF(struct SimpleChoice) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } SetOfChoice_t; /*** <<< FUNC-DECLS [SetOfChoice] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_SetOfChoice; /*** <<< POST-INCLUDE [SetOfChoice] >>> ***/ #include "SimpleChoice.h" /*** <<< STAT-DEFS [SetOfChoice] >>> ***/ static asn_TYPE_member_t asn_MBR_SetOfChoice_1[] = { { ATF_POINTER, 0, 0, .tag = -1 /* Ambiguous tag (CHOICE?) */, .tag_mode = 0, .type = &asn_DEF_SimpleChoice, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "" }, }; static const ber_tlv_tag_t asn_DEF_SetOfChoice_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_SetOfChoice_specs_1 = { sizeof(struct SetOfChoice), offsetof(struct SetOfChoice, _asn_ctx), 2, /* XER encoding is XMLValueList */ }; asn_TYPE_descriptor_t asn_DEF_SetOfChoice = { "SetOfChoice", "SetOfChoice", SET_OF_free, SET_OF_print, SET_OF_constraint, SET_OF_decode_ber, SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_SetOfChoice_tags_1, sizeof(asn_DEF_SetOfChoice_tags_1) /sizeof(asn_DEF_SetOfChoice_tags_1[0]), /* 1 */ asn_DEF_SetOfChoice_tags_1, /* Same as above */ sizeof(asn_DEF_SetOfChoice_tags_1) /sizeof(asn_DEF_SetOfChoice_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_SetOfChoice_1, 1, /* Single element */ &asn_SPC_SetOfChoice_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [NamedSetOfChoice] >>> ***/ #include #include /*** <<< FWD-DECLS [NamedSetOfChoice] >>> ***/ struct SimpleChoice; /*** <<< TYPE-DECLS [NamedSetOfChoice] >>> ***/ typedef struct NamedSetOfChoice { A_SET_OF(struct SimpleChoice) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } NamedSetOfChoice_t; /*** <<< FUNC-DECLS [NamedSetOfChoice] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_NamedSetOfChoice; /*** <<< POST-INCLUDE [NamedSetOfChoice] >>> ***/ #include "SimpleChoice.h" /*** <<< STAT-DEFS [NamedSetOfChoice] >>> ***/ static asn_TYPE_member_t asn_MBR_NamedSetOfChoice_1[] = { { ATF_POINTER, 0, 0, .tag = -1 /* Ambiguous tag (CHOICE?) */, .tag_mode = 0, .type = &asn_DEF_SimpleChoice, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "whatever" }, }; static const ber_tlv_tag_t asn_DEF_NamedSetOfChoice_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_NamedSetOfChoice_specs_1 = { sizeof(struct NamedSetOfChoice), offsetof(struct NamedSetOfChoice, _asn_ctx), 2, /* XER encoding is XMLValueList */ }; asn_TYPE_descriptor_t asn_DEF_NamedSetOfChoice = { "NamedSetOfChoice", "NamedSetOfChoice", SET_OF_free, SET_OF_print, SET_OF_constraint, SET_OF_decode_ber, SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NamedSetOfChoice_tags_1, sizeof(asn_DEF_NamedSetOfChoice_tags_1) /sizeof(asn_DEF_NamedSetOfChoice_tags_1[0]), /* 1 */ asn_DEF_NamedSetOfChoice_tags_1, /* Same as above */ sizeof(asn_DEF_NamedSetOfChoice_tags_1) /sizeof(asn_DEF_NamedSetOfChoice_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_NamedSetOfChoice_1, 1, /* Single element */ &asn_SPC_NamedSetOfChoice_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [SimpleChoice] >>> ***/ #include #include #include /*** <<< DEPS [SimpleChoice] >>> ***/ typedef enum SimpleChoice_PR { SimpleChoice_PR_NOTHING, /* No components present */ SimpleChoice_PR_a, SimpleChoice_PR_b } SimpleChoice_PR; /*** <<< TYPE-DECLS [SimpleChoice] >>> ***/ typedef struct SimpleChoice { SimpleChoice_PR present; union SimpleChoice_u { NULL_t a; INTEGER_t b; } choice; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } SimpleChoice_t; /*** <<< FUNC-DECLS [SimpleChoice] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_SimpleChoice; /*** <<< STAT-DEFS [SimpleChoice] >>> ***/ static asn_TYPE_member_t asn_MBR_SimpleChoice_1[] = { { ATF_NOFLAGS, 0, offsetof(struct SimpleChoice, choice.a), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_NULL, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "a" }, { ATF_NOFLAGS, 0, offsetof(struct SimpleChoice, choice.b), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_INTEGER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "b" }, }; static const asn_TYPE_tag2member_t asn_MAP_SimpleChoice_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* a */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* b */ }; static asn_CHOICE_specifics_t asn_SPC_SimpleChoice_specs_1 = { sizeof(struct SimpleChoice), offsetof(struct SimpleChoice, _asn_ctx), offsetof(struct SimpleChoice, present), sizeof(((struct SimpleChoice *)0)->present), asn_MAP_SimpleChoice_tag2el_1, 2, /* Count of tags in the map */ .canonical_order = 0, .ext_start = -1 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_SimpleChoice = { "SimpleChoice", "SimpleChoice", CHOICE_free, CHOICE_print, CHOICE_constraint, CHOICE_decode_ber, CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ 0, /* No tags (pointer) */ 0, /* No tags (count) */ 0, /* No PER visible constraints */ asn_MBR_SimpleChoice_1, 2, /* Elements count */ &asn_SPC_SimpleChoice_specs_1 /* Additional specs */ }; asn1c-0.9.28+dfsg/tests/95-choice-per-order-OK.asn1.-Pfwide-types0000644000000000000000000001761513065714043022524 0ustar rootroot /*** <<< INCLUDES [Choice] >>> ***/ #include #include #include #include #include #include /*** <<< DEPS [Choice] >>> ***/ typedef enum Choice_PR { Choice_PR_NOTHING, /* No components present */ Choice_PR_roid, Choice_PR_bitstr, Choice_PR_ch, /* Extensions may appear below */ Choice_PR_bool } Choice_PR; typedef enum ch_PR { ch_PR_NOTHING, /* No components present */ ch_PR_null, ch_PR_int } ch_PR; /*** <<< TYPE-DECLS [Choice] >>> ***/ typedef struct Choice { Choice_PR present; union Choice_u { RELATIVE_OID_t roid; BIT_STRING_t bitstr; struct ch { ch_PR present; union Choice__ch_u { NULL_t null; INTEGER_t Int; } choice; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } ch; /* * This type is extensible, * possible extensions are below. */ BOOLEAN_t Bool; } choice; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Choice_t; /*** <<< FUNC-DECLS [Choice] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Choice; /*** <<< STAT-DEFS [Choice] >>> ***/ static asn_TYPE_member_t asn_MBR_ch_4[] = { { ATF_NOFLAGS, 0, offsetof(struct ch, choice.null), .tag = (ASN_TAG_CLASS_UNIVERSAL | (5 << 2)), .tag_mode = 0, .type = &asn_DEF_NULL, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "null" }, { ATF_NOFLAGS, 0, offsetof(struct ch, choice.Int), .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), .tag_mode = 0, .type = &asn_DEF_INTEGER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "int" }, }; static const asn_TYPE_tag2member_t asn_MAP_ch_tag2el_4[] = { { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* int */ { (ASN_TAG_CLASS_UNIVERSAL | (5 << 2)), 0, 0, 0 } /* null */ }; static asn_CHOICE_specifics_t asn_SPC_ch_specs_4 = { sizeof(struct ch), offsetof(struct ch, _asn_ctx), offsetof(struct ch, present), sizeof(((struct ch *)0)->present), asn_MAP_ch_tag2el_4, 2, /* Count of tags in the map */ .canonical_order = 0, .ext_start = -1 /* Extensions start */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_ch_4 = { "ch", "ch", CHOICE_free, CHOICE_print, CHOICE_constraint, CHOICE_decode_ber, CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ 0, /* No tags (pointer) */ 0, /* No tags (count) */ 0, /* No PER visible constraints */ asn_MBR_ch_4, 2, /* Elements count */ &asn_SPC_ch_specs_4 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_Choice_1[] = { { ATF_NOFLAGS, 0, offsetof(struct Choice, choice.roid), .tag = (ASN_TAG_CLASS_UNIVERSAL | (13 << 2)), .tag_mode = 0, .type = &asn_DEF_RELATIVE_OID, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "roid" }, { ATF_NOFLAGS, 0, offsetof(struct Choice, choice.bitstr), .tag = (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), .tag_mode = 0, .type = &asn_DEF_BIT_STRING, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "bitstr" }, { ATF_NOFLAGS, 0, offsetof(struct Choice, choice.ch), .tag = -1 /* Ambiguous tag (CHOICE?) */, .tag_mode = 0, .type = &asn_DEF_ch_4, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "ch" }, { ATF_NOFLAGS, 0, offsetof(struct Choice, choice.Bool), .tag = (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)), .tag_mode = 0, .type = &asn_DEF_BOOLEAN, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "bool" }, }; static const asn_TYPE_tag2member_t asn_MAP_Choice_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)), 3, 0, 0 }, /* bool */ { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 2, 0, 0 }, /* int */ { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 1, 0, 0 }, /* bitstr */ { (ASN_TAG_CLASS_UNIVERSAL | (5 << 2)), 2, 0, 0 }, /* null */ { (ASN_TAG_CLASS_UNIVERSAL | (13 << 2)), 0, 0, 0 } /* roid */ }; static asn_CHOICE_specifics_t asn_SPC_Choice_specs_1 = { sizeof(struct Choice), offsetof(struct Choice, _asn_ctx), offsetof(struct Choice, present), sizeof(((struct Choice *)0)->present), asn_MAP_Choice_tag2el_1, 5, /* Count of tags in the map */ .canonical_order = 0, .ext_start = 3 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_Choice = { "Choice", "Choice", CHOICE_free, CHOICE_print, CHOICE_constraint, CHOICE_decode_ber, CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ 0, /* No tags (pointer) */ 0, /* No tags (count) */ 0, /* No PER visible constraints */ asn_MBR_Choice_1, 4, /* Elements count */ &asn_SPC_Choice_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Choice2] >>> ***/ #include #include #include /*** <<< DEPS [Choice2] >>> ***/ typedef enum Choice2_PR { Choice2_PR_NOTHING, /* No components present */ Choice2_PR_bitstr, Choice2_PR_roid } Choice2_PR; /*** <<< TYPE-DECLS [Choice2] >>> ***/ typedef struct Choice2 { Choice2_PR present; union Choice2_u { BIT_STRING_t bitstr; RELATIVE_OID_t roid; } choice; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Choice2_t; /*** <<< FUNC-DECLS [Choice2] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Choice2; /*** <<< STAT-DEFS [Choice2] >>> ***/ static asn_TYPE_member_t asn_MBR_Choice2_1[] = { { ATF_NOFLAGS, 0, offsetof(struct Choice2, choice.bitstr), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = +1, /* EXPLICIT tag at current level */ .type = &asn_DEF_BIT_STRING, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "bitstr" }, { ATF_NOFLAGS, 0, offsetof(struct Choice2, choice.roid), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = +1, /* EXPLICIT tag at current level */ .type = &asn_DEF_RELATIVE_OID, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "roid" }, }; static const asn_TYPE_tag2member_t asn_MAP_Choice2_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* bitstr */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* roid */ }; static asn_CHOICE_specifics_t asn_SPC_Choice2_specs_1 = { sizeof(struct Choice2), offsetof(struct Choice2, _asn_ctx), offsetof(struct Choice2, present), sizeof(((struct Choice2 *)0)->present), asn_MAP_Choice2_tag2el_1, 2, /* Count of tags in the map */ .canonical_order = 0, .ext_start = -1 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_Choice2 = { "Choice2", "Choice2", CHOICE_free, CHOICE_print, CHOICE_constraint, CHOICE_decode_ber, CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ 0, /* No tags (pointer) */ 0, /* No tags (count) */ 0, /* No PER visible constraints */ asn_MBR_Choice2_1, 2, /* Elements count */ &asn_SPC_Choice2_specs_1 /* Additional specs */ }; asn1c-0.9.28+dfsg/tests/104-param-1-OK.asn1.-Pfwide-types0000644000000000000000000001340713065714043020675 0ustar rootroot /*** <<< INCLUDES [Collection] >>> ***/ #include #include #include #include /*** <<< TYPE-DECLS [Collection] >>> ***/ typedef struct Collection_16P0 { A_SET_OF(REAL_t) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Collection_16P0_t; typedef struct Collection_16P1 { A_SET_OF(IA5String_t) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Collection_16P1_t; /*** <<< FUNC-DECLS [Collection] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Collection_16P0; extern asn_TYPE_descriptor_t asn_DEF_Collection_16P1; /*** <<< STAT-DEFS [Collection] >>> ***/ static asn_TYPE_member_t asn_MBR_Collection_16P0_1[] = { { ATF_POINTER, 0, 0, .tag = (ASN_TAG_CLASS_UNIVERSAL | (9 << 2)), .tag_mode = 0, .type = &asn_DEF_REAL, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "" }, }; static const ber_tlv_tag_t asn_DEF_Collection_16P0_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_Collection_16P0_specs_1 = { sizeof(struct Collection_16P0), offsetof(struct Collection_16P0, _asn_ctx), 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_Collection_16P0 = { "Collection", "Collection", SET_OF_free, SET_OF_print, SET_OF_constraint, SET_OF_decode_ber, SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Collection_16P0_tags_1, sizeof(asn_DEF_Collection_16P0_tags_1) /sizeof(asn_DEF_Collection_16P0_tags_1[0]), /* 1 */ asn_DEF_Collection_16P0_tags_1, /* Same as above */ sizeof(asn_DEF_Collection_16P0_tags_1) /sizeof(asn_DEF_Collection_16P0_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Collection_16P0_1, 1, /* Single element */ &asn_SPC_Collection_16P0_specs_1 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_Collection_16P1_3[] = { { ATF_POINTER, 0, 0, .tag = (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)), .tag_mode = 0, .type = &asn_DEF_IA5String, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "" }, }; static const ber_tlv_tag_t asn_DEF_Collection_16P1_tags_3[] = { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_Collection_16P1_specs_3 = { sizeof(struct Collection_16P1), offsetof(struct Collection_16P1, _asn_ctx), 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_Collection_16P1 = { "Collection", "Collection", SET_OF_free, SET_OF_print, SET_OF_constraint, SET_OF_decode_ber, SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Collection_16P1_tags_3, sizeof(asn_DEF_Collection_16P1_tags_3) /sizeof(asn_DEF_Collection_16P1_tags_3[0]), /* 1 */ asn_DEF_Collection_16P1_tags_3, /* Same as above */ sizeof(asn_DEF_Collection_16P1_tags_3) /sizeof(asn_DEF_Collection_16P1_tags_3[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Collection_16P1_3, 1, /* Single element */ &asn_SPC_Collection_16P1_specs_3 /* Additional specs */ }; /*** <<< INCLUDES [Bunch] >>> ***/ #include "Collection.h" #include /*** <<< TYPE-DECLS [Bunch] >>> ***/ typedef struct Bunch { Collection_16P0_t field_REAL; Collection_16P1_t field_IA5String; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Bunch_t; /*** <<< FUNC-DECLS [Bunch] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Bunch; /*** <<< STAT-DEFS [Bunch] >>> ***/ static asn_TYPE_member_t asn_MBR_Bunch_1[] = { { ATF_NOFLAGS, 0, offsetof(struct Bunch, field_REAL), .tag = (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), .tag_mode = 0, .type = &asn_DEF_Collection_16P0, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "field-REAL" }, { ATF_NOFLAGS, 0, offsetof(struct Bunch, field_IA5String), .tag = (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), .tag_mode = 0, .type = &asn_DEF_Collection_16P1, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "field-IA5String" }, }; static const ber_tlv_tag_t asn_DEF_Bunch_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_Bunch_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), 0, 0, 1 }, /* field-REAL */ { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), 1, -1, 0 } /* field-IA5String */ }; static asn_SEQUENCE_specifics_t asn_SPC_Bunch_specs_1 = { sizeof(struct Bunch), offsetof(struct Bunch, _asn_ctx), asn_MAP_Bunch_tag2el_1, 2, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Bunch = { "Bunch", "Bunch", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Bunch_tags_1, sizeof(asn_DEF_Bunch_tags_1) /sizeof(asn_DEF_Bunch_tags_1[0]), /* 1 */ asn_DEF_Bunch_tags_1, /* Same as above */ sizeof(asn_DEF_Bunch_tags_1) /sizeof(asn_DEF_Bunch_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Bunch_1, 2, /* Elements count */ &asn_SPC_Bunch_specs_1 /* Additional specs */ }; asn1c-0.9.28+dfsg/tests/04-enum-SE.asn1.-E0000644000000000000000000000035413065714043016121 0ustar rootrootModuleTestEnum2 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 4 } DEFINITIONS ::= BEGIN enum1 Enum1 ::= blue Enum1 ::= ENUMERATED { red, green, ..., blue(1) } END asn1c-0.9.28+dfsg/tests/118-per-constraint-OK.asn10000644000000000000000000000127013065714043017753 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .118 ModuleConstraintPrecedence { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 118 } DEFINITIONS ::= BEGIN E1 ::= IA5String (SIZE(1..5, ...) ^ FROM("A".."Z")) E2 ::= IA5String (SIZE(1..5,...,5)) (FROM("A".."Z")) E3 ::= IA5String (SIZE(1..5) ^ FROM("A".."Z"),...) E4 ::= IA5String (FROM("A".."Z"),...) (SIZE(1..5)) C ::= IA5String (SIZE(10) ^ FROM("A".."D") | SIZE(20) ^ FROM("D".."F")) P ::= IA5String (FROM("AB") ^ SIZE(1..2) | FROM("DE") ^ SIZE(3) | FROM("AXE") ^ SIZE(1..5)) END asn1c-0.9.28+dfsg/tests/103-reference-SE.asn10000644000000000000000000000053313065714043016732 0ustar rootroot -- SE: Semantic error -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .103 ModuleReference { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 103 } DEFINITIONS ::= BEGIN IMPORTS Type FROM ModuleReference; T ::= SEQUENCE OF Type END asn1c-0.9.28+dfsg/tests/87-old-syntax-OK.asn10000644000000000000000000000066513065714043017041 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .87 ModuleObsoleteSyntax { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 87 } DEFINITIONS ::= BEGIN Tc ::= CHOICE { INTEGER, BOOLEAN } Ts ::= SET { INTEGER, BOOLEAN, SEQUENCE { OBJECT IDENTIFIER, RELATIVE-OID, Tc } } END asn1c-0.9.28+dfsg/tests/91-cond-int-blessSize-OK.asn10000644000000000000000000000075513065714043020406 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .91 ModuleConditionalIntegerType-with-fblessSIZE { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 91 } DEFINITIONS ::= BEGIN OK-Integer1 ::= INTEGER (SIZE(1)) OK-Integer2 ::= INTEGER (SIZE(2)) OK-Integer3 ::= INTEGER (SIZE(3)) OK-Integer4 ::= INTEGER (SIZE(4)) NO-Integer5 ::= INTEGER (SIZE(5)) END asn1c-0.9.28+dfsg/tests/129-enum-SE.asn10000644000000000000000000000050713065714043015751 0ustar rootroot -- SE: Semantic error -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .129 ModuleTestEnum1 { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 129 } DEFINITIONS ::= BEGIN A ::= ENUMERATED {a, b, ..., c, d(2)} END asn1c-0.9.28+dfsg/tests/127-per-long-OK.asn1.-Pgen-PER0000644000000000000000000003746613065714043020137 0ustar rootroot /*** <<< INCLUDES [T] >>> ***/ #include #include /*** <<< TYPE-DECLS [T] >>> ***/ typedef struct T { long small32range; long full32range; unsigned long unsigned32; unsigned long unsplit32; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } T_t; /*** <<< FUNC-DECLS [T] >>> ***/ /* extern asn_TYPE_descriptor_t asn_DEF_unsigned32_4; // (Use -fall-defs-global to expose) */ /* extern asn_TYPE_descriptor_t asn_DEF_unsplit32_5; // (Use -fall-defs-global to expose) */ extern asn_TYPE_descriptor_t asn_DEF_T; /*** <<< CODE [T] >>> ***/ static int unsigned32_4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } /* Constraint check succeeded */ return 0; } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void unsigned32_4_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; /* td->specifics = asn_DEF_NativeInteger.specifics; // Defined explicitly */ } static void unsigned32_4_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { unsigned32_4_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } static int unsigned32_4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { unsigned32_4_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } static asn_dec_rval_t unsigned32_4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { unsigned32_4_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } static asn_enc_rval_t unsigned32_4_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { unsigned32_4_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } static asn_dec_rval_t unsigned32_4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { unsigned32_4_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } static asn_enc_rval_t unsigned32_4_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { unsigned32_4_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } static asn_dec_rval_t unsigned32_4_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { unsigned32_4_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } static asn_enc_rval_t unsigned32_4_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { unsigned32_4_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static int unsplit32_5_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { unsigned long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const unsigned long *)sptr; if(((value >= 5 && value <= 500) || (value >= 600 && value <= 4294967290))) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void unsplit32_5_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; /* td->specifics = asn_DEF_NativeInteger.specifics; // Defined explicitly */ } static void unsplit32_5_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { unsplit32_5_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } static int unsplit32_5_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { unsplit32_5_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } static asn_dec_rval_t unsplit32_5_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { unsplit32_5_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } static asn_enc_rval_t unsplit32_5_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { unsplit32_5_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } static asn_dec_rval_t unsplit32_5_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { unsplit32_5_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } static asn_enc_rval_t unsplit32_5_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { unsplit32_5_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } static asn_dec_rval_t unsplit32_5_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { unsplit32_5_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } static asn_enc_rval_t unsplit32_5_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { unsplit32_5_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } static int memb_small32range_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if((value >= -2000000000 && value <= 2000000000)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } static int memb_full32range_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if((value >= (-2147483647L - 1) && value <= 2147483647)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } static int memb_unsigned32_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } /* Constraint check succeeded */ return 0; } static int memb_unsplit32_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { unsigned long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const unsigned long *)sptr; if(((value >= 5 && value <= 500) || (value >= 600 && value <= 4294967290))) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /*** <<< CTDEFS [T] >>> ***/ static asn_per_constraints_t asn_PER_type_unsigned32_constr_4 GCC_NOTUSED = { { APC_CONSTRAINED, 32, -1, 0, 4294967295 } /* (0..4294967295) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; static asn_per_constraints_t asn_PER_type_unsplit32_constr_5 GCC_NOTUSED = { { APC_CONSTRAINED, 32, -1, 5, 4294967290 } /* (5..4294967290) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; static asn_per_constraints_t asn_PER_memb_small32range_constr_2 GCC_NOTUSED = { { APC_CONSTRAINED, 32, -1, -2000000000, 2000000000 } /* (-2000000000..2000000000) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; static asn_per_constraints_t asn_PER_memb_full32range_constr_3 GCC_NOTUSED = { { APC_CONSTRAINED, 32, -1, (-2147483647L - 1), 2147483647 } /* (-2147483648..2147483647) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; static asn_per_constraints_t asn_PER_memb_unsigned32_constr_4 GCC_NOTUSED = { { APC_CONSTRAINED, 32, -1, 0, 4294967295 } /* (0..4294967295) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; static asn_per_constraints_t asn_PER_memb_unsplit32_constr_5 GCC_NOTUSED = { { APC_CONSTRAINED, 32, -1, 5, 4294967290 } /* (5..4294967290) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; /*** <<< STAT-DEFS [T] >>> ***/ static const asn_INTEGER_specifics_t asn_SPC_unsigned32_specs_4 = { 0, 0, 0, 0, 0, 0, /* Native long size */ 1 /* Unsigned representation */ }; static const ber_tlv_tag_t asn_DEF_unsigned32_tags_4[] = { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_unsigned32_4 = { "unsigned32", "unsigned32", unsigned32_4_free, unsigned32_4_print, unsigned32_4_constraint, unsigned32_4_decode_ber, unsigned32_4_encode_der, unsigned32_4_decode_xer, unsigned32_4_encode_xer, unsigned32_4_decode_uper, unsigned32_4_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_unsigned32_tags_4, sizeof(asn_DEF_unsigned32_tags_4) /sizeof(asn_DEF_unsigned32_tags_4[0]) - 1, /* 1 */ asn_DEF_unsigned32_tags_4, /* Same as above */ sizeof(asn_DEF_unsigned32_tags_4) /sizeof(asn_DEF_unsigned32_tags_4[0]), /* 2 */ &asn_PER_type_unsigned32_constr_4, 0, 0, /* No members */ &asn_SPC_unsigned32_specs_4 /* Additional specs */ }; static const asn_INTEGER_specifics_t asn_SPC_unsplit32_specs_5 = { 0, 0, 0, 0, 0, 0, /* Native long size */ 1 /* Unsigned representation */ }; static const ber_tlv_tag_t asn_DEF_unsplit32_tags_5[] = { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_unsplit32_5 = { "unsplit32", "unsplit32", unsplit32_5_free, unsplit32_5_print, unsplit32_5_constraint, unsplit32_5_decode_ber, unsplit32_5_encode_der, unsplit32_5_decode_xer, unsplit32_5_encode_xer, unsplit32_5_decode_uper, unsplit32_5_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_unsplit32_tags_5, sizeof(asn_DEF_unsplit32_tags_5) /sizeof(asn_DEF_unsplit32_tags_5[0]) - 1, /* 1 */ asn_DEF_unsplit32_tags_5, /* Same as above */ sizeof(asn_DEF_unsplit32_tags_5) /sizeof(asn_DEF_unsplit32_tags_5[0]), /* 2 */ &asn_PER_type_unsplit32_constr_5, 0, 0, /* No members */ &asn_SPC_unsplit32_specs_5 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_T_1[] = { { ATF_NOFLAGS, 0, offsetof(struct T, small32range), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_NativeInteger, .memb_constraints = memb_small32range_constraint_1, .per_constraints = &asn_PER_memb_small32range_constr_2, .default_value = 0, .name = "small32range" }, { ATF_NOFLAGS, 0, offsetof(struct T, full32range), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_NativeInteger, .memb_constraints = memb_full32range_constraint_1, .per_constraints = &asn_PER_memb_full32range_constr_3, .default_value = 0, .name = "full32range" }, { ATF_NOFLAGS, 0, offsetof(struct T, unsigned32), .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_unsigned32_4, .memb_constraints = memb_unsigned32_constraint_1, .per_constraints = &asn_PER_memb_unsigned32_constr_4, .default_value = 0, .name = "unsigned32" }, { ATF_NOFLAGS, 0, offsetof(struct T, unsplit32), .tag = (ASN_TAG_CLASS_CONTEXT | (3 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_unsplit32_5, .memb_constraints = memb_unsplit32_constraint_1, .per_constraints = &asn_PER_memb_unsplit32_constr_5, .default_value = 0, .name = "unsplit32" }, }; static const ber_tlv_tag_t asn_DEF_T_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_T_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* small32range */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* full32range */ { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* unsigned32 */ { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* unsplit32 */ }; static asn_SEQUENCE_specifics_t asn_SPC_T_specs_1 = { sizeof(struct T), offsetof(struct T, _asn_ctx), asn_MAP_T_tag2el_1, 4, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_T = { "T", "T", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_T_tags_1, sizeof(asn_DEF_T_tags_1) /sizeof(asn_DEF_T_tags_1[0]), /* 1 */ asn_DEF_T_tags_1, /* Same as above */ sizeof(asn_DEF_T_tags_1) /sizeof(asn_DEF_T_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_T_1, 4, /* Elements count */ &asn_SPC_T_specs_1 /* Additional specs */ }; asn1c-0.9.28+dfsg/tests/23-bits-OK.asn10000644000000000000000000000077513065714043015670 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .23 ModuleTestBitString { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 23 } DEFINITIONS AUTOMATIC TAGS ::= BEGIN v28 INTEGER ::= 28 BS1 ::= BIT STRING { first(0), third(2), twenty-eight(v28) } one-zero-one BS1 ::= { first, third } -- Equivalent to '101'B one0one BS1 ::= '1010000'B -- Equivalent to '101'B END asn1c-0.9.28+dfsg/tests/22-tags-OK.asn10000644000000000000000000000062413065714043015655 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .22 ModuleTestTags3 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 22 } DEFINITIONS AUTOMATIC TAGS ::= BEGIN T1 ::= SEQUENCE { a INTEGER, b CHOICE { i INTEGER, n IA5String }, c UTF8String } END asn1c-0.9.28+dfsg/tests/90-cond-int-type-OK.asn1.-Pgen-PER0000644000000000000000000031263113065714043021013 0ustar rootroot /*** <<< INCLUDES [CN-IntegerUnlimited] >>> ***/ #include /*** <<< TYPE-DECLS [CN-IntegerUnlimited] >>> ***/ typedef long CN_IntegerUnlimited_t; /*** <<< FUNC-DECLS [CN-IntegerUnlimited] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_CN_IntegerUnlimited; asn_struct_free_f CN_IntegerUnlimited_free; asn_struct_print_f CN_IntegerUnlimited_print; asn_constr_check_f CN_IntegerUnlimited_constraint; ber_type_decoder_f CN_IntegerUnlimited_decode_ber; der_type_encoder_f CN_IntegerUnlimited_encode_der; xer_type_decoder_f CN_IntegerUnlimited_decode_xer; xer_type_encoder_f CN_IntegerUnlimited_encode_xer; per_type_decoder_f CN_IntegerUnlimited_decode_uper; per_type_encoder_f CN_IntegerUnlimited_encode_uper; /*** <<< CODE [CN-IntegerUnlimited] >>> ***/ int CN_IntegerUnlimited_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_NativeInteger.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void CN_IntegerUnlimited_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; td->specifics = asn_DEF_NativeInteger.specifics; } void CN_IntegerUnlimited_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { CN_IntegerUnlimited_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int CN_IntegerUnlimited_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerUnlimited_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t CN_IntegerUnlimited_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { CN_IntegerUnlimited_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t CN_IntegerUnlimited_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerUnlimited_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t CN_IntegerUnlimited_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { CN_IntegerUnlimited_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t CN_IntegerUnlimited_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerUnlimited_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t CN_IntegerUnlimited_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { CN_IntegerUnlimited_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t CN_IntegerUnlimited_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { CN_IntegerUnlimited_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } /*** <<< STAT-DEFS [CN-IntegerUnlimited] >>> ***/ static const ber_tlv_tag_t asn_DEF_CN_IntegerUnlimited_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_CN_IntegerUnlimited = { "CN-IntegerUnlimited", "CN-IntegerUnlimited", CN_IntegerUnlimited_free, CN_IntegerUnlimited_print, CN_IntegerUnlimited_constraint, CN_IntegerUnlimited_decode_ber, CN_IntegerUnlimited_encode_der, CN_IntegerUnlimited_decode_xer, CN_IntegerUnlimited_encode_xer, CN_IntegerUnlimited_decode_uper, CN_IntegerUnlimited_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_CN_IntegerUnlimited_tags_1, sizeof(asn_DEF_CN_IntegerUnlimited_tags_1) /sizeof(asn_DEF_CN_IntegerUnlimited_tags_1[0]), /* 1 */ asn_DEF_CN_IntegerUnlimited_tags_1, /* Same as above */ sizeof(asn_DEF_CN_IntegerUnlimited_tags_1) /sizeof(asn_DEF_CN_IntegerUnlimited_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [CN-IntegerMinMax] >>> ***/ #include /*** <<< TYPE-DECLS [CN-IntegerMinMax] >>> ***/ typedef long CN_IntegerMinMax_t; /*** <<< FUNC-DECLS [CN-IntegerMinMax] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_CN_IntegerMinMax; asn_struct_free_f CN_IntegerMinMax_free; asn_struct_print_f CN_IntegerMinMax_print; asn_constr_check_f CN_IntegerMinMax_constraint; ber_type_decoder_f CN_IntegerMinMax_decode_ber; der_type_encoder_f CN_IntegerMinMax_encode_der; xer_type_decoder_f CN_IntegerMinMax_decode_xer; xer_type_encoder_f CN_IntegerMinMax_encode_xer; per_type_decoder_f CN_IntegerMinMax_decode_uper; per_type_encoder_f CN_IntegerMinMax_encode_uper; /*** <<< CODE [CN-IntegerMinMax] >>> ***/ int CN_IntegerMinMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(1 /* No applicable constraints whatsoever */) { /* Nothing is here. See below */ } /* Replace with underlying type checker */ td->check_constraints = asn_DEF_NativeInteger.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void CN_IntegerMinMax_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; td->specifics = asn_DEF_NativeInteger.specifics; } void CN_IntegerMinMax_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { CN_IntegerMinMax_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int CN_IntegerMinMax_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerMinMax_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t CN_IntegerMinMax_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { CN_IntegerMinMax_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t CN_IntegerMinMax_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerMinMax_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t CN_IntegerMinMax_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { CN_IntegerMinMax_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t CN_IntegerMinMax_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerMinMax_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t CN_IntegerMinMax_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { CN_IntegerMinMax_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t CN_IntegerMinMax_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { CN_IntegerMinMax_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } /*** <<< CTDEFS [CN-IntegerMinMax] >>> ***/ static asn_per_constraints_t asn_PER_type_CN_IntegerMinMax_constr_1 GCC_NOTUSED = { { APC_UNCONSTRAINED, -1, -1, 0, 0 }, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; /*** <<< STAT-DEFS [CN-IntegerMinMax] >>> ***/ static const ber_tlv_tag_t asn_DEF_CN_IntegerMinMax_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_CN_IntegerMinMax = { "CN-IntegerMinMax", "CN-IntegerMinMax", CN_IntegerMinMax_free, CN_IntegerMinMax_print, CN_IntegerMinMax_constraint, CN_IntegerMinMax_decode_ber, CN_IntegerMinMax_encode_der, CN_IntegerMinMax_decode_xer, CN_IntegerMinMax_encode_xer, CN_IntegerMinMax_decode_uper, CN_IntegerMinMax_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_CN_IntegerMinMax_tags_1, sizeof(asn_DEF_CN_IntegerMinMax_tags_1) /sizeof(asn_DEF_CN_IntegerMinMax_tags_1[0]), /* 1 */ asn_DEF_CN_IntegerMinMax_tags_1, /* Same as above */ sizeof(asn_DEF_CN_IntegerMinMax_tags_1) /sizeof(asn_DEF_CN_IntegerMinMax_tags_1[0]), /* 1 */ &asn_PER_type_CN_IntegerMinMax_constr_1, 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [CN-IntegerMinLow] >>> ***/ #include /*** <<< TYPE-DECLS [CN-IntegerMinLow] >>> ***/ typedef long CN_IntegerMinLow_t; /*** <<< FUNC-DECLS [CN-IntegerMinLow] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_CN_IntegerMinLow; asn_struct_free_f CN_IntegerMinLow_free; asn_struct_print_f CN_IntegerMinLow_print; asn_constr_check_f CN_IntegerMinLow_constraint; ber_type_decoder_f CN_IntegerMinLow_decode_ber; der_type_encoder_f CN_IntegerMinLow_encode_der; xer_type_decoder_f CN_IntegerMinLow_decode_xer; xer_type_encoder_f CN_IntegerMinLow_encode_xer; per_type_decoder_f CN_IntegerMinLow_decode_uper; per_type_encoder_f CN_IntegerMinLow_encode_uper; /*** <<< CODE [CN-IntegerMinLow] >>> ***/ int CN_IntegerMinLow_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if((value <= 1)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void CN_IntegerMinLow_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; td->specifics = asn_DEF_NativeInteger.specifics; } void CN_IntegerMinLow_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { CN_IntegerMinLow_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int CN_IntegerMinLow_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerMinLow_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t CN_IntegerMinLow_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { CN_IntegerMinLow_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t CN_IntegerMinLow_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerMinLow_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t CN_IntegerMinLow_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { CN_IntegerMinLow_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t CN_IntegerMinLow_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerMinLow_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t CN_IntegerMinLow_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { CN_IntegerMinLow_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t CN_IntegerMinLow_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { CN_IntegerMinLow_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } /*** <<< CTDEFS [CN-IntegerMinLow] >>> ***/ static asn_per_constraints_t asn_PER_type_CN_IntegerMinLow_constr_1 GCC_NOTUSED = { { APC_UNCONSTRAINED, -1, -1, 0, 0 } /* (MIN..1) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; /*** <<< STAT-DEFS [CN-IntegerMinLow] >>> ***/ static const ber_tlv_tag_t asn_DEF_CN_IntegerMinLow_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_CN_IntegerMinLow = { "CN-IntegerMinLow", "CN-IntegerMinLow", CN_IntegerMinLow_free, CN_IntegerMinLow_print, CN_IntegerMinLow_constraint, CN_IntegerMinLow_decode_ber, CN_IntegerMinLow_encode_der, CN_IntegerMinLow_decode_xer, CN_IntegerMinLow_encode_xer, CN_IntegerMinLow_decode_uper, CN_IntegerMinLow_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_CN_IntegerMinLow_tags_1, sizeof(asn_DEF_CN_IntegerMinLow_tags_1) /sizeof(asn_DEF_CN_IntegerMinLow_tags_1[0]), /* 1 */ asn_DEF_CN_IntegerMinLow_tags_1, /* Same as above */ sizeof(asn_DEF_CN_IntegerMinLow_tags_1) /sizeof(asn_DEF_CN_IntegerMinLow_tags_1[0]), /* 1 */ &asn_PER_type_CN_IntegerMinLow_constr_1, 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [NO-IntegerMinHigh] >>> ***/ #include /*** <<< TYPE-DECLS [NO-IntegerMinHigh] >>> ***/ typedef INTEGER_t NO_IntegerMinHigh_t; /*** <<< FUNC-DECLS [NO-IntegerMinHigh] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_NO_IntegerMinHigh; asn_struct_free_f NO_IntegerMinHigh_free; asn_struct_print_f NO_IntegerMinHigh_print; asn_constr_check_f NO_IntegerMinHigh_constraint; ber_type_decoder_f NO_IntegerMinHigh_decode_ber; der_type_encoder_f NO_IntegerMinHigh_encode_der; xer_type_decoder_f NO_IntegerMinHigh_decode_xer; xer_type_encoder_f NO_IntegerMinHigh_encode_xer; per_type_decoder_f NO_IntegerMinHigh_decode_uper; per_type_encoder_f NO_IntegerMinHigh_encode_uper; /*** <<< CODE [NO-IntegerMinHigh] >>> ***/ int NO_IntegerMinHigh_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(asn_INTEGER2long(st, &value)) { ASN__CTFAIL(app_key, td, sptr, "%s: value too large (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if((value <= 3000000000)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using INTEGER, * so here we adjust the DEF accordingly. */ static void NO_IntegerMinHigh_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_INTEGER.free_struct; td->print_struct = asn_DEF_INTEGER.print_struct; td->check_constraints = asn_DEF_INTEGER.check_constraints; td->ber_decoder = asn_DEF_INTEGER.ber_decoder; td->der_encoder = asn_DEF_INTEGER.der_encoder; td->xer_decoder = asn_DEF_INTEGER.xer_decoder; td->xer_encoder = asn_DEF_INTEGER.xer_encoder; td->uper_decoder = asn_DEF_INTEGER.uper_decoder; td->uper_encoder = asn_DEF_INTEGER.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; td->elements = asn_DEF_INTEGER.elements; td->elements_count = asn_DEF_INTEGER.elements_count; td->specifics = asn_DEF_INTEGER.specifics; } void NO_IntegerMinHigh_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { NO_IntegerMinHigh_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int NO_IntegerMinHigh_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerMinHigh_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t NO_IntegerMinHigh_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { NO_IntegerMinHigh_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t NO_IntegerMinHigh_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerMinHigh_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t NO_IntegerMinHigh_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { NO_IntegerMinHigh_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t NO_IntegerMinHigh_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerMinHigh_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t NO_IntegerMinHigh_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { NO_IntegerMinHigh_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t NO_IntegerMinHigh_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { NO_IntegerMinHigh_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } /*** <<< CTDEFS [NO-IntegerMinHigh] >>> ***/ static asn_per_constraints_t asn_PER_type_NO_IntegerMinHigh_constr_1 GCC_NOTUSED = { { APC_UNCONSTRAINED, -1, -1, 0, 0 } /* (MIN..3000000000) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; /*** <<< STAT-DEFS [NO-IntegerMinHigh] >>> ***/ static const ber_tlv_tag_t asn_DEF_NO_IntegerMinHigh_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_NO_IntegerMinHigh = { "NO-IntegerMinHigh", "NO-IntegerMinHigh", NO_IntegerMinHigh_free, NO_IntegerMinHigh_print, NO_IntegerMinHigh_constraint, NO_IntegerMinHigh_decode_ber, NO_IntegerMinHigh_encode_der, NO_IntegerMinHigh_decode_xer, NO_IntegerMinHigh_encode_xer, NO_IntegerMinHigh_decode_uper, NO_IntegerMinHigh_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerMinHigh_tags_1, sizeof(asn_DEF_NO_IntegerMinHigh_tags_1) /sizeof(asn_DEF_NO_IntegerMinHigh_tags_1[0]), /* 1 */ asn_DEF_NO_IntegerMinHigh_tags_1, /* Same as above */ sizeof(asn_DEF_NO_IntegerMinHigh_tags_1) /sizeof(asn_DEF_NO_IntegerMinHigh_tags_1[0]), /* 1 */ &asn_PER_type_NO_IntegerMinHigh_constr_1, 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [NO-IntegerLowHigh] >>> ***/ #include /*** <<< TYPE-DECLS [NO-IntegerLowHigh] >>> ***/ typedef unsigned long NO_IntegerLowHigh_t; /*** <<< FUNC-DECLS [NO-IntegerLowHigh] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_NO_IntegerLowHigh; asn_struct_free_f NO_IntegerLowHigh_free; asn_struct_print_f NO_IntegerLowHigh_print; asn_constr_check_f NO_IntegerLowHigh_constraint; ber_type_decoder_f NO_IntegerLowHigh_decode_ber; der_type_encoder_f NO_IntegerLowHigh_encode_der; xer_type_decoder_f NO_IntegerLowHigh_decode_xer; xer_type_encoder_f NO_IntegerLowHigh_encode_xer; per_type_decoder_f NO_IntegerLowHigh_decode_uper; per_type_encoder_f NO_IntegerLowHigh_encode_uper; /*** <<< CODE [NO-IntegerLowHigh] >>> ***/ int NO_IntegerLowHigh_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { unsigned long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const unsigned long *)sptr; if((value >= 1 && value <= 3000000000)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void NO_IntegerLowHigh_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; /* td->specifics = asn_DEF_NativeInteger.specifics; // Defined explicitly */ } void NO_IntegerLowHigh_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { NO_IntegerLowHigh_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int NO_IntegerLowHigh_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerLowHigh_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t NO_IntegerLowHigh_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { NO_IntegerLowHigh_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t NO_IntegerLowHigh_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerLowHigh_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t NO_IntegerLowHigh_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { NO_IntegerLowHigh_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t NO_IntegerLowHigh_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerLowHigh_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t NO_IntegerLowHigh_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { NO_IntegerLowHigh_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t NO_IntegerLowHigh_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { NO_IntegerLowHigh_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } /*** <<< CTDEFS [NO-IntegerLowHigh] >>> ***/ static asn_per_constraints_t asn_PER_type_NO_IntegerLowHigh_constr_1 GCC_NOTUSED = { { APC_CONSTRAINED, 32, -1, 1, 3000000000 } /* (1..3000000000) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; /*** <<< STAT-DEFS [NO-IntegerLowHigh] >>> ***/ static const asn_INTEGER_specifics_t asn_SPC_NO_IntegerLowHigh_specs_1 = { 0, 0, 0, 0, 0, 0, /* Native long size */ 1 /* Unsigned representation */ }; static const ber_tlv_tag_t asn_DEF_NO_IntegerLowHigh_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_NO_IntegerLowHigh = { "NO-IntegerLowHigh", "NO-IntegerLowHigh", NO_IntegerLowHigh_free, NO_IntegerLowHigh_print, NO_IntegerLowHigh_constraint, NO_IntegerLowHigh_decode_ber, NO_IntegerLowHigh_encode_der, NO_IntegerLowHigh_decode_xer, NO_IntegerLowHigh_encode_xer, NO_IntegerLowHigh_decode_uper, NO_IntegerLowHigh_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerLowHigh_tags_1, sizeof(asn_DEF_NO_IntegerLowHigh_tags_1) /sizeof(asn_DEF_NO_IntegerLowHigh_tags_1[0]), /* 1 */ asn_DEF_NO_IntegerLowHigh_tags_1, /* Same as above */ sizeof(asn_DEF_NO_IntegerLowHigh_tags_1) /sizeof(asn_DEF_NO_IntegerLowHigh_tags_1[0]), /* 1 */ &asn_PER_type_NO_IntegerLowHigh_constr_1, 0, 0, /* No members */ &asn_SPC_NO_IntegerLowHigh_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [CN-IntegerLowMax] >>> ***/ #include /*** <<< TYPE-DECLS [CN-IntegerLowMax] >>> ***/ typedef long CN_IntegerLowMax_t; /*** <<< FUNC-DECLS [CN-IntegerLowMax] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_CN_IntegerLowMax; asn_struct_free_f CN_IntegerLowMax_free; asn_struct_print_f CN_IntegerLowMax_print; asn_constr_check_f CN_IntegerLowMax_constraint; ber_type_decoder_f CN_IntegerLowMax_decode_ber; der_type_encoder_f CN_IntegerLowMax_encode_der; xer_type_decoder_f CN_IntegerLowMax_decode_xer; xer_type_encoder_f CN_IntegerLowMax_encode_xer; per_type_decoder_f CN_IntegerLowMax_decode_uper; per_type_encoder_f CN_IntegerLowMax_encode_uper; /*** <<< CODE [CN-IntegerLowMax] >>> ***/ int CN_IntegerLowMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if((value >= 1)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void CN_IntegerLowMax_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; td->specifics = asn_DEF_NativeInteger.specifics; } void CN_IntegerLowMax_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { CN_IntegerLowMax_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int CN_IntegerLowMax_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerLowMax_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t CN_IntegerLowMax_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { CN_IntegerLowMax_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t CN_IntegerLowMax_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerLowMax_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t CN_IntegerLowMax_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { CN_IntegerLowMax_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t CN_IntegerLowMax_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerLowMax_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t CN_IntegerLowMax_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { CN_IntegerLowMax_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t CN_IntegerLowMax_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { CN_IntegerLowMax_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } /*** <<< CTDEFS [CN-IntegerLowMax] >>> ***/ static asn_per_constraints_t asn_PER_type_CN_IntegerLowMax_constr_1 GCC_NOTUSED = { { APC_SEMI_CONSTRAINED, -1, -1, 1, 0 } /* (1..MAX) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; /*** <<< STAT-DEFS [CN-IntegerLowMax] >>> ***/ static const ber_tlv_tag_t asn_DEF_CN_IntegerLowMax_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_CN_IntegerLowMax = { "CN-IntegerLowMax", "CN-IntegerLowMax", CN_IntegerLowMax_free, CN_IntegerLowMax_print, CN_IntegerLowMax_constraint, CN_IntegerLowMax_decode_ber, CN_IntegerLowMax_encode_der, CN_IntegerLowMax_decode_xer, CN_IntegerLowMax_encode_xer, CN_IntegerLowMax_decode_uper, CN_IntegerLowMax_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_CN_IntegerLowMax_tags_1, sizeof(asn_DEF_CN_IntegerLowMax_tags_1) /sizeof(asn_DEF_CN_IntegerLowMax_tags_1[0]), /* 1 */ asn_DEF_CN_IntegerLowMax_tags_1, /* Same as above */ sizeof(asn_DEF_CN_IntegerLowMax_tags_1) /sizeof(asn_DEF_CN_IntegerLowMax_tags_1[0]), /* 1 */ &asn_PER_type_CN_IntegerLowMax_constr_1, 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [NO-IntegerHighMax] >>> ***/ #include /*** <<< TYPE-DECLS [NO-IntegerHighMax] >>> ***/ typedef INTEGER_t NO_IntegerHighMax_t; /*** <<< FUNC-DECLS [NO-IntegerHighMax] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_NO_IntegerHighMax; asn_struct_free_f NO_IntegerHighMax_free; asn_struct_print_f NO_IntegerHighMax_print; asn_constr_check_f NO_IntegerHighMax_constraint; ber_type_decoder_f NO_IntegerHighMax_decode_ber; der_type_encoder_f NO_IntegerHighMax_encode_der; xer_type_decoder_f NO_IntegerHighMax_decode_xer; xer_type_encoder_f NO_IntegerHighMax_encode_xer; per_type_decoder_f NO_IntegerHighMax_decode_uper; per_type_encoder_f NO_IntegerHighMax_encode_uper; /*** <<< CODE [NO-IntegerHighMax] >>> ***/ int NO_IntegerHighMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(asn_INTEGER2long(st, &value)) { ASN__CTFAIL(app_key, td, sptr, "%s: value too large (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if((value >= 3000000000)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using INTEGER, * so here we adjust the DEF accordingly. */ static void NO_IntegerHighMax_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_INTEGER.free_struct; td->print_struct = asn_DEF_INTEGER.print_struct; td->check_constraints = asn_DEF_INTEGER.check_constraints; td->ber_decoder = asn_DEF_INTEGER.ber_decoder; td->der_encoder = asn_DEF_INTEGER.der_encoder; td->xer_decoder = asn_DEF_INTEGER.xer_decoder; td->xer_encoder = asn_DEF_INTEGER.xer_encoder; td->uper_decoder = asn_DEF_INTEGER.uper_decoder; td->uper_encoder = asn_DEF_INTEGER.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; td->elements = asn_DEF_INTEGER.elements; td->elements_count = asn_DEF_INTEGER.elements_count; td->specifics = asn_DEF_INTEGER.specifics; } void NO_IntegerHighMax_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { NO_IntegerHighMax_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int NO_IntegerHighMax_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerHighMax_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t NO_IntegerHighMax_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { NO_IntegerHighMax_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t NO_IntegerHighMax_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerHighMax_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t NO_IntegerHighMax_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { NO_IntegerHighMax_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t NO_IntegerHighMax_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerHighMax_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t NO_IntegerHighMax_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { NO_IntegerHighMax_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t NO_IntegerHighMax_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { NO_IntegerHighMax_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } /*** <<< CTDEFS [NO-IntegerHighMax] >>> ***/ static asn_per_constraints_t asn_PER_type_NO_IntegerHighMax_constr_1 GCC_NOTUSED = { { APC_SEMI_CONSTRAINED, -1, -1, 3000000000, 0 } /* (3000000000..MAX) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; /*** <<< STAT-DEFS [NO-IntegerHighMax] >>> ***/ static const ber_tlv_tag_t asn_DEF_NO_IntegerHighMax_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_NO_IntegerHighMax = { "NO-IntegerHighMax", "NO-IntegerHighMax", NO_IntegerHighMax_free, NO_IntegerHighMax_print, NO_IntegerHighMax_constraint, NO_IntegerHighMax_decode_ber, NO_IntegerHighMax_encode_der, NO_IntegerHighMax_decode_xer, NO_IntegerHighMax_encode_xer, NO_IntegerHighMax_decode_uper, NO_IntegerHighMax_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerHighMax_tags_1, sizeof(asn_DEF_NO_IntegerHighMax_tags_1) /sizeof(asn_DEF_NO_IntegerHighMax_tags_1[0]), /* 1 */ asn_DEF_NO_IntegerHighMax_tags_1, /* Same as above */ sizeof(asn_DEF_NO_IntegerHighMax_tags_1) /sizeof(asn_DEF_NO_IntegerHighMax_tags_1[0]), /* 1 */ &asn_PER_type_NO_IntegerHighMax_constr_1, 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [NO-IntegerLowestMax] >>> ***/ #include /*** <<< TYPE-DECLS [NO-IntegerLowestMax] >>> ***/ typedef INTEGER_t NO_IntegerLowestMax_t; /*** <<< FUNC-DECLS [NO-IntegerLowestMax] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_NO_IntegerLowestMax; asn_struct_free_f NO_IntegerLowestMax_free; asn_struct_print_f NO_IntegerLowestMax_print; asn_constr_check_f NO_IntegerLowestMax_constraint; ber_type_decoder_f NO_IntegerLowestMax_decode_ber; der_type_encoder_f NO_IntegerLowestMax_encode_der; xer_type_decoder_f NO_IntegerLowestMax_decode_xer; xer_type_encoder_f NO_IntegerLowestMax_encode_xer; per_type_decoder_f NO_IntegerLowestMax_decode_uper; per_type_encoder_f NO_IntegerLowestMax_encode_uper; /*** <<< CODE [NO-IntegerLowestMax] >>> ***/ int NO_IntegerLowestMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(asn_INTEGER2long(st, &value)) { ASN__CTFAIL(app_key, td, sptr, "%s: value too large (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if((value >= -3000000000)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using INTEGER, * so here we adjust the DEF accordingly. */ static void NO_IntegerLowestMax_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_INTEGER.free_struct; td->print_struct = asn_DEF_INTEGER.print_struct; td->check_constraints = asn_DEF_INTEGER.check_constraints; td->ber_decoder = asn_DEF_INTEGER.ber_decoder; td->der_encoder = asn_DEF_INTEGER.der_encoder; td->xer_decoder = asn_DEF_INTEGER.xer_decoder; td->xer_encoder = asn_DEF_INTEGER.xer_encoder; td->uper_decoder = asn_DEF_INTEGER.uper_decoder; td->uper_encoder = asn_DEF_INTEGER.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; td->elements = asn_DEF_INTEGER.elements; td->elements_count = asn_DEF_INTEGER.elements_count; td->specifics = asn_DEF_INTEGER.specifics; } void NO_IntegerLowestMax_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { NO_IntegerLowestMax_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int NO_IntegerLowestMax_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerLowestMax_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t NO_IntegerLowestMax_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { NO_IntegerLowestMax_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t NO_IntegerLowestMax_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerLowestMax_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t NO_IntegerLowestMax_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { NO_IntegerLowestMax_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t NO_IntegerLowestMax_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerLowestMax_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t NO_IntegerLowestMax_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { NO_IntegerLowestMax_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t NO_IntegerLowestMax_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { NO_IntegerLowestMax_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } /*** <<< CTDEFS [NO-IntegerLowestMax] >>> ***/ static asn_per_constraints_t asn_PER_type_NO_IntegerLowestMax_constr_1 GCC_NOTUSED = { { APC_SEMI_CONSTRAINED, -1, -1, -3000000000, 0 } /* (-3000000000..MAX) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; /*** <<< STAT-DEFS [NO-IntegerLowestMax] >>> ***/ static const ber_tlv_tag_t asn_DEF_NO_IntegerLowestMax_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_NO_IntegerLowestMax = { "NO-IntegerLowestMax", "NO-IntegerLowestMax", NO_IntegerLowestMax_free, NO_IntegerLowestMax_print, NO_IntegerLowestMax_constraint, NO_IntegerLowestMax_decode_ber, NO_IntegerLowestMax_encode_der, NO_IntegerLowestMax_decode_xer, NO_IntegerLowestMax_encode_xer, NO_IntegerLowestMax_decode_uper, NO_IntegerLowestMax_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerLowestMax_tags_1, sizeof(asn_DEF_NO_IntegerLowestMax_tags_1) /sizeof(asn_DEF_NO_IntegerLowestMax_tags_1[0]), /* 1 */ asn_DEF_NO_IntegerLowestMax_tags_1, /* Same as above */ sizeof(asn_DEF_NO_IntegerLowestMax_tags_1) /sizeof(asn_DEF_NO_IntegerLowestMax_tags_1[0]), /* 1 */ &asn_PER_type_NO_IntegerLowestMax_constr_1, 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [NO-IntegerOutRange] >>> ***/ #include /*** <<< TYPE-DECLS [NO-IntegerOutRange] >>> ***/ typedef unsigned long NO_IntegerOutRange_t; /*** <<< FUNC-DECLS [NO-IntegerOutRange] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_NO_IntegerOutRange; asn_struct_free_f NO_IntegerOutRange_free; asn_struct_print_f NO_IntegerOutRange_print; asn_constr_check_f NO_IntegerOutRange_constraint; ber_type_decoder_f NO_IntegerOutRange_decode_ber; der_type_encoder_f NO_IntegerOutRange_encode_der; xer_type_decoder_f NO_IntegerOutRange_decode_xer; xer_type_encoder_f NO_IntegerOutRange_encode_xer; per_type_decoder_f NO_IntegerOutRange_decode_uper; per_type_encoder_f NO_IntegerOutRange_encode_uper; /*** <<< CODE [NO-IntegerOutRange] >>> ***/ int NO_IntegerOutRange_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { unsigned long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const unsigned long *)sptr; if((value >= 3000000000 && value <= 3000000001)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void NO_IntegerOutRange_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; /* td->specifics = asn_DEF_NativeInteger.specifics; // Defined explicitly */ } void NO_IntegerOutRange_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { NO_IntegerOutRange_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int NO_IntegerOutRange_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerOutRange_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t NO_IntegerOutRange_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { NO_IntegerOutRange_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t NO_IntegerOutRange_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerOutRange_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t NO_IntegerOutRange_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { NO_IntegerOutRange_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t NO_IntegerOutRange_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerOutRange_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t NO_IntegerOutRange_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { NO_IntegerOutRange_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t NO_IntegerOutRange_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { NO_IntegerOutRange_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } /*** <<< CTDEFS [NO-IntegerOutRange] >>> ***/ static asn_per_constraints_t asn_PER_type_NO_IntegerOutRange_constr_1 GCC_NOTUSED = { { APC_CONSTRAINED, 1, -1, 3000000000, 3000000001 } /* (3000000000..3000000001) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; /*** <<< STAT-DEFS [NO-IntegerOutRange] >>> ***/ static const asn_INTEGER_specifics_t asn_SPC_NO_IntegerOutRange_specs_1 = { 0, 0, 0, 0, 0, 0, /* Native long size */ 1 /* Unsigned representation */ }; static const ber_tlv_tag_t asn_DEF_NO_IntegerOutRange_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_NO_IntegerOutRange = { "NO-IntegerOutRange", "NO-IntegerOutRange", NO_IntegerOutRange_free, NO_IntegerOutRange_print, NO_IntegerOutRange_constraint, NO_IntegerOutRange_decode_ber, NO_IntegerOutRange_encode_der, NO_IntegerOutRange_decode_xer, NO_IntegerOutRange_encode_xer, NO_IntegerOutRange_decode_uper, NO_IntegerOutRange_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerOutRange_tags_1, sizeof(asn_DEF_NO_IntegerOutRange_tags_1) /sizeof(asn_DEF_NO_IntegerOutRange_tags_1[0]), /* 1 */ asn_DEF_NO_IntegerOutRange_tags_1, /* Same as above */ sizeof(asn_DEF_NO_IntegerOutRange_tags_1) /sizeof(asn_DEF_NO_IntegerOutRange_tags_1[0]), /* 1 */ &asn_PER_type_NO_IntegerOutRange_constr_1, 0, 0, /* No members */ &asn_SPC_NO_IntegerOutRange_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [NO-IntegerOutValue] >>> ***/ #include /*** <<< TYPE-DECLS [NO-IntegerOutValue] >>> ***/ typedef unsigned long NO_IntegerOutValue_t; /*** <<< FUNC-DECLS [NO-IntegerOutValue] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_NO_IntegerOutValue; asn_struct_free_f NO_IntegerOutValue_free; asn_struct_print_f NO_IntegerOutValue_print; asn_constr_check_f NO_IntegerOutValue_constraint; ber_type_decoder_f NO_IntegerOutValue_decode_ber; der_type_encoder_f NO_IntegerOutValue_encode_der; xer_type_decoder_f NO_IntegerOutValue_decode_xer; xer_type_encoder_f NO_IntegerOutValue_encode_xer; per_type_decoder_f NO_IntegerOutValue_decode_uper; per_type_encoder_f NO_IntegerOutValue_encode_uper; /*** <<< CODE [NO-IntegerOutValue] >>> ***/ int NO_IntegerOutValue_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { unsigned long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const unsigned long *)sptr; if((value == 3000000000)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void NO_IntegerOutValue_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; /* td->specifics = asn_DEF_NativeInteger.specifics; // Defined explicitly */ } void NO_IntegerOutValue_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { NO_IntegerOutValue_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int NO_IntegerOutValue_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerOutValue_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t NO_IntegerOutValue_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { NO_IntegerOutValue_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t NO_IntegerOutValue_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerOutValue_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t NO_IntegerOutValue_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { NO_IntegerOutValue_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t NO_IntegerOutValue_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerOutValue_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t NO_IntegerOutValue_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { NO_IntegerOutValue_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t NO_IntegerOutValue_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { NO_IntegerOutValue_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } /*** <<< CTDEFS [NO-IntegerOutValue] >>> ***/ static asn_per_constraints_t asn_PER_type_NO_IntegerOutValue_constr_1 GCC_NOTUSED = { { APC_CONSTRAINED, 0, -1, 3000000000, 3000000000 } /* (3000000000..3000000000) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; /*** <<< STAT-DEFS [NO-IntegerOutValue] >>> ***/ static const asn_INTEGER_specifics_t asn_SPC_NO_IntegerOutValue_specs_1 = { 0, 0, 0, 0, 0, 0, /* Native long size */ 1 /* Unsigned representation */ }; static const ber_tlv_tag_t asn_DEF_NO_IntegerOutValue_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_NO_IntegerOutValue = { "NO-IntegerOutValue", "NO-IntegerOutValue", NO_IntegerOutValue_free, NO_IntegerOutValue_print, NO_IntegerOutValue_constraint, NO_IntegerOutValue_decode_ber, NO_IntegerOutValue_encode_der, NO_IntegerOutValue_decode_xer, NO_IntegerOutValue_encode_xer, NO_IntegerOutValue_decode_uper, NO_IntegerOutValue_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerOutValue_tags_1, sizeof(asn_DEF_NO_IntegerOutValue_tags_1) /sizeof(asn_DEF_NO_IntegerOutValue_tags_1[0]), /* 1 */ asn_DEF_NO_IntegerOutValue_tags_1, /* Same as above */ sizeof(asn_DEF_NO_IntegerOutValue_tags_1) /sizeof(asn_DEF_NO_IntegerOutValue_tags_1[0]), /* 1 */ &asn_PER_type_NO_IntegerOutValue_constr_1, 0, 0, /* No members */ &asn_SPC_NO_IntegerOutValue_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [OK-IntegerInRange1] >>> ***/ #include /*** <<< TYPE-DECLS [OK-IntegerInRange1] >>> ***/ typedef long OK_IntegerInRange1_t; /*** <<< FUNC-DECLS [OK-IntegerInRange1] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange1; asn_struct_free_f OK_IntegerInRange1_free; asn_struct_print_f OK_IntegerInRange1_print; asn_constr_check_f OK_IntegerInRange1_constraint; ber_type_decoder_f OK_IntegerInRange1_decode_ber; der_type_encoder_f OK_IntegerInRange1_encode_der; xer_type_decoder_f OK_IntegerInRange1_decode_xer; xer_type_encoder_f OK_IntegerInRange1_encode_xer; per_type_decoder_f OK_IntegerInRange1_decode_uper; per_type_encoder_f OK_IntegerInRange1_encode_uper; /*** <<< CODE [OK-IntegerInRange1] >>> ***/ int OK_IntegerInRange1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if((value >= -100 && value <= 100)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void OK_IntegerInRange1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; td->specifics = asn_DEF_NativeInteger.specifics; } void OK_IntegerInRange1_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { OK_IntegerInRange1_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int OK_IntegerInRange1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange1_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t OK_IntegerInRange1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { OK_IntegerInRange1_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t OK_IntegerInRange1_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange1_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t OK_IntegerInRange1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { OK_IntegerInRange1_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t OK_IntegerInRange1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange1_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t OK_IntegerInRange1_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { OK_IntegerInRange1_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t OK_IntegerInRange1_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { OK_IntegerInRange1_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } /*** <<< CTDEFS [OK-IntegerInRange1] >>> ***/ static asn_per_constraints_t asn_PER_type_OK_IntegerInRange1_constr_1 GCC_NOTUSED = { { APC_CONSTRAINED, 8, 8, -100, 100 } /* (-100..100) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; /*** <<< STAT-DEFS [OK-IntegerInRange1] >>> ***/ static const ber_tlv_tag_t asn_DEF_OK_IntegerInRange1_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange1 = { "OK-IntegerInRange1", "OK-IntegerInRange1", OK_IntegerInRange1_free, OK_IntegerInRange1_print, OK_IntegerInRange1_constraint, OK_IntegerInRange1_decode_ber, OK_IntegerInRange1_encode_der, OK_IntegerInRange1_decode_xer, OK_IntegerInRange1_encode_xer, OK_IntegerInRange1_decode_uper, OK_IntegerInRange1_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_OK_IntegerInRange1_tags_1, sizeof(asn_DEF_OK_IntegerInRange1_tags_1) /sizeof(asn_DEF_OK_IntegerInRange1_tags_1[0]), /* 1 */ asn_DEF_OK_IntegerInRange1_tags_1, /* Same as above */ sizeof(asn_DEF_OK_IntegerInRange1_tags_1) /sizeof(asn_DEF_OK_IntegerInRange1_tags_1[0]), /* 1 */ &asn_PER_type_OK_IntegerInRange1_constr_1, 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [OK-IntegerInRange2] >>> ***/ #include /*** <<< TYPE-DECLS [OK-IntegerInRange2] >>> ***/ typedef long OK_IntegerInRange2_t; /*** <<< FUNC-DECLS [OK-IntegerInRange2] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange2; asn_struct_free_f OK_IntegerInRange2_free; asn_struct_print_f OK_IntegerInRange2_print; asn_constr_check_f OK_IntegerInRange2_constraint; ber_type_decoder_f OK_IntegerInRange2_decode_ber; der_type_encoder_f OK_IntegerInRange2_encode_der; xer_type_decoder_f OK_IntegerInRange2_decode_xer; xer_type_encoder_f OK_IntegerInRange2_encode_xer; per_type_decoder_f OK_IntegerInRange2_decode_uper; per_type_encoder_f OK_IntegerInRange2_encode_uper; /*** <<< CODE [OK-IntegerInRange2] >>> ***/ int OK_IntegerInRange2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if(((value == -100) || (value == 100))) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void OK_IntegerInRange2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; td->specifics = asn_DEF_NativeInteger.specifics; } void OK_IntegerInRange2_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { OK_IntegerInRange2_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int OK_IntegerInRange2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange2_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t OK_IntegerInRange2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { OK_IntegerInRange2_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t OK_IntegerInRange2_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange2_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t OK_IntegerInRange2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { OK_IntegerInRange2_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t OK_IntegerInRange2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange2_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t OK_IntegerInRange2_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { OK_IntegerInRange2_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t OK_IntegerInRange2_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { OK_IntegerInRange2_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } /*** <<< CTDEFS [OK-IntegerInRange2] >>> ***/ static asn_per_constraints_t asn_PER_type_OK_IntegerInRange2_constr_1 GCC_NOTUSED = { { APC_CONSTRAINED, 8, 8, -100, 100 } /* (-100..100) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; /*** <<< STAT-DEFS [OK-IntegerInRange2] >>> ***/ static const ber_tlv_tag_t asn_DEF_OK_IntegerInRange2_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange2 = { "OK-IntegerInRange2", "OK-IntegerInRange2", OK_IntegerInRange2_free, OK_IntegerInRange2_print, OK_IntegerInRange2_constraint, OK_IntegerInRange2_decode_ber, OK_IntegerInRange2_encode_der, OK_IntegerInRange2_decode_xer, OK_IntegerInRange2_encode_xer, OK_IntegerInRange2_decode_uper, OK_IntegerInRange2_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_OK_IntegerInRange2_tags_1, sizeof(asn_DEF_OK_IntegerInRange2_tags_1) /sizeof(asn_DEF_OK_IntegerInRange2_tags_1[0]), /* 1 */ asn_DEF_OK_IntegerInRange2_tags_1, /* Same as above */ sizeof(asn_DEF_OK_IntegerInRange2_tags_1) /sizeof(asn_DEF_OK_IntegerInRange2_tags_1[0]), /* 1 */ &asn_PER_type_OK_IntegerInRange2_constr_1, 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [OK-IntegerInRange3] >>> ***/ #include /*** <<< TYPE-DECLS [OK-IntegerInRange3] >>> ***/ typedef long OK_IntegerInRange3_t; /*** <<< FUNC-DECLS [OK-IntegerInRange3] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange3; asn_struct_free_f OK_IntegerInRange3_free; asn_struct_print_f OK_IntegerInRange3_print; asn_constr_check_f OK_IntegerInRange3_constraint; ber_type_decoder_f OK_IntegerInRange3_decode_ber; der_type_encoder_f OK_IntegerInRange3_encode_der; xer_type_decoder_f OK_IntegerInRange3_decode_xer; xer_type_encoder_f OK_IntegerInRange3_encode_xer; per_type_decoder_f OK_IntegerInRange3_decode_uper; per_type_encoder_f OK_IntegerInRange3_encode_uper; /*** <<< CODE [OK-IntegerInRange3] >>> ***/ int OK_IntegerInRange3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if((value >= (-2147483647L - 1) && value <= 2147483647)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void OK_IntegerInRange3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; td->specifics = asn_DEF_NativeInteger.specifics; } void OK_IntegerInRange3_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { OK_IntegerInRange3_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int OK_IntegerInRange3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange3_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t OK_IntegerInRange3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { OK_IntegerInRange3_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t OK_IntegerInRange3_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange3_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t OK_IntegerInRange3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { OK_IntegerInRange3_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t OK_IntegerInRange3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange3_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t OK_IntegerInRange3_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { OK_IntegerInRange3_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t OK_IntegerInRange3_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { OK_IntegerInRange3_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } /*** <<< CTDEFS [OK-IntegerInRange3] >>> ***/ static asn_per_constraints_t asn_PER_type_OK_IntegerInRange3_constr_1 GCC_NOTUSED = { { APC_CONSTRAINED, 32, -1, (-2147483647L - 1), 2147483647 } /* (-2147483648..2147483647) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; /*** <<< STAT-DEFS [OK-IntegerInRange3] >>> ***/ static const ber_tlv_tag_t asn_DEF_OK_IntegerInRange3_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange3 = { "OK-IntegerInRange3", "OK-IntegerInRange3", OK_IntegerInRange3_free, OK_IntegerInRange3_print, OK_IntegerInRange3_constraint, OK_IntegerInRange3_decode_ber, OK_IntegerInRange3_encode_der, OK_IntegerInRange3_decode_xer, OK_IntegerInRange3_encode_xer, OK_IntegerInRange3_decode_uper, OK_IntegerInRange3_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_OK_IntegerInRange3_tags_1, sizeof(asn_DEF_OK_IntegerInRange3_tags_1) /sizeof(asn_DEF_OK_IntegerInRange3_tags_1[0]), /* 1 */ asn_DEF_OK_IntegerInRange3_tags_1, /* Same as above */ sizeof(asn_DEF_OK_IntegerInRange3_tags_1) /sizeof(asn_DEF_OK_IntegerInRange3_tags_1[0]), /* 1 */ &asn_PER_type_OK_IntegerInRange3_constr_1, 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [OK-IntegerInRange4] >>> ***/ #include /*** <<< TYPE-DECLS [OK-IntegerInRange4] >>> ***/ typedef long OK_IntegerInRange4_t; /*** <<< FUNC-DECLS [OK-IntegerInRange4] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange4; asn_struct_free_f OK_IntegerInRange4_free; asn_struct_print_f OK_IntegerInRange4_print; asn_constr_check_f OK_IntegerInRange4_constraint; ber_type_decoder_f OK_IntegerInRange4_decode_ber; der_type_encoder_f OK_IntegerInRange4_encode_der; xer_type_decoder_f OK_IntegerInRange4_decode_xer; xer_type_encoder_f OK_IntegerInRange4_encode_xer; per_type_decoder_f OK_IntegerInRange4_decode_uper; per_type_encoder_f OK_IntegerInRange4_encode_uper; /*** <<< CODE [OK-IntegerInRange4] >>> ***/ int OK_IntegerInRange4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if(((value == (-2147483647L - 1)) || (value == 2147483647))) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void OK_IntegerInRange4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; td->specifics = asn_DEF_NativeInteger.specifics; } void OK_IntegerInRange4_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { OK_IntegerInRange4_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int OK_IntegerInRange4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange4_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t OK_IntegerInRange4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { OK_IntegerInRange4_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t OK_IntegerInRange4_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange4_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t OK_IntegerInRange4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { OK_IntegerInRange4_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t OK_IntegerInRange4_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange4_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t OK_IntegerInRange4_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { OK_IntegerInRange4_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t OK_IntegerInRange4_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { OK_IntegerInRange4_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } /*** <<< CTDEFS [OK-IntegerInRange4] >>> ***/ static asn_per_constraints_t asn_PER_type_OK_IntegerInRange4_constr_1 GCC_NOTUSED = { { APC_CONSTRAINED, 32, -1, (-2147483647L - 1), 2147483647 } /* (-2147483648..2147483647) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; /*** <<< STAT-DEFS [OK-IntegerInRange4] >>> ***/ static const ber_tlv_tag_t asn_DEF_OK_IntegerInRange4_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange4 = { "OK-IntegerInRange4", "OK-IntegerInRange4", OK_IntegerInRange4_free, OK_IntegerInRange4_print, OK_IntegerInRange4_constraint, OK_IntegerInRange4_decode_ber, OK_IntegerInRange4_encode_der, OK_IntegerInRange4_decode_xer, OK_IntegerInRange4_encode_xer, OK_IntegerInRange4_decode_uper, OK_IntegerInRange4_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_OK_IntegerInRange4_tags_1, sizeof(asn_DEF_OK_IntegerInRange4_tags_1) /sizeof(asn_DEF_OK_IntegerInRange4_tags_1[0]), /* 1 */ asn_DEF_OK_IntegerInRange4_tags_1, /* Same as above */ sizeof(asn_DEF_OK_IntegerInRange4_tags_1) /sizeof(asn_DEF_OK_IntegerInRange4_tags_1[0]), /* 1 */ &asn_PER_type_OK_IntegerInRange4_constr_1, 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [OK-IntegerInRange5] >>> ***/ #include /*** <<< TYPE-DECLS [OK-IntegerInRange5] >>> ***/ typedef long OK_IntegerInRange5_t; /*** <<< FUNC-DECLS [OK-IntegerInRange5] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange5; asn_struct_free_f OK_IntegerInRange5_free; asn_struct_print_f OK_IntegerInRange5_print; asn_constr_check_f OK_IntegerInRange5_constraint; ber_type_decoder_f OK_IntegerInRange5_decode_ber; der_type_encoder_f OK_IntegerInRange5_encode_der; xer_type_decoder_f OK_IntegerInRange5_decode_xer; xer_type_encoder_f OK_IntegerInRange5_encode_xer; per_type_decoder_f OK_IntegerInRange5_decode_uper; per_type_encoder_f OK_IntegerInRange5_encode_uper; /*** <<< CODE [OK-IntegerInRange5] >>> ***/ int OK_IntegerInRange5_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if(((value == (-2147483647L - 1)) || (value == 2147483647))) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void OK_IntegerInRange5_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; td->specifics = asn_DEF_NativeInteger.specifics; } void OK_IntegerInRange5_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { OK_IntegerInRange5_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int OK_IntegerInRange5_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange5_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t OK_IntegerInRange5_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { OK_IntegerInRange5_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t OK_IntegerInRange5_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange5_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t OK_IntegerInRange5_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { OK_IntegerInRange5_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t OK_IntegerInRange5_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { OK_IntegerInRange5_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t OK_IntegerInRange5_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { OK_IntegerInRange5_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t OK_IntegerInRange5_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { OK_IntegerInRange5_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } /*** <<< CTDEFS [OK-IntegerInRange5] >>> ***/ static asn_per_constraints_t asn_PER_type_OK_IntegerInRange5_constr_1 GCC_NOTUSED = { { APC_CONSTRAINED | APC_EXTENSIBLE, 32, -1, (-2147483647L - 1), 2147483647 } /* (-2147483648..2147483647,...) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; /*** <<< STAT-DEFS [OK-IntegerInRange5] >>> ***/ static const ber_tlv_tag_t asn_DEF_OK_IntegerInRange5_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange5 = { "OK-IntegerInRange5", "OK-IntegerInRange5", OK_IntegerInRange5_free, OK_IntegerInRange5_print, OK_IntegerInRange5_constraint, OK_IntegerInRange5_decode_ber, OK_IntegerInRange5_encode_der, OK_IntegerInRange5_decode_xer, OK_IntegerInRange5_encode_xer, OK_IntegerInRange5_decode_uper, OK_IntegerInRange5_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_OK_IntegerInRange5_tags_1, sizeof(asn_DEF_OK_IntegerInRange5_tags_1) /sizeof(asn_DEF_OK_IntegerInRange5_tags_1[0]), /* 1 */ asn_DEF_OK_IntegerInRange5_tags_1, /* Same as above */ sizeof(asn_DEF_OK_IntegerInRange5_tags_1) /sizeof(asn_DEF_OK_IntegerInRange5_tags_1[0]), /* 1 */ &asn_PER_type_OK_IntegerInRange5_constr_1, 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [NO-IntegerInRange6] >>> ***/ #include /*** <<< TYPE-DECLS [NO-IntegerInRange6] >>> ***/ typedef unsigned long NO_IntegerInRange6_t; /*** <<< FUNC-DECLS [NO-IntegerInRange6] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_NO_IntegerInRange6; asn_struct_free_f NO_IntegerInRange6_free; asn_struct_print_f NO_IntegerInRange6_print; asn_constr_check_f NO_IntegerInRange6_constraint; ber_type_decoder_f NO_IntegerInRange6_decode_ber; der_type_encoder_f NO_IntegerInRange6_encode_der; xer_type_decoder_f NO_IntegerInRange6_decode_xer; xer_type_encoder_f NO_IntegerInRange6_encode_xer; per_type_decoder_f NO_IntegerInRange6_decode_uper; per_type_encoder_f NO_IntegerInRange6_encode_uper; /*** <<< CODE [NO-IntegerInRange6] >>> ***/ int NO_IntegerInRange6_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } /* Constraint check succeeded */ return 0; } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void NO_IntegerInRange6_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; /* td->specifics = asn_DEF_NativeInteger.specifics; // Defined explicitly */ } void NO_IntegerInRange6_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { NO_IntegerInRange6_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int NO_IntegerInRange6_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerInRange6_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t NO_IntegerInRange6_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { NO_IntegerInRange6_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t NO_IntegerInRange6_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerInRange6_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t NO_IntegerInRange6_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { NO_IntegerInRange6_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t NO_IntegerInRange6_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerInRange6_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t NO_IntegerInRange6_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { NO_IntegerInRange6_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t NO_IntegerInRange6_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { NO_IntegerInRange6_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } /*** <<< CTDEFS [NO-IntegerInRange6] >>> ***/ static asn_per_constraints_t asn_PER_type_NO_IntegerInRange6_constr_1 GCC_NOTUSED = { { APC_CONSTRAINED, 32, -1, 0, 4294967295 } /* (0..4294967295) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; /*** <<< STAT-DEFS [NO-IntegerInRange6] >>> ***/ static const asn_INTEGER_specifics_t asn_SPC_NO_IntegerInRange6_specs_1 = { 0, 0, 0, 0, 0, 0, /* Native long size */ 1 /* Unsigned representation */ }; static const ber_tlv_tag_t asn_DEF_NO_IntegerInRange6_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_NO_IntegerInRange6 = { "NO-IntegerInRange6", "NO-IntegerInRange6", NO_IntegerInRange6_free, NO_IntegerInRange6_print, NO_IntegerInRange6_constraint, NO_IntegerInRange6_decode_ber, NO_IntegerInRange6_encode_der, NO_IntegerInRange6_decode_xer, NO_IntegerInRange6_encode_xer, NO_IntegerInRange6_decode_uper, NO_IntegerInRange6_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerInRange6_tags_1, sizeof(asn_DEF_NO_IntegerInRange6_tags_1) /sizeof(asn_DEF_NO_IntegerInRange6_tags_1[0]), /* 1 */ asn_DEF_NO_IntegerInRange6_tags_1, /* Same as above */ sizeof(asn_DEF_NO_IntegerInRange6_tags_1) /sizeof(asn_DEF_NO_IntegerInRange6_tags_1[0]), /* 1 */ &asn_PER_type_NO_IntegerInRange6_constr_1, 0, 0, /* No members */ &asn_SPC_NO_IntegerInRange6_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [CN-IntegerEnumerated1] >>> ***/ #include /*** <<< DEPS [CN-IntegerEnumerated1] >>> ***/ typedef enum CN_IntegerEnumerated1 { CN_IntegerEnumerated1_a = 1, CN_IntegerEnumerated1_b = 2 } e_CN_IntegerEnumerated1; /*** <<< TYPE-DECLS [CN-IntegerEnumerated1] >>> ***/ typedef long CN_IntegerEnumerated1_t; /*** <<< FUNC-DECLS [CN-IntegerEnumerated1] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_CN_IntegerEnumerated1; asn_struct_free_f CN_IntegerEnumerated1_free; asn_struct_print_f CN_IntegerEnumerated1_print; asn_constr_check_f CN_IntegerEnumerated1_constraint; ber_type_decoder_f CN_IntegerEnumerated1_decode_ber; der_type_encoder_f CN_IntegerEnumerated1_encode_der; xer_type_decoder_f CN_IntegerEnumerated1_decode_xer; xer_type_encoder_f CN_IntegerEnumerated1_encode_xer; per_type_decoder_f CN_IntegerEnumerated1_decode_uper; per_type_encoder_f CN_IntegerEnumerated1_encode_uper; /*** <<< CODE [CN-IntegerEnumerated1] >>> ***/ int CN_IntegerEnumerated1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_NativeInteger.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void CN_IntegerEnumerated1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; td->specifics = asn_DEF_NativeInteger.specifics; } void CN_IntegerEnumerated1_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { CN_IntegerEnumerated1_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int CN_IntegerEnumerated1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerEnumerated1_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t CN_IntegerEnumerated1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { CN_IntegerEnumerated1_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t CN_IntegerEnumerated1_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerEnumerated1_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t CN_IntegerEnumerated1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { CN_IntegerEnumerated1_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t CN_IntegerEnumerated1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { CN_IntegerEnumerated1_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t CN_IntegerEnumerated1_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { CN_IntegerEnumerated1_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t CN_IntegerEnumerated1_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { CN_IntegerEnumerated1_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } /*** <<< STAT-DEFS [CN-IntegerEnumerated1] >>> ***/ static const ber_tlv_tag_t asn_DEF_CN_IntegerEnumerated1_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_CN_IntegerEnumerated1 = { "CN-IntegerEnumerated1", "CN-IntegerEnumerated1", CN_IntegerEnumerated1_free, CN_IntegerEnumerated1_print, CN_IntegerEnumerated1_constraint, CN_IntegerEnumerated1_decode_ber, CN_IntegerEnumerated1_encode_der, CN_IntegerEnumerated1_decode_xer, CN_IntegerEnumerated1_encode_xer, CN_IntegerEnumerated1_decode_uper, CN_IntegerEnumerated1_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_CN_IntegerEnumerated1_tags_1, sizeof(asn_DEF_CN_IntegerEnumerated1_tags_1) /sizeof(asn_DEF_CN_IntegerEnumerated1_tags_1[0]), /* 1 */ asn_DEF_CN_IntegerEnumerated1_tags_1, /* Same as above */ sizeof(asn_DEF_CN_IntegerEnumerated1_tags_1) /sizeof(asn_DEF_CN_IntegerEnumerated1_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* Defined elsewhere */ 0 /* No specifics */ }; /*** <<< INCLUDES [NO-IntegerEnumerated2] >>> ***/ #include /*** <<< DEPS [NO-IntegerEnumerated2] >>> ***/ typedef enum NO_IntegerEnumerated2 { NO_IntegerEnumerated2_a = 1, NO_IntegerEnumerated2_b = 3000000000 } e_NO_IntegerEnumerated2; /*** <<< TYPE-DECLS [NO-IntegerEnumerated2] >>> ***/ typedef INTEGER_t NO_IntegerEnumerated2_t; /*** <<< FUNC-DECLS [NO-IntegerEnumerated2] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_NO_IntegerEnumerated2; asn_struct_free_f NO_IntegerEnumerated2_free; asn_struct_print_f NO_IntegerEnumerated2_print; asn_constr_check_f NO_IntegerEnumerated2_constraint; ber_type_decoder_f NO_IntegerEnumerated2_decode_ber; der_type_encoder_f NO_IntegerEnumerated2_encode_der; xer_type_decoder_f NO_IntegerEnumerated2_decode_xer; xer_type_encoder_f NO_IntegerEnumerated2_encode_xer; per_type_decoder_f NO_IntegerEnumerated2_decode_uper; per_type_encoder_f NO_IntegerEnumerated2_encode_uper; /*** <<< CODE [NO-IntegerEnumerated2] >>> ***/ int NO_IntegerEnumerated2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_INTEGER.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using INTEGER, * so here we adjust the DEF accordingly. */ static void NO_IntegerEnumerated2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_INTEGER.free_struct; td->print_struct = asn_DEF_INTEGER.print_struct; td->check_constraints = asn_DEF_INTEGER.check_constraints; td->ber_decoder = asn_DEF_INTEGER.ber_decoder; td->der_encoder = asn_DEF_INTEGER.der_encoder; td->xer_decoder = asn_DEF_INTEGER.xer_decoder; td->xer_encoder = asn_DEF_INTEGER.xer_encoder; td->uper_decoder = asn_DEF_INTEGER.uper_decoder; td->uper_encoder = asn_DEF_INTEGER.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; td->elements = asn_DEF_INTEGER.elements; td->elements_count = asn_DEF_INTEGER.elements_count; td->specifics = asn_DEF_INTEGER.specifics; } void NO_IntegerEnumerated2_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { NO_IntegerEnumerated2_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int NO_IntegerEnumerated2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerEnumerated2_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t NO_IntegerEnumerated2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { NO_IntegerEnumerated2_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t NO_IntegerEnumerated2_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerEnumerated2_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t NO_IntegerEnumerated2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { NO_IntegerEnumerated2_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t NO_IntegerEnumerated2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { NO_IntegerEnumerated2_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } asn_dec_rval_t NO_IntegerEnumerated2_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { NO_IntegerEnumerated2_1_inherit_TYPE_descriptor(td); return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data); } asn_enc_rval_t NO_IntegerEnumerated2_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *structure, asn_per_outp_t *per_out) { NO_IntegerEnumerated2_1_inherit_TYPE_descriptor(td); return td->uper_encoder(td, constraints, structure, per_out); } /*** <<< STAT-DEFS [NO-IntegerEnumerated2] >>> ***/ static const ber_tlv_tag_t asn_DEF_NO_IntegerEnumerated2_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_NO_IntegerEnumerated2 = { "NO-IntegerEnumerated2", "NO-IntegerEnumerated2", NO_IntegerEnumerated2_free, NO_IntegerEnumerated2_print, NO_IntegerEnumerated2_constraint, NO_IntegerEnumerated2_decode_ber, NO_IntegerEnumerated2_encode_der, NO_IntegerEnumerated2_decode_xer, NO_IntegerEnumerated2_encode_xer, NO_IntegerEnumerated2_decode_uper, NO_IntegerEnumerated2_encode_uper, 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerEnumerated2_tags_1, sizeof(asn_DEF_NO_IntegerEnumerated2_tags_1) /sizeof(asn_DEF_NO_IntegerEnumerated2_tags_1[0]), /* 1 */ asn_DEF_NO_IntegerEnumerated2_tags_1, /* Same as above */ sizeof(asn_DEF_NO_IntegerEnumerated2_tags_1) /sizeof(asn_DEF_NO_IntegerEnumerated2_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* Defined elsewhere */ 0 /* No specifics */ }; asn1c-0.9.28+dfsg/tests/01-empty-OK.asn10000644000000000000000000000043713065714043016054 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .1 ModuleTestEmpty { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 1 } DEFINITIONS ::= BEGIN END asn1c-0.9.28+dfsg/tests/36-indirect-choice-SE.asn10000644000000000000000000000070013065714043017746 0ustar rootroot -- SE: Semantic error -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .36 ModuleTestIndirectChoiceError { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 36 } DEFINITIONS ::= BEGIN T ::= CHOICE { t-a INTEGER, t-b OCTET STRING, t-c Choice } Choice ::= CHOICE { -- One more level c-a OCTET STRING, c-b INTEGER } END asn1c-0.9.28+dfsg/tests/72-same-names-OK.asn10000644000000000000000000000161113065714043016747 0ustar rootroot -- OK: Everything is Fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .72 ModuleTestSameNames { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 72 } DEFINITIONS ::= BEGIN /* * This test checks whether different top-level types containing * similarly named inner types may be compiled by the target language * compiler successfully. This was not the case before asn1c-0.9.11. */ Type ::= SET OF SEQUENCE { t1 Type1, t2 Type2 } Type1 ::= SEQUENCE { one-name CHOICE { another-name SEQUENCE { a INTEGER, b INTEGER } } } Type2 ::= CHOICE { one-name SEQUENCE { another-name SEQUENCE { a BIT STRING { one(0) } SIZE(2), b INTEGER } }, two-name SET { another-name SEQUENCE { a BIT STRING { one(0) } SIZE(2), b INTEGER } } } END asn1c-0.9.28+dfsg/tests/02-garbage-NP.asn10000644000000000000000000000051613065714043016311 0ustar rootroot -- NP: Non-parseable. -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .2 ModuleTestGarbage { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 2 } DEFINITIONS ::= BEGIN -- must fail on the next line -- some garbage END asn1c-0.9.28+dfsg/tests/130-enum-OK.asn10000644000000000000000000000051413065714043015741 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .130 ModuleTestEnum1 { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 130 } DEFINITIONS ::= BEGIN A ::= ENUMERATED {a(-5), b(-4),..., c} END asn1c-0.9.28+dfsg/tests/52-constraint-SE.asn10000644000000000000000000000052213065714043017101 0ustar rootroot -- SE: Semantic error -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .52 ModuleInvalidConstraintApplicability1 { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 52 } DEFINITIONS ::= BEGIN Int ::= INTEGER (SIZE(0..4)) END asn1c-0.9.28+dfsg/tests/34-class-OK.asn1.-EF0000644000000000000000000000157313065714043016401 0ustar rootrootModuleTestClassSimple { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 34 } DEFINITIONS IMPLICIT TAGS ::= BEGIN EXTENSION ::= CLASS { &id [PRIVATE 0] INTEGER UNIQUE, &ExtnType } WITH SYNTAX { SYNTAX &ExtnType IDENTIFIED BY &id } Ext1 ::= SEQUENCE { extnId EXTENSION.&id } EXTENSION-ATTRIBUTE ::= CLASS { &id INTEGER (0..256) UNIQUE, &Type ANY } WITH SYNTAX {&Type IDENTIFIED BY &id} terminal-type EXTENSION-ATTRIBUTE ::= {TerminalType IDENTIFIED BY 23} TerminalType ::= INTEGER { terminal(0) } ExtensionAttribute ::= SEQUENCE { extension-attribute-type [0] IMPLICIT EXTENSION-ATTRIBUTE.&id ({ExtensionAttributeTable}), extension-attribute-value [1] EXPLICIT EXTENSION-ATTRIBUTE.&Type ({ExtensionAttributeTable}{@extension-attribute-type}) } ub-extension-attributes INTEGER ::= 256 END asn1c-0.9.28+dfsg/tests/00-empty-OK.asn10000644000000000000000000000005213065714043016044 0ustar rootrootModuleTestEmpty DEFINITIONS ::= BEGIN END asn1c-0.9.28+dfsg/tests/81-type-default-OK.asn10000644000000000000000000000060213065714043017323 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .81 ModuleTestTypeDefault1 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 81 } DEFINITIONS ::= BEGIN Type ::= SEQUENCE { other SEQUENCE { member-1 INTEGER } DEFAULT { member-1 5 } } END asn1c-0.9.28+dfsg/tests/65-multi-tag-OK.asn1.-Pfnative-types0000644000000000000000000007171413065714043021633 0ustar rootroot /*** <<< INCLUDES [T1] >>> ***/ #include "T2.h" /*** <<< TYPE-DECLS [T1] >>> ***/ typedef T2_t T1_t; /*** <<< FUNC-DECLS [T1] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_T1; asn_struct_free_f T1_free; asn_struct_print_f T1_print; asn_constr_check_f T1_constraint; ber_type_decoder_f T1_decode_ber; der_type_encoder_f T1_encode_der; xer_type_decoder_f T1_decode_xer; xer_type_encoder_f T1_encode_xer; /*** <<< CODE [T1] >>> ***/ int T1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_T2.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using T2, * so here we adjust the DEF accordingly. */ static void T1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_T2.free_struct; td->print_struct = asn_DEF_T2.print_struct; td->check_constraints = asn_DEF_T2.check_constraints; td->ber_decoder = asn_DEF_T2.ber_decoder; td->der_encoder = asn_DEF_T2.der_encoder; td->xer_decoder = asn_DEF_T2.xer_decoder; td->xer_encoder = asn_DEF_T2.xer_encoder; td->uper_decoder = asn_DEF_T2.uper_decoder; td->uper_encoder = asn_DEF_T2.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_T2.per_constraints; td->elements = asn_DEF_T2.elements; td->elements_count = asn_DEF_T2.elements_count; td->specifics = asn_DEF_T2.specifics; } void T1_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { T1_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int T1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { T1_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t T1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { T1_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t T1_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { T1_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t T1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { T1_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t T1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { T1_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [T1] >>> ***/ static const ber_tlv_tag_t asn_DEF_T1_tags_1[] = { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), (ASN_TAG_CLASS_CONTEXT | (3 << 2)), (ASN_TAG_CLASS_CONTEXT | (4 << 2)), (ASN_TAG_CLASS_CONTEXT | (6 << 2)) }; static const ber_tlv_tag_t asn_DEF_T1_all_tags_1[] = { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), (ASN_TAG_CLASS_CONTEXT | (3 << 2)), (ASN_TAG_CLASS_CONTEXT | (4 << 2)), (ASN_TAG_CLASS_CONTEXT | (5 << 2)), (ASN_TAG_CLASS_CONTEXT | (6 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (9 << 2)) }; asn_TYPE_descriptor_t asn_DEF_T1 = { "T1", "T1", T1_free, T1_print, T1_constraint, T1_decode_ber, T1_encode_der, T1_decode_xer, T1_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T1_tags_1, sizeof(asn_DEF_T1_tags_1) /sizeof(asn_DEF_T1_tags_1[0]), /* 4 */ asn_DEF_T1_all_tags_1, sizeof(asn_DEF_T1_all_tags_1) /sizeof(asn_DEF_T1_all_tags_1[0]), /* 6 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [T2] >>> ***/ #include "T3.h" /*** <<< TYPE-DECLS [T2] >>> ***/ typedef T3_t T2_t; /*** <<< FUNC-DECLS [T2] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_T2; asn_struct_free_f T2_free; asn_struct_print_f T2_print; asn_constr_check_f T2_constraint; ber_type_decoder_f T2_decode_ber; der_type_encoder_f T2_encode_der; xer_type_decoder_f T2_decode_xer; xer_type_encoder_f T2_encode_xer; /*** <<< CODE [T2] >>> ***/ int T2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_T3.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using T3, * so here we adjust the DEF accordingly. */ static void T2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_T3.free_struct; td->print_struct = asn_DEF_T3.print_struct; td->check_constraints = asn_DEF_T3.check_constraints; td->ber_decoder = asn_DEF_T3.ber_decoder; td->der_encoder = asn_DEF_T3.der_encoder; td->xer_decoder = asn_DEF_T3.xer_decoder; td->xer_encoder = asn_DEF_T3.xer_encoder; td->uper_decoder = asn_DEF_T3.uper_decoder; td->uper_encoder = asn_DEF_T3.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_T3.per_constraints; td->elements = asn_DEF_T3.elements; td->elements_count = asn_DEF_T3.elements_count; td->specifics = asn_DEF_T3.specifics; } void T2_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { T2_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int T2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { T2_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t T2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { T2_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t T2_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { T2_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t T2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { T2_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t T2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { T2_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [T2] >>> ***/ static const ber_tlv_tag_t asn_DEF_T2_tags_1[] = { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), (ASN_TAG_CLASS_CONTEXT | (4 << 2)), (ASN_TAG_CLASS_CONTEXT | (6 << 2)) }; static const ber_tlv_tag_t asn_DEF_T2_all_tags_1[] = { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), (ASN_TAG_CLASS_CONTEXT | (4 << 2)), (ASN_TAG_CLASS_CONTEXT | (5 << 2)), (ASN_TAG_CLASS_CONTEXT | (6 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (9 << 2)) }; asn_TYPE_descriptor_t asn_DEF_T2 = { "T2", "T2", T2_free, T2_print, T2_constraint, T2_decode_ber, T2_encode_der, T2_decode_xer, T2_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T2_tags_1, sizeof(asn_DEF_T2_tags_1) /sizeof(asn_DEF_T2_tags_1[0]), /* 3 */ asn_DEF_T2_all_tags_1, sizeof(asn_DEF_T2_all_tags_1) /sizeof(asn_DEF_T2_all_tags_1[0]), /* 5 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [T3] >>> ***/ #include "T4.h" /*** <<< TYPE-DECLS [T3] >>> ***/ typedef T4_t T3_t; /*** <<< FUNC-DECLS [T3] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_T3; asn_struct_free_f T3_free; asn_struct_print_f T3_print; asn_constr_check_f T3_constraint; ber_type_decoder_f T3_decode_ber; der_type_encoder_f T3_encode_der; xer_type_decoder_f T3_decode_xer; xer_type_encoder_f T3_encode_xer; /*** <<< CODE [T3] >>> ***/ int T3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_T4.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using T4, * so here we adjust the DEF accordingly. */ static void T3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_T4.free_struct; td->print_struct = asn_DEF_T4.print_struct; td->check_constraints = asn_DEF_T4.check_constraints; td->ber_decoder = asn_DEF_T4.ber_decoder; td->der_encoder = asn_DEF_T4.der_encoder; td->xer_decoder = asn_DEF_T4.xer_decoder; td->xer_encoder = asn_DEF_T4.xer_encoder; td->uper_decoder = asn_DEF_T4.uper_decoder; td->uper_encoder = asn_DEF_T4.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_T4.per_constraints; td->elements = asn_DEF_T4.elements; td->elements_count = asn_DEF_T4.elements_count; td->specifics = asn_DEF_T4.specifics; } void T3_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { T3_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int T3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { T3_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t T3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { T3_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t T3_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { T3_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t T3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { T3_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t T3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { T3_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [T3] >>> ***/ static const ber_tlv_tag_t asn_DEF_T3_tags_1[] = { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), (ASN_TAG_CLASS_CONTEXT | (6 << 2)) }; static const ber_tlv_tag_t asn_DEF_T3_all_tags_1[] = { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), (ASN_TAG_CLASS_CONTEXT | (5 << 2)), (ASN_TAG_CLASS_CONTEXT | (6 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (9 << 2)) }; asn_TYPE_descriptor_t asn_DEF_T3 = { "T3", "T3", T3_free, T3_print, T3_constraint, T3_decode_ber, T3_encode_der, T3_decode_xer, T3_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T3_tags_1, sizeof(asn_DEF_T3_tags_1) /sizeof(asn_DEF_T3_tags_1[0]), /* 2 */ asn_DEF_T3_all_tags_1, sizeof(asn_DEF_T3_all_tags_1) /sizeof(asn_DEF_T3_all_tags_1[0]), /* 4 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [T4] >>> ***/ #include "T5.h" /*** <<< TYPE-DECLS [T4] >>> ***/ typedef T5_t T4_t; /*** <<< FUNC-DECLS [T4] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_T4; asn_struct_free_f T4_free; asn_struct_print_f T4_print; asn_constr_check_f T4_constraint; ber_type_decoder_f T4_decode_ber; der_type_encoder_f T4_encode_der; xer_type_decoder_f T4_decode_xer; xer_type_encoder_f T4_encode_xer; /*** <<< CODE [T4] >>> ***/ int T4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_T5.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using T5, * so here we adjust the DEF accordingly. */ static void T4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_T5.free_struct; td->print_struct = asn_DEF_T5.print_struct; td->check_constraints = asn_DEF_T5.check_constraints; td->ber_decoder = asn_DEF_T5.ber_decoder; td->der_encoder = asn_DEF_T5.der_encoder; td->xer_decoder = asn_DEF_T5.xer_decoder; td->xer_encoder = asn_DEF_T5.xer_encoder; td->uper_decoder = asn_DEF_T5.uper_decoder; td->uper_encoder = asn_DEF_T5.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_T5.per_constraints; td->elements = asn_DEF_T5.elements; td->elements_count = asn_DEF_T5.elements_count; td->specifics = asn_DEF_T5.specifics; } void T4_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { T4_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int T4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { T4_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t T4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { T4_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t T4_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { T4_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t T4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { T4_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t T4_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { T4_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [T4] >>> ***/ static const ber_tlv_tag_t asn_DEF_T4_tags_1[] = { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), (ASN_TAG_CLASS_CONTEXT | (6 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (9 << 2)) }; asn_TYPE_descriptor_t asn_DEF_T4 = { "T4", "T4", T4_free, T4_print, T4_constraint, T4_decode_ber, T4_encode_der, T4_decode_xer, T4_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T4_tags_1, sizeof(asn_DEF_T4_tags_1) /sizeof(asn_DEF_T4_tags_1[0]) - 1, /* 2 */ asn_DEF_T4_tags_1, /* Same as above */ sizeof(asn_DEF_T4_tags_1) /sizeof(asn_DEF_T4_tags_1[0]), /* 3 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [T5] >>> ***/ #include "T6.h" /*** <<< TYPE-DECLS [T5] >>> ***/ typedef T6_t T5_t; /*** <<< FUNC-DECLS [T5] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_T5; asn_struct_free_f T5_free; asn_struct_print_f T5_print; asn_constr_check_f T5_constraint; ber_type_decoder_f T5_decode_ber; der_type_encoder_f T5_encode_der; xer_type_decoder_f T5_decode_xer; xer_type_encoder_f T5_encode_xer; /*** <<< CODE [T5] >>> ***/ int T5_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_T6.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using T6, * so here we adjust the DEF accordingly. */ static void T5_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_T6.free_struct; td->print_struct = asn_DEF_T6.print_struct; td->check_constraints = asn_DEF_T6.check_constraints; td->ber_decoder = asn_DEF_T6.ber_decoder; td->der_encoder = asn_DEF_T6.der_encoder; td->xer_decoder = asn_DEF_T6.xer_decoder; td->xer_encoder = asn_DEF_T6.xer_encoder; td->uper_decoder = asn_DEF_T6.uper_decoder; td->uper_encoder = asn_DEF_T6.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_T6.per_constraints; td->elements = asn_DEF_T6.elements; td->elements_count = asn_DEF_T6.elements_count; td->specifics = asn_DEF_T6.specifics; } void T5_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { T5_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int T5_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { T5_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t T5_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { T5_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t T5_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { T5_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t T5_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { T5_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t T5_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { T5_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [T5] >>> ***/ static const ber_tlv_tag_t asn_DEF_T5_tags_1[] = { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (9 << 2)) }; asn_TYPE_descriptor_t asn_DEF_T5 = { "T5", "T5", T5_free, T5_print, T5_constraint, T5_decode_ber, T5_encode_der, T5_decode_xer, T5_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T5_tags_1, sizeof(asn_DEF_T5_tags_1) /sizeof(asn_DEF_T5_tags_1[0]) - 1, /* 1 */ asn_DEF_T5_tags_1, /* Same as above */ sizeof(asn_DEF_T5_tags_1) /sizeof(asn_DEF_T5_tags_1[0]), /* 2 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [T6] >>> ***/ #include /*** <<< TYPE-DECLS [T6] >>> ***/ typedef double T6_t; /*** <<< FUNC-DECLS [T6] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_T6; asn_struct_free_f T6_free; asn_struct_print_f T6_print; asn_constr_check_f T6_constraint; ber_type_decoder_f T6_decode_ber; der_type_encoder_f T6_encode_der; xer_type_decoder_f T6_decode_xer; xer_type_encoder_f T6_encode_xer; /*** <<< CODE [T6] >>> ***/ int T6_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_NativeReal.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using NativeReal, * so here we adjust the DEF accordingly. */ static void T6_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeReal.free_struct; td->print_struct = asn_DEF_NativeReal.print_struct; td->check_constraints = asn_DEF_NativeReal.check_constraints; td->ber_decoder = asn_DEF_NativeReal.ber_decoder; td->der_encoder = asn_DEF_NativeReal.der_encoder; td->xer_decoder = asn_DEF_NativeReal.xer_decoder; td->xer_encoder = asn_DEF_NativeReal.xer_encoder; td->uper_decoder = asn_DEF_NativeReal.uper_decoder; td->uper_encoder = asn_DEF_NativeReal.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeReal.per_constraints; td->elements = asn_DEF_NativeReal.elements; td->elements_count = asn_DEF_NativeReal.elements_count; td->specifics = asn_DEF_NativeReal.specifics; } void T6_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { T6_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int T6_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { T6_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t T6_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { T6_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t T6_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { T6_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t T6_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { T6_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t T6_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { T6_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [T6] >>> ***/ static const ber_tlv_tag_t asn_DEF_T6_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (9 << 2)) }; asn_TYPE_descriptor_t asn_DEF_T6 = { "T6", "T6", T6_free, T6_print, T6_constraint, T6_decode_ber, T6_encode_der, T6_decode_xer, T6_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T6_tags_1, sizeof(asn_DEF_T6_tags_1) /sizeof(asn_DEF_T6_tags_1[0]), /* 1 */ asn_DEF_T6_tags_1, /* Same as above */ sizeof(asn_DEF_T6_tags_1) /sizeof(asn_DEF_T6_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [T] >>> ***/ #include "Ts.h" /*** <<< TYPE-DECLS [T] >>> ***/ typedef Ts_t T_t; /*** <<< FUNC-DECLS [T] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_T; asn_struct_free_f T_free; asn_struct_print_f T_print; asn_constr_check_f T_constraint; ber_type_decoder_f T_decode_ber; der_type_encoder_f T_encode_der; xer_type_decoder_f T_decode_xer; xer_type_encoder_f T_encode_xer; /*** <<< CODE [T] >>> ***/ int T_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_Ts.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using Ts, * so here we adjust the DEF accordingly. */ static void T_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_Ts.free_struct; td->print_struct = asn_DEF_Ts.print_struct; td->check_constraints = asn_DEF_Ts.check_constraints; td->ber_decoder = asn_DEF_Ts.ber_decoder; td->der_encoder = asn_DEF_Ts.der_encoder; td->xer_decoder = asn_DEF_Ts.xer_decoder; td->xer_encoder = asn_DEF_Ts.xer_encoder; td->uper_decoder = asn_DEF_Ts.uper_decoder; td->uper_encoder = asn_DEF_Ts.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Ts.per_constraints; td->elements = asn_DEF_Ts.elements; td->elements_count = asn_DEF_Ts.elements_count; td->specifics = asn_DEF_Ts.specifics; } void T_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { T_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int T_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { T_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t T_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { T_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t T_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { T_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t T_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { T_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t T_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { T_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [T] >>> ***/ static const ber_tlv_tag_t asn_DEF_T_tags_1[] = { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), (ASN_TAG_CLASS_CONTEXT | (123 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; asn_TYPE_descriptor_t asn_DEF_T = { "T", "T", T_free, T_print, T_constraint, T_decode_ber, T_encode_der, T_decode_xer, T_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T_tags_1, sizeof(asn_DEF_T_tags_1) /sizeof(asn_DEF_T_tags_1[0]) - 2, /* 1 */ asn_DEF_T_tags_1, /* Same as above */ sizeof(asn_DEF_T_tags_1) /sizeof(asn_DEF_T_tags_1[0]), /* 3 */ 0, /* No PER visible constraints */ 0, 0, /* Defined elsewhere */ 0 /* No specifics */ }; /*** <<< INCLUDES [Ts] >>> ***/ #include "T2.h" #include "T3.h" #include /*** <<< TYPE-DECLS [Ts] >>> ***/ typedef struct Ts { T2_t m1; T3_t *m2 /* OPTIONAL */; T3_t m3; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Ts_t; /*** <<< FUNC-DECLS [Ts] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Ts; /*** <<< STAT-DEFS [Ts] >>> ***/ static asn_TYPE_member_t asn_MBR_Ts_1[] = { { ATF_NOFLAGS, 0, offsetof(struct Ts, m1), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_T2, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "m1" }, { ATF_POINTER, 1, offsetof(struct Ts, m2), .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), .tag_mode = +1, /* EXPLICIT tag at current level */ .type = &asn_DEF_T3, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "m2" }, { ATF_NOFLAGS, 0, offsetof(struct Ts, m3), .tag = (ASN_TAG_CLASS_CONTEXT | (3 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_T3, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "m3" }, }; static const ber_tlv_tag_t asn_DEF_Ts_tags_1[] = { (ASN_TAG_CLASS_CONTEXT | (123 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_Ts_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 0, 0, 0 }, /* m1 */ { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 1, 0, 0 }, /* m2 */ { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 2, 0, 0 } /* m3 */ }; static asn_SEQUENCE_specifics_t asn_SPC_Ts_specs_1 = { sizeof(struct Ts), offsetof(struct Ts, _asn_ctx), asn_MAP_Ts_tag2el_1, 3, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Ts = { "Ts", "Ts", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Ts_tags_1, sizeof(asn_DEF_Ts_tags_1) /sizeof(asn_DEF_Ts_tags_1[0]) - 1, /* 1 */ asn_DEF_Ts_tags_1, /* Same as above */ sizeof(asn_DEF_Ts_tags_1) /sizeof(asn_DEF_Ts_tags_1[0]), /* 2 */ 0, /* No PER visible constraints */ asn_MBR_Ts_1, 3, /* Elements count */ &asn_SPC_Ts_specs_1 /* Additional specs */ }; asn1c-0.9.28+dfsg/tests/85-comments-OK.asn10000644000000000000000000000115113065714043016551 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .85 ModuleTestComments { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 85 } DEFINITIONS ::= BEGIN T1 ::= SEQUENCE--comment-- { ... } T2 ::= SEQUENCE-- comment-- { ... } T3 ::= SEQUENCE--- comment --- { ... } T4 ::= SEQUENCE----comment---- { ... } T5 ::= SEQUENCE---- comment ---- { ... } ----- Another ambiguous comment --- -- Immediately terminating ambiguous comment ---- ------------- -- cmt1 ---- cmt2 ---- END asn1c-0.9.28+dfsg/tests/79-constrained-by-OK.asn10000644000000000000000000000057113065714043017655 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .79 ModuleTestConstrainedBy { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 79 } DEFINITIONS ::= BEGIN Type ::= SEQUENCE { int INTEGER, ... } (CONSTRAINED BY { -- nothing -- }) END asn1c-0.9.28+dfsg/tests/07-int-OK.asn10000644000000000000000000000077213065714043015520 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .7 ModuleTestInt1 { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 7 } DEFINITIONS ::= BEGIN int123456 INTEGER ::= 123456 Interval ::= INTEGER (1..int123456) SameInterval INTEGER ::= { 1 | 2 | 3 | 4 | 5 | 6 } Reason ::= INTEGER { no-reason(0), negative-reason(-10), some-large-value(1324324) } END asn1c-0.9.28+dfsg/tests/38-comments-OK.asn10000644000000000000000000000115013065714043016546 0ustar rootroot -- OK: Everything is Fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .38 ModuleNestedCTypeComments { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 38 } DEFINITIONS ::= BEGIN T ::= CHOICE { t-a INTEGER, t-b OCTET STRING /* t-c [1] Choice1, t-d Choice2 */ } -- this is a comment too -- This-Is-Not-A-Comment ::= INTEGER /* ISO/IEC 8824-1 #11.6.4 blah blah blah /* nested comment */ -- this is an insignificant coment -- this is a comment too -- and this is a comment */ END asn1c-0.9.28+dfsg/tests/109-bit-string-SE.asn10000644000000000000000000000051713065714043017066 0ustar rootroot -- SE: Semantic error -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .109 ModuleBitStringExtensibility { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 109 } DEFINITIONS ::= BEGIN T ::= BIT STRING { one(1), ... } END asn1c-0.9.28+dfsg/tests/23-bits-OK.asn1.-EF0000644000000000000000000000047113065714043016227 0ustar rootrootModuleTestBitString { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 23 } DEFINITIONS AUTOMATIC TAGS ::= BEGIN v28 INTEGER ::= 28 BS1 ::= BIT STRING { first(0), third(2), twenty-eight(28) } one-zero-one BS1 ::= '101'B one0one BS1 ::= '101'B END asn1c-0.9.28+dfsg/tests/112-param-class-OK.asn10000644000000000000000000000116113065714043017177 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .112 ModuleParameterizationClass { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 112 } DEFINITIONS ::= BEGIN PCLASS {Type, INTEGER:value, INTEGER:ValueSet} ::= CLASS { &valueField1 Type, &valueField2 INTEGER DEFAULT value, &valueField3 INTEGER (ValueSet), &ValueSetField INTEGER DEFAULT {ValueSet} } WITH SYNTAX { &valueField1, &valueField2, &valueField3, &ValueSetField } SCLASS ::= PCLASS {REAL, 111, {1 | 2 | 3}} END asn1c-0.9.28+dfsg/tests/51-constraint-SE.asn10000644000000000000000000000052313065714043017101 0ustar rootroot -- SE: Semantic error -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .51 ModuleInvalidConstraintApplicability1 { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 51 } DEFINITIONS ::= BEGIN Int ::= INTEGER (FROM("abc")) END asn1c-0.9.28+dfsg/tests/16-constraint-OK.asn10000644000000000000000000000161213065714043017104 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .16 1 -- .16 2 ModuleTestConstraint1 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 16 1 } DEFINITIONS ::= BEGIN IMPORTS Type1 FROM ModuleTestConstraint2; -- external reference Type0 ::= IA5String (Type6) Type6 ::= IA5String (Type1) END ModuleTestConstraint2 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 16 2 } DEFINITIONS ::= BEGIN EXPORTS Type1; -- external reference Type1 ::= IA5String (SIZE(1..ten,...))(FROM("a".."z"|"#",...)) Type2 ::= IA5String (SIZE (MIN..4)|FROM ("abc")) Type3 ::= BMPString (SIZE(1)) Type4 ::= INTEGER (1..MAX) Type5 ::= BOOLEAN (TRUE|FALSE) ten INTEGER ::= 10 v1 Type1 ::= "#value wi th ""double quotes""" END asn1c-0.9.28+dfsg/tests/35-set-choice-OK.asn10000644000000000000000000000114713065714043016747 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .35 ModuleTestSetAndUntaggedChoice { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 35 } DEFINITIONS ::= BEGIN T ::= SET { a NumericString, b CHOICE { -- Untagged choice b1 IA5String, b2 ObjectDescriptor, b3 Choice }, c BOOLEAN, ..., d OID } Choice ::= CHOICE { -- One more level ch-a OCTET STRING, ch-b BIT STRING } OID ::= CHOICE { oid OBJECT IDENTIFIER, r-oid RELATIVE-OID } END asn1c-0.9.28+dfsg/tests/32-sequence-of-OK.asn1.-P0000644000000000000000000003307513065714043017413 0ustar rootroot /*** <<< INCLUDES [Programming] >>> ***/ #include #include /*** <<< FWD-DECLS [Programming] >>> ***/ struct Fault; /*** <<< TYPE-DECLS [Programming] >>> ***/ typedef struct Programming { A_SEQUENCE_OF(struct Fault) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Programming_t; /*** <<< FUNC-DECLS [Programming] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Programming; /*** <<< POST-INCLUDE [Programming] >>> ***/ #include "Fault.h" /*** <<< STAT-DEFS [Programming] >>> ***/ static asn_TYPE_member_t asn_MBR_Programming_1[] = { { ATF_POINTER, 0, 0, .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Fault, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "" }, }; static const ber_tlv_tag_t asn_DEF_Programming_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_Programming_specs_1 = { sizeof(struct Programming), offsetof(struct Programming, _asn_ctx), 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_Programming = { "Programming", "Programming", SEQUENCE_OF_free, SEQUENCE_OF_print, SEQUENCE_OF_constraint, SEQUENCE_OF_decode_ber, SEQUENCE_OF_encode_der, SEQUENCE_OF_decode_xer, SEQUENCE_OF_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Programming_tags_1, sizeof(asn_DEF_Programming_tags_1) /sizeof(asn_DEF_Programming_tags_1[0]), /* 1 */ asn_DEF_Programming_tags_1, /* Same as above */ sizeof(asn_DEF_Programming_tags_1) /sizeof(asn_DEF_Programming_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Programming_1, 1, /* Single element */ &asn_SPC_Programming_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Fault] >>> ***/ #include #include /*** <<< FWD-DECLS [Fault] >>> ***/ struct Error; /*** <<< TYPE-DECLS [Fault] >>> ***/ typedef struct Fault { A_SET_OF(struct Error) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Fault_t; /*** <<< FUNC-DECLS [Fault] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Fault; /*** <<< POST-INCLUDE [Fault] >>> ***/ #include "Error.h" /*** <<< STAT-DEFS [Fault] >>> ***/ static asn_TYPE_member_t asn_MBR_Fault_1[] = { { ATF_POINTER, 0, 0, .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), .tag_mode = 0, .type = &asn_DEF_Error, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "" }, }; static const ber_tlv_tag_t asn_DEF_Fault_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_Fault_specs_1 = { sizeof(struct Fault), offsetof(struct Fault, _asn_ctx), 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_Fault = { "Fault", "Fault", SET_OF_free, SET_OF_print, SET_OF_constraint, SET_OF_decode_ber, SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Fault_tags_1, sizeof(asn_DEF_Fault_tags_1) /sizeof(asn_DEF_Fault_tags_1[0]), /* 1 */ asn_DEF_Fault_tags_1, /* Same as above */ sizeof(asn_DEF_Fault_tags_1) /sizeof(asn_DEF_Fault_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Fault_1, 1, /* Single element */ &asn_SPC_Fault_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Error] >>> ***/ #include /*** <<< TYPE-DECLS [Error] >>> ***/ typedef struct Error { /* * This type is extensible, * possible extensions are below. */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Error_t; /*** <<< FUNC-DECLS [Error] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Error; /*** <<< STAT-DEFS [Error] >>> ***/ static const ber_tlv_tag_t asn_DEF_Error_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static asn_SEQUENCE_specifics_t asn_SPC_Error_specs_1 = { sizeof(struct Error), offsetof(struct Error, _asn_ctx), 0, /* No top level tags */ 0, /* No tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Error = { "Error", "Error", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Error_tags_1, sizeof(asn_DEF_Error_tags_1) /sizeof(asn_DEF_Error_tags_1[0]), /* 1 */ asn_DEF_Error_tags_1, /* Same as above */ sizeof(asn_DEF_Error_tags_1) /sizeof(asn_DEF_Error_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ &asn_SPC_Error_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [SeqWithMandatory] >>> ***/ #include #include #include #include /*** <<< FWD-DECLS [SeqWithMandatory] >>> ***/ struct Error; /*** <<< TYPE-DECLS [SeqWithMandatory] >>> ***/ typedef struct SeqWithMandatory { UTF8String_t someString; struct seqOfMan { A_SEQUENCE_OF(struct Error) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } seqOfMan; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } SeqWithMandatory_t; /*** <<< FUNC-DECLS [SeqWithMandatory] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_SeqWithMandatory; /*** <<< POST-INCLUDE [SeqWithMandatory] >>> ***/ #include "Error.h" /*** <<< STAT-DEFS [SeqWithMandatory] >>> ***/ static asn_TYPE_member_t asn_MBR_seqOfMan_3[] = { { ATF_POINTER, 0, 0, .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), .tag_mode = 0, .type = &asn_DEF_Error, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "" }, }; static const ber_tlv_tag_t asn_DEF_seqOfMan_tags_3[] = { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_seqOfMan_specs_3 = { sizeof(struct seqOfMan), offsetof(struct seqOfMan, _asn_ctx), 0, /* XER encoding is XMLDelimitedItemList */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_seqOfMan_3 = { "seqOfMan", "seqOfMan", SEQUENCE_OF_free, SEQUENCE_OF_print, SEQUENCE_OF_constraint, SEQUENCE_OF_decode_ber, SEQUENCE_OF_encode_der, SEQUENCE_OF_decode_xer, SEQUENCE_OF_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_seqOfMan_tags_3, sizeof(asn_DEF_seqOfMan_tags_3) /sizeof(asn_DEF_seqOfMan_tags_3[0]), /* 2 */ asn_DEF_seqOfMan_tags_3, /* Same as above */ sizeof(asn_DEF_seqOfMan_tags_3) /sizeof(asn_DEF_seqOfMan_tags_3[0]), /* 2 */ 0, /* No PER visible constraints */ asn_MBR_seqOfMan_3, 1, /* Single element */ &asn_SPC_seqOfMan_specs_3 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_SeqWithMandatory_1[] = { { ATF_NOFLAGS, 0, offsetof(struct SeqWithMandatory, someString), .tag = (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)), .tag_mode = 0, .type = &asn_DEF_UTF8String, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "someString" }, { ATF_NOFLAGS, 0, offsetof(struct SeqWithMandatory, seqOfMan), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = 0, .type = &asn_DEF_seqOfMan_3, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "seqOfMan" }, }; static const ber_tlv_tag_t asn_DEF_SeqWithMandatory_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_SeqWithMandatory_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)), 0, 0, 0 }, /* someString */ { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 1, 0, 0 } /* seqOfMan */ }; static asn_SEQUENCE_specifics_t asn_SPC_SeqWithMandatory_specs_1 = { sizeof(struct SeqWithMandatory), offsetof(struct SeqWithMandatory, _asn_ctx), asn_MAP_SeqWithMandatory_tag2el_1, 2, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_SeqWithMandatory = { "SeqWithMandatory", "SeqWithMandatory", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_SeqWithMandatory_tags_1, sizeof(asn_DEF_SeqWithMandatory_tags_1) /sizeof(asn_DEF_SeqWithMandatory_tags_1[0]), /* 1 */ asn_DEF_SeqWithMandatory_tags_1, /* Same as above */ sizeof(asn_DEF_SeqWithMandatory_tags_1) /sizeof(asn_DEF_SeqWithMandatory_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_SeqWithMandatory_1, 2, /* Elements count */ &asn_SPC_SeqWithMandatory_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [SeqWithOptional] >>> ***/ #include #include #include #include /*** <<< FWD-DECLS [SeqWithOptional] >>> ***/ struct Error; /*** <<< TYPE-DECLS [SeqWithOptional] >>> ***/ typedef struct SeqWithOptional { UTF8String_t someString; struct seqOfOpt { A_SEQUENCE_OF(struct Error) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } *seqOfOpt; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } SeqWithOptional_t; /*** <<< FUNC-DECLS [SeqWithOptional] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_SeqWithOptional; /*** <<< POST-INCLUDE [SeqWithOptional] >>> ***/ #include "Error.h" /*** <<< STAT-DEFS [SeqWithOptional] >>> ***/ static asn_TYPE_member_t asn_MBR_seqOfOpt_3[] = { { ATF_POINTER, 0, 0, .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), .tag_mode = 0, .type = &asn_DEF_Error, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "" }, }; static const ber_tlv_tag_t asn_DEF_seqOfOpt_tags_3[] = { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_seqOfOpt_specs_3 = { sizeof(struct seqOfOpt), offsetof(struct seqOfOpt, _asn_ctx), 0, /* XER encoding is XMLDelimitedItemList */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_seqOfOpt_3 = { "seqOfOpt", "seqOfOpt", SEQUENCE_OF_free, SEQUENCE_OF_print, SEQUENCE_OF_constraint, SEQUENCE_OF_decode_ber, SEQUENCE_OF_encode_der, SEQUENCE_OF_decode_xer, SEQUENCE_OF_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_seqOfOpt_tags_3, sizeof(asn_DEF_seqOfOpt_tags_3) /sizeof(asn_DEF_seqOfOpt_tags_3[0]), /* 2 */ asn_DEF_seqOfOpt_tags_3, /* Same as above */ sizeof(asn_DEF_seqOfOpt_tags_3) /sizeof(asn_DEF_seqOfOpt_tags_3[0]), /* 2 */ 0, /* No PER visible constraints */ asn_MBR_seqOfOpt_3, 1, /* Single element */ &asn_SPC_seqOfOpt_specs_3 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_SeqWithOptional_1[] = { { ATF_NOFLAGS, 0, offsetof(struct SeqWithOptional, someString), .tag = (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)), .tag_mode = 0, .type = &asn_DEF_UTF8String, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "someString" }, { ATF_POINTER, 1, offsetof(struct SeqWithOptional, seqOfOpt), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = 0, .type = &asn_DEF_seqOfOpt_3, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "seqOfOpt" }, }; static const ber_tlv_tag_t asn_DEF_SeqWithOptional_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_SeqWithOptional_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)), 0, 0, 0 }, /* someString */ { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 1, 0, 0 } /* seqOfOpt */ }; static asn_SEQUENCE_specifics_t asn_SPC_SeqWithOptional_specs_1 = { sizeof(struct SeqWithOptional), offsetof(struct SeqWithOptional, _asn_ctx), asn_MAP_SeqWithOptional_tag2el_1, 2, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_SeqWithOptional = { "SeqWithOptional", "SeqWithOptional", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_SeqWithOptional_tags_1, sizeof(asn_DEF_SeqWithOptional_tags_1) /sizeof(asn_DEF_SeqWithOptional_tags_1[0]), /* 1 */ asn_DEF_SeqWithOptional_tags_1, /* Same as above */ sizeof(asn_DEF_SeqWithOptional_tags_1) /sizeof(asn_DEF_SeqWithOptional_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_SeqWithOptional_1, 2, /* Elements count */ &asn_SPC_SeqWithOptional_specs_1 /* Additional specs */ }; asn1c-0.9.28+dfsg/tests/29-tags-OK.asn10000644000000000000000000000064313065714043015665 0ustar rootroot -- OK: Everything is fin -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .29 ModuleTestTagsDistinct2 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 29 } DEFINITIONS AUTOMATIC TAGS ::= BEGIN S ::= SET { a INTEGER, b CHOICE { c IA5String, ... }, d CHOICE { e BOOLEAN, ... } } END asn1c-0.9.28+dfsg/tests/09-int-SE.asn10000644000000000000000000000060013065714043015506 0ustar rootroot -- SE: Semantic error -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .9 ModuleTestInt3 { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 9 } DEFINITIONS ::= BEGIN Reason ::= INTEGER { value1(1), value5(5), value2-1(1) -- integers must be distinct -- } END asn1c-0.9.28+dfsg/tests/98-attribute-class-OK.asn10000644000000000000000000000127013065714043020040 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .98 ModuleAttributeClass { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 98 } DEFINITIONS ::= BEGIN ATTRIBUTE ::= CLASS { &id RELATIVE-OID UNIQUE } WITH SYNTAX { ID &id } Attribute ::= SEQUENCE { identifier ATTRIBUTE.&id ({Attributes}), siAttributeValue IA5String } Attributes ATTRIBUTE ::= { Names } Names ATTRIBUTE ::= { rafService | rcfService } rafService ATTRIBUTE ::= { ID raf } rcfService ATTRIBUTE ::= { ID rcf } raf RELATIVE-OID ::= {3 2 1} rcf RELATIVE-OID ::= {3 2 2} END asn1c-0.9.28+dfsg/tests/27-set-SE.asn10000644000000000000000000000066613065714043015523 0ustar rootroot -- SE: Semantic error -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .27 ModuleTestSetTagsDistinct { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 27 } DEFINITIONS IMPLICIT TAGS ::= BEGIN T ::= SET { a INTEGER, b CHOICE { -- Could we lookup tag past CHOICE?.. c INTEGER -- Tags must be distinct here. } } END asn1c-0.9.28+dfsg/tests/37-indirect-choice-OK.asn1.-EF0000644000000000000000000000114013065714043020316 0ustar rootrootModuleTestIndirectChoiceFine { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 37 } DEFINITIONS IMPLICIT TAGS ::= BEGIN T ::= CHOICE { t-a INTEGER, t-b OCTET STRING, t-c [1] EXPLICIT Choice1, t-d [3] IMPLICIT Choice2 } Choice1 ::= CHOICE { c-a OCTET STRING, c-b INTEGER } Choice2 ::= [2] EXPLICIT CHOICE { c-a OCTET STRING, c-b INTEGER, c-d [3] EXPLICIT Choice1, c-e [4] EXPLICIT Choice1 } Choice3 ::= [3] EXPLICIT Choice2 Choice4 ::= [4] IMPLICIT Choice2 Choice5 ::= Choice2 Choice6 ::= Choice1 END asn1c-0.9.28+dfsg/tests/66-ref-simple-OK.asn10000644000000000000000000000062713065714043016775 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .66 ModuleTestReferenceToNamedSimpleType { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 66 } DEFINITIONS IMPLICIT TAGS ::= BEGIN T ::= SET OF named SimpleType SimpleType ::= ENUMERATED { one, two, three } END asn1c-0.9.28+dfsg/tests/125-bitstring-constraint-OK.asn10000644000000000000000000000061013065714043021165 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .125 ModuleBitStringConstraint { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 125 } DEFINITIONS ::= BEGIN T ::= BIT STRING { flag1(0), flag2(1), flag3(2) } ('000'B | '001'B | '010'B | '011'B) END asn1c-0.9.28+dfsg/tests/42-real-life-OK.asn10000644000000000000000000000322513065714043016561 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .42 ModuleLAPStorage { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 42 } DEFINITIONS EXTENSIBILITY IMPLIED ::= BEGIN /* * A package representing a distinguished log line. * It contains * - a digest of that line (actually, a normalized * form with bells (\007) in place of variable components), * - one or more sets of variable parts (presumably with different * acceptability rules). */ LogLine ::= SEQUENCE { line-digest IA5String, -- Log line normal form varsets SEQUENCE SIZE(1..MAX) OF VariablePartSet } /* * This package contains a set of variable components of a log line. * Each variable component may contain one or more "value samples", * or a range between two samples. */ VariablePartSet ::= SEQUENCE { vparts SEQUENCE SIZE(0..MAX) OF VariablePart, -- {123,321} resolution ActionItem } /* * A description of a single variable part. */ VariablePart ::= CHOICE { -- A set of acceptable values vset SET SIZE(1..MAX) OF VisibleString, -- A range of acceptable values vrange SEQUENCE { from VisibleString, to VisibleString } } /* * What to do with the log line. */ ActionItem ::= SEQUENCE { accept-as ENUMERATED { unknown, -- Action yet unknown. safe, -- No action, just move on. unsafe, -- Unsafe message. Inform NOC. ... }, notify SEQUENCE { -- How to notify NOC. critical BOOLEAN, -- Emit critical message email SET OF VisibleString, -- Send emails ... } OPTIONAL } END asn1c-0.9.28+dfsg/tests/91-cond-int-blessSize-OK.asn1.-Pfbless-SIZE0000644000000000000000000005355413065714043022635 0ustar rootroot /*** <<< INCLUDES [OK-Integer1] >>> ***/ #include /*** <<< TYPE-DECLS [OK-Integer1] >>> ***/ typedef long OK_Integer1_t; /*** <<< FUNC-DECLS [OK-Integer1] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_OK_Integer1; asn_struct_free_f OK_Integer1_free; asn_struct_print_f OK_Integer1_print; asn_constr_check_f OK_Integer1_constraint; ber_type_decoder_f OK_Integer1_decode_ber; der_type_encoder_f OK_Integer1_encode_der; xer_type_decoder_f OK_Integer1_decode_xer; xer_type_encoder_f OK_Integer1_encode_xer; /*** <<< CODE [OK-Integer1] >>> ***/ int OK_Integer1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(1 /* No applicable constraints whatsoever */) { /* Nothing is here. See below */ } /* Replace with underlying type checker */ td->check_constraints = asn_DEF_NativeInteger.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void OK_Integer1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; td->specifics = asn_DEF_NativeInteger.specifics; } void OK_Integer1_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { OK_Integer1_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int OK_Integer1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { OK_Integer1_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t OK_Integer1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { OK_Integer1_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t OK_Integer1_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { OK_Integer1_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t OK_Integer1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { OK_Integer1_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t OK_Integer1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { OK_Integer1_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [OK-Integer1] >>> ***/ static const ber_tlv_tag_t asn_DEF_OK_Integer1_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_OK_Integer1 = { "OK-Integer1", "OK-Integer1", OK_Integer1_free, OK_Integer1_print, OK_Integer1_constraint, OK_Integer1_decode_ber, OK_Integer1_encode_der, OK_Integer1_decode_xer, OK_Integer1_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_OK_Integer1_tags_1, sizeof(asn_DEF_OK_Integer1_tags_1) /sizeof(asn_DEF_OK_Integer1_tags_1[0]), /* 1 */ asn_DEF_OK_Integer1_tags_1, /* Same as above */ sizeof(asn_DEF_OK_Integer1_tags_1) /sizeof(asn_DEF_OK_Integer1_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [OK-Integer2] >>> ***/ #include /*** <<< TYPE-DECLS [OK-Integer2] >>> ***/ typedef long OK_Integer2_t; /*** <<< FUNC-DECLS [OK-Integer2] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_OK_Integer2; asn_struct_free_f OK_Integer2_free; asn_struct_print_f OK_Integer2_print; asn_constr_check_f OK_Integer2_constraint; ber_type_decoder_f OK_Integer2_decode_ber; der_type_encoder_f OK_Integer2_encode_der; xer_type_decoder_f OK_Integer2_decode_xer; xer_type_encoder_f OK_Integer2_encode_xer; /*** <<< CODE [OK-Integer2] >>> ***/ int OK_Integer2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(1 /* No applicable constraints whatsoever */) { /* Nothing is here. See below */ } /* Replace with underlying type checker */ td->check_constraints = asn_DEF_NativeInteger.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void OK_Integer2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; td->specifics = asn_DEF_NativeInteger.specifics; } void OK_Integer2_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { OK_Integer2_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int OK_Integer2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { OK_Integer2_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t OK_Integer2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { OK_Integer2_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t OK_Integer2_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { OK_Integer2_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t OK_Integer2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { OK_Integer2_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t OK_Integer2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { OK_Integer2_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [OK-Integer2] >>> ***/ static const ber_tlv_tag_t asn_DEF_OK_Integer2_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_OK_Integer2 = { "OK-Integer2", "OK-Integer2", OK_Integer2_free, OK_Integer2_print, OK_Integer2_constraint, OK_Integer2_decode_ber, OK_Integer2_encode_der, OK_Integer2_decode_xer, OK_Integer2_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_OK_Integer2_tags_1, sizeof(asn_DEF_OK_Integer2_tags_1) /sizeof(asn_DEF_OK_Integer2_tags_1[0]), /* 1 */ asn_DEF_OK_Integer2_tags_1, /* Same as above */ sizeof(asn_DEF_OK_Integer2_tags_1) /sizeof(asn_DEF_OK_Integer2_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [OK-Integer3] >>> ***/ #include /*** <<< TYPE-DECLS [OK-Integer3] >>> ***/ typedef long OK_Integer3_t; /*** <<< FUNC-DECLS [OK-Integer3] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_OK_Integer3; asn_struct_free_f OK_Integer3_free; asn_struct_print_f OK_Integer3_print; asn_constr_check_f OK_Integer3_constraint; ber_type_decoder_f OK_Integer3_decode_ber; der_type_encoder_f OK_Integer3_encode_der; xer_type_decoder_f OK_Integer3_decode_xer; xer_type_encoder_f OK_Integer3_encode_xer; /*** <<< CODE [OK-Integer3] >>> ***/ int OK_Integer3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(1 /* No applicable constraints whatsoever */) { /* Nothing is here. See below */ } /* Replace with underlying type checker */ td->check_constraints = asn_DEF_NativeInteger.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void OK_Integer3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; td->specifics = asn_DEF_NativeInteger.specifics; } void OK_Integer3_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { OK_Integer3_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int OK_Integer3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { OK_Integer3_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t OK_Integer3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { OK_Integer3_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t OK_Integer3_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { OK_Integer3_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t OK_Integer3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { OK_Integer3_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t OK_Integer3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { OK_Integer3_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [OK-Integer3] >>> ***/ static const ber_tlv_tag_t asn_DEF_OK_Integer3_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_OK_Integer3 = { "OK-Integer3", "OK-Integer3", OK_Integer3_free, OK_Integer3_print, OK_Integer3_constraint, OK_Integer3_decode_ber, OK_Integer3_encode_der, OK_Integer3_decode_xer, OK_Integer3_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_OK_Integer3_tags_1, sizeof(asn_DEF_OK_Integer3_tags_1) /sizeof(asn_DEF_OK_Integer3_tags_1[0]), /* 1 */ asn_DEF_OK_Integer3_tags_1, /* Same as above */ sizeof(asn_DEF_OK_Integer3_tags_1) /sizeof(asn_DEF_OK_Integer3_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [OK-Integer4] >>> ***/ #include /*** <<< TYPE-DECLS [OK-Integer4] >>> ***/ typedef long OK_Integer4_t; /*** <<< FUNC-DECLS [OK-Integer4] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_OK_Integer4; asn_struct_free_f OK_Integer4_free; asn_struct_print_f OK_Integer4_print; asn_constr_check_f OK_Integer4_constraint; ber_type_decoder_f OK_Integer4_decode_ber; der_type_encoder_f OK_Integer4_encode_der; xer_type_decoder_f OK_Integer4_decode_xer; xer_type_encoder_f OK_Integer4_encode_xer; /*** <<< CODE [OK-Integer4] >>> ***/ int OK_Integer4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(1 /* No applicable constraints whatsoever */) { /* Nothing is here. See below */ } /* Replace with underlying type checker */ td->check_constraints = asn_DEF_NativeInteger.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void OK_Integer4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; td->specifics = asn_DEF_NativeInteger.specifics; } void OK_Integer4_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { OK_Integer4_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int OK_Integer4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { OK_Integer4_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t OK_Integer4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { OK_Integer4_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t OK_Integer4_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { OK_Integer4_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t OK_Integer4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { OK_Integer4_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t OK_Integer4_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { OK_Integer4_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [OK-Integer4] >>> ***/ static const ber_tlv_tag_t asn_DEF_OK_Integer4_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_OK_Integer4 = { "OK-Integer4", "OK-Integer4", OK_Integer4_free, OK_Integer4_print, OK_Integer4_constraint, OK_Integer4_decode_ber, OK_Integer4_encode_der, OK_Integer4_decode_xer, OK_Integer4_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_OK_Integer4_tags_1, sizeof(asn_DEF_OK_Integer4_tags_1) /sizeof(asn_DEF_OK_Integer4_tags_1[0]), /* 1 */ asn_DEF_OK_Integer4_tags_1, /* Same as above */ sizeof(asn_DEF_OK_Integer4_tags_1) /sizeof(asn_DEF_OK_Integer4_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [NO-Integer5] >>> ***/ #include /*** <<< TYPE-DECLS [NO-Integer5] >>> ***/ typedef long NO_Integer5_t; /*** <<< FUNC-DECLS [NO-Integer5] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_NO_Integer5; asn_struct_free_f NO_Integer5_free; asn_struct_print_f NO_Integer5_print; asn_constr_check_f NO_Integer5_constraint; ber_type_decoder_f NO_Integer5_decode_ber; der_type_encoder_f NO_Integer5_encode_der; xer_type_decoder_f NO_Integer5_decode_xer; xer_type_encoder_f NO_Integer5_encode_xer; /*** <<< CODE [NO-Integer5] >>> ***/ int NO_Integer5_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(1 /* No applicable constraints whatsoever */) { /* Nothing is here. See below */ } /* Replace with underlying type checker */ td->check_constraints = asn_DEF_NativeInteger.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using NativeInteger, * so here we adjust the DEF accordingly. */ static void NO_Integer5_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeInteger.free_struct; td->print_struct = asn_DEF_NativeInteger.print_struct; td->check_constraints = asn_DEF_NativeInteger.check_constraints; td->ber_decoder = asn_DEF_NativeInteger.ber_decoder; td->der_encoder = asn_DEF_NativeInteger.der_encoder; td->xer_decoder = asn_DEF_NativeInteger.xer_decoder; td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; td->elements_count = asn_DEF_NativeInteger.elements_count; td->specifics = asn_DEF_NativeInteger.specifics; } void NO_Integer5_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { NO_Integer5_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int NO_Integer5_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { NO_Integer5_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t NO_Integer5_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { NO_Integer5_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t NO_Integer5_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { NO_Integer5_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t NO_Integer5_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { NO_Integer5_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t NO_Integer5_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { NO_Integer5_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [NO-Integer5] >>> ***/ static const ber_tlv_tag_t asn_DEF_NO_Integer5_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_NO_Integer5 = { "NO-Integer5", "NO-Integer5", NO_Integer5_free, NO_Integer5_print, NO_Integer5_constraint, NO_Integer5_decode_ber, NO_Integer5_encode_der, NO_Integer5_decode_xer, NO_Integer5_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_Integer5_tags_1, sizeof(asn_DEF_NO_Integer5_tags_1) /sizeof(asn_DEF_NO_Integer5_tags_1[0]), /* 1 */ asn_DEF_NO_Integer5_tags_1, /* Same as above */ sizeof(asn_DEF_NO_Integer5_tags_1) /sizeof(asn_DEF_NO_Integer5_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; asn1c-0.9.28+dfsg/tests/97-type-identifier-SW.asn10000644000000000000000000000156413065714043020060 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .97 ModuleTypeIdentifier1 { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 97 1 } DEFINITIONS ::= BEGIN /* * TYPE-IDENTIFIER is resolved to a clause below. */ T1 ::= SEQUENCE { id TYPE-IDENTIFIER.&id2, type TYPE-IDENTIFIER.&Type } TYPE-IDENTIFIER ::= CLASS { &id2 OBJECT IDENTIFIER UNIQUE, &Type } WITH SYNTAX { [ &Type -- comment --] IDENTIFIED BY &id2 } END ModuleTypeIdentifier2 { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 97 2 } DEFINITIONS ::= BEGIN /* * TYPE-IDENTIFIER is resolved to a default TYPE-IDENTIFIER class. */ T2 ::= SEQUENCE { id TYPE-IDENTIFIER.&id, type TYPE-IDENTIFIER.&Type } END asn1c-0.9.28+dfsg/tests/57-components-of-OK.asn10000644000000000000000000000134113065714043017513 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .57 ModuleTestComponentsOfCrossModule1 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 57 1 } DEFINITIONS AUTOMATIC TAGS ::= BEGIN SecondType ::= SEQUENCE { a IA5String, COMPONENTS OF ModuleTestComponentsOfCrossModule2.OneType, b UniversalString } END ModuleTestComponentsOfCrossModule2 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 57 2 } DEFINITIONS EXPLICIT TAGS ::= BEGIN OneType ::= SEQUENCE { x T1, y T2, z T3 } T1 ::= INTEGER T2 ::= INTEGER T3 ::= INTEGER END asn1c-0.9.28+dfsg/tests/22-tags-OK.asn1.-Pfwide-types0000644000000000000000000001137313065714043020314 0ustar rootroot /*** <<< INCLUDES [T1] >>> ***/ #include #include #include #include #include /*** <<< DEPS [T1] >>> ***/ typedef enum b_PR { b_PR_NOTHING, /* No components present */ b_PR_i, b_PR_n } b_PR; /*** <<< TYPE-DECLS [T1] >>> ***/ typedef struct T1 { INTEGER_t a; struct b { b_PR present; union T1__b_u { INTEGER_t i; IA5String_t n; } choice; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } b; UTF8String_t c; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } T1_t; /*** <<< FUNC-DECLS [T1] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_T1; /*** <<< STAT-DEFS [T1] >>> ***/ static asn_TYPE_member_t asn_MBR_b_3[] = { { ATF_NOFLAGS, 0, offsetof(struct b, choice.i), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_INTEGER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "i" }, { ATF_NOFLAGS, 0, offsetof(struct b, choice.n), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_IA5String, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "n" }, }; static const asn_TYPE_tag2member_t asn_MAP_b_tag2el_3[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* i */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* n */ }; static asn_CHOICE_specifics_t asn_SPC_b_specs_3 = { sizeof(struct b), offsetof(struct b, _asn_ctx), offsetof(struct b, present), sizeof(((struct b *)0)->present), asn_MAP_b_tag2el_3, 2, /* Count of tags in the map */ .canonical_order = 0, .ext_start = -1 /* Extensions start */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_b_3 = { "b", "b", CHOICE_free, CHOICE_print, CHOICE_constraint, CHOICE_decode_ber, CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ 0, /* No tags (pointer) */ 0, /* No tags (count) */ 0, /* No PER visible constraints */ asn_MBR_b_3, 2, /* Elements count */ &asn_SPC_b_specs_3 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_T1_1[] = { { ATF_NOFLAGS, 0, offsetof(struct T1, a), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_INTEGER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "a" }, { ATF_NOFLAGS, 0, offsetof(struct T1, b), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = +1, /* EXPLICIT tag at current level */ .type = &asn_DEF_b_3, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "b" }, { ATF_NOFLAGS, 0, offsetof(struct T1, c), .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_UTF8String, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "c" }, }; static const ber_tlv_tag_t asn_DEF_T1_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_T1_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* a */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* b */ { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* c */ }; static asn_SEQUENCE_specifics_t asn_SPC_T1_specs_1 = { sizeof(struct T1), offsetof(struct T1, _asn_ctx), asn_MAP_T1_tag2el_1, 3, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_T1 = { "T1", "T1", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T1_tags_1, sizeof(asn_DEF_T1_tags_1) /sizeof(asn_DEF_T1_tags_1[0]), /* 1 */ asn_DEF_T1_tags_1, /* Same as above */ sizeof(asn_DEF_T1_tags_1) /sizeof(asn_DEF_T1_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_T1_1, 3, /* Elements count */ &asn_SPC_T1_specs_1 /* Additional specs */ }; asn1c-0.9.28+dfsg/tests/92-circular-loops-OK.asn1.-Pfwide-types0000644000000000000000000013736013065714043022330 0ustar rootroot /*** <<< INCLUDES [Everything] >>> ***/ #include "Set.h" #include "Alpha.h" #include "Beta.h" #include "Gamma.h" #include "OneTwo.h" #include "TwoThree.h" #include "ThreeOne.h" #include /*** <<< FWD-DECLS [Everything] >>> ***/ struct Choice1; struct Choice2; struct Choice3; /*** <<< TYPE-DECLS [Everything] >>> ***/ typedef struct Everything { struct Choice1 *ch1; struct Choice2 *ch2; struct Choice3 *ch3; Set_t set; Alpha_t a; Beta_t b; Gamma_t g; OneTwo_t ot; TwoThree_t tt; ThreeOne_t to; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Everything_t; /*** <<< FUNC-DECLS [Everything] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Everything; /*** <<< POST-INCLUDE [Everything] >>> ***/ #include "Choice1.h" #include "Choice2.h" #include "Choice3.h" /*** <<< STAT-DEFS [Everything] >>> ***/ static asn_TYPE_member_t asn_MBR_Everything_1[] = { { ATF_POINTER, 0, offsetof(struct Everything, ch1), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = +1, /* EXPLICIT tag at current level */ .type = &asn_DEF_Choice1, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "ch1" }, { ATF_POINTER, 0, offsetof(struct Everything, ch2), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = +1, /* EXPLICIT tag at current level */ .type = &asn_DEF_Choice2, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "ch2" }, { ATF_POINTER, 0, offsetof(struct Everything, ch3), .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), .tag_mode = +1, /* EXPLICIT tag at current level */ .type = &asn_DEF_Choice3, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "ch3" }, { ATF_NOFLAGS, 0, offsetof(struct Everything, set), .tag = (ASN_TAG_CLASS_CONTEXT | (3 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Set, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "set" }, { ATF_NOFLAGS, 0, offsetof(struct Everything, a), .tag = (ASN_TAG_CLASS_CONTEXT | (4 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Alpha, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "a" }, { ATF_NOFLAGS, 0, offsetof(struct Everything, b), .tag = (ASN_TAG_CLASS_CONTEXT | (5 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Beta, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "b" }, { ATF_NOFLAGS, 0, offsetof(struct Everything, g), .tag = (ASN_TAG_CLASS_CONTEXT | (6 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Gamma, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "g" }, { ATF_NOFLAGS, 0, offsetof(struct Everything, ot), .tag = (ASN_TAG_CLASS_CONTEXT | (7 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_OneTwo, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "ot" }, { ATF_NOFLAGS, 0, offsetof(struct Everything, tt), .tag = (ASN_TAG_CLASS_CONTEXT | (8 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_TwoThree, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "tt" }, { ATF_NOFLAGS, 0, offsetof(struct Everything, to), .tag = (ASN_TAG_CLASS_CONTEXT | (9 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_ThreeOne, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "to" }, }; static const ber_tlv_tag_t asn_DEF_Everything_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_Everything_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* ch1 */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* ch2 */ { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* ch3 */ { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* set */ { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 }, /* a */ { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 5, 0, 0 }, /* b */ { (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 6, 0, 0 }, /* g */ { (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 7, 0, 0 }, /* ot */ { (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 8, 0, 0 }, /* tt */ { (ASN_TAG_CLASS_CONTEXT | (9 << 2)), 9, 0, 0 } /* to */ }; static asn_SEQUENCE_specifics_t asn_SPC_Everything_specs_1 = { sizeof(struct Everything), offsetof(struct Everything, _asn_ctx), asn_MAP_Everything_tag2el_1, 10, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Everything = { "Everything", "Everything", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Everything_tags_1, sizeof(asn_DEF_Everything_tags_1) /sizeof(asn_DEF_Everything_tags_1[0]), /* 1 */ asn_DEF_Everything_tags_1, /* Same as above */ sizeof(asn_DEF_Everything_tags_1) /sizeof(asn_DEF_Everything_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Everything_1, 10, /* Elements count */ &asn_SPC_Everything_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Choice1] >>> ***/ #include /*** <<< DEPS [Choice1] >>> ***/ typedef enum Choice1_PR { Choice1_PR_NOTHING, /* No components present */ Choice1_PR_something, /* Extensions may appear below */ Choice1_PR_some2 } Choice1_PR; /*** <<< FWD-DECLS [Choice1] >>> ***/ struct Everything; /*** <<< TYPE-DECLS [Choice1] >>> ***/ typedef struct Choice1 { Choice1_PR present; union Choice1_u { struct Everything *something; /* * This type is extensible, * possible extensions are below. */ struct Everything *some2; } choice; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Choice1_t; /*** <<< FUNC-DECLS [Choice1] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Choice1; /*** <<< POST-INCLUDE [Choice1] >>> ***/ #include "Everything.h" /*** <<< STAT-DEFS [Choice1] >>> ***/ static asn_TYPE_member_t asn_MBR_Choice1_1[] = { { ATF_POINTER, 0, offsetof(struct Choice1, choice.something), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Everything, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "something" }, { ATF_POINTER, 0, offsetof(struct Choice1, choice.some2), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Everything, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "some2" }, }; static const asn_TYPE_tag2member_t asn_MAP_Choice1_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* something */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* some2 */ }; static asn_CHOICE_specifics_t asn_SPC_Choice1_specs_1 = { sizeof(struct Choice1), offsetof(struct Choice1, _asn_ctx), offsetof(struct Choice1, present), sizeof(((struct Choice1 *)0)->present), asn_MAP_Choice1_tag2el_1, 2, /* Count of tags in the map */ .canonical_order = 0, .ext_start = 1 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_Choice1 = { "Choice1", "Choice1", CHOICE_free, CHOICE_print, CHOICE_constraint, CHOICE_decode_ber, CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ 0, /* No tags (pointer) */ 0, /* No tags (count) */ 0, /* No PER visible constraints */ asn_MBR_Choice1_1, 2, /* Elements count */ &asn_SPC_Choice1_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Choice2] >>> ***/ #include "TypeRef.h" #include /*** <<< DEPS [Choice2] >>> ***/ typedef enum Choice2_PR { Choice2_PR_NOTHING, /* No components present */ Choice2_PR_typeref, /* Extensions may appear below */ Choice2_PR_some3 } Choice2_PR; /*** <<< FWD-DECLS [Choice2] >>> ***/ struct Everything; /*** <<< TYPE-DECLS [Choice2] >>> ***/ typedef struct Choice2 { Choice2_PR present; union Choice2_u { TypeRef_t typeref; /* * This type is extensible, * possible extensions are below. */ struct Everything *some3; } choice; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Choice2_t; /*** <<< FUNC-DECLS [Choice2] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Choice2; /*** <<< POST-INCLUDE [Choice2] >>> ***/ #include "Everything.h" /*** <<< STAT-DEFS [Choice2] >>> ***/ static asn_TYPE_member_t asn_MBR_Choice2_1[] = { { ATF_NOFLAGS, 0, offsetof(struct Choice2, choice.typeref), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_TypeRef, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "typeref" }, { ATF_POINTER, 0, offsetof(struct Choice2, choice.some3), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Everything, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "some3" }, }; static const asn_TYPE_tag2member_t asn_MAP_Choice2_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* typeref */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* some3 */ }; static asn_CHOICE_specifics_t asn_SPC_Choice2_specs_1 = { sizeof(struct Choice2), offsetof(struct Choice2, _asn_ctx), offsetof(struct Choice2, present), sizeof(((struct Choice2 *)0)->present), asn_MAP_Choice2_tag2el_1, 2, /* Count of tags in the map */ .canonical_order = 0, .ext_start = 1 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_Choice2 = { "Choice2", "Choice2", CHOICE_free, CHOICE_print, CHOICE_constraint, CHOICE_decode_ber, CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ 0, /* No tags (pointer) */ 0, /* No tags (count) */ 0, /* No PER visible constraints */ asn_MBR_Choice2_1, 2, /* Elements count */ &asn_SPC_Choice2_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Choice3] >>> ***/ #include #include #include #include /*** <<< DEPS [Choice3] >>> ***/ typedef enum Choice3_PR { Choice3_PR_NOTHING, /* No components present */ Choice3_PR_a, Choice3_PR_b, Choice3_PR_c } Choice3_PR; /*** <<< FWD-DECLS [Choice3] >>> ***/ struct Everything; struct Choice3; /*** <<< TYPE-DECLS [Choice3] >>> ***/ typedef struct Choice3 { Choice3_PR present; union Choice3_u { struct a { struct Everything *aa; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } a; struct Everything *b; struct c { A_SEQUENCE_OF(struct Choice3) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } c; } choice; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Choice3_t; /*** <<< FUNC-DECLS [Choice3] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Choice3; /*** <<< POST-INCLUDE [Choice3] >>> ***/ #include "Everything.h" #include "Choice3.h" /*** <<< STAT-DEFS [Choice3] >>> ***/ static asn_TYPE_member_t asn_MBR_a_2[] = { { ATF_POINTER, 0, offsetof(struct a, aa), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Everything, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "aa" }, }; static const ber_tlv_tag_t asn_DEF_a_tags_2[] = { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_a_tag2el_2[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* aa */ }; static asn_SEQUENCE_specifics_t asn_SPC_a_specs_2 = { sizeof(struct a), offsetof(struct a, _asn_ctx), asn_MAP_a_tag2el_2, 1, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_a_2 = { "a", "a", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_a_tags_2, sizeof(asn_DEF_a_tags_2) /sizeof(asn_DEF_a_tags_2[0]) - 1, /* 1 */ asn_DEF_a_tags_2, /* Same as above */ sizeof(asn_DEF_a_tags_2) /sizeof(asn_DEF_a_tags_2[0]), /* 2 */ 0, /* No PER visible constraints */ asn_MBR_a_2, 1, /* Elements count */ &asn_SPC_a_specs_2 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_c_5[] = { { ATF_POINTER, 0, 0, .tag = -1 /* Ambiguous tag (CHOICE?) */, .tag_mode = 0, .type = &asn_DEF_Choice3, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "" }, }; static const ber_tlv_tag_t asn_DEF_c_tags_5[] = { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_c_specs_5 = { sizeof(struct c), offsetof(struct c, _asn_ctx), 2, /* XER encoding is XMLValueList */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_c_5 = { "c", "c", SEQUENCE_OF_free, SEQUENCE_OF_print, SEQUENCE_OF_constraint, SEQUENCE_OF_decode_ber, SEQUENCE_OF_encode_der, SEQUENCE_OF_decode_xer, SEQUENCE_OF_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_c_tags_5, sizeof(asn_DEF_c_tags_5) /sizeof(asn_DEF_c_tags_5[0]) - 1, /* 1 */ asn_DEF_c_tags_5, /* Same as above */ sizeof(asn_DEF_c_tags_5) /sizeof(asn_DEF_c_tags_5[0]), /* 2 */ 0, /* No PER visible constraints */ asn_MBR_c_5, 1, /* Single element */ &asn_SPC_c_specs_5 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_Choice3_1[] = { { ATF_NOFLAGS, 0, offsetof(struct Choice3, choice.a), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = 0, .type = &asn_DEF_a_2, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "a" }, { ATF_POINTER, 0, offsetof(struct Choice3, choice.b), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Everything, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "b" }, { ATF_NOFLAGS, 0, offsetof(struct Choice3, choice.c), .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), .tag_mode = 0, .type = &asn_DEF_c_5, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "c" }, }; static const asn_TYPE_tag2member_t asn_MAP_Choice3_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* a */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* b */ { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* c */ }; static asn_CHOICE_specifics_t asn_SPC_Choice3_specs_1 = { sizeof(struct Choice3), offsetof(struct Choice3, _asn_ctx), offsetof(struct Choice3, present), sizeof(((struct Choice3 *)0)->present), asn_MAP_Choice3_tag2el_1, 3, /* Count of tags in the map */ .canonical_order = 0, .ext_start = -1 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_Choice3 = { "Choice3", "Choice3", CHOICE_free, CHOICE_print, CHOICE_constraint, CHOICE_decode_ber, CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ 0, /* No tags (pointer) */ 0, /* No tags (count) */ 0, /* No PER visible constraints */ asn_MBR_Choice3_1, 3, /* Elements count */ &asn_SPC_Choice3_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Set] >>> ***/ #include #include #include #include /*** <<< FWD-DECLS [Set] >>> ***/ struct Set; struct Sequence; /*** <<< TYPE-DECLS [Set] >>> ***/ typedef struct Set { A_SET_OF(struct Member { INTEGER_t Int; struct Set *set; struct Sequence *seq; struct Set *set2 /* OPTIONAL */; /* * This type is extensible, * possible extensions are below. */ struct Set *set3; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } ) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Set_t; /*** <<< FUNC-DECLS [Set] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Set; /*** <<< POST-INCLUDE [Set] >>> ***/ #include "Set.h" #include "Sequence.h" /*** <<< STAT-DEFS [Set] >>> ***/ static asn_TYPE_member_t asn_MBR_Member_2[] = { { ATF_NOFLAGS, 0, offsetof(struct Member, Int), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_INTEGER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "int" }, { ATF_POINTER, 0, offsetof(struct Member, set), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Set, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "set" }, { ATF_POINTER, 0, offsetof(struct Member, seq), .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Sequence, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "seq" }, { ATF_POINTER, 2, offsetof(struct Member, set2), .tag = (ASN_TAG_CLASS_CONTEXT | (3 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Set, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "set2" }, { ATF_POINTER, 1, offsetof(struct Member, set3), .tag = (ASN_TAG_CLASS_CONTEXT | (4 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Set, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "set3" }, }; static const ber_tlv_tag_t asn_DEF_Member_tags_2[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_Member_tag2el_2[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* int */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* set */ { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* seq */ { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 }, /* set2 */ { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 4, 0, 0 } /* set3 */ }; static asn_SEQUENCE_specifics_t asn_SPC_Member_specs_2 = { sizeof(struct Member), offsetof(struct Member, _asn_ctx), asn_MAP_Member_tag2el_2, 5, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ 3, /* Start extensions */ 6 /* Stop extensions */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_Member_2 = { "SEQUENCE", "SEQUENCE", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Member_tags_2, sizeof(asn_DEF_Member_tags_2) /sizeof(asn_DEF_Member_tags_2[0]), /* 1 */ asn_DEF_Member_tags_2, /* Same as above */ sizeof(asn_DEF_Member_tags_2) /sizeof(asn_DEF_Member_tags_2[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Member_2, 5, /* Elements count */ &asn_SPC_Member_specs_2 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_Set_1[] = { { ATF_POINTER, 0, 0, .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), .tag_mode = 0, .type = &asn_DEF_Member_2, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "" }, }; static const ber_tlv_tag_t asn_DEF_Set_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_Set_specs_1 = { sizeof(struct Set), offsetof(struct Set, _asn_ctx), 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_Set = { "Set", "Set", SET_OF_free, SET_OF_print, SET_OF_constraint, SET_OF_decode_ber, SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Set_tags_1, sizeof(asn_DEF_Set_tags_1) /sizeof(asn_DEF_Set_tags_1[0]), /* 1 */ asn_DEF_Set_tags_1, /* Same as above */ sizeof(asn_DEF_Set_tags_1) /sizeof(asn_DEF_Set_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Set_1, 1, /* Single element */ &asn_SPC_Set_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Sequence] >>> ***/ #include #include /*** <<< FWD-DECLS [Sequence] >>> ***/ struct Sequence; struct Set; /*** <<< TYPE-DECLS [Sequence] >>> ***/ typedef struct Sequence { INTEGER_t a; struct Sequence *seq /* OPTIONAL */; /* * This type is extensible, * possible extensions are below. */ INTEGER_t *b; struct Set *set /* OPTIONAL */; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Sequence_t; /*** <<< FUNC-DECLS [Sequence] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Sequence; /*** <<< POST-INCLUDE [Sequence] >>> ***/ #include "Sequence.h" #include "Set.h" /*** <<< STAT-DEFS [Sequence] >>> ***/ static asn_TYPE_member_t asn_MBR_Sequence_1[] = { { ATF_NOFLAGS, 0, offsetof(struct Sequence, a), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_INTEGER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "a" }, { ATF_POINTER, 3, offsetof(struct Sequence, seq), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Sequence, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "seq" }, { ATF_POINTER, 2, offsetof(struct Sequence, b), .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_INTEGER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "b" }, { ATF_POINTER, 1, offsetof(struct Sequence, set), .tag = (ASN_TAG_CLASS_CONTEXT | (3 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Set, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "set" }, }; static const ber_tlv_tag_t asn_DEF_Sequence_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_Sequence_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* a */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* seq */ { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 }, /* b */ { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 3, 0, 0 } /* set */ }; static asn_SEQUENCE_specifics_t asn_SPC_Sequence_specs_1 = { sizeof(struct Sequence), offsetof(struct Sequence, _asn_ctx), asn_MAP_Sequence_tag2el_1, 4, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ 1, /* Start extensions */ 5 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Sequence = { "Sequence", "Sequence", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Sequence_tags_1, sizeof(asn_DEF_Sequence_tags_1) /sizeof(asn_DEF_Sequence_tags_1[0]), /* 1 */ asn_DEF_Sequence_tags_1, /* Same as above */ sizeof(asn_DEF_Sequence_tags_1) /sizeof(asn_DEF_Sequence_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Sequence_1, 4, /* Elements count */ &asn_SPC_Sequence_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [TypeRef] >>> ***/ #include "Sequence.h" /*** <<< TYPE-DECLS [TypeRef] >>> ***/ typedef Sequence_t TypeRef_t; /*** <<< FUNC-DECLS [TypeRef] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_TypeRef; asn_struct_free_f TypeRef_free; asn_struct_print_f TypeRef_print; asn_constr_check_f TypeRef_constraint; ber_type_decoder_f TypeRef_decode_ber; der_type_encoder_f TypeRef_encode_der; xer_type_decoder_f TypeRef_decode_xer; xer_type_encoder_f TypeRef_encode_xer; /*** <<< CODE [TypeRef] >>> ***/ int TypeRef_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_Sequence.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using Sequence, * so here we adjust the DEF accordingly. */ static void TypeRef_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_Sequence.free_struct; td->print_struct = asn_DEF_Sequence.print_struct; td->check_constraints = asn_DEF_Sequence.check_constraints; td->ber_decoder = asn_DEF_Sequence.ber_decoder; td->der_encoder = asn_DEF_Sequence.der_encoder; td->xer_decoder = asn_DEF_Sequence.xer_decoder; td->xer_encoder = asn_DEF_Sequence.xer_encoder; td->uper_decoder = asn_DEF_Sequence.uper_decoder; td->uper_encoder = asn_DEF_Sequence.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Sequence.per_constraints; td->elements = asn_DEF_Sequence.elements; td->elements_count = asn_DEF_Sequence.elements_count; td->specifics = asn_DEF_Sequence.specifics; } void TypeRef_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { TypeRef_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int TypeRef_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { TypeRef_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t TypeRef_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { TypeRef_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t TypeRef_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { TypeRef_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t TypeRef_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { TypeRef_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t TypeRef_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { TypeRef_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [TypeRef] >>> ***/ static const ber_tlv_tag_t asn_DEF_TypeRef_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; asn_TYPE_descriptor_t asn_DEF_TypeRef = { "TypeRef", "TypeRef", TypeRef_free, TypeRef_print, TypeRef_constraint, TypeRef_decode_ber, TypeRef_encode_der, TypeRef_decode_xer, TypeRef_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_TypeRef_tags_1, sizeof(asn_DEF_TypeRef_tags_1) /sizeof(asn_DEF_TypeRef_tags_1[0]), /* 1 */ asn_DEF_TypeRef_tags_1, /* Same as above */ sizeof(asn_DEF_TypeRef_tags_1) /sizeof(asn_DEF_TypeRef_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* Defined elsewhere */ 0 /* No specifics */ }; /*** <<< INCLUDES [Alpha] >>> ***/ #include /*** <<< FWD-DECLS [Alpha] >>> ***/ struct Beta; /*** <<< TYPE-DECLS [Alpha] >>> ***/ typedef struct Alpha { struct Beta *a; struct b { struct Beta *b /* OPTIONAL */; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } b; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Alpha_t; /*** <<< FUNC-DECLS [Alpha] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Alpha; /*** <<< POST-INCLUDE [Alpha] >>> ***/ #include "Beta.h" /*** <<< STAT-DEFS [Alpha] >>> ***/ static asn_TYPE_member_t asn_MBR_b_3[] = { { ATF_POINTER, 1, offsetof(struct b, b), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Beta, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "b" }, }; static const ber_tlv_tag_t asn_DEF_b_tags_3[] = { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_b_tag2el_3[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* b */ }; static asn_SEQUENCE_specifics_t asn_SPC_b_specs_3 = { sizeof(struct b), offsetof(struct b, _asn_ctx), asn_MAP_b_tag2el_3, 1, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_b_3 = { "b", "b", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_b_tags_3, sizeof(asn_DEF_b_tags_3) /sizeof(asn_DEF_b_tags_3[0]) - 1, /* 1 */ asn_DEF_b_tags_3, /* Same as above */ sizeof(asn_DEF_b_tags_3) /sizeof(asn_DEF_b_tags_3[0]), /* 2 */ 0, /* No PER visible constraints */ asn_MBR_b_3, 1, /* Elements count */ &asn_SPC_b_specs_3 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_Alpha_1[] = { { ATF_POINTER, 0, offsetof(struct Alpha, a), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Beta, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "a" }, { ATF_NOFLAGS, 0, offsetof(struct Alpha, b), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = 0, .type = &asn_DEF_b_3, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "b" }, }; static const ber_tlv_tag_t asn_DEF_Alpha_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_Alpha_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* a */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* b */ }; static asn_SEQUENCE_specifics_t asn_SPC_Alpha_specs_1 = { sizeof(struct Alpha), offsetof(struct Alpha, _asn_ctx), asn_MAP_Alpha_tag2el_1, 2, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Alpha = { "Alpha", "Alpha", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Alpha_tags_1, sizeof(asn_DEF_Alpha_tags_1) /sizeof(asn_DEF_Alpha_tags_1[0]), /* 1 */ asn_DEF_Alpha_tags_1, /* Same as above */ sizeof(asn_DEF_Alpha_tags_1) /sizeof(asn_DEF_Alpha_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Alpha_1, 2, /* Elements count */ &asn_SPC_Alpha_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Beta] >>> ***/ #include /*** <<< FWD-DECLS [Beta] >>> ***/ struct Alpha; struct Gamma; /*** <<< TYPE-DECLS [Beta] >>> ***/ typedef struct Beta { struct Alpha *b /* OPTIONAL */; struct Gamma *g /* OPTIONAL */; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Beta_t; /*** <<< FUNC-DECLS [Beta] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Beta; /*** <<< POST-INCLUDE [Beta] >>> ***/ #include "Alpha.h" #include "Gamma.h" /*** <<< STAT-DEFS [Beta] >>> ***/ static asn_TYPE_member_t asn_MBR_Beta_1[] = { { ATF_POINTER, 2, offsetof(struct Beta, b), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Alpha, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "b" }, { ATF_POINTER, 1, offsetof(struct Beta, g), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Gamma, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "g" }, }; static const ber_tlv_tag_t asn_DEF_Beta_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_Beta_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* b */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* g */ }; static asn_SEQUENCE_specifics_t asn_SPC_Beta_specs_1 = { sizeof(struct Beta), offsetof(struct Beta, _asn_ctx), asn_MAP_Beta_tag2el_1, 2, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Beta = { "Beta", "Beta", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Beta_tags_1, sizeof(asn_DEF_Beta_tags_1) /sizeof(asn_DEF_Beta_tags_1[0]), /* 1 */ asn_DEF_Beta_tags_1, /* Same as above */ sizeof(asn_DEF_Beta_tags_1) /sizeof(asn_DEF_Beta_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Beta_1, 2, /* Elements count */ &asn_SPC_Beta_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Gamma] >>> ***/ #include /*** <<< FWD-DECLS [Gamma] >>> ***/ struct TwoThree; struct Alpha; struct Beta; /*** <<< TYPE-DECLS [Gamma] >>> ***/ typedef struct Gamma { struct TwoThree *o; struct Alpha *a; struct Beta *b; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Gamma_t; /*** <<< FUNC-DECLS [Gamma] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Gamma; /*** <<< POST-INCLUDE [Gamma] >>> ***/ #include "TwoThree.h" #include "Alpha.h" #include "Beta.h" /*** <<< STAT-DEFS [Gamma] >>> ***/ static asn_TYPE_member_t asn_MBR_Gamma_1[] = { { ATF_POINTER, 0, offsetof(struct Gamma, o), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_TwoThree, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "o" }, { ATF_POINTER, 0, offsetof(struct Gamma, a), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Alpha, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "a" }, { ATF_POINTER, 0, offsetof(struct Gamma, b), .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Beta, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "b" }, }; static const ber_tlv_tag_t asn_DEF_Gamma_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_Gamma_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* o */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* a */ { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 2, 0, 0 } /* b */ }; static asn_SEQUENCE_specifics_t asn_SPC_Gamma_specs_1 = { sizeof(struct Gamma), offsetof(struct Gamma, _asn_ctx), asn_MAP_Gamma_tag2el_1, 3, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Gamma = { "Gamma", "Gamma", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Gamma_tags_1, sizeof(asn_DEF_Gamma_tags_1) /sizeof(asn_DEF_Gamma_tags_1[0]), /* 1 */ asn_DEF_Gamma_tags_1, /* Same as above */ sizeof(asn_DEF_Gamma_tags_1) /sizeof(asn_DEF_Gamma_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Gamma_1, 3, /* Elements count */ &asn_SPC_Gamma_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [OneTwo] >>> ***/ #include /*** <<< DEPS [OneTwo] >>> ***/ /* * Method of determining the components presence */ typedef enum OneTwo_PR { OneTwo_PR_m12, /* Member m12 is present */ } OneTwo_PR; /*** <<< FWD-DECLS [OneTwo] >>> ***/ struct TwoThree; /*** <<< TYPE-DECLS [OneTwo] >>> ***/ typedef struct OneTwo { struct TwoThree *m12; /* Presence bitmask: ASN_SET_ISPRESENT(pOneTwo, OneTwo_PR_x) */ unsigned int _presence_map [((1+(8*sizeof(unsigned int))-1)/(8*sizeof(unsigned int)))]; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } OneTwo_t; /*** <<< FUNC-DECLS [OneTwo] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_OneTwo; /*** <<< POST-INCLUDE [OneTwo] >>> ***/ #include "TwoThree.h" /*** <<< STAT-DEFS [OneTwo] >>> ***/ static asn_TYPE_member_t asn_MBR_OneTwo_1[] = { { ATF_POINTER, 0, offsetof(struct OneTwo, m12), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_TwoThree, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "m12" }, }; static const ber_tlv_tag_t asn_DEF_OneTwo_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_OneTwo_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* m12 */ }; static const uint8_t asn_MAP_OneTwo_mmap_1[(1 + (8 * sizeof(unsigned int)) - 1) / 8] = { (1 << 7) }; static asn_SET_specifics_t asn_SPC_OneTwo_specs_1 = { sizeof(struct OneTwo), offsetof(struct OneTwo, _asn_ctx), offsetof(struct OneTwo, _presence_map), asn_MAP_OneTwo_tag2el_1, 1, /* Count of tags in the map */ asn_MAP_OneTwo_tag2el_1, /* Same as above */ 1, /* Count of tags in the CXER map */ 0, /* Whether extensible */ (unsigned int *)asn_MAP_OneTwo_mmap_1 /* Mandatory elements map */ }; asn_TYPE_descriptor_t asn_DEF_OneTwo = { "OneTwo", "OneTwo", SET_free, SET_print, SET_constraint, SET_decode_ber, SET_encode_der, SET_decode_xer, SET_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_OneTwo_tags_1, sizeof(asn_DEF_OneTwo_tags_1) /sizeof(asn_DEF_OneTwo_tags_1[0]), /* 1 */ asn_DEF_OneTwo_tags_1, /* Same as above */ sizeof(asn_DEF_OneTwo_tags_1) /sizeof(asn_DEF_OneTwo_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_OneTwo_1, 1, /* Elements count */ &asn_SPC_OneTwo_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [TwoThree] >>> ***/ #include /*** <<< DEPS [TwoThree] >>> ***/ /* * Method of determining the components presence */ typedef enum TwoThree_PR { TwoThree_PR_m23, /* Member m23 is present */ } TwoThree_PR; /*** <<< FWD-DECLS [TwoThree] >>> ***/ struct ThreeOne; /*** <<< TYPE-DECLS [TwoThree] >>> ***/ typedef struct TwoThree { struct ThreeOne *m23; /* Presence bitmask: ASN_SET_ISPRESENT(pTwoThree, TwoThree_PR_x) */ unsigned int _presence_map [((1+(8*sizeof(unsigned int))-1)/(8*sizeof(unsigned int)))]; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } TwoThree_t; /*** <<< FUNC-DECLS [TwoThree] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_TwoThree; /*** <<< POST-INCLUDE [TwoThree] >>> ***/ #include "ThreeOne.h" /*** <<< STAT-DEFS [TwoThree] >>> ***/ static asn_TYPE_member_t asn_MBR_TwoThree_1[] = { { ATF_POINTER, 0, offsetof(struct TwoThree, m23), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_ThreeOne, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "m23" }, }; static const ber_tlv_tag_t asn_DEF_TwoThree_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_TwoThree_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* m23 */ }; static const uint8_t asn_MAP_TwoThree_mmap_1[(1 + (8 * sizeof(unsigned int)) - 1) / 8] = { (1 << 7) }; static asn_SET_specifics_t asn_SPC_TwoThree_specs_1 = { sizeof(struct TwoThree), offsetof(struct TwoThree, _asn_ctx), offsetof(struct TwoThree, _presence_map), asn_MAP_TwoThree_tag2el_1, 1, /* Count of tags in the map */ asn_MAP_TwoThree_tag2el_1, /* Same as above */ 1, /* Count of tags in the CXER map */ 0, /* Whether extensible */ (unsigned int *)asn_MAP_TwoThree_mmap_1 /* Mandatory elements map */ }; asn_TYPE_descriptor_t asn_DEF_TwoThree = { "TwoThree", "TwoThree", SET_free, SET_print, SET_constraint, SET_decode_ber, SET_encode_der, SET_decode_xer, SET_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_TwoThree_tags_1, sizeof(asn_DEF_TwoThree_tags_1) /sizeof(asn_DEF_TwoThree_tags_1[0]), /* 1 */ asn_DEF_TwoThree_tags_1, /* Same as above */ sizeof(asn_DEF_TwoThree_tags_1) /sizeof(asn_DEF_TwoThree_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_TwoThree_1, 1, /* Elements count */ &asn_SPC_TwoThree_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [ThreeOne] >>> ***/ #include /*** <<< DEPS [ThreeOne] >>> ***/ /* * Method of determining the components presence */ typedef enum ThreeOne_PR { ThreeOne_PR_m31, /* Member m31 is present */ ThreeOne_PR_g, /* Member g is present */ } ThreeOne_PR; /*** <<< FWD-DECLS [ThreeOne] >>> ***/ struct OneTwo; struct Gamma; /*** <<< TYPE-DECLS [ThreeOne] >>> ***/ typedef struct ThreeOne { struct OneTwo *m31; struct Gamma *g; /* Presence bitmask: ASN_SET_ISPRESENT(pThreeOne, ThreeOne_PR_x) */ unsigned int _presence_map [((2+(8*sizeof(unsigned int))-1)/(8*sizeof(unsigned int)))]; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } ThreeOne_t; /*** <<< FUNC-DECLS [ThreeOne] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_ThreeOne; /*** <<< POST-INCLUDE [ThreeOne] >>> ***/ #include "OneTwo.h" #include "Gamma.h" /*** <<< STAT-DEFS [ThreeOne] >>> ***/ static asn_TYPE_member_t asn_MBR_ThreeOne_1[] = { { ATF_POINTER, 0, offsetof(struct ThreeOne, m31), .tag = (ASN_TAG_CLASS_CONTEXT | (0 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_OneTwo, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "m31" }, { ATF_POINTER, 0, offsetof(struct ThreeOne, g), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_Gamma, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "g" }, }; static const ber_tlv_tag_t asn_DEF_ThreeOne_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_ThreeOne_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* m31 */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* g */ }; static const uint8_t asn_MAP_ThreeOne_mmap_1[(2 + (8 * sizeof(unsigned int)) - 1) / 8] = { (1 << 7) | (1 << 6) }; static asn_SET_specifics_t asn_SPC_ThreeOne_specs_1 = { sizeof(struct ThreeOne), offsetof(struct ThreeOne, _asn_ctx), offsetof(struct ThreeOne, _presence_map), asn_MAP_ThreeOne_tag2el_1, 2, /* Count of tags in the map */ asn_MAP_ThreeOne_tag2el_1, /* Same as above */ 2, /* Count of tags in the CXER map */ 0, /* Whether extensible */ (unsigned int *)asn_MAP_ThreeOne_mmap_1 /* Mandatory elements map */ }; asn_TYPE_descriptor_t asn_DEF_ThreeOne = { "ThreeOne", "ThreeOne", SET_free, SET_print, SET_constraint, SET_decode_ber, SET_encode_der, SET_decode_xer, SET_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_ThreeOne_tags_1, sizeof(asn_DEF_ThreeOne_tags_1) /sizeof(asn_DEF_ThreeOne_tags_1[0]), /* 1 */ asn_DEF_ThreeOne_tags_1, /* Same as above */ sizeof(asn_DEF_ThreeOne_tags_1) /sizeof(asn_DEF_ThreeOne_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_ThreeOne_1, 2, /* Elements count */ &asn_SPC_ThreeOne_specs_1 /* Additional specs */ }; asn1c-0.9.28+dfsg/tests/30-set-OK.asn10000644000000000000000000000060613065714043015511 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .30 ModuleTestSetSimple { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 30 } DEFINITIONS IMPLICIT TAGS ::= BEGIN T ::= SET { i [APPLICATION 3] INTEGER, s IA5String, ..., b [2] BOOLEAN } END asn1c-0.9.28+dfsg/tests/69-reserved-words-OK.asn10000644000000000000000000000061713065714043017707 0ustar rootroot -- OK: Everything is Fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .69 ModuleTestReservedWords { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 69 } DEFINITIONS ::= BEGIN T ::= SEQUENCE { int INTEGER, char OCTET STRING (SIZE(1)), class SET { ... }, double REAL } END asn1c-0.9.28+dfsg/tests/41-int-optional-OK.asn10000644000000000000000000000100413065714043017326 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .41 ModuleTestIntOptional { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 41 } DEFINITIONS AUTOMATIC TAGS ::= BEGIN T ::= CHOICE { seq SEQUENCE { string UTF8String, alpha INTEGER OPTIONAL, beta INTEGER OPTIONAL }, set SET { string UTF8String, alpha INTEGER OPTIONAL, beta INTEGER OPTIONAL } } END asn1c-0.9.28+dfsg/tests/123-valueassignment-OK.asn1.-EF0000644000000000000000000000033513065714043020553 0ustar rootrootModuleValueAssignmentConstrained { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 123 } DEFINITIONS AUTOMATIC TAGS ::= BEGIN zzz OCTET STRING (SIZE(1)) ::= '0001'B END asn1c-0.9.28+dfsg/tests/113-bit-string-SE.asn10000644000000000000000000000053113065714043017055 0ustar rootroot -- SE: Semantic error -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .113 ModuleBitStringIdentifierUniqueness { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 113 } DEFINITIONS ::= BEGIN T ::= BIT STRING { one(1), one(2) } END asn1c-0.9.28+dfsg/tests/48-real-life-OK.asn10000644000000000000000000000066113065714043016570 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .48 ModuleSetChoiceExtensibility { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 48 } DEFINITIONS ::= BEGIN /* * 0.8.14 had problem saving/reloading this object */ UserIdentifier ::= CHOICE { phoneNumber [3] EXPLICIT IA5String } END asn1c-0.9.28+dfsg/tests/59-choice-extended-OK.asn10000644000000000000000000000063713065714043017765 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .59 ModuleTestExtensibleChoice { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 59 } DEFINITIONS AUTOMATIC TAGS ::= BEGIN Choice ::= [123] CHOICE { a INTEGER, ..., b INTEGER, c Choice -- A reference to itself } END asn1c-0.9.28+dfsg/tests/32-sequence-of-OK.asn10000644000000000000000000000124513065714043017132 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .32 ModuleTestSequenceSimple { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 32 } DEFINITIONS IMPLICIT TAGS ::= BEGIN Programming ::= SEQUENCE SIZE(1..maxSize) OF [0] IMPLICIT Fault Fault ::= SET OF Error Error ::= SEQUENCE { ... } maxSize INTEGER ::= 10 SeqWithMandatory ::= SEQUENCE { someString UTF8String, seqOfMan [0] EXPLICIT SEQUENCE OF Error } SeqWithOptional ::= SEQUENCE { someString UTF8String, seqOfOpt [0] EXPLICIT SEQUENCE OF Error OPTIONAL } END asn1c-0.9.28+dfsg/tests/50-constraint-OK.asn10000644000000000000000000000522113065714043017102 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .50 1 -- .50 2 ModuleNestedConstraintsCheck { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 50 1 } DEFINITIONS ::= BEGIN IMPORTS Identifier FROM IdentifierModule; Int1 ::= INTEGER Int2 ::= Int1 (0..MAX) -- X.680-0207::41.4.4 Int3 ::= Int2 (MIN..ten) -- Means (0..10) Int4 ::= Int3 (5..MAX,...,1..4) -- Means (1..10,...) Int5 ::= Int4 (MIN..5) -- Means (5) -- Int6 ::= INTEGER (Int5) -- -- Not yet supported ten Int1 ::= other-ten other-ten Int2 ::= 10 -- G.4.3.4 ExtensibleExtensions ::= INTEGER ((1..256,...) INTERSECTION (1..256)) Str1 ::= IA5String Str2 ::= Str1 (SIZE(MIN..20 | 25..30)) -- Means (SIZE(0..20 | 25..30)) Str3 ::= Str2 (SIZE(10..27))(FROM("ABC"|"def")) -- (SIZE(10..20,25..27))(FROM("ABCdef")) Str4 ::= IA5String ("ABCD"|SIZE(4)) -- Not PER-visible PER-Visible ::= IA5String (FROM("A".."F")) PER-Visible-2 ::= PER-Visible (FROM("E".."F")) -- Means (FROM("EF")) -- The following maintain parent permitted alphabet constraint Not-PER-Visible-1 ::= PER-Visible (FROM("AB") | SIZE(1..2)) Not-PER-Visible-2 ::= PER-Visible (FROM("AB",...)) Not-PER-Visible-3 ::= PER-Visible (FROM("AB"),...) SIZE-but-not-FROM ::= PER-Visible (SIZE(1..4) ^ FROM("ABCD",...)) SIZE-and-FROM ::= PER-Visible (SIZE(1..4) ^ FROM("ABCD")) Neither-SIZE-nor-FROM ::= PER-Visible (SIZE(1..4) | FROM("ABCD",...)) Utf8-4 ::= UTF8String (FROM("A".."Z")) -- Alphabet Utf8-3 ::= Utf8-2 (FROM("A".."Z"|"a".."z")) -- Alphabet and size Utf8-2 ::= Utf8-1 (SIZE(1..2)) -- Size Utf8-1 ::= UTF8String VisibleIdentifier ::= Identifier Sequence ::= SEQUENCE { int1-c Int1 (-2..MAX) DEFAULT 3, int4 [2] Int4, int4-c Int4 (MIN..7), bool BOOLEAN DEFAULT 1, enum-c ENUMERATED { one(1), two(2), ..., three(3) }, ..., int5-c Int5 (5) OPTIONAL, ..., null NULL OPTIONAL } SequenceOf ::= SEQUENCE (SIZE(1..2)) OF Sequence Enum0 ::= ENUMERATED { one, two } Enum1 ::= ENUMERATED { one, two } (one) END IdentifierModule { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 50 2 } DEFINITIONS ::= BEGIN EXPORTS Identifier; maxIdentifier INTEGER ::= 32 Identifier ::= VisibleString ( FROM ("A"|"a"|"B"|"b"|"C"|"c"|"D"|"d"|"E"|"e"|"F"|"f"| "G"|"g"|"H"|"h"|"I"|"i"|"J"|"j"|"K"|"k"|"L"|"l"| "M"|"m"|"N"|"n"|"O"|"o"|"P"|"p"|"Q"|"q"|"R"|"r"| "S"|"s"|"T"|"t"|"U"|"u"|"V"|"v"|"W"|"w"|"X"|"x"| "Y"|"y"|"Z"|"z"|"$"|"_"|"0"|"1"|"2"|"3"|"4"|"5"| "6"|"7"|"8"|"9") ) (SIZE(1..maxIdentifier)) END asn1c-0.9.28+dfsg/tests/44-choice-in-sequence-OK.asn10000644000000000000000000000111313065714043020361 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .44 ModuleChoiceInSequence { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 44 } DEFINITIONS IMPLICIT TAGS ::= BEGIN T ::= [PRIVATE 1] SEQUENCE { a [PRIVATE 2] NULL, b CHOICE { c [PRIVATE 5] NULL, d [PRIVATE 6] NULL, e CHOICE { f [PRIVATE 7] NULL, g [PRIVATE 8] NULL }, h [PRIVATE 9] CHOICE { -- EXPLICIT! i [PRIVATE 1] NULL, j [PRIVATE 2] NULL } } } END asn1c-0.9.28+dfsg/tests/46-redefine-OK.asn10000644000000000000000000000065513065714043016512 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .46 ModuleRedefineType { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 46 } DEFINITIONS IMPLICIT TAGS ::= BEGIN PrimitiveType ::= OCTET STRING ConstructedType ::= SEQUENCE { field [5] PrimitiveType } T ::= [3] ConstructedType END asn1c-0.9.28+dfsg/tests/03-enum-OK.asn10000644000000000000000000000144713065714043015666 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .3 ModuleTestEnum1 { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 3 } DEFINITIONS ::= BEGIN Enum1 ::= ENUMERATED { red, -- will be 0 -- green, -- will be 1 -- blue(4), alpha, ... -- extensible -- } Enum2 ::= ENUMERATED { red, -- will be 0 -- green, -- will be 1 -- blue(45), orange(23), -- Does not have to be ordered -- alpha, ..., -- extensible -- beta(12), -- May be less than the max value in the root -- gamma(103) -- Must be ordered -- } Enum3 ::= ENUMERATED { a, b(3), ..., c(1) } Enum4 ::= ENUMERATED { a, b, ..., c(3), d } Enum5 ::= ENUMERATED { a, z(25), ..., d } END asn1c-0.9.28+dfsg/tests/26-sequence-SE.asn10000644000000000000000000000057613065714043016537 0ustar rootroot -- SE: Semantic error -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .26 ModuleTestSequenceTagsDistinct { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 26 } DEFINITIONS IMPLICIT TAGS ::= BEGIN T ::= SEQUENCE { a INTEGER, b INTEGER OPTIONAL, c INTEGER } END asn1c-0.9.28+dfsg/tests/03-enum-OK.asn1.-Pfwide-types0000644000000000000000000005722513065714043020327 0ustar rootroot /*** <<< INCLUDES [Enum1] >>> ***/ #include /*** <<< DEPS [Enum1] >>> ***/ typedef enum Enum1 { Enum1_red = 0, Enum1_green = 1, Enum1_blue = 4, Enum1_alpha = 5 /* * Enumeration is extensible */ } e_Enum1; /*** <<< TYPE-DECLS [Enum1] >>> ***/ typedef ENUMERATED_t Enum1_t; /*** <<< FUNC-DECLS [Enum1] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Enum1; asn_struct_free_f Enum1_free; asn_struct_print_f Enum1_print; asn_constr_check_f Enum1_constraint; ber_type_decoder_f Enum1_decode_ber; der_type_encoder_f Enum1_encode_der; xer_type_decoder_f Enum1_decode_xer; xer_type_encoder_f Enum1_encode_xer; /*** <<< CODE [Enum1] >>> ***/ int Enum1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ENUMERATED.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using ENUMERATED, * so here we adjust the DEF accordingly. */ static void Enum1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_ENUMERATED.free_struct; td->print_struct = asn_DEF_ENUMERATED.print_struct; td->check_constraints = asn_DEF_ENUMERATED.check_constraints; td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; td->der_encoder = asn_DEF_ENUMERATED.der_encoder; td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; td->elements = asn_DEF_ENUMERATED.elements; td->elements_count = asn_DEF_ENUMERATED.elements_count; /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ } void Enum1_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Enum1_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Enum1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Enum1_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Enum1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Enum1_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Enum1_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Enum1_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Enum1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Enum1_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Enum1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Enum1_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [Enum1] >>> ***/ static const asn_INTEGER_enum_map_t asn_MAP_Enum1_value2enum_1[] = { { 0, 3, "red" }, { 1, 5, "green" }, { 4, 4, "blue" }, { 5, 5, "alpha" } /* This list is extensible */ }; static const unsigned int asn_MAP_Enum1_enum2value_1[] = { 3, /* alpha(5) */ 2, /* blue(4) */ 1, /* green(1) */ 0 /* red(0) */ /* This list is extensible */ }; static const asn_INTEGER_specifics_t asn_SPC_Enum1_specs_1 = { asn_MAP_Enum1_value2enum_1, /* "tag" => N; sorted by tag */ asn_MAP_Enum1_enum2value_1, /* N => "tag"; sorted by N */ 4, /* Number of elements in the maps */ 5, /* Extensions before this member */ 1, /* Strict enumeration */ 0, /* Native long size */ 0 }; static const ber_tlv_tag_t asn_DEF_Enum1_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Enum1 = { "Enum1", "Enum1", Enum1_free, Enum1_print, Enum1_constraint, Enum1_decode_ber, Enum1_encode_der, Enum1_decode_xer, Enum1_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Enum1_tags_1, sizeof(asn_DEF_Enum1_tags_1) /sizeof(asn_DEF_Enum1_tags_1[0]), /* 1 */ asn_DEF_Enum1_tags_1, /* Same as above */ sizeof(asn_DEF_Enum1_tags_1) /sizeof(asn_DEF_Enum1_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* Defined elsewhere */ &asn_SPC_Enum1_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Enum2] >>> ***/ #include /*** <<< DEPS [Enum2] >>> ***/ typedef enum Enum2 { Enum2_red = 0, Enum2_green = 1, Enum2_blue = 45, Enum2_orange = 23, Enum2_alpha = 46, /* * Enumeration is extensible */ Enum2_beta = 12, Enum2_gamma = 103 } e_Enum2; /*** <<< TYPE-DECLS [Enum2] >>> ***/ typedef ENUMERATED_t Enum2_t; /*** <<< FUNC-DECLS [Enum2] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Enum2; asn_struct_free_f Enum2_free; asn_struct_print_f Enum2_print; asn_constr_check_f Enum2_constraint; ber_type_decoder_f Enum2_decode_ber; der_type_encoder_f Enum2_encode_der; xer_type_decoder_f Enum2_decode_xer; xer_type_encoder_f Enum2_encode_xer; /*** <<< CODE [Enum2] >>> ***/ int Enum2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ENUMERATED.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using ENUMERATED, * so here we adjust the DEF accordingly. */ static void Enum2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_ENUMERATED.free_struct; td->print_struct = asn_DEF_ENUMERATED.print_struct; td->check_constraints = asn_DEF_ENUMERATED.check_constraints; td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; td->der_encoder = asn_DEF_ENUMERATED.der_encoder; td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; td->elements = asn_DEF_ENUMERATED.elements; td->elements_count = asn_DEF_ENUMERATED.elements_count; /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ } void Enum2_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Enum2_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Enum2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Enum2_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Enum2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Enum2_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Enum2_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Enum2_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Enum2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Enum2_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Enum2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Enum2_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [Enum2] >>> ***/ static const asn_INTEGER_enum_map_t asn_MAP_Enum2_value2enum_1[] = { { 0, 3, "red" }, { 1, 5, "green" }, { 12, 4, "beta" }, { 23, 6, "orange" }, { 45, 4, "blue" }, { 46, 5, "alpha" }, { 103, 5, "gamma" } /* This list is extensible */ }; static const unsigned int asn_MAP_Enum2_enum2value_1[] = { 5, /* alpha(46) */ 2, /* beta(12) */ 4, /* blue(45) */ 6, /* gamma(103) */ 1, /* green(1) */ 3, /* orange(23) */ 0 /* red(0) */ /* This list is extensible */ }; static const asn_INTEGER_specifics_t asn_SPC_Enum2_specs_1 = { asn_MAP_Enum2_value2enum_1, /* "tag" => N; sorted by tag */ asn_MAP_Enum2_enum2value_1, /* N => "tag"; sorted by N */ 7, /* Number of elements in the maps */ 6, /* Extensions before this member */ 1, /* Strict enumeration */ 0, /* Native long size */ 0 }; static const ber_tlv_tag_t asn_DEF_Enum2_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Enum2 = { "Enum2", "Enum2", Enum2_free, Enum2_print, Enum2_constraint, Enum2_decode_ber, Enum2_encode_der, Enum2_decode_xer, Enum2_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Enum2_tags_1, sizeof(asn_DEF_Enum2_tags_1) /sizeof(asn_DEF_Enum2_tags_1[0]), /* 1 */ asn_DEF_Enum2_tags_1, /* Same as above */ sizeof(asn_DEF_Enum2_tags_1) /sizeof(asn_DEF_Enum2_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* Defined elsewhere */ &asn_SPC_Enum2_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Enum3] >>> ***/ #include /*** <<< DEPS [Enum3] >>> ***/ typedef enum Enum3 { Enum3_a = 0, Enum3_b = 3, /* * Enumeration is extensible */ Enum3_c = 1 } e_Enum3; /*** <<< TYPE-DECLS [Enum3] >>> ***/ typedef ENUMERATED_t Enum3_t; /*** <<< FUNC-DECLS [Enum3] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Enum3; asn_struct_free_f Enum3_free; asn_struct_print_f Enum3_print; asn_constr_check_f Enum3_constraint; ber_type_decoder_f Enum3_decode_ber; der_type_encoder_f Enum3_encode_der; xer_type_decoder_f Enum3_decode_xer; xer_type_encoder_f Enum3_encode_xer; /*** <<< CODE [Enum3] >>> ***/ int Enum3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ENUMERATED.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using ENUMERATED, * so here we adjust the DEF accordingly. */ static void Enum3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_ENUMERATED.free_struct; td->print_struct = asn_DEF_ENUMERATED.print_struct; td->check_constraints = asn_DEF_ENUMERATED.check_constraints; td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; td->der_encoder = asn_DEF_ENUMERATED.der_encoder; td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; td->elements = asn_DEF_ENUMERATED.elements; td->elements_count = asn_DEF_ENUMERATED.elements_count; /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ } void Enum3_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Enum3_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Enum3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Enum3_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Enum3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Enum3_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Enum3_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Enum3_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Enum3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Enum3_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Enum3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Enum3_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [Enum3] >>> ***/ static const asn_INTEGER_enum_map_t asn_MAP_Enum3_value2enum_1[] = { { 0, 1, "a" }, { 1, 1, "c" }, { 3, 1, "b" } /* This list is extensible */ }; static const unsigned int asn_MAP_Enum3_enum2value_1[] = { 0, /* a(0) */ 2, /* b(3) */ 1 /* c(1) */ /* This list is extensible */ }; static const asn_INTEGER_specifics_t asn_SPC_Enum3_specs_1 = { asn_MAP_Enum3_value2enum_1, /* "tag" => N; sorted by tag */ asn_MAP_Enum3_enum2value_1, /* N => "tag"; sorted by N */ 3, /* Number of elements in the maps */ 3, /* Extensions before this member */ 1, /* Strict enumeration */ 0, /* Native long size */ 0 }; static const ber_tlv_tag_t asn_DEF_Enum3_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Enum3 = { "Enum3", "Enum3", Enum3_free, Enum3_print, Enum3_constraint, Enum3_decode_ber, Enum3_encode_der, Enum3_decode_xer, Enum3_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Enum3_tags_1, sizeof(asn_DEF_Enum3_tags_1) /sizeof(asn_DEF_Enum3_tags_1[0]), /* 1 */ asn_DEF_Enum3_tags_1, /* Same as above */ sizeof(asn_DEF_Enum3_tags_1) /sizeof(asn_DEF_Enum3_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* Defined elsewhere */ &asn_SPC_Enum3_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Enum4] >>> ***/ #include /*** <<< DEPS [Enum4] >>> ***/ typedef enum Enum4 { Enum4_a = 0, Enum4_b = 1, /* * Enumeration is extensible */ Enum4_c = 3, Enum4_d = 4 } e_Enum4; /*** <<< TYPE-DECLS [Enum4] >>> ***/ typedef ENUMERATED_t Enum4_t; /*** <<< FUNC-DECLS [Enum4] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Enum4; asn_struct_free_f Enum4_free; asn_struct_print_f Enum4_print; asn_constr_check_f Enum4_constraint; ber_type_decoder_f Enum4_decode_ber; der_type_encoder_f Enum4_encode_der; xer_type_decoder_f Enum4_decode_xer; xer_type_encoder_f Enum4_encode_xer; /*** <<< CODE [Enum4] >>> ***/ int Enum4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ENUMERATED.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using ENUMERATED, * so here we adjust the DEF accordingly. */ static void Enum4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_ENUMERATED.free_struct; td->print_struct = asn_DEF_ENUMERATED.print_struct; td->check_constraints = asn_DEF_ENUMERATED.check_constraints; td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; td->der_encoder = asn_DEF_ENUMERATED.der_encoder; td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; td->elements = asn_DEF_ENUMERATED.elements; td->elements_count = asn_DEF_ENUMERATED.elements_count; /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ } void Enum4_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Enum4_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Enum4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Enum4_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Enum4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Enum4_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Enum4_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Enum4_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Enum4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Enum4_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Enum4_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Enum4_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [Enum4] >>> ***/ static const asn_INTEGER_enum_map_t asn_MAP_Enum4_value2enum_1[] = { { 0, 1, "a" }, { 1, 1, "b" }, { 3, 1, "c" }, { 4, 1, "d" } /* This list is extensible */ }; static const unsigned int asn_MAP_Enum4_enum2value_1[] = { 0, /* a(0) */ 1, /* b(1) */ 2, /* c(3) */ 3 /* d(4) */ /* This list is extensible */ }; static const asn_INTEGER_specifics_t asn_SPC_Enum4_specs_1 = { asn_MAP_Enum4_value2enum_1, /* "tag" => N; sorted by tag */ asn_MAP_Enum4_enum2value_1, /* N => "tag"; sorted by N */ 4, /* Number of elements in the maps */ 3, /* Extensions before this member */ 1, /* Strict enumeration */ 0, /* Native long size */ 0 }; static const ber_tlv_tag_t asn_DEF_Enum4_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Enum4 = { "Enum4", "Enum4", Enum4_free, Enum4_print, Enum4_constraint, Enum4_decode_ber, Enum4_encode_der, Enum4_decode_xer, Enum4_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Enum4_tags_1, sizeof(asn_DEF_Enum4_tags_1) /sizeof(asn_DEF_Enum4_tags_1[0]), /* 1 */ asn_DEF_Enum4_tags_1, /* Same as above */ sizeof(asn_DEF_Enum4_tags_1) /sizeof(asn_DEF_Enum4_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* Defined elsewhere */ &asn_SPC_Enum4_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Enum5] >>> ***/ #include /*** <<< DEPS [Enum5] >>> ***/ typedef enum Enum5 { Enum5_a = 0, Enum5_z = 25, /* * Enumeration is extensible */ Enum5_d = 26 } e_Enum5; /*** <<< TYPE-DECLS [Enum5] >>> ***/ typedef ENUMERATED_t Enum5_t; /*** <<< FUNC-DECLS [Enum5] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Enum5; asn_struct_free_f Enum5_free; asn_struct_print_f Enum5_print; asn_constr_check_f Enum5_constraint; ber_type_decoder_f Enum5_decode_ber; der_type_encoder_f Enum5_encode_der; xer_type_decoder_f Enum5_decode_xer; xer_type_encoder_f Enum5_encode_xer; /*** <<< CODE [Enum5] >>> ***/ int Enum5_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ENUMERATED.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using ENUMERATED, * so here we adjust the DEF accordingly. */ static void Enum5_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_ENUMERATED.free_struct; td->print_struct = asn_DEF_ENUMERATED.print_struct; td->check_constraints = asn_DEF_ENUMERATED.check_constraints; td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; td->der_encoder = asn_DEF_ENUMERATED.der_encoder; td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; td->elements = asn_DEF_ENUMERATED.elements; td->elements_count = asn_DEF_ENUMERATED.elements_count; /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ } void Enum5_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Enum5_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Enum5_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Enum5_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Enum5_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Enum5_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Enum5_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Enum5_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Enum5_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Enum5_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Enum5_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Enum5_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [Enum5] >>> ***/ static const asn_INTEGER_enum_map_t asn_MAP_Enum5_value2enum_1[] = { { 0, 1, "a" }, { 25, 1, "z" }, { 26, 1, "d" } /* This list is extensible */ }; static const unsigned int asn_MAP_Enum5_enum2value_1[] = { 0, /* a(0) */ 2, /* d(26) */ 1 /* z(25) */ /* This list is extensible */ }; static const asn_INTEGER_specifics_t asn_SPC_Enum5_specs_1 = { asn_MAP_Enum5_value2enum_1, /* "tag" => N; sorted by tag */ asn_MAP_Enum5_enum2value_1, /* N => "tag"; sorted by N */ 3, /* Number of elements in the maps */ 3, /* Extensions before this member */ 1, /* Strict enumeration */ 0, /* Native long size */ 0 }; static const ber_tlv_tag_t asn_DEF_Enum5_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Enum5 = { "Enum5", "Enum5", Enum5_free, Enum5_print, Enum5_constraint, Enum5_decode_ber, Enum5_encode_der, Enum5_decode_xer, Enum5_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Enum5_tags_1, sizeof(asn_DEF_Enum5_tags_1) /sizeof(asn_DEF_Enum5_tags_1[0]), /* 1 */ asn_DEF_Enum5_tags_1, /* Same as above */ sizeof(asn_DEF_Enum5_tags_1) /sizeof(asn_DEF_Enum5_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* Defined elsewhere */ &asn_SPC_Enum5_specs_1 /* Additional specs */ }; asn1c-0.9.28+dfsg/tests/89-bit-string-enum-OK.asn1.-Pfcompound-names0000644000000000000000000000347713065714043023260 0ustar rootroot /*** <<< INCLUDES [T] >>> ***/ #include #include /*** <<< DEPS [T] >>> ***/ typedef enum T_PR { T_PR_NOTHING, /* No components present */ T_PR_bs } T_PR; typedef enum T__bs { T__bs_a = 1, T__bs_b = 2 } e_T__bs; /*** <<< TYPE-DECLS [T] >>> ***/ typedef struct T { T_PR present; union T_u { BIT_STRING_t bs; } choice; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } T_t; /*** <<< FUNC-DECLS [T] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_T; /*** <<< STAT-DEFS [T] >>> ***/ static asn_TYPE_member_t asn_MBR_T_1[] = { { ATF_NOFLAGS, 0, offsetof(struct T, choice.bs), .tag = (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), .tag_mode = 0, .type = &asn_DEF_BIT_STRING, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "bs" }, }; static const asn_TYPE_tag2member_t asn_MAP_T_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 0, 0, 0 } /* bs */ }; static asn_CHOICE_specifics_t asn_SPC_T_specs_1 = { sizeof(struct T), offsetof(struct T, _asn_ctx), offsetof(struct T, present), sizeof(((struct T *)0)->present), asn_MAP_T_tag2el_1, 1, /* Count of tags in the map */ .canonical_order = 0, .ext_start = -1 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_T = { "T", "T", CHOICE_free, CHOICE_print, CHOICE_constraint, CHOICE_decode_ber, CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ 0, /* No tags (pointer) */ 0, /* No tags (count) */ 0, /* No PER visible constraints */ asn_MBR_T_1, 1, /* Elements count */ &asn_SPC_T_specs_1 /* Additional specs */ }; asn1c-0.9.28+dfsg/tests/89-bit-string-enum-OK.asn10000644000000000000000000000053613065714043017762 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .89 ModuleBitStringEnumeration { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 89 } DEFINITIONS ::= BEGIN T ::= CHOICE { bs BIT STRING { a(1), b(2) } } END asn1c-0.9.28+dfsg/tests/43-recursion-OK.asn1.-Pfwide-types0000644000000000000000000004261013065714043021370 0ustar rootroot /*** <<< INCLUDES [Test-structure-1] >>> ***/ #include #include #include #include #include #include /*** <<< FWD-DECLS [Test-structure-1] >>> ***/ struct Test_structure_1; /*** <<< TYPE-DECLS [Test-structure-1] >>> ***/ typedef struct Test_structure_1 { struct t_member1 { A_SET_OF(struct Test_structure_1) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } t_member1; struct t_member2 { A_SEQUENCE_OF(struct Test_structure_1) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } t_member2; struct Test_structure_1 *t_member3 /* OPTIONAL */; INTEGER_t t_member4; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Test_structure_1_t; /*** <<< FUNC-DECLS [Test-structure-1] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Test_structure_1; /*** <<< POST-INCLUDE [Test-structure-1] >>> ***/ #include "Test-structure-1.h" /*** <<< STAT-DEFS [Test-structure-1] >>> ***/ static asn_TYPE_member_t asn_MBR_t_member1_2[] = { { ATF_POINTER, 0, 0, .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), .tag_mode = 0, .type = &asn_DEF_Test_structure_1, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "" }, }; static const ber_tlv_tag_t asn_DEF_t_member1_tags_2[] = { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_t_member1_specs_2 = { sizeof(struct t_member1), offsetof(struct t_member1, _asn_ctx), 0, /* XER encoding is XMLDelimitedItemList */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_t_member1_2 = { "t-member1", "t-member1", SET_OF_free, SET_OF_print, SET_OF_constraint, SET_OF_decode_ber, SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_t_member1_tags_2, sizeof(asn_DEF_t_member1_tags_2) /sizeof(asn_DEF_t_member1_tags_2[0]), /* 1 */ asn_DEF_t_member1_tags_2, /* Same as above */ sizeof(asn_DEF_t_member1_tags_2) /sizeof(asn_DEF_t_member1_tags_2[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_t_member1_2, 1, /* Single element */ &asn_SPC_t_member1_specs_2 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_t_member2_4[] = { { ATF_POINTER, 0, 0, .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), .tag_mode = 0, .type = &asn_DEF_Test_structure_1, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "" }, }; static const ber_tlv_tag_t asn_DEF_t_member2_tags_4[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_t_member2_specs_4 = { sizeof(struct t_member2), offsetof(struct t_member2, _asn_ctx), 0, /* XER encoding is XMLDelimitedItemList */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_t_member2_4 = { "t-member2", "t-member2", SEQUENCE_OF_free, SEQUENCE_OF_print, SEQUENCE_OF_constraint, SEQUENCE_OF_decode_ber, SEQUENCE_OF_encode_der, SEQUENCE_OF_decode_xer, SEQUENCE_OF_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_t_member2_tags_4, sizeof(asn_DEF_t_member2_tags_4) /sizeof(asn_DEF_t_member2_tags_4[0]), /* 1 */ asn_DEF_t_member2_tags_4, /* Same as above */ sizeof(asn_DEF_t_member2_tags_4) /sizeof(asn_DEF_t_member2_tags_4[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_t_member2_4, 1, /* Single element */ &asn_SPC_t_member2_specs_4 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_Test_structure_1_1[] = { { ATF_NOFLAGS, 0, offsetof(struct Test_structure_1, t_member1), .tag = (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), .tag_mode = 0, .type = &asn_DEF_t_member1_2, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "t-member1" }, { ATF_NOFLAGS, 0, offsetof(struct Test_structure_1, t_member2), .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), .tag_mode = 0, .type = &asn_DEF_t_member2_4, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "t-member2" }, { ATF_POINTER, 1, offsetof(struct Test_structure_1, t_member3), .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), .tag_mode = 0, .type = &asn_DEF_Test_structure_1, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "t-member3" }, { ATF_NOFLAGS, 0, offsetof(struct Test_structure_1, t_member4), .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), .tag_mode = 0, .type = &asn_DEF_INTEGER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "t-member4" }, }; static const ber_tlv_tag_t asn_DEF_Test_structure_1_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_Test_structure_1_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 3, 0, 0 }, /* t-member4 */ { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 1, 0, 1 }, /* t-member2 */ { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 2, -1, 0 }, /* t-member3 */ { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), 0, 0, 0 } /* t-member1 */ }; static asn_SEQUENCE_specifics_t asn_SPC_Test_structure_1_specs_1 = { sizeof(struct Test_structure_1), offsetof(struct Test_structure_1, _asn_ctx), asn_MAP_Test_structure_1_tag2el_1, 4, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Test_structure_1 = { "Test-structure-1", "Test-structure-1", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Test_structure_1_tags_1, sizeof(asn_DEF_Test_structure_1_tags_1) /sizeof(asn_DEF_Test_structure_1_tags_1[0]), /* 1 */ asn_DEF_Test_structure_1_tags_1, /* Same as above */ sizeof(asn_DEF_Test_structure_1_tags_1) /sizeof(asn_DEF_Test_structure_1_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Test_structure_1_1, 4, /* Elements count */ &asn_SPC_Test_structure_1_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Choice-1] >>> ***/ #include #include #include #include /*** <<< DEPS [Choice-1] >>> ***/ typedef enum Choice_1_PR { Choice_1_PR_NOTHING, /* No components present */ Choice_1_PR_and, Choice_1_PR_or, Choice_1_PR_not, Choice_1_PR_other } Choice_1_PR; /*** <<< FWD-DECLS [Choice-1] >>> ***/ struct Choice_1; /*** <<< TYPE-DECLS [Choice-1] >>> ***/ typedef struct Choice_1 { Choice_1_PR present; union Choice_1_u { struct Choice_1 *And; struct Or { A_SET_OF(struct Choice_1) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Or; struct Choice_1 *Not; INTEGER_t other; } choice; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Choice_1_t; /*** <<< FUNC-DECLS [Choice-1] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Choice_1; /*** <<< POST-INCLUDE [Choice-1] >>> ***/ #include "Choice-1.h" /*** <<< STAT-DEFS [Choice-1] >>> ***/ static asn_TYPE_member_t asn_MBR_or_3[] = { { ATF_POINTER, 0, 0, .tag = -1 /* Ambiguous tag (CHOICE?) */, .tag_mode = 0, .type = &asn_DEF_Choice_1, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "" }, }; static const ber_tlv_tag_t asn_DEF_or_tags_3[] = { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_or_specs_3 = { sizeof(struct Or), offsetof(struct Or, _asn_ctx), 2, /* XER encoding is XMLValueList */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_or_3 = { "or", "or", SET_OF_free, SET_OF_print, SET_OF_constraint, SET_OF_decode_ber, SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_or_tags_3, sizeof(asn_DEF_or_tags_3) /sizeof(asn_DEF_or_tags_3[0]) - 1, /* 1 */ asn_DEF_or_tags_3, /* Same as above */ sizeof(asn_DEF_or_tags_3) /sizeof(asn_DEF_or_tags_3[0]), /* 2 */ 0, /* No PER visible constraints */ asn_MBR_or_3, 1, /* Single element */ &asn_SPC_or_specs_3 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_Choice_1_1[] = { { ATF_POINTER, 0, offsetof(struct Choice_1, choice.And), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = +1, /* EXPLICIT tag at current level */ .type = &asn_DEF_Choice_1, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "and" }, { ATF_NOFLAGS, 0, offsetof(struct Choice_1, choice.Or), .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), .tag_mode = 0, .type = &asn_DEF_or_3, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "or" }, { ATF_POINTER, 0, offsetof(struct Choice_1, choice.Not), .tag = (ASN_TAG_CLASS_CONTEXT | (3 << 2)), .tag_mode = +1, /* EXPLICIT tag at current level */ .type = &asn_DEF_Choice_1, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "not" }, { ATF_NOFLAGS, 0, offsetof(struct Choice_1, choice.other), .tag = (ASN_TAG_CLASS_CONTEXT | (4 << 2)), .tag_mode = +1, /* EXPLICIT tag at current level */ .type = &asn_DEF_INTEGER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "other" }, }; static const asn_TYPE_tag2member_t asn_MAP_Choice_1_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 0, 0, 0 }, /* and */ { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 1, 0, 0 }, /* or */ { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 2, 0, 0 }, /* not */ { (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 3, 0, 0 } /* other */ }; static asn_CHOICE_specifics_t asn_SPC_Choice_1_specs_1 = { sizeof(struct Choice_1), offsetof(struct Choice_1, _asn_ctx), offsetof(struct Choice_1, present), sizeof(((struct Choice_1 *)0)->present), asn_MAP_Choice_1_tag2el_1, 4, /* Count of tags in the map */ .canonical_order = 0, .ext_start = -1 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_Choice_1 = { "Choice-1", "Choice-1", CHOICE_free, CHOICE_print, CHOICE_constraint, CHOICE_decode_ber, CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ 0, /* No tags (pointer) */ 0, /* No tags (count) */ 0, /* No PER visible constraints */ asn_MBR_Choice_1_1, 4, /* Elements count */ &asn_SPC_Choice_1_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Test-structure-2] >>> ***/ #include /*** <<< DEPS [Test-structure-2] >>> ***/ /* * Method of determining the components presence */ typedef enum Test_structure_2_PR { Test_structure_2_PR_m1, /* Member m1 is present */ } Test_structure_2_PR; /*** <<< FWD-DECLS [Test-structure-2] >>> ***/ struct Test_structure_3; /*** <<< TYPE-DECLS [Test-structure-2] >>> ***/ typedef struct Test_structure_2 { struct Test_structure_3 *m1 /* OPTIONAL */; /* Presence bitmask: ASN_SET_ISPRESENT(pTest_structure_2, Test_structure_2_PR_x) */ unsigned int _presence_map [((1+(8*sizeof(unsigned int))-1)/(8*sizeof(unsigned int)))]; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Test_structure_2_t; /*** <<< FUNC-DECLS [Test-structure-2] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Test_structure_2; /*** <<< POST-INCLUDE [Test-structure-2] >>> ***/ #include "Test-structure-3.h" /*** <<< STAT-DEFS [Test-structure-2] >>> ***/ static asn_TYPE_member_t asn_MBR_Test_structure_2_1[] = { { ATF_POINTER, 1, offsetof(struct Test_structure_2, m1), .tag = (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), .tag_mode = 0, .type = &asn_DEF_Test_structure_3, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "m1" }, }; static const ber_tlv_tag_t asn_DEF_Test_structure_2_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_Test_structure_2_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), 0, 0, 0 } /* m1 */ }; static const uint8_t asn_MAP_Test_structure_2_mmap_1[(1 + (8 * sizeof(unsigned int)) - 1) / 8] = { (0 << 7) }; static asn_SET_specifics_t asn_SPC_Test_structure_2_specs_1 = { sizeof(struct Test_structure_2), offsetof(struct Test_structure_2, _asn_ctx), offsetof(struct Test_structure_2, _presence_map), asn_MAP_Test_structure_2_tag2el_1, 1, /* Count of tags in the map */ asn_MAP_Test_structure_2_tag2el_1, /* Same as above */ 1, /* Count of tags in the CXER map */ 0, /* Whether extensible */ (unsigned int *)asn_MAP_Test_structure_2_mmap_1 /* Mandatory elements map */ }; asn_TYPE_descriptor_t asn_DEF_Test_structure_2 = { "Test-structure-2", "Test-structure-2", SET_free, SET_print, SET_constraint, SET_decode_ber, SET_encode_der, SET_decode_xer, SET_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Test_structure_2_tags_1, sizeof(asn_DEF_Test_structure_2_tags_1) /sizeof(asn_DEF_Test_structure_2_tags_1[0]), /* 1 */ asn_DEF_Test_structure_2_tags_1, /* Same as above */ sizeof(asn_DEF_Test_structure_2_tags_1) /sizeof(asn_DEF_Test_structure_2_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Test_structure_2_1, 1, /* Elements count */ &asn_SPC_Test_structure_2_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Test-structure-3] >>> ***/ #include /*** <<< DEPS [Test-structure-3] >>> ***/ /* * Method of determining the components presence */ typedef enum Test_structure_3_PR { Test_structure_3_PR_m1, /* Member m1 is present */ } Test_structure_3_PR; /*** <<< FWD-DECLS [Test-structure-3] >>> ***/ struct Test_structure_2; /*** <<< TYPE-DECLS [Test-structure-3] >>> ***/ typedef struct Test_structure_3 { struct Test_structure_2 *m1 /* OPTIONAL */; /* Presence bitmask: ASN_SET_ISPRESENT(pTest_structure_3, Test_structure_3_PR_x) */ unsigned int _presence_map [((1+(8*sizeof(unsigned int))-1)/(8*sizeof(unsigned int)))]; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Test_structure_3_t; /*** <<< FUNC-DECLS [Test-structure-3] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Test_structure_3; /*** <<< POST-INCLUDE [Test-structure-3] >>> ***/ #include "Test-structure-2.h" /*** <<< STAT-DEFS [Test-structure-3] >>> ***/ static asn_TYPE_member_t asn_MBR_Test_structure_3_1[] = { { ATF_POINTER, 1, offsetof(struct Test_structure_3, m1), .tag = (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), .tag_mode = 0, .type = &asn_DEF_Test_structure_2, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "m1" }, }; static const ber_tlv_tag_t asn_DEF_Test_structure_3_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_Test_structure_3_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), 0, 0, 0 } /* m1 */ }; static const uint8_t asn_MAP_Test_structure_3_mmap_1[(1 + (8 * sizeof(unsigned int)) - 1) / 8] = { (0 << 7) }; static asn_SET_specifics_t asn_SPC_Test_structure_3_specs_1 = { sizeof(struct Test_structure_3), offsetof(struct Test_structure_3, _asn_ctx), offsetof(struct Test_structure_3, _presence_map), asn_MAP_Test_structure_3_tag2el_1, 1, /* Count of tags in the map */ asn_MAP_Test_structure_3_tag2el_1, /* Same as above */ 1, /* Count of tags in the CXER map */ 0, /* Whether extensible */ (unsigned int *)asn_MAP_Test_structure_3_mmap_1 /* Mandatory elements map */ }; asn_TYPE_descriptor_t asn_DEF_Test_structure_3 = { "Test-structure-3", "Test-structure-3", SET_free, SET_print, SET_constraint, SET_decode_ber, SET_encode_der, SET_decode_xer, SET_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Test_structure_3_tags_1, sizeof(asn_DEF_Test_structure_3_tags_1) /sizeof(asn_DEF_Test_structure_3_tags_1[0]), /* 1 */ asn_DEF_Test_structure_3_tags_1, /* Same as above */ sizeof(asn_DEF_Test_structure_3_tags_1) /sizeof(asn_DEF_Test_structure_3_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Test_structure_3_1, 1, /* Elements count */ &asn_SPC_Test_structure_3_specs_1 /* Additional specs */ }; asn1c-0.9.28+dfsg/tests/14-resolver-OK.asn10000644000000000000000000000304713065714043016563 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .14 1 -- .14 2 -- .14 3 ModuleTestResolver2 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 14 1 } DEFINITIONS ::= BEGIN IMPORTS Enumeration, beta, gamma FROM OtherModuleRenamed { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 14 2 }; -- external references alpha Enumeration ::= beta other Enumeration ::= gamma Struct ::= SEQUENCE { member1 [1] ModuleTestResolver3.Enumeration OPTIONAL, member2 [2] OtherModuleRenamed.Enumeration DEFAULT b } -- -- The following are for post-fix checking by the check_fixer. -- It will be able to pick-up these values if the file is parseable, -- even if it contains some semantic errors. -- check-alpha INTEGER ::= 2 check-other INTEGER ::= 1 END ModuleTestResolver3 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 14 2 } DEFINITIONS ::= BEGIN EXPORTS Enumeration, beta, gamma; IMPORTS gamma, HiddenEnum FROM HiddenModule; beta HiddenEnum ::= b Enumeration ::= ENUMERATED { a(1), b(2) } -- the same type -- END HiddenModule { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 14 3 } DEFINITIONS ::= BEGIN EXPORTS HiddenEnum, gamma; IMPORTS Enumeration FROM ModuleTestResolver3; HiddenEnum ::= ENUMERATED { a(1), b(2) } gamma Enumeration ::= a END asn1c-0.9.28+dfsg/tests/42-real-life-OK.asn1.-EF0000644000000000000000000000155013065714043017126 0ustar rootrootModuleLAPStorage { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 42 } DEFINITIONS EXTENSIBILITY IMPLIED ::= BEGIN LogLine ::= SEQUENCE { line-digest IA5String, varsets SEQUENCE SIZE(1..MAX) OF VariablePartSet, ... } VariablePartSet ::= SEQUENCE { vparts SEQUENCE SIZE(0..MAX) OF VariablePart, resolution ActionItem, ... } VariablePart ::= CHOICE { vset SET SIZE(1..MAX) OF VisibleString, vrange SEQUENCE { from VisibleString, to VisibleString, ... }, ... } ActionItem ::= SEQUENCE { accept-as ENUMERATED { unknown(0), safe(1), unsafe(2), ... }, notify SEQUENCE { critical BOOLEAN, email SET OF VisibleString, ... } OPTIONAL, ... } END asn1c-0.9.28+dfsg/tests/71-duplicate-types-SE.asn10000644000000000000000000000103413065714043020031 0ustar rootroot -- SE: Semantic error -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .71 1 -- .71 2 ModuleDuplicateTypes1 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 71 1 } DEFINITIONS ::= BEGIN Type ::= INTEGER -- Original type. END ModuleDuplicateTypes2 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 71 2 } DEFINITIONS ::= BEGIN Type ::= INTEGER -- A duplicate type. END asn1c-0.9.28+dfsg/tests/22-tags-OK.asn1.-EF0000644000000000000000000000053713065714043016226 0ustar rootrootModuleTestTags3 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 22 } DEFINITIONS AUTOMATIC TAGS ::= BEGIN T1 ::= SEQUENCE { a [0] IMPLICIT INTEGER, b [1] EXPLICIT CHOICE { i [0] IMPLICIT INTEGER, n [1] IMPLICIT IA5String }, c [2] IMPLICIT UTF8String } END asn1c-0.9.28+dfsg/tests/125-bitstring-constraint-OK.asn1.-P0000644000000000000000000001005513065714043021444 0ustar rootroot /*** <<< INCLUDES [T] >>> ***/ #include /*** <<< DEPS [T] >>> ***/ typedef enum T { T_flag1 = 0, T_flag2 = 1, T_flag3 = 2 } e_T; /*** <<< TYPE-DECLS [T] >>> ***/ typedef BIT_STRING_t T_t; /*** <<< FUNC-DECLS [T] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_T; asn_struct_free_f T_free; asn_struct_print_f T_print; asn_constr_check_f T_constraint; ber_type_decoder_f T_decode_ber; der_type_encoder_f T_encode_der; xer_type_decoder_f T_decode_xer; xer_type_encoder_f T_encode_xer; /*** <<< CODE [T] >>> ***/ int T_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(1 /* No applicable constraints whatsoever */) { /* Nothing is here. See below */ } /* Replace with underlying type checker */ td->check_constraints = asn_DEF_BIT_STRING.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using BIT_STRING, * so here we adjust the DEF accordingly. */ static void T_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_BIT_STRING.free_struct; td->print_struct = asn_DEF_BIT_STRING.print_struct; td->check_constraints = asn_DEF_BIT_STRING.check_constraints; td->ber_decoder = asn_DEF_BIT_STRING.ber_decoder; td->der_encoder = asn_DEF_BIT_STRING.der_encoder; td->xer_decoder = asn_DEF_BIT_STRING.xer_decoder; td->xer_encoder = asn_DEF_BIT_STRING.xer_encoder; td->uper_decoder = asn_DEF_BIT_STRING.uper_decoder; td->uper_encoder = asn_DEF_BIT_STRING.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_BIT_STRING.per_constraints; td->elements = asn_DEF_BIT_STRING.elements; td->elements_count = asn_DEF_BIT_STRING.elements_count; td->specifics = asn_DEF_BIT_STRING.specifics; } void T_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { T_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int T_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { T_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t T_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { T_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t T_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { T_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t T_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { T_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t T_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { T_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [T] >>> ***/ static const ber_tlv_tag_t asn_DEF_T_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)) }; asn_TYPE_descriptor_t asn_DEF_T = { "T", "T", T_free, T_print, T_constraint, T_decode_ber, T_encode_der, T_decode_xer, T_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T_tags_1, sizeof(asn_DEF_T_tags_1) /sizeof(asn_DEF_T_tags_1[0]), /* 1 */ asn_DEF_T_tags_1, /* Same as above */ sizeof(asn_DEF_T_tags_1) /sizeof(asn_DEF_T_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* Defined elsewhere */ 0 /* No specifics */ }; asn1c-0.9.28+dfsg/tests/86-atags-OK.asn1.-EF0000644000000000000000000000067113065714043016400 0ustar rootrootModuleAutoTags { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 86 } DEFINITIONS AUTOMATIC TAGS ::= BEGIN A ::= SEQUENCE { a [0] IMPLICIT INTEGER } B ::= SEQUENCE { a [0] IMPLICIT INTEGER } C ::= SEQUENCE { a [0] IMPLICIT INTEGER } D ::= SEQUENCE { a [0] EXPLICIT INTEGER } E ::= SEQUENCE { a [0] EXPLICIT CHOICE { b [0] IMPLICIT INTEGER } } END asn1c-0.9.28+dfsg/tests/75-duplicate-modules-SE.asn10000644000000000000000000000072713065714043020351 0ustar rootroot -- SE: Semantic error -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .75 1 -- .75 1 ModuleDuplicateModuleName { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 75 1 } DEFINITIONS ::= BEGIN END ModuleDuplicateModuleName { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 75 1 } DEFINITIONS ::= BEGIN END asn1c-0.9.28+dfsg/tests/55-components-of-OK.asn10000644000000000000000000000113213065714043017507 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .55 ModuleTestComponentsOf { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 55 } DEFINITIONS AUTOMATIC TAGS ::= BEGIN OneType ::= SEQUENCE { one-1 INTEGER, one-2 [1] BOOLEAN, one-3 SEQUENCE { alpha INTEGER, beta INTEGER, ... }, ..., ignored-in-SecondType INTEGER, ..., one-4 INTEGER } SecondType ::= SEQUENCE { a IA5String, COMPONENTS OF OneType, b UniversalString } END asn1c-0.9.28+dfsg/tests/106-param-constr-OK.asn10000644000000000000000000000077513065714043017417 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .106 ModuleParameterizationWithConstraints { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 106 } DEFINITIONS ::= BEGIN Narrow {Type, INTEGER:value} ::= SEQUENCE { narrow1 Type (1..5) DEFAULT value, narrow2 [0] Type (2..5), narrow3 [1] Type (3..5) OPTIONAL } NarrowInteger ::= Narrow {INTEGER (0..10), 3} END asn1c-0.9.28+dfsg/tests/107-param-constr-2-OK.asn10000644000000000000000000000057713065714043017557 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .107 ModuleParameterizationWithConstraints2 { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 107 } DEFINITIONS ::= BEGIN Narrow {Type} ::= Type (2..5) NarrowInteger ::= Narrow {INTEGER} END asn1c-0.9.28+dfsg/tests/65-multi-tag-OK.asn10000644000000000000000000000113213065714043016624 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .65 ModuleTestMultipleTags { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 65 } DEFINITIONS ::= BEGIN T1 ::= [2] EXPLICIT T2 T2 ::= [3] EXPLICIT T3 T3 ::= [4] IMPLICIT T4 T4 ::= [5] EXPLICIT T5 T5 ::= [6] IMPLICIT T6 T6 ::= REAL T ::= [0] IMPLICIT Ts Ts ::= [123] IMPLICIT SEQUENCE { m1 [1] IMPLICIT T2, -- [1][4][6] m2 [2] EXPLICIT T3 OPTIONAL, -- [2][4][6] m3 [3] IMPLICIT T3 -- [3][6] } END asn1c-0.9.28+dfsg/tests/97-type-identifier-SW.asn1.-EF0000644000000000000000000000113613065714043020421 0ustar rootrootModuleTypeIdentifier1 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 97 1 } DEFINITIONS ::= BEGIN T1 ::= SEQUENCE { id TYPE-IDENTIFIER.&id2, type TYPE-IDENTIFIER.&Type } TYPE-IDENTIFIER ::= CLASS { &id2 OBJECT IDENTIFIER UNIQUE, &Type ANY } WITH SYNTAX { [ &Type ] IDENTIFIED BY &id2 } END ModuleTypeIdentifier2 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 97 2 } DEFINITIONS ::= BEGIN T2 ::= SEQUENCE { id TYPE-IDENTIFIER.&id, type TYPE-IDENTIFIER.&Type } END asn1c-0.9.28+dfsg/tests/06-enum-SE.asn10000644000000000000000000000062413065714043015663 0ustar rootroot -- SE: Semantic error -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .6 ModuleTestEnum4 { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 6 } DEFINITIONS ::= BEGIN enum1 Enum1 ::= red Enum1 ::= ENUMERATED { red(5), ..., green(7), blue(6) -- order is not maintained after ... } END asn1c-0.9.28+dfsg/tests/47-set-ext-OK.asn1.-Pfwide-types0000644000000000000000000002056613065714043020762 0ustar rootroot /*** <<< INCLUDES [T1] >>> ***/ #include #include /*** <<< DEPS [T1] >>> ***/ /* * Method of determining the components presence */ typedef enum T1_PR { T1_PR_i, /* Member i is present */ } T1_PR; /*** <<< TYPE-DECLS [T1] >>> ***/ typedef struct T1 { INTEGER_t i; /* * This type is extensible, * possible extensions are below. */ /* Presence bitmask: ASN_SET_ISPRESENT(pT1, T1_PR_x) */ unsigned int _presence_map [((1+(8*sizeof(unsigned int))-1)/(8*sizeof(unsigned int)))]; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } T1_t; /*** <<< FUNC-DECLS [T1] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_T1; /*** <<< STAT-DEFS [T1] >>> ***/ static asn_TYPE_member_t asn_MBR_T1_1[] = { { ATF_NOFLAGS, 0, offsetof(struct T1, i), .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), .tag_mode = 0, .type = &asn_DEF_INTEGER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "i" }, }; static const ber_tlv_tag_t asn_DEF_T1_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_T1_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 } /* i */ }; static const uint8_t asn_MAP_T1_mmap_1[(1 + (8 * sizeof(unsigned int)) - 1) / 8] = { (1 << 7) }; static asn_SET_specifics_t asn_SPC_T1_specs_1 = { sizeof(struct T1), offsetof(struct T1, _asn_ctx), offsetof(struct T1, _presence_map), asn_MAP_T1_tag2el_1, 1, /* Count of tags in the map */ asn_MAP_T1_tag2el_1, /* Same as above */ 1, /* Count of tags in the CXER map */ 1, /* Whether extensible */ (unsigned int *)asn_MAP_T1_mmap_1 /* Mandatory elements map */ }; asn_TYPE_descriptor_t asn_DEF_T1 = { "T1", "T1", SET_free, SET_print, SET_constraint, SET_decode_ber, SET_encode_der, SET_decode_xer, SET_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T1_tags_1, sizeof(asn_DEF_T1_tags_1) /sizeof(asn_DEF_T1_tags_1[0]), /* 1 */ asn_DEF_T1_tags_1, /* Same as above */ sizeof(asn_DEF_T1_tags_1) /sizeof(asn_DEF_T1_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_T1_1, 1, /* Elements count */ &asn_SPC_T1_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [T2] >>> ***/ #include #include /*** <<< DEPS [T2] >>> ***/ /* * Method of determining the components presence */ typedef enum T2_PR { T2_PR_i, /* Member i is present */ } T2_PR; /*** <<< TYPE-DECLS [T2] >>> ***/ typedef struct T2 { INTEGER_t i; /* * This type is extensible, * possible extensions are below. */ /* Presence bitmask: ASN_SET_ISPRESENT(pT2, T2_PR_x) */ unsigned int _presence_map [((1+(8*sizeof(unsigned int))-1)/(8*sizeof(unsigned int)))]; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } T2_t; /*** <<< FUNC-DECLS [T2] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_T2; /*** <<< STAT-DEFS [T2] >>> ***/ static asn_TYPE_member_t asn_MBR_T2_1[] = { { ATF_NOFLAGS, 0, offsetof(struct T2, i), .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), .tag_mode = 0, .type = &asn_DEF_INTEGER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "i" }, }; static const ber_tlv_tag_t asn_DEF_T2_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_T2_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 } /* i */ }; static const uint8_t asn_MAP_T2_mmap_1[(1 + (8 * sizeof(unsigned int)) - 1) / 8] = { (1 << 7) }; static asn_SET_specifics_t asn_SPC_T2_specs_1 = { sizeof(struct T2), offsetof(struct T2, _asn_ctx), offsetof(struct T2, _presence_map), asn_MAP_T2_tag2el_1, 1, /* Count of tags in the map */ asn_MAP_T2_tag2el_1, /* Same as above */ 1, /* Count of tags in the CXER map */ 1, /* Whether extensible */ (unsigned int *)asn_MAP_T2_mmap_1 /* Mandatory elements map */ }; asn_TYPE_descriptor_t asn_DEF_T2 = { "T2", "T2", SET_free, SET_print, SET_constraint, SET_decode_ber, SET_encode_der, SET_decode_xer, SET_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T2_tags_1, sizeof(asn_DEF_T2_tags_1) /sizeof(asn_DEF_T2_tags_1[0]), /* 1 */ asn_DEF_T2_tags_1, /* Same as above */ sizeof(asn_DEF_T2_tags_1) /sizeof(asn_DEF_T2_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_T2_1, 1, /* Elements count */ &asn_SPC_T2_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [T3] >>> ***/ #include #include /*** <<< DEPS [T3] >>> ***/ typedef enum T3_PR { T3_PR_NOTHING, /* No components present */ T3_PR_i, /* Extensions may appear below */ } T3_PR; /*** <<< TYPE-DECLS [T3] >>> ***/ typedef struct T3 { T3_PR present; union T3_u { INTEGER_t i; /* * This type is extensible, * possible extensions are below. */ } choice; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } T3_t; /*** <<< FUNC-DECLS [T3] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_T3; /*** <<< STAT-DEFS [T3] >>> ***/ static asn_TYPE_member_t asn_MBR_T3_1[] = { { ATF_NOFLAGS, 0, offsetof(struct T3, choice.i), .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), .tag_mode = 0, .type = &asn_DEF_INTEGER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "i" }, }; static const asn_TYPE_tag2member_t asn_MAP_T3_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 } /* i */ }; static asn_CHOICE_specifics_t asn_SPC_T3_specs_1 = { sizeof(struct T3), offsetof(struct T3, _asn_ctx), offsetof(struct T3, present), sizeof(((struct T3 *)0)->present), asn_MAP_T3_tag2el_1, 1, /* Count of tags in the map */ .canonical_order = 0, .ext_start = 1 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_T3 = { "T3", "T3", CHOICE_free, CHOICE_print, CHOICE_constraint, CHOICE_decode_ber, CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ 0, /* No tags (pointer) */ 0, /* No tags (count) */ 0, /* No PER visible constraints */ asn_MBR_T3_1, 1, /* Elements count */ &asn_SPC_T3_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [T4] >>> ***/ #include #include /*** <<< DEPS [T4] >>> ***/ typedef enum T4_PR { T4_PR_NOTHING, /* No components present */ T4_PR_i, /* Extensions may appear below */ } T4_PR; /*** <<< TYPE-DECLS [T4] >>> ***/ typedef struct T4 { T4_PR present; union T4_u { INTEGER_t i; /* * This type is extensible, * possible extensions are below. */ } choice; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } T4_t; /*** <<< FUNC-DECLS [T4] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_T4; /*** <<< STAT-DEFS [T4] >>> ***/ static asn_TYPE_member_t asn_MBR_T4_1[] = { { ATF_NOFLAGS, 0, offsetof(struct T4, choice.i), .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), .tag_mode = 0, .type = &asn_DEF_INTEGER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "i" }, }; static const asn_TYPE_tag2member_t asn_MAP_T4_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 } /* i */ }; static asn_CHOICE_specifics_t asn_SPC_T4_specs_1 = { sizeof(struct T4), offsetof(struct T4, _asn_ctx), offsetof(struct T4, present), sizeof(((struct T4 *)0)->present), asn_MAP_T4_tag2el_1, 1, /* Count of tags in the map */ .canonical_order = 0, .ext_start = 1 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_T4 = { "T4", "T4", CHOICE_free, CHOICE_print, CHOICE_constraint, CHOICE_decode_ber, CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ 0, /* No tags (pointer) */ 0, /* No tags (count) */ 0, /* No PER visible constraints */ asn_MBR_T4_1, 1, /* Elements count */ &asn_SPC_T4_specs_1 /* Additional specs */ }; asn1c-0.9.28+dfsg/tests/84-param-tags-OK.asn1.-EF0000644000000000000000000000131413065714043017326 0ustar rootrootModuleTestParameterizationTags1 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 84 1 } DEFINITIONS ::= BEGIN TestType{Parameter} ::= SEQUENCE { common Parameter DEFAULT 0 } TestChoice ::= CHOICE { type1 TestType{ INTEGER (1..10)}, type2 [0] IMPLICIT TestType{ BOOLEAN} } END ModuleTestParameterizationTagsAuto2 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 84 2 } DEFINITIONS AUTOMATIC TAGS ::= BEGIN AutoType{Parameter} ::= SEQUENCE { common Parameter (0) } AutoChoice ::= CHOICE { type1 [0] IMPLICIT AutoType{ INTEGER (0..1)}, type2 [1] IMPLICIT AutoType{ BOOLEAN} } END asn1c-0.9.28+dfsg/tests/127-per-long-OK.asn10000644000000000000000000000114213065714043016524 0ustar rootroot -- OK: Everything is fine -- Also see .134 for wider integer types. -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .127 ModulePERLong { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 127 } DEFINITIONS AUTOMATIC TAGS ::= BEGIN T ::= SEQUENCE { -- Should be supported on all 32-bit platforms and above. small32range INTEGER (-2000000000..2000000000), full32range INTEGER (-2147483648..2147483647), unsigned32 INTEGER (0..4294967295), unsplit32 INTEGER (5..500|600..4294967290) } END asn1c-0.9.28+dfsg/tests/115-bit-string-OK.asn10000644000000000000000000000054313065714043017064 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .115 ModuleBitStringReferencedValue { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 115 } DEFINITIONS ::= BEGIN T ::= BIT STRING { one(a) } a INTEGER ::= 123 END asn1c-0.9.28+dfsg/tests/70-xer-test-OK.asn1.-EF0000644000000000000000000000430013065714043017036 0ustar rootrootModuleTestXERDecoding { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 70 } DEFINITIONS AUTOMATIC TAGS ::= BEGIN PDU ::= CHOICE { sequence [0] IMPLICIT Sequence, set [1] IMPLICIT Set, sequenceOf [2] IMPLICIT SequenceOf, extensibleSet [3] IMPLICIT ExtensibleSet, extensibleSequence [4] IMPLICIT ExtensibleSequence, extensibleSequence2 [5] IMPLICIT ExtensibleSequence2, setOfNULL [6] IMPLICIT SetOfNULL, setOfREAL [7] IMPLICIT SetOfREAL, setOfEnums [8] IMPLICIT SetOfEnums, namedSetOfNULL [9] IMPLICIT NamedSetOfNULL, namedSetOfREAL [10] IMPLICIT NamedSetOfREAL, namedSetOfEnums [11] IMPLICIT NamedSetOfEnums, seqOfZuka [12] IMPLICIT SeqOfZuka, setOfChoice [13] IMPLICIT SetOfChoice, namedSetOfChoice [14] IMPLICIT NamedSetOfChoice, ... } Sequence ::= SEQUENCE { integer [0] IMPLICIT INTEGER, sequence [1] IMPLICIT Sequence OPTIONAL, bits [2] IMPLICIT BIT STRING OPTIONAL, string [3] IMPLICIT UTF8String } Set ::= SET { roid [0] IMPLICIT RELATIVE-OID, opaque [1] IMPLICIT OCTET STRING OPTIONAL } ExtensibleSet ::= SET { string [0] IMPLICIT UTF8String OPTIONAL, ..., enum [1] IMPLICIT ENUMERATED { b(0), a(1) } } ExtensibleSequence ::= SEQUENCE { string [0] IMPLICIT UTF8String OPTIONAL, ..., integer [1] IMPLICIT INTEGER OPTIONAL, gtime [2] IMPLICIT GeneralizedTime } ExtensibleSequence2 ::= SEQUENCE { string [0] IMPLICIT UTF8String OPTIONAL, ..., integer [1] IMPLICIT INTEGER OPTIONAL } SetOfNULL ::= SET OF NULL SetOfREAL ::= SET OF REAL SetOfEnums ::= SET OF ENUMERATED { one(0), oneMore(1) } NamedSetOfNULL ::= SET OF y NULL NamedSetOfREAL ::= SET OF name REAL NamedSetOfEnums ::= SET OF name ENUMERATED { one(0), oneMore(1) } SequenceOf ::= SEQUENCE OF id INTEGER { one(1), two(2) } SeqOfZuka ::= SEQUENCE OF zuka NULL SetOfChoice ::= SET OF SimpleChoice NamedSetOfChoice ::= SET OF whatever SimpleChoice SimpleChoice ::= CHOICE { a [0] IMPLICIT NULL, b [1] IMPLICIT INTEGER } END asn1c-0.9.28+dfsg/tests/15-resolver-SE.asn10000644000000000000000000000142013065714043016553 0ustar rootroot -- SE: Semantic error -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .15 1 -- .15 2 ModuleTestResolver4 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 15 1 } DEFINITIONS ::= BEGIN IMPORTS Enumeration, beta FROM OtherModuleRenamed { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 15 2 }; -- external reference alpha Enumeration ::= beta END ModuleTestResolver5 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 15 2 } DEFINITIONS ::= BEGIN EXPORTS; -- Does not export anything! beta Enumeration ::= b Enumeration ::= ENUMERATED { a(1), b(2) } END asn1c-0.9.28+dfsg/tests/77-str-default-OK.asn10000644000000000000000000000110013065714043017151 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .77 ModuleTestStringDefault1 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 77 } DEFINITIONS AUTOMATIC TAGS ::= BEGIN Type ::= SEQUENCE { cntry PRString DEFAULT country1, cntry1 PrintableString DEFAULT country1, cntry2 UniversalString DEFAULT country2, ... } country1 PrintableString ::= "Rwanda" country2 PRString ::= "United Kingdom" PRString ::= PrintableString END asn1c-0.9.28+dfsg/tests/124-multiconstraint-OK.asn10000644000000000000000000000057413065714043020245 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .124 ModuleMultiConstraint { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 124 } DEFINITIONS AUTOMATIC TAGS ::= BEGIN T ::= VisibleString (PATTERN "^[a-z]+$") (CONSTRAINED BY { ... }) END asn1c-0.9.28+dfsg/tests/89-bit-string-enum-OK.asn1.-Pfwide-types0000644000000000000000000000346313065714043022420 0ustar rootroot /*** <<< INCLUDES [T] >>> ***/ #include #include /*** <<< DEPS [T] >>> ***/ typedef enum T_PR { T_PR_NOTHING, /* No components present */ T_PR_bs } T_PR; typedef enum bs { bs_a = 1, bs_b = 2 } e_bs; /*** <<< TYPE-DECLS [T] >>> ***/ typedef struct T { T_PR present; union T_u { BIT_STRING_t bs; } choice; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } T_t; /*** <<< FUNC-DECLS [T] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_T; /*** <<< STAT-DEFS [T] >>> ***/ static asn_TYPE_member_t asn_MBR_T_1[] = { { ATF_NOFLAGS, 0, offsetof(struct T, choice.bs), .tag = (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), .tag_mode = 0, .type = &asn_DEF_BIT_STRING, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "bs" }, }; static const asn_TYPE_tag2member_t asn_MAP_T_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 0, 0, 0 } /* bs */ }; static asn_CHOICE_specifics_t asn_SPC_T_specs_1 = { sizeof(struct T), offsetof(struct T, _asn_ctx), offsetof(struct T, present), sizeof(((struct T *)0)->present), asn_MAP_T_tag2el_1, 1, /* Count of tags in the map */ .canonical_order = 0, .ext_start = -1 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_T = { "T", "T", CHOICE_free, CHOICE_print, CHOICE_constraint, CHOICE_decode_ber, CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ 0, /* No tags (pointer) */ 0, /* No tags (count) */ 0, /* No PER visible constraints */ asn_MBR_T_1, 1, /* Elements count */ &asn_SPC_T_specs_1 /* Additional specs */ }; asn1c-0.9.28+dfsg/tests/123-valueassignment-OK.asn10000644000000000000000000000055113065714043020205 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .123 ModuleValueAssignmentConstrained { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 123 } DEFINITIONS AUTOMATIC TAGS ::= BEGIN zzz OCTET STRING (SIZE(1)) ::= '1'H END asn1c-0.9.28+dfsg/tests/117-real-constraint-OK.asn10000644000000000000000000000050513065714043020107 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .117 ModuleRealConstraint { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 117 } DEFINITIONS ::= BEGIN R ::= REAL (0..3.14159265) END asn1c-0.9.28+dfsg/tests/111-param-4-SE.asn10000644000000000000000000000074513065714043016241 0ustar rootroot -- SE: Semantic error -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .111 ModuleParameterization4 { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 111 } DEFINITIONS ::= BEGIN Flag{Color} ::= SEQUENCE { field Color DEFAULT cyan } IntegerColorFlag ::= Flag{INTEGER{ red(0), green(1), blue(5) }} EnumeratedColorFlag ::= Flag{ENUMERATED{ red(3), green, blue }} END asn1c-0.9.28+dfsg/tests/45-undefined-type-SE.asn1.-EFfknown-extern-type=KnownExt0000644000000000000000000000025513065714043025510 0ustar rootrootModuleKnownExternType { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 45 } DEFINITIONS ::= BEGIN Type ::= KnownExt END asn1c-0.9.28+dfsg/tests/105-param-2-OK.asn10000644000000000000000000000064613065714043016244 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .105 ModuleParameterization2 { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 105 } DEFINITIONS ::= BEGIN SIGNED {Type} ::= SEQUENCE { signed Type } SignedREAL ::= SIGNED {REAL} SignedSET ::= SIGNED { SET { a INTEGER } } END asn1c-0.9.28+dfsg/tests/121-empty-imports-OK.asn1.-EF0000644000000000000000000000027113065714043020174 0ustar rootrootModuleEmptyIMPORTS { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 121 } DEFINITIONS AUTOMATIC TAGS ::= BEGIN Type ::= INTEGER END asn1c-0.9.28+dfsg/tests/88-integer-enum-OK.asn1.-Pfwide-types0000644000000000000000000000731213065714043021767 0ustar rootroot /*** <<< INCLUDES [T] >>> ***/ #include /*** <<< DEPS [T] >>> ***/ typedef enum T { T_a = 1, T_b = 2 } e_T; /*** <<< TYPE-DECLS [T] >>> ***/ typedef INTEGER_t T_t; /*** <<< FUNC-DECLS [T] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_T; asn_struct_free_f T_free; asn_struct_print_f T_print; asn_constr_check_f T_constraint; ber_type_decoder_f T_decode_ber; der_type_encoder_f T_encode_der; xer_type_decoder_f T_decode_xer; xer_type_encoder_f T_encode_xer; /*** <<< CODE [T] >>> ***/ int T_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_INTEGER.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using INTEGER, * so here we adjust the DEF accordingly. */ static void T_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_INTEGER.free_struct; td->print_struct = asn_DEF_INTEGER.print_struct; td->check_constraints = asn_DEF_INTEGER.check_constraints; td->ber_decoder = asn_DEF_INTEGER.ber_decoder; td->der_encoder = asn_DEF_INTEGER.der_encoder; td->xer_decoder = asn_DEF_INTEGER.xer_decoder; td->xer_encoder = asn_DEF_INTEGER.xer_encoder; td->uper_decoder = asn_DEF_INTEGER.uper_decoder; td->uper_encoder = asn_DEF_INTEGER.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; td->elements = asn_DEF_INTEGER.elements; td->elements_count = asn_DEF_INTEGER.elements_count; td->specifics = asn_DEF_INTEGER.specifics; } void T_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { T_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int T_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { T_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t T_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { T_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t T_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { T_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t T_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { T_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t T_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { T_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [T] >>> ***/ static const ber_tlv_tag_t asn_DEF_T_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_T = { "T", "T", T_free, T_print, T_constraint, T_decode_ber, T_encode_der, T_decode_xer, T_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T_tags_1, sizeof(asn_DEF_T_tags_1) /sizeof(asn_DEF_T_tags_1[0]), /* 1 */ asn_DEF_T_tags_1, /* Same as above */ sizeof(asn_DEF_T_tags_1) /sizeof(asn_DEF_T_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* Defined elsewhere */ 0 /* No specifics */ }; asn1c-0.9.28+dfsg/tests/104-param-1-OK.asn1.-EFprint-class-matrix0000644000000000000000000000053713065714043022271 0ustar rootrootModuleParameterization1 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 104 } DEFINITIONS ::= BEGIN Collection{T} ::= SET OF T -- Specializations list has 2 entries: -- REAL -- IA5String Bunch ::= SEQUENCE { field-REAL Collection{ REAL}, field-IA5String Collection{ IA5String} } END asn1c-0.9.28+dfsg/tests/130-enum-OK.asn1.-EF0000644000000000000000000000032313065714043016305 0ustar rootrootModuleTestEnum1 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 130 } DEFINITIONS ::= BEGIN A ::= ENUMERATED { a(-5), b(-4), ..., c(0) } END asn1c-0.9.28+dfsg/tests/108-param-constr-3-OK.asn1.-Pfwide-types0000644000000000000000000002147413065714043022214 0ustar rootroot /*** <<< INCLUDES [MinMax] >>> ***/ #include /*** <<< TYPE-DECLS [MinMax] >>> ***/ typedef INTEGER_t MinMax_16P0_t; /*** <<< FUNC-DECLS [MinMax] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_MinMax_16P0; asn_struct_free_f MinMax_16P0_free; asn_struct_print_f MinMax_16P0_print; asn_constr_check_f MinMax_16P0_constraint; ber_type_decoder_f MinMax_16P0_decode_ber; der_type_encoder_f MinMax_16P0_encode_der; xer_type_decoder_f MinMax_16P0_decode_xer; xer_type_encoder_f MinMax_16P0_encode_xer; /*** <<< CODE [MinMax] >>> ***/ int MinMax_16P0_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(asn_INTEGER2long(st, &value)) { ASN__CTFAIL(app_key, td, sptr, "%s: value too large (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if((value >= 3)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using INTEGER, * so here we adjust the DEF accordingly. */ static void MinMax_16P0_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_INTEGER.free_struct; td->print_struct = asn_DEF_INTEGER.print_struct; td->check_constraints = asn_DEF_INTEGER.check_constraints; td->ber_decoder = asn_DEF_INTEGER.ber_decoder; td->der_encoder = asn_DEF_INTEGER.der_encoder; td->xer_decoder = asn_DEF_INTEGER.xer_decoder; td->xer_encoder = asn_DEF_INTEGER.xer_encoder; td->uper_decoder = asn_DEF_INTEGER.uper_decoder; td->uper_encoder = asn_DEF_INTEGER.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; td->elements = asn_DEF_INTEGER.elements; td->elements_count = asn_DEF_INTEGER.elements_count; td->specifics = asn_DEF_INTEGER.specifics; } void MinMax_16P0_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { MinMax_16P0_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int MinMax_16P0_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { MinMax_16P0_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t MinMax_16P0_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { MinMax_16P0_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t MinMax_16P0_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { MinMax_16P0_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t MinMax_16P0_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { MinMax_16P0_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t MinMax_16P0_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { MinMax_16P0_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [MinMax] >>> ***/ static const ber_tlv_tag_t asn_DEF_MinMax_16P0_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_MinMax_16P0 = { "MinMax", "MinMax", MinMax_16P0_free, MinMax_16P0_print, MinMax_16P0_constraint, MinMax_16P0_decode_ber, MinMax_16P0_encode_der, MinMax_16P0_decode_xer, MinMax_16P0_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_MinMax_16P0_tags_1, sizeof(asn_DEF_MinMax_16P0_tags_1) /sizeof(asn_DEF_MinMax_16P0_tags_1[0]), /* 1 */ asn_DEF_MinMax_16P0_tags_1, /* Same as above */ sizeof(asn_DEF_MinMax_16P0_tags_1) /sizeof(asn_DEF_MinMax_16P0_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [ThreePlus] >>> ***/ #include "MinMax.h" /*** <<< TYPE-DECLS [ThreePlus] >>> ***/ typedef MinMax_16P0_t ThreePlus_t; /*** <<< FUNC-DECLS [ThreePlus] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_ThreePlus; asn_struct_free_f ThreePlus_free; asn_struct_print_f ThreePlus_print; asn_constr_check_f ThreePlus_constraint; ber_type_decoder_f ThreePlus_decode_ber; der_type_encoder_f ThreePlus_encode_der; xer_type_decoder_f ThreePlus_decode_xer; xer_type_encoder_f ThreePlus_encode_xer; /*** <<< CODE [ThreePlus] >>> ***/ int ThreePlus_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const MinMax_16P0_t *st = (const MinMax_16P0_t *)sptr; long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(asn_INTEGER2long(st, &value)) { ASN__CTFAIL(app_key, td, sptr, "%s: value too large (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if((value >= 3)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using MinMax_16P0, * so here we adjust the DEF accordingly. */ static void ThreePlus_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_MinMax_16P0.free_struct; td->print_struct = asn_DEF_MinMax_16P0.print_struct; td->check_constraints = asn_DEF_MinMax_16P0.check_constraints; td->ber_decoder = asn_DEF_MinMax_16P0.ber_decoder; td->der_encoder = asn_DEF_MinMax_16P0.der_encoder; td->xer_decoder = asn_DEF_MinMax_16P0.xer_decoder; td->xer_encoder = asn_DEF_MinMax_16P0.xer_encoder; td->uper_decoder = asn_DEF_MinMax_16P0.uper_decoder; td->uper_encoder = asn_DEF_MinMax_16P0.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_MinMax_16P0.per_constraints; td->elements = asn_DEF_MinMax_16P0.elements; td->elements_count = asn_DEF_MinMax_16P0.elements_count; td->specifics = asn_DEF_MinMax_16P0.specifics; } void ThreePlus_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { ThreePlus_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int ThreePlus_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { ThreePlus_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t ThreePlus_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { ThreePlus_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t ThreePlus_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { ThreePlus_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t ThreePlus_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { ThreePlus_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t ThreePlus_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { ThreePlus_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [ThreePlus] >>> ***/ static const ber_tlv_tag_t asn_DEF_ThreePlus_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_ThreePlus = { "ThreePlus", "ThreePlus", ThreePlus_free, ThreePlus_print, ThreePlus_constraint, ThreePlus_decode_ber, ThreePlus_encode_der, ThreePlus_decode_xer, ThreePlus_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_ThreePlus_tags_1, sizeof(asn_DEF_ThreePlus_tags_1) /sizeof(asn_DEF_ThreePlus_tags_1[0]), /* 1 */ asn_DEF_ThreePlus_tags_1, /* Same as above */ sizeof(asn_DEF_ThreePlus_tags_1) /sizeof(asn_DEF_ThreePlus_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; asn1c-0.9.28+dfsg/tests/50-constraint-OK.asn1.-Pfwide-types0000644000000000000000000041335613065714043021552 0ustar rootroot /*** <<< INCLUDES [Int1] >>> ***/ #include /*** <<< TYPE-DECLS [Int1] >>> ***/ typedef INTEGER_t Int1_t; /*** <<< FUNC-DECLS [Int1] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Int1; asn_struct_free_f Int1_free; asn_struct_print_f Int1_print; asn_constr_check_f Int1_constraint; ber_type_decoder_f Int1_decode_ber; der_type_encoder_f Int1_encode_der; xer_type_decoder_f Int1_decode_xer; xer_type_encoder_f Int1_encode_xer; /*** <<< CODE [Int1] >>> ***/ int Int1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_INTEGER.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using INTEGER, * so here we adjust the DEF accordingly. */ static void Int1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_INTEGER.free_struct; td->print_struct = asn_DEF_INTEGER.print_struct; td->check_constraints = asn_DEF_INTEGER.check_constraints; td->ber_decoder = asn_DEF_INTEGER.ber_decoder; td->der_encoder = asn_DEF_INTEGER.der_encoder; td->xer_decoder = asn_DEF_INTEGER.xer_decoder; td->xer_encoder = asn_DEF_INTEGER.xer_encoder; td->uper_decoder = asn_DEF_INTEGER.uper_decoder; td->uper_encoder = asn_DEF_INTEGER.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; td->elements = asn_DEF_INTEGER.elements; td->elements_count = asn_DEF_INTEGER.elements_count; td->specifics = asn_DEF_INTEGER.specifics; } void Int1_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Int1_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Int1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Int1_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Int1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Int1_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Int1_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Int1_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Int1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Int1_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Int1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Int1_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [Int1] >>> ***/ static const ber_tlv_tag_t asn_DEF_Int1_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Int1 = { "Int1", "Int1", Int1_free, Int1_print, Int1_constraint, Int1_decode_ber, Int1_encode_der, Int1_decode_xer, Int1_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Int1_tags_1, sizeof(asn_DEF_Int1_tags_1) /sizeof(asn_DEF_Int1_tags_1[0]), /* 1 */ asn_DEF_Int1_tags_1, /* Same as above */ sizeof(asn_DEF_Int1_tags_1) /sizeof(asn_DEF_Int1_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [Int2] >>> ***/ #include "Int1.h" /*** <<< TYPE-DECLS [Int2] >>> ***/ typedef Int1_t Int2_t; /*** <<< FUNC-DECLS [Int2] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Int2; asn_struct_free_f Int2_free; asn_struct_print_f Int2_print; asn_constr_check_f Int2_constraint; ber_type_decoder_f Int2_decode_ber; der_type_encoder_f Int2_encode_der; xer_type_decoder_f Int2_decode_xer; xer_type_encoder_f Int2_encode_xer; /*** <<< CODE [Int2] >>> ***/ int Int2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Int1_t *st = (const Int1_t *)sptr; long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } /* Check if the sign bit is present */ value = st->buf ? ((st->buf[0] & 0x80) ? -1 : 1) : 0; if((value >= 0)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using Int1, * so here we adjust the DEF accordingly. */ static void Int2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_Int1.free_struct; td->print_struct = asn_DEF_Int1.print_struct; td->check_constraints = asn_DEF_Int1.check_constraints; td->ber_decoder = asn_DEF_Int1.ber_decoder; td->der_encoder = asn_DEF_Int1.der_encoder; td->xer_decoder = asn_DEF_Int1.xer_decoder; td->xer_encoder = asn_DEF_Int1.xer_encoder; td->uper_decoder = asn_DEF_Int1.uper_decoder; td->uper_encoder = asn_DEF_Int1.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Int1.per_constraints; td->elements = asn_DEF_Int1.elements; td->elements_count = asn_DEF_Int1.elements_count; td->specifics = asn_DEF_Int1.specifics; } void Int2_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Int2_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Int2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Int2_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Int2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Int2_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Int2_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Int2_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Int2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Int2_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Int2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Int2_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [Int2] >>> ***/ static const ber_tlv_tag_t asn_DEF_Int2_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Int2 = { "Int2", "Int2", Int2_free, Int2_print, Int2_constraint, Int2_decode_ber, Int2_encode_der, Int2_decode_xer, Int2_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Int2_tags_1, sizeof(asn_DEF_Int2_tags_1) /sizeof(asn_DEF_Int2_tags_1[0]), /* 1 */ asn_DEF_Int2_tags_1, /* Same as above */ sizeof(asn_DEF_Int2_tags_1) /sizeof(asn_DEF_Int2_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [Int3] >>> ***/ #include "Int2.h" /*** <<< TYPE-DECLS [Int3] >>> ***/ typedef Int2_t Int3_t; /*** <<< FUNC-DECLS [Int3] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Int3; asn_struct_free_f Int3_free; asn_struct_print_f Int3_print; asn_constr_check_f Int3_constraint; ber_type_decoder_f Int3_decode_ber; der_type_encoder_f Int3_encode_der; xer_type_decoder_f Int3_decode_xer; xer_type_encoder_f Int3_encode_xer; /*** <<< CODE [Int3] >>> ***/ int Int3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Int2_t *st = (const Int2_t *)sptr; long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(asn_INTEGER2long(st, &value)) { ASN__CTFAIL(app_key, td, sptr, "%s: value too large (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if((value >= 0 && value <= 10)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using Int2, * so here we adjust the DEF accordingly. */ static void Int3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_Int2.free_struct; td->print_struct = asn_DEF_Int2.print_struct; td->check_constraints = asn_DEF_Int2.check_constraints; td->ber_decoder = asn_DEF_Int2.ber_decoder; td->der_encoder = asn_DEF_Int2.der_encoder; td->xer_decoder = asn_DEF_Int2.xer_decoder; td->xer_encoder = asn_DEF_Int2.xer_encoder; td->uper_decoder = asn_DEF_Int2.uper_decoder; td->uper_encoder = asn_DEF_Int2.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Int2.per_constraints; td->elements = asn_DEF_Int2.elements; td->elements_count = asn_DEF_Int2.elements_count; td->specifics = asn_DEF_Int2.specifics; } void Int3_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Int3_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Int3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Int3_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Int3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Int3_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Int3_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Int3_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Int3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Int3_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Int3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Int3_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [Int3] >>> ***/ static const ber_tlv_tag_t asn_DEF_Int3_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Int3 = { "Int3", "Int3", Int3_free, Int3_print, Int3_constraint, Int3_decode_ber, Int3_encode_der, Int3_decode_xer, Int3_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Int3_tags_1, sizeof(asn_DEF_Int3_tags_1) /sizeof(asn_DEF_Int3_tags_1[0]), /* 1 */ asn_DEF_Int3_tags_1, /* Same as above */ sizeof(asn_DEF_Int3_tags_1) /sizeof(asn_DEF_Int3_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [Int4] >>> ***/ #include "Int3.h" /*** <<< TYPE-DECLS [Int4] >>> ***/ typedef Int3_t Int4_t; /*** <<< FUNC-DECLS [Int4] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Int4; asn_struct_free_f Int4_free; asn_struct_print_f Int4_print; asn_constr_check_f Int4_constraint; ber_type_decoder_f Int4_decode_ber; der_type_encoder_f Int4_encode_der; xer_type_decoder_f Int4_decode_xer; xer_type_encoder_f Int4_encode_xer; /*** <<< CODE [Int4] >>> ***/ int Int4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Int3_t *st = (const Int3_t *)sptr; long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(asn_INTEGER2long(st, &value)) { ASN__CTFAIL(app_key, td, sptr, "%s: value too large (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if((value >= 1 && value <= 10)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using Int3, * so here we adjust the DEF accordingly. */ static void Int4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_Int3.free_struct; td->print_struct = asn_DEF_Int3.print_struct; td->check_constraints = asn_DEF_Int3.check_constraints; td->ber_decoder = asn_DEF_Int3.ber_decoder; td->der_encoder = asn_DEF_Int3.der_encoder; td->xer_decoder = asn_DEF_Int3.xer_decoder; td->xer_encoder = asn_DEF_Int3.xer_encoder; td->uper_decoder = asn_DEF_Int3.uper_decoder; td->uper_encoder = asn_DEF_Int3.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Int3.per_constraints; td->elements = asn_DEF_Int3.elements; td->elements_count = asn_DEF_Int3.elements_count; td->specifics = asn_DEF_Int3.specifics; } void Int4_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Int4_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Int4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Int4_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Int4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Int4_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Int4_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Int4_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Int4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Int4_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Int4_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Int4_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [Int4] >>> ***/ static const ber_tlv_tag_t asn_DEF_Int4_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Int4 = { "Int4", "Int4", Int4_free, Int4_print, Int4_constraint, Int4_decode_ber, Int4_encode_der, Int4_decode_xer, Int4_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Int4_tags_1, sizeof(asn_DEF_Int4_tags_1) /sizeof(asn_DEF_Int4_tags_1[0]), /* 1 */ asn_DEF_Int4_tags_1, /* Same as above */ sizeof(asn_DEF_Int4_tags_1) /sizeof(asn_DEF_Int4_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [Int5] >>> ***/ #include "Int4.h" /*** <<< TYPE-DECLS [Int5] >>> ***/ typedef Int4_t Int5_t; /*** <<< FUNC-DECLS [Int5] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Int5; asn_struct_free_f Int5_free; asn_struct_print_f Int5_print; asn_constr_check_f Int5_constraint; ber_type_decoder_f Int5_decode_ber; der_type_encoder_f Int5_encode_der; xer_type_decoder_f Int5_decode_xer; xer_type_encoder_f Int5_encode_xer; /*** <<< CODE [Int5] >>> ***/ int Int5_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Int4_t *st = (const Int4_t *)sptr; long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(asn_INTEGER2long(st, &value)) { ASN__CTFAIL(app_key, td, sptr, "%s: value too large (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if((value == 5)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using Int4, * so here we adjust the DEF accordingly. */ static void Int5_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_Int4.free_struct; td->print_struct = asn_DEF_Int4.print_struct; td->check_constraints = asn_DEF_Int4.check_constraints; td->ber_decoder = asn_DEF_Int4.ber_decoder; td->der_encoder = asn_DEF_Int4.der_encoder; td->xer_decoder = asn_DEF_Int4.xer_decoder; td->xer_encoder = asn_DEF_Int4.xer_encoder; td->uper_decoder = asn_DEF_Int4.uper_decoder; td->uper_encoder = asn_DEF_Int4.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Int4.per_constraints; td->elements = asn_DEF_Int4.elements; td->elements_count = asn_DEF_Int4.elements_count; td->specifics = asn_DEF_Int4.specifics; } void Int5_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Int5_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Int5_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Int5_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Int5_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Int5_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Int5_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Int5_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Int5_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Int5_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Int5_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Int5_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [Int5] >>> ***/ static const ber_tlv_tag_t asn_DEF_Int5_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Int5 = { "Int5", "Int5", Int5_free, Int5_print, Int5_constraint, Int5_decode_ber, Int5_encode_der, Int5_decode_xer, Int5_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Int5_tags_1, sizeof(asn_DEF_Int5_tags_1) /sizeof(asn_DEF_Int5_tags_1[0]), /* 1 */ asn_DEF_Int5_tags_1, /* Same as above */ sizeof(asn_DEF_Int5_tags_1) /sizeof(asn_DEF_Int5_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [ExtensibleExtensions] >>> ***/ #include /*** <<< TYPE-DECLS [ExtensibleExtensions] >>> ***/ typedef INTEGER_t ExtensibleExtensions_t; /*** <<< FUNC-DECLS [ExtensibleExtensions] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_ExtensibleExtensions; asn_struct_free_f ExtensibleExtensions_free; asn_struct_print_f ExtensibleExtensions_print; asn_constr_check_f ExtensibleExtensions_constraint; ber_type_decoder_f ExtensibleExtensions_decode_ber; der_type_encoder_f ExtensibleExtensions_encode_der; xer_type_decoder_f ExtensibleExtensions_decode_xer; xer_type_encoder_f ExtensibleExtensions_encode_xer; /*** <<< CODE [ExtensibleExtensions] >>> ***/ int ExtensibleExtensions_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(asn_INTEGER2long(st, &value)) { ASN__CTFAIL(app_key, td, sptr, "%s: value too large (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if((value >= 1 && value <= 256)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using INTEGER, * so here we adjust the DEF accordingly. */ static void ExtensibleExtensions_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_INTEGER.free_struct; td->print_struct = asn_DEF_INTEGER.print_struct; td->check_constraints = asn_DEF_INTEGER.check_constraints; td->ber_decoder = asn_DEF_INTEGER.ber_decoder; td->der_encoder = asn_DEF_INTEGER.der_encoder; td->xer_decoder = asn_DEF_INTEGER.xer_decoder; td->xer_encoder = asn_DEF_INTEGER.xer_encoder; td->uper_decoder = asn_DEF_INTEGER.uper_decoder; td->uper_encoder = asn_DEF_INTEGER.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; td->elements = asn_DEF_INTEGER.elements; td->elements_count = asn_DEF_INTEGER.elements_count; td->specifics = asn_DEF_INTEGER.specifics; } void ExtensibleExtensions_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { ExtensibleExtensions_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int ExtensibleExtensions_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { ExtensibleExtensions_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t ExtensibleExtensions_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { ExtensibleExtensions_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t ExtensibleExtensions_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { ExtensibleExtensions_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t ExtensibleExtensions_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { ExtensibleExtensions_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t ExtensibleExtensions_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { ExtensibleExtensions_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [ExtensibleExtensions] >>> ***/ static const ber_tlv_tag_t asn_DEF_ExtensibleExtensions_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)) }; asn_TYPE_descriptor_t asn_DEF_ExtensibleExtensions = { "ExtensibleExtensions", "ExtensibleExtensions", ExtensibleExtensions_free, ExtensibleExtensions_print, ExtensibleExtensions_constraint, ExtensibleExtensions_decode_ber, ExtensibleExtensions_encode_der, ExtensibleExtensions_decode_xer, ExtensibleExtensions_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_ExtensibleExtensions_tags_1, sizeof(asn_DEF_ExtensibleExtensions_tags_1) /sizeof(asn_DEF_ExtensibleExtensions_tags_1[0]), /* 1 */ asn_DEF_ExtensibleExtensions_tags_1, /* Same as above */ sizeof(asn_DEF_ExtensibleExtensions_tags_1) /sizeof(asn_DEF_ExtensibleExtensions_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [Str1] >>> ***/ #include /*** <<< TYPE-DECLS [Str1] >>> ***/ typedef IA5String_t Str1_t; /*** <<< FUNC-DECLS [Str1] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Str1; asn_struct_free_f Str1_free; asn_struct_print_f Str1_print; asn_constr_check_f Str1_constraint; ber_type_decoder_f Str1_decode_ber; der_type_encoder_f Str1_encode_der; xer_type_decoder_f Str1_decode_xer; xer_type_encoder_f Str1_encode_xer; /*** <<< CODE [Str1] >>> ***/ int Str1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_IA5String.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using IA5String, * so here we adjust the DEF accordingly. */ static void Str1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_IA5String.free_struct; td->print_struct = asn_DEF_IA5String.print_struct; td->check_constraints = asn_DEF_IA5String.check_constraints; td->ber_decoder = asn_DEF_IA5String.ber_decoder; td->der_encoder = asn_DEF_IA5String.der_encoder; td->xer_decoder = asn_DEF_IA5String.xer_decoder; td->xer_encoder = asn_DEF_IA5String.xer_encoder; td->uper_decoder = asn_DEF_IA5String.uper_decoder; td->uper_encoder = asn_DEF_IA5String.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_IA5String.per_constraints; td->elements = asn_DEF_IA5String.elements; td->elements_count = asn_DEF_IA5String.elements_count; td->specifics = asn_DEF_IA5String.specifics; } void Str1_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Str1_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Str1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Str1_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Str1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Str1_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Str1_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Str1_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Str1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Str1_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Str1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Str1_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [Str1] >>> ***/ static const ber_tlv_tag_t asn_DEF_Str1_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Str1 = { "Str1", "Str1", Str1_free, Str1_print, Str1_constraint, Str1_decode_ber, Str1_encode_der, Str1_decode_xer, Str1_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Str1_tags_1, sizeof(asn_DEF_Str1_tags_1) /sizeof(asn_DEF_Str1_tags_1[0]), /* 1 */ asn_DEF_Str1_tags_1, /* Same as above */ sizeof(asn_DEF_Str1_tags_1) /sizeof(asn_DEF_Str1_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [Str2] >>> ***/ #include "Str1.h" /*** <<< TYPE-DECLS [Str2] >>> ***/ typedef Str1_t Str2_t; /*** <<< FUNC-DECLS [Str2] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Str2; asn_struct_free_f Str2_free; asn_struct_print_f Str2_print; asn_constr_check_f Str2_constraint; ber_type_decoder_f Str2_decode_ber; der_type_encoder_f Str2_encode_der; xer_type_decoder_f Str2_decode_xer; xer_type_encoder_f Str2_encode_xer; /*** <<< CTABLES [Str2] >>> ***/ static int check_permitted_alphabet_1(const void *sptr) { /* The underlying type is IA5String */ const IA5String_t *st = (const IA5String_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(!(cv <= 127)) return -1; } return 0; } /*** <<< CODE [Str2] >>> ***/ int Str2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Str1_t *st = (const Str1_t *)sptr; size_t size; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } size = st->size; if(((size <= 20) || (size >= 25 && size <= 30)) && !check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using Str1, * so here we adjust the DEF accordingly. */ static void Str2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_Str1.free_struct; td->print_struct = asn_DEF_Str1.print_struct; td->check_constraints = asn_DEF_Str1.check_constraints; td->ber_decoder = asn_DEF_Str1.ber_decoder; td->der_encoder = asn_DEF_Str1.der_encoder; td->xer_decoder = asn_DEF_Str1.xer_decoder; td->xer_encoder = asn_DEF_Str1.xer_encoder; td->uper_decoder = asn_DEF_Str1.uper_decoder; td->uper_encoder = asn_DEF_Str1.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Str1.per_constraints; td->elements = asn_DEF_Str1.elements; td->elements_count = asn_DEF_Str1.elements_count; td->specifics = asn_DEF_Str1.specifics; } void Str2_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Str2_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Str2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Str2_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Str2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Str2_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Str2_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Str2_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Str2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Str2_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Str2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Str2_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [Str2] >>> ***/ static const ber_tlv_tag_t asn_DEF_Str2_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Str2 = { "Str2", "Str2", Str2_free, Str2_print, Str2_constraint, Str2_decode_ber, Str2_encode_der, Str2_decode_xer, Str2_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Str2_tags_1, sizeof(asn_DEF_Str2_tags_1) /sizeof(asn_DEF_Str2_tags_1[0]), /* 1 */ asn_DEF_Str2_tags_1, /* Same as above */ sizeof(asn_DEF_Str2_tags_1) /sizeof(asn_DEF_Str2_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [Str3] >>> ***/ #include "Str2.h" /*** <<< TYPE-DECLS [Str3] >>> ***/ typedef Str2_t Str3_t; /*** <<< FUNC-DECLS [Str3] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Str3; asn_struct_free_f Str3_free; asn_struct_print_f Str3_print; asn_constr_check_f Str3_constraint; ber_type_decoder_f Str3_decode_ber; der_type_encoder_f Str3_encode_der; xer_type_decoder_f Str3_decode_xer; xer_type_encoder_f Str3_encode_xer; /*** <<< CTABLES [Str3] >>> ***/ static const int permitted_alphabet_table_1[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* ABC */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 4, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* def */ }; static int check_permitted_alphabet_1(const void *sptr) { const int *table = permitted_alphabet_table_1; /* The underlying type is IA5String */ const IA5String_t *st = (const IA5String_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(!table[cv]) return -1; } return 0; } /*** <<< CODE [Str3] >>> ***/ int Str3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Str2_t *st = (const Str2_t *)sptr; size_t size; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } size = st->size; if(((size >= 10 && size <= 20) || (size >= 25 && size <= 27)) && !check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using Str2, * so here we adjust the DEF accordingly. */ static void Str3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_Str2.free_struct; td->print_struct = asn_DEF_Str2.print_struct; td->check_constraints = asn_DEF_Str2.check_constraints; td->ber_decoder = asn_DEF_Str2.ber_decoder; td->der_encoder = asn_DEF_Str2.der_encoder; td->xer_decoder = asn_DEF_Str2.xer_decoder; td->xer_encoder = asn_DEF_Str2.xer_encoder; td->uper_decoder = asn_DEF_Str2.uper_decoder; td->uper_encoder = asn_DEF_Str2.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Str2.per_constraints; td->elements = asn_DEF_Str2.elements; td->elements_count = asn_DEF_Str2.elements_count; td->specifics = asn_DEF_Str2.specifics; } void Str3_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Str3_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Str3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Str3_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Str3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Str3_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Str3_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Str3_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Str3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Str3_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Str3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Str3_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [Str3] >>> ***/ static const ber_tlv_tag_t asn_DEF_Str3_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Str3 = { "Str3", "Str3", Str3_free, Str3_print, Str3_constraint, Str3_decode_ber, Str3_encode_der, Str3_decode_xer, Str3_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Str3_tags_1, sizeof(asn_DEF_Str3_tags_1) /sizeof(asn_DEF_Str3_tags_1[0]), /* 1 */ asn_DEF_Str3_tags_1, /* Same as above */ sizeof(asn_DEF_Str3_tags_1) /sizeof(asn_DEF_Str3_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [Str4] >>> ***/ #include /*** <<< TYPE-DECLS [Str4] >>> ***/ typedef IA5String_t Str4_t; /*** <<< FUNC-DECLS [Str4] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Str4; asn_struct_free_f Str4_free; asn_struct_print_f Str4_print; asn_constr_check_f Str4_constraint; ber_type_decoder_f Str4_decode_ber; der_type_encoder_f Str4_encode_der; xer_type_decoder_f Str4_decode_xer; xer_type_encoder_f Str4_encode_xer; /*** <<< CTABLES [Str4] >>> ***/ static int check_permitted_alphabet_1(const void *sptr) { /* The underlying type is IA5String */ const IA5String_t *st = (const IA5String_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(!(cv <= 127)) return -1; } return 0; } /*** <<< CODE [Str4] >>> ***/ int Str4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const IA5String_t *st = (const IA5String_t *)sptr; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(!check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using IA5String, * so here we adjust the DEF accordingly. */ static void Str4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_IA5String.free_struct; td->print_struct = asn_DEF_IA5String.print_struct; td->check_constraints = asn_DEF_IA5String.check_constraints; td->ber_decoder = asn_DEF_IA5String.ber_decoder; td->der_encoder = asn_DEF_IA5String.der_encoder; td->xer_decoder = asn_DEF_IA5String.xer_decoder; td->xer_encoder = asn_DEF_IA5String.xer_encoder; td->uper_decoder = asn_DEF_IA5String.uper_decoder; td->uper_encoder = asn_DEF_IA5String.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_IA5String.per_constraints; td->elements = asn_DEF_IA5String.elements; td->elements_count = asn_DEF_IA5String.elements_count; td->specifics = asn_DEF_IA5String.specifics; } void Str4_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Str4_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Str4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Str4_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Str4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Str4_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Str4_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Str4_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Str4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Str4_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Str4_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Str4_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [Str4] >>> ***/ static const ber_tlv_tag_t asn_DEF_Str4_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Str4 = { "Str4", "Str4", Str4_free, Str4_print, Str4_constraint, Str4_decode_ber, Str4_encode_der, Str4_decode_xer, Str4_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Str4_tags_1, sizeof(asn_DEF_Str4_tags_1) /sizeof(asn_DEF_Str4_tags_1[0]), /* 1 */ asn_DEF_Str4_tags_1, /* Same as above */ sizeof(asn_DEF_Str4_tags_1) /sizeof(asn_DEF_Str4_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [PER-Visible] >>> ***/ #include /*** <<< TYPE-DECLS [PER-Visible] >>> ***/ typedef IA5String_t PER_Visible_t; /*** <<< FUNC-DECLS [PER-Visible] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_PER_Visible; asn_struct_free_f PER_Visible_free; asn_struct_print_f PER_Visible_print; asn_constr_check_f PER_Visible_constraint; ber_type_decoder_f PER_Visible_decode_ber; der_type_encoder_f PER_Visible_encode_der; xer_type_decoder_f PER_Visible_decode_xer; xer_type_encoder_f PER_Visible_encode_xer; /*** <<< CTABLES [PER-Visible] >>> ***/ static int check_permitted_alphabet_1(const void *sptr) { /* The underlying type is IA5String */ const IA5String_t *st = (const IA5String_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(!(cv >= 65 && cv <= 70)) return -1; } return 0; } /*** <<< CODE [PER-Visible] >>> ***/ int PER_Visible_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const IA5String_t *st = (const IA5String_t *)sptr; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(!check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using IA5String, * so here we adjust the DEF accordingly. */ static void PER_Visible_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_IA5String.free_struct; td->print_struct = asn_DEF_IA5String.print_struct; td->check_constraints = asn_DEF_IA5String.check_constraints; td->ber_decoder = asn_DEF_IA5String.ber_decoder; td->der_encoder = asn_DEF_IA5String.der_encoder; td->xer_decoder = asn_DEF_IA5String.xer_decoder; td->xer_encoder = asn_DEF_IA5String.xer_encoder; td->uper_decoder = asn_DEF_IA5String.uper_decoder; td->uper_encoder = asn_DEF_IA5String.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_IA5String.per_constraints; td->elements = asn_DEF_IA5String.elements; td->elements_count = asn_DEF_IA5String.elements_count; td->specifics = asn_DEF_IA5String.specifics; } void PER_Visible_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { PER_Visible_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int PER_Visible_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { PER_Visible_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t PER_Visible_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { PER_Visible_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t PER_Visible_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { PER_Visible_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t PER_Visible_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { PER_Visible_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t PER_Visible_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { PER_Visible_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [PER-Visible] >>> ***/ static const ber_tlv_tag_t asn_DEF_PER_Visible_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) }; asn_TYPE_descriptor_t asn_DEF_PER_Visible = { "PER-Visible", "PER-Visible", PER_Visible_free, PER_Visible_print, PER_Visible_constraint, PER_Visible_decode_ber, PER_Visible_encode_der, PER_Visible_decode_xer, PER_Visible_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_PER_Visible_tags_1, sizeof(asn_DEF_PER_Visible_tags_1) /sizeof(asn_DEF_PER_Visible_tags_1[0]), /* 1 */ asn_DEF_PER_Visible_tags_1, /* Same as above */ sizeof(asn_DEF_PER_Visible_tags_1) /sizeof(asn_DEF_PER_Visible_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [PER-Visible-2] >>> ***/ #include "PER-Visible.h" /*** <<< TYPE-DECLS [PER-Visible-2] >>> ***/ typedef PER_Visible_t PER_Visible_2_t; /*** <<< FUNC-DECLS [PER-Visible-2] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_PER_Visible_2; asn_struct_free_f PER_Visible_2_free; asn_struct_print_f PER_Visible_2_print; asn_constr_check_f PER_Visible_2_constraint; ber_type_decoder_f PER_Visible_2_decode_ber; der_type_encoder_f PER_Visible_2_encode_der; xer_type_decoder_f PER_Visible_2_decode_xer; xer_type_encoder_f PER_Visible_2_encode_xer; /*** <<< CTABLES [PER-Visible-2] >>> ***/ static int check_permitted_alphabet_1(const void *sptr) { /* The underlying type is IA5String */ const IA5String_t *st = (const IA5String_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(!(cv >= 69 && cv <= 70)) return -1; } return 0; } /*** <<< CODE [PER-Visible-2] >>> ***/ int PER_Visible_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const PER_Visible_t *st = (const PER_Visible_t *)sptr; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(!check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using PER_Visible, * so here we adjust the DEF accordingly. */ static void PER_Visible_2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_PER_Visible.free_struct; td->print_struct = asn_DEF_PER_Visible.print_struct; td->check_constraints = asn_DEF_PER_Visible.check_constraints; td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; td->der_encoder = asn_DEF_PER_Visible.der_encoder; td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_PER_Visible.per_constraints; td->elements = asn_DEF_PER_Visible.elements; td->elements_count = asn_DEF_PER_Visible.elements_count; td->specifics = asn_DEF_PER_Visible.specifics; } void PER_Visible_2_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { PER_Visible_2_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int PER_Visible_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { PER_Visible_2_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t PER_Visible_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { PER_Visible_2_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t PER_Visible_2_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { PER_Visible_2_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t PER_Visible_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { PER_Visible_2_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t PER_Visible_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { PER_Visible_2_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [PER-Visible-2] >>> ***/ static const ber_tlv_tag_t asn_DEF_PER_Visible_2_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) }; asn_TYPE_descriptor_t asn_DEF_PER_Visible_2 = { "PER-Visible-2", "PER-Visible-2", PER_Visible_2_free, PER_Visible_2_print, PER_Visible_2_constraint, PER_Visible_2_decode_ber, PER_Visible_2_encode_der, PER_Visible_2_decode_xer, PER_Visible_2_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_PER_Visible_2_tags_1, sizeof(asn_DEF_PER_Visible_2_tags_1) /sizeof(asn_DEF_PER_Visible_2_tags_1[0]), /* 1 */ asn_DEF_PER_Visible_2_tags_1, /* Same as above */ sizeof(asn_DEF_PER_Visible_2_tags_1) /sizeof(asn_DEF_PER_Visible_2_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [Not-PER-Visible-1] >>> ***/ #include "PER-Visible.h" /*** <<< TYPE-DECLS [Not-PER-Visible-1] >>> ***/ typedef PER_Visible_t Not_PER_Visible_1_t; /*** <<< FUNC-DECLS [Not-PER-Visible-1] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_1; asn_struct_free_f Not_PER_Visible_1_free; asn_struct_print_f Not_PER_Visible_1_print; asn_constr_check_f Not_PER_Visible_1_constraint; ber_type_decoder_f Not_PER_Visible_1_decode_ber; der_type_encoder_f Not_PER_Visible_1_encode_der; xer_type_decoder_f Not_PER_Visible_1_decode_xer; xer_type_encoder_f Not_PER_Visible_1_encode_xer; /*** <<< CTABLES [Not-PER-Visible-1] >>> ***/ static int check_permitted_alphabet_1(const void *sptr) { /* The underlying type is IA5String */ const IA5String_t *st = (const IA5String_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(!(cv >= 65 && cv <= 70)) return -1; } return 0; } /*** <<< CODE [Not-PER-Visible-1] >>> ***/ int Not_PER_Visible_1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const PER_Visible_t *st = (const PER_Visible_t *)sptr; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(!check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using PER_Visible, * so here we adjust the DEF accordingly. */ static void Not_PER_Visible_1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_PER_Visible.free_struct; td->print_struct = asn_DEF_PER_Visible.print_struct; td->check_constraints = asn_DEF_PER_Visible.check_constraints; td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; td->der_encoder = asn_DEF_PER_Visible.der_encoder; td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_PER_Visible.per_constraints; td->elements = asn_DEF_PER_Visible.elements; td->elements_count = asn_DEF_PER_Visible.elements_count; td->specifics = asn_DEF_PER_Visible.specifics; } void Not_PER_Visible_1_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Not_PER_Visible_1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Not_PER_Visible_1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Not_PER_Visible_1_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Not_PER_Visible_1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Not_PER_Visible_1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [Not-PER-Visible-1] >>> ***/ static const ber_tlv_tag_t asn_DEF_Not_PER_Visible_1_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_1 = { "Not-PER-Visible-1", "Not-PER-Visible-1", Not_PER_Visible_1_free, Not_PER_Visible_1_print, Not_PER_Visible_1_constraint, Not_PER_Visible_1_decode_ber, Not_PER_Visible_1_encode_der, Not_PER_Visible_1_decode_xer, Not_PER_Visible_1_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Not_PER_Visible_1_tags_1, sizeof(asn_DEF_Not_PER_Visible_1_tags_1) /sizeof(asn_DEF_Not_PER_Visible_1_tags_1[0]), /* 1 */ asn_DEF_Not_PER_Visible_1_tags_1, /* Same as above */ sizeof(asn_DEF_Not_PER_Visible_1_tags_1) /sizeof(asn_DEF_Not_PER_Visible_1_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [Not-PER-Visible-2] >>> ***/ #include "PER-Visible.h" /*** <<< TYPE-DECLS [Not-PER-Visible-2] >>> ***/ typedef PER_Visible_t Not_PER_Visible_2_t; /*** <<< FUNC-DECLS [Not-PER-Visible-2] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_2; asn_struct_free_f Not_PER_Visible_2_free; asn_struct_print_f Not_PER_Visible_2_print; asn_constr_check_f Not_PER_Visible_2_constraint; ber_type_decoder_f Not_PER_Visible_2_decode_ber; der_type_encoder_f Not_PER_Visible_2_encode_der; xer_type_decoder_f Not_PER_Visible_2_decode_xer; xer_type_encoder_f Not_PER_Visible_2_encode_xer; /*** <<< CTABLES [Not-PER-Visible-2] >>> ***/ static int check_permitted_alphabet_1(const void *sptr) { /* The underlying type is IA5String */ const IA5String_t *st = (const IA5String_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(!(cv >= 65 && cv <= 66)) return -1; } return 0; } /*** <<< CODE [Not-PER-Visible-2] >>> ***/ int Not_PER_Visible_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const PER_Visible_t *st = (const PER_Visible_t *)sptr; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(!check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using PER_Visible, * so here we adjust the DEF accordingly. */ static void Not_PER_Visible_2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_PER_Visible.free_struct; td->print_struct = asn_DEF_PER_Visible.print_struct; td->check_constraints = asn_DEF_PER_Visible.check_constraints; td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; td->der_encoder = asn_DEF_PER_Visible.der_encoder; td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_PER_Visible.per_constraints; td->elements = asn_DEF_PER_Visible.elements; td->elements_count = asn_DEF_PER_Visible.elements_count; td->specifics = asn_DEF_PER_Visible.specifics; } void Not_PER_Visible_2_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Not_PER_Visible_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Not_PER_Visible_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Not_PER_Visible_2_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Not_PER_Visible_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Not_PER_Visible_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [Not-PER-Visible-2] >>> ***/ static const ber_tlv_tag_t asn_DEF_Not_PER_Visible_2_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_2 = { "Not-PER-Visible-2", "Not-PER-Visible-2", Not_PER_Visible_2_free, Not_PER_Visible_2_print, Not_PER_Visible_2_constraint, Not_PER_Visible_2_decode_ber, Not_PER_Visible_2_encode_der, Not_PER_Visible_2_decode_xer, Not_PER_Visible_2_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Not_PER_Visible_2_tags_1, sizeof(asn_DEF_Not_PER_Visible_2_tags_1) /sizeof(asn_DEF_Not_PER_Visible_2_tags_1[0]), /* 1 */ asn_DEF_Not_PER_Visible_2_tags_1, /* Same as above */ sizeof(asn_DEF_Not_PER_Visible_2_tags_1) /sizeof(asn_DEF_Not_PER_Visible_2_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [Not-PER-Visible-3] >>> ***/ #include "PER-Visible.h" /*** <<< TYPE-DECLS [Not-PER-Visible-3] >>> ***/ typedef PER_Visible_t Not_PER_Visible_3_t; /*** <<< FUNC-DECLS [Not-PER-Visible-3] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_3; asn_struct_free_f Not_PER_Visible_3_free; asn_struct_print_f Not_PER_Visible_3_print; asn_constr_check_f Not_PER_Visible_3_constraint; ber_type_decoder_f Not_PER_Visible_3_decode_ber; der_type_encoder_f Not_PER_Visible_3_encode_der; xer_type_decoder_f Not_PER_Visible_3_decode_xer; xer_type_encoder_f Not_PER_Visible_3_encode_xer; /*** <<< CTABLES [Not-PER-Visible-3] >>> ***/ static int check_permitted_alphabet_1(const void *sptr) { /* The underlying type is IA5String */ const IA5String_t *st = (const IA5String_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(!(cv >= 65 && cv <= 66)) return -1; } return 0; } /*** <<< CODE [Not-PER-Visible-3] >>> ***/ int Not_PER_Visible_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const PER_Visible_t *st = (const PER_Visible_t *)sptr; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(!check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using PER_Visible, * so here we adjust the DEF accordingly. */ static void Not_PER_Visible_3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_PER_Visible.free_struct; td->print_struct = asn_DEF_PER_Visible.print_struct; td->check_constraints = asn_DEF_PER_Visible.check_constraints; td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; td->der_encoder = asn_DEF_PER_Visible.der_encoder; td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_PER_Visible.per_constraints; td->elements = asn_DEF_PER_Visible.elements; td->elements_count = asn_DEF_PER_Visible.elements_count; td->specifics = asn_DEF_PER_Visible.specifics; } void Not_PER_Visible_3_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Not_PER_Visible_3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Not_PER_Visible_3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Not_PER_Visible_3_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Not_PER_Visible_3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Not_PER_Visible_3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [Not-PER-Visible-3] >>> ***/ static const ber_tlv_tag_t asn_DEF_Not_PER_Visible_3_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_3 = { "Not-PER-Visible-3", "Not-PER-Visible-3", Not_PER_Visible_3_free, Not_PER_Visible_3_print, Not_PER_Visible_3_constraint, Not_PER_Visible_3_decode_ber, Not_PER_Visible_3_encode_der, Not_PER_Visible_3_decode_xer, Not_PER_Visible_3_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Not_PER_Visible_3_tags_1, sizeof(asn_DEF_Not_PER_Visible_3_tags_1) /sizeof(asn_DEF_Not_PER_Visible_3_tags_1[0]), /* 1 */ asn_DEF_Not_PER_Visible_3_tags_1, /* Same as above */ sizeof(asn_DEF_Not_PER_Visible_3_tags_1) /sizeof(asn_DEF_Not_PER_Visible_3_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [SIZE-but-not-FROM] >>> ***/ #include "PER-Visible.h" /*** <<< TYPE-DECLS [SIZE-but-not-FROM] >>> ***/ typedef PER_Visible_t SIZE_but_not_FROM_t; /*** <<< FUNC-DECLS [SIZE-but-not-FROM] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_SIZE_but_not_FROM; asn_struct_free_f SIZE_but_not_FROM_free; asn_struct_print_f SIZE_but_not_FROM_print; asn_constr_check_f SIZE_but_not_FROM_constraint; ber_type_decoder_f SIZE_but_not_FROM_decode_ber; der_type_encoder_f SIZE_but_not_FROM_encode_der; xer_type_decoder_f SIZE_but_not_FROM_decode_xer; xer_type_encoder_f SIZE_but_not_FROM_encode_xer; /*** <<< CTABLES [SIZE-but-not-FROM] >>> ***/ static int check_permitted_alphabet_1(const void *sptr) { /* The underlying type is IA5String */ const IA5String_t *st = (const IA5String_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(!(cv >= 65 && cv <= 68)) return -1; } return 0; } /*** <<< CODE [SIZE-but-not-FROM] >>> ***/ int SIZE_but_not_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const PER_Visible_t *st = (const PER_Visible_t *)sptr; size_t size; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } size = st->size; if((size >= 1 && size <= 4) && !check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using PER_Visible, * so here we adjust the DEF accordingly. */ static void SIZE_but_not_FROM_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_PER_Visible.free_struct; td->print_struct = asn_DEF_PER_Visible.print_struct; td->check_constraints = asn_DEF_PER_Visible.check_constraints; td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; td->der_encoder = asn_DEF_PER_Visible.der_encoder; td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_PER_Visible.per_constraints; td->elements = asn_DEF_PER_Visible.elements; td->elements_count = asn_DEF_PER_Visible.elements_count; td->specifics = asn_DEF_PER_Visible.specifics; } void SIZE_but_not_FROM_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int SIZE_but_not_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t SIZE_but_not_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t SIZE_but_not_FROM_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t SIZE_but_not_FROM_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t SIZE_but_not_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [SIZE-but-not-FROM] >>> ***/ static const ber_tlv_tag_t asn_DEF_SIZE_but_not_FROM_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) }; asn_TYPE_descriptor_t asn_DEF_SIZE_but_not_FROM = { "SIZE-but-not-FROM", "SIZE-but-not-FROM", SIZE_but_not_FROM_free, SIZE_but_not_FROM_print, SIZE_but_not_FROM_constraint, SIZE_but_not_FROM_decode_ber, SIZE_but_not_FROM_encode_der, SIZE_but_not_FROM_decode_xer, SIZE_but_not_FROM_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_SIZE_but_not_FROM_tags_1, sizeof(asn_DEF_SIZE_but_not_FROM_tags_1) /sizeof(asn_DEF_SIZE_but_not_FROM_tags_1[0]), /* 1 */ asn_DEF_SIZE_but_not_FROM_tags_1, /* Same as above */ sizeof(asn_DEF_SIZE_but_not_FROM_tags_1) /sizeof(asn_DEF_SIZE_but_not_FROM_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [SIZE-and-FROM] >>> ***/ #include "PER-Visible.h" /*** <<< TYPE-DECLS [SIZE-and-FROM] >>> ***/ typedef PER_Visible_t SIZE_and_FROM_t; /*** <<< FUNC-DECLS [SIZE-and-FROM] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_SIZE_and_FROM; asn_struct_free_f SIZE_and_FROM_free; asn_struct_print_f SIZE_and_FROM_print; asn_constr_check_f SIZE_and_FROM_constraint; ber_type_decoder_f SIZE_and_FROM_decode_ber; der_type_encoder_f SIZE_and_FROM_encode_der; xer_type_decoder_f SIZE_and_FROM_decode_xer; xer_type_encoder_f SIZE_and_FROM_encode_xer; /*** <<< CTABLES [SIZE-and-FROM] >>> ***/ static int check_permitted_alphabet_1(const void *sptr) { /* The underlying type is IA5String */ const IA5String_t *st = (const IA5String_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(!(cv >= 65 && cv <= 68)) return -1; } return 0; } /*** <<< CODE [SIZE-and-FROM] >>> ***/ int SIZE_and_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const PER_Visible_t *st = (const PER_Visible_t *)sptr; size_t size; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } size = st->size; if((size >= 1 && size <= 4) && !check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using PER_Visible, * so here we adjust the DEF accordingly. */ static void SIZE_and_FROM_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_PER_Visible.free_struct; td->print_struct = asn_DEF_PER_Visible.print_struct; td->check_constraints = asn_DEF_PER_Visible.check_constraints; td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; td->der_encoder = asn_DEF_PER_Visible.der_encoder; td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_PER_Visible.per_constraints; td->elements = asn_DEF_PER_Visible.elements; td->elements_count = asn_DEF_PER_Visible.elements_count; td->specifics = asn_DEF_PER_Visible.specifics; } void SIZE_and_FROM_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { SIZE_and_FROM_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int SIZE_and_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { SIZE_and_FROM_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t SIZE_and_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { SIZE_and_FROM_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t SIZE_and_FROM_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { SIZE_and_FROM_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t SIZE_and_FROM_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { SIZE_and_FROM_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t SIZE_and_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { SIZE_and_FROM_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [SIZE-and-FROM] >>> ***/ static const ber_tlv_tag_t asn_DEF_SIZE_and_FROM_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) }; asn_TYPE_descriptor_t asn_DEF_SIZE_and_FROM = { "SIZE-and-FROM", "SIZE-and-FROM", SIZE_and_FROM_free, SIZE_and_FROM_print, SIZE_and_FROM_constraint, SIZE_and_FROM_decode_ber, SIZE_and_FROM_encode_der, SIZE_and_FROM_decode_xer, SIZE_and_FROM_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_SIZE_and_FROM_tags_1, sizeof(asn_DEF_SIZE_and_FROM_tags_1) /sizeof(asn_DEF_SIZE_and_FROM_tags_1[0]), /* 1 */ asn_DEF_SIZE_and_FROM_tags_1, /* Same as above */ sizeof(asn_DEF_SIZE_and_FROM_tags_1) /sizeof(asn_DEF_SIZE_and_FROM_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [Neither-SIZE-nor-FROM] >>> ***/ #include "PER-Visible.h" /*** <<< TYPE-DECLS [Neither-SIZE-nor-FROM] >>> ***/ typedef PER_Visible_t Neither_SIZE_nor_FROM_t; /*** <<< FUNC-DECLS [Neither-SIZE-nor-FROM] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Neither_SIZE_nor_FROM; asn_struct_free_f Neither_SIZE_nor_FROM_free; asn_struct_print_f Neither_SIZE_nor_FROM_print; asn_constr_check_f Neither_SIZE_nor_FROM_constraint; ber_type_decoder_f Neither_SIZE_nor_FROM_decode_ber; der_type_encoder_f Neither_SIZE_nor_FROM_encode_der; xer_type_decoder_f Neither_SIZE_nor_FROM_decode_xer; xer_type_encoder_f Neither_SIZE_nor_FROM_encode_xer; /*** <<< CTABLES [Neither-SIZE-nor-FROM] >>> ***/ static int check_permitted_alphabet_1(const void *sptr) { /* The underlying type is IA5String */ const IA5String_t *st = (const IA5String_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(!(cv >= 65 && cv <= 70)) return -1; } return 0; } /*** <<< CODE [Neither-SIZE-nor-FROM] >>> ***/ int Neither_SIZE_nor_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const PER_Visible_t *st = (const PER_Visible_t *)sptr; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(!check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using PER_Visible, * so here we adjust the DEF accordingly. */ static void Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_PER_Visible.free_struct; td->print_struct = asn_DEF_PER_Visible.print_struct; td->check_constraints = asn_DEF_PER_Visible.check_constraints; td->ber_decoder = asn_DEF_PER_Visible.ber_decoder; td->der_encoder = asn_DEF_PER_Visible.der_encoder; td->xer_decoder = asn_DEF_PER_Visible.xer_decoder; td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_PER_Visible.per_constraints; td->elements = asn_DEF_PER_Visible.elements; td->elements_count = asn_DEF_PER_Visible.elements_count; td->specifics = asn_DEF_PER_Visible.specifics; } void Neither_SIZE_nor_FROM_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Neither_SIZE_nor_FROM_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Neither_SIZE_nor_FROM_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Neither_SIZE_nor_FROM_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Neither_SIZE_nor_FROM_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Neither_SIZE_nor_FROM_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [Neither-SIZE-nor-FROM] >>> ***/ static const ber_tlv_tag_t asn_DEF_Neither_SIZE_nor_FROM_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Neither_SIZE_nor_FROM = { "Neither-SIZE-nor-FROM", "Neither-SIZE-nor-FROM", Neither_SIZE_nor_FROM_free, Neither_SIZE_nor_FROM_print, Neither_SIZE_nor_FROM_constraint, Neither_SIZE_nor_FROM_decode_ber, Neither_SIZE_nor_FROM_encode_der, Neither_SIZE_nor_FROM_decode_xer, Neither_SIZE_nor_FROM_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Neither_SIZE_nor_FROM_tags_1, sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags_1) /sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags_1[0]), /* 1 */ asn_DEF_Neither_SIZE_nor_FROM_tags_1, /* Same as above */ sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags_1) /sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [Utf8-4] >>> ***/ #include /*** <<< TYPE-DECLS [Utf8-4] >>> ***/ typedef UTF8String_t Utf8_4_t; /*** <<< FUNC-DECLS [Utf8-4] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Utf8_4; asn_struct_free_f Utf8_4_free; asn_struct_print_f Utf8_4_print; asn_constr_check_f Utf8_4_constraint; ber_type_decoder_f Utf8_4_decode_ber; der_type_encoder_f Utf8_4_encode_der; xer_type_decoder_f Utf8_4_decode_xer; xer_type_encoder_f Utf8_4_encode_xer; /*** <<< CTABLES [Utf8-4] >>> ***/ static int check_permitted_alphabet_1(const void *sptr) { if(UTF8String_length((const UTF8String_t *)sptr) < 0) return -1; /* Alphabet (sic!) test failed. */ return 0; } /*** <<< CODE [Utf8-4] >>> ***/ int Utf8_4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const UTF8String_t *st = (const UTF8String_t *)sptr; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(!check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using UTF8String, * so here we adjust the DEF accordingly. */ static void Utf8_4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_UTF8String.free_struct; td->print_struct = asn_DEF_UTF8String.print_struct; td->check_constraints = asn_DEF_UTF8String.check_constraints; td->ber_decoder = asn_DEF_UTF8String.ber_decoder; td->der_encoder = asn_DEF_UTF8String.der_encoder; td->xer_decoder = asn_DEF_UTF8String.xer_decoder; td->xer_encoder = asn_DEF_UTF8String.xer_encoder; td->uper_decoder = asn_DEF_UTF8String.uper_decoder; td->uper_encoder = asn_DEF_UTF8String.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_UTF8String.per_constraints; td->elements = asn_DEF_UTF8String.elements; td->elements_count = asn_DEF_UTF8String.elements_count; td->specifics = asn_DEF_UTF8String.specifics; } void Utf8_4_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Utf8_4_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Utf8_4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Utf8_4_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Utf8_4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Utf8_4_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Utf8_4_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Utf8_4_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Utf8_4_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Utf8_4_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Utf8_4_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Utf8_4_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [Utf8-4] >>> ***/ static const ber_tlv_tag_t asn_DEF_Utf8_4_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Utf8_4 = { "Utf8-4", "Utf8-4", Utf8_4_free, Utf8_4_print, Utf8_4_constraint, Utf8_4_decode_ber, Utf8_4_encode_der, Utf8_4_decode_xer, Utf8_4_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Utf8_4_tags_1, sizeof(asn_DEF_Utf8_4_tags_1) /sizeof(asn_DEF_Utf8_4_tags_1[0]), /* 1 */ asn_DEF_Utf8_4_tags_1, /* Same as above */ sizeof(asn_DEF_Utf8_4_tags_1) /sizeof(asn_DEF_Utf8_4_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [Utf8-3] >>> ***/ #include "Utf8-2.h" /*** <<< TYPE-DECLS [Utf8-3] >>> ***/ typedef Utf8_2_t Utf8_3_t; /*** <<< FUNC-DECLS [Utf8-3] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Utf8_3; asn_struct_free_f Utf8_3_free; asn_struct_print_f Utf8_3_print; asn_constr_check_f Utf8_3_constraint; ber_type_decoder_f Utf8_3_decode_ber; der_type_encoder_f Utf8_3_encode_der; xer_type_decoder_f Utf8_3_decode_xer; xer_type_encoder_f Utf8_3_encode_xer; /*** <<< CTABLES [Utf8-3] >>> ***/ static const int permitted_alphabet_table_1[128] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15, /* ABCDEFGHIJKLMNO */ 16,17,18,19,20,21,22,23,24,25,26, 0, 0, 0, 0, 0, /* PQRSTUVWXYZ */ 0,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41, /* abcdefghijklmno */ 42,43,44,45,46,47,48,49,50,51,52, 0, 0, 0, 0, 0, /* pqrstuvwxyz */ }; static int check_permitted_alphabet_1(const void *sptr) { const int *table = permitted_alphabet_table_1; /* The underlying type is UTF8String */ const UTF8String_t *st = (const UTF8String_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(cv >= 0x80) return -1; if(!table[cv]) return -1; } return 0; } /*** <<< CODE [Utf8-3] >>> ***/ int Utf8_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Utf8_2_t *st = (const Utf8_2_t *)sptr; size_t size; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } size = UTF8String_length(st); if((ssize_t)size < 0) { ASN__CTFAIL(app_key, td, sptr, "%s: UTF-8: broken encoding (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if((size >= 1 && size <= 2) && !check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using Utf8_2, * so here we adjust the DEF accordingly. */ static void Utf8_3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_Utf8_2.free_struct; td->print_struct = asn_DEF_Utf8_2.print_struct; td->check_constraints = asn_DEF_Utf8_2.check_constraints; td->ber_decoder = asn_DEF_Utf8_2.ber_decoder; td->der_encoder = asn_DEF_Utf8_2.der_encoder; td->xer_decoder = asn_DEF_Utf8_2.xer_decoder; td->xer_encoder = asn_DEF_Utf8_2.xer_encoder; td->uper_decoder = asn_DEF_Utf8_2.uper_decoder; td->uper_encoder = asn_DEF_Utf8_2.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Utf8_2.per_constraints; td->elements = asn_DEF_Utf8_2.elements; td->elements_count = asn_DEF_Utf8_2.elements_count; td->specifics = asn_DEF_Utf8_2.specifics; } void Utf8_3_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Utf8_3_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Utf8_3_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Utf8_3_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Utf8_3_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Utf8_3_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Utf8_3_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Utf8_3_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Utf8_3_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Utf8_3_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Utf8_3_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Utf8_3_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [Utf8-3] >>> ***/ static const ber_tlv_tag_t asn_DEF_Utf8_3_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Utf8_3 = { "Utf8-3", "Utf8-3", Utf8_3_free, Utf8_3_print, Utf8_3_constraint, Utf8_3_decode_ber, Utf8_3_encode_der, Utf8_3_decode_xer, Utf8_3_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Utf8_3_tags_1, sizeof(asn_DEF_Utf8_3_tags_1) /sizeof(asn_DEF_Utf8_3_tags_1[0]), /* 1 */ asn_DEF_Utf8_3_tags_1, /* Same as above */ sizeof(asn_DEF_Utf8_3_tags_1) /sizeof(asn_DEF_Utf8_3_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [Utf8-2] >>> ***/ #include "Utf8-1.h" /*** <<< TYPE-DECLS [Utf8-2] >>> ***/ typedef Utf8_1_t Utf8_2_t; /*** <<< FUNC-DECLS [Utf8-2] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Utf8_2; asn_struct_free_f Utf8_2_free; asn_struct_print_f Utf8_2_print; asn_constr_check_f Utf8_2_constraint; ber_type_decoder_f Utf8_2_decode_ber; der_type_encoder_f Utf8_2_encode_der; xer_type_decoder_f Utf8_2_decode_xer; xer_type_encoder_f Utf8_2_encode_xer; /*** <<< CODE [Utf8-2] >>> ***/ int Utf8_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Utf8_1_t *st = (const Utf8_1_t *)sptr; size_t size; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } size = UTF8String_length(st); if((ssize_t)size < 0) { ASN__CTFAIL(app_key, td, sptr, "%s: UTF-8: broken encoding (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if((size >= 1 && size <= 2)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using Utf8_1, * so here we adjust the DEF accordingly. */ static void Utf8_2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_Utf8_1.free_struct; td->print_struct = asn_DEF_Utf8_1.print_struct; td->check_constraints = asn_DEF_Utf8_1.check_constraints; td->ber_decoder = asn_DEF_Utf8_1.ber_decoder; td->der_encoder = asn_DEF_Utf8_1.der_encoder; td->xer_decoder = asn_DEF_Utf8_1.xer_decoder; td->xer_encoder = asn_DEF_Utf8_1.xer_encoder; td->uper_decoder = asn_DEF_Utf8_1.uper_decoder; td->uper_encoder = asn_DEF_Utf8_1.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Utf8_1.per_constraints; td->elements = asn_DEF_Utf8_1.elements; td->elements_count = asn_DEF_Utf8_1.elements_count; td->specifics = asn_DEF_Utf8_1.specifics; } void Utf8_2_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Utf8_2_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Utf8_2_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Utf8_2_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Utf8_2_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Utf8_2_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Utf8_2_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Utf8_2_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Utf8_2_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Utf8_2_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Utf8_2_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Utf8_2_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [Utf8-2] >>> ***/ static const ber_tlv_tag_t asn_DEF_Utf8_2_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Utf8_2 = { "Utf8-2", "Utf8-2", Utf8_2_free, Utf8_2_print, Utf8_2_constraint, Utf8_2_decode_ber, Utf8_2_encode_der, Utf8_2_decode_xer, Utf8_2_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Utf8_2_tags_1, sizeof(asn_DEF_Utf8_2_tags_1) /sizeof(asn_DEF_Utf8_2_tags_1[0]), /* 1 */ asn_DEF_Utf8_2_tags_1, /* Same as above */ sizeof(asn_DEF_Utf8_2_tags_1) /sizeof(asn_DEF_Utf8_2_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [Utf8-1] >>> ***/ #include /*** <<< TYPE-DECLS [Utf8-1] >>> ***/ typedef UTF8String_t Utf8_1_t; /*** <<< FUNC-DECLS [Utf8-1] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Utf8_1; asn_struct_free_f Utf8_1_free; asn_struct_print_f Utf8_1_print; asn_constr_check_f Utf8_1_constraint; ber_type_decoder_f Utf8_1_decode_ber; der_type_encoder_f Utf8_1_encode_der; xer_type_decoder_f Utf8_1_decode_xer; xer_type_encoder_f Utf8_1_encode_xer; /*** <<< CODE [Utf8-1] >>> ***/ int Utf8_1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_UTF8String.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using UTF8String, * so here we adjust the DEF accordingly. */ static void Utf8_1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_UTF8String.free_struct; td->print_struct = asn_DEF_UTF8String.print_struct; td->check_constraints = asn_DEF_UTF8String.check_constraints; td->ber_decoder = asn_DEF_UTF8String.ber_decoder; td->der_encoder = asn_DEF_UTF8String.der_encoder; td->xer_decoder = asn_DEF_UTF8String.xer_decoder; td->xer_encoder = asn_DEF_UTF8String.xer_encoder; td->uper_decoder = asn_DEF_UTF8String.uper_decoder; td->uper_encoder = asn_DEF_UTF8String.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_UTF8String.per_constraints; td->elements = asn_DEF_UTF8String.elements; td->elements_count = asn_DEF_UTF8String.elements_count; td->specifics = asn_DEF_UTF8String.specifics; } void Utf8_1_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Utf8_1_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Utf8_1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Utf8_1_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Utf8_1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Utf8_1_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Utf8_1_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Utf8_1_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Utf8_1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Utf8_1_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Utf8_1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Utf8_1_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [Utf8-1] >>> ***/ static const ber_tlv_tag_t asn_DEF_Utf8_1_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Utf8_1 = { "Utf8-1", "Utf8-1", Utf8_1_free, Utf8_1_print, Utf8_1_constraint, Utf8_1_decode_ber, Utf8_1_encode_der, Utf8_1_decode_xer, Utf8_1_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Utf8_1_tags_1, sizeof(asn_DEF_Utf8_1_tags_1) /sizeof(asn_DEF_Utf8_1_tags_1[0]), /* 1 */ asn_DEF_Utf8_1_tags_1, /* Same as above */ sizeof(asn_DEF_Utf8_1_tags_1) /sizeof(asn_DEF_Utf8_1_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [VisibleIdentifier] >>> ***/ #include "Identifier.h" /*** <<< TYPE-DECLS [VisibleIdentifier] >>> ***/ typedef Identifier_t VisibleIdentifier_t; /*** <<< FUNC-DECLS [VisibleIdentifier] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_VisibleIdentifier; asn_struct_free_f VisibleIdentifier_free; asn_struct_print_f VisibleIdentifier_print; asn_constr_check_f VisibleIdentifier_constraint; ber_type_decoder_f VisibleIdentifier_decode_ber; der_type_encoder_f VisibleIdentifier_encode_der; xer_type_decoder_f VisibleIdentifier_decode_xer; xer_type_encoder_f VisibleIdentifier_encode_xer; /*** <<< CTABLES [VisibleIdentifier] >>> ***/ static const int permitted_alphabet_table_1[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* $ */ 2, 3, 4, 5, 6, 7, 8, 9,10,11, 0, 0, 0, 0, 0, 0, /* 0123456789 */ 0,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26, /* ABCDEFGHIJKLMNO */ 27,28,29,30,31,32,33,34,35,36,37, 0, 0, 0, 0,38, /* PQRSTUVWXYZ _ */ 0,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53, /* abcdefghijklmno */ 54,55,56,57,58,59,60,61,62,63,64, 0, 0, 0, 0, 0, /* pqrstuvwxyz */ }; static int check_permitted_alphabet_1(const void *sptr) { const int *table = permitted_alphabet_table_1; /* The underlying type is VisibleString */ const VisibleString_t *st = (const VisibleString_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(!table[cv]) return -1; } return 0; } /*** <<< CODE [VisibleIdentifier] >>> ***/ int VisibleIdentifier_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Identifier_t *st = (const Identifier_t *)sptr; size_t size; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } size = st->size; if((size >= 1 && size <= 32) && !check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using Identifier, * so here we adjust the DEF accordingly. */ static void VisibleIdentifier_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_Identifier.free_struct; td->print_struct = asn_DEF_Identifier.print_struct; td->check_constraints = asn_DEF_Identifier.check_constraints; td->ber_decoder = asn_DEF_Identifier.ber_decoder; td->der_encoder = asn_DEF_Identifier.der_encoder; td->xer_decoder = asn_DEF_Identifier.xer_decoder; td->xer_encoder = asn_DEF_Identifier.xer_encoder; td->uper_decoder = asn_DEF_Identifier.uper_decoder; td->uper_encoder = asn_DEF_Identifier.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Identifier.per_constraints; td->elements = asn_DEF_Identifier.elements; td->elements_count = asn_DEF_Identifier.elements_count; td->specifics = asn_DEF_Identifier.specifics; } void VisibleIdentifier_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { VisibleIdentifier_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int VisibleIdentifier_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { VisibleIdentifier_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t VisibleIdentifier_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { VisibleIdentifier_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t VisibleIdentifier_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { VisibleIdentifier_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t VisibleIdentifier_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { VisibleIdentifier_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t VisibleIdentifier_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { VisibleIdentifier_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [VisibleIdentifier] >>> ***/ static const ber_tlv_tag_t asn_DEF_VisibleIdentifier_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (26 << 2)) }; asn_TYPE_descriptor_t asn_DEF_VisibleIdentifier = { "VisibleIdentifier", "VisibleIdentifier", VisibleIdentifier_free, VisibleIdentifier_print, VisibleIdentifier_constraint, VisibleIdentifier_decode_ber, VisibleIdentifier_encode_der, VisibleIdentifier_decode_xer, VisibleIdentifier_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_VisibleIdentifier_tags_1, sizeof(asn_DEF_VisibleIdentifier_tags_1) /sizeof(asn_DEF_VisibleIdentifier_tags_1[0]), /* 1 */ asn_DEF_VisibleIdentifier_tags_1, /* Same as above */ sizeof(asn_DEF_VisibleIdentifier_tags_1) /sizeof(asn_DEF_VisibleIdentifier_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [Sequence] >>> ***/ #include "Int1.h" #include "Int4.h" #include #include #include #include "Int5.h" #include /*** <<< DEPS [Sequence] >>> ***/ typedef enum enum_c { enum_c_one = 1, enum_c_two = 2, /* * Enumeration is extensible */ enum_c_three = 3 } e_enum_c; /*** <<< TYPE-DECLS [Sequence] >>> ***/ typedef struct Sequence { Int1_t *int1_c /* DEFAULT 3 */; Int4_t int4; Int4_t int4_c; BOOLEAN_t *Bool /* DEFAULT 1 */; ENUMERATED_t enum_c; NULL_t *null /* OPTIONAL */; /* * This type is extensible, * possible extensions are below. */ Int5_t *int5_c /* OPTIONAL */; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Sequence_t; /*** <<< FUNC-DECLS [Sequence] >>> ***/ /* extern asn_TYPE_descriptor_t asn_DEF_enum_c_6; // (Use -fall-defs-global to expose) */ extern asn_TYPE_descriptor_t asn_DEF_Sequence; /*** <<< CODE [Sequence] >>> ***/ static int enum_c_6_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ENUMERATED.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using ENUMERATED, * so here we adjust the DEF accordingly. */ static void enum_c_6_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_ENUMERATED.free_struct; td->print_struct = asn_DEF_ENUMERATED.print_struct; td->check_constraints = asn_DEF_ENUMERATED.check_constraints; td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; td->der_encoder = asn_DEF_ENUMERATED.der_encoder; td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; td->elements = asn_DEF_ENUMERATED.elements; td->elements_count = asn_DEF_ENUMERATED.elements_count; /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ } static void enum_c_6_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { enum_c_6_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } static int enum_c_6_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { enum_c_6_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } static asn_dec_rval_t enum_c_6_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { enum_c_6_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } static asn_enc_rval_t enum_c_6_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { enum_c_6_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } static asn_dec_rval_t enum_c_6_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { enum_c_6_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } static asn_enc_rval_t enum_c_6_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { enum_c_6_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } static int memb_int1_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Int1_t *st = (const Int1_t *)sptr; long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(asn_INTEGER2long(st, &value)) { ASN__CTFAIL(app_key, td, sptr, "%s: value too large (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if((value >= -2)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } static int memb_int4_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Int4_t *st = (const Int4_t *)sptr; long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(asn_INTEGER2long(st, &value)) { ASN__CTFAIL(app_key, td, sptr, "%s: value too large (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if((value >= 5 && value <= 7)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } static int memb_int5_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Int5_t *st = (const Int5_t *)sptr; long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(asn_INTEGER2long(st, &value)) { ASN__CTFAIL(app_key, td, sptr, "%s: value too large (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if((value == 5)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /*** <<< STAT-DEFS [Sequence] >>> ***/ static int asn_DFL_2_set_3(int set_value, void **sptr) { Int1_t *st = *sptr; if(!st) { if(!set_value) return -1; /* Not a default value */ st = (*sptr = CALLOC(1, sizeof(*st))); if(!st) return -1; } if(set_value) { /* Install default value 3 */ return asn_long2INTEGER(st, 3); } else { /* Test default value 3 */ long value; if(asn_INTEGER2long(st, &value)) return -1; return (value == 3); } } static int asn_DFL_5_set_1(int set_value, void **sptr) { BOOLEAN_t *st = *sptr; if(!st) { if(!set_value) return -1; /* Not a default value */ st = (*sptr = CALLOC(1, sizeof(*st))); if(!st) return -1; } if(set_value) { /* Install default value 1 */ *st = 1; return 0; } else { /* Test default value 1 */ return (*st == 1); } } static const asn_INTEGER_enum_map_t asn_MAP_enum_c_value2enum_6[] = { { 1, 3, "one" }, { 2, 3, "two" }, { 3, 5, "three" } /* This list is extensible */ }; static const unsigned int asn_MAP_enum_c_enum2value_6[] = { 0, /* one(1) */ 2, /* three(3) */ 1 /* two(2) */ /* This list is extensible */ }; static const asn_INTEGER_specifics_t asn_SPC_enum_c_specs_6 = { asn_MAP_enum_c_value2enum_6, /* "tag" => N; sorted by tag */ asn_MAP_enum_c_enum2value_6, /* N => "tag"; sorted by N */ 3, /* Number of elements in the maps */ 3, /* Extensions before this member */ 1, /* Strict enumeration */ 0, /* Native long size */ 0 }; static const ber_tlv_tag_t asn_DEF_enum_c_tags_6[] = { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_enum_c_6 = { "enum-c", "enum-c", enum_c_6_free, enum_c_6_print, enum_c_6_constraint, enum_c_6_decode_ber, enum_c_6_encode_der, enum_c_6_decode_xer, enum_c_6_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_enum_c_tags_6, sizeof(asn_DEF_enum_c_tags_6) /sizeof(asn_DEF_enum_c_tags_6[0]), /* 1 */ asn_DEF_enum_c_tags_6, /* Same as above */ sizeof(asn_DEF_enum_c_tags_6) /sizeof(asn_DEF_enum_c_tags_6[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* Defined elsewhere */ &asn_SPC_enum_c_specs_6 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_Sequence_1[] = { { ATF_POINTER, 1, offsetof(struct Sequence, int1_c), .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), .tag_mode = 0, .type = &asn_DEF_Int1, .memb_constraints = memb_int1_c_constraint_1, .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = asn_DFL_2_set_3, /* DEFAULT 3 */ .name = "int1-c" }, { ATF_NOFLAGS, 0, offsetof(struct Sequence, int4), .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), .tag_mode = +1, /* EXPLICIT tag at current level */ .type = &asn_DEF_Int4, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "int4" }, { ATF_NOFLAGS, 0, offsetof(struct Sequence, int4_c), .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), .tag_mode = 0, .type = &asn_DEF_Int4, .memb_constraints = memb_int4_c_constraint_1, .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "int4-c" }, { ATF_POINTER, 1, offsetof(struct Sequence, Bool), .tag = (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)), .tag_mode = 0, .type = &asn_DEF_BOOLEAN, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = asn_DFL_5_set_1, /* DEFAULT 1 */ .name = "bool" }, { ATF_NOFLAGS, 0, offsetof(struct Sequence, enum_c), .tag = (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), .tag_mode = 0, .type = &asn_DEF_enum_c_6, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "enum-c" }, { ATF_POINTER, 2, offsetof(struct Sequence, null), .tag = (ASN_TAG_CLASS_UNIVERSAL | (5 << 2)), .tag_mode = 0, .type = &asn_DEF_NULL, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "null" }, { ATF_POINTER, 1, offsetof(struct Sequence, int5_c), .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), .tag_mode = 0, .type = &asn_DEF_Int5, .memb_constraints = memb_int5_c_constraint_1, .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "int5-c" }, }; static const ber_tlv_tag_t asn_DEF_Sequence_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_Sequence_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)), 3, 0, 0 }, /* bool */ { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 2 }, /* int1-c */ { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 2, -1, 1 }, /* int4-c */ { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 6, -2, 0 }, /* int5-c */ { (ASN_TAG_CLASS_UNIVERSAL | (5 << 2)), 5, 0, 0 }, /* null */ { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 4, 0, 0 }, /* enum-c */ { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 1, 0, 0 } /* int4 */ }; static asn_SEQUENCE_specifics_t asn_SPC_Sequence_specs_1 = { sizeof(struct Sequence), offsetof(struct Sequence, _asn_ctx), asn_MAP_Sequence_tag2el_1, 7, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ 5, /* Start extensions */ 8 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Sequence = { "Sequence", "Sequence", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Sequence_tags_1, sizeof(asn_DEF_Sequence_tags_1) /sizeof(asn_DEF_Sequence_tags_1[0]), /* 1 */ asn_DEF_Sequence_tags_1, /* Same as above */ sizeof(asn_DEF_Sequence_tags_1) /sizeof(asn_DEF_Sequence_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Sequence_1, 7, /* Elements count */ &asn_SPC_Sequence_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [SequenceOf] >>> ***/ #include #include /*** <<< FWD-DECLS [SequenceOf] >>> ***/ struct Sequence; /*** <<< TYPE-DECLS [SequenceOf] >>> ***/ typedef struct SequenceOf { A_SEQUENCE_OF(struct Sequence) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } SequenceOf_t; /*** <<< FUNC-DECLS [SequenceOf] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_SequenceOf; /*** <<< POST-INCLUDE [SequenceOf] >>> ***/ #include "Sequence.h" /*** <<< STAT-DEFS [SequenceOf] >>> ***/ static asn_TYPE_member_t asn_MBR_SequenceOf_1[] = { { ATF_POINTER, 0, 0, .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), .tag_mode = 0, .type = &asn_DEF_Sequence, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "" }, }; static const ber_tlv_tag_t asn_DEF_SequenceOf_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_SequenceOf_specs_1 = { sizeof(struct SequenceOf), offsetof(struct SequenceOf, _asn_ctx), 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_SequenceOf = { "SequenceOf", "SequenceOf", SEQUENCE_OF_free, SEQUENCE_OF_print, SEQUENCE_OF_constraint, SEQUENCE_OF_decode_ber, SEQUENCE_OF_encode_der, SEQUENCE_OF_decode_xer, SEQUENCE_OF_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_SequenceOf_tags_1, sizeof(asn_DEF_SequenceOf_tags_1) /sizeof(asn_DEF_SequenceOf_tags_1[0]), /* 1 */ asn_DEF_SequenceOf_tags_1, /* Same as above */ sizeof(asn_DEF_SequenceOf_tags_1) /sizeof(asn_DEF_SequenceOf_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_SequenceOf_1, 1, /* Single element */ &asn_SPC_SequenceOf_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Enum0] >>> ***/ #include /*** <<< DEPS [Enum0] >>> ***/ typedef enum Enum0 { Enum0_one = 0, Enum0_two = 1 } e_Enum0; /*** <<< TYPE-DECLS [Enum0] >>> ***/ typedef ENUMERATED_t Enum0_t; /*** <<< FUNC-DECLS [Enum0] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Enum0; asn_struct_free_f Enum0_free; asn_struct_print_f Enum0_print; asn_constr_check_f Enum0_constraint; ber_type_decoder_f Enum0_decode_ber; der_type_encoder_f Enum0_encode_der; xer_type_decoder_f Enum0_decode_xer; xer_type_encoder_f Enum0_encode_xer; /*** <<< CODE [Enum0] >>> ***/ int Enum0_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ENUMERATED.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using ENUMERATED, * so here we adjust the DEF accordingly. */ static void Enum0_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_ENUMERATED.free_struct; td->print_struct = asn_DEF_ENUMERATED.print_struct; td->check_constraints = asn_DEF_ENUMERATED.check_constraints; td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; td->der_encoder = asn_DEF_ENUMERATED.der_encoder; td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; td->elements = asn_DEF_ENUMERATED.elements; td->elements_count = asn_DEF_ENUMERATED.elements_count; /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ } void Enum0_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Enum0_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Enum0_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Enum0_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Enum0_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Enum0_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Enum0_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Enum0_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Enum0_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Enum0_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Enum0_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Enum0_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [Enum0] >>> ***/ static const asn_INTEGER_enum_map_t asn_MAP_Enum0_value2enum_1[] = { { 0, 3, "one" }, { 1, 3, "two" } }; static const unsigned int asn_MAP_Enum0_enum2value_1[] = { 0, /* one(0) */ 1 /* two(1) */ }; static const asn_INTEGER_specifics_t asn_SPC_Enum0_specs_1 = { asn_MAP_Enum0_value2enum_1, /* "tag" => N; sorted by tag */ asn_MAP_Enum0_enum2value_1, /* N => "tag"; sorted by N */ 2, /* Number of elements in the maps */ 0, /* Enumeration is not extensible */ 1, /* Strict enumeration */ 0, /* Native long size */ 0 }; static const ber_tlv_tag_t asn_DEF_Enum0_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Enum0 = { "Enum0", "Enum0", Enum0_free, Enum0_print, Enum0_constraint, Enum0_decode_ber, Enum0_encode_der, Enum0_decode_xer, Enum0_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Enum0_tags_1, sizeof(asn_DEF_Enum0_tags_1) /sizeof(asn_DEF_Enum0_tags_1[0]), /* 1 */ asn_DEF_Enum0_tags_1, /* Same as above */ sizeof(asn_DEF_Enum0_tags_1) /sizeof(asn_DEF_Enum0_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* Defined elsewhere */ &asn_SPC_Enum0_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Enum1] >>> ***/ #include /*** <<< DEPS [Enum1] >>> ***/ typedef enum Enum1 { Enum1_one = 0, Enum1_two = 1 } e_Enum1; /*** <<< TYPE-DECLS [Enum1] >>> ***/ typedef long Enum1_t; /*** <<< FUNC-DECLS [Enum1] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Enum1; asn_struct_free_f Enum1_free; asn_struct_print_f Enum1_print; asn_constr_check_f Enum1_constraint; ber_type_decoder_f Enum1_decode_ber; der_type_encoder_f Enum1_encode_der; xer_type_decoder_f Enum1_decode_xer; xer_type_encoder_f Enum1_encode_xer; /*** <<< CODE [Enum1] >>> ***/ int Enum1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if((value == 0)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using NativeEnumerated, * so here we adjust the DEF accordingly. */ static void Enum1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_NativeEnumerated.free_struct; td->print_struct = asn_DEF_NativeEnumerated.print_struct; td->check_constraints = asn_DEF_NativeEnumerated.check_constraints; td->ber_decoder = asn_DEF_NativeEnumerated.ber_decoder; td->der_encoder = asn_DEF_NativeEnumerated.der_encoder; td->xer_decoder = asn_DEF_NativeEnumerated.xer_decoder; td->xer_encoder = asn_DEF_NativeEnumerated.xer_encoder; td->uper_decoder = asn_DEF_NativeEnumerated.uper_decoder; td->uper_encoder = asn_DEF_NativeEnumerated.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeEnumerated.per_constraints; td->elements = asn_DEF_NativeEnumerated.elements; td->elements_count = asn_DEF_NativeEnumerated.elements_count; /* td->specifics = asn_DEF_NativeEnumerated.specifics; // Defined explicitly */ } void Enum1_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Enum1_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Enum1_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Enum1_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Enum1_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Enum1_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Enum1_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Enum1_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Enum1_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Enum1_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Enum1_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Enum1_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [Enum1] >>> ***/ static const asn_INTEGER_enum_map_t asn_MAP_Enum1_value2enum_1[] = { { 0, 3, "one" }, { 1, 3, "two" } }; static const unsigned int asn_MAP_Enum1_enum2value_1[] = { 0, /* one(0) */ 1 /* two(1) */ }; static const asn_INTEGER_specifics_t asn_SPC_Enum1_specs_1 = { asn_MAP_Enum1_value2enum_1, /* "tag" => N; sorted by tag */ asn_MAP_Enum1_enum2value_1, /* N => "tag"; sorted by N */ 2, /* Number of elements in the maps */ 0, /* Enumeration is not extensible */ 1, /* Strict enumeration */ 0, /* Native long size */ 0 }; static const ber_tlv_tag_t asn_DEF_Enum1_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Enum1 = { "Enum1", "Enum1", Enum1_free, Enum1_print, Enum1_constraint, Enum1_decode_ber, Enum1_encode_der, Enum1_decode_xer, Enum1_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Enum1_tags_1, sizeof(asn_DEF_Enum1_tags_1) /sizeof(asn_DEF_Enum1_tags_1[0]), /* 1 */ asn_DEF_Enum1_tags_1, /* Same as above */ sizeof(asn_DEF_Enum1_tags_1) /sizeof(asn_DEF_Enum1_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* Defined elsewhere */ &asn_SPC_Enum1_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Identifier] >>> ***/ #include /*** <<< TYPE-DECLS [Identifier] >>> ***/ typedef VisibleString_t Identifier_t; /*** <<< FUNC-DECLS [Identifier] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Identifier; asn_struct_free_f Identifier_free; asn_struct_print_f Identifier_print; asn_constr_check_f Identifier_constraint; ber_type_decoder_f Identifier_decode_ber; der_type_encoder_f Identifier_encode_der; xer_type_decoder_f Identifier_decode_xer; xer_type_encoder_f Identifier_encode_xer; /*** <<< CTABLES [Identifier] >>> ***/ static const int permitted_alphabet_table_1[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* $ */ 2, 3, 4, 5, 6, 7, 8, 9,10,11, 0, 0, 0, 0, 0, 0, /* 0123456789 */ 0,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26, /* ABCDEFGHIJKLMNO */ 27,28,29,30,31,32,33,34,35,36,37, 0, 0, 0, 0,38, /* PQRSTUVWXYZ _ */ 0,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53, /* abcdefghijklmno */ 54,55,56,57,58,59,60,61,62,63,64, 0, 0, 0, 0, 0, /* pqrstuvwxyz */ }; static int check_permitted_alphabet_1(const void *sptr) { const int *table = permitted_alphabet_table_1; /* The underlying type is VisibleString */ const VisibleString_t *st = (const VisibleString_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(!table[cv]) return -1; } return 0; } /*** <<< CODE [Identifier] >>> ***/ int Identifier_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const VisibleString_t *st = (const VisibleString_t *)sptr; size_t size; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } size = st->size; if((size >= 1 && size <= 32) && !check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /* * This type is implemented using VisibleString, * so here we adjust the DEF accordingly. */ static void Identifier_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_VisibleString.free_struct; td->print_struct = asn_DEF_VisibleString.print_struct; td->check_constraints = asn_DEF_VisibleString.check_constraints; td->ber_decoder = asn_DEF_VisibleString.ber_decoder; td->der_encoder = asn_DEF_VisibleString.der_encoder; td->xer_decoder = asn_DEF_VisibleString.xer_decoder; td->xer_encoder = asn_DEF_VisibleString.xer_encoder; td->uper_decoder = asn_DEF_VisibleString.uper_decoder; td->uper_encoder = asn_DEF_VisibleString.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_VisibleString.per_constraints; td->elements = asn_DEF_VisibleString.elements; td->elements_count = asn_DEF_VisibleString.elements_count; td->specifics = asn_DEF_VisibleString.specifics; } void Identifier_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { Identifier_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int Identifier_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { Identifier_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t Identifier_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { Identifier_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t Identifier_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { Identifier_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t Identifier_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { Identifier_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t Identifier_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { Identifier_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [Identifier] >>> ***/ static const ber_tlv_tag_t asn_DEF_Identifier_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (26 << 2)) }; asn_TYPE_descriptor_t asn_DEF_Identifier = { "Identifier", "Identifier", Identifier_free, Identifier_print, Identifier_constraint, Identifier_decode_ber, Identifier_encode_der, Identifier_decode_xer, Identifier_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Identifier_tags_1, sizeof(asn_DEF_Identifier_tags_1) /sizeof(asn_DEF_Identifier_tags_1[0]), /* 1 */ asn_DEF_Identifier_tags_1, /* Same as above */ sizeof(asn_DEF_Identifier_tags_1) /sizeof(asn_DEF_Identifier_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; asn1c-0.9.28+dfsg/tests/04-enum-SE.asn10000644000000000000000000000060213065714043015655 0ustar rootroot -- SE: Semantic error -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .4 ModuleTestEnum2 { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 4 } DEFINITIONS ::= BEGIN enum1 Enum1 ::= blue Enum1 ::= ENUMERATED { red, green, ..., blue(1) -- collides with green -- } END asn1c-0.9.28+dfsg/tests/46-redefine-OK.asn1.-PR0000644000000000000000000002432013065714043017102 0ustar rootroot /*** <<< INCLUDES [PrimitiveType] >>> ***/ #include /*** <<< TYPE-DECLS [PrimitiveType] >>> ***/ typedef OCTET_STRING_t PrimitiveType_t; /*** <<< FUNC-DECLS [PrimitiveType] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_PrimitiveType; asn_struct_free_f PrimitiveType_free; asn_struct_print_f PrimitiveType_print; asn_constr_check_f PrimitiveType_constraint; ber_type_decoder_f PrimitiveType_decode_ber; der_type_encoder_f PrimitiveType_encode_der; xer_type_decoder_f PrimitiveType_decode_xer; xer_type_encoder_f PrimitiveType_encode_xer; /*** <<< CODE [PrimitiveType] >>> ***/ int PrimitiveType_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_OCTET_STRING.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using OCTET_STRING, * so here we adjust the DEF accordingly. */ static void PrimitiveType_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_OCTET_STRING.free_struct; td->print_struct = asn_DEF_OCTET_STRING.print_struct; td->check_constraints = asn_DEF_OCTET_STRING.check_constraints; td->ber_decoder = asn_DEF_OCTET_STRING.ber_decoder; td->der_encoder = asn_DEF_OCTET_STRING.der_encoder; td->xer_decoder = asn_DEF_OCTET_STRING.xer_decoder; td->xer_encoder = asn_DEF_OCTET_STRING.xer_encoder; td->uper_decoder = asn_DEF_OCTET_STRING.uper_decoder; td->uper_encoder = asn_DEF_OCTET_STRING.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_OCTET_STRING.per_constraints; td->elements = asn_DEF_OCTET_STRING.elements; td->elements_count = asn_DEF_OCTET_STRING.elements_count; td->specifics = asn_DEF_OCTET_STRING.specifics; } void PrimitiveType_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { PrimitiveType_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int PrimitiveType_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { PrimitiveType_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t PrimitiveType_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { PrimitiveType_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t PrimitiveType_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { PrimitiveType_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t PrimitiveType_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { PrimitiveType_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t PrimitiveType_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { PrimitiveType_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [PrimitiveType] >>> ***/ static const ber_tlv_tag_t asn_DEF_PrimitiveType_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) }; asn_TYPE_descriptor_t asn_DEF_PrimitiveType = { "PrimitiveType", "PrimitiveType", PrimitiveType_free, PrimitiveType_print, PrimitiveType_constraint, PrimitiveType_decode_ber, PrimitiveType_encode_der, PrimitiveType_decode_xer, PrimitiveType_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_PrimitiveType_tags_1, sizeof(asn_DEF_PrimitiveType_tags_1) /sizeof(asn_DEF_PrimitiveType_tags_1[0]), /* 1 */ asn_DEF_PrimitiveType_tags_1, /* Same as above */ sizeof(asn_DEF_PrimitiveType_tags_1) /sizeof(asn_DEF_PrimitiveType_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* No members */ 0 /* No specifics */ }; /*** <<< INCLUDES [ConstructedType] >>> ***/ #include "PrimitiveType.h" #include /*** <<< TYPE-DECLS [ConstructedType] >>> ***/ typedef struct ConstructedType { PrimitiveType_t field; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } ConstructedType_t; /*** <<< FUNC-DECLS [ConstructedType] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_ConstructedType; /*** <<< STAT-DEFS [ConstructedType] >>> ***/ static asn_TYPE_member_t asn_MBR_ConstructedType_1[] = { { ATF_NOFLAGS, 0, offsetof(struct ConstructedType, field), .tag = (ASN_TAG_CLASS_CONTEXT | (5 << 2)), .tag_mode = -1, /* IMPLICIT tag at current level */ .type = &asn_DEF_PrimitiveType, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "field" }, }; static const ber_tlv_tag_t asn_DEF_ConstructedType_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_ConstructedType_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 0, 0, 0 } /* field */ }; static asn_SEQUENCE_specifics_t asn_SPC_ConstructedType_specs_1 = { sizeof(struct ConstructedType), offsetof(struct ConstructedType, _asn_ctx), asn_MAP_ConstructedType_tag2el_1, 1, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_ConstructedType = { "ConstructedType", "ConstructedType", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_ConstructedType_tags_1, sizeof(asn_DEF_ConstructedType_tags_1) /sizeof(asn_DEF_ConstructedType_tags_1[0]), /* 1 */ asn_DEF_ConstructedType_tags_1, /* Same as above */ sizeof(asn_DEF_ConstructedType_tags_1) /sizeof(asn_DEF_ConstructedType_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_ConstructedType_1, 1, /* Elements count */ &asn_SPC_ConstructedType_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [T] >>> ***/ #include "ConstructedType.h" /*** <<< TYPE-DECLS [T] >>> ***/ typedef ConstructedType_t T_t; /*** <<< FUNC-DECLS [T] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_T; asn_struct_free_f T_free; asn_struct_print_f T_print; asn_constr_check_f T_constraint; ber_type_decoder_f T_decode_ber; der_type_encoder_f T_encode_der; xer_type_decoder_f T_decode_xer; xer_type_encoder_f T_encode_xer; /*** <<< CODE [T] >>> ***/ int T_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ConstructedType.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using ConstructedType, * so here we adjust the DEF accordingly. */ static void T_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_ConstructedType.free_struct; td->print_struct = asn_DEF_ConstructedType.print_struct; td->check_constraints = asn_DEF_ConstructedType.check_constraints; td->ber_decoder = asn_DEF_ConstructedType.ber_decoder; td->der_encoder = asn_DEF_ConstructedType.der_encoder; td->xer_decoder = asn_DEF_ConstructedType.xer_decoder; td->xer_encoder = asn_DEF_ConstructedType.xer_encoder; td->uper_decoder = asn_DEF_ConstructedType.uper_decoder; td->uper_encoder = asn_DEF_ConstructedType.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_ConstructedType.per_constraints; td->elements = asn_DEF_ConstructedType.elements; td->elements_count = asn_DEF_ConstructedType.elements_count; td->specifics = asn_DEF_ConstructedType.specifics; } void T_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { T_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int T_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { T_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t T_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { T_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t T_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { T_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t T_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { T_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t T_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { T_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [T] >>> ***/ static const ber_tlv_tag_t asn_DEF_T_tags_1[] = { (ASN_TAG_CLASS_CONTEXT | (3 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; asn_TYPE_descriptor_t asn_DEF_T = { "T", "T", T_free, T_print, T_constraint, T_decode_ber, T_encode_der, T_decode_xer, T_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T_tags_1, sizeof(asn_DEF_T_tags_1) /sizeof(asn_DEF_T_tags_1[0]) - 1, /* 1 */ asn_DEF_T_tags_1, /* Same as above */ sizeof(asn_DEF_T_tags_1) /sizeof(asn_DEF_T_tags_1[0]), /* 2 */ 0, /* No PER visible constraints */ 0, 0, /* Defined elsewhere */ 0 /* No specifics */ }; asn1c-0.9.28+dfsg/tests/49-real-life-OK.asn10000644000000000000000000000074613065714043016575 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .49 ModuleSetChoiceExtensibility { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 49 } DEFINITIONS ::= BEGIN /* * 0.8.17 had problem parsing this module */ EXPORTS TypeA ; IMPORTS TypeB FROM ModuleB TypeC FROM ModuleC ; Z ::= INTEGER -- Can't specify only EXPORTS & IMPOTS END asn1c-0.9.28+dfsg/tests/94-set-optionals-OK.asn10000644000000000000000000000126513065714043017533 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .94 ModuleSetOptionals { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 94 } DEFINITIONS AUTOMATIC TAGS ::= BEGIN TestSet ::= SET { m0 [0] IMPLICIT VisibleString, m1 [1] IMPLICIT VisibleString OPTIONAL, m2 [2] IMPLICIT VisibleString, m3 [3] IMPLICIT VisibleString, m4 [4] IMPLICIT VisibleString OPTIONAL, m5 [5] IMPLICIT VisibleString, m6 [6] IMPLICIT VisibleString, m7 [7] IMPLICIT VisibleString, m8 [8] IMPLICIT VisibleString OPTIONAL, m9 [9] IMPLICIT VisibleString, ... } END asn1c-0.9.28+dfsg/tests/105-param-2-OK.asn1.-Pfwide-types0000644000000000000000000003416113065714043020677 0ustar rootroot /*** <<< INCLUDES [SIGNED] >>> ***/ #include #include #include #include /*** <<< DEPS [SIGNED] >>> ***/ /* * Method of determining the components presence */ typedef enum signed_PR { signed_PR_a, /* Member a is present */ } signed_PR; /*** <<< TYPE-DECLS [SIGNED] >>> ***/ typedef struct SIGNED_16P0 { REAL_t Signed; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } SIGNED_16P0_t; typedef struct SIGNED_16P1 { struct Signed { INTEGER_t a; /* Presence bitmask: ASN_SET_ISPRESENT(psigned, signed_PR_x) */ unsigned int _presence_map [((1+(8*sizeof(unsigned int))-1)/(8*sizeof(unsigned int)))]; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Signed; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } SIGNED_16P1_t; /*** <<< FUNC-DECLS [SIGNED] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_SIGNED_16P0; extern asn_TYPE_descriptor_t asn_DEF_SIGNED_16P1; /*** <<< STAT-DEFS [SIGNED] >>> ***/ static asn_TYPE_member_t asn_MBR_SIGNED_16P0_1[] = { { ATF_NOFLAGS, 0, offsetof(struct SIGNED_16P0, Signed), .tag = (ASN_TAG_CLASS_UNIVERSAL | (9 << 2)), .tag_mode = 0, .type = &asn_DEF_REAL, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "signed" }, }; static const ber_tlv_tag_t asn_DEF_SIGNED_16P0_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_SIGNED_16P0_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (9 << 2)), 0, 0, 0 } /* signed */ }; static asn_SEQUENCE_specifics_t asn_SPC_SIGNED_16P0_specs_1 = { sizeof(struct SIGNED_16P0), offsetof(struct SIGNED_16P0, _asn_ctx), asn_MAP_SIGNED_16P0_tag2el_1, 1, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_SIGNED_16P0 = { "SIGNED", "SIGNED", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_SIGNED_16P0_tags_1, sizeof(asn_DEF_SIGNED_16P0_tags_1) /sizeof(asn_DEF_SIGNED_16P0_tags_1[0]), /* 1 */ asn_DEF_SIGNED_16P0_tags_1, /* Same as above */ sizeof(asn_DEF_SIGNED_16P0_tags_1) /sizeof(asn_DEF_SIGNED_16P0_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_SIGNED_16P0_1, 1, /* Elements count */ &asn_SPC_SIGNED_16P0_specs_1 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_signed_4[] = { { ATF_NOFLAGS, 0, offsetof(struct Signed, a), .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), .tag_mode = 0, .type = &asn_DEF_INTEGER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "a" }, }; static const ber_tlv_tag_t asn_DEF_signed_tags_4[] = { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_signed_tag2el_4[] = { { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 } /* a */ }; static const uint8_t asn_MAP_signed_mmap_4[(1 + (8 * sizeof(unsigned int)) - 1) / 8] = { (1 << 7) }; static asn_SET_specifics_t asn_SPC_signed_specs_4 = { sizeof(struct Signed), offsetof(struct Signed, _asn_ctx), offsetof(struct Signed, _presence_map), asn_MAP_signed_tag2el_4, 1, /* Count of tags in the map */ asn_MAP_signed_tag2el_4, /* Same as above */ 1, /* Count of tags in the CXER map */ 0, /* Whether extensible */ (unsigned int *)asn_MAP_signed_mmap_4 /* Mandatory elements map */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_signed_4 = { "signed", "signed", SET_free, SET_print, SET_constraint, SET_decode_ber, SET_encode_der, SET_decode_xer, SET_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_signed_tags_4, sizeof(asn_DEF_signed_tags_4) /sizeof(asn_DEF_signed_tags_4[0]), /* 1 */ asn_DEF_signed_tags_4, /* Same as above */ sizeof(asn_DEF_signed_tags_4) /sizeof(asn_DEF_signed_tags_4[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_signed_4, 1, /* Elements count */ &asn_SPC_signed_specs_4 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_SIGNED_16P1_3[] = { { ATF_NOFLAGS, 0, offsetof(struct SIGNED_16P1, Signed), .tag = (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), .tag_mode = 0, .type = &asn_DEF_signed_4, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "signed" }, }; static const ber_tlv_tag_t asn_DEF_SIGNED_16P1_tags_3[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_SIGNED_16P1_tag2el_3[] = { { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), 0, 0, 0 } /* signed */ }; static asn_SEQUENCE_specifics_t asn_SPC_SIGNED_16P1_specs_3 = { sizeof(struct SIGNED_16P1), offsetof(struct SIGNED_16P1, _asn_ctx), asn_MAP_SIGNED_16P1_tag2el_3, 1, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_SIGNED_16P1 = { "SIGNED", "SIGNED", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_SIGNED_16P1_tags_3, sizeof(asn_DEF_SIGNED_16P1_tags_3) /sizeof(asn_DEF_SIGNED_16P1_tags_3[0]), /* 1 */ asn_DEF_SIGNED_16P1_tags_3, /* Same as above */ sizeof(asn_DEF_SIGNED_16P1_tags_3) /sizeof(asn_DEF_SIGNED_16P1_tags_3[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_SIGNED_16P1_3, 1, /* Elements count */ &asn_SPC_SIGNED_16P1_specs_3 /* Additional specs */ }; /*** <<< INCLUDES [SignedREAL] >>> ***/ #include "SIGNED.h" /*** <<< TYPE-DECLS [SignedREAL] >>> ***/ typedef SIGNED_16P0_t SignedREAL_t; /*** <<< FUNC-DECLS [SignedREAL] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_SignedREAL; asn_struct_free_f SignedREAL_free; asn_struct_print_f SignedREAL_print; asn_constr_check_f SignedREAL_constraint; ber_type_decoder_f SignedREAL_decode_ber; der_type_encoder_f SignedREAL_encode_der; xer_type_decoder_f SignedREAL_decode_xer; xer_type_encoder_f SignedREAL_encode_xer; /*** <<< CODE [SignedREAL] >>> ***/ int SignedREAL_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_SIGNED_16P0.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using SIGNED_16P0, * so here we adjust the DEF accordingly. */ static void SignedREAL_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_SIGNED_16P0.free_struct; td->print_struct = asn_DEF_SIGNED_16P0.print_struct; td->check_constraints = asn_DEF_SIGNED_16P0.check_constraints; td->ber_decoder = asn_DEF_SIGNED_16P0.ber_decoder; td->der_encoder = asn_DEF_SIGNED_16P0.der_encoder; td->xer_decoder = asn_DEF_SIGNED_16P0.xer_decoder; td->xer_encoder = asn_DEF_SIGNED_16P0.xer_encoder; td->uper_decoder = asn_DEF_SIGNED_16P0.uper_decoder; td->uper_encoder = asn_DEF_SIGNED_16P0.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_SIGNED_16P0.per_constraints; td->elements = asn_DEF_SIGNED_16P0.elements; td->elements_count = asn_DEF_SIGNED_16P0.elements_count; td->specifics = asn_DEF_SIGNED_16P0.specifics; } void SignedREAL_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { SignedREAL_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int SignedREAL_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { SignedREAL_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t SignedREAL_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { SignedREAL_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t SignedREAL_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { SignedREAL_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t SignedREAL_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { SignedREAL_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t SignedREAL_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { SignedREAL_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [SignedREAL] >>> ***/ static const ber_tlv_tag_t asn_DEF_SignedREAL_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; asn_TYPE_descriptor_t asn_DEF_SignedREAL = { "SignedREAL", "SignedREAL", SignedREAL_free, SignedREAL_print, SignedREAL_constraint, SignedREAL_decode_ber, SignedREAL_encode_der, SignedREAL_decode_xer, SignedREAL_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_SignedREAL_tags_1, sizeof(asn_DEF_SignedREAL_tags_1) /sizeof(asn_DEF_SignedREAL_tags_1[0]), /* 1 */ asn_DEF_SignedREAL_tags_1, /* Same as above */ sizeof(asn_DEF_SignedREAL_tags_1) /sizeof(asn_DEF_SignedREAL_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* Defined elsewhere */ 0 /* No specifics */ }; /*** <<< INCLUDES [SignedSET] >>> ***/ #include "SIGNED.h" /*** <<< TYPE-DECLS [SignedSET] >>> ***/ typedef SIGNED_16P1_t SignedSET_t; /*** <<< FUNC-DECLS [SignedSET] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_SignedSET; asn_struct_free_f SignedSET_free; asn_struct_print_f SignedSET_print; asn_constr_check_f SignedSET_constraint; ber_type_decoder_f SignedSET_decode_ber; der_type_encoder_f SignedSET_encode_der; xer_type_decoder_f SignedSET_decode_xer; xer_type_encoder_f SignedSET_encode_xer; /*** <<< CODE [SignedSET] >>> ***/ int SignedSET_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_SIGNED_16P1.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using SIGNED_16P1, * so here we adjust the DEF accordingly. */ static void SignedSET_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_SIGNED_16P1.free_struct; td->print_struct = asn_DEF_SIGNED_16P1.print_struct; td->check_constraints = asn_DEF_SIGNED_16P1.check_constraints; td->ber_decoder = asn_DEF_SIGNED_16P1.ber_decoder; td->der_encoder = asn_DEF_SIGNED_16P1.der_encoder; td->xer_decoder = asn_DEF_SIGNED_16P1.xer_decoder; td->xer_encoder = asn_DEF_SIGNED_16P1.xer_encoder; td->uper_decoder = asn_DEF_SIGNED_16P1.uper_decoder; td->uper_encoder = asn_DEF_SIGNED_16P1.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_SIGNED_16P1.per_constraints; td->elements = asn_DEF_SIGNED_16P1.elements; td->elements_count = asn_DEF_SIGNED_16P1.elements_count; td->specifics = asn_DEF_SIGNED_16P1.specifics; } void SignedSET_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { SignedSET_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int SignedSET_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { SignedSET_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t SignedSET_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { SignedSET_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t SignedSET_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { SignedSET_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t SignedSET_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { SignedSET_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t SignedSET_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { SignedSET_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [SignedSET] >>> ***/ static const ber_tlv_tag_t asn_DEF_SignedSET_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; asn_TYPE_descriptor_t asn_DEF_SignedSET = { "SignedSET", "SignedSET", SignedSET_free, SignedSET_print, SignedSET_constraint, SignedSET_decode_ber, SignedSET_encode_der, SignedSET_decode_xer, SignedSET_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_SignedSET_tags_1, sizeof(asn_DEF_SignedSET_tags_1) /sizeof(asn_DEF_SignedSET_tags_1[0]), /* 1 */ asn_DEF_SignedSET_tags_1, /* Same as above */ sizeof(asn_DEF_SignedSET_tags_1) /sizeof(asn_DEF_SignedSET_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* Defined elsewhere */ 0 /* No specifics */ }; asn1c-0.9.28+dfsg/tests/73-circular-OK.asn10000644000000000000000000000123513065714043016530 0ustar rootroot -- OK: Everything is Fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .73 ModuleTestCircularReferences { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 73 } DEFINITIONS ::= BEGIN Type ::= SEQUENCE { data SEQUENCE OF EpytRef } EpytRef ::= Epyt Epyt ::= SEQUENCE { stype SET OF Type, type Type OPTIONAL, ypet Ypet OPTIONAL } Ypet ::= SET { epyt Epyt, plain INTEGER DEFAULT 7, senums SET OF EnumType, patest1 [1] IA5String (FROM("A".."Z")), patest2 [2] IA5String (FROM("a".."z")) } EnumType ::= ENUMERATED { one, two } END asn1c-0.9.28+dfsg/tests/84-param-tags-OK.asn10000644000000000000000000000151513065714043016763 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .84 1 -- .84 2 ModuleTestParameterizationTags1 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 84 1 } DEFINITIONS ::= BEGIN TestType {Parameter} ::= SEQUENCE { common Parameter DEFAULT 0 } TestChoice ::= CHOICE { type1 TestType {INTEGER (1..10)}, type2 [0] IMPLICIT TestType {BOOLEAN} } END ModuleTestParameterizationTagsAuto2 { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 84 2 } DEFINITIONS AUTOMATIC TAGS ::= BEGIN AutoType {Parameter} ::= SEQUENCE { common Parameter (0) } AutoChoice ::= CHOICE { type1 AutoType {INTEGER (0..1)}, type2 AutoType {BOOLEAN} } END asn1c-0.9.28+dfsg/tests/54-constraint-SE.asn10000644000000000000000000000065713065714043017114 0ustar rootroot -- SE: Semantic error -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .54 ModuleInvalidConstraintApplicability1 { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 54 } DEFINITIONS ::= BEGIN StrFine ::= NumericString (FROM(" ".."9")) -- That's fine StrBad ::= NumericString (FROM("0".."9" | "#")) -- That's bad END asn1c-0.9.28+dfsg/tests/74-int-enum-constraints-OK.asn1.-EFprint-constraints0000644000000000000000000000153713065714043025023 0ustar rootrootModuleTestIntegerAndEnumeratedConstraints { iso org(3) dod(6) internet(1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 74 } DEFINITIONS ::= BEGIN Enum ::= ENUMERATED { one(0) -- Practical constraints (one): -- PER-visible constraints (one): , two(1) -- Practical constraints (two): -- PER-visible constraints (two): } (1 | 0) -- Combined constraints: (1 | 0) -- Practical constraints (Enum): (0..1) -- PER-visible constraints (Enum): (0..1) Int ::= INTEGER { v1-0(123) -- Practical constraints (v1-0): -- PER-visible constraints (v1-0): } (123) -- Combined constraints: (123) -- Practical constraints (Int): (123) -- PER-visible constraints (Int): (123) EnumRef ::= Enum (1) -- Combined constraints: (1 | 0)(1) -- Practical constraints (Enum): (1) -- PER-visible constraints (Enum): (1) END asn1c-0.9.28+dfsg/tests/72-same-names-OK.asn1.-Pfwide-types0000644000000000000000000005334513065714043021416 0ustar rootroot /*** <<< INCLUDES [Type] >>> ***/ #include #include "Type1.h" #include "Type2.h" #include #include /*** <<< TYPE-DECLS [Type] >>> ***/ typedef struct Type { A_SET_OF(struct Member { Type1_t t1; Type2_t t2; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } ) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Type_t; /*** <<< FUNC-DECLS [Type] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Type; /*** <<< STAT-DEFS [Type] >>> ***/ static asn_TYPE_member_t asn_MBR_Member_2[] = { { ATF_NOFLAGS, 0, offsetof(struct Member, t1), .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), .tag_mode = 0, .type = &asn_DEF_Type1, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "t1" }, { ATF_NOFLAGS, 0, offsetof(struct Member, t2), .tag = -1 /* Ambiguous tag (CHOICE?) */, .tag_mode = 0, .type = &asn_DEF_Type2, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "t2" }, }; static const ber_tlv_tag_t asn_DEF_Member_tags_2[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_Member_tag2el_2[] = { { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 1 }, /* t1 */ { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 1, -1, 0 }, /* one-name */ { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), 1, 0, 0 } /* two-name */ }; static asn_SEQUENCE_specifics_t asn_SPC_Member_specs_2 = { sizeof(struct Member), offsetof(struct Member, _asn_ctx), asn_MAP_Member_tag2el_2, 3, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_Member_2 = { "SEQUENCE", "SEQUENCE", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Member_tags_2, sizeof(asn_DEF_Member_tags_2) /sizeof(asn_DEF_Member_tags_2[0]), /* 1 */ asn_DEF_Member_tags_2, /* Same as above */ sizeof(asn_DEF_Member_tags_2) /sizeof(asn_DEF_Member_tags_2[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Member_2, 2, /* Elements count */ &asn_SPC_Member_specs_2 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_Type_1[] = { { ATF_POINTER, 0, 0, .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), .tag_mode = 0, .type = &asn_DEF_Member_2, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "" }, }; static const ber_tlv_tag_t asn_DEF_Type_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_Type_specs_1 = { sizeof(struct Type), offsetof(struct Type, _asn_ctx), 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_Type = { "Type", "Type", SET_OF_free, SET_OF_print, SET_OF_constraint, SET_OF_decode_ber, SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Type_tags_1, sizeof(asn_DEF_Type_tags_1) /sizeof(asn_DEF_Type_tags_1[0]), /* 1 */ asn_DEF_Type_tags_1, /* Same as above */ sizeof(asn_DEF_Type_tags_1) /sizeof(asn_DEF_Type_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Type_1, 1, /* Single element */ &asn_SPC_Type_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Type1] >>> ***/ #include #include #include /*** <<< DEPS [Type1] >>> ***/ typedef enum one_name_PR { one_name_PR_NOTHING, /* No components present */ one_name_PR_another_name } one_name_PR; /*** <<< TYPE-DECLS [Type1] >>> ***/ typedef struct Type1 { struct one_name { one_name_PR present; union Type1__one_name_u { struct another_name { INTEGER_t a; INTEGER_t b; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } another_name; } choice; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } one_name; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Type1_t; /*** <<< FUNC-DECLS [Type1] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Type1; /*** <<< STAT-DEFS [Type1] >>> ***/ static asn_TYPE_member_t asn_MBR_another_name_3[] = { { ATF_NOFLAGS, 0, offsetof(struct another_name, a), .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), .tag_mode = 0, .type = &asn_DEF_INTEGER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "a" }, { ATF_NOFLAGS, 0, offsetof(struct another_name, b), .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), .tag_mode = 0, .type = &asn_DEF_INTEGER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "b" }, }; static const ber_tlv_tag_t asn_DEF_another_name_tags_3[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_another_name_tag2el_3[] = { { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 1 }, /* a */ { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, -1, 0 } /* b */ }; static asn_SEQUENCE_specifics_t asn_SPC_another_name_specs_3 = { sizeof(struct another_name), offsetof(struct another_name, _asn_ctx), asn_MAP_another_name_tag2el_3, 2, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_another_name_3 = { "another-name", "another-name", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_another_name_tags_3, sizeof(asn_DEF_another_name_tags_3) /sizeof(asn_DEF_another_name_tags_3[0]), /* 1 */ asn_DEF_another_name_tags_3, /* Same as above */ sizeof(asn_DEF_another_name_tags_3) /sizeof(asn_DEF_another_name_tags_3[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_another_name_3, 2, /* Elements count */ &asn_SPC_another_name_specs_3 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_one_name_2[] = { { ATF_NOFLAGS, 0, offsetof(struct one_name, choice.another_name), .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), .tag_mode = 0, .type = &asn_DEF_another_name_3, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "another-name" }, }; static const asn_TYPE_tag2member_t asn_MAP_one_name_tag2el_2[] = { { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 0 } /* another-name */ }; static asn_CHOICE_specifics_t asn_SPC_one_name_specs_2 = { sizeof(struct one_name), offsetof(struct one_name, _asn_ctx), offsetof(struct one_name, present), sizeof(((struct one_name *)0)->present), asn_MAP_one_name_tag2el_2, 1, /* Count of tags in the map */ .canonical_order = 0, .ext_start = -1 /* Extensions start */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_one_name_2 = { "one-name", "one-name", CHOICE_free, CHOICE_print, CHOICE_constraint, CHOICE_decode_ber, CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ 0, /* No tags (pointer) */ 0, /* No tags (count) */ 0, /* No PER visible constraints */ asn_MBR_one_name_2, 1, /* Elements count */ &asn_SPC_one_name_specs_2 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_Type1_1[] = { { ATF_NOFLAGS, 0, offsetof(struct Type1, one_name), .tag = -1 /* Ambiguous tag (CHOICE?) */, .tag_mode = 0, .type = &asn_DEF_one_name_2, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "one-name" }, }; static const ber_tlv_tag_t asn_DEF_Type1_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_Type1_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 0 } /* another-name */ }; static asn_SEQUENCE_specifics_t asn_SPC_Type1_specs_1 = { sizeof(struct Type1), offsetof(struct Type1, _asn_ctx), asn_MAP_Type1_tag2el_1, 1, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Type1 = { "Type1", "Type1", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Type1_tags_1, sizeof(asn_DEF_Type1_tags_1) /sizeof(asn_DEF_Type1_tags_1[0]), /* 1 */ asn_DEF_Type1_tags_1, /* Same as above */ sizeof(asn_DEF_Type1_tags_1) /sizeof(asn_DEF_Type1_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Type1_1, 1, /* Elements count */ &asn_SPC_Type1_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Type2] >>> ***/ #include #include #include #include #include /*** <<< DEPS [Type2] >>> ***/ typedef enum Type2_PR { Type2_PR_NOTHING, /* No components present */ Type2_PR_one_name, Type2_PR_two_name } Type2_PR; typedef enum a { a_one = 0 } e_a; /* * Method of determining the components presence */ typedef enum two_name_PR { two_name_PR_another_name, /* Member another_name is present */ } two_name_PR; typedef enum a { a_one = 0 } e_a; /*** <<< TYPE-DECLS [Type2] >>> ***/ typedef struct Type2 { Type2_PR present; union Type2_u { struct one_name { struct another_name { BIT_STRING_t a; INTEGER_t b; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } another_name; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } one_name; struct two_name { struct another_name { BIT_STRING_t a; INTEGER_t b; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } another_name; /* Presence bitmask: ASN_SET_ISPRESENT(ptwo_name, two_name_PR_x) */ unsigned int _presence_map [((1+(8*sizeof(unsigned int))-1)/(8*sizeof(unsigned int)))]; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } two_name; } choice; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Type2_t; /*** <<< FUNC-DECLS [Type2] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Type2; /*** <<< CODE [Type2] >>> ***/ static int memb_a_constraint_3(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; size_t size; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(st->size > 0) { /* Size in bits */ size = 8 * st->size - (st->bits_unused & 0x07); } else { size = 0; } if((size == 2)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } static int memb_a_constraint_8(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; size_t size; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(st->size > 0) { /* Size in bits */ size = 8 * st->size - (st->bits_unused & 0x07); } else { size = 0; } if((size == 2)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /*** <<< STAT-DEFS [Type2] >>> ***/ static asn_TYPE_member_t asn_MBR_another_name_3[] = { { ATF_NOFLAGS, 0, offsetof(struct another_name, a), .tag = (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), .tag_mode = 0, .type = &asn_DEF_BIT_STRING, .memb_constraints = memb_a_constraint_3, .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "a" }, { ATF_NOFLAGS, 0, offsetof(struct another_name, b), .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), .tag_mode = 0, .type = &asn_DEF_INTEGER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "b" }, }; static const ber_tlv_tag_t asn_DEF_another_name_tags_3[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_another_name_tag2el_3[] = { { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* b */ { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 0, 0, 0 } /* a */ }; static asn_SEQUENCE_specifics_t asn_SPC_another_name_specs_3 = { sizeof(struct another_name), offsetof(struct another_name, _asn_ctx), asn_MAP_another_name_tag2el_3, 2, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_another_name_3 = { "another-name", "another-name", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_another_name_tags_3, sizeof(asn_DEF_another_name_tags_3) /sizeof(asn_DEF_another_name_tags_3[0]), /* 1 */ asn_DEF_another_name_tags_3, /* Same as above */ sizeof(asn_DEF_another_name_tags_3) /sizeof(asn_DEF_another_name_tags_3[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_another_name_3, 2, /* Elements count */ &asn_SPC_another_name_specs_3 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_one_name_2[] = { { ATF_NOFLAGS, 0, offsetof(struct one_name, another_name), .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), .tag_mode = 0, .type = &asn_DEF_another_name_3, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "another-name" }, }; static const ber_tlv_tag_t asn_DEF_one_name_tags_2[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_one_name_tag2el_2[] = { { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 0 } /* another-name */ }; static asn_SEQUENCE_specifics_t asn_SPC_one_name_specs_2 = { sizeof(struct one_name), offsetof(struct one_name, _asn_ctx), asn_MAP_one_name_tag2el_2, 1, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_one_name_2 = { "one-name", "one-name", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_one_name_tags_2, sizeof(asn_DEF_one_name_tags_2) /sizeof(asn_DEF_one_name_tags_2[0]), /* 1 */ asn_DEF_one_name_tags_2, /* Same as above */ sizeof(asn_DEF_one_name_tags_2) /sizeof(asn_DEF_one_name_tags_2[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_one_name_2, 1, /* Elements count */ &asn_SPC_one_name_specs_2 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_another_name_8[] = { { ATF_NOFLAGS, 0, offsetof(struct another_name, a), .tag = (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), .tag_mode = 0, .type = &asn_DEF_BIT_STRING, .memb_constraints = memb_a_constraint_8, .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "a" }, { ATF_NOFLAGS, 0, offsetof(struct another_name, b), .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), .tag_mode = 0, .type = &asn_DEF_INTEGER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "b" }, }; static const ber_tlv_tag_t asn_DEF_another_name_tags_8[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_another_name_tag2el_8[] = { { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* b */ { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 0, 0, 0 } /* a */ }; static asn_SEQUENCE_specifics_t asn_SPC_another_name_specs_8 = { sizeof(struct another_name), offsetof(struct another_name, _asn_ctx), asn_MAP_another_name_tag2el_8, 2, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_another_name_8 = { "another-name", "another-name", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_another_name_tags_8, sizeof(asn_DEF_another_name_tags_8) /sizeof(asn_DEF_another_name_tags_8[0]), /* 1 */ asn_DEF_another_name_tags_8, /* Same as above */ sizeof(asn_DEF_another_name_tags_8) /sizeof(asn_DEF_another_name_tags_8[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_another_name_8, 2, /* Elements count */ &asn_SPC_another_name_specs_8 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_two_name_7[] = { { ATF_NOFLAGS, 0, offsetof(struct two_name, another_name), .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), .tag_mode = 0, .type = &asn_DEF_another_name_8, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "another-name" }, }; static const ber_tlv_tag_t asn_DEF_two_name_tags_7[] = { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_two_name_tag2el_7[] = { { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 0 } /* another-name */ }; static const uint8_t asn_MAP_two_name_mmap_7[(1 + (8 * sizeof(unsigned int)) - 1) / 8] = { (1 << 7) }; static asn_SET_specifics_t asn_SPC_two_name_specs_7 = { sizeof(struct two_name), offsetof(struct two_name, _asn_ctx), offsetof(struct two_name, _presence_map), asn_MAP_two_name_tag2el_7, 1, /* Count of tags in the map */ asn_MAP_two_name_tag2el_7, /* Same as above */ 1, /* Count of tags in the CXER map */ 0, /* Whether extensible */ (unsigned int *)asn_MAP_two_name_mmap_7 /* Mandatory elements map */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_two_name_7 = { "two-name", "two-name", SET_free, SET_print, SET_constraint, SET_decode_ber, SET_encode_der, SET_decode_xer, SET_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_two_name_tags_7, sizeof(asn_DEF_two_name_tags_7) /sizeof(asn_DEF_two_name_tags_7[0]), /* 1 */ asn_DEF_two_name_tags_7, /* Same as above */ sizeof(asn_DEF_two_name_tags_7) /sizeof(asn_DEF_two_name_tags_7[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_two_name_7, 1, /* Elements count */ &asn_SPC_two_name_specs_7 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_Type2_1[] = { { ATF_NOFLAGS, 0, offsetof(struct Type2, choice.one_name), .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), .tag_mode = 0, .type = &asn_DEF_one_name_2, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "one-name" }, { ATF_NOFLAGS, 0, offsetof(struct Type2, choice.two_name), .tag = (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), .tag_mode = 0, .type = &asn_DEF_two_name_7, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "two-name" }, }; static const asn_TYPE_tag2member_t asn_MAP_Type2_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 0 }, /* one-name */ { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), 1, 0, 0 } /* two-name */ }; static asn_CHOICE_specifics_t asn_SPC_Type2_specs_1 = { sizeof(struct Type2), offsetof(struct Type2, _asn_ctx), offsetof(struct Type2, present), sizeof(((struct Type2 *)0)->present), asn_MAP_Type2_tag2el_1, 2, /* Count of tags in the map */ .canonical_order = 0, .ext_start = -1 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_Type2 = { "Type2", "Type2", CHOICE_free, CHOICE_print, CHOICE_constraint, CHOICE_decode_ber, CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ 0, /* No tags (pointer) */ 0, /* No tags (count) */ 0, /* No PER visible constraints */ asn_MBR_Type2_1, 2, /* Elements count */ &asn_SPC_Type2_specs_1 /* Additional specs */ }; asn1c-0.9.28+dfsg/tests/73-circular-OK.asn1.-Pfwide-types0000644000000000000000000006020513065714043021166 0ustar rootroot /*** <<< INCLUDES [Type] >>> ***/ #include #include #include /*** <<< FWD-DECLS [Type] >>> ***/ struct Epyt; /*** <<< TYPE-DECLS [Type] >>> ***/ typedef struct Type { struct data { A_SEQUENCE_OF(struct Epyt) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } data; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Type_t; /*** <<< FUNC-DECLS [Type] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Type; /*** <<< POST-INCLUDE [Type] >>> ***/ #include "EpytRef.h" /*** <<< STAT-DEFS [Type] >>> ***/ static asn_TYPE_member_t asn_MBR_data_2[] = { { ATF_POINTER, 0, 0, .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), .tag_mode = 0, .type = &asn_DEF_EpytRef, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "" }, }; static const ber_tlv_tag_t asn_DEF_data_tags_2[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_data_specs_2 = { sizeof(struct data), offsetof(struct data, _asn_ctx), 0, /* XER encoding is XMLDelimitedItemList */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_data_2 = { "data", "data", SEQUENCE_OF_free, SEQUENCE_OF_print, SEQUENCE_OF_constraint, SEQUENCE_OF_decode_ber, SEQUENCE_OF_encode_der, SEQUENCE_OF_decode_xer, SEQUENCE_OF_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_data_tags_2, sizeof(asn_DEF_data_tags_2) /sizeof(asn_DEF_data_tags_2[0]), /* 1 */ asn_DEF_data_tags_2, /* Same as above */ sizeof(asn_DEF_data_tags_2) /sizeof(asn_DEF_data_tags_2[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_data_2, 1, /* Single element */ &asn_SPC_data_specs_2 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_Type_1[] = { { ATF_NOFLAGS, 0, offsetof(struct Type, data), .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), .tag_mode = 0, .type = &asn_DEF_data_2, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "data" }, }; static const ber_tlv_tag_t asn_DEF_Type_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_Type_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 0 } /* data */ }; static asn_SEQUENCE_specifics_t asn_SPC_Type_specs_1 = { sizeof(struct Type), offsetof(struct Type, _asn_ctx), asn_MAP_Type_tag2el_1, 1, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Type = { "Type", "Type", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Type_tags_1, sizeof(asn_DEF_Type_tags_1) /sizeof(asn_DEF_Type_tags_1[0]), /* 1 */ asn_DEF_Type_tags_1, /* Same as above */ sizeof(asn_DEF_Type_tags_1) /sizeof(asn_DEF_Type_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Type_1, 1, /* Elements count */ &asn_SPC_Type_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [EpytRef] >>> ***/ #include "Epyt.h" /*** <<< TYPE-DECLS [EpytRef] >>> ***/ typedef Epyt_t EpytRef_t; /*** <<< FUNC-DECLS [EpytRef] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_EpytRef; asn_struct_free_f EpytRef_free; asn_struct_print_f EpytRef_print; asn_constr_check_f EpytRef_constraint; ber_type_decoder_f EpytRef_decode_ber; der_type_encoder_f EpytRef_encode_der; xer_type_decoder_f EpytRef_decode_xer; xer_type_encoder_f EpytRef_encode_xer; /*** <<< CODE [EpytRef] >>> ***/ int EpytRef_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_Epyt.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using Epyt, * so here we adjust the DEF accordingly. */ static void EpytRef_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_Epyt.free_struct; td->print_struct = asn_DEF_Epyt.print_struct; td->check_constraints = asn_DEF_Epyt.check_constraints; td->ber_decoder = asn_DEF_Epyt.ber_decoder; td->der_encoder = asn_DEF_Epyt.der_encoder; td->xer_decoder = asn_DEF_Epyt.xer_decoder; td->xer_encoder = asn_DEF_Epyt.xer_encoder; td->uper_decoder = asn_DEF_Epyt.uper_decoder; td->uper_encoder = asn_DEF_Epyt.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Epyt.per_constraints; td->elements = asn_DEF_Epyt.elements; td->elements_count = asn_DEF_Epyt.elements_count; td->specifics = asn_DEF_Epyt.specifics; } void EpytRef_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { EpytRef_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int EpytRef_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { EpytRef_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t EpytRef_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { EpytRef_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t EpytRef_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { EpytRef_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t EpytRef_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { EpytRef_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t EpytRef_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { EpytRef_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [EpytRef] >>> ***/ static const ber_tlv_tag_t asn_DEF_EpytRef_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; asn_TYPE_descriptor_t asn_DEF_EpytRef = { "EpytRef", "EpytRef", EpytRef_free, EpytRef_print, EpytRef_constraint, EpytRef_decode_ber, EpytRef_encode_der, EpytRef_decode_xer, EpytRef_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_EpytRef_tags_1, sizeof(asn_DEF_EpytRef_tags_1) /sizeof(asn_DEF_EpytRef_tags_1[0]), /* 1 */ asn_DEF_EpytRef_tags_1, /* Same as above */ sizeof(asn_DEF_EpytRef_tags_1) /sizeof(asn_DEF_EpytRef_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* Defined elsewhere */ 0 /* No specifics */ }; /*** <<< INCLUDES [Epyt] >>> ***/ #include #include #include /*** <<< FWD-DECLS [Epyt] >>> ***/ struct Type; struct Ypet; /*** <<< TYPE-DECLS [Epyt] >>> ***/ typedef struct Epyt { struct stype { A_SET_OF(struct Type) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } stype; struct Type *type /* OPTIONAL */; struct Ypet *ypet /* OPTIONAL */; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Epyt_t; /*** <<< FUNC-DECLS [Epyt] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Epyt; /*** <<< POST-INCLUDE [Epyt] >>> ***/ #include "Type.h" #include "Ypet.h" /*** <<< STAT-DEFS [Epyt] >>> ***/ static asn_TYPE_member_t asn_MBR_stype_2[] = { { ATF_POINTER, 0, 0, .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), .tag_mode = 0, .type = &asn_DEF_Type, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "" }, }; static const ber_tlv_tag_t asn_DEF_stype_tags_2[] = { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_stype_specs_2 = { sizeof(struct stype), offsetof(struct stype, _asn_ctx), 0, /* XER encoding is XMLDelimitedItemList */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_stype_2 = { "stype", "stype", SET_OF_free, SET_OF_print, SET_OF_constraint, SET_OF_decode_ber, SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_stype_tags_2, sizeof(asn_DEF_stype_tags_2) /sizeof(asn_DEF_stype_tags_2[0]), /* 1 */ asn_DEF_stype_tags_2, /* Same as above */ sizeof(asn_DEF_stype_tags_2) /sizeof(asn_DEF_stype_tags_2[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_stype_2, 1, /* Single element */ &asn_SPC_stype_specs_2 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_Epyt_1[] = { { ATF_NOFLAGS, 0, offsetof(struct Epyt, stype), .tag = (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), .tag_mode = 0, .type = &asn_DEF_stype_2, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "stype" }, { ATF_POINTER, 2, offsetof(struct Epyt, type), .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), .tag_mode = 0, .type = &asn_DEF_Type, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "type" }, { ATF_POINTER, 1, offsetof(struct Epyt, ypet), .tag = (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), .tag_mode = 0, .type = &asn_DEF_Ypet, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "ypet" }, }; static const ber_tlv_tag_t asn_DEF_Epyt_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_Epyt_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 1, 0, 0 }, /* type */ { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), 0, 0, 1 }, /* stype */ { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), 2, -1, 0 } /* ypet */ }; static asn_SEQUENCE_specifics_t asn_SPC_Epyt_specs_1 = { sizeof(struct Epyt), offsetof(struct Epyt, _asn_ctx), asn_MAP_Epyt_tag2el_1, 3, /* Count of tags in the map */ 0, 0, 0, /* Optional elements (not needed) */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Epyt = { "Epyt", "Epyt", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Epyt_tags_1, sizeof(asn_DEF_Epyt_tags_1) /sizeof(asn_DEF_Epyt_tags_1[0]), /* 1 */ asn_DEF_Epyt_tags_1, /* Same as above */ sizeof(asn_DEF_Epyt_tags_1) /sizeof(asn_DEF_Epyt_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Epyt_1, 3, /* Elements count */ &asn_SPC_Epyt_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [Ypet] >>> ***/ #include #include #include "EnumType.h" #include #include #include /*** <<< DEPS [Ypet] >>> ***/ /* * Method of determining the components presence */ typedef enum Ypet_PR { Ypet_PR_epyt, /* Member epyt is present */ Ypet_PR_plain, /* Member plain is present */ Ypet_PR_senums, /* Member senums is present */ Ypet_PR_patest1, /* Member patest1 is present */ Ypet_PR_patest2, /* Member patest2 is present */ } Ypet_PR; /*** <<< FWD-DECLS [Ypet] >>> ***/ struct Epyt; /*** <<< TYPE-DECLS [Ypet] >>> ***/ typedef struct Ypet { struct Epyt *epyt; INTEGER_t *plain /* DEFAULT 7 */; struct senums { A_SET_OF(EnumType_t) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } senums; IA5String_t patest1; IA5String_t patest2; /* Presence bitmask: ASN_SET_ISPRESENT(pYpet, Ypet_PR_x) */ unsigned int _presence_map [((5+(8*sizeof(unsigned int))-1)/(8*sizeof(unsigned int)))]; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Ypet_t; /*** <<< FUNC-DECLS [Ypet] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Ypet; /*** <<< POST-INCLUDE [Ypet] >>> ***/ #include "Epyt.h" /*** <<< CTABLES [Ypet] >>> ***/ static int check_permitted_alphabet_6(const void *sptr) { /* The underlying type is IA5String */ const IA5String_t *st = (const IA5String_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(!(cv >= 65 && cv <= 90)) return -1; } return 0; } static int check_permitted_alphabet_7(const void *sptr) { /* The underlying type is IA5String */ const IA5String_t *st = (const IA5String_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(!(cv >= 97 && cv <= 122)) return -1; } return 0; } /*** <<< CODE [Ypet] >>> ***/ static int memb_patest1_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const IA5String_t *st = (const IA5String_t *)sptr; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(!check_permitted_alphabet_6(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } static int memb_patest2_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const IA5String_t *st = (const IA5String_t *)sptr; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(!check_permitted_alphabet_7(st)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /*** <<< STAT-DEFS [Ypet] >>> ***/ static int asn_DFL_3_set_7(int set_value, void **sptr) { INTEGER_t *st = *sptr; if(!st) { if(!set_value) return -1; /* Not a default value */ st = (*sptr = CALLOC(1, sizeof(*st))); if(!st) return -1; } if(set_value) { /* Install default value 7 */ return asn_long2INTEGER(st, 7); } else { /* Test default value 7 */ long value; if(asn_INTEGER2long(st, &value)) return -1; return (value == 7); } } static asn_TYPE_member_t asn_MBR_senums_4[] = { { ATF_POINTER, 0, 0, .tag = (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), .tag_mode = 0, .type = &asn_DEF_EnumType, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "" }, }; static const ber_tlv_tag_t asn_DEF_senums_tags_4[] = { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_senums_specs_4 = { sizeof(struct senums), offsetof(struct senums, _asn_ctx), 1, /* XER encoding is XMLValueList */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_senums_4 = { "senums", "senums", SET_OF_free, SET_OF_print, SET_OF_constraint, SET_OF_decode_ber, SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_senums_tags_4, sizeof(asn_DEF_senums_tags_4) /sizeof(asn_DEF_senums_tags_4[0]), /* 1 */ asn_DEF_senums_tags_4, /* Same as above */ sizeof(asn_DEF_senums_tags_4) /sizeof(asn_DEF_senums_tags_4[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_senums_4, 1, /* Single element */ &asn_SPC_senums_specs_4 /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_Ypet_1[] = { { ATF_POINTER, 0, offsetof(struct Ypet, epyt), .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), .tag_mode = 0, .type = &asn_DEF_Epyt, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "epyt" }, { ATF_POINTER, 1, offsetof(struct Ypet, plain), .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), .tag_mode = 0, .type = &asn_DEF_INTEGER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = asn_DFL_3_set_7, /* DEFAULT 7 */ .name = "plain" }, { ATF_NOFLAGS, 0, offsetof(struct Ypet, senums), .tag = (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), .tag_mode = 0, .type = &asn_DEF_senums_4, .memb_constraints = 0, /* Defer constraints checking to the member type */ .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "senums" }, { ATF_NOFLAGS, 0, offsetof(struct Ypet, patest1), .tag = (ASN_TAG_CLASS_CONTEXT | (1 << 2)), .tag_mode = +1, /* EXPLICIT tag at current level */ .type = &asn_DEF_IA5String, .memb_constraints = memb_patest1_constraint_1, .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "patest1" }, { ATF_NOFLAGS, 0, offsetof(struct Ypet, patest2), .tag = (ASN_TAG_CLASS_CONTEXT | (2 << 2)), .tag_mode = +1, /* EXPLICIT tag at current level */ .type = &asn_DEF_IA5String, .memb_constraints = memb_patest2_constraint_1, .per_constraints = 0, /* PER is not compiled, use -gen-PER */ .default_value = 0, .name = "patest2" }, }; static const ber_tlv_tag_t asn_DEF_Ypet_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static const asn_TYPE_tag2member_t asn_MAP_Ypet_tag2el_1[] = { { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* plain */ { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 0 }, /* epyt */ { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), 2, 0, 0 }, /* senums */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 3, 0, 0 }, /* patest1 */ { (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 4, 0, 0 } /* patest2 */ }; static const uint8_t asn_MAP_Ypet_mmap_1[(5 + (8 * sizeof(unsigned int)) - 1) / 8] = { (1 << 7) | (0 << 6) | (1 << 5) | (1 << 4) | (1 << 3) }; static asn_SET_specifics_t asn_SPC_Ypet_specs_1 = { sizeof(struct Ypet), offsetof(struct Ypet, _asn_ctx), offsetof(struct Ypet, _presence_map), asn_MAP_Ypet_tag2el_1, 5, /* Count of tags in the map */ asn_MAP_Ypet_tag2el_1, /* Same as above */ 5, /* Count of tags in the CXER map */ 0, /* Whether extensible */ (unsigned int *)asn_MAP_Ypet_mmap_1 /* Mandatory elements map */ }; asn_TYPE_descriptor_t asn_DEF_Ypet = { "Ypet", "Ypet", SET_free, SET_print, SET_constraint, SET_decode_ber, SET_encode_der, SET_decode_xer, SET_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Ypet_tags_1, sizeof(asn_DEF_Ypet_tags_1) /sizeof(asn_DEF_Ypet_tags_1[0]), /* 1 */ asn_DEF_Ypet_tags_1, /* Same as above */ sizeof(asn_DEF_Ypet_tags_1) /sizeof(asn_DEF_Ypet_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ asn_MBR_Ypet_1, 5, /* Elements count */ &asn_SPC_Ypet_specs_1 /* Additional specs */ }; /*** <<< INCLUDES [EnumType] >>> ***/ #include /*** <<< DEPS [EnumType] >>> ***/ typedef enum EnumType { EnumType_one = 0, EnumType_two = 1 } e_EnumType; /*** <<< TYPE-DECLS [EnumType] >>> ***/ typedef ENUMERATED_t EnumType_t; /*** <<< FUNC-DECLS [EnumType] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_EnumType; asn_struct_free_f EnumType_free; asn_struct_print_f EnumType_print; asn_constr_check_f EnumType_constraint; ber_type_decoder_f EnumType_decode_ber; der_type_encoder_f EnumType_encode_der; xer_type_decoder_f EnumType_decode_xer; xer_type_encoder_f EnumType_encode_xer; /*** <<< CODE [EnumType] >>> ***/ int EnumType_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { /* Replace with underlying type checker */ td->check_constraints = asn_DEF_ENUMERATED.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); } /* * This type is implemented using ENUMERATED, * so here we adjust the DEF accordingly. */ static void EnumType_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->free_struct = asn_DEF_ENUMERATED.free_struct; td->print_struct = asn_DEF_ENUMERATED.print_struct; td->check_constraints = asn_DEF_ENUMERATED.check_constraints; td->ber_decoder = asn_DEF_ENUMERATED.ber_decoder; td->der_encoder = asn_DEF_ENUMERATED.der_encoder; td->xer_decoder = asn_DEF_ENUMERATED.xer_decoder; td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; td->elements = asn_DEF_ENUMERATED.elements; td->elements_count = asn_DEF_ENUMERATED.elements_count; /* td->specifics = asn_DEF_ENUMERATED.specifics; // Defined explicitly */ } void EnumType_free(asn_TYPE_descriptor_t *td, void *struct_ptr, int contents_only) { EnumType_1_inherit_TYPE_descriptor(td); td->free_struct(td, struct_ptr, contents_only); } int EnumType_print(asn_TYPE_descriptor_t *td, const void *struct_ptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { EnumType_1_inherit_TYPE_descriptor(td); return td->print_struct(td, struct_ptr, ilevel, cb, app_key); } asn_dec_rval_t EnumType_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const void *bufptr, size_t size, int tag_mode) { EnumType_1_inherit_TYPE_descriptor(td); return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode); } asn_enc_rval_t EnumType_encode_der(asn_TYPE_descriptor_t *td, void *structure, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { EnumType_1_inherit_TYPE_descriptor(td); return td->der_encoder(td, structure, tag_mode, tag, cb, app_key); } asn_dec_rval_t EnumType_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **structure, const char *opt_mname, const void *bufptr, size_t size) { EnumType_1_inherit_TYPE_descriptor(td); return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size); } asn_enc_rval_t EnumType_encode_xer(asn_TYPE_descriptor_t *td, void *structure, int ilevel, enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb, void *app_key) { EnumType_1_inherit_TYPE_descriptor(td); return td->xer_encoder(td, structure, ilevel, flags, cb, app_key); } /*** <<< STAT-DEFS [EnumType] >>> ***/ static const asn_INTEGER_enum_map_t asn_MAP_EnumType_value2enum_1[] = { { 0, 3, "one" }, { 1, 3, "two" } }; static const unsigned int asn_MAP_EnumType_enum2value_1[] = { 0, /* one(0) */ 1 /* two(1) */ }; static const asn_INTEGER_specifics_t asn_SPC_EnumType_specs_1 = { asn_MAP_EnumType_value2enum_1, /* "tag" => N; sorted by tag */ asn_MAP_EnumType_enum2value_1, /* N => "tag"; sorted by N */ 2, /* Number of elements in the maps */ 0, /* Enumeration is not extensible */ 1, /* Strict enumeration */ 0, /* Native long size */ 0 }; static const ber_tlv_tag_t asn_DEF_EnumType_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) }; asn_TYPE_descriptor_t asn_DEF_EnumType = { "EnumType", "EnumType", EnumType_free, EnumType_print, EnumType_constraint, EnumType_decode_ber, EnumType_encode_der, EnumType_decode_xer, EnumType_encode_xer, 0, 0, /* No PER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_EnumType_tags_1, sizeof(asn_DEF_EnumType_tags_1) /sizeof(asn_DEF_EnumType_tags_1[0]), /* 1 */ asn_DEF_EnumType_tags_1, /* Same as above */ sizeof(asn_DEF_EnumType_tags_1) /sizeof(asn_DEF_EnumType_tags_1[0]), /* 1 */ 0, /* No PER visible constraints */ 0, 0, /* Defined elsewhere */ &asn_SPC_EnumType_specs_1 /* Additional specs */ }; asn1c-0.9.28+dfsg/tests/128-enum-SE.asn10000644000000000000000000000050713065714043015750 0ustar rootroot -- SE: Semantic error -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .128 ModuleTestEnum1 { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 128 } DEFINITIONS ::= BEGIN A ::= ENUMERATED {a, b, ..., c, d(2)} END asn1c-0.9.28+dfsg/tests/125-bitstring-constraint-OK.asn1.-X0000644000000000000000000000044013065714043021451 0ustar rootroot asn1c-0.9.28+dfsg/tests/99-class-sample-OK.asn10000644000000000000000000000220713065714043017320 0ustar rootroot -- OK: Everything is fine -- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1) -- .spelio.software.asn1c.test (9363.1.5.1) -- .99 ModuleClassSample { iso org(3) dod(6) internet (1) private(4) enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 99 } DEFINITIONS ::= BEGIN SAMPLE-CLASS ::= CLASS { &id RELATIVE-OID UNIQUE, &code ENUMERATED { request, response, status } DEFAULT request, &Type OPTIONAL } WITH SYNTAX { [TYPE &Type] [WITH CODE &code] IDENTIFIED BY &id } SampleClassObjectSet SAMPLE-CLASS ::= { request-Whatever | respond-Stuff | request-Status | request-Salt } request-Whatever SAMPLE-CLASS ::= { IDENTIFIED BY request-whatever } respond-Stuff SAMPLE-CLASS ::= { WITH CODE 1 IDENTIFIED BY response-stuff } request-Status SAMPLE-CLASS ::= { TYPE SampleType WITH CODE 2 IDENTIFIED BY request-id } request-Salt SAMPLE-CLASS ::= { TYPE Salt IDENTIFIED BY request-salt } request-id RELATIVE-OID ::= { 1 1 1 } request-salt RELATIVE-OID ::= { 1 1 1 } request-whatever RELATIVE-OID ::= { 1 1 5 } response-stuff RELATIVE-OID ::= { 2 0 1 } SampleType ::= SEQUENCE { ... } Salt ::= SET { ... } END asn1c-0.9.28+dfsg/libasn1compiler/0000755000000000000000000000000013065714043015323 5ustar rootrootasn1c-0.9.28+dfsg/libasn1compiler/asn1c_internal.h0000644000000000000000000000264613065714043020405 0ustar rootroot#ifndef ASN1_COMPILER_INTERNAL_H #define ASN1_COMPILER_INTERNAL_H #ifdef HAVE_CONFIG_H #include #endif #include #include #include /* for strlen(3) and memset(3) */ #include /* for isalnum(3) */ #include /* for fstat(2) */ #include #include #include #ifdef HAVE_SYS_STAT_H #include /* for fstat(2) */ #endif #ifdef HAVE_UNISTD_H #include /* for unlink(2) */ #endif #ifdef _WIN32 #include #include #include #define open _open #define close _close #define snprintf _snprintf #define vsnprintf _vsnprintf #else #include /* for glob(3) */ #endif #include /* for open(2) */ #ifdef HAVE_SYS_PARAM_H #include /* For MAXPATHLEN */ #endif #include "asn1compiler.h" typedef struct arg_s { enum asn1c_flags flags; void (*logger_cb)(int _severity, const char *fmt, ...); int (*default_cb)(struct arg_s *); struct compiler_streams *target; asn1p_t *asn; asn1p_expr_t *expr; int embed; } arg_t; /* * Logging. */ #define LOG(ll, fmt, args...) do { \ arg->logger_cb(ll, fmt, ##args); \ } while(0) #define DEBUG(fmt, args...) do { \ if(arg->flags & A1C_DEBUG) \ LOG(-1, fmt, ##args); \ } while(0) #define WARNING(fmt, args...) LOG(0, fmt, ##args); #define FATAL(fmt, args...) LOG(1, fmt, ##args); #endif /* ASN1_COMPILER_INTERNAL_H */ asn1c-0.9.28+dfsg/libasn1compiler/Makefile.am0000644000000000000000000000074213065714043017362 0ustar rootroot AM_CFLAGS = @ADD_CFLAGS@ AM_CPPFLAGS = \ -I$(top_srcdir)/libasn1parser \ -I$(top_srcdir)/libasn1fix noinst_LTLIBRARIES = libasn1compiler.la libasn1compiler_la_SOURCES = \ asn1compiler.c asn1compiler.h \ asn1c_misc.c asn1c_misc.h \ asn1c_out.c asn1c_out.h \ asn1c_lang.c asn1c_lang.h \ asn1c_save.c asn1c_save.h \ asn1c_C.c asn1c_C.h \ asn1c_constraint.c asn1c_constraint.h \ asn1c_compat.c asn1c_compat.h \ asn1c_fdeps.c asn1c_fdeps.h \ asn1c_internal.h asn1c-0.9.28+dfsg/libasn1compiler/asn1c_save.c0000644000000000000000000003722613065714043017524 0ustar rootroot#include "asn1c_internal.h" #include "asn1c_compat.h" #include "asn1c_fdeps.h" #include "asn1c_lang.h" #include "asn1c_misc.h" #include "asn1c_save.h" #include "asn1c_out.h" #ifndef HAVE_SYMLINK #define symlink(a,b) (errno=ENOSYS, -1) #endif /* Pedantically check fprintf's return value. */ static int safe_fprintf(FILE *fp, const char *fmt, ...) { va_list ap; va_start(ap, fmt); int ret = vfprintf(fp, fmt, ap); va_end(ap); assert(ret >= 0); return ret; } /* Pedantically check fwrite's return value. */ static size_t safe_fwrite(const void *ptr, size_t size, size_t nitems, FILE *stream) { size_t ret = fwrite(ptr, 1, size * nitems, stream); assert(ret == size * nitems); return ret; } #define HINCLUDE(s) \ ((arg->flags & A1C_INCLUDES_QUOTED) \ ? safe_fprintf(fp_h, "#include \"%s\"\n", s) \ : safe_fprintf(fp_h, "#include <%s>\n", s)) \ static int asn1c_dump_streams(arg_t *arg, asn1c_fdeps_t *, int, char **); static int asn1c_print_streams(arg_t *arg); static int asn1c_save_streams(arg_t *arg, asn1c_fdeps_t *, int, char **); static int asn1c_copy_over(arg_t *arg, char *path); static int identical_files(const char *fname1, const char *fname2); static int need_to_generate_pdu_collection(arg_t *arg); static int generate_pdu_collection_file(arg_t *arg); static int generate_preamble(arg_t *, FILE *, int optc, char **argv); static int include_type_to_pdu_collection(arg_t *arg); static void pdu_collection_print_unused_types(arg_t *arg); static const char *generate_pdu_C_definition(void); int asn1c_save_compiled_output(arg_t *arg, const char *datadir, int argc, int optc, char **argv) { asn1c_fdeps_t *deps = 0; asn1c_fdeps_t *dlist; asn1p_module_t *mod; FILE *mkf; /* Makefile.am.sample */ int i; deps = asn1c_read_file_dependencies(arg, datadir); if(!deps && datadir) { WARNING("Cannot read file-dependencies information " "from %s\n", datadir); } TQ_FOR(mod, &(arg->asn->modules), mod_next) { TQ_FOR(arg->expr, &(mod->members), next) { if(asn1_lang_map[arg->expr->meta_type] [arg->expr->expr_type].type_cb) { if(asn1c_dump_streams(arg, deps, optc, argv)) return -1; } } } /* * Dump out the Makefile template and the rest of the support code. */ if((arg->flags & A1C_PRINT_COMPILED) || (arg->flags & A1C_OMIT_SUPPORT_CODE)) { return 0; /* Finished */ } mkf = asn1c_open_file("Makefile.am", ".sample", 0); if(mkf == NULL) { perror("Makefile.am.sample"); return -1; } safe_fprintf(mkf, "ASN_MODULE_SOURCES="); TQ_FOR(mod, &(arg->asn->modules), mod_next) { TQ_FOR(arg->expr, &(mod->members), next) { if(asn1_lang_map[arg->expr->meta_type] [arg->expr->expr_type].type_cb) { safe_fprintf(mkf, "\t\\\n\t%s.c", arg->expr->Identifier); } } } safe_fprintf(mkf, "\n\nASN_MODULE_HEADERS="); TQ_FOR(mod, &(arg->asn->modules), mod_next) { TQ_FOR(arg->expr, &(mod->members), next) { if(asn1_lang_map[arg->expr->meta_type] [arg->expr->expr_type].type_cb) { safe_fprintf(mkf, "\t\\\n\t%s.h", arg->expr->Identifier); } } } safe_fprintf(mkf, "\n\n"); /* * Move necessary skeleton files and add them to Makefile.am.sample. */ dlist = asn1c_deps_makelist(deps); if(dlist) { char buf[8129]; char *dir_end; size_t dlen = strlen(datadir); assert(dlen < (sizeof(buf) / 2 - 2)); memcpy(buf, datadir, dlen); dir_end = buf + dlen; *dir_end++ = '/'; for(i = 0; i < dlist->el_count; i++) { char *what_class; /* MODULE or CONVERTER */ char *what_kind; /* HEADERS or SOURCES */ char *fname = dlist->elements[i]->filename; char *dotH; assert(strlen(fname) < (sizeof(buf) / 2)); strcpy(dir_end, fname); if(asn1c_copy_over(arg, buf) == -1) { safe_fprintf(mkf, ">>>ABORTED<<<"); fclose(mkf); return -1; } /* MODULE data versus CONVERTER data */ switch(dlist->elements[i]->usage) { case FDEP_CONVERTER: what_class = "CONVERTER"; break; default: what_class= "MODULE"; break; } /* HEADERS versus SOURCES */ dotH = strrchr(fname, 'h'); if(dotH && fnameflags & A1C_PDU_TYPE) ? generate_pdu_C_definition() : "" , need_to_generate_pdu_collection(arg) ? " -DASN_PDU_COLLECTION" : "" ); for(i = 0; i < argc; i++) safe_fprintf(mkf, "%s%s", i ? " " : "", argv[i]); safe_fprintf(mkf, "\n\n"); fclose(mkf); safe_fprintf(stderr, "Generated Makefile.am.sample\n"); return 0; } /* * Dump the streams. */ static int asn1c_dump_streams(arg_t *arg, asn1c_fdeps_t *deps, int optc, char **argv) { if(arg->flags & A1C_PRINT_COMPILED) { return asn1c_print_streams(arg); } else { return asn1c_save_streams(arg, deps, optc, argv); } } static int asn1c_print_streams(arg_t *arg) { compiler_streams_t *cs = arg->expr->data; asn1p_expr_t *expr = arg->expr; int i; for(i = 1; i < OT_MAX; i++) { out_chunk_t *ot; if(TQ_FIRST(&cs->destination[i].chunks) == NULL) continue; printf("\n/*** <<< %s [%s] >>> ***/\n\n", _compiler_stream2str[i], expr->Identifier); TQ_FOR(ot, &(cs->destination[i].chunks), next) { safe_fwrite(ot->buf, ot->len, 1, stdout); } } return 0; } static int asn1c_save_streams(arg_t *arg, asn1c_fdeps_t *deps, int optc, char **argv) { asn1p_expr_t *expr = arg->expr; compiler_streams_t *cs = expr->data; out_chunk_t *ot; FILE *fp_c, *fp_h; char *tmpname_c, *tmpname_h; char *name_buf; char *header_id; const char *c_retained = ""; const char *h_retained = ""; if(cs == NULL) { safe_fprintf(stderr, "Cannot compile %s at line %d\n", expr->Identifier, expr->_lineno); return -1; } fp_c = asn1c_open_file(expr->Identifier, ".c", &tmpname_c); fp_h = asn1c_open_file(expr->Identifier, ".h", &tmpname_h); if(fp_c == NULL || fp_h == NULL) { if(fp_c) { unlink(tmpname_c); free(tmpname_c); fclose(fp_c); } if(fp_h) { unlink(tmpname_h); free(tmpname_h); fclose(fp_h); } return -1; } generate_preamble(arg, fp_c, optc, argv); generate_preamble(arg, fp_h, optc, argv); header_id = asn1c_make_identifier(0, expr, NULL); safe_fprintf(fp_h, "#ifndef\t_%s_H_\n" "#define\t_%s_H_\n" "\n", header_id, header_id); safe_fprintf(fp_h, "\n"); HINCLUDE("asn_application.h"); #define SAVE_STREAM(fp, idx, msg, actdep) do { \ if(TQ_FIRST(&(cs->destination[idx].chunks)) && *msg) \ safe_fprintf(fp, "\n/* %s */\n", msg); \ TQ_FOR(ot, &(cs->destination[idx].chunks), next) { \ if(actdep) asn1c_activate_dependency(deps, 0, ot->buf); \ safe_fwrite(ot->buf, ot->len, 1, fp); \ } \ } while(0) SAVE_STREAM(fp_h, OT_INCLUDES, "Including external dependencies", 1); safe_fprintf(fp_h, "\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n"); SAVE_STREAM(fp_h, OT_DEPS, "Dependencies", 0); SAVE_STREAM(fp_h, OT_FWD_DECLS, "Forward declarations", 0); SAVE_STREAM(fp_h, OT_TYPE_DECLS, expr->Identifier, 0); SAVE_STREAM(fp_h, OT_FUNC_DECLS,"Implementation", 0); safe_fprintf(fp_h, "\n#ifdef __cplusplus\n}\n#endif\n"); if(!(arg->flags & A1C_NO_INCLUDE_DEPS)) SAVE_STREAM(fp_h, OT_POST_INCLUDE, "Referred external types", 1); safe_fprintf(fp_h, "\n#endif\t/* _%s_H_ */\n", header_id); HINCLUDE("asn_internal.h"); safe_fprintf(fp_c, "#include \"%s.h\"\n\n", expr->Identifier); if(arg->flags & A1C_NO_INCLUDE_DEPS) SAVE_STREAM(fp_c, OT_POST_INCLUDE, "", 1); TQ_FOR(ot, &(cs->destination[OT_CTABLES].chunks), next) safe_fwrite(ot->buf, ot->len, 1, fp_c); TQ_FOR(ot, &(cs->destination[OT_CODE].chunks), next) safe_fwrite(ot->buf, ot->len, 1, fp_c); TQ_FOR(ot, &(cs->destination[OT_CTDEFS].chunks), next) safe_fwrite(ot->buf, ot->len, 1, fp_c); TQ_FOR(ot, &(cs->destination[OT_STAT_DEFS].chunks), next) safe_fwrite(ot->buf, ot->len, 1, fp_c); assert(OT_MAX == 11); /* Protection from reckless changes */ fclose(fp_c); fclose(fp_h); name_buf = alloca(strlen(expr->Identifier) + 3); sprintf(name_buf, "%s.c", expr->Identifier); if(identical_files(name_buf, tmpname_c)) { c_retained = " (contents unchanged)"; unlink(tmpname_c); } else { if(rename(tmpname_c, name_buf)) { unlink(tmpname_c); perror(tmpname_c); free(tmpname_c); free(tmpname_h); return -1; } } sprintf(name_buf, "%s.h", expr->Identifier); if(identical_files(name_buf, tmpname_h)) { h_retained = " (contents unchanged)"; unlink(tmpname_h); } else { if(rename(tmpname_h, name_buf)) { unlink(tmpname_h); perror(tmpname_h); free(tmpname_c); free(tmpname_h); return -1; } } free(tmpname_c); free(tmpname_h); safe_fprintf(stderr, "Compiled %s.c%s\n", expr->Identifier, c_retained); safe_fprintf(stderr, "Compiled %s.h%s\n", expr->Identifier, h_retained); return 0; } static int generate_preamble(arg_t *arg, FILE *fp, int optc, char **argv) { safe_fprintf(fp, "/*\n" " * Generated by asn1c-" VERSION " (http://lionet.info/asn1c)\n" " * From ASN.1 module \"%s\"\n" " * \tfound in \"%s\"\n", arg->expr->module->ModuleName, arg->expr->module->source_file_name); if(optc > 1) { int i; safe_fprintf(fp, " * \t`asn1c "); for(i = 1; i < optc; i++) safe_fprintf(fp, "%s%s", i>1?" ":"", argv[i]); safe_fprintf(fp, "`\n"); } safe_fprintf(fp, " */\n\n"); return 0; } static int identical_files(const char *fname1, const char *fname2) { char buf[2][4096]; FILE *fp1, *fp2; size_t olen, nlen; int retval = 1; /* Files are identical */ #ifndef _WIN32 struct stat sb; if(lstat(fname1, &sb) || !S_ISREG(sb.st_mode) || lstat(fname2, &sb) || !S_ISREG(sb.st_mode)) { return 0; /* Files are not identical */ } #endif fp1 = fopen(fname1, "r"); if(!fp1) { return 0; } fp2 = fopen(fname2, "r"); if(!fp2) { fclose(fp1); return 0; } while((olen = fread(buf[0], 1, sizeof(buf[0]), fp1))) { nlen = fread(buf[1], 1, olen, fp2); if(nlen != olen || memcmp(buf[0], buf[1], nlen)) { retval = 0; break; } } nlen = fread(buf[1], 1, 1, fp2); if(nlen) retval = 0; fclose(fp1); fclose(fp2); return retval; } /* * Copy file for real. */ static int real_copy(const char *src, const char *dst) { unsigned char buf[4096]; char *tmpname; FILE *fpsrc, *fpdst; size_t len; int retval = 0; if(identical_files(src, dst)) return retval; /* Success, no need to copy for real. */ fpsrc = fopen(src, "r"); if(!fpsrc) { errno = EIO; return -1; } fpdst = asn1c_open_file(dst, "", &tmpname); if(!fpdst) { fclose(fpsrc); errno = EIO; return -1; } while(!feof(fpsrc)) { len = fread(buf, 1, sizeof(buf), fpsrc); if(safe_fwrite(buf, 1, len, fpdst) != len) { perror(tmpname); errno = EIO; retval = -1; break; } } fclose(fpsrc); fclose(fpdst); /* Check if copied correctly, and rename into a permanent name */ if(retval) { unlink(tmpname); } else if(rename(tmpname, dst)) { unlink(tmpname); perror(tmpname); retval = -1; } free(tmpname); return retval; } static int asn1c_copy_over(arg_t *arg, char *path) { char *fname; #ifdef _WIN32 int use_real_copy = 1; #else int use_real_copy = !(arg->flags & A1C_LINK_SKELETONS); #endif fname = a1c_basename(path); if(!fname || (use_real_copy ? real_copy(path, fname) : symlink(path, fname)) ) { if(errno == EEXIST) { struct stat sb1, sb2; if(stat(path, &sb1) == 0 && stat(fname, &sb2) == 0 && sb1.st_dev == sb2.st_dev && sb1.st_ino == sb2.st_ino) { /* * Nothing to do. */ safe_fprintf(stderr, "File %s is already here as %s\n", path, fname); return 1; } else { safe_fprintf(stderr, "Retaining local %s (%s suggested)\n", fname, path); return 1; } } else if(errno == ENOENT) { /* Ignore this */ return 0; } else { safe_fprintf(stderr, "%s %s -> %s failed: %s\n", use_real_copy ? "Copy" : "Symlink", path, fname, strerror(errno)); return -1; } } safe_fprintf(stderr, "%s %s\t-> %s\n", use_real_copy ? "Copied" : "Symlinked", path, fname); return 1; } static int generate_pdu_collection_file(arg_t *arg) { asn1p_module_t *mod; FILE *fp; fp = asn1c_open_file("pdu_collection", ".c", 0); if(fp == NULL) { perror("pdu_collection.c"); return -1; } safe_fprintf(fp, "/*\n" " * Generated by asn1c-" VERSION " (http://lionet.info/asn1c)\n" " */\n\n"); safe_fprintf(fp, "struct asn_TYPE_descriptor_s;\t" "/* Forward declaration */\n\n"); TQ_FOR(mod, &(arg->asn->modules), mod_next) { TQ_FOR(arg->expr, &(mod->members), next) { if(!include_type_to_pdu_collection(arg)) continue; safe_fprintf(fp, "extern struct asn_TYPE_descriptor_s " "asn_DEF_%s;\n", asn1c_make_identifier(0, arg->expr, NULL)); } } safe_fprintf(fp, "\n\n"); safe_fprintf(fp, "struct asn_TYPE_descriptor_s *asn_pdu_collection[] = {\n"); TQ_FOR(mod, &(arg->asn->modules), mod_next) { int mod_printed = 0; TQ_FOR(arg->expr, &(mod->members), next) { if(!include_type_to_pdu_collection(arg)) continue; if(!mod_printed++) safe_fprintf(fp, "\t/* From module %s in %s */\n", arg->expr->module->ModuleName, arg->expr->module->source_file_name); safe_fprintf(fp, "\t&asn_DEF_%s,\t\n", asn1c_make_identifier(0, arg->expr, NULL)); } } safe_fprintf(fp, "\t0\n};\n\n"); pdu_collection_print_unused_types(arg); fclose(fp); safe_fprintf(stderr, "Generated pdu_collection.c\n"); return 0; } static struct PDUType { char *typename; int used; } *pduType; static int pduTypes; static const char * generate_pdu_C_definition(void) { const char *src; char *def; char *dst; if(pduTypes == 0) return ""; def = malloc(strlen(pduType[0].typename) + 20); assert(def); strcpy(def, " -DPDU="); for(src = pduType[0].typename, dst = def + 7; *src; src++, dst++) if((*dst = *src) == '-') *dst = '_'; *dst = 0; return def; } void asn1c__add_pdu_type(const char *ctypename) { char *typename = strdup(ctypename); assert(typename && *typename); pduType = realloc(pduType, sizeof(pduType[0]) * (pduTypes + 1)); assert(pduType); pduType[pduTypes].used = 0; pduType[pduTypes].typename = typename; pduTypes++; } static int asn1c__pdu_type_lookup(const char *typename) { int i; for(i = 0; i < pduTypes; i++) { struct PDUType *pt = &pduType[i]; if(strcmp(pt->typename, typename) == 0) { pt->used++; return 1; } } return 0; } static int need_to_generate_pdu_collection(arg_t *arg) { if(arg->flags & (A1C_PDU_ALL|A1C_PDU_AUTO)) return 1; if(arg->flags & A1C_PDU_TYPE) return (pduTypes > 1) ? 1 : 0; return 0; } static void pdu_collection_print_unused_types(arg_t *arg) { int i; for(i = 0; i < pduTypes; i++) { struct PDUType *pt = &pduType[i]; if(!pt->used) { WARNING("Missing type specified in -pdu=%s", pt->typename); } } } static int include_type_to_pdu_collection(arg_t *arg) { if(!asn1_lang_map[arg->expr->meta_type] [arg->expr->expr_type].type_cb) return 0; if((arg->flags & A1C_PDU_ALL) || ((arg->flags & A1C_PDU_AUTO) && !arg->expr->_type_referenced) || asn1c__pdu_type_lookup(arg->expr->Identifier)) { return 1; } return 0; } asn1c-0.9.28+dfsg/libasn1compiler/asn1c_misc.c0000644000000000000000000002403213065714043017510 0ustar rootroot#include "asn1c_internal.h" #include "asn1c_misc.h" #include /* constraint groker from libasn1fix */ #include /* other exportable stuff from libasn1fix */ /* * Checks that the given string is not a reserved C/C++ keyword. * ISO/IEC 9899:1999 (C99), A.1.2 */ static char *res_kwd[] = { "auto", "break", "case", "char", "const", "continue", "default", "do", "double", "else", "enum", "extern", "float", "for", "goto", "if", "inline", "int", "long", "register", "restrict", "return", "short", "signed", "sizeof", "static", "struct", "switch", "typedef", "union", "unsigned", "void", "volatile", "while", "_Bool", "_Complex", "_Imaginary", /* C++ */ "class", "explicit", "bool", "mutable", "template", "typeid", "typename", "and", "and_eq", "or", "or_eq", "xor", "xor_eq", "not", "not_eq", "bitor", "compl", "bitand", "const_cast", "dynamic_cast", "reinterpret_cast", "static_cast", "true", "false", "namespace", "using", "throw", "try", "catch" }; static int reserved_keyword(const char *str) { size_t i; for(i = 0 ; i < sizeof(res_kwd)/sizeof(res_kwd[0]); i++) { if(strcmp(str, res_kwd[i]) == 0) return 1; } return 0; } /* * Construct identifier from multiple parts. * Convert unsafe characters to underscores. */ char * asn1c_make_identifier(enum ami_flags_e flags, asn1p_expr_t *expr, ...) { static char *storage; static int storage_size; int nodelimiter = 0; va_list ap; char *str; char *nextstr; char *first = 0; char *second = 0; ssize_t size; char *p; if(expr) { /* * Estimate the necessary storage size */ if(expr->Identifier == NULL) return "Member"; size = strlen(expr->Identifier); if(expr->spec_index != -1) { static char buf[32]; second = buf; size += 1 + snprintf(buf, sizeof buf, "%dP%d", expr->_lineno, expr->spec_index); } } else { size = -1; } va_start(ap, expr); while((str = va_arg(ap, char *))) size += 1 + strlen(str); va_end(ap); if(size == -1) return NULL; /* * Make sure we have this amount of storage. */ if(storage_size <= size) { free(storage); storage = malloc(size + 1); if(storage) { storage_size = size; } else { storage_size = 0; return NULL; } } /* * Fill-in the storage. */ va_start(ap, expr); p = storage; nextstr = ""; for(p = storage, str = 0; str || nextstr; str = nextstr) { int subst_made = 0; nextstr = second ? second : va_arg(ap, char *); if(str == 0) { if(expr) { str = expr->Identifier; first = str; second = 0; } else { first = nextstr; continue; } } if(str[0] == ' ' && str[1] == '\0') { *p++ = ' '; nodelimiter = 1; /* No delimiter */ continue; } if(str != first && !nodelimiter && !(flags & AMI_NODELIMITER)) *p++ = '_'; /* Delimiter between tokens */ nodelimiter = 0; /* * If it is a single argument, check that it does not clash * with C/C++ language keywords. */ if((flags & AMI_CHECK_RESERVED) && str == first && !nextstr && reserved_keyword(str)) { *p++ = toupper(*str++); /* Fall through */ } for(; *str; str++) { if(isalnum(*str)) { *p++ = *str; subst_made = 0; } else if(!subst_made++) { if((flags & AMI_MASK_ONLY_SPACES) && !isspace(*str)) { *p ++ = *str; } else { *p++ = '_'; } } } } va_end(ap); *p = '\0'; assert((p - storage) <= storage_size); return storage; } char * asn1c_type_name(arg_t *arg, asn1p_expr_t *expr, enum tnfmt _format) { asn1p_expr_t *exprid = 0; asn1p_expr_t *top_parent; asn1p_expr_t *terminal; int stdname = 0; char *typename; /* Rewind to the topmost parent expression */ if((top_parent = expr->parent_expr)) while(top_parent->parent_expr) top_parent = top_parent->parent_expr; if(0) DEBUG("asn1c_type_name(%s: 0x%x)", expr->Identifier, expr->expr_type); switch(expr->expr_type) { case A1TC_REFERENCE: typename = expr->reference->components[ expr->reference->comp_count-1].name; if(typename[0] == '&') { arg_t tmp = *arg; /* * This is a reference to a type defined in a class. * Resolve it and use instead. */ tmp.expr = asn1f_class_access_ex(arg->asn, arg->expr->module, arg->expr, expr->rhs_pspecs, expr->reference); if(!tmp.expr) return NULL; return asn1c_type_name(&tmp, tmp.expr, _format); } terminal = asn1f_find_terminal_type_ex(arg->asn, expr); if(_format == TNF_RSAFE) { if(terminal && terminal->expr_type & ASN_CONSTR_MASK) { typename = terminal->Identifier; } } if(_format == TNF_CTYPE) { /* * If the component references the type itself, * switch to a recursion-safe type naming * ("struct foo" instead of "foo_t"). */ if(terminal && terminal == top_parent) { _format = TNF_RSAFE; } } if(terminal && terminal->spec_index != -1) { exprid = terminal; typename = 0; } break; case ASN_BASIC_INTEGER: case ASN_BASIC_ENUMERATED: case ASN_BASIC_REAL: if((expr->expr_type == ASN_BASIC_REAL && !(arg->flags & A1C_USE_WIDE_TYPES)) || asn1c_type_fits_long(arg, expr)) { switch(_format) { case TNF_CTYPE: case TNF_RSAFE: if(expr->expr_type == ASN_BASIC_REAL) return "double"; else if(asn1c_type_fits_long(arg, expr) == FL_FITS_UNSIGN) return "unsigned long"; else return "long"; default: typename = 0; switch(expr->expr_type) { case ASN_BASIC_INTEGER: typename = "NativeInteger"; break; case ASN_BASIC_ENUMERATED: typename = "NativeEnumerated"; break; case ASN_BASIC_REAL: typename = "NativeReal"; break; default: break; } break; } if(typename) { if(_format != TNF_INCLUDE) return typename; stdname = 1; break; } } /* Fall through */ default: if(expr->expr_type & (ASN_CONSTR_MASK | ASN_BASIC_MASK | ASN_STRING_MASK)) { if(_format == TNF_RSAFE) _format = TNF_CTYPE; stdname = 1; typename = ASN_EXPR_TYPE2STR(expr->expr_type); } else { _format = TNF_RSAFE; typename = expr->Identifier; } } switch(_format) { case TNF_UNMODIFIED: return asn1c_make_identifier(AMI_MASK_ONLY_SPACES, 0, exprid ? exprid->Identifier : typename, 0); case TNF_INCLUDE: return asn1c_make_identifier( AMI_MASK_ONLY_SPACES | AMI_NODELIMITER, 0, ((!stdname || (arg->flags & A1C_INCLUDES_QUOTED)) ? "\"" : "<"), exprid ? exprid->Identifier : typename, ((!stdname || (arg->flags & A1C_INCLUDES_QUOTED)) ? ".h\"" : ".h>"), 0); case TNF_SAFE: return asn1c_make_identifier(0, exprid, typename, 0); case TNF_CTYPE: /* C type */ return asn1c_make_identifier(0, exprid, exprid?"t":typename, exprid?0:"t", 0); case TNF_RSAFE: /* Recursion-safe type */ return asn1c_make_identifier(AMI_CHECK_RESERVED, 0, "struct", " ", typename, 0); } assert(!"unreachable"); return typename; } /* * Check whether the specified INTEGER or ENUMERATED type can be represented * using the generic 'long' or 'unsigned long' type. */ enum asn1c_fitslong_e asn1c_type_fits_long(arg_t *arg, asn1p_expr_t *expr) { asn1cnst_range_t *range = 0; asn1cnst_edge_t left; asn1cnst_edge_t right; asn1p_expr_t *v; /* * Since we don't know the sizeof(long) on the possible target platform * which will be compiling the code generated by asn1c, let's play it * simple: long's range is equal to or greater than int32_t. * NOTE: the most negative integer cannot be written in C, as the C99 * standard will give it an unsigned type. * It is defined here as a constant expression. */ #define RIGHTMAX 2147483647 /* of 32-bit integer type */ #define LEFTMIN (-RIGHTMAX-1) /* of 32-bit integer type */ /* Descend to the terminal type */ expr = asn1f_find_terminal_type_ex(arg->asn, expr); if(expr == 0) return FL_NOTFIT; /* The "fits into long" operation is relevant only for integer types */ switch(expr->expr_type) { case ASN_BASIC_INTEGER: case ASN_BASIC_ENUMERATED: break; default: return FL_NOTFIT; } /* * First, evaluate the range of explicitly given identifiers. */ TQ_FOR(v, &(expr->members), next) { if(v->expr_type != A1TC_UNIVERVAL) continue; if(v->value->value.v_integer < LEFTMIN || v->value->value.v_integer > RIGHTMAX) return FL_NOTFIT; } if(!expr->combined_constraints) return (arg->flags & A1C_USE_WIDE_TYPES) ? FL_NOTFIT : FL_PRESUMED; /* * Second, if -fbless-SIZE is given, the (SIZE()) constraint may be * applied (non-standard! but we can deal with this) to the type. * Check the range. */ range = asn1constraint_compute_PER_range(expr->expr_type, expr->combined_constraints, ACT_CT_SIZE, 0, 0, CPR_simulate_fbless_SIZE); if(range) { if(!range->incompatible) { right = range->right; /* Use 4 instead of sizeof(long) is justified! */ if(right.type == ARE_VALUE && right.value <= 4) return FL_FITS_SIGNED; } asn1constraint_range_free(range); } /* * Third, pull up the PER visible range of the INTEGER. */ range = asn1constraint_compute_PER_range(expr->expr_type, expr->combined_constraints, ACT_EL_RANGE, 0, 0, 0); if(!range /* Commenting out || range->extensible * because this may or may not indicate wide type. */ || (range->extensible && (arg->flags & A1C_USE_WIDE_TYPES)) || range->empty_constraint || range->incompatible || range->not_PER_visible ) { asn1constraint_range_free(range); return (arg->flags & A1C_USE_WIDE_TYPES) ? FL_NOTFIT : FL_PRESUMED; } left = range->left; right = range->right; asn1constraint_range_free(range); /* Special case for unsigned */ if(left.type == ARE_VALUE && left.value >= 0 && right.type == ARE_VALUE && right.value > 2147483647 && right.value <= (asn1c_integer_t)(4294967295UL)) return FL_FITS_UNSIGN; /* If some fixed value is outside of target range, not fit */ if(left.type == ARE_VALUE && (left.value < LEFTMIN || left.value > RIGHTMAX)) return FL_NOTFIT; if(right.type == ARE_VALUE && (right.value > RIGHTMAX || right.value < LEFTMIN)) return FL_NOTFIT; /* If the range is open, fits only unless -fwide-types is given */ if(left.type != ARE_VALUE || right.type != ARE_VALUE) { return (arg->flags & A1C_USE_WIDE_TYPES) ? FL_NOTFIT : FL_PRESUMED; } return FL_FITS_SIGNED; } asn1c-0.9.28+dfsg/libasn1compiler/asn1c_fdeps.h0000644000000000000000000000162313065714043017664 0ustar rootroot#ifndef ASN1C_FDEPS_H #define ASN1C_FDEPS_H typedef struct asn1c_fdeps_s { char *filename; /* Or 0, if root. */ enum fdep_usage { FDEP_IGNORE = -1, /* Ignore contents of the section */ FDEP_NOTUSED = 0, FDEP_REFERRED = 1, /* Dynamic list of dependencies */ FDEP_CONVERTER = 2, /* Name of the int main() file */ FDEP_COMMON_FILES = 3, /* Section for mandatory dependencies */ FDEP_CODEC_PER = 4, /* Use contents only if -gen-PER */ } usage; /* Some file refers to it */ struct asn1c_fdeps_s **elements; int el_size; int el_count; } asn1c_fdeps_t; asn1c_fdeps_t *asn1c_read_file_dependencies(arg_t *arg, const char *datadir); /* Data may be a filename or an "#include <>" string. */ int asn1c_activate_dependency(asn1c_fdeps_t *deps, asn1c_fdeps_t *cur, const char *data); asn1c_fdeps_t *asn1c_deps_makelist(asn1c_fdeps_t *deps); #endif /* ASN1C_FDEPS_H */ asn1c-0.9.28+dfsg/libasn1compiler/asn1c_save.h0000644000000000000000000000025113065714043017515 0ustar rootroot#ifndef ASN1C_SAVE_H #define ASN1C_SAVE_H int asn1c_save_compiled_output(arg_t *arg, const char *datadir, int argc, int optc, char **argv); #endif /* ASN1C_SAVE_H */ asn1c-0.9.28+dfsg/libasn1compiler/asn1c_lang.c0000644000000000000000000000130513065714043017474 0ustar rootroot#include "asn1c_internal.h" #include "asn1c_C.h" asn1_language_map_t asn1_lang_map[AMT_EXPR_META_MAX][ASN_EXPR_TYPE_MAX]; int asn1c_with_language(asn1c_target_language_e lang) { asn1_language_map_t *lptr; int lsize; if(lang != ASN1C_LANGUAGE_C) { errno = EINVAL; return -1; } lptr = asn1_lang_C; lsize = sizeof(asn1_lang_C)/sizeof(asn1_lang_C[0]); memset(asn1_lang_map, 0, sizeof(asn1_lang_map)); for(; lsize && lptr->expr_match; lsize--, lptr++) { assert(lptr->meta_match > 0); assert(lptr->meta_match < AMT_EXPR_META_MAX); assert(lptr->expr_match > 0); assert(lptr->expr_match < ASN_EXPR_TYPE_MAX); asn1_lang_map[lptr->meta_match][lptr->expr_match] = *lptr; } return 0; } asn1c-0.9.28+dfsg/libasn1compiler/asn1c_C.c0000644000000000000000000022127313065714043016745 0ustar rootroot/* * Don't look into this file. First, because it's a mess, and second, because * it's a brain of the compiler, and you don't wanna mess with brains do you? ;) */ #include "asn1c_internal.h" #include "asn1c_C.h" #include "asn1c_constraint.h" #include "asn1c_out.h" #include "asn1c_misc.h" #include /* constraint groker from libasn1fix */ #include /* other exportables from libasn1fix */ typedef struct tag2el_s { struct asn1p_type_tag_s el_tag; int el_no; int toff_first; int toff_last; asn1p_expr_t *from_expr; } tag2el_t; typedef enum fte { FTE_ALLTAGS, FTE_CANONICAL_XER, } fte_e; static int _fill_tag2el_map(arg_t *arg, tag2el_t **tag2el, int *count, int el_no, fte_e flags); static int _add_tag2el_member(arg_t *arg, tag2el_t **tag2el, int *count, int el_no, fte_e flags); enum onc_flags { ONC_noflags = 0x00, ONC_avoid_keywords = 0x01, ONC_force_compound_name = 0x02, }; static int out_name_chain(arg_t *arg, enum onc_flags); static int asn1c_lang_C_type_SEQUENCE_def(arg_t *arg); static int asn1c_lang_C_type_SET_def(arg_t *arg); static int asn1c_lang_C_type_CHOICE_def(arg_t *arg); static int asn1c_lang_C_type_SEx_OF_def(arg_t *arg, int seq_of); static int _print_tag(arg_t *arg, struct asn1p_type_tag_s *tag_p); static int compute_extensions_start(asn1p_expr_t *expr); static int expr_break_recursion(arg_t *arg, asn1p_expr_t *expr); static int expr_as_xmlvaluelist(arg_t *arg, asn1p_expr_t *expr); static int expr_elements_count(arg_t *arg, asn1p_expr_t *expr); static int emit_single_member_PER_constraint(arg_t *arg, asn1cnst_range_t *range, int juscountvalues, char *type); static int emit_member_PER_constraints(arg_t *arg, asn1p_expr_t *expr, const char *pfx); static int emit_member_table(arg_t *arg, asn1p_expr_t *expr); static int emit_tag2member_map(arg_t *arg, tag2el_t *tag2el, int tag2el_count, const char *opt_modifier); static int emit_include_dependencies(arg_t *arg); static asn1p_expr_t *terminal_structable(arg_t *arg, asn1p_expr_t *expr); static int expr_defined_recursively(arg_t *arg, asn1p_expr_t *expr); static int asn1c_recurse(arg_t *arg, asn1p_expr_t *expr, int (*callback)(arg_t *arg, void *key), void *key); static asn1p_expr_type_e expr_get_type(arg_t *arg, asn1p_expr_t *expr); static int try_inline_default(arg_t *arg, asn1p_expr_t *expr, int out); static int *compute_canonical_members_order(arg_t *arg, int el_count); enum tvm_compat { _TVM_SAME = 0, /* tags and all_tags are same */ _TVM_SUBSET = 1, /* tags are subset of all_tags */ _TVM_DIFFERENT = 2, /* tags and all_tags are different */ }; static enum tvm_compat emit_tags_vectors(arg_t *arg, asn1p_expr_t *expr, int *tc, int *atc); enum etd_spec { ETD_NO_SPECIFICS, ETD_HAS_SPECIFICS }; static int emit_type_DEF(arg_t *arg, asn1p_expr_t *expr, enum tvm_compat tv_mode, int tags_count, int all_tags_count, int elements_count, enum etd_spec); #define C99_MODE (!(arg->flags & A1C_NO_C99)) #define UNNAMED_UNIONS (arg->flags & A1C_UNNAMED_UNIONS) #define HIDE_INNER_DEFS (arg->embed && !(arg->flags & A1C_ALL_DEFS_GLOBAL)) #define PCTX_DEF INDENTED( \ OUT("\n"); \ OUT("/* Context for parsing across buffer boundaries */\n"); \ OUT("asn_struct_ctx_t _asn_ctx;\n")); #define DEPENDENCIES do { \ emit_include_dependencies(arg); \ if(expr->expr_type == ASN_CONSTR_SET_OF) \ GEN_INCLUDE_STD("asn_SET_OF"); \ if(expr->expr_type == ASN_CONSTR_SEQUENCE_OF) \ GEN_INCLUDE_STD("asn_SEQUENCE_OF"); \ } while(0) /* MKID_safe() without checking for reserved keywords */ #define MKID(expr) (asn1c_make_identifier(0, expr, 0)) #define MKID_safe(expr) (asn1c_make_identifier(AMI_CHECK_RESERVED, expr, 0)) int asn1c_lang_C_type_REAL(arg_t *arg) { return asn1c_lang_C_type_SIMPLE_TYPE(arg); } struct value2enum { asn1c_integer_t value; const char *name; int idx; }; static int compar_enumMap_byName(const void *ap, const void *bp) { const struct value2enum *a = (const struct value2enum *)ap; const struct value2enum *b = (const struct value2enum *)bp; return strcmp(a->name, b->name); } static int compar_enumMap_byValue(const void *ap, const void *bp) { const struct value2enum *a = (const struct value2enum *)ap; const struct value2enum *b = (const struct value2enum *)bp; if(a->value < b->value) return -1; else if(a->value == b->value) return 0; return 1; } int asn1c_lang_C_type_common_INTEGER(arg_t *arg) { asn1p_expr_t *expr = arg->expr; asn1p_expr_t *v; int el_count = expr_elements_count(arg, expr); struct value2enum *v2e; int map_extensions = (expr->expr_type == ASN_BASIC_INTEGER); int eidx; v2e = alloca((el_count + 1) * sizeof(*v2e)); /* * For all ENUMERATED types and for those INTEGER types which * have identifiers, print out an enumeration table. */ if(expr->expr_type == ASN_BASIC_ENUMERATED || el_count) { eidx = 0; REDIR(OT_DEPS); OUT("typedef enum "); out_name_chain(arg, ONC_avoid_keywords); OUT(" {\n"); TQ_FOR(v, &(expr->members), next) { switch(v->expr_type) { case A1TC_UNIVERVAL: OUT("\t"); out_name_chain(arg, ONC_noflags); OUT("_%s", MKID(v)); OUT("\t= %" PRIdASN "%s\n", v->value->value.v_integer, (eidx+1 < el_count) ? "," : ""); v2e[eidx].name = v->Identifier; v2e[eidx].value = v->value->value.v_integer; eidx++; break; case A1TC_EXTENSIBLE: OUT("\t/*\n"); OUT("\t * Enumeration is extensible\n"); OUT("\t */\n"); if(!map_extensions) map_extensions = eidx + 1; break; default: return -1; } } OUT("} e_"); out_name_chain(arg, ONC_noflags); OUT(";\n"); assert(eidx == el_count); } /* * For all ENUMERATED types print out a mapping table * between identifiers and associated values. * This is prohibited for INTEGER types by by X.693:8.3.4. */ if(expr->expr_type == ASN_BASIC_ENUMERATED) { /* * Generate a enumerationName<->value map for XER codec. */ REDIR(OT_STAT_DEFS); OUT("static const asn_INTEGER_enum_map_t asn_MAP_%s_value2enum_%d[] = {\n", MKID(expr), expr->_type_unique_index); qsort(v2e, el_count, sizeof(v2e[0]), compar_enumMap_byValue); for(eidx = 0; eidx < el_count; eidx++) { v2e[eidx].idx = eidx; OUT("\t{ %" PRIdASN ",\t%ld,\t\"%s\" }%s\n", v2e[eidx].value, (long)strlen(v2e[eidx].name), v2e[eidx].name, (eidx + 1 < el_count) ? "," : ""); } if(map_extensions) OUT("\t/* This list is extensible */\n"); OUT("};\n"); OUT("static const unsigned int asn_MAP_%s_enum2value_%d[] = {\n", MKID(expr), expr->_type_unique_index); qsort(v2e, el_count, sizeof(v2e[0]), compar_enumMap_byName); for(eidx = 0; eidx < el_count; eidx++) { OUT("\t%d%s\t/* %s(%" PRIdASN ") */\n", v2e[eidx].idx, (eidx + 1 < el_count) ? "," : "", v2e[eidx].name, v2e[eidx].value); } if(map_extensions) OUT("\t/* This list is extensible */\n"); OUT("};\n"); OUT("static const asn_INTEGER_specifics_t asn_SPC_%s_specs_%d = {\n", MKID(expr), expr->_type_unique_index); INDENT(+1); OUT("asn_MAP_%s_value2enum_%d,\t" "/* \"tag\" => N; sorted by tag */\n", MKID(expr), expr->_type_unique_index); OUT("asn_MAP_%s_enum2value_%d,\t" "/* N => \"tag\"; sorted by N */\n", MKID(expr), expr->_type_unique_index); OUT("%d,\t/* Number of elements in the maps */\n", el_count); if(map_extensions) { OUT("%d,\t/* Extensions before this member */\n", map_extensions); } else { OUT("0,\t/* Enumeration is not extensible */\n"); } if(expr->expr_type == ASN_BASIC_ENUMERATED) OUT("1,\t/* Strict enumeration */\n"); else OUT("0,\n"); OUT("0,\t/* Native long size */\n"); OUT("0\n"); INDENT(-1); OUT("};\n"); } if(expr->expr_type == ASN_BASIC_INTEGER && asn1c_type_fits_long(arg, expr) == FL_FITS_UNSIGN) { REDIR(OT_STAT_DEFS); OUT("static const asn_INTEGER_specifics_t asn_SPC_%s_specs_%d = {\n", MKID(expr), expr->_type_unique_index); INDENT(+1); OUT("0,\t"); OUT("0,\t"); OUT("0,\t"); OUT("0,\t"); OUT("0,\n"); OUT("0,\t/* Native long size */\n"); OUT("1\t/* Unsigned representation */\n"); INDENT(-1); OUT("};\n"); } return asn1c_lang_C_type_SIMPLE_TYPE(arg); } int asn1c_lang_C_type_BIT_STRING(arg_t *arg) { asn1p_expr_t *expr = arg->expr; asn1p_expr_t *v; int el_count = expr_elements_count(arg, expr); if(el_count) { int eidx = 0; REDIR(OT_DEPS); OUT("typedef enum "); out_name_chain(arg, ONC_avoid_keywords); OUT(" {\n"); TQ_FOR(v, &(expr->members), next) { if(v->expr_type != A1TC_UNIVERVAL) { OUT("/* Unexpected BIT STRING element: %s */\n", v->Identifier); continue; } eidx++; OUT("\t"); out_name_chain(arg, ONC_noflags); OUT("_%s", MKID(v)); OUT("\t= %" PRIdASN "%s\n", v->value->value.v_integer, (eidx < el_count) ? "," : ""); } OUT("} e_"); out_name_chain(arg, ONC_noflags); OUT(";\n"); assert(eidx == el_count); } return asn1c_lang_C_type_SIMPLE_TYPE(arg); } int asn1c_lang_C_type_SEQUENCE(arg_t *arg) { asn1p_expr_t *expr = arg->expr; asn1p_expr_t *v; int comp_mode = 0; /* {root,ext=1,root,root,...} */ DEPENDENCIES; if(arg->embed) { OUT("struct "); out_name_chain(arg, ONC_avoid_keywords); OUT(" {\n"); } else { OUT("typedef struct %s {\n", MKID_safe(expr)); } TQ_FOR(v, &(expr->members), next) { if(v->expr_type == A1TC_EXTENSIBLE) if(comp_mode < 3) comp_mode++; if(comp_mode == 1) v->marker.flags |= EM_OMITABLE | EM_INDIRECT; try_inline_default(arg, v, 1); EMBED(v); } PCTX_DEF; OUT("} %s%s%s", (expr->marker.flags & EM_INDIRECT)?"*":"", expr->_anonymous_type ? "" : arg->embed ? MKID_safe(expr) : MKID(expr), arg->embed ? "" : "_t"); return asn1c_lang_C_type_SEQUENCE_def(arg); } static int asn1c_lang_C_type_SEQUENCE_def(arg_t *arg) { asn1p_expr_t *expr = arg->expr; asn1p_expr_t *v; int elements; /* Number of elements */ int ext_start = -2; int ext_stop = -2; tag2el_t *tag2el = NULL; int tag2el_count = 0; int tags_count; int all_tags_count; enum tvm_compat tv_mode; int roms_count; /* Root optional members */ int aoms_count; /* Additions optional members */ /* * Fetch every inner tag from the tag to elements map. */ if(_fill_tag2el_map(arg, &tag2el, &tag2el_count, -1, FTE_ALLTAGS)) { if(tag2el) free(tag2el); return -1; } GEN_INCLUDE_STD("constr_SEQUENCE"); if(!arg->embed) GEN_DECLARE(expr); /* asn_DEF_xxx */ REDIR(OT_STAT_DEFS); /* * Print out the table according to which parsing is performed. */ if(expr_elements_count(arg, expr)) { int comp_mode = 0; /* {root,ext=1,root,root,...} */ OUT("static asn_TYPE_member_t asn_MBR_%s_%d[] = {\n", MKID(expr), expr->_type_unique_index); elements = 0; roms_count = 0; aoms_count = 0; INDENTED(TQ_FOR(v, &(expr->members), next) { if(v->expr_type == A1TC_EXTENSIBLE) { if((++comp_mode) == 1) ext_start = elements - 1; else ext_stop = elements - 1; continue; } if(v->marker.flags & EM_OMITABLE) comp_mode == 1 ? ++aoms_count : ++roms_count; emit_member_table(arg, v); elements++; }); OUT("};\n"); if((roms_count + aoms_count) && (arg->flags & A1C_GEN_PER)) { int elm = 0; int comma = 0; comp_mode = 0; OUT("static const int asn_MAP_%s_oms_%d[] = {", MKID(expr), expr->_type_unique_index); TQ_FOR(v, &(expr->members), next) { if(v->expr_type == A1TC_EXTENSIBLE) { ++comp_mode; continue; } if((v->marker.flags & EM_OMITABLE) && comp_mode != 1) { if(!comma) comma++; else OUT(","); OUT(" %d", elm); } ++elm; } elm = 0; comp_mode = 0; TQ_FOR(v, &(expr->members), next) { if(v->expr_type == A1TC_EXTENSIBLE) { ++comp_mode; continue; } if((v->marker.flags & EM_OMITABLE) && comp_mode == 1) { if(!comma) comma++; else OUT(","); OUT(" %d", elm); } ++elm; } OUT(" };\n"); if(roms_count > 65536) FATAL("Too many optional elements in %s " "at line %d!", arg->expr->Identifier, arg->expr->_lineno); } else { roms_count = 0; aoms_count = 0; } } else { elements = 0; roms_count = 0; aoms_count = 0; } /* * Print out asn_DEF__[all_]tags[] vectors. */ tv_mode = emit_tags_vectors(arg, expr, &tags_count, &all_tags_count); /* * Tags to elements map. */ emit_tag2member_map(arg, tag2el, tag2el_count, 0); OUT("static asn_SEQUENCE_specifics_t asn_SPC_%s_specs_%d = {\n", MKID(expr), expr->_type_unique_index); INDENT(+1); OUT("sizeof(struct "); out_name_chain(arg, ONC_avoid_keywords); OUT("),\n"); OUT("offsetof(struct "); out_name_chain(arg, ONC_avoid_keywords); OUT(", _asn_ctx),\n"); if(tag2el_count) { OUT("asn_MAP_%s_tag2el_%d,\n", MKID(expr), expr->_type_unique_index); OUT("%d,\t/* Count of tags in the map */\n", tag2el_count); } else { OUT("0,\t/* No top level tags */\n"); OUT("0,\t/* No tags in the map */\n"); } if(roms_count + aoms_count) { OUT("asn_MAP_%s_oms_%d,\t/* Optional members */\n", MKID(expr), expr->_type_unique_index); OUT("%d, %d,\t/* Root/Additions */\n", roms_count, aoms_count); } else { OUT("0, 0, 0,\t/* Optional elements (not needed) */\n"); } OUT("%d,\t/* Start extensions */\n", ext_start<0 ? -1 : ext_start); OUT("%d\t/* Stop extensions */\n", (ext_stopexpr; asn1p_expr_t *v; long mcount; char *id; int comp_mode = 0; /* {root,ext=1,root,root,...} */ DEPENDENCIES; REDIR(OT_DEPS); OUT("\n"); OUT("/*\n"); OUT(" * Method of determining the components presence\n"); OUT(" */\n"); mcount = 0; OUT("typedef enum "); out_name_chain(arg, ONC_noflags); OUT("_PR {\n"); TQ_FOR(v, &(expr->members), next) { if(v->expr_type == A1TC_EXTENSIBLE) continue; INDENTED( out_name_chain(arg, ONC_noflags); OUT("_PR_"); id = MKID(v); OUT("%s,\t/* Member %s is present */\n", id, id) ); mcount++; } OUT("} "); out_name_chain(arg, ONC_noflags); OUT("_PR;\n"); REDIR(OT_TYPE_DECLS); if(arg->embed) { OUT("struct "); out_name_chain(arg, ONC_avoid_keywords); OUT(" {\n"); } else { OUT("typedef struct %s {\n", MKID_safe(expr)); } TQ_FOR(v, &(expr->members), next) { if(v->expr_type == A1TC_EXTENSIBLE) if(comp_mode < 3) comp_mode++; if(comp_mode == 1) v->marker.flags |= EM_OMITABLE | EM_INDIRECT; try_inline_default(arg, v, 1); EMBED(v); } INDENTED( id = MKID(expr); OUT("\n"); OUT("/* Presence bitmask: ASN_SET_ISPRESENT(p%s, %s_PR_x) */\n", id, id); OUT("unsigned int _presence_map\n"); OUT("\t[((%ld+(8*sizeof(unsigned int))-1)/(8*sizeof(unsigned int)))];\n", mcount); ); PCTX_DEF; OUT("} %s%s%s", (expr->marker.flags & EM_INDIRECT)?"*":"", expr->_anonymous_type ? "" : MKID_safe(expr), arg->embed ? "" : "_t"); return asn1c_lang_C_type_SET_def(arg); } static int asn1c_lang_C_type_SET_def(arg_t *arg) { asn1p_expr_t *expr = arg->expr; asn1p_expr_t *v; int elements; tag2el_t *tag2el = NULL; int tag2el_count = 0; tag2el_t *tag2el_cxer = NULL; int tag2el_cxer_count = 0; int tags_count; int all_tags_count; enum tvm_compat tv_mode; char *p; /* * Fetch every inner tag from the tag to elements map. */ if(_fill_tag2el_map(arg, &tag2el, &tag2el_count, -1, FTE_ALLTAGS)) { if(tag2el) free(tag2el); return -1; } if(_fill_tag2el_map(arg, &tag2el_cxer, &tag2el_cxer_count, -1, FTE_CANONICAL_XER)) { if(tag2el) free(tag2el); if(tag2el_cxer) free(tag2el_cxer); return -1; } if(tag2el_cxer_count == tag2el_count && memcmp(tag2el, tag2el_cxer, tag2el_count) == 0) { free(tag2el_cxer); tag2el_cxer = 0; } GEN_INCLUDE_STD("constr_SET"); if(!arg->embed) GEN_DECLARE(expr); /* asn_DEF_xxx */ REDIR(OT_STAT_DEFS); /* * Print out the table according to which parsing is performed. */ if(expr_elements_count(arg, expr)) { int comp_mode = 0; /* {root,ext=1,root,root,...} */ OUT("static asn_TYPE_member_t asn_MBR_%s_%d[] = {\n", MKID(expr), expr->_type_unique_index); elements = 0; INDENTED(TQ_FOR(v, &(expr->members), next) { if(v->expr_type == A1TC_EXTENSIBLE) { if(comp_mode < 3) comp_mode++; } else { emit_member_table(arg, v); elements++; } }); OUT("};\n"); } else { elements = 0; } /* * Print out asn_DEF__[all_]tags[] vectors. */ tv_mode = emit_tags_vectors(arg, expr, &tags_count, &all_tags_count); /* * Tags to elements map. */ emit_tag2member_map(arg, tag2el, tag2el_count, 0); if(tag2el_cxer) emit_tag2member_map(arg, tag2el_cxer, tag2el_cxer_count, "_cxer"); /* * Emit a map of mandatory elements. */ OUT("static const uint8_t asn_MAP_%s_mmap_%d", MKID(expr), expr->_type_unique_index); p = MKID_safe(expr); OUT("[(%d + (8 * sizeof(unsigned int)) - 1) / 8]", elements); OUT(" = {\n"); INDENTED( if(elements) { int el = 0; TQ_FOR(v, &(expr->members), next) { if(v->expr_type == A1TC_EXTENSIBLE) continue; if(el) { if((el % 8) == 0) OUT(",\n"); else OUT(" | "); } OUT("(%d << %d)", (v->marker.flags & EM_OMITABLE) != EM_OMITABLE, 7 - (el % 8)); el++; } } else { OUT("0"); } ); OUT("\n"); OUT("};\n"); OUT("static asn_SET_specifics_t asn_SPC_%s_specs_%d = {\n", MKID(expr), expr->_type_unique_index); INDENTED( OUT("sizeof(struct "); out_name_chain(arg, ONC_avoid_keywords); OUT("),\n"); OUT("offsetof(struct "); out_name_chain(arg, ONC_avoid_keywords); OUT(", _asn_ctx),\n"); OUT("offsetof(struct "); out_name_chain(arg, ONC_avoid_keywords); OUT(", _presence_map),\n"); p = MKID(expr); OUT("asn_MAP_%s_tag2el_%d,\n", p, expr->_type_unique_index); OUT("%d,\t/* Count of tags in the map */\n", tag2el_count); if(tag2el_cxer) OUT("asn_MAP_%s_tag2el_cxer_%d,\n", p, expr->_type_unique_index); else OUT("asn_MAP_%s_tag2el_%d,\t/* Same as above */\n", p, expr->_type_unique_index); OUT("%d,\t/* Count of tags in the CXER map */\n", tag2el_cxer_count); OUT("%d,\t/* Whether extensible */\n", compute_extensions_start(expr) == -1 ? 0 : 1); OUT("(unsigned int *)asn_MAP_%s_mmap_%d\t/* Mandatory elements map */\n", p, expr->_type_unique_index); ); OUT("};\n"); /* * Emit asn_DEF_xxx table. */ emit_type_DEF(arg, expr, tv_mode, tags_count, all_tags_count, elements, ETD_HAS_SPECIFICS); REDIR(OT_TYPE_DECLS); return 0; } /* _SET_def() */ int asn1c_lang_C_type_SEx_OF(arg_t *arg) { asn1p_expr_t *expr = arg->expr; asn1p_expr_t *memb = TQ_FIRST(&expr->members); DEPENDENCIES; if(arg->embed) { OUT("struct "); out_name_chain(arg, ONC_avoid_keywords); OUT(" {\n"); } else { OUT("typedef struct %s {\n", MKID_safe(expr)); } INDENT(+1); OUT("A_%s_OF(", (arg->expr->expr_type == ASN_CONSTR_SET_OF) ? "SET" : "SEQUENCE"); /* * README README * The implementation of the A_SET_OF() macro is already indirect. */ memb->marker.flags |= EM_INDIRECT; if(memb->expr_type & ASN_CONSTR_MASK || ((memb->expr_type == ASN_BASIC_ENUMERATED || (0 /* -- prohibited by X.693:8.3.4 */ && memb->expr_type == ASN_BASIC_INTEGER)) && expr_elements_count(arg, memb))) { arg_t tmp; asn1p_expr_t tmp_memb; arg->embed++; tmp = *arg; tmp.expr = &tmp_memb; tmp_memb = *memb; tmp_memb.marker.flags &= ~EM_INDIRECT; tmp_memb._anonymous_type = 1; if(tmp_memb.Identifier == 0) { tmp_memb.Identifier = "Member"; if(0) tmp_memb.Identifier = strdup( asn1c_make_identifier(0, expr, "Member", 0)); assert(tmp_memb.Identifier); } tmp.default_cb(&tmp); if(tmp_memb.Identifier != memb->Identifier) if(0) free(tmp_memb.Identifier); arg->embed--; assert(arg->target->target == OT_TYPE_DECLS); } else { OUT("%s", asn1c_type_name(arg, memb, (memb->marker.flags & EM_UNRECURSE) ? TNF_RSAFE : TNF_CTYPE)); } /* README README (above) */ if(0 && (memb->marker.flags & EM_INDIRECT)) OUT(" *"); OUT(") list;\n"); INDENT(-1); PCTX_DEF; OUT("} %s%s%s", (expr->marker.flags & EM_INDIRECT)?"*":"", expr->_anonymous_type ? "" : MKID_safe(expr), arg->embed ? "" : "_t"); /* * SET OF/SEQUENCE OF definition */ return asn1c_lang_C_type_SEx_OF_def(arg, (arg->expr->expr_type == ASN_CONSTR_SEQUENCE_OF)); } static int asn1c_lang_C_type_SEx_OF_def(arg_t *arg, int seq_of) { asn1p_expr_t *expr = arg->expr; asn1p_expr_t *v; int tags_count; int all_tags_count; enum tvm_compat tv_mode; /* * Print out the table according to which parsing is performed. */ if(seq_of) { GEN_INCLUDE_STD("constr_SEQUENCE_OF"); } else { GEN_INCLUDE_STD("constr_SET_OF"); } if(!arg->embed) GEN_DECLARE(expr); /* asn_DEF_xxx */ REDIR(OT_STAT_DEFS); /* * Print out the table according to which parsing is performed. */ OUT("static asn_TYPE_member_t asn_MBR_%s_%d[] = {\n", MKID(expr), expr->_type_unique_index); INDENT(+1); v = TQ_FIRST(&(expr->members)); if(!v->Identifier) { v->Identifier = strdup("Member"); assert(v->Identifier); } v->_anonymous_type = 1; arg->embed++; emit_member_table(arg, v); arg->embed--; INDENT(-1); OUT("};\n"); /* * Print out asn_DEF__[all_]tags[] vectors. */ tv_mode = emit_tags_vectors(arg, expr, &tags_count, &all_tags_count); OUT("static asn_SET_OF_specifics_t asn_SPC_%s_specs_%d = {\n", MKID(expr), expr->_type_unique_index); INDENTED( OUT("sizeof(struct "); out_name_chain(arg, ONC_avoid_keywords); OUT("),\n"); OUT("offsetof(struct "); out_name_chain(arg, ONC_avoid_keywords); OUT(", _asn_ctx),\n"); { int as_xvl = expr_as_xmlvaluelist(arg, v); OUT("%d,\t/* XER encoding is %s */\n", as_xvl, as_xvl ? "XMLValueList" : "XMLDelimitedItemList"); } ); OUT("};\n"); /* * Emit asn_DEF_xxx table. */ emit_type_DEF(arg, expr, tv_mode, tags_count, all_tags_count, 1, ETD_HAS_SPECIFICS); REDIR(OT_TYPE_DECLS); return 0; } /* _SEx_OF_def() */ int asn1c_lang_C_type_CHOICE(arg_t *arg) { asn1p_expr_t *expr = arg->expr; asn1p_expr_t *v; char *id; DEPENDENCIES; REDIR(OT_DEPS); OUT("typedef enum "); out_name_chain(arg, ONC_noflags); OUT("_PR {\n"); INDENTED( int skipComma = 1; out_name_chain(arg, ONC_noflags); OUT("_PR_NOTHING,\t/* No components present */\n"); TQ_FOR(v, &(expr->members), next) { if(skipComma) skipComma = 0; else OUT(",\n"); if(v->expr_type == A1TC_EXTENSIBLE) { OUT("/* Extensions may appear below */\n"); skipComma = 1; continue; } out_name_chain(arg, ONC_noflags); id = MKID(v); OUT("_PR_%s", id); } OUT("\n"); ); OUT("} "); out_name_chain(arg, ONC_noflags); OUT("_PR;\n"); REDIR(OT_TYPE_DECLS); if(arg->embed) { OUT("struct "); out_name_chain(arg, ONC_avoid_keywords); OUT(" {\n"); } else { OUT("typedef struct %s {\n", MKID_safe(expr)); } INDENTED( out_name_chain(arg, ONC_noflags); OUT("_PR present;\n"); OUT("union "); if(UNNAMED_UNIONS == 0) { out_name_chain(arg, ONC_force_compound_name); OUT("_u "); } OUT("{\n"); TQ_FOR(v, &(expr->members), next) { EMBED(v); } if(UNNAMED_UNIONS) OUT("};\n"); else OUT("} choice;\n"); ); PCTX_DEF; OUT("} %s%s%s", (expr->marker.flags & EM_INDIRECT)?"*":"", expr->_anonymous_type ? "" : arg->embed ? MKID_safe(expr) : MKID(expr), arg->embed ? "" : "_t"); return asn1c_lang_C_type_CHOICE_def(arg); } static int asn1c_lang_C_type_CHOICE_def(arg_t *arg) { asn1p_expr_t *expr = arg->expr; asn1p_expr_t *v; int elements; /* Number of elements */ tag2el_t *tag2el = NULL; int tag2el_count = 0; int tags_count; int all_tags_count; enum tvm_compat tv_mode; int *cmap = 0; /* * Fetch every inner tag from the tag to elements map. */ if(_fill_tag2el_map(arg, &tag2el, &tag2el_count, -1, FTE_ALLTAGS)) { if(tag2el) free(tag2el); return -1; } GEN_INCLUDE_STD("constr_CHOICE"); if(!arg->embed) GEN_DECLARE(expr); /* asn_DEF_xxx */ REDIR(OT_STAT_DEFS); /* * Print out the table according to which parsing is performed. */ if(expr_elements_count(arg, expr)) { OUT("static asn_TYPE_member_t asn_MBR_%s_%d[] = {\n", MKID(expr), expr->_type_unique_index); elements = 0; INDENTED(TQ_FOR(v, &(expr->members), next) { if(v->expr_type == A1TC_EXTENSIBLE) continue; emit_member_table(arg, v); elements++; }); OUT("};\n"); } else { elements = 0; } /* Create a canonical elements map */ if(elements && (arg->flags & A1C_GEN_PER)) { int i; cmap = compute_canonical_members_order(arg, elements); if(cmap) { OUT("static const int asn_MAP_%s_cmap_%d[] = {", MKID(expr), expr->_type_unique_index); for(i = 0; i < elements; i++) { if(i) OUT(","); OUT(" %d", cmap[i]); } OUT(" };\n"); free(cmap); } } if(arg->embed) { /* * Our parent structure has already taken this into account. */ tv_mode = _TVM_SAME; tags_count = all_tags_count = 0; } else { tv_mode = emit_tags_vectors(arg, expr, &tags_count, &all_tags_count); } /* * Tags to elements map. */ emit_tag2member_map(arg, tag2el, tag2el_count, 0); OUT("static asn_CHOICE_specifics_t asn_SPC_%s_specs_%d = {\n", MKID(expr), expr->_type_unique_index); INDENTED( OUT("sizeof(struct "); out_name_chain(arg, ONC_avoid_keywords); OUT("),\n"); OUT("offsetof(struct "); out_name_chain(arg, ONC_avoid_keywords); OUT(", _asn_ctx),\n"); OUT("offsetof(struct "); out_name_chain(arg, ONC_avoid_keywords); OUT(", present),\n"); OUT("sizeof(((struct "); out_name_chain(arg, ONC_avoid_keywords); OUT(" *)0)->present),\n"); OUT("asn_MAP_%s_tag2el_%d,\n", MKID(expr), expr->_type_unique_index); OUT("%d,\t/* Count of tags in the map */\n", tag2el_count); if(C99_MODE) OUT(".canonical_order = "); if(cmap) OUT("asn_MAP_%s_cmap_%d,\t/* Canonically sorted */\n", MKID(expr), expr->_type_unique_index); else OUT("0,\n"); if(C99_MODE) OUT(".ext_start = "); OUT("%d\t/* Extensions start */\n", compute_extensions_start(expr)); ); OUT("};\n"); /* * Emit asn_DEF_xxx table. */ emit_type_DEF(arg, expr, tv_mode, tags_count, all_tags_count, elements, ETD_HAS_SPECIFICS); REDIR(OT_TYPE_DECLS); return 0; } /* _CHOICE_def() */ int asn1c_lang_C_type_REFERENCE(arg_t *arg) { asn1p_ref_t *ref; ref = arg->expr->reference; if(ref->components[ref->comp_count-1].name[0] == '&') { asn1p_expr_t *extract; arg_t tmp; int ret; extract = asn1f_class_access_ex(arg->asn, arg->expr->module, arg->expr, arg->expr->rhs_pspecs, ref); if(extract == NULL) return -1; extract = asn1p_expr_clone(extract, 0); if(extract) { free(extract->Identifier); extract->Identifier = strdup(arg->expr->Identifier); if(extract->Identifier == NULL) { asn1p_expr_free(extract); return -1; } } else { return -1; } tmp = *arg; tmp.asn = arg->asn; tmp.expr = extract; ret = arg->default_cb(&tmp); asn1p_expr_free(extract); return ret; } return asn1c_lang_C_type_SIMPLE_TYPE(arg); } int asn1c_lang_C_type_SIMPLE_TYPE(arg_t *arg) { asn1p_expr_t *expr = arg->expr; int tags_count; int all_tags_count; enum tvm_compat tv_mode; enum etd_spec etd_spec; char *p; if(arg->embed) { enum tnfmt tnfmt = TNF_CTYPE; /* * If this is an optional compound type, * refer it using "struct X" convention, * as it may recursively include the current structure. */ if(expr->marker.flags & (EM_INDIRECT | EM_UNRECURSE)) { if(terminal_structable(arg, expr)) { tnfmt = TNF_RSAFE; REDIR(OT_FWD_DECLS); OUT("%s;\n", asn1c_type_name(arg, arg->expr, tnfmt)); } } REDIR(OT_TYPE_DECLS); OUT("%s", asn1c_type_name(arg, arg->expr, tnfmt)); if(!expr->_anonymous_type) { OUT("%s", (expr->marker.flags&EM_INDIRECT)?"\t*":"\t "); OUT("%s", MKID_safe(expr)); if((expr->marker.flags & (EM_DEFAULT & ~EM_INDIRECT)) == (EM_DEFAULT & ~EM_INDIRECT)) OUT("\t/* DEFAULT %s */", asn1f_printable_value( expr->marker.default_value)); else if((expr->marker.flags & EM_OPTIONAL) == EM_OPTIONAL) OUT("\t/* OPTIONAL */"); } } else { GEN_INCLUDE(asn1c_type_name(arg, expr, TNF_INCLUDE)); REDIR(OT_TYPE_DECLS); OUT("typedef %s\t", asn1c_type_name(arg, arg->expr, TNF_CTYPE)); OUT("%s%s_t", (expr->marker.flags & EM_INDIRECT)?"*":" ", MKID(expr)); } if((expr->expr_type == ASN_BASIC_ENUMERATED) || (0 /* -- prohibited by X.693:8.3.4 */ && expr->expr_type == ASN_BASIC_INTEGER && expr_elements_count(arg, expr)) || (expr->expr_type == ASN_BASIC_INTEGER && asn1c_type_fits_long(arg, expr) == FL_FITS_UNSIGN) ) etd_spec = ETD_HAS_SPECIFICS; else etd_spec = ETD_NO_SPECIFICS; /* * If this type just blindly refers the other type, alias it. * Type1 ::= Type2 */ if(arg->embed && etd_spec == ETD_NO_SPECIFICS) { REDIR(OT_TYPE_DECLS); return 0; } if((!expr->constraints || (arg->flags & A1C_NO_CONSTRAINTS)) && (arg->embed || expr->tag.tag_class == TC_NOCLASS) && etd_spec == ETD_NO_SPECIFICS && 0 /* This shortcut is incompatible with XER */ ) { char *type_name; REDIR(OT_FUNC_DECLS); type_name = asn1c_type_name(arg, expr, TNF_SAFE); OUT("/* This type is equivalent to %s */\n", type_name); if(HIDE_INNER_DEFS) OUT("/* "); OUT("#define\tasn_DEF_%s\t", MKID(expr)); type_name = asn1c_type_name(arg, expr, TNF_SAFE); OUT("asn_DEF_%s", type_name); if(HIDE_INNER_DEFS) OUT("\t// (Use -fall-defs-global to expose) */"); OUT("\n"); REDIR(OT_CODE); OUT("/* This type is equivalent to %s */\n", type_name); OUT("\n"); REDIR(OT_TYPE_DECLS); return 0; } REDIR(OT_CODE); /* * Constraint checking. */ if(!(arg->flags & A1C_NO_CONSTRAINTS)) { p = MKID(expr); if(HIDE_INNER_DEFS) OUT("static "); OUT("int\n"); OUT("%s", p); if(HIDE_INNER_DEFS) OUT("_%d", expr->_type_unique_index); OUT("_constraint(asn_TYPE_descriptor_t *td, const void *sptr,\n"); INDENT(+1); OUT("\t\tasn_app_constraint_failed_f *ctfailcb, void *app_key) {"); OUT("\n"); DEBUG("expr constraint checking code for %s", p); if(asn1c_emit_constraint_checking_code(arg) == 1) { OUT("/* Replace with underlying type checker */\n"); OUT("td->check_constraints " "= asn_DEF_%s.check_constraints;\n", asn1c_type_name(arg, expr, TNF_SAFE)); OUT("return td->check_constraints" "(td, sptr, ctfailcb, app_key);\n"); } INDENT(-1); OUT("}\n"); OUT("\n"); } REDIR(OT_STAT_DEFS); /* * Print out asn_DEF__[all_]tags[] vectors. */ tv_mode = emit_tags_vectors(arg, expr, &tags_count, &all_tags_count); DEBUG("emit tag vectors for %s %d, %d, %d", expr->Identifier, tv_mode, tags_count, all_tags_count); emit_type_DEF(arg, expr, tv_mode, tags_count, all_tags_count, 0, etd_spec); REDIR(OT_CODE); /* * Emit suicidal functions. */ /* * This function replaces certain fields from the definition * of a type with the corresponding fields from the basic type * (from which the current type is inherited). */ OUT("/*\n"); OUT(" * This type is implemented using %s,\n", asn1c_type_name(arg, expr, TNF_SAFE)); OUT(" * so here we adjust the DEF accordingly.\n"); OUT(" */\n"); OUT("static void\n"); OUT("%s_%d_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {\n", MKID(expr), expr->_type_unique_index); INDENT(+1); { asn1p_expr_t *terminal = asn1f_find_terminal_type_ex(arg->asn, expr); char *type_name = asn1c_type_name(arg, expr, TNF_SAFE); OUT("td->free_struct = asn_DEF_%s.free_struct;\n", type_name); OUT("td->print_struct = asn_DEF_%s.print_struct;\n", type_name); OUT("td->check_constraints = asn_DEF_%s.check_constraints;\n", type_name); OUT("td->ber_decoder = asn_DEF_%s.ber_decoder;\n", type_name); OUT("td->der_encoder = asn_DEF_%s.der_encoder;\n", type_name); OUT("td->xer_decoder = asn_DEF_%s.xer_decoder;\n", type_name); OUT("td->xer_encoder = asn_DEF_%s.xer_encoder;\n", type_name); OUT("td->uper_decoder = asn_DEF_%s.uper_decoder;\n", type_name); OUT("td->uper_encoder = asn_DEF_%s.uper_encoder;\n", type_name); if(!terminal && !tags_count) { OUT("/* The next four lines are here because of -fknown-extern-type */\n"); OUT("td->tags = asn_DEF_%s.tags;\n", type_name); OUT("td->tags_count = asn_DEF_%s.tags_count;\n", type_name); OUT("td->all_tags = asn_DEF_%s.all_tags;\n", type_name); OUT("td->all_tags_count = asn_DEF_%s.all_tags_count;\n",type_name); OUT("/* End of these lines */\n"); } OUT("if(!td->per_constraints)\n"); OUT("\ttd->per_constraints = asn_DEF_%s.per_constraints;\n", type_name); OUT("td->elements = asn_DEF_%s.elements;\n", type_name); OUT("td->elements_count = asn_DEF_%s.elements_count;\n", type_name); if(etd_spec != ETD_NO_SPECIFICS) { INDENT(-1); OUT(" /* "); } OUT("td->specifics = asn_DEF_%s.specifics;", type_name); if(etd_spec == ETD_NO_SPECIFICS) { INDENT(-1); OUT("\n"); } else { OUT("\t// Defined explicitly */\n"); } } OUT("}\n"); OUT("\n"); p = MKID(expr); if(HIDE_INNER_DEFS) OUT("static "); OUT("void\n"); OUT("%s", p); if(HIDE_INNER_DEFS) OUT("_%d", expr->_type_unique_index); OUT("_free(asn_TYPE_descriptor_t *td,\n"); INDENTED( OUT("\tvoid *struct_ptr, int contents_only) {\n"); OUT("%s_%d_inherit_TYPE_descriptor(td);\n", p, expr->_type_unique_index); OUT("td->free_struct(td, struct_ptr, contents_only);\n"); ); OUT("}\n"); OUT("\n"); p = MKID(expr); if(HIDE_INNER_DEFS) OUT("static "); OUT("int\n"); OUT("%s", p); if(HIDE_INNER_DEFS) OUT("_%d", expr->_type_unique_index); OUT("_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,\n"); INDENTED( OUT("\tint ilevel, asn_app_consume_bytes_f *cb, void *app_key) {\n"); OUT("%s_%d_inherit_TYPE_descriptor(td);\n", p, expr->_type_unique_index); OUT("return td->print_struct(td, struct_ptr, ilevel, cb, app_key);\n"); ); OUT("}\n"); OUT("\n"); p = MKID(expr); if(HIDE_INNER_DEFS) OUT("static "); OUT("asn_dec_rval_t\n"); OUT("%s", p); if(HIDE_INNER_DEFS) OUT("_%d", expr->_type_unique_index); OUT("_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,\n"); INDENTED( OUT("\tvoid **structure, const void *bufptr, size_t size, int tag_mode) {\n"); OUT("%s_%d_inherit_TYPE_descriptor(td);\n", p, expr->_type_unique_index); OUT("return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);\n"); ); OUT("}\n"); OUT("\n"); p = MKID(expr); if(HIDE_INNER_DEFS) OUT("static "); OUT("asn_enc_rval_t\n"); OUT("%s", p); if(HIDE_INNER_DEFS) OUT("_%d", expr->_type_unique_index); OUT("_encode_der(asn_TYPE_descriptor_t *td,\n"); INDENTED( OUT("\tvoid *structure, int tag_mode, ber_tlv_tag_t tag,\n"); OUT("\tasn_app_consume_bytes_f *cb, void *app_key) {\n"); OUT("%s_%d_inherit_TYPE_descriptor(td);\n", p, expr->_type_unique_index); OUT("return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);\n"); ); OUT("}\n"); OUT("\n"); p = MKID(expr); if(HIDE_INNER_DEFS) OUT("static "); OUT("asn_dec_rval_t\n"); OUT("%s", p); if(HIDE_INNER_DEFS) OUT("_%d", expr->_type_unique_index); OUT("_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,\n"); INDENTED( OUT("\tvoid **structure, const char *opt_mname, const void *bufptr, size_t size) {\n"); OUT("%s_%d_inherit_TYPE_descriptor(td);\n", p, expr->_type_unique_index); OUT("return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);\n"); ); OUT("}\n"); OUT("\n"); p = MKID(expr); if(HIDE_INNER_DEFS) OUT("static "); OUT("asn_enc_rval_t\n"); OUT("%s", p); if(HIDE_INNER_DEFS) OUT("_%d", expr->_type_unique_index); OUT("_encode_xer(asn_TYPE_descriptor_t *td, void *structure,\n"); INDENTED( OUT("\tint ilevel, enum xer_encoder_flags_e flags,\n"); OUT("\tasn_app_consume_bytes_f *cb, void *app_key) {\n"); OUT("%s_%d_inherit_TYPE_descriptor(td);\n", p, expr->_type_unique_index); OUT("return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);\n"); ); OUT("}\n"); OUT("\n"); if(arg->flags & A1C_GEN_PER) { p = MKID(expr); if(HIDE_INNER_DEFS) OUT("static "); OUT("asn_dec_rval_t\n"); OUT("%s", p); if(HIDE_INNER_DEFS) OUT("_%d", expr->_type_unique_index); OUT("_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,\n"); INDENTED( OUT("\tasn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) {\n"); OUT("%s_%d_inherit_TYPE_descriptor(td);\n", p, expr->_type_unique_index); OUT("return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data);\n"); ); OUT("}\n"); OUT("\n"); p = MKID(expr); if(HIDE_INNER_DEFS) OUT("static "); OUT("asn_enc_rval_t\n"); OUT("%s", p); if(HIDE_INNER_DEFS) OUT("_%d", expr->_type_unique_index); OUT("_encode_uper(asn_TYPE_descriptor_t *td,\n"); INDENTED( OUT("\tasn_per_constraints_t *constraints,\n"); OUT("\tvoid *structure, asn_per_outp_t *per_out) {\n"); OUT("%s_%d_inherit_TYPE_descriptor(td);\n", p, expr->_type_unique_index); OUT("return td->uper_encoder(td, constraints, structure, per_out);\n"); ); OUT("}\n"); OUT("\n"); } REDIR(OT_FUNC_DECLS); p = MKID(expr); if(HIDE_INNER_DEFS) { OUT("/* extern asn_TYPE_descriptor_t asn_DEF_%s_%d;" "\t// (Use -fall-defs-global to expose) */\n", p, expr->_type_unique_index); } else { OUT("extern asn_TYPE_descriptor_t asn_DEF_%s;\n", p); OUT("asn_struct_free_f %s_free;\n", p); OUT("asn_struct_print_f %s_print;\n", p); OUT("asn_constr_check_f %s_constraint;\n", p); OUT("ber_type_decoder_f %s_decode_ber;\n", p); OUT("der_type_encoder_f %s_encode_der;\n", p); OUT("xer_type_decoder_f %s_decode_xer;\n", p); OUT("xer_type_encoder_f %s_encode_xer;\n", p); if(arg->flags & A1C_GEN_PER) { OUT("per_type_decoder_f %s_decode_uper;\n", p); OUT("per_type_encoder_f %s_encode_uper;\n", p); } } REDIR(OT_TYPE_DECLS); return 0; } int asn1c_lang_C_type_EXTENSIBLE(arg_t *arg) { OUT("/*\n"); OUT(" * This type is extensible,\n"); OUT(" * possible extensions are below.\n"); OUT(" */\n"); return 0; } static int compute_extensions_start(asn1p_expr_t *expr) { asn1p_expr_t *v; int eidx = 0; TQ_FOR(v, &(expr->members), next) { if(v->expr_type == A1TC_EXTENSIBLE) return eidx; eidx++; } return -1; } static int _print_tag(arg_t *arg, struct asn1p_type_tag_s *tag) { OUT("("); switch(tag->tag_class) { case TC_UNIVERSAL: OUT("ASN_TAG_CLASS_UNIVERSAL"); break; case TC_APPLICATION: OUT("ASN_TAG_CLASS_APPLICATION"); break; case TC_CONTEXT_SPECIFIC: OUT("ASN_TAG_CLASS_CONTEXT"); break; case TC_PRIVATE: OUT("ASN_TAG_CLASS_PRIVATE"); break; case TC_NOCLASS: break; } OUT(" | (%" PRIdASN " << 2))", tag->tag_value); return 0; } static int _tag2el_cmp(const void *ap, const void *bp) { const tag2el_t *a = ap; const tag2el_t *b = bp; const struct asn1p_type_tag_s *ta = &a->el_tag; const struct asn1p_type_tag_s *tb = &b->el_tag; if(ta->tag_class == tb->tag_class) { if(ta->tag_value == tb->tag_value) { /* * Sort by their respective positions. */ if(a->el_no < b->el_no) return -1; else if(a->el_no > b->el_no) return 1; return 0; } else if(ta->tag_value < tb->tag_value) return -1; else return 1; } else if(ta->tag_class < tb->tag_class) { return -1; } else { return 1; } } /* * For constructed types, number of external tags may be greater than * number of elements in the type because of CHOICE type. * T ::= SET { -- Three possible tags: * a INTEGER, -- One tag is here... * b Choice1 -- ... and two more tags are there. * } * Choice1 ::= CHOICE { * s1 IA5String, * s2 ObjectDescriptor * } */ static int _fill_tag2el_map(arg_t *arg, tag2el_t **tag2el, int *count, int el_no, fte_e flags) { asn1p_expr_t *expr = arg->expr; arg_t tmparg = *arg; asn1p_expr_t *v; int element = 0; int original_count = *count; int sort_until = -1; TQ_FOR(v, &(expr->members), next) { if(v->expr_type == A1TC_EXTENSIBLE) { /* * CXER mandates sorting * only for the root part. */ if(flags == FTE_CANONICAL_XER && sort_until == -1) sort_until = *count; continue; } tmparg.expr = v; if(_add_tag2el_member(&tmparg, tag2el, count, (el_no==-1)?element:el_no, flags)) { return -1; } element++; } if(flags == FTE_CANONICAL_XER) { if(sort_until == -1) sort_until = *count; qsort((*tag2el) + original_count, sort_until - original_count, sizeof(**tag2el), _tag2el_cmp); if(arg->expr->expr_type == ASN_CONSTR_CHOICE && (sort_until - original_count) >= 1) { /* Only take in account the root component */ *count = original_count + 1; } } else { /* * Sort the map according to canonical order of their * tags and element numbers. */ qsort(*tag2el, *count, sizeof(**tag2el), _tag2el_cmp); } /* * Initialize .toff_{first|last} members. */ if(*count) { struct asn1p_type_tag_s *cur_tag = 0; tag2el_t *cur = *tag2el; tag2el_t *end = cur + *count; int occur, i; for(occur = 0; cur < end; cur++) { if(cur_tag == 0 || cur_tag->tag_value != cur->el_tag.tag_value || cur_tag->tag_class != cur->el_tag.tag_class) { cur_tag = &cur->el_tag; occur = 0; } else { occur++; } cur->toff_first = -occur; for(i = 0; i >= -occur; i--) cur[i].toff_last = -i; } } return 0; } static int _add_tag2el_member(arg_t *arg, tag2el_t **tag2el, int *count, int el_no, fte_e flags) { struct asn1p_type_tag_s tag; int ret; assert(el_no >= 0); ret = asn1f_fetch_outmost_tag(arg->asn, arg->expr->module, arg->expr, &tag, AFT_IMAGINARY_ANY); if(ret == 0) { tag2el_t *te; int new_count = (*count) + 1; void *p; if(tag.tag_value == -1) { /* * This is an untagged ANY type, * proceed without adding a tag */ return 0; } p = realloc(*tag2el, new_count * sizeof(tag2el_t)); if(p) *tag2el = p; else return -1; if(0) DEBUG("Found tag for %s: %ld", arg->expr->Identifier, (long)tag.tag_value); te = &((*tag2el)[*count]); te->el_tag = tag; te->el_no = el_no; te->from_expr = arg->expr; *count = new_count; return 0; } DEBUG("Searching tag in complex expression %s:%x at line %d", arg->expr->Identifier, arg->expr->expr_type, arg->expr->_lineno); /* * Iterate over members of CHOICE type. */ if(arg->expr->expr_type == ASN_CONSTR_CHOICE) { return _fill_tag2el_map(arg, tag2el, count, el_no, flags); } if(arg->expr->expr_type == A1TC_REFERENCE) { arg_t tmp = *arg; asn1p_expr_t *expr; expr = asn1f_lookup_symbol_ex(tmp.asn, tmp.expr, arg->expr->reference); if(expr) { tmp.expr = expr; return _add_tag2el_member(&tmp, tag2el, count, el_no, flags); } else { FATAL("Cannot dereference %s at line %d", arg->expr->Identifier, arg->expr->_lineno); return -1; } } DEBUG("No tag for %s at line %d", arg->expr->Identifier, arg->expr->_lineno); return -1; } static int emit_tag2member_map(arg_t *arg, tag2el_t *tag2el, int tag2el_count, const char *opt_modifier) { asn1p_expr_t *expr = arg->expr; int i; if(!tag2el_count) return 0; /* No top level tags */ OUT("static const asn_TYPE_tag2member_t asn_MAP_%s_tag2el%s_%d[] = {\n", MKID(expr), opt_modifier?opt_modifier:"", expr->_type_unique_index); for(i = 0; i < tag2el_count; i++) { OUT(" { "); _print_tag(arg, &tag2el[i].el_tag); OUT(", "); OUT("%d, ", tag2el[i].el_no); OUT("%d, ", tag2el[i].toff_first); OUT("%d ", tag2el[i].toff_last); OUT("}%s /* %s", (i + 1 < tag2el_count) ? "," : "", tag2el[i].from_expr->Identifier); if(arg->flags & A1C_LINE_REFS) OUT("at %d", tag2el[i].from_expr->_lineno); OUT(" */\n"); } OUT("};\n"); return 0; } static enum tvm_compat emit_tags_vectors(arg_t *arg, asn1p_expr_t *expr, int *tags_count_r, int *all_tags_count_r) { struct asn1p_type_tag_s *tags = 0; /* Effective tags */ struct asn1p_type_tag_s *all_tags = 0; /* The full array */ int tags_count = 0; int all_tags_count = 0; enum tvm_compat tv_mode = _TVM_SAME; int i; /* Cleanup before proceeding. */ *tags_count_r = 0; *all_tags_count_r = 0; /* Fetch a chain of tags */ tags_count = asn1f_fetch_tags(arg->asn, expr->module, expr, &tags, 0); if(tags_count < 0) { DEBUG("fail to fetch tags for %s", expr->Identifier); return -1; } /* Fetch a chain of tags */ all_tags_count = asn1f_fetch_tags(arg->asn, expr->module, expr, &all_tags, AFT_FULL_COLLECT); if(all_tags_count < 0) { free(tags); DEBUG("fail to fetch tags chain for %s", expr->Identifier); return -1; } assert(tags_count <= all_tags_count); assert((tags_count?0:1) == (all_tags_count?0:1)); if(tags_count <= all_tags_count) { for(i = 0; i < tags_count; i++) { if(tags[i].tag_value != all_tags[i].tag_value || tags[i].tag_class != all_tags[i].tag_class) { tv_mode = _TVM_DIFFERENT; break; } } if(i == tags_count && tags_count < all_tags_count) tv_mode = _TVM_SUBSET; } else { tv_mode = _TVM_DIFFERENT; } #define EMIT_TAGS_TABLE(name, tags, tags_count) do { \ OUT("static const ber_tlv_tag_t asn_DEF_%s%s_tags_%d[] = {\n",\ MKID(expr), name, \ expr->_type_unique_index); \ INDENT(+1); \ /* Print the array of collected tags */ \ for(i = 0; i < tags_count; i++) { \ if(i) OUT(",\n"); \ _print_tag(arg, &tags[i]); \ } \ OUT("\n"); \ INDENT(-1); \ OUT("};\n"); \ } while(0) if(tags_count) { if(tv_mode == _TVM_SUBSET) EMIT_TAGS_TABLE("", all_tags, all_tags_count); else EMIT_TAGS_TABLE("", tags, tags_count); } if(all_tags_count) { if(tv_mode == _TVM_DIFFERENT) EMIT_TAGS_TABLE("_all", all_tags, all_tags_count); } free(tags); free(all_tags); *tags_count_r = tags_count; *all_tags_count_r = all_tags_count; return tv_mode; } static int expr_elements_count(arg_t *arg, asn1p_expr_t *expr) { asn1p_expr_t *topmost_parent; asn1p_expr_t *v; int elements = 0; topmost_parent = asn1f_find_terminal_type_ex(arg->asn, expr); if(!topmost_parent) return 0; if(!(topmost_parent->expr_type & ASN_CONSTR_MASK) && !(topmost_parent->expr_type == ASN_BASIC_INTEGER) && !(topmost_parent->expr_type == ASN_BASIC_ENUMERATED) && !(topmost_parent->expr_type == ASN_BASIC_BIT_STRING)) return 0; TQ_FOR(v, &(topmost_parent->members), next) { if(v->expr_type != A1TC_EXTENSIBLE) elements++; } return elements; } static asn1p_expr_type_e expr_get_type(arg_t *arg, asn1p_expr_t *expr) { asn1p_expr_t *terminal; terminal = asn1f_find_terminal_type_ex(arg->asn, expr); if(terminal) return terminal->expr_type; return A1TC_INVALID; } static asn1c_integer_t PER_FROM_alphabet_characters(asn1cnst_range_t *range) { asn1c_integer_t numchars = 0; if(range->el_count) { int i; for(i = 0; i < range->el_count; i++) numchars += PER_FROM_alphabet_characters(range->elements[i]); } else { assert(range->left.type == ARE_VALUE); assert(range->right.type == ARE_VALUE); numchars = 1 + (range->right.value - range->left.value); } return numchars; } static int emit_single_member_PER_constraint(arg_t *arg, asn1cnst_range_t *range, int alphabetsize, char *type) { if(!range || range->incompatible || range->not_PER_visible) { OUT("{ APC_UNCONSTRAINED,\t-1, -1, 0, 0 }"); return 0; } if(range->left.type == ARE_VALUE) { if(range->right.type == ARE_VALUE) { asn1c_integer_t cover = 1; asn1c_integer_t r = 1 + range->right.value - range->left.value; size_t rbits; /* Value range bits */ ssize_t ebits; /* Value effective range bits */ if(range->empty_constraint) r = 0; if(alphabetsize) { /* X.691: 27.5.2 */ r = PER_FROM_alphabet_characters(range); } /* Compute real constraint */ for(rbits = 0; rbits < (8 * sizeof(r)); rbits++) { if(r <= cover) break; cover *= 2; /* Can't do shifting */ if(cover < 0) { FATAL("Constraint at line %d too wide " "for %d-bits integer type", arg->expr->_lineno, sizeof(r) * 8); rbits = sizeof(r); break; } } if(alphabetsize) { ebits = rbits; } else { /* X.691, #10.9.4.1 */ for(ebits = 0; ebits <= 16; ebits++) if(r <= 1 << ebits) break; if(ebits == 17 || range->right.value >= 65536) ebits = -1; if(0) { /* X.691, #10.5.7.1 */ for(ebits = 0; ebits <= 8; ebits++) if(r <= 1 << ebits) break; if(ebits == 9) { if(r <= 65536) ebits = 16; else ebits = -1; } } } OUT("{ APC_CONSTRAINED%s,%s% d, % d, ", range->extensible ? " | APC_EXTENSIBLE" : "", range->extensible ? " " : "\t", rbits, ebits); if(alphabetsize) { asn1c_integer_t lv = range->left.value; asn1c_integer_t rv = range->right.value; int gcmt = 0; if(lv > 0x7fffffff) { lv = 0x7fffffff; gcmt++; } if(rv > 0x7fffffff) { rv = 0x7fffffff; gcmt++; } if(gcmt) { OINTS(lv); OUT(", "); OINTS(rv); OUT(" }"); goto pcmt; } } } else { if(range->extensible) { OUT("{ APC_SEMI_CONSTRAINED | APC_EXTENSIBLE, " "-1, "); } else { OUT("{ APC_SEMI_CONSTRAINED,\t-1, -1, "); } } OINTS(range->left.value); OUT(", "); OINTS(range->right.value); OUT(" }"); } else { OUT("{ APC_UNCONSTRAINED,\t-1, -1, 0, 0 }"); } pcmt: /* * Print some courtesy debug information. */ if(range->left.type == ARE_VALUE || range->right.type == ARE_VALUE) { OUT("\t/* "); if(type) OUT("(%s", type); OUT("("); if(range->left.type == ARE_VALUE) OUT("%" PRIdASN, range->left.value); else OUT("MIN"); OUT(".."); if(range->right.type == ARE_VALUE) OUT("%" PRIdASN, range->right.value); else OUT("MAX"); if(range->extensible) OUT(",..."); if(type) OUT(")"); OUT(") */"); } return 0; } static int emit_member_PER_constraints(arg_t *arg, asn1p_expr_t *expr, const char *pfx) { int save_target = arg->target->target; asn1cnst_range_t *range; asn1p_expr_type_e etype; etype = expr_get_type(arg, expr); if((arg->flags & A1C_GEN_PER) && (expr->constraints || etype == ASN_BASIC_ENUMERATED || etype == ASN_CONSTR_CHOICE) ) { /* Fall through */ } else { return 0; } REDIR(OT_CTDEFS); OUT("static asn_per_constraints_t " "asn_PER_%s_%s_constr_%d GCC_NOTUSED = {\n", pfx, MKID(expr), expr->_type_unique_index); INDENT(+1); /* * ENUMERATED and CHOICE are special. */ if(etype == ASN_BASIC_ENUMERATED || etype == ASN_CONSTR_CHOICE) { asn1cnst_range_t tmprng; asn1p_expr_t *v; int extensible = 0; int eidx = -1; expr = asn1f_find_terminal_type_ex(arg->asn, expr); assert(expr); TQ_FOR(v, &(expr->members), next) { if(v->expr_type == A1TC_EXTENSIBLE) { extensible++; break; } eidx++; } memset(&tmprng, 0, sizeof (tmprng)); tmprng.extensible = extensible; if(eidx < 0) tmprng.empty_constraint = 1; tmprng.left.type = ARE_VALUE; tmprng.left.value = 0; tmprng.right.type = ARE_VALUE; tmprng.right.value = eidx < 0 ? 0 : eidx; if(emit_single_member_PER_constraint(arg, &tmprng, 0, 0)) return -1; } else if(etype & ASN_STRING_KM_MASK) { range = asn1constraint_compute_PER_range(etype, expr->combined_constraints, ACT_CT_FROM, 0, 0, 0); DEBUG("Emitting FROM constraint for %s", expr->Identifier); if((range->left.type == ARE_MIN && range->right.type == ARE_MAX) || range->not_PER_visible) { switch(etype) { case ASN_STRING_BMPString: range->left.type = ARE_VALUE; range->left.value = 0; range->right.type = ARE_VALUE; range->right.value = 65535; range->not_PER_visible = 0; range->extensible = 0; break; case ASN_STRING_UniversalString: OUT("{ APC_CONSTRAINED,\t32, 32," " 0, 2147483647 }" " /* special case 1 */\n"); goto avoid; default: break; } } if(emit_single_member_PER_constraint(arg, range, 1, 0)) return -1; avoid: asn1constraint_range_free(range); } else { range = asn1constraint_compute_PER_range(etype, expr->combined_constraints, ACT_EL_RANGE, 0, 0, 0); if(emit_single_member_PER_constraint(arg, range, 0, 0)) return -1; asn1constraint_range_free(range); } OUT(",\n"); range = asn1constraint_compute_PER_range(etype, expr->combined_constraints, ACT_CT_SIZE, 0, 0, 0); if(emit_single_member_PER_constraint(arg, range, 0, "SIZE")) return -1; asn1constraint_range_free(range); OUT(",\n"); if((etype & ASN_STRING_KM_MASK) && (expr->_mark & TM_PERFROMCT)) { int old_target = arg->target->target; REDIR(OT_CODE); OUT("static int asn_PER_MAP_%s_%d_v2c(unsigned int value) {\n", MKID(expr), expr->_type_unique_index); OUT("\tif(value >= sizeof(permitted_alphabet_table_%d)/" "sizeof(permitted_alphabet_table_%d[0]))\n", expr->_type_unique_index, expr->_type_unique_index); OUT("\t\treturn -1;\n"); OUT("\treturn permitted_alphabet_table_%d[value] - 1;\n", expr->_type_unique_index); OUT("}\n"); OUT("static int asn_PER_MAP_%s_%d_c2v(unsigned int code) {\n", MKID(expr), expr->_type_unique_index); OUT("\tif(code >= sizeof(permitted_alphabet_code2value_%d)/" "sizeof(permitted_alphabet_code2value_%d[0]))\n", expr->_type_unique_index, expr->_type_unique_index); OUT("\t\treturn -1;\n"); OUT("\treturn permitted_alphabet_code2value_%d[code];\n", expr->_type_unique_index); OUT("}\n"); REDIR(old_target); OUT("asn_PER_MAP_%s_%d_v2c,\t/* Value to PER code map */\n", MKID(expr), expr->_type_unique_index); OUT("asn_PER_MAP_%s_%d_c2v\t/* PER code to value map */\n", MKID(expr), expr->_type_unique_index); } else if(etype & ASN_STRING_KM_MASK) { DEBUG("No PER value map necessary for %s", MKID(expr)); OUT("0, 0\t/* No PER character map necessary */\n"); } else { OUT("0, 0\t/* No PER value map */\n"); } INDENT(-1); OUT("};\n"); REDIR(save_target); return 0; } static int safe_string(const uint8_t *buf, int size) { const uint8_t *end = buf + size; for(; buf < end; buf++) { int ch = *buf; if((ch < 0x20 || ch > 0x7e) || ch == '"') return 0; } return 1; } static void emit_default_value(arg_t *arg, asn1p_value_t *v) { OUT("static uint8_t defv[] = "); assert(v->type == ATV_STRING); if(safe_string(v->value.string.buf, v->value.string.size)) { OUT("\"%s\";\n", v->value.string.buf); } else { uint8_t *b = v->value.string.buf; uint8_t *e = v->value.string.size + b; OUT("{ "); for(;b < e; b++) OUT("0x%02x, ", *b); OUT("0 };\n"); } } static int try_inline_default(arg_t *arg, asn1p_expr_t *expr, int out) { int save_target = arg->target->target; asn1p_expr_type_e etype = expr_get_type(arg, expr); int fits_long = 0; switch(etype) { case ASN_BASIC_BOOLEAN: fits_long = 1; case ASN_BASIC_INTEGER: case ASN_BASIC_ENUMERATED: if(expr->marker.default_value == NULL || expr->marker.default_value->type != ATV_INTEGER) break; if(!fits_long) fits_long = asn1c_type_fits_long(arg, expr)!=FL_NOTFIT; if(fits_long && !expr->marker.default_value->value.v_integer) expr->marker.flags &= ~EM_INDIRECT; if(!out) { OUT("asn_DFL_%d_set_%" PRIdASN ",\t/* DEFAULT %" PRIdASN " */\n", expr->_type_unique_index, expr->marker.default_value->value.v_integer, expr->marker.default_value->value.v_integer); return 1; } REDIR(OT_STAT_DEFS); OUT("static int asn_DFL_%d_set_%" PRIdASN "(int set_value, void **sptr) {\n", expr->_type_unique_index, expr->marker.default_value->value.v_integer); INDENT(+1); OUT("%s *st = *sptr;\n", asn1c_type_name(arg, expr, TNF_CTYPE)); OUT("\n"); OUT("if(!st) {\n"); OUT("\tif(!set_value) return -1;\t/* Not a default value */\n"); OUT("\tst = (*sptr = CALLOC(1, sizeof(*st)));\n"); OUT("\tif(!st) return -1;\n"); OUT("}\n"); OUT("\n"); OUT("if(set_value) {\n"); INDENT(+1); OUT("/* Install default value %" PRIdASN " */\n", expr->marker.default_value->value.v_integer); if(fits_long) { OUT("*st = "); OINT(expr->marker.default_value->value.v_integer); OUT(";\n"); OUT("return 0;\n"); } else { OUT("return asn_long2INTEGER(st, "); OINT(expr->marker.default_value->value.v_integer); OUT(");\n"); } INDENT(-1); OUT("} else {\n"); INDENT(+1); OUT("/* Test default value %" PRIdASN " */\n", expr->marker.default_value->value.v_integer); if(fits_long) { OUT("return (*st == %" PRIdASN ");\n", expr->marker.default_value->value.v_integer); } else { OUT("long value;\n"); OUT("if(asn_INTEGER2long(st, &value))\n"); OUT("\treturn -1;\n"); OUT("return (value == %" PRIdASN ");\n", expr->marker.default_value->value.v_integer); } INDENT(-1); OUT("}\n"); INDENT(-1); OUT("}\n"); REDIR(save_target); return 1; case ASN_BASIC_NULL: //expr->marker.flags &= ~EM_INDIRECT; return 0; default: if(etype & ASN_STRING_KM_MASK) { if(expr->marker.default_value == NULL || expr->marker.default_value->type != ATV_STRING) break; if(!out) { OUT("asn_DFL_%d_set,\t/* DEFAULT \"%s\" */\n", expr->_type_unique_index, expr->marker.default_value->value.string.buf); return 1; } REDIR(OT_STAT_DEFS); OUT("static int asn_DFL_%d_set(int set_value, void **sptr) {\n", expr->_type_unique_index); INDENT(+1); emit_default_value(arg, expr->marker.default_value); OUT("%s *st = *sptr;\n", asn1c_type_name(arg, expr, TNF_CTYPE)); OUT("\n"); OUT("if(!st) {\n"); OUT("\tif(!set_value) return -1;\t/* Not a default value */\n"); OUT("\tst = (*sptr = CALLOC(1, sizeof(*st)));\n"); OUT("\tif(!st) return -1;\n"); OUT("}\n"); OUT("\n"); OUT("if(set_value) {\n"); INDENT(+1); OUT("uint8_t *ptr = MALLOC(sizeof(defv));\n"); OUT("if(!ptr) return -1;\n"); OUT("memcpy(ptr, &defv, sizeof(defv));\n"); OUT("FREEMEM(st->buf);\n"); OUT("st->buf = ptr;\n"); OUT("st->size = sizeof(defv) - 1;\n"); OUT("return 0;\n"); INDENT(-1); OUT("} else {\n"); INDENT(+1); OUT("if(st->size != (sizeof(defv) - 1)\n"); OUT("|| memcmp(st->buf, &defv, sizeof(defv) - 1))\n"); OUT("\treturn 0;\n"); OUT("return 1;\n"); INDENT(-1); OUT("}\n"); OUT("\n"); INDENT(-1); OUT("}\n"); REDIR(save_target); return 1; } break; } return 0; } static int emit_member_table(arg_t *arg, asn1p_expr_t *expr) { int save_target; arg_t tmp_arg; struct asn1p_type_tag_s outmost_tag_s; struct asn1p_type_tag_s *outmost_tag; int complex_contents; char *p; if(asn1f_fetch_outmost_tag(arg->asn, expr->module, expr, &outmost_tag_s, AFT_IMAGINARY_ANY)) { outmost_tag = 0; } else { outmost_tag = &outmost_tag_s; } OUT("{ "); if(outmost_tag && outmost_tag->tag_value == -1) OUT("ATF_OPEN_TYPE | "); OUT("%s, ", (expr->marker.flags & EM_INDIRECT)?"ATF_POINTER":"ATF_NOFLAGS"); if((expr->marker.flags & EM_OMITABLE) == EM_OMITABLE) { asn1p_expr_t *tv; int opts = 0; for(tv = expr; tv && (tv->marker.flags & EM_OMITABLE) == EM_OMITABLE; tv = TQ_NEXT(tv, next), opts++) { if(tv->expr_type == A1TC_EXTENSIBLE) opts--; } OUT("%d, ", opts); } else { OUT("0, "); } if(expr->_anonymous_type) { assert(arg->expr->expr_type == ASN_CONSTR_SET_OF || arg->expr->expr_type == ASN_CONSTR_SEQUENCE_OF); OUT("0,\n"); } else { OUT("offsetof(struct "); out_name_chain(arg, ONC_avoid_keywords); OUT(", "); if(arg->expr->expr_type == ASN_CONSTR_CHOICE && (!UNNAMED_UNIONS)) OUT("choice."); OUT("%s),\n", MKID_safe(expr)); } INDENT(+1); if(C99_MODE) OUT(".tag = "); if(outmost_tag) { if(outmost_tag->tag_value == -1) OUT("-1 /* Ambiguous tag (ANY?) */"); else _print_tag(arg, outmost_tag); } else { OUT("-1 /* Ambiguous tag (CHOICE?) */"); } OUT(",\n"); if(C99_MODE) OUT(".tag_mode = "); if((!(expr->expr_type & ASN_CONSTR_MASK) || expr->expr_type == ASN_CONSTR_CHOICE) && expr->tag.tag_class) { if(expr->tag.tag_mode == TM_IMPLICIT) OUT("-1,\t/* IMPLICIT tag at current level */\n"); else OUT("+1,\t/* EXPLICIT tag at current level */\n"); } else { OUT("0,\n"); } complex_contents = (expr->expr_type & ASN_CONSTR_MASK) || expr->expr_type == ASN_BASIC_ENUMERATED || (0 /* -- prohibited by X.693:8.3.4 */ && expr->expr_type == ASN_BASIC_INTEGER && expr_elements_count(arg, expr)) || (expr->expr_type == ASN_BASIC_INTEGER && asn1c_type_fits_long(arg, expr) == FL_FITS_UNSIGN); if(C99_MODE) OUT(".type = "); OUT("&asn_DEF_"); if(complex_contents) { OUT("%s", MKID(expr)); if(!(arg->flags & A1C_ALL_DEFS_GLOBAL)) OUT("_%d", expr->_type_unique_index); } else { OUT("%s", asn1c_type_name(arg, expr, TNF_SAFE)); } OUT(",\n"); if(C99_MODE) OUT(".memb_constraints = "); if(expr->constraints) { if(arg->flags & A1C_NO_CONSTRAINTS) { OUT("0,\t/* No check because of -fno-constraints */\n"); } else { char *id = MKID(expr); if(expr->_anonymous_type && !strcmp(expr->Identifier, "Member")) id = asn1c_type_name(arg, expr, TNF_SAFE); OUT("memb_%s_constraint_%d,\n", id, arg->expr->_type_unique_index); } } else { OUT("0,\t/* Defer constraints checking to the member type */\n"); } if(C99_MODE) OUT(".per_constraints = "); if(arg->flags & A1C_GEN_PER) { if(expr->constraints) { OUT("&asn_PER_memb_%s_constr_%d,\n", MKID(expr), expr->_type_unique_index); } else { OUT("0,\t/* No PER visible constraints */\n"); } } else { OUT("0,\t/* PER is not compiled, use -gen-PER */\n"); } if(C99_MODE) OUT(".default_value = "); if(try_inline_default(arg, expr, 0)) { } else { OUT("0,\n"); } if(C99_MODE) OUT(".name = "); if(expr->_anonymous_type && !strcmp(expr->Identifier, "Member")) { OUT("\"\"\n"); } else { OUT("\"%s\"\n", expr->Identifier); } OUT("},\n"); INDENT(-1); if(!expr->constraints || (arg->flags & A1C_NO_CONSTRAINTS)) return 0; save_target = arg->target->target; REDIR(OT_CODE); if(expr->_anonymous_type && !strcmp(expr->Identifier, "Member")) p = asn1c_type_name(arg, expr, TNF_SAFE); else p = MKID(expr); OUT("static int\n"); OUT("memb_%s_constraint_%d(asn_TYPE_descriptor_t *td, const void *sptr,\n", p, arg->expr->_type_unique_index); INDENT(+1); OUT("\t\tasn_app_constraint_failed_f *ctfailcb, void *app_key) {\n"); tmp_arg = *arg; tmp_arg.expr = expr; DEBUG("member constraint checking code for %s", p); if(asn1c_emit_constraint_checking_code(&tmp_arg) == 1) { OUT("return td->check_constraints" "(td, sptr, ctfailcb, app_key);\n"); } INDENT(-1); OUT("}\n"); OUT("\n"); if(emit_member_PER_constraints(arg, expr, "memb")) return -1; REDIR(save_target); return 0; } /* * Generate "asn_DEF_XXX" type definition. */ static int emit_type_DEF(arg_t *arg, asn1p_expr_t *expr, enum tvm_compat tv_mode, int tags_count, int all_tags_count, int elements_count, enum etd_spec spec) { asn1p_expr_t *terminal; int using_type_name = 0; char *p = MKID(expr); terminal = asn1f_find_terminal_type_ex(arg->asn, expr); if(emit_member_PER_constraints(arg, expr, "type")) return -1; if(HIDE_INNER_DEFS) OUT("static /* Use -fall-defs-global to expose */\n"); OUT("asn_TYPE_descriptor_t asn_DEF_%s", p); if(HIDE_INNER_DEFS) OUT("_%d", expr->_type_unique_index); OUT(" = {\n"); INDENT(+1); if(expr->_anonymous_type) { p = ASN_EXPR_TYPE2STR(expr->expr_type); OUT("\"%s\",\n", p?p:""); OUT("\"%s\",\n", p ? asn1c_make_identifier(AMI_CHECK_RESERVED, 0, p, 0) : ""); } else { OUT("\"%s\",\n", expr->Identifier); OUT("\"%s\",\n", expr->Identifier); } if(expr->expr_type & ASN_CONSTR_MASK) { using_type_name = 1; p = asn1c_type_name(arg, arg->expr, TNF_SAFE); } else { p = MKID(expr); } #define FUNCREF(foo) do { \ OUT("%s", p); \ if(HIDE_INNER_DEFS && !using_type_name) \ OUT("_%d", expr->_type_unique_index); \ OUT("_" #foo ",\n"); \ } while(0) FUNCREF(free); FUNCREF(print); FUNCREF(constraint); FUNCREF(decode_ber); FUNCREF(encode_der); FUNCREF(decode_xer); FUNCREF(encode_xer); if(arg->flags & A1C_GEN_PER) { FUNCREF(decode_uper); FUNCREF(encode_uper); } else { OUT("0, 0,\t/* No PER support, " "use \"-gen-PER\" to enable */\n"); } if(!terminal || terminal->expr_type == ASN_CONSTR_CHOICE) { //if(expr->expr_type == ASN_CONSTR_CHOICE) { OUT("CHOICE_outmost_tag,\n"); } else { OUT("0,\t/* Use generic outmost tag fetcher */\n"); } p = MKID(expr); if(tags_count) { OUT("asn_DEF_%s_tags_%d,\n", p, expr->_type_unique_index); OUT("sizeof(asn_DEF_%s_tags_%d)\n", p, expr->_type_unique_index); OUT("\t/sizeof(asn_DEF_%s_tags_%d[0])", p, expr->_type_unique_index); if(tv_mode == _TVM_SUBSET && tags_count != all_tags_count) OUT(" - %d", all_tags_count - tags_count); OUT(", /* %d */\n", tags_count); } else { OUT("0,\t/* No effective tags (pointer) */\n"); OUT("0,\t/* No effective tags (count) */\n"); } if(all_tags_count && tv_mode == _TVM_DIFFERENT) { OUT("asn_DEF_%s_all_tags_%d,\n", p, expr->_type_unique_index); OUT("sizeof(asn_DEF_%s_all_tags_%d)\n", p, expr->_type_unique_index); OUT("\t/sizeof(asn_DEF_%s_all_tags_%d[0]), /* %d */\n", p, expr->_type_unique_index, all_tags_count); } else if(all_tags_count) { OUT("asn_DEF_%s_tags_%d,\t/* Same as above */\n", p, expr->_type_unique_index); OUT("sizeof(asn_DEF_%s_tags_%d)\n", p, expr->_type_unique_index); OUT("\t/sizeof(asn_DEF_%s_tags_%d[0]), /* %d */\n", p, expr->_type_unique_index, all_tags_count); } else { OUT("0,\t/* No tags (pointer) */\n"); OUT("0,\t/* No tags (count) */\n"); } if(arg->flags & A1C_GEN_PER) { if(expr->constraints || expr->expr_type == ASN_BASIC_ENUMERATED || expr->expr_type == ASN_CONSTR_CHOICE) { OUT("&asn_PER_type_%s_constr_%d,\n", p, expr->_type_unique_index); } else { OUT("0,\t/* No PER visible constraints */\n"); } } else { OUT("0,\t/* No PER visible constraints */\n"); } if(elements_count) { OUT("asn_MBR_%s_%d,\n", p, expr->_type_unique_index); if(expr->expr_type == ASN_CONSTR_SEQUENCE_OF || expr->expr_type == ASN_CONSTR_SET_OF) { OUT("%d,\t/* Single element */\n", elements_count); assert(elements_count == 1); } else { OUT("%d,\t/* Elements count */\n", elements_count); } } else { if(expr_elements_count(arg, expr)) OUT("0, 0,\t/* Defined elsewhere */\n"); else OUT("0, 0,\t/* No members */\n"); } switch(spec) { case ETD_NO_SPECIFICS: OUT("0\t/* No specifics */\n"); break; case ETD_HAS_SPECIFICS: OUT("&asn_SPC_%s_specs_%d\t/* Additional specs */\n", p, expr->_type_unique_index); } INDENT(-1); OUT("};\n"); OUT("\n"); return 0; } static int expr_as_xmlvaluelist(arg_t *arg, asn1p_expr_t *expr) { /* * X.680, 25.5, Table 5 */ switch(expr_get_type(arg, expr)) { case ASN_BASIC_BOOLEAN: case ASN_BASIC_ENUMERATED: case ASN_BASIC_NULL: return 1; case ASN_CONSTR_CHOICE: return 2; default: return 0; } } static int out_name_chain(arg_t *arg, enum onc_flags onc_flags) { asn1p_expr_t *expr = arg->expr; char *id; assert(expr->Identifier); if((arg->flags & A1C_COMPOUND_NAMES || onc_flags & ONC_force_compound_name) && ((expr->expr_type & ASN_CONSTR_MASK) || expr->expr_type == ASN_BASIC_ENUMERATED || ((expr->expr_type == ASN_BASIC_INTEGER || expr->expr_type == ASN_BASIC_BIT_STRING) && expr_elements_count(arg, expr)) ) && expr->parent_expr && expr->parent_expr->Identifier) { arg_t tmparg = *arg; tmparg.expr = expr->parent_expr; if(0) tmparg.flags &= ~A1C_COMPOUND_NAMES; out_name_chain(&tmparg, onc_flags); OUT("__"); /* a separator between id components */ /* Fall through */ } if(onc_flags & ONC_avoid_keywords) id = MKID_safe(expr); else id = MKID(expr); OUT("%s", id); return 0; } static int emit_include_dependencies(arg_t *arg) { asn1p_expr_t *expr = arg->expr; asn1p_expr_t *memb; /* Avoid recursive definitions. */ TQ_FOR(memb, &(expr->members), next) { expr_break_recursion(arg, memb); } TQ_FOR(memb, &(expr->members), next) { if(memb->marker.flags & (EM_INDIRECT | EM_UNRECURSE)) { if(terminal_structable(arg, memb)) { int saved_target = arg->target->target; REDIR(OT_FWD_DECLS); OUT("%s;\n", asn1c_type_name(arg, memb, TNF_RSAFE)); REDIR(saved_target); } } if((!(memb->expr_type & ASN_CONSTR_MASK) && memb->expr_type > ASN_CONSTR_MASK) || memb->meta_type == AMT_TYPEREF) { if(memb->marker.flags & EM_UNRECURSE) { GEN_POSTINCLUDE(asn1c_type_name(arg, memb, TNF_INCLUDE)); } else { GEN_INCLUDE(asn1c_type_name(arg, memb, TNF_INCLUDE)); } } } return 0; } /* * Check if it is better to make this type indirectly accessed via * a pointer. * This may be the case for the following recursive definition: * Type ::= CHOICE { member Type }; */ static int expr_break_recursion(arg_t *arg, asn1p_expr_t *expr) { int ret; if(expr->marker.flags & EM_UNRECURSE) return 1; /* Already broken */ /* -findirect-choice compiles members of CHOICE as indirect pointers */ if((arg->flags & A1C_INDIRECT_CHOICE) && arg->expr->expr_type == ASN_CONSTR_CHOICE && (expr_get_type(arg, expr) & ASN_CONSTR_MASK) ) { /* Break cross-reference */ expr->marker.flags |= EM_INDIRECT | EM_UNRECURSE; return 1; } if((expr->marker.flags & EM_INDIRECT) || arg->expr->expr_type == ASN_CONSTR_SET_OF || arg->expr->expr_type == ASN_CONSTR_SEQUENCE_OF) { if(terminal_structable(arg, expr)) { expr->marker.flags |= EM_UNRECURSE; if(arg->expr->expr_type == ASN_CONSTR_SET_OF || arg->expr->expr_type == ASN_CONSTR_SEQUENCE_OF) { /* Don't put EM_INDIRECT even if recursion */ return 1; } /* Fall through */ } } /* Look for recursive back-references */ ret = expr_defined_recursively(arg, expr); switch(ret) { case 2: /* Explicitly break the recursion */ case 1: /* Use safer typing */ expr->marker.flags |= EM_INDIRECT; expr->marker.flags |= EM_UNRECURSE; break; } return 0; } /* * Check if the type can be represented using simple `struct TYPE`. */ static asn1p_expr_t * terminal_structable(arg_t *arg, asn1p_expr_t *expr) { asn1p_expr_t *terminal = asn1f_find_terminal_type_ex(arg->asn, expr); if(terminal && !terminal->parent_expr && (terminal->expr_type & ASN_CONSTR_MASK)) { return terminal; } return 0; } static int asn1c_recurse(arg_t *arg, asn1p_expr_t *expr, int (*callback)(arg_t *arg, void *key), void *key) { arg_t tmp = *arg; int maxret = 0; int ret; if(expr->_mark) return 0; expr->_mark |= TM_RECURSION; /* Invoke callback for every type going into recursion */ tmp.expr = expr; maxret = callback(&tmp, key); if(maxret <= 1) { /* * Recursively invoke myself and the callbacks. */ TQ_FOR(tmp.expr, &(expr->members), next) { ret = asn1c_recurse(&tmp, tmp.expr, callback, key); if(ret > maxret) maxret = ret; if(maxret > 1) break; } } expr->_mark &= ~TM_RECURSION; return maxret; } static int check_is_refer_to(arg_t *arg, void *key) { asn1p_expr_t *terminal = terminal_structable(arg, arg->expr); if(terminal == key) { if(arg->expr->marker.flags & EM_INDIRECT) return 1; /* This is almost safe indirection */ return 2; } else if(terminal) { /* This might be N-step circular loop. Dive into it. */ return asn1c_recurse(arg, terminal, check_is_refer_to, key); } return 0; } /* * Check if the possibly inner expression defined recursively. */ static int expr_defined_recursively(arg_t *arg, asn1p_expr_t *expr) { asn1p_expr_t *terminal; asn1p_expr_t *topmost; /* If expression is top-level, there's no way it can be recursive. */ if(expr->parent_expr == 0) return 0; if(expr->expr_type != A1TC_REFERENCE) return 0; /* Basic types are never recursive */ terminal = terminal_structable(arg, expr); if(!terminal) return 0; /* Terminal cannot be indirected */ /* Search for the parent container for the given expression */ topmost = expr; while(topmost->parent_expr) topmost = topmost->parent_expr; /* Look inside the terminal type if it mentions the parent expression */ return asn1c_recurse(arg, terminal, check_is_refer_to, topmost); } struct canonical_map_element { int eidx; asn1p_expr_t *expr; }; static int compar_cameo(const void *ap, const void *bp); static arg_t *cameo_arg; static int * compute_canonical_members_order(arg_t *arg, int el_count) { struct canonical_map_element *cmap; int *rmap; asn1p_expr_t *v; int eidx = 0; int ext_start = -1; int nextmax = -1; int already_sorted = 1; cmap = calloc(el_count, sizeof *cmap); assert(cmap); TQ_FOR(v, &(arg->expr->members), next) { if(v->expr_type != A1TC_EXTENSIBLE) { cmap[eidx].eidx = eidx; cmap[eidx].expr = v; eidx++; } else if(ext_start == -1) ext_start = eidx; } cameo_arg = arg; if(ext_start == -1) { /* Sort the whole thing */ qsort(cmap, el_count, sizeof(*cmap), compar_cameo); } else { /* Sort root and extensions independently */ qsort(cmap, ext_start, sizeof(*cmap), compar_cameo); qsort(cmap + ext_start, el_count - ext_start, sizeof(*cmap), compar_cameo); } /* move data back to a simpler map */ rmap = calloc(el_count, sizeof *rmap); assert(rmap); for(eidx = 0; eidx < el_count; eidx++) { rmap[eidx] = cmap[eidx].eidx; if(rmap[eidx] <= nextmax) already_sorted = 0; else nextmax = rmap[eidx]; } free(cmap); if(already_sorted) { free(rmap); rmap = 0; } return rmap; } static int compar_cameo(const void *ap, const void *bp) { const struct canonical_map_element *a = (const void *)ap; const struct canonical_map_element *b = (const void *)bp; struct asn1p_type_tag_s atag, btag; arg_t *arg = cameo_arg; if(asn1f_fetch_outmost_tag(arg->asn, a->expr->module, a->expr, &atag, AFT_IMAGINARY_ANY | AFT_CANON_CHOICE)) return 1; if(asn1f_fetch_outmost_tag(arg->asn, b->expr->module, b->expr, &btag, AFT_IMAGINARY_ANY | AFT_CANON_CHOICE)) return -1; if(atag.tag_class < btag.tag_class) return -1; if(atag.tag_class > btag.tag_class) return 1; if(atag.tag_value < btag.tag_value) return -1; if(atag.tag_value > btag.tag_value) return 1; return 0; } asn1c-0.9.28+dfsg/libasn1compiler/asn1c_out.h0000644000000000000000000000732413065714043017376 0ustar rootroot#ifndef ASN1_COMPILED_OUTPUT_H #define ASN1_COMPILED_OUTPUT_H /* * An elementary chunk of target language text. */ typedef struct out_chunk { char *buf; int len; TQ_ENTRY(struct out_chunk) next; } out_chunk_t; typedef struct compiler_streams { enum { OT_IGNORE, /* Ignore this output */ OT_INCLUDES, /* #include files */ OT_DEPS, /* Dependencies (other than #includes) */ OT_FWD_DECLS, /* Forward declarations */ OT_TYPE_DECLS, /* Type declarations */ OT_FUNC_DECLS, /* Function declarations */ OT_POST_INCLUDE,/* #include after type definition */ OT_CTABLES, /* Constraint tables */ OT_CODE, /* Some code */ OT_CTDEFS, /* Constraint definitions */ OT_STAT_DEFS, /* Static definitions */ OT_MAX } target; struct compiler_stream_destination_s { TQ_HEAD(out_chunk_t) chunks; int indent_level; int indented; } destination[OT_MAX]; } compiler_streams_t; static char *_compiler_stream2str[] __attribute__ ((unused)) = { "IGNORE", "INCLUDES", "DEPS", "FWD-DECLS", "TYPE-DECLS", "FUNC-DECLS", "POST-INCLUDE", "CTABLES", "CODE", "CTDEFS", "STAT-DEFS" }; int asn1c_compiled_output(arg_t *arg, const char *fmt, ...); /***************************************************************** * Useful macros for invoking asn1c_compiled_output() and friends. */ /* Redirect output to a different stream. */ #define REDIR(foo) do { arg->target->target = foo; } while(0) #define INDENT_LEVEL \ arg->target->destination[arg->target->target].indent_level #define INDENT(val) INDENT_LEVEL += (val) #define INDENTED(code) do { \ INDENT(+1); \ do { code; } while(0); \ INDENT(-1); \ } while(0) #define EMBED(ev) do { \ int saved_target = arg->target->target; \ REDIR(OT_TYPE_DECLS); \ arg->embed++; \ INDENTED(arg_t _tmp = *arg; \ _tmp.expr = ev; \ _tmp.default_cb(&_tmp); \ ); \ arg->embed--; \ if(ev->expr_type != A1TC_EXTENSIBLE) \ OUT(";\n"); \ assert(arg->target->target == OT_TYPE_DECLS); \ REDIR(saved_target); \ } while(0) /* Output a piece of text into a default stream */ #define OUT(fmt, args...) asn1c_compiled_output(arg, fmt, ##args) #define OUT_NOINDENT(fmt, args...) do { \ int _saved_indent = INDENT_LEVEL; \ INDENT_LEVEL = 0; \ OUT(fmt, ##args); \ INDENT_LEVEL = _saved_indent; \ } while(0) #define OUT_DEBUG(fmt, args...) do { \ if(arg->flags & A1C_DEBUG) OUT(fmt, ##args); \ } while(0) /* Generate #include line */ #define GEN_INCLUDE_STD(typename) do { \ if((arg->flags & A1C_INCLUDES_QUOTED)) { \ GEN_INCLUDE("\"" typename ".h\""); \ } else { \ GEN_INCLUDE("<" typename ".h>"); \ } } while(0) #define GEN_INCLUDE(filename) do { \ int saved_target = arg->target->target; \ if(!filename) break; \ REDIR(OT_INCLUDES); \ OUT_NOINDENT("#include %s\n", filename); \ REDIR(saved_target); \ } while(0) #define GEN_POSTINCLUDE(filename) do { \ int saved_target = arg->target->target; \ if(!filename) break; \ REDIR(OT_POST_INCLUDE); \ OUT_NOINDENT("#include %s\n", filename); \ REDIR(saved_target); \ } while(0) /* Generate ASN.1 type declaration */ #define GEN_DECLARE(expr) do { \ int saved_target = arg->target->target; \ REDIR(OT_FUNC_DECLS); \ OUT_NOINDENT("extern asn_TYPE_descriptor_t " \ "asn_DEF_%s;\n", MKID(expr)); \ REDIR(saved_target); \ } while(0) /* * Format LONG_MIN according to C90 rules. */ #define OINT(iv) do { \ if(iv == (-2147483647L - 1)) \ OUT("(-2147483647L - 1)"); \ else \ OUT("%" PRIdASN, iv); \ } while(0) #define OINTS(iv) do { \ if(iv == (-2147483647L - 1)) \ OUT("(-2147483647L - 1)"); \ else \ OUT("% " PRIdASN, iv); \ } while(0) #endif /* ASN1_COMPILED_OUTPUT_H */ asn1c-0.9.28+dfsg/libasn1compiler/asn1c_compat.c0000644000000000000000000000760713065714043020051 0ustar rootroot#include "asn1c_internal.h" #include "asn1c_compat.h" #ifndef MAXPATHLEN #define MAXPATHLEN 1024 #endif /* Normally file permissions are (DEFFILEMODE & ~umask(2)) */ #ifndef DEFFILEMODE /* Normally in */ #ifdef _WIN32 #define DEFFILEMODE (S_IREAD|S_IWRITE) #define REASONABLE_FILE_MODE DEFFILEMODE #else #define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) #define REASONABLE_FILE_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH) #endif #else /* !DEFFILEMODE */ #ifdef _WIN32 #define REASONABLE_FILE_MODE DEFFILEMODE #else #define REASONABLE_FILE_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH) #endif #endif #ifdef _WIN32 int mkstemp(char *template) { char *tmpFN = _mktemp(template); if(tmpFN) return open(tmpFN, O_CREAT | O_EXCL | O_WRONLY, DEFFILEMODE); else return -1; } #undef HAVE_MKSTEMPS #endif #ifdef HAVE_MKSTEMPS #undef mkstemp #define mkstemp(foo) mkstemps(foo, 0) #endif FILE * asn1c_open_file(const char *name, const char *ext, char **opt_tmpname) { int created = 1; #ifndef _WIN32 struct stat sb; #endif char *fname; size_t len; FILE *fp; int ret; int fd; /* * Compute filenames. */ len = strlen(name) + strlen(ext) + sizeof(".XXXXXX"); fname = alloca(len); ret = snprintf(fname, len, "%s%s%s", name, ext, opt_tmpname ? ".XXXXXX" : ""); assert(ret > 0 && ret < (ssize_t)len); if(opt_tmpname) { /* * Create temporary file. */ fd = mkstemp(fname); #ifndef _WIN32 /* fchmod() does not respect umask */ (void)fchmod(fd, REASONABLE_FILE_MODE); #endif } else { /* * Create specified file, or open the old one. */ fd = open(fname, O_CREAT | O_EXCL | O_WRONLY, DEFFILEMODE); if(fd == -1 && errno == EEXIST) { fd = open(fname, O_WRONLY, DEFFILEMODE); created = 0; } } if(fd == -1) { perror(fname); return NULL; } #ifndef _WIN32 /* * Check sanity. */ if(fstat(fd, &sb) || !S_ISREG(sb.st_mode)) { fprintf(stderr, "%s: Not a regular file\n", fname); if(created) unlink(fname); close(fd); return NULL; } if(ftruncate(fd, 0) == -1) { fprintf(stderr, "%s: ftruncate failed: %s\n", fname, strerror(errno)); if(created) unlink(fname); return NULL; } #else _chsize(fd, 0); #endif /* _WIN32 */ /* * Convert file descriptor into file pointer. */ fp = fdopen(fd, "w"); if(fp == NULL) { if(created) unlink(fname); close(fd); return NULL; } /* Return the temporary file name */ if(opt_tmpname) { *opt_tmpname = strdup(fname); if(*opt_tmpname) { /* Successfull */ } else { if(created) unlink(fname); fclose(fp); return NULL; } } return fp; } char * a1c_basename(const char *path) { static char strbuf[MAXPATHLEN]; const char *pend; const char *name; pend = path + strlen(path); if(pend == path) { strcpy(strbuf, "."); return strbuf; } /* Skip tailing slashes */ for(pend--; pend > path && *pend == '/'; pend--); if(pend == path && *path == '/') { strcpy(strbuf, "/"); return strbuf; } for(name = pend; name > path && name[-1] != '/'; name--); if((pend - name) >= (int)sizeof(strbuf) - 1) { errno = ENAMETOOLONG; return 0; } memcpy(strbuf, name, pend - name + 1); strbuf[pend - name + 1] = '\0'; return strbuf; } char * a1c_dirname(const char *path) { static char strbuf[MAXPATHLEN]; const char *pend; const char *last = 0; int in_slash = 0; /* One-pass determination of the last char of the pathname */ for(pend = path; ; pend++) { switch(*pend) { case '\0': break; case '/': if(!in_slash) { last = pend; in_slash = 1; } continue; default: if(in_slash) in_slash = 0; continue; } break; } if(last <= path) { strcpy(strbuf, *path == '/' ? "/" : "."); return strbuf; } if(!last) { strcpy(strbuf, "/"); return strbuf; } if((last - path) >= (int)sizeof(strbuf)) { errno = ENAMETOOLONG; return 0; } memcpy(strbuf, path, last - path); strbuf[last - path] = '\0'; return strbuf; } asn1c-0.9.28+dfsg/libasn1compiler/asn1c_compat.h0000644000000000000000000000114113065714043020041 0ustar rootroot#ifndef ASN1C_COMPAT_H #define ASN1C_COMPAT_H /* * Open the arbitrary file by its base name and extension. * If opt_tmpname is given, a temporary file will be created and * its name returned in (*opt_tmpname). * The (*opt_tmpname) should then be subsequently freed by free(3). */ FILE *asn1c_open_file(const char *base_part, const char *extension, char **opt_tmpname); /* * Obtain base name and directory name of a path. * Some systems have them in as dirname(3) and basename(3). */ char *a1c_basename(const char *path); char *a1c_dirname(const char *path); #endif /* ASN1C_COMPAT_H */ asn1c-0.9.28+dfsg/libasn1compiler/asn1c_constraint.c0000644000000000000000000004345413065714043020752 0ustar rootroot#include "asn1c_internal.h" #include "asn1c_constraint.h" #include "asn1c_misc.h" #include "asn1c_out.h" #include /* constraint groker from libasn1fix */ #include /* other exportables from libasn1fix */ static int asn1c_emit_constraint_tables(arg_t *arg, int got_size); static int emit_alphabet_check_loop(arg_t *arg, asn1cnst_range_t *range); static int emit_value_determination_code(arg_t *arg, asn1p_expr_type_e etype, asn1cnst_range_t *r_value); static int emit_size_determination_code(arg_t *arg, asn1p_expr_type_e etype); static asn1p_expr_type_e _find_terminal_type(arg_t *arg); static int emit_range_comparison_code(arg_t *arg, asn1cnst_range_t *range, const char *varname, asn1c_integer_t natural_start, asn1c_integer_t natural_stop); static int native_long_sign(asn1cnst_range_t *r); /* -1, 0, 1 */ static int ulong_optimization(asn1p_expr_type_e etype, asn1cnst_range_t *r_size, asn1cnst_range_t *r_value) { return (!r_size && r_value && (etype == ASN_BASIC_INTEGER || etype == ASN_BASIC_ENUMERATED) && native_long_sign(r_value) == 0); } int asn1c_emit_constraint_checking_code(arg_t *arg) { asn1cnst_range_t *r_size; asn1cnst_range_t *r_value; asn1p_expr_t *expr = arg->expr; asn1p_expr_type_e etype; asn1p_constraint_t *ct; int got_something = 0; int alphabet_table_compiled; int produce_st = 0; int ulong_optimize = 0; ct = expr->combined_constraints; if(ct == NULL) return 1; /* No additional constraints defined */ etype = _find_terminal_type(arg); r_value=asn1constraint_compute_PER_range(etype, ct, ACT_EL_RANGE,0,0,0); r_size =asn1constraint_compute_PER_range(etype, ct, ACT_CT_SIZE, 0,0,0); if(r_value) { if(r_value->incompatible || r_value->empty_constraint || (r_value->left.type == ARE_MIN && r_value->right.type == ARE_MAX) || (etype == ASN_BASIC_BOOLEAN && r_value->left.value == 0 && r_value->right.value == 1) ) { asn1constraint_range_free(r_value); r_value = 0; } } if(r_size) { if(r_size->incompatible || r_size->empty_constraint || (r_size->left.value == 0 /* or .type == MIN */ && r_size->right.type == ARE_MAX) ) { asn1constraint_range_free(r_size); r_size = 0; } } /* * Do we really need an "*st = sptr" pointer? */ switch(etype) { case ASN_BASIC_INTEGER: case ASN_BASIC_ENUMERATED: if(asn1c_type_fits_long(arg, arg->expr) == FL_NOTFIT) produce_st = 1; break; case ASN_BASIC_REAL: if((arg->flags & A1C_USE_WIDE_TYPES)) produce_st = 1; break; case ASN_BASIC_BIT_STRING: case ASN_BASIC_OCTET_STRING: produce_st = 1; break; default: if(etype & ASN_STRING_MASK) produce_st = 1; break; } if(produce_st) { char *tname = asn1c_type_name(arg, arg->expr, TNF_SAFE); OUT("const %s_t *st = (const %s_t *)sptr;\n", tname, tname); } if(r_size || r_value) { if(r_size) { OUT("size_t size;\n"); } if(r_value) switch(etype) { case ASN_BASIC_INTEGER: case ASN_BASIC_ENUMERATED: if(native_long_sign(r_value) >= 0) { ulong_optimize = ulong_optimization(etype, r_size, r_value); if(!ulong_optimize) { OUT("unsigned long value;\n"); } } else { OUT("long value;\n"); } break; case ASN_BASIC_REAL: OUT("double value;\n"); break; case ASN_BASIC_BOOLEAN: OUT("BOOLEAN_t value;\n"); break; default: break; } } OUT("\n"); /* * Protection against null input. */ OUT("if(!sptr) {\n"); INDENT(+1); OUT("ASN__CTFAIL(app_key, td, sptr,\n"); OUT("\t\"%%s: value not given (%%s:%%d)\",\n"); OUT("\ttd->name, __FILE__, __LINE__);\n"); OUT("return -1;\n"); INDENT(-1); OUT("}\n"); OUT("\n"); if((r_value) && (!ulong_optimize)) emit_value_determination_code(arg, etype, r_value); if(r_size) emit_size_determination_code(arg, etype); INDENT(-1); REDIR(OT_CTABLES); /* Emit FROM() tables */ alphabet_table_compiled = (asn1c_emit_constraint_tables(arg, r_size?1:0) == 1); REDIR(OT_CODE); INDENT(+1); /* * Optimization for unsigned longs. */ if(ulong_optimize) { OUT("\n"); OUT("/* Constraint check succeeded */\n"); OUT("return 0;\n"); return 0; } /* * Here is an if() {} else {} consrtaint checking code. */ OUT("\n"); OUT("if("); INDENT(+1); if(r_size) { if(got_something++) { OUT("\n"); OUT(" && "); } OUT("("); emit_range_comparison_code(arg, r_size, "size", 0, -1); OUT(")"); } if(r_value) { if(got_something++) { OUT("\n"); OUT(" && "); } OUT("("); if(etype == ASN_BASIC_BOOLEAN) emit_range_comparison_code(arg, r_value, "value", 0, 1); else emit_range_comparison_code(arg, r_value, "value", -1, -1); OUT(")"); } if(alphabet_table_compiled) { if(got_something++) { OUT("\n"); OUT(" && "); } OUT("!check_permitted_alphabet_%d(%s)", arg->expr->_type_unique_index, produce_st ? "st" : "sptr"); } if(!got_something) { OUT("1 /* No applicable constraints whatsoever */"); OUT(") {\n"); INDENT(-1); INDENTED(OUT("/* Nothing is here. See below */\n")); OUT("}\n"); OUT("\n"); return 1; } INDENT(-1); OUT(") {\n"); INDENT(+1); switch(etype) { case ASN_CONSTR_SEQUENCE_OF: case ASN_CONSTR_SET_OF: OUT("/* Perform validation of the inner elements */\n"); OUT("return td->check_constraints(td, sptr, ctfailcb, app_key);\n"); break; default: OUT("/* Constraint check succeeded */\n"); OUT("return 0;\n"); } INDENT(-1); OUT("} else {\n"); INDENT(+1); OUT("ASN__CTFAIL(app_key, td, sptr,\n"); OUT("\t\"%%s: constraint failed (%%s:%%d)\",\n"); OUT("\ttd->name, __FILE__, __LINE__);\n"); OUT("return -1;\n"); INDENT(-1); OUT("}\n"); return 0; } static int asn1c_emit_constraint_tables(arg_t *arg, int got_size) { asn1c_integer_t range_start; asn1c_integer_t range_stop; asn1p_expr_type_e etype; asn1cnst_range_t *range; asn1p_constraint_t *ct; int utf8_full_alphabet_check = 0; int max_table_size = 256; int table[256]; int use_table; ct = arg->expr->combined_constraints; if(!ct) return 0; etype = _find_terminal_type(arg); range = asn1constraint_compute_PER_range(etype, ct, ACT_CT_FROM, 0,0,0); if(!range) return 0; if(range->incompatible || range->empty_constraint) { asn1constraint_range_free(range); return 0; } if(range->left.type == ARE_MIN && range->right.type == ARE_MAX) { /* * The permitted alphabet constraint checker code guarantees * that either both bounds (left/right) are present, or * they're absent simultaneously. Thus, this assertion * legitimately holds true. */ assert(range->el_count == 0); /* The full range is specified. Ignore it. */ return 0; } range_start = range->left.value; range_stop = range->right.value; assert(range->left.type == ARE_VALUE); assert(range->right.type == ARE_VALUE); assert(range_start <= range_stop); range_start = 0; /* Force old behavior */ /* * Check if we need a test table to check the alphabet. */ use_table = 1; if(range->el_count == 0) { /* * It's better to have a short if() check * than waste 1k of table space */ use_table = 0; } if((range_stop - range_start) > 255) use_table = 0; if(etype == ASN_STRING_UTF8String) { if(range_stop >= 0x80) use_table = 0; else max_table_size = 128; } if(use_table) { int cardinal = 0; int i, n = 0; int untl; memset(table, 0, sizeof(table)); for(i = -1; i < range->el_count; i++) { asn1cnst_range_t *r; asn1c_integer_t v; if(i == -1) { if(range->el_count) continue; r = range; } else { r = range->elements[i]; } for(v = r->left.value; v <= r->right.value; v++) { assert((v - range_start) >= 0); assert((v - range_start) < max_table_size); table[v - range_start] = ++n; } } untl = (range_stop - range_start) + 1; untl += (untl % 16)?16 - (untl % 16):0; OUT("static const int permitted_alphabet_table_%d[%d] = {\n", arg->expr->_type_unique_index, max_table_size); for(n = 0; n < untl; n++) { cardinal += table[n] ? 1 : 0; OUT("%2d,", table[n]); if(!((n+1) % 16)) { int c; if(!n || (n-15) + range_start >= 0x80) { OUT("\n"); continue; } OUT("\t/* "); for(c = n - 15; c <= n; c++) { if(table[c]) { int a = c + range_start; if(a > 0x20 && a < 0x80) OUT("%c", a); else OUT("."); } else { OUT(" "); } } OUT(" */"); OUT("\n"); } } OUT("};\n"); if((arg->flags & A1C_GEN_PER) && (etype & ASN_STRING_KM_MASK)) { int c; OUT("static const int permitted_alphabet_code2value_%d[%d] = {\n", arg->expr->_type_unique_index, cardinal); for(n = c = 0; c < max_table_size; c++) { if(table[c]) { OUT("%d,", c); if(!((++n) % 16)) OUT("\n"); } } OUT("};\n"); OUT("\n"); DEBUG("code2value map gen for %s", arg->expr->Identifier); arg->expr->_mark |= TM_PERFROMCT; } OUT("\n"); } else if(etype == ASN_STRING_UTF8String) { /* * UTF8String type is a special case in many respects. */ if(got_size) { /* * Size has been already determined. * The UTF8String length checker also checks * for the syntax validity, so we don't have * to repeat this process twice. */ asn1constraint_range_free(range); return 0; } else { utf8_full_alphabet_check = 1; } } else { /* * This permitted alphabet check will be * expressed using conditional statements * instead of table lookups. Table would be * to large or otherwise inappropriate (too sparse?). */ } OUT("static int check_permitted_alphabet_%d(const void *sptr) {\n", arg->expr->_type_unique_index); INDENT(+1); if(utf8_full_alphabet_check) { OUT("if(UTF8String_length((const UTF8String_t *)sptr) < 0)\n"); OUT("\treturn -1; /* Alphabet (sic!) test failed. */\n"); OUT("\n"); } else { if(use_table) { OUT("const int *table = permitted_alphabet_table_%d;\n", arg->expr->_type_unique_index); emit_alphabet_check_loop(arg, 0); } else { emit_alphabet_check_loop(arg, range); } } OUT("return 0;\n"); INDENT(-1); OUT("}\n"); OUT("\n"); asn1constraint_range_free(range); return 1; } static int emit_alphabet_check_loop(arg_t *arg, asn1cnst_range_t *range) { asn1c_integer_t natural_stop; asn1p_expr_t *terminal; char *tname; terminal = asn1f_find_terminal_type_ex(arg->asn, arg->expr); if(terminal) { OUT("/* The underlying type is %s */\n", ASN_EXPR_TYPE2STR(terminal->expr_type)); } else { terminal = arg->expr; } tname = asn1c_type_name(arg, terminal, TNF_SAFE); OUT("const %s_t *st = (const %s_t *)sptr;\n", tname, tname); switch(terminal->expr_type) { case ASN_STRING_UTF8String: OUT("const uint8_t *ch = st->buf;\n"); OUT("const uint8_t *end = ch + st->size;\n"); OUT("\n"); OUT("for(; ch < end; ch++) {\n"); INDENT(+1); OUT("uint8_t cv = *ch;\n"); if(!range) OUT("if(cv >= 0x80) return -1;\n"); natural_stop = 0xffffffffUL; break; case ASN_STRING_UniversalString: OUT("const uint8_t *ch = st->buf;\n"); OUT("const uint8_t *end = ch + st->size;\n"); OUT("\n"); OUT("if(st->size %% 4) return -1; /* (size%%4)! */\n"); OUT("for(; ch < end; ch += 4) {\n"); INDENT(+1); OUT("uint32_t cv = (ch[0] << 24)\n"); OUT("\t\t| (ch[1] << 16)\n"); OUT("\t\t| (ch[2] << 8)\n"); OUT("\t\t| ch[3];\n"); if(!range) OUT("if(cv > 255) return -1;\n"); natural_stop = 0xffffffffUL; break; case ASN_STRING_BMPString: OUT("const uint8_t *ch = st->buf;\n"); OUT("const uint8_t *end = ch + st->size;\n"); OUT("\n"); OUT("if(st->size %% 2) return -1; /* (size%%2)! */\n"); OUT("for(; ch < end; ch += 2) {\n"); INDENT(+1); OUT("uint16_t cv = (ch[0] << 8)\n"); OUT("\t\t| ch[1];\n"); if(!range) OUT("if(cv > 255) return -1;\n"); natural_stop = 0xffff; break; case ASN_BASIC_OCTET_STRING: default: OUT("const uint8_t *ch = st->buf;\n"); OUT("const uint8_t *end = ch + st->size;\n"); OUT("\n"); OUT("for(; ch < end; ch++) {\n"); INDENT(+1); OUT("uint8_t cv = *ch;\n"); natural_stop = 0xff; break; } if(range) { OUT("if(!("); emit_range_comparison_code(arg, range, "cv", 0, natural_stop); OUT(")) return -1;\n"); } else { OUT("if(!table[cv]) return -1;\n"); } INDENT(-1); OUT("}\n"); return 0; } static int emit_range_comparison_code(arg_t *arg, asn1cnst_range_t *range, const char *varname, asn1c_integer_t natural_start, asn1c_integer_t natural_stop) { int ignore_left; int ignore_right; int generated_something = 0; int i; for(i = -1; i < range->el_count; i++) { asn1cnst_range_t *r; if(i == -1) { if(range->el_count) continue; r = range; } else { if(i) OUT(" || "); r = range->elements[i]; } if(r != range) OUT("("); ignore_left = (r->left.type == ARE_MIN) || (natural_start != -1 && r->left.value <= natural_start); ignore_right = (r->right.type == ARE_MAX) || (natural_stop != -1 && r->right.value >= natural_stop); if(ignore_left && ignore_right) { OUT("1 /* Constraint matches natural range of %s */", varname); continue; } if(ignore_left) { OUT("%s <= ", varname); OINT(r->right.value); } else if(ignore_right) { OUT("%s >= ", varname); OINT(r->left.value); } else if(r->left.value == r->right.value) { OUT("%s == ", varname); OINT(r->right.value); } else { OUT("%s >= ", varname); OINT(r->left.value); OUT(" && "); OUT("%s <= ", varname); OINT(r->right.value); } if(r != range) OUT(")"); generated_something = 1; } return generated_something; } static int emit_size_determination_code(arg_t *arg, asn1p_expr_type_e etype) { switch(etype) { case ASN_BASIC_BIT_STRING: OUT("if(st->size > 0) {\n"); OUT("\t/* Size in bits */\n"); OUT("\tsize = 8 * st->size - (st->bits_unused & 0x07);\n"); OUT("} else {\n"); OUT("\tsize = 0;\n"); OUT("}\n"); break; case ASN_STRING_UniversalString: OUT("size = st->size >> 2;\t/* 4 byte per character */\n"); break; case ASN_STRING_BMPString: OUT("size = st->size >> 1;\t/* 2 byte per character */\n"); break; case ASN_STRING_UTF8String: OUT("size = UTF8String_length(st);\n"); OUT("if((ssize_t)size < 0) {\n"); OUT("\tASN__CTFAIL(app_key, td, sptr,\n"); OUT("\t\t\"%%s: UTF-8: broken encoding (%%s:%%d)\",\n"); OUT("\t\ttd->name, __FILE__, __LINE__);\n"); OUT("\treturn -1;\n"); OUT("}\n"); break; case ASN_CONSTR_SET_OF: case ASN_CONSTR_SEQUENCE_OF: OUT("/* Determine the number of elements */\n"); OUT("size = _A_C%s_FROM_VOID(sptr)->count;\n", etype==ASN_CONSTR_SET_OF?"SET":"SEQUENCE"); break; case ASN_BASIC_OCTET_STRING: OUT("size = st->size;\n"); break; default: if(etype & ASN_STRING_MASK) { OUT("size = st->size;\n"); break; } else { const char *type_name = ASN_EXPR_TYPE2STR(etype); if(!type_name) type_name = arg->expr->Identifier; WARNING("SizeConstraint is not defined for %s", type_name); OUT_NOINDENT("#warning SizeConstraint " "is not defined for %s!\n", type_name); OUT("size = st->size;\n"); } return -1; } return 0; } static int emit_value_determination_code(arg_t *arg, asn1p_expr_type_e etype, asn1cnst_range_t *r_value) { switch(etype) { case ASN_BASIC_INTEGER: case ASN_BASIC_ENUMERATED: if(asn1c_type_fits_long(arg, arg->expr) == FL_FITS_UNSIGN) { OUT("value = *(const unsigned long *)sptr;\n"); } else if(asn1c_type_fits_long(arg, arg->expr) != FL_NOTFIT) { OUT("value = *(const long *)sptr;\n"); } else { /* * In some cases we can explore our knowledge of * underlying INTEGER_t->buf format. */ if(r_value->el_count == 0 && ( /* Speed-up common case: (0..MAX) */ (r_value->left.type == ARE_VALUE && r_value->left.value == 0 && r_value->right.type == ARE_MAX) || /* Speed-up common case: (MIN..-1) */ (r_value->left.type == ARE_MIN && r_value->right.type == ARE_VALUE && r_value->right.value == -1) )) { OUT("/* Check if the sign bit is present */\n"); OUT("value = st->buf ? ((st->buf[0] & 0x80) ? -1 : 1) : 0;\n"); break; } if(native_long_sign(r_value) >= 0) { /* Special case for treating unsigned longs */ OUT("if(asn_INTEGER2ulong(st, &value)) {\n"); INDENT(+1); OUT("ASN__CTFAIL(app_key, td, sptr,\n"); OUT("\t\"%%s: value too large (%%s:%%d)\",\n"); OUT("\ttd->name, __FILE__, __LINE__);\n"); OUT("return -1;\n"); INDENT(-1); OUT("}\n"); } else { OUT("if(asn_INTEGER2long(st, &value)) {\n"); INDENT(+1); OUT("ASN__CTFAIL(app_key, td, sptr,\n"); OUT("\t\"%%s: value too large (%%s:%%d)\",\n"); OUT("\ttd->name, __FILE__, __LINE__);\n"); OUT("return -1;\n"); INDENT(-1); OUT("}\n"); } } break; case ASN_BASIC_REAL: if(arg->flags & A1C_USE_WIDE_TYPES) { OUT("if(asn_REAL2double(st, &value)) {\n"); INDENT(+1); OUT("ASN__CTFAIL(app_key, td, sptr,\n"); OUT("\t\"%%s: value too large (%%s:%%d)\",\n"); OUT("\ttd->name, __FILE__, __LINE__);\n"); OUT("return -1;\n"); INDENT(-1); OUT("}\n"); } else { OUT("value = *(const double *)sptr;\n"); } break; case ASN_BASIC_BOOLEAN: OUT("value = (*(const long *)sptr) ? 1 : 0;\n"); break; default: WARNING("%s:%d: Value cannot be determined " "for constraint check for %s", arg->expr->module->source_file_name, arg->expr->_lineno, arg->expr->Identifier ); OUT_NOINDENT( "#error %s:%d: Value of %s cannot be determined\n", arg->expr->module->source_file_name, arg->expr->_lineno, arg->expr->Identifier ); break; } return 0; } static asn1p_expr_type_e _find_terminal_type(arg_t *arg) { asn1p_expr_t *expr; expr = asn1f_find_terminal_type_ex(arg->asn, arg->expr); if(expr) return expr->expr_type; return A1TC_INVALID; } static int native_long_sign(asn1cnst_range_t *r) { if(r->left.type == ARE_VALUE && r->left.value >= 0 && r->right.type == ARE_VALUE && r->right.value > 2147483647 && r->right.value <= (asn1c_integer_t)(4294967295UL)) { if(r->el_count == 0 && r->left.value == 0 && r->right.value == 4294967295UL) return 0; else return 1; } else { return -1; } } asn1c-0.9.28+dfsg/libasn1compiler/asn1c_misc.h0000644000000000000000000000301713065714043017515 0ustar rootroot#ifndef ASN1_COMPILER_MISC_H #define ASN1_COMPILER_MISC_H /* * Make the target language identifier out of one or more names. * The function will concatenate the names and replace unsafe characters * with safe ones. */ enum ami_flags_e { AMI_MASK_ONLY_SPACES = 1, /* Mask only spaces, everything else's safe */ AMI_CHECK_RESERVED = 2, /* Check against reserved keywords */ AMI_NODELIMITER = 4, /* Do not put delimiter, just concatenate */ }; char *asn1c_make_identifier(enum ami_flags_e, asn1p_expr_t *expr, ...); /* * Return the type name of the specified expression. */ enum tnfmt { TNF_UNMODIFIED = 0x10, /* Return unmodified type name */ TNF_INCLUDE = 0x20, /* Format for #include <> */ TNF_CTYPE = 0x30, /* Format as normal C-ish type (append "_t") */ TNF_SAFE = 0x40, /* Replace unsafe characters with _ */ TNF_RSAFE = 0x50, /* Recursion-safe C type format */ }; char *asn1c_type_name(arg_t *arg, asn1p_expr_t *expr, enum tnfmt _format); /* * Check whether the specified INTEGER or ENUMERATED type can be represented * using the generic 'long' type. * Return values: * FL_NOTFIT: No, it cannot be represented using long. * FL_FITS_SIGNED: It can be represented using signed long. * FL_FITS_UNSIGN: It can be represented using unsigned long. * FL_PRESUMED: Probably can't, but -fwide-types is not in effect. */ enum asn1c_fitslong_e { FL_NOTFIT, FL_FITS_SIGNED, FL_FITS_UNSIGN, FL_PRESUMED, }; enum asn1c_fitslong_e asn1c_type_fits_long(arg_t *arg, asn1p_expr_t *expr); #endif /* ASN1_COMPILER_MISC_H */ asn1c-0.9.28+dfsg/libasn1compiler/asn1c_out.c0000644000000000000000000000327113065714043017366 0ustar rootroot#include "asn1c_internal.h" #include "asn1c_out.h" /* * Add an elementary chunk of target language text * into appropriate output stream. */ int asn1c_compiled_output(arg_t *arg, const char *fmt, ...) { struct compiler_stream_destination_s *dst; const char *p; int lf_found; va_list ap; out_chunk_t *m; int ret; switch(arg->target->target) { case OT_IGNORE: return 0; default: dst = &arg->target->destination[arg->target->target]; break; } /* * Make sure the output has a single LF and only at the end. */ for(lf_found = 0, p = fmt; *p; p++) { if(*p == '\n') { lf_found++; assert(p[1] == '\0'); } } assert(lf_found <= 1); /* * Print out the indentation. */ if(dst->indented == 0) { int i = dst->indent_level; dst->indented = 1; while(i--) { ret = asn1c_compiled_output(arg, "\t"); if(ret == -1) return -1; } } if(lf_found) dst->indented = 0; /* * Allocate buffer. */ m = calloc(1, sizeof(out_chunk_t)); if(m == NULL) return -1; m->len = 16; do { void *tmp; m->len <<= 2; tmp = realloc(m->buf, m->len); if(tmp) { m->buf = (char *)tmp; } else { free(m->buf); free(m); return -1; } va_start(ap, fmt); ret = vsnprintf(m->buf, m->len, fmt, ap); va_end(ap); } while(ret >= (m->len - 1) || ret < 0); m->len = ret; if(arg->target->target == OT_INCLUDES || arg->target->target == OT_FWD_DECLS || arg->target->target == OT_POST_INCLUDE) { out_chunk_t *v; TQ_FOR(v, &dst->chunks, next) { if(m->len == v->len && !memcmp(m->buf, v->buf, m->len)) break; } if(v) { /* Entry is already present. Skip it. */ free(m->buf); free(m); return 0; } } TQ_ADD(&dst->chunks, m, next); return 0; } asn1c-0.9.28+dfsg/libasn1compiler/asn1c_lang.h0000644000000000000000000000126113065714043017502 0ustar rootroot#ifndef ASN1_COMPILER_LANGUAGE_H #define ASN1_COMPILER_LANGUAGE_H struct arg_s; typedef struct asn1_language_map_s { asn1p_expr_meta_e meta_match; /* meta_type */ asn1p_expr_type_e expr_match; /* expr_type */ /* * A callback that would create a language-specific type declaration. */ int (*type_cb)(struct arg_s *arg); } asn1_language_map_t; extern asn1_language_map_t asn1_lang_map[AMT_EXPR_META_MAX][ASN_EXPR_TYPE_MAX]; typedef enum asn1c_target_language { ASN1C_LANGUAGE_C, } asn1c_target_language_e; /* * Initialize the compiler to generate specified target language. */ int asn1c_with_language(asn1c_target_language_e lang); #endif /* ASN1_COMPILER_LANGUAGE_H */ asn1c-0.9.28+dfsg/libasn1compiler/asn1c_fdeps.c0000644000000000000000000000745313065714043017666 0ustar rootroot#include "asn1c_internal.h" #include "asn1c_fdeps.h" static asn1c_fdeps_t *asn1c_new_dep(const char *filename); static int asn1c_dep_add(asn1c_fdeps_t *deps, asn1c_fdeps_t *d); int asn1c_activate_dependency(asn1c_fdeps_t *deps, asn1c_fdeps_t *cur, const char *data) { const char *fname; int i; if(!deps || !data || !*data) return 0; if(!cur) cur = deps; if(cur->usage > FDEP_NOTUSED) return 1; /* Already activated */ fname = data; if(*data == '#') { const char *start = data; const char *end = 0; start = strchr(data, '<'); if(start) { start++; end = strchr(start, '>'); } else if((start = strchr(data, '\"'))) { start++; end = strchr(start, '\"'); } if(end) { char *p = alloca((end - start) + 1); memcpy(p, start, end - start); p[end-start] = '\0'; fname = p; } else { return 0; } } if(cur->filename && strcmp(cur->filename, fname) == 0) { cur->usage = FDEP_REFERRED; /* Activate subdependencies */ for(i = 0; i < cur->el_count; i++) { asn1c_activate_dependency(deps, cur->elements[i], cur->elements[i]->filename); } /* * This might be a link to someplace else. */ return asn1c_activate_dependency(deps, NULL, fname); } else { for(i = 0; i < cur->el_count; i++) { asn1c_activate_dependency(deps, cur->elements[i], fname); } } return 0; } asn1c_fdeps_t * asn1c_read_file_dependencies(arg_t *arg, const char *datadir) { char buf[4096]; asn1c_fdeps_t *deps; asn1c_fdeps_t *cur; FILE *f; enum fdep_usage special_section = FDEP_NOTUSED; (void)arg; if(!datadir || strlen(datadir) > sizeof(buf) / 2) { errno = EINVAL; return NULL; } else { sprintf(buf, "%s/file-dependencies", datadir); } f = fopen(buf, "r"); if(!f) return NULL; deps = asn1c_new_dep(0); assert(deps); while(fgets(buf, sizeof(buf), f)) { char *p = strchr(buf, '#'); if(p) *p = '\0'; /* Remove comments */ cur = deps; for(p = strtok(buf, " \t\r\n"); p; p = strtok(NULL, " \t\r\n")) { asn1c_fdeps_t *d; /* * Special "prefix" section. */ if(strchr(p, ':')) { special_section = FDEP_IGNORE; if(strcmp(p, "COMMON-FILES:") == 0) { special_section = FDEP_COMMON_FILES; } else if(strcmp(p, "CONVERTER:") == 0) { special_section = FDEP_CONVERTER; } else if((arg->flags & A1C_GEN_PER) && strcmp(p, "CODEC-PER:") == 0) { special_section = FDEP_CODEC_PER; } break; } if(special_section == FDEP_IGNORE) continue; d = asn1c_new_dep(p); d->usage = special_section; if(asn1c_dep_add(cur, d) == 1) cur = d; } } fclose(f); return deps; } static asn1c_fdeps_t * asn1c_new_dep(const char *filename) { asn1c_fdeps_t *d; d = calloc(1, sizeof(*d)); if(filename) { d->filename = strdup(filename); if(!d->filename) return NULL; } return d; } static int asn1c_dep_add(asn1c_fdeps_t *deps, asn1c_fdeps_t *d) { int n; /* Check for duplicates */ for(n = 0; n < deps->el_count; n++) { if(strcmp(deps->elements[n]->filename, d->filename) == 0) return 0; } if(deps->el_count == deps->el_size) { void *p; n = deps->el_size?deps->el_size << 2:16; p = realloc(deps->elements, n * sizeof(deps->elements[0])); assert(p); deps->elements = p; deps->el_size = n; } deps->elements[deps->el_count++] = d; return 1; } asn1c_fdeps_t * asn1c_deps_makelist(asn1c_fdeps_t *deps) { asn1c_fdeps_t *dlist; asn1c_fdeps_t *d; int i; if(!deps) { errno = EINVAL; return 0; } dlist = asn1c_new_dep(0); if(deps->filename && deps->usage != FDEP_NOTUSED) { d = asn1c_new_dep(deps->filename); d->usage = deps->usage; asn1c_dep_add(dlist, d); } for(i = 0; i < deps->el_count; i++) { int j; d = asn1c_deps_makelist(deps->elements[i]); assert(!d->filename); for(j = 0; j < d->el_count; j++) { asn1c_dep_add(dlist, d->elements[j]); } } return dlist; } asn1c-0.9.28+dfsg/libasn1compiler/asn1compiler.h0000644000000000000000000000373213065714043020076 0ustar rootroot#ifndef ASN1_COMPILER_H #define ASN1_COMPILER_H #include enum asn1c_flags { A1C_NOFLAGS, /* * Debug the compiler. */ A1C_DEBUG = 0x0001, /* * Do not split the target output in several files, just print it. * (Note: the output is not likely to be compilable in this case). */ A1C_PRINT_COMPILED = 0x0002, /* * Generate only the tables for ASN.1 types, * do not emit ASN.1 parsing support code. */ A1C_OMIT_SUPPORT_CODE = 0x0004, /* * Use wide types by default (INTEGER_t etc) instead of native/long. */ A1C_USE_WIDE_TYPES = 0x0008, /* * Do not use C99 extensions. */ A1C_NO_C99 = 0x0010, /* * Enable use of unnamed unions (non-portable feature). */ A1C_UNNAMED_UNIONS = 0x0020, /* * Don't make the asn1_DEF_'s of structure members "static". */ A1C_ALL_DEFS_GLOBAL = 0x0040, /* * Do not generate constraint checking code. */ A1C_NO_CONSTRAINTS = 0x0080, /* * Generate type_id_PR_member things identifiers of id_PR_member. */ A1C_COMPOUND_NAMES = 0x0100, /* * Do not generate courtesy #includes for external dependencies. */ A1C_NO_INCLUDE_DEPS = 0x0200, /* * Compile members of CHOICE as indirect pointers. */ A1C_INDIRECT_CHOICE = 0x0400, /* * -flink-skeletons * Symlink support files rather than copy them. */ A1C_LINK_SKELETONS = 0x0800, /* * -gen-PER * Generate PER support code */ A1C_GEN_PER = 0x1000, /* * -pdu={all|auto|Type} * Generate PDU table */ A1C_PDU_ALL = 0x2000, A1C_PDU_AUTO = 0x4000, A1C_PDU_TYPE = 0x8000, /* * -fincludes-quoted * Avoid generating #include , generate "foo" instead. */ A1C_INCLUDES_QUOTED = 0x10000, /* * -fline-refs * Include ASN.1 module's line numbers in comments. */ A1C_LINE_REFS = 0x20000 }; /* * Compile the ASN.1 specification. */ int asn1_compile(asn1p_t *asn, const char *datadir, enum asn1c_flags, int argc, int optc, char **argv); void asn1c__add_pdu_type(const char *typename); #endif /* ASN1_COMPILER_H */ asn1c-0.9.28+dfsg/libasn1compiler/asn1c_C.h0000644000000000000000000000634613065714043016754 0ustar rootroot#ifndef ASN1_COMPILER_LANGUAGE_C_H #define ASN1_COMPILER_LANGUAGE_C_H #include "asn1c_lang.h" int asn1c_lang_C_type_REFERENCE(arg_t *); int asn1c_lang_C_type_EXTENSIBLE(arg_t *); int asn1c_lang_C_type_SEQUENCE(arg_t *); int asn1c_lang_C_type_SET(arg_t *); int asn1c_lang_C_type_SEx_OF(arg_t *); /* SET OF or SEQUENCE OF */ int asn1c_lang_C_type_CHOICE(arg_t *); int asn1c_lang_C_type_common_INTEGER(arg_t *); int asn1c_lang_C_type_BIT_STRING(arg_t *); int asn1c_lang_C_type_REAL(arg_t *); int asn1c_lang_C_type_SIMPLE_TYPE(arg_t *); static asn1_language_map_t asn1_lang_C[] __attribute__ ((unused)) = { { AMT_TYPE, A1TC_REFERENCE, asn1c_lang_C_type_REFERENCE }, { AMT_TYPEREF, A1TC_REFERENCE, asn1c_lang_C_type_REFERENCE }, { AMT_TYPE, A1TC_EXTENSIBLE, asn1c_lang_C_type_EXTENSIBLE }, /* * Constructed types */ { AMT_TYPE, ASN_CONSTR_SEQUENCE, asn1c_lang_C_type_SEQUENCE }, { AMT_TYPE, ASN_CONSTR_SEQUENCE_OF, asn1c_lang_C_type_SEx_OF, }, { AMT_TYPEREF, ASN_CONSTR_SEQUENCE_OF, asn1c_lang_C_type_SEx_OF }, { AMT_TYPE, ASN_CONSTR_SET, asn1c_lang_C_type_SET }, { AMT_TYPE, ASN_CONSTR_SET_OF, asn1c_lang_C_type_SEx_OF }, { AMT_TYPEREF, ASN_CONSTR_SET_OF, asn1c_lang_C_type_SEx_OF }, { AMT_TYPE, ASN_CONSTR_CHOICE, asn1c_lang_C_type_CHOICE }, /* * ANY type (deprecated) */ { AMT_TYPE, ASN_TYPE_ANY, asn1c_lang_C_type_SIMPLE_TYPE }, /* * Basic types */ { AMT_TYPE, ASN_BASIC_BOOLEAN, asn1c_lang_C_type_SIMPLE_TYPE }, { AMT_TYPE, ASN_BASIC_NULL, asn1c_lang_C_type_SIMPLE_TYPE }, { AMT_TYPE, ASN_BASIC_INTEGER, asn1c_lang_C_type_common_INTEGER }, { AMT_TYPE, ASN_BASIC_REAL, asn1c_lang_C_type_REAL }, { AMT_TYPE, ASN_BASIC_ENUMERATED, asn1c_lang_C_type_common_INTEGER }, { AMT_TYPE, ASN_BASIC_BIT_STRING, asn1c_lang_C_type_BIT_STRING }, { AMT_TYPE, ASN_BASIC_OCTET_STRING, asn1c_lang_C_type_SIMPLE_TYPE }, { AMT_TYPE, ASN_BASIC_OBJECT_IDENTIFIER,asn1c_lang_C_type_SIMPLE_TYPE }, { AMT_TYPE, ASN_BASIC_RELATIVE_OID, asn1c_lang_C_type_SIMPLE_TYPE }, { AMT_TYPE, ASN_BASIC_CHARACTER_STRING, asn1c_lang_C_type_SIMPLE_TYPE }, { AMT_TYPE, ASN_BASIC_UTCTime, asn1c_lang_C_type_SIMPLE_TYPE }, { AMT_TYPE, ASN_BASIC_GeneralizedTime, asn1c_lang_C_type_SIMPLE_TYPE }, /* * String types */ { AMT_TYPE, ASN_STRING_BMPString, asn1c_lang_C_type_SIMPLE_TYPE }, { AMT_TYPE, ASN_STRING_GeneralString, asn1c_lang_C_type_SIMPLE_TYPE }, { AMT_TYPE, ASN_STRING_GraphicString, asn1c_lang_C_type_SIMPLE_TYPE }, { AMT_TYPE, ASN_STRING_IA5String, asn1c_lang_C_type_SIMPLE_TYPE }, { AMT_TYPE, ASN_STRING_ISO646String, asn1c_lang_C_type_SIMPLE_TYPE }, { AMT_TYPE, ASN_STRING_NumericString, asn1c_lang_C_type_SIMPLE_TYPE }, { AMT_TYPE, ASN_STRING_PrintableString,asn1c_lang_C_type_SIMPLE_TYPE }, { AMT_TYPE, ASN_STRING_TeletexString, asn1c_lang_C_type_SIMPLE_TYPE }, { AMT_TYPE, ASN_STRING_T61String, asn1c_lang_C_type_SIMPLE_TYPE }, { AMT_TYPE, ASN_STRING_UniversalString,asn1c_lang_C_type_SIMPLE_TYPE }, { AMT_TYPE, ASN_STRING_UTF8String, asn1c_lang_C_type_SIMPLE_TYPE }, { AMT_TYPE, ASN_STRING_VideotexString,asn1c_lang_C_type_SIMPLE_TYPE }, { AMT_TYPE, ASN_STRING_VisibleString, asn1c_lang_C_type_SIMPLE_TYPE }, { AMT_TYPE, ASN_STRING_ObjectDescriptor,asn1c_lang_C_type_SIMPLE_TYPE }, { 0, 0, 0 } }; #endif /* ASN1_COMPILER_LANGUAGE_C_H */ asn1c-0.9.28+dfsg/libasn1compiler/asn1compiler.c0000644000000000000000000000745513065714043020077 0ustar rootroot#include "asn1c_internal.h" #include "asn1c_lang.h" #include "asn1c_out.h" #include "asn1c_save.h" static void default_logger_cb(int, const char *fmt, ...); static int asn1c_compile_expr(arg_t *arg); static int asn1c_attach_streams(asn1p_expr_t *expr); int asn1_compile(asn1p_t *asn, const char *datadir, enum asn1c_flags flags, int argc, int optc, char **argv) { arg_t arg_s; arg_t *arg = &arg_s; asn1p_module_t *mod; int ret; /* * Initialize target language. */ ret = asn1c_with_language(ASN1C_LANGUAGE_C); assert(ret == 0); memset(arg, 0, sizeof(*arg)); arg->default_cb = asn1c_compile_expr; arg->logger_cb = default_logger_cb; arg->flags = flags; arg->asn = asn; /* * Compile each individual top level structure. */ TQ_FOR(mod, &(asn->modules), mod_next) { TQ_FOR(arg->expr, &(mod->members), next) { compiler_streams_t *cs = NULL; if(asn1c_attach_streams(arg->expr)) return -1; cs = arg->expr->data; cs->target = OT_TYPE_DECLS; arg->target = cs; ret = asn1c_compile_expr(arg); if(ret) { FATAL("Cannot compile \"%s\" (%x:%x) at line %d", arg->expr->Identifier, arg->expr->expr_type, arg->expr->meta_type, arg->expr->_lineno); return ret; } } } DEBUG("Saving compiled data"); /* * Save or print out the compiled result. */ if(asn1c_save_compiled_output(arg, datadir, argc, optc, argv)) return -1; return 0; } static int asn1c_compile_expr(arg_t *arg) { asn1p_expr_t *expr = arg->expr; int (*type_cb)(arg_t *); int ret; assert((int)expr->meta_type >= AMT_INVALID); assert(expr->meta_type < AMT_EXPR_META_MAX); assert((int)expr->expr_type >= A1TC_INVALID); assert(expr->expr_type < ASN_EXPR_TYPE_MAX); type_cb = asn1_lang_map[expr->meta_type][expr->expr_type].type_cb; if(type_cb) { DEBUG("Compiling %s at line %d", expr->Identifier, expr->_lineno); if(expr->lhs_params && expr->spec_index == -1) { int i; ret = 0; DEBUG("Parameterized type %s at line %d: %s (%d)", expr->Identifier, expr->_lineno, expr->specializations.pspecs_count ? "compiling" : "unused, skipping"); for(i = 0; ispecializations.pspecs_count; i++) { arg->expr = expr->specializations .pspec[i].my_clone; ret = asn1c_compile_expr(arg); if(ret) break; } arg->expr = expr; /* Restore */ } else { ret = type_cb(arg); if(arg->target->destination[OT_TYPE_DECLS] .indent_level == 0) OUT(";\n"); } } else { ret = -1; /* * Even if the target language compiler does not know * how to compile the given expression, we know that * certain expressions need not to be compiled at all. */ switch(expr->meta_type) { case AMT_OBJECT: case AMT_OBJECTCLASS: case AMT_OBJECTFIELD: case AMT_VALUE: case AMT_VALUESET: ret = 0; break; default: break; } } if(ret == -1) { FATAL("Cannot compile \"%s\" (%x:%x) at line %d", arg->expr->Identifier, arg->expr->expr_type, arg->expr->meta_type, arg->expr->_lineno); OUT("#error Cannot compile \"%s\" (%x/%x) at line %d\n", arg->expr->Identifier, arg->expr->meta_type, arg->expr->expr_type, arg->expr->_lineno ); } return ret; } static int asn1c_attach_streams(asn1p_expr_t *expr) { compiler_streams_t *cs; int i; if(expr->data) return 0; /* Already attached? */ expr->data = calloc(1, sizeof(compiler_streams_t)); if(expr->data == NULL) return -1; cs = expr->data; for(i = 0; i < OT_MAX; i++) { TQ_INIT(&(cs->destination[i].chunks)); } return 0; } static void default_logger_cb(int _severity, const char *fmt, ...) { va_list ap; char *pfx = ""; switch(_severity) { case -1: pfx = "DEBUG: "; break; case 0: pfx = "WARNING: "; break; case 1: pfx = "FATAL: "; break; } fprintf(stderr, "%s", pfx); va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); fprintf(stderr, "\n"); } asn1c-0.9.28+dfsg/libasn1compiler/check_compiler.c0000644000000000000000000000010713065714043020434 0ustar rootroot#include "asn1compiler.h" int main(int ac, char **av) { return 0; } asn1c-0.9.28+dfsg/libasn1compiler/asn1c_constraint.h0000644000000000000000000000021513065714043020743 0ustar rootroot#ifndef ASN1C_CONSTRAINT_H #define ASN1C_CONSTRAINT_H int asn1c_emit_constraint_checking_code(arg_t *arg); #endif /* ASN1C_CONSTRAINT_H */ asn1c-0.9.28+dfsg/ChangeLog0000644000000000000000000005702713065714043014024 0ustar rootroot 0.9.28: 2017-03-26 * PER decoding: avoid memory leak on error. By github.com/simo5 * Constness patch #46 by Wim L (41bbf1c..78d604f). Build issues: * Fixed generated file permissions introduced by earlier pull (issue/32). * Win32/MinGW patch #31 by Frank Morgner (frankmorgner). * Autoreconf fix patch by Dave Cridland (github.com/dwd) * Fix autoreconf-2.69 failure by github.com/brchiu * Fix C99 warnings. Fix by Adrien Destugues (github.com/pulkomandy). * C89 compliance fix by Jaroslav Imrich (github.com/jariq). * C standard compliance fixes by Markus Elfring (github.com/elfring). 0.9.27: 2014-Sep-17 * Build structure fixes for portability. * Disable long debug of ASN.1 operations during `make check` stage. * Introduce --enable-ASN_DEBUG configure flag to emit long debug output. 0.9.26: 2014-Sep-11 * Updated asn1c-usage.pdf. * Made -fskeletons-copy a default option; removed cmdline option. * Made -fnative-types a default option; removed cmdline option. Added -fwide-types for backwards compatibility. * Add -fline-refs to avoid being unfriendly to version control systems. * Default constraint checking fix. Thanks to Bartosz Marcinkiewicz * Get rid of non-standard pointer arithmetics on void* pointer. * PER-encoding of integers wider than 32 bits. 0.9.24: 2013-Mar-16 * GeneralizedTime fix for working with time offsets which are not representable in whole hours. (Severity: low; Security impact: low) Thanks to IP Fabrics, Inc. * Added -fincludes-quoted to asn1c to generate #includes in "double" instead of quotes. * PER encoding correctness fix. (Severity: high; Security impact: low) Reported by Grzegorz Aksamit. * ENUMERATED extension values check relaxed. Reported by Gabriel Burca. * Fixed decimal decoding of REAL values in -fnative-types mode (Severity: medium; Security impact: medium) * Removed webcgi subproject (introduced in 2004) as useless. 0.9.22: 2008-Nov-19 * Added -pdu=all and -pdu= switches to asn1c. * Added PER support for most known-multiplier string types: IA5String, VisibleString, PrintableString, BMPString, UniversalString; useful types: GeneralizedTime, UTCTime, ObjectDescriptor; as well as REAL and OBJECT IDENTIFIER. TODO: SET type. * Added PER support for extensions in SEQUENCE. * Multiple enhancements by Daniele Varrazzo * Fixed explicit tagging of an in-lined constructed type. (Severity: low; Security impact: none). * Memory leak fixed in SET OF / SEQUENCE OF when wrong encoding is encountered. (Severity: medium; Security impact: low) * Fixed extensibility handling of second SEQUENCE production. (Severity: low; Security impact: none) * Added DEFAULT handling for known multiplier string. * Added a sample OMA ULP decoder (./examples/sample.source.ULP). * Added full-width 32-bit integer encoding support in PER. * Fixed 1-byte OOB write issue with non-standard and Windows memory allocators (Severity: low; Security impact: medium). Reported by Sheng Yu. 0.9.21: 2006-Sep-17 * skeletons/standard-modules directory is now used for standard types. * Fixed class field access problem (Test case 98) (Severity: medium; Security impact: none) * Refactored Information Object Classes parsing. * Refactored Parameterization support. * [typedef enum foo {}] foo_e; is now e_foo, see #1287989 * Refactored ValueSetTypeAssignment parsing. * asn-decoder-template.c renamed into converter-sample.c * MEGACO (Media Gateway Control Protocol) decoder sample added. * First release of PER encoder (does not encode SETs yet). * Added a sample LDAP decoder (./examples/sample.source.LDAP3). * Added a sample 3GPP RRC decoder (./examples/sample.source.RRC). * Added a sample MEGACO (H.248.1) decoder (sample.source.MEGACO). 0.9.20: 2006-Mar-06 * SET OF CHOICE, SEQUENCE OF CHOICE and a certain named S/O types are represented differently in XER. THIS IS AN INCOMPATIBLE CHANGE. (Test case 70) (Severity: low; Security impact: low) * asn1c: Removed -ftypes88 command line option. * Started PER implementation. Somewhat experimental! 0.9.19: 2005-Oct-06 * A proper solution to circular references. No kludge flags should be necessary anymore to produce reference-free code: recursive dependencies are resolved automatically. * Test cases 73 & 92 keep track of various circular references. * Introduced compiler directives to allow finer control over the generated code ("----" in comments), (Test case 93). * New feature for unber(1): -s bytes. * Mandatory elements map for SET was not getting generated properly. (Test case 94) (Severity: high; Security impact: low) * asn1c: new command line option: -fskeletons-copy. 0.9.18: 2005-Aug-14 * The obsolete X.208 syntax is handled gracefully now (compound types' member names are invented on the fly). (Test case 87). * Generating enumeration tables for INTEGER types (Test case 88). * Generating enumeration tables for BIT STRING types (Test case 89). * Conditional INTEGER/ENUMERATED representation: long vs. INTEGER_t type is chosen based on PER visible constraints (Test cases 90, 91). * Union structures for CHOICE type are not anonymous anymore. * Made unber(1) program more verbose: effective structure length is now displayed as L="" at the closing tag. (Test check-xxber.sh). * Fixed unber(1)'s -1 switch for indefinite encoding length. * New command line option for unber(1): -m to enable minimalistic mode. 0.9.17: 2005-Aug-07 * Tagging mode is implicitly IMPLICIT if AUTOMATIC TAGS is used, #30.6. (Test cases 55, 86). * Started to use extern "C" {} in skeleton headers. * Introduced -finline-choice command line option to fix yet another class of circular references. 0.9.16: 2005-July-04 * GeneralizedTime API now supports fractions of seconds. Thanks to Bent Nicolaisen for support. * ASN.1 parser has been tweaked to allow parsing something like "SEQUENCE----comment----", which is ambiguous for many reasons. * XER decoder better handles not-yet-defined future extensions. 0.9.15: 2005-July-02 * Compiler now checks 64-bit overflows in constraints range handling code. No effect on the code produced by the compiler. * Compiler support for tagged and marked parametrized members. * Empty tags to element map avoided. * Compiled code GCC 4.x compatibility. 0.9.14: 2005-Apr-29 * Fixed check-70.-fnative-integers.c test (it was failing when no test directory was found). 0.9.13: 2005-Apr-24 * Added extra const qualifiers into the support code. * More RFC variations supported in crfc2asn1.pl. * Refined string values compatibility. (Test cases 77, 78). * Support for ContainedSubtype constraints. (Test case 16). * Parsing support for CONSTRAINED BY. (Test case 79). * Support for CharsDefn (Quadruple and Tuple, most used in ASN1-CHARACTER-MODULE) (Test case 80). * Pretty-printing support for WITH COMPONENT[S]. (Test case 82). * Streamed OCTET STRING decoding of large values: fixed allocation problem introduced in 0.9.9. (Severity: high; Security impact: medium) Reported by Yann Grossel . * Fixed BASIC-XER encoding of REAL numbers. 0.9.12: 2005-Mar-10 * Fixed a name clash in produced constraint checking code. * #includes are now in single quotes (to solve a name clash with system's on a Win32 system). * Small refinement of XML DTD generation (`asn1c -X`). * Relaxed XER processing rules to skip extra whitespace in some more places. It also skips XML comments (although XML comments in XER are prohibited by X.693, #8.2.1). (Test case 70) (Severity: medium; Security impact: none) Reported by . * Constraints on primitive types being defined are now supported. (Test case 74) (Severity: low; Security impact: none) * XMLValueList generation fixed for CHOICE type. (Severity: medium; Security impact: none) * Added the GSM TAP3 decoder into ./examples/sample.source.TAP3 0.9.11: 2005-Mar-04 * Released -fcompound-names to fix the name clashes in the code produced by the asn1c. * Released -fno-include-deps to avoid #including non-critical external dependencies. * Compiler is taught to produce compilable code for yet another class of circular ASN.1 type references. * X.693:8.3.4 prohibits anything but SignedNumber; fixed XER codec. * Fixed ENUMERATED identifier to value conversion in XER. Reported by . * If the compiled file contents are the same as in already existing file (left from previous compilation), the old file is retained. This prevents thrashing `make` dependencies if amount of changes in the original ASN.1 module(s) is small. 0.9.10: 2005-Feb-25 * Completed the XER XMLValueList encoding and decoding. * Native integer type is now using "long". * Fixed #1150856. Reported by . * Some WIN32 portability fixes. 0.9.9: 2005-Feb-22 * First release of XER (XML) decoding implementation (somewhat experimental). * ANY allocation routine fixed. Reported by . * Fixed tag parsing (tags like "[ 0 ]" were not supported). * Compiler now checks for duplicate ASN.1 types across modules. 0.9.8: 2005-Jan-17 * [NEW PLATFORM] Compiled and tested on Linux @ alpha64 (LP64). Some code needed to be fixed regarding int-long conversions (mostly inside the test suite), and floating point handling code needed to be restructured to handle signalling NAN and other floating point exceptions quietly. Smooth transition! * [NEW PLATFORM] Compiled and tested on Sun Solaris 9 @ sparc. Improved includes/defines of/for system headers. * -X command line option added to asn1c to generate XML DTD. * Empty SEQUENCE and SET clauses are now allowed. * Removed confusion between &xNN; and &#xNN; in enber and unber. * Removed order dependency in DEFAULT references to ENUMERATED identifiers (./tests/68-*-OK.asn1). * ber_dec_rval_t renamed into asn_dec_rval_t: more generality. * Extensions in CHOICE types are properly marked as non-pointers (Test case 59) (Severity: medium; Security impact: medium) Reported by . * Tagged CHOICE type is now supported again. (Test case 59) (Severity: low; Security impact: low) Reported by . * Implemented der_encode_to_buffer() procedure. 0.9.7.1: 2004-Oct-12 * Fixed automatic tagging for extensions of compound types. * Fixed ParametrizedReference parsing: {} are now recognized. 0.9.7: 2004-Oct-11 * Finished CXER implementation by adding SET and SET OF canonical ordering support. * Fixed unber(1) limits controlling logic. * Removed C99'izm from the x509dump, now understood by older compilers. * Enhanced UTF8String constraint validation, now it checks for the minimal encoding length; API of UTF8String_length() changed. * Fixed SEQUENCE dealing with premature termination of the optionals-laden indefinite length structure. The code was previously refusing to parse such structures. * Fixed explicitly tagged ANY type encoding and decoding (Severity: medium; Security impact: low). * Fixed CHOICE code spin when indefinite length structures appear in the extensions (Severity: medium; Security impact: medium). Reported by . * BIT STRING now stores the number of unused octets in a separate field. 0.9.6: 2004-Sep-29 * Added several security firewalls: decoder's stack usage control and the stricter checking of the TLV length. * Implemented BASIC-XER encoding support (X.693). * Implemented unber(1) and enber(1) for BER<->XML translation. * Implemented CGI for online ASN.1 compilation (asn1c/webcgi). * Implemented the sample X.509 decoder (./examples/sample.source.PKIX1). * NamedType is now supported for SET OF/SEQUENCE OF type. * Added -fno-constraints option to asn1c, which disabled generation of ASN.1 subtype constraints checking code. * Added ASN1C_ENVIRONMENT_VERSION and get_asn1c_environment_version(). * Fixed ANY type decoding (Severity: high; Security impact: low). * Fixed BER decoder restartability problem with certain primitive types (BOOLEAN, INTEGER, and REAL). The problem occured when the encoding of such type is split between several bytes. (Severity: high; Security impact: low) * Support for cross-referencing type definitions (updated ./tests/43-*). * Fixed pretty-printing of the REAL type. Added lots of test cases. * Renamed asn1_* into asn_* in function and type names. * Updated documentation. 0.9.5: 2004-Sep-17 * Fixed CER (common BER) decoder code. See check-25.c/VisibleString case for details. X.690 specifies that inner structures in BER encoding must be tagged by stripping off the outer tag for each subsequent containment level. See also X.690: 8.21.5.4 and the "Spouse" case in A.3. (Severity: medium; Security impact: low) * Added converters between any generic type and the ANY type. * Parser fixed: Information Object Class fields may be taged. * Parser fixed: tagged types inside SEQUENCE OF/SET OF support. * Improved DEFAULT Value parsing and pretty-printing. * Condition on distinct tags checker was incorrectly dealing with tagged CHOICE types. Fixed. Modified tests/37-indirect-choice-OK.asn1 * Improved type name generation code ("struct foo" vs "foo_t"). * Fixed constraint checking code incorrectly dealing with imported types with constraint values defined in other modules. * Real REAL support! (Haven't tested denormals support yet!) See skeletons/tests/check-REAL.c 0.9.4: 2004-Sep-10 * More support for recursive type definitions. * Explicit support for ANY type decoding. * Refactored tags processing code. * Fixed constraints checking code: non-exploitable buffer overflow. (Severity: medium; Security impact: low) 0.9.3: 2004-Sep-07 * Extended constraints support in parametrized types. * Better support for parametrization and constraints handling. * Better handling of recursive type definitions. * Added support for ANY type. 0.9.2: 2004-Aug-24 * More flexible subtype constraints handling, with relaxed PER visibility rules for actual constraints checking code generator. * Indirect references in constraints resolver code fixed. * Avoided compilation warning on gcc 3.3.3 systems. * Better ValueSet printing. 0.9.1: 2004-Aug-23 * Documentation updated: doc/asn1c-usage.pdf * Fixed OBJECT IDENTIFIER human-readable printing. Reported by . 0.9: 2004-Aug-23 * Reworked subtype constraints handling, aiming at PER-applicability. * BOOLEAN and NULL are now implemented in terms of native int type. * Compiler now links in only necessary skeleton files. * -t option added to asn1c to ease manual BER/CER/DER decoding. * Added support COMPONENTS OF construct. * Numerous parser fixes and enhancements. * Better constraint failure reporting. 0.8.19: 2004-Aug-18 * Fixed BER encoder (problem encoding large tag values) (Severity: medium; Security impact: low) 0.8.18: 2004-Aug-12 * Parser: fixed multiple IMPORTS problem (incorrect assertion). * Parser: constraints extensibility parsing fix. 0.8.17: 2004-Aug-11 * Improved compiler output: duplicate #includes eliminated. * Win32 portability fixes. * More compatibility with C++ or non-GCC compilers. 0.8.16: 2004-Jul-22 * Fixed application-level problem in SET OF/SEQUENCE OF array cleanup. (Severity: medium; Security impact: low) * Improved asn_GT2time() and added asn_time2{GT,UT}() functions. * BIT STRING pretty-printing. 0.8.15: 2004-Jul-20 * Fixed parser: memory leak in free_struct code for SET OF/SEQUENCE OF. (Severity: high; Security impact: medium) * Fixed parser: invalid memory reference in code constructing tags. (Test case 48) (Severity: high; Security impact: medium) When encoding data for certain ASN.1 specifications containing explicit tags, the tag is always written incorrectly due to incorrect memory reference. The encoding will almost always produce unparseable data and might well reference unmapped region so program would produce segmentation violation. Fortunately, memory is read, not written, so remote exploits cannot execute arbitrary code and triggering unmapped memory reference is highly unlikely even it attacker knows the code (basically, the compiler should place asn1_DEF_... right before the end of the mapped memory region, which is extremely rare). * Improved INTEGER type printing. 0.8.14: 2004-Jun-30 * Fixed compiler: extensibility of CHOICE and SET type has not been taken into account during table construction. (Test case 47) (Severity: high; Security impact: low) 0.8.13: 2004-Jun-29 * Fixed compiler: the skip values for IMPLICIT tagging were broken in some complex cases where one type is defined using another. (Test case 46) (Severity: medium; Security impact: low). * Added -fknown-extern-type command line parameter to asn1c. * Removed -N command line flag and underlying functionality to honor KISS principle. 0.8.12: 2004-Jun-17 * RELATIVE-OID and OBJECT IDENTIFIER encoders/decoders are not bound anymore to an integer type of specific size (unsigned long). The size of an integer must be provided explicitly. See {OBJECT_IDENTIFIER|RELATIVE_OID}_{get|set}_arcs(). * SEQUENCE BER decoder fixed again for complex CHOICE case (Test case 44) (Severity: medium; Security impact: low). 0.8.11: 2004-Jun-05 * Enforced stricter conformance with C standards. * SEQUENCE BER decoder is now equipped with the sorted map in case of complex CHOICE descendants. Test case 44 created. 0.8.10: 2004-Jun-02 * Added const qualifier where necessary. * Changed position of outmost_tag fetcher within asn1_TYPE_descriptor_t structure. 0.8.9: 2004-May-26 * Added *_{get|set}_arcs_*() functions for OBJECT IDENTIFIER and RELATIVE-OID, together with test cases. 0.8.8: 2004-May-09 * Introduced subtype constraints support (incomplete!). * Fixed compiler. If the last member of the SEQUENCE is OPTIONAL and absent in the encoding, and the type is extensible (...) or EXTENSIBILITY IMPLIED flag is set, then the structure could not be correctly decoded. (Severity: high; Security impact: low). * Compiler: fixed recursive ASN.1 types inclusion (Severity: low, Security impact: none). * Parser: IMPORTS/FROM fixes, now allowing multiple sections. * NEW PLATFORM: Compiled and tested on MacOS X (@ PowerPC). No major portability issues experienced. 0.8.7: 2004-Apr-11 T-version-0-8-7 * Fixed SEQUENCE BER decoder: if the last member of the SEQUENCE is OPTIONAL and absent in the encoding, RC_FAIL was returned instead of RC_OK (Severity: high; Security impact: low). * Added test case to check the above problem. * Added test case to check -fnative-integers mode. 0.8.6: 2004-Apr-03 T-version-0-8-6 * Fixed compiler output for embedded ASN.1 structures. 0.8.5: 2004-Mar-28 T-version-0-8-5 * Fixed ber_tlv_length() computation problem (Severity: high, Security impact: none). Reported by 0.8.4: 2004-Mar-22 * Removed RC_ITAG enumeration element from BER decoder. This return code did not have much practical value. 0.8.3: 2004-Mar-14 T-version-0-8-3 * Fixed SET::BER decoder: restart after reaching a buffer boundary weas broken (Severity: high; Security impact: low). * Fixed OCTET STRING::BER decoder: restart after reaching a buffer boundary was broken (Severity: high; Security impact: low). Reported by * Added test cases to check decoders restartability. * Slightly more general INTEGER2long decoder. * Allowed nested /* C-type */ comments, as per X.680:2002. 0.8.2: 2004-Mar-01 T-version-0-8-2 * Fixed SEQUENCE BER decoder: an OPTIONAL element was required, where should not have been (Severity: major; Security impact: low). * Fixed print_struct pointer inheritance. * Added -fno-c99 and -funnamed-unions 0.8.1: 2004-Feb-22 * -R switch to asn1c: Omit support code, compile only the tables. * Introduced NativeInteger pseudotype. * Corrected the informal print_struct()'s output format. 0.8.0: 2004-Feb-03 T-version-0-8-0 * Some documentation is created (a .pdf and a short manual page). * Last touches to the code. 0.7.9: 2004-Feb-01 T-version-0-7-9 * Human readable printing support. * Support for implicit (standard) constraints. 0.7.8: 2004-Jan-31 * SET now rejects duplicate fields in the data stream. 0.7.7: 2004-Jan-25 * Added types: GeneralizedTime and UTCTime. 0.7.6: 2004-Jan-24 T-version-0-7-6 * DER encoding of a SET OF now involves dynamic sorting. 0.7.5: 2004-Jan-24 T-version-0-7-5 * DER encoding of a SET with untagged CHOICE now involves dynamic sorting. 0.7.0: 2004-Jan-19 T-version-0-7-0 * A bunch of DER encoders is implemented. 0.6.6: 2004-Jan-11 * Implemented CHOICE decoder. * Implemented destructors support. 0.6.5: 2004-Jan-03 * Implemented SET decoder. * Implemented SET OF and SEQUENCE OF decoders. 0.6.4: 2003-Dec-31 * Implemented BOOLEAN, NULL, ENUMERATED decoders. * Implemented OCTET STRING decoder. * Implemented BIT STRING decoder. 0.6: 2003-Dec-30 * First decoding of a BER-encoded structure! 0.5: 2003-Dec-28 * Framework and most of the compiler backbone coding done. 0.1: 2003-Nov-28 * Programming started. === Bug importance disclosure terms === SEVERITY. This term applies to the frequence the particular construct is used in the real world. The higher the frequency, the more chances of triggering this bug. low: The ASN.1 specifications which could trigger this kind of bug are not widespread. medium: The particular ASN.1 construct is used quite often, so the chance of triggering an error is considerable. high: This fix is considered urgent, or the particular ASN.1 construct triggering this bug is in wide use. SECURITY IMPACT. This term applies to the amount of potential damage a bug exploitation could cause. none: No malicious exploitation is possible. low: The local exploitation is unlikely; the remote exploitation is not possible. medium: The remote exploitation is possible when a particular ASN.1 construct is being used. If possible, only hard failure, spin or memory leak are the possible outcome: no shellcode injection could possibly be carried by the attack. high: The remote shellcode injection is possible, or the bug is otherwise remotely exploitable for most specifications. asn1c-0.9.28+dfsg/examples/0000755000000000000000000000000013133744516014061 5ustar rootrootasn1c-0.9.28+dfsg/examples/sample.source.LDAP3/0000755000000000000000000000000013065714043017437 5ustar rootrootasn1c-0.9.28+dfsg/examples/sample.source.LDAP3/Makefile0000644000000000000000000001763213065714043021110 0ustar rootrootASN_MODULE_SOURCES= \ LDAPMessage.c \ MessageID.c \ LDAPString.c \ LDAPOID.c \ LDAPDN.c \ RelativeLDAPDN.c \ AttributeDescription.c \ AttributeValue.c \ AttributeValueAssertion.c \ AssertionValue.c \ PartialAttribute.c \ Attribute.c \ MatchingRuleId.c \ LDAPResult.c \ Referral.c \ URI.c \ Controls.c \ Control.c \ BindRequest.c \ AuthenticationChoice.c \ SaslCredentials.c \ BindResponse.c \ UnbindRequest.c \ SearchRequest.c \ AttributeSelection.c \ Filter.c \ SubstringFilter.c \ MatchingRuleAssertion.c \ SearchResultEntry.c \ PartialAttributeList.c \ SearchResultReference.c \ SearchResultDone.c \ ModifyRequest.c \ ModifyResponse.c \ AddRequest.c \ AttributeList.c \ AddResponse.c \ DelRequest.c \ DelResponse.c \ ModifyDNRequest.c \ ModifyDNResponse.c \ CompareRequest.c \ CompareResponse.c \ AbandonRequest.c \ ExtendedRequest.c \ ExtendedResponse.c \ IntermediateResponse.c ASN_MODULE_HEADERS= \ LDAPMessage.h \ MessageID.h \ LDAPString.h \ LDAPOID.h \ LDAPDN.h \ RelativeLDAPDN.h \ AttributeDescription.h \ AttributeValue.h \ AttributeValueAssertion.h \ AssertionValue.h \ PartialAttribute.h \ Attribute.h \ MatchingRuleId.h \ LDAPResult.h \ Referral.h \ URI.h \ Controls.h \ Control.h \ BindRequest.h \ AuthenticationChoice.h \ SaslCredentials.h \ BindResponse.h \ UnbindRequest.h \ SearchRequest.h \ AttributeSelection.h \ Filter.h \ SubstringFilter.h \ MatchingRuleAssertion.h \ SearchResultEntry.h \ PartialAttributeList.h \ SearchResultReference.h \ SearchResultDone.h \ ModifyRequest.h \ ModifyResponse.h \ AddRequest.h \ AttributeList.h \ AddResponse.h \ DelRequest.h \ DelResponse.h \ ModifyDNRequest.h \ ModifyDNResponse.h \ CompareRequest.h \ CompareResponse.h \ AbandonRequest.h \ ExtendedRequest.h \ ExtendedResponse.h \ IntermediateResponse.h ASN_MODULE_HEADERS+=BOOLEAN.h ASN_MODULE_SOURCES+=BOOLEAN.c ASN_MODULE_HEADERS+=INTEGER.h ASN_MODULE_HEADERS+=NativeEnumerated.h ASN_MODULE_SOURCES+=INTEGER.c ASN_MODULE_HEADERS+=NULL.h ASN_MODULE_SOURCES+=NULL.c ASN_MODULE_SOURCES+=NativeEnumerated.c ASN_MODULE_HEADERS+=NativeInteger.h ASN_MODULE_SOURCES+=NativeInteger.c ASN_MODULE_HEADERS+=asn_SEQUENCE_OF.h ASN_MODULE_SOURCES+=asn_SEQUENCE_OF.c ASN_MODULE_HEADERS+=asn_SET_OF.h ASN_MODULE_SOURCES+=asn_SET_OF.c ASN_MODULE_HEADERS+=constr_CHOICE.h ASN_MODULE_SOURCES+=constr_CHOICE.c ASN_MODULE_HEADERS+=constr_SEQUENCE.h ASN_MODULE_SOURCES+=constr_SEQUENCE.c ASN_MODULE_HEADERS+=constr_SEQUENCE_OF.h ASN_MODULE_SOURCES+=constr_SEQUENCE_OF.c ASN_MODULE_HEADERS+=constr_SET_OF.h ASN_MODULE_SOURCES+=constr_SET_OF.c ASN_MODULE_HEADERS+=asn_application.h ASN_MODULE_HEADERS+=asn_system.h ASN_MODULE_HEADERS+=asn_codecs.h ASN_MODULE_HEADERS+=asn_internal.h ASN_MODULE_HEADERS+=OCTET_STRING.h ASN_MODULE_SOURCES+=OCTET_STRING.c ASN_MODULE_HEADERS+=BIT_STRING.h ASN_MODULE_SOURCES+=BIT_STRING.c ASN_MODULE_SOURCES+=asn_codecs_prim.c ASN_MODULE_HEADERS+=asn_codecs_prim.h ASN_MODULE_HEADERS+=ber_tlv_length.h ASN_MODULE_SOURCES+=ber_tlv_length.c ASN_MODULE_HEADERS+=ber_tlv_tag.h ASN_MODULE_SOURCES+=ber_tlv_tag.c ASN_MODULE_HEADERS+=ber_decoder.h ASN_MODULE_SOURCES+=ber_decoder.c ASN_MODULE_HEADERS+=der_encoder.h ASN_MODULE_SOURCES+=der_encoder.c ASN_MODULE_HEADERS+=constr_TYPE.h ASN_MODULE_SOURCES+=constr_TYPE.c ASN_MODULE_HEADERS+=constraints.h ASN_MODULE_SOURCES+=constraints.c ASN_MODULE_HEADERS+=xer_support.h ASN_MODULE_SOURCES+=xer_support.c ASN_MODULE_HEADERS+=xer_decoder.h ASN_MODULE_SOURCES+=xer_decoder.c ASN_MODULE_HEADERS+=xer_encoder.h ASN_MODULE_SOURCES+=xer_encoder.c ASN_MODULE_HEADERS+=per_support.h ASN_MODULE_SOURCES+=per_support.c ASN_MODULE_HEADERS+=per_decoder.h ASN_MODULE_SOURCES+=per_decoder.c ASN_MODULE_HEADERS+=per_encoder.h ASN_MODULE_SOURCES+=per_encoder.c ASN_MODULE_HEADERS+=per_opentype.h ASN_MODULE_SOURCES+=per_opentype.c ASN_CONVERTER_SOURCES+=converter-sample.c lib_LTLIBRARIES=libsomething.la libsomething_la_SOURCES=$(ASN_MODULE_SOURCES) $(ASN_MODULE_HEADERS) # This file may be used as an input for make(3) # Remove the lines below to convert it into a pure .am file TARGET = ldap3dump CFLAGS += -DASN_CONVERTER_TITLE="Lightweight Directory Access Protocol V3 decoder" -DHAVE_CONFIG_H -DJUNKTEST -DPDU=LDAPMessage -I. OBJS=${ASN_MODULE_SOURCES:.c=.o} ${ASN_CONVERTER_SOURCES:.c=.o} all: LDAPMessage.c $(TARGET) $(TARGET): ${OBJS} $(CC) $(CFLAGS) -o $(TARGET) ${OBJS} $(LDFLAGS) $(LIBS) .SUFFIXES: .SUFFIXES: .c .o .c.o: $(CC) $(CFLAGS) -o $@ -c $< clean: rm -f $(TARGET) rm -f $(OBJS) regen: regenerate-from-asn1-source regenerate-from-asn1-source: ../../asn1c/asn1c -S ../../skeletons -pdu=LDAPMessage -fcompound-names ../rfc4511-Lightweight-Directory-Access-Protocol-V3.asn1 LDAPMessage.c: ../sample.makefile.regen ../rfc4511-Lightweight-Directory-Access-Protocol-V3.asn1 make regen-makefile @touch LDAPMessage.c make regen-makefile: TITLE="Lightweight Directory Access Protocol V3 decoder" \ ASN1CMDOPTS="-fcompound-names" \ ASN1MODULES="../rfc4511-Lightweight-Directory-Access-Protocol-V3.asn1" \ ASN1PDU=LDAPMessage \ PROGNAME=ldap3dump \ ../sample.makefile.regen check: ${TARGET} check-ber check-xer check-per @echo ================ @echo All tests passed @echo ================ check-ber: @if test -f sample-LDAPMessage-1.[db]er ; then \ for f in sample-LDAPMessage-*.[db]er; do \ for b in 1 17 33 980 8192; do \ echo "Recoding $$f into XER and back ($$b)..."; \ ./${TARGET} -b $$b -iber -oxer $$f > ./.tmp.1.$$$$ || exit 2; \ ./${TARGET} -b $$b -ixer -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \ diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 4; \ rm -f ./.tmp.[12].$$$$; \ echo "Test junking $$f (please wait)..."; \ ./${TARGET} -J0.0001 -n 1000 -b $$b -iber -onull $$f || exit 5; \ ./${TARGET} -J0.001 -n 1000 -b $$b -iber -onull $$f || exit 6; \ done; done; fi check-xer: @if test -f sample-LDAPMessage-1.xer ; then \ for f in sample-LDAPMessage-*.xer; do \ for b in 1 17 33 980 8192; do \ echo "Recoding $$f into DER and back ($$b)..."; \ ./${TARGET} -b $$b -ixer -oder $$f > ./.tmp.1.$$$$ || exit 2; \ ./${TARGET} -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \ diff $$f ./.tmp.2.$$$$ || exit 4; \ rm -f ./.tmp.[12].$$$$; \ echo "Test junking $$f (please wait)..."; \ ./${TARGET} -J0.0001 -n 1000 -b $$b -ixer -onull $$f || exit 5; \ ./${TARGET} -J0.001 -n 1000 -b $$b -ixer -onull $$f || exit 6; \ done; done; fi check-per: @if test -f sample-LDAPMessage-1-nopad.per ; then \ for f in sample-LDAPMessage-[1-9]-nopad.per; do \ for b in 1 17 33 980 8192; do \ echo "Recoding non-padded $$f into DER into XER and back ($$b)..."; \ ./${TARGET} -b $$b -per-nopad -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \ ./${TARGET} -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \ ./${TARGET} -b $$b -ixer -oder ./.tmp.2.$$$$ > ./.tmp.3.$$$$ || exit 4; \ diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 5; \ rm -f ./.tmp.[123].$$$$; \ echo "Test junking $$f (please wait)..."; \ ./${TARGET} -J0.0001 -n 1000 -b $$b -per-nopad -iper -onull $$f || exit 6; \ ./${TARGET} -J0.001 -n 1000 -b $$b -per-nopad -iper -onull $$f || exit 7; \ done; done; fi @if test -f sample-LDAPMessage-1.per ; then \ for f in sample-*-[1-9].per; do \ pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z-]+)-[0-9].*/\1/"`; \ for b in 1 17 33 980 8192; do \ echo "Recoding $$f into DER into XER and back ($$b)..."; \ ./${TARGET} -b $$b -p $$pdu -iper -oder $$f > ./.tmp.1.$$$$ || exit 3; \ ./${TARGET} -b $$b -p $$pdu -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 4; \ ./${TARGET} -b $$b -p $$pdu -ixer -oper ./.tmp.2.$$$$ > ./.tmp.1.$$$$ || exit 5; \ diff $$f ./.tmp.1.$$$$ || exit 6; \ rm -f ./.tmp.[12].$$$$; \ echo "Test junking $$f (please wait)..."; \ ./${TARGET} -J0.0001 -n 1000 -b $$b -iper -onull $$f || exit 7; \ ./${TARGET} -J0.001 -n 1000 -b $$b -iper -onull $$f || exit 8; \ done; done; fi distclean: clean rm -f $(ASN_MODULE_SOURCES) rm -f $(ASN_MODULE_HEADERS) rm -f $(ASN_CONVERTER_SOURCES) $(ASN_CONVERTER_HEADERS) rm -f Makefile.am.sample asn1c-0.9.28+dfsg/examples/sample.source.LDAP3/sample-LDAPMessage-1.ber0000644000000000000000000000004213065714043023567 0ustar rootroot0 ` uid=a,dc=compasswordasn1c-0.9.28+dfsg/examples/sample.source.LDAP3/README0000644000000000000000000000105613065714043020321 0ustar rootroot GENERAL INFORMATION =================== The LDAPv3 (Lightweight Directory Access Protocol) PDU decoder. Invoking `make` will compile the ASN.1 specifications from the rfc4211.txt in the above directory. This LDAP decoder has been successfully tested against the PROTOS c06-ldapv3 security test suite: http://www.ee.oulu.fi/research/ouspg/protos/testing/c06/ldapv3/index.html ldap3dump USAGE ============== ./ldap3dump LDAPMessage.ber # Print as XML (BASIC-XER) The full list of recognized command line options may be obtained with > ./ldap3dump -h asn1c-0.9.28+dfsg/examples/sample.source.LDAP3/config.h0000644000000000000000000000031013065714043021047 0ustar rootroot extern int opt_debug; #define ASN_DEBUG(fmt, args...) do { \ if(opt_debug < 2) break; \ fprintf(stderr, fmt, ##args); \ fprintf(stderr, " (%s:%d)\n", \ __FILE__, __LINE__); \ } while(0) asn1c-0.9.28+dfsg/examples/Makefile.am0000644000000000000000000000227313065714043016115 0ustar rootroot dist_bin_SCRIPTS = crfc2asn1.pl ASN1_SOURCE_1 = rfc3280.txt ASN1_FILES_1 = \ rfc3280-PKIX1Explicit88.asn1 \ rfc3280-PKIX1Implicit88.asn1 ASN1_SOURCE_2 = rfc3525.txt ASN1_FILES_2 = \ rfc3525-MEDIA-GATEWAY-CONTROL.asn1 ASN1_SOURCE_3 = rfc4511.txt ASN1_FILES_3 = \ rfc4511-Lightweight-Directory-Access-Protocol-V3.asn1 BUILT_SOURCES = $(ASN1_FILES_1) $(ASN1_FILES_2) $(ASN1_FILES_3) $(ASN1_FILES_1): crfc2asn1.pl $(ASN1_SOURCE_1) ${srcdir}/crfc2asn1.pl ${srcdir}/$(ASN1_SOURCE_1) $(ASN1_FILES_2): crfc2asn1.pl $(ASN1_SOURCE_2) ${srcdir}/crfc2asn1.pl ${srcdir}/$(ASN1_SOURCE_2) $(ASN1_FILES_3): crfc2asn1.pl $(ASN1_SOURCE_3) ${srcdir}/crfc2asn1.pl ${srcdir}/$(ASN1_SOURCE_3) EXTRA_DIST = \ rfc3280.txt rfc3525.txt rfc4511.txt \ sample.source.LDAP3 \ sample.source.MEGACO \ sample.source.MHEG5 \ sample.source.RRC \ sample.source.TAP3 \ sample.source.PKIX1 \ sample.makefile.regen CLEANFILES = $(ASN1_FILES_1) $(ASN1_FILES_2) $(ASN1_FILES_3) clean-local: for dir in ${srcdir}/sample.source.*; do (cd $$dir && make distclean); done dist-hook: clean-local rm -f `find $(distdir) -name "*.core" -or -name ".tmp.*"` rm -f `find $(distdir) -name "*.[ch].??????"` asn1c-0.9.28+dfsg/examples/sample.source.TAP3/0000755000000000000000000000000013065714043017343 5ustar rootrootasn1c-0.9.28+dfsg/examples/sample.source.TAP3/Makefile0000644000000000000000000004737513065714043021023 0ustar rootrootASN_MODULE_SOURCES= \ DataInterChange.c \ TransferBatch.c \ Notification.c \ CallEventDetailList.c \ CallEventDetail.c \ BatchControlInfo.c \ AccountingInfo.c \ NetworkInfo.c \ MessageDescriptionInfoList.c \ MobileOriginatedCall.c \ MobileTerminatedCall.c \ SupplServiceEvent.c \ ServiceCentreUsage.c \ GprsCall.c \ ContentTransaction.c \ LocationService.c \ AuditControlInfo.c \ AccessPointNameNI.c \ AccessPointNameOI.c \ ActualDeliveryTimeStamp.c \ AddressStringDigits.c \ AdvisedCharge.c \ AdvisedChargeCurrency.c \ AdvisedChargeInformation.c \ AgeOfLocation.c \ BasicService.c \ BasicServiceCode.c \ BasicServiceCodeList.c \ BasicServiceUsed.c \ BasicServiceUsedList.c \ BearerServiceCode.c \ CalledNumber.c \ CalledPlace.c \ CalledRegion.c \ CallEventDetailsCount.c \ CallEventStartTimeStamp.c \ CallingNumber.c \ CallOriginator.c \ CallReference.c \ CallTypeGroup.c \ CallTypeLevel1.c \ CallTypeLevel2.c \ CallTypeLevel3.c \ CamelDestinationNumber.c \ CamelInvocationFee.c \ CamelServiceKey.c \ CamelServiceLevel.c \ CamelServiceUsed.c \ CauseForTerm.c \ CellId.c \ Charge.c \ ChargeableSubscriber.c \ ChargeableUnits.c \ ChargeDetail.c \ ChargeDetailList.c \ ChargeDetailTimeStamp.c \ ChargedItem.c \ ChargedPartyEquipment.c \ ChargedPartyHomeIdentification.c \ ChargedPartyHomeIdList.c \ ChargedPartyIdentification.c \ ChargedPartyIdentifier.c \ ChargedPartyIdList.c \ ChargedPartyIdType.c \ ChargedPartyInformation.c \ ChargedPartyLocation.c \ ChargedPartyLocationList.c \ ChargedPartyStatus.c \ ChargedUnits.c \ ChargeInformation.c \ ChargeInformationList.c \ ChargeRefundIndicator.c \ ChargeType.c \ ChargingId.c \ ChargingPoint.c \ ChargingTimeStamp.c \ ClirIndicator.c \ Commission.c \ CompletionTimeStamp.c \ ContentChargingPoint.c \ ContentProvider.c \ ContentProviderIdentifier.c \ ContentProviderIdList.c \ ContentProviderIdType.c \ ContentProviderName.c \ ContentServiceUsed.c \ ContentServiceUsedList.c \ ContentTransactionBasicInfo.c \ ContentTransactionCode.c \ ContentTransactionType.c \ CseInformation.c \ CurrencyConversion.c \ CurrencyConversionList.c \ CustomerIdentifier.c \ CustomerIdType.c \ DataVolume.c \ DataVolumeIncoming.c \ DataVolumeOutgoing.c \ DateTime.c \ DateTimeLong.c \ DefaultCallHandlingIndicator.c \ DepositTimeStamp.c \ Destination.c \ DestinationNetwork.c \ DialledDigits.c \ Discount.c \ DiscountableAmount.c \ DiscountApplied.c \ DiscountCode.c \ DiscountInformation.c \ Discounting.c \ DiscountingList.c \ DiscountRate.c \ DiscountValue.c \ DistanceChargeBandCode.c \ EarliestCallTimeStamp.c \ EquipmentId.c \ EquipmentIdType.c \ Esn.c \ ExchangeRate.c \ ExchangeRateCode.c \ FileAvailableTimeStamp.c \ FileCreationTimeStamp.c \ FileSequenceNumber.c \ FileTypeIndicator.c \ FixedDiscountValue.c \ Fnur.c \ GeographicalLocation.c \ GprsBasicCallInformation.c \ GprsChargeableSubscriber.c \ GprsDestination.c \ GprsLocationInformation.c \ GprsNetworkLocation.c \ GprsServiceUsed.c \ GsmChargeableSubscriber.c \ GuaranteedBitRate.c \ HomeBid.c \ HomeIdentifier.c \ HomeIdType.c \ HomeLocationDescription.c \ HomeLocationInformation.c \ HorizontalAccuracyDelivered.c \ HorizontalAccuracyRequested.c \ HSCSDIndicator.c \ Imei.c \ ImeiOrEsn.c \ Imsi.c \ IMSSignallingContext.c \ InternetServiceProvider.c \ InternetServiceProviderIdList.c \ IspIdentifier.c \ IspIdType.c \ ISPList.c \ NetworkIdType.c \ NetworkIdentifier.c \ Network.c \ NetworkList.c \ LatestCallTimeStamp.c \ LCSQosDelivered.c \ LCSQosRequested.c \ LCSRequestTimestamp.c \ LCSSPIdentification.c \ LCSSPIdentificationList.c \ LCSSPInformation.c \ LCSTransactionStatus.c \ LocalCurrency.c \ LocalTimeStamp.c \ LocationArea.c \ LocationDescription.c \ LocationIdentifier.c \ LocationIdType.c \ LocationInformation.c \ LocationServiceUsage.c \ MaximumBitRate.c \ Mdn.c \ MessageDescription.c \ MessageDescriptionCode.c \ MessageDescriptionInformation.c \ MessageStatus.c \ MessageType.c \ Min.c \ MinChargeableSubscriber.c \ MoBasicCallInformation.c \ Msisdn.c \ MtBasicCallInformation.c \ NetworkAccessIdentifier.c \ NetworkId.c \ NetworkInitPDPContext.c \ NetworkLocation.c \ NonChargedNumber.c \ NumberOfDecimalPlaces.c \ ObjectType.c \ OperatorSpecInfoList.c \ OperatorSpecInformation.c \ OrderPlacedTimeStamp.c \ OriginatingNetwork.c \ PacketDataProtocolAddress.c \ PaidIndicator.c \ PartialTypeIndicator.c \ PaymentMethod.c \ PdpAddress.c \ PDPContextStartTimestamp.c \ PlmnId.c \ PositioningMethod.c \ PriorityCode.c \ RapFileSequenceNumber.c \ RecEntityCode.c \ RecEntityCodeList.c \ RecEntityId.c \ RecEntityInfoList.c \ RecEntityInformation.c \ RecEntityType.c \ Recipient.c \ ReleaseVersionNumber.c \ RequestedDeliveryTimeStamp.c \ ResponseTime.c \ ResponseTimeCategory.c \ ScuBasicInformation.c \ ScuChargeType.c \ ScuTimeStamps.c \ ScuChargeableSubscriber.c \ Sender.c \ ServingBid.c \ ServingLocationDescription.c \ ServingNetwork.c \ ServingPartiesInformation.c \ SimChargeableSubscriber.c \ SimToolkitIndicator.c \ SMSDestinationNumber.c \ SMSOriginator.c \ SpecificationVersionNumber.c \ SsParameters.c \ SupplServiceActionCode.c \ SupplServiceCode.c \ SupplServiceUsed.c \ TapCurrency.c \ TapDecimalPlaces.c \ TaxableAmount.c \ Taxation.c \ TaxationList.c \ TaxCode.c \ TaxInformation.c \ TaxInformationList.c \ TaxRate.c \ TaxType.c \ TaxValue.c \ TeleServiceCode.c \ ThirdPartyInformation.c \ ThirdPartyNumber.c \ ThreeGcamelDestination.c \ TotalAdvisedCharge.c \ TotalAdvisedChargeRefund.c \ TotalAdvisedChargeValue.c \ TotalAdvisedChargeValueList.c \ TotalCallEventDuration.c \ TotalCharge.c \ TotalChargeRefund.c \ TotalCommission.c \ TotalCommissionRefund.c \ TotalDataVolume.c \ TotalDiscountRefund.c \ TotalDiscountValue.c \ TotalTaxRefund.c \ TotalTaxValue.c \ TotalTransactionDuration.c \ TrackedCustomerEquipment.c \ TrackedCustomerHomeId.c \ TrackedCustomerHomeIdList.c \ TrackedCustomerIdentification.c \ TrackedCustomerIdList.c \ TrackedCustomerInformation.c \ TrackedCustomerLocation.c \ TrackedCustomerLocList.c \ TrackingCustomerEquipment.c \ TrackingCustomerHomeId.c \ TrackingCustomerHomeIdList.c \ TrackingCustomerIdentification.c \ TrackingCustomerIdList.c \ TrackingCustomerInformation.c \ TrackingCustomerLocation.c \ TrackingCustomerLocList.c \ TrackingFrequency.c \ TrackingPeriod.c \ TransactionAuthCode.c \ TransactionDescriptionSupp.c \ TransactionDetailDescription.c \ TransactionIdentifier.c \ TransactionShortDescription.c \ TransactionStatus.c \ TransferCutOffTimeStamp.c \ TransparencyIndicator.c \ UserProtocolIndicator.c \ UtcTimeOffset.c \ UtcTimeOffsetCode.c \ UtcTimeOffsetInfo.c \ UtcTimeOffsetInfoList.c \ VerticalAccuracyDelivered.c \ VerticalAccuracyRequested.c \ AbsoluteAmount.c \ Bid.c \ Code.c \ AsciiString.c \ BCDString.c \ Currency.c \ HexString.c \ NumberString.c \ PercentageRate.c ASN_MODULE_HEADERS= \ DataInterChange.h \ TransferBatch.h \ Notification.h \ CallEventDetailList.h \ CallEventDetail.h \ BatchControlInfo.h \ AccountingInfo.h \ NetworkInfo.h \ MessageDescriptionInfoList.h \ MobileOriginatedCall.h \ MobileTerminatedCall.h \ SupplServiceEvent.h \ ServiceCentreUsage.h \ GprsCall.h \ ContentTransaction.h \ LocationService.h \ AuditControlInfo.h \ AccessPointNameNI.h \ AccessPointNameOI.h \ ActualDeliveryTimeStamp.h \ AddressStringDigits.h \ AdvisedCharge.h \ AdvisedChargeCurrency.h \ AdvisedChargeInformation.h \ AgeOfLocation.h \ BasicService.h \ BasicServiceCode.h \ BasicServiceCodeList.h \ BasicServiceUsed.h \ BasicServiceUsedList.h \ BearerServiceCode.h \ CalledNumber.h \ CalledPlace.h \ CalledRegion.h \ CallEventDetailsCount.h \ CallEventStartTimeStamp.h \ CallingNumber.h \ CallOriginator.h \ CallReference.h \ CallTypeGroup.h \ CallTypeLevel1.h \ CallTypeLevel2.h \ CallTypeLevel3.h \ CamelDestinationNumber.h \ CamelInvocationFee.h \ CamelServiceKey.h \ CamelServiceLevel.h \ CamelServiceUsed.h \ CauseForTerm.h \ CellId.h \ Charge.h \ ChargeableSubscriber.h \ ChargeableUnits.h \ ChargeDetail.h \ ChargeDetailList.h \ ChargeDetailTimeStamp.h \ ChargedItem.h \ ChargedPartyEquipment.h \ ChargedPartyHomeIdentification.h \ ChargedPartyHomeIdList.h \ ChargedPartyIdentification.h \ ChargedPartyIdentifier.h \ ChargedPartyIdList.h \ ChargedPartyIdType.h \ ChargedPartyInformation.h \ ChargedPartyLocation.h \ ChargedPartyLocationList.h \ ChargedPartyStatus.h \ ChargedUnits.h \ ChargeInformation.h \ ChargeInformationList.h \ ChargeRefundIndicator.h \ ChargeType.h \ ChargingId.h \ ChargingPoint.h \ ChargingTimeStamp.h \ ClirIndicator.h \ Commission.h \ CompletionTimeStamp.h \ ContentChargingPoint.h \ ContentProvider.h \ ContentProviderIdentifier.h \ ContentProviderIdList.h \ ContentProviderIdType.h \ ContentProviderName.h \ ContentServiceUsed.h \ ContentServiceUsedList.h \ ContentTransactionBasicInfo.h \ ContentTransactionCode.h \ ContentTransactionType.h \ CseInformation.h \ CurrencyConversion.h \ CurrencyConversionList.h \ CustomerIdentifier.h \ CustomerIdType.h \ DataVolume.h \ DataVolumeIncoming.h \ DataVolumeOutgoing.h \ DateTime.h \ DateTimeLong.h \ DefaultCallHandlingIndicator.h \ DepositTimeStamp.h \ Destination.h \ DestinationNetwork.h \ DialledDigits.h \ Discount.h \ DiscountableAmount.h \ DiscountApplied.h \ DiscountCode.h \ DiscountInformation.h \ Discounting.h \ DiscountingList.h \ DiscountRate.h \ DiscountValue.h \ DistanceChargeBandCode.h \ EarliestCallTimeStamp.h \ EquipmentId.h \ EquipmentIdType.h \ Esn.h \ ExchangeRate.h \ ExchangeRateCode.h \ FileAvailableTimeStamp.h \ FileCreationTimeStamp.h \ FileSequenceNumber.h \ FileTypeIndicator.h \ FixedDiscountValue.h \ Fnur.h \ GeographicalLocation.h \ GprsBasicCallInformation.h \ GprsChargeableSubscriber.h \ GprsDestination.h \ GprsLocationInformation.h \ GprsNetworkLocation.h \ GprsServiceUsed.h \ GsmChargeableSubscriber.h \ GuaranteedBitRate.h \ HomeBid.h \ HomeIdentifier.h \ HomeIdType.h \ HomeLocationDescription.h \ HomeLocationInformation.h \ HorizontalAccuracyDelivered.h \ HorizontalAccuracyRequested.h \ HSCSDIndicator.h \ Imei.h \ ImeiOrEsn.h \ Imsi.h \ IMSSignallingContext.h \ InternetServiceProvider.h \ InternetServiceProviderIdList.h \ IspIdentifier.h \ IspIdType.h \ ISPList.h \ NetworkIdType.h \ NetworkIdentifier.h \ Network.h \ NetworkList.h \ LatestCallTimeStamp.h \ LCSQosDelivered.h \ LCSQosRequested.h \ LCSRequestTimestamp.h \ LCSSPIdentification.h \ LCSSPIdentificationList.h \ LCSSPInformation.h \ LCSTransactionStatus.h \ LocalCurrency.h \ LocalTimeStamp.h \ LocationArea.h \ LocationDescription.h \ LocationIdentifier.h \ LocationIdType.h \ LocationInformation.h \ LocationServiceUsage.h \ MaximumBitRate.h \ Mdn.h \ MessageDescription.h \ MessageDescriptionCode.h \ MessageDescriptionInformation.h \ MessageStatus.h \ MessageType.h \ Min.h \ MinChargeableSubscriber.h \ MoBasicCallInformation.h \ Msisdn.h \ MtBasicCallInformation.h \ NetworkAccessIdentifier.h \ NetworkId.h \ NetworkInitPDPContext.h \ NetworkLocation.h \ NonChargedNumber.h \ NumberOfDecimalPlaces.h \ ObjectType.h \ OperatorSpecInfoList.h \ OperatorSpecInformation.h \ OrderPlacedTimeStamp.h \ OriginatingNetwork.h \ PacketDataProtocolAddress.h \ PaidIndicator.h \ PartialTypeIndicator.h \ PaymentMethod.h \ PdpAddress.h \ PDPContextStartTimestamp.h \ PlmnId.h \ PositioningMethod.h \ PriorityCode.h \ RapFileSequenceNumber.h \ RecEntityCode.h \ RecEntityCodeList.h \ RecEntityId.h \ RecEntityInfoList.h \ RecEntityInformation.h \ RecEntityType.h \ Recipient.h \ ReleaseVersionNumber.h \ RequestedDeliveryTimeStamp.h \ ResponseTime.h \ ResponseTimeCategory.h \ ScuBasicInformation.h \ ScuChargeType.h \ ScuTimeStamps.h \ ScuChargeableSubscriber.h \ Sender.h \ ServingBid.h \ ServingLocationDescription.h \ ServingNetwork.h \ ServingPartiesInformation.h \ SimChargeableSubscriber.h \ SimToolkitIndicator.h \ SMSDestinationNumber.h \ SMSOriginator.h \ SpecificationVersionNumber.h \ SsParameters.h \ SupplServiceActionCode.h \ SupplServiceCode.h \ SupplServiceUsed.h \ TapCurrency.h \ TapDecimalPlaces.h \ TaxableAmount.h \ Taxation.h \ TaxationList.h \ TaxCode.h \ TaxInformation.h \ TaxInformationList.h \ TaxRate.h \ TaxType.h \ TaxValue.h \ TeleServiceCode.h \ ThirdPartyInformation.h \ ThirdPartyNumber.h \ ThreeGcamelDestination.h \ TotalAdvisedCharge.h \ TotalAdvisedChargeRefund.h \ TotalAdvisedChargeValue.h \ TotalAdvisedChargeValueList.h \ TotalCallEventDuration.h \ TotalCharge.h \ TotalChargeRefund.h \ TotalCommission.h \ TotalCommissionRefund.h \ TotalDataVolume.h \ TotalDiscountRefund.h \ TotalDiscountValue.h \ TotalTaxRefund.h \ TotalTaxValue.h \ TotalTransactionDuration.h \ TrackedCustomerEquipment.h \ TrackedCustomerHomeId.h \ TrackedCustomerHomeIdList.h \ TrackedCustomerIdentification.h \ TrackedCustomerIdList.h \ TrackedCustomerInformation.h \ TrackedCustomerLocation.h \ TrackedCustomerLocList.h \ TrackingCustomerEquipment.h \ TrackingCustomerHomeId.h \ TrackingCustomerHomeIdList.h \ TrackingCustomerIdentification.h \ TrackingCustomerIdList.h \ TrackingCustomerInformation.h \ TrackingCustomerLocation.h \ TrackingCustomerLocList.h \ TrackingFrequency.h \ TrackingPeriod.h \ TransactionAuthCode.h \ TransactionDescriptionSupp.h \ TransactionDetailDescription.h \ TransactionIdentifier.h \ TransactionShortDescription.h \ TransactionStatus.h \ TransferCutOffTimeStamp.h \ TransparencyIndicator.h \ UserProtocolIndicator.h \ UtcTimeOffset.h \ UtcTimeOffsetCode.h \ UtcTimeOffsetInfo.h \ UtcTimeOffsetInfoList.h \ VerticalAccuracyDelivered.h \ VerticalAccuracyRequested.h \ AbsoluteAmount.h \ Bid.h \ Code.h \ AsciiString.h \ BCDString.h \ Currency.h \ HexString.h \ NumberString.h \ PercentageRate.h ASN_MODULE_HEADERS+=INTEGER.h ASN_MODULE_HEADERS+=NativeEnumerated.h ASN_MODULE_HEADERS+=IA5String.h ASN_MODULE_SOURCES+=IA5String.c ASN_MODULE_SOURCES+=INTEGER.c ASN_MODULE_SOURCES+=NativeEnumerated.c ASN_MODULE_HEADERS+=NativeInteger.h ASN_MODULE_SOURCES+=NativeInteger.c ASN_MODULE_HEADERS+=asn_SEQUENCE_OF.h ASN_MODULE_SOURCES+=asn_SEQUENCE_OF.c ASN_MODULE_HEADERS+=asn_SET_OF.h ASN_MODULE_SOURCES+=asn_SET_OF.c ASN_MODULE_HEADERS+=constr_CHOICE.h ASN_MODULE_SOURCES+=constr_CHOICE.c ASN_MODULE_HEADERS+=constr_SEQUENCE.h ASN_MODULE_SOURCES+=constr_SEQUENCE.c ASN_MODULE_HEADERS+=constr_SEQUENCE_OF.h ASN_MODULE_SOURCES+=constr_SEQUENCE_OF.c ASN_MODULE_HEADERS+=constr_SET_OF.h ASN_MODULE_SOURCES+=constr_SET_OF.c ASN_MODULE_HEADERS+=asn_application.h ASN_MODULE_HEADERS+=asn_system.h ASN_MODULE_HEADERS+=asn_codecs.h ASN_MODULE_HEADERS+=asn_internal.h ASN_MODULE_HEADERS+=OCTET_STRING.h ASN_MODULE_SOURCES+=OCTET_STRING.c ASN_MODULE_HEADERS+=BIT_STRING.h ASN_MODULE_SOURCES+=BIT_STRING.c ASN_MODULE_SOURCES+=asn_codecs_prim.c ASN_MODULE_HEADERS+=asn_codecs_prim.h ASN_MODULE_HEADERS+=ber_tlv_length.h ASN_MODULE_SOURCES+=ber_tlv_length.c ASN_MODULE_HEADERS+=ber_tlv_tag.h ASN_MODULE_SOURCES+=ber_tlv_tag.c ASN_MODULE_HEADERS+=ber_decoder.h ASN_MODULE_SOURCES+=ber_decoder.c ASN_MODULE_HEADERS+=der_encoder.h ASN_MODULE_SOURCES+=der_encoder.c ASN_MODULE_HEADERS+=constr_TYPE.h ASN_MODULE_SOURCES+=constr_TYPE.c ASN_MODULE_HEADERS+=constraints.h ASN_MODULE_SOURCES+=constraints.c ASN_MODULE_HEADERS+=xer_support.h ASN_MODULE_SOURCES+=xer_support.c ASN_MODULE_HEADERS+=xer_decoder.h ASN_MODULE_SOURCES+=xer_decoder.c ASN_MODULE_HEADERS+=xer_encoder.h ASN_MODULE_SOURCES+=xer_encoder.c ASN_MODULE_HEADERS+=per_support.h ASN_MODULE_SOURCES+=per_support.c ASN_MODULE_HEADERS+=per_decoder.h ASN_MODULE_SOURCES+=per_decoder.c ASN_MODULE_HEADERS+=per_encoder.h ASN_MODULE_SOURCES+=per_encoder.c ASN_MODULE_HEADERS+=per_opentype.h ASN_MODULE_SOURCES+=per_opentype.c ASN_CONVERTER_SOURCES+=converter-sample.c lib_LTLIBRARIES=libsomething.la libsomething_la_SOURCES=$(ASN_MODULE_SOURCES) $(ASN_MODULE_HEADERS) # This file may be used as an input for make(3) # Remove the lines below to convert it into a pure .am file TARGET = tap3dump CFLAGS += -DASN_CONVERTER_TITLE="GSM TAP3 (Transferred Account Procedure, Version 3) decoder" -DHAVE_CONFIG_H -DJUNKTEST -DPDU=DataInterChange -I. OBJS=${ASN_MODULE_SOURCES:.c=.o} ${ASN_CONVERTER_SOURCES:.c=.o} all: DataInterChange.c $(TARGET) $(TARGET): ${OBJS} $(CC) $(CFLAGS) -o $(TARGET) ${OBJS} $(LDFLAGS) $(LIBS) .SUFFIXES: .SUFFIXES: .c .o .c.o: $(CC) $(CFLAGS) -o $@ -c $< clean: rm -f $(TARGET) rm -f $(OBJS) regen: regenerate-from-asn1-source regenerate-from-asn1-source: ../../asn1c/asn1c -S ../../skeletons -pdu=DataInterChange ../tap3.asn1 DataInterChange.c: ../sample.makefile.regen ../tap3.asn1 make regen-makefile @touch DataInterChange.c make regen-makefile: TITLE="GSM TAP3 (Transferred Account Procedure, Version 3) decoder" \ ASN1CMDOPTS="" \ ASN1MODULES="../tap3.asn1" \ ASN1PDU=DataInterChange \ PROGNAME=tap3dump \ ../sample.makefile.regen check: ${TARGET} check-ber check-xer check-per @echo ================ @echo All tests passed @echo ================ check-ber: @if test -f sample-DataInterChange-1.[db]er ; then \ for f in sample-DataInterChange-*.[db]er; do \ for b in 1 17 33 980 8192; do \ echo "Recoding $$f into XER and back ($$b)..."; \ ./${TARGET} -b $$b -iber -oxer $$f > ./.tmp.1.$$$$ || exit 2; \ ./${TARGET} -b $$b -ixer -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \ diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 4; \ rm -f ./.tmp.[12].$$$$; \ echo "Test junking $$f (please wait)..."; \ ./${TARGET} -J0.0001 -n 1000 -b $$b -iber -onull $$f || exit 5; \ ./${TARGET} -J0.001 -n 1000 -b $$b -iber -onull $$f || exit 6; \ done; done; fi check-xer: @if test -f sample-DataInterChange-1.xer ; then \ for f in sample-DataInterChange-*.xer; do \ for b in 1 17 33 980 8192; do \ echo "Recoding $$f into DER and back ($$b)..."; \ ./${TARGET} -b $$b -ixer -oder $$f > ./.tmp.1.$$$$ || exit 2; \ ./${TARGET} -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \ diff $$f ./.tmp.2.$$$$ || exit 4; \ rm -f ./.tmp.[12].$$$$; \ echo "Test junking $$f (please wait)..."; \ ./${TARGET} -J0.0001 -n 1000 -b $$b -ixer -onull $$f || exit 5; \ ./${TARGET} -J0.001 -n 1000 -b $$b -ixer -onull $$f || exit 6; \ done; done; fi check-per: @if test -f sample-DataInterChange-1-nopad.per ; then \ for f in sample-DataInterChange-[1-9]-nopad.per; do \ for b in 1 17 33 980 8192; do \ echo "Recoding non-padded $$f into DER into XER and back ($$b)..."; \ ./${TARGET} -b $$b -per-nopad -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \ ./${TARGET} -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \ ./${TARGET} -b $$b -ixer -oder ./.tmp.2.$$$$ > ./.tmp.3.$$$$ || exit 4; \ diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 5; \ rm -f ./.tmp.[123].$$$$; \ echo "Test junking $$f (please wait)..."; \ ./${TARGET} -J0.0001 -n 1000 -b $$b -per-nopad -iper -onull $$f || exit 6; \ ./${TARGET} -J0.001 -n 1000 -b $$b -per-nopad -iper -onull $$f || exit 7; \ done; done; fi @if test -f sample-DataInterChange-1.per ; then \ for f in sample-*-[1-9].per; do \ pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z-]+)-[0-9].*/\1/"`; \ for b in 1 17 33 980 8192; do \ echo "Recoding $$f into DER into XER and back ($$b)..."; \ ./${TARGET} -b $$b -p $$pdu -iper -oder $$f > ./.tmp.1.$$$$ || exit 3; \ ./${TARGET} -b $$b -p $$pdu -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 4; \ ./${TARGET} -b $$b -p $$pdu -ixer -oper ./.tmp.2.$$$$ > ./.tmp.1.$$$$ || exit 5; \ diff $$f ./.tmp.1.$$$$ || exit 6; \ rm -f ./.tmp.[12].$$$$; \ echo "Test junking $$f (please wait)..."; \ ./${TARGET} -J0.0001 -n 1000 -b $$b -iper -onull $$f || exit 7; \ ./${TARGET} -J0.001 -n 1000 -b $$b -iper -onull $$f || exit 8; \ done; done; fi distclean: clean rm -f $(ASN_MODULE_SOURCES) rm -f $(ASN_MODULE_HEADERS) rm -f $(ASN_CONVERTER_SOURCES) $(ASN_CONVERTER_HEADERS) rm -f Makefile.am.sample asn1c-0.9.28+dfsg/examples/sample.source.TAP3/README0000644000000000000000000000245413065714043020230 0ustar rootroot GENERAL INFORMATION =================== The GSM TAP3 (Transferred Account Procedure, Version 3) decoder. Invoking `make` will compile the ASN.1 specifications from the ../tap3.asn1 file. THERE IS NO tap3.asn1 FILE THERE YET! OBTAINING THE TAP3 SPECIFICATION ================================ Due to licensing restrictions, asn1c can not include the TAP3 ASN.1 module in its distribution. To obtain the TAP3 ASN.1 specification, you should go to http://www.gsmworld.com/using/billing/tap3_legal.html and agree with their licensing terms by clicking the "I ACCEPT" button. A .ZIP file with several Microsoft Word .DOC files will download shortly. You should extract the TAP-0311 ASN.1 module from one of these .DOC files and save it as the ../tap3.asn1 file. The ../tap3.asn1 file should start with the following line "TAP-0311 DEFINITIONS IMPLICIT TAGS ::=" and end with the "END" token. Be careful not to copy any non-ASN.1 preambles from that .DOC file. After obtaining the tap3.asn1, type `make` in the directory containing this README file. tap3dump USAGE ============== The tap3dump utility may be used to dump the contents of the BER-encoded TAP3 data record file: ./tap3dump tapfile.ber # Print as XML (BASIC-XER) The full list of recognized command line options may be obtained with > ./tap3dump -h asn1c-0.9.28+dfsg/examples/sample.source.TAP3/sample-DataInterChange-1.ber0000644000000000000000000000056413065714043024440 0ustar rootrootapdy_.WERFD_6XLKJE_m31707lP20050405090547_“+0200…P20050405090547_“+0200kP20050405090547_“+0200_!_= e!_EURPj_i__hナ_》fE)(_”_“+0200<+7 _8_:7 _8_:7 _8酸:cNj" _8_-Jw農 ア_;j" _8_-Jッ_ カ_;$}nnno9eP20050404162453_“+0200P20050405090059_“+0200asn1c-0.9.28+dfsg/examples/sample.source.TAP3/config.h0000644000000000000000000000031013065714043020753 0ustar rootroot extern int opt_debug; #define ASN_DEBUG(fmt, args...) do { \ if(opt_debug < 2) break; \ fprintf(stderr, fmt, ##args); \ fprintf(stderr, " (%s:%d)\n", \ __FILE__, __LINE__); \ } while(0) asn1c-0.9.28+dfsg/examples/sample.source.MHEG5/0000755000000000000000000000000013065714043017441 5ustar rootrootasn1c-0.9.28+dfsg/examples/sample.source.MHEG5/Makefile0000644000000000000000000003206413065714043021106 0ustar rootrootASN_MODULE_SOURCES= \ InterchangedObject.c \ RootClass.c \ GroupClass.c \ StandardIdentifier.c \ GroupItem.c \ ApplicationClass.c \ DefaultAttribute.c \ FontBody.c \ SceneClass.c \ SceneCoordinateSystem.c \ AspectRatio.c \ NextScene.c \ IngredientClass.c \ ContentBody.c \ ReferencedContent.c \ LinkClass.c \ LinkCondition.c \ EventType.c \ EventData.c \ ProgramClass.c \ ResidentProgramClass.c \ RemoteProgramClass.c \ InterchangedProgramClass.c \ PaletteClass.c \ FontClass.c \ CursorShapeClass.c \ VariableClass.c \ OriginalValue.c \ BooleanVariableClass.c \ IntegerVariableClass.c \ OctetStringVariableClass.c \ ObjectRefVariableClass.c \ ContentRefVariableClass.c \ PresentableClass.c \ TokenManagerClass.c \ Movement.c \ TokenGroupClass.c \ TokenGroupItem.c \ ActionSlot.c \ ListGroupClass.c \ VisibleClass.c \ OriginalBoxSize.c \ BitmapClass.c \ LineArtClass.c \ RectangleClass.c \ DynamicLineArtClass.c \ TextClass.c \ Justification.c \ LineOrientation.c \ StartCorner.c \ StreamClass.c \ StreamComponent.c \ Storage.c \ AudioClass.c \ VideoClass.c \ Termination.c \ RTGraphicsClass.c \ InteractibleClass.c \ SliderClass.c \ Orientation.c \ SliderStyle.c \ EntryFieldClass.c \ InputType.c \ HyperTextClass.c \ ButtonClass.c \ HotspotClass.c \ PushButtonClass.c \ SwitchButtonClass.c \ ButtonStyle.c \ ActionClass.c \ ElementaryAction.c \ Add.c \ AddItem.c \ Append.c \ Call.c \ CallActionSlot.c \ Clone.c \ CloseConnection.c \ DelItem.c \ DeselectItem.c \ Divide.c \ DrawArc.c \ DrawLine.c \ DrawOval.c \ DrawPolygon.c \ DrawPolyline.c \ DrawRectangle.c \ DrawSector.c \ Fork.c \ GetAvailabilityStatus.c \ GetBoxSize.c \ GetCellItem.c \ GetCursorPosition.c \ GetEngineSupport.c \ GetEntryPoint.c \ GetFillColour.c \ GetFirstItem.c \ GetHighlightStatus.c \ GetInteractionStatus.c \ GetItemStatus.c \ GetLabel.c \ GetLastAnchorFired.c \ GetLineColour.c \ GetLineStyle.c \ GetLineWidth.c \ GetListItem.c \ GetListSize.c \ GetOverwriteMode.c \ GetPortion.c \ GetPosition.c \ GetRunningStatus.c \ GetSelectionStatus.c \ GetSliderValue.c \ GetTextContent.c \ GetTextData.c \ GetTokenPosition.c \ GetVolume.c \ Modulo.c \ Move.c \ MoveTo.c \ Multiply.c \ OpenConnection.c \ PutBefore.c \ PutBehind.c \ ReadPersistent.c \ ScaleBitmap.c \ ScaleVideo.c \ ScrollItems.c \ SelectItem.c \ SendEvent.c \ SetBoxSize.c \ SetCachePriority.c \ SetCounterEndPosition.c \ SetCounterPosition.c \ SetCounterTrigger.c \ SetCursorPosition.c \ SetCursorShape.c \ SetData.c \ SetEntryPoint.c \ SetFillColour.c \ SetFirstItem.c \ SetFontRef.c \ SetHighlightStatus.c \ SetInteractionStatus.c \ SetLabel.c \ SetLineColour.c \ SetLineStyle.c \ SetLineWidth.c \ SetOverwriteMode.c \ SetPaletteRef.c \ SetPortion.c \ SetPosition.c \ SetSliderValue.c \ SetSpeed.c \ SetTimer.c \ NewTimer.c \ SetTransparency.c \ SetVariable.c \ SetVolume.c \ Step.c \ StorePersistent.c \ Subtract.c \ TestVariable.c \ ToggleItem.c \ TransitionTo.c \ ConnectionTagOrNull.c \ ComparisonValue.c \ EmulatedEventData.c \ NewColour.c \ NewContent.c \ NewFont.c \ NewReferencedContent.c \ NewContentSize.c \ NewVariableValue.c \ Parameter.c \ Point.c \ Rational.c \ ObjectReference.c \ ExternalReference.c \ IndirectReference.c \ ContentReference.c \ GenericObjectReference.c \ GenericContentReference.c \ GenericInteger.c \ GenericBoolean.c \ GenericOctetString.c \ Colour.c \ XYPosition.c \ OctetString.c ASN_MODULE_HEADERS= \ InterchangedObject.h \ RootClass.h \ GroupClass.h \ StandardIdentifier.h \ GroupItem.h \ ApplicationClass.h \ DefaultAttribute.h \ FontBody.h \ SceneClass.h \ SceneCoordinateSystem.h \ AspectRatio.h \ NextScene.h \ IngredientClass.h \ ContentBody.h \ ReferencedContent.h \ LinkClass.h \ LinkCondition.h \ EventType.h \ EventData.h \ ProgramClass.h \ ResidentProgramClass.h \ RemoteProgramClass.h \ InterchangedProgramClass.h \ PaletteClass.h \ FontClass.h \ CursorShapeClass.h \ VariableClass.h \ OriginalValue.h \ BooleanVariableClass.h \ IntegerVariableClass.h \ OctetStringVariableClass.h \ ObjectRefVariableClass.h \ ContentRefVariableClass.h \ PresentableClass.h \ TokenManagerClass.h \ Movement.h \ TokenGroupClass.h \ TokenGroupItem.h \ ActionSlot.h \ ListGroupClass.h \ VisibleClass.h \ OriginalBoxSize.h \ BitmapClass.h \ LineArtClass.h \ RectangleClass.h \ DynamicLineArtClass.h \ TextClass.h \ Justification.h \ LineOrientation.h \ StartCorner.h \ StreamClass.h \ StreamComponent.h \ Storage.h \ AudioClass.h \ VideoClass.h \ Termination.h \ RTGraphicsClass.h \ InteractibleClass.h \ SliderClass.h \ Orientation.h \ SliderStyle.h \ EntryFieldClass.h \ InputType.h \ HyperTextClass.h \ ButtonClass.h \ HotspotClass.h \ PushButtonClass.h \ SwitchButtonClass.h \ ButtonStyle.h \ ActionClass.h \ ElementaryAction.h \ Add.h \ AddItem.h \ Append.h \ Call.h \ CallActionSlot.h \ Clone.h \ CloseConnection.h \ DelItem.h \ DeselectItem.h \ Divide.h \ DrawArc.h \ DrawLine.h \ DrawOval.h \ DrawPolygon.h \ DrawPolyline.h \ DrawRectangle.h \ DrawSector.h \ Fork.h \ GetAvailabilityStatus.h \ GetBoxSize.h \ GetCellItem.h \ GetCursorPosition.h \ GetEngineSupport.h \ GetEntryPoint.h \ GetFillColour.h \ GetFirstItem.h \ GetHighlightStatus.h \ GetInteractionStatus.h \ GetItemStatus.h \ GetLabel.h \ GetLastAnchorFired.h \ GetLineColour.h \ GetLineStyle.h \ GetLineWidth.h \ GetListItem.h \ GetListSize.h \ GetOverwriteMode.h \ GetPortion.h \ GetPosition.h \ GetRunningStatus.h \ GetSelectionStatus.h \ GetSliderValue.h \ GetTextContent.h \ GetTextData.h \ GetTokenPosition.h \ GetVolume.h \ Modulo.h \ Move.h \ MoveTo.h \ Multiply.h \ OpenConnection.h \ PutBefore.h \ PutBehind.h \ ReadPersistent.h \ ScaleBitmap.h \ ScaleVideo.h \ ScrollItems.h \ SelectItem.h \ SendEvent.h \ SetBoxSize.h \ SetCachePriority.h \ SetCounterEndPosition.h \ SetCounterPosition.h \ SetCounterTrigger.h \ SetCursorPosition.h \ SetCursorShape.h \ SetData.h \ SetEntryPoint.h \ SetFillColour.h \ SetFirstItem.h \ SetFontRef.h \ SetHighlightStatus.h \ SetInteractionStatus.h \ SetLabel.h \ SetLineColour.h \ SetLineStyle.h \ SetLineWidth.h \ SetOverwriteMode.h \ SetPaletteRef.h \ SetPortion.h \ SetPosition.h \ SetSliderValue.h \ SetSpeed.h \ SetTimer.h \ NewTimer.h \ SetTransparency.h \ SetVariable.h \ SetVolume.h \ Step.h \ StorePersistent.h \ Subtract.h \ TestVariable.h \ ToggleItem.h \ TransitionTo.h \ ConnectionTagOrNull.h \ ComparisonValue.h \ EmulatedEventData.h \ NewColour.h \ NewContent.h \ NewFont.h \ NewReferencedContent.h \ NewContentSize.h \ NewVariableValue.h \ Parameter.h \ Point.h \ Rational.h \ ObjectReference.h \ ExternalReference.h \ IndirectReference.h \ ContentReference.h \ GenericObjectReference.h \ GenericContentReference.h \ GenericInteger.h \ GenericBoolean.h \ GenericOctetString.h \ Colour.h \ XYPosition.h \ OctetString.h ASN_MODULE_HEADERS+=ANY.h ASN_MODULE_SOURCES+=ANY.c ASN_MODULE_HEADERS+=BOOLEAN.h ASN_MODULE_SOURCES+=BOOLEAN.c ASN_MODULE_HEADERS+=ENUMERATED.h ASN_MODULE_SOURCES+=ENUMERATED.c ASN_MODULE_HEADERS+=INTEGER.h ASN_MODULE_HEADERS+=NativeEnumerated.h ASN_MODULE_HEADERS+=IA5String.h ASN_MODULE_SOURCES+=IA5String.c ASN_MODULE_SOURCES+=INTEGER.c ASN_MODULE_HEADERS+=NULL.h ASN_MODULE_SOURCES+=NULL.c ASN_MODULE_SOURCES+=NativeEnumerated.c ASN_MODULE_HEADERS+=NativeInteger.h ASN_MODULE_SOURCES+=NativeInteger.c ASN_MODULE_HEADERS+=asn_SEQUENCE_OF.h ASN_MODULE_SOURCES+=asn_SEQUENCE_OF.c ASN_MODULE_HEADERS+=asn_SET_OF.h ASN_MODULE_SOURCES+=asn_SET_OF.c ASN_MODULE_HEADERS+=constr_CHOICE.h ASN_MODULE_SOURCES+=constr_CHOICE.c ASN_MODULE_HEADERS+=constr_SEQUENCE.h ASN_MODULE_SOURCES+=constr_SEQUENCE.c ASN_MODULE_HEADERS+=constr_SEQUENCE_OF.h ASN_MODULE_SOURCES+=constr_SEQUENCE_OF.c ASN_MODULE_HEADERS+=constr_SET_OF.h ASN_MODULE_HEADERS+=constr_SET.h ASN_MODULE_SOURCES+=constr_SET.c ASN_MODULE_SOURCES+=constr_SET_OF.c ASN_MODULE_HEADERS+=asn_application.h ASN_MODULE_HEADERS+=asn_system.h ASN_MODULE_HEADERS+=asn_codecs.h ASN_MODULE_HEADERS+=asn_internal.h ASN_MODULE_HEADERS+=OCTET_STRING.h ASN_MODULE_SOURCES+=OCTET_STRING.c ASN_MODULE_HEADERS+=BIT_STRING.h ASN_MODULE_SOURCES+=BIT_STRING.c ASN_MODULE_SOURCES+=asn_codecs_prim.c ASN_MODULE_HEADERS+=asn_codecs_prim.h ASN_MODULE_HEADERS+=ber_tlv_length.h ASN_MODULE_SOURCES+=ber_tlv_length.c ASN_MODULE_HEADERS+=ber_tlv_tag.h ASN_MODULE_SOURCES+=ber_tlv_tag.c ASN_MODULE_HEADERS+=ber_decoder.h ASN_MODULE_SOURCES+=ber_decoder.c ASN_MODULE_HEADERS+=der_encoder.h ASN_MODULE_SOURCES+=der_encoder.c ASN_MODULE_HEADERS+=constr_TYPE.h ASN_MODULE_SOURCES+=constr_TYPE.c ASN_MODULE_HEADERS+=constraints.h ASN_MODULE_SOURCES+=constraints.c ASN_MODULE_HEADERS+=xer_support.h ASN_MODULE_SOURCES+=xer_support.c ASN_MODULE_HEADERS+=xer_decoder.h ASN_MODULE_SOURCES+=xer_decoder.c ASN_MODULE_HEADERS+=xer_encoder.h ASN_MODULE_SOURCES+=xer_encoder.c ASN_MODULE_HEADERS+=per_support.h ASN_MODULE_SOURCES+=per_support.c ASN_MODULE_HEADERS+=per_decoder.h ASN_MODULE_SOURCES+=per_decoder.c ASN_MODULE_HEADERS+=per_encoder.h ASN_MODULE_SOURCES+=per_encoder.c ASN_CONVERTER_SOURCES+=converter-sample.c lib_LTLIBRARIES=libsomething.la libsomething_la_SOURCES=$(ASN_MODULE_SOURCES) $(ASN_MODULE_HEADERS) # This file may be used as an input for make(3) # Remove the lines below to convert it into a pure .am file TARGET = mheg5dump CFLAGS += -DHAVE_CONFIG_H -DJUNKTEST -DPDU=InterchangedObject -I. OBJS=${ASN_MODULE_SOURCES:.c=.o} ${ASN_CONVERTER_SOURCES:.c=.o} all: InterchangedObject.c $(TARGET) $(TARGET): ${OBJS} $(CC) $(CFLAGS) -o $(TARGET) ${OBJS} $(LDFLAGS) $(LIBS) .SUFFIXES: .SUFFIXES: .c .o .c.o: $(CC) $(CFLAGS) -o $@ -c $< clean: rm -f $(TARGET) rm -f $(OBJS) regen: regenerate-from-asn1-source regenerate-from-asn1-source: ../../asn1c/asn1c -S ../../skeletons -pdu=InterchangedObject -fcompound-names ../ISO13522-MHEG-5.asn InterchangedObject.c: ../sample.makefile.regen ../ISO13522-MHEG-5.asn make regen-makefile @touch InterchangedObject.c make regen-makefile: ASN1CMDOPTS="-fcompound-names" \ ASN1MODULES="../ISO13522-MHEG-5.asn" \ ASN1PDU=InterchangedObject \ PROGNAME=mheg5dump \ ../sample.makefile.regen check: ${TARGET} check-ber check-xer check-per @echo ================ @echo All tests passed @echo ================ check-ber: @if test -f sample-InterchangedObject-1.[db]er ; then \ for f in sample-InterchangedObject-*.[db]er; do \ for b in 1 17 33 980 8192; do \ echo "Recoding $$f into XER and back ($$b)..."; \ ./${TARGET} -b $$b -iber -oxer $$f > ./.tmp.1.$$$$ || exit 2; \ ./${TARGET} -b $$b -ixer -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 2; \ diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 2; \ rm -f ./.tmp.[12].$$$$; \ echo "Test junking $$f (please wait)..."; \ ./${TARGET} -J0.0001 -n 1000 -b $$b -iber -onull $$f || exit 2; \ ./${TARGET} -J0.001 -n 1000 -b $$b -iber -onull $$f || exit 2; \ done; done; fi check-xer: @if test -f sample-InterchangedObject-1.xer ; then \ for f in sample-InterchangedObject-*.xer; do \ for b in 1 17 33 980 8192; do \ echo "Recoding $$f into DER and back ($$b)..."; \ ./${TARGET} -b $$b -ixer -oder $$f > ./.tmp.1.$$$$ || exit 2; \ ./${TARGET} -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 2; \ diff $$f ./.tmp.2.$$$$ || exit 2; \ rm -f ./.tmp.[12].$$$$; \ echo "Test junking $$f (please wait)..."; \ ./${TARGET} -J0.0001 -n 1000 -b $$b -ixer -onull $$f || exit 2; \ ./${TARGET} -J0.001 -n 1000 -b $$b -ixer -onull $$f || exit 2; \ done; done; fi check-per: @if test -f sample-InterchangedObject-1.per ; then \ for f in sample-InterchangedObject-[1-9].per; do \ for b in 1 17 33 980 8192; do \ echo "Recoding $$f into DER into XER and back ($$b)..."; \ ./${TARGET} -b $$b -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \ ./${TARGET} -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 2; \ ./${TARGET} -b $$b -ixer -oder ./.tmp.2.$$$$ > ./.tmp.3.$$$$ || exit 2; \ diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 2; \ rm -f ./.tmp.[123].$$$$; \ echo "Test junking $$f (please wait)..."; \ ./${TARGET} -J0.0001 -n 1000 -b $$b -iper -onull $$f || exit 2; \ ./${TARGET} -J0.001 -n 1000 -b $$b -iper -onull $$f || exit 2; \ done; done; fi @if test -f sample-InterchangedObject-1-padded.per ; then \ for f in sample-*-[1-9]-padded.per; do \ pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z-]+)-[0-9].*/\1/"`; \ for b in 1 17 33 980 8192; do \ echo "Recoding byte-padded $$f into DER into XER and back ($$b)..."; \ ./${TARGET} -b $$b -per-padded -p $$pdu -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \ ./${TARGET} -b $$b -p $$pdu -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 2; \ ./${TARGET} -b $$b -p $$pdu -ixer -oper ./.tmp.2.$$$$ > ./.tmp.1.$$$$ || exit 2; \ diff $$f ./.tmp.1.$$$$ || exit 2; \ rm -f ./.tmp.[12].$$$$; \ echo "Test junking $$f (please wait)..."; \ ./${TARGET} -J0.0001 -n 1000 -b $$b -per-padded -iper -onull $$f || exit 2; \ ./${TARGET} -J0.001 -n 1000 -b $$b -per-padded -iper -onull $$f || exit 2; \ done; done; fi distclean: clean rm -f $(ASN_MODULE_SOURCES) rm -f $(ASN_MODULE_HEADERS) rm -f $(ASN_CONVERTER_SOURCES) $(ASN_CONVERTER_HEADERS) rm -f Makefile.am.sample asn1c-0.9.28+dfsg/examples/sample.source.MHEG5/README0000644000000000000000000000200713065714043020320 0ustar rootroot GENERAL INFORMATION =================== The ISO MHEG-5 (Multimedia Hypermedia Experts Group, Multimedia Presentations) decoder. Invoking `make` will first attempt compile the ASN.1 specifications from the ../ISO13522-MHEG-5.asn file. THERE IS NO ISO13522-MHEG-5.asn FILE THERE YET! OBTAINING THE MHEG-5 SPECIFICATION ================================== Due to licensing restrictions, asn1c can not include the MHEG-5 ASN.1 module in its distribution. To obtain the MHEG-5 ASN.1 specification, you should go to http://www.itu.int/ITU-T/asn1/database/itu-t/t/t172 and select the latest "Text" version of the corresponding ASN.1 module. After obtaining the ISO13522-MHEG-5.asn, type `make` in the directory containing this README file. mheg5dump USAGE =============== The mheg5dump utility may be used to dump the contents of the BER-encoded MHEG-5 data record file: ./mheg5dump mhegscene.ber # Print MHEG-5 stream as XML (BASIC-XER) The full list of recognized command line options may be obtained with ./mheg5dump -h asn1c-0.9.28+dfsg/examples/sample.source.MHEG5/sample-InterchangedObject-1.xer0000644000000000000000000001015513065714043025322 0ustar rootroot smth 0 14 ldskfjlsfd 22 3 39 42 0 45 xxx 113 a 5 103 31 3 100 100 asn1c-0.9.28+dfsg/examples/sample.source.MHEG5/config.h0000644000000000000000000000031013065714043021051 0ustar rootroot extern int opt_debug; #define ASN_DEBUG(fmt, args...) do { \ if(opt_debug < 2) break; \ fprintf(stderr, fmt, ##args); \ fprintf(stderr, " (%s:%d)\n", \ __FILE__, __LINE__); \ } while(0) asn1c-0.9.28+dfsg/examples/crfc2asn1.pl0000755000000000000000000000564613065714043016212 0ustar rootroot#!/usr/bin/env perl # # Extract the ASN.1 module text from the given set of RFC files. # my $inasn = 0; # Are we inside ASN.1 grammar? my $found = 0; my $currentFname = ''; if(-t STDIN && $#ARGV == -1) { print STDERR "Extract the ASN.1 specification from the RFC file(s).\n"; print STDERR "Usage 1: $0 ...\n"; print STDERR "Usage 2: | $0\n"; exit(1); } while(<>) { # # Strip RFC page delimiters. # next if /^[A-Z].*\[Page [0-9]+\]$/; next if /^ $/; next if /^RFC [0-9].*[0-9]+$/; if($inasn == 0) { # # The least correct way to find the start of ASN # definition. That is, to ask a user. # if(/^[ \t]*END[ \t]*(--.*)?$/) { print STDERR "Missed an ASN.1 grammar before line ". $. ."?\n"; exit(1); } my $modName = ''; # ASN.1 module name my $rfcid = ''; $rfcid = $1 . '-' if($ARGV =~ /([a-z0-9]+)\.[^.]+$/i); if(/^[ \t]*([A-Z][A-Za-z0-9-]*).*DEFINITIONS.*::=/) { $modName = $1; $currentFname = $rfcid . $modName . ".asn1"; $inasn = 1; } elsif(/^[ \t]*([A-Z][A-Za-z0-9-]*).*{[ \t]*(?:joint-)?iso/ || /^[ \t]*{[ \t]*(?:joint-)?iso/) { my @a = ($_); $modName = $1; unless(length($modName)) { next unless $prevLine =~ /^[ \t]*([A-Z][A-Za-z0-9-]*)[ \t]*$/; $modName = $1; unshift(@a, $prevLine); } $currentFname = $rfcid . $modName . ".asn1"; my $i; for($i = 0; $i < 8; $i++) { $_ = <>; push(@a, $_); if(/DEFINITIONS/) { $_ = join('', @a); $inasn = 1; last; } } next unless $inasn; } elsif(/^\s*DEFINITIONS\s*$/ && $prevLine =~ /^\s*([A-Z][A-Za-z0-9-]*)\s*{[0-9a-z)( -]+}\s*$/) { $_ = $prevLine . $prevComments . $_; $modName = $1; $currentFname = $rfcid . $modName. ".asn1"; $inasn = 1; } else { if(/^[ \t]*--/) { $prevComments .= $_; } else { $prevComments = ''; $prevLine = $_; } next; } print STDERR "Found $modName at line $.\n=> Saving as $currentFname\n"; open(O, "> $currentFname") or die "Can't open $currentFname"; select(O); $found++; print "\n"; print "-- \n"; print "-- ASN.1 module found by $0 in $ARGV at line " . $. . "\n"; print "-- \n"; print "\n"; } if(/^[ \t]*END[ \t]*(--.*)?$/) { print; select(STDOUT); close(O); $inasn = 0; next; } # # The following clauses are primarily designed to simplify # asn1c tool behavior. # You may want to get rid of them if you're doing generic # ASN.1 extraction and do not want to alter the ASN.1 specs at all. # if( /^([ \t]*)((UniversalString|BMPString|UTF8String)\s+::=\s+\[[A-Z]+\s\d+\]\sIMPLICIT\sOCTET\sSTRING)(.*)$/ms ) { print "\n-- Legacy redefinition of $3 removed by $0:\n"; print "$1-- $2 -- $4"; next; } elsif(/delete following line if \"new\" types are supported/) { print; print "/* Legacy constructs deleted by $0:\n"; $_ = <>; print; print " */\n"; next; } print; # Dump the ASN.1 module line out. } die "No ASN.1 modules found\n" unless $found; asn1c-0.9.28+dfsg/examples/sample.source.MEGACO/0000755000000000000000000000000013065714043017567 5ustar rootrootasn1c-0.9.28+dfsg/examples/sample.source.MEGACO/Makefile0000644000000000000000000002434013065714043021232 0ustar rootrootASN_MODULE_SOURCES= \ MegacoMessage.c \ AuthenticationHeader.c \ SecurityParmIndex.c \ SequenceNum.c \ AuthData.c \ Message.c \ MId.c \ DomainName.c \ IP4Address.c \ IP6Address.c \ PathName.c \ Transaction.c \ TransactionId.c \ TransactionRequest.c \ TransactionPending.c \ TransactionReply.c \ TransactionResponseAck.c \ TransactionAck.c \ ErrorDescriptor.c \ ErrorCode.c \ ErrorText.c \ ContextID.c \ ActionRequest.c \ ActionReply.c \ ContextRequest.c \ ContextAttrAuditRequest.c \ CommandRequest.c \ Command.c \ CommandReply.c \ TopologyRequest.c \ AmmRequest.c \ AmmDescriptor.c \ AmmsReply.c \ SubtractRequest.c \ AuditRequest.c \ AuditReply.c \ AuditResult.c \ TerminationAudit.c \ AuditReturnParameter.c \ AuditDescriptor.c \ NotifyRequest.c \ NotifyReply.c \ ObservedEventsDescriptor.c \ ObservedEvent.c \ EventName.c \ EventParameter.c \ ServiceChangeRequest.c \ ServiceChangeReply.c \ ServiceChangeResult.c \ WildcardField.c \ TerminationID.c \ TerminationIDList.c \ MediaDescriptor.c \ StreamDescriptor.c \ StreamParms.c \ LocalControlDescriptor.c \ StreamMode.c \ PropertyParm.c \ Name.c \ PkgdName.c \ Relation.c \ LocalRemoteDescriptor.c \ PropertyGroup.c \ TerminationStateDescriptor.c \ EventBufferControl.c \ ServiceState.c \ MuxDescriptor.c \ MuxType.c \ StreamID.c \ EventsDescriptor.c \ RequestedEvent.c \ RequestedActions.c \ EventDM.c \ SecondEventsDescriptor.c \ SecondRequestedEvent.c \ SecondRequestedActions.c \ EventBufferDescriptor.c \ EventSpec.c \ SignalsDescriptor.c \ SignalRequest.c \ SeqSigList.c \ Signal.c \ SignalType.c \ SignalName.c \ NotifyCompletion.c \ SigParameter.c \ RequestID.c \ ModemDescriptor.c \ ModemType.c \ DigitMapDescriptor.c \ DigitMapName.c \ DigitMapValue.c \ ServiceChangeParm.c \ ServiceChangeAddress.c \ ServiceChangeResParm.c \ ServiceChangeMethod.c \ ServiceChangeProfile.c \ PackagesDescriptor.c \ PackagesItem.c \ StatisticsDescriptor.c \ StatisticsParameter.c \ NonStandardData.c \ NonStandardIdentifier.c \ H221NonStandard.c \ TimeNotation.c \ Value.c ASN_MODULE_HEADERS= \ MegacoMessage.h \ AuthenticationHeader.h \ SecurityParmIndex.h \ SequenceNum.h \ AuthData.h \ Message.h \ MId.h \ DomainName.h \ IP4Address.h \ IP6Address.h \ PathName.h \ Transaction.h \ TransactionId.h \ TransactionRequest.h \ TransactionPending.h \ TransactionReply.h \ TransactionResponseAck.h \ TransactionAck.h \ ErrorDescriptor.h \ ErrorCode.h \ ErrorText.h \ ContextID.h \ ActionRequest.h \ ActionReply.h \ ContextRequest.h \ ContextAttrAuditRequest.h \ CommandRequest.h \ Command.h \ CommandReply.h \ TopologyRequest.h \ AmmRequest.h \ AmmDescriptor.h \ AmmsReply.h \ SubtractRequest.h \ AuditRequest.h \ AuditReply.h \ AuditResult.h \ TerminationAudit.h \ AuditReturnParameter.h \ AuditDescriptor.h \ NotifyRequest.h \ NotifyReply.h \ ObservedEventsDescriptor.h \ ObservedEvent.h \ EventName.h \ EventParameter.h \ ServiceChangeRequest.h \ ServiceChangeReply.h \ ServiceChangeResult.h \ WildcardField.h \ TerminationID.h \ TerminationIDList.h \ MediaDescriptor.h \ StreamDescriptor.h \ StreamParms.h \ LocalControlDescriptor.h \ StreamMode.h \ PropertyParm.h \ Name.h \ PkgdName.h \ Relation.h \ LocalRemoteDescriptor.h \ PropertyGroup.h \ TerminationStateDescriptor.h \ EventBufferControl.h \ ServiceState.h \ MuxDescriptor.h \ MuxType.h \ StreamID.h \ EventsDescriptor.h \ RequestedEvent.h \ RequestedActions.h \ EventDM.h \ SecondEventsDescriptor.h \ SecondRequestedEvent.h \ SecondRequestedActions.h \ EventBufferDescriptor.h \ EventSpec.h \ SignalsDescriptor.h \ SignalRequest.h \ SeqSigList.h \ Signal.h \ SignalType.h \ SignalName.h \ NotifyCompletion.h \ SigParameter.h \ RequestID.h \ ModemDescriptor.h \ ModemType.h \ DigitMapDescriptor.h \ DigitMapName.h \ DigitMapValue.h \ ServiceChangeParm.h \ ServiceChangeAddress.h \ ServiceChangeResParm.h \ ServiceChangeMethod.h \ ServiceChangeProfile.h \ PackagesDescriptor.h \ PackagesItem.h \ StatisticsDescriptor.h \ StatisticsParameter.h \ NonStandardData.h \ NonStandardIdentifier.h \ H221NonStandard.h \ TimeNotation.h \ Value.h ASN_MODULE_HEADERS+=BOOLEAN.h ASN_MODULE_SOURCES+=BOOLEAN.c ASN_MODULE_HEADERS+=INTEGER.h ASN_MODULE_HEADERS+=NativeEnumerated.h ASN_MODULE_HEADERS+=IA5String.h ASN_MODULE_SOURCES+=IA5String.c ASN_MODULE_SOURCES+=INTEGER.c ASN_MODULE_HEADERS+=NULL.h ASN_MODULE_SOURCES+=NULL.c ASN_MODULE_SOURCES+=NativeEnumerated.c ASN_MODULE_HEADERS+=NativeInteger.h ASN_MODULE_SOURCES+=NativeInteger.c ASN_MODULE_HEADERS+=OBJECT_IDENTIFIER.h ASN_MODULE_SOURCES+=OBJECT_IDENTIFIER.c ASN_MODULE_HEADERS+=asn_SEQUENCE_OF.h ASN_MODULE_SOURCES+=asn_SEQUENCE_OF.c ASN_MODULE_HEADERS+=asn_SET_OF.h ASN_MODULE_SOURCES+=asn_SET_OF.c ASN_MODULE_HEADERS+=constr_CHOICE.h ASN_MODULE_SOURCES+=constr_CHOICE.c ASN_MODULE_HEADERS+=constr_SEQUENCE.h ASN_MODULE_SOURCES+=constr_SEQUENCE.c ASN_MODULE_HEADERS+=constr_SEQUENCE_OF.h ASN_MODULE_SOURCES+=constr_SEQUENCE_OF.c ASN_MODULE_HEADERS+=constr_SET_OF.h ASN_MODULE_SOURCES+=constr_SET_OF.c ASN_MODULE_HEADERS+=asn_application.h ASN_MODULE_HEADERS+=asn_system.h ASN_MODULE_HEADERS+=asn_codecs.h ASN_MODULE_HEADERS+=asn_internal.h ASN_MODULE_HEADERS+=OCTET_STRING.h ASN_MODULE_SOURCES+=OCTET_STRING.c ASN_MODULE_HEADERS+=BIT_STRING.h ASN_MODULE_SOURCES+=BIT_STRING.c ASN_MODULE_SOURCES+=asn_codecs_prim.c ASN_MODULE_HEADERS+=asn_codecs_prim.h ASN_MODULE_HEADERS+=ber_tlv_length.h ASN_MODULE_SOURCES+=ber_tlv_length.c ASN_MODULE_HEADERS+=ber_tlv_tag.h ASN_MODULE_SOURCES+=ber_tlv_tag.c ASN_MODULE_HEADERS+=ber_decoder.h ASN_MODULE_SOURCES+=ber_decoder.c ASN_MODULE_HEADERS+=der_encoder.h ASN_MODULE_SOURCES+=der_encoder.c ASN_MODULE_HEADERS+=constr_TYPE.h ASN_MODULE_SOURCES+=constr_TYPE.c ASN_MODULE_HEADERS+=constraints.h ASN_MODULE_SOURCES+=constraints.c ASN_MODULE_HEADERS+=xer_support.h ASN_MODULE_SOURCES+=xer_support.c ASN_MODULE_HEADERS+=xer_decoder.h ASN_MODULE_SOURCES+=xer_decoder.c ASN_MODULE_HEADERS+=xer_encoder.h ASN_MODULE_SOURCES+=xer_encoder.c ASN_MODULE_HEADERS+=per_support.h ASN_MODULE_SOURCES+=per_support.c ASN_MODULE_HEADERS+=per_decoder.h ASN_MODULE_SOURCES+=per_decoder.c ASN_MODULE_HEADERS+=per_encoder.h ASN_MODULE_SOURCES+=per_encoder.c ASN_MODULE_HEADERS+=per_opentype.h ASN_MODULE_SOURCES+=per_opentype.c ASN_CONVERTER_SOURCES+=converter-sample.c lib_LTLIBRARIES=libsomething.la libsomething_la_SOURCES=$(ASN_MODULE_SOURCES) $(ASN_MODULE_HEADERS) # This file may be used as an input for make(3) # Remove the lines below to convert it into a pure .am file TARGET = megaco-dump CFLAGS += -DHAVE_CONFIG_H -DJUNKTEST -DPDU=MegacoMessage -I. OBJS=${ASN_MODULE_SOURCES:.c=.o} ${ASN_CONVERTER_SOURCES:.c=.o} all: MegacoMessage.c $(TARGET) $(TARGET): ${OBJS} $(CC) $(CFLAGS) -o $(TARGET) ${OBJS} $(LDFLAGS) $(LIBS) .SUFFIXES: .SUFFIXES: .c .o .c.o: $(CC) $(CFLAGS) -o $@ -c $< clean: rm -f $(TARGET) rm -f $(OBJS) regen: regenerate-from-asn1-source regenerate-from-asn1-source: ../../asn1c/asn1c -S ../../skeletons -pdu=MegacoMessage -fcompound-names ../rfc3525-MEDIA-GATEWAY-CONTROL.asn1 MegacoMessage.c: ../sample.makefile.regen ../rfc3525-MEDIA-GATEWAY-CONTROL.asn1 make regen-makefile @touch MegacoMessage.c make regen-makefile: ASN1CMDOPTS="-fcompound-names" \ ASN1MODULES="../rfc3525-MEDIA-GATEWAY-CONTROL.asn1" \ ASN1PDU=MegacoMessage \ PROGNAME=megaco-dump \ ../sample.makefile.regen check: ${TARGET} check-ber check-xer check-per @echo ================ @echo All tests passed @echo ================ check-ber: @if test -f sample-MegacoMessage-1.[db]er ; then \ for f in sample-MegacoMessage-*.[db]er; do \ for b in 1 17 33 980 8192; do \ echo "Recoding $$f into XER and back ($$b)..."; \ ./${TARGET} -b $$b -iber -oxer $$f > ./.tmp.1.$$$$ || exit 2; \ ./${TARGET} -b $$b -ixer -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \ diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 4; \ rm -f ./.tmp.[12].$$$$; \ echo "Test junking $$f (please wait)..."; \ ./${TARGET} -J0.0001 -n 1000 -b $$b -iber -onull $$f || exit 5; \ ./${TARGET} -J0.001 -n 1000 -b $$b -iber -onull $$f || exit 6; \ done; done; fi check-xer: @if test -f sample-MegacoMessage-1.xer ; then \ for f in sample-MegacoMessage-*.xer; do \ for b in 1 17 33 980 8192; do \ echo "Recoding $$f into DER and back ($$b)..."; \ ./${TARGET} -b $$b -ixer -oder $$f > ./.tmp.1.$$$$ || exit 2; \ ./${TARGET} -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \ diff $$f ./.tmp.2.$$$$ || exit 4; \ rm -f ./.tmp.[12].$$$$; \ echo "Test junking $$f (please wait)..."; \ ./${TARGET} -J0.0001 -n 1000 -b $$b -ixer -onull $$f || exit 5; \ ./${TARGET} -J0.001 -n 1000 -b $$b -ixer -onull $$f || exit 6; \ done; done; fi check-per: @if test -f sample-MegacoMessage-1-nopad.per ; then \ for f in sample-MegacoMessage-[1-9]-nopad.per; do \ for b in 1 17 33 980 8192; do \ echo "Recoding non-padded $$f into DER into XER and back ($$b)..."; \ ./${TARGET} -b $$b -per-nopad -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \ ./${TARGET} -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \ ./${TARGET} -b $$b -ixer -oder ./.tmp.2.$$$$ > ./.tmp.3.$$$$ || exit 4; \ diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 5; \ rm -f ./.tmp.[123].$$$$; \ echo "Test junking $$f (please wait)..."; \ ./${TARGET} -J0.0001 -n 1000 -b $$b -per-nopad -iper -onull $$f || exit 6; \ ./${TARGET} -J0.001 -n 1000 -b $$b -per-nopad -iper -onull $$f || exit 7; \ done; done; fi @if test -f sample-MegacoMessage-1.per ; then \ for f in sample-*-[1-9].per; do \ pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z-]+)-[0-9].*/\1/"`; \ for b in 1 17 33 980 8192; do \ echo "Recoding $$f into DER into XER and back ($$b)..."; \ ./${TARGET} -b $$b -p $$pdu -iper -oder $$f > ./.tmp.1.$$$$ || exit 3; \ ./${TARGET} -b $$b -p $$pdu -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 4; \ ./${TARGET} -b $$b -p $$pdu -ixer -oper ./.tmp.2.$$$$ > ./.tmp.1.$$$$ || exit 5; \ diff $$f ./.tmp.1.$$$$ || exit 6; \ rm -f ./.tmp.[12].$$$$; \ echo "Test junking $$f (please wait)..."; \ ./${TARGET} -J0.0001 -n 1000 -b $$b -iper -onull $$f || exit 7; \ ./${TARGET} -J0.001 -n 1000 -b $$b -iper -onull $$f || exit 8; \ done; done; fi distclean: clean rm -f $(ASN_MODULE_SOURCES) rm -f $(ASN_MODULE_HEADERS) rm -f $(ASN_CONVERTER_SOURCES) $(ASN_CONVERTER_HEADERS) rm -f Makefile.am.sample asn1c-0.9.28+dfsg/examples/sample.source.MEGACO/README0000644000000000000000000000060513065714043020450 0ustar rootroot GENERAL INFORMATION =================== The MEGACO (Media Gateway Control Protocol) PDU decoder. Invoking `make` will compile the ASN.1 specifications from the rfc3525.txt in the above directory. megaco-dump USAGE ================= ./megaco-dump MegacoMessage.ber # Print as XML (BASIC-XER) The full list of recognized command line options may be obtained with > ./megaco-dump -h asn1c-0.9.28+dfsg/examples/sample.source.MEGACO/config.h0000644000000000000000000000031013065714043021177 0ustar rootroot extern int opt_debug; #define ASN_DEBUG(fmt, args...) do { \ if(opt_debug < 2) break; \ fprintf(stderr, fmt, ##args); \ fprintf(stderr, " (%s:%d)\n", \ __FILE__, __LINE__); \ } while(0) asn1c-0.9.28+dfsg/examples/sample.makefile.regen0000755000000000000000000001250613065714043020143 0ustar rootroot#!/bin/sh # # This script attempts to compile the given ASN.1 specification and then # transforms the resulting Makefile.am.sample tailored to that specification # into a customized Makefile. # # The information which is necessary for this script is passed from the # Makefile which is going to be replaced with an updated Makefile. # This is called "boot-strapping" and is frequently the source of inside jokes. # # $Id$ # if test -z "$ASN1PDU" \ -o -z "$ASN1MODULES" \ -o -z "$PROGNAME" \ ; then echo "ASN1CMDOPTS=\"$ASN1CMDOPTS\"" echo "ASN1MODULES=\"$ASN1MODULES\"" echo "ASN1PDU=\"$ASN1PDU\"" echo "PROGNAME=\"$PROGNAME\"" echo "ASN1PDU, ASN1MODULES, and PROGNAME are mandatory" exit fi CMDOPTS="-pdu=${ASN1PDU} ${ASN1CMDOPTS} ${ASN1MODULES}" if test -x ../../asn1c/asn1c ; then echo "Compiling ${ASN1MODULES} using local compiler" ../../asn1c/asn1c -S ../../skeletons ${CMDOPTS} || exit $? else echo "Compiling ${ASN1MODULES} using system compiler" asn1c ${CMDOPTS} || exit $? fi if test ! -f Makefile.am.sample ; then echo "Makefile.am.sample is missing" exit 1 fi EXTRA_CFLAGS="-DJUNKTEST" test -f config.h && EXTRA_CFLAGS="-DHAVE_CONFIG_H ${EXTRA_CFLAGS}" test -n "$TITLE" && EXTRA_CFLAGS="-DASN_CONVERTER_TITLE=\"$TITLE\" ${EXTRA_CFLAGS}" set -x cat Makefile.am.sample \ | sed -e "s/^CFLAGS += /CFLAGS += ${EXTRA_CFLAGS} /" \ | sed -e "s/^all: /all: ${ASN1PDU}.c /" \ | sed -e "s/progname/${PROGNAME}/" \ > Makefile.$$ set +x ( echo echo "${ASN1PDU}.c: $0 ${ASN1MODULES}" echo " make regen-makefile" echo " @touch ${ASN1PDU}.c" echo " make" echo echo "regen-makefile:" test -n "$TITLE" && echo " TITLE=\"$TITLE\" \\" echo " ASN1CMDOPTS=\"${ASN1CMDOPTS}\" \\" echo " ASN1MODULES=\"${ASN1MODULES}\" \\" echo " ASN1PDU=${ASN1PDU} \\" echo " PROGNAME=${PROGNAME} \\" echo " $0" echo echo 'check: ${TARGET} check-ber check-xer check-per' echo ' @echo ================' echo ' @echo All tests passed' echo ' @echo ================' echo echo 'check-ber:' echo " @if test -f sample-${ASN1PDU}-1.[db]er ; then \\" echo " for f in sample-${ASN1PDU}-*.[db]er; do \\" echo ' for b in 1 17 33 980 8192; do \' echo ' echo "Recoding $$f into XER and back ($$b)..."; \' echo ' ./${TARGET} -b $$b -iber -oxer $$f > ./.tmp.1.$$$$ || exit 2; \' echo ' ./${TARGET} -b $$b -ixer -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \' echo ' diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 4; \' echo ' rm -f ./.tmp.[12].$$$$; \' echo ' echo "Test junking $$f (please wait)..."; \' echo ' ./${TARGET} -J0.0001 -n 1000 -b $$b -iber -onull $$f || exit 5; \' echo ' ./${TARGET} -J0.001 -n 1000 -b $$b -iber -onull $$f || exit 6; \' echo ' done; done; fi' echo echo 'check-xer:' echo " @if test -f sample-${ASN1PDU}-1.xer ; then \\" echo " for f in sample-${ASN1PDU}-*.xer; do \\" echo ' for b in 1 17 33 980 8192; do \' echo ' echo "Recoding $$f into DER and back ($$b)..."; \' echo ' ./${TARGET} -b $$b -ixer -oder $$f > ./.tmp.1.$$$$ || exit 2; \' echo ' ./${TARGET} -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \' echo ' diff $$f ./.tmp.2.$$$$ || exit 4; \' echo ' rm -f ./.tmp.[12].$$$$; \' echo ' echo "Test junking $$f (please wait)..."; \' echo ' ./${TARGET} -J0.0001 -n 1000 -b $$b -ixer -onull $$f || exit 5; \' echo ' ./${TARGET} -J0.001 -n 1000 -b $$b -ixer -onull $$f || exit 6; \' echo ' done; done; fi' echo echo 'check-per:' echo " @if test -f sample-${ASN1PDU}-1-nopad.per ; then \\" echo " for f in sample-${ASN1PDU}-[1-9]-nopad.per; do \\" echo ' for b in 1 17 33 980 8192; do \' echo ' echo "Recoding non-padded $$f into DER into XER and back ($$b)..."; \' echo ' ./${TARGET} -b $$b -per-nopad -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \' echo ' ./${TARGET} -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \' echo ' ./${TARGET} -b $$b -ixer -oder ./.tmp.2.$$$$ > ./.tmp.3.$$$$ || exit 4; \' echo ' diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 5; \' echo ' rm -f ./.tmp.[123].$$$$; \' echo ' echo "Test junking $$f (please wait)..."; \' echo ' ./${TARGET} -J0.0001 -n 1000 -b $$b -per-nopad -iper -onull $$f || exit 6; \' echo ' ./${TARGET} -J0.001 -n 1000 -b $$b -per-nopad -iper -onull $$f || exit 7; \' echo ' done; done; fi' echo " @if test -f sample-${ASN1PDU}-1.per ; then \\" echo " for f in sample-*-[1-9].per; do \\" echo ' pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z-]+)-[0-9].*/\1/"`; \' echo ' for b in 1 17 33 980 8192; do \' echo ' echo "Recoding $$f into DER into XER and back ($$b)..."; \' echo ' ./${TARGET} -b $$b -p $$pdu -iper -oder $$f > ./.tmp.1.$$$$ || exit 3; \' echo ' ./${TARGET} -b $$b -p $$pdu -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 4; \' echo ' ./${TARGET} -b $$b -p $$pdu -ixer -oper ./.tmp.2.$$$$ > ./.tmp.1.$$$$ || exit 5; \' echo ' diff $$f ./.tmp.1.$$$$ || exit 6; \' echo ' rm -f ./.tmp.[12].$$$$; \' echo ' echo "Test junking $$f (please wait)..."; \' echo ' ./${TARGET} -J0.0001 -n 1000 -b $$b -iper -onull $$f || exit 7; \' echo ' ./${TARGET} -J0.001 -n 1000 -b $$b -iper -onull $$f || exit 8; \' echo ' done; done; fi' echo echo "distclean: clean" echo ' rm -f $(ASN_MODULE_SOURCES)' echo ' rm -f $(ASN_MODULE_HEADERS)' echo ' rm -f $(ASN_CONVERTER_SOURCES) $(ASN_CONVERTER_HEADERS)' echo " rm -f Makefile.am.sample" ) >> Makefile.$$ set -x mv Makefile.$$ Makefile || exit $? rm Makefile.am.sample || exit $? set +x echo echo "Makefile generation finished" asn1c-0.9.28+dfsg/examples/README0000644000000000000000000000273213065714043014741 0ustar rootroot This directory contains a few examples. 1. The ./sample.source.PKIX1 directory contains the X.509 Certificate decoder, as specified in rfc3280.txt. Just type `make` in there to compile. 2. The ./sample.source.MHEG5 directory contains the decoder for ISO 13522 MHEG-5/ITU-T T.172 (Multimedia Hypermedia Experts Group, Multimedia Presentations). Read the README file in that directory. 3. The ./sample.source.MEGACO directory contains the decoder for Media Gateway Control Protocol data units as specified in rfc3525.txt. 4. The ./sample.source.LDAP3 directory contains the decoder for Lightweight Directory Access Protocol version 3 PDU as specified in rfc4211.txt. 6. The ./sample.source.RRC directory contains the 3GPP Radio Resource Control decoder for RRC version 7.1.0. Just type `make` in there to compile. 5. The ./sample.source.TAP3 directory contains the GSM TAP3 decoder. Before trying to compile, read the README file in that directory. 6. The ./sample.source.ULP directory contains the Open Mobile Alliance UserPlane Location Protocol decoder. Before trying to compile, read the README file in that directory. The crfc2asn1.pl script can be used to extract ASN.1 data from RFC texts. For instance, it is used to extract X.509, MEGACO, and LDAPv3 ASN.1 modules from the corresponding RFC texts (rfc3280.txt, rfc3525.txt, rfc4211.txt). To regenerate the .asn1 files from the original RFC texts, execute `make clean; make` in the current directory. asn1c-0.9.28+dfsg/examples/sample.source.RRC/0000755000000000000000000000000013065714043017262 5ustar rootrootasn1c-0.9.28+dfsg/examples/sample.source.RRC/Makefile0000644000000000000000000042130313065714043020725 0ustar rootrootASN_MODULE_SOURCES= \ DL-DCCH-Message.c \ DL-DCCH-MessageType.c \ UL-DCCH-Message.c \ UL-DCCH-MessageType.c \ DL-CCCH-Message.c \ DL-CCCH-MessageType.c \ UL-CCCH-Message.c \ UL-CCCH-MessageType.c \ PCCH-Message.c \ PCCH-MessageType.c \ DL-SHCCH-Message.c \ DL-SHCCH-MessageType.c \ UL-SHCCH-Message.c \ UL-SHCCH-MessageType.c \ BCCH-FACH-Message.c \ BCCH-FACH-MessageType.c \ BCCH-BCH-Message.c \ MCCH-Message.c \ MCCH-MessageType.c \ MSCH-Message.c \ MSCH-MessageType.c \ ActiveSetUpdate.c \ ActiveSetUpdate-r3-IEs.c \ ActiveSetUpdate-v4b0ext-IEs.c \ ActiveSetUpdate-v590ext-IEs.c \ ActiveSetUpdate-v690ext-IEs.c \ ActiveSetUpdate-r6-IEs.c \ ActiveSetUpdateComplete.c \ ActiveSetUpdateFailure.c \ AssistanceDataDelivery.c \ AssistanceDataDelivery-r3-IEs.c \ AssistanceDataDelivery-v3a0ext.c \ AssistanceDataDelivery-v4b0ext-IEs.c \ CellChangeOrderFromUTRAN.c \ CellChangeOrderFromUTRAN-r3-IEs.c \ CellChangeOrderFromUTRAN-v590ext-IEs.c \ CellChangeOrderFromUTRANFailure.c \ CellChangeOrderFromUTRANFailure-r3-IEs.c \ CellUpdate.c \ CellUpdate-v590ext.c \ CellUpdate-v690ext-IEs.c \ CellUpdate-v7xyext-IEs.c \ CellUpdateConfirm.c \ CellUpdateConfirm-r3-IEs.c \ CellUpdateConfirm-v3a0ext.c \ CellUpdateConfirm-v4b0ext-IEs.c \ CellUpdateConfirm-v590ext-IEs.c \ CellUpdateConfirm-v5d0ext-IEs.c \ CellUpdateConfirm-r4-IEs.c \ CellUpdateConfirm-r5-IEs.c \ CellUpdateConfirm-r6-IEs.c \ CellUpdateConfirm-v690ext-IEs.c \ CellUpdateConfirm-r7-IEs.c \ CellUpdateConfirm-CCCH.c \ CounterCheck.c \ CounterCheck-r3-IEs.c \ CounterCheckResponse.c \ DownlinkDirectTransfer.c \ DownlinkDirectTransfer-r3-IEs.c \ HandoverToUTRANCommand.c \ HandoverToUTRANCommand-r3-IEs.c \ HandoverToUTRANCommand-r4-IEs.c \ HandoverToUTRANCommand-r5-IEs.c \ HandoverToUTRANCommand-r6-IEs.c \ HandoverToUTRANCommand-r7-IEs.c \ HandoverToUTRANComplete.c \ InitialDirectTransfer.c \ InitialDirectTransfer-v3a0ext.c \ InitialDirectTransfer-v590ext.c \ InitialDirectTransfer-v690ext-IEs.c \ HandoverFromUTRANCommand-GSM.c \ HandoverFromUTRANCommand-GSM-r3-IEs.c \ HandoverFromUTRANCommand-GSM-r6-IEs.c \ HandoverFromUTRANCommand-GSM-v690ext-IEs.c \ HandoverFromUTRANCommand-GERANIu.c \ HandoverFromUTRANCommand-GERANIu-r5-IEs.c \ HandoverFromUTRANCommand-CDMA2000.c \ HandoverFromUTRANCommand-CDMA2000-r3-IEs.c \ HandoverFromUTRANFailure.c \ HandoverFromUtranFailure-v590ext-IEs.c \ InterRATHandoverInfo.c \ InterRATHandoverInfo-v390ext-IEs.c \ InterRATHandoverInfo-v3a0ext-IEs.c \ InterRATHandoverInfo-v3d0ext-IEs.c \ InterRATHandoverInfo-v3g0ext-IEs.c \ InterRATHandoverInfo-r3-add-ext-IEs.c \ InterRATHandoverInfo-v4b0ext-IEs.c \ InterRATHandoverInfo-v4d0ext-IEs.c \ InterRATHandoverInfo-v590ext-IEs.c \ InterRATHandoverInfo-v690ext1-IEs.c \ InterRATHandoverInfo-v690ext-IEs.c \ InterRATHandoverInfo-v7xyext-IEs.c \ MeasurementControl.c \ MeasurementControl-r3-IEs.c \ MeasurementControl-v390ext.c \ MeasurementControl-v3a0ext.c \ MeasurementControl-r4-IEs.c \ MeasurementControl-v590ext-IEs.c \ MeasurementControl-v5b0ext-IEs.c \ MeasurementControl-r6-IEs.c \ MeasurementControl-v6a0ext-IEs.c \ MeasurementControl-v7xyext-IEs.c \ MeasurementControlFailure.c \ MeasurementControlFailure-v590ext-IEs.c \ MeasurementReport.c \ MeasurementReport-v390ext.c \ MeasurementReport-v4b0ext-IEs.c \ MeasurementReport-v590ext-IEs.c \ MeasurementReport-v5b0ext-IEs.c \ MeasurementReport-v690ext-IEs.c \ MeasurementReport-v7xyext-IEs.c \ PagingType1.c \ PagingType1-v590ext-IEs.c \ PagingType2.c \ PhysicalChannelReconfiguration.c \ PhysicalChannelReconfiguration-r3-IEs.c \ PhysicalChannelReconfiguration-v3a0ext.c \ PhysicalChannelReconfiguration-v4b0ext-IEs.c \ PhysicalChannelReconfiguration-v590ext-IEs.c \ PhysicalChannelReconfiguration-r4-IEs.c \ PhysicalChannelReconfiguration-r5-IEs.c \ PhysicalChannelReconfiguration-r6-IEs.c \ PhysicalChannelReconfiguration-v690ext-IEs.c \ PhysicalChannelReconfiguration-r7-IEs.c \ PhysicalChannelReconfigurationComplete.c \ PhysicalChannelReconfigurationComplete-v7xyext-IEs.c \ PhysicalChannelReconfigurationFailure.c \ PhysicalSharedChannelAllocation.c \ PhysicalSharedChannelAllocation-r3-IEs.c \ PhysicalSharedChannelAllocation-r4-IEs.c \ PhysicalSharedChannelAllocation-v690ext-IEs.c \ PhysicalSharedChannelAllocation-v7xyext-IEs.c \ PUSCHCapacityRequest.c \ PUSCHCapacityRequest-v590ext.c \ RadioBearerReconfiguration.c \ RadioBearerReconfiguration-r3-IEs.c \ RadioBearerReconfiguration-v3a0ext.c \ RadioBearerReconfiguration-v4b0ext-IEs.c \ RadioBearerReconfiguration-v590ext-IEs.c \ RadioBearerReconfiguration-v5d0ext-IEs.c \ RadioBearerReconfiguration-r4-IEs.c \ RadioBearerReconfiguration-r5-IEs.c \ RadioBearerReconfiguration-r6-IEs.c \ RadioBearerReconfiguration-v690ext-IEs.c \ RadioBearerReconfiguration-r7-IEs.c \ RadioBearerReconfigurationComplete.c \ RadioBearerReconfigurationComplete-v7xyext-IEs.c \ RadioBearerReconfigurationFailure.c \ RadioBearerRelease.c \ RadioBearerRelease-r3-IEs.c \ RadioBearerRelease-v3a0ext.c \ RadioBearerRelease-v4b0ext-IEs.c \ RadioBearerRelease-v590ext-IEs.c \ RadioBearerRelease-r4-IEs.c \ RadioBearerRelease-r5-IEs.c \ RadioBearerRelease-v690ext-IEs.c \ RadioBearerRelease-r6-IEs.c \ RadioBearerRelease-r7-IEs.c \ RadioBearerReleaseComplete.c \ RadioBearerReleaseComplete-v7xyext-IEs.c \ RadioBearerReleaseFailure.c \ RadioBearerSetup.c \ RadioBearerSetup-r3-IEs.c \ RadioBearerSetup-v3a0ext.c \ RadioBearerSetup-v4b0ext-IEs.c \ RadioBearerSetup-v590ext-IEs.c \ RadioBearerSetup-v5d0ext-IEs.c \ RadioBearerSetup-r4-IEs.c \ RadioBearerSetup-r5-IEs.c \ RadioBearerSetup-v690ext-IEs.c \ RadioBearerSetup-r6-IEs.c \ RadioBearerSetup-r7-IEs.c \ RadioBearerSetupComplete.c \ RadioBearerSetupComplete-v7xyext-IEs.c \ RadioBearerSetupFailure.c \ RRCConnectionReject.c \ RRCConnectionReject-r3-IEs.c \ RRCConnectionReject-v690ext-IEs.c \ RRCConnectionRelease.c \ RRCConnectionRelease-r3-IEs.c \ RRCConnectionRelease-r4-IEs.c \ RRCConnectionRelease-v690ext-IEs.c \ RRCConnectionRelease-CCCH.c \ RRCConnectionRelease-CCCH-r3-IEs.c \ RRCConnectionRelease-CCCH-r4-IEs.c \ RRCConnectionRelease-CCCH-r5-IEs.c \ RRCConnectionRelease-CCCH-v690ext-IEs.c \ RRCConnectionReleaseComplete.c \ RRCConnectionRequest.c \ RRCConnectionRequest-v3d0ext-IEs.c \ RRCConnectionRequest-v4b0ext-IEs.c \ RRCConnectionRequest-v590ext-IEs.c \ RRCConnectionRequest-v690ext-IEs.c \ RRCConnectionSetup.c \ RRCConnectionSetup-r3-IEs.c \ RRCConnectionSetup-v4b0ext-IEs.c \ RRCConnectionSetup-v590ext-IEs.c \ RRCConnectionSetup-r4-IEs.c \ RRCConnectionSetup-r5-IEs.c \ RRCConnectionSetup-v690ext-IEs.c \ RRCConnectionSetup-r6-IEs.c \ RRCConnectionSetup-r7-IEs.c \ RRCConnectionSetup-v7xyext-IEs.c \ RRCConnectionSetupComplete.c \ RRCConnectionSetupComplete-v370ext.c \ RRCConnectionSetupComplete-v380ext-IEs.c \ RRCConnectionSetupComplete-v3a0ext-IEs.c \ RRCConnectionSetupComplete-v3g0ext-IEs.c \ RRCConnectionSetupComplete-r3-add-ext-IEs.c \ RRCConnectionSetupComplete-v4b0ext-IEs.c \ RRCConnectionSetupComplete-v590ext-IEs.c \ RRCConnectionSetupComplete-v5c0ext-IEs.c \ RRCConnectionSetupComplete-v650ext-IEs.c \ RRCConnectionSetupComplete-v680ext-IEs.c \ RRCConnectionSetupComplete-v690ext-IEs.c \ RRCConnectionSetupComplete-v7xyext-IEs.c \ RRC-FailureInfo.c \ RRC-FailureInfo-r3-IEs.c \ RRCStatus.c \ SecurityModeCommand.c \ SecurityModeCommand-r3-IEs.c \ SecurityModeComplete.c \ SecurityModeFailure.c \ SignallingConnectionRelease.c \ SignallingConnectionRelease-r3-IEs.c \ SignallingConnectionReleaseIndication.c \ SystemInformation-BCH.c \ SystemInformation-FACH.c \ FirstSegment.c \ FirstSegmentShort.c \ SubsequentSegment.c \ LastSegment.c \ LastSegmentShort.c \ CompleteSIB-List.c \ CompleteSIB.c \ CompleteSIBshort.c \ SystemInformationChangeIndication.c \ TransportChannelReconfiguration.c \ TransportChannelReconfiguration-r3-IEs.c \ TransportChannelReconfiguration-v3a0ext.c \ TransportChannelReconfiguration-v4b0ext-IEs.c \ TransportChannelReconfiguration-v590ext-IEs.c \ TransportChannelReconfiguration-r4-IEs.c \ TransportChannelReconfiguration-r5-IEs.c \ TransportChannelReconfiguration-v690ext-IEs.c \ TransportChannelReconfiguration-r6-IEs.c \ TransportChannelReconfiguration-r7-IEs.c \ TransportChannelReconfigurationComplete.c \ TransportChannelReconfigurationComplete-v7xyext-IEs.c \ TransportChannelReconfigurationFailure.c \ TransportFormatCombinationControl.c \ TransportFormatCombinationControlFailure.c \ UECapabilityEnquiry.c \ UECapabilityEnquiry-r3-IEs.c \ UECapabilityEnquiry-v4b0ext-IEs.c \ UECapabilityEnquiry-v590ext-IEs.c \ UECapabilityEnquiry-v7xyext-IEs.c \ UECapabilityInformation.c \ UECapabilityInformation-v370ext.c \ UECapabilityInformation-v380ext-IEs.c \ UECapabilityInformation-v3a0ext-IEs.c \ UECapabilityInformation-r3-add-ext-IEs.c \ UECapabilityInformation-v4b0ext.c \ UECapabilityInformation-v590ext.c \ UECapabilityInformation-v5c0ext.c \ UECapabilityInformation-v650ext-IEs.c \ UECapabilityInformation-v680ext-IEs.c \ UECapabilityInformation-v690ext-IEs.c \ UECapabilityInformation-v7xyext-IEs.c \ UECapabilityInformationConfirm.c \ UECapabilityInformationConfirm-r3-IEs.c \ UplinkDirectTransfer.c \ UplinkDirectTransfer-v690ext-IEs.c \ UplinkPhysicalChannelControl.c \ UplinkPhysicalChannelControl-r3-IEs.c \ UplinkPhysicalChannelControl-v4b0ext-IEs.c \ UplinkPhysicalChannelControl-r4-IEs.c \ UplinkPhysicalChannelControl-r5-IEs.c \ UplinkPhysicalChannelControl-v690ext-IEs.c \ UplinkPhysicalChannelControl-v6a0ext-IEs.c \ UplinkPhysicalChannelControl-r7-IEs.c \ URAUpdate.c \ URAUpdateConfirm.c \ URAUpdateConfirm-r3-IEs.c \ URAUpdateConfirm-r5-IEs.c \ URAUpdateConfirm-v690ext-IEs.c \ URAUpdateConfirm-CCCH.c \ URAUpdateConfirm-CCCH-r3-IEs.c \ UTRANMobilityInformation.c \ UTRANMobilityInformation-r3-IEs.c \ UTRANMobilityInformation-v3a0ext-IEs.c \ UTRANMobilityInformation-r5-IEs.c \ UtranMobilityInformation-v690ext-IEs.c \ UTRANMobilityInformationConfirm.c \ UTRANMobilityInformationFailure.c \ MBMSAccessInformation.c \ MBMSCommonPTMRBInformation.c \ MBMSCurrentCellPTMRBInformation.c \ MBMSGeneralInformation.c \ MBMSGeneralInformation-v7xyext-IEs.c \ MBMSModificationRequest.c \ MBMSModifiedServicesInformation.c \ MBMSNeighbouringCellPTMRBInformation.c \ MBMSSchedulingInformation.c \ MBMSUnmodifiedServicesInformation.c \ Ansi-41-IDNNS.c \ CN-DomainIdentity.c \ CN-DomainInformation.c \ CN-DomainInformationFull.c \ CN-DomainInformationList.c \ CN-DomainInformationListFull.c \ CN-DomainSysInfo.c \ CN-DomainSysInfoList.c \ CN-InformationInfo.c \ CN-InformationInfo-r6.c \ CN-InformationInfoFull.c \ Digit.c \ Gsm-map-IDNNS.c \ IMEI.c \ IMEI-Digit.c \ IMSI-GSM-MAP.c \ IntraDomainNasNodeSelector.c \ LAI.c \ MCC.c \ MNC.c \ MultiplePLMN-List-r6.c \ NAS-Message.c \ NAS-Synchronisation-Indicator.c \ NAS-SystemInformationGSM-MAP.c \ P-TMSI-GSM-MAP.c \ PagingRecordTypeID.c \ PLMN-Identity.c \ PLMN-IdentityWithOptionalMCC-r6.c \ PLMN-Type.c \ RAB-Identity.c \ RAI.c \ RoutingAreaCode.c \ RoutingParameter.c \ TMSI-GSM-MAP.c \ AccessClassBarred.c \ AccessClassBarredList.c \ AllowedIndicator.c \ CellAccessRestriction.c \ CellBarred.c \ CellIdentity.c \ CellIdentity-PerRL-List.c \ CellSelectReselectInfoSIB-3-4.c \ DomainSpecificAccessRestrictionForSharedNetwork-v670ext.c \ DomainSpecificAccessRestrictionList-v670ext.c \ DomainSpecificAccessRestrictionParam-v670ext.c \ DomainSpecificAccessRestriction-v670ext.c \ MapParameter.c \ Mapping.c \ Mapping-LCR-r4.c \ MappingFunctionParameter.c \ MappingFunctionParameterList.c \ MappingFunctionType.c \ MappingInfo.c \ Q-Hyst-S.c \ Q-Hyst-S-Fine.c \ RAT.c \ RAT-FDD-Info.c \ RAT-FDD-InfoList.c \ RAT-Identifier.c \ RAT-TDD-Info.c \ RAT-TDD-InfoList.c \ ReservedIndicator.c \ S-SearchQual.c \ S-SearchRXLEV.c \ SpeedDependentScalingFactor.c \ T-Barred.c \ T-Reselection-S.c \ T-Reselection-S-Fine.c \ TreselectionScalingFactor.c \ UpperLimit.c \ URA-Identity.c \ URA-IdentityList.c \ AccessStratumReleaseIndicator.c \ ActivationTime.c \ BackoffControlParams.c \ C-RNTI.c \ CapabilityUpdateRequirement.c \ CapabilityUpdateRequirement-r4-ext.c \ CapabilityUpdateRequirement-r4.c \ CapabilityUpdateRequirement-r7-ext.c \ CellUpdateCause.c \ CellUpdateCause-ext.c \ ChipRateCapability.c \ ChipRateCapability-r7.c \ CipheringAlgorithm.c \ CipheringModeCommand.c \ CipheringModeInfo.c \ CN-DRX-CycleLengthCoefficient.c \ CN-PagedUE-Identity.c \ CompressedModeMeasCapability.c \ CompressedModeMeasCapability-LCR-r4.c \ CompressedModeMeasCapabFDDList.c \ CompressedModeMeasCapabFDDList2.c \ CompressedModeMeasCapabFDDList-ext.c \ CompressedModeMeasCapabFDD.c \ CompressedModeMeasCapabFDD2.c \ CompressedModeMeasCapabFDD-ext.c \ CompressedModeMeasCapabTDDList.c \ CompressedModeMeasCapabTDD.c \ CompressedModeMeasCapabGSMList.c \ CompressedModeMeasCapabGSM.c \ CompressedModeMeasCapabMC.c \ CPCH-Parameters.c \ DL-CapabilityWithSimultaneousHS-DSCHConfig.c \ DL-DPCCH-BER.c \ DL-PhysChCapabilityFDD.c \ DL-PhysChCapabilityFDD-v380ext.c \ SupportOfDedicatedPilotsForChEstimation.c \ DL-PhysChCapabilityTDD.c \ DL-PhysChCapabilityTDD-LCR-r4.c \ DL-PhysChCapabilityTDD-768.c \ DL-TransChCapability.c \ DRAC-SysInfo.c \ DRAC-SysInfoList.c \ DSCH-RNTI.c \ DelayRestrictionFlag.c \ E-RNTI.c \ ESN-DS-41.c \ EstablishmentCause.c \ FailureCauseWithProtErr.c \ FailureCauseWithProtErrTrId.c \ GroupIdentityWithReleaseInformation.c \ GroupReleaseInformation.c \ GSM-Measurements.c \ H-RNTI.c \ HSDSCH-physical-layer-category.c \ UESpecificBehaviourInformation1idle.c \ UESpecificBehaviourInformation1interRAT.c \ IMSI-and-ESN-DS-41.c \ IMSI-DS-41.c \ InitialPriorityDelayList.c \ InitialUE-Identity.c \ IntegrityCheckInfo.c \ IntegrityProtActivationInfo.c \ IntegrityProtectionAlgorithm.c \ IntegrityProtectionModeCommand.c \ IntegrityProtectionModeInfo.c \ IntegrityProtInitNumber.c \ MaxHcContextSpace.c \ MaxHcContextSpace-r5-ext.c \ MaxROHC-ContextSessions-r4.c \ MaximumAM-EntityNumberRLC-Cap.c \ MaximumBitRate.c \ MaximumRLC-WindowSize.c \ MaxNoDPDCH-BitsTransmitted.c \ MaxNoBits.c \ MaxNoPhysChBitsReceived.c \ MaxNoSCCPCH-RL.c \ MaxNumberOfTF.c \ MaxNumberOfTFC-DL.c \ MaxNumberOfTFC-UL.c \ MaxPhysChPerFrame.c \ MaxPhysChPerFrame-768.c \ MaxPhysChPerSubFrame-r4.c \ MaxPhysChPerTimeslot.c \ MaxPhysChPerTS.c \ MaxPhysChPerTS-768.c \ MaxSimultaneousCCTrCH-Count.c \ MaxSimultaneousTransChsDL.c \ MaxSimultaneousTransChsUL.c \ MaxTransportBlocksDL.c \ MaxTransportBlocksUL.c \ MaxTS-PerFrame.c \ MaxTS-PerSubFrame-r4.c \ MeasurementCapability.c \ MeasurementCapabilityExt.c \ MeasurementCapabilityExt2.c \ MeasurementCapability-r4-ext.c \ MessageAuthenticationCode.c \ MinimumSF-DL.c \ MinimumSF-DL-768.c \ MinimumSF-UL.c \ MultiModeCapability.c \ MultiRAT-Capability.c \ MultiModeRAT-Capability-v590ext.c \ MultiModeRAT-Capability-v680ext.c \ N-300.c \ N-301.c \ N-302.c \ N-304.c \ N-308.c \ N-310.c \ N-312.c \ N-312ext.c \ N-312-r5.c \ N-313.c \ N-315.c \ N-315ext.c \ N-315-r5.c \ N-AccessFails.c \ N-AP-RetransMax.c \ NetworkAssistedGPS-Supported.c \ NF-BO-AllBusy.c \ NF-BO-NoAICH.c \ NF-BO-Mismatch.c \ NS-BO-Busy.c \ NS-IP.c \ P-TMSI-and-RAI-GSM-MAP.c \ PagingCause.c \ PagingRecord.c \ PagingRecord2-r5.c \ PagingRecordList.c \ PagingRecord2List-r5.c \ PDCP-Capability.c \ PDCP-Capability-r4-ext.c \ PDCP-Capability-r5-ext.c \ PDCP-Capability-r5-ext2.c \ PhysicalChannelCapability.c \ PhysicalChannelCapability-r7.c \ PhysicalChannelCapability-LCR-r4.c \ PhysicalChannelCapability-hspdsch-r5.c \ PNBSCH-Allocation-r4.c \ ProtocolErrorCause.c \ ProtocolErrorIndicator.c \ ProtocolErrorIndicatorWithMoreInfo.c \ ProtocolErrorMoreInformation.c \ RadioFrequencyBandFDD.c \ RadioFrequencyBandFDD2.c \ RadioFrequencyBandTDDList.c \ RadioFrequencyBandTDD.c \ RadioFrequencyBandGSM.c \ Rb-timer-indicator.c \ Re-EstablishmentTimer.c \ RedirectionInfo.c \ RedirectionInfo-r6.c \ RejectionCause.c \ ReleaseCause.c \ RF-Capability.c \ RF-Capability-r4-ext.c \ RF-Capability-r7.c \ RLC-Capability.c \ RLC-Capability-r5-ext.c \ RRC-ConnectionReleaseInformation.c \ RRC-MessageSequenceNumber.c \ RRC-MessageSequenceNumberList.c \ RRC-StateIndicator.c \ RRC-TransactionIdentifier.c \ S-RNTI.c \ S-RNTI-2.c \ SecurityCapability.c \ Serving-HSDSCH-CellInformation.c \ SimultaneousSCCPCH-DPCH-Reception.c \ SRNC-Identity.c \ START-Value.c \ STARTList.c \ STARTSingle.c \ CapabilityUpdateRequirement-r5.c \ SystemSpecificCapUpdateReq.c \ SystemSpecificCapUpdateReq-v590ext.c \ SystemSpecificCapUpdateReq-r5.c \ SystemSpecificCapUpdateReqList.c \ SystemSpecificCapUpdateReqList-r5.c \ T-300.c \ T-301.c \ T-302.c \ T-304.c \ T-305.c \ T-307.c \ T-308.c \ T-309.c \ T-310.c \ T-311.c \ T-312.c \ T-313.c \ T-314.c \ T-315.c \ T-316.c \ T-317.c \ T-318.c \ T-CPCH.c \ TMSI-and-LAI-GSM-MAP.c \ TMSI-DS-41.c \ TotalRLC-AM-BufferSize.c \ TotalRLC-AM-BufferSize-r5-ext.c \ TransmissionProbability.c \ TransportChannelCapability.c \ TurboSupport.c \ TxRxFrequencySeparation.c \ U-RNTI.c \ U-RNTI-Group.c \ U-RNTI-Short.c \ UE-CapabilityContainer-IEs.c \ UE-ConnTimersAndConstants.c \ UE-ConnTimersAndConstants-v3a0ext.c \ UE-ConnTimersAndConstants-r5.c \ UE-IdleTimersAndConstants.c \ UE-IdleTimersAndConstants-v3a0ext.c \ UE-MultiModeRAT-Capability.c \ UE-PowerClass.c \ UE-PowerClassExt.c \ UE-RadioAccessCapability.c \ UE-RadioAccessCapabilityInfo.c \ UE-RadioAccessCapability-v370ext.c \ UE-RadioAccessCapability-v380ext.c \ UE-RadioAccessCapability-v3a0ext.c \ UE-RadioAccessCapability-v3g0ext.c \ UE-RadioAccessCapability-v650ext.c \ UE-RadioAccessCapability-v690ext.c \ UE-RadioAccessCapability-v7xyext.c \ UE-RadioAccessCapabBandFDDList2.c \ UE-RadioAccessCapabBandFDD2.c \ UE-PositioningCapabilityExt-v380.c \ UE-PositioningCapabilityExt-v3a0.c \ UE-PositioningCapabilityExt-v3g0.c \ UE-RadioAccessCapabBandFDDList.c \ UE-RadioAccessCapabBandFDDList-ext.c \ UE-RadioAccessCapabBandFDD.c \ UE-RadioAccessCapabBandFDD-ext.c \ UE-RadioAccessCapability-v4b0ext.c \ UE-RadioAccessCapabilityComp.c \ UE-RadioAccessCapabilityComp-ext.c \ UE-RadioAccessCapabilityComp-r7.c \ UE-RadioAccessCapabilityComp2.c \ RF-CapabilityComp.c \ RF-CapabilityComp-r7.c \ RF-CapabBandFDDComp.c \ RF-CapabBandListFDDComp.c \ RF-CapabBandListFDDComp-ext.c \ UE-RadioAccessCapability-v590ext.c \ UE-RadioAccessCapability-v5c0ext.c \ UE-RadioAccessCapability-v680ext.c \ UL-PhysChCapabilityFDD.c \ UL-PhysChCapabilityFDD-r6.c \ UL-PhysChCapabilityTDD.c \ UL-PhysChCapabilityTDD-LCR-r4.c \ PhysicalChannelCapability-edch-r6.c \ UL-TransChCapability.c \ UE-Positioning-Capability.c \ UE-SecurityInformation.c \ UE-SecurityInformation2.c \ URA-UpdateCause.c \ UTRAN-DRX-CycleLengthCoefficient.c \ WaitTime.c \ AlgorithmSpecificInfo.c \ AlgorithmSpecificInfo-r4.c \ CID-InclusionInfo-r4.c \ COUNT-C.c \ COUNT-C-MSB.c \ DefaultConfigIdentity.c \ DefaultConfigIdentity-r4.c \ DefaultConfigIdentity-r5.c \ DefaultConfigIdentity-r6.c \ DefaultConfigMode.c \ DDI.c \ DL-AM-RLC-Mode.c \ DL-AM-RLC-Mode-r5.c \ DL-CounterSynchronisationInfo.c \ DL-CounterSynchronisationInfo-r5.c \ DL-LogicalChannelMapping.c \ DL-LogicalChannelMapping-r5.c \ DL-LogicalChannelMappingList.c \ DL-LogicalChannelMappingList-r5.c \ DL-Reception-Window-Size-r6.c \ DL-RFC3095-r4.c \ DL-RLC-Mode.c \ DL-RLC-Mode-r5.c \ DL-RLC-Mode-r6.c \ DL-RLC-StatusInfo.c \ DL-TM-RLC-Mode.c \ DL-TransportChannelType.c \ DL-TransportChannelType-r5.c \ DL-UM-RLC-LI-size.c \ DL-UM-RLC-Mode-r5.c \ DL-UM-RLC-Mode-r6.c \ ExpectReordering.c \ ExplicitDiscard.c \ HeaderCompressionInfo.c \ HeaderCompressionInfoList.c \ HeaderCompressionInfo-r4.c \ HeaderCompressionInfoList-r4.c \ LogicalChannelIdentity.c \ LosslessSRNS-RelocSupport.c \ MAC-d-HFN-initial-value.c \ MAC-LogicalChannelPriority.c \ MaxDAT.c \ MaxDAT-Retransmissions.c \ MaxMRW.c \ MaxPDCP-SN-WindowSize.c \ MaxRST.c \ NoExplicitDiscard.c \ PDCP-Info.c \ PDCP-Info-r4.c \ PDCP-InfoReconfig.c \ PDCP-InfoReconfig-r4.c \ PDCP-PDU-Header.c \ PDCP-ROHC-TargetMode.c \ PDCP-SN-Info.c \ Poll-PDU.c \ Poll-SDU.c \ PollingInfo.c \ PollWindow.c \ PredefinedConfigIdentity.c \ PredefinedConfigValueTag.c \ PredefinedRB-Configuration.c \ PreDefRadioConfiguration.c \ PredefinedConfigStatusList.c \ PredefinedConfigStatusInfo.c \ PredefinedConfigStatusListComp.c \ PredefinedConfigSetsWithDifferentValueTag.c \ PredefinedConfigSetWithDifferentValueTag.c \ PredefinedConfigValueTagList.c \ PredefinedConfigStatusListVarSz.c \ RAB-Info.c \ RAB-Info-r6-ext.c \ RAB-Info-r6.c \ RAB-InformationList.c \ RAB-InformationList-r6.c \ RAB-InformationReconfigList.c \ RAB-InformationReconfig.c \ RAB-Info-Post.c \ RAB-InformationSetup.c \ RAB-InformationSetup-r4.c \ RAB-InformationSetup-r5.c \ RAB-InformationSetup-r6-ext.c \ RAB-InformationSetup-r6.c \ RAB-InformationSetupList.c \ RAB-InformationSetupList-r4.c \ RAB-InformationSetupList-r5.c \ RAB-InformationSetupList-r6.c \ RAB-InformationSetupList-r6-ext.c \ RB-ActivationTimeInfo.c \ RB-ActivationTimeInfoList.c \ RB-COUNT-C-Information.c \ RB-COUNT-C-InformationList.c \ RB-COUNT-C-MSB-Information.c \ RB-COUNT-C-MSB-InformationList.c \ RB-Identity.c \ RB-IdentityList.c \ RB-InformationAffected.c \ RB-InformationAffected-r5.c \ RB-InformationAffected-r6.c \ RB-InformationAffectedList.c \ RB-InformationAffectedList-r5.c \ RB-InformationAffectedList-r6.c \ RB-InformationChanged-r6.c \ RB-InformationChangedList-r6.c \ RB-InformationReconfig.c \ RB-InformationReconfig-r4.c \ RB-InformationReconfig-r5.c \ RB-InformationReconfig-r6.c \ RB-InformationReconfigList.c \ RB-InformationReconfigList-r4.c \ RB-InformationReconfigList-r5.c \ RB-InformationReconfigList-r6.c \ RB-InformationReleaseList.c \ RB-InformationSetup.c \ RB-InformationSetup-r4.c \ RB-InformationSetup-r5.c \ RB-InformationSetup-r6.c \ RB-InformationSetupList.c \ RB-InformationSetupList-r4.c \ RB-InformationSetupList-r5.c \ RB-InformationSetupList-r6.c \ RB-MappingInfo.c \ RB-MappingInfo-r5.c \ RB-MappingInfo-r6.c \ RB-MappingOption.c \ RB-MappingOption-r5.c \ RB-MappingOption-r6.c \ RB-PDCPContextRelocation.c \ RB-PDCPContextRelocationList.c \ RB-StopContinue.c \ RB-WithPDCP-Info.c \ RB-WithPDCP-InfoList.c \ ReceivingWindowSize.c \ RFC2507-Info.c \ RFC3095-Info-r4.c \ RLC-Info.c \ RLC-Info-r5.c \ RLC-Info-r6.c \ RLC-Info-MCCH-r6.c \ RLC-Info-MSCH-r6.c \ RLC-Info-MTCH-r6.c \ RLC-InfoChoice.c \ RLC-InfoChoice-r5.c \ RLC-InfoChoice-r6.c \ RLC-PDU-Size.c \ RLC-PDU-SizeList.c \ RLC-SequenceNumber.c \ RLC-SizeInfo.c \ RLC-SizeExplicitList.c \ ROHC-Profile-r4.c \ ROHC-ProfileList-r4.c \ ROHC-PacketSize-r4.c \ ROHC-PacketSizeList-r4.c \ SRB-InformationSetup.c \ SRB-InformationSetup-r5.c \ SRB-InformationSetup-r6.c \ SRB-InformationSetupList.c \ SRB-InformationSetupList-r5.c \ SRB-InformationSetupList-r6.c \ SRB-InformationSetupList2.c \ SRB-InformationSetupList2-r6.c \ TimerDAR-r6.c \ TimerDiscard.c \ TimerEPC.c \ TimerMRW.c \ TimerOSD-r6.c \ TimerPoll.c \ TimerPollPeriodic.c \ TimerPollProhibit.c \ TimerRST.c \ TimerStatusPeriodic.c \ TimerStatusProhibit.c \ TransmissionRLC-Discard.c \ TransmissionWindowSize.c \ UL-AM-RLC-Mode.c \ UL-CounterSynchronisationInfo.c \ UL-LogicalChannelMapping.c \ UL-LogicalChannelMapping-r6.c \ UL-LogicalChannelMappingList.c \ UL-LogicalChannelMappingList-r6.c \ UL-LogicalChannelMappings.c \ UL-LogicalChannelMappings-r6.c \ UL-RFC3095-r4.c \ UL-RLC-Mode.c \ UL-TM-RLC-Mode.c \ UL-UM-RLC-Mode.c \ UL-TransportChannelType.c \ UM-RLC-DuplAvoid-Reord-Info-r6.c \ UM-RLC-OutOSeqDelivery-Info-r6.c \ WindowSizeDAR-r6.c \ WindowSizeOSD-r6.c \ AddOrReconfMAC-dFlow.c \ AllowedTFC-List.c \ AllowedTFI-List.c \ BitModeRLC-SizeInfo.c \ BLER-QualityValue.c \ ChannelCodingType.c \ CodingRate.c \ CommonDynamicTF-Info.c \ CommonDynamicTF-Info-DynamicTTI.c \ CommonDynamicTF-InfoList.c \ CommonDynamicTF-InfoList-DynamicTTI.c \ CommonTransChTFS.c \ CommonTransChTFS-LCR.c \ CPCH-SetID.c \ CRC-Size.c \ DedicatedDynamicTF-Info.c \ DedicatedDynamicTF-Info-DynamicTTI.c \ DedicatedDynamicTF-InfoList.c \ DedicatedDynamicTF-InfoList-DynamicTTI.c \ DedicatedTransChTFS.c \ DL-AddReconfTransChInfo2List.c \ DL-AddReconfTransChInfoList.c \ DL-AddReconfTransChInfoList-r4.c \ DL-AddReconfTransChInfoList-r5.c \ DL-AddReconfTransChInformation.c \ DL-AddReconfTransChInformation-r4.c \ DL-AddReconfTransChInformation-r5.c \ DL-AddReconfTransChInformation2.c \ DL-CommonTransChInfo.c \ DL-CommonTransChInfo-r4.c \ DL-DeletedTransChInfoList.c \ DL-DeletedTransChInfoList-r5.c \ DL-TransportChannelIdentity.c \ DL-TransportChannelIdentity-r5.c \ DL-TrCH-Type.c \ DL-TrCH-TypeId1-r5.c \ DL-TrCH-TypeId2-r5.c \ DRAC-ClassIdentity.c \ DRAC-StaticInformation.c \ DRAC-StaticInformationList.c \ E-DCH-AddReconf-MAC-d-Flow.c \ E-DCH-AddReconf-MAC-d-FlowList.c \ E-DCH-MAC-d-FlowIdentity.c \ E-DCH-MAC-d-FlowMaxRetrans.c \ E-DCH-MAC-d-FlowMultiplexingList.c \ E-DCH-MAC-d-FlowPowerOffset.c \ E-DCH-TTI.c \ ExplicitTFCS-Configuration.c \ GainFactor.c \ GainFactorInformation.c \ HSDSCH-Info.c \ HARQ-Info.c \ HARQMemorySize.c \ IndividualDL-CCTrCH-Info.c \ IndividualDL-CCTrCH-InfoList.c \ IndividualUL-CCTrCH-Info.c \ IndividualUL-CCTrCH-InfoList.c \ LogicalChannelByRB.c \ LogicalChannelList.c \ MAC-d-FlowIdentityDCHandHSDSCH.c \ MAC-d-FlowIdentity.c \ MAC-d-PDU-SizeInfo-List.c \ MAC-d-PDUsizeInfo.c \ MAC-hs-AddReconfQueue-List.c \ MAC-hs-AddReconfQueue.c \ MAC-hs-DelQueue-List.c \ MAC-hs-DelQueue.c \ MAC-hs-WindowSize.c \ NumberOfTbSizeAndTTIList.c \ MessType.c \ Non-allowedTFC-List.c \ NumberOfTransportBlocks.c \ OctetModeRLC-SizeInfoType1.c \ OctetModeRLC-SizeInfoType2.c \ PowerOffsetInfoShort.c \ PowerOffsetInformation.c \ PowerOffsetPp-m.c \ PreDefTransChConfiguration.c \ QualityTarget.c \ RateMatchingAttribute.c \ ReferenceTFC-ID.c \ RestrictedTrChInfo.c \ RestrictedTrChInfoList.c \ SemistaticTF-Information.c \ SignalledGainFactors.c \ SplitTFCI-Signalling.c \ SplitType.c \ T1-ReleaseTimer.c \ TFC-Subset.c \ TFC-SubsetList.c \ TFC-Value.c \ TFCI-Field2-Information.c \ TFCI-Range.c \ TFCI-RangeList.c \ TFCS.c \ TFCS-Identity.c \ TFCS-IdentityPlain.c \ TFCS-InfoForDSCH.c \ TFCS-ReconfAdd.c \ TFCS-Removal.c \ TFCS-RemovalList.c \ TimeDurationBeforeRetry.c \ TM-SignallingInfo.c \ TransmissionTimeInterval.c \ TransmissionTimeValidity.c \ TransportChannelIdentity.c \ TransportChannelIdentityDCHandDSCH.c \ TransportFormatSet.c \ TransportFormatSet-LCR.c \ UL-AddReconfTransChInfoList.c \ UL-AddReconfTransChInfoList-r6.c \ UL-AddReconfTransChInformation.c \ UL-AddReconfTransChInformation-r6.c \ UL-CommonTransChInfo.c \ UL-CommonTransChInfo-r4.c \ UL-ControlledTrChList.c \ UL-DeletedTransChInfoList.c \ UL-DeletedTransChInfoList-r6.c \ UL-TransportChannelIdentity.c \ UL-TransportChannelIdentity-r6.c \ UL-TrCH-Type.c \ USCH-TransportChannelsInfo.c \ ACK-NACK-repetitionFactor.c \ AC-To-ASC-Mapping.c \ AC-To-ASC-MappingTable.c \ AccessServiceClass-FDD.c \ AccessServiceClass-TDD.c \ AccessServiceClass-TDD-r7.c \ AccessServiceClass-TDD-LCR-r4.c \ AdditionalPRACH-TF-and-TFCS-CCCH-IEs.c \ AdditionalPRACH-TF-and-TFCS-CCCH.c \ AdditionalPRACH-TF-and-TFCS-CCCH-List.c \ AICH-Info.c \ AICH-PowerOffset.c \ AICH-TransmissionTiming.c \ AllocationPeriodInfo.c \ Alpha.c \ AP-AICH-ChannelisationCode.c \ AP-PreambleScramblingCode.c \ AP-Signature.c \ AP-Signature-VCAM.c \ AP-Subchannel.c \ ASCSetting-FDD.c \ ASCSetting-TDD.c \ ASCSetting-TDD-r7.c \ ASCSetting-TDD-LCR-r4.c \ AvailableAP-Signature-VCAMList.c \ AvailableAP-SignatureList.c \ AvailableAP-SubchannelList.c \ AvailableMinimumSF-ListVCAM.c \ AvailableMinimumSF-VCAM.c \ AvailableSignatures.c \ AvailableSubChannelNumbers.c \ BEACON-PL-Est.c \ BurstType.c \ Bler-Target.c \ CCTrCH-PowerControlInfo.c \ CCTrCH-PowerControlInfo-r4.c \ CCTrCH-PowerControlInfo-r5.c \ CCTrCH-PowerControlInfo-r7.c \ CD-AccessSlotSubchannel.c \ CD-AccessSlotSubchannelList.c \ CD-CA-ICH-ChannelisationCode.c \ CD-PreambleScramblingCode.c \ CD-SignatureCode.c \ CD-SignatureCodeList.c \ CellAndChannelIdentity.c \ CellParametersID.c \ Cfntargetsfnframeoffset.c \ ChannelAssignmentActive.c \ ChannelisationCode256.c \ ChannelReqParamsForUCSM.c \ ClosedLoopTimingAdjMode.c \ CodeNumberDSCH.c \ CodeRange.c \ CodeWordSet.c \ CommonTimeslotInfo.c \ CommonTimeslotInfoSCCPCH.c \ ConstantValue.c \ ConstantValueTdd.c \ CPCH-PersistenceLevels.c \ CPCH-PersistenceLevelsList.c \ CPCH-SetInfo.c \ CPCH-SetInfoList.c \ CPCH-StatusIndicationMode.c \ CQI-RepetitionFactor.c \ CSICH-PowerOffset.c \ DefaultDPCH-OffsetValueFDD.c \ DefaultDPCH-OffsetValueTDD.c \ DeltaPp-m.c \ DeltaCQI.c \ DeltaNACK.c \ DeltaACK.c \ DeltaSIR.c \ DHS-Sync.c \ DL-CCTrCh.c \ DL-CCTrCh-r4.c \ DL-CCTrCh-r7.c \ DL-CCTrChList.c \ DL-CCTrChList-r7.c \ DL-CCTrChList-r4.c \ DL-CCTrChListToRemove.c \ DL-CCTrChTPCList.c \ DL-ChannelisationCode.c \ DL-ChannelisationCodeList.c \ DL-CommonInformation.c \ DL-CommonInformation-r4.c \ DL-CommonInformation-r5.c \ DL-CommonInformation-r6.c \ DL-CommonInformation-r7.c \ DL-CommonInformationPost.c \ DL-CommonInformationPredef.c \ DL-CompressedModeMethod.c \ DL-DPCH-InfoCommon.c \ DL-DPCH-InfoCommon-r4.c \ DL-DPCH-InfoCommon-r6.c \ DL-DPCH-InfoCommonPost.c \ DL-DPCH-InfoCommonPredef.c \ DL-DPCH-InfoPerRL.c \ DL-DPCH-InfoPerRL-r4.c \ DL-DPCH-InfoPerRL-r5.c \ DL-DPCH-InfoPerRL-r6.c \ DL-DPCH-InfoPerRL-r7.c \ DL-FDPCH-InfoPerRL-r6.c \ DL-DPCH-InfoPerRL-PostFDD.c \ DL-DPCH-InfoPerRL-PostTDD.c \ DL-DPCH-InfoPerRL-PostTDD-LCR-r4.c \ DL-DPCH-PowerControlInfo.c \ DL-FDPCH-InfoCommon-r6.c \ DL-FrameType.c \ DL-HSPDSCH-Information.c \ DL-HSPDSCH-Information-r6.c \ DL-HSPDSCH-Information-r7.c \ DL-HSPDSCH-TS-Configuration.c \ DL-HSPDSCH-TS-Configuration-VHCR.c \ DL-InformationPerRL.c \ DL-InformationPerRL-r4.c \ DL-InformationPerRL-r5.c \ DL-InformationPerRL-r5bis.c \ DL-InformationPerRL-r6.c \ DL-InformationPerRL-r7.c \ DL-InformationPerRL-List.c \ DL-InformationPerRL-List-r4.c \ DL-InformationPerRL-List-r5.c \ DL-InformationPerRL-List-r6.c \ DL-InformationPerRL-List-r5bis.c \ DL-InformationPerRL-List-r7.c \ DL-InformationPerRL-ListPostFDD.c \ DL-InformationPerRL-PostFDD.c \ DL-InformationPerRL-PostTDD.c \ DL-InformationPerRL-PostTDD-LCR-r4.c \ DL-PDSCH-Information.c \ Dl-rate-matching-restriction.c \ DL-TPC-PowerOffsetPerRL.c \ DL-TPC-PowerOffsetPerRL-List.c \ DL-TS-ChannelisationCode.c \ DL-TS-ChannelisationCode-VHCR.c \ DL-TS-ChannelisationCodesShort.c \ DL-TS-ChannelisationCodesShort-VHCR.c \ DownlinkAdditionalTimeslots.c \ DownlinkAdditionalTimeslots-VHCR.c \ DownlinkAdditionalTimeslots-LCR-r4.c \ DownlinkTimeslotsCodes.c \ DownlinkTimeslotsCodes-VHCR.c \ DownlinkTimeslotsCodes-LCR-r4.c \ DPC-Mode.c \ DPCCH-PowerOffset.c \ DPCCH-PowerOffset2.c \ DPCH-CompressedModeInfo.c \ DPCH-CompressedModeStatusInfo.c \ DPCH-FrameOffset.c \ DSCH-Mapping.c \ DSCH-MappingList.c \ DSCH-RadioLinkIdentifier.c \ DSCH-TransportChannelsInfo.c \ DurationTimeInfo.c \ DynamicPersistenceLevel.c \ DynamicPersistenceLevelList.c \ DynamicPersistenceLevelTF-List.c \ DynamicTFInformationCCCH.c \ E-AGCH-ChannelisationCode.c \ E-AGCH-Information.c \ E-DCH-MinimumSet-E-TFCI.c \ E-DCH-ReconfigurationInfo.c \ E-DCH-RL-InfoNewServingCell.c \ E-DCH-RL-InfoOtherCell.c \ E-DPCCH-Info.c \ E-DPCCH-DPCCH-PowerOffset.c \ E-DPDCH-Info.c \ E-DPDCH-PeriodicyOfSchedInfo.c \ E-DPDCH-PL-NonMax.c \ E-DPDCH-Reference-E-TFCI.c \ E-DPDCH-Reference-E-TFCIList.c \ E-DPDCH-SchedulingInfoConfiguration.c \ E-DPDCH-SchedulingTransmConfiguration.c \ E-DPDCH-MaxChannelisationCodes.c \ E-HICH-ChannelisationCode.c \ E-HICH-Information.c \ E-HICH-RGCH-SignatureSequence.c \ E-RGCH-CombinationIndex.c \ E-RGCH-Information.c \ E-TFCI-TableIndex.c \ EXT-UL-TimingAdvance.c \ FACH-PCH-Information.c \ FACH-PCH-InformationList.c \ Feedback-cycle.c \ FPACH-Info-r4.c \ FrequencyInfo.c \ FrequencyInfoFDD.c \ FrequencyInfoTDD.c \ HappyBit-DelayCondition.c \ HARQ-Preamble-Mode.c \ HS-ChannelisationCode-LCR.c \ HS-PDSCH-Midamble-Configuration-TDD128.c \ HS-SCCH-Info.c \ HS-SCCH-Info-r6.c \ HS-SCCH-Info-r7.c \ HS-SCCH-Codes.c \ HS-SCCH-TDD128.c \ HS-SICH-Configuration-TDD128.c \ HS-SCCH-TDD384.c \ HS-SCCH-TDD384-r6.c \ HS-SCCH-TDD768.c \ HS-SICH-Configuration-TDD384.c \ HS-SICH-Configuration-TDD768.c \ HS-SICH-Power-Control-Info-TDD384.c \ HS-SICH-Power-Control-Info-TDD768.c \ IndividualTimeslotInfo.c \ IndividualTimeslotInfo-VHCR.c \ IndividualTimeslotInfo-LCR-r4.c \ IndividualTimeslotInfo-LCR-r4-ext.c \ IndividualTS-Interference.c \ IndividualTS-InterferenceList.c \ ITP.c \ NidentifyAbort.c \ MaxAllowedUL-TX-Power.c \ MaxAvailablePCPCH-Number.c \ MaxPowerIncrease-r4.c \ MaxTFCI-Field2Value.c \ Measurement-Feedback-Info.c \ MidambleConfigurationBurstType1and3.c \ MidambleConfigurationBurstType2.c \ MidambleConfigurationBurstType2-VHCR.c \ MidambleShiftAndBurstType.c \ MidambleShiftAndBurstType-VHCR.c \ MidambleShiftAndBurstType-DL.c \ MidambleShiftAndBurstType-DL-VHCR.c \ MidambleShiftAndBurstType-LCR-r4.c \ MidambleShiftLong.c \ MidambleShiftShort.c \ MidambleShiftShort-VHCR.c \ MinimumSpreadingFactor.c \ MultiCodeInfo.c \ N-EOT.c \ N-GAP.c \ N-PCH.c \ N-StartMessage.c \ NB01.c \ NF-Max.c \ NumberOfDPDCH.c \ NumberOfFBI-Bits.c \ OpenLoopPowerControl-TDD.c \ OpenLoopPowerControl-IPDL-TDD-r4.c \ PagingIndicatorLength.c \ PC-Preamble.c \ PCP-Length.c \ PCPCH-ChannelInfo.c \ PCPCH-ChannelInfoList.c \ PCPICH-UsageForChannelEst.c \ PDSCH-CapacityAllocationInfo.c \ PDSCH-CapacityAllocationInfo-r4.c \ PDSCH-CapacityAllocationInfo-r7.c \ PDSCH-CodeInfo.c \ PDSCH-CodeInfoList.c \ PDSCH-CodeMap.c \ PDSCH-CodeMapList.c \ PDSCH-CodeMapping.c \ PDSCH-Identity.c \ PDSCH-Info.c \ PDSCH-Info-r4.c \ PDSCH-Info-r7.c \ PDSCH-Info-LCR-r4.c \ PDSCH-PowerControlInfo.c \ PDSCH-SHO-DCH-Info.c \ PDSCH-SysInfo.c \ PDSCH-SysInfo-r7.c \ PDSCH-SysInfo-HCR-r5.c \ PDSCH-SysInfo-LCR-r4.c \ PDSCH-SysInfoList.c \ PDSCH-SysInfoList-r7.c \ PDSCH-SysInfoList-HCR-r5.c \ PDSCH-SysInfoList-LCR-r4.c \ PDSCH-SysInfoList-SFN.c \ PDSCH-SysInfoList-SFN-HCR-r5.c \ PDSCH-SysInfoList-SFN-LCR-r4.c \ PersistenceScalingFactor.c \ PersistenceScalingFactorList.c \ PI-CountPerFrame.c \ PichChannelisationCodeList-LCR-r4.c \ PICH-Info.c \ PICH-Info-r7.c \ PICH-Info-LCR-r4.c \ PICH-PowerOffset.c \ PilotBits128.c \ PilotBits256.c \ MeasurementPowerOffset.c \ PLCCH-Info.c \ PositionFixedOrFlexible.c \ PowerControlAlgorithm.c \ PowerOffsetPilot-pdpdch.c \ PowerOffsetTPC-pdpdch.c \ PowerRampStep.c \ PRACH-ChanCodes-LCR-r4.c \ PRACH-Definition-LCR-r4.c \ PRACH-Midamble.c \ PRACH-Partitioning.c \ PRACH-Partitioning-r7.c \ PRACH-Partitioning-LCR-r4.c \ PRACH-PowerOffset.c \ PRACH-RACH-Info.c \ PRACH-RACH-Info-r7.c \ PRACH-RACH-Info-LCR-r4.c \ PRACH-SystemInformation.c \ PRACH-SystemInformation-r7.c \ PRACH-SystemInformation-LCR-r4.c \ PRACH-SystemInformationList.c \ PRACH-SystemInformationList-r7.c \ PRACH-SystemInformationList-LCR-r4.c \ PreambleRetransMax.c \ PreambleScramblingCodeWordNumber.c \ PreDefPhyChConfiguration.c \ PrimaryCCPCH-Info.c \ PrimaryCCPCH-Info-r4.c \ PrimaryCCPCH-Info-r7.c \ PrimaryCCPCH-Info-LCR-r4.c \ PrimaryCCPCH-Info-LCR-r4-ext.c \ PrimaryCCPCH-InfoPost.c \ PrimaryCCPCH-InfoPostTDD-LCR-r4.c \ PrimaryCCPCH-TX-Power.c \ PrimaryCPICH-Info.c \ PrimaryCPICH-TX-Power.c \ PrimaryScramblingCode.c \ PuncturingLimit.c \ PUSCH-CapacityAllocationInfo.c \ PUSCH-CapacityAllocationInfo-r4.c \ PUSCH-CapacityAllocationInfo-r7.c \ PUSCH-Identity.c \ PUSCH-Info.c \ PUSCH-Info-r4.c \ PUSCH-Info-VHCR.c \ PUSCH-Info-LCR-r4.c \ PUSCH-PowerControlInfo-r4.c \ PUSCH-PowerControlInfo-r7.c \ PUSCH-SysInfo.c \ PUSCH-SysInfo-VHCR.c \ PUSCH-SysInfo-HCR-r5.c \ PUSCH-SysInfo-LCR-r4.c \ PUSCH-SysInfoList.c \ PUSCH-SysInfoList-HCR-r5.c \ PUSCH-SysInfoList-LCR-r4.c \ PUSCH-SysInfoList-SFN.c \ PUSCH-SysInfoList-SFN-HCR-r5.c \ PUSCH-SysInfoList-SFN-LCR-r4.c \ PUSCH-SysInfoList-SFN-VHCR.c \ RACH-TransmissionParameters.c \ ReducedScramblingCodeNumber.c \ RepetitionPeriodAndLength.c \ RepetitionPeriodLengthAndOffset.c \ ReplacedPDSCH-CodeInfo.c \ ReplacedPDSCH-CodeInfoList.c \ RepPerLengthOffset-PICH.c \ RepPerLengthOffset-MICH.c \ RestrictedTrCH.c \ RestrictedTrCH-InfoList.c \ RL-AdditionInformation.c \ RL-AdditionInformation-r6.c \ RL-AdditionInformationList.c \ RL-AdditionInformationList-r6.c \ RL-IdentifierList.c \ RL-RemovalInformationList.c \ RPP.c \ S-Field.c \ SCCPCH-ChannelisationCode.c \ SCCPCH-ChannelisationCode-VHCR.c \ SCCPCH-ChannelisationCodeList.c \ SCCPCH-ChannelisationCodeList-VHCR.c \ SCCPCH-InfoForFACH.c \ SCCPCH-InfoForFACH-r4.c \ SCCPCH-SystemInformation.c \ SCCPCH-SystemInformation-LCR-r4-ext.c \ SCCPCH-SystemInformation-r7.c \ SCCPCH-SystemInformationList.c \ SCCPCH-SystemInformationList-r7.c \ SCCPCH-SystemInformationList-LCR-r4-ext.c \ SCCPCH-SystemInformation-MBMS-r6.c \ SCCPCH-SystemInformation-MBMS-r7.c \ ScramblingCodeChange.c \ ScramblingCodeType.c \ SecondaryCCPCH-Info.c \ SecondaryCCPCH-Info-r4.c \ SecondaryCCPCH-Info-r7.c \ SecondaryCCPCH-Info-LCR-r4-ext.c \ SecondaryCCPCHInfo-MBMS-r6.c \ SecondaryCCPCHInfo-MBMS-r7.c \ SecondaryCPICH-Info.c \ SecondaryScramblingCode.c \ SecondInterleavingMode.c \ SF256-AndCodeNumber.c \ SF512-AndCodeNumber.c \ SF512-AndPilot.c \ SF-PDSCH.c \ SF-PRACH.c \ SFN-TimeInfo.c \ SpecialBurstScheduling.c \ SpreadingFactor.c \ SRB-delay.c \ SSDT-CellIdentity.c \ SSDT-Information.c \ SSDT-Information-r4.c \ SSDT-UL.c \ SynchronisationParameters-r4.c \ SYNC-UL-Procedure-r4.c \ SYNC-UL-Info-r4.c \ TDD-FPACH-CCode16-r4.c \ TDD-UL-Interference.c \ TDD-PICH-CCode.c \ TDD768-PICH-CCode.c \ TDD-PRACH-CCode8.c \ TDD-PRACH-CCode16.c \ TDD-PRACH-CCode-LCR-r4.c \ TDD-PRACH-CCodeList.c \ TDD768-PRACH-CCode8.c \ TDD768-PRACH-CCode16.c \ TDD768-PRACH-CCode32.c \ TDD768-PRACH-CCodeList.c \ TFC-ControlDuration.c \ TFCI-Coding.c \ TGCFN.c \ TGD.c \ TGL.c \ TGMP.c \ TGP-Sequence.c \ TGPS-Reconfiguration-CFN.c \ TGP-SequenceList.c \ TGP-SequenceShort.c \ TGPL.c \ TGPRC.c \ TGPS-ConfigurationParams.c \ TGPSI.c \ TGSN.c \ TimeInfo.c \ TimeslotList.c \ TimeslotList-r4.c \ TimeslotNumber.c \ TimeslotNumber-LCR-r4.c \ TimeslotNumber-PRACH-LCR-r4.c \ TimeslotSync2.c \ TimingOffset.c \ TimingMaintainedSynchInd.c \ TPC-CombinationIndex.c \ TPC-CommandTargetRate.c \ TPC-StepSizeFDD.c \ TPC-StepSizeTDD.c \ TreconfirmAbort.c \ TX-DiversityMode.c \ UARFCN.c \ UCSM-Info.c \ UL-CCTrCH.c \ UL-CCTrCH-r4.c \ UL-CCTrCH-r7.c \ UL-CCTrCHList.c \ UL-CCTrCHList-r4.c \ UL-CCTrCHList-r7.c \ UL-CCTrCHListToRemove.c \ UL-CCTrChTPCList.c \ UL-ChannelRequirement.c \ UL-ChannelRequirement-r4.c \ UL-ChannelRequirement-r5.c \ UL-ChannelRequirementWithCPCH-SetID.c \ UL-ChannelRequirementWithCPCH-SetID-r4.c \ UL-ChannelRequirementWithCPCH-SetID-r5.c \ UL-CompressedModeMethod.c \ UL-DL-Mode.c \ UL-DPCCH-SlotFormat.c \ UL-DPCH-Info.c \ UL-DPCH-Info-r4.c \ UL-DPCH-Info-r5.c \ UL-DPCH-Info-r6.c \ UL-DPCH-Info-r7.c \ UL-DPCH-InfoPostFDD.c \ UL-DPCH-InfoPostTDD.c \ UL-DPCH-InfoPostTDD-LCR-r4.c \ UL-DPCH-InfoPredef.c \ UL-DPCH-PowerControlInfo.c \ UL-DPCH-PowerControlInfo-r4.c \ UL-DPCH-PowerControlInfo-r5.c \ UL-DPCH-PowerControlInfo-r6.c \ UL-DPCH-PowerControlInfo-r7.c \ UL-DPCH-PowerControlInfoPostFDD.c \ UL-DPCH-PowerControlInfoPostTDD.c \ UL-DPCH-PowerControlInfoPostTDD-LCR-r4.c \ UL-DPCH-PowerControlInfoPredef.c \ UL-EDCH-Information-r6.c \ UL-Interference.c \ UL-ScramblingCode.c \ UL-SynchronisationParameters-r4.c \ UL-TargetSIR.c \ UL-TimingAdvance.c \ UL-TimingAdvance-VHCR.c \ UL-TimingAdvanceControl.c \ UL-TimingAdvanceControl-r4.c \ UL-TimingAdvanceControl-r7.c \ UL-TimingAdvanceControl-LCR-r4.c \ UL-TS-ChannelisationCode.c \ UL-TS-ChannelisationCodeList.c \ UL-TS-ChannelisationCodeList-r7.c \ UL-TS-ChannelisationCode-VHCR.c \ UL-TS-ChannelisationCodeList-VHCR.c \ UplinkAdditionalTimeslots.c \ UplinkAdditionalTimeslots-LCR-r4.c \ UplinkAdditionalTimeslots-LCR-r7.c \ UplinkTimeslotsCodes.c \ UplinkTimeslotsCodes-VHCR.c \ UplinkTimeslotsCodes-LCR-r4.c \ UplinkTimeslotsCodes-LCR-r7.c \ Wi-LCR.c \ AcquisitionSatInfo.c \ AcquisitionSatInfoList.c \ AdditionalMeasurementID-List.c \ AlmanacSatInfo.c \ AlmanacSatInfoList.c \ AverageRLC-BufferPayload.c \ AzimuthAndElevation.c \ BadSatList.c \ Frequency-Band.c \ BCCH-ARFCN.c \ BLER-MeasurementResults.c \ BLER-MeasurementResultsList.c \ BLER-TransChIdList.c \ BSIC-VerificationRequired.c \ BSICReported.c \ BurstModeParameters.c \ CellDCH-ReportCriteria.c \ CellDCH-ReportCriteria-LCR-r4.c \ CellIndividualOffset.c \ CellInfo.c \ CellInfo-r4.c \ CellInfoSI-RSCP.c \ CellInfoSI-RSCP-LCR-r4.c \ CellInfoSI-ECN0.c \ CellInfoSI-ECN0-LCR-r4.c \ CellInfoSI-HCS-RSCP.c \ CellInfoSI-HCS-RSCP-LCR-r4.c \ CellInfoSI-HCS-ECN0.c \ CellInfoSI-HCS-ECN0-LCR-r4.c \ CellMeasuredResults.c \ CellMeasurementEventResults.c \ CellMeasurementEventResults-LCR-r4.c \ CellReportingQuantities.c \ CellSelectReselectInfoSIB-11-12.c \ CellSelectReselectInfoSIB-11-12-RSCP.c \ CellSelectReselectInfoSIB-11-12-ECN0.c \ CellSelectReselectInfoSIB-11-12-HCS-RSCP.c \ CellSelectReselectInfoSIB-11-12-HCS-ECN0.c \ CellSelectReselectInfo-v590ext.c \ CellSelectReselectInfoPCHFACH-v5b0ext.c \ CellSelectReselectInfoTreselectionScaling-v5c0ext.c \ CellsForInterFreqMeasList.c \ CellsForInterRATMeasList.c \ CellsForIntraFreqMeasList.c \ CellSynchronisationInfo.c \ CellToReport.c \ CellToReportList.c \ CodePhaseSearchWindow.c \ CountC-SFN-Frame-difference.c \ CPICH-Ec-N0.c \ CPICH-RSCP.c \ DeltaPRC.c \ DeltaQrxlevmin.c \ DeltaRSCP.c \ DeltaRSCPPerCell.c \ DeltaRRC.c \ DGPS-CorrectionSatInfo.c \ DGPS-CorrectionSatInfoList.c \ DiffCorrectionStatus.c \ DL-TransportChannelBLER.c \ DopplerUncertainty.c \ EllipsoidPoint.c \ EllipsoidPointAltitude.c \ EllipsoidPointAltitudeEllipsoide.c \ EllipsoidPointUncertCircle.c \ EllipsoidPointUncertEllipse.c \ EnvironmentCharacterisation.c \ Event1a.c \ Event1a-r4.c \ Event1a-LCR-r4.c \ Event1b.c \ Event1b-r4.c \ Event1b-LCR-r4.c \ Event1c.c \ Event1d.c \ Event1e.c \ Event1e-r6.c \ Event1f.c \ Event1f-r6.c \ Event1j-r6.c \ Event2a.c \ Event2a-r6.c \ Event2b.c \ Event2b-r6.c \ Event2c.c \ Event2c-r6.c \ Event2d.c \ Event2d-r6.c \ Event2e.c \ Event2e-r6.c \ Event2f.c \ Event2f-r6.c \ Event3a.c \ Event3b.c \ Event3c.c \ Event3d.c \ EventIDInterFreq.c \ EventIDInterRAT.c \ EventIDIntraFreq.c \ EventResults.c \ ExtraDopplerInfo.c \ FACH-MeasurementOccasionInfo.c \ FACH-MeasurementOccasionInfo-LCR-r4-ext.c \ FilterCoefficient.c \ FineSFN-SFN.c \ ForbiddenAffectCell.c \ ForbiddenAffectCell-r4.c \ ForbiddenAffectCell-LCR-r4.c \ ForbiddenAffectCellList.c \ ForbiddenAffectCellList-r4.c \ ForbiddenAffectCellList-LCR-r4.c \ FreqQualityEstimateQuantity-FDD.c \ FreqQualityEstimateQuantity-TDD.c \ GPS-MeasurementParam.c \ GPS-MeasurementParamList.c \ GSM-CarrierRSSI.c \ GSM-MeasuredResults.c \ GSM-MeasuredResultsList.c \ GPS-TOW-1msec.c \ GPS-TOW-Assist.c \ GPS-TOW-AssistList.c \ HCS-CellReselectInformation-RSCP.c \ HCS-CellReselectInformation-ECN0.c \ HCS-NeighbouringCellInformation-RSCP.c \ HCS-NeighbouringCellInformation-ECN0.c \ HCS-PRIO.c \ HCS-ServingCellInformation.c \ HorizontalVelocity.c \ HorizontalWithVerticalVelocity.c \ HorizontalVelocityWithUncertainty.c \ HorizontalWithVerticalVelocityAndUncertainty.c \ Hysteresis.c \ HysteresisInterFreq.c \ InterFreqCell.c \ InterFreqCell-LCR-r4.c \ InterFreqCellID.c \ InterFreqCellInfoList.c \ InterFreqCellInfoList-r4.c \ InterFreqCellInfoSI-List-RSCP.c \ InterFreqCellInfoSI-List-ECN0.c \ InterFreqCellInfoSI-List-HCS-RSCP.c \ InterFreqCellInfoSI-List-HCS-ECN0.c \ InterFreqCellInfoSI-List-RSCP-LCR.c \ InterFreqCellInfoSI-List-ECN0-LCR.c \ InterFreqCellInfoSI-List-HCS-RSCP-LCR.c \ InterFreqCellInfoSI-List-HCS-ECN0-LCR.c \ InterFreqCellList.c \ InterFreqCellList-LCR-r4-ext.c \ InterFreqCellMeasuredResultsList.c \ InterFreqEvent.c \ InterFreqEvent-r6.c \ InterFreqEventList.c \ InterFreqEventList-r6.c \ InterFrequencyMeasuredResultsList-v590ext.c \ Inter-FreqEventCriteria-v590ext.c \ Inter-FreqEventCriteriaList-v590ext.c \ Intra-FreqEventCriteriaList-v590ext.c \ IntraFrequencyMeasuredResultsList-v590ext.c \ IntraFreqReportingCriteria-1b-r5.c \ PeriodicReportingInfo-1b.c \ InterFreqEventResults.c \ InterFreqEventResults-LCR-r4-ext.c \ InterFreqMeasQuantity.c \ InterFreqMeasuredResults.c \ InterFreqMeasuredResultsList.c \ InterFreqMeasurementSysInfo-RSCP.c \ InterFreqMeasurementSysInfo-ECN0.c \ InterFreqMeasurementSysInfo-HCS-RSCP.c \ InterFreqMeasurementSysInfo-HCS-ECN0.c \ InterFreqMeasurementSysInfo-RSCP-LCR-r4.c \ InterFreqMeasurementSysInfo-ECN0-LCR-r4.c \ InterFreqMeasurementSysInfo-HCS-RSCP-LCR-r4.c \ InterFreqMeasurementSysInfo-HCS-ECN0-LCR-r4.c \ InterFreqRACHRepCellsList.c \ InterFreqRACHReportingInfo.c \ InterFreqReportCriteria.c \ InterFreqReportCriteria-r4.c \ InterFreqReportCriteria-r6.c \ InterFreqReportingCriteria.c \ InterFreqReportingCriteria-r6.c \ InterFreqReportingQuantity.c \ InterFreqRepQuantityRACH-FDD.c \ InterFreqRepQuantityRACH-TDD.c \ InterFreqRepQuantityRACH-TDDList.c \ InterFrequencyMeasurement.c \ InterFrequencyMeasurement-r4.c \ InterFrequencyMeasurement-r6.c \ InterRAT-TargetCellDescription.c \ InterRATCellID.c \ InterRATCellInfoIndication.c \ InterRATCellInfoList.c \ InterRATCellInfoList-B.c \ InterRATCellInfoList-r4.c \ InterRATCellInfoList-r6.c \ InterRATCellIndividualOffset.c \ InterRATEvent.c \ InterRATEventList.c \ InterRATEventResults.c \ InterRATInfo.c \ InterRATInfo-r6.c \ InterRATMeasQuantity.c \ InterRATMeasuredResults.c \ InterRATMeasuredResultsList.c \ InterRATMeasurement.c \ InterRATMeasurement-r4.c \ InterRATMeasurement-r6.c \ InterRATMeasurementSysInfo.c \ InterRATMeasurementSysInfo-B.c \ InterRATReportCriteria.c \ InterRATReportingCriteria.c \ InterRATReportingQuantity.c \ IntraFreqCellID.c \ IntraFreqCellInfoList.c \ IntraFreqCellInfoList-r4.c \ IntraFreqCellInfoSI-List-RSCP.c \ IntraFreqCellInfoSI-List-ECN0.c \ IntraFreqCellInfoSI-List-HCS-RSCP.c \ IntraFreqCellInfoSI-List-HCS-ECN0.c \ IntraFreqCellInfoSI-List-RSCP-LCR-r4.c \ IntraFreqCellInfoSI-List-ECN0-LCR-r4.c \ IntraFreqCellInfoSI-List-HCS-RSCP-LCR-r4.c \ IntraFreqCellInfoSI-List-HCS-ECN0-LCR-r4.c \ IntraFreqEvent.c \ IntraFreqEvent-r4.c \ IntraFreqEvent-LCR-r4.c \ IntraFreqEvent-r6.c \ IntraFreqEvent-1d-r5.c \ IntraFreqEventCriteria.c \ IntraFreqEventCriteria-r4.c \ IntraFreqEventCriteria-LCR-r4.c \ IntraFreqEventCriteria-r6.c \ IntraFreqEventCriteriaList.c \ IntraFreqEventCriteriaList-r4.c \ IntraFreqEventCriteriaList-LCR-r4.c \ IntraFreqEventCriteriaList-r6.c \ IntraFreqEventResults.c \ IntraFreqMeasQuantity.c \ IntraFreqMeasQuantity-FDD.c \ IntraFreqMeasQuantity-TDD.c \ IntraFreqMeasQuantity-TDDList.c \ IntraFreqMeasuredResultsList.c \ IntraFreqMeasurementSysInfo-RSCP.c \ IntraFreqMeasurementSysInfo-ECN0.c \ IntraFreqMeasurementSysInfo-HCS-RSCP.c \ IntraFreqMeasurementSysInfo-HCS-ECN0.c \ IntraFreqMeasurementSysInfo-RSCP-LCR-r4.c \ IntraFreqMeasurementSysInfo-ECN0-LCR-r4.c \ IntraFreqMeasurementSysInfo-HCS-RSCP-LCR-r4.c \ IntraFreqMeasurementSysInfo-HCS-ECN0-LCR-r4.c \ IntraFreqReportCriteria.c \ IntraFreqReportCriteria-r4.c \ IntraFreqReportCriteria-r6.c \ IntraFreqReportingCriteria.c \ IntraFreqReportingCriteria-r4.c \ IntraFreqReportingCriteria-LCR-r4.c \ IntraFreqReportingCriteria-r6.c \ IntraFreqReportingQuantity.c \ IntraFreqReportingQuantityForRACH.c \ IntraFreqRepQuantityRACH-FDD.c \ IntraFreqRepQuantityRACH-TDD.c \ IntraFreqRepQuantityRACH-TDDList.c \ IntraFrequencyMeasurement.c \ IntraFrequencyMeasurement-r4.c \ IntraFrequencyMeasurement-r6.c \ IODE.c \ IP-Length.c \ IP-PCCPCH-r4.c \ IP-Spacing.c \ IP-Spacing-TDD.c \ IS-2000SpecificMeasInfo.c \ MaxNumberOfReportingCellsType1.c \ MaxNumberOfReportingCellsType2.c \ MaxNumberOfReportingCellsType3.c \ MaxReportedCellsOnRACH.c \ MaxReportedCellsOnRACHinterFreq.c \ MeasuredResults.c \ MeasuredResults-v390ext.c \ MeasuredResults-v590ext.c \ MeasuredResults-v7xyext.c \ MeasuredResults-LCR-r4.c \ MeasuredResultsList.c \ MeasuredResultsList-LCR-r4-ext.c \ MeasuredResultsOnRACH.c \ MeasuredResultsOnRACHinterFreq.c \ MeasurementCommand.c \ MeasurementCommand-r4.c \ MeasurementCommand-r6.c \ MeasurementControlSysInfo.c \ MeasurementControlSysInfo-LCR-r4-ext.c \ MeasurementIdentity.c \ MeasurementQuantityGSM.c \ MeasurementReportingMode.c \ MeasurementType.c \ MeasurementType-r4.c \ MeasurementType-r6.c \ MeasurementValidity.c \ MonitoredCellRACH-List.c \ MonitoredCellRACH-Result.c \ MultipathIndicator.c \ N-CR-T-CRMaxHyst.c \ NavigationModelSatInfo.c \ NavigationModelSatInfoList.c \ EphemerisParameter.c \ NC-Mode.c \ Neighbour.c \ Neighbour-v390ext.c \ NeighbourList.c \ NeighbourList-v390ext.c \ NeighbourQuality.c \ NewInterFreqCell.c \ NewInterFreqCell-r4.c \ NewInterFreqCellList.c \ NewInterFreqCellList-r4.c \ NewInterFreqCellSI-RSCP.c \ NewInterFreqCellSI-ECN0.c \ NewInterFreqCellSI-HCS-RSCP.c \ NewInterFreqCellSI-HCS-ECN0.c \ NewInterFreqCellSI-RSCP-LCR-r4.c \ NewInterFreqCellSI-ECN0-LCR-r4.c \ NewInterFreqCellSI-HCS-RSCP-LCR-r4.c \ NewInterFreqCellSI-HCS-ECN0-LCR-r4.c \ NewInterFreqCellSI-List-ECN0.c \ NewInterFreqCellSI-List-HCS-RSCP.c \ NewInterFreqCellSI-List-HCS-ECN0.c \ NewInterFreqCellSI-List-RSCP.c \ NewInterFreqCellSI-List-ECN0-LCR-r4.c \ NewInterFreqCellSI-List-HCS-RSCP-LCR-r4.c \ NewInterFreqCellSI-List-HCS-ECN0-LCR-r4.c \ NewInterFreqCellSI-List-RSCP-LCR-r4.c \ NewInterRATCell.c \ NewInterRATCell-B.c \ NewInterRATCellList.c \ NewInterRATCellList-B.c \ NewIntraFreqCell.c \ NewIntraFreqCell-r4.c \ NewIntraFreqCellList.c \ NewIntraFreqCellList-r4.c \ NewIntraFreqCellSI-RSCP.c \ NewIntraFreqCellSI-ECN0.c \ NewIntraFreqCellSI-HCS-RSCP.c \ NewIntraFreqCellSI-HCS-ECN0.c \ NewIntraFreqCellSI-RSCP-LCR-r4.c \ NewIntraFreqCellSI-ECN0-LCR-r4.c \ NewIntraFreqCellSI-HCS-RSCP-LCR-r4.c \ NewIntraFreqCellSI-HCS-ECN0-LCR-r4.c \ NewIntraFreqCellSI-List-RSCP.c \ NewIntraFreqCellSI-List-ECN0.c \ NewIntraFreqCellSI-List-HCS-RSCP.c \ NewIntraFreqCellSI-List-HCS-ECN0.c \ NewIntraFreqCellSI-List-RSCP-LCR-r4.c \ NewIntraFreqCellSI-List-ECN0-LCR-r4.c \ NewIntraFreqCellSI-List-HCS-RSCP-LCR-r4.c \ NewIntraFreqCellSI-List-HCS-ECN0-LCR-r4.c \ NonUsedFreqParameter.c \ NonUsedFreqParameter-r6.c \ NonUsedFreqParameterList.c \ NonUsedFreqParameterList-r6.c \ NonUsedFreqWList-r6.c \ ObservedTimeDifferenceToGSM.c \ OTDOA-SearchWindowSize.c \ Pathloss.c \ PenaltyTime-RSCP.c \ PenaltyTime-ECN0.c \ PendingTimeAfterTrigger.c \ PeriodicalOrEventTrigger.c \ PeriodicalReportingCriteria.c \ PeriodicalWithReportingCellStatus.c \ PLMNIdentitiesOfNeighbourCells.c \ PLMNsOfInterFreqCellsList.c \ PLMNsOfIntraFreqCellsList.c \ PLMNsOfInterRATCellsList.c \ PositionEstimate.c \ PositioningMethod.c \ PRC.c \ PrimaryCCPCH-RSCP.c \ Q-HCS.c \ Q-OffsetS-N.c \ Q-QualMin.c \ Q-RxlevMin.c \ QualityEventResults.c \ QualityMeasuredResults.c \ QualityMeasurement.c \ QualityReportCriteria.c \ QualityReportingCriteria.c \ QualityReportingCriteriaSingle.c \ QualityReportingQuantity.c \ RAT-Type.c \ ReferenceCellPosition.c \ ReferenceLocation.c \ ReferenceTimeDifferenceToCell.c \ RemovedInterFreqCellList.c \ RemovedInterRATCellList.c \ RemovedIntraFreqCellList.c \ ReplacementActivationThreshold.c \ ReportDeactivationThreshold.c \ ReportingAmount.c \ ReportingCellStatus.c \ ReportingCellStatusOpt.c \ ReportingInfoForCellDCH.c \ ReportingInfoForCellDCH-LCR-r4.c \ ReportingInterval.c \ ReportingIntervalLong.c \ ReportingRange.c \ RL-AdditionInfoList.c \ RL-InformationLists.c \ RLC-BuffersPayload.c \ RRC.c \ SatData.c \ SatDataList.c \ SatelliteStatus.c \ SatID.c \ SFN-Offset-Validity.c \ SFN-SFN-Drift.c \ SFN-SFN-ObsTimeDifference.c \ SFN-SFN-ObsTimeDifference1.c \ SFN-SFN-ObsTimeDifference2.c \ SFN-SFN-OTD-Type.c \ SFN-SFN-RelTimeDifference1.c \ SFN-TOW-Uncertainty.c \ SIR.c \ SIR-MeasurementList.c \ SIR-MeasurementResults.c \ SIR-TFCS.c \ SIR-TFCS-List.c \ SIR-TimeslotList.c \ SubFrame1Reserved.c \ T-ADVinfo.c \ T-CRMax.c \ T-CRMaxHyst.c \ TemporaryOffset1.c \ TemporaryOffset2.c \ TemporaryOffsetList.c \ Threshold.c \ Threshold-r6.c \ ThreholdNonUsedFrequency-deltaList.c \ ThresholdPositionChange.c \ ThresholdSFN-GPS-TOW.c \ ThresholdSFN-SFN-Change.c \ ThresholdUsedFrequency.c \ ThresholdUsedFrequency-r6.c \ TimeInterval.c \ TimeslotInfo.c \ TimeslotInfo-LCR-r4.c \ TimeslotInfoList.c \ TimeslotInfoList-LCR-r4.c \ TimeslotInfoList-r4.c \ TimeslotISCP.c \ TimeslotISCP-List.c \ TimeslotListWithISCP.c \ TimeslotWithISCP.c \ TimeToTrigger.c \ TrafficVolumeEventParam.c \ TrafficVolumeEventResults.c \ TrafficVolumeEventType.c \ TrafficVolumeMeasQuantity.c \ TrafficVolumeMeasSysInfo.c \ TrafficVolumeMeasuredResults.c \ TrafficVolumeMeasuredResultsList.c \ TrafficVolumeMeasurement.c \ TrafficVolumeMeasurementObjectList.c \ TrafficVolumeReportCriteria.c \ TrafficVolumeReportCriteriaSysInfo.c \ TrafficVolumeReportingCriteria.c \ TrafficVolumeReportingQuantity.c \ TrafficVolumeThreshold.c \ TransChCriteria.c \ TransChCriteriaList.c \ TransferMode.c \ TransmittedPowerThreshold.c \ TriggeringCondition1.c \ TriggeringCondition2.c \ TX-InterruptionAfterTrigger.c \ UDRE.c \ UE-6AB-Event.c \ UE-6FG-Event.c \ UE-AutonomousUpdateMode.c \ UE-InternalEventParam.c \ UE-InternalEventParamList.c \ UE-InternalEventResults.c \ UE-InternalMeasQuantity.c \ UE-InternalMeasuredResults.c \ UE-InternalMeasuredResults-r7.c \ UE-InternalMeasuredResults-LCR-r4.c \ UE-InternalMeasurement.c \ UE-InternalMeasurement-r4.c \ UE-InternalMeasurementSysInfo.c \ UE-InternalReportCriteria.c \ UE-InternalReportingCriteria.c \ UE-InternalReportingQuantity.c \ UE-InternalReportingQuantity-r4.c \ UE-MeasurementQuantity.c \ UE-RX-TX-ReportEntry.c \ UE-RX-TX-ReportEntryList.c \ UE-RX-TX-TimeDifferenceType1.c \ UE-RX-TX-TimeDifferenceType2.c \ UE-RX-TX-TimeDifferenceType2Info.c \ UE-RX-TX-TimeDifferenceThreshold.c \ UE-TransmittedPower.c \ UE-TransmittedPowerTDD-List.c \ UL-TrCH-Identity.c \ UE-Positioning-Accuracy.c \ UE-Positioning-CipherParameters.c \ UE-Positioning-Error.c \ UE-Positioning-ErrorCause.c \ UE-Positioning-EventParam.c \ UE-Positioning-EventParamList.c \ UE-Positioning-EventSpecificInfo.c \ UE-Positioning-GPS-AcquisitionAssistance.c \ UE-Positioning-GPS-AdditionalAssistanceDataRequest.c \ UE-Positioning-GPS-Almanac.c \ UE-Positioning-GPS-AssistanceData.c \ UE-Positioning-GPS-DGPS-Corrections.c \ UE-Positioning-GPS-IonosphericModel.c \ UE-Positioning-GPS-MeasurementResults.c \ UE-Positioning-GPS-NavigationModel.c \ UE-Positioning-GPS-NavModelAddDataReq.c \ UE-Positioning-GPS-ReferenceCellInfo.c \ UE-Positioning-GPS-ReferenceTime.c \ UE-Positioning-GPS-UTC-Model.c \ UE-Positioning-IPDL-Parameters.c \ UE-Positioning-IPDL-Parameters-r4.c \ UE-Positioning-IPDL-Parameters-TDD-r4-ext.c \ UE-Positioning-MeasuredResults.c \ UE-Positioning-MeasuredResults-v390ext.c \ UE-Positioning-Measurement.c \ UE-Positioning-Measurement-v390ext.c \ UE-Positioning-Measurement-r4.c \ UE-Positioning-Measurement-v7xyext.c \ UE-Positioning-MeasurementEventResults.c \ UE-Positioning-MeasurementInterval.c \ UE-Positioning-MethodType.c \ UE-Positioning-OTDOA-AssistanceData.c \ UE-Positioning-OTDOA-AssistanceData-r4.c \ UE-Positioning-OTDOA-AssistanceData-r4ext.c \ UE-Positioning-OTDOA-AssistanceData-UEB.c \ UE-Positioning-IPDL-Parameters-TDDList-r4-ext.c \ UE-Positioning-OTDOA-Measurement.c \ UE-Positioning-OTDOA-Measurement-v390ext.c \ UE-Positioning-OTDOA-NeighbourCellInfo.c \ UE-Positioning-OTDOA-NeighbourCellInfo-r4.c \ UE-Positioning-OTDOA-NeighbourCellInfo-UEB.c \ UE-Positioning-OTDOA-NeighbourCellList.c \ UE-Positioning-OTDOA-NeighbourCellList-r4.c \ UE-Positioning-OTDOA-NeighbourCellList-UEB.c \ UE-Positioning-OTDOA-Quality.c \ UE-Positioning-OTDOA-ReferenceCellInfo.c \ UE-Positioning-OTDOA-ReferenceCellInfo-r4.c \ UE-Positioning-OTDOA-ReferenceCellInfo-UEB.c \ UE-Positioning-PositionEstimateInfo.c \ UE-Positioning-ReportCriteria.c \ UE-Positioning-ReportingQuantity.c \ UE-Positioning-ReportingQuantity-v390ext.c \ UE-Positioning-ReportingQuantity-r4.c \ UE-Positioning-ReportingQuantity-v7xyext.c \ UE-Positioning-ResponseTime.c \ UTRA-CarrierRSSI.c \ UTRAN-GPS-DriftRate.c \ UTRAN-GPSReferenceTime.c \ UTRAN-GPSReferenceTimeResult.c \ VarianceOfRLC-BufferPayload.c \ VelocityEstimate.c \ W.c \ BCC.c \ BCCH-ModificationInfo.c \ BCCH-ModificationTime.c \ BSIC.c \ CBS-DRX-Level1Information.c \ CBS-DRX-Level1Information-extension-r6.c \ CDMA2000-Message.c \ CDMA2000-MessageList.c \ CDMA2000-UMTS-Frequency-List.c \ CellValueTag.c \ ExpirationTimeFactor.c \ FDD-UMTS-Frequency-List.c \ FrequencyInfoCDMA2000.c \ GERAN-SystemInfoBlock.c \ GERAN-SystemInformation.c \ GSM-BA-Range.c \ GSM-BA-Range-List.c \ GSM-Classmark2.c \ GSM-Classmark3.c \ GSM-MessageList.c \ GSM-MS-RadioAccessCapability.c \ GsmSecurityCapability.c \ GSM-TargetCellInfoList.c \ GSM-TargetCellInfo.c \ IdentificationOfReceivedMessage.c \ InterRAT-ChangeFailureCause.c \ GERANIu-MessageList.c \ GERANIu-RadioAccessCapability.c \ InterRAT-UE-RadioAccessCapability.c \ InterRAT-UE-RadioAccessCapabilityList.c \ InterRAT-UE-RadioAccessCapability-v590ext.c \ InterRAT-UE-RadioAccessCapability-v690ext.c \ InterRAT-UE-SecurityCapability.c \ InterRAT-UE-SecurityCapList.c \ InterRAT-HO-FailureCause.c \ MasterInformationBlock.c \ MasterInformationBlock-v690ext.c \ MIB-ValueTag.c \ NCC.c \ PLMN-ValueTag.c \ PredefinedConfigIdentityAndValueTag.c \ ProtocolErrorInformation.c \ ReceivedMessageType.c \ Rplmn-Information.c \ Rplmn-Information-r4.c \ SchedulingInformation.c \ SchedulingInformationSIB.c \ SchedulingInformationSIBSb.c \ SegCount.c \ SegmentIndex.c \ SFN-Prime.c \ SIB-Data-fixed.c \ SIB-Data-variable.c \ SIBOccurIdentity.c \ SIBOccurrenceIdentityAndValueTag.c \ SIBOccurValueTag.c \ SIB-ReferenceList.c \ SIBSb-ReferenceList.c \ SIB-ReferenceListFACH.c \ SIB-Type.c \ SIB-TypeAndTag.c \ SIBSb-TypeAndTag.c \ SibOFF.c \ SibOFF-List.c \ SysInfoType1.c \ SysInfoType1-v3a0ext-IEs.c \ SysInfoType2.c \ SysInfoType3.c \ SysInfoType3-v4b0ext-IEs.c \ SysInfoType3-v590ext.c \ SysInfoType3-v5c0ext-IEs.c \ SysInfoType3-v670ext.c \ SysInfoType4.c \ SysInfoType4-v4b0ext-IEs.c \ SysInfoType4-v590ext.c \ SysInfoType4-v5b0ext-IEs.c \ SysInfoType4-v5c0ext-IEs.c \ SysInfoType5.c \ SysInfoType5-v4b0ext-IEs.c \ SysInfoType5-v590ext-IEs.c \ SysInfoType5-v650ext-IEs.c \ SysInfoType5-v680ext-IEs.c \ SysInfoType5-v690ext-IEs.c \ SysInfoType5-v7xyext-IEs.c \ SysInfoType5bis.c \ SysInfoType6.c \ SysInfoType6-v4b0ext-IEs.c \ SysInfoType6-v590ext-IEs.c \ SysInfoType6-v650ext-IEs.c \ SysInfoType6-v690ext-IEs.c \ SysInfoType6-v7xyext-IEs.c \ SysInfoType7.c \ SysInfoType8.c \ SysInfoType9.c \ SysInfoType10.c \ SysInfoType11.c \ SysInfoType11-v4b0ext-IEs.c \ SysInfoType11-v590ext-IEs.c \ SysInfoType11-v690ext-IEs.c \ SysInfoType12.c \ SysInfoType12-v4b0ext-IEs.c \ SysInfoType12-v590ext-IEs.c \ SysInfoType12-v690ext-IEs.c \ SysInfoType13.c \ SysInfoType13-v3a0ext-IEs.c \ SysInfoType13-v4b0ext-IEs.c \ SysInfoType13-v7xyext-IEs.c \ SysInfoType13-1.c \ SysInfoType13-2.c \ SysInfoType13-3.c \ SysInfoType13-4.c \ SysInfoType14.c \ SysInfoType15.c \ SysInfoType15-v4b0ext-IEs.c \ SysInfoType15-1.c \ SysInfoType15-2.c \ SysInfoType15-3.c \ SysInfoType15-4.c \ SysInfoType15-4-v3a0ext.c \ SysInfoType15-4-v4b0ext.c \ SysInfoType15-5.c \ SysInfoType15-5-v3a0ext.c \ SysInfoType16.c \ SysInfoType17.c \ SysInfoType17-v4b0ext-IEs.c \ SysInfoType17-v590ext-IEs.c \ SysInfoType17-v7xyext-IEs.c \ SysInfoType18.c \ SysInfoTypeSB1.c \ SysInfoTypeSB2.c \ TDD-UMTS-Frequency-List.c \ ANSI-41-GlobalServiceRedirectInfo.c \ ANSI-41-PrivateNeighbourListInfo.c \ ANSI-41-RAND-Information.c \ ANSI-41-UserZoneID-Information.c \ ANSI-41-NAS-Parameter.c \ Min-P-REV.c \ NAS-SystemInformationANSI-41.c \ NID.c \ P-REV.c \ SID.c \ MBMS-AccessProbabilityFactor.c \ MBMS-CellGroupIdentity-r6.c \ MBMS-CommonCCTrChIdentity.c \ MBMS-CommonPhyChIdentity.c \ MBMS-CommonRBIdentity.c \ MBMS-CommonRBInformation-r6.c \ MBMS-CommonRBInformationList-r6.c \ MBMS-CommonTrChIdentity.c \ MBMS-ConnectedModeCountingScope.c \ MBMS-CurrentCell-SCCPCH-r6.c \ MBMS-CurrentCell-SCCPCHList-r6.c \ MBMS-FACHCarryingMTCH-List.c \ MBMS-JoinedInformation-r6.c \ MBMS-L1CombiningSchedule-32.c \ MBMS-L1CombiningSchedule-64.c \ MBMS-L1CombiningSchedule-128.c \ MBMS-L1CombiningSchedule-256.c \ MBMS-L1CombiningSchedule-512.c \ MBMS-L1CombiningSchedule-1024.c \ MBMS-L1CombiningSchedule.c \ MBMS-L1CombiningTransmTimeDiff.c \ MBMS-L23Configuration.c \ MBMS-LogicalChIdentity.c \ MBMS-MCCH-ConfigurationInfo-r6.c \ MBMS-MICHConfigurationInfo-r6.c \ MBMS-MICHConfigurationInfo-r7.c \ MBMS-MICHNotificationIndLength.c \ MBMS-MICHPowerOffset.c \ MBMS-ModifedService-r6.c \ MBMS-ModifedServiceList-r6.c \ MBMS-MSCH-ConfigurationInfo-r6.c \ MBMS-MSCHSchedulingInfo.c \ MBMS-NeighbouringCellSCCPCH-r6.c \ MBMS-NeighbouringCellSCCPCHList-r6.c \ MBMS-NI-CountPerFrame.c \ MBMS-NumberOfNeighbourCells-r6.c \ MBMS-PFLIndex.c \ MBMS-PFLInfo.c \ MBMS-PhyChInformation-r6.c \ MBMS-PhyChInformationList-r6.c \ MBMS-PL-ServiceRestrictInfo-r6.c \ MBMS-PreferredFreqRequest-r6.c \ MBMS-PreferredFrequencyInfo-r6.c \ MBMS-PreferredFrequencyList-r6.c \ MBMS-PTMActivationTime-r6.c \ MBMS-PTM-RBInformation-C.c \ MBMS-PTM-RBInformation-CList.c \ MBMS-PTM-RBInformation-N.c \ MBMS-PTM-RBInformation-NList.c \ MBMS-Qoffset.c \ MBMS-RequiredUEAction-Mod.c \ MBMS-RequiredUEAction-UMod.c \ MBMS-SCCPCHIdentity.c \ MBMS-SCCPCHPwrOffsetDiff.c \ MBMS-ServiceAccessInfo-r6.c \ MBMS-ServiceAccessInfoList-r6.c \ MBMS-ServiceIdentity-r6.c \ MBMS-ServiceSchedulingInfo-r6.c \ MBMS-ServiceSchedulingInfoList-r6.c \ MBMS-ServiceTransmInfo.c \ MBMS-ServiceTransmInfoList.c \ MBMS-SessionIdentity.c \ MBMS-ShortTransmissionID.c \ MBMS-SIBType5-SCCPCH-r6.c \ MBMS-SIBType5-SCCPCHList-r6.c \ MBMS-SoftComb-TimingOffset.c \ MBMS-TCTF-Presence.c \ MBMS-TimersAndCounters-r6.c \ MBMS-TransmissionIdentity.c \ MBMS-TranspChInfoForCCTrCh-r6.c \ MBMS-TranspChInfoForEachCCTrCh-r6.c \ MBMS-TranspChInfoForEachTrCh-r6.c \ MBMS-TranspChInfoForTrCh-r6.c \ MBMS-TrCHInformation-Curr.c \ MBMS-TrCHInformation-CurrList.c \ MBMS-TrCHInformation-Neighb.c \ MBMS-TrCHInformation-NeighbList.c \ MBMS-TrCHInformation-SIB5.c \ MBMS-TrCHInformation-SIB5List.c \ MBMS-UnmodifiedService-r6.c \ MBMS-UnmodifiedServiceList-r6.c \ ToTargetRNC-Container.c \ TargetRNC-ToSourceRNC-Container.c \ InterRATHandoverInfoWithInterRATCapabilities-r3.c \ InterRATHandoverInfoWithInterRATCapabilities-r3-IEs.c \ InterRATHandoverInfoWithInterRATCapabilities-v390ext-IEs.c \ InterRATHandoverInfoWithInterRATCapabilities-v690ext-IEs.c \ RFC3095-ContextInfo-r5.c \ RFC3095-ContextInfoList-r5.c \ SRNC-RelocationInfo-r3.c \ SRNC-RelocationInfo-r3-IEs.c \ SRNC-RelocationInfo-v380ext-IEs.c \ SRNC-RelocationInfo-v390ext-IEs.c \ SRNC-RelocationInfo-v3a0ext-IEs.c \ SRNC-RelocationInfo-v3b0ext-IEs.c \ SRNC-RelocationInfo-v3c0ext-IEs.c \ SRNC-RelocationInfo-v3d0ext-IEs.c \ SRNC-RelocationInfo-v3g0ext-IEs.c \ SRNC-RelocationInfo-v3h0ext-IEs.c \ SRNC-RelocationInfo-v4d0ext-IEs.c \ TPC-CombinationInfoList.c \ STARTList2.c \ SRNC-RelocationInfo-v4b0ext-IEs.c \ SRNC-RelocationInfo-v590ext-IEs.c \ SRNC-RelocationInfo-v5a0ext-IEs.c \ SRNC-RelocationInfo-v5b0ext-IEs.c \ SRNC-RelocationInfo-v5c0ext-IEs.c \ SRNC-RelocationInfo-v7xyext-IEs.c \ CipheringInfoPerRB-List-v3a0ext.c \ CipheringStatusList.c \ CipheringStatusCNdomain.c \ CodeChangeStatusList.c \ CodeChangeStatus.c \ StoredCompressedModeInfo.c \ StoredTGP-SequenceList.c \ StoredTGP-Sequence.c \ SRNC-RelocationInfo-r4-IEs.c \ SRNC-RelocationInfo-r5-IEs.c \ SRNC-RelocationInfo-v690ext-IEs.c \ SRNC-RelocationInfo-r6-IEs.c \ CalculationTimeForCiphering.c \ CipheringInfoPerRB.c \ CipheringInfoPerRB-r4.c \ CipheringInfoPerRB-List.c \ CipheringInfoPerRB-List-r4.c \ CipheringStatus.c \ CipheringStatusList-r4.c \ CipheringStatusCNdomain-r4.c \ CN-DomainInformation-v390ext.c \ CN-DomainInformationList-v390ext.c \ CompressedModeMeasCapability-r4.c \ COUNT-C-List.c \ COUNT-CSingle.c \ DL-PhysChCapabilityFDD-r4.c \ DL-PhysChCapabilityFDD-r5.c \ DL-PhysChCapabilityTDD-r5.c \ DL-PhysChCapabilityTDD-LCR-r5.c \ DL-RFC3095-Context.c \ ImplementationSpecificParams.c \ IntegrityProtectionStatus.c \ InterRAT-UE-RadioAccessCapabilityList-r5.c \ IntraFreqReportingCriteria-r6-ext.c \ MaxHcContextSpace-r5.c \ MeasurementCapability-r4.c \ MeasurementCommandWithType.c \ MeasurementCommandWithType-r4.c \ MeasurementCommandWithType-r6.c \ OngoingMeasRep.c \ OngoingMeasRep-r4.c \ OngoingMeasRep-r5.c \ OngoingMeasRep-r6.c \ OngoingMeasRepList.c \ OngoingMeasRepList-r4.c \ OngoingMeasRepList-r5.c \ OngoingMeasRepList-r6.c \ PDCP-Capability-r4.c \ PDCP-Capability-r5.c \ PDCP-Capability-r6.c \ PhysicalChannelCapability-r4.c \ PhysicalChannelCapability-r5.c \ RF-Capability-r4.c \ RFC3095-ContextInfo.c \ RFC3095-Context-List.c \ RLC-Capability-r5.c \ SRB-SpecificIntegrityProtInfo.c \ SRB-SpecificIntegrityProtInfoList.c \ StateOfRRC.c \ StateOfRRC-Procedure.c \ TotalRLC-AM-BufferSize-r5.c \ TPC-Combination-Info.c \ UE-MultiModeRAT-Capability-r5.c \ UE-Positioning-Capability-r4.c \ UE-Positioning-LastKnownPos.c \ UE-RadioAccessCapability-r4.c \ UE-RadioAccessCapability-r5.c \ UE-RadioAccessCapability-r6.c \ UE-RadioAccessCapability-r7.c \ UL-RFC3095-Context.c ASN_MODULE_HEADERS= \ DL-DCCH-Message.h \ DL-DCCH-MessageType.h \ UL-DCCH-Message.h \ UL-DCCH-MessageType.h \ DL-CCCH-Message.h \ DL-CCCH-MessageType.h \ UL-CCCH-Message.h \ UL-CCCH-MessageType.h \ PCCH-Message.h \ PCCH-MessageType.h \ DL-SHCCH-Message.h \ DL-SHCCH-MessageType.h \ UL-SHCCH-Message.h \ UL-SHCCH-MessageType.h \ BCCH-FACH-Message.h \ BCCH-FACH-MessageType.h \ BCCH-BCH-Message.h \ MCCH-Message.h \ MCCH-MessageType.h \ MSCH-Message.h \ MSCH-MessageType.h \ ActiveSetUpdate.h \ ActiveSetUpdate-r3-IEs.h \ ActiveSetUpdate-v4b0ext-IEs.h \ ActiveSetUpdate-v590ext-IEs.h \ ActiveSetUpdate-v690ext-IEs.h \ ActiveSetUpdate-r6-IEs.h \ ActiveSetUpdateComplete.h \ ActiveSetUpdateFailure.h \ AssistanceDataDelivery.h \ AssistanceDataDelivery-r3-IEs.h \ AssistanceDataDelivery-v3a0ext.h \ AssistanceDataDelivery-v4b0ext-IEs.h \ CellChangeOrderFromUTRAN.h \ CellChangeOrderFromUTRAN-r3-IEs.h \ CellChangeOrderFromUTRAN-v590ext-IEs.h \ CellChangeOrderFromUTRANFailure.h \ CellChangeOrderFromUTRANFailure-r3-IEs.h \ CellUpdate.h \ CellUpdate-v590ext.h \ CellUpdate-v690ext-IEs.h \ CellUpdate-v7xyext-IEs.h \ CellUpdateConfirm.h \ CellUpdateConfirm-r3-IEs.h \ CellUpdateConfirm-v3a0ext.h \ CellUpdateConfirm-v4b0ext-IEs.h \ CellUpdateConfirm-v590ext-IEs.h \ CellUpdateConfirm-v5d0ext-IEs.h \ CellUpdateConfirm-r4-IEs.h \ CellUpdateConfirm-r5-IEs.h \ CellUpdateConfirm-r6-IEs.h \ CellUpdateConfirm-v690ext-IEs.h \ CellUpdateConfirm-r7-IEs.h \ CellUpdateConfirm-CCCH.h \ CounterCheck.h \ CounterCheck-r3-IEs.h \ CounterCheckResponse.h \ DownlinkDirectTransfer.h \ DownlinkDirectTransfer-r3-IEs.h \ HandoverToUTRANCommand.h \ HandoverToUTRANCommand-r3-IEs.h \ HandoverToUTRANCommand-r4-IEs.h \ HandoverToUTRANCommand-r5-IEs.h \ HandoverToUTRANCommand-r6-IEs.h \ HandoverToUTRANCommand-r7-IEs.h \ HandoverToUTRANComplete.h \ InitialDirectTransfer.h \ InitialDirectTransfer-v3a0ext.h \ InitialDirectTransfer-v590ext.h \ InitialDirectTransfer-v690ext-IEs.h \ HandoverFromUTRANCommand-GSM.h \ HandoverFromUTRANCommand-GSM-r3-IEs.h \ HandoverFromUTRANCommand-GSM-r6-IEs.h \ HandoverFromUTRANCommand-GSM-v690ext-IEs.h \ HandoverFromUTRANCommand-GERANIu.h \ HandoverFromUTRANCommand-GERANIu-r5-IEs.h \ HandoverFromUTRANCommand-CDMA2000.h \ HandoverFromUTRANCommand-CDMA2000-r3-IEs.h \ HandoverFromUTRANFailure.h \ HandoverFromUtranFailure-v590ext-IEs.h \ InterRATHandoverInfo.h \ InterRATHandoverInfo-v390ext-IEs.h \ InterRATHandoverInfo-v3a0ext-IEs.h \ InterRATHandoverInfo-v3d0ext-IEs.h \ InterRATHandoverInfo-v3g0ext-IEs.h \ InterRATHandoverInfo-r3-add-ext-IEs.h \ InterRATHandoverInfo-v4b0ext-IEs.h \ InterRATHandoverInfo-v4d0ext-IEs.h \ InterRATHandoverInfo-v590ext-IEs.h \ InterRATHandoverInfo-v690ext1-IEs.h \ InterRATHandoverInfo-v690ext-IEs.h \ InterRATHandoverInfo-v7xyext-IEs.h \ MeasurementControl.h \ MeasurementControl-r3-IEs.h \ MeasurementControl-v390ext.h \ MeasurementControl-v3a0ext.h \ MeasurementControl-r4-IEs.h \ MeasurementControl-v590ext-IEs.h \ MeasurementControl-v5b0ext-IEs.h \ MeasurementControl-r6-IEs.h \ MeasurementControl-v6a0ext-IEs.h \ MeasurementControl-v7xyext-IEs.h \ MeasurementControlFailure.h \ MeasurementControlFailure-v590ext-IEs.h \ MeasurementReport.h \ MeasurementReport-v390ext.h \ MeasurementReport-v4b0ext-IEs.h \ MeasurementReport-v590ext-IEs.h \ MeasurementReport-v5b0ext-IEs.h \ MeasurementReport-v690ext-IEs.h \ MeasurementReport-v7xyext-IEs.h \ PagingType1.h \ PagingType1-v590ext-IEs.h \ PagingType2.h \ PhysicalChannelReconfiguration.h \ PhysicalChannelReconfiguration-r3-IEs.h \ PhysicalChannelReconfiguration-v3a0ext.h \ PhysicalChannelReconfiguration-v4b0ext-IEs.h \ PhysicalChannelReconfiguration-v590ext-IEs.h \ PhysicalChannelReconfiguration-r4-IEs.h \ PhysicalChannelReconfiguration-r5-IEs.h \ PhysicalChannelReconfiguration-r6-IEs.h \ PhysicalChannelReconfiguration-v690ext-IEs.h \ PhysicalChannelReconfiguration-r7-IEs.h \ PhysicalChannelReconfigurationComplete.h \ PhysicalChannelReconfigurationComplete-v7xyext-IEs.h \ PhysicalChannelReconfigurationFailure.h \ PhysicalSharedChannelAllocation.h \ PhysicalSharedChannelAllocation-r3-IEs.h \ PhysicalSharedChannelAllocation-r4-IEs.h \ PhysicalSharedChannelAllocation-v690ext-IEs.h \ PhysicalSharedChannelAllocation-v7xyext-IEs.h \ PUSCHCapacityRequest.h \ PUSCHCapacityRequest-v590ext.h \ RadioBearerReconfiguration.h \ RadioBearerReconfiguration-r3-IEs.h \ RadioBearerReconfiguration-v3a0ext.h \ RadioBearerReconfiguration-v4b0ext-IEs.h \ RadioBearerReconfiguration-v590ext-IEs.h \ RadioBearerReconfiguration-v5d0ext-IEs.h \ RadioBearerReconfiguration-r4-IEs.h \ RadioBearerReconfiguration-r5-IEs.h \ RadioBearerReconfiguration-r6-IEs.h \ RadioBearerReconfiguration-v690ext-IEs.h \ RadioBearerReconfiguration-r7-IEs.h \ RadioBearerReconfigurationComplete.h \ RadioBearerReconfigurationComplete-v7xyext-IEs.h \ RadioBearerReconfigurationFailure.h \ RadioBearerRelease.h \ RadioBearerRelease-r3-IEs.h \ RadioBearerRelease-v3a0ext.h \ RadioBearerRelease-v4b0ext-IEs.h \ RadioBearerRelease-v590ext-IEs.h \ RadioBearerRelease-r4-IEs.h \ RadioBearerRelease-r5-IEs.h \ RadioBearerRelease-v690ext-IEs.h \ RadioBearerRelease-r6-IEs.h \ RadioBearerRelease-r7-IEs.h \ RadioBearerReleaseComplete.h \ RadioBearerReleaseComplete-v7xyext-IEs.h \ RadioBearerReleaseFailure.h \ RadioBearerSetup.h \ RadioBearerSetup-r3-IEs.h \ RadioBearerSetup-v3a0ext.h \ RadioBearerSetup-v4b0ext-IEs.h \ RadioBearerSetup-v590ext-IEs.h \ RadioBearerSetup-v5d0ext-IEs.h \ RadioBearerSetup-r4-IEs.h \ RadioBearerSetup-r5-IEs.h \ RadioBearerSetup-v690ext-IEs.h \ RadioBearerSetup-r6-IEs.h \ RadioBearerSetup-r7-IEs.h \ RadioBearerSetupComplete.h \ RadioBearerSetupComplete-v7xyext-IEs.h \ RadioBearerSetupFailure.h \ RRCConnectionReject.h \ RRCConnectionReject-r3-IEs.h \ RRCConnectionReject-v690ext-IEs.h \ RRCConnectionRelease.h \ RRCConnectionRelease-r3-IEs.h \ RRCConnectionRelease-r4-IEs.h \ RRCConnectionRelease-v690ext-IEs.h \ RRCConnectionRelease-CCCH.h \ RRCConnectionRelease-CCCH-r3-IEs.h \ RRCConnectionRelease-CCCH-r4-IEs.h \ RRCConnectionRelease-CCCH-r5-IEs.h \ RRCConnectionRelease-CCCH-v690ext-IEs.h \ RRCConnectionReleaseComplete.h \ RRCConnectionRequest.h \ RRCConnectionRequest-v3d0ext-IEs.h \ RRCConnectionRequest-v4b0ext-IEs.h \ RRCConnectionRequest-v590ext-IEs.h \ RRCConnectionRequest-v690ext-IEs.h \ RRCConnectionSetup.h \ RRCConnectionSetup-r3-IEs.h \ RRCConnectionSetup-v4b0ext-IEs.h \ RRCConnectionSetup-v590ext-IEs.h \ RRCConnectionSetup-r4-IEs.h \ RRCConnectionSetup-r5-IEs.h \ RRCConnectionSetup-v690ext-IEs.h \ RRCConnectionSetup-r6-IEs.h \ RRCConnectionSetup-r7-IEs.h \ RRCConnectionSetup-v7xyext-IEs.h \ RRCConnectionSetupComplete.h \ RRCConnectionSetupComplete-v370ext.h \ RRCConnectionSetupComplete-v380ext-IEs.h \ RRCConnectionSetupComplete-v3a0ext-IEs.h \ RRCConnectionSetupComplete-v3g0ext-IEs.h \ RRCConnectionSetupComplete-r3-add-ext-IEs.h \ RRCConnectionSetupComplete-v4b0ext-IEs.h \ RRCConnectionSetupComplete-v590ext-IEs.h \ RRCConnectionSetupComplete-v5c0ext-IEs.h \ RRCConnectionSetupComplete-v650ext-IEs.h \ RRCConnectionSetupComplete-v680ext-IEs.h \ RRCConnectionSetupComplete-v690ext-IEs.h \ RRCConnectionSetupComplete-v7xyext-IEs.h \ RRC-FailureInfo.h \ RRC-FailureInfo-r3-IEs.h \ RRCStatus.h \ SecurityModeCommand.h \ SecurityModeCommand-r3-IEs.h \ SecurityModeComplete.h \ SecurityModeFailure.h \ SignallingConnectionRelease.h \ SignallingConnectionRelease-r3-IEs.h \ SignallingConnectionReleaseIndication.h \ SystemInformation-BCH.h \ SystemInformation-FACH.h \ FirstSegment.h \ FirstSegmentShort.h \ SubsequentSegment.h \ LastSegment.h \ LastSegmentShort.h \ CompleteSIB-List.h \ CompleteSIB.h \ CompleteSIBshort.h \ SystemInformationChangeIndication.h \ TransportChannelReconfiguration.h \ TransportChannelReconfiguration-r3-IEs.h \ TransportChannelReconfiguration-v3a0ext.h \ TransportChannelReconfiguration-v4b0ext-IEs.h \ TransportChannelReconfiguration-v590ext-IEs.h \ TransportChannelReconfiguration-r4-IEs.h \ TransportChannelReconfiguration-r5-IEs.h \ TransportChannelReconfiguration-v690ext-IEs.h \ TransportChannelReconfiguration-r6-IEs.h \ TransportChannelReconfiguration-r7-IEs.h \ TransportChannelReconfigurationComplete.h \ TransportChannelReconfigurationComplete-v7xyext-IEs.h \ TransportChannelReconfigurationFailure.h \ TransportFormatCombinationControl.h \ TransportFormatCombinationControlFailure.h \ UECapabilityEnquiry.h \ UECapabilityEnquiry-r3-IEs.h \ UECapabilityEnquiry-v4b0ext-IEs.h \ UECapabilityEnquiry-v590ext-IEs.h \ UECapabilityEnquiry-v7xyext-IEs.h \ UECapabilityInformation.h \ UECapabilityInformation-v370ext.h \ UECapabilityInformation-v380ext-IEs.h \ UECapabilityInformation-v3a0ext-IEs.h \ UECapabilityInformation-r3-add-ext-IEs.h \ UECapabilityInformation-v4b0ext.h \ UECapabilityInformation-v590ext.h \ UECapabilityInformation-v5c0ext.h \ UECapabilityInformation-v650ext-IEs.h \ UECapabilityInformation-v680ext-IEs.h \ UECapabilityInformation-v690ext-IEs.h \ UECapabilityInformation-v7xyext-IEs.h \ UECapabilityInformationConfirm.h \ UECapabilityInformationConfirm-r3-IEs.h \ UplinkDirectTransfer.h \ UplinkDirectTransfer-v690ext-IEs.h \ UplinkPhysicalChannelControl.h \ UplinkPhysicalChannelControl-r3-IEs.h \ UplinkPhysicalChannelControl-v4b0ext-IEs.h \ UplinkPhysicalChannelControl-r4-IEs.h \ UplinkPhysicalChannelControl-r5-IEs.h \ UplinkPhysicalChannelControl-v690ext-IEs.h \ UplinkPhysicalChannelControl-v6a0ext-IEs.h \ UplinkPhysicalChannelControl-r7-IEs.h \ URAUpdate.h \ URAUpdateConfirm.h \ URAUpdateConfirm-r3-IEs.h \ URAUpdateConfirm-r5-IEs.h \ URAUpdateConfirm-v690ext-IEs.h \ URAUpdateConfirm-CCCH.h \ URAUpdateConfirm-CCCH-r3-IEs.h \ UTRANMobilityInformation.h \ UTRANMobilityInformation-r3-IEs.h \ UTRANMobilityInformation-v3a0ext-IEs.h \ UTRANMobilityInformation-r5-IEs.h \ UtranMobilityInformation-v690ext-IEs.h \ UTRANMobilityInformationConfirm.h \ UTRANMobilityInformationFailure.h \ MBMSAccessInformation.h \ MBMSCommonPTMRBInformation.h \ MBMSCurrentCellPTMRBInformation.h \ MBMSGeneralInformation.h \ MBMSGeneralInformation-v7xyext-IEs.h \ MBMSModificationRequest.h \ MBMSModifiedServicesInformation.h \ MBMSNeighbouringCellPTMRBInformation.h \ MBMSSchedulingInformation.h \ MBMSUnmodifiedServicesInformation.h \ Ansi-41-IDNNS.h \ CN-DomainIdentity.h \ CN-DomainInformation.h \ CN-DomainInformationFull.h \ CN-DomainInformationList.h \ CN-DomainInformationListFull.h \ CN-DomainSysInfo.h \ CN-DomainSysInfoList.h \ CN-InformationInfo.h \ CN-InformationInfo-r6.h \ CN-InformationInfoFull.h \ Digit.h \ Gsm-map-IDNNS.h \ IMEI.h \ IMEI-Digit.h \ IMSI-GSM-MAP.h \ IntraDomainNasNodeSelector.h \ LAI.h \ MCC.h \ MNC.h \ MultiplePLMN-List-r6.h \ NAS-Message.h \ NAS-Synchronisation-Indicator.h \ NAS-SystemInformationGSM-MAP.h \ P-TMSI-GSM-MAP.h \ PagingRecordTypeID.h \ PLMN-Identity.h \ PLMN-IdentityWithOptionalMCC-r6.h \ PLMN-Type.h \ RAB-Identity.h \ RAI.h \ RoutingAreaCode.h \ RoutingParameter.h \ TMSI-GSM-MAP.h \ AccessClassBarred.h \ AccessClassBarredList.h \ AllowedIndicator.h \ CellAccessRestriction.h \ CellBarred.h \ CellIdentity.h \ CellIdentity-PerRL-List.h \ CellSelectReselectInfoSIB-3-4.h \ DomainSpecificAccessRestrictionForSharedNetwork-v670ext.h \ DomainSpecificAccessRestrictionList-v670ext.h \ DomainSpecificAccessRestrictionParam-v670ext.h \ DomainSpecificAccessRestriction-v670ext.h \ MapParameter.h \ Mapping.h \ Mapping-LCR-r4.h \ MappingFunctionParameter.h \ MappingFunctionParameterList.h \ MappingFunctionType.h \ MappingInfo.h \ Q-Hyst-S.h \ Q-Hyst-S-Fine.h \ RAT.h \ RAT-FDD-Info.h \ RAT-FDD-InfoList.h \ RAT-Identifier.h \ RAT-TDD-Info.h \ RAT-TDD-InfoList.h \ ReservedIndicator.h \ S-SearchQual.h \ S-SearchRXLEV.h \ SpeedDependentScalingFactor.h \ T-Barred.h \ T-Reselection-S.h \ T-Reselection-S-Fine.h \ TreselectionScalingFactor.h \ UpperLimit.h \ URA-Identity.h \ URA-IdentityList.h \ AccessStratumReleaseIndicator.h \ ActivationTime.h \ BackoffControlParams.h \ C-RNTI.h \ CapabilityUpdateRequirement.h \ CapabilityUpdateRequirement-r4-ext.h \ CapabilityUpdateRequirement-r4.h \ CapabilityUpdateRequirement-r7-ext.h \ CellUpdateCause.h \ CellUpdateCause-ext.h \ ChipRateCapability.h \ ChipRateCapability-r7.h \ CipheringAlgorithm.h \ CipheringModeCommand.h \ CipheringModeInfo.h \ CN-DRX-CycleLengthCoefficient.h \ CN-PagedUE-Identity.h \ CompressedModeMeasCapability.h \ CompressedModeMeasCapability-LCR-r4.h \ CompressedModeMeasCapabFDDList.h \ CompressedModeMeasCapabFDDList2.h \ CompressedModeMeasCapabFDDList-ext.h \ CompressedModeMeasCapabFDD.h \ CompressedModeMeasCapabFDD2.h \ CompressedModeMeasCapabFDD-ext.h \ CompressedModeMeasCapabTDDList.h \ CompressedModeMeasCapabTDD.h \ CompressedModeMeasCapabGSMList.h \ CompressedModeMeasCapabGSM.h \ CompressedModeMeasCapabMC.h \ CPCH-Parameters.h \ DL-CapabilityWithSimultaneousHS-DSCHConfig.h \ DL-DPCCH-BER.h \ DL-PhysChCapabilityFDD.h \ DL-PhysChCapabilityFDD-v380ext.h \ SupportOfDedicatedPilotsForChEstimation.h \ DL-PhysChCapabilityTDD.h \ DL-PhysChCapabilityTDD-LCR-r4.h \ DL-PhysChCapabilityTDD-768.h \ DL-TransChCapability.h \ DRAC-SysInfo.h \ DRAC-SysInfoList.h \ DSCH-RNTI.h \ DelayRestrictionFlag.h \ E-RNTI.h \ ESN-DS-41.h \ EstablishmentCause.h \ FailureCauseWithProtErr.h \ FailureCauseWithProtErrTrId.h \ GroupIdentityWithReleaseInformation.h \ GroupReleaseInformation.h \ GSM-Measurements.h \ H-RNTI.h \ HSDSCH-physical-layer-category.h \ UESpecificBehaviourInformation1idle.h \ UESpecificBehaviourInformation1interRAT.h \ IMSI-and-ESN-DS-41.h \ IMSI-DS-41.h \ InitialPriorityDelayList.h \ InitialUE-Identity.h \ IntegrityCheckInfo.h \ IntegrityProtActivationInfo.h \ IntegrityProtectionAlgorithm.h \ IntegrityProtectionModeCommand.h \ IntegrityProtectionModeInfo.h \ IntegrityProtInitNumber.h \ MaxHcContextSpace.h \ MaxHcContextSpace-r5-ext.h \ MaxROHC-ContextSessions-r4.h \ MaximumAM-EntityNumberRLC-Cap.h \ MaximumBitRate.h \ MaximumRLC-WindowSize.h \ MaxNoDPDCH-BitsTransmitted.h \ MaxNoBits.h \ MaxNoPhysChBitsReceived.h \ MaxNoSCCPCH-RL.h \ MaxNumberOfTF.h \ MaxNumberOfTFC-DL.h \ MaxNumberOfTFC-UL.h \ MaxPhysChPerFrame.h \ MaxPhysChPerFrame-768.h \ MaxPhysChPerSubFrame-r4.h \ MaxPhysChPerTimeslot.h \ MaxPhysChPerTS.h \ MaxPhysChPerTS-768.h \ MaxSimultaneousCCTrCH-Count.h \ MaxSimultaneousTransChsDL.h \ MaxSimultaneousTransChsUL.h \ MaxTransportBlocksDL.h \ MaxTransportBlocksUL.h \ MaxTS-PerFrame.h \ MaxTS-PerSubFrame-r4.h \ MeasurementCapability.h \ MeasurementCapabilityExt.h \ MeasurementCapabilityExt2.h \ MeasurementCapability-r4-ext.h \ MessageAuthenticationCode.h \ MinimumSF-DL.h \ MinimumSF-DL-768.h \ MinimumSF-UL.h \ MultiModeCapability.h \ MultiRAT-Capability.h \ MultiModeRAT-Capability-v590ext.h \ MultiModeRAT-Capability-v680ext.h \ N-300.h \ N-301.h \ N-302.h \ N-304.h \ N-308.h \ N-310.h \ N-312.h \ N-312ext.h \ N-312-r5.h \ N-313.h \ N-315.h \ N-315ext.h \ N-315-r5.h \ N-AccessFails.h \ N-AP-RetransMax.h \ NetworkAssistedGPS-Supported.h \ NF-BO-AllBusy.h \ NF-BO-NoAICH.h \ NF-BO-Mismatch.h \ NS-BO-Busy.h \ NS-IP.h \ P-TMSI-and-RAI-GSM-MAP.h \ PagingCause.h \ PagingRecord.h \ PagingRecord2-r5.h \ PagingRecordList.h \ PagingRecord2List-r5.h \ PDCP-Capability.h \ PDCP-Capability-r4-ext.h \ PDCP-Capability-r5-ext.h \ PDCP-Capability-r5-ext2.h \ PhysicalChannelCapability.h \ PhysicalChannelCapability-r7.h \ PhysicalChannelCapability-LCR-r4.h \ PhysicalChannelCapability-hspdsch-r5.h \ PNBSCH-Allocation-r4.h \ ProtocolErrorCause.h \ ProtocolErrorIndicator.h \ ProtocolErrorIndicatorWithMoreInfo.h \ ProtocolErrorMoreInformation.h \ RadioFrequencyBandFDD.h \ RadioFrequencyBandFDD2.h \ RadioFrequencyBandTDDList.h \ RadioFrequencyBandTDD.h \ RadioFrequencyBandGSM.h \ Rb-timer-indicator.h \ Re-EstablishmentTimer.h \ RedirectionInfo.h \ RedirectionInfo-r6.h \ RejectionCause.h \ ReleaseCause.h \ RF-Capability.h \ RF-Capability-r4-ext.h \ RF-Capability-r7.h \ RLC-Capability.h \ RLC-Capability-r5-ext.h \ RRC-ConnectionReleaseInformation.h \ RRC-MessageSequenceNumber.h \ RRC-MessageSequenceNumberList.h \ RRC-StateIndicator.h \ RRC-TransactionIdentifier.h \ S-RNTI.h \ S-RNTI-2.h \ SecurityCapability.h \ Serving-HSDSCH-CellInformation.h \ SimultaneousSCCPCH-DPCH-Reception.h \ SRNC-Identity.h \ START-Value.h \ STARTList.h \ STARTSingle.h \ CapabilityUpdateRequirement-r5.h \ SystemSpecificCapUpdateReq.h \ SystemSpecificCapUpdateReq-v590ext.h \ SystemSpecificCapUpdateReq-r5.h \ SystemSpecificCapUpdateReqList.h \ SystemSpecificCapUpdateReqList-r5.h \ T-300.h \ T-301.h \ T-302.h \ T-304.h \ T-305.h \ T-307.h \ T-308.h \ T-309.h \ T-310.h \ T-311.h \ T-312.h \ T-313.h \ T-314.h \ T-315.h \ T-316.h \ T-317.h \ T-318.h \ T-CPCH.h \ TMSI-and-LAI-GSM-MAP.h \ TMSI-DS-41.h \ TotalRLC-AM-BufferSize.h \ TotalRLC-AM-BufferSize-r5-ext.h \ TransmissionProbability.h \ TransportChannelCapability.h \ TurboSupport.h \ TxRxFrequencySeparation.h \ U-RNTI.h \ U-RNTI-Group.h \ U-RNTI-Short.h \ UE-CapabilityContainer-IEs.h \ UE-ConnTimersAndConstants.h \ UE-ConnTimersAndConstants-v3a0ext.h \ UE-ConnTimersAndConstants-r5.h \ UE-IdleTimersAndConstants.h \ UE-IdleTimersAndConstants-v3a0ext.h \ UE-MultiModeRAT-Capability.h \ UE-PowerClass.h \ UE-PowerClassExt.h \ UE-RadioAccessCapability.h \ UE-RadioAccessCapabilityInfo.h \ UE-RadioAccessCapability-v370ext.h \ UE-RadioAccessCapability-v380ext.h \ UE-RadioAccessCapability-v3a0ext.h \ UE-RadioAccessCapability-v3g0ext.h \ UE-RadioAccessCapability-v650ext.h \ UE-RadioAccessCapability-v690ext.h \ UE-RadioAccessCapability-v7xyext.h \ UE-RadioAccessCapabBandFDDList2.h \ UE-RadioAccessCapabBandFDD2.h \ UE-PositioningCapabilityExt-v380.h \ UE-PositioningCapabilityExt-v3a0.h \ UE-PositioningCapabilityExt-v3g0.h \ UE-RadioAccessCapabBandFDDList.h \ UE-RadioAccessCapabBandFDDList-ext.h \ UE-RadioAccessCapabBandFDD.h \ UE-RadioAccessCapabBandFDD-ext.h \ UE-RadioAccessCapability-v4b0ext.h \ UE-RadioAccessCapabilityComp.h \ UE-RadioAccessCapabilityComp-ext.h \ UE-RadioAccessCapabilityComp-r7.h \ UE-RadioAccessCapabilityComp2.h \ RF-CapabilityComp.h \ RF-CapabilityComp-r7.h \ RF-CapabBandFDDComp.h \ RF-CapabBandListFDDComp.h \ RF-CapabBandListFDDComp-ext.h \ UE-RadioAccessCapability-v590ext.h \ UE-RadioAccessCapability-v5c0ext.h \ UE-RadioAccessCapability-v680ext.h \ UL-PhysChCapabilityFDD.h \ UL-PhysChCapabilityFDD-r6.h \ UL-PhysChCapabilityTDD.h \ UL-PhysChCapabilityTDD-LCR-r4.h \ PhysicalChannelCapability-edch-r6.h \ UL-TransChCapability.h \ UE-Positioning-Capability.h \ UE-SecurityInformation.h \ UE-SecurityInformation2.h \ URA-UpdateCause.h \ UTRAN-DRX-CycleLengthCoefficient.h \ WaitTime.h \ AlgorithmSpecificInfo.h \ AlgorithmSpecificInfo-r4.h \ CID-InclusionInfo-r4.h \ COUNT-C.h \ COUNT-C-MSB.h \ DefaultConfigIdentity.h \ DefaultConfigIdentity-r4.h \ DefaultConfigIdentity-r5.h \ DefaultConfigIdentity-r6.h \ DefaultConfigMode.h \ DDI.h \ DL-AM-RLC-Mode.h \ DL-AM-RLC-Mode-r5.h \ DL-CounterSynchronisationInfo.h \ DL-CounterSynchronisationInfo-r5.h \ DL-LogicalChannelMapping.h \ DL-LogicalChannelMapping-r5.h \ DL-LogicalChannelMappingList.h \ DL-LogicalChannelMappingList-r5.h \ DL-Reception-Window-Size-r6.h \ DL-RFC3095-r4.h \ DL-RLC-Mode.h \ DL-RLC-Mode-r5.h \ DL-RLC-Mode-r6.h \ DL-RLC-StatusInfo.h \ DL-TM-RLC-Mode.h \ DL-TransportChannelType.h \ DL-TransportChannelType-r5.h \ DL-UM-RLC-LI-size.h \ DL-UM-RLC-Mode-r5.h \ DL-UM-RLC-Mode-r6.h \ ExpectReordering.h \ ExplicitDiscard.h \ HeaderCompressionInfo.h \ HeaderCompressionInfoList.h \ HeaderCompressionInfo-r4.h \ HeaderCompressionInfoList-r4.h \ LogicalChannelIdentity.h \ LosslessSRNS-RelocSupport.h \ MAC-d-HFN-initial-value.h \ MAC-LogicalChannelPriority.h \ MaxDAT.h \ MaxDAT-Retransmissions.h \ MaxMRW.h \ MaxPDCP-SN-WindowSize.h \ MaxRST.h \ NoExplicitDiscard.h \ PDCP-Info.h \ PDCP-Info-r4.h \ PDCP-InfoReconfig.h \ PDCP-InfoReconfig-r4.h \ PDCP-PDU-Header.h \ PDCP-ROHC-TargetMode.h \ PDCP-SN-Info.h \ Poll-PDU.h \ Poll-SDU.h \ PollingInfo.h \ PollWindow.h \ PredefinedConfigIdentity.h \ PredefinedConfigValueTag.h \ PredefinedRB-Configuration.h \ PreDefRadioConfiguration.h \ PredefinedConfigStatusList.h \ PredefinedConfigStatusInfo.h \ PredefinedConfigStatusListComp.h \ PredefinedConfigSetsWithDifferentValueTag.h \ PredefinedConfigSetWithDifferentValueTag.h \ PredefinedConfigValueTagList.h \ PredefinedConfigStatusListVarSz.h \ RAB-Info.h \ RAB-Info-r6-ext.h \ RAB-Info-r6.h \ RAB-InformationList.h \ RAB-InformationList-r6.h \ RAB-InformationReconfigList.h \ RAB-InformationReconfig.h \ RAB-Info-Post.h \ RAB-InformationSetup.h \ RAB-InformationSetup-r4.h \ RAB-InformationSetup-r5.h \ RAB-InformationSetup-r6-ext.h \ RAB-InformationSetup-r6.h \ RAB-InformationSetupList.h \ RAB-InformationSetupList-r4.h \ RAB-InformationSetupList-r5.h \ RAB-InformationSetupList-r6.h \ RAB-InformationSetupList-r6-ext.h \ RB-ActivationTimeInfo.h \ RB-ActivationTimeInfoList.h \ RB-COUNT-C-Information.h \ RB-COUNT-C-InformationList.h \ RB-COUNT-C-MSB-Information.h \ RB-COUNT-C-MSB-InformationList.h \ RB-Identity.h \ RB-IdentityList.h \ RB-InformationAffected.h \ RB-InformationAffected-r5.h \ RB-InformationAffected-r6.h \ RB-InformationAffectedList.h \ RB-InformationAffectedList-r5.h \ RB-InformationAffectedList-r6.h \ RB-InformationChanged-r6.h \ RB-InformationChangedList-r6.h \ RB-InformationReconfig.h \ RB-InformationReconfig-r4.h \ RB-InformationReconfig-r5.h \ RB-InformationReconfig-r6.h \ RB-InformationReconfigList.h \ RB-InformationReconfigList-r4.h \ RB-InformationReconfigList-r5.h \ RB-InformationReconfigList-r6.h \ RB-InformationReleaseList.h \ RB-InformationSetup.h \ RB-InformationSetup-r4.h \ RB-InformationSetup-r5.h \ RB-InformationSetup-r6.h \ RB-InformationSetupList.h \ RB-InformationSetupList-r4.h \ RB-InformationSetupList-r5.h \ RB-InformationSetupList-r6.h \ RB-MappingInfo.h \ RB-MappingInfo-r5.h \ RB-MappingInfo-r6.h \ RB-MappingOption.h \ RB-MappingOption-r5.h \ RB-MappingOption-r6.h \ RB-PDCPContextRelocation.h \ RB-PDCPContextRelocationList.h \ RB-StopContinue.h \ RB-WithPDCP-Info.h \ RB-WithPDCP-InfoList.h \ ReceivingWindowSize.h \ RFC2507-Info.h \ RFC3095-Info-r4.h \ RLC-Info.h \ RLC-Info-r5.h \ RLC-Info-r6.h \ RLC-Info-MCCH-r6.h \ RLC-Info-MSCH-r6.h \ RLC-Info-MTCH-r6.h \ RLC-InfoChoice.h \ RLC-InfoChoice-r5.h \ RLC-InfoChoice-r6.h \ RLC-PDU-Size.h \ RLC-PDU-SizeList.h \ RLC-SequenceNumber.h \ RLC-SizeInfo.h \ RLC-SizeExplicitList.h \ ROHC-Profile-r4.h \ ROHC-ProfileList-r4.h \ ROHC-PacketSize-r4.h \ ROHC-PacketSizeList-r4.h \ SRB-InformationSetup.h \ SRB-InformationSetup-r5.h \ SRB-InformationSetup-r6.h \ SRB-InformationSetupList.h \ SRB-InformationSetupList-r5.h \ SRB-InformationSetupList-r6.h \ SRB-InformationSetupList2.h \ SRB-InformationSetupList2-r6.h \ TimerDAR-r6.h \ TimerDiscard.h \ TimerEPC.h \ TimerMRW.h \ TimerOSD-r6.h \ TimerPoll.h \ TimerPollPeriodic.h \ TimerPollProhibit.h \ TimerRST.h \ TimerStatusPeriodic.h \ TimerStatusProhibit.h \ TransmissionRLC-Discard.h \ TransmissionWindowSize.h \ UL-AM-RLC-Mode.h \ UL-CounterSynchronisationInfo.h \ UL-LogicalChannelMapping.h \ UL-LogicalChannelMapping-r6.h \ UL-LogicalChannelMappingList.h \ UL-LogicalChannelMappingList-r6.h \ UL-LogicalChannelMappings.h \ UL-LogicalChannelMappings-r6.h \ UL-RFC3095-r4.h \ UL-RLC-Mode.h \ UL-TM-RLC-Mode.h \ UL-UM-RLC-Mode.h \ UL-TransportChannelType.h \ UM-RLC-DuplAvoid-Reord-Info-r6.h \ UM-RLC-OutOSeqDelivery-Info-r6.h \ WindowSizeDAR-r6.h \ WindowSizeOSD-r6.h \ AddOrReconfMAC-dFlow.h \ AllowedTFC-List.h \ AllowedTFI-List.h \ BitModeRLC-SizeInfo.h \ BLER-QualityValue.h \ ChannelCodingType.h \ CodingRate.h \ CommonDynamicTF-Info.h \ CommonDynamicTF-Info-DynamicTTI.h \ CommonDynamicTF-InfoList.h \ CommonDynamicTF-InfoList-DynamicTTI.h \ CommonTransChTFS.h \ CommonTransChTFS-LCR.h \ CPCH-SetID.h \ CRC-Size.h \ DedicatedDynamicTF-Info.h \ DedicatedDynamicTF-Info-DynamicTTI.h \ DedicatedDynamicTF-InfoList.h \ DedicatedDynamicTF-InfoList-DynamicTTI.h \ DedicatedTransChTFS.h \ DL-AddReconfTransChInfo2List.h \ DL-AddReconfTransChInfoList.h \ DL-AddReconfTransChInfoList-r4.h \ DL-AddReconfTransChInfoList-r5.h \ DL-AddReconfTransChInformation.h \ DL-AddReconfTransChInformation-r4.h \ DL-AddReconfTransChInformation-r5.h \ DL-AddReconfTransChInformation2.h \ DL-CommonTransChInfo.h \ DL-CommonTransChInfo-r4.h \ DL-DeletedTransChInfoList.h \ DL-DeletedTransChInfoList-r5.h \ DL-TransportChannelIdentity.h \ DL-TransportChannelIdentity-r5.h \ DL-TrCH-Type.h \ DL-TrCH-TypeId1-r5.h \ DL-TrCH-TypeId2-r5.h \ DRAC-ClassIdentity.h \ DRAC-StaticInformation.h \ DRAC-StaticInformationList.h \ E-DCH-AddReconf-MAC-d-Flow.h \ E-DCH-AddReconf-MAC-d-FlowList.h \ E-DCH-MAC-d-FlowIdentity.h \ E-DCH-MAC-d-FlowMaxRetrans.h \ E-DCH-MAC-d-FlowMultiplexingList.h \ E-DCH-MAC-d-FlowPowerOffset.h \ E-DCH-TTI.h \ ExplicitTFCS-Configuration.h \ GainFactor.h \ GainFactorInformation.h \ HSDSCH-Info.h \ HARQ-Info.h \ HARQMemorySize.h \ IndividualDL-CCTrCH-Info.h \ IndividualDL-CCTrCH-InfoList.h \ IndividualUL-CCTrCH-Info.h \ IndividualUL-CCTrCH-InfoList.h \ LogicalChannelByRB.h \ LogicalChannelList.h \ MAC-d-FlowIdentityDCHandHSDSCH.h \ MAC-d-FlowIdentity.h \ MAC-d-PDU-SizeInfo-List.h \ MAC-d-PDUsizeInfo.h \ MAC-hs-AddReconfQueue-List.h \ MAC-hs-AddReconfQueue.h \ MAC-hs-DelQueue-List.h \ MAC-hs-DelQueue.h \ MAC-hs-WindowSize.h \ NumberOfTbSizeAndTTIList.h \ MessType.h \ Non-allowedTFC-List.h \ NumberOfTransportBlocks.h \ OctetModeRLC-SizeInfoType1.h \ OctetModeRLC-SizeInfoType2.h \ PowerOffsetInfoShort.h \ PowerOffsetInformation.h \ PowerOffsetPp-m.h \ PreDefTransChConfiguration.h \ QualityTarget.h \ RateMatchingAttribute.h \ ReferenceTFC-ID.h \ RestrictedTrChInfo.h \ RestrictedTrChInfoList.h \ SemistaticTF-Information.h \ SignalledGainFactors.h \ SplitTFCI-Signalling.h \ SplitType.h \ T1-ReleaseTimer.h \ TFC-Subset.h \ TFC-SubsetList.h \ TFC-Value.h \ TFCI-Field2-Information.h \ TFCI-Range.h \ TFCI-RangeList.h \ TFCS.h \ TFCS-Identity.h \ TFCS-IdentityPlain.h \ TFCS-InfoForDSCH.h \ TFCS-ReconfAdd.h \ TFCS-Removal.h \ TFCS-RemovalList.h \ TimeDurationBeforeRetry.h \ TM-SignallingInfo.h \ TransmissionTimeInterval.h \ TransmissionTimeValidity.h \ TransportChannelIdentity.h \ TransportChannelIdentityDCHandDSCH.h \ TransportFormatSet.h \ TransportFormatSet-LCR.h \ UL-AddReconfTransChInfoList.h \ UL-AddReconfTransChInfoList-r6.h \ UL-AddReconfTransChInformation.h \ UL-AddReconfTransChInformation-r6.h \ UL-CommonTransChInfo.h \ UL-CommonTransChInfo-r4.h \ UL-ControlledTrChList.h \ UL-DeletedTransChInfoList.h \ UL-DeletedTransChInfoList-r6.h \ UL-TransportChannelIdentity.h \ UL-TransportChannelIdentity-r6.h \ UL-TrCH-Type.h \ USCH-TransportChannelsInfo.h \ ACK-NACK-repetitionFactor.h \ AC-To-ASC-Mapping.h \ AC-To-ASC-MappingTable.h \ AccessServiceClass-FDD.h \ AccessServiceClass-TDD.h \ AccessServiceClass-TDD-r7.h \ AccessServiceClass-TDD-LCR-r4.h \ AdditionalPRACH-TF-and-TFCS-CCCH-IEs.h \ AdditionalPRACH-TF-and-TFCS-CCCH.h \ AdditionalPRACH-TF-and-TFCS-CCCH-List.h \ AICH-Info.h \ AICH-PowerOffset.h \ AICH-TransmissionTiming.h \ AllocationPeriodInfo.h \ Alpha.h \ AP-AICH-ChannelisationCode.h \ AP-PreambleScramblingCode.h \ AP-Signature.h \ AP-Signature-VCAM.h \ AP-Subchannel.h \ ASCSetting-FDD.h \ ASCSetting-TDD.h \ ASCSetting-TDD-r7.h \ ASCSetting-TDD-LCR-r4.h \ AvailableAP-Signature-VCAMList.h \ AvailableAP-SignatureList.h \ AvailableAP-SubchannelList.h \ AvailableMinimumSF-ListVCAM.h \ AvailableMinimumSF-VCAM.h \ AvailableSignatures.h \ AvailableSubChannelNumbers.h \ BEACON-PL-Est.h \ BurstType.h \ Bler-Target.h \ CCTrCH-PowerControlInfo.h \ CCTrCH-PowerControlInfo-r4.h \ CCTrCH-PowerControlInfo-r5.h \ CCTrCH-PowerControlInfo-r7.h \ CD-AccessSlotSubchannel.h \ CD-AccessSlotSubchannelList.h \ CD-CA-ICH-ChannelisationCode.h \ CD-PreambleScramblingCode.h \ CD-SignatureCode.h \ CD-SignatureCodeList.h \ CellAndChannelIdentity.h \ CellParametersID.h \ Cfntargetsfnframeoffset.h \ ChannelAssignmentActive.h \ ChannelisationCode256.h \ ChannelReqParamsForUCSM.h \ ClosedLoopTimingAdjMode.h \ CodeNumberDSCH.h \ CodeRange.h \ CodeWordSet.h \ CommonTimeslotInfo.h \ CommonTimeslotInfoSCCPCH.h \ ConstantValue.h \ ConstantValueTdd.h \ CPCH-PersistenceLevels.h \ CPCH-PersistenceLevelsList.h \ CPCH-SetInfo.h \ CPCH-SetInfoList.h \ CPCH-StatusIndicationMode.h \ CQI-RepetitionFactor.h \ CSICH-PowerOffset.h \ DefaultDPCH-OffsetValueFDD.h \ DefaultDPCH-OffsetValueTDD.h \ DeltaPp-m.h \ DeltaCQI.h \ DeltaNACK.h \ DeltaACK.h \ DeltaSIR.h \ DHS-Sync.h \ DL-CCTrCh.h \ DL-CCTrCh-r4.h \ DL-CCTrCh-r7.h \ DL-CCTrChList.h \ DL-CCTrChList-r7.h \ DL-CCTrChList-r4.h \ DL-CCTrChListToRemove.h \ DL-CCTrChTPCList.h \ DL-ChannelisationCode.h \ DL-ChannelisationCodeList.h \ DL-CommonInformation.h \ DL-CommonInformation-r4.h \ DL-CommonInformation-r5.h \ DL-CommonInformation-r6.h \ DL-CommonInformation-r7.h \ DL-CommonInformationPost.h \ DL-CommonInformationPredef.h \ DL-CompressedModeMethod.h \ DL-DPCH-InfoCommon.h \ DL-DPCH-InfoCommon-r4.h \ DL-DPCH-InfoCommon-r6.h \ DL-DPCH-InfoCommonPost.h \ DL-DPCH-InfoCommonPredef.h \ DL-DPCH-InfoPerRL.h \ DL-DPCH-InfoPerRL-r4.h \ DL-DPCH-InfoPerRL-r5.h \ DL-DPCH-InfoPerRL-r6.h \ DL-DPCH-InfoPerRL-r7.h \ DL-FDPCH-InfoPerRL-r6.h \ DL-DPCH-InfoPerRL-PostFDD.h \ DL-DPCH-InfoPerRL-PostTDD.h \ DL-DPCH-InfoPerRL-PostTDD-LCR-r4.h \ DL-DPCH-PowerControlInfo.h \ DL-FDPCH-InfoCommon-r6.h \ DL-FrameType.h \ DL-HSPDSCH-Information.h \ DL-HSPDSCH-Information-r6.h \ DL-HSPDSCH-Information-r7.h \ DL-HSPDSCH-TS-Configuration.h \ DL-HSPDSCH-TS-Configuration-VHCR.h \ DL-InformationPerRL.h \ DL-InformationPerRL-r4.h \ DL-InformationPerRL-r5.h \ DL-InformationPerRL-r5bis.h \ DL-InformationPerRL-r6.h \ DL-InformationPerRL-r7.h \ DL-InformationPerRL-List.h \ DL-InformationPerRL-List-r4.h \ DL-InformationPerRL-List-r5.h \ DL-InformationPerRL-List-r6.h \ DL-InformationPerRL-List-r5bis.h \ DL-InformationPerRL-List-r7.h \ DL-InformationPerRL-ListPostFDD.h \ DL-InformationPerRL-PostFDD.h \ DL-InformationPerRL-PostTDD.h \ DL-InformationPerRL-PostTDD-LCR-r4.h \ DL-PDSCH-Information.h \ Dl-rate-matching-restriction.h \ DL-TPC-PowerOffsetPerRL.h \ DL-TPC-PowerOffsetPerRL-List.h \ DL-TS-ChannelisationCode.h \ DL-TS-ChannelisationCode-VHCR.h \ DL-TS-ChannelisationCodesShort.h \ DL-TS-ChannelisationCodesShort-VHCR.h \ DownlinkAdditionalTimeslots.h \ DownlinkAdditionalTimeslots-VHCR.h \ DownlinkAdditionalTimeslots-LCR-r4.h \ DownlinkTimeslotsCodes.h \ DownlinkTimeslotsCodes-VHCR.h \ DownlinkTimeslotsCodes-LCR-r4.h \ DPC-Mode.h \ DPCCH-PowerOffset.h \ DPCCH-PowerOffset2.h \ DPCH-CompressedModeInfo.h \ DPCH-CompressedModeStatusInfo.h \ DPCH-FrameOffset.h \ DSCH-Mapping.h \ DSCH-MappingList.h \ DSCH-RadioLinkIdentifier.h \ DSCH-TransportChannelsInfo.h \ DurationTimeInfo.h \ DynamicPersistenceLevel.h \ DynamicPersistenceLevelList.h \ DynamicPersistenceLevelTF-List.h \ DynamicTFInformationCCCH.h \ E-AGCH-ChannelisationCode.h \ E-AGCH-Information.h \ E-DCH-MinimumSet-E-TFCI.h \ E-DCH-ReconfigurationInfo.h \ E-DCH-RL-InfoNewServingCell.h \ E-DCH-RL-InfoOtherCell.h \ E-DPCCH-Info.h \ E-DPCCH-DPCCH-PowerOffset.h \ E-DPDCH-Info.h \ E-DPDCH-PeriodicyOfSchedInfo.h \ E-DPDCH-PL-NonMax.h \ E-DPDCH-Reference-E-TFCI.h \ E-DPDCH-Reference-E-TFCIList.h \ E-DPDCH-SchedulingInfoConfiguration.h \ E-DPDCH-SchedulingTransmConfiguration.h \ E-DPDCH-MaxChannelisationCodes.h \ E-HICH-ChannelisationCode.h \ E-HICH-Information.h \ E-HICH-RGCH-SignatureSequence.h \ E-RGCH-CombinationIndex.h \ E-RGCH-Information.h \ E-TFCI-TableIndex.h \ EXT-UL-TimingAdvance.h \ FACH-PCH-Information.h \ FACH-PCH-InformationList.h \ Feedback-cycle.h \ FPACH-Info-r4.h \ FrequencyInfo.h \ FrequencyInfoFDD.h \ FrequencyInfoTDD.h \ HappyBit-DelayCondition.h \ HARQ-Preamble-Mode.h \ HS-ChannelisationCode-LCR.h \ HS-PDSCH-Midamble-Configuration-TDD128.h \ HS-SCCH-Info.h \ HS-SCCH-Info-r6.h \ HS-SCCH-Info-r7.h \ HS-SCCH-Codes.h \ HS-SCCH-TDD128.h \ HS-SICH-Configuration-TDD128.h \ HS-SCCH-TDD384.h \ HS-SCCH-TDD384-r6.h \ HS-SCCH-TDD768.h \ HS-SICH-Configuration-TDD384.h \ HS-SICH-Configuration-TDD768.h \ HS-SICH-Power-Control-Info-TDD384.h \ HS-SICH-Power-Control-Info-TDD768.h \ IndividualTimeslotInfo.h \ IndividualTimeslotInfo-VHCR.h \ IndividualTimeslotInfo-LCR-r4.h \ IndividualTimeslotInfo-LCR-r4-ext.h \ IndividualTS-Interference.h \ IndividualTS-InterferenceList.h \ ITP.h \ NidentifyAbort.h \ MaxAllowedUL-TX-Power.h \ MaxAvailablePCPCH-Number.h \ MaxPowerIncrease-r4.h \ MaxTFCI-Field2Value.h \ Measurement-Feedback-Info.h \ MidambleConfigurationBurstType1and3.h \ MidambleConfigurationBurstType2.h \ MidambleConfigurationBurstType2-VHCR.h \ MidambleShiftAndBurstType.h \ MidambleShiftAndBurstType-VHCR.h \ MidambleShiftAndBurstType-DL.h \ MidambleShiftAndBurstType-DL-VHCR.h \ MidambleShiftAndBurstType-LCR-r4.h \ MidambleShiftLong.h \ MidambleShiftShort.h \ MidambleShiftShort-VHCR.h \ MinimumSpreadingFactor.h \ MultiCodeInfo.h \ N-EOT.h \ N-GAP.h \ N-PCH.h \ N-StartMessage.h \ NB01.h \ NF-Max.h \ NumberOfDPDCH.h \ NumberOfFBI-Bits.h \ OpenLoopPowerControl-TDD.h \ OpenLoopPowerControl-IPDL-TDD-r4.h \ PagingIndicatorLength.h \ PC-Preamble.h \ PCP-Length.h \ PCPCH-ChannelInfo.h \ PCPCH-ChannelInfoList.h \ PCPICH-UsageForChannelEst.h \ PDSCH-CapacityAllocationInfo.h \ PDSCH-CapacityAllocationInfo-r4.h \ PDSCH-CapacityAllocationInfo-r7.h \ PDSCH-CodeInfo.h \ PDSCH-CodeInfoList.h \ PDSCH-CodeMap.h \ PDSCH-CodeMapList.h \ PDSCH-CodeMapping.h \ PDSCH-Identity.h \ PDSCH-Info.h \ PDSCH-Info-r4.h \ PDSCH-Info-r7.h \ PDSCH-Info-LCR-r4.h \ PDSCH-PowerControlInfo.h \ PDSCH-SHO-DCH-Info.h \ PDSCH-SysInfo.h \ PDSCH-SysInfo-r7.h \ PDSCH-SysInfo-HCR-r5.h \ PDSCH-SysInfo-LCR-r4.h \ PDSCH-SysInfoList.h \ PDSCH-SysInfoList-r7.h \ PDSCH-SysInfoList-HCR-r5.h \ PDSCH-SysInfoList-LCR-r4.h \ PDSCH-SysInfoList-SFN.h \ PDSCH-SysInfoList-SFN-HCR-r5.h \ PDSCH-SysInfoList-SFN-LCR-r4.h \ PersistenceScalingFactor.h \ PersistenceScalingFactorList.h \ PI-CountPerFrame.h \ PichChannelisationCodeList-LCR-r4.h \ PICH-Info.h \ PICH-Info-r7.h \ PICH-Info-LCR-r4.h \ PICH-PowerOffset.h \ PilotBits128.h \ PilotBits256.h \ MeasurementPowerOffset.h \ PLCCH-Info.h \ PositionFixedOrFlexible.h \ PowerControlAlgorithm.h \ PowerOffsetPilot-pdpdch.h \ PowerOffsetTPC-pdpdch.h \ PowerRampStep.h \ PRACH-ChanCodes-LCR-r4.h \ PRACH-Definition-LCR-r4.h \ PRACH-Midamble.h \ PRACH-Partitioning.h \ PRACH-Partitioning-r7.h \ PRACH-Partitioning-LCR-r4.h \ PRACH-PowerOffset.h \ PRACH-RACH-Info.h \ PRACH-RACH-Info-r7.h \ PRACH-RACH-Info-LCR-r4.h \ PRACH-SystemInformation.h \ PRACH-SystemInformation-r7.h \ PRACH-SystemInformation-LCR-r4.h \ PRACH-SystemInformationList.h \ PRACH-SystemInformationList-r7.h \ PRACH-SystemInformationList-LCR-r4.h \ PreambleRetransMax.h \ PreambleScramblingCodeWordNumber.h \ PreDefPhyChConfiguration.h \ PrimaryCCPCH-Info.h \ PrimaryCCPCH-Info-r4.h \ PrimaryCCPCH-Info-r7.h \ PrimaryCCPCH-Info-LCR-r4.h \ PrimaryCCPCH-Info-LCR-r4-ext.h \ PrimaryCCPCH-InfoPost.h \ PrimaryCCPCH-InfoPostTDD-LCR-r4.h \ PrimaryCCPCH-TX-Power.h \ PrimaryCPICH-Info.h \ PrimaryCPICH-TX-Power.h \ PrimaryScramblingCode.h \ PuncturingLimit.h \ PUSCH-CapacityAllocationInfo.h \ PUSCH-CapacityAllocationInfo-r4.h \ PUSCH-CapacityAllocationInfo-r7.h \ PUSCH-Identity.h \ PUSCH-Info.h \ PUSCH-Info-r4.h \ PUSCH-Info-VHCR.h \ PUSCH-Info-LCR-r4.h \ PUSCH-PowerControlInfo-r4.h \ PUSCH-PowerControlInfo-r7.h \ PUSCH-SysInfo.h \ PUSCH-SysInfo-VHCR.h \ PUSCH-SysInfo-HCR-r5.h \ PUSCH-SysInfo-LCR-r4.h \ PUSCH-SysInfoList.h \ PUSCH-SysInfoList-HCR-r5.h \ PUSCH-SysInfoList-LCR-r4.h \ PUSCH-SysInfoList-SFN.h \ PUSCH-SysInfoList-SFN-HCR-r5.h \ PUSCH-SysInfoList-SFN-LCR-r4.h \ PUSCH-SysInfoList-SFN-VHCR.h \ RACH-TransmissionParameters.h \ ReducedScramblingCodeNumber.h \ RepetitionPeriodAndLength.h \ RepetitionPeriodLengthAndOffset.h \ ReplacedPDSCH-CodeInfo.h \ ReplacedPDSCH-CodeInfoList.h \ RepPerLengthOffset-PICH.h \ RepPerLengthOffset-MICH.h \ RestrictedTrCH.h \ RestrictedTrCH-InfoList.h \ RL-AdditionInformation.h \ RL-AdditionInformation-r6.h \ RL-AdditionInformationList.h \ RL-AdditionInformationList-r6.h \ RL-IdentifierList.h \ RL-RemovalInformationList.h \ RPP.h \ S-Field.h \ SCCPCH-ChannelisationCode.h \ SCCPCH-ChannelisationCode-VHCR.h \ SCCPCH-ChannelisationCodeList.h \ SCCPCH-ChannelisationCodeList-VHCR.h \ SCCPCH-InfoForFACH.h \ SCCPCH-InfoForFACH-r4.h \ SCCPCH-SystemInformation.h \ SCCPCH-SystemInformation-LCR-r4-ext.h \ SCCPCH-SystemInformation-r7.h \ SCCPCH-SystemInformationList.h \ SCCPCH-SystemInformationList-r7.h \ SCCPCH-SystemInformationList-LCR-r4-ext.h \ SCCPCH-SystemInformation-MBMS-r6.h \ SCCPCH-SystemInformation-MBMS-r7.h \ ScramblingCodeChange.h \ ScramblingCodeType.h \ SecondaryCCPCH-Info.h \ SecondaryCCPCH-Info-r4.h \ SecondaryCCPCH-Info-r7.h \ SecondaryCCPCH-Info-LCR-r4-ext.h \ SecondaryCCPCHInfo-MBMS-r6.h \ SecondaryCCPCHInfo-MBMS-r7.h \ SecondaryCPICH-Info.h \ SecondaryScramblingCode.h \ SecondInterleavingMode.h \ SF256-AndCodeNumber.h \ SF512-AndCodeNumber.h \ SF512-AndPilot.h \ SF-PDSCH.h \ SF-PRACH.h \ SFN-TimeInfo.h \ SpecialBurstScheduling.h \ SpreadingFactor.h \ SRB-delay.h \ SSDT-CellIdentity.h \ SSDT-Information.h \ SSDT-Information-r4.h \ SSDT-UL.h \ SynchronisationParameters-r4.h \ SYNC-UL-Procedure-r4.h \ SYNC-UL-Info-r4.h \ TDD-FPACH-CCode16-r4.h \ TDD-UL-Interference.h \ TDD-PICH-CCode.h \ TDD768-PICH-CCode.h \ TDD-PRACH-CCode8.h \ TDD-PRACH-CCode16.h \ TDD-PRACH-CCode-LCR-r4.h \ TDD-PRACH-CCodeList.h \ TDD768-PRACH-CCode8.h \ TDD768-PRACH-CCode16.h \ TDD768-PRACH-CCode32.h \ TDD768-PRACH-CCodeList.h \ TFC-ControlDuration.h \ TFCI-Coding.h \ TGCFN.h \ TGD.h \ TGL.h \ TGMP.h \ TGP-Sequence.h \ TGPS-Reconfiguration-CFN.h \ TGP-SequenceList.h \ TGP-SequenceShort.h \ TGPL.h \ TGPRC.h \ TGPS-ConfigurationParams.h \ TGPSI.h \ TGSN.h \ TimeInfo.h \ TimeslotList.h \ TimeslotList-r4.h \ TimeslotNumber.h \ TimeslotNumber-LCR-r4.h \ TimeslotNumber-PRACH-LCR-r4.h \ TimeslotSync2.h \ TimingOffset.h \ TimingMaintainedSynchInd.h \ TPC-CombinationIndex.h \ TPC-CommandTargetRate.h \ TPC-StepSizeFDD.h \ TPC-StepSizeTDD.h \ TreconfirmAbort.h \ TX-DiversityMode.h \ UARFCN.h \ UCSM-Info.h \ UL-CCTrCH.h \ UL-CCTrCH-r4.h \ UL-CCTrCH-r7.h \ UL-CCTrCHList.h \ UL-CCTrCHList-r4.h \ UL-CCTrCHList-r7.h \ UL-CCTrCHListToRemove.h \ UL-CCTrChTPCList.h \ UL-ChannelRequirement.h \ UL-ChannelRequirement-r4.h \ UL-ChannelRequirement-r5.h \ UL-ChannelRequirementWithCPCH-SetID.h \ UL-ChannelRequirementWithCPCH-SetID-r4.h \ UL-ChannelRequirementWithCPCH-SetID-r5.h \ UL-CompressedModeMethod.h \ UL-DL-Mode.h \ UL-DPCCH-SlotFormat.h \ UL-DPCH-Info.h \ UL-DPCH-Info-r4.h \ UL-DPCH-Info-r5.h \ UL-DPCH-Info-r6.h \ UL-DPCH-Info-r7.h \ UL-DPCH-InfoPostFDD.h \ UL-DPCH-InfoPostTDD.h \ UL-DPCH-InfoPostTDD-LCR-r4.h \ UL-DPCH-InfoPredef.h \ UL-DPCH-PowerControlInfo.h \ UL-DPCH-PowerControlInfo-r4.h \ UL-DPCH-PowerControlInfo-r5.h \ UL-DPCH-PowerControlInfo-r6.h \ UL-DPCH-PowerControlInfo-r7.h \ UL-DPCH-PowerControlInfoPostFDD.h \ UL-DPCH-PowerControlInfoPostTDD.h \ UL-DPCH-PowerControlInfoPostTDD-LCR-r4.h \ UL-DPCH-PowerControlInfoPredef.h \ UL-EDCH-Information-r6.h \ UL-Interference.h \ UL-ScramblingCode.h \ UL-SynchronisationParameters-r4.h \ UL-TargetSIR.h \ UL-TimingAdvance.h \ UL-TimingAdvance-VHCR.h \ UL-TimingAdvanceControl.h \ UL-TimingAdvanceControl-r4.h \ UL-TimingAdvanceControl-r7.h \ UL-TimingAdvanceControl-LCR-r4.h \ UL-TS-ChannelisationCode.h \ UL-TS-ChannelisationCodeList.h \ UL-TS-ChannelisationCodeList-r7.h \ UL-TS-ChannelisationCode-VHCR.h \ UL-TS-ChannelisationCodeList-VHCR.h \ UplinkAdditionalTimeslots.h \ UplinkAdditionalTimeslots-LCR-r4.h \ UplinkAdditionalTimeslots-LCR-r7.h \ UplinkTimeslotsCodes.h \ UplinkTimeslotsCodes-VHCR.h \ UplinkTimeslotsCodes-LCR-r4.h \ UplinkTimeslotsCodes-LCR-r7.h \ Wi-LCR.h \ AcquisitionSatInfo.h \ AcquisitionSatInfoList.h \ AdditionalMeasurementID-List.h \ AlmanacSatInfo.h \ AlmanacSatInfoList.h \ AverageRLC-BufferPayload.h \ AzimuthAndElevation.h \ BadSatList.h \ Frequency-Band.h \ BCCH-ARFCN.h \ BLER-MeasurementResults.h \ BLER-MeasurementResultsList.h \ BLER-TransChIdList.h \ BSIC-VerificationRequired.h \ BSICReported.h \ BurstModeParameters.h \ CellDCH-ReportCriteria.h \ CellDCH-ReportCriteria-LCR-r4.h \ CellIndividualOffset.h \ CellInfo.h \ CellInfo-r4.h \ CellInfoSI-RSCP.h \ CellInfoSI-RSCP-LCR-r4.h \ CellInfoSI-ECN0.h \ CellInfoSI-ECN0-LCR-r4.h \ CellInfoSI-HCS-RSCP.h \ CellInfoSI-HCS-RSCP-LCR-r4.h \ CellInfoSI-HCS-ECN0.h \ CellInfoSI-HCS-ECN0-LCR-r4.h \ CellMeasuredResults.h \ CellMeasurementEventResults.h \ CellMeasurementEventResults-LCR-r4.h \ CellReportingQuantities.h \ CellSelectReselectInfoSIB-11-12.h \ CellSelectReselectInfoSIB-11-12-RSCP.h \ CellSelectReselectInfoSIB-11-12-ECN0.h \ CellSelectReselectInfoSIB-11-12-HCS-RSCP.h \ CellSelectReselectInfoSIB-11-12-HCS-ECN0.h \ CellSelectReselectInfo-v590ext.h \ CellSelectReselectInfoPCHFACH-v5b0ext.h \ CellSelectReselectInfoTreselectionScaling-v5c0ext.h \ CellsForInterFreqMeasList.h \ CellsForInterRATMeasList.h \ CellsForIntraFreqMeasList.h \ CellSynchronisationInfo.h \ CellToReport.h \ CellToReportList.h \ CodePhaseSearchWindow.h \ CountC-SFN-Frame-difference.h \ CPICH-Ec-N0.h \ CPICH-RSCP.h \ DeltaPRC.h \ DeltaQrxlevmin.h \ DeltaRSCP.h \ DeltaRSCPPerCell.h \ DeltaRRC.h \ DGPS-CorrectionSatInfo.h \ DGPS-CorrectionSatInfoList.h \ DiffCorrectionStatus.h \ DL-TransportChannelBLER.h \ DopplerUncertainty.h \ EllipsoidPoint.h \ EllipsoidPointAltitude.h \ EllipsoidPointAltitudeEllipsoide.h \ EllipsoidPointUncertCircle.h \ EllipsoidPointUncertEllipse.h \ EnvironmentCharacterisation.h \ Event1a.h \ Event1a-r4.h \ Event1a-LCR-r4.h \ Event1b.h \ Event1b-r4.h \ Event1b-LCR-r4.h \ Event1c.h \ Event1d.h \ Event1e.h \ Event1e-r6.h \ Event1f.h \ Event1f-r6.h \ Event1j-r6.h \ Event2a.h \ Event2a-r6.h \ Event2b.h \ Event2b-r6.h \ Event2c.h \ Event2c-r6.h \ Event2d.h \ Event2d-r6.h \ Event2e.h \ Event2e-r6.h \ Event2f.h \ Event2f-r6.h \ Event3a.h \ Event3b.h \ Event3c.h \ Event3d.h \ EventIDInterFreq.h \ EventIDInterRAT.h \ EventIDIntraFreq.h \ EventResults.h \ ExtraDopplerInfo.h \ FACH-MeasurementOccasionInfo.h \ FACH-MeasurementOccasionInfo-LCR-r4-ext.h \ FilterCoefficient.h \ FineSFN-SFN.h \ ForbiddenAffectCell.h \ ForbiddenAffectCell-r4.h \ ForbiddenAffectCell-LCR-r4.h \ ForbiddenAffectCellList.h \ ForbiddenAffectCellList-r4.h \ ForbiddenAffectCellList-LCR-r4.h \ FreqQualityEstimateQuantity-FDD.h \ FreqQualityEstimateQuantity-TDD.h \ GPS-MeasurementParam.h \ GPS-MeasurementParamList.h \ GSM-CarrierRSSI.h \ GSM-MeasuredResults.h \ GSM-MeasuredResultsList.h \ GPS-TOW-1msec.h \ GPS-TOW-Assist.h \ GPS-TOW-AssistList.h \ HCS-CellReselectInformation-RSCP.h \ HCS-CellReselectInformation-ECN0.h \ HCS-NeighbouringCellInformation-RSCP.h \ HCS-NeighbouringCellInformation-ECN0.h \ HCS-PRIO.h \ HCS-ServingCellInformation.h \ HorizontalVelocity.h \ HorizontalWithVerticalVelocity.h \ HorizontalVelocityWithUncertainty.h \ HorizontalWithVerticalVelocityAndUncertainty.h \ Hysteresis.h \ HysteresisInterFreq.h \ InterFreqCell.h \ InterFreqCell-LCR-r4.h \ InterFreqCellID.h \ InterFreqCellInfoList.h \ InterFreqCellInfoList-r4.h \ InterFreqCellInfoSI-List-RSCP.h \ InterFreqCellInfoSI-List-ECN0.h \ InterFreqCellInfoSI-List-HCS-RSCP.h \ InterFreqCellInfoSI-List-HCS-ECN0.h \ InterFreqCellInfoSI-List-RSCP-LCR.h \ InterFreqCellInfoSI-List-ECN0-LCR.h \ InterFreqCellInfoSI-List-HCS-RSCP-LCR.h \ InterFreqCellInfoSI-List-HCS-ECN0-LCR.h \ InterFreqCellList.h \ InterFreqCellList-LCR-r4-ext.h \ InterFreqCellMeasuredResultsList.h \ InterFreqEvent.h \ InterFreqEvent-r6.h \ InterFreqEventList.h \ InterFreqEventList-r6.h \ InterFrequencyMeasuredResultsList-v590ext.h \ Inter-FreqEventCriteria-v590ext.h \ Inter-FreqEventCriteriaList-v590ext.h \ Intra-FreqEventCriteriaList-v590ext.h \ IntraFrequencyMeasuredResultsList-v590ext.h \ IntraFreqReportingCriteria-1b-r5.h \ PeriodicReportingInfo-1b.h \ InterFreqEventResults.h \ InterFreqEventResults-LCR-r4-ext.h \ InterFreqMeasQuantity.h \ InterFreqMeasuredResults.h \ InterFreqMeasuredResultsList.h \ InterFreqMeasurementSysInfo-RSCP.h \ InterFreqMeasurementSysInfo-ECN0.h \ InterFreqMeasurementSysInfo-HCS-RSCP.h \ InterFreqMeasurementSysInfo-HCS-ECN0.h \ InterFreqMeasurementSysInfo-RSCP-LCR-r4.h \ InterFreqMeasurementSysInfo-ECN0-LCR-r4.h \ InterFreqMeasurementSysInfo-HCS-RSCP-LCR-r4.h \ InterFreqMeasurementSysInfo-HCS-ECN0-LCR-r4.h \ InterFreqRACHRepCellsList.h \ InterFreqRACHReportingInfo.h \ InterFreqReportCriteria.h \ InterFreqReportCriteria-r4.h \ InterFreqReportCriteria-r6.h \ InterFreqReportingCriteria.h \ InterFreqReportingCriteria-r6.h \ InterFreqReportingQuantity.h \ InterFreqRepQuantityRACH-FDD.h \ InterFreqRepQuantityRACH-TDD.h \ InterFreqRepQuantityRACH-TDDList.h \ InterFrequencyMeasurement.h \ InterFrequencyMeasurement-r4.h \ InterFrequencyMeasurement-r6.h \ InterRAT-TargetCellDescription.h \ InterRATCellID.h \ InterRATCellInfoIndication.h \ InterRATCellInfoList.h \ InterRATCellInfoList-B.h \ InterRATCellInfoList-r4.h \ InterRATCellInfoList-r6.h \ InterRATCellIndividualOffset.h \ InterRATEvent.h \ InterRATEventList.h \ InterRATEventResults.h \ InterRATInfo.h \ InterRATInfo-r6.h \ InterRATMeasQuantity.h \ InterRATMeasuredResults.h \ InterRATMeasuredResultsList.h \ InterRATMeasurement.h \ InterRATMeasurement-r4.h \ InterRATMeasurement-r6.h \ InterRATMeasurementSysInfo.h \ InterRATMeasurementSysInfo-B.h \ InterRATReportCriteria.h \ InterRATReportingCriteria.h \ InterRATReportingQuantity.h \ IntraFreqCellID.h \ IntraFreqCellInfoList.h \ IntraFreqCellInfoList-r4.h \ IntraFreqCellInfoSI-List-RSCP.h \ IntraFreqCellInfoSI-List-ECN0.h \ IntraFreqCellInfoSI-List-HCS-RSCP.h \ IntraFreqCellInfoSI-List-HCS-ECN0.h \ IntraFreqCellInfoSI-List-RSCP-LCR-r4.h \ IntraFreqCellInfoSI-List-ECN0-LCR-r4.h \ IntraFreqCellInfoSI-List-HCS-RSCP-LCR-r4.h \ IntraFreqCellInfoSI-List-HCS-ECN0-LCR-r4.h \ IntraFreqEvent.h \ IntraFreqEvent-r4.h \ IntraFreqEvent-LCR-r4.h \ IntraFreqEvent-r6.h \ IntraFreqEvent-1d-r5.h \ IntraFreqEventCriteria.h \ IntraFreqEventCriteria-r4.h \ IntraFreqEventCriteria-LCR-r4.h \ IntraFreqEventCriteria-r6.h \ IntraFreqEventCriteriaList.h \ IntraFreqEventCriteriaList-r4.h \ IntraFreqEventCriteriaList-LCR-r4.h \ IntraFreqEventCriteriaList-r6.h \ IntraFreqEventResults.h \ IntraFreqMeasQuantity.h \ IntraFreqMeasQuantity-FDD.h \ IntraFreqMeasQuantity-TDD.h \ IntraFreqMeasQuantity-TDDList.h \ IntraFreqMeasuredResultsList.h \ IntraFreqMeasurementSysInfo-RSCP.h \ IntraFreqMeasurementSysInfo-ECN0.h \ IntraFreqMeasurementSysInfo-HCS-RSCP.h \ IntraFreqMeasurementSysInfo-HCS-ECN0.h \ IntraFreqMeasurementSysInfo-RSCP-LCR-r4.h \ IntraFreqMeasurementSysInfo-ECN0-LCR-r4.h \ IntraFreqMeasurementSysInfo-HCS-RSCP-LCR-r4.h \ IntraFreqMeasurementSysInfo-HCS-ECN0-LCR-r4.h \ IntraFreqReportCriteria.h \ IntraFreqReportCriteria-r4.h \ IntraFreqReportCriteria-r6.h \ IntraFreqReportingCriteria.h \ IntraFreqReportingCriteria-r4.h \ IntraFreqReportingCriteria-LCR-r4.h \ IntraFreqReportingCriteria-r6.h \ IntraFreqReportingQuantity.h \ IntraFreqReportingQuantityForRACH.h \ IntraFreqRepQuantityRACH-FDD.h \ IntraFreqRepQuantityRACH-TDD.h \ IntraFreqRepQuantityRACH-TDDList.h \ IntraFrequencyMeasurement.h \ IntraFrequencyMeasurement-r4.h \ IntraFrequencyMeasurement-r6.h \ IODE.h \ IP-Length.h \ IP-PCCPCH-r4.h \ IP-Spacing.h \ IP-Spacing-TDD.h \ IS-2000SpecificMeasInfo.h \ MaxNumberOfReportingCellsType1.h \ MaxNumberOfReportingCellsType2.h \ MaxNumberOfReportingCellsType3.h \ MaxReportedCellsOnRACH.h \ MaxReportedCellsOnRACHinterFreq.h \ MeasuredResults.h \ MeasuredResults-v390ext.h \ MeasuredResults-v590ext.h \ MeasuredResults-v7xyext.h \ MeasuredResults-LCR-r4.h \ MeasuredResultsList.h \ MeasuredResultsList-LCR-r4-ext.h \ MeasuredResultsOnRACH.h \ MeasuredResultsOnRACHinterFreq.h \ MeasurementCommand.h \ MeasurementCommand-r4.h \ MeasurementCommand-r6.h \ MeasurementControlSysInfo.h \ MeasurementControlSysInfo-LCR-r4-ext.h \ MeasurementIdentity.h \ MeasurementQuantityGSM.h \ MeasurementReportingMode.h \ MeasurementType.h \ MeasurementType-r4.h \ MeasurementType-r6.h \ MeasurementValidity.h \ MonitoredCellRACH-List.h \ MonitoredCellRACH-Result.h \ MultipathIndicator.h \ N-CR-T-CRMaxHyst.h \ NavigationModelSatInfo.h \ NavigationModelSatInfoList.h \ EphemerisParameter.h \ NC-Mode.h \ Neighbour.h \ Neighbour-v390ext.h \ NeighbourList.h \ NeighbourList-v390ext.h \ NeighbourQuality.h \ NewInterFreqCell.h \ NewInterFreqCell-r4.h \ NewInterFreqCellList.h \ NewInterFreqCellList-r4.h \ NewInterFreqCellSI-RSCP.h \ NewInterFreqCellSI-ECN0.h \ NewInterFreqCellSI-HCS-RSCP.h \ NewInterFreqCellSI-HCS-ECN0.h \ NewInterFreqCellSI-RSCP-LCR-r4.h \ NewInterFreqCellSI-ECN0-LCR-r4.h \ NewInterFreqCellSI-HCS-RSCP-LCR-r4.h \ NewInterFreqCellSI-HCS-ECN0-LCR-r4.h \ NewInterFreqCellSI-List-ECN0.h \ NewInterFreqCellSI-List-HCS-RSCP.h \ NewInterFreqCellSI-List-HCS-ECN0.h \ NewInterFreqCellSI-List-RSCP.h \ NewInterFreqCellSI-List-ECN0-LCR-r4.h \ NewInterFreqCellSI-List-HCS-RSCP-LCR-r4.h \ NewInterFreqCellSI-List-HCS-ECN0-LCR-r4.h \ NewInterFreqCellSI-List-RSCP-LCR-r4.h \ NewInterRATCell.h \ NewInterRATCell-B.h \ NewInterRATCellList.h \ NewInterRATCellList-B.h \ NewIntraFreqCell.h \ NewIntraFreqCell-r4.h \ NewIntraFreqCellList.h \ NewIntraFreqCellList-r4.h \ NewIntraFreqCellSI-RSCP.h \ NewIntraFreqCellSI-ECN0.h \ NewIntraFreqCellSI-HCS-RSCP.h \ NewIntraFreqCellSI-HCS-ECN0.h \ NewIntraFreqCellSI-RSCP-LCR-r4.h \ NewIntraFreqCellSI-ECN0-LCR-r4.h \ NewIntraFreqCellSI-HCS-RSCP-LCR-r4.h \ NewIntraFreqCellSI-HCS-ECN0-LCR-r4.h \ NewIntraFreqCellSI-List-RSCP.h \ NewIntraFreqCellSI-List-ECN0.h \ NewIntraFreqCellSI-List-HCS-RSCP.h \ NewIntraFreqCellSI-List-HCS-ECN0.h \ NewIntraFreqCellSI-List-RSCP-LCR-r4.h \ NewIntraFreqCellSI-List-ECN0-LCR-r4.h \ NewIntraFreqCellSI-List-HCS-RSCP-LCR-r4.h \ NewIntraFreqCellSI-List-HCS-ECN0-LCR-r4.h \ NonUsedFreqParameter.h \ NonUsedFreqParameter-r6.h \ NonUsedFreqParameterList.h \ NonUsedFreqParameterList-r6.h \ NonUsedFreqWList-r6.h \ ObservedTimeDifferenceToGSM.h \ OTDOA-SearchWindowSize.h \ Pathloss.h \ PenaltyTime-RSCP.h \ PenaltyTime-ECN0.h \ PendingTimeAfterTrigger.h \ PeriodicalOrEventTrigger.h \ PeriodicalReportingCriteria.h \ PeriodicalWithReportingCellStatus.h \ PLMNIdentitiesOfNeighbourCells.h \ PLMNsOfInterFreqCellsList.h \ PLMNsOfIntraFreqCellsList.h \ PLMNsOfInterRATCellsList.h \ PositionEstimate.h \ PositioningMethod.h \ PRC.h \ PrimaryCCPCH-RSCP.h \ Q-HCS.h \ Q-OffsetS-N.h \ Q-QualMin.h \ Q-RxlevMin.h \ QualityEventResults.h \ QualityMeasuredResults.h \ QualityMeasurement.h \ QualityReportCriteria.h \ QualityReportingCriteria.h \ QualityReportingCriteriaSingle.h \ QualityReportingQuantity.h \ RAT-Type.h \ ReferenceCellPosition.h \ ReferenceLocation.h \ ReferenceTimeDifferenceToCell.h \ RemovedInterFreqCellList.h \ RemovedInterRATCellList.h \ RemovedIntraFreqCellList.h \ ReplacementActivationThreshold.h \ ReportDeactivationThreshold.h \ ReportingAmount.h \ ReportingCellStatus.h \ ReportingCellStatusOpt.h \ ReportingInfoForCellDCH.h \ ReportingInfoForCellDCH-LCR-r4.h \ ReportingInterval.h \ ReportingIntervalLong.h \ ReportingRange.h \ RL-AdditionInfoList.h \ RL-InformationLists.h \ RLC-BuffersPayload.h \ RRC.h \ SatData.h \ SatDataList.h \ SatelliteStatus.h \ SatID.h \ SFN-Offset-Validity.h \ SFN-SFN-Drift.h \ SFN-SFN-ObsTimeDifference.h \ SFN-SFN-ObsTimeDifference1.h \ SFN-SFN-ObsTimeDifference2.h \ SFN-SFN-OTD-Type.h \ SFN-SFN-RelTimeDifference1.h \ SFN-TOW-Uncertainty.h \ SIR.h \ SIR-MeasurementList.h \ SIR-MeasurementResults.h \ SIR-TFCS.h \ SIR-TFCS-List.h \ SIR-TimeslotList.h \ SubFrame1Reserved.h \ T-ADVinfo.h \ T-CRMax.h \ T-CRMaxHyst.h \ TemporaryOffset1.h \ TemporaryOffset2.h \ TemporaryOffsetList.h \ Threshold.h \ Threshold-r6.h \ ThreholdNonUsedFrequency-deltaList.h \ ThresholdPositionChange.h \ ThresholdSFN-GPS-TOW.h \ ThresholdSFN-SFN-Change.h \ ThresholdUsedFrequency.h \ ThresholdUsedFrequency-r6.h \ TimeInterval.h \ TimeslotInfo.h \ TimeslotInfo-LCR-r4.h \ TimeslotInfoList.h \ TimeslotInfoList-LCR-r4.h \ TimeslotInfoList-r4.h \ TimeslotISCP.h \ TimeslotISCP-List.h \ TimeslotListWithISCP.h \ TimeslotWithISCP.h \ TimeToTrigger.h \ TrafficVolumeEventParam.h \ TrafficVolumeEventResults.h \ TrafficVolumeEventType.h \ TrafficVolumeMeasQuantity.h \ TrafficVolumeMeasSysInfo.h \ TrafficVolumeMeasuredResults.h \ TrafficVolumeMeasuredResultsList.h \ TrafficVolumeMeasurement.h \ TrafficVolumeMeasurementObjectList.h \ TrafficVolumeReportCriteria.h \ TrafficVolumeReportCriteriaSysInfo.h \ TrafficVolumeReportingCriteria.h \ TrafficVolumeReportingQuantity.h \ TrafficVolumeThreshold.h \ TransChCriteria.h \ TransChCriteriaList.h \ TransferMode.h \ TransmittedPowerThreshold.h \ TriggeringCondition1.h \ TriggeringCondition2.h \ TX-InterruptionAfterTrigger.h \ UDRE.h \ UE-6AB-Event.h \ UE-6FG-Event.h \ UE-AutonomousUpdateMode.h \ UE-InternalEventParam.h \ UE-InternalEventParamList.h \ UE-InternalEventResults.h \ UE-InternalMeasQuantity.h \ UE-InternalMeasuredResults.h \ UE-InternalMeasuredResults-r7.h \ UE-InternalMeasuredResults-LCR-r4.h \ UE-InternalMeasurement.h \ UE-InternalMeasurement-r4.h \ UE-InternalMeasurementSysInfo.h \ UE-InternalReportCriteria.h \ UE-InternalReportingCriteria.h \ UE-InternalReportingQuantity.h \ UE-InternalReportingQuantity-r4.h \ UE-MeasurementQuantity.h \ UE-RX-TX-ReportEntry.h \ UE-RX-TX-ReportEntryList.h \ UE-RX-TX-TimeDifferenceType1.h \ UE-RX-TX-TimeDifferenceType2.h \ UE-RX-TX-TimeDifferenceType2Info.h \ UE-RX-TX-TimeDifferenceThreshold.h \ UE-TransmittedPower.h \ UE-TransmittedPowerTDD-List.h \ UL-TrCH-Identity.h \ UE-Positioning-Accuracy.h \ UE-Positioning-CipherParameters.h \ UE-Positioning-Error.h \ UE-Positioning-ErrorCause.h \ UE-Positioning-EventParam.h \ UE-Positioning-EventParamList.h \ UE-Positioning-EventSpecificInfo.h \ UE-Positioning-GPS-AcquisitionAssistance.h \ UE-Positioning-GPS-AdditionalAssistanceDataRequest.h \ UE-Positioning-GPS-Almanac.h \ UE-Positioning-GPS-AssistanceData.h \ UE-Positioning-GPS-DGPS-Corrections.h \ UE-Positioning-GPS-IonosphericModel.h \ UE-Positioning-GPS-MeasurementResults.h \ UE-Positioning-GPS-NavigationModel.h \ UE-Positioning-GPS-NavModelAddDataReq.h \ UE-Positioning-GPS-ReferenceCellInfo.h \ UE-Positioning-GPS-ReferenceTime.h \ UE-Positioning-GPS-UTC-Model.h \ UE-Positioning-IPDL-Parameters.h \ UE-Positioning-IPDL-Parameters-r4.h \ UE-Positioning-IPDL-Parameters-TDD-r4-ext.h \ UE-Positioning-MeasuredResults.h \ UE-Positioning-MeasuredResults-v390ext.h \ UE-Positioning-Measurement.h \ UE-Positioning-Measurement-v390ext.h \ UE-Positioning-Measurement-r4.h \ UE-Positioning-Measurement-v7xyext.h \ UE-Positioning-MeasurementEventResults.h \ UE-Positioning-MeasurementInterval.h \ UE-Positioning-MethodType.h \ UE-Positioning-OTDOA-AssistanceData.h \ UE-Positioning-OTDOA-AssistanceData-r4.h \ UE-Positioning-OTDOA-AssistanceData-r4ext.h \ UE-Positioning-OTDOA-AssistanceData-UEB.h \ UE-Positioning-IPDL-Parameters-TDDList-r4-ext.h \ UE-Positioning-OTDOA-Measurement.h \ UE-Positioning-OTDOA-Measurement-v390ext.h \ UE-Positioning-OTDOA-NeighbourCellInfo.h \ UE-Positioning-OTDOA-NeighbourCellInfo-r4.h \ UE-Positioning-OTDOA-NeighbourCellInfo-UEB.h \ UE-Positioning-OTDOA-NeighbourCellList.h \ UE-Positioning-OTDOA-NeighbourCellList-r4.h \ UE-Positioning-OTDOA-NeighbourCellList-UEB.h \ UE-Positioning-OTDOA-Quality.h \ UE-Positioning-OTDOA-ReferenceCellInfo.h \ UE-Positioning-OTDOA-ReferenceCellInfo-r4.h \ UE-Positioning-OTDOA-ReferenceCellInfo-UEB.h \ UE-Positioning-PositionEstimateInfo.h \ UE-Positioning-ReportCriteria.h \ UE-Positioning-ReportingQuantity.h \ UE-Positioning-ReportingQuantity-v390ext.h \ UE-Positioning-ReportingQuantity-r4.h \ UE-Positioning-ReportingQuantity-v7xyext.h \ UE-Positioning-ResponseTime.h \ UTRA-CarrierRSSI.h \ UTRAN-GPS-DriftRate.h \ UTRAN-GPSReferenceTime.h \ UTRAN-GPSReferenceTimeResult.h \ VarianceOfRLC-BufferPayload.h \ VelocityEstimate.h \ W.h \ BCC.h \ BCCH-ModificationInfo.h \ BCCH-ModificationTime.h \ BSIC.h \ CBS-DRX-Level1Information.h \ CBS-DRX-Level1Information-extension-r6.h \ CDMA2000-Message.h \ CDMA2000-MessageList.h \ CDMA2000-UMTS-Frequency-List.h \ CellValueTag.h \ ExpirationTimeFactor.h \ FDD-UMTS-Frequency-List.h \ FrequencyInfoCDMA2000.h \ GERAN-SystemInfoBlock.h \ GERAN-SystemInformation.h \ GSM-BA-Range.h \ GSM-BA-Range-List.h \ GSM-Classmark2.h \ GSM-Classmark3.h \ GSM-MessageList.h \ GSM-MS-RadioAccessCapability.h \ GsmSecurityCapability.h \ GSM-TargetCellInfoList.h \ GSM-TargetCellInfo.h \ IdentificationOfReceivedMessage.h \ InterRAT-ChangeFailureCause.h \ GERANIu-MessageList.h \ GERANIu-RadioAccessCapability.h \ InterRAT-UE-RadioAccessCapability.h \ InterRAT-UE-RadioAccessCapabilityList.h \ InterRAT-UE-RadioAccessCapability-v590ext.h \ InterRAT-UE-RadioAccessCapability-v690ext.h \ InterRAT-UE-SecurityCapability.h \ InterRAT-UE-SecurityCapList.h \ InterRAT-HO-FailureCause.h \ MasterInformationBlock.h \ MasterInformationBlock-v690ext.h \ MIB-ValueTag.h \ NCC.h \ PLMN-ValueTag.h \ PredefinedConfigIdentityAndValueTag.h \ ProtocolErrorInformation.h \ ReceivedMessageType.h \ Rplmn-Information.h \ Rplmn-Information-r4.h \ SchedulingInformation.h \ SchedulingInformationSIB.h \ SchedulingInformationSIBSb.h \ SegCount.h \ SegmentIndex.h \ SFN-Prime.h \ SIB-Data-fixed.h \ SIB-Data-variable.h \ SIBOccurIdentity.h \ SIBOccurrenceIdentityAndValueTag.h \ SIBOccurValueTag.h \ SIB-ReferenceList.h \ SIBSb-ReferenceList.h \ SIB-ReferenceListFACH.h \ SIB-Type.h \ SIB-TypeAndTag.h \ SIBSb-TypeAndTag.h \ SibOFF.h \ SibOFF-List.h \ SysInfoType1.h \ SysInfoType1-v3a0ext-IEs.h \ SysInfoType2.h \ SysInfoType3.h \ SysInfoType3-v4b0ext-IEs.h \ SysInfoType3-v590ext.h \ SysInfoType3-v5c0ext-IEs.h \ SysInfoType3-v670ext.h \ SysInfoType4.h \ SysInfoType4-v4b0ext-IEs.h \ SysInfoType4-v590ext.h \ SysInfoType4-v5b0ext-IEs.h \ SysInfoType4-v5c0ext-IEs.h \ SysInfoType5.h \ SysInfoType5-v4b0ext-IEs.h \ SysInfoType5-v590ext-IEs.h \ SysInfoType5-v650ext-IEs.h \ SysInfoType5-v680ext-IEs.h \ SysInfoType5-v690ext-IEs.h \ SysInfoType5-v7xyext-IEs.h \ SysInfoType5bis.h \ SysInfoType6.h \ SysInfoType6-v4b0ext-IEs.h \ SysInfoType6-v590ext-IEs.h \ SysInfoType6-v650ext-IEs.h \ SysInfoType6-v690ext-IEs.h \ SysInfoType6-v7xyext-IEs.h \ SysInfoType7.h \ SysInfoType8.h \ SysInfoType9.h \ SysInfoType10.h \ SysInfoType11.h \ SysInfoType11-v4b0ext-IEs.h \ SysInfoType11-v590ext-IEs.h \ SysInfoType11-v690ext-IEs.h \ SysInfoType12.h \ SysInfoType12-v4b0ext-IEs.h \ SysInfoType12-v590ext-IEs.h \ SysInfoType12-v690ext-IEs.h \ SysInfoType13.h \ SysInfoType13-v3a0ext-IEs.h \ SysInfoType13-v4b0ext-IEs.h \ SysInfoType13-v7xyext-IEs.h \ SysInfoType13-1.h \ SysInfoType13-2.h \ SysInfoType13-3.h \ SysInfoType13-4.h \ SysInfoType14.h \ SysInfoType15.h \ SysInfoType15-v4b0ext-IEs.h \ SysInfoType15-1.h \ SysInfoType15-2.h \ SysInfoType15-3.h \ SysInfoType15-4.h \ SysInfoType15-4-v3a0ext.h \ SysInfoType15-4-v4b0ext.h \ SysInfoType15-5.h \ SysInfoType15-5-v3a0ext.h \ SysInfoType16.h \ SysInfoType17.h \ SysInfoType17-v4b0ext-IEs.h \ SysInfoType17-v590ext-IEs.h \ SysInfoType17-v7xyext-IEs.h \ SysInfoType18.h \ SysInfoTypeSB1.h \ SysInfoTypeSB2.h \ TDD-UMTS-Frequency-List.h \ ANSI-41-GlobalServiceRedirectInfo.h \ ANSI-41-PrivateNeighbourListInfo.h \ ANSI-41-RAND-Information.h \ ANSI-41-UserZoneID-Information.h \ ANSI-41-NAS-Parameter.h \ Min-P-REV.h \ NAS-SystemInformationANSI-41.h \ NID.h \ P-REV.h \ SID.h \ MBMS-AccessProbabilityFactor.h \ MBMS-CellGroupIdentity-r6.h \ MBMS-CommonCCTrChIdentity.h \ MBMS-CommonPhyChIdentity.h \ MBMS-CommonRBIdentity.h \ MBMS-CommonRBInformation-r6.h \ MBMS-CommonRBInformationList-r6.h \ MBMS-CommonTrChIdentity.h \ MBMS-ConnectedModeCountingScope.h \ MBMS-CurrentCell-SCCPCH-r6.h \ MBMS-CurrentCell-SCCPCHList-r6.h \ MBMS-FACHCarryingMTCH-List.h \ MBMS-JoinedInformation-r6.h \ MBMS-L1CombiningSchedule-32.h \ MBMS-L1CombiningSchedule-64.h \ MBMS-L1CombiningSchedule-128.h \ MBMS-L1CombiningSchedule-256.h \ MBMS-L1CombiningSchedule-512.h \ MBMS-L1CombiningSchedule-1024.h \ MBMS-L1CombiningSchedule.h \ MBMS-L1CombiningTransmTimeDiff.h \ MBMS-L23Configuration.h \ MBMS-LogicalChIdentity.h \ MBMS-MCCH-ConfigurationInfo-r6.h \ MBMS-MICHConfigurationInfo-r6.h \ MBMS-MICHConfigurationInfo-r7.h \ MBMS-MICHNotificationIndLength.h \ MBMS-MICHPowerOffset.h \ MBMS-ModifedService-r6.h \ MBMS-ModifedServiceList-r6.h \ MBMS-MSCH-ConfigurationInfo-r6.h \ MBMS-MSCHSchedulingInfo.h \ MBMS-NeighbouringCellSCCPCH-r6.h \ MBMS-NeighbouringCellSCCPCHList-r6.h \ MBMS-NI-CountPerFrame.h \ MBMS-NumberOfNeighbourCells-r6.h \ MBMS-PFLIndex.h \ MBMS-PFLInfo.h \ MBMS-PhyChInformation-r6.h \ MBMS-PhyChInformationList-r6.h \ MBMS-PL-ServiceRestrictInfo-r6.h \ MBMS-PreferredFreqRequest-r6.h \ MBMS-PreferredFrequencyInfo-r6.h \ MBMS-PreferredFrequencyList-r6.h \ MBMS-PTMActivationTime-r6.h \ MBMS-PTM-RBInformation-C.h \ MBMS-PTM-RBInformation-CList.h \ MBMS-PTM-RBInformation-N.h \ MBMS-PTM-RBInformation-NList.h \ MBMS-Qoffset.h \ MBMS-RequiredUEAction-Mod.h \ MBMS-RequiredUEAction-UMod.h \ MBMS-SCCPCHIdentity.h \ MBMS-SCCPCHPwrOffsetDiff.h \ MBMS-ServiceAccessInfo-r6.h \ MBMS-ServiceAccessInfoList-r6.h \ MBMS-ServiceIdentity-r6.h \ MBMS-ServiceSchedulingInfo-r6.h \ MBMS-ServiceSchedulingInfoList-r6.h \ MBMS-ServiceTransmInfo.h \ MBMS-ServiceTransmInfoList.h \ MBMS-SessionIdentity.h \ MBMS-ShortTransmissionID.h \ MBMS-SIBType5-SCCPCH-r6.h \ MBMS-SIBType5-SCCPCHList-r6.h \ MBMS-SoftComb-TimingOffset.h \ MBMS-TCTF-Presence.h \ MBMS-TimersAndCounters-r6.h \ MBMS-TransmissionIdentity.h \ MBMS-TranspChInfoForCCTrCh-r6.h \ MBMS-TranspChInfoForEachCCTrCh-r6.h \ MBMS-TranspChInfoForEachTrCh-r6.h \ MBMS-TranspChInfoForTrCh-r6.h \ MBMS-TrCHInformation-Curr.h \ MBMS-TrCHInformation-CurrList.h \ MBMS-TrCHInformation-Neighb.h \ MBMS-TrCHInformation-NeighbList.h \ MBMS-TrCHInformation-SIB5.h \ MBMS-TrCHInformation-SIB5List.h \ MBMS-UnmodifiedService-r6.h \ MBMS-UnmodifiedServiceList-r6.h \ ToTargetRNC-Container.h \ TargetRNC-ToSourceRNC-Container.h \ InterRATHandoverInfoWithInterRATCapabilities-r3.h \ InterRATHandoverInfoWithInterRATCapabilities-r3-IEs.h \ InterRATHandoverInfoWithInterRATCapabilities-v390ext-IEs.h \ InterRATHandoverInfoWithInterRATCapabilities-v690ext-IEs.h \ RFC3095-ContextInfo-r5.h \ RFC3095-ContextInfoList-r5.h \ SRNC-RelocationInfo-r3.h \ SRNC-RelocationInfo-r3-IEs.h \ SRNC-RelocationInfo-v380ext-IEs.h \ SRNC-RelocationInfo-v390ext-IEs.h \ SRNC-RelocationInfo-v3a0ext-IEs.h \ SRNC-RelocationInfo-v3b0ext-IEs.h \ SRNC-RelocationInfo-v3c0ext-IEs.h \ SRNC-RelocationInfo-v3d0ext-IEs.h \ SRNC-RelocationInfo-v3g0ext-IEs.h \ SRNC-RelocationInfo-v3h0ext-IEs.h \ SRNC-RelocationInfo-v4d0ext-IEs.h \ TPC-CombinationInfoList.h \ STARTList2.h \ SRNC-RelocationInfo-v4b0ext-IEs.h \ SRNC-RelocationInfo-v590ext-IEs.h \ SRNC-RelocationInfo-v5a0ext-IEs.h \ SRNC-RelocationInfo-v5b0ext-IEs.h \ SRNC-RelocationInfo-v5c0ext-IEs.h \ SRNC-RelocationInfo-v7xyext-IEs.h \ CipheringInfoPerRB-List-v3a0ext.h \ CipheringStatusList.h \ CipheringStatusCNdomain.h \ CodeChangeStatusList.h \ CodeChangeStatus.h \ StoredCompressedModeInfo.h \ StoredTGP-SequenceList.h \ StoredTGP-Sequence.h \ SRNC-RelocationInfo-r4-IEs.h \ SRNC-RelocationInfo-r5-IEs.h \ SRNC-RelocationInfo-v690ext-IEs.h \ SRNC-RelocationInfo-r6-IEs.h \ CalculationTimeForCiphering.h \ CipheringInfoPerRB.h \ CipheringInfoPerRB-r4.h \ CipheringInfoPerRB-List.h \ CipheringInfoPerRB-List-r4.h \ CipheringStatus.h \ CipheringStatusList-r4.h \ CipheringStatusCNdomain-r4.h \ CN-DomainInformation-v390ext.h \ CN-DomainInformationList-v390ext.h \ CompressedModeMeasCapability-r4.h \ COUNT-C-List.h \ COUNT-CSingle.h \ DL-PhysChCapabilityFDD-r4.h \ DL-PhysChCapabilityFDD-r5.h \ DL-PhysChCapabilityTDD-r5.h \ DL-PhysChCapabilityTDD-LCR-r5.h \ DL-RFC3095-Context.h \ ImplementationSpecificParams.h \ IntegrityProtectionStatus.h \ InterRAT-UE-RadioAccessCapabilityList-r5.h \ IntraFreqReportingCriteria-r6-ext.h \ MaxHcContextSpace-r5.h \ MeasurementCapability-r4.h \ MeasurementCommandWithType.h \ MeasurementCommandWithType-r4.h \ MeasurementCommandWithType-r6.h \ OngoingMeasRep.h \ OngoingMeasRep-r4.h \ OngoingMeasRep-r5.h \ OngoingMeasRep-r6.h \ OngoingMeasRepList.h \ OngoingMeasRepList-r4.h \ OngoingMeasRepList-r5.h \ OngoingMeasRepList-r6.h \ PDCP-Capability-r4.h \ PDCP-Capability-r5.h \ PDCP-Capability-r6.h \ PhysicalChannelCapability-r4.h \ PhysicalChannelCapability-r5.h \ RF-Capability-r4.h \ RFC3095-ContextInfo.h \ RFC3095-Context-List.h \ RLC-Capability-r5.h \ SRB-SpecificIntegrityProtInfo.h \ SRB-SpecificIntegrityProtInfoList.h \ StateOfRRC.h \ StateOfRRC-Procedure.h \ TotalRLC-AM-BufferSize-r5.h \ TPC-Combination-Info.h \ UE-MultiModeRAT-Capability-r5.h \ UE-Positioning-Capability-r4.h \ UE-Positioning-LastKnownPos.h \ UE-RadioAccessCapability-r4.h \ UE-RadioAccessCapability-r5.h \ UE-RadioAccessCapability-r6.h \ UE-RadioAccessCapability-r7.h \ UL-RFC3095-Context.h ASN_MODULE_HEADERS+=BOOLEAN.h ASN_MODULE_SOURCES+=BOOLEAN.c ASN_MODULE_HEADERS+=INTEGER.h ASN_MODULE_HEADERS+=NativeEnumerated.h ASN_MODULE_SOURCES+=INTEGER.c ASN_MODULE_HEADERS+=NULL.h ASN_MODULE_SOURCES+=NULL.c ASN_MODULE_SOURCES+=NativeEnumerated.c ASN_MODULE_HEADERS+=NativeInteger.h ASN_MODULE_SOURCES+=NativeInteger.c ASN_MODULE_HEADERS+=asn_SEQUENCE_OF.h ASN_MODULE_SOURCES+=asn_SEQUENCE_OF.c ASN_MODULE_HEADERS+=asn_SET_OF.h ASN_MODULE_SOURCES+=asn_SET_OF.c ASN_MODULE_HEADERS+=constr_CHOICE.h ASN_MODULE_SOURCES+=constr_CHOICE.c ASN_MODULE_HEADERS+=constr_SEQUENCE.h ASN_MODULE_SOURCES+=constr_SEQUENCE.c ASN_MODULE_HEADERS+=constr_SEQUENCE_OF.h ASN_MODULE_SOURCES+=constr_SEQUENCE_OF.c ASN_MODULE_HEADERS+=constr_SET_OF.h ASN_MODULE_SOURCES+=constr_SET_OF.c ASN_MODULE_HEADERS+=asn_application.h ASN_MODULE_HEADERS+=asn_system.h ASN_MODULE_HEADERS+=asn_codecs.h ASN_MODULE_HEADERS+=asn_internal.h ASN_MODULE_HEADERS+=OCTET_STRING.h ASN_MODULE_SOURCES+=OCTET_STRING.c ASN_MODULE_HEADERS+=BIT_STRING.h ASN_MODULE_SOURCES+=BIT_STRING.c ASN_MODULE_SOURCES+=asn_codecs_prim.c ASN_MODULE_HEADERS+=asn_codecs_prim.h ASN_MODULE_HEADERS+=ber_tlv_length.h ASN_MODULE_SOURCES+=ber_tlv_length.c ASN_MODULE_HEADERS+=ber_tlv_tag.h ASN_MODULE_SOURCES+=ber_tlv_tag.c ASN_MODULE_HEADERS+=ber_decoder.h ASN_MODULE_SOURCES+=ber_decoder.c ASN_MODULE_HEADERS+=der_encoder.h ASN_MODULE_SOURCES+=der_encoder.c ASN_MODULE_HEADERS+=constr_TYPE.h ASN_MODULE_SOURCES+=constr_TYPE.c ASN_MODULE_HEADERS+=constraints.h ASN_MODULE_SOURCES+=constraints.c ASN_MODULE_HEADERS+=xer_support.h ASN_MODULE_SOURCES+=xer_support.c ASN_MODULE_HEADERS+=xer_decoder.h ASN_MODULE_SOURCES+=xer_decoder.c ASN_MODULE_HEADERS+=xer_encoder.h ASN_MODULE_SOURCES+=xer_encoder.c ASN_MODULE_HEADERS+=per_support.h ASN_MODULE_SOURCES+=per_support.c ASN_MODULE_HEADERS+=per_decoder.h ASN_MODULE_SOURCES+=per_decoder.c ASN_MODULE_HEADERS+=per_encoder.h ASN_MODULE_SOURCES+=per_encoder.c ASN_MODULE_HEADERS+=per_opentype.h ASN_MODULE_SOURCES+=per_opentype.c ASN_CONVERTER_SOURCES+=converter-sample.c ASN_CONVERTER_SOURCES+=pdu_collection.c lib_LTLIBRARIES=libsomething.la libsomething_la_SOURCES=$(ASN_MODULE_SOURCES) $(ASN_MODULE_HEADERS) # This file may be used as an input for make(3) # Remove the lines below to convert it into a pure .am file TARGET = rrc-dump CFLAGS += -DHAVE_CONFIG_H -DJUNKTEST -DPDU=DL_DCCH_Message -DASN_PDU_COLLECTION -I. OBJS=${ASN_MODULE_SOURCES:.c=.o} ${ASN_CONVERTER_SOURCES:.c=.o} all: DL-DCCH-Message.c $(TARGET) $(TARGET): ${OBJS} $(CC) $(CFLAGS) -o $(TARGET) ${OBJS} $(LDFLAGS) $(LIBS) .SUFFIXES: .SUFFIXES: .c .o .c.o: $(CC) $(CFLAGS) -o $@ -c $< clean: rm -f $(TARGET) rm -f $(OBJS) regen: regenerate-from-asn1-source regenerate-from-asn1-source: ../../asn1c/asn1c -S ../../skeletons -pdu=DL-DCCH-Message -pdu=auto -fcompound-names -gen-PER ../rrc-7.1.0.asn1 DL-DCCH-Message.c: ../sample.makefile.regen ../rrc-7.1.0.asn1 make regen-makefile @touch DL-DCCH-Message.c make regen-makefile: ASN1CMDOPTS="-pdu=auto -fcompound-names -gen-PER" \ ASN1MODULES="../rrc-7.1.0.asn1" \ ASN1PDU=DL-DCCH-Message \ PROGNAME=rrc-dump \ ../sample.makefile.regen check: ${TARGET} check-ber check-xer check-per @echo ================ @echo All tests passed @echo ================ check-ber: @if test -f sample-DL-DCCH-Message-1.[db]er ; then \ for f in sample-DL-DCCH-Message-*.[db]er; do \ for b in 1 17 33 980 8192; do \ echo "Recoding $$f into XER and back ($$b)..."; \ ./${TARGET} -b $$b -iber -oxer $$f > ./.tmp.1.$$$$ || exit 2; \ ./${TARGET} -b $$b -ixer -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \ diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 4; \ rm -f ./.tmp.[12].$$$$; \ echo "Test junking $$f (please wait)..."; \ ./${TARGET} -J0.0001 -n 1000 -b $$b -iber -onull $$f || exit 5; \ ./${TARGET} -J0.001 -n 1000 -b $$b -iber -onull $$f || exit 6; \ done; done; fi check-xer: @if test -f sample-DL-DCCH-Message-1.xer ; then \ for f in sample-DL-DCCH-Message-*.xer; do \ for b in 1 17 33 980 8192; do \ echo "Recoding $$f into DER and back ($$b)..."; \ ./${TARGET} -b $$b -ixer -oder $$f > ./.tmp.1.$$$$ || exit 2; \ ./${TARGET} -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \ diff $$f ./.tmp.2.$$$$ || exit 4; \ rm -f ./.tmp.[12].$$$$; \ echo "Test junking $$f (please wait)..."; \ ./${TARGET} -J0.0001 -n 1000 -b $$b -ixer -onull $$f || exit 5; \ ./${TARGET} -J0.001 -n 1000 -b $$b -ixer -onull $$f || exit 6; \ done; done; fi check-per: @if test -f sample-DL-DCCH-Message-1-nopad.per ; then \ for f in sample-DL-DCCH-Message-[1-9]-nopad.per; do \ for b in 1 17 33 980 8192; do \ echo "Recoding non-padded $$f into DER into XER and back ($$b)..."; \ ./${TARGET} -b $$b -per-nopad -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \ ./${TARGET} -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \ ./${TARGET} -b $$b -ixer -oder ./.tmp.2.$$$$ > ./.tmp.3.$$$$ || exit 4; \ diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 5; \ rm -f ./.tmp.[123].$$$$; \ echo "Test junking $$f (please wait)..."; \ ./${TARGET} -J0.0001 -n 1000 -b $$b -per-nopad -iper -onull $$f || exit 6; \ ./${TARGET} -J0.001 -n 1000 -b $$b -per-nopad -iper -onull $$f || exit 7; \ done; done; fi @if test -f sample-DL-DCCH-Message-1.per ; then \ for f in sample-*-[1-9].per; do \ pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z-]+)-[0-9].*/\1/"`; \ for b in 1 17 33 980 8192; do \ echo "Recoding $$f into DER into XER and back ($$b)..."; \ ./${TARGET} -b $$b -p $$pdu -iper -oder $$f > ./.tmp.1.$$$$ || exit 3; \ ./${TARGET} -b $$b -p $$pdu -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 4; \ ./${TARGET} -b $$b -p $$pdu -ixer -oper ./.tmp.2.$$$$ > ./.tmp.1.$$$$ || exit 5; \ diff $$f ./.tmp.1.$$$$ || exit 6; \ rm -f ./.tmp.[12].$$$$; \ echo "Test junking $$f (please wait)..."; \ ./${TARGET} -J0.0001 -n 1000 -b $$b -iper -onull $$f || exit 7; \ ./${TARGET} -J0.001 -n 1000 -b $$b -iper -onull $$f || exit 8; \ done; done; fi distclean: clean rm -f $(ASN_MODULE_SOURCES) rm -f $(ASN_MODULE_HEADERS) rm -f $(ASN_CONVERTER_SOURCES) $(ASN_CONVERTER_HEADERS) rm -f Makefile.am.sample asn1c-0.9.28+dfsg/examples/sample.source.RRC/sample-DL-CCCH-Message-2-nopad.per0000644000000000000000000000015313065714043025065 0ustar rootroot0&C=「HンL81齡ノIモ邃0agナRア謚ツ躇担蟀@RァヘIヤ)ヌ モ雍jユムJワ2e磁r9P。 b8asn1c-0.9.28+dfsg/examples/sample.source.RRC/README0000644000000000000000000000222113065714043020137 0ustar rootroot GENERAL INFORMATION =================== The 3GPP TS 25.331 version 7.1.0 RRC (Radio Resource Control) PER decoder. Invoking `make` will compile the ASN.1 specifications from the ../rrc-7.1.0.asn1 file. OBTAINING THE RRC SPECIFICATION ================================ To obtain a different version of RRC ASN.1 specification, you should go to http://www.3gpp.org/ftp/Specs/html-info/25331.htm and download any version of RRC specification you like. A .ZIP file with a Microsoft Word .DOC files will download shortly. You should extract the ASN.1 modules from the chapter 11 of that .DOC file. Be careful not to copy any preambles, chapter titles and other non-ASN.1 text. rrc-dump USAGE ============== The rrc-dump utility may be used to dump the contents of a PER-encoded RRC protocol data unit. Since RRC specification contains multiple PDUs, a PDU must be selected manually using -p command line option: ./rrc-dump -p DL-DCCH-Message message.per ./rrc-dump -p PCCH-Message message.per The list of recognized PDUs may be obtained using `-p list`. The full list of recognized command line options may be obtained with > ./rrc-dump -h asn1c-0.9.28+dfsg/examples/sample.source.RRC/sample-BCCH-BCH-Message-2.per0000644000000000000000000000002613065714043024061 0ustar rootroot.VUUUUYY頬・U"ォZェ asn1c-0.9.28+dfsg/examples/sample.source.RRC/sample-DL-DCCH-Message-1-nopad.per0000644000000000000000000000001413065714043025061 0ustar rootroot`@`/asn1c-0.9.28+dfsg/examples/sample.source.RRC/sample-DL-DCCH-Message-1.per0000644000000000000000000000001613065714043023764 0ustar rootrootタタ_@asn1c-0.9.28+dfsg/examples/sample.source.RRC/config.h0000644000000000000000000000031013065714043020672 0ustar rootroot extern int opt_debug; #define ASN_DEBUG(fmt, args...) do { \ if(opt_debug < 2) break; \ fprintf(stderr, fmt, ##args); \ fprintf(stderr, " (%s:%d)\n", \ __FILE__, __LINE__); \ } while(0) asn1c-0.9.28+dfsg/examples/rrc-7.1.0.asn10000644000000000000000000260535113065714043016104 0ustar rootroot/* * Radio Resource Control Technical Specification ASN.1 module. * 3GPP 25.331 (TS 125 331) (ETSI ref RTS/TSGR-0225331v710) [2006-06] * Extracted and verified by Lev Walkin * * DO NOT REDISTRIBUTE. Obtain your own copy of 3GPP RRC specification * if you need to create products based on this RRC ASN.1 module. * * The ETSI has granted me the right to reproduce this ASN.1 RRC * (Radio Resource Control) module as part of asn1c provided that I insert * the following paragraph: * * 3GPP邃「 TSs and TRs are the property of ARIB, ATIS, ETSI, CCSA, TTA and TTC * who jointly own the copyright in them. They are subject to further * modifications and are therefore provided to you "as is" for information * purposes only. Further use is strictly prohibited. */ Class-definitions DEFINITIONS AUTOMATIC TAGS ::= BEGIN IMPORTS ActiveSetUpdate, ActiveSetUpdateComplete, ActiveSetUpdateFailure, AssistanceDataDelivery, CellChangeOrderFromUTRAN, CellChangeOrderFromUTRANFailure, CellUpdate, CellUpdateConfirm-CCCH, CellUpdateConfirm, CounterCheck, CounterCheckResponse, DownlinkDirectTransfer, HandoverToUTRANComplete, InitialDirectTransfer, HandoverFromUTRANCommand-GERANIu, HandoverFromUTRANCommand-GSM, HandoverFromUTRANCommand-CDMA2000, HandoverFromUTRANFailure, MBMSAccessInformation, MBMSCommonPTMRBInformation, MBMSCurrentCellPTMRBInformation, MBMSGeneralInformation, MBMSModificationRequest, MBMSModifiedServicesInformation, MBMSNeighbouringCellPTMRBInformation, MBMSSchedulingInformation, MBMSUnmodifiedServicesInformation, MeasurementControl, MeasurementControlFailure, MeasurementReport, PagingType1, PagingType2, PhysicalChannelReconfiguration, PhysicalChannelReconfigurationComplete, PhysicalChannelReconfigurationFailure, PhysicalSharedChannelAllocation, PUSCHCapacityRequest, RadioBearerReconfiguration, RadioBearerReconfigurationComplete, RadioBearerReconfigurationFailure, RadioBearerRelease, RadioBearerReleaseComplete, RadioBearerReleaseFailure, RadioBearerSetup, RadioBearerSetupComplete, RadioBearerSetupFailure, RRCConnectionReject, RRCConnectionRelease, RRCConnectionRelease-CCCH, RRCConnectionReleaseComplete, RRCConnectionRequest, RRCConnectionSetup, RRCConnectionSetupComplete, RRCStatus, SecurityModeCommand, SecurityModeComplete, SecurityModeFailure, SignallingConnectionRelease, SignallingConnectionReleaseIndication, SystemInformation-BCH, SystemInformation-FACH, SystemInformationChangeIndication, TransportChannelReconfiguration, TransportChannelReconfigurationComplete, TransportChannelReconfigurationFailure, TransportFormatCombinationControl, TransportFormatCombinationControlFailure, UECapabilityEnquiry, UECapabilityInformation, UECapabilityInformationConfirm, UplinkDirectTransfer, UplinkPhysicalChannelControl, URAUpdate, URAUpdateConfirm, URAUpdateConfirm-CCCH, UTRANMobilityInformation, UTRANMobilityInformationConfirm, UTRANMobilityInformationFailure FROM PDU-definitions -- User Equipment IEs : IntegrityCheckInfo FROM InformationElements; --************************************************************** -- -- Downlink DCCH messages -- --************************************************************** DL-DCCH-Message ::= SEQUENCE { integrityCheckInfo IntegrityCheckInfo OPTIONAL, message DL-DCCH-MessageType } DL-DCCH-MessageType ::= CHOICE { activeSetUpdate ActiveSetUpdate, assistanceDataDelivery AssistanceDataDelivery, cellChangeOrderFromUTRAN CellChangeOrderFromUTRAN, cellUpdateConfirm CellUpdateConfirm, counterCheck CounterCheck, downlinkDirectTransfer DownlinkDirectTransfer, handoverFromUTRANCommand-GSM HandoverFromUTRANCommand-GSM, handoverFromUTRANCommand-CDMA2000 HandoverFromUTRANCommand-CDMA2000, measurementControl MeasurementControl, pagingType2 PagingType2, physicalChannelReconfiguration PhysicalChannelReconfiguration, physicalSharedChannelAllocation PhysicalSharedChannelAllocation, radioBearerReconfiguration RadioBearerReconfiguration, radioBearerRelease RadioBearerRelease, radioBearerSetup RadioBearerSetup, rrcConnectionRelease RRCConnectionRelease, securityModeCommand SecurityModeCommand, signallingConnectionRelease SignallingConnectionRelease, transportChannelReconfiguration TransportChannelReconfiguration, transportFormatCombinationControl TransportFormatCombinationControl, ueCapabilityEnquiry UECapabilityEnquiry, ueCapabilityInformationConfirm UECapabilityInformationConfirm, uplinkPhysicalChannelControl UplinkPhysicalChannelControl, uraUpdateConfirm URAUpdateConfirm, utranMobilityInformation UTRANMobilityInformation, handoverFromUTRANCommand-GERANIu HandoverFromUTRANCommand-GERANIu, mbmsModifiedServicesInformation MBMSModifiedServicesInformation, spare5 NULL, spare4 NULL, spare3 NULL, spare2 NULL, spare1 NULL } --************************************************************** -- -- Uplink DCCH messages -- --************************************************************** UL-DCCH-Message ::= SEQUENCE { integrityCheckInfo IntegrityCheckInfo OPTIONAL, message UL-DCCH-MessageType } UL-DCCH-MessageType ::= CHOICE { activeSetUpdateComplete ActiveSetUpdateComplete, activeSetUpdateFailure ActiveSetUpdateFailure, cellChangeOrderFromUTRANFailure CellChangeOrderFromUTRANFailure, counterCheckResponse CounterCheckResponse, handoverToUTRANComplete HandoverToUTRANComplete, initialDirectTransfer InitialDirectTransfer, handoverFromUTRANFailure HandoverFromUTRANFailure, measurementControlFailure MeasurementControlFailure, measurementReport MeasurementReport, physicalChannelReconfigurationComplete PhysicalChannelReconfigurationComplete, physicalChannelReconfigurationFailure PhysicalChannelReconfigurationFailure, radioBearerReconfigurationComplete RadioBearerReconfigurationComplete, radioBearerReconfigurationFailure RadioBearerReconfigurationFailure, radioBearerReleaseComplete RadioBearerReleaseComplete, radioBearerReleaseFailure RadioBearerReleaseFailure, radioBearerSetupComplete RadioBearerSetupComplete, radioBearerSetupFailure RadioBearerSetupFailure, rrcConnectionReleaseComplete RRCConnectionReleaseComplete, rrcConnectionSetupComplete RRCConnectionSetupComplete, rrcStatus RRCStatus, securityModeComplete SecurityModeComplete, securityModeFailure SecurityModeFailure, signallingConnectionReleaseIndication SignallingConnectionReleaseIndication, transportChannelReconfigurationComplete TransportChannelReconfigurationComplete, transportChannelReconfigurationFailure TransportChannelReconfigurationFailure, transportFormatCombinationControlFailure TransportFormatCombinationControlFailure, ueCapabilityInformation UECapabilityInformation, uplinkDirectTransfer UplinkDirectTransfer, utranMobilityInformationConfirm UTRANMobilityInformationConfirm, utranMobilityInformationFailure UTRANMobilityInformationFailure, mbmsModificationRequest MBMSModificationRequest, spare1 NULL } --************************************************************** -- -- Downlink CCCH messages -- --************************************************************** DL-CCCH-Message ::= SEQUENCE { integrityCheckInfo IntegrityCheckInfo OPTIONAL, message DL-CCCH-MessageType } DL-CCCH-MessageType ::= CHOICE { cellUpdateConfirm CellUpdateConfirm-CCCH, rrcConnectionReject RRCConnectionReject, rrcConnectionRelease RRCConnectionRelease-CCCH, rrcConnectionSetup RRCConnectionSetup, uraUpdateConfirm URAUpdateConfirm-CCCH, spare3 NULL, spare2 NULL, spare1 NULL } --************************************************************** -- -- Uplink CCCH messages -- --************************************************************** UL-CCCH-Message ::= SEQUENCE { integrityCheckInfo IntegrityCheckInfo OPTIONAL, message UL-CCCH-MessageType } UL-CCCH-MessageType ::= CHOICE { cellUpdate CellUpdate, rrcConnectionRequest RRCConnectionRequest, uraUpdate URAUpdate, spare NULL } --************************************************************** -- -- PCCH messages -- --************************************************************** PCCH-Message ::= SEQUENCE { message PCCH-MessageType } PCCH-MessageType ::= CHOICE { pagingType1 PagingType1, spare NULL } --************************************************************** -- -- Downlink SHCCH messages -- --************************************************************** DL-SHCCH-Message ::= SEQUENCE { message DL-SHCCH-MessageType } DL-SHCCH-MessageType ::= CHOICE { physicalSharedChannelAllocation PhysicalSharedChannelAllocation, spare NULL } --************************************************************** -- -- Uplink SHCCH messages -- --************************************************************** UL-SHCCH-Message ::= SEQUENCE { message UL-SHCCH-MessageType } UL-SHCCH-MessageType ::= CHOICE { puschCapacityRequest PUSCHCapacityRequest, spare NULL } --************************************************************** -- -- BCCH messages sent on FACH -- --************************************************************** BCCH-FACH-Message ::= SEQUENCE { message BCCH-FACH-MessageType } BCCH-FACH-MessageType ::= CHOICE { systemInformation SystemInformation-FACH, systemInformationChangeIndication SystemInformationChangeIndication, spare2 NULL, spare1 NULL } --************************************************************** -- -- BCCH messages sent on BCH -- --************************************************************** BCCH-BCH-Message ::= SEQUENCE { message SystemInformation-BCH } --************************************************************** -- -- MCCH messages -- --************************************************************** MCCH-Message ::= SEQUENCE { message MCCH-MessageType } MCCH-MessageType ::= CHOICE { mbmsAccessInformation MBMSAccessInformation, mbmsCommonPTMRBInformation MBMSCommonPTMRBInformation, mbmsCurrentCellPTMRBInformation MBMSCurrentCellPTMRBInformation, mbmsGeneralInformation MBMSGeneralInformation, mbmsModifiedServicesInformation MBMSModifiedServicesInformation, mbmsNeighbouringCellPTMRBInformation MBMSNeighbouringCellPTMRBInformation, mbmsUnmodifiedServicesInformation MBMSUnmodifiedServicesInformation, spare9 NULL, spare8 NULL, spare7 NULL, spare6 NULL, spare5 NULL, spare4 NULL, spare3 NULL, spare2 NULL, spare1 NULL } --************************************************************** -- -- MSCH messages -- --************************************************************** MSCH-Message ::= SEQUENCE { message MSCH-MessageType } MSCH-MessageType ::= CHOICE { mbmsSchedulingInformation MBMSSchedulingInformation, spare3 NULL, spare2 NULL, spare1 NULL } END --************************************************************** -- -- TABULAR: The message type and integrity check info are not -- visible in this module as they are defined in the class module. -- Also, all FDD/TDD specific choices have the FDD option first -- and TDD second, just for consistency. -- --************************************************************** PDU-definitions DEFINITIONS AUTOMATIC TAGS ::= BEGIN --************************************************************** -- -- IE parameter types from other modules -- --************************************************************** IMPORTS -- Core Network IEs : CN-DomainIdentity, CN-InformationInfo, CN-InformationInfo-r6, CN-InformationInfoFull, NAS-Message, PagingRecordTypeID, PLMN-Identity, -- UTRAN Mobility IEs : CellIdentity, CellIdentity-PerRL-List, URA-Identity, -- User Equipment IEs : UE-RadioAccessCapabilityComp-r7, UE-RadioAccessCapability-v7xyext, UE-RadioAccessCapabBandFDDList2, UE-RadioAccessCapabBandFDDList-ext, AccessStratumReleaseIndicator, ActivationTime, C-RNTI, CapabilityUpdateRequirement, CapabilityUpdateRequirement-r4, CapabilityUpdateRequirement-r4-ext, CapabilityUpdateRequirement-r5, CapabilityUpdateRequirement-r7-ext, CellUpdateCause, CellUpdateCause-ext, CipheringAlgorithm, CipheringModeInfo, DelayRestrictionFlag, DSCH-RNTI, E-RNTI, EstablishmentCause, FailureCauseWithProtErr, FailureCauseWithProtErrTrId, GroupReleaseInformation, H-RNTI, UESpecificBehaviourInformation1idle, UESpecificBehaviourInformation1interRAT, InitialUE-Identity, IntegrityProtActivationInfo, IntegrityProtectionModeInfo, N-308, PagingCause, PagingRecordList, PagingRecord2List-r5, ProtocolErrorIndicator, ProtocolErrorIndicatorWithMoreInfo, RadioFrequencyBandTDDList, Rb-timer-indicator, RedirectionInfo, RedirectionInfo-r6, RejectionCause, ReleaseCause, RF-CapabilityComp, RRC-StateIndicator, RRC-TransactionIdentifier, SecurityCapability, START-Value, STARTList, SystemSpecificCapUpdateReq-v590ext, U-RNTI, U-RNTI-Short, UE-CapabilityContainer-IEs, UE-RadioAccessCapability, UE-RadioAccessCapability-v370ext, UE-RadioAccessCapability-v380ext, UE-RadioAccessCapability-v3a0ext, UE-RadioAccessCapability-v3g0ext, UE-RadioAccessCapability-v4b0ext, UE-RadioAccessCapability-v590ext, UE-RadioAccessCapability-v5c0ext, UE-RadioAccessCapability-v650ext, UE-RadioAccessCapability-v680ext, UE-RadioAccessCapabilityComp, UE-RadioAccessCapabilityComp-ext, UE-RadioAccessCapabilityComp2, DL-PhysChCapabilityFDD-v380ext, UE-ConnTimersAndConstants, UE-ConnTimersAndConstants-v3a0ext, UE-ConnTimersAndConstants-r5, UE-SecurityInformation, UE-SecurityInformation2, URA-UpdateCause, UTRAN-DRX-CycleLengthCoefficient, WaitTime, -- Radio Bearer IEs : DefaultConfigIdentity, DefaultConfigIdentity-r4, DefaultConfigIdentity-r5, DefaultConfigIdentity-r6, DefaultConfigMode, DL-CounterSynchronisationInfo, DL-CounterSynchronisationInfo-r5, PDCP-ROHC-TargetMode, PredefinedConfigIdentity, PredefinedConfigStatusList, PredefinedConfigStatusListComp, PredefinedConfigSetWithDifferentValueTag, RAB-Info, RAB-Info-r6, RAB-Info-Post, RAB-InformationList, RAB-InformationList-r6, RAB-InformationReconfigList, RAB-InformationSetupList, RAB-InformationSetupList-r4, RAB-InformationSetupList-r5, RAB-InformationSetupList-r6-ext, RAB-InformationSetupList-r6, RB-ActivationTimeInfoList, RB-COUNT-C-InformationList, RB-COUNT-C-MSB-InformationList, RB-IdentityList, RB-InformationAffectedList, RB-InformationAffectedList-r5, RB-InformationAffectedList-r6, RB-InformationChangedList-r6, RB-InformationReconfigList, RB-InformationReconfigList-r4, RB-InformationReconfigList-r5, RB-InformationReconfigList-r6, RB-InformationReleaseList, RB-PDCPContextRelocationList, SRB-InformationSetupList, SRB-InformationSetupList-r5, SRB-InformationSetupList-r6, SRB-InformationSetupList2, SRB-InformationSetupList2-r6, UL-CounterSynchronisationInfo, -- Transport Channel IEs: CPCH-SetID, DL-AddReconfTransChInfo2List, DL-AddReconfTransChInfoList, DL-AddReconfTransChInfoList-r4, DL-AddReconfTransChInfoList-r5, DL-CommonTransChInfo, DL-CommonTransChInfo-r4, DL-DeletedTransChInfoList, DL-DeletedTransChInfoList-r5, DRAC-StaticInformationList, PowerOffsetInfoShort, TFC-Subset, TFCS-Identity, UL-AddReconfTransChInfoList, UL-AddReconfTransChInfoList-r6, UL-CommonTransChInfo, UL-CommonTransChInfo-r4, UL-DeletedTransChInfoList, UL-DeletedTransChInfoList-r6, -- Physical Channel IEs : Alpha, BEACON-PL-Est, CCTrCH-PowerControlInfo, CCTrCH-PowerControlInfo-r4, CCTrCH-PowerControlInfo-r5, CCTrCH-PowerControlInfo-r7, ConstantValue, ConstantValueTdd, CPCH-SetInfo, DHS-Sync, DL-CommonInformation, DL-CommonInformation-r4, DL-CommonInformation-r5, DL-CommonInformation-r6, DL-CommonInformation-r7, DL-CommonInformationPost, DL-HSPDSCH-Information, DL-HSPDSCH-Information-r6, DL-HSPDSCH-Information-r7, DL-InformationPerRL-List, DL-InformationPerRL-List-r4, DL-InformationPerRL-List-r5, DL-InformationPerRL-List-r5bis, DL-InformationPerRL-List-r6, DL-InformationPerRL-List-r7, DL-InformationPerRL-ListPostFDD, DL-InformationPerRL-PostTDD, DL-InformationPerRL-PostTDD-LCR-r4, DL-PDSCH-Information, DL-TPC-PowerOffsetPerRL-List, DPC-Mode, DPCH-CompressedModeStatusInfo, DynamicPersistenceLevel, E-DCH-ReconfigurationInfo, EXT-UL-TimingAdvance, FrequencyInfo, FrequencyInfoFDD, FrequencyInfoTDD, HARQ-Preamble-Mode, HS-SICH-Power-Control-Info-TDD384, HS-SICH-Power-Control-Info-TDD768, MaxAllowedUL-TX-Power, OpenLoopPowerControl-IPDL-TDD-r4, PDSCH-CapacityAllocationInfo, PDSCH-CapacityAllocationInfo-r4, PDSCH-CapacityAllocationInfo-r7, PDSCH-Identity, PrimaryCPICH-Info, PrimaryCCPCH-TX-Power, PUSCH-CapacityAllocationInfo, PUSCH-CapacityAllocationInfo-r4, PUSCH-CapacityAllocationInfo-r7, PUSCH-Identity, PUSCH-SysInfoList-HCR-r5, PDSCH-SysInfoList-HCR-r5, RL-AdditionInformationList, RL-AdditionInformationList-r6, RL-RemovalInformationList, Serving-HSDSCH-CellInformation, SpecialBurstScheduling, SSDT-Information, SSDT-Information-r4, TFC-ControlDuration, SSDT-UL, TimingMaintainedSynchInd, TimeslotList, TimeslotList-r4, TX-DiversityMode, UL-ChannelRequirement, UL-ChannelRequirement-r4, UL-ChannelRequirement-r5, UL-ChannelRequirementWithCPCH-SetID, UL-ChannelRequirementWithCPCH-SetID-r4, UL-ChannelRequirementWithCPCH-SetID-r5, UL-DPCH-Info, UL-DPCH-Info-r4, UL-DPCH-Info-r5, UL-DPCH-Info-r6, UL-DPCH-Info-r7, UL-DPCH-InfoPostFDD, UL-DPCH-InfoPostTDD, UL-DPCH-InfoPostTDD-LCR-r4, UL-EDCH-Information-r6, UL-SynchronisationParameters-r4, UL-TimingAdvance, UL-TimingAdvanceControl, UL-TimingAdvanceControl-r4, UL-TimingAdvanceControl-r7, UL-TimingAdvance-VHCR, -- Measurement IEs : AdditionalMeasurementID-List, DeltaRSCP, Frequency-Band, EventResults, Inter-FreqEventCriteriaList-v590ext, Intra-FreqEventCriteriaList-v590ext, IntraFreqReportingCriteria-1b-r5, IntraFreqEvent-1d-r5, IntraFreqCellID, InterFreqEventResults-LCR-r4-ext, InterRATCellInfoIndication, InterRAT-TargetCellDescription, MeasuredResults, MeasuredResults-v390ext, MeasuredResults-v590ext, MeasuredResultsList, MeasuredResultsList-LCR-r4-ext, MeasuredResultsOnRACH, MeasuredResultsOnRACHinterFreq, MeasurementCommand, MeasurementCommand-r4, MeasurementCommand-r6, MeasurementIdentity, MeasurementReportingMode, PrimaryCCPCH-RSCP, SFN-Offset-Validity, TimeslotListWithISCP, TrafficVolumeMeasuredResultsList, UE-Positioning-GPS-AssistanceData, UE-Positioning-Measurement-v390ext, UE-Positioning-Measurement-v7xyext, UE-Positioning-OTDOA-AssistanceData, UE-Positioning-OTDOA-AssistanceData-r4ext, UE-Positioning-OTDOA-AssistanceData-UEB, VelocityEstimate, UE-InternalMeasuredResults-r7, -- Other IEs : BCCH-ModificationInfo, CDMA2000-MessageList, GSM-TargetCellInfoList, GERANIu-MessageList, GERAN-SystemInformation, GSM-MessageList, InterRAT-ChangeFailureCause, InterRAT-HO-FailureCause, InterRAT-UE-RadioAccessCapabilityList, InterRAT-UE-RadioAccessCapability-v590ext, InterRAT-UE-SecurityCapList, IntraDomainNasNodeSelector, ProtocolErrorMoreInformation, Rplmn-Information, Rplmn-Information-r4, SegCount, SegmentIndex, SFN-Prime, SIB-Data-fixed, SIB-Data-variable, SIB-Type, -- MBMS IEs: MBMS-CellGroupIdentity-r6, MBMS-CommonRBInformationList-r6, MBMS-CurrentCell-SCCPCHList-r6, MBMS-JoinedInformation-r6, MBMS-MICHConfigurationInfo-r6, MBMS-MICHConfigurationInfo-r7, MBMS-ModifedServiceList-r6, MBMS-MSCH-ConfigurationInfo-r6, MBMS-NeighbouringCellSCCPCHList-r6, MBMS-NumberOfNeighbourCells-r6, MBMS-PhyChInformationList-r6, MBMS-PL-ServiceRestrictInfo-r6, MBMS-PreferredFreqRequest-r6, MBMS-PreferredFrequencyList-r6, MBMS-PTMActivationTime-r6, MBMS-ServiceAccessInfoList-r6, MBMS-ServiceIdentity-r6, MBMS-ServiceSchedulingInfoList-r6, MBMS-SIBType5-SCCPCHList-r6, MBMS-TimersAndCounters-r6, MBMS-TranspChInfoForEachCCTrCh-r6, MBMS-TranspChInfoForEachTrCh-r6, MBMS-UnmodifiedServiceList-r6 FROM InformationElements maxSIBperMsg, maxURNTI-Group FROM Constant-definitions; -- *************************************************** -- -- ACTIVE SET UPDATE (FDD only) -- -- *************************************************** ActiveSetUpdate ::= CHOICE { r3 SEQUENCE { activeSetUpdate-r3 ActiveSetUpdate-r3-IEs, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions activeSetUpdate-r3-add-ext BIT STRING OPTIONAL, v4b0NonCriticalExtensions SEQUENCE { activeSetUpdate-v4b0ext ActiveSetUpdate-v4b0ext-IEs, v590NonCriticalExtensions SEQUENCE { activeSetUpdate-v590ext ActiveSetUpdate-v590ext-IEs, v690NonCriticalExtensions SEQUENCE { activeSetUpdate-v690ext ActiveSetUpdate-v690ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL }, later-than-r3 SEQUENCE { rrc-TransactionIdentifier RRC-TransactionIdentifier, criticalExtensions CHOICE { r6 SEQUENCE { activeSetUpdate-r6 ActiveSetUpdate-r6-IEs, activeSetUpdate-r6-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL }, criticalExtensions SEQUENCE {} } } } ActiveSetUpdate-r3-IEs ::= SEQUENCE { -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier, -- dummy and dummy2 are not used in this version of the specification, they should -- not be sent and if received they should be ignored. dummy IntegrityProtectionModeInfo OPTIONAL, dummy2 CipheringModeInfo OPTIONAL, activationTime ActivationTime OPTIONAL, newU-RNTI U-RNTI OPTIONAL, -- Core network IEs cn-InformationInfo CN-InformationInfo OPTIONAL, -- Radio bearer IEs -- dummy3 is not used in this version of the specification, it should -- not be sent and if received it should be ignored. dummy3 DL-CounterSynchronisationInfo OPTIONAL, -- Physical channel IEs maxAllowedUL-TX-Power MaxAllowedUL-TX-Power OPTIONAL, rl-AdditionInformationList RL-AdditionInformationList OPTIONAL, rl-RemovalInformationList RL-RemovalInformationList OPTIONAL, tx-DiversityMode TX-DiversityMode OPTIONAL, -- dummy4 is not used in this version of the specification, it should -- not be sent and if received it should be ignored. dummy4 SSDT-Information OPTIONAL } ActiveSetUpdate-v4b0ext-IEs ::= SEQUENCE { -- Physical channel IEs -- dummy is not used in this version of the specification, it should -- not be sent and if received it should be ignored. dummy SSDT-UL OPTIONAL, -- The order of the RLs in IE cell-id-PerRL-List is the same as -- in IE RL-AdditionInformationList included in this message cell-id-PerRL-List CellIdentity-PerRL-List OPTIONAL } ActiveSetUpdate-v590ext-IEs ::= SEQUENCE { -- Physical channel IEs dpc-Mode DPC-Mode, dl-TPC-PowerOffsetPerRL-List DL-TPC-PowerOffsetPerRL-List OPTIONAL } ActiveSetUpdate-v690ext-IEs ::= SEQUENCE { -- Core network IEs primary-plmn-Identity PLMN-Identity OPTIONAL } ActiveSetUpdate-r6-IEs ::= SEQUENCE { -- User equipment IEs activationTime ActivationTime OPTIONAL, newU-RNTI U-RNTI OPTIONAL, newH-RNTI H-RNTI OPTIONAL, newPrimary-E-RNTI E-RNTI OPTIONAL, newSecondary-E-RNTI E-RNTI OPTIONAL, -- Core network IEs cn-InformationInfo CN-InformationInfo-r6 OPTIONAL, -- Physical channel IEs maxAllowedUL-TX-Power MaxAllowedUL-TX-Power OPTIONAL, rl-AdditionInformationList RL-AdditionInformationList-r6 OPTIONAL, rl-RemovalInformationList RL-RemovalInformationList OPTIONAL, tx-DiversityMode TX-DiversityMode OPTIONAL, dpc-Mode DPC-Mode OPTIONAL, serving-HSDSCH-CellInformation Serving-HSDSCH-CellInformation OPTIONAL, e-dch-ReconfigurationInfo E-DCH-ReconfigurationInfo OPTIONAL } -- *************************************************** -- -- ACTIVE SET UPDATE COMPLETE (FDD only) -- -- *************************************************** ActiveSetUpdateComplete ::= SEQUENCE { -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier, -- dummy is not used in this version of the specification, it should -- not be sent and if received it should be ignored. dummy IntegrityProtActivationInfo OPTIONAL, -- Radio bearer IEs -- dummy2 and dummy3 are not used in this version of the specification, they should -- not be sent and if received they should be ignored. dummy2 RB-ActivationTimeInfoList OPTIONAL, dummy3 UL-CounterSynchronisationInfo OPTIONAL, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions activeSetUpdateComplete-r3-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } -- *************************************************** -- -- ACTIVE SET UPDATE FAILURE (FDD only) -- -- *************************************************** ActiveSetUpdateFailure ::= SEQUENCE { -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier, failureCause FailureCauseWithProtErr, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions activeSetUpdateFailure-r3-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } -- *************************************************** -- -- Assistance Data Delivery -- -- *************************************************** AssistanceDataDelivery ::= CHOICE { r3 SEQUENCE { assistanceDataDelivery-r3 AssistanceDataDelivery-r3-IEs, v3a0NonCriticalExtensions SEQUENCE { assistanceDataDelivery-v3a0ext AssistanceDataDelivery-v3a0ext, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions assistanceDataDelivery-r3-add-ext BIT STRING OPTIONAL, v4b0NonCriticalExtensions SEQUENCE { assistanceDataDelivery-v4b0ext AssistanceDataDelivery-v4b0ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL }, later-than-r3 SEQUENCE { rrc-TransactionIdentifier RRC-TransactionIdentifier, criticalExtensions SEQUENCE {} } } AssistanceDataDelivery-r3-IEs ::= SEQUENCE { -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier, -- Measurement Information Elements ue-positioning-GPS-AssistanceData UE-Positioning-GPS-AssistanceData OPTIONAL, ue-positioning-OTDOA-AssistanceData-UEB UE-Positioning-OTDOA-AssistanceData-UEB OPTIONAL } AssistanceDataDelivery-v3a0ext ::= SEQUENCE { sfn-Offset-Validity SFN-Offset-Validity OPTIONAL } AssistanceDataDelivery-v4b0ext-IEs ::= SEQUENCE { ue-Positioning-OTDOA-AssistanceData-r4ext UE-Positioning-OTDOA-AssistanceData-r4ext OPTIONAL } -- *************************************************** -- -- CELL CHANGE ORDER FROM UTRAN -- -- *************************************************** CellChangeOrderFromUTRAN ::= CHOICE { r3 SEQUENCE { cellChangeOrderFromUTRAN-IEs CellChangeOrderFromUTRAN-r3-IEs, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions cellChangeOrderFromUTRAN-r3-add-ext BIT STRING OPTIONAL, v590NonCriticalExtensions SEQUENCE { cellChangeOrderFromUTRAN-v590ext CellChangeOrderFromUTRAN-v590ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL }, later-than-r3 SEQUENCE { rrc-TransactionIdentifier RRC-TransactionIdentifier, criticalExtensions SEQUENCE {} } } CellChangeOrderFromUTRAN-r3-IEs ::= SEQUENCE { -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier, -- dummy is not used in this version of the specification, it should -- not be sent and if received it should be ignored. dummy IntegrityProtectionModeInfo OPTIONAL, activationTime ActivationTime OPTIONAL, -- the IE rab-InformationList is not used in this version of the specification, it should -- not be sent and if received it should be ignored. The IE may be used in a later -- version of the protocol and hence it is not changed into a dummy rab-InformationList RAB-InformationList OPTIONAL, interRAT-TargetCellDescription InterRAT-TargetCellDescription } CellChangeOrderFromUTRAN-v590ext-IEs ::= SEQUENCE { geran-SystemInfoType CHOICE { sI GERAN-SystemInformation, pSI GERAN-SystemInformation } OPTIONAL } -- *************************************************** -- -- CELL CHANGE ORDER FROM UTRAN FAILURE -- -- *************************************************** CellChangeOrderFromUTRANFailure ::= CHOICE { r3 SEQUENCE { cellChangeOrderFromUTRANFailure-r3 CellChangeOrderFromUTRANFailure-r3-IEs, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions cellChangeOrderFromUTRANFailure-r3-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL }, -- dummy is not used in this version of the specification and it -- should be ignored. dummy SEQUENCE { rrc-TransactionIdentifier RRC-TransactionIdentifier, criticalExtensions SEQUENCE {} } } CellChangeOrderFromUTRANFailure-r3-IEs ::= SEQUENCE { -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier, -- dummy is not used in this version of the specification, it should -- not be sent and if received it should be ignored. dummy IntegrityProtectionModeInfo OPTIONAL, interRAT-ChangeFailureCause InterRAT-ChangeFailureCause } -- *************************************************** -- -- CELL UPDATE -- -- *************************************************** CellUpdate ::= SEQUENCE { -- User equipment IEs u-RNTI U-RNTI, startList STARTList, am-RLC-ErrorIndicationRb2-3or4 BOOLEAN, am-RLC-ErrorIndicationRb5orAbove BOOLEAN, cellUpdateCause CellUpdateCause, -- TABULAR: RRC transaction identifier is nested in FailureCauseWithProtErrTrId failureCause FailureCauseWithProtErrTrId OPTIONAL, rb-timer-indicator Rb-timer-indicator, -- Measurement IEs measuredResultsOnRACH MeasuredResultsOnRACH OPTIONAL, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions cellUpdate-r3-add-ext BIT STRING OPTIONAL, v590NonCriticalExtensions SEQUENCE { cellUpdate-v590ext CellUpdate-v590ext, v690NonCriticalExtensions SEQUENCE { cellUpdate-v690ext CellUpdate-v690ext-IEs, v7xyNonCriticalExtensions SEQUENCE { cellUpdate-v7xyext CellUpdate-v7xyext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } CellUpdate-v590ext ::= SEQUENCE { establishmentCause EstablishmentCause OPTIONAL } CellUpdate-v690ext-IEs ::= SEQUENCE { -- User equipment IEs cellUpdateCause-ext CellUpdateCause-ext OPTIONAL, trafficVolumeIndicator ENUMERATED { true } OPTIONAL, -- Measurement IEs measuredResultsOnRACHinterFreq MeasuredResultsOnRACHinterFreq OPTIONAL, reconfigurationStatusIndicator ENUMERATED { true } OPTIONAL } CellUpdate-v7xyext-IEs ::= SEQUENCE { -- Call Type IE csCallType ENUMERATED { speech, video, other, spare } OPTIONAL } -- *************************************************** -- -- CELL UPDATE CONFIRM -- -- *************************************************** CellUpdateConfirm ::= CHOICE { r3 SEQUENCE { cellUpdateConfirm-r3 CellUpdateConfirm-r3-IEs, v3a0NonCriticalExtensions SEQUENCE { cellUpdateConfirm-v3a0ext CellUpdateConfirm-v3a0ext, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions cellUpdateConfirm-r3-add-ext BIT STRING OPTIONAL, v4b0NonCriticalExtensions SEQUENCE { cellUpdateConfirm-v4b0ext CellUpdateConfirm-v4b0ext-IEs, v590NonCriticalExtenstions SEQUENCE { cellUpdateConfirm-v590ext CellUpdateConfirm-v590ext-IEs, v5d0NonCriticalExtenstions SEQUENCE { cellUpdateConfirm-v5d0ext CellUpdateConfirm-v5d0ext-IEs, v690NonCriticalExtensions SEQUENCE { cellUpdateConfirm-v690ext CellUpdateConfirm-v690ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL }, later-than-r3 SEQUENCE { rrc-TransactionIdentifier RRC-TransactionIdentifier, criticalExtensions CHOICE { r4 SEQUENCE { cellUpdateConfirm-r4 CellUpdateConfirm-r4-IEs, v4d0NonCriticalExtensions SEQUENCE { -- Container for adding non critical extensions after freezing REL-5 cellUpdateConfirm-r4-add-ext BIT STRING OPTIONAL, v590NonCriticalExtenstions SEQUENCE { cellUpdateConfirm-v590ext CellUpdateConfirm-v590ext-IEs, v5d0NonCriticalExtenstions SEQUENCE { cellUpdateConfirm-v5d0ext CellUpdateConfirm-v5d0ext-IEs, v690NonCriticalExtensions SEQUENCE { cellUpdateConfirm-v690ext CellUpdateConfirm-v690ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL }, criticalExtensions CHOICE { r5 SEQUENCE { cellUpdateConfirm-r5 CellUpdateConfirm-r5-IEs, -- Container for adding non critical extensions after freezing REL-6 cellUpdateConfirm-r5-add-ext BIT STRING OPTIONAL, v5d0NonCriticalExtenstions SEQUENCE { cellUpdateConfirm-v5d0ext CellUpdateConfirm-v5d0ext-IEs, v690NonCriticalExtensions SEQUENCE { cellUpdateConfirm-v690ext CellUpdateConfirm-v690ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL }, criticalExtensions CHOICE { r6 SEQUENCE { cellUpdateConfirm-r6 CellUpdateConfirm-r6-IEs, -- Container for adding non critical extensions after freezing REL-7 cellUpdateConfirm-r6-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL }, criticalExtensions CHOICE { r7 SEQUENCE { cellUpdateConfirm-r7 CellUpdateConfirm-r7-IEs, -- Container for adding non critical extensions after freezing REL-8 cellUpdateConfirm-r7-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL }, criticalExtensions SEQUENCE {} } } } } } } CellUpdateConfirm-r3-IEs ::= SEQUENCE { -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier, integrityProtectionModeInfo IntegrityProtectionModeInfo OPTIONAL, cipheringModeInfo CipheringModeInfo OPTIONAL, activationTime ActivationTime OPTIONAL, new-U-RNTI U-RNTI OPTIONAL, new-C-RNTI C-RNTI OPTIONAL, rrc-StateIndicator RRC-StateIndicator, utran-DRX-CycleLengthCoeff UTRAN-DRX-CycleLengthCoefficient OPTIONAL, rlc-Re-establishIndicatorRb2-3or4 BOOLEAN, rlc-Re-establishIndicatorRb5orAbove BOOLEAN, -- CN information elements cn-InformationInfo CN-InformationInfo OPTIONAL, -- UTRAN mobility IEs ura-Identity URA-Identity OPTIONAL, -- Radio bearer IEs rb-InformationReleaseList RB-InformationReleaseList OPTIONAL, rb-InformationReconfigList RB-InformationReconfigList OPTIONAL, rb-InformationAffectedList RB-InformationAffectedList OPTIONAL, dl-CounterSynchronisationInfo DL-CounterSynchronisationInfo OPTIONAL, -- Transport channel IEs ul-CommonTransChInfo UL-CommonTransChInfo OPTIONAL, ul-deletedTransChInfoList UL-DeletedTransChInfoList OPTIONAL, ul-AddReconfTransChInfoList UL-AddReconfTransChInfoList OPTIONAL, modeSpecificTransChInfo CHOICE { fdd SEQUENCE { -- dummy and dummy2 are not used in this version of the specification, they should -- not be sent and if received they should be ignored. dummy CPCH-SetID OPTIONAL, dummy2 DRAC-StaticInformationList OPTIONAL }, tdd NULL }, dl-CommonTransChInfo DL-CommonTransChInfo OPTIONAL, dl-DeletedTransChInfoList DL-DeletedTransChInfoList OPTIONAL, dl-AddReconfTransChInfoList DL-AddReconfTransChInfoList OPTIONAL, -- Physical channel IEs frequencyInfo FrequencyInfo OPTIONAL, maxAllowedUL-TX-Power MaxAllowedUL-TX-Power OPTIONAL, ul-ChannelRequirement UL-ChannelRequirement OPTIONAL, modeSpecificPhysChInfo CHOICE { fdd SEQUENCE { -- dummy is not used in this version of specification, it should -- not be sent and if received it should be ignored. dummy DL-PDSCH-Information OPTIONAL }, tdd NULL }, dl-CommonInformation DL-CommonInformation OPTIONAL, dl-InformationPerRL-List DL-InformationPerRL-List OPTIONAL } CellUpdateConfirm-v3a0ext ::= SEQUENCE { -- The IE 窶從ew-DSCH-RNTI窶 should not be included in FDD mode, and if received the UE behaviour -- is unspecified new-DSCH-RNTI DSCH-RNTI OPTIONAL } CellUpdateConfirm-v4b0ext-IEs ::= SEQUENCE { -- Physical channel IEs -- dummy is not used in this version of the specification, it should -- not be sent and if received it should be ignored. dummy SSDT-UL OPTIONAL, -- The order of the RLs in IE cell-id-PerRL-List is the same as -- in IE DL-InformationPerRL-List included in this message cell-id-PerRL-List CellIdentity-PerRL-List OPTIONAL } CellUpdateConfirm-v590ext-IEs ::= SEQUENCE { -- Physical channel IEs dl-TPC-PowerOffsetPerRL-List DL-TPC-PowerOffsetPerRL-List OPTIONAL } CellUpdateConfirm-v5d0ext-IEs ::= SEQUENCE { --Radio Bearer IEs pdcp-ROHC-TargetMode PDCP-ROHC-TargetMode OPTIONAL } CellUpdateConfirm-r4-IEs ::= SEQUENCE { -- User equipment IEs integrityProtectionModeInfo IntegrityProtectionModeInfo OPTIONAL, cipheringModeInfo CipheringModeInfo OPTIONAL, activationTime ActivationTime OPTIONAL, new-U-RNTI U-RNTI OPTIONAL, new-C-RNTI C-RNTI OPTIONAL, -- The IE 窶從ew-DSCH-RNTI窶 should not be included in FDD mode, and if received -- the UE behaviour is unspecified new-DSCH-RNTI DSCH-RNTI OPTIONAL, rrc-StateIndicator RRC-StateIndicator, utran-DRX-CycleLengthCoeff UTRAN-DRX-CycleLengthCoefficient OPTIONAL, rlc-Re-establishIndicatorRb2-3or4 BOOLEAN, rlc-Re-establishIndicatorRb5orAbove BOOLEAN, -- CN information elements cn-InformationInfo CN-InformationInfo OPTIONAL, -- UTRAN mobility IEs ura-Identity URA-Identity OPTIONAL, -- Radio bearer IEs rb-InformationReleaseList RB-InformationReleaseList OPTIONAL, rb-InformationReconfigList RB-InformationReconfigList-r4 OPTIONAL, rb-InformationAffectedList RB-InformationAffectedList OPTIONAL, dl-CounterSynchronisationInfo DL-CounterSynchronisationInfo OPTIONAL, -- Transport channel IEs ul-CommonTransChInfo UL-CommonTransChInfo-r4 OPTIONAL, ul-deletedTransChInfoList UL-DeletedTransChInfoList OPTIONAL, ul-AddReconfTransChInfoList UL-AddReconfTransChInfoList OPTIONAL, modeSpecificTransChInfo CHOICE { fdd SEQUENCE { -- dummy and dummy2 are not used in this version of the specification, they should -- not be sent and if received they should be ignored. dummy CPCH-SetID OPTIONAL, dummy2 DRAC-StaticInformationList OPTIONAL }, tdd NULL }, dl-CommonTransChInfo DL-CommonTransChInfo-r4 OPTIONAL, dl-DeletedTransChInfoList DL-DeletedTransChInfoList OPTIONAL, dl-AddReconfTransChInfoList DL-AddReconfTransChInfoList-r4 OPTIONAL, -- Physical channel IEs frequencyInfo FrequencyInfo OPTIONAL, maxAllowedUL-TX-Power MaxAllowedUL-TX-Power OPTIONAL, ul-ChannelRequirement UL-ChannelRequirement-r4 OPTIONAL, modeSpecificPhysChInfo CHOICE { fdd SEQUENCE { -- dummy is not used in this version of specification, it should -- not be sent and if received it should be ignored. dummy DL-PDSCH-Information OPTIONAL }, tdd NULL }, dl-CommonInformation DL-CommonInformation-r4 OPTIONAL, dl-InformationPerRL-List DL-InformationPerRL-List-r4 OPTIONAL } CellUpdateConfirm-r5-IEs ::= SEQUENCE { -- User equipment IEs integrityProtectionModeInfo IntegrityProtectionModeInfo OPTIONAL, cipheringModeInfo CipheringModeInfo OPTIONAL, activationTime ActivationTime OPTIONAL, new-U-RNTI U-RNTI OPTIONAL, new-C-RNTI C-RNTI OPTIONAL, -- The IE 窶從ew-DSCH-RNTI窶 should not be included in FDD mode, and if received -- the UE behaviour is unspecified new-DSCH-RNTI DSCH-RNTI OPTIONAL, new-H-RNTI H-RNTI OPTIONAL, rrc-StateIndicator RRC-StateIndicator, utran-DRX-CycleLengthCoeff UTRAN-DRX-CycleLengthCoefficient OPTIONAL, rlc-Re-establishIndicatorRb2-3or4 BOOLEAN, rlc-Re-establishIndicatorRb5orAbove BOOLEAN, -- CN information elements cn-InformationInfo CN-InformationInfo OPTIONAL, -- UTRAN mobility IEs ura-Identity URA-Identity OPTIONAL, -- Radio bearer IEs rb-InformationReleaseList RB-InformationReleaseList OPTIONAL, rb-InformationReconfigList RB-InformationReconfigList-r5 OPTIONAL, rb-InformationAffectedList RB-InformationAffectedList-r5 OPTIONAL, dl-CounterSynchronisationInfo DL-CounterSynchronisationInfo-r5 OPTIONAL, -- Transport channel IEs ul-CommonTransChInfo UL-CommonTransChInfo-r4 OPTIONAL, ul-deletedTransChInfoList UL-DeletedTransChInfoList OPTIONAL, ul-AddReconfTransChInfoList UL-AddReconfTransChInfoList OPTIONAL, modeSpecificTransChInfo CHOICE { fdd SEQUENCE { -- dummy and dummy2 are not used in this version of the specification, they should -- not be sent and if received they should be ignored. dummy CPCH-SetID OPTIONAL, dummy2 DRAC-StaticInformationList OPTIONAL }, tdd NULL }, dl-CommonTransChInfo DL-CommonTransChInfo-r4 OPTIONAL, dl-DeletedTransChInfoList DL-DeletedTransChInfoList-r5 OPTIONAL, dl-AddReconfTransChInfoList DL-AddReconfTransChInfoList-r5 OPTIONAL, -- Physical channel IEs frequencyInfo FrequencyInfo OPTIONAL, maxAllowedUL-TX-Power MaxAllowedUL-TX-Power OPTIONAL, ul-ChannelRequirement UL-ChannelRequirement-r5 OPTIONAL, modeSpecificPhysChInfo CHOICE { fdd SEQUENCE { -- dummy is not used in this version of specification, it should -- not be sent and if received it should be ignored. dummy DL-PDSCH-Information OPTIONAL }, tdd NULL }, dl-HSPDSCH-Information DL-HSPDSCH-Information OPTIONAL, dl-CommonInformation DL-CommonInformation-r5 OPTIONAL, dl-InformationPerRL-List DL-InformationPerRL-List-r5 OPTIONAL } CellUpdateConfirm-r6-IEs ::= SEQUENCE { -- User equipment IEs integrityProtectionModeInfo IntegrityProtectionModeInfo OPTIONAL, cipheringModeInfo CipheringModeInfo OPTIONAL, activationTime ActivationTime OPTIONAL, new-U-RNTI U-RNTI OPTIONAL, new-C-RNTI C-RNTI OPTIONAL, -- The IE 窶從ew-DSCH-RNTI窶 should not be included in FDD mode, -- and if received the UE behaviour is unspecified new-DSCH-RNTI DSCH-RNTI OPTIONAL, new-H-RNTI H-RNTI OPTIONAL, newPrimary-E-RNTI E-RNTI OPTIONAL, newSecondary-E-RNTI E-RNTI OPTIONAL, rrc-StateIndicator RRC-StateIndicator, utran-DRX-CycleLengthCoeff UTRAN-DRX-CycleLengthCoefficient OPTIONAL, rlc-Re-establishIndicatorRb2-3or4 BOOLEAN, rlc-Re-establishIndicatorRb5orAbove BOOLEAN, -- CN information elements cn-InformationInfo CN-InformationInfo-r6 OPTIONAL, -- UTRAN mobility IEs ura-Identity URA-Identity OPTIONAL, -- Radio bearer IEs rb-InformationReleaseList RB-InformationReleaseList OPTIONAL, rb-InformationReconfigList RB-InformationReconfigList-r6 OPTIONAL, rb-InformationAffectedList RB-InformationAffectedList-r6 OPTIONAL, dl-CounterSynchronisationInfo DL-CounterSynchronisationInfo-r5 OPTIONAL, pdcp-ROHC-TargetMode PDCP-ROHC-TargetMode OPTIONAL, -- Transport channel IEs ul-CommonTransChInfo UL-CommonTransChInfo-r4 OPTIONAL, ul-deletedTransChInfoList UL-DeletedTransChInfoList-r6 OPTIONAL, ul-AddReconfTransChInfoList UL-AddReconfTransChInfoList-r6 OPTIONAL, dl-CommonTransChInfo DL-CommonTransChInfo-r4 OPTIONAL, dl-DeletedTransChInfoList DL-DeletedTransChInfoList-r5 OPTIONAL, dl-AddReconfTransChInfoList DL-AddReconfTransChInfoList-r5 OPTIONAL, -- Physical channel IEs frequencyInfo FrequencyInfo OPTIONAL, maxAllowedUL-TX-Power MaxAllowedUL-TX-Power OPTIONAL, ul-DPCH-Info UL-DPCH-Info-r6 OPTIONAL, ul-EDCH-Information UL-EDCH-Information-r6 OPTIONAL, dl-HSPDSCH-Information DL-HSPDSCH-Information-r6 OPTIONAL, dl-CommonInformation DL-CommonInformation-r6 OPTIONAL, dl-InformationPerRL-List DL-InformationPerRL-List-r6 OPTIONAL, -- MBMS IEs mbms-PL-ServiceRestrictInfo MBMS-PL-ServiceRestrictInfo-r6 OPTIONAL } CellUpdateConfirm-v690ext-IEs ::= SEQUENCE { -- Core network IEs primary-plmn-Identity PLMN-Identity OPTIONAL, -- Physical channel IEs -- The IE harq-Preamble-Mode should not be used in the r3 and r4 versions of the message -- If included in the r3 or r4 version of the message, the UE should ignore the IE harq-Preamble-Mode HARQ-Preamble-Mode OPTIONAL, beaconPLEst BEACON-PL-Est OPTIONAL, postVerificationPeriod ENUMERATED { true } OPTIONAL, dhs-sync DHS-Sync OPTIONAL, -- MBMS IEs mbms-PL-ServiceRestrictInfo MBMS-PL-ServiceRestrictInfo-r6 OPTIONAL } CellUpdateConfirm-r7-IEs ::= SEQUENCE { -- User equipment IEs integrityProtectionModeInfo IntegrityProtectionModeInfo OPTIONAL, cipheringModeInfo CipheringModeInfo OPTIONAL, activationTime ActivationTime OPTIONAL, new-U-RNTI U-RNTI OPTIONAL, new-C-RNTI C-RNTI OPTIONAL, -- The IE 窶從ew-DSCH-RNTI窶 should not be included in FDD mode, -- and if received the UE behaviour is unspecified new-DSCH-RNTI DSCH-RNTI OPTIONAL, new-H-RNTI H-RNTI OPTIONAL, newPrimary-E-RNTI E-RNTI OPTIONAL, newSecondary-E-RNTI E-RNTI OPTIONAL, rrc-StateIndicator RRC-StateIndicator, utran-DRX-CycleLengthCoeff UTRAN-DRX-CycleLengthCoefficient OPTIONAL, rlc-Re-establishIndicatorRb2-3or4 BOOLEAN, rlc-Re-establishIndicatorRb5orAbove BOOLEAN, -- CN information elements cn-InformationInfo CN-InformationInfo-r6 OPTIONAL, -- UTRAN mobility IEs ura-Identity URA-Identity OPTIONAL, -- Radio bearer IEs rb-InformationReleaseList RB-InformationReleaseList OPTIONAL, rb-InformationReconfigList RB-InformationReconfigList-r6 OPTIONAL, rb-InformationAffectedList RB-InformationAffectedList-r6 OPTIONAL, dl-CounterSynchronisationInfo DL-CounterSynchronisationInfo-r5 OPTIONAL, pdcp-ROHC-TargetMode PDCP-ROHC-TargetMode OPTIONAL, -- Transport channel IEs ul-CommonTransChInfo UL-CommonTransChInfo-r4 OPTIONAL, ul-deletedTransChInfoList UL-DeletedTransChInfoList-r6 OPTIONAL, ul-AddReconfTransChInfoList UL-AddReconfTransChInfoList-r6 OPTIONAL, dl-CommonTransChInfo DL-CommonTransChInfo-r4 OPTIONAL, dl-DeletedTransChInfoList DL-DeletedTransChInfoList-r5 OPTIONAL, dl-AddReconfTransChInfoList DL-AddReconfTransChInfoList-r5 OPTIONAL, -- Physical channel IEs frequencyInfo FrequencyInfo OPTIONAL, maxAllowedUL-TX-Power MaxAllowedUL-TX-Power OPTIONAL, ul-DPCH-Info UL-DPCH-Info-r7 OPTIONAL, ul-EDCH-Information UL-EDCH-Information-r6 OPTIONAL, dl-HSPDSCH-Information DL-HSPDSCH-Information-r7 OPTIONAL, dl-CommonInformation DL-CommonInformation-r7 OPTIONAL, dl-InformationPerRL-List DL-InformationPerRL-List-r7 OPTIONAL, -- MBMS IEs mbms-PL-ServiceRestrictInfo MBMS-PL-ServiceRestrictInfo-r6 OPTIONAL } -- *************************************************** -- -- CELL UPDATE CONFIRM for CCCH -- -- *************************************************** CellUpdateConfirm-CCCH ::= CHOICE { r3 SEQUENCE { -- User equipment IEs u-RNTI U-RNTI, -- The rest of the message is identical to the one sent on DCCH. cellUpdateConfirm-r3 CellUpdateConfirm-r3-IEs, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions cellUpdateConfirm-CCCH-r3-add-ext BIT STRING OPTIONAL, v4b0NonCriticalExtensions SEQUENCE { cellUpdateConfirm-v4b0ext CellUpdateConfirm-v4b0ext-IEs, v590NonCriticalExtensions SEQUENCE { cellUpdateConfirm-v590ext CellUpdateConfirm-v590ext-IEs, v5d0NonCriticalExtenstions SEQUENCE { cellUpdateConfirm-v5d0ext CellUpdateConfirm-v5d0ext-IEs, v690NonCriticalExtensions SEQUENCE { cellUpdateConfirm-v690ext CellUpdateConfirm-v690ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL }, later-than-r3 SEQUENCE { u-RNTI U-RNTI, rrc-TransactionIdentifier RRC-TransactionIdentifier, criticalExtensions CHOICE { r4 SEQUENCE { -- The rest of the message is identical to the one sent on DCCH. cellUpdateConfirm-r4 CellUpdateConfirm-r4-IEs, v4d0NonCriticalExtensions SEQUENCE { -- Container for adding non critical extensions after freezing REL-5 cellUpdateConfirm-CCCH-r4-add-ext BIT STRING OPTIONAL, v590NonCriticalExtensions SEQUENCE { cellUpdateConfirm-v590ext CellUpdateConfirm-v590ext-IEs, v5d0NonCriticalExtenstions SEQUENCE { cellUpdateConfirm-v5d0ext CellUpdateConfirm-v5d0ext-IEs, v690NonCriticalExtensions SEQUENCE { cellUpdateConfirm-v690ext CellUpdateConfirm-v690ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL }, criticalExtensions CHOICE { r5 SEQUENCE { cellUpdateConfirm-r5 CellUpdateConfirm-r5-IEs, cellUpdateConfirm-CCCH-r5-add-ext BIT STRING OPTIONAL, v5d0NonCriticalExtenstions SEQUENCE { cellUpdateConfirm-v5d0ext CellUpdateConfirm-v5d0ext-IEs, v690NonCriticalExtensions SEQUENCE { cellUpdateConfirm-v690ext CellUpdateConfirm-v690ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL }, criticalExtensions CHOICE { r6 SEQUENCE { cellUpdateConfirm-r6 CellUpdateConfirm-r6-IEs, cellUpdateConfirm-r6-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL }, criticalExtensions CHOICE { r7 SEQUENCE { cellUpdateConfirm-r7 CellUpdateConfirm-r7-IEs, cellUpdateConfirm-r7-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL }, criticalExtensions SEQUENCE {} } } } } } } -- *************************************************** -- -- COUNTER CHECK -- -- *************************************************** CounterCheck ::= CHOICE { r3 SEQUENCE { counterCheck-r3 CounterCheck-r3-IEs, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions counterCheck-r3-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL }, later-than-r3 SEQUENCE { rrc-TransactionIdentifier RRC-TransactionIdentifier, criticalExtensions SEQUENCE {} } } CounterCheck-r3-IEs ::= SEQUENCE { -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier, -- Radio bearer IEs rb-COUNT-C-MSB-InformationList RB-COUNT-C-MSB-InformationList } -- *************************************************** -- -- COUNTER CHECK RESPONSE -- -- *************************************************** CounterCheckResponse ::= SEQUENCE { -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier, -- Radio bearer IEs rb-COUNT-C-InformationList RB-COUNT-C-InformationList OPTIONAL, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions counterCheckResponse-r3-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } -- *************************************************** -- -- DOWNLINK DIRECT TRANSFER -- -- *************************************************** DownlinkDirectTransfer ::= CHOICE { r3 SEQUENCE { downlinkDirectTransfer-r3 DownlinkDirectTransfer-r3-IEs, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions downlinkDirectTransfer-r3-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL }, later-than-r3 SEQUENCE { rrc-TransactionIdentifier RRC-TransactionIdentifier, criticalExtensions SEQUENCE {} } } DownlinkDirectTransfer-r3-IEs ::= SEQUENCE { -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier, -- Core network IEs cn-DomainIdentity CN-DomainIdentity, nas-Message NAS-Message } -- *************************************************** -- -- HANDOVER TO UTRAN COMMAND -- -- *************************************************** HandoverToUTRANCommand ::= CHOICE { r3 SEQUENCE { handoverToUTRANCommand-r3 HandoverToUTRANCommand-r3-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL }, criticalExtensions CHOICE { r4 SEQUENCE { handoverToUTRANCommand-r4 HandoverToUTRANCommand-r4-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL }, criticalExtensions CHOICE { r5 SEQUENCE { handoverToUTRANCommand-r5 HandoverToUTRANCommand-r5-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL }, criticalExtensions CHOICE { r6 SEQUENCE { handoverToUTRANCommand-r6 HandoverToUTRANCommand-r6-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL }, criticalExtensions CHOICE { r7 SEQUENCE { handoverToUTRANCommand-r7 HandoverToUTRANCommand-r7-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL }, criticalExtensions SEQUENCE {} } } } } } HandoverToUTRANCommand-r3-IEs ::= SEQUENCE { -- User equipment IEs new-U-RNTI U-RNTI-Short, -- dummy is not used in this version of specification, it should -- not be sent and if received it should be ignored. dummy ActivationTime OPTIONAL, cipheringAlgorithm CipheringAlgorithm OPTIONAL, -- Radio bearer IEs -- Specification mode information specificationMode CHOICE { complete SEQUENCE { srb-InformationSetupList SRB-InformationSetupList, rab-InformationSetupList RAB-InformationSetupList OPTIONAL, ul-CommonTransChInfo UL-CommonTransChInfo, ul-AddReconfTransChInfoList UL-AddReconfTransChInfoList, dl-CommonTransChInfo DL-CommonTransChInfo, dl-AddReconfTransChInfoList DL-AddReconfTransChInfoList, ul-DPCH-Info UL-DPCH-Info, modeSpecificInfo CHOICE { fdd SEQUENCE { -- dummy and dummy2 are not used in this version of specification, -- they should not be sent and if received they should be ignored. dummy DL-PDSCH-Information OPTIONAL, dummy2 CPCH-SetInfo OPTIONAL }, tdd NULL }, dl-CommonInformation DL-CommonInformation, dl-InformationPerRL-List DL-InformationPerRL-List, frequencyInfo FrequencyInfo }, preconfiguration SEQUENCE { -- All IEs that include an FDD/TDD choice are split in two IEs for this message, -- one for the FDD only elements and one for the TDD only elements, so that one -- FDD/TDD choice in this level is sufficient. preConfigMode CHOICE { predefinedConfigIdentity PredefinedConfigIdentity, defaultConfig SEQUENCE { defaultConfigMode DefaultConfigMode, defaultConfigIdentity DefaultConfigIdentity } }, rab-Info RAB-Info-Post OPTIONAL, modeSpecificInfo CHOICE { fdd SEQUENCE { ul-DPCH-Info UL-DPCH-InfoPostFDD, dl-CommonInformationPost DL-CommonInformationPost, dl-InformationPerRL-List DL-InformationPerRL-ListPostFDD, frequencyInfo FrequencyInfoFDD }, tdd SEQUENCE { ul-DPCH-Info UL-DPCH-InfoPostTDD, dl-CommonInformationPost DL-CommonInformationPost, dl-InformationPerRL DL-InformationPerRL-PostTDD, frequencyInfo FrequencyInfoTDD, primaryCCPCH-TX-Power PrimaryCCPCH-TX-Power } } } }, -- Physical channel IEs maxAllowedUL-TX-Power MaxAllowedUL-TX-Power } HandoverToUTRANCommand-r4-IEs ::= SEQUENCE { -- User equipment IEs new-U-RNTI U-RNTI-Short, cipheringAlgorithm CipheringAlgorithm OPTIONAL, -- Radio bearer IEs -- Specification mode information specificationMode CHOICE { complete SEQUENCE { srb-InformationSetupList SRB-InformationSetupList, rab-InformationSetupList RAB-InformationSetupList-r4 OPTIONAL, ul-CommonTransChInfo UL-CommonTransChInfo-r4, ul-AddReconfTransChInfoList UL-AddReconfTransChInfoList, dl-CommonTransChInfo DL-CommonTransChInfo-r4, dl-AddReconfTransChInfoList DL-AddReconfTransChInfoList-r4, ul-DPCH-Info UL-DPCH-Info-r4, modeSpecificInfo CHOICE { fdd SEQUENCE { -- dummy and dummy2 are not used in this version of specification, -- they should not be sent and if received they should be ignored. dummy DL-PDSCH-Information OPTIONAL, dummy2 CPCH-SetInfo OPTIONAL }, tdd NULL }, dl-CommonInformation DL-CommonInformation-r4, dl-InformationPerRL-List DL-InformationPerRL-List-r4, frequencyInfo FrequencyInfo }, preconfiguration SEQUENCE { -- All IEs that include an FDD/TDD choice are split in two IEs for this message, -- one for the FDD only elements and one for the TDD only elements, so that one -- FDD/TDD choice in this level is sufficient. preConfigMode CHOICE { predefinedConfigIdentity PredefinedConfigIdentity, defaultConfig SEQUENCE { defaultConfigMode DefaultConfigMode, defaultConfigIdentity DefaultConfigIdentity-r4 } }, rab-Info RAB-Info-Post OPTIONAL, modeSpecificInfo CHOICE { fdd SEQUENCE { ul-DPCH-Info UL-DPCH-InfoPostFDD, dl-CommonInformationPost DL-CommonInformationPost, dl-InformationPerRL-List DL-InformationPerRL-ListPostFDD, frequencyInfo FrequencyInfoFDD }, tdd CHOICE { tdd384 SEQUENCE { ul-DPCH-Info UL-DPCH-InfoPostTDD, dl-InformationPerRL DL-InformationPerRL-PostTDD, frequencyInfo FrequencyInfoTDD, primaryCCPCH-TX-Power PrimaryCCPCH-TX-Power }, tdd128 SEQUENCE { ul-DPCH-Info UL-DPCH-InfoPostTDD-LCR-r4, dl-InformationPerRL DL-InformationPerRL-PostTDD-LCR-r4, frequencyInfo FrequencyInfoTDD, primaryCCPCH-TX-Power PrimaryCCPCH-TX-Power } } } } }, -- Physical channel IEs maxAllowedUL-TX-Power MaxAllowedUL-TX-Power } HandoverToUTRANCommand-r5-IEs ::= SEQUENCE { -- User equipment IEs new-U-RNTI U-RNTI-Short, cipheringAlgorithm CipheringAlgorithm OPTIONAL, -- Radio bearer IEs -- Specification mode information specificationMode CHOICE { complete SEQUENCE { srb-InformationSetupList SRB-InformationSetupList-r5, rab-InformationSetupList RAB-InformationSetupList-r5 OPTIONAL, ul-CommonTransChInfo UL-CommonTransChInfo-r4, ul-AddReconfTransChInfoList UL-AddReconfTransChInfoList, dl-CommonTransChInfo DL-CommonTransChInfo-r4, dl-AddReconfTransChInfoList DL-AddReconfTransChInfoList-r5, ul-DPCH-Info UL-DPCH-Info-r5, modeSpecificInfo CHOICE { fdd SEQUENCE { -- dummy and dummy2 are not used in this version of specification, -- they should not be sent and if received they should be ignored. dummy DL-PDSCH-Information OPTIONAL, dummy2 CPCH-SetInfo OPTIONAL }, tdd NULL }, dl-CommonInformation DL-CommonInformation-r4, dl-InformationPerRL-List DL-InformationPerRL-List-r5, frequencyInfo FrequencyInfo }, preconfiguration SEQUENCE { -- All IEs that include an FDD/TDD choice are split in two IEs for this message, -- one for the FDD only elements and one for the TDD only elements, so that one -- FDD/TDD choice in this level is sufficient. preConfigMode CHOICE { predefinedConfigIdentity PredefinedConfigIdentity, defaultConfig SEQUENCE { defaultConfigMode DefaultConfigMode, defaultConfigIdentity DefaultConfigIdentity-r5 } }, rab-Info RAB-Info-Post OPTIONAL, modeSpecificInfo CHOICE { fdd SEQUENCE { ul-DPCH-Info UL-DPCH-InfoPostFDD, dl-CommonInformationPost DL-CommonInformationPost, dl-InformationPerRL-List DL-InformationPerRL-ListPostFDD, frequencyInfo FrequencyInfoFDD }, tdd CHOICE { tdd384 SEQUENCE { ul-DPCH-Info UL-DPCH-InfoPostTDD, dl-InformationPerRL DL-InformationPerRL-PostTDD, frequencyInfo FrequencyInfoTDD, primaryCCPCH-TX-Power PrimaryCCPCH-TX-Power }, tdd128 SEQUENCE { ul-DPCH-Info UL-DPCH-InfoPostTDD-LCR-r4, dl-InformationPerRL DL-InformationPerRL-PostTDD-LCR-r4, frequencyInfo FrequencyInfoTDD, primaryCCPCH-TX-Power PrimaryCCPCH-TX-Power } } } } }, -- Physical channel IEs maxAllowedUL-TX-Power MaxAllowedUL-TX-Power } HandoverToUTRANCommand-r6-IEs ::= SEQUENCE { -- User equipment IEs new-U-RNTI U-RNTI-Short, cipheringAlgorithm CipheringAlgorithm OPTIONAL, -- Radio bearer IEs -- Specification mode information specificationMode CHOICE { complete SEQUENCE { srb-InformationSetupList SRB-InformationSetupList-r6, rab-InformationSetupList RAB-InformationSetupList-r6 OPTIONAL, ul-CommonTransChInfo UL-CommonTransChInfo-r4, ul-AddReconfTransChInfoList UL-AddReconfTransChInfoList-r6, dl-CommonTransChInfo DL-CommonTransChInfo-r4, dl-AddReconfTransChInfoList DL-AddReconfTransChInfoList-r5, ul-DPCH-Info UL-DPCH-Info-r6, ul-EDCH-Information UL-EDCH-Information-r6 OPTIONAL, dl-HSPDSCH-Information DL-HSPDSCH-Information-r6 OPTIONAL, dl-CommonInformation DL-CommonInformation-r6, dl-InformationPerRL-List DL-InformationPerRL-List-r6, frequencyInfo FrequencyInfo }, preconfiguration SEQUENCE { -- All IEs that include an FDD/TDD choice are split in two IEs for this message, -- one for the FDD only elements and one for the TDD only elements, so that one -- FDD/TDD choice in this level is sufficient. preConfigMode CHOICE { predefinedConfigIdentity PredefinedConfigIdentity, defaultConfig SEQUENCE { defaultConfigMode DefaultConfigMode, defaultConfigIdentity DefaultConfigIdentity-r6 } }, rab-Info RAB-Info-Post OPTIONAL, modeSpecificInfo CHOICE { fdd SEQUENCE { ul-DPCH-Info UL-DPCH-InfoPostFDD, dl-CommonInformationPost DL-CommonInformationPost, dl-InformationPerRL-List DL-InformationPerRL-ListPostFDD, frequencyInfo FrequencyInfoFDD }, tdd CHOICE { tdd384 SEQUENCE { ul-DPCH-Info UL-DPCH-InfoPostTDD, dl-InformationPerRL DL-InformationPerRL-PostTDD, frequencyInfo FrequencyInfoTDD, primaryCCPCH-TX-Power PrimaryCCPCH-TX-Power }, tdd128 SEQUENCE { ul-DPCH-Info UL-DPCH-InfoPostTDD-LCR-r4, dl-InformationPerRL DL-InformationPerRL-PostTDD-LCR-r4, frequencyInfo FrequencyInfoTDD, primaryCCPCH-TX-Power PrimaryCCPCH-TX-Power } } } } }, -- Physical channel IEs maxAllowedUL-TX-Power MaxAllowedUL-TX-Power } HandoverToUTRANCommand-r7-IEs ::= SEQUENCE { -- User equipment IEs new-U-RNTI U-RNTI-Short, cipheringAlgorithm CipheringAlgorithm OPTIONAL, -- Radio bearer IEs -- Specification mode information specificationMode CHOICE { complete SEQUENCE { srb-InformationSetupList SRB-InformationSetupList-r6, rab-InformationSetupList RAB-InformationSetupList-r6 OPTIONAL, ul-CommonTransChInfo UL-CommonTransChInfo-r4, ul-AddReconfTransChInfoList UL-AddReconfTransChInfoList-r6, dl-CommonTransChInfo DL-CommonTransChInfo-r4, dl-AddReconfTransChInfoList DL-AddReconfTransChInfoList-r5, ul-DPCH-Info UL-DPCH-Info-r7, dl-CommonInformation DL-CommonInformation-r4, dl-InformationPerRL-List DL-InformationPerRL-List-r7, frequencyInfo FrequencyInfo }, preconfiguration SEQUENCE { -- All IEs that include an FDD/TDD choice are split in two IEs for this message, -- one for the FDD only elements and one for the TDD only elements, so that one -- FDD/TDD choice in this level is sufficient. preConfigMode CHOICE { predefinedConfigIdentity PredefinedConfigIdentity, defaultConfig SEQUENCE { defaultConfigMode DefaultConfigMode, defaultConfigIdentity DefaultConfigIdentity-r6 } }, rab-Info RAB-Info-Post OPTIONAL, modeSpecificInfo CHOICE { fdd SEQUENCE { ul-DPCH-Info UL-DPCH-InfoPostFDD, dl-CommonInformationPost DL-CommonInformationPost, dl-InformationPerRL-List DL-InformationPerRL-ListPostFDD, frequencyInfo FrequencyInfoFDD }, tdd CHOICE { tdd384 SEQUENCE { ul-DPCH-Info UL-DPCH-InfoPostTDD, dl-InformationPerRL DL-InformationPerRL-PostTDD, frequencyInfo FrequencyInfoTDD, primaryCCPCH-TX-Power PrimaryCCPCH-TX-Power }, tdd128 SEQUENCE { ul-DPCH-Info UL-DPCH-Info-r7, dl-InformationPerRL DL-InformationPerRL-PostTDD-LCR-r4, frequencyInfo FrequencyInfoTDD, primaryCCPCH-TX-Power PrimaryCCPCH-TX-Power }, tdd768 SEQUENCE { ul-DPCH-Info UL-DPCH-Info-r7, dl-InformationPerRL DL-InformationPerRL-List-r7, frequencyInfo FrequencyInfoTDD, primaryCCPCH-TX-Power PrimaryCCPCH-TX-Power } } } } }, -- Physical channel IEs maxAllowedUL-TX-Power MaxAllowedUL-TX-Power } -- *************************************************** -- -- HANDOVER TO UTRAN COMPLETE -- -- *************************************************** HandoverToUTRANComplete ::= SEQUENCE { --TABULAR: Integrity protection shall not be performed on this message. -- User equipment IEs -- TABULAR: startList is conditional on history. startList STARTList OPTIONAL, -- Radio bearer IEs count-C-ActivationTime ActivationTime OPTIONAL, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions handoverToUTRANComplete-r3-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } -- *************************************************** -- -- INITIAL DIRECT TRANSFER -- -- *************************************************** InitialDirectTransfer ::= SEQUENCE { -- Core network IEs cn-DomainIdentity CN-DomainIdentity, intraDomainNasNodeSelector IntraDomainNasNodeSelector, nas-Message NAS-Message, -- Measurement IEs measuredResultsOnRACH MeasuredResultsOnRACH OPTIONAL, v3a0NonCriticalExtensions SEQUENCE { initialDirectTransfer-v3a0ext InitialDirectTransfer-v3a0ext, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions initialDirectTransfer-r3-add-ext BIT STRING OPTIONAL, v590NonCriticalExtensions SEQUENCE { initialDirectTransfer-v590ext InitialDirectTransfer-v590ext, v690NonCriticalExtensions SEQUENCE { initialDirectTransfer-v690ext InitialDirectTransfer-v690ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } InitialDirectTransfer-v3a0ext ::= SEQUENCE { -- start-value shall always be included in this version of the protocol start-Value START-Value OPTIONAL } InitialDirectTransfer-v590ext ::= SEQUENCE { establishmentCause EstablishmentCause OPTIONAL } InitialDirectTransfer-v690ext-IEs ::= SEQUENCE { -- Core network IEs plmn-Identity PLMN-Identity OPTIONAL, -- Measurement IEs measuredResultsOnRACHinterFreq MeasuredResultsOnRACHinterFreq OPTIONAL, -- MBMS IEs mbms-JoinedInformation MBMS-JoinedInformation-r6 OPTIONAL } -- *************************************************** -- -- HANDOVER FROM UTRAN COMMAND -- -- *************************************************** HandoverFromUTRANCommand-GSM ::= CHOICE { r3 SEQUENCE { handoverFromUTRANCommand-GSM-r3 HandoverFromUTRANCommand-GSM-r3-IEs, -- UTRAN should not include the IE laterNonCriticalExtensions when it sets the IE -- gsm-message included in handoverFromUTRANCommand-GSM-r3 to single-GSM-Message. The UE -- behaviour upon receiving a message with this combination of IE values is unspecified. laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions handoverFromUTRANCommand-GSM-r3-add-ext BIT STRING OPTIONAL, -- UTRAN may apply the r3 version of the message to perform PS handover -- for a single RAB only v690NonCriticalExtensions SEQUENCE { handoverFromUTRANCommand-GSM-v690ext HandoverFromUTRANCommand-GSM-v690ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL }, later-than-r3 SEQUENCE { rrc-TransactionIdentifier RRC-TransactionIdentifier, criticalExtensions CHOICE { r6 SEQUENCE { handoverFromUTRANCommand-GSM-r6 HandoverFromUTRANCommand-GSM-r6-IEs, handoverFromUTRANCommand-GSM-r6-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL }, criticalExtensions SEQUENCE {} } } } HandoverFromUTRANCommand-GSM-r3-IEs ::= SEQUENCE { -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier, activationTime ActivationTime OPTIONAL, -- Radio bearer IEs toHandoverRAB-Info RAB-Info OPTIONAL, -- Measurement IEs frequency-band Frequency-Band, -- Other IEs gsm-message CHOICE { -- In the single-GSM-Message case the following rules apply: -- 1> the GSM message directly follows the basic production; the final padding that -- results when PER encoding the abstract syntax value is removed prior to appending -- the GSM message. -- 2> the RRC message excluding the GSM part, does not contain a length determinant; -- there is no explicit parameter indicating the size of the included GSM message. -- 3> depending on need, final padding (all 窶0窶捏) is added to ensure the final result -- comprises a full number of octets single-GSM-Message SEQUENCE {}, gsm-MessageList SEQUENCE { gsm-Messages GSM-MessageList } } } HandoverFromUTRANCommand-GSM-r6-IEs ::= SEQUENCE { -- User equipment IEs activationTime ActivationTime OPTIONAL, -- Radio bearer IEs toHandoverRAB-Info RAB-InformationList-r6 OPTIONAL, -- Measurement IEs frequency-band Frequency-Band, -- Other IEs gsm-message CHOICE { -- In the single-GSM-Message case the following rules apply: -- 1> the GSM message directly follows the basic production; the final padding that -- results when PER encoding the abstract syntax value is removed prior to appending -- the GSM message. -- 2> the RRC message excluding the GSM part, does not contain a length determinant; -- there is no explicit parameter indicating the size of the included GSM message. -- 3> depending on need, final padding (all 窶0窶捏) is added to ensure the final result -- comprises a full number of octets single-GSM-Message SEQUENCE {}, gsm-MessageList SEQUENCE { gsm-Messages GSM-MessageList } }, geran-SystemInfoType CHOICE { sI GERAN-SystemInformation, pSI GERAN-SystemInformation } OPTIONAL } HandoverFromUTRANCommand-GSM-v690ext-IEs ::= SEQUENCE { geran-SystemInfoType CHOICE { sI GERAN-SystemInformation, pSI GERAN-SystemInformation } OPTIONAL } HandoverFromUTRANCommand-GERANIu ::= SEQUENCE { rrc-TransactionIdentifier RRC-TransactionIdentifier, handoverFromUTRANCommand-GERANIu CHOICE { r5 SEQUENCE { handoverFromUTRANCommand-GERANIu-r5 HandoverFromUTRANCommand-GERANIu-r5-IEs, -- UTRAN should not include the IE nonCriticalExtensions when it sets -- the IE geranIu-message included in handoverFromUTRANCommand-GERANIu-r5 to -- single-GERANIu-Message -- The UE behaviour upon receiving a message including this combination of IE values is -- not specified nonCriticalExtensions SEQUENCE {} OPTIONAL }, later-than-r5 SEQUENCE { criticalExtensions SEQUENCE {} } } } HandoverFromUTRANCommand-GERANIu-r5-IEs ::= SEQUENCE { -- User equipment IEs activationTime ActivationTime OPTIONAL, -- Measurement IEs frequency-Band Frequency-Band, -- Other IEs geranIu-Message CHOICE { -- In the single-GERANIu-Message case the following rules apply: -- 1> the GERAN Iu message directly follows the basic production; the final padding that -- results when PER encoding the abstract syntax value is removed prior to appending -- the GERAN Iu message. -- 2> the RRC message excluding the GERAN Iu part does not contain a length determinant; -- there is no explicit parameter indicating the size of the included GERAN Iu -- message. -- 3> depending on need, final padding (all 窶0窶捏) is added to ensure the final result -- comprises a full number of octets. single-GERANIu-Message SEQUENCE {}, geranIu-MessageList SEQUENCE { geranIu-Messages GERANIu-MessageList } } } HandoverFromUTRANCommand-CDMA2000 ::= CHOICE { r3 SEQUENCE { handoverFromUTRANCommand-CDMA2000-r3 HandoverFromUTRANCommand-CDMA2000-r3-IEs, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions handoverFromUTRANCommand-CDMA2000-r3-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL }, later-than-r3 SEQUENCE { rrc-TransactionIdentifier RRC-TransactionIdentifier, criticalExtensions SEQUENCE {} } } HandoverFromUTRANCommand-CDMA2000-r3-IEs ::= SEQUENCE { -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier, activationTime ActivationTime OPTIONAL, -- Radio bearer IEs toHandoverRAB-Info RAB-Info OPTIONAL, -- Other IEs cdma2000-MessageList CDMA2000-MessageList } -- *************************************************** -- -- HANDOVER FROM UTRAN FAILURE -- -- *************************************************** HandoverFromUTRANFailure ::= SEQUENCE { -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier, -- Other IEs interRAT-HO-FailureCause InterRAT-HO-FailureCause OPTIONAL, -- In case the interRATMessage to be transferred is for GERAN Iu mode, the -- message should be placed in the HandoverFromUtranFailure-v590ext-IEs -- non-critical extension container. interRATMessage CHOICE { gsm SEQUENCE { gsm-MessageList GSM-MessageList }, cdma2000 SEQUENCE { cdma2000-MessageList CDMA2000-MessageList } } OPTIONAL, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions handoverFromUTRANFailure-r3-add-ext BIT STRING OPTIONAL, v590NonCriticalExtensions SEQUENCE { handoverFromUTRANFailure-v590ext HandoverFromUtranFailure-v590ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } HandoverFromUtranFailure-v590ext-IEs ::= SEQUENCE { geranIu-MessageList GERANIu-MessageList OPTIONAL } -- *************************************************** -- -- INTER RAT HANDOVER INFO -- -- *************************************************** InterRATHandoverInfo ::= SEQUENCE { -- This structure is defined for historical reasons, backward compatibility with 44.018 predefinedConfigStatusList CHOICE { absent NULL, present PredefinedConfigStatusList }, uE-SecurityInformation CHOICE { absent NULL, present UE-SecurityInformation }, ue-CapabilityContainer CHOICE { absent NULL, -- present is an octet aligned string containing IE UE-RadioAccessCapabilityInfo present OCTET STRING (SIZE (0..63)) }, -- Non critical extensions v390NonCriticalExtensions CHOICE { absent NULL, present SEQUENCE { interRATHandoverInfo-v390ext InterRATHandoverInfo-v390ext-IEs, v3a0NonCriticalExtensions SEQUENCE { interRATHandoverInfo-v3a0ext InterRATHandoverInfo-v3a0ext-IEs, laterNonCriticalExtensions SEQUENCE { interRATHandoverInfo-v3d0ext InterRATHandoverInfo-v3d0ext-IEs, -- Container for additional R99 extensions interRATHandoverInfo-r3-add-ext BIT STRING (CONTAINING InterRATHandoverInfo-r3-add-ext-IEs) OPTIONAL, v3g0NonCriticalExtensions SEQUENCE { interRATHandoverInfo-v3g0ext InterRATHandoverInfo-v3g0ext-IEs, v4b0NonCriticalExtensions SEQUENCE { interRATHandoverInfo-v4b0ext InterRATHandoverInfo-v4b0ext-IEs, v4d0NonCriticalExtensions SEQUENCE { interRATHandoverInfo-v4d0ext InterRATHandoverInfo-v4d0ext-IEs, -- Reserved for future non critical extension v590NonCriticalExtensions SEQUENCE { interRATHandoverInfo-v590ext InterRATHandoverInfo-v590ext-IEs, v690NonCriticalExtensions SEQUENCE { interRATHandoverInfo-v690ext InterRATHandoverInfo-v690ext-IEs, v7xyNonCriticalExtensions SEQUENCE { interRATHandoverInfo-v7xyext InterRATHandoverInfo-v7xyext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } } } InterRATHandoverInfo-v390ext-IEs ::= SEQUENCE { -- User equipment IEs ue-RadioAccessCapability-v380ext UE-RadioAccessCapability-v380ext OPTIONAL, dl-PhysChCapabilityFDD-v380ext DL-PhysChCapabilityFDD-v380ext } InterRATHandoverInfo-v3a0ext-IEs ::= SEQUENCE { -- User equipment IEs ue-RadioAccessCapability-v3a0ext UE-RadioAccessCapability-v3a0ext OPTIONAL } InterRATHandoverInfo-v3d0ext-IEs ::= SEQUENCE { -- User equipment IEs uESpecificBehaviourInformation1interRAT UESpecificBehaviourInformation1interRAT OPTIONAL } InterRATHandoverInfo-v3g0ext-IEs ::= SEQUENCE { -- User equipment IEs ue-RadioAccessCapability-v3g0ext UE-RadioAccessCapability-v3g0ext OPTIONAL } InterRATHandoverInfo-r3-add-ext-IEs ::= SEQUENCE { interRATHandoverInfo-v690ext1 InterRATHandoverInfo-v690ext1-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } InterRATHandoverInfo-v4b0ext-IEs ::= SEQUENCE { -- User equipment IEs accessStratumReleaseIndicator AccessStratumReleaseIndicator } InterRATHandoverInfo-v4d0ext-IEs ::= SEQUENCE { -- User equipment IEs tdd128-RF-Capability RadioFrequencyBandTDDList OPTIONAL } InterRATHandoverInfo-v590ext-IEs ::= SEQUENCE { -- User equipment IEs predefinedConfigStatusListComp PredefinedConfigStatusListComp OPTIONAL, ue-RadioAccessCapabilityComp UE-RadioAccessCapabilityComp OPTIONAL } InterRATHandoverInfo-v690ext1-IEs ::= SEQUENCE { -- User equipment IEs ue-RadioAccessCapability-v650ext UE-RadioAccessCapability-v650ext OPTIONAL } InterRATHandoverInfo-v690ext-IEs ::= SEQUENCE { -- User equipment IEs ue-SecurityInformation2 UE-SecurityInformation2 OPTIONAL, ue-RadioAccessCapabilityComp UE-RadioAccessCapabilityComp-ext OPTIONAL, ue-RadioAccessCapabilityComp2 UE-RadioAccessCapabilityComp2 } InterRATHandoverInfo-v7xyext-IEs ::= SEQUENCE { ue-RadioAccessCapability-v7xyext UE-RadioAccessCapability-v7xyext OPTIONAL, ue-RadioAccessCapabilityComp UE-RadioAccessCapabilityComp-r7 OPTIONAL } -- *************************************************** -- -- MEASUREMENT CONTROL -- -- *************************************************** MeasurementControl ::= CHOICE { -- The Rel-4 functionality of UE Positioning OTDOA AssistanceData TDD is only available -- in the later-than-r3 branch of this message (i.e. through the use of the IE -- ue-Positioning-OTDOA-AssistanceData-r4) r3 SEQUENCE { measurementControl-r3 MeasurementControl-r3-IEs, v390nonCriticalExtensions SEQUENCE { measurementControl-v390ext MeasurementControl-v390ext, v3a0NonCriticalExtensions SEQUENCE { measurementControl-v3a0ext MeasurementControl-v3a0ext, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions measurementControl-r3-add-ext BIT STRING OPTIONAL, v4b0NonCriticalExtensions SEQUENCE{ -- The content of the v4b0 non-critical extension has been removed. If sent -- to a UE of AS release 4, the UE behaviour is unspecified. A UE of AS -- release 5 onward shall comply with the v4b0 and later extensions in this -- branch of the message. v590NonCriticalExtensions SEQUENCE { measurementControl-v590ext MeasurementControl-v590ext-IEs, v5b0NonCriticalExtensions SEQUENCE { measurementControl-v5b0ext MeasurementControl-v5b0ext-IEs, v7xyNonCriticalExtensions SEQUENCE { measurementControl-v7xyext MeasurementControl-v7xyext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL }, later-than-r3 SEQUENCE { rrc-TransactionIdentifier RRC-TransactionIdentifier, criticalExtensions CHOICE { r4 SEQUENCE { measurementControl-r4 MeasurementControl-r4-IEs, v4d0NonCriticalExtensions SEQUENCE { -- Container for adding non critical extensions after freezing REL-5 measurementControl-r4-add-ext BIT STRING OPTIONAL, v590NonCriticalExtensions SEQUENCE{ measurementControl-v590ext MeasurementControl-v590ext-IEs, v5b0NonCriticalExtensions SEQUENCE { measurementControl-v5b0ext MeasurementControl-v5b0ext-IEs, v7xyNonCriticalExtensions SEQUENCE { measurementControl-v7xyext MeasurementControl-v7xyext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL }, later-than-r4 SEQUENCE { -- Most significant part of "RRC transaction identifier" (MSP), -- "RRC transaction identifier" = rrc-TransactionIdentifier-MSP * 4 + -- rrc-TransactionIdentifier rrc-TransactionIdentifier-MSP RRC-TransactionIdentifier, criticalExtensions CHOICE { r6 SEQUENCE { measurementControl-r6 MeasurementControl-r6-IEs, v6a0NonCriticalExtensions SEQUENCE { measurementControl-v6a0ext MeasurementControl-v6a0ext-IEs, v7xyNonCriticalExtensions SEQUENCE { measurementControl-v7xyext MeasurementControl-v7xyext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL }, criticalExtensions SEQUENCE {} } } } } } MeasurementControl-r3-IEs ::= SEQUENCE { -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier, -- Measurement IEs measurementIdentity MeasurementIdentity, -- TABULAR: The measurement type is included in MeasurementCommand. measurementCommand MeasurementCommand, measurementReportingMode MeasurementReportingMode OPTIONAL, additionalMeasurementList AdditionalMeasurementID-List OPTIONAL, -- Physical channel IEs dpch-CompressedModeStatusInfo DPCH-CompressedModeStatusInfo OPTIONAL } MeasurementControl-v390ext ::= SEQUENCE { ue-Positioning-Measurement-v390ext UE-Positioning-Measurement-v390ext OPTIONAL } MeasurementControl-v3a0ext ::= SEQUENCE { sfn-Offset-Validity SFN-Offset-Validity OPTIONAL } MeasurementControl-r4-IEs ::= SEQUENCE { -- Measurement IEs measurementIdentity MeasurementIdentity, -- TABULAR: The measurement type is included in measurementCommand. measurementCommand MeasurementCommand-r4, measurementReportingMode MeasurementReportingMode OPTIONAL, additionalMeasurementList AdditionalMeasurementID-List OPTIONAL, -- Physical channel IEs dpch-CompressedModeStatusInfo DPCH-CompressedModeStatusInfo OPTIONAL } MeasurementControl-v590ext-IEs ::= SEQUENCE { measurementCommand-v590ext CHOICE { -- the choice 窶彿ntra-frequency窶 shall be used for the case of intra-frequency measurement, -- as well as when intra-frequency events are configured for inter-frequency measurement intra-frequency Intra-FreqEventCriteriaList-v590ext, inter-frequency Inter-FreqEventCriteriaList-v590ext } OPTIONAL, intraFreqReportingCriteria-1b-r5 IntraFreqReportingCriteria-1b-r5 OPTIONAL, intraFreqEvent-1d-r5 IntraFreqEvent-1d-r5 OPTIONAL, -- most significant part of "RRC transaction identifier" (MSP), -- "RRC transaction identifier" = rrc-TransactionIdentifier-MSP-v590ext * 4 + -- rrc-TransactionIdentifier rrc-TransactionIdentifier-MSP-v590ext RRC-TransactionIdentifier } MeasurementControl-v5b0ext-IEs ::= SEQUENCE { interRATCellInfoIndication InterRATCellInfoIndication OPTIONAL } MeasurementControl-r6-IEs ::= SEQUENCE { -- Measurement IEs measurementIdentity MeasurementIdentity, -- TABULAR: The measurement type is included in measurementCommand. measurementCommand MeasurementCommand-r6, measurementReportingMode MeasurementReportingMode OPTIONAL, additionalMeasurementList AdditionalMeasurementID-List OPTIONAL, -- Physical channel IEs dpch-CompressedModeStatusInfo DPCH-CompressedModeStatusInfo OPTIONAL } MeasurementControl-v6a0ext-IEs ::= SEQUENCE { intraFreqReportingCriteria-1b-r5 IntraFreqReportingCriteria-1b-r5 OPTIONAL } MeasurementControl-v7xyext-IEs ::= SEQUENCE { ue-Positioning-Measurement-v7xyext UE-Positioning-Measurement-v7xyext } -- *************************************************** -- -- MEASUREMENT CONTROL FAILURE -- -- *************************************************** MeasurementControlFailure ::= SEQUENCE { -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier, failureCause FailureCauseWithProtErr, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions measurementControlFailure-r3-add-ext BIT STRING OPTIONAL, v590NonCriticalExtensions SEQUENCE { measurementControlFailure-v590ext MeasurementControlFailure-v590ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } MeasurementControlFailure-v590ext-IEs ::= SEQUENCE { -- most significant part of "RRC transaction identifier" (MSP), -- "RRC transaction identifier" = rrc-TransactionIdentifier-MSP-v590ext * 4 + -- rrc-TransactionIdentifier -- If the rrc-TransactionIdentifier-MSP-v590ext was not received in the MEASUREMENT CONTROL -- message, then the rrc-TransactionIdentifier-MSP-v590ext shall be set to zero rrc-TransactionIdentifier-MSP-v590ext RRC-TransactionIdentifier } -- *************************************************** -- -- MEASUREMENT REPORT -- -- *************************************************** MeasurementReport ::= SEQUENCE { -- Measurement IEs measurementIdentity MeasurementIdentity, measuredResults MeasuredResults OPTIONAL, measuredResultsOnRACH MeasuredResultsOnRACH OPTIONAL, additionalMeasuredResults MeasuredResultsList OPTIONAL, eventResults EventResults OPTIONAL, -- Non-critical extensions v390nonCriticalExtensions SEQUENCE { measurementReport-v390ext MeasurementReport-v390ext, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions measurementReport-r3-add-ext BIT STRING OPTIONAL, v4b0NonCriticalExtensions SEQUENCE { measurementReport-v4b0ext MeasurementReport-v4b0ext-IEs, -- Extension mechanism for non-Rel4 information v590NonCriticalExtensions SEQUENCE { measurementReport-v590ext MeasurementReport-v590ext-IEs, v5b0NonCriticalExtensions SEQUENCE { measurementReport-v5b0ext MeasurementReport-v5b0ext-IEs, v690NonCriticalExtensions SEQUENCE { measurementReport-v690ext MeasurementReport-v690ext-IEs, v7xyNonCriticalExtensions SEQUENCE { measurementReport-v7xyext MeasurementReport-v7xyext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } MeasurementReport-v390ext ::= SEQUENCE { measuredResults-v390ext MeasuredResults-v390ext OPTIONAL } MeasurementReport-v4b0ext-IEs ::= SEQUENCE { interFreqEventResults-LCR InterFreqEventResults-LCR-r4-ext OPTIONAL, -- additionalMeasuredResults-LCR shall contain measurement results and additional measurement -- results list. additionalMeasuredResults-LCR MeasuredResultsList-LCR-r4-ext OPTIONAL, -- dummy is not used in this version of the specification. It should not be sent and -- if received it should be ignored. dummy PrimaryCPICH-Info OPTIONAL } MeasurementReport-v590ext-IEs ::= SEQUENCE { measuredResults-v590ext MeasuredResults-v590ext OPTIONAL } MeasurementReport-v5b0ext-IEs ::= SEQUENCE { interRATCellInfoIndication InterRATCellInfoIndication OPTIONAL } MeasurementReport-v690ext-IEs ::= SEQUENCE { measuredResultsOnRACHinterFreq MeasuredResultsOnRACHinterFreq OPTIONAL } MeasurementReport-v7xyext-IEs ::= SEQUENCE { velocityEstimate VelocityEstimate OPTIONAL, ue-InternalMeasuredResults UE-InternalMeasuredResults-r7 OPTIONAL } -- *************************************************** -- -- PAGING TYPE 1 -- -- *************************************************** PagingType1 ::= SEQUENCE { -- User equipment IEs pagingRecordList PagingRecordList OPTIONAL, -- Other IEs bcch-ModificationInfo BCCH-ModificationInfo OPTIONAL, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions pagingType1-r3-add-ext BIT STRING OPTIONAL, v590NonCriticalExtensions SEQUENCE { pagingType1-v590ext PagingType1-v590ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } PagingType1-v590ext-IEs ::= SEQUENCE { -- User equipment IEs pagingRecord2List PagingRecord2List-r5 OPTIONAL } -- *************************************************** -- -- PAGING TYPE 2 -- -- *************************************************** PagingType2 ::= SEQUENCE { -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier, pagingCause PagingCause, -- Core network IEs cn-DomainIdentity CN-DomainIdentity, pagingRecordTypeID PagingRecordTypeID, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions pagingType2-r3-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } -- *************************************************** -- -- PHYSICAL CHANNEL RECONFIGURATION -- -- *************************************************** PhysicalChannelReconfiguration ::= CHOICE { r3 SEQUENCE { physicalChannelReconfiguration-r3 PhysicalChannelReconfiguration-r3-IEs, v3a0NonCriticalExtensions SEQUENCE { physicalChannelReconfiguration-v3a0ext PhysicalChannelReconfiguration-v3a0ext, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions physicalChannelReconfiguration-r3-add-ext BIT STRING OPTIONAL, v4b0NonCriticalExtenstions SEQUENCE { physicalChannelReconfiguration-v4b0ext PhysicalChannelReconfiguration-v4b0ext-IEs, v590NonCriticalExtenstions SEQUENCE { physicalChannelReconfiguration-v590ext PhysicalChannelReconfiguration-v590ext-IEs, v690NonCriticalExtensions SEQUENCE { physicalChannelReconfiguration-v690ext PhysicalChannelReconfiguration-v690ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL }, later-than-r3 SEQUENCE { rrc-TransactionIdentifier RRC-TransactionIdentifier, criticalExtensions CHOICE { r4 SEQUENCE { physicalChannelReconfiguration-r4 PhysicalChannelReconfiguration-r4-IEs, v4d0NonCriticalExtensions SEQUENCE { -- Container for adding non critical extensions after freezing REL-5 physicalChannelReconfiguration-r4-add-ext BIT STRING OPTIONAL, v590NonCriticalExtenstions SEQUENCE { physicalChannelReconfiguration-v590ext PhysicalChannelReconfiguration-v590ext-IEs, v690NonCriticalExtensions SEQUENCE { physicalChannelReconfiguration-v690ext PhysicalChannelReconfiguration-v690ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL }, criticalExtensions CHOICE { r5 SEQUENCE { physicalChannelReconfiguration-r5 PhysicalChannelReconfiguration-r5-IEs, -- Container for adding non critical extensions after freezing REL-6 physicalChannelReconfiguration-r5-add-ext BIT STRING OPTIONAL, v690NonCriticalExtensions SEQUENCE { physicalChannelReconfiguration-v690ext PhysicalChannelReconfiguration-v690ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL }, criticalExtensions CHOICE { r6 SEQUENCE { physicalChannelReconfiguration-r6 PhysicalChannelReconfiguration-r6-IEs, -- Container for adding non critical extensions after freezing REL-7 physicalChannelReconfiguration-r6-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL }, criticalExtensions CHOICE { r7 SEQUENCE { physicalChannelReconfiguration-r7 PhysicalChannelReconfiguration-r7-IEs, -- Container for adding non critical extensions after freezing REL-8 physicalChannelReconfiguration-r7-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL }, criticalExtensions SEQUENCE {} } } } } } } PhysicalChannelReconfiguration-r3-IEs ::= SEQUENCE { -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier, integrityProtectionModeInfo IntegrityProtectionModeInfo OPTIONAL, cipheringModeInfo CipheringModeInfo OPTIONAL, activationTime ActivationTime OPTIONAL, new-U-RNTI U-RNTI OPTIONAL, new-C-RNTI C-RNTI OPTIONAL, rrc-StateIndicator RRC-StateIndicator, utran-DRX-CycleLengthCoeff UTRAN-DRX-CycleLengthCoefficient OPTIONAL, -- Core network IEs cn-InformationInfo CN-InformationInfo OPTIONAL, -- UTRAN mobility IEs ura-Identity URA-Identity OPTIONAL, -- Radio bearer IEs dl-CounterSynchronisationInfo DL-CounterSynchronisationInfo OPTIONAL, -- Physical channel IEs frequencyInfo FrequencyInfo OPTIONAL, maxAllowedUL-TX-Power MaxAllowedUL-TX-Power OPTIONAL, -- Note: the reference to CPCH in the element name below is incorrect. The name is not -- changed to keep it aligned with R99. ul-ChannelRequirement UL-ChannelRequirementWithCPCH-SetID OPTIONAL, modeSpecificInfo CHOICE { fdd SEQUENCE { -- dummy is not used in this version of specification, it should -- not be sent and if received it should be ignored. dummy DL-PDSCH-Information OPTIONAL }, tdd NULL }, dl-CommonInformation DL-CommonInformation OPTIONAL, dl-InformationPerRL-List DL-InformationPerRL-List OPTIONAL } PhysicalChannelReconfiguration-v3a0ext ::= SEQUENCE { -- The IE 窶從ew-DSCH-RNTI窶 should not be included in FDD mode, and if received the UE behaviour -- is unspecified new-DSCH-RNTI DSCH-RNTI OPTIONAL } PhysicalChannelReconfiguration-v4b0ext-IEs ::= SEQUENCE { -- Physical channel IEs -- dummy is not used in this version of the specification, it should -- not be sent and if received it should be ignored. dummy SSDT-UL OPTIONAL, -- The order of the RLs in IE cell-id-PerRL-List is the same as -- in IE DL-InformationPerRL-List included in this message cell-id-PerRL-List CellIdentity-PerRL-List OPTIONAL } PhysicalChannelReconfiguration-v590ext-IEs ::= SEQUENCE { -- Physical channel IEs dl-TPC-PowerOffsetPerRL-List DL-TPC-PowerOffsetPerRL-List OPTIONAL } PhysicalChannelReconfiguration-r4-IEs ::= SEQUENCE { -- User equipment IEs integrityProtectionModeInfo IntegrityProtectionModeInfo OPTIONAL, cipheringModeInfo CipheringModeInfo OPTIONAL, activationTime ActivationTime OPTIONAL, new-U-RNTI U-RNTI OPTIONAL, new-C-RNTI C-RNTI OPTIONAL, -- The IE 窶從ew-DSCH-RNTI窶 should not be included in FDD mode, and if received -- the UE behaviour is unspecified new-DSCH-RNTI DSCH-RNTI OPTIONAL, rrc-StateIndicator RRC-StateIndicator, utran-DRX-CycleLengthCoeff UTRAN-DRX-CycleLengthCoefficient OPTIONAL, -- Core network IEs cn-InformationInfo CN-InformationInfo OPTIONAL, -- UTRAN mobility IEs ura-Identity URA-Identity OPTIONAL, -- Radio bearer IEs dl-CounterSynchronisationInfo DL-CounterSynchronisationInfo OPTIONAL, -- Physical channel IEs frequencyInfo FrequencyInfo OPTIONAL, maxAllowedUL-TX-Power MaxAllowedUL-TX-Power OPTIONAL, -- Note: the reference to CPCH in the element name below is incorrect. The name is not -- changed to keep it aligned with R99. ul-ChannelRequirement UL-ChannelRequirementWithCPCH-SetID-r4 OPTIONAL, modeSpecificInfo CHOICE { fdd SEQUENCE { -- dummy is not used in this version of specification, it should -- not be sent and if received it should be ignored. dummy DL-PDSCH-Information OPTIONAL }, tdd NULL }, dl-CommonInformation DL-CommonInformation-r4 OPTIONAL, dl-InformationPerRL-List DL-InformationPerRL-List-r4 OPTIONAL } PhysicalChannelReconfiguration-r5-IEs ::= SEQUENCE { -- User equipment IEs integrityProtectionModeInfo IntegrityProtectionModeInfo OPTIONAL, cipheringModeInfo CipheringModeInfo OPTIONAL, activationTime ActivationTime OPTIONAL, new-U-RNTI U-RNTI OPTIONAL, new-C-RNTI C-RNTI OPTIONAL, -- The IE 窶從ew-DSCH-RNTI窶 should not be included in FDD mode, and if received -- the UE behaviour is unspecified new-DSCH-RNTI DSCH-RNTI OPTIONAL, new-H-RNTI H-RNTI OPTIONAL, rrc-StateIndicator RRC-StateIndicator, utran-DRX-CycleLengthCoeff UTRAN-DRX-CycleLengthCoefficient OPTIONAL, -- Core network IEs cn-InformationInfo CN-InformationInfo OPTIONAL, -- UTRAN mobility IEs ura-Identity URA-Identity OPTIONAL, -- Radio bearer IEs dl-CounterSynchronisationInfo DL-CounterSynchronisationInfo-r5 OPTIONAL, -- Physical channel IEs frequencyInfo FrequencyInfo OPTIONAL, maxAllowedUL-TX-Power MaxAllowedUL-TX-Power OPTIONAL, -- Note: the reference to CPCH in the element name below is incorrect. The name is not -- changed to keep it aligned with R99. ul-ChannelRequirement UL-ChannelRequirementWithCPCH-SetID-r5 OPTIONAL, modeSpecificInfo CHOICE { fdd SEQUENCE { -- dummy is not used in this version of specification, it should -- not be sent and if received it should be ignored. dummy DL-PDSCH-Information OPTIONAL }, tdd NULL }, dl-HSPDSCH-Information DL-HSPDSCH-Information OPTIONAL, dl-CommonInformation DL-CommonInformation-r5 OPTIONAL, dl-InformationPerRL-List DL-InformationPerRL-List-r5 OPTIONAL } PhysicalChannelReconfiguration-r6-IEs ::= SEQUENCE { -- User equipment IEs integrityProtectionModeInfo IntegrityProtectionModeInfo OPTIONAL, cipheringModeInfo CipheringModeInfo OPTIONAL, activationTime ActivationTime OPTIONAL, delayRestrictionFlag DelayRestrictionFlag OPTIONAL, new-U-RNTI U-RNTI OPTIONAL, new-C-RNTI C-RNTI OPTIONAL, -- The IE 窶從ew-DSCH-RNTI窶 should not be included in FDD mode, -- and if received the UE behaviour is unspecified new-DSCH-RNTI DSCH-RNTI OPTIONAL, new-H-RNTI H-RNTI OPTIONAL, newPrimary-E-RNTI E-RNTI OPTIONAL, newSecondary-E-RNTI E-RNTI OPTIONAL, rrc-StateIndicator RRC-StateIndicator, utran-DRX-CycleLengthCoeff UTRAN-DRX-CycleLengthCoefficient OPTIONAL, -- Core network IEs cn-InformationInfo CN-InformationInfo-r6 OPTIONAL, -- UTRAN mobility IEs ura-Identity URA-Identity OPTIONAL, -- Radio bearer IEs dl-CounterSynchronisationInfo DL-CounterSynchronisationInfo-r5 OPTIONAL, -- Physical channel IEs frequencyInfo FrequencyInfo OPTIONAL, maxAllowedUL-TX-Power MaxAllowedUL-TX-Power OPTIONAL, ul-DPCH-Info UL-DPCH-Info-r6 OPTIONAL, ul-EDCH-Information UL-EDCH-Information-r6 OPTIONAL, dl-HSPDSCH-Information DL-HSPDSCH-Information-r6 OPTIONAL, dl-CommonInformation DL-CommonInformation-r6 OPTIONAL, dl-InformationPerRL-List DL-InformationPerRL-List-r6 OPTIONAL, -- MBMS IEs mbms-PL-ServiceRestrictInfo MBMS-PL-ServiceRestrictInfo-r6 OPTIONAL } PhysicalChannelReconfiguration-v690ext-IEs ::= SEQUENCE { -- User Equipment IEs delayRestrictionFlag DelayRestrictionFlag OPTIONAL, -- Core network IEs primary-plmn-Identity PLMN-Identity OPTIONAL, -- Physical channel IEs -- The IE harq-Preamble-Mode should not be used in the r3 and r4 versions of the message -- If included in the r3 or r4 version of the message, the UE should ignore the IE harq-Preamble-Mode HARQ-Preamble-Mode OPTIONAL, beaconPLEst BEACON-PL-Est OPTIONAL, postVerificationPeriod ENUMERATED { true } OPTIONAL, dhs-sync DHS-Sync OPTIONAL, timingMaintainedSynchInd TimingMaintainedSynchInd OPTIONAL, -- MBMS IEs mbms-PL-ServiceRestrictInfo MBMS-PL-ServiceRestrictInfo-r6 OPTIONAL } PhysicalChannelReconfiguration-r7-IEs ::= SEQUENCE { -- User equipment IEs integrityProtectionModeInfo IntegrityProtectionModeInfo OPTIONAL, cipheringModeInfo CipheringModeInfo OPTIONAL, activationTime ActivationTime OPTIONAL, delayRestrictionFlag DelayRestrictionFlag OPTIONAL, new-U-RNTI U-RNTI OPTIONAL, new-C-RNTI C-RNTI OPTIONAL, -- The IE 窶從ew-DSCH-RNTI窶 should not be included in FDD mode, -- and if received the UE behaviour is unspecified new-DSCH-RNTI DSCH-RNTI OPTIONAL, new-H-RNTI H-RNTI OPTIONAL, newPrimary-E-RNTI E-RNTI OPTIONAL, newSecondary-E-RNTI E-RNTI OPTIONAL, rrc-StateIndicator RRC-StateIndicator, utran-DRX-CycleLengthCoeff UTRAN-DRX-CycleLengthCoefficient OPTIONAL, -- Core network IEs cn-InformationInfo CN-InformationInfo-r6 OPTIONAL, -- UTRAN mobility IEs ura-Identity URA-Identity OPTIONAL, -- Radio bearer IEs dl-CounterSynchronisationInfo DL-CounterSynchronisationInfo-r5 OPTIONAL, -- Physical channel IEs frequencyInfo FrequencyInfo OPTIONAL, maxAllowedUL-TX-Power MaxAllowedUL-TX-Power OPTIONAL, ul-DPCH-Info UL-DPCH-Info-r7 OPTIONAL, ul-EDCH-Information UL-EDCH-Information-r6 OPTIONAL, dl-HSPDSCH-Information DL-HSPDSCH-Information-r7 OPTIONAL, dl-CommonInformation DL-CommonInformation-r7 OPTIONAL, dl-InformationPerRL-List DL-InformationPerRL-List-r7 OPTIONAL, -- MBMS IEs mbms-PL-ServiceRestrictInfo MBMS-PL-ServiceRestrictInfo-r6 OPTIONAL } -- *************************************************** -- -- PHYSICAL CHANNEL RECONFIGURATION COMPLETE -- -- *************************************************** PhysicalChannelReconfigurationComplete ::= SEQUENCE { -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier, ul-IntegProtActivationInfo IntegrityProtActivationInfo OPTIONAL, -- TABULAR: UL-TimingAdvance is applicable for TDD mode only. ul-TimingAdvance UL-TimingAdvance OPTIONAL, -- Radio bearer IEs count-C-ActivationTime ActivationTime OPTIONAL, -- dummy is not used in this version of the specification and -- it should be ignored by the receiver. dummy RB-ActivationTimeInfoList OPTIONAL, ul-CounterSynchronisationInfo UL-CounterSynchronisationInfo OPTIONAL, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions physicalChannelReconfigurationComplete-r3-add-ext BIT STRING OPTIONAL, v7xyNonCriticalExtensions SEQUENCE { physicalChannelReconfigurationComplete-v7xyext PhysicalChannelReconfigurationComplete-v7xyext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } PhysicalChannelReconfigurationComplete-v7xyext-IEs ::= SEQUENCE { ext-ul-TimingAdvance EXT-UL-TimingAdvance OPTIONAL } -- *************************************************** -- -- PHYSICAL CHANNEL RECONFIGURATION FAILURE -- -- *************************************************** PhysicalChannelReconfigurationFailure ::= SEQUENCE { -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier OPTIONAL, failureCause FailureCauseWithProtErr, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions physicalChannelReconfigurationFailure-r3-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } -- *************************************************** -- -- PHYSICAL SHARED CHANNEL ALLOCATION (TDD only) -- -- *************************************************** PhysicalSharedChannelAllocation ::= CHOICE { r3 SEQUENCE { physicalSharedChannelAllocation-r3 PhysicalSharedChannelAllocation-r3-IEs, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions physicalSharedChannelAllocation-r3-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL }, later-than-r3 SEQUENCE { dsch-RNTI DSCH-RNTI OPTIONAL, rrc-TransactionIdentifier RRC-TransactionIdentifier, criticalExtensions CHOICE { r4 SEQUENCE { physicalSharedChannelAllocation-r4 PhysicalSharedChannelAllocation-r4-IEs, v4d0NonCriticalExtensions SEQUENCE { -- Container for adding non critical extensions after freezing REL-5 physicalSharedChannelAllocation-r4-add-ext BIT STRING OPTIONAL, v690NonCriticalExtensions SEQUENCE { physicalSharedChannelAllocation-v690ext PhysicalSharedChannelAllocation-v690ext-IEs, v7xyNonCriticalExtensions SEQUENCE { physicalSharedChannelAllocation-v7xyext PhysicalSharedChannelAllocation-v7xyext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL }, criticalExtensions SEQUENCE {} } } } PhysicalSharedChannelAllocation-r3-IEs ::= SEQUENCE { -- TABULAR: Integrity protection shall not be performed on this message. -- User equipment IEs dsch-RNTI DSCH-RNTI OPTIONAL, rrc-TransactionIdentifier RRC-TransactionIdentifier, -- Physical channel IEs ul-TimingAdvance UL-TimingAdvanceControl OPTIONAL, pusch-CapacityAllocationInfo PUSCH-CapacityAllocationInfo OPTIONAL, pdsch-CapacityAllocationInfo PDSCH-CapacityAllocationInfo OPTIONAL, -- TABULAR: If confirmRequest is not present, the default value "No Confirm" -- shall be used as specified in 10.2.25. confirmRequest ENUMERATED { confirmPDSCH, confirmPUSCH } OPTIONAL, trafficVolumeReportRequest INTEGER (0..255) OPTIONAL, iscpTimeslotList TimeslotList OPTIONAL, requestPCCPCHRSCP BOOLEAN } PhysicalSharedChannelAllocation-r4-IEs ::= SEQUENCE { -- TABULAR: Integrity protection shall not be performed on this message. -- Physical channel IEs ul-TimingAdvance UL-TimingAdvanceControl-r4 OPTIONAL, pusch-CapacityAllocationInfo PUSCH-CapacityAllocationInfo-r4 OPTIONAL, pdsch-CapacityAllocationInfo PDSCH-CapacityAllocationInfo-r4 OPTIONAL, -- TABULAR: If confirmRequest is not present, the default value "No Confirm" -- shall be used as specified in 10.2.25. confirmRequest ENUMERATED { confirmPDSCH, confirmPUSCH } OPTIONAL, trafficVolumeReportRequest INTEGER (0..255) OPTIONAL, iscpTimeslotList TimeslotList-r4 OPTIONAL, requestPCCPCHRSCP BOOLEAN } PhysicalSharedChannelAllocation-v690ext-IEs ::= SEQUENCE { -- Physical Channel IEs beaconPLEst BEACON-PL-Est OPTIONAL } PhysicalSharedChannelAllocation-v7xyext-IEs ::= SEQUENCE { ul-TimingAdvance UL-TimingAdvanceControl-r7 OPTIONAL, pusch-CapacityAllocationInfo PUSCH-CapacityAllocationInfo-r7 OPTIONAL, pdsch-CapacityAllocationInfo PDSCH-CapacityAllocationInfo-r7 OPTIONAL } -- *************************************************** -- -- PUSCH CAPACITY REQUEST (TDD only) -- -- *************************************************** PUSCHCapacityRequest ::= SEQUENCE { -- User equipment IEs dsch-RNTI DSCH-RNTI OPTIONAL, -- Measurement IEs trafficVolume TrafficVolumeMeasuredResultsList OPTIONAL, timeslotListWithISCP TimeslotListWithISCP OPTIONAL, primaryCCPCH-RSCP PrimaryCCPCH-RSCP OPTIONAL, allocationConfirmation CHOICE { pdschConfirmation PDSCH-Identity, puschConfirmation PUSCH-Identity } OPTIONAL, protocolErrorIndicator ProtocolErrorIndicatorWithMoreInfo, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions puschCapacityRequest-r3-add-ext BIT STRING OPTIONAL, v590NonCriticalExtensions SEQUENCE { puschCapacityRequest-v590ext PUSCHCapacityRequest-v590ext, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } PUSCHCapacityRequest-v590ext ::= SEQUENCE { primaryCCPCH-RSCP-delta DeltaRSCP OPTIONAL } -- *************************************************** -- -- RADIO BEARER RECONFIGURATION -- -- *************************************************** RadioBearerReconfiguration ::= CHOICE { r3 SEQUENCE { radioBearerReconfiguration-r3 RadioBearerReconfiguration-r3-IEs, -- Prefix "v3ao" is used (in one instance) to keep alignment with R99 v3aoNonCriticalExtensions SEQUENCE { radioBearerReconfiguration-v3a0ext RadioBearerReconfiguration-v3a0ext, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions radioBearerReconfiguration-r3-add-ext BIT STRING OPTIONAL, v4b0NonCriticalExtensions SEQUENCE { radioBearerReconfiguration-v4b0ext RadioBearerReconfiguration-v4b0ext-IEs, v590NonCriticalExtensions SEQUENCE { radioBearerReconfiguration-v590ext RadioBearerReconfiguration-v590ext-IEs, v5d0NonCriticalExtenstions SEQUENCE { radioBearerReconfiguration-v5d0ext RadioBearerReconfiguration-v5d0ext-IEs, v690NonCriticalExtensions SEQUENCE { radioBearerReconfiguration-v690ext RadioBearerReconfiguration-v690ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL }, later-than-r3 SEQUENCE { rrc-TransactionIdentifier RRC-TransactionIdentifier, criticalExtensions CHOICE { r4 SEQUENCE { radioBearerReconfiguration-r4 RadioBearerReconfiguration-r4-IEs, v4d0NonCriticalExtensions SEQUENCE { -- Container for adding non critical extensions after freezing REL-5 radioBearerReconfiguration-r4-add-ext BIT STRING OPTIONAL, v590NonCriticalExtensions SEQUENCE { radioBearerReconfiguration-v590ext RadioBearerReconfiguration-v590ext-IEs, v5d0NonCriticalExtenstions SEQUENCE { radioBearerReconfiguration-v5d0ext RadioBearerReconfiguration-v5d0ext-IEs, v690NonCriticalExtensions SEQUENCE { radioBearerReconfiguration-v690ext RadioBearerReconfiguration-v690ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL }, criticalExtensions CHOICE { r5 SEQUENCE { radioBearerReconfiguration-r5 RadioBearerReconfiguration-r5-IEs, -- Container for adding non critical extensions after freezing REL-6 radioBearerReconfiguration-r5-add-ext BIT STRING OPTIONAL, v5d0NonCriticalExtenstions SEQUENCE { radioBearerReconfiguration-v5d0ext RadioBearerReconfiguration-v5d0ext-IEs, v690NonCriticalExtensions SEQUENCE { radioBearerReconfiguration-v690ext RadioBearerReconfiguration-v690ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL }, criticalExtensions CHOICE { r6 SEQUENCE { radioBearerReconfiguration-r6 RadioBearerReconfiguration-r6-IEs, -- Container for adding non critical extensions after freezing REL-7 radioBearerReconfiguration-r6-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL }, criticalExtensions CHOICE { r7 SEQUENCE { radioBearerReconfiguration-r7 RadioBearerReconfiguration-r7-IEs, -- Container for adding non critical extensions after freezing REL-8 radioBearerReconfiguration-r7-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL }, criticalExtensions SEQUENCE {} } } } } } } RadioBearerReconfiguration-r3-IEs ::= SEQUENCE { -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier, integrityProtectionModeInfo IntegrityProtectionModeInfo OPTIONAL, cipheringModeInfo CipheringModeInfo OPTIONAL, activationTime ActivationTime OPTIONAL, new-U-RNTI U-RNTI OPTIONAL, new-C-RNTI C-RNTI OPTIONAL, rrc-StateIndicator RRC-StateIndicator, utran-DRX-CycleLengthCoeff UTRAN-DRX-CycleLengthCoefficient OPTIONAL, -- Core network IEs cn-InformationInfo CN-InformationInfo OPTIONAL, -- UTRAN mobility IEs ura-Identity URA-Identity OPTIONAL, -- Radio bearer IEs rab-InformationReconfigList RAB-InformationReconfigList OPTIONAL, -- NOTE: IE rb-InformationReconfigList should be optional in later versions -- of this message rb-InformationReconfigList RB-InformationReconfigList, rb-InformationAffectedList RB-InformationAffectedList OPTIONAL, -- Transport channel IEs ul-CommonTransChInfo UL-CommonTransChInfo OPTIONAL, ul-deletedTransChInfoList UL-DeletedTransChInfoList OPTIONAL, ul-AddReconfTransChInfoList UL-AddReconfTransChInfoList OPTIONAL, -- 'dummy', 'dummy1' and 'dummy2' are not used in this version of the specification, -- they should not be sent and if received they should be ignored. dummy CHOICE { fdd SEQUENCE { dummy1 CPCH-SetID OPTIONAL, dummy2 DRAC-StaticInformationList OPTIONAL }, tdd NULL } OPTIONAL, dl-CommonTransChInfo DL-CommonTransChInfo OPTIONAL, dl-DeletedTransChInfoList DL-DeletedTransChInfoList OPTIONAL, dl-AddReconfTransChInfoList DL-AddReconfTransChInfo2List OPTIONAL, -- Physical channel IEs frequencyInfo FrequencyInfo OPTIONAL, maxAllowedUL-TX-Power MaxAllowedUL-TX-Power OPTIONAL, ul-ChannelRequirement UL-ChannelRequirement OPTIONAL, modeSpecificPhysChInfo CHOICE { fdd SEQUENCE { -- dummy is not used in this version of specification, it should -- not be sent and if received it should be ignored. dummy DL-PDSCH-Information OPTIONAL }, tdd NULL }, dl-CommonInformation DL-CommonInformation OPTIONAL, -- NOTE: IE dl-InformationPerRL-List is optional in later versions -- of this message dl-InformationPerRL-List DL-InformationPerRL-List } RadioBearerReconfiguration-v3a0ext ::= SEQUENCE { -- The IE 窶從ew-DSCH-RNTI窶 should not be included in FDD mode, and if received the UE behaviour -- is unspecified new-DSCH-RNTI DSCH-RNTI OPTIONAL } RadioBearerReconfiguration-v4b0ext-IEs ::= SEQUENCE { -- Physical channel IEs -- dummy is not used in this version of the specification, it should -- not be sent and if received it should be ignored. dummy SSDT-UL OPTIONAL, -- The order of the RLs in IE cell-id-PerRL-List is the same as -- in IE DL-InformationPerRL-List included in this message cell-id-PerRL-List CellIdentity-PerRL-List OPTIONAL } RadioBearerReconfiguration-v590ext-IEs ::= SEQUENCE { -- Physical channel IEs dl-TPC-PowerOffsetPerRL-List DL-TPC-PowerOffsetPerRL-List OPTIONAL } RadioBearerReconfiguration-v5d0ext-IEs ::= SEQUENCE { --Radio Bearer IEs pdcp-ROHC-TargetMode PDCP-ROHC-TargetMode OPTIONAL } RadioBearerReconfiguration-r4-IEs ::= SEQUENCE { -- User equipment IEs integrityProtectionModeInfo IntegrityProtectionModeInfo OPTIONAL, cipheringModeInfo CipheringModeInfo OPTIONAL, activationTime ActivationTime OPTIONAL, new-U-RNTI U-RNTI OPTIONAL, new-C-RNTI C-RNTI OPTIONAL, -- The IE 窶從ew-DSCH-RNTI窶 should not be included in FDD mode, and if received -- the UE behaviour is unspecified new-DSCH-RNTI DSCH-RNTI OPTIONAL, rrc-StateIndicator RRC-StateIndicator, utran-DRX-CycleLengthCoeff UTRAN-DRX-CycleLengthCoefficient OPTIONAL, -- Core network IEs cn-InformationInfo CN-InformationInfo OPTIONAL, -- UTRAN mobility IEs ura-Identity URA-Identity OPTIONAL, -- Radio bearer IEs rab-InformationReconfigList RAB-InformationReconfigList OPTIONAL, rb-InformationReconfigList RB-InformationReconfigList-r4 OPTIONAL, rb-InformationAffectedList RB-InformationAffectedList OPTIONAL, -- Transport channel IEs ul-CommonTransChInfo UL-CommonTransChInfo-r4 OPTIONAL, ul-deletedTransChInfoList UL-DeletedTransChInfoList OPTIONAL, ul-AddReconfTransChInfoList UL-AddReconfTransChInfoList OPTIONAL, -- 'dummy', 'dummy1' and 'dummy2' are not used in this version of the specification, -- they should not be sent and if received they should be ignored. dummy CHOICE { fdd SEQUENCE { dummy1 CPCH-SetID OPTIONAL, dummy2 DRAC-StaticInformationList OPTIONAL }, tdd NULL } OPTIONAL, dl-CommonTransChInfo DL-CommonTransChInfo-r4 OPTIONAL, dl-DeletedTransChInfoList DL-DeletedTransChInfoList OPTIONAL, dl-AddReconfTransChInfoList DL-AddReconfTransChInfoList-r4 OPTIONAL, -- Physical channel IEs frequencyInfo FrequencyInfo OPTIONAL, maxAllowedUL-TX-Power MaxAllowedUL-TX-Power OPTIONAL, ul-ChannelRequirement UL-ChannelRequirement-r4 OPTIONAL, modeSpecificPhysChInfo CHOICE { fdd SEQUENCE { -- dummy is not used in this version of specification, it should -- not be sent and if received it should be ignored. dummy DL-PDSCH-Information OPTIONAL }, tdd NULL }, dl-CommonInformation DL-CommonInformation-r4 OPTIONAL, dl-InformationPerRL-List DL-InformationPerRL-List-r4 OPTIONAL } RadioBearerReconfiguration-r5-IEs ::= SEQUENCE { -- User equipment IEs integrityProtectionModeInfo IntegrityProtectionModeInfo OPTIONAL, cipheringModeInfo CipheringModeInfo OPTIONAL, activationTime ActivationTime OPTIONAL, new-U-RNTI U-RNTI OPTIONAL, new-C-RNTI C-RNTI OPTIONAL, -- The IE 窶從ew-DSCH-RNTI窶 should not be included in FDD mode, and if received -- the UE behaviour is unspecified new-DSCH-RNTI DSCH-RNTI OPTIONAL, new-H-RNTI H-RNTI OPTIONAL, rrc-StateIndicator RRC-StateIndicator, utran-DRX-CycleLengthCoeff UTRAN-DRX-CycleLengthCoefficient OPTIONAL, -- Core network IEs cn-InformationInfo CN-InformationInfo OPTIONAL, -- UTRAN mobility IEs ura-Identity URA-Identity OPTIONAL, -- Specification mode information specificationMode CHOICE { complete SEQUENCE { -- Radio bearer IEs rab-InformationReconfigList RAB-InformationReconfigList OPTIONAL, rb-InformationReconfigList RB-InformationReconfigList-r5 OPTIONAL, rb-InformationAffectedList RB-InformationAffectedList-r5 OPTIONAL, rb-PDCPContextRelocationList RB-PDCPContextRelocationList OPTIONAL, -- Transport channel IEs ul-CommonTransChInfo UL-CommonTransChInfo-r4 OPTIONAL, ul-deletedTransChInfoList UL-DeletedTransChInfoList OPTIONAL, ul-AddReconfTransChInfoList UL-AddReconfTransChInfoList OPTIONAL, -- 'dummy', 'dummy1' and 'dummy2' are not used in this version of the -- specification, they should not be sent and if received they should be ignored. dummy CHOICE { fdd SEQUENCE { dummy1 CPCH-SetID OPTIONAL, dummy2 DRAC-StaticInformationList OPTIONAL }, tdd NULL } OPTIONAL, dl-CommonTransChInfo DL-CommonTransChInfo-r4 OPTIONAL, dl-DeletedTransChInfoList DL-DeletedTransChInfoList-r5 OPTIONAL, dl-AddReconfTransChInfoList DL-AddReconfTransChInfoList-r5 OPTIONAL }, preconfiguration SEQUENCE { -- All IEs that include an FDD/TDD choice are split in two IEs for this message, -- one for the FDD only elements and one for the TDD only elements, so that one -- FDD/TDD choice in this level is sufficient. preConfigMode CHOICE { predefinedConfigIdentity PredefinedConfigIdentity, defaultConfig SEQUENCE { defaultConfigMode DefaultConfigMode, defaultConfigIdentity DefaultConfigIdentity-r5 } } } }, -- Physical channel IEs frequencyInfo FrequencyInfo OPTIONAL, maxAllowedUL-TX-Power MaxAllowedUL-TX-Power OPTIONAL, ul-ChannelRequirement UL-ChannelRequirement-r5 OPTIONAL, modeSpecificPhysChInfo CHOICE { fdd SEQUENCE { -- dummy is not used in this version of specification, it should -- not be sent and if received it should be ignored. dummy DL-PDSCH-Information OPTIONAL }, tdd NULL }, dl-HSPDSCH-Information DL-HSPDSCH-Information OPTIONAL, dl-CommonInformation DL-CommonInformation-r5 OPTIONAL, dl-InformationPerRL-List DL-InformationPerRL-List-r5 OPTIONAL } RadioBearerReconfiguration-r6-IEs ::= SEQUENCE { -- User equipment IEs integrityProtectionModeInfo IntegrityProtectionModeInfo OPTIONAL, cipheringModeInfo CipheringModeInfo OPTIONAL, activationTime ActivationTime OPTIONAL, delayRestrictionFlag DelayRestrictionFlag OPTIONAL, new-U-RNTI U-RNTI OPTIONAL, new-C-RNTI C-RNTI OPTIONAL, -- The IE 窶從ew-DSCH-RNTI窶 should not be included in FDD mode, -- and if received the UE behaviour is unspecified new-DSCH-RNTI DSCH-RNTI OPTIONAL, new-H-RNTI H-RNTI OPTIONAL, newPrimary-E-RNTI E-RNTI OPTIONAL, newSecondary-E-RNTI E-RNTI OPTIONAL, rrc-StateIndicator RRC-StateIndicator, utran-DRX-CycleLengthCoeff UTRAN-DRX-CycleLengthCoefficient OPTIONAL, -- Core network IEs cn-InformationInfo CN-InformationInfo-r6 OPTIONAL, -- UTRAN mobility IEs ura-Identity URA-Identity OPTIONAL, -- Specification mode information specificationMode CHOICE { complete SEQUENCE { -- Radio bearer IEs rab-InformationReconfigList RAB-InformationReconfigList OPTIONAL, rb-InformationReconfigList RB-InformationReconfigList-r6 OPTIONAL, rb-InformationAffectedList RB-InformationAffectedList-r6 OPTIONAL, rb-PDCPContextRelocationList RB-PDCPContextRelocationList OPTIONAL, pdcp-ROHC-TargetMode PDCP-ROHC-TargetMode OPTIONAL, -- Transport channel IEs ul-CommonTransChInfo UL-CommonTransChInfo-r4 OPTIONAL, ul-deletedTransChInfoList UL-DeletedTransChInfoList-r6 OPTIONAL, ul-AddReconfTransChInfoList UL-AddReconfTransChInfoList-r6 OPTIONAL, dl-CommonTransChInfo DL-CommonTransChInfo-r4 OPTIONAL, dl-DeletedTransChInfoList DL-DeletedTransChInfoList-r5 OPTIONAL, dl-AddReconfTransChInfoList DL-AddReconfTransChInfoList-r5 OPTIONAL }, preconfiguration SEQUENCE { -- All IEs that include an FDD/TDD choice are split in two IEs for this message, -- one for the FDD only elements and one for the TDD only elements, so that one -- FDD/TDD choice in this level is sufficient. preConfigMode CHOICE { predefinedConfigIdentity PredefinedConfigIdentity, defaultConfig SEQUENCE { defaultConfigMode DefaultConfigMode, defaultConfigIdentity DefaultConfigIdentity-r6 } } } }, -- Physical channel IEs frequencyInfo FrequencyInfo OPTIONAL, maxAllowedUL-TX-Power MaxAllowedUL-TX-Power OPTIONAL, ul-DPCH-Info UL-DPCH-Info-r6 OPTIONAL, ul-EDCH-Information UL-EDCH-Information-r6 OPTIONAL, dl-HSPDSCH-Information DL-HSPDSCH-Information-r6 OPTIONAL, dl-CommonInformation DL-CommonInformation-r6 OPTIONAL, dl-InformationPerRL-List DL-InformationPerRL-List-r6 OPTIONAL, -- MBMS IEs mbms-PL-ServiceRestrictInfo MBMS-PL-ServiceRestrictInfo-r6 OPTIONAL } RadioBearerReconfiguration-v690ext-IEs ::= SEQUENCE { -- User Equipment IEs delayRestrictionFlag DelayRestrictionFlag OPTIONAL, -- Core network IEs primary-plmn-Identity PLMN-Identity OPTIONAL, -- Physical channel IEs -- The IE harq-Preamble-Mode should not be used in the r3 and r4 versions of the message -- If included in the r3 or r4 version of the message, the UE should ignore the IE harq-Preamble-Mode HARQ-Preamble-Mode OPTIONAL, beaconPLEst BEACON-PL-Est OPTIONAL, postVerificationPeriod ENUMERATED { true } OPTIONAL, dhs-sync DHS-Sync OPTIONAL, timingMaintainedSynchInd TimingMaintainedSynchInd OPTIONAL, -- MBMS IEs mbms-PL-ServiceRestrictInfo MBMS-PL-ServiceRestrictInfo-r6 OPTIONAL } RadioBearerReconfiguration-r7-IEs ::= SEQUENCE { -- User equipment IEs integrityProtectionModeInfo IntegrityProtectionModeInfo OPTIONAL, cipheringModeInfo CipheringModeInfo OPTIONAL, activationTime ActivationTime OPTIONAL, delayRestrictionFlag DelayRestrictionFlag OPTIONAL, new-U-RNTI U-RNTI OPTIONAL, new-C-RNTI C-RNTI OPTIONAL, -- The IE 窶從ew-DSCH-RNTI窶 should not be included in FDD mode, -- and if received the UE behaviour is unspecified new-DSCH-RNTI DSCH-RNTI OPTIONAL, new-H-RNTI H-RNTI OPTIONAL, newPrimary-E-RNTI E-RNTI OPTIONAL, newSecondary-E-RNTI E-RNTI OPTIONAL, rrc-StateIndicator RRC-StateIndicator, utran-DRX-CycleLengthCoeff UTRAN-DRX-CycleLengthCoefficient OPTIONAL, -- Core network IEs cn-InformationInfo CN-InformationInfo-r6 OPTIONAL, -- UTRAN mobility IEs ura-Identity URA-Identity OPTIONAL, -- Specification mode information specificationMode CHOICE { complete SEQUENCE { -- Radio bearer IEs rab-InformationReconfigList RAB-InformationReconfigList OPTIONAL, rb-InformationReconfigList RB-InformationReconfigList-r6 OPTIONAL, rb-InformationAffectedList RB-InformationAffectedList-r6 OPTIONAL, rb-PDCPContextRelocationList RB-PDCPContextRelocationList OPTIONAL, pdcp-ROHC-TargetMode PDCP-ROHC-TargetMode OPTIONAL, -- Transport channel IEs ul-CommonTransChInfo UL-CommonTransChInfo-r4 OPTIONAL, ul-deletedTransChInfoList UL-DeletedTransChInfoList-r6 OPTIONAL, ul-AddReconfTransChInfoList UL-AddReconfTransChInfoList-r6 OPTIONAL, dl-CommonTransChInfo DL-CommonTransChInfo-r4 OPTIONAL, dl-DeletedTransChInfoList DL-DeletedTransChInfoList-r5 OPTIONAL, dl-AddReconfTransChInfoList DL-AddReconfTransChInfoList-r5 OPTIONAL }, preconfiguration SEQUENCE { -- All IEs that include an FDD/TDD choice are split in two IEs for this message, -- one for the FDD only elements and one for the TDD only elements, so that one -- FDD/TDD choice in this level is sufficient. preConfigMode CHOICE { predefinedConfigIdentity PredefinedConfigIdentity, defaultConfig SEQUENCE { defaultConfigMode DefaultConfigMode, defaultConfigIdentity DefaultConfigIdentity-r6 } } } }, -- Physical channel IEs frequencyInfo FrequencyInfo OPTIONAL, maxAllowedUL-TX-Power MaxAllowedUL-TX-Power OPTIONAL, ul-DPCH-Info UL-DPCH-Info-r7 OPTIONAL, ul-EDCH-Information UL-EDCH-Information-r6 OPTIONAL, dl-HSPDSCH-Information DL-HSPDSCH-Information-r7 OPTIONAL, dl-CommonInformation DL-CommonInformation-r7 OPTIONAL, dl-InformationPerRL-List DL-InformationPerRL-List-r7 OPTIONAL, -- MBMS IEs mbms-PL-ServiceRestrictInfo MBMS-PL-ServiceRestrictInfo-r6 OPTIONAL } -- *************************************************** -- -- RADIO BEARER RECONFIGURATION COMPLETE -- -- *************************************************** RadioBearerReconfigurationComplete ::= SEQUENCE { -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier, ul-IntegProtActivationInfo IntegrityProtActivationInfo OPTIONAL, -- TABULAR: UL-TimingAdvance is applicable for TDD mode only. ul-TimingAdvance UL-TimingAdvance OPTIONAL, -- Radio bearer IEs count-C-ActivationTime ActivationTime OPTIONAL, -- dummy is not used in this version of the specification and -- it should be ignored by the receiver. dummy RB-ActivationTimeInfoList OPTIONAL, ul-CounterSynchronisationInfo UL-CounterSynchronisationInfo OPTIONAL, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions radioBearerReconfigurationComplete-r3-add-ext BIT STRING OPTIONAL, v7xyNonCriticalExtensions SEQUENCE { radioBearerReconfigurationComplete-v7xyext RadioBearerReconfigurationComplete-v7xyext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } RadioBearerReconfigurationComplete-v7xyext-IEs ::= SEQUENCE { ext-ul-TimingAdvance EXT-UL-TimingAdvance OPTIONAL } -- *************************************************** -- -- RADIO BEARER RECONFIGURATION FAILURE -- -- *************************************************** RadioBearerReconfigurationFailure ::= SEQUENCE { -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier, failureCause FailureCauseWithProtErr, -- Radio bearer IEs potentiallySuccesfulBearerList RB-IdentityList OPTIONAL, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions radioBearerReconfigurationFailure-r3-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } -- *************************************************** -- -- RADIO BEARER RELEASE -- -- *************************************************** RadioBearerRelease ::= CHOICE { r3 SEQUENCE { radioBearerRelease-r3 RadioBearerRelease-r3-IEs, v3a0NonCriticalExtensions SEQUENCE { radioBearerRelease-v3a0ext RadioBearerRelease-v3a0ext, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions radioBearerRelease-r3-add-ext BIT STRING OPTIONAL, v4b0NonCriticalExtensions SEQUENCE { radioBearerRelease-v4b0ext RadioBearerRelease-v4b0ext-IEs, v590NonCriticalExtensions SEQUENCE { radioBearerRelease-v590ext RadioBearerRelease-v590ext-IEs, v690NonCriticalExtensions SEQUENCE { radioBearerRelease-v690ext RadioBearerRelease-v690ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL }, later-than-r3 SEQUENCE { rrc-TransactionIdentifier RRC-TransactionIdentifier, criticalExtensions CHOICE { r4 SEQUENCE { radioBearerRelease-r4 RadioBearerRelease-r4-IEs, v4d0NonCriticalExtensions SEQUENCE { -- Container for adding non critical extensions after freezing REL-5 radioBearerRelease-r4-add-ext BIT STRING OPTIONAL, v590NonCriticalExtensions SEQUENCE { radioBearerRelease-v590ext RadioBearerRelease-v590ext-IEs, v690NonCriticalExtensions SEQUENCE { radioBearerRelease-v690ext RadioBearerRelease-v690ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL }, criticalExtensions CHOICE { r5 SEQUENCE { radioBearerRelease-r5 RadioBearerRelease-r5-IEs, -- Container for adding non critical extensions after freezing REL-6 radioBearerRelease-r5-add-ext BIT STRING OPTIONAL, v690NonCriticalExtensions SEQUENCE { radioBearerRelease-v690ext RadioBearerRelease-v690ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL }, criticalExtensions CHOICE { r6 SEQUENCE { radioBearerRelease-r6 RadioBearerRelease-r6-IEs, -- Container for adding non critical extensions after freezing REL-7 radioBearerRelease-r6-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL }, criticalExtensions CHOICE { r7 SEQUENCE { radioBearerRelease-r7 RadioBearerRelease-r7-IEs, -- Container for adding non critical extensions after freezing REL-8 radioBearerRelease-r7-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL }, criticalExtensions SEQUENCE {} } } } } } } RadioBearerRelease-r3-IEs ::= SEQUENCE { -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier, integrityProtectionModeInfo IntegrityProtectionModeInfo OPTIONAL, cipheringModeInfo CipheringModeInfo OPTIONAL, activationTime ActivationTime OPTIONAL, new-U-RNTI U-RNTI OPTIONAL, new-C-RNTI C-RNTI OPTIONAL, rrc-StateIndicator RRC-StateIndicator, utran-DRX-CycleLengthCoeff UTRAN-DRX-CycleLengthCoefficient OPTIONAL, -- Core network IEs cn-InformationInfo CN-InformationInfo OPTIONAL, signallingConnectionRelIndication CN-DomainIdentity OPTIONAL, -- UTRAN mobility IEs ura-Identity URA-Identity OPTIONAL, -- Radio bearer IEs rab-InformationReconfigList RAB-InformationReconfigList OPTIONAL, rb-InformationReleaseList RB-InformationReleaseList, rb-InformationAffectedList RB-InformationAffectedList OPTIONAL, dl-CounterSynchronisationInfo DL-CounterSynchronisationInfo OPTIONAL, -- Transport channel IEs ul-CommonTransChInfo UL-CommonTransChInfo OPTIONAL, ul-deletedTransChInfoList UL-DeletedTransChInfoList OPTIONAL, ul-AddReconfTransChInfoList UL-AddReconfTransChInfoList OPTIONAL, -- 'dummy', 'dummy1' and 'dummy2' are not used in this version of the specification, -- they should not be sent and if received they should be ignored. dummy CHOICE { fdd SEQUENCE { dummy1 CPCH-SetID OPTIONAL, dummy2 DRAC-StaticInformationList OPTIONAL }, tdd NULL } OPTIONAL, dl-CommonTransChInfo DL-CommonTransChInfo OPTIONAL, dl-DeletedTransChInfoList DL-DeletedTransChInfoList OPTIONAL, dl-AddReconfTransChInfoList DL-AddReconfTransChInfo2List OPTIONAL, -- Physical channel IEs frequencyInfo FrequencyInfo OPTIONAL, maxAllowedUL-TX-Power MaxAllowedUL-TX-Power OPTIONAL, ul-ChannelRequirement UL-ChannelRequirement OPTIONAL, modeSpecificPhysChInfo CHOICE { fdd SEQUENCE { -- dummy is not used in this version of specification, it should -- not be sent and if received it should be ignored. dummy DL-PDSCH-Information OPTIONAL }, tdd NULL }, dl-CommonInformation DL-CommonInformation OPTIONAL, dl-InformationPerRL-List DL-InformationPerRL-List OPTIONAL } RadioBearerRelease-v3a0ext ::= SEQUENCE { -- The IE 窶從ew-DSCH-RNTI窶 should not be included in FDD mode, and if received the UE behaviour -- is unspecified new-DSCH-RNTI DSCH-RNTI OPTIONAL } RadioBearerRelease-v4b0ext-IEs ::= SEQUENCE { -- Physical channel IEs -- dummy is not used in this version of the specification, it should -- not be sent and if received it should be ignored. dummy SSDT-UL OPTIONAL, -- The order of the RLs in IE cell-id-PerRL-List is the same as -- in IE DL-InformationPerRL-List included in this message cell-id-PerRL-List CellIdentity-PerRL-List OPTIONAL } RadioBearerRelease-v590ext-IEs ::= SEQUENCE { -- Physical channel IEs dl-TPC-PowerOffsetPerRL-List DL-TPC-PowerOffsetPerRL-List OPTIONAL } RadioBearerRelease-r4-IEs ::= SEQUENCE { -- User equipment IEs integrityProtectionModeInfo IntegrityProtectionModeInfo OPTIONAL, cipheringModeInfo CipheringModeInfo OPTIONAL, activationTime ActivationTime OPTIONAL, new-U-RNTI U-RNTI OPTIONAL, new-C-RNTI C-RNTI OPTIONAL, -- The IE 窶從ew-DSCH-RNTI窶 should not be included in FDD mode, and if received -- the UE behaviour is unspecified new-DSCH-RNTI DSCH-RNTI OPTIONAL, rrc-StateIndicator RRC-StateIndicator, utran-DRX-CycleLengthCoeff UTRAN-DRX-CycleLengthCoefficient OPTIONAL, -- Core network IEs cn-InformationInfo CN-InformationInfo OPTIONAL, signallingConnectionRelIndication CN-DomainIdentity OPTIONAL, -- UTRAN mobility IEs ura-Identity URA-Identity OPTIONAL, -- Radio bearer IEs rab-InformationReconfigList RAB-InformationReconfigList OPTIONAL, rb-InformationReleaseList RB-InformationReleaseList, rb-InformationAffectedList RB-InformationAffectedList OPTIONAL, dl-CounterSynchronisationInfo DL-CounterSynchronisationInfo OPTIONAL, -- Transport channel IEs ul-CommonTransChInfo UL-CommonTransChInfo-r4 OPTIONAL, ul-deletedTransChInfoList UL-DeletedTransChInfoList OPTIONAL, ul-AddReconfTransChInfoList UL-AddReconfTransChInfoList OPTIONAL, -- 'dummy', 'dummy1' and 'dummy2' are not used in this version of the specification, -- they should not be sent and if received they should be ignored. dummy CHOICE { fdd SEQUENCE { dummy1 CPCH-SetID OPTIONAL, dummy2 DRAC-StaticInformationList OPTIONAL }, tdd NULL } OPTIONAL, dl-CommonTransChInfo DL-CommonTransChInfo-r4 OPTIONAL, dl-DeletedTransChInfoList DL-DeletedTransChInfoList OPTIONAL, dl-AddReconfTransChInfoList DL-AddReconfTransChInfoList-r4 OPTIONAL, -- Physical channel IEs frequencyInfo FrequencyInfo OPTIONAL, maxAllowedUL-TX-Power MaxAllowedUL-TX-Power OPTIONAL, ul-ChannelRequirement UL-ChannelRequirement-r4 OPTIONAL, modeSpecificPhysChInfo CHOICE { fdd SEQUENCE { -- dummy is not used in this version of specification, it should -- not be sent and if received it should be ignored. dummy DL-PDSCH-Information OPTIONAL }, tdd NULL }, dl-CommonInformation DL-CommonInformation-r4 OPTIONAL, dl-InformationPerRL-List DL-InformationPerRL-List-r4 OPTIONAL } RadioBearerRelease-r5-IEs ::= SEQUENCE { -- User equipment IEs integrityProtectionModeInfo IntegrityProtectionModeInfo OPTIONAL, cipheringModeInfo CipheringModeInfo OPTIONAL, activationTime ActivationTime OPTIONAL, new-U-RNTI U-RNTI OPTIONAL, new-C-RNTI C-RNTI OPTIONAL, -- The IE 窶從ew-DSCH-RNTI窶 should not be included in FDD mode, -- and if received the UE behaviour is unspecified new-DSCH-RNTI DSCH-RNTI OPTIONAL, new-H-RNTI H-RNTI OPTIONAL, rrc-StateIndicator RRC-StateIndicator, utran-DRX-CycleLengthCoeff UTRAN-DRX-CycleLengthCoefficient OPTIONAL, -- Core network IEs cn-InformationInfo CN-InformationInfo OPTIONAL, signallingConnectionRelIndication CN-DomainIdentity OPTIONAL, -- UTRAN mobility IEs ura-Identity URA-Identity OPTIONAL, -- Radio bearer IEs rab-InformationReconfigList RAB-InformationReconfigList OPTIONAL, rb-InformationReleaseList RB-InformationReleaseList, rb-InformationAffectedList RB-InformationAffectedList-r5 OPTIONAL, dl-CounterSynchronisationInfo DL-CounterSynchronisationInfo-r5 OPTIONAL, -- Transport channel IEs ul-CommonTransChInfo UL-CommonTransChInfo-r4 OPTIONAL, ul-deletedTransChInfoList UL-DeletedTransChInfoList OPTIONAL, ul-AddReconfTransChInfoList UL-AddReconfTransChInfoList OPTIONAL, -- 'dummy', 'dummy1' and 'dummy2' are not used in this version of the specification, -- they should not be sent and if received they should be ignored. dummy CHOICE { fdd SEQUENCE { dummy1 CPCH-SetID OPTIONAL, dummy2 DRAC-StaticInformationList OPTIONAL }, tdd NULL } OPTIONAL, dl-CommonTransChInfo DL-CommonTransChInfo-r4 OPTIONAL, dl-DeletedTransChInfoList DL-DeletedTransChInfoList-r5 OPTIONAL, dl-AddReconfTransChInfoList DL-AddReconfTransChInfoList-r5 OPTIONAL, -- Physical channel IEs frequencyInfo FrequencyInfo OPTIONAL, maxAllowedUL-TX-Power MaxAllowedUL-TX-Power OPTIONAL, ul-ChannelRequirement UL-ChannelRequirement-r5 OPTIONAL, modeSpecificPhysChInfo CHOICE { fdd SEQUENCE { -- dummy is not used in this version of specification, it should -- not be sent and if received it should be ignored. dummy DL-PDSCH-Information OPTIONAL }, tdd NULL }, dl-HSPDSCH-Information DL-HSPDSCH-Information OPTIONAL, dl-CommonInformation DL-CommonInformation-r5 OPTIONAL, dl-InformationPerRL-List DL-InformationPerRL-List-r5 OPTIONAL } RadioBearerRelease-v690ext-IEs ::= SEQUENCE { -- Core network IEs primary-plmn-Identity PLMN-Identity OPTIONAL, -- Physical channel IEs -- The IE harq-Preamble-Mode should not be used in the r3 and r4 versions of the message -- If included in the r3 or r4 version of the message, the UE should ignore the IE harq-Preamble-Mode HARQ-Preamble-Mode OPTIONAL, beaconPLEst BEACON-PL-Est OPTIONAL, postVerificationPeriod ENUMERATED { true } OPTIONAL, dhs-sync DHS-Sync OPTIONAL, timingMaintainedSynchInd TimingMaintainedSynchInd OPTIONAL, -- MBMS IEs mbms-PL-ServiceRestrictInfo MBMS-PL-ServiceRestrictInfo-r6 OPTIONAL, mbms-RB-ListReleasedToChangeTransferMode RB-InformationReleaseList OPTIONAL } RadioBearerRelease-r6-IEs ::= SEQUENCE { -- User equipment IEs integrityProtectionModeInfo IntegrityProtectionModeInfo OPTIONAL, cipheringModeInfo CipheringModeInfo OPTIONAL, activationTime ActivationTime OPTIONAL, new-U-RNTI U-RNTI OPTIONAL, new-C-RNTI C-RNTI OPTIONAL, -- The IE 窶從ew-DSCH-RNTI窶 should not be included in FDD mode, -- and if received the UE behaviour is unspecified new-DSCH-RNTI DSCH-RNTI OPTIONAL, new-H-RNTI H-RNTI OPTIONAL, newPrimary-E-RNTI E-RNTI OPTIONAL, newSecondary-E-RNTI E-RNTI OPTIONAL, rrc-StateIndicator RRC-StateIndicator, utran-DRX-CycleLengthCoeff UTRAN-DRX-CycleLengthCoefficient OPTIONAL, -- Core network IEs cn-InformationInfo CN-InformationInfo-r6 OPTIONAL, signallingConnectionRelIndication CN-DomainIdentity OPTIONAL, -- UTRAN mobility IEs ura-Identity URA-Identity OPTIONAL, -- Radio bearer IEs rab-InformationReconfigList RAB-InformationReconfigList OPTIONAL, rb-InformationReleaseList RB-InformationReleaseList, rb-InformationReconfigList RB-InformationReconfigList-r6 OPTIONAL, rb-InformationAffectedList RB-InformationAffectedList-r6 OPTIONAL, dl-CounterSynchronisationInfo DL-CounterSynchronisationInfo-r5 OPTIONAL, -- Transport channel IEs ul-CommonTransChInfo UL-CommonTransChInfo-r4 OPTIONAL, ul-deletedTransChInfoList UL-DeletedTransChInfoList-r6 OPTIONAL, ul-AddReconfTransChInfoList UL-AddReconfTransChInfoList-r6 OPTIONAL, dl-CommonTransChInfo DL-CommonTransChInfo-r4 OPTIONAL, dl-DeletedTransChInfoList DL-DeletedTransChInfoList-r5 OPTIONAL, dl-AddReconfTransChInfoList DL-AddReconfTransChInfoList-r5 OPTIONAL, -- Physical channel IEs frequencyInfo FrequencyInfo OPTIONAL, maxAllowedUL-TX-Power MaxAllowedUL-TX-Power OPTIONAL, ul-DPCH-Info UL-DPCH-Info-r6 OPTIONAL, ul-EDCH-Information UL-EDCH-Information-r6 OPTIONAL, dl-HSPDSCH-Information DL-HSPDSCH-Information-r6 OPTIONAL, dl-CommonInformation DL-CommonInformation-r6 OPTIONAL, dl-InformationPerRL-List DL-InformationPerRL-List-r6 OPTIONAL, -- MBMS IEs mbms-PL-ServiceRestrictInfo MBMS-PL-ServiceRestrictInfo-r6 OPTIONAL, mbms-RB-ListReleasedToChangeTransferMode RB-InformationReleaseList OPTIONAL } RadioBearerRelease-r7-IEs ::= SEQUENCE { -- User equipment IEs integrityProtectionModeInfo IntegrityProtectionModeInfo OPTIONAL, cipheringModeInfo CipheringModeInfo OPTIONAL, activationTime ActivationTime OPTIONAL, new-U-RNTI U-RNTI OPTIONAL, new-C-RNTI C-RNTI OPTIONAL, -- The IE 窶從ew-DSCH-RNTI窶 should not be included in FDD mode, -- and if received the UE behaviour is unspecified new-DSCH-RNTI DSCH-RNTI OPTIONAL, new-H-RNTI H-RNTI OPTIONAL, newPrimary-E-RNTI E-RNTI OPTIONAL, newSecondary-E-RNTI E-RNTI OPTIONAL, rrc-StateIndicator RRC-StateIndicator, utran-DRX-CycleLengthCoeff UTRAN-DRX-CycleLengthCoefficient OPTIONAL, -- Core network IEs cn-InformationInfo CN-InformationInfo-r6 OPTIONAL, signallingConnectionRelIndication CN-DomainIdentity OPTIONAL, -- UTRAN mobility IEs ura-Identity URA-Identity OPTIONAL, -- Radio bearer IEs rab-InformationReconfigList RAB-InformationReconfigList OPTIONAL, rb-InformationReleaseList RB-InformationReleaseList, rb-InformationReconfigList RB-InformationReconfigList-r6 OPTIONAL, rb-InformationAffectedList RB-InformationAffectedList-r6 OPTIONAL, dl-CounterSynchronisationInfo DL-CounterSynchronisationInfo-r5 OPTIONAL, -- Transport channel IEs ul-CommonTransChInfo UL-CommonTransChInfo-r4 OPTIONAL, ul-deletedTransChInfoList UL-DeletedTransChInfoList-r6 OPTIONAL, ul-AddReconfTransChInfoList UL-AddReconfTransChInfoList-r6 OPTIONAL, dl-CommonTransChInfo DL-CommonTransChInfo-r4 OPTIONAL, dl-DeletedTransChInfoList DL-DeletedTransChInfoList-r5 OPTIONAL, dl-AddReconfTransChInfoList DL-AddReconfTransChInfoList-r5 OPTIONAL, -- Physical channel IEs frequencyInfo FrequencyInfo OPTIONAL, maxAllowedUL-TX-Power MaxAllowedUL-TX-Power OPTIONAL, ul-DPCH-Info UL-DPCH-Info-r7 OPTIONAL, ul-EDCH-Information UL-EDCH-Information-r6 OPTIONAL, dl-HSPDSCH-Information DL-HSPDSCH-Information-r7 OPTIONAL, dl-CommonInformation DL-CommonInformation-r7 OPTIONAL, dl-InformationPerRL-List DL-InformationPerRL-List-r7 OPTIONAL, -- MBMS IEs mbms-PL-ServiceRestrictInfo MBMS-PL-ServiceRestrictInfo-r6 OPTIONAL, mbms-RB-ListReleasedToChangeTransferMode RB-InformationReleaseList OPTIONAL } -- *************************************************** -- -- RADIO BEARER RELEASE COMPLETE -- -- *************************************************** RadioBearerReleaseComplete ::= SEQUENCE { -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier, ul-IntegProtActivationInfo IntegrityProtActivationInfo OPTIONAL, -- TABULAR: UL-TimingAdvance is applicable for TDD mode only. ul-TimingAdvance UL-TimingAdvance OPTIONAL, -- Radio bearer IEs count-C-ActivationTime ActivationTime OPTIONAL, -- dummy is not used in this version of the specification and -- it should be ignored by the receiver. dummy RB-ActivationTimeInfoList OPTIONAL, ul-CounterSynchronisationInfo UL-CounterSynchronisationInfo OPTIONAL, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions radioBearerReleaseComplete-r3-add-ext BIT STRING OPTIONAL, v7xyNonCriticalExtensions SEQUENCE { radioBearerReleaseComplete-v7xyext RadioBearerReleaseComplete-v7xyext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } RadioBearerReleaseComplete-v7xyext-IEs ::= SEQUENCE { ext-ul-TimingAdvance EXT-UL-TimingAdvance OPTIONAL } -- *************************************************** -- -- RADIO BEARER RELEASE FAILURE -- -- *************************************************** RadioBearerReleaseFailure ::= SEQUENCE { -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier, failureCause FailureCauseWithProtErr, -- Radio bearer IEs potentiallySuccesfulBearerList RB-IdentityList OPTIONAL, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions radioBearerReleaseFailure-r3-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } -- *************************************************** -- -- RADIO BEARER SETUP -- -- *************************************************** RadioBearerSetup ::= CHOICE { r3 SEQUENCE { radioBearerSetup-r3 RadioBearerSetup-r3-IEs, v3a0NonCriticalExtensions SEQUENCE { radioBearerSetup-v3a0ext RadioBearerSetup-v3a0ext, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions radioBearerSetup-r3-add-ext BIT STRING OPTIONAL, v4b0NonCriticalExtensions SEQUENCE { radioBearerSetup-v4b0ext RadioBearerSetup-v4b0ext-IEs, v590NonCriticalExtensions SEQUENCE { radioBearerSetup-v590ext RadioBearerSetup-v590ext-IEs, v5d0NonCriticalExtenstions SEQUENCE { radioBearerSetup-v5d0ext RadioBearerSetup-v5d0ext-IEs, v690NonCriticalExtensions SEQUENCE { radioBearerSetup-v690ext RadioBearerSetup-v690ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL }, later-than-r3 SEQUENCE { rrc-TransactionIdentifier RRC-TransactionIdentifier, criticalExtensions CHOICE { r4 SEQUENCE { radioBearerSetup-r4 RadioBearerSetup-r4-IEs, v4d0NonCriticalExtensions SEQUENCE { -- Container for adding non critical extensions after freezing REL-5 radioBearerSetup-r4-add-ext BIT STRING OPTIONAL, v590NonCriticalExtensions SEQUENCE { radioBearerSetup-v590ext RadioBearerSetup-v590ext-IEs, v5d0NonCriticalExtenstions SEQUENCE { radioBearerSetup-v5d0ext RadioBearerSetup-v5d0ext-IEs, v690NonCriticalExtensions SEQUENCE { radioBearerSetup-v690ext RadioBearerSetup-v690ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL }, criticalExtensions CHOICE { r5 SEQUENCE { radioBearerSetup-r5 RadioBearerSetup-r5-IEs, -- Container for adding non critical extensions after freezing REL-6 radioBearerSetup-r5-add-ext BIT STRING OPTIONAL, v5d0NonCriticalExtenstions SEQUENCE { radioBearerSetup-v5d0ext RadioBearerSetup-v5d0ext-IEs, v690NonCriticalExtensions SEQUENCE { radioBearerSetup-v690ext RadioBearerSetup-v690ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL }, criticalExtensions CHOICE { r6 SEQUENCE { radioBearerSetup-r6 RadioBearerSetup-r6-IEs, -- Container for adding non critical extensions after freezing REL-7 radioBearerSetup-r6-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL }, criticalExtensions CHOICE { r7 SEQUENCE { radioBearerSetup-r7 RadioBearerSetup-r7-IEs, -- Container for adding non critical extensions after freezing REL-8 radioBearerSetup-r7-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL }, criticalExtensions SEQUENCE {} } } } } } } RadioBearerSetup-r3-IEs ::= SEQUENCE { -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier, integrityProtectionModeInfo IntegrityProtectionModeInfo OPTIONAL, cipheringModeInfo CipheringModeInfo OPTIONAL, activationTime ActivationTime OPTIONAL, new-U-RNTI U-RNTI OPTIONAL, new-C-RNTI C-RNTI OPTIONAL, rrc-StateIndicator RRC-StateIndicator, utran-DRX-CycleLengthCoeff UTRAN-DRX-CycleLengthCoefficient OPTIONAL, -- UTRAN mobility IEs ura-Identity URA-Identity OPTIONAL, -- Core network IEs cn-InformationInfo CN-InformationInfo OPTIONAL, -- Radio bearer IEs srb-InformationSetupList SRB-InformationSetupList OPTIONAL, rab-InformationSetupList RAB-InformationSetupList OPTIONAL, rb-InformationAffectedList RB-InformationAffectedList OPTIONAL, dl-CounterSynchronisationInfo DL-CounterSynchronisationInfo OPTIONAL, -- Transport channel IEs ul-CommonTransChInfo UL-CommonTransChInfo OPTIONAL, ul-deletedTransChInfoList UL-DeletedTransChInfoList OPTIONAL, ul-AddReconfTransChInfoList UL-AddReconfTransChInfoList OPTIONAL, -- 'dummy', 'dummy1' and 'dummy2' are not used in this version of the specification, -- they should not be sent and if received they should be ignored. dummy CHOICE { fdd SEQUENCE { dummy1 CPCH-SetID OPTIONAL, dummy2 DRAC-StaticInformationList OPTIONAL }, tdd NULL } OPTIONAL, dl-CommonTransChInfo DL-CommonTransChInfo OPTIONAL, dl-DeletedTransChInfoList DL-DeletedTransChInfoList OPTIONAL, dl-AddReconfTransChInfoList DL-AddReconfTransChInfoList OPTIONAL, -- Physical channel IEs frequencyInfo FrequencyInfo OPTIONAL, maxAllowedUL-TX-Power MaxAllowedUL-TX-Power OPTIONAL, ul-ChannelRequirement UL-ChannelRequirement OPTIONAL, modeSpecificPhysChInfo CHOICE { fdd SEQUENCE { -- dummy is not used in this version of specification, it should -- not be sent and if received it should be ignored. dummy DL-PDSCH-Information OPTIONAL }, tdd NULL }, dl-CommonInformation DL-CommonInformation OPTIONAL, dl-InformationPerRL-List DL-InformationPerRL-List OPTIONAL } RadioBearerSetup-v3a0ext ::= SEQUENCE { -- The IE 窶從ew-DSCH-RNTI窶 should not be included in FDD mode, and if received the UE behaviour -- is unspecified new-DSCH-RNTI DSCH-RNTI OPTIONAL } RadioBearerSetup-v4b0ext-IEs ::= SEQUENCE { -- Physical channel IEs -- dummy is not used in this version of the specification, it should -- not be sent and if received it should be ignored. dummy SSDT-UL OPTIONAL, -- The order of the RLs in IE cell-id-PerRL-List is the same as -- in IE DL-InformationPerRL-List included in this message cell-id-PerRL-List CellIdentity-PerRL-List OPTIONAL } RadioBearerSetup-v590ext-IEs ::= SEQUENCE { -- Physical channel IEs dl-TPC-PowerOffsetPerRL-List DL-TPC-PowerOffsetPerRL-List OPTIONAL } RadioBearerSetup-v5d0ext-IEs ::= SEQUENCE { --Radio Bearer IEs pdcp-ROHC-TargetMode PDCP-ROHC-TargetMode OPTIONAL } RadioBearerSetup-r4-IEs ::= SEQUENCE { -- User equipment IEs integrityProtectionModeInfo IntegrityProtectionModeInfo OPTIONAL, cipheringModeInfo CipheringModeInfo OPTIONAL, activationTime ActivationTime OPTIONAL, new-U-RNTI U-RNTI OPTIONAL, new-C-RNTI C-RNTI OPTIONAL, -- The IE 窶從ew-DSCH-RNTI窶 should not be included in FDD mode, and if received -- the UE behaviour is unspecified new-DSCH-RNTI DSCH-RNTI OPTIONAL, rrc-StateIndicator RRC-StateIndicator, utran-DRX-CycleLengthCoeff UTRAN-DRX-CycleLengthCoefficient OPTIONAL, -- UTRAN mobility IEs ura-Identity URA-Identity OPTIONAL, -- Core network IEs cn-InformationInfo CN-InformationInfo OPTIONAL, -- Radio bearer IEs srb-InformationSetupList SRB-InformationSetupList OPTIONAL, rab-InformationSetupList RAB-InformationSetupList-r4 OPTIONAL, rb-InformationAffectedList RB-InformationAffectedList OPTIONAL, dl-CounterSynchronisationInfo DL-CounterSynchronisationInfo OPTIONAL, -- Transport channel IEs ul-CommonTransChInfo UL-CommonTransChInfo-r4 OPTIONAL, ul-deletedTransChInfoList UL-DeletedTransChInfoList OPTIONAL, ul-AddReconfTransChInfoList UL-AddReconfTransChInfoList OPTIONAL, -- 'dummy', 'dummy1' and 'dummy2' are not used in this version of the specification, -- they should not be sent and if received they should be ignored. dummy CHOICE { fdd SEQUENCE { dummy1 CPCH-SetID OPTIONAL, dummy2 DRAC-StaticInformationList OPTIONAL }, tdd NULL } OPTIONAL, dl-CommonTransChInfo DL-CommonTransChInfo-r4 OPTIONAL, dl-DeletedTransChInfoList DL-DeletedTransChInfoList OPTIONAL, dl-AddReconfTransChInfoList DL-AddReconfTransChInfoList-r4 OPTIONAL, -- Physical channel IEs frequencyInfo FrequencyInfo OPTIONAL, maxAllowedUL-TX-Power MaxAllowedUL-TX-Power OPTIONAL, ul-ChannelRequirement UL-ChannelRequirement-r4 OPTIONAL, modeSpecificPhysChInfo CHOICE { fdd SEQUENCE { -- dummy is not used in this version of specification, it should -- not be sent and if received it should be ignored. dummy DL-PDSCH-Information OPTIONAL }, tdd NULL }, dl-CommonInformation DL-CommonInformation-r4 OPTIONAL, dl-InformationPerRL-List DL-InformationPerRL-List-r4 OPTIONAL } RadioBearerSetup-r5-IEs ::= SEQUENCE { -- User equipment IEs integrityProtectionModeInfo IntegrityProtectionModeInfo OPTIONAL, cipheringModeInfo CipheringModeInfo OPTIONAL, activationTime ActivationTime OPTIONAL, new-U-RNTI U-RNTI OPTIONAL, new-C-RNTI C-RNTI OPTIONAL, -- The IE 窶從ew-DSCH-RNTI窶 should not be included in FDD mode, and if received -- the UE behaviour is unspecified new-DSCH-RNTI DSCH-RNTI OPTIONAL, new-H-RNTI H-RNTI OPTIONAL, rrc-StateIndicator RRC-StateIndicator, utran-DRX-CycleLengthCoeff UTRAN-DRX-CycleLengthCoefficient OPTIONAL, -- UTRAN mobility IEs ura-Identity URA-Identity OPTIONAL, -- Core network IEs cn-InformationInfo CN-InformationInfo OPTIONAL, -- Radio bearer IEs srb-InformationSetupList SRB-InformationSetupList-r5 OPTIONAL, rab-InformationSetupList RAB-InformationSetupList-r5 OPTIONAL, rb-InformationAffectedList RB-InformationAffectedList-r5 OPTIONAL, dl-CounterSynchronisationInfo DL-CounterSynchronisationInfo-r5 OPTIONAL, -- Transport channel IEs ul-CommonTransChInfo UL-CommonTransChInfo-r4 OPTIONAL, ul-deletedTransChInfoList UL-DeletedTransChInfoList OPTIONAL, ul-AddReconfTransChInfoList UL-AddReconfTransChInfoList OPTIONAL, -- 'dummy', 'dummy1' and 'dummy2' are not used in this version of the specification, -- they should not be sent and if received they should be ignored. dummy CHOICE { fdd SEQUENCE { dummy1 CPCH-SetID OPTIONAL, dummy2 DRAC-StaticInformationList OPTIONAL }, tdd NULL } OPTIONAL, dl-CommonTransChInfo DL-CommonTransChInfo-r4 OPTIONAL, dl-DeletedTransChInfoList DL-DeletedTransChInfoList-r5 OPTIONAL, dl-AddReconfTransChInfoList DL-AddReconfTransChInfoList-r5 OPTIONAL, -- Physical channel IEs frequencyInfo FrequencyInfo OPTIONAL, maxAllowedUL-TX-Power MaxAllowedUL-TX-Power OPTIONAL, ul-ChannelRequirement UL-ChannelRequirement-r5 OPTIONAL, modeSpecificPhysChInfo CHOICE { fdd SEQUENCE { -- dummy is not used in this version of specification, it should -- not be sent and if received it should be ignored. dummy DL-PDSCH-Information OPTIONAL }, tdd NULL }, dl-HSPDSCH-Information DL-HSPDSCH-Information OPTIONAL, dl-CommonInformation DL-CommonInformation-r5 OPTIONAL, dl-InformationPerRL-List DL-InformationPerRL-List-r5 OPTIONAL } RadioBearerSetup-v690ext-IEs ::= SEQUENCE { -- Core network IEs primary-plmn-Identity PLMN-Identity OPTIONAL, -- Physical channel IEs -- The IE harq-Preamble-Mode should not be used in the r3 and r4 versions of the message -- If included in the r3 or r4 version of the message, the UE should ignore the IE harq-Preamble-Mode HARQ-Preamble-Mode OPTIONAL, beaconPLEst BEACON-PL-Est OPTIONAL, postVerificationPeriod ENUMERATED { true } OPTIONAL, dhs-sync DHS-Sync OPTIONAL, timingMaintainedSynchInd TimingMaintainedSynchInd OPTIONAL, -- Radio bearer IEs rab-InformationSetupList RAB-InformationSetupList-r6-ext OPTIONAL, -- MBMS IEs mbms-PL-ServiceRestrictInfo MBMS-PL-ServiceRestrictInfo-r6 OPTIONAL } RadioBearerSetup-r6-IEs ::= SEQUENCE { -- User equipment IEs integrityProtectionModeInfo IntegrityProtectionModeInfo OPTIONAL, cipheringModeInfo CipheringModeInfo OPTIONAL, activationTime ActivationTime OPTIONAL, new-U-RNTI U-RNTI OPTIONAL, new-C-RNTI C-RNTI OPTIONAL, -- The IE 窶從ew-DSCH-RNTI窶 should not be included in FDD mode, -- and if received the UE behaviour is unspecified new-DSCH-RNTI DSCH-RNTI OPTIONAL, new-H-RNTI H-RNTI OPTIONAL, newPrimary-E-RNTI E-RNTI OPTIONAL, newSecondary-E-RNTI E-RNTI OPTIONAL, rrc-StateIndicator RRC-StateIndicator, utran-DRX-CycleLengthCoeff UTRAN-DRX-CycleLengthCoefficient OPTIONAL, -- UTRAN mobility IEs ura-Identity URA-Identity OPTIONAL, -- Core network IEs cn-InformationInfo CN-InformationInfo-r6 OPTIONAL, specificationMode CHOICE { complete SEQUENCE { -- Radio bearer IEs srb-InformationSetupList SRB-InformationSetupList-r6 OPTIONAL, rab-InformationSetupList RAB-InformationSetupList-r6 OPTIONAL, rab-InformationReconfigList RAB-InformationReconfigList OPTIONAL, rb-InformationReconfigList RB-InformationReconfigList-r6 OPTIONAL, rb-InformationAffectedList RB-InformationAffectedList-r6 OPTIONAL, dl-CounterSynchronisationInfo DL-CounterSynchronisationInfo-r5 OPTIONAL, pdcp-ROHC-TargetMode PDCP-ROHC-TargetMode OPTIONAL, -- Transport channel IEs ul-CommonTransChInfo UL-CommonTransChInfo-r4 OPTIONAL, ul-deletedTransChInfoList UL-DeletedTransChInfoList-r6 OPTIONAL, ul-AddReconfTransChInfoList UL-AddReconfTransChInfoList-r6 OPTIONAL, dl-CommonTransChInfo DL-CommonTransChInfo-r4 OPTIONAL, dl-DeletedTransChInfoList DL-DeletedTransChInfoList-r5 OPTIONAL, dl-AddReconfTransChInfoList DL-AddReconfTransChInfoList-r5 OPTIONAL }, preconfiguration SEQUENCE { rab-Info RAB-Info-r6, defaultConfigMode DefaultConfigMode, defaultConfigIdentity DefaultConfigIdentity-r6, rb-InformationChangedList RB-InformationChangedList-r6 OPTIONAL, powerOffsetInfoShort PowerOffsetInfoShort } }, -- Physical channel IEs frequencyInfo FrequencyInfo OPTIONAL, maxAllowedUL-TX-Power MaxAllowedUL-TX-Power OPTIONAL, ul-DPCH-Info UL-DPCH-Info-r6 OPTIONAL, ul-EDCH-Information UL-EDCH-Information-r6 OPTIONAL, dl-HSPDSCH-Information DL-HSPDSCH-Information-r6 OPTIONAL, dl-CommonInformation DL-CommonInformation-r6 OPTIONAL, dl-InformationPerRL-List DL-InformationPerRL-List-r6 OPTIONAL, -- MBMS IEs mbms-PL-ServiceRestrictInfo MBMS-PL-ServiceRestrictInfo-r6 OPTIONAL } RadioBearerSetup-r7-IEs ::= SEQUENCE { -- User equipment IEs integrityProtectionModeInfo IntegrityProtectionModeInfo OPTIONAL, cipheringModeInfo CipheringModeInfo OPTIONAL, activationTime ActivationTime OPTIONAL, new-U-RNTI U-RNTI OPTIONAL, new-C-RNTI C-RNTI OPTIONAL, -- The IE 窶從ew-DSCH-RNTI窶 should not be included in FDD mode, -- and if received the UE behaviour is unspecified new-DSCH-RNTI DSCH-RNTI OPTIONAL, new-H-RNTI H-RNTI OPTIONAL, newPrimary-E-RNTI E-RNTI OPTIONAL, newSecondary-E-RNTI E-RNTI OPTIONAL, rrc-StateIndicator RRC-StateIndicator, utran-DRX-CycleLengthCoeff UTRAN-DRX-CycleLengthCoefficient OPTIONAL, -- UTRAN mobility IEs ura-Identity URA-Identity OPTIONAL, -- Core network IEs cn-InformationInfo CN-InformationInfo-r6 OPTIONAL, specificationMode CHOICE { complete SEQUENCE { -- Radio bearer IEs srb-InformationSetupList SRB-InformationSetupList-r6 OPTIONAL, rab-InformationSetupList RAB-InformationSetupList-r6 OPTIONAL, rb-InformationReconfigList RB-InformationReconfigList-r6 OPTIONAL, rb-InformationAffectedList RB-InformationAffectedList-r6 OPTIONAL, dl-CounterSynchronisationInfo DL-CounterSynchronisationInfo-r5 OPTIONAL, pdcp-ROHC-TargetMode PDCP-ROHC-TargetMode OPTIONAL, -- Transport channel IEs ul-CommonTransChInfo UL-CommonTransChInfo-r4 OPTIONAL, ul-deletedTransChInfoList UL-DeletedTransChInfoList-r6 OPTIONAL, ul-AddReconfTransChInfoList UL-AddReconfTransChInfoList-r6 OPTIONAL, dl-CommonTransChInfo DL-CommonTransChInfo-r4 OPTIONAL, dl-DeletedTransChInfoList DL-DeletedTransChInfoList-r5 OPTIONAL, dl-AddReconfTransChInfoList DL-AddReconfTransChInfoList-r5 OPTIONAL }, preconfiguration SEQUENCE { rab-Info RAB-Info-r6, defaultConfigMode DefaultConfigMode, defaultConfigIdentity DefaultConfigIdentity-r6, rb-InformationChangedList RB-InformationChangedList-r6 OPTIONAL, powerOffsetInfoShort PowerOffsetInfoShort } }, -- Physical channel IEs frequencyInfo FrequencyInfo OPTIONAL, maxAllowedUL-TX-Power MaxAllowedUL-TX-Power OPTIONAL, ul-DPCH-Info UL-DPCH-Info-r7 OPTIONAL, ul-EDCH-Information UL-EDCH-Information-r6 OPTIONAL, dl-HSPDSCH-Information DL-HSPDSCH-Information-r7 OPTIONAL, dl-CommonInformation DL-CommonInformation-r7 OPTIONAL, dl-InformationPerRL-List DL-InformationPerRL-List-r7 OPTIONAL, -- MBMS IEs mbms-PL-ServiceRestrictInfo MBMS-PL-ServiceRestrictInfo-r6 OPTIONAL } -- *************************************************** -- -- RADIO BEARER SETUP COMPLETE -- -- *************************************************** RadioBearerSetupComplete ::= SEQUENCE { -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier, ul-IntegProtActivationInfo IntegrityProtActivationInfo OPTIONAL, -- TABULAR: UL-TimingAdvance is applicable for TDD mode only. ul-TimingAdvance UL-TimingAdvance OPTIONAL, start-Value START-Value OPTIONAL, -- Radio bearer IEs count-C-ActivationTime ActivationTime OPTIONAL, -- dummy is not used in this version of the specification and -- it should be ignored by the receiver. dummy RB-ActivationTimeInfoList OPTIONAL, ul-CounterSynchronisationInfo UL-CounterSynchronisationInfo OPTIONAL, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions radioBearerSetupComplete-r3-add-ext BIT STRING OPTIONAL, v7xyNonCriticalExtensions SEQUENCE { radioBearerSetupComplete-v7xyext RadioBearerSetupComplete-v7xyext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } RadioBearerSetupComplete-v7xyext-IEs ::= SEQUENCE { ext-ul-TimingAdvance EXT-UL-TimingAdvance OPTIONAL } -- *************************************************** -- -- RADIO BEARER SETUP FAILURE -- -- *************************************************** RadioBearerSetupFailure ::= SEQUENCE { -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier, failureCause FailureCauseWithProtErr, -- Radio bearer IEs potentiallySuccesfulBearerList RB-IdentityList OPTIONAL, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions radioBearerSetupFailure-r3-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } -- *************************************************** -- -- RRC CONNECTION REJECT -- -- *************************************************** RRCConnectionReject ::= CHOICE { r3 SEQUENCE { rrcConnectionReject-r3 RRCConnectionReject-r3-IEs, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions rrcConnectionReject-r3-add-ext BIT STRING OPTIONAL, v690NonCriticalExtensions SEQUENCE { rrcConnectionReject-v690ext RRCConnectionReject-v690ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL }, later-than-r3 SEQUENCE { initialUE-Identity InitialUE-Identity, rrc-TransactionIdentifier RRC-TransactionIdentifier, criticalExtensions SEQUENCE {} } } RRCConnectionReject-r3-IEs ::= SEQUENCE { -- TABULAR: Integrity protection shall not be performed on this message. -- User equipment IEs initialUE-Identity InitialUE-Identity, rrc-TransactionIdentifier RRC-TransactionIdentifier, rejectionCause RejectionCause, waitTime WaitTime, redirectionInfo RedirectionInfo OPTIONAL } RRCConnectionReject-v690ext-IEs ::= SEQUENCE { redirectionInfo-v690ext GSM-TargetCellInfoList OPTIONAL } -- *************************************************** -- -- RRC CONNECTION RELEASE -- -- *************************************************** RRCConnectionRelease ::= CHOICE { r3 SEQUENCE { rrcConnectionRelease-r3 RRCConnectionRelease-r3-IEs, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions rrcConnectionRelease-r3-add-ext BIT STRING OPTIONAL, v690NonCriticalExtensions SEQUENCE { rrcConnectionRelease-v690ext RRCConnectionRelease-v690ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL }, later-than-r3 SEQUENCE { rrc-TransactionIdentifier RRC-TransactionIdentifier, criticalExtensions CHOICE { r4 SEQUENCE { rrcConnectionRelease-r4 RRCConnectionRelease-r4-IEs, v4d0NonCriticalExtensions SEQUENCE { -- Container for adding non critical extensions after freezing REL-6 rrcConnectionRelease-r4-add-ext BIT STRING OPTIONAL, v690NonCriticalExtensions SEQUENCE { rrcConnectionRelease-v690ext RRCConnectionRelease-v690ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL }, criticalExtensions SEQUENCE {} } } } RRCConnectionRelease-r3-IEs ::= SEQUENCE { -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier, -- n-308 is conditional on the UE state n-308 N-308 OPTIONAL, releaseCause ReleaseCause, rplmn-information Rplmn-Information OPTIONAL } RRCConnectionRelease-r4-IEs ::= SEQUENCE { -- User equipment IEs -- n-308 is conditional on the UE state. n-308 N-308 OPTIONAL, releaseCause ReleaseCause, rplmn-information Rplmn-Information-r4 OPTIONAL } RRCConnectionRelease-v690ext-IEs ::= SEQUENCE { redirectionInfo-v690ext RedirectionInfo-r6 OPTIONAL } -- *************************************************** -- -- RRC CONNECTION RELEASE for CCCH -- -- *************************************************** RRCConnectionRelease-CCCH ::= CHOICE { r3 SEQUENCE { rrcConnectionRelease-CCCH-r3 RRCConnectionRelease-CCCH-r3-IEs, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions rrcConnectionRelease-CCCH-r3-add-ext BIT STRING OPTIONAL, v690NonCriticalExtensions SEQUENCE { rrcConnectionRelease-v690ext RRCConnectionRelease-CCCH-v690ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL }, later-than-r3 SEQUENCE { u-RNTI U-RNTI, rrc-TransactionIdentifier RRC-TransactionIdentifier, criticalExtensions CHOICE { r4 SEQUENCE { rrcConnectionRelease-CCCH-r4 RRCConnectionRelease-CCCH-r4-IEs, v4d0NonCriticalExtensions SEQUENCE { -- Container for adding non critical extensions after freezing REL-5 rrcConnectionRelease-CCCH-r4-add-ext BIT STRING OPTIONAL, v690NonCriticalExtensions SEQUENCE { rrcConnectionRelease-v690ext RRCConnectionRelease-CCCH-v690ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL }, criticalExtensions SEQUENCE { -- TABULAR: CHOICE IdentityType (U-RNTI, GroupIdentity) is replaced with the -- optional element groupIdentity, since the U-RNTI is mandatory in ASN.1. -- In case CHOICE IdentityType is equal to GroupIdentity the value of the U-RNTI -- shall be ignored by a UE complying with this version of the message. groupIdentity SEQUENCE ( SIZE (1 .. maxURNTI-Group) ) OF GroupReleaseInformation OPTIONAL, criticalExtensions CHOICE { r5 SEQUENCE { rrcConnectionRelease-CCCH-r5 RRCConnectionRelease-CCCH-r5-IEs, -- Container for adding non critical extensions after freezing REL-6 rrcConnectionRelease-CCCH-r5-add-ext BIT STRING OPTIONAL, v690NonCriticalExtensions SEQUENCE { rrcConnectionRelease-v690ext RRCConnectionRelease-CCCH-v690ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL }, criticalExtensions SEQUENCE {} } } } } } RRCConnectionRelease-CCCH-r3-IEs ::= SEQUENCE { -- User equipment IEs u-RNTI U-RNTI, -- The rest of the message is identical to the one sent on DCCH. rrcConnectionRelease RRCConnectionRelease-r3-IEs } RRCConnectionRelease-CCCH-r4-IEs ::= SEQUENCE { -- The rest of the message is identical to the one sent on DCCH. rrcConnectionRelease RRCConnectionRelease-r4-IEs } -- The R5 and R4 sequence of IEs are identical in this message RRCConnectionRelease-CCCH-r5-IEs ::= RRCConnectionRelease-CCCH-r4-IEs -- The R6 non-critical extension is identical to the one sent on DCCH. RRCConnectionRelease-CCCH-v690ext-IEs ::= RRCConnectionRelease-v690ext-IEs -- *************************************************** -- -- RRC CONNECTION RELEASE COMPLETE -- -- *************************************************** RRCConnectionReleaseComplete ::= SEQUENCE { -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier, errorIndication FailureCauseWithProtErr OPTIONAL, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions rrcConnectionReleaseComplete-r3-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } -- *************************************************** -- -- RRC CONNECTION REQUEST -- -- *************************************************** RRCConnectionRequest ::= SEQUENCE { -- TABULAR: Integrity protection shall not be performed on this message. -- User equipment IEs initialUE-Identity InitialUE-Identity, establishmentCause EstablishmentCause, -- protocolErrorIndicator is MD, but for compactness reasons no default value -- has been assigned to it. protocolErrorIndicator ProtocolErrorIndicator, -- Measurement IEs measuredResultsOnRACH MeasuredResultsOnRACH OPTIONAL, -- Non critical Extensions v3d0NonCriticalExtensions SEQUENCE { rRCConnectionRequest-v3d0ext RRCConnectionRequest-v3d0ext-IEs, -- Reserved for future non critical extension v4b0NonCriticalExtensions SEQUENCE { rrcConnectionRequest-v4b0ext RRCConnectionRequest-v4b0ext-IEs, v590NonCriticalExtensions SEQUENCE { rrcConnectionRequest-v590ext RRCConnectionRequest-v590ext-IEs, v690NonCriticalExtensions SEQUENCE { rrcConnectionRequest-v690ext RRCConnectionRequest-v690ext-IEs, -- Reserved for future non critical extension nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } RRCConnectionRequest-v3d0ext-IEs ::= SEQUENCE { -- User equipment IEs uESpecificBehaviourInformation1idle UESpecificBehaviourInformation1idle OPTIONAL } RRCConnectionRequest-v4b0ext-IEs ::= SEQUENCE { -- User equipment IEs accessStratumReleaseIndicator AccessStratumReleaseIndicator } RRCConnectionRequest-v590ext-IEs ::= SEQUENCE { -- User equipment IEs predefinedConfigStatusInfo BOOLEAN } RRCConnectionRequest-v690ext-IEs ::= SEQUENCE { -- User equipment IEs ueCapabilityIndication ENUMERATED { hsdch, hsdch-edch } OPTIONAL, -- Measurement IEs measuredResultsOnRACHinterFreq MeasuredResultsOnRACHinterFreq OPTIONAL, domainIndicator CHOICE { cs-domain SEQUENCE { csCallType ENUMERATED {speech, video, other, spare } }, ps-domain NULL } } -- *************************************************** -- -- RRC CONNECTION SETUP -- -- *************************************************** RRCConnectionSetup ::= CHOICE { r3 SEQUENCE { rrcConnectionSetup-r3 RRCConnectionSetup-r3-IEs, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions rrcConnectionSetup-r3-add-ext BIT STRING OPTIONAL, v4b0NonCriticalExtensions SEQUENCE { rrcConnectionSetup-v4b0ext RRCConnectionSetup-v4b0ext-IEs, v590NonCriticalExtensions SEQUENCE { rrcConnectionSetup-v590ext RRCConnectionSetup-v590ext-IEs, v690NonCriticalExtensions SEQUENCE { rrcConnectionSetup-v690ext RRCConnectionSetup-v690ext-IEs, v7xyNonCriticalExtensions SEQUENCE { rrcConnectionSetup-v7xyext RRCConnectionSetup-v7xyext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL }, later-than-r3 SEQUENCE { initialUE-Identity InitialUE-Identity, rrc-TransactionIdentifier RRC-TransactionIdentifier, criticalExtensions CHOICE { r4 SEQUENCE { rrcConnectionSetup-r4 RRCConnectionSetup-r4-IEs, v4d0NonCriticalExtensions SEQUENCE { -- Container for adding non critical extensions after freezing REL-5 rrcConnectionSetup-r4-add-ext BIT STRING OPTIONAL, v590NonCriticalExtensions SEQUENCE { rrcConnectionSetup-v590ext RRCConnectionSetup-v590ext-IEs, v690NonCriticalExtensions SEQUENCE { rrcConnectionSetup-v690ext RRCConnectionSetup-v690ext-IEs, v7xyNonCriticalExtensions SEQUENCE { rrcConnectionSetup-v7xyext RRCConnectionSetup-v7xyext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL }, criticalExtensions CHOICE { r5 SEQUENCE { rrcConnectionSetup-r5 RRCConnectionSetup-r5-IEs, -- Container for adding non critical extensions after freezing REL-6 rrcConnectionSetup-r5-add-ext BIT STRING OPTIONAL, v690NonCriticalExtensions SEQUENCE { rrcConnectionSetup-v690ext RRCConnectionSetup-v690ext-IEs, v7xyNonCriticalExtensions SEQUENCE { rrcConnectionSetup-v7xyext RRCConnectionSetup-v7xyext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL }, criticalExtensions CHOICE { r6 SEQUENCE { rrcConnectionSetup-r6 RRCConnectionSetup-r6-IEs, -- Container for adding non critical extensions after freezing REL-7 rrcConnectionSetup-r6-add-ext BIT STRING OPTIONAL, v7xyNonCriticalExtensions SEQUENCE { rrcConnectionSetup-v7xyext RRCConnectionSetup-v7xyext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL }, criticalExtensions CHOICE { r7 SEQUENCE { rrcConnectionSetup-r7 RRCConnectionSetup-r7-IEs, -- Container for adding non critical extensions after freezing REL-8 rrcConnectionSetup-r7-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL }, criticalExtensions SEQUENCE {} } } } } } } RRCConnectionSetup-r3-IEs ::= SEQUENCE { -- TABULAR: Integrity protection shall not be performed on this message. -- User equipment IEs initialUE-Identity InitialUE-Identity, rrc-TransactionIdentifier RRC-TransactionIdentifier, activationTime ActivationTime OPTIONAL, new-U-RNTI U-RNTI, new-c-RNTI C-RNTI OPTIONAL, rrc-StateIndicator RRC-StateIndicator, utran-DRX-CycleLengthCoeff UTRAN-DRX-CycleLengthCoefficient, -- TABULAR: If capabilityUpdateRequirement is not present, the default value -- defined in 10.3.3.2 shall be used. capabilityUpdateRequirement CapabilityUpdateRequirement OPTIONAL, -- Radio bearer IEs srb-InformationSetupList SRB-InformationSetupList2, -- Transport channel IEs ul-CommonTransChInfo UL-CommonTransChInfo OPTIONAL, -- NOTE: ul-AddReconfTransChInfoList should be optional in later versions of -- this message ul-AddReconfTransChInfoList UL-AddReconfTransChInfoList, dl-CommonTransChInfo DL-CommonTransChInfo OPTIONAL, -- NOTE: dl-AddReconfTransChInfoList should be optional in later versions -- of this message dl-AddReconfTransChInfoList DL-AddReconfTransChInfoList, -- Physical channel IEs frequencyInfo FrequencyInfo OPTIONAL, maxAllowedUL-TX-Power MaxAllowedUL-TX-Power OPTIONAL, ul-ChannelRequirement UL-ChannelRequirement OPTIONAL, dl-CommonInformation DL-CommonInformation OPTIONAL, dl-InformationPerRL-List DL-InformationPerRL-List OPTIONAL } RRCConnectionSetup-v4b0ext-IEs ::= SEQUENCE { capabilityUpdateRequirement-r4-ext CapabilityUpdateRequirement-r4-ext OPTIONAL, -- Physical channel IEs -- dummy is not used in this version of the specification, it should -- not be sent and if received it should be ignored. dummy SSDT-UL OPTIONAL, -- The order of the RLs in IE cell-id-PerRL-List is the same as -- in IE DL-InformationPerRL-List included in this message cell-id-PerRL-List CellIdentity-PerRL-List OPTIONAL } RRCConnectionSetup-v590ext-IEs ::= SEQUENCE { -- User equipment IEs systemSpecificCapUpdateReq SystemSpecificCapUpdateReq-v590ext OPTIONAL, -- Physical channel IEs dl-TPC-PowerOffsetPerRL-List DL-TPC-PowerOffsetPerRL-List OPTIONAL } RRCConnectionSetup-r4-IEs ::= SEQUENCE { -- TABULAR: Integrity protection shall not be performed on this message. activationTime ActivationTime OPTIONAL, new-U-RNTI U-RNTI, new-c-RNTI C-RNTI OPTIONAL, rrc-StateIndicator RRC-StateIndicator, utran-DRX-CycleLengthCoeff UTRAN-DRX-CycleLengthCoefficient, -- TABULAR: If capabilityUpdateRequirement is not present, the default value -- defined in 10.3.3.2 shall be used. capabilityUpdateRequirement CapabilityUpdateRequirement-r4 OPTIONAL, -- Radio bearer IEs srb-InformationSetupList SRB-InformationSetupList2, -- Transport channel IEs ul-CommonTransChInfo UL-CommonTransChInfo-r4 OPTIONAL, ul-AddReconfTransChInfoList UL-AddReconfTransChInfoList OPTIONAL, dl-CommonTransChInfo DL-CommonTransChInfo-r4 OPTIONAL, dl-AddReconfTransChInfoList DL-AddReconfTransChInfoList-r4 OPTIONAL, -- Physical channel IEs frequencyInfo FrequencyInfo OPTIONAL, maxAllowedUL-TX-Power MaxAllowedUL-TX-Power OPTIONAL, ul-ChannelRequirement UL-ChannelRequirement-r4 OPTIONAL, dl-CommonInformation DL-CommonInformation-r4 OPTIONAL, dl-InformationPerRL-List DL-InformationPerRL-List-r4 OPTIONAL } RRCConnectionSetup-r5-IEs ::= SEQUENCE { -- TABULAR: Integrity protection shall not be performed on this message. activationTime ActivationTime OPTIONAL, new-U-RNTI U-RNTI, new-c-RNTI C-RNTI OPTIONAL, rrc-StateIndicator RRC-StateIndicator, utran-DRX-CycleLengthCoeff UTRAN-DRX-CycleLengthCoefficient, -- TABULAR: If capabilityUpdateRequirement is not present, the default value -- defined in 10.3.3.2 shall be used. capabilityUpdateRequirement CapabilityUpdateRequirement-r5 OPTIONAL, -- Specification mode information specificationMode CHOICE { complete SEQUENCE { -- Radio bearer IEs srb-InformationSetupList SRB-InformationSetupList2, -- Transport channel IEs ul-CommonTransChInfo UL-CommonTransChInfo-r4 OPTIONAL, ul-AddReconfTransChInfoList UL-AddReconfTransChInfoList OPTIONAL, dl-CommonTransChInfo DL-CommonTransChInfo-r4 OPTIONAL, dl-AddReconfTransChInfoList DL-AddReconfTransChInfoList-r4 OPTIONAL }, preconfiguration SEQUENCE { -- All IEs that include an FDD/TDD choice are split in two IEs for this message, -- one for the FDD only elements and one for the TDD only elements, so that one -- FDD/TDD choice in this level is sufficient. preConfigMode CHOICE { predefinedConfigIdentity PredefinedConfigIdentity, defaultConfig SEQUENCE { defaultConfigMode DefaultConfigMode, defaultConfigIdentity DefaultConfigIdentity-r5 } } } }, -- Physical channel IEs frequencyInfo FrequencyInfo OPTIONAL, maxAllowedUL-TX-Power MaxAllowedUL-TX-Power OPTIONAL, ul-ChannelRequirement UL-ChannelRequirement-r4 OPTIONAL, dl-CommonInformation DL-CommonInformation-r4 OPTIONAL, dl-InformationPerRL-List DL-InformationPerRL-List-r5bis OPTIONAL } RRCConnectionSetup-v690ext-IEs ::= SEQUENCE { -- Physical Channel IEs beaconPLEst BEACON-PL-Est OPTIONAL, postVerificationPeriod ENUMERATED { true } OPTIONAL } RRCConnectionSetup-r6-IEs ::= SEQUENCE { -- TABULAR: Integrity protection shall not be performed on this message. activationTime ActivationTime OPTIONAL, new-U-RNTI U-RNTI, new-c-RNTI C-RNTI OPTIONAL, new-H-RNTI H-RNTI OPTIONAL, newPrimary-E-RNTI E-RNTI OPTIONAL, newSecondary-E-RNTI E-RNTI OPTIONAL, rrc-StateIndicator RRC-StateIndicator, utran-DRX-CycleLengthCoeff UTRAN-DRX-CycleLengthCoefficient, -- TABULAR: If capabilityUpdateRequirement is not present, the default value -- defined in 10.3.3.2 shall be used. capabilityUpdateRequirement CapabilityUpdateRequirement-r5 OPTIONAL, -- Specification mode information specificationMode CHOICE { complete SEQUENCE { -- Radio bearer IEs srb-InformationSetupList SRB-InformationSetupList2-r6, -- Transport channel IEs ul-CommonTransChInfo UL-CommonTransChInfo-r4 OPTIONAL, ul-AddReconfTransChInfoList UL-AddReconfTransChInfoList-r6 OPTIONAL, dl-CommonTransChInfo DL-CommonTransChInfo-r4 OPTIONAL, dl-AddReconfTransChInfoList DL-AddReconfTransChInfoList-r5 OPTIONAL }, preconfiguration SEQUENCE { -- All IEs that include an FDD/TDD choice are split in two IEs for this message, -- one for the FDD only elements and one for the TDD only elements, so that one -- FDD/TDD choice in this level is sufficient. preConfigMode CHOICE { predefinedConfigIdentity PredefinedConfigIdentity, defaultConfig SEQUENCE { defaultConfigMode DefaultConfigMode, defaultConfigIdentity DefaultConfigIdentity-r6 } } } }, -- Physical channel IEs frequencyInfo FrequencyInfo OPTIONAL, maxAllowedUL-TX-Power MaxAllowedUL-TX-Power OPTIONAL, ul-DPCH-Info UL-DPCH-Info-r6 OPTIONAL, ul-EDCH-Information UL-EDCH-Information-r6 OPTIONAL, dl-HSPDSCH-Information DL-HSPDSCH-Information-r6 OPTIONAL, dl-CommonInformation DL-CommonInformation-r6 OPTIONAL, dl-InformationPerRL-List DL-InformationPerRL-List-r6 OPTIONAL } RRCConnectionSetup-r7-IEs ::= SEQUENCE { -- TABULAR: Integrity protection shall not be performed on this message. activationTime ActivationTime OPTIONAL, new-U-RNTI U-RNTI, new-c-RNTI C-RNTI OPTIONAL, new-H-RNTI H-RNTI OPTIONAL, newPrimary-E-RNTI E-RNTI OPTIONAL, newSecondary-E-RNTI E-RNTI OPTIONAL, rrc-StateIndicator RRC-StateIndicator, utran-DRX-CycleLengthCoeff UTRAN-DRX-CycleLengthCoefficient, -- TABULAR: If capabilityUpdateRequirement is not present, the default value -- defined in 10.3.3.2 shall be used. capabilityUpdateRequirement CapabilityUpdateRequirement-r5 OPTIONAL, -- Specification mode information specificationMode CHOICE { complete SEQUENCE { -- Radio bearer IEs srb-InformationSetupList SRB-InformationSetupList2-r6, -- Transport channel IEs ul-CommonTransChInfo UL-CommonTransChInfo-r4 OPTIONAL, ul-AddReconfTransChInfoList UL-AddReconfTransChInfoList-r6 OPTIONAL, dl-CommonTransChInfo DL-CommonTransChInfo-r4 OPTIONAL, dl-AddReconfTransChInfoList DL-AddReconfTransChInfoList-r5 OPTIONAL }, preconfiguration SEQUENCE { -- All IEs that include an FDD/TDD choice are split in two IEs for this message, -- one for the FDD only elements and one for the TDD only elements, so that one -- FDD/TDD choice in this level is sufficient. preConfigMode CHOICE { predefinedConfigIdentity PredefinedConfigIdentity, defaultConfig SEQUENCE { defaultConfigMode DefaultConfigMode, defaultConfigIdentity DefaultConfigIdentity-r6 } } } }, -- Physical channel IEs frequencyInfo FrequencyInfo OPTIONAL, maxAllowedUL-TX-Power MaxAllowedUL-TX-Power OPTIONAL, ul-DPCH-Info UL-DPCH-Info-r7 OPTIONAL, ul-EDCH-Information UL-EDCH-Information-r6 OPTIONAL, dl-HSPDSCH-Information DL-HSPDSCH-Information-r7 OPTIONAL, dl-CommonInformation DL-CommonInformation-r7 OPTIONAL, dl-InformationPerRL-List DL-InformationPerRL-List-r7 OPTIONAL } RRCConnectionSetup-v7xyext-IEs ::= SEQUENCE { capabilityUpdateRequirement-r7-ext CapabilityUpdateRequirement-r7-ext OPTIONAL } -- *************************************************** -- -- RRC CONNECTION SETUP COMPLETE -- -- *************************************************** RRCConnectionSetupComplete ::= SEQUENCE { -- TABULAR: Integrity protection shall not be performed on this message. -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier, startList STARTList, ue-RadioAccessCapability UE-RadioAccessCapability OPTIONAL, -- Other IEs ue-RATSpecificCapability InterRAT-UE-RadioAccessCapabilityList OPTIONAL, -- Non critical extensions v370NonCriticalExtensions SEQUENCE { rrcConnectionSetupComplete-v370ext RRCConnectionSetupComplete-v370ext, v380NonCriticalExtensions SEQUENCE { rrcConnectionSetupComplete-v380ext RRCConnectionSetupComplete-v380ext-IEs, -- Reserved for future non critical extension v3a0NonCriticalExtensions SEQUENCE { rrcConnectionSetupComplete-v3a0ext RRCConnectionSetupComplete-v3a0ext-IEs, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions rrcConnectionSetupComplete-r3-add-ext BIT STRING (CONTAINING RRCConnectionSetupComplete-r3-add-ext-IEs) OPTIONAL, v3g0NonCriticalExtensions SEQUENCE { rrcConnectionSetupComplete-v3g0ext RRCConnectionSetupComplete-v3g0ext-IEs, v4b0NonCriticalExtensions SEQUENCE { rrcConnectionSetupComplete-v4b0ext RRCConnectionSetupComplete-v4b0ext-IEs, v590NonCriticalExtensions SEQUENCE { rrcConnectionSetupComplete-v590ext RRCConnectionSetupComplete-v590ext-IEs, v5c0NonCriticalExtensions SEQUENCE { rrcConnectionSetupComplete-v5c0ext RRCConnectionSetupComplete-v5c0ext-IEs, v690NonCriticalExtensions SEQUENCE { rrcConnectionSetupComplete-v690ext RRCConnectionSetupComplete-v690ext-IEs, v7xyNonCriticalExtensions SEQUENCE { rrcConectionSetupComplete-v7xyext RRCConnectionSetupComplete-v7xyext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } RRCConnectionSetupComplete-v370ext ::= SEQUENCE { -- User equipment IEs ue-RadioAccessCapability-v370ext UE-RadioAccessCapability-v370ext OPTIONAL } RRCConnectionSetupComplete-v380ext-IEs ::= SEQUENCE { -- User equipment IEs ue-RadioAccessCapability-v380ext UE-RadioAccessCapability-v380ext OPTIONAL, dl-PhysChCapabilityFDD-v380ext DL-PhysChCapabilityFDD-v380ext } RRCConnectionSetupComplete-v3a0ext-IEs ::= SEQUENCE { -- User equipment IEs ue-RadioAccessCapability-v3a0ext UE-RadioAccessCapability-v3a0ext OPTIONAL } RRCConnectionSetupComplete-v3g0ext-IEs ::= SEQUENCE { -- User equipment IEs ue-RadioAccessCapability-v3g0ext UE-RadioAccessCapability-v3g0ext OPTIONAL } RRCConnectionSetupComplete-r3-add-ext-IEs ::= SEQUENCE { rrcConnectionSetupComplete-v650ext RRCConnectionSetupComplete-v650ext-IEs OPTIONAL, v680NonCriticalExtensions SEQUENCE { rrcConnectionSetupComplete-v680ext RRCConnectionSetupComplete-v680ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } RRCConnectionSetupComplete-v4b0ext-IEs ::= SEQUENCE { -- User equipment IEs ue-RadioAccessCapability-v4b0ext UE-RadioAccessCapability-v4b0ext OPTIONAL } RRCConnectionSetupComplete-v590ext-IEs ::= SEQUENCE { -- User equipment IEs ue-RadioAccessCapability-v590ext UE-RadioAccessCapability-v590ext OPTIONAL, -- Other IEs ue-RATSpecificCapability-v590ext InterRAT-UE-RadioAccessCapability-v590ext OPTIONAL } RRCConnectionSetupComplete-v5c0ext-IEs ::= SEQUENCE { -- User equipment IEs ue-RadioAccessCapability-v5c0ext UE-RadioAccessCapability-v5c0ext OPTIONAL } RRCConnectionSetupComplete-v650ext-IEs ::= SEQUENCE { -- User equipment IEs ue-RadioAccessCapability-v650ext UE-RadioAccessCapability-v650ext } RRCConnectionSetupComplete-v680ext-IEs ::= SEQUENCE { -- User equipment IEs ue-RadioAccessCapability-v680ext UE-RadioAccessCapability-v680ext } RRCConnectionSetupComplete-v690ext-IEs ::= SEQUENCE { -- User equipment IEs ueCapabilityContainer BIT STRING (CONTAINING UE-CapabilityContainer-IEs) OPTIONAL } RRCConnectionSetupComplete-v7xyext-IEs ::= SEQUENCE { ue-RadioAccessCapability-v7xyext UE-RadioAccessCapability-v7xyext OPTIONAL } -- *************************************************** -- -- RRC FAILURE INFO -- -- *************************************************** RRC-FailureInfo ::= CHOICE { r3 SEQUENCE { rRC-FailureInfo-r3 RRC-FailureInfo-r3-IEs, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions rrc-FailureInfo-r3-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL }, criticalExtensions SEQUENCE {} } RRC-FailureInfo-r3-IEs ::= SEQUENCE { -- Non-RRC IEs failureCauseWithProtErr FailureCauseWithProtErr } -- *************************************************** -- -- RRC STATUS -- -- *************************************************** RRCStatus ::= SEQUENCE { -- Other IEs -- TABULAR: Identification of received message is nested in -- ProtocolErrorMoreInformation protocolErrorInformation ProtocolErrorMoreInformation, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions rrcStatus-r3-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } -- *************************************************** -- -- SECURITY MODE COMMAND -- -- *************************************************** SecurityModeCommand ::= CHOICE { r3 SEQUENCE { securityModeCommand-r3 SecurityModeCommand-r3-IEs, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions securityModeCommand-r3-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL }, later-than-r3 SEQUENCE { rrc-TransactionIdentifier RRC-TransactionIdentifier, criticalExtensions SEQUENCE {} } } SecurityModeCommand-r3-IEs ::= SEQUENCE { -- TABULAR: Integrity protection shall always be performed on this message. -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier, securityCapability SecurityCapability, cipheringModeInfo CipheringModeInfo OPTIONAL, integrityProtectionModeInfo IntegrityProtectionModeInfo OPTIONAL, -- Core network IEs cn-DomainIdentity CN-DomainIdentity, -- Other IEs ue-SystemSpecificSecurityCap InterRAT-UE-SecurityCapList OPTIONAL } -- *************************************************** -- -- SECURITY MODE COMPLETE -- -- *************************************************** SecurityModeComplete ::= SEQUENCE { -- TABULAR: Integrity protection shall always be performed on this message. -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier, ul-IntegProtActivationInfo IntegrityProtActivationInfo OPTIONAL, -- Radio bearer IEs rb-UL-CiphActivationTimeInfo RB-ActivationTimeInfoList OPTIONAL, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions securityModeComplete-r3-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } -- *************************************************** -- -- SECURITY MODE FAILURE -- -- *************************************************** SecurityModeFailure ::= SEQUENCE { -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier, failureCause FailureCauseWithProtErr, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions securityModeFailure-r3-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } -- *************************************************** -- -- SIGNALLING CONNECTION RELEASE -- -- *************************************************** SignallingConnectionRelease ::= CHOICE { r3 SEQUENCE { signallingConnectionRelease-r3 SignallingConnectionRelease-r3-IEs, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions signallingConnectionRelease-r3-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL }, later-than-r3 SEQUENCE { rrc-TransactionIdentifier RRC-TransactionIdentifier, criticalExtensions SEQUENCE {} } } SignallingConnectionRelease-r3-IEs ::= SEQUENCE { -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier, -- Core network IEs cn-DomainIdentity CN-DomainIdentity } -- *************************************************** -- -- SIGNALLING CONNECTION RELEASE INDICATION -- -- *************************************************** SignallingConnectionReleaseIndication ::= SEQUENCE { -- Core network IEs cn-DomainIdentity CN-DomainIdentity, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions signallingConnectionReleaseIndication-r3-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } -- *************************************************** -- -- SYSTEM INFORMATION for BCH -- -- *************************************************** SystemInformation-BCH ::= SEQUENCE { -- Other information elements sfn-Prime SFN-Prime, payload CHOICE { noSegment NULL, firstSegment FirstSegment, subsequentSegment SubsequentSegment, lastSegmentShort LastSegmentShort, lastAndFirst SEQUENCE { lastSegmentShort LastSegmentShort, firstSegment FirstSegmentShort }, lastAndComplete SEQUENCE { lastSegmentShort LastSegmentShort, completeSIB-List CompleteSIB-List }, lastAndCompleteAndFirst SEQUENCE { lastSegmentShort LastSegmentShort, completeSIB-List CompleteSIB-List, firstSegment FirstSegmentShort }, completeSIB-List CompleteSIB-List, completeAndFirst SEQUENCE { completeSIB-List CompleteSIB-List, firstSegment FirstSegmentShort }, completeSIB CompleteSIB, lastSegment LastSegment, spare5 NULL, spare4 NULL, spare3 NULL, spare2 NULL, spare1 NULL } } -- *************************************************** -- -- SYSTEM INFORMATION for FACH -- -- *************************************************** SystemInformation-FACH ::= SEQUENCE { -- Other information elements payload CHOICE { noSegment NULL, firstSegment FirstSegment, subsequentSegment SubsequentSegment, lastSegmentShort LastSegmentShort, lastAndFirst SEQUENCE { lastSegmentShort LastSegmentShort, firstSegment FirstSegmentShort }, lastAndComplete SEQUENCE { lastSegmentShort LastSegmentShort, completeSIB-List CompleteSIB-List }, lastAndCompleteAndFirst SEQUENCE { lastSegmentShort LastSegmentShort, completeSIB-List CompleteSIB-List, firstSegment FirstSegmentShort }, completeSIB-List CompleteSIB-List, completeAndFirst SEQUENCE { completeSIB-List CompleteSIB-List, firstSegment FirstSegmentShort }, completeSIB CompleteSIB, lastSegment LastSegment, spare5 NULL, spare4 NULL, spare3 NULL, spare2 NULL, spare1 NULL } } -- *************************************************** -- -- First segment -- -- *************************************************** FirstSegment ::= SEQUENCE { -- Other information elements sib-Type SIB-Type, seg-Count SegCount, sib-Data-fixed SIB-Data-fixed } -- *************************************************** -- -- First segment (short) -- -- *************************************************** FirstSegmentShort ::= SEQUENCE { -- Other information elements sib-Type SIB-Type, seg-Count SegCount, sib-Data-variable SIB-Data-variable } -- *************************************************** -- -- Subsequent segment -- -- *************************************************** SubsequentSegment ::= SEQUENCE { -- Other information elements sib-Type SIB-Type, segmentIndex SegmentIndex, sib-Data-fixed SIB-Data-fixed } -- *************************************************** -- -- Last segment -- -- *************************************************** LastSegment ::= SEQUENCE { -- Other information elements sib-Type SIB-Type, segmentIndex SegmentIndex, -- For sib-Data-fixed, in case the SIB data is less than 222 bits, padding -- shall be used. The same padding bits shall be used as defined in clause 12.1 sib-Data-fixed SIB-Data-fixed } LastSegmentShort ::= SEQUENCE { -- Other information elements sib-Type SIB-Type, segmentIndex SegmentIndex, sib-Data-variable SIB-Data-variable } -- *************************************************** -- -- Complete SIB -- -- *************************************************** CompleteSIB-List ::= SEQUENCE (SIZE (1..maxSIBperMsg)) OF CompleteSIBshort CompleteSIB ::= SEQUENCE { -- Other information elements sib-Type SIB-Type, -- For sib-Data-fixed, in case the SIB data is less than 226 bits, padding -- shall be used. The same padding bits shall be used as defined in clause 12.1 sib-Data-fixed BIT STRING (SIZE (226)) } CompleteSIBshort ::= SEQUENCE { -- Other information elements sib-Type SIB-Type, sib-Data-variable SIB-Data-variable } -- *************************************************** -- -- SYSTEM INFORMATION CHANGE INDICATION -- -- *************************************************** SystemInformationChangeIndication ::= SEQUENCE { -- Other IEs bcch-ModificationInfo BCCH-ModificationInfo, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions systemInformationChangeIndication-r3-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } -- *************************************************** -- -- TRANSPORT CHANNEL RECONFIGURATION -- -- *************************************************** TransportChannelReconfiguration ::= CHOICE { r3 SEQUENCE { transportChannelReconfiguration-r3 TransportChannelReconfiguration-r3-IEs, v3a0NonCriticalExtensions SEQUENCE { transportChannelReconfiguration-v3a0ext TransportChannelReconfiguration-v3a0ext, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions transportChannelReconfiguration-r3-add-ext BIT STRING OPTIONAL, v4b0NonCriticalExtensions SEQUENCE { transportChannelReconfiguration-v4b0ext TransportChannelReconfiguration-v4b0ext-IEs, v590NonCriticalExtensions SEQUENCE { transportChannelReconfiguration-v590ext TransportChannelReconfiguration-v590ext-IEs, v690NonCriticalExtensions SEQUENCE { transportChannelReconfiguration-v690ext TransportChannelReconfiguration-v690ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL }, later-than-r3 SEQUENCE { rrc-TransactionIdentifier RRC-TransactionIdentifier, criticalExtensions CHOICE { r4 SEQUENCE { transportChannelReconfiguration-r4 TransportChannelReconfiguration-r4-IEs, v4d0NonCriticalExtensions SEQUENCE { -- Container for adding non critical extensions after freezing REL-5 transportChannelReconfiguration-r4-add-ext BIT STRING OPTIONAL, v590NonCriticalExtensions SEQUENCE { transportChannelReconfiguration-v590ext TransportChannelReconfiguration-v590ext-IEs, v690NonCriticalExtensions SEQUENCE { transportChannelReconfiguration-v690ext TransportChannelReconfiguration-v690ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL }, criticalExtensions CHOICE { r5 SEQUENCE { transportChannelReconfiguration-r5 TransportChannelReconfiguration-r5-IEs, -- Container for adding non critical extensions after freezing REL-6 transportChannelReconfiguration-r5-add-ext BIT STRING OPTIONAL, v690NonCriticalExtensions SEQUENCE { transportChannelReconfiguration-v690ext TransportChannelReconfiguration-v690ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL }, criticalExtensions CHOICE { r6 SEQUENCE { transportChannelReconfiguration-r6 TransportChannelReconfiguration-r6-IEs, -- Container for adding non critical extensions after freezing REL-7 transportChannelReconfiguration-r6-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL }, criticalExtensions CHOICE { r7 SEQUENCE { transportChannelReconfiguration-r7 TransportChannelReconfiguration-r7-IEs, -- Container for adding non critical extensions after freezing REL-8 transportChannelReconfiguration-r7-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL }, criticalExtensions SEQUENCE {} } } } } } } TransportChannelReconfiguration-r3-IEs ::= SEQUENCE { -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier, integrityProtectionModeInfo IntegrityProtectionModeInfo OPTIONAL, cipheringModeInfo CipheringModeInfo OPTIONAL, activationTime ActivationTime OPTIONAL, new-U-RNTI U-RNTI OPTIONAL, new-C-RNTI C-RNTI OPTIONAL, rrc-StateIndicator RRC-StateIndicator, utran-DRX-CycleLengthCoeff UTRAN-DRX-CycleLengthCoefficient OPTIONAL, -- Core network IEs cn-InformationInfo CN-InformationInfo OPTIONAL, -- UTRAN mobility IEs ura-Identity URA-Identity OPTIONAL, -- Radio bearer IEs dl-CounterSynchronisationInfo DL-CounterSynchronisationInfo OPTIONAL, -- Transport channel IEs ul-CommonTransChInfo UL-CommonTransChInfo OPTIONAL, ul-AddReconfTransChInfoList UL-AddReconfTransChInfoList OPTIONAL, -- 'dummy', 'dummy1' and 'dummy2' are not used in this version of the specification, -- they should not be sent and if received they should be ignored. dummy CHOICE { fdd SEQUENCE { dummy1 CPCH-SetID OPTIONAL, dummy2 DRAC-StaticInformationList OPTIONAL }, tdd NULL } OPTIONAL, dl-CommonTransChInfo DL-CommonTransChInfo OPTIONAL, dl-AddReconfTransChInfoList DL-AddReconfTransChInfoList OPTIONAL, -- Physical channel IEs frequencyInfo FrequencyInfo OPTIONAL, maxAllowedUL-TX-Power MaxAllowedUL-TX-Power OPTIONAL, ul-ChannelRequirement UL-ChannelRequirement OPTIONAL, modeSpecificPhysChInfo CHOICE { fdd SEQUENCE { -- dummy is not used in this version of specification, it should -- not be sent and if received it should be ignored. dummy DL-PDSCH-Information OPTIONAL }, tdd NULL }, dl-CommonInformation DL-CommonInformation OPTIONAL, dl-InformationPerRL-List DL-InformationPerRL-List OPTIONAL } TransportChannelReconfiguration-v3a0ext ::= SEQUENCE { -- The IE 窶從ew-DSCH-RNTI窶 should not be included in FDD mode, and if received -- the UE behaviour is unspecified new-DSCH-RNTI DSCH-RNTI OPTIONAL } TransportChannelReconfiguration-v4b0ext-IEs ::= SEQUENCE { -- Physical channel IEs -- dummy is not used in this version of the specification, it should -- not be sent and if received it should be ignored. dummy SSDT-UL OPTIONAL, -- The order of the RLs in IE cell-id-PerRL-List is the same as -- in IE DL-InformationPerRL-List included in this message cell-id-PerRL-List CellIdentity-PerRL-List OPTIONAL } TransportChannelReconfiguration-v590ext-IEs ::= SEQUENCE { -- Physical channel IEs dl-TPC-PowerOffsetPerRL-List DL-TPC-PowerOffsetPerRL-List OPTIONAL } TransportChannelReconfiguration-r4-IEs ::= SEQUENCE { -- User equipment IEs integrityProtectionModeInfo IntegrityProtectionModeInfo OPTIONAL, cipheringModeInfo CipheringModeInfo OPTIONAL, activationTime ActivationTime OPTIONAL, new-U-RNTI U-RNTI OPTIONAL, new-C-RNTI C-RNTI OPTIONAL, -- The IE 窶從ew-DSCH-RNTI窶 should not be included in FDD mode, and if received -- the UE behaviour is unspecified new-DSCH-RNTI DSCH-RNTI OPTIONAL, rrc-StateIndicator RRC-StateIndicator, utran-DRX-CycleLengthCoeff UTRAN-DRX-CycleLengthCoefficient OPTIONAL, -- Core network IEs cn-InformationInfo CN-InformationInfo OPTIONAL, -- UTRAN mobility IEs ura-Identity URA-Identity OPTIONAL, -- Radio bearer IEs dl-CounterSynchronisationInfo DL-CounterSynchronisationInfo OPTIONAL, -- Transport channel IEs ul-CommonTransChInfo UL-CommonTransChInfo-r4 OPTIONAL, ul-AddReconfTransChInfoList UL-AddReconfTransChInfoList OPTIONAL, -- 'dummy', 'dummy1' and 'dummy2' are not used in this version of the specification, -- they should not be sent and if received they should be ignored. dummy CHOICE { fdd SEQUENCE { dummy1 CPCH-SetID OPTIONAL, dummy2 DRAC-StaticInformationList OPTIONAL }, tdd NULL } OPTIONAL, dl-CommonTransChInfo DL-CommonTransChInfo-r4 OPTIONAL, dl-AddReconfTransChInfoList DL-AddReconfTransChInfoList-r4 OPTIONAL, -- Physical channel IEs frequencyInfo FrequencyInfo OPTIONAL, maxAllowedUL-TX-Power MaxAllowedUL-TX-Power OPTIONAL, ul-ChannelRequirement UL-ChannelRequirement-r4 OPTIONAL, modeSpecificPhysChInfo CHOICE { fdd SEQUENCE { -- dummy is not used in this version of specification, it should -- not be sent and if received it should be ignored. dummy DL-PDSCH-Information OPTIONAL }, tdd NULL }, dl-CommonInformation DL-CommonInformation-r4 OPTIONAL, dl-InformationPerRL-List DL-InformationPerRL-List-r4 OPTIONAL } TransportChannelReconfiguration-r5-IEs ::= SEQUENCE { -- User equipment IEs integrityProtectionModeInfo IntegrityProtectionModeInfo OPTIONAL, cipheringModeInfo CipheringModeInfo OPTIONAL, activationTime ActivationTime OPTIONAL, new-U-RNTI U-RNTI OPTIONAL, new-C-RNTI C-RNTI OPTIONAL, -- The IE 窶從ew-DSCH-RNTI窶 should not be included in FDD mode, and if received -- the UE behaviour is unspecified new-DSCH-RNTI DSCH-RNTI OPTIONAL, new-H-RNTI H-RNTI OPTIONAL, rrc-StateIndicator RRC-StateIndicator, utran-DRX-CycleLengthCoeff UTRAN-DRX-CycleLengthCoefficient OPTIONAL, -- Core network IEs cn-InformationInfo CN-InformationInfo OPTIONAL, -- UTRAN mobility IEs ura-Identity URA-Identity OPTIONAL, -- Radio bearer IEs dl-CounterSynchronisationInfo DL-CounterSynchronisationInfo-r5 OPTIONAL, -- Transport channel IEs ul-CommonTransChInfo UL-CommonTransChInfo-r4 OPTIONAL, ul-AddReconfTransChInfoList UL-AddReconfTransChInfoList OPTIONAL, -- 'dummy', 'dummy1' and 'dummy2' are not used in this version of the specification, -- they should not be sent and if received they should be ignored. dummy CHOICE { fdd SEQUENCE { dummy1 CPCH-SetID OPTIONAL, dummy2 DRAC-StaticInformationList OPTIONAL }, tdd NULL } OPTIONAL, dl-CommonTransChInfo DL-CommonTransChInfo-r4 OPTIONAL, dl-AddReconfTransChInfoList DL-AddReconfTransChInfoList-r5 OPTIONAL, -- Physical channel IEs frequencyInfo FrequencyInfo OPTIONAL, maxAllowedUL-TX-Power MaxAllowedUL-TX-Power OPTIONAL, ul-ChannelRequirement UL-ChannelRequirement-r5 OPTIONAL, modeSpecificPhysChInfo CHOICE { fdd SEQUENCE { -- dummy is not used in this version of specification, it should -- not be sent and if received it should be ignored. dummy DL-PDSCH-Information OPTIONAL }, tdd NULL }, dl-HSPDSCH-Information DL-HSPDSCH-Information OPTIONAL, dl-CommonInformation DL-CommonInformation-r5 OPTIONAL, dl-InformationPerRL-List DL-InformationPerRL-List-r5 OPTIONAL } TransportChannelReconfiguration-v690ext-IEs ::= SEQUENCE { -- User Equipment IEs delayRestrictionFlag DelayRestrictionFlag OPTIONAL, -- Core network IEs primary-plmn-Identity PLMN-Identity OPTIONAL, -- Physical channel IEs -- The IE harq-Preamble-Mode should not be used in the r3 and r4 versions of the message -- If included in the r3 or r4 version of the message, the UE should ignore the IE harq-Preamble-Mode HARQ-Preamble-Mode OPTIONAL, beaconPLEst BEACON-PL-Est OPTIONAL, postVerificationPeriod ENUMERATED { true } OPTIONAL, dhs-sync DHS-Sync OPTIONAL, timingMaintainedSynchInd TimingMaintainedSynchInd OPTIONAL, -- MBMS IEs mbms-PL-ServiceRestrictInfo MBMS-PL-ServiceRestrictInfo-r6 OPTIONAL } TransportChannelReconfiguration-r6-IEs ::= SEQUENCE { -- User equipment IEs integrityProtectionModeInfo IntegrityProtectionModeInfo OPTIONAL, cipheringModeInfo CipheringModeInfo OPTIONAL, activationTime ActivationTime OPTIONAL, delayRestrictionFlag DelayRestrictionFlag OPTIONAL, new-U-RNTI U-RNTI OPTIONAL, new-C-RNTI C-RNTI OPTIONAL, -- The IE 窶從ew-DSCH-RNTI窶 should not be included in FDD mode, -- and if received the UE behaviour is unspecified new-DSCH-RNTI DSCH-RNTI OPTIONAL, new-H-RNTI H-RNTI OPTIONAL, newPrimary-E-RNTI E-RNTI OPTIONAL, newSecondary-E-RNTI E-RNTI OPTIONAL, rrc-StateIndicator RRC-StateIndicator, utran-DRX-CycleLengthCoeff UTRAN-DRX-CycleLengthCoefficient OPTIONAL, -- Core network IEs cn-InformationInfo CN-InformationInfo-r6 OPTIONAL, -- UTRAN mobility IEs ura-Identity URA-Identity OPTIONAL, -- Radio bearer IEs dl-CounterSynchronisationInfo DL-CounterSynchronisationInfo-r5 OPTIONAL, -- Transport channel IEs ul-CommonTransChInfo UL-CommonTransChInfo-r4 OPTIONAL, ul-AddReconfTransChInfoList UL-AddReconfTransChInfoList-r6 OPTIONAL, dl-CommonTransChInfo DL-CommonTransChInfo-r4 OPTIONAL, dl-AddReconfTransChInfoList DL-AddReconfTransChInfoList-r5 OPTIONAL, -- Physical channel IEs frequencyInfo FrequencyInfo OPTIONAL, maxAllowedUL-TX-Power MaxAllowedUL-TX-Power OPTIONAL, ul-DPCH-Info UL-DPCH-Info-r6 OPTIONAL, ul-EDCH-Information UL-EDCH-Information-r6 OPTIONAL, dl-HSPDSCH-Information DL-HSPDSCH-Information-r6 OPTIONAL, dl-CommonInformation DL-CommonInformation-r6 OPTIONAL, dl-InformationPerRL-List DL-InformationPerRL-List-r6 OPTIONAL, -- MBMS IEs mbms-PL-ServiceRestrictInfo MBMS-PL-ServiceRestrictInfo-r6 OPTIONAL } TransportChannelReconfiguration-r7-IEs ::= SEQUENCE { -- User equipment IEs integrityProtectionModeInfo IntegrityProtectionModeInfo OPTIONAL, cipheringModeInfo CipheringModeInfo OPTIONAL, activationTime ActivationTime OPTIONAL, delayRestrictionFlag DelayRestrictionFlag OPTIONAL, new-U-RNTI U-RNTI OPTIONAL, new-C-RNTI C-RNTI OPTIONAL, -- The IE 窶從ew-DSCH-RNTI窶 should not be included in FDD mode, -- and if received the UE behaviour is unspecified new-DSCH-RNTI DSCH-RNTI OPTIONAL, new-H-RNTI H-RNTI OPTIONAL, newPrimary-E-RNTI E-RNTI OPTIONAL, newSecondary-E-RNTI E-RNTI OPTIONAL, rrc-StateIndicator RRC-StateIndicator, utran-DRX-CycleLengthCoeff UTRAN-DRX-CycleLengthCoefficient OPTIONAL, -- Core network IEs cn-InformationInfo CN-InformationInfo-r6 OPTIONAL, -- UTRAN mobility IEs ura-Identity URA-Identity OPTIONAL, -- Radio bearer IEs dl-CounterSynchronisationInfo DL-CounterSynchronisationInfo-r5 OPTIONAL, -- Transport channel IEs ul-CommonTransChInfo UL-CommonTransChInfo-r4 OPTIONAL, ul-AddReconfTransChInfoList UL-AddReconfTransChInfoList-r6 OPTIONAL, dl-CommonTransChInfo DL-CommonTransChInfo-r4 OPTIONAL, dl-AddReconfTransChInfoList DL-AddReconfTransChInfoList-r5 OPTIONAL, -- Physical channel IEs frequencyInfo FrequencyInfo OPTIONAL, maxAllowedUL-TX-Power MaxAllowedUL-TX-Power OPTIONAL, ul-DPCH-Info UL-DPCH-Info-r7 OPTIONAL, ul-EDCH-Information UL-EDCH-Information-r6 OPTIONAL, dl-HSPDSCH-Information DL-HSPDSCH-Information-r7 OPTIONAL, dl-CommonInformation DL-CommonInformation-r7 OPTIONAL, dl-InformationPerRL-List DL-InformationPerRL-List-r7 OPTIONAL, -- MBMS IEs mbms-PL-ServiceRestrictInfo MBMS-PL-ServiceRestrictInfo-r6 OPTIONAL } -- *************************************************** -- -- TRANSPORT CHANNEL RECONFIGURATION COMPLETE -- -- *************************************************** TransportChannelReconfigurationComplete ::= SEQUENCE { -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier, ul-IntegProtActivationInfo IntegrityProtActivationInfo OPTIONAL, -- TABULAR: UL-TimingAdvance is applicable for TDD mode only. ul-TimingAdvance UL-TimingAdvance OPTIONAL, -- Radio bearer IEs count-C-ActivationTime ActivationTime OPTIONAL, -- dummy is not used in this version of the specification and -- it should be ignored by the receiver. dummy RB-ActivationTimeInfoList OPTIONAL, ul-CounterSynchronisationInfo UL-CounterSynchronisationInfo OPTIONAL, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions transportChannelReconfigurationComplete-r3-add-ext BIT STRING OPTIONAL, v7xyNonCriticalExtensions SEQUENCE { transportChannelReconfigurationComplete-v7xyext TransportChannelReconfigurationComplete-v7xyext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } TransportChannelReconfigurationComplete-v7xyext-IEs ::= SEQUENCE { ext-ul-TimingAdvance EXT-UL-TimingAdvance OPTIONAL } -- *************************************************** -- -- TRANSPORT CHANNEL RECONFIGURATION FAILURE -- -- *************************************************** TransportChannelReconfigurationFailure ::= SEQUENCE { -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier, failureCause FailureCauseWithProtErr, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions transportChannelReconfigurationFailure-r3-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } -- ********************************************************* -- -- TRANSPORT FORMAT COMBINATION CONTROL in AM or UM RLC mode -- -- ********************************************************* TransportFormatCombinationControl ::= SEQUENCE { -- rrc-TransactionIdentifier is always included in this version of the specification rrc-TransactionIdentifier RRC-TransactionIdentifier OPTIONAL, modeSpecificInfo CHOICE { fdd NULL, tdd SEQUENCE { tfcs-ID TFCS-Identity OPTIONAL } }, dpch-TFCS-InUplink TFC-Subset, activationTimeForTFCSubset ActivationTime OPTIONAL, tfc-ControlDuration TFC-ControlDuration OPTIONAL, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions transportFormatCombinationControl-r3-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } -- *************************************************** -- -- TRANSPORT FORMAT COMBINATION CONTROL FAILURE -- -- *************************************************** TransportFormatCombinationControlFailure ::= SEQUENCE { -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier, failureCause FailureCauseWithProtErr, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions transportFormatCombinationControlFailure-r3-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } -- *************************************************** -- -- UE CAPABILITY ENQUIRY -- -- *************************************************** UECapabilityEnquiry ::= CHOICE { r3 SEQUENCE { ueCapabilityEnquiry-r3 UECapabilityEnquiry-r3-IEs, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions ueCapabilityEnquiry-r3-add-ext BIT STRING OPTIONAL, v4b0NonCriticalExtensions SEQUENCE { ueCapabilityEnquiry-v4b0ext UECapabilityEnquiry-v4b0ext-IEs, v590NonCriticalExtensions SEQUENCE { ueCapabilityEnquiry-v590ext UECapabilityEnquiry-v590ext-IEs, v7xyNonCriticalExtensions SEQUENCE { ueCapabilityEnquiry-v7xyext UECapabilityEnquiry-v7xyext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL }, later-than-r3 SEQUENCE { rrc-TransactionIdentifier RRC-TransactionIdentifier, criticalExtensions SEQUENCE {} } } UECapabilityEnquiry-r3-IEs ::= SEQUENCE { -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier, capabilityUpdateRequirement CapabilityUpdateRequirement } UECapabilityEnquiry-v4b0ext-IEs ::= SEQUENCE { capabilityUpdateRequirement-r4-ext CapabilityUpdateRequirement-r4-ext } UECapabilityEnquiry-v590ext-IEs ::= SEQUENCE { systemSpecificCapUpdateReq SystemSpecificCapUpdateReq-v590ext } UECapabilityEnquiry-v7xyext-IEs ::= SEQUENCE { capabilityUpdateRequirement-r7-ext CapabilityUpdateRequirement-r7-ext OPTIONAL } -- *************************************************** -- -- UE CAPABILITY INFORMATION -- -- *************************************************** UECapabilityInformation ::= SEQUENCE { -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier OPTIONAL, ue-RadioAccessCapability UE-RadioAccessCapability OPTIONAL, -- Other IEs ue-RATSpecificCapability InterRAT-UE-RadioAccessCapabilityList OPTIONAL, v370NonCriticalExtensions SEQUENCE { ueCapabilityInformation-v370ext UECapabilityInformation-v370ext, v380NonCriticalExtensions SEQUENCE { ueCapabilityInformation-v380ext UECapabilityInformation-v380ext-IEs, v3a0NonCriticalExtensions SEQUENCE { ueCapabilityInformation-v3a0ext UECapabilityInformation-v3a0ext-IEs, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions ueCapabilityInformation-r3-add-ext BIT STRING (CONTAINING UECapabilityInformation-r3-add-ext-IEs) OPTIONAL, -- Reserved for future non critical extension v4b0NonCriticalExtensions SEQUENCE { ueCapabilityInformation-v4b0ext UECapabilityInformation-v4b0ext, v590NonCriticalExtensions SEQUENCE { ueCapabilityInformation-v590ext UECapabilityInformation-v590ext, v5c0NonCriticalExtensions SEQUENCE { ueCapabilityInformation-v5c0ext UECapabilityInformation-v5c0ext, v690NonCriticalExtensions SEQUENCE { ueCapabilityInformation-v690ext UECapabilityInformation-v690ext-IEs, v7xyNonCriticalExtensions SEQUENCE { ueCapabilityInformation-v7xyext UECapabilityInformation-v7xyext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } UECapabilityInformation-v370ext ::= SEQUENCE { -- User equipment IEs ue-RadioAccessCapability-v370ext UE-RadioAccessCapability-v370ext OPTIONAL } UECapabilityInformation-v380ext-IEs ::= SEQUENCE { -- User equipment IEs ue-RadioAccessCapability-v380ext UE-RadioAccessCapability-v380ext OPTIONAL, dl-PhysChCapabilityFDD-v380ext DL-PhysChCapabilityFDD-v380ext } UECapabilityInformation-v3a0ext-IEs ::= SEQUENCE { -- User equipment IEs ue-RadioAccessCapability-v3a0ext UE-RadioAccessCapability-v3a0ext OPTIONAL } UECapabilityInformation-r3-add-ext-IEs ::= SEQUENCE { ueCapabilityInformation-v650ext UECapabilityInformation-v650ext-IEs OPTIONAL, v680NonCriticalExtensions SEQUENCE { ueCapabilityInformation-v680ext UECapabilityInformation-v680ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } UECapabilityInformation-v4b0ext ::= SEQUENCE { -- User equipment IEs ue-RadioAccessCapability-v4b0ext UE-RadioAccessCapability-v4b0ext OPTIONAL } UECapabilityInformation-v590ext ::= SEQUENCE { -- User equipment IEs ue-RadioAccessCapability-v3g0ext UE-RadioAccessCapability-v3g0ext OPTIONAL, ue-RadioAccessCapability-v590ext UE-RadioAccessCapability-v590ext OPTIONAL, -- Other IEs ue-RATSpecificCapability-v590ext InterRAT-UE-RadioAccessCapability-v590ext OPTIONAL } UECapabilityInformation-v5c0ext ::= SEQUENCE { -- User equipment IEs ue-RadioAccessCapability-v5c0ext UE-RadioAccessCapability-v5c0ext OPTIONAL } UECapabilityInformation-v650ext-IEs ::= SEQUENCE { ue-RadioAccessCapability-v650ext UE-RadioAccessCapability-v650ext } UECapabilityInformation-v680ext-IEs ::= SEQUENCE { -- User equipment IEs ue-RadioAccessCapability-v680ext UE-RadioAccessCapability-v680ext } UECapabilityInformation-v690ext-IEs ::= SEQUENCE { -- User equipment IEs ueCapabilityContainer BIT STRING (CONTAINING UE-CapabilityContainer-IEs) OPTIONAL } UECapabilityInformation-v7xyext-IEs ::= SEQUENCE { ue-RadioAccessCapability-v7xyext UE-RadioAccessCapability-v7xyext OPTIONAL } -- *************************************************** -- -- UE CAPABILITY INFORMATION CONFIRM -- -- *************************************************** UECapabilityInformationConfirm ::= CHOICE { r3 SEQUENCE { ueCapabilityInformationConfirm-r3 UECapabilityInformationConfirm-r3-IEs, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions ueCapabilityInformationConfirm-r3-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL }, later-than-r3 SEQUENCE { rrc-TransactionIdentifier RRC-TransactionIdentifier, criticalExtensions SEQUENCE {} } } UECapabilityInformationConfirm-r3-IEs ::= SEQUENCE { -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier } -- *************************************************** -- -- UPLINK DIRECT TRANSFER -- -- *************************************************** UplinkDirectTransfer ::= SEQUENCE { -- Core network IEs cn-DomainIdentity CN-DomainIdentity, nas-Message NAS-Message, -- Measurement IEs measuredResultsOnRACH MeasuredResultsOnRACH OPTIONAL, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions uplinkDirectTransfer-r3-add-ext BIT STRING OPTIONAL, v690NonCriticalExtensions SEQUENCE { uplinkDirectTransfer-v690ext UplinkDirectTransfer-v690ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } UplinkDirectTransfer-v690ext-IEs ::= SEQUENCE { -- Measurement IEs measuredResultsOnRACHinterFreq MeasuredResultsOnRACHinterFreq OPTIONAL } -- *************************************************** -- -- UPLINK PHYSICAL CHANNEL CONTROL -- -- *************************************************** UplinkPhysicalChannelControl ::= CHOICE { r3 SEQUENCE { uplinkPhysicalChannelControl-r3 UplinkPhysicalChannelControl-r3-IEs, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions uplinkPhysicalChannelControl-r3-add-ext BIT STRING OPTIONAL, v4b0NonCriticalExtensions SEQUENCE { uplinkPysicalChannelControl-v4b0ext UplinkPhysicalChannelControl-v4b0ext-IEs, -- Extension mechanism for non-release 4 information noncriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL }, later-than-r3 SEQUENCE { rrc-TransactionIdentifier RRC-TransactionIdentifier, criticalExtensions CHOICE { r4 SEQUENCE { uplinkPhysicalChannelControl-r4 UplinkPhysicalChannelControl-r4-IEs, v4d0NonCriticalExtensions SEQUENCE { -- Container for adding non critical extensions after freezing REL-5 uplinkPhysicalChannelControl-r4-add-ext BIT STRING OPTIONAL, v690NonCriticalExtensions SEQUENCE { uplinkPhysicalChannelControl-v690ext UplinkPhysicalChannelControl-v690ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL }, criticalExtensions CHOICE { r5 SEQUENCE { uplinkPhysicalChannelControl-r5 UplinkPhysicalChannelControl-r5-IEs, -- Container for adding non critical extensions after freezing REL-6 uplinkPhysicalChannelControl-r5-add-ext BIT STRING OPTIONAL, v690NonCriticalExtensions SEQUENCE { uplinkPhysicalChannelControl-v690ext UplinkPhysicalChannelControl-v690ext-IEs, v6a0NonCriticalExtensions SEQUENCE{ uplinkPhysicalChannelControl-v6a0ext UplinkPhysicalChannelControl-v6a0ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL }, criticalExtensions CHOICE { r7 SEQUENCE { uplinkPhysicalChannelControl-r7 UplinkPhysicalChannelControl-r7-IEs, -- Container for adding non critical extensions after freezing REL-8 uplinkPhysicalChannelControl-r7-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL }, criticalExtensions SEQUENCE {} } } } } } UplinkPhysicalChannelControl-r3-IEs ::= SEQUENCE { -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier, -- Physical channel IEs ccTrCH-PowerControlInfo CCTrCH-PowerControlInfo OPTIONAL, timingAdvance UL-TimingAdvanceControl OPTIONAL, alpha Alpha OPTIONAL, specialBurstScheduling SpecialBurstScheduling OPTIONAL, prach-ConstantValue ConstantValueTdd OPTIONAL, pusch-ConstantValue ConstantValueTdd OPTIONAL } UplinkPhysicalChannelControl-v4b0ext-IEs ::= SEQUENCE { -- In case of TDD, openLoopPowerControl-IPDL-TDD is included instead of IE -- up-IPDL-Parameters in up-OTDOA-AssistanceData openLoopPowerControl-IPDL-TDD OpenLoopPowerControl-IPDL-TDD-r4 OPTIONAL } UplinkPhysicalChannelControl-r4-IEs ::= SEQUENCE { -- Physical channel IEs ccTrCH-PowerControlInfo CCTrCH-PowerControlInfo-r4 OPTIONAL, specialBurstScheduling SpecialBurstScheduling OPTIONAL, tddOption CHOICE { tdd384 SEQUENCE { timingAdvance UL-TimingAdvanceControl-r4 OPTIONAL, alpha Alpha OPTIONAL, prach-ConstantValue ConstantValueTdd OPTIONAL, pusch-ConstantValue ConstantValueTdd OPTIONAL, openLoopPowerControl-IPDL-TDD OpenLoopPowerControl-IPDL-TDD-r4 OPTIONAL }, tdd128 SEQUENCE { ul-SynchronisationParameters UL-SynchronisationParameters-r4 OPTIONAL } } } UplinkPhysicalChannelControl-r5-IEs ::= SEQUENCE { -- Physical channel IEs ccTrCH-PowerControlInfo CCTrCH-PowerControlInfo-r5 OPTIONAL, specialBurstScheduling SpecialBurstScheduling OPTIONAL, tddOption CHOICE { tdd384 SEQUENCE { timingAdvance UL-TimingAdvanceControl-r4 OPTIONAL, alpha Alpha OPTIONAL, prach-ConstantValue ConstantValueTdd OPTIONAL, pusch-ConstantValue ConstantValueTdd OPTIONAL, openLoopPowerControl-IPDL-TDD OpenLoopPowerControl-IPDL-TDD-r4 OPTIONAL, hs-SICH-PowerControl HS-SICH-Power-Control-Info-TDD384 OPTIONAL }, tdd128 SEQUENCE { ul-SynchronisationParameters UL-SynchronisationParameters-r4 OPTIONAL } } } UplinkPhysicalChannelControl-v690ext-IEs ::= SEQUENCE { -- Physical Channel IEs beaconPLEst BEACON-PL-Est OPTIONAL } UplinkPhysicalChannelControl-v6a0ext-IEs ::= SEQUENCE { -- Physical Channel IEs desired-HS-SICH-PowerLevel INTEGER (-120..-58) OPTIONAL, tpc-Step-Size ENUMERATED { s1, s2, s3 , spare1 } OPTIONAL } UplinkPhysicalChannelControl-r7-IEs ::= SEQUENCE { -- Physical channel IEs ccTrCH-PowerControlInfo CCTrCH-PowerControlInfo-r7 OPTIONAL, specialBurstScheduling SpecialBurstScheduling OPTIONAL, tddOption CHOICE { tdd384 SEQUENCE { timingAdvance UL-TimingAdvanceControl-r4 OPTIONAL, alpha Alpha OPTIONAL, prach-ConstantValue ConstantValueTdd OPTIONAL, pusch-ConstantValue ConstantValueTdd OPTIONAL, openLoopPowerControl-IPDL-TDD OpenLoopPowerControl-IPDL-TDD-r4 OPTIONAL, hs-SICH-PowerControl HS-SICH-Power-Control-Info-TDD384 OPTIONAL }, tdd768 SEQUENCE { timingAdvance UL-TimingAdvanceControl-r7 OPTIONAL, alpha Alpha OPTIONAL, prach-ConstantValue ConstantValueTdd OPTIONAL, pusch-ConstantValue ConstantValueTdd OPTIONAL, openLoopPowerControl-IPDL-TDD OpenLoopPowerControl-IPDL-TDD-r4 OPTIONAL, hs-SICH-PowerControl HS-SICH-Power-Control-Info-TDD768 OPTIONAL }, tdd128 SEQUENCE { ul-SynchronisationParameters UL-SynchronisationParameters-r4 OPTIONAL, desired-HS-SICH-PowerLevel INTEGER (-120..-58) OPTIONAL, tpc-Step-Size ENUMERATED { s1, s2, s3 , spare1 } OPTIONAL } } } -- *************************************************** -- -- URA UPDATE -- -- *************************************************** URAUpdate ::= SEQUENCE { -- User equipment IEs u-RNTI U-RNTI, ura-UpdateCause URA-UpdateCause, protocolErrorIndicator ProtocolErrorIndicatorWithMoreInfo, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions uraUpdate-r3-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } -- *************************************************** -- -- URA UPDATE CONFIRM -- -- *************************************************** URAUpdateConfirm ::= CHOICE { r3 SEQUENCE { uraUpdateConfirm-r3 URAUpdateConfirm-r3-IEs, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions uraUpdateConfirm-r3-add-ext BIT STRING OPTIONAL, v690NonCriticalExtensions SEQUENCE { uraUpdateConfirm-v690ext URAUpdateConfirm-v690ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL }, later-than-r3 SEQUENCE { rrc-TransactionIdentifier RRC-TransactionIdentifier, criticalExtensions CHOICE { r5 SEQUENCE { uraUpdateConfirm-r5 URAUpdateConfirm-r5-IEs, v690NonCriticalExtensions SEQUENCE { uraUpdateConfirm-v690ext URAUpdateConfirm-v690ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL }, criticalExtensions SEQUENCE {} } } } URAUpdateConfirm-r3-IEs ::= SEQUENCE { -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier, integrityProtectionModeInfo IntegrityProtectionModeInfo OPTIONAL, cipheringModeInfo CipheringModeInfo OPTIONAL, new-U-RNTI U-RNTI OPTIONAL, new-C-RNTI C-RNTI OPTIONAL, rrc-StateIndicator RRC-StateIndicator, utran-DRX-CycleLengthCoeff UTRAN-DRX-CycleLengthCoefficient OPTIONAL, -- CN information elements cn-InformationInfo CN-InformationInfo OPTIONAL, -- UTRAN mobility IEs ura-Identity URA-Identity OPTIONAL, -- Radio bearer IEs dl-CounterSynchronisationInfo DL-CounterSynchronisationInfo OPTIONAL } URAUpdateConfirm-r5-IEs ::= SEQUENCE { -- User equipment IEs integrityProtectionModeInfo IntegrityProtectionModeInfo OPTIONAL, cipheringModeInfo CipheringModeInfo OPTIONAL, new-U-RNTI U-RNTI OPTIONAL, new-C-RNTI C-RNTI OPTIONAL, rrc-StateIndicator RRC-StateIndicator, utran-DRX-CycleLengthCoeff UTRAN-DRX-CycleLengthCoefficient OPTIONAL, -- CN information elements cn-InformationInfo CN-InformationInfo OPTIONAL, -- UTRAN mobility IEs ura-Identity URA-Identity OPTIONAL, -- Radio bearer IEs dl-CounterSynchronisationInfo DL-CounterSynchronisationInfo-r5 OPTIONAL } URAUpdateConfirm-v690ext-IEs ::= SEQUENCE { -- Core network IEs primary-plmn-Identity PLMN-Identity OPTIONAL } -- *************************************************** -- -- URA UPDATE CONFIRM for CCCH -- -- *************************************************** URAUpdateConfirm-CCCH ::= CHOICE { r3 SEQUENCE { uraUpdateConfirm-CCCH-r3 URAUpdateConfirm-CCCH-r3-IEs, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions uraUpdateConfirm-CCCH-r3-add-ext BIT STRING OPTIONAL, v690NonCriticalExtensions SEQUENCE { uraUpdateConfirm-v690ext URAUpdateConfirm-v690ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL }, later-than-r3 SEQUENCE { u-RNTI U-RNTI, rrc-TransactionIdentifier RRC-TransactionIdentifier, criticalExtensions SEQUENCE {} } } URAUpdateConfirm-CCCH-r3-IEs ::= SEQUENCE { -- User equipment IEs u-RNTI U-RNTI, -- The rest of the message is identical to the one sent on DCCH. uraUpdateConfirm URAUpdateConfirm-r3-IEs } -- *************************************************** -- -- UTRAN MOBILITY INFORMATION -- -- *************************************************** UTRANMobilityInformation ::= CHOICE { r3 SEQUENCE { utranMobilityInformation-r3 UTRANMobilityInformation-r3-IEs, v3a0NonCriticalExtensions SEQUENCE { utranMobilityInformation-v3a0ext UTRANMobilityInformation-v3a0ext-IEs, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions utranMobilityInformation-r3-add-ext BIT STRING OPTIONAL, v690NonCriticalExtensions SEQUENCE { utranMobilityInformation-v690ext UtranMobilityInformation-v690ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL }, later-than-r3 SEQUENCE { rrc-TransactionIdentifier RRC-TransactionIdentifier, criticalExtensions CHOICE { r5 SEQUENCE { utranMobilityInformation-r5 UTRANMobilityInformation-r5-IEs, v690NonCriticalExtensions SEQUENCE { utranMobilityInformation-v690ext UtranMobilityInformation-v690ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL }, criticalExtensions SEQUENCE {} } } } UTRANMobilityInformation-r3-IEs ::= SEQUENCE { -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier, integrityProtectionModeInfo IntegrityProtectionModeInfo OPTIONAL, cipheringModeInfo CipheringModeInfo OPTIONAL, new-U-RNTI U-RNTI OPTIONAL, new-C-RNTI C-RNTI OPTIONAL, ue-ConnTimersAndConstants UE-ConnTimersAndConstants OPTIONAL, -- CN information elements cn-InformationInfo CN-InformationInfoFull OPTIONAL, -- UTRAN mobility IEs ura-Identity URA-Identity OPTIONAL, -- Radio bearer IEs dl-CounterSynchronisationInfo DL-CounterSynchronisationInfo OPTIONAL, -- Extension mechanism for non- release99 information nonCriticalExtensions SEQUENCE {} OPTIONAL } UTRANMobilityInformation-v3a0ext-IEs ::= SEQUENCE { ue-ConnTimersAndConstants-v3a0ext UE-ConnTimersAndConstants-v3a0ext } UTRANMobilityInformation-r5-IEs ::= SEQUENCE { -- User equipment IEs integrityProtectionModeInfo IntegrityProtectionModeInfo OPTIONAL, cipheringModeInfo CipheringModeInfo OPTIONAL, new-U-RNTI U-RNTI OPTIONAL, new-C-RNTI C-RNTI OPTIONAL, ue-ConnTimersAndConstants UE-ConnTimersAndConstants-r5 OPTIONAL, -- CN information elements cn-InformationInfo CN-InformationInfoFull OPTIONAL, -- UTRAN mobility IEs ura-Identity URA-Identity OPTIONAL, -- Radio bearer IEs dl-CounterSynchronisationInfo DL-CounterSynchronisationInfo-r5 OPTIONAL } UtranMobilityInformation-v690ext-IEs ::= SEQUENCE { -- Core network IEs primary-plmn-Identity PLMN-Identity OPTIONAL } -- *************************************************** -- -- UTRAN MOBILITY INFORMATION CONFIRM -- -- *************************************************** UTRANMobilityInformationConfirm ::= SEQUENCE { -- User equipment IEs rrc-TransactionIdentifier RRC-TransactionIdentifier, ul-IntegProtActivationInfo IntegrityProtActivationInfo OPTIONAL, -- Radio bearer IEs count-C-ActivationTime ActivationTime OPTIONAL, -- dummy is not used in this version of the specification and -- it should be ignored by the receiver. dummy RB-ActivationTimeInfoList OPTIONAL, ul-CounterSynchronisationInfo UL-CounterSynchronisationInfo OPTIONAL, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions utranMobilityInformationConfirm-r3-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } -- *************************************************** -- -- UTRAN MOBILITY INFORMATION FAILURE -- -- *************************************************** UTRANMobilityInformationFailure ::= SEQUENCE { -- UE information elements rrc-TransactionIdentifier RRC-TransactionIdentifier, failureCause FailureCauseWithProtErr, laterNonCriticalExtensions SEQUENCE { -- Container for additional R99 extensions utranMobilityInformationFailure-r3-add-ext BIT STRING OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } -- *************************************************** -- -- MBMS ACCESS INFORMATION -- -- *************************************************** MBMSAccessInformation ::= SEQUENCE { -- Access Information IEs mbms-ServiceAccessInfoList MBMS-ServiceAccessInfoList-r6, -- Non critical extensions nonCriticalExtensions SEQUENCE {} OPTIONAL } -- *************************************************** -- -- MBMS COMMON PTM RB INFORMATION -- -- *************************************************** MBMSCommonPTMRBInformation ::= SEQUENCE { -- Common PTM RB Information IEs mbms-CommonRBInformationList MBMS-CommonRBInformationList-r6, mbms-TranspChInfoForEachTrCh MBMS-TranspChInfoForEachTrCh-r6, mbms-TranspChInfoForEachCCTrCh MBMS-TranspChInfoForEachCCTrCh-r6 OPTIONAL, mbms-PhyChInformationList MBMS-PhyChInformationList-r6, -- Non critical extensions nonCriticalExtensions SEQUENCE {} OPTIONAL } -- *************************************************** -- -- MBMS CURRENT CELL PTM RB INFORMATION -- -- *************************************************** MBMSCurrentCellPTMRBInformation ::= SEQUENCE { -- Current Cell PTM RB Information IEs mbms-CurrentCell-SCCPCHList MBMS-CurrentCell-SCCPCHList-r6 OPTIONAL, mbms-SIBType5-SCCPCHList MBMS-SIBType5-SCCPCHList-r6 OPTIONAL, -- Non critical extensions nonCriticalExtensions SEQUENCE {} OPTIONAL } -- *************************************************** -- -- MBMS GENERAL INFORMATION -- -- *************************************************** MBMSGeneralInformation ::= SEQUENCE { -- MBMS General Information IEs mbms-PreferredFrequencyInfo MBMS-PreferredFrequencyList-r6 OPTIONAL, mbms-TimersAndCounters MBMS-TimersAndCounters-r6, michConfigurationInfo MBMS-MICHConfigurationInfo-r6, cellGroupIdentity MBMS-CellGroupIdentity-r6, mschDefaultConfigurationInfo MBMS-MSCH-ConfigurationInfo-r6 OPTIONAL, -- Non critical extensions v7xyNonCriticalExtensions SEQUENCE { mbmsGenerAlInformation-v7xyext MBMSGeneralInformation-v7xyext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } } MBMSGeneralInformation-v7xyext-IEs ::= SEQUENCE { mbmsMICHConfiguration-v7xyext MBMS-MICHConfigurationInfo-r7 OPTIONAL } -- *************************************************** -- -- MBMS MODIFICATION REQUEST -- -- *************************************************** MBMSModificationRequest ::= SEQUENCE { -- MBMS Modification Request IEs mbms-PreferredFreqRequest MBMS-ServiceIdentity-r6 OPTIONAL, rb-InformationReleaseList RB-InformationReleaseList OPTIONAL, -- Non critical extensions nonCriticalExtensions SEQUENCE {} OPTIONAL } -- *************************************************** -- -- MBMS MODIFIED SERVICES INFORMATION -- -- *************************************************** MBMSModifiedServicesInformation ::= SEQUENCE { -- MBMS Modified Services Information IEs modifedServiceList MBMS-ModifedServiceList-r6 OPTIONAL, mbms-ReacquireMCCH ENUMERATED { true } OPTIONAL, mbms-DynamicPersistenceLevel DynamicPersistenceLevel OPTIONAL, endOfModifiedMCCHInformation INTEGER (1..16) OPTIONAL, mbmsNumberOfNeighbourCells MBMS-NumberOfNeighbourCells-r6, mbms-AllUnmodifiedPTMServices ENUMERATED { true } OPTIONAL, mbms-PTMActivationTime MBMS-PTMActivationTime-r6 OPTIONAL, -- Non critical extensions nonCriticalExtensions SEQUENCE {} OPTIONAL } -- *************************************************** -- -- MBMS NEIGHBOURING CELL PTM RB INFORMATION -- -- *************************************************** MBMSNeighbouringCellPTMRBInformation ::= SEQUENCE { -- MBMS Neighbouring Cell PTM RB Information IEs neighbouringCellIdentity IntraFreqCellID, neighbouringCellSCCPCHList MBMS-NeighbouringCellSCCPCHList-r6, -- Non critical extensions nonCriticalExtensions SEQUENCE {} OPTIONAL } -- *************************************************** -- -- MBMS SCHEDULING INFORMATION -- -- *************************************************** MBMSSchedulingInformation ::= SEQUENCE { -- MBMS Scheduling Information IEs serviceSchedulingInfoList MBMS-ServiceSchedulingInfoList-r6, -- Non critical extensions nonCriticalExtensions SEQUENCE {} OPTIONAL } -- *************************************************** -- -- MBMS UNMODIFIED SERVICES INFORMATION -- -- *************************************************** MBMSUnmodifiedServicesInformation ::= SEQUENCE { -- MBMS Unmodified Services Information IEs unmodifiedServiceList MBMS-UnmodifiedServiceList-r6 OPTIONAL, -- Non critical extensions nonCriticalExtensions SEQUENCE {} OPTIONAL } END InformationElements DEFINITIONS AUTOMATIC TAGS ::= -- *************************************************** -- -- CORE NETWORK INFORMATION ELEMENTS (10.3.1) -- -- *************************************************** BEGIN IMPORTS hiPDSCHidentities, hiPUSCHidentities, hiRM, maxAC, maxAdditionalMeas, maxASC, maxASCmap, maxASCpersist, maxCCTrCH, maxCellMeas, maxCellMeas-1, maxCNdomains, maxCPCHsets, maxDPCH-DLchan, maxDPDCH-UL, maxDRACclasses, maxE-DCHMACdFlow, maxE-DCHMACdFlow-1, maxFACHPCH, maxFreq, maxFreqBandsFDD, maxFreqBandsFDD-ext, maxFreqBandsTDD, maxFreqBandsGSM, maxGERAN-SI, maxHProcesses, maxHSDSCHTBIndex, maxHSDSCHTBIndex-tdd384, maxHSSCCHs, maxInterSysMessages, maxLoCHperRLC, maxMAC-d-PDUsizes, maxMBMS-CommonCCTrCh, maxMBMS-CommonPhyCh, maxMBMS-CommonRB, maxMBMS-CommonTrCh, maxMBMS-Freq, maxMBMS-L1CP, maxMBMSservCount, maxMBMSservModif, maxMBMSservSched, maxMBMSservUnmodif, maxMBMSTransmis, maxMeasEvent, maxMeasIntervals, maxMeasParEvent, maxNumCDMA2000Freqs, maxNumFDDFreqs, maxNumGSMFreqRanges, maxGSMTargetCells, maxNumTDDFreqs, maxOtherRAT, maxOtherRAT-16, maxPage1, maxPCPCH-APsig, maxPCPCH-APsubCh, maxPCPCH-CDsig, maxPCPCH-CDsubCh, maxPCPCH-SF, maxPCPCHs, maxPDCPAlgoType, maxPDSCH, maxPDSCH-TFCIgroups, maxPRACH, maxPRACH-FPACH, maxPredefConfig, maxPUSCH, maxQueueIDs, maxRABsetup, maxRAT, maxRB, maxRBallRABs, maxRBperTrCh, maxRBMuxOptions, maxRBperRAB, maxReportedGSMCells, maxRLCPDUsizePerLogChan, maxSRBsetup, maxRL, maxRL-1, maxEDCHRL, maxROHC-PacketSizes-r4, maxROHC-Profile-r4, maxSCCPCH, maxSat, maxSIB, maxSIB-FACH, maxSystemCapability, maxTF, maxTF-CPCH, maxTFC, maxTFCsub, maxTFCI-2-Combs, maxTGPS, maxTrCH, maxTrCHpreconf, maxTS, maxTS-1, maxTS-2, maxTS-LCR, maxTS-LCR-1, maxURA, maxURNTI-Group FROM Constant-definitions; Ansi-41-IDNNS ::= BIT STRING (SIZE (14)) CN-DomainIdentity ::= ENUMERATED { cs-domain, ps-domain } CN-DomainInformation ::= SEQUENCE { cn-DomainIdentity CN-DomainIdentity, cn-DomainSpecificNAS-Info NAS-SystemInformationGSM-MAP } CN-DomainInformationFull ::= SEQUENCE { cn-DomainIdentity CN-DomainIdentity, cn-DomainSpecificNAS-Info NAS-SystemInformationGSM-MAP, cn-DRX-CycleLengthCoeff CN-DRX-CycleLengthCoefficient } CN-DomainInformationList ::= SEQUENCE (SIZE (1..maxCNdomains)) OF CN-DomainInformation CN-DomainInformationListFull ::= SEQUENCE (SIZE (1..maxCNdomains)) OF CN-DomainInformationFull CN-DomainSysInfo ::= SEQUENCE { cn-DomainIdentity CN-DomainIdentity, cn-Type CHOICE { gsm-MAP NAS-SystemInformationGSM-MAP, ansi-41 NAS-SystemInformationANSI-41 }, cn-DRX-CycleLengthCoeff CN-DRX-CycleLengthCoefficient } CN-DomainSysInfoList ::= SEQUENCE (SIZE (1..maxCNdomains)) OF CN-DomainSysInfo CN-InformationInfo ::= SEQUENCE { plmn-Identity PLMN-Identity OPTIONAL, cn-CommonGSM-MAP-NAS-SysInfo NAS-SystemInformationGSM-MAP OPTIONAL, cn-DomainInformationList CN-DomainInformationList OPTIONAL } CN-InformationInfo-r6 ::= SEQUENCE { plmn-Identity PLMN-Identity OPTIONAL, cn-CommonGSM-MAP-NAS-SysInfo NAS-SystemInformationGSM-MAP OPTIONAL, cn-DomainInformationList CN-DomainInformationList OPTIONAL, primary-plmn-Identity PLMN-Identity OPTIONAL } CN-InformationInfoFull ::= SEQUENCE { plmn-Identity PLMN-Identity OPTIONAL, cn-CommonGSM-MAP-NAS-SysInfo NAS-SystemInformationGSM-MAP OPTIONAL, cn-DomainInformationListFull CN-DomainInformationListFull OPTIONAL } Digit ::= INTEGER (0..9) Gsm-map-IDNNS ::= SEQUENCE { routingbasis CHOICE { localPTMSI SEQUENCE { routingparameter RoutingParameter }, tMSIofsamePLMN SEQUENCE { routingparameter RoutingParameter }, tMSIofdifferentPLMN SEQUENCE { routingparameter RoutingParameter }, iMSIresponsetopaging SEQUENCE { routingparameter RoutingParameter }, iMSIcauseUEinitiatedEvent SEQUENCE { routingparameter RoutingParameter }, iMEI SEQUENCE { routingparameter RoutingParameter }, spare2 SEQUENCE { routingparameter RoutingParameter }, spare1 SEQUENCE { routingparameter RoutingParameter } }, -- dummy is not used in this version of the specification and -- it should be ignored by the receiver. dummy BOOLEAN } IMEI ::= SEQUENCE (SIZE (15)) OF IMEI-Digit IMEI-Digit ::= INTEGER (0..15) IMSI-GSM-MAP ::= SEQUENCE (SIZE (6..21)) OF Digit IntraDomainNasNodeSelector ::= SEQUENCE { version CHOICE { release99 SEQUENCE { cn-Type CHOICE { gsm-Map-IDNNS Gsm-map-IDNNS, ansi-41-IDNNS Ansi-41-IDNNS } }, later SEQUENCE { futurecoding BIT STRING (SIZE (15)) } } } LAI ::= SEQUENCE { plmn-Identity PLMN-Identity, lac BIT STRING (SIZE (16)) } MCC ::= SEQUENCE (SIZE (3)) OF Digit MNC ::= SEQUENCE (SIZE (2..3)) OF Digit MultiplePLMN-List-r6 ::= SEQUENCE { mibPLMN-Identity BOOLEAN, multiplePLMNs SEQUENCE (SIZE (1..5)) OF PLMN-IdentityWithOptionalMCC-r6 } NAS-Message ::= OCTET STRING (SIZE (1..4095)) NAS-Synchronisation-Indicator ::= BIT STRING(SIZE(4)) NAS-SystemInformationGSM-MAP ::= OCTET STRING (SIZE (1..8)) P-TMSI-GSM-MAP ::= BIT STRING (SIZE (32)) PagingRecordTypeID ::= ENUMERATED { imsi-GSM-MAP, tmsi-GSM-MAP-P-TMSI, imsi-DS-41, tmsi-DS-41 } PLMN-Identity ::= SEQUENCE { mcc MCC, mnc MNC } PLMN-IdentityWithOptionalMCC-r6 ::= SEQUENCE { mcc MCC OPTIONAL, mnc MNC } PLMN-Type ::= CHOICE { gsm-MAP SEQUENCE { plmn-Identity PLMN-Identity }, ansi-41 SEQUENCE { p-REV P-REV, min-P-REV Min-P-REV, sid SID, nid NID }, gsm-MAP-and-ANSI-41 SEQUENCE { plmn-Identity PLMN-Identity, p-REV P-REV, min-P-REV Min-P-REV, sid SID, nid NID }, spare NULL } RAB-Identity ::= CHOICE { gsm-MAP-RAB-Identity BIT STRING (SIZE (8)), ansi-41-RAB-Identity BIT STRING (SIZE (8)) } RAI ::= SEQUENCE { lai LAI, rac RoutingAreaCode } RoutingAreaCode ::= BIT STRING (SIZE (8)) RoutingParameter ::= BIT STRING (SIZE (10)) TMSI-GSM-MAP ::= BIT STRING (SIZE (32)) -- *************************************************** -- -- UTRAN MOBILITY INFORMATION ELEMENTS (10.3.2) -- -- *************************************************** AccessClassBarred ::= ENUMERATED { barred, notBarred } AccessClassBarredList ::= SEQUENCE (SIZE (maxAC)) OF AccessClassBarred AllowedIndicator ::= ENUMERATED { allowed, notAllowed } CellAccessRestriction ::= SEQUENCE { cellBarred CellBarred, cellReservedForOperatorUse ReservedIndicator, cellReservationExtension ReservedIndicator, -- NOTE: IE accessClassBarredList should not be included if the IE CellAccessRestriction -- is included in the IE SysInfoType4 accessClassBarredList AccessClassBarredList OPTIONAL } CellBarred ::= CHOICE { barred SEQUENCE { intraFreqCellReselectionInd AllowedIndicator, t-Barred T-Barred }, notBarred NULL } CellIdentity ::= BIT STRING (SIZE (28)) CellIdentity-PerRL-List ::= SEQUENCE (SIZE (1..maxRL)) OF CellIdentity CellSelectReselectInfoSIB-3-4 ::= SEQUENCE { mappingInfo MappingInfo OPTIONAL, cellSelectQualityMeasure CHOICE { cpich-Ec-N0 SEQUENCE { -- Default value for q-HYST-2-S is q-HYST-1-S q-HYST-2-S Q-Hyst-S OPTIONAL -- Default value for q-HYST-2-S is q-HYST-1-S }, cpich-RSCP NULL }, modeSpecificInfo CHOICE { fdd SEQUENCE { s-Intrasearch S-SearchQual OPTIONAL, s-Intersearch S-SearchQual OPTIONAL, s-SearchHCS S-SearchRXLEV OPTIONAL, rat-List RAT-FDD-InfoList OPTIONAL, q-QualMin Q-QualMin, q-RxlevMin Q-RxlevMin }, tdd SEQUENCE { s-Intrasearch S-SearchRXLEV OPTIONAL, s-Intersearch S-SearchRXLEV OPTIONAL, s-SearchHCS S-SearchRXLEV OPTIONAL, rat-List RAT-TDD-InfoList OPTIONAL, q-RxlevMin Q-RxlevMin } }, q-Hyst-l-S Q-Hyst-S, t-Reselection-S T-Reselection-S, hcs-ServingCellInformation HCS-ServingCellInformation OPTIONAL, maxAllowedUL-TX-Power MaxAllowedUL-TX-Power } DomainSpecificAccessRestrictionForSharedNetwork-v670ext ::= CHOICE { domainSpecificAccessRestictionList DomainSpecificAccessRestrictionList-v670ext, domainSpecificAccessRestictionParametersForAll DomainSpecificAccessRestrictionParam-v670ext } DomainSpecificAccessRestrictionList-v670ext ::= SEQUENCE { domainSpecificAccessRestrictionParametersForOperator1 DomainSpecificAccessRestrictionParam-v670ext OPTIONAL, domainSpecificAccessRestrictionParametersForOperator2 DomainSpecificAccessRestrictionParam-v670ext OPTIONAL, domainSpecificAccessRestrictionParametersForOperator3 DomainSpecificAccessRestrictionParam-v670ext OPTIONAL, domainSpecificAccessRestrictionParametersForOperator4 DomainSpecificAccessRestrictionParam-v670ext OPTIONAL, domainSpecificAccessRestrictionParametersForOperator5 DomainSpecificAccessRestrictionParam-v670ext OPTIONAL } DomainSpecificAccessRestrictionParam-v670ext ::= SEQUENCE { cSDomainSpecificAccessRestriction DomainSpecificAccessRestriction-v670ext, pSDomainSpecificAccessRestriction DomainSpecificAccessRestriction-v670ext } DomainSpecificAccessRestriction-v670ext ::= CHOICE { noRestriction NULL, restriction SEQUENCE { domainSpecficAccessClassBarredList AccessClassBarredList OPTIONAL } } MapParameter ::= INTEGER (0..99) Mapping ::= SEQUENCE { rat RAT, mappingFunctionParameterList MappingFunctionParameterList } Mapping-LCR-r4 ::= SEQUENCE { mappingFunctionParameterList MappingFunctionParameterList } MappingFunctionParameter ::= SEQUENCE { functionType MappingFunctionType, mapParameter1 MapParameter OPTIONAL, mapParameter2 MapParameter, -- The presence of upperLimit is conditional on the number of repetition upperLimit UpperLimit OPTIONAL } MappingFunctionParameterList ::= SEQUENCE (SIZE (1..maxMeasIntervals)) OF MappingFunctionParameter MappingFunctionType ::= ENUMERATED { linear, functionType2, functionType3, functionType4 } -- In MappingInfo list, mapping for FDD and 3.84Mcps TDD is defined. -- For 1.28Mcps TDD, Mapping-LCR-r4 is used instead. MappingInfo ::= SEQUENCE (SIZE (1..maxRAT)) OF Mapping -- Actual value Q-Hyst-S = IE value * 2 Q-Hyst-S ::= INTEGER (0..20) Q-Hyst-S-Fine ::= INTEGER (0..40) RAT ::= ENUMERATED { utra-FDD, utra-TDD, gsm, cdma2000 } RAT-FDD-Info ::= SEQUENCE { rat-Identifier RAT-Identifier, s-SearchRAT S-SearchQual, s-HCS-RAT S-SearchRXLEV OPTIONAL, s-Limit-SearchRAT S-SearchQual } RAT-FDD-InfoList ::= SEQUENCE (SIZE (1..maxOtherRAT)) OF RAT-FDD-Info RAT-Identifier ::= ENUMERATED { gsm, cdma2000 } RAT-TDD-Info ::= SEQUENCE { rat-Identifier RAT-Identifier, s-SearchRAT S-SearchRXLEV, s-HCS-RAT S-SearchRXLEV OPTIONAL, s-Limit-SearchRAT S-SearchRXLEV } RAT-TDD-InfoList ::= SEQUENCE (SIZE (1..maxOtherRAT)) OF RAT-TDD-Info ReservedIndicator ::= ENUMERATED { reserved, notReserved } -- Actual value S-SearchQual = IE value * 2 S-SearchQual ::= INTEGER (-16..10) -- Actual value S-SearchRXLEV = (IE value * 2) + 1 S-SearchRXLEV ::= INTEGER (-53..45) -- Actual value ScalingFactor = IE value * 0.1 SpeedDependentScalingFactor ::= INTEGER (0..10) T-Barred ::= ENUMERATED { s10, s20, s40, s80, s160, s320, s640, s1280 } T-Reselection-S ::= INTEGER (0..31) -- Actual value T-Reselection-S-Fine = IE value * 0.2 T-Reselection-S-Fine ::= INTEGER (0..31) -- Actual value ScalingFactor = IE value * 0.25 TreselectionScalingFactor ::= INTEGER (4..19) -- For UpperLimit, the used range depends on the RAT used. UpperLimit ::= INTEGER (1..91) URA-Identity ::= BIT STRING (SIZE (16)) URA-IdentityList ::= SEQUENCE (SIZE (1..maxURA)) OF URA-Identity -- *************************************************** -- -- USER EQUIPMENT INFORMATION ELEMENTS (10.3.3) -- -- *************************************************** AccessStratumReleaseIndicator ::= ENUMERATED { rel-4, rel-5, rel-6, rel-7, spare12, spare11, spare10, spare9, spare8, spare7, spare6, spare5, spare4, spare3, spare2, spare1 } -- TABULAR : for ActivationTime, value 'now' always appear as default, and is encoded -- by absence of the field ActivationTime ::= INTEGER (0..255) BackoffControlParams ::= SEQUENCE { n-AP-RetransMax N-AP-RetransMax, n-AccessFails N-AccessFails, nf-BO-NoAICH NF-BO-NoAICH, ns-BO-Busy NS-BO-Busy, nf-BO-AllBusy NF-BO-AllBusy, nf-BO-Mismatch NF-BO-Mismatch, t-CPCH T-CPCH } C-RNTI ::= BIT STRING (SIZE (16)) CapabilityUpdateRequirement ::= SEQUENCE { ue-RadioCapabilityFDDUpdateRequirement BOOLEAN, -- ue-RadioCapabilityTDDUpdateRequirement is for 3.84Mcps TDD update requirement ue-RadioCapabilityTDDUpdateRequirement BOOLEAN, systemSpecificCapUpdateReqList SystemSpecificCapUpdateReqList OPTIONAL } CapabilityUpdateRequirement-r4-ext ::= SEQUENCE { ue-RadioCapabilityUpdateRequirement-TDD128 BOOLEAN } CapabilityUpdateRequirement-r4 ::= SEQUENCE { ue-RadioCapabilityFDDUpdateRequirement-FDD BOOLEAN, ue-RadioCapabilityTDDUpdateRequirement-TDD384 BOOLEAN, ue-RadioCapabilityTDDUpdateRequirement-TDD128 BOOLEAN, systemSpecificCapUpdateReqList SystemSpecificCapUpdateReqList OPTIONAL } CapabilityUpdateRequirement-r7-ext ::= SEQUENCE { ue-RadioCapabilityUpdateRequirement-TDD768 BOOLEAN } -- If the IE CellUpdateCause has the value 'cellUpdateCause-ext', the actual value is -- defined in the IE CellUpdateCause-ext. CellUpdateCause ::= ENUMERATED { cellReselection, periodicalCellUpdate, uplinkDataTransmission, utran-pagingResponse, re-enteredServiceArea, radiolinkFailure, rlc-unrecoverableError, cellUpdateCause-ext } -- The IE CellUpdateCause-ext shall be present, if the IE CellUpdateCause has the -- value 'cellUpdateCause-ext'. CellUpdateCause-ext ::= ENUMERATED { mbms-Reception, mbms-PTP-RB-Request, spare2, spare1 } ChipRateCapability ::= ENUMERATED { mcps3-84, mcps1-28 } ChipRateCapability-r7 ::= ENUMERATED { mcps3-84, mcps7-68, mcps1-28 } CipheringAlgorithm ::= ENUMERATED { uea0, uea1 } CipheringModeCommand ::= CHOICE { startRestart CipheringAlgorithm, dummy NULL } CipheringModeInfo ::= SEQUENCE { -- TABULAR: The ciphering algorithm is included in the CipheringModeCommand. cipheringModeCommand CipheringModeCommand, activationTimeForDPCH ActivationTime OPTIONAL, rb-DL-CiphActivationTimeInfo RB-ActivationTimeInfoList OPTIONAL } CN-DRX-CycleLengthCoefficient ::= INTEGER (6..9) CN-PagedUE-Identity ::= CHOICE { imsi-GSM-MAP IMSI-GSM-MAP, tmsi-GSM-MAP TMSI-GSM-MAP, p-TMSI-GSM-MAP P-TMSI-GSM-MAP, imsi-DS-41 IMSI-DS-41, tmsi-DS-41 TMSI-DS-41, spare3 NULL, spare2 NULL, spare1 NULL } CompressedModeMeasCapability ::= SEQUENCE { fdd-Measurements BOOLEAN, -- TABULAR: The IEs tdd-Measurements, gsm-Measurements and multiCarrierMeasurements -- are made optional since they are conditional based on another information element. -- Their absence corresponds to the case where the condition is not true. tdd-Measurements BOOLEAN OPTIONAL, gsm-Measurements GSM-Measurements OPTIONAL, multiCarrierMeasurements BOOLEAN OPTIONAL } CompressedModeMeasCapability-LCR-r4 ::= SEQUENCE { tdd128-Measurements BOOLEAN OPTIONAL } CompressedModeMeasCapabFDDList ::= SEQUENCE (SIZE (1..maxFreqBandsFDD)) OF CompressedModeMeasCapabFDD CompressedModeMeasCapabFDDList2 ::= SEQUENCE (SIZE (1..maxFreqBandsFDD)) OF CompressedModeMeasCapabFDD2 CompressedModeMeasCapabFDDList-ext ::= SEQUENCE (SIZE (1..maxFreqBandsFDD)) OF CompressedModeMeasCapabFDD-ext CompressedModeMeasCapabFDD ::= SEQUENCE { radioFrequencyBandFDD RadioFrequencyBandFDD OPTIONAL, dl-MeasurementsFDD BOOLEAN, ul-MeasurementsFDD BOOLEAN } CompressedModeMeasCapabFDD2 ::= SEQUENCE { -- UE may omit both IEs if this IE indicates the compressed mode capability within the same -- frequency band. Otherwise, the UE shall include either one of the following OPTIONAL IEs. radioFrequencyBandFDD RadioFrequencyBandFDD OPTIONAL, radioFrequencyBandFDD2 RadioFrequencyBandFDD2 OPTIONAL, dl-MeasurementsFDD BOOLEAN, ul-MeasurementsFDD BOOLEAN } CompressedModeMeasCapabFDD-ext ::= SEQUENCE { radioFrequencyBandFDD2 RadioFrequencyBandFDD2, dl-MeasurementsFDD BOOLEAN, ul-MeasurementsFDD BOOLEAN } CompressedModeMeasCapabTDDList ::= SEQUENCE (SIZE (1..maxFreqBandsTDD)) OF CompressedModeMeasCapabTDD CompressedModeMeasCapabTDD ::= SEQUENCE { radioFrequencyBandTDD RadioFrequencyBandTDD, dl-MeasurementsTDD BOOLEAN, ul-MeasurementsTDD BOOLEAN } CompressedModeMeasCapabGSMList ::= SEQUENCE (SIZE (1..maxFreqBandsGSM)) OF CompressedModeMeasCapabGSM CompressedModeMeasCapabGSM ::= SEQUENCE { radioFrequencyBandGSM RadioFrequencyBandGSM, dl-MeasurementsGSM BOOLEAN, ul-MeasurementsGSM BOOLEAN } CompressedModeMeasCapabMC ::= SEQUENCE { dl-MeasurementsMC BOOLEAN, ul-MeasurementsMC BOOLEAN } CPCH-Parameters ::= SEQUENCE { initialPriorityDelayList InitialPriorityDelayList OPTIONAL, backoffControlParams BackoffControlParams, -- TABULAR: TPC step size nested inside PowerControlAlgorithm powerControlAlgorithm PowerControlAlgorithm, dl-DPCCH-BER DL-DPCCH-BER } DL-CapabilityWithSimultaneousHS-DSCHConfig ::= ENUMERATED{kbps32, kbps64, kbps128, kbps384} DL-DPCCH-BER ::= INTEGER (0..63) DL-PhysChCapabilityFDD ::= SEQUENCE { -- The IE 窶徇axNoDPCH-PDSCH-Codes窶 only gives information on the maximum number of DPCH Codes. maxNoDPCH-PDSCH-Codes INTEGER (1..8), maxNoPhysChBitsReceived MaxNoPhysChBitsReceived, supportForSF-512 BOOLEAN, -- dummy and dummy2 are not used in this version of the specification -- and if received they should be ignored. dummy BOOLEAN, dummy2 SimultaneousSCCPCH-DPCH-Reception } DL-PhysChCapabilityFDD-v380ext ::= SEQUENCE { -- dummy is not used in this version of the specification, it should -- not be sent and if received it should be ignored. dummy SupportOfDedicatedPilotsForChEstimation OPTIONAL } SupportOfDedicatedPilotsForChEstimation ::= ENUMERATED { true } DL-PhysChCapabilityTDD ::= SEQUENCE { maxTS-PerFrame MaxTS-PerFrame, maxPhysChPerFrame MaxPhysChPerFrame, minimumSF MinimumSF-DL, supportOfPDSCH BOOLEAN, maxPhysChPerTS MaxPhysChPerTS } DL-PhysChCapabilityTDD-LCR-r4 ::= SEQUENCE { maxTS-PerSubFrame MaxTS-PerSubFrame-r4, maxPhysChPerFrame MaxPhysChPerSubFrame-r4, minimumSF MinimumSF-DL, supportOfPDSCH BOOLEAN, maxPhysChPerTS MaxPhysChPerTS, supportOf8PSK BOOLEAN } DL-PhysChCapabilityTDD-768 ::= SEQUENCE { maxTS-PerFrame MaxTS-PerFrame, maxPhysChPerFrame MaxPhysChPerFrame-768, minimumSF MinimumSF-DL-768, supportOfPDSCH BOOLEAN, maxPhysChPerTS MaxPhysChPerTS-768 } DL-TransChCapability ::= SEQUENCE { maxNoBitsReceived MaxNoBits, maxConvCodeBitsReceived MaxNoBits, turboDecodingSupport TurboSupport, maxSimultaneousTransChs MaxSimultaneousTransChsDL, maxSimultaneousCCTrCH-Count MaxSimultaneousCCTrCH-Count, maxReceivedTransportBlocks MaxTransportBlocksDL, maxNumberOfTFC MaxNumberOfTFC-DL, maxNumberOfTF MaxNumberOfTF } DRAC-SysInfo ::= SEQUENCE { transmissionProbability TransmissionProbability, maximumBitRate MaximumBitRate } DRAC-SysInfoList ::= SEQUENCE (SIZE (1..maxDRACclasses)) OF DRAC-SysInfo DSCH-RNTI ::= BIT STRING (SIZE (16)) DelayRestrictionFlag ::= ENUMERATED { true } E-RNTI ::= BIT STRING (SIZE (16)) ESN-DS-41 ::= BIT STRING (SIZE (32)) EstablishmentCause ::= ENUMERATED { originatingConversationalCall, originatingStreamingCall, originatingInteractiveCall, originatingBackgroundCall, originatingSubscribedTrafficCall, terminatingConversationalCall, terminatingStreamingCall, terminatingInteractiveCall, terminatingBackgroundCall, emergencyCall, interRAT-CellReselection, interRAT-CellChangeOrder, registration, detach, originatingHighPrioritySignalling, originatingLowPrioritySignalling, callRe-establishment, terminatingHighPrioritySignalling, terminatingLowPrioritySignalling, terminatingCauseUnknown, mbms-Reception, mbms-PTP-RB-Request, spare10, spare9, spare8, spare7, spare6, spare5, spare4, spare3, spare2, spare1 } FailureCauseWithProtErr ::= CHOICE { configurationUnsupported NULL, physicalChannelFailure NULL, incompatibleSimultaneousReconfiguration NULL, compressedModeRuntimeError TGPSI, protocolError ProtocolErrorInformation, cellUpdateOccurred NULL, invalidConfiguration NULL, configurationIncomplete NULL, unsupportedMeasurement NULL, mbmsSessionAlreadyReceivedCorrectly NULL, lowerPriorityMBMSService NULL, spare5 NULL, spare4 NULL, spare3 NULL, spare2 NULL, spare1 NULL } FailureCauseWithProtErrTrId ::= SEQUENCE { rrc-TransactionIdentifier RRC-TransactionIdentifier, failureCause FailureCauseWithProtErr } GroupIdentityWithReleaseInformation ::= SEQUENCE { rrc-ConnectionReleaseInformation RRC-ConnectionReleaseInformation, groupReleaseInformation GroupReleaseInformation } GroupReleaseInformation ::= SEQUENCE { uRNTI-Group U-RNTI-Group } GSM-Measurements ::= SEQUENCE { gsm900 BOOLEAN, dcs1800 BOOLEAN, gsm1900 BOOLEAN } H-RNTI ::= BIT STRING (SIZE (16)) HSDSCH-physical-layer-category ::= INTEGER (1..64) UESpecificBehaviourInformation1idle ::= BIT STRING (SIZE (4)) UESpecificBehaviourInformation1interRAT ::= BIT STRING (SIZE (8)) IMSI-and-ESN-DS-41 ::= SEQUENCE { imsi-DS-41 IMSI-DS-41, esn-DS-41 ESN-DS-41 } IMSI-DS-41 ::= OCTET STRING (SIZE (5..7)) InitialPriorityDelayList ::= SEQUENCE (SIZE (1..maxASC)) OF NS-IP InitialUE-Identity ::= CHOICE { imsi IMSI-GSM-MAP, tmsi-and-LAI TMSI-and-LAI-GSM-MAP, p-TMSI-and-RAI P-TMSI-and-RAI-GSM-MAP, imei IMEI, esn-DS-41 ESN-DS-41, imsi-DS-41 IMSI-DS-41, imsi-and-ESN-DS-41 IMSI-and-ESN-DS-41, tmsi-DS-41 TMSI-DS-41 } IntegrityCheckInfo ::= SEQUENCE { messageAuthenticationCode MessageAuthenticationCode, rrc-MessageSequenceNumber RRC-MessageSequenceNumber } IntegrityProtActivationInfo ::= SEQUENCE { rrc-MessageSequenceNumberList RRC-MessageSequenceNumberList } IntegrityProtectionAlgorithm ::= ENUMERATED { uia1 } IntegrityProtectionModeCommand ::= CHOICE { startIntegrityProtection SEQUENCE { integrityProtInitNumber IntegrityProtInitNumber }, modify SEQUENCE { dl-IntegrityProtActivationInfo IntegrityProtActivationInfo } } IntegrityProtectionModeInfo ::= SEQUENCE { -- TABULAR: DL integrity protection activation info and Integrity -- protection intialisation number have been nested inside -- IntegrityProtectionModeCommand. integrityProtectionModeCommand IntegrityProtectionModeCommand, integrityProtectionAlgorithm IntegrityProtectionAlgorithm OPTIONAL } IntegrityProtInitNumber ::= BIT STRING (SIZE (32)) -- dummy is not used in this version of the specification, it should -- not be sent and if received it should be ignored. MaxHcContextSpace ::= ENUMERATED { dummy, by1024, by2048, by4096, by8192 } MaxHcContextSpace-r5-ext ::= ENUMERATED { by16384, by32768, by65536, by131072 } MaxROHC-ContextSessions-r4 ::= ENUMERATED { s2, s4, s8, s12, s16, s24, s32, s48, s64, s128, s256, s512, s1024, s16384 } MaximumAM-EntityNumberRLC-Cap ::= ENUMERATED { dummy, am4, am5, am6, am8, am16, am30 } -- Actual value MaximumBitRate = IE value * 16 MaximumBitRate ::= INTEGER (0..32) MaximumRLC-WindowSize ::= ENUMERATED { mws2047, mws4095 } MaxNoDPDCH-BitsTransmitted ::= ENUMERATED { b600, b1200, b2400, b4800, b9600, b19200, b28800, b38400, b48000, b57600 } MaxNoBits ::= ENUMERATED { b640, b1280, b2560, b3840, b5120, b6400, b7680, b8960, b10240, b20480, b40960, b81920, b163840 } MaxNoPhysChBitsReceived ::= ENUMERATED { dummy, b1200, b2400, b3600, b4800, b7200, b9600, b14400, b19200, b28800, b38400, b48000, b57600, b67200, b76800 } MaxNoSCCPCH-RL ::= ENUMERATED { rl1 } MaxNumberOfTF ::= ENUMERATED { tf32, tf64, tf128, tf256, tf512, tf1024 } MaxNumberOfTFC-DL ::= ENUMERATED { tfc16, tfc32, tfc48, tfc64, tfc96, tfc128, tfc256, tfc512, tfc1024 } MaxNumberOfTFC-UL ::= ENUMERATED { dummy1, dummy2, tfc16, tfc32, tfc48, tfc64, tfc96, tfc128, tfc256, tfc512, tfc1024 } -- the values 1 窶ヲ4 for MaxPhysChPerFrame are not used in this version of the protocol MaxPhysChPerFrame ::= INTEGER (1..224) MaxPhysChPerFrame-768 ::= INTEGER (1..448) MaxPhysChPerSubFrame-r4 ::= INTEGER (1..96) MaxPhysChPerTimeslot ::= ENUMERATED { ts1, ts2 } -- the values 1 窶ヲ4 for MaxPhysChPerTS are not used in this version of the protocol MaxPhysChPerTS ::= INTEGER (1..16) MaxPhysChPerTS-768 ::= INTEGER (1..32) MaxSimultaneousCCTrCH-Count ::= INTEGER (1..8) MaxSimultaneousTransChsDL ::= ENUMERATED { e4, e8, e16, e32 } MaxSimultaneousTransChsUL ::= ENUMERATED { dummy, e4, e8, e16, e32 } MaxTransportBlocksDL ::= ENUMERATED { tb4, tb8, tb16, tb32, tb48, tb64, tb96, tb128, tb256, tb512 } MaxTransportBlocksUL ::= ENUMERATED { dummy, tb4, tb8, tb16, tb32, tb48, tb64, tb96, tb128, tb256, tb512 } MaxTS-PerFrame ::= INTEGER (1..14) MaxTS-PerSubFrame-r4 ::= INTEGER (1..6) -- TABULAR: MeasurementCapability contains dependencies to UE-MultiModeRAT-Capability, -- the conditional fields have been left mandatory for now. MeasurementCapability ::= SEQUENCE { downlinkCompressedMode CompressedModeMeasCapability, uplinkCompressedMode CompressedModeMeasCapability } MeasurementCapabilityExt ::= SEQUENCE{ compressedModeMeasCapabFDDList CompressedModeMeasCapabFDDList, compressedModeMeasCapabTDDList CompressedModeMeasCapabTDDList OPTIONAL, compressedModeMeasCapabGSMList CompressedModeMeasCapabGSMList OPTIONAL, compressedModeMeasCapabMC CompressedModeMeasCapabMC OPTIONAL } MeasurementCapabilityExt2 ::= SEQUENCE{ compressedModeMeasCapabFDDList CompressedModeMeasCapabFDDList2, compressedModeMeasCapabTDDList CompressedModeMeasCapabTDDList OPTIONAL, compressedModeMeasCapabGSMList CompressedModeMeasCapabGSMList OPTIONAL, compressedModeMeasCapabMC CompressedModeMeasCapabMC OPTIONAL } MeasurementCapability-r4-ext ::= SEQUENCE { downlinkCompressedMode-LCR CompressedModeMeasCapability-LCR-r4, uplinkCompressedMode-LCR CompressedModeMeasCapability-LCR-r4 } MessageAuthenticationCode ::= BIT STRING (SIZE (32)) MinimumSF-DL ::= ENUMERATED { sf1, sf16 } MinimumSF-DL-768 ::= ENUMERATED { sf1, sf32 } MinimumSF-UL ::= ENUMERATED { sf1, sf2, sf4, sf8, dummy } MultiModeCapability ::= ENUMERATED { tdd, fdd, fdd-tdd } MultiRAT-Capability ::= SEQUENCE { supportOfGSM BOOLEAN, supportOfMulticarrier BOOLEAN } MultiModeRAT-Capability-v590ext ::= SEQUENCE { supportOfUTRAN-ToGERAN-NACC BOOLEAN } MultiModeRAT-Capability-v680ext ::= SEQUENCE { supportOfHandoverToGAN ENUMERATED { doesSupportHandoverToGAN } OPTIONAL } N-300 ::= INTEGER (0..7) N-301 ::= INTEGER (0..7) N-302 ::= INTEGER (0..7) N-304 ::= INTEGER (0..7) N-308 ::= INTEGER (1..8) N-310 ::= INTEGER (0..7) N-312 ::= ENUMERATED { s1, s50, s100, s200, s400, s600, s800, s1000 } N-312ext ::= ENUMERATED { s2, s4, s10, s20 } N-312-r5 ::= ENUMERATED { s1, s2, s4, s10, s20, s50, s100, s200, s400, s600, s800, s1000 } N-313 ::= ENUMERATED { s1, s2, s4, s10, s20, s50, s100, s200 } N-315 ::= ENUMERATED { s1, s50, s100, s200, s400, s600, s800, s1000 } N-315ext ::= ENUMERATED { s2, s4, s10, s20 } N-315-r5 ::= ENUMERATED { s1, s2, s4, s10, s20, s50, s100, s200, s400, s600, s800, s1000 } N-AccessFails ::= INTEGER (1..64) N-AP-RetransMax ::= INTEGER (1..64) NetworkAssistedGPS-Supported ::= ENUMERATED { networkBased, ue-Based, bothNetworkAndUE-Based, noNetworkAssistedGPS } NF-BO-AllBusy ::= INTEGER (0..31) NF-BO-NoAICH ::= INTEGER (0..31) NF-BO-Mismatch ::= INTEGER (0..127) NS-BO-Busy ::= INTEGER (0..63) NS-IP ::= INTEGER (0..28) P-TMSI-and-RAI-GSM-MAP ::= SEQUENCE { p-TMSI P-TMSI-GSM-MAP, rai RAI } PagingCause ::= ENUMERATED { terminatingConversationalCall, terminatingStreamingCall, terminatingInteractiveCall, terminatingBackgroundCall, terminatingHighPrioritySignalling, terminatingLowPrioritySignalling, terminatingCauseUnknown, spare } PagingRecord ::= CHOICE { cn-Identity SEQUENCE { pagingCause PagingCause, cn-DomainIdentity CN-DomainIdentity, cn-pagedUE-Identity CN-PagedUE-Identity }, utran-Identity SEQUENCE { u-RNTI U-RNTI, cn-OriginatedPage-connectedMode-UE SEQUENCE { pagingCause PagingCause, cn-DomainIdentity CN-DomainIdentity, pagingRecordTypeID PagingRecordTypeID } OPTIONAL } } PagingRecord2-r5 ::= CHOICE { utran-SingleUE-Identity SEQUENCE { u-RNTI U-RNTI, cn-OriginatedPage-connectedMode-UE SEQUENCE { pagingCause PagingCause, cn-DomainIdentity CN-DomainIdentity, pagingRecordTypeID PagingRecordTypeID } OPTIONAL, rrc-ConnectionReleaseInformation RRC-ConnectionReleaseInformation }, utran-GroupIdentity SEQUENCE ( SIZE (1 .. maxURNTI-Group) ) OF GroupIdentityWithReleaseInformation } PagingRecordList ::= SEQUENCE (SIZE (1..maxPage1)) OF PagingRecord PagingRecord2List-r5 ::= SEQUENCE (SIZE (1..maxPage1)) OF PagingRecord2-r5 PDCP-Capability ::= SEQUENCE { losslessSRNS-RelocationSupport BOOLEAN, -- If present, the "maxHcContextSpace" in the IE "PDCP-Capability-r5-ext" overrides the -- "supported" value in this IE. The value in this IE may be used by a pre-REL-5 UTRAN. supportForRfc2507 CHOICE { notSupported NULL, supported MaxHcContextSpace } } PDCP-Capability-r4-ext ::= SEQUENCE { supportForRfc3095 CHOICE { notSupported NULL, supported SEQUENCE { maxROHC-ContextSessions MaxROHC-ContextSessions-r4 DEFAULT s16, reverseCompressionDepth INTEGER (0..65535) DEFAULT 0 } } } PDCP-Capability-r5-ext ::= SEQUENCE { supportForRfc3095ContextRelocation BOOLEAN, maxHcContextSpace MaxHcContextSpace-r5-ext OPTIONAL } PDCP-Capability-r5-ext2 ::= SEQUENCE { losslessDLRLC-PDUSizeChange ENUMERATED { true } OPTIONAL } PhysicalChannelCapability ::= SEQUENCE { fddPhysChCapability SEQUENCE { downlinkPhysChCapability DL-PhysChCapabilityFDD, uplinkPhysChCapability UL-PhysChCapabilityFDD } OPTIONAL, -- tddPhysChCapability describes the 3.84Mcps TDD physical channel capability tddPhysChCapability SEQUENCE { downlinkPhysChCapability DL-PhysChCapabilityTDD, uplinkPhysChCapability UL-PhysChCapabilityTDD } OPTIONAL } PhysicalChannelCapability-r7 ::= SEQUENCE { fddPhysChCapability SEQUENCE { downlinkPhysChCapability DL-PhysChCapabilityFDD, uplinkPhysChCapability UL-PhysChCapabilityFDD } OPTIONAL, -- tddPhysChCapability describes the 3.84Mcps TDD physical channel capability tddPhysChCapability SEQUENCE { downlinkPhysChCapability DL-PhysChCapabilityTDD, uplinkPhysChCapability UL-PhysChCapabilityTDD } OPTIONAL, -- tddPhysicalChaCapability-768 describes the 7.68 TDD physical channel capability tddPhysChCapability-768 SEQUENCE { downlinkPhysChCapability DL-PhysChCapabilityTDD-768, uplinkPhysChCapability UL-PhysChCapabilityTDD } } -- PhysicalChannelCapability-LCR-r4 describes the 1.28Mcps TDD physical channel capability PhysicalChannelCapability-LCR-r4 ::= SEQUENCE { tdd128-PhysChCapability SEQUENCE { downlinkPhysChCapability DL-PhysChCapabilityTDD-LCR-r4, uplinkPhysChCapability UL-PhysChCapabilityTDD-LCR-r4 } OPTIONAL } -- PhysicalChannelCapability-hspdsch-r5 describes the HS-PDSCH physical channel capability PhysicalChannelCapability-hspdsch-r5 ::= SEQUENCE { fdd-hspdsch CHOICE { supported SEQUENCE { hsdsch-physical-layer-category HSDSCH-physical-layer-category, -- dummy and dummy2 are not used in this version of the specification -- and if received they should be ignored. dummy BOOLEAN, dummy2 BOOLEAN }, unsupported NULL }, tdd384-hspdsch CHOICE { supported HSDSCH-physical-layer-category, unsupported NULL }, tdd128-hspdsch CHOICE { supported HSDSCH-physical-layer-category, unsupported NULL } } PNBSCH-Allocation-r4 ::= SEQUENCE { numberOfRepetitionsPerSFNPeriod ENUMERATED { c2, c3, c4, c5, c6, c7, c8, c9, c10, c12, c14, c16, c18, c20, c24, c28, c32, c36, c40, c48, c56, c64, c72, c80 } } ProtocolErrorCause ::= ENUMERATED { asn1-ViolationOrEncodingError, messageTypeNonexistent, messageNotCompatibleWithReceiverState, ie-ValueNotComprehended, informationElementMissing, messageExtensionNotComprehended, spare2, spare1 } ProtocolErrorIndicator ::= ENUMERATED { noError, errorOccurred } ProtocolErrorIndicatorWithMoreInfo ::= CHOICE { noError NULL, errorOccurred SEQUENCE { rrc-TransactionIdentifier RRC-TransactionIdentifier, protocolErrorInformation ProtocolErrorInformation } } ProtocolErrorMoreInformation ::= SEQUENCE { diagnosticsType CHOICE { type1 CHOICE { asn1-ViolationOrEncodingError NULL, messageTypeNonexistent NULL, messageNotCompatibleWithReceiverState IdentificationOfReceivedMessage, ie-ValueNotComprehended IdentificationOfReceivedMessage, conditionalInformationElementError IdentificationOfReceivedMessage, messageExtensionNotComprehended IdentificationOfReceivedMessage, spare1 NULL, spare2 NULL }, spare NULL } } RadioFrequencyBandFDD ::= ENUMERATED { -- fdd2100, fdd1900, fdd1800 correspond to Band I, Band II and Band III respectively fdd2100, fdd1900, fdd1800, bandVI, bandIV, bandV, bandVII, extension-indicator } RadioFrequencyBandFDD2 ::= ENUMERATED { bandVIII, bandIX, bandX, bandXI, bandXII, bandXIII, bandXIV, bandXV, bandXVI, bandXVII, bandXVIII, bandXIX, bandXX, bandXXI, bandXXII, extension-indicator } RadioFrequencyBandTDDList ::= ENUMERATED { a, b, c, ab, ac, bc, abc, spare } RadioFrequencyBandTDD ::= ENUMERATED {a, b, c, spare} RadioFrequencyBandGSM ::= ENUMERATED { gsm450, gsm480, gsm850, gsm900P, gsm900E, gsm1800, gsm1900, spare9, spare8, spare7, spare6, spare5, spare4, spare3, spare2, spare1} Rb-timer-indicator ::= SEQUENCE { t314-expired BOOLEAN, t315-expired BOOLEAN } Re-EstablishmentTimer ::= ENUMERATED { useT314, useT315 } RedirectionInfo ::= CHOICE { frequencyInfo FrequencyInfo, interRATInfo InterRATInfo } RedirectionInfo-r6 ::= CHOICE { frequencyInfo FrequencyInfo, interRATInfo InterRATInfo-r6 } RejectionCause ::= ENUMERATED { congestion, unspecified } ReleaseCause ::= ENUMERATED { normalEvent, unspecified, pre-emptiveRelease, congestion, re-establishmentReject, directedsignallingconnectionre-establishment, userInactivity, spare } RF-Capability ::= SEQUENCE { fddRF-Capability SEQUENCE { ue-PowerClass UE-PowerClass, txRxFrequencySeparation TxRxFrequencySeparation } OPTIONAL, tddRF-Capability SEQUENCE { ue-PowerClass UE-PowerClass, radioFrequencyTDDBandList RadioFrequencyBandTDDList, chipRateCapability ChipRateCapability } OPTIONAL } RF-Capability-r4-ext ::= SEQUENCE { tddRF-Capability SEQUENCE { ue-PowerClass UE-PowerClass, radioFrequencyBandTDDList RadioFrequencyBandTDDList, chipRateCapability ChipRateCapability } OPTIONAL } RF-Capability-r7 ::= SEQUENCE { fddRF-Capability SEQUENCE { ue-PowerClass UE-PowerClass, txRxFrequencySeparation TxRxFrequencySeparation } OPTIONAL, tddRF-Capability SEQUENCE { ue-PowerClass UE-PowerClass, radioFrequencyTDDBandList RadioFrequencyBandTDDList, chipRateCapability ChipRateCapability-r7 } OPTIONAL } RLC-Capability ::= SEQUENCE { -- If present, the "totalRLC-AM-BufferSize" in the IE "RLC-Capability-r5-ext" overrides the -- corresponding value in this IE. The value in this IE may be used by a pre-REL-5 UTRAN. totalRLC-AM-BufferSize TotalRLC-AM-BufferSize, maximumRLC-WindowSize MaximumRLC-WindowSize, maximumAM-EntityNumber MaximumAM-EntityNumberRLC-Cap } RLC-Capability-r5-ext ::= SEQUENCE { totalRLC-AM-BufferSize TotalRLC-AM-BufferSize-r5-ext OPTIONAL } RRC-ConnectionReleaseInformation ::= CHOICE { noRelease NULL, release SEQUENCE { releaseCause ReleaseCause } } RRC-MessageSequenceNumber ::= INTEGER (0..15) RRC-MessageSequenceNumberList ::= SEQUENCE (SIZE (4..5)) OF RRC-MessageSequenceNumber RRC-StateIndicator ::= ENUMERATED { cell-DCH, cell-FACH, cell-PCH, ura-PCH } RRC-TransactionIdentifier ::= INTEGER (0..3) S-RNTI ::= BIT STRING (SIZE (20)) S-RNTI-2 ::= BIT STRING (SIZE (10)) SecurityCapability ::= SEQUENCE { cipheringAlgorithmCap BIT STRING { -- For each bit value 窶0窶 means false/ not supported spare15(0), spare14(1), spare13(2), spare12(3), spare11(4), spare10(5), spare9(6), spare8(7), spare7(8), spare6(9), spare5(10), spare4(11), spare3(12), spare2(13), uea1(14), uea0(15) } (SIZE (16)), integrityProtectionAlgorithmCap BIT STRING { -- For each bit value 窶0窶 means false/ not supported spare15(0), spare14(1), spare13(2), spare12(3), spare11(4), spare10(5), spare9(6), spare8(7), spare7(8), spare6(9), spare5(10), spare4(11), spare3(12), spare2(13), uia1(14), spare0(15) } (SIZE (16)) } Serving-HSDSCH-CellInformation ::= SEQUENCE { deltaACK DeltaACK OPTIONAL, deltaNACK DeltaNACK OPTIONAL, harq-Preamble-Mode HARQ-Preamble-Mode, primaryCPICH-Info PrimaryCPICH-Info OPTIONAL, dl-hspdsch-Information DL-HSPDSCH-Information OPTIONAL, harqInfo HARQ-Info OPTIONAL, mac-hsResetIndicator ENUMERATED { true } OPTIONAL } SimultaneousSCCPCH-DPCH-Reception ::= CHOICE { notSupported NULL, supported SEQUENCE { maxNoSCCPCH-RL MaxNoSCCPCH-RL, -- simultaneousSCCPCH-DPCH-DPDCH-Reception is applicable only if -- the IE Support of PDSCH = TRUE -- Note: the reference to DPDCH in the element name below is incorrect (see tabular). The -- name is not changed, to keep it aligned with R99. simultaneousSCCPCH-DPCH-DPDCH-Reception BOOLEAN } } SRNC-Identity ::= BIT STRING (SIZE (12)) START-Value ::= BIT STRING (SIZE (20)) STARTList ::= SEQUENCE (SIZE (1..maxCNdomains)) OF STARTSingle STARTSingle ::= SEQUENCE { cn-DomainIdentity CN-DomainIdentity, start-Value START-Value } CapabilityUpdateRequirement-r5 ::= SEQUENCE { ue-RadioCapabilityFDDUpdateRequirement-FDD BOOLEAN, ue-RadioCapabilityTDDUpdateRequirement-TDD384 BOOLEAN, ue-RadioCapabilityTDDUpdateRequirement-TDD128 BOOLEAN, systemSpecificCapUpdateReqList SystemSpecificCapUpdateReqList-r5 OPTIONAL } SystemSpecificCapUpdateReq ::= ENUMERATED { gsm } SystemSpecificCapUpdateReq-v590ext ::= ENUMERATED { geranIu } SystemSpecificCapUpdateReq-r5 ::= ENUMERATED { gsm, geranIu } SystemSpecificCapUpdateReqList ::= SEQUENCE (SIZE (1..maxSystemCapability)) OF SystemSpecificCapUpdateReq SystemSpecificCapUpdateReqList-r5 ::= SEQUENCE (SIZE (1..maxSystemCapability)) OF SystemSpecificCapUpdateReq-r5 T-300 ::= ENUMERATED { ms100, ms200, ms400, ms600, ms800, ms1000, ms1200, ms1400, ms1600, ms1800, ms2000, ms3000, ms4000, ms6000, ms8000 } T-301 ::= ENUMERATED { ms100, ms200, ms400, ms600, ms800, ms1000, ms1200, ms1400, ms1600, ms1800, ms2000, ms3000, ms4000, ms6000, ms8000, spare } T-302 ::= ENUMERATED { ms100, ms200, ms400, ms600, ms800, ms1000, ms1200, ms1400, ms1600, ms1800, ms2000, ms3000, ms4000, ms6000, ms8000, spare } T-304 ::= ENUMERATED { ms100, ms200, ms400, ms1000, ms2000, spare3, spare2, spare1 } T-305 ::= ENUMERATED { noUpdate, m5, m10, m30, m60, m120, m360, m720 } T-307 ::= ENUMERATED { s5, s10, s15, s20, s30, s40, s50, spare } T-308 ::= ENUMERATED { ms40, ms80, ms160, ms320 } T-309 ::= INTEGER (1..8) T-310 ::= ENUMERATED { ms40, ms80, ms120, ms160, ms200, ms240, ms280, ms320 } T-311 ::= ENUMERATED { ms250, ms500, ms750, ms1000, ms1250, ms1500, ms1750, ms2000 } -- The value 0 for T-312 is not used in this version of the specification T-312 ::= INTEGER (0..15) T-313 ::= INTEGER (0..15) T-314 ::= ENUMERATED { s0, s2, s4, s6, s8, s12, s16, s20 } T-315 ::= ENUMERATED { s0, s10, s30, s60, s180, s600, s1200, s1800 } T-316 ::= ENUMERATED { s0, s10, s20, s30, s40, s50, s-inf, spare } -- All the values are changed to "infinity" in Rel-5 T-317 ::= ENUMERATED { infinity0, infinity1, infinity2, infinity3, infinity4, infinity5, infinity6, infinity7} T-318 ::= ENUMERATED { ms250, ms500, ms750, ms1000, ms1250, ms1500, ms1750, ms2000, ms3000, ms4000, ms6000, ms8000, ms10000, ms12000, ms16000 } T-CPCH ::= ENUMERATED { ct0, ct1 } TMSI-and-LAI-GSM-MAP ::= SEQUENCE { tmsi TMSI-GSM-MAP, lai LAI } TMSI-DS-41 ::= OCTET STRING (SIZE (2..17)) TotalRLC-AM-BufferSize ::= ENUMERATED { dummy, kb10, kb50, kb100, kb150, kb500, kb1000, spare } TotalRLC-AM-BufferSize-r5-ext ::= ENUMERATED { kb200, kb300, kb400, kb750 } -- Actual value TransmissionProbability = IE value * 0.125 TransmissionProbability ::= INTEGER (1..8) TransportChannelCapability ::= SEQUENCE { dl-TransChCapability DL-TransChCapability, ul-TransChCapability UL-TransChCapability } TurboSupport ::= CHOICE { notSupported NULL, supported MaxNoBits } -- Values defined as spare shall not be sent in this version of the protocol. If a spare value is -- received, it should be interpreted as 'default-RxTX-sparation'. TxRxFrequencySeparation ::= ENUMERATED { default-TxRx-separation, spare2, spare1 } U-RNTI ::= SEQUENCE { srnc-Identity SRNC-Identity, s-RNTI S-RNTI } U-RNTI-Group ::= CHOICE { -- TABULAR: not following the tabular strictly, but this will most likely save bits all NULL, u-RNTI-BitMaskIndex-b1 BIT STRING (SIZE (31)), u-RNTI-BitMaskIndex-b2 BIT STRING (SIZE (30)), u-RNTI-BitMaskIndex-b3 BIT STRING (SIZE (29)), u-RNTI-BitMaskIndex-b4 BIT STRING (SIZE (28)), u-RNTI-BitMaskIndex-b5 BIT STRING (SIZE (27)), u-RNTI-BitMaskIndex-b6 BIT STRING (SIZE (26)), u-RNTI-BitMaskIndex-b7 BIT STRING (SIZE (25)), u-RNTI-BitMaskIndex-b8 BIT STRING (SIZE (24)), u-RNTI-BitMaskIndex-b9 BIT STRING (SIZE (23)), u-RNTI-BitMaskIndex-b10 BIT STRING (SIZE (22)), u-RNTI-BitMaskIndex-b11 BIT STRING (SIZE (21)), u-RNTI-BitMaskIndex-b12 BIT STRING (SIZE (20)), u-RNTI-BitMaskIndex-b13 BIT STRING (SIZE (19)), u-RNTI-BitMaskIndex-b14 BIT STRING (SIZE (18)), u-RNTI-BitMaskIndex-b15 BIT STRING (SIZE (17)), u-RNTI-BitMaskIndex-b16 BIT STRING (SIZE (16)), u-RNTI-BitMaskIndex-b17 BIT STRING (SIZE (15)), u-RNTI-BitMaskIndex-b18 BIT STRING (SIZE (14)), u-RNTI-BitMaskIndex-b19 BIT STRING (SIZE (13)), u-RNTI-BitMaskIndex-b20 BIT STRING (SIZE (12)), u-RNTI-BitMaskIndex-b21 BIT STRING (SIZE (11)), u-RNTI-BitMaskIndex-b22 BIT STRING (SIZE (10)), u-RNTI-BitMaskIndex-b23 BIT STRING (SIZE (9)), u-RNTI-BitMaskIndex-b24 BIT STRING (SIZE (8)), u-RNTI-BitMaskIndex-b25 BIT STRING (SIZE (7)), u-RNTI-BitMaskIndex-b26 BIT STRING (SIZE (6)), u-RNTI-BitMaskIndex-b27 BIT STRING (SIZE (5)), u-RNTI-BitMaskIndex-b28 BIT STRING (SIZE (4)), u-RNTI-BitMaskIndex-b29 BIT STRING (SIZE (3)), u-RNTI-BitMaskIndex-b30 BIT STRING (SIZE (2)), u-RNTI-BitMaskIndex-b31 BIT STRING (SIZE (1)) } U-RNTI-Short ::= SEQUENCE { srnc-Identity SRNC-Identity, s-RNTI-2 S-RNTI-2 } UE-CapabilityContainer-IEs ::= SEQUENCE { -- Container for transparent transfer of capability information not related to -- features for which early implementation is desired ue-RadioAccessCapability-v690ext UE-RadioAccessCapability-v690ext, ue-RATSpecificCapability-v690ext InterRAT-UE-RadioAccessCapability-v690ext OPTIONAL, nonCriticalExtensions SEQUENCE {} OPTIONAL } UE-ConnTimersAndConstants ::= SEQUENCE { -- Optional is used also for parameters for which the default value is the last one read in SIB1 -- t-301 and n-301 should not be used by the UE in this version of the specification t-301 T-301 DEFAULT ms2000, n-301 N-301 DEFAULT 2, t-302 T-302 DEFAULT ms4000, n-302 N-302 DEFAULT 3, t-304 T-304 DEFAULT ms2000, n-304 N-304 DEFAULT 2, t-305 T-305 DEFAULT m30, t-307 T-307 DEFAULT s30, t-308 T-308 DEFAULT ms160, t-309 T-309 DEFAULT 5, t-310 T-310 DEFAULT ms160, n-310 N-310 DEFAULT 4, t-311 T-311 DEFAULT ms2000, t-312 T-312 DEFAULT 1, -- n-312 shall be ignored if n-312 in UE-ConnTimersAndConstants-v3a0ext is present, and the -- value of that element shall be used instead. n-312 N-312 DEFAULT s1, t-313 T-313 DEFAULT 3, n-313 N-313 DEFAULT s20, t-314 T-314 DEFAULT s12, t-315 T-315 DEFAULT s180, -- n-315 shall be ignored if n-315 in UE-ConnTimersAndConstants-v3a0ext is present, and the -- value of that element shall be used instead. n-315 N-315 DEFAULT s1, t-316 T-316 DEFAULT s30, t-317 T-317 DEFAULT infinity4 } UE-ConnTimersAndConstants-v3a0ext ::= SEQUENCE { n-312 N-312ext OPTIONAL, n-315 N-315ext OPTIONAL } UE-ConnTimersAndConstants-r5 ::= SEQUENCE { -- Optional is used also for parameters for which the default value is the last one read in SIB1 -- t-301 and n-301 should not be used by the UE in this version of the specification t-301 T-301 DEFAULT ms2000, n-301 N-301 DEFAULT 2, t-302 T-302 DEFAULT ms4000, n-302 N-302 DEFAULT 3, t-304 T-304 DEFAULT ms2000, n-304 N-304 DEFAULT 2, t-305 T-305 DEFAULT m30, t-307 T-307 DEFAULT s30, t-308 T-308 DEFAULT ms160, t-309 T-309 DEFAULT 5, t-310 T-310 DEFAULT ms160, n-310 N-310 DEFAULT 4, t-311 T-311 DEFAULT ms2000, t-312 T-312 DEFAULT 1, n-312 N-312-r5 DEFAULT s1, t-313 T-313 DEFAULT 3, n-313 N-313 DEFAULT s20, t-314 T-314 DEFAULT s12, t-315 T-315 DEFAULT s180, n-315 N-315-r5 DEFAULT s1, t-316 T-316 DEFAULT s30, t-317 T-317 DEFAULT infinity4 } UE-IdleTimersAndConstants ::= SEQUENCE { t-300 T-300, n-300 N-300, t-312 T-312, -- n-312 shall be ignored if n-312 in UE-IdleTimersAndConstants-v3a0ext is present, and the -- value of that element shall be used instead. n-312 N-312 } UE-IdleTimersAndConstants-v3a0ext ::= SEQUENCE { n-312 N-312ext OPTIONAL } UE-MultiModeRAT-Capability ::= SEQUENCE { multiRAT-CapabilityList MultiRAT-Capability, multiModeCapability MultiModeCapability } UE-PowerClass ::= INTEGER (1..4) UE-PowerClassExt ::= ENUMERATED {class1, class2, class3, class4, spare4, spare3, spare2, spare1 } UE-RadioAccessCapability ::= SEQUENCE { -- UE-RadioAccessCapability is compatible with R99, although accessStratumReleaseIndicator -- is removed from this IE, since its encoding did not does in bits. The -- accessStratumReleaseIndicator is provided in the relevant REL-4 extension IEs. pdcp-Capability PDCP-Capability, rlc-Capability RLC-Capability, transportChannelCapability TransportChannelCapability, rf-Capability RF-Capability, physicalChannelCapability PhysicalChannelCapability, ue-MultiModeRAT-Capability UE-MultiModeRAT-Capability, securityCapability SecurityCapability, ue-positioning-Capability UE-Positioning-Capability, measurementCapability MeasurementCapability OPTIONAL } UE-RadioAccessCapabilityInfo ::= SEQUENCE { ue-RadioAccessCapability UE-RadioAccessCapability, ue-RadioAccessCapability-v370ext UE-RadioAccessCapability-v370ext } UE-RadioAccessCapability-v370ext ::= SEQUENCE { ue-RadioAccessCapabBandFDDList UE-RadioAccessCapabBandFDDList } UE-RadioAccessCapability-v380ext ::= SEQUENCE { ue-PositioningCapabilityExt-v380 UE-PositioningCapabilityExt-v380 } UE-RadioAccessCapability-v3a0ext ::= SEQUENCE { ue-PositioningCapabilityExt-v3a0 UE-PositioningCapabilityExt-v3a0 } UE-RadioAccessCapability-v3g0ext ::= SEQUENCE { ue-PositioningCapabilityExt-v3g0 UE-PositioningCapabilityExt-v3g0 } UE-RadioAccessCapability-v650ext ::= SEQUENCE { ue-RadioAccessCapabBandFDDList2 UE-RadioAccessCapabBandFDDList2, -- This IE shall be included if the UE also supports Band I-VII ue-RadioAccessCapabBandFDDList-ext UE-RadioAccessCapabBandFDDList-ext OPTIONAL } UE-RadioAccessCapability-v690ext ::= SEQUENCE { physicalchannelcapability-edch PhysicalChannelCapability-edch-r6, -- TABULAR: deviceType is MD in tabular description -- Default value is 'doesBenefitFromBatteryConsumptionOptimisation' deviceType ENUMERATED { doesNotBenefitFromBatteryConsumptionOptimisation } OPTIONAL } UE-RadioAccessCapability-v7xyext ::= SEQUENCE { rf-Capability RF-Capability-r7 OPTIONAL, physicalChannelCapability-r7 PhysicalChannelCapability-r7 OPTIONAL } UE-RadioAccessCapabBandFDDList2 ::= SEQUENCE (SIZE (1..maxFreqBandsFDD)) OF UE-RadioAccessCapabBandFDD2 UE-RadioAccessCapabBandFDD2 ::= SEQUENCE { radioFrequencyBandFDD2 RadioFrequencyBandFDD2, fddRF-Capability SEQUENCE { ue-PowerClass UE-PowerClassExt, txRxFrequencySeparation TxRxFrequencySeparation } OPTIONAL, measurementCapability2 MeasurementCapabilityExt2 } UE-PositioningCapabilityExt-v380 ::= SEQUENCE { rx-tx-TimeDifferenceType2Capable BOOLEAN } UE-PositioningCapabilityExt-v3a0 ::= SEQUENCE { validity-CellPCH-UraPCH ENUMERATED { true } } UE-PositioningCapabilityExt-v3g0 ::= SEQUENCE { sfn-sfnType2Capability ENUMERATED { true } } UE-RadioAccessCapabBandFDDList ::= SEQUENCE (SIZE (1..maxFreqBandsFDD)) OF UE-RadioAccessCapabBandFDD UE-RadioAccessCapabBandFDDList-ext ::= SEQUENCE (SIZE (1..maxFreqBandsFDD)) OF UE-RadioAccessCapabBandFDD-ext UE-RadioAccessCapabBandFDD ::= SEQUENCE{ radioFrequencyBandFDD RadioFrequencyBandFDD, fddRF-Capability SEQUENCE { ue-PowerClass UE-PowerClassExt, txRxFrequencySeparation TxRxFrequencySeparation } OPTIONAL, measurementCapability MeasurementCapabilityExt } UE-RadioAccessCapabBandFDD-ext ::= SEQUENCE { radioFrequencyBandFDD RadioFrequencyBandFDD, compressedModeMeasCapabFDDList-ext CompressedModeMeasCapabFDDList-ext } UE-RadioAccessCapability-v4b0ext ::= SEQUENCE { pdcp-Capability-r4-ext PDCP-Capability-r4-ext, tdd-CapabilityExt SEQUENCE { rf-Capability RF-Capability-r4-ext, physicalChannelCapability-LCR PhysicalChannelCapability-LCR-r4, measurementCapability-r4-ext MeasurementCapability-r4-ext } OPTIONAL, -- IE " AccessStratumReleaseIndicator" is not needed in RRC CONNECTION SETUP COMPLETE accessStratumReleaseIndicator AccessStratumReleaseIndicator OPTIONAL } UE-RadioAccessCapabilityComp ::= SEQUENCE { totalAM-RLCMemoryExceeds10kB BOOLEAN, rf-CapabilityComp RF-CapabilityComp } UE-RadioAccessCapabilityComp-ext ::= SEQUENCE { rf-CapabilityFDDComp RF-CapabBandListFDDComp-ext } UE-RadioAccessCapabilityComp-r7 ::= SEQUENCE { totalAM-RLCMemoryExceeds10kB BOOLEAN, rf-CapabilityComp RF-CapabilityComp-r7 } UE-RadioAccessCapabilityComp2 ::= SEQUENCE { fddPhysicalChannelCapab-hspdsch-edch SEQUENCE { dl-CapabilityWithSimultaneousHS-DSCHConfig DL-CapabilityWithSimultaneousHS-DSCHConfig OPTIONAL, physicalChannelCapabComp-hspdsch-r6 HSDSCH-physical-layer-category, physicalChannelCapability-edch-r6 PhysicalChannelCapability-edch-r6 } OPTIONAL } RF-CapabilityComp ::= SEQUENCE { fdd CHOICE { notSupported NULL, supported RF-CapabBandListFDDComp }, tdd384-RF-Capability CHOICE { notSupported NULL, supported RadioFrequencyBandTDDList }, tdd128-RF-Capability CHOICE { notSupported NULL, supported RadioFrequencyBandTDDList } } RF-CapabilityComp-r7 ::= SEQUENCE { fdd CHOICE { notSupported NULL, supported RF-CapabBandListFDDComp }, tdd384-RF-Capability CHOICE { notSupported NULL, supported RadioFrequencyBandTDDList }, tdd768-RF-Capability CHOICE { notSupported NULL, supported RadioFrequencyBandTDDList }, tdd128-RF-Capability CHOICE { notSupported NULL, supported RadioFrequencyBandTDDList } } -- NOTE: This IE defines the supported TX/RX frequency separation for the respective supported -- frequency band. Values defined as spare shall not be sent in this version of the protocol. -- If a spare value is received, it should be interpreted as 'default-RxTX-sparation'. RF-CapabBandFDDComp ::= ENUMERATED { notSupported, default-TxRx-separation, spare2, spare1 } RF-CapabBandListFDDComp ::= SEQUENCE (SIZE (1..maxFreqBandsFDD)) OF -- The first entry corresponds with the first value of IE RadioFrequencyBandFDD, -- fdd2100, and so on. No more than seven entries should be included in this IE. The -- 8'th entry, if present, shall be ignored. -- An extension of this IE may be provided using the IE 'RF-CapabBandListFDDComp-ext'. RF-CapabBandFDDComp RF-CapabBandListFDDComp-ext ::= SEQUENCE (SIZE (1..maxFreqBandsFDD-ext)) OF -- The first entry corresponds with the first value of IE RadioFrequencyBandFDD2, -- bandVIII, and so on. RF-CapabBandFDDComp UE-RadioAccessCapability-v590ext ::= SEQUENCE { dl-CapabilityWithSimultaneousHS-DSCHConfig DL-CapabilityWithSimultaneousHS-DSCHConfig OPTIONAL, pdcp-Capability-r5-ext PDCP-Capability-r5-ext, rlc-Capability-r5-ext RLC-Capability-r5-ext, physicalChannelCapability PhysicalChannelCapability-hspdsch-r5, multiModeRAT-Capability-v590ext MultiModeRAT-Capability-v590ext } UE-RadioAccessCapability-v5c0ext ::= SEQUENCE { pdcp-Capability-r5-ext2 PDCP-Capability-r5-ext2 } UE-RadioAccessCapability-v680ext ::= SEQUENCE { multiModeRAT-Capability-v680ext MultiModeRAT-Capability-v680ext } UL-PhysChCapabilityFDD ::= SEQUENCE { maxNoDPDCH-BitsTransmitted MaxNoDPDCH-BitsTransmitted, -- dummy is not used in this version of the specification and -- it should be ignored by the receiver. dummy BOOLEAN } UL-PhysChCapabilityFDD-r6 ::= SEQUENCE { maxNoDPDCH-BitsTransmitted MaxNoDPDCH-BitsTransmitted, physicalchannelcapability-edch PhysicalChannelCapability-edch-r6 } UL-PhysChCapabilityTDD ::= SEQUENCE { maxTS-PerFrame MaxTS-PerFrame, maxPhysChPerTimeslot MaxPhysChPerTimeslot, minimumSF MinimumSF-UL, supportOfPUSCH BOOLEAN } UL-PhysChCapabilityTDD-LCR-r4 ::= SEQUENCE { maxTS-PerSubFrame MaxTS-PerSubFrame-r4, maxPhysChPerTimeslot MaxPhysChPerTimeslot, minimumSF MinimumSF-UL, supportOfPUSCH BOOLEAN, supportOf8PSK BOOLEAN } PhysicalChannelCapability-edch-r6 ::= SEQUENCE { fdd-edch CHOICE { supported SEQUENCE { edch-PhysicalLayerCategory INTEGER (1..16) }, unsupported NULL } } UL-TransChCapability ::= SEQUENCE { maxNoBitsTransmitted MaxNoBits, maxConvCodeBitsTransmitted MaxNoBits, turboEncodingSupport TurboSupport, maxSimultaneousTransChs MaxSimultaneousTransChsUL, modeSpecificInfo CHOICE { fdd NULL, tdd SEQUENCE { maxSimultaneousCCTrCH-Count MaxSimultaneousCCTrCH-Count } }, maxTransmittedBlocks MaxTransportBlocksUL, maxNumberOfTFC MaxNumberOfTFC-UL, maxNumberOfTF MaxNumberOfTF } UE-Positioning-Capability ::= SEQUENCE { standaloneLocMethodsSupported BOOLEAN, ue-BasedOTDOA-Supported BOOLEAN, networkAssistedGPS-Supported NetworkAssistedGPS-Supported, supportForUE-GPS-TimingOfCellFrames BOOLEAN, supportForIPDL BOOLEAN } UE-SecurityInformation ::= SEQUENCE { start-CS START-Value } UE-SecurityInformation2 ::= SEQUENCE { start-PS START-Value } URA-UpdateCause ::= ENUMERATED { changeOfURA, periodicURAUpdate, dummy, spare1 } UTRAN-DRX-CycleLengthCoefficient ::= INTEGER (3..9) WaitTime ::= INTEGER (0..15) -- *************************************************** -- -- RADIO BEARER INFORMATION ELEMENTS (10.3.4) -- -- *************************************************** AlgorithmSpecificInfo ::= CHOICE { rfc2507-Info RFC2507-Info } AlgorithmSpecificInfo-r4 ::= CHOICE { rfc2507-Info RFC2507-Info, rfc3095-Info RFC3095-Info-r4 } CID-InclusionInfo-r4 ::= ENUMERATED { pdcp-Header, rfc3095-PacketFormat } -- Upper limit of COUNT-C is 2^32 - 1 COUNT-C ::= INTEGER (0..4294967295) -- Upper limit of COUNT-C-MSB is 2^25 - 1 COUNT-C-MSB ::= INTEGER (0..33554431) DefaultConfigIdentity ::= INTEGER (0..10) DefaultConfigIdentity-r4 ::= INTEGER (0..12) DefaultConfigIdentity-r5 ::= INTEGER (0..13) -- DefaultConfigIdentity-r6 values 23..31 are spare and shall not be used in this version of -- the protocol DefaultConfigIdentity-r6 ::= INTEGER (0..31) DefaultConfigMode ::= ENUMERATED { fdd, tdd } DDI ::= INTEGER (0..62) DL-AM-RLC-Mode ::= SEQUENCE { inSequenceDelivery BOOLEAN, receivingWindowSize ReceivingWindowSize, dl-RLC-StatusInfo DL-RLC-StatusInfo } DL-AM-RLC-Mode-r5 ::= SEQUENCE { dl-RLC-PDU-size OctetModeRLC-SizeInfoType1, inSequenceDelivery BOOLEAN, receivingWindowSize ReceivingWindowSize, dl-RLC-StatusInfo DL-RLC-StatusInfo } DL-CounterSynchronisationInfo ::= SEQUENCE { rB-WithPDCP-InfoList RB-WithPDCP-InfoList OPTIONAL } DL-CounterSynchronisationInfo-r5 ::= SEQUENCE { rb-WithPDCP-InfoList RB-WithPDCP-InfoList OPTIONAL, rb-PDCPContextRelocationList RB-PDCPContextRelocationList OPTIONAL } DL-LogicalChannelMapping ::= SEQUENCE { -- TABULAR: DL-TransportChannelType contains TransportChannelIdentity as well. dl-TransportChannelType DL-TransportChannelType, logicalChannelIdentity LogicalChannelIdentity OPTIONAL } DL-LogicalChannelMapping-r5 ::= SEQUENCE { -- TABULAR: DL-TransportChannelType contains TransportChannelIdentity as well. dl-TransportChannelType DL-TransportChannelType-r5, logicalChannelIdentity LogicalChannelIdentity OPTIONAL } DL-LogicalChannelMappingList ::= SEQUENCE (SIZE (1..maxLoCHperRLC)) OF DL-LogicalChannelMapping DL-LogicalChannelMappingList-r5 ::= SEQUENCE (SIZE (1..maxLoCHperRLC)) OF DL-LogicalChannelMapping-r5 DL-Reception-Window-Size-r6 ::= ENUMERATED { size32, size48, size64, size80, size96, size112 } DL-RFC3095-r4 ::= SEQUENCE { cid-InclusionInfo CID-InclusionInfo-r4, max-CID INTEGER (1..16383) DEFAULT 15, reverseDecompressionDepth INTEGER (0..65535) DEFAULT 0 } DL-RLC-Mode ::= CHOICE { dl-AM-RLC-Mode DL-AM-RLC-Mode, dl-UM-RLC-Mode NULL, dl-TM-RLC-Mode DL-TM-RLC-Mode } DL-RLC-Mode-r5 ::= CHOICE { dl-AM-RLC-Mode DL-AM-RLC-Mode-r5, dl-UM-RLC-Mode DL-UM-RLC-Mode-r5, dl-TM-RLC-Mode DL-TM-RLC-Mode } DL-RLC-Mode-r6 ::= CHOICE { dl-AM-RLC-Mode DL-AM-RLC-Mode-r5, dl-UM-RLC-Mode DL-UM-RLC-Mode-r6, dl-TM-RLC-Mode DL-TM-RLC-Mode } DL-RLC-StatusInfo ::= SEQUENCE { timerStatusProhibit TimerStatusProhibit OPTIONAL, -- dummy is not used in this version of the specification, it should not be sent -- and if received they should be ignored. dummy TimerEPC OPTIONAL, missingPDU-Indicator BOOLEAN, timerStatusPeriodic TimerStatusPeriodic OPTIONAL } DL-TM-RLC-Mode ::= SEQUENCE { segmentationIndication BOOLEAN } DL-TransportChannelType ::= CHOICE { dch TransportChannelIdentity, fach NULL, -- The choice 窶彭sch窶 should not be used in FDD mode, and if received -- the UE behaviour is unspecified. dsch TransportChannelIdentity, -- The choice 窶彭ch-and-dsch窶 should not be used in FDD mode, and if received the UE -- behaviour is unspecified dch-and-dsch TransportChannelIdentityDCHandDSCH } DL-TransportChannelType-r5 ::= CHOICE { dch TransportChannelIdentity, fach NULL, -- The choice 窶彭sch窶 should not be used in FDD mode, and if received -- the UE behaviour is unspecified. dsch TransportChannelIdentity, -- The choice 窶彭ch-and-dsch窶 should not be used in FDD mode, and if received the UE -- behaviour is unspecified dch-and-dsch TransportChannelIdentityDCHandDSCH, hsdsch MAC-d-FlowIdentity, dch-and-hsdsch MAC-d-FlowIdentityDCHandHSDSCH } DL-UM-RLC-LI-size ::= ENUMERATED { size7, size15 } DL-UM-RLC-Mode-r5 ::= SEQUENCE { dl-UM-RLC-LI-size DL-UM-RLC-LI-size } DL-UM-RLC-Mode-r6 ::= SEQUENCE { dl-UM-RLC-LI-size DL-UM-RLC-LI-size, dl-Reception-Window-Size DL-Reception-Window-Size-r6 OPTIONAL } ExpectReordering ::= ENUMERATED { reorderingNotExpected, reorderingExpected } ExplicitDiscard ::= SEQUENCE { timerMRW TimerMRW, timerDiscard TimerDiscard, maxMRW MaxMRW } HeaderCompressionInfo ::= SEQUENCE { algorithmSpecificInfo AlgorithmSpecificInfo } HeaderCompressionInfoList ::= SEQUENCE (SIZE (1..maxPDCPAlgoType)) OF HeaderCompressionInfo HeaderCompressionInfo-r4 ::= SEQUENCE { algorithmSpecificInfo AlgorithmSpecificInfo-r4 } HeaderCompressionInfoList-r4 ::= SEQUENCE (SIZE (1..maxPDCPAlgoType)) OF HeaderCompressionInfo-r4 LogicalChannelIdentity ::= INTEGER (1..15) LosslessSRNS-RelocSupport ::= CHOICE { supported MaxPDCP-SN-WindowSize, notSupported NULL } MAC-d-HFN-initial-value ::= BIT STRING (SIZE (24)) MAC-LogicalChannelPriority ::= INTEGER (1..8) MaxDAT ::= ENUMERATED { dat1, dat2, dat3, dat4, dat5, dat6, dat7, dat8, dat9, dat10, dat15, dat20, dat25, dat30, dat35, dat40 } MaxDAT-Retransmissions ::= SEQUENCE { maxDAT MaxDAT, timerMRW TimerMRW, maxMRW MaxMRW } MaxMRW ::= ENUMERATED { mm1, mm4, mm6, mm8, mm12, mm16, mm24, mm32 } MaxPDCP-SN-WindowSize ::= ENUMERATED { sn255, sn65535 } MaxRST ::= ENUMERATED { rst1, rst4, rst6, rst8, rst12, rst16, rst24, rst32 } NoExplicitDiscard ::= ENUMERATED { dt10, dt20, dt30, dt40, dt50, dt60, dt70, dt80, dt90, dt100 } PDCP-Info ::= SEQUENCE { losslessSRNS-RelocSupport LosslessSRNS-RelocSupport OPTIONAL, -- TABULAR: pdcp-PDU-Header is MD in the tabular format and it can be encoded -- in one bit, so the OPTIONAL is removed for compactness. pdcp-PDU-Header PDCP-PDU-Header, headerCompressionInfoList HeaderCompressionInfoList OPTIONAL } PDCP-Info-r4 ::= SEQUENCE { losslessSRNS-RelocSupport LosslessSRNS-RelocSupport OPTIONAL, -- TABULAR: pdcp-PDU-Header is MD in the tabular format and it can be encoded -- in one bit, so the OPTIONAL is removed for compactness. pdcp-PDU-Header PDCP-PDU-Header, headerCompressionInfoList HeaderCompressionInfoList-r4 OPTIONAL } PDCP-InfoReconfig ::= SEQUENCE { pdcp-Info PDCP-Info, -- dummy is not used in this version of the specification and -- it should be ignored. dummy INTEGER (0..65535) } PDCP-InfoReconfig-r4 ::= SEQUENCE { pdcp-Info PDCP-Info-r4 } PDCP-PDU-Header ::= ENUMERATED { present, absent } PDCP-ROHC-TargetMode ::= ENUMERATED { o-Mode, r-Mode } PDCP-SN-Info ::= INTEGER (0..65535) Poll-PDU ::= ENUMERATED { pdu1, pdu2, pdu4, pdu8, pdu16, pdu32, pdu64, pdu128 } Poll-SDU ::= ENUMERATED { sdu1, sdu4, sdu16, sdu64 } PollingInfo ::= SEQUENCE { timerPollProhibit TimerPollProhibit OPTIONAL, timerPoll TimerPoll OPTIONAL, poll-PDU Poll-PDU OPTIONAL, poll-SDU Poll-SDU OPTIONAL, lastTransmissionPDU-Poll BOOLEAN, lastRetransmissionPDU-Poll BOOLEAN, pollWindow PollWindow OPTIONAL, timerPollPeriodic TimerPollPeriodic OPTIONAL } PollWindow ::= ENUMERATED { pw50, pw60, pw70, pw80, pw85, pw90, pw95, pw99 } PredefinedConfigIdentity ::= INTEGER (0..15) PredefinedConfigValueTag ::= INTEGER (0..15) PredefinedRB-Configuration ::= SEQUENCE { re-EstablishmentTimer Re-EstablishmentTimer, srb-InformationList SRB-InformationSetupList, rb-InformationList RB-InformationSetupList } PreDefRadioConfiguration ::= SEQUENCE { -- Radio bearer IEs predefinedRB-Configuration PredefinedRB-Configuration, -- Transport channel IEs preDefTransChConfiguration PreDefTransChConfiguration, -- Physical channel IEs preDefPhyChConfiguration PreDefPhyChConfiguration } PredefinedConfigStatusList ::= SEQUENCE (SIZE (maxPredefConfig)) OF PredefinedConfigStatusInfo PredefinedConfigStatusInfo ::= CHOICE { storedWithValueTagSameAsPrevius NULL, other CHOICE { notStored NULL, storedWithDifferentValueTag PredefinedConfigValueTag } } PredefinedConfigStatusListComp ::= SEQUENCE { setsWithDifferentValueTag PredefinedConfigSetsWithDifferentValueTag, otherEntries PredefinedConfigStatusListVarSz OPTIONAL } PredefinedConfigSetsWithDifferentValueTag ::= SEQUENCE (SIZE (1..2)) OF PredefinedConfigSetWithDifferentValueTag PredefinedConfigSetWithDifferentValueTag ::= SEQUENCE { startPosition INTEGER (0..10) DEFAULT 0, -- numberOfEntries INTEGER (6..16), -- numberOfEntries is covered by the size of the list in IE PredefinedConfigValueTagList valueTagList PredefinedConfigValueTagList } PredefinedConfigValueTagList ::= SEQUENCE (SIZE (1..maxPredefConfig)) OF PredefinedConfigValueTag PredefinedConfigStatusListVarSz ::= SEQUENCE (SIZE (1..maxPredefConfig)) OF PredefinedConfigStatusInfo RAB-Info ::= SEQUENCE { rab-Identity RAB-Identity, cn-DomainIdentity CN-DomainIdentity, nas-Synchronisation-Indicator NAS-Synchronisation-Indicator OPTIONAL, re-EstablishmentTimer Re-EstablishmentTimer } RAB-Info-r6-ext ::= SEQUENCE { mbms-SessionIdentity MBMS-SessionIdentity OPTIONAL } RAB-Info-r6 ::= SEQUENCE { rab-Identity RAB-Identity, mbms-SessionIdentity MBMS-SessionIdentity OPTIONAL, cn-DomainIdentity CN-DomainIdentity, nas-Synchronisation-Indicator NAS-Synchronisation-Indicator OPTIONAL, re-EstablishmentTimer Re-EstablishmentTimer } RAB-InformationList ::= SEQUENCE (SIZE (1..maxRABsetup)) OF RAB-Info RAB-InformationList-r6 ::= SEQUENCE (SIZE (1..maxRABsetup)) OF RAB-Info-r6 RAB-InformationReconfigList ::= SEQUENCE (SIZE (1.. maxRABsetup)) OF RAB-InformationReconfig RAB-InformationReconfig ::= SEQUENCE { rab-Identity RAB-Identity, cn-DomainIdentity CN-DomainIdentity, nas-Synchronisation-Indicator NAS-Synchronisation-Indicator } RAB-Info-Post ::= SEQUENCE { rab-Identity RAB-Identity, cn-DomainIdentity CN-DomainIdentity, nas-Synchronisation-Indicator NAS-Synchronisation-Indicator OPTIONAL } RAB-InformationSetup ::= SEQUENCE { rab-Info RAB-Info, rb-InformationSetupList RB-InformationSetupList } RAB-InformationSetup-r4 ::= SEQUENCE { rab-Info RAB-Info, rb-InformationSetupList RB-InformationSetupList-r4 } RAB-InformationSetup-r5 ::= SEQUENCE { rab-Info RAB-Info, rb-InformationSetupList RB-InformationSetupList-r5 } RAB-InformationSetup-r6-ext ::= SEQUENCE { rab-Info-r6-ext RAB-Info-r6-ext } RAB-InformationSetup-r6 ::= SEQUENCE { rab-Info RAB-Info-r6, rb-InformationSetupList RB-InformationSetupList-r6 } RAB-InformationSetupList ::= SEQUENCE (SIZE (1..maxRABsetup)) OF RAB-InformationSetup RAB-InformationSetupList-r4 ::= SEQUENCE (SIZE (1..maxRABsetup)) OF RAB-InformationSetup-r4 RAB-InformationSetupList-r5 ::= SEQUENCE (SIZE (1..maxRABsetup)) OF RAB-InformationSetup-r5 RAB-InformationSetupList-r6 ::= SEQUENCE (SIZE (1..maxRABsetup)) OF RAB-InformationSetup-r6 -- The IE 'RAB-InformationSetupList-r6-ext' provides elements of extension information, which -- are added to the corresponding elements of the IE 'RAB-InformationSetupList/-r4/-r5'. RAB-InformationSetupList-r6-ext ::= SEQUENCE (SIZE (1..maxRABsetup)) OF RAB-InformationSetup-r6-ext RB-ActivationTimeInfo ::= SEQUENCE { rb-Identity RB-Identity, rlc-SequenceNumber RLC-SequenceNumber } RB-ActivationTimeInfoList ::= SEQUENCE (SIZE (1..maxRB)) OF RB-ActivationTimeInfo RB-COUNT-C-Information ::= SEQUENCE { rb-Identity RB-Identity, count-C-UL COUNT-C, count-C-DL COUNT-C } RB-COUNT-C-InformationList ::= SEQUENCE (SIZE (1..maxRBallRABs)) OF RB-COUNT-C-Information RB-COUNT-C-MSB-Information ::= SEQUENCE { rb-Identity RB-Identity, count-C-MSB-UL COUNT-C-MSB, count-C-MSB-DL COUNT-C-MSB } RB-COUNT-C-MSB-InformationList ::= SEQUENCE (SIZE (1..maxRBallRABs)) OF RB-COUNT-C-MSB-Information RB-Identity ::= INTEGER (1..32) RB-IdentityList ::= SEQUENCE (SIZE (1..maxRB)) OF RB-Identity RB-InformationAffected ::= SEQUENCE { rb-Identity RB-Identity, rb-MappingInfo RB-MappingInfo } RB-InformationAffected-r5 ::= SEQUENCE { rb-Identity RB-Identity, rb-MappingInfo RB-MappingInfo-r5 } RB-InformationAffected-r6 ::= SEQUENCE { rb-Identity RB-Identity, rb-MappingInfo RB-MappingInfo-r6 } RB-InformationAffectedList ::= SEQUENCE (SIZE (1..maxRB)) OF RB-InformationAffected RB-InformationAffectedList-r5 ::= SEQUENCE (SIZE (1..maxRB)) OF RB-InformationAffected-r5 RB-InformationAffectedList-r6 ::= SEQUENCE (SIZE (1..maxRB)) OF RB-InformationAffected-r6 RB-InformationChanged-r6 ::= SEQUENCE { rb-Identity RB-Identity, rb-Change CHOICE { release NULL, re-mapToDefaultRb RB-Identity } } RB-InformationChangedList-r6 ::= SEQUENCE (SIZE (1..maxRB)) OF RB-InformationChanged-r6 RB-InformationReconfig ::= SEQUENCE { rb-Identity RB-Identity, pdcp-Info PDCP-InfoReconfig OPTIONAL, pdcp-SN-Info PDCP-SN-Info OPTIONAL, rlc-Info RLC-Info OPTIONAL, rb-MappingInfo RB-MappingInfo OPTIONAL, rb-StopContinue RB-StopContinue OPTIONAL } RB-InformationReconfig-r4 ::= SEQUENCE { rb-Identity RB-Identity, pdcp-Info PDCP-InfoReconfig-r4 OPTIONAL, pdcp-SN-Info PDCP-SN-Info OPTIONAL, rlc-Info RLC-Info OPTIONAL, rb-MappingInfo RB-MappingInfo OPTIONAL, rb-StopContinue RB-StopContinue OPTIONAL } RB-InformationReconfig-r5 ::= SEQUENCE { rb-Identity RB-Identity, pdcp-Info PDCP-InfoReconfig-r4 OPTIONAL, pdcp-SN-Info PDCP-SN-Info OPTIONAL, rlc-Info RLC-Info-r5 OPTIONAL, rb-MappingInfo RB-MappingInfo-r5 OPTIONAL, rb-StopContinue RB-StopContinue OPTIONAL } RB-InformationReconfig-r6 ::= SEQUENCE { rb-Identity RB-Identity, pdcp-Info PDCP-InfoReconfig-r4 OPTIONAL, pdcp-SN-Info PDCP-SN-Info OPTIONAL, rlc-Info RLC-Info-r6 OPTIONAL, rb-MappingInfo RB-MappingInfo-r6 OPTIONAL, rb-StopContinue RB-StopContinue OPTIONAL } RB-InformationReconfigList ::= SEQUENCE (SIZE (1..maxRB)) OF RB-InformationReconfig RB-InformationReconfigList-r4 ::= SEQUENCE (SIZE (1..maxRB)) OF RB-InformationReconfig-r4 RB-InformationReconfigList-r5 ::= SEQUENCE (SIZE (1..maxRB)) OF RB-InformationReconfig-r5 RB-InformationReconfigList-r6 ::= SEQUENCE (SIZE (1..maxRB)) OF RB-InformationReconfig-r6 RB-InformationReleaseList ::= SEQUENCE (SIZE (1..maxRB)) OF RB-Identity RB-InformationSetup ::= SEQUENCE { rb-Identity RB-Identity, pdcp-Info PDCP-Info OPTIONAL, rlc-InfoChoice RLC-InfoChoice, rb-MappingInfo RB-MappingInfo } RB-InformationSetup-r4 ::= SEQUENCE { rb-Identity RB-Identity, pdcp-Info PDCP-Info-r4 OPTIONAL, rlc-InfoChoice RLC-InfoChoice, rb-MappingInfo RB-MappingInfo } RB-InformationSetup-r5 ::= SEQUENCE { rb-Identity RB-Identity, pdcp-Info PDCP-Info-r4 OPTIONAL, rlc-InfoChoice RLC-InfoChoice-r5, rb-MappingInfo RB-MappingInfo-r5 } RB-InformationSetup-r6 ::= SEQUENCE { rb-Identity RB-Identity, pdcp-Info PDCP-Info-r4 OPTIONAL, rlc-InfoChoice RLC-InfoChoice-r6, rb-MappingInfo RB-MappingInfo-r6 } RB-InformationSetupList ::= SEQUENCE (SIZE (1..maxRBperRAB)) OF RB-InformationSetup RB-InformationSetupList-r4 ::= SEQUENCE (SIZE (1..maxRBperRAB)) OF RB-InformationSetup-r4 RB-InformationSetupList-r5 ::= SEQUENCE (SIZE (1..maxRBperRAB)) OF RB-InformationSetup-r5 RB-InformationSetupList-r6 ::= SEQUENCE (SIZE (1..maxRBperRAB)) OF RB-InformationSetup-r6 RB-MappingInfo ::= SEQUENCE (SIZE (1..maxRBMuxOptions)) OF RB-MappingOption RB-MappingInfo-r5 ::= SEQUENCE (SIZE (1..maxRBMuxOptions)) OF RB-MappingOption-r5 RB-MappingInfo-r6 ::= SEQUENCE (SIZE (1..maxRBMuxOptions)) OF RB-MappingOption-r6 RB-MappingOption ::= SEQUENCE { ul-LogicalChannelMappings UL-LogicalChannelMappings OPTIONAL, dl-LogicalChannelMappingList DL-LogicalChannelMappingList OPTIONAL } RB-MappingOption-r5 ::= SEQUENCE { ul-LogicalChannelMappings UL-LogicalChannelMappings OPTIONAL, dl-LogicalChannelMappingList DL-LogicalChannelMappingList-r5 OPTIONAL } RB-MappingOption-r6 ::= SEQUENCE { ul-LogicalChannelMappings UL-LogicalChannelMappings-r6 OPTIONAL, dl-LogicalChannelMappingList DL-LogicalChannelMappingList-r5 OPTIONAL } RB-PDCPContextRelocation ::= SEQUENCE { rb-Identity RB-Identity, dl-RFC3095-Context-Relocation BOOLEAN, ul-RFC3095-Context-Relocation BOOLEAN } RB-PDCPContextRelocationList ::= SEQUENCE (SIZE (1..maxRBallRABs)) OF RB-PDCPContextRelocation RB-StopContinue ::= ENUMERATED { stopRB, continueRB } RB-WithPDCP-Info ::= SEQUENCE { rb-Identity RB-Identity, pdcp-SN-Info PDCP-SN-Info } RB-WithPDCP-InfoList ::= SEQUENCE (SIZE (1..maxRBallRABs)) OF RB-WithPDCP-Info ReceivingWindowSize ::= ENUMERATED { rw1, rw8, rw16, rw32, rw64, rw128, rw256, rw512, rw768, rw1024, rw1536, rw2047, rw2560, rw3072, rw3584, rw4095 } RFC2507-Info ::= SEQUENCE { f-MAX-PERIOD INTEGER (1..65535) DEFAULT 256, f-MAX-TIME INTEGER (1..255) DEFAULT 5, max-HEADER INTEGER (60..65535) DEFAULT 168, tcp-SPACE INTEGER (3..255) DEFAULT 15, non-TCP-SPACE INTEGER (3..65535) DEFAULT 15, -- TABULAR: expectReordering has only two possible values, so using Optional or Default -- would be wasteful expectReordering ExpectReordering } RFC3095-Info-r4 ::= SEQUENCE { rohcProfileList ROHC-ProfileList-r4, ul-RFC3095 UL-RFC3095-r4 OPTIONAL, dl-RFC3095 DL-RFC3095-r4 OPTIONAL } RLC-Info ::= SEQUENCE { ul-RLC-Mode UL-RLC-Mode OPTIONAL, dl-RLC-Mode DL-RLC-Mode OPTIONAL } RLC-Info-r5 ::= SEQUENCE { ul-RLC-Mode UL-RLC-Mode OPTIONAL, dl-RLC-Mode DL-RLC-Mode-r5 OPTIONAL, rlc-OneSidedReEst BOOLEAN } RLC-Info-r6 ::= SEQUENCE { ul-RLC-Mode UL-RLC-Mode OPTIONAL, dl-RLC-Mode DL-RLC-Mode-r6 OPTIONAL, rlc-OneSidedReEst BOOLEAN, altE-bitInterpretation ENUMERATED { true } OPTIONAL } RLC-Info-MCCH-r6 ::= SEQUENCE { dl-UM-RLC-LI-size DL-UM-RLC-LI-size, dl-UM-RLC-OutOSeqDelivery-Info UM-RLC-OutOSeqDelivery-Info-r6 OPTIONAL } RLC-Info-MSCH-r6 ::= SEQUENCE { dl-UM-RLC-LI-size DL-UM-RLC-LI-size } RLC-Info-MTCH-r6 ::= SEQUENCE { dl-UM-RLC-LI-size DL-UM-RLC-LI-size, dl-UM-RLC-DuplAvoid-Reord-Info UM-RLC-DuplAvoid-Reord-Info-r6 OPTIONAL } RLC-InfoChoice ::= CHOICE { rlc-Info RLC-Info, same-as-RB RB-Identity } RLC-InfoChoice-r5 ::= CHOICE { rlc-Info RLC-Info-r5, same-as-RB RB-Identity } RLC-InfoChoice-r6 ::= CHOICE { rlc-Info RLC-Info-r6, same-as-RB RB-Identity } RLC-PDU-Size ::= OctetModeRLC-SizeInfoType1 RLC-PDU-SizeList ::= SEQUENCE (SIZE (1..maxRLCPDUsizePerLogChan)) OF RLC-PDU-Size RLC-SequenceNumber ::= INTEGER (0..4095) RLC-SizeInfo ::= SEQUENCE { rlc-SizeIndex INTEGER (1..maxTF) } RLC-SizeExplicitList ::= SEQUENCE (SIZE (1..maxTF)) OF RLC-SizeInfo ROHC-Profile-r4 ::= INTEGER (1..3) ROHC-ProfileList-r4 ::= SEQUENCE (SIZE (1..maxROHC-Profile-r4)) OF ROHC-Profile-r4 ROHC-PacketSize-r4 ::= INTEGER (2..1500) ROHC-PacketSizeList-r4 ::= SEQUENCE (SIZE (1..maxROHC-PacketSizes-r4)) OF ROHC-PacketSize-r4 SRB-InformationSetup ::= SEQUENCE { -- The default value for rb-Identity is the smallest value not used yet. rb-Identity RB-Identity OPTIONAL, rlc-InfoChoice RLC-InfoChoice, rb-MappingInfo RB-MappingInfo } SRB-InformationSetup-r5 ::= SEQUENCE { -- The default value for rb-Identity is the smallest value not used yet. rb-Identity RB-Identity OPTIONAL, rlc-InfoChoice RLC-InfoChoice-r5, rb-MappingInfo RB-MappingInfo-r5 } SRB-InformationSetup-r6 ::= SEQUENCE { -- The default value for rb-Identity is the smallest value not used yet. rb-Identity RB-Identity OPTIONAL, rlc-InfoChoice RLC-InfoChoice-r6, rb-MappingInfo RB-MappingInfo-r6 } SRB-InformationSetupList ::= SEQUENCE (SIZE (1..maxSRBsetup)) OF SRB-InformationSetup SRB-InformationSetupList-r5 ::= SEQUENCE (SIZE (1..maxSRBsetup)) OF SRB-InformationSetup-r5 SRB-InformationSetupList-r6 ::= SEQUENCE (SIZE (1..maxSRBsetup)) OF SRB-InformationSetup-r6 SRB-InformationSetupList2 ::= SEQUENCE (SIZE (3..4)) OF SRB-InformationSetup SRB-InformationSetupList2-r6 ::= SEQUENCE (SIZE (3..4)) OF SRB-InformationSetup-r6 TimerDAR-r6 ::= ENUMERATED { ms40, ms80, ms120, ms160, ms240, ms320, ms480, ms640, ms960, ms1280, ms1920, ms2560, ms3840, ms5120 } TimerDiscard ::= ENUMERATED { td0-1, td0-25, td0-5, td0-75, td1, td1-25, td1-5, td1-75, td2, td2-5, td3, td3-5, td4, td4-5, td5, td7-5 } TimerEPC ::= ENUMERATED { te50, te60, te70, te80, te90, te100, te120, te140, te160, te180, te200, te300, te400, te500, te700, te900 } TimerMRW ::= ENUMERATED { te50, te60, te70, te80, te90, te100, te120, te140, te160, te180, te200, te300, te400, te500, te700, te900 } TimerOSD-r6 ::= ENUMERATED { ms40, ms80, ms120, ms160, ms240, ms320, ms480, ms640, ms960, ms1280, ms1920, ms2560, ms3840, ms5120 } TimerPoll ::= ENUMERATED { tp10, tp20, tp30, tp40, tp50, tp60, tp70, tp80, tp90, tp100, tp110, tp120, tp130, tp140, tp150, tp160, tp170, tp180, tp190, tp200, tp210, tp220, tp230, tp240, tp250, tp260, tp270, tp280, tp290, tp300, tp310, tp320, tp330, tp340, tp350, tp360, tp370, tp380, tp390, tp400, tp410, tp420, tp430, tp440, tp450, tp460, tp470, tp480, tp490, tp500, tp510, tp520, tp530, tp540, tp550, tp600, tp650, tp700, tp750, tp800, tp850, tp900, tp950, tp1000 } TimerPollPeriodic ::= ENUMERATED { tper100, tper200, tper300, tper400, tper500, tper750, tper1000, tper2000 } TimerPollProhibit ::= ENUMERATED { tpp10, tpp20, tpp30, tpp40, tpp50, tpp60, tpp70, tpp80, tpp90, tpp100, tpp110, tpp120, tpp130, tpp140, tpp150, tpp160, tpp170, tpp180, tpp190, tpp200, tpp210, tpp220, tpp230, tpp240, tpp250, tpp260, tpp270, tpp280, tpp290, tpp300, tpp310, tpp320, tpp330, tpp340, tpp350, tpp360, tpp370, tpp380, tpp390, tpp400, tpp410, tpp420, tpp430, tpp440, tpp450, tpp460, tpp470, tpp480, tpp490, tpp500, tpp510, tpp520, tpp530, tpp540, tpp550, tpp600, tpp650, tpp700, tpp750, tpp800, tpp850, tpp900, tpp950, tpp1000 } TimerRST ::= ENUMERATED { tr50, tr100, tr150, tr200, tr250, tr300, tr350, tr400, tr450, tr500, tr550, tr600, tr700, tr800, tr900, tr1000 } TimerStatusPeriodic ::= ENUMERATED { tsp100, tsp200, tsp300, tsp400, tsp500, tsp750, tsp1000, tsp2000 } TimerStatusProhibit ::= ENUMERATED { tsp10,tsp20,tsp30,tsp40,tsp50, tsp60,tsp70,tsp80,tsp90,tsp100, tsp110,tsp120,tsp130,tsp140,tsp150, tsp160,tsp170,tsp180,tsp190,tsp200, tsp210,tsp220,tsp230,tsp240,tsp250, tsp260,tsp270,tsp280,tsp290,tsp300, tsp310,tsp320,tsp330,tsp340,tsp350, tsp360,tsp370,tsp380,tsp390,tsp400, tsp410,tsp420,tsp430,tsp440,tsp450, tsp460,tsp470,tsp480,tsp490,tsp500, tsp510,tsp520,tsp530,tsp540,tsp550, tsp600,tsp650,tsp700,tsp750,tsp800, tsp850,tsp900,tsp950,tsp1000 } TransmissionRLC-Discard ::= CHOICE { timerBasedExplicit ExplicitDiscard, timerBasedNoExplicit NoExplicitDiscard, maxDAT-Retransmissions MaxDAT-Retransmissions, noDiscard MaxDAT } TransmissionWindowSize ::= ENUMERATED { tw1, tw8, tw16, tw32, tw64, tw128, tw256, tw512, tw768, tw1024, tw1536, tw2047, tw2560, tw3072, tw3584, tw4095 } UL-AM-RLC-Mode ::= SEQUENCE { transmissionRLC-Discard TransmissionRLC-Discard, transmissionWindowSize TransmissionWindowSize, timerRST TimerRST, max-RST MaxRST, pollingInfo PollingInfo OPTIONAL } UL-CounterSynchronisationInfo ::= SEQUENCE { rB-WithPDCP-InfoList RB-WithPDCP-InfoList OPTIONAL, startList STARTList } UL-LogicalChannelMapping ::= SEQUENCE { -- TABULAR: UL-TransportChannelType contains TransportChannelIdentity as well. ul-TransportChannelType UL-TransportChannelType, logicalChannelIdentity LogicalChannelIdentity OPTIONAL, rlc-SizeList CHOICE { allSizes NULL, configured NULL, explicitList RLC-SizeExplicitList }, mac-LogicalChannelPriority MAC-LogicalChannelPriority } UL-LogicalChannelMapping-r6 ::= SEQUENCE { ul-TrCH-Type CHOICE { dch-rach-usch SEQUENCE { -- TABULAR: UL-TransportChannelType contains TransportChannelIdentity as well. ul-TransportChannelType UL-TransportChannelType, logicalChannelIdentity LogicalChannelIdentity OPTIONAL, rlc-SizeList CHOICE { allSizes NULL, configured NULL, explicitList RLC-SizeExplicitList } }, e-dch SEQUENCE { logicalChannelIdentity LogicalChannelIdentity, e-DCH-MAC-d-FlowIdentity E-DCH-MAC-d-FlowIdentity, ddi DDI, rlc-PDU-SizeList RLC-PDU-SizeList, includeInSchedulingInfo BOOLEAN } }, mac-LogicalChannelPriority MAC-LogicalChannelPriority } UL-LogicalChannelMappingList ::= SEQUENCE { -- rlc-LogicalChannelMappingIndicator shall be set to TRUE in this version -- of the specification rlc-LogicalChannelMappingIndicator BOOLEAN, ul-LogicalChannelMapping SEQUENCE (SIZE (maxLoCHperRLC)) OF UL-LogicalChannelMapping } UL-LogicalChannelMappingList-r6 ::= SEQUENCE { -- rlc-LogicalChannelMappingIndicator shall be set to TRUE in this version -- of the specification rlc-LogicalChannelMappingIndicator BOOLEAN, ul-LogicalChannelMapping SEQUENCE (SIZE (maxLoCHperRLC)) OF UL-LogicalChannelMapping-r6 } UL-LogicalChannelMappings ::= CHOICE { oneLogicalChannel UL-LogicalChannelMapping, twoLogicalChannels UL-LogicalChannelMappingList } UL-LogicalChannelMappings-r6 ::= CHOICE { oneLogicalChannel UL-LogicalChannelMapping-r6, twoLogicalChannels UL-LogicalChannelMappingList-r6 } UL-RFC3095-r4 ::= SEQUENCE { cid-InclusionInfo CID-InclusionInfo-r4, max-CID INTEGER (1..16383) DEFAULT 15, -- dummy is not used in this version of the specification and -- it should be ignored by the receiver. dummy ROHC-PacketSizeList-r4 } UL-RLC-Mode ::= CHOICE { ul-AM-RLC-Mode UL-AM-RLC-Mode, ul-UM-RLC-Mode UL-UM-RLC-Mode, ul-TM-RLC-Mode UL-TM-RLC-Mode, spare NULL } UL-TM-RLC-Mode ::= SEQUENCE { transmissionRLC-Discard TransmissionRLC-Discard OPTIONAL, segmentationIndication BOOLEAN } UL-UM-RLC-Mode ::= SEQUENCE { transmissionRLC-Discard TransmissionRLC-Discard OPTIONAL } UL-TransportChannelType ::= CHOICE { dch TransportChannelIdentity, rach NULL, -- dummy is not used in this version of the specification and -- if received the UE behaviour is not specified. dummy NULL, usch TransportChannelIdentity } UM-RLC-DuplAvoid-Reord-Info-r6 ::= SEQUENCE { timer-DAR TimerDAR-r6, widowSize-DAR WindowSizeDAR-r6 } UM-RLC-OutOSeqDelivery-Info-r6 ::= SEQUENCE { timer-OSD TimerOSD-r6 OPTIONAL, windowSize-OSD WindowSizeOSD-r6 } WindowSizeDAR-r6 ::= ENUMERATED { ws4, ws8, ws16, ws32, ws40, ws48, ws56, ws64 } WindowSizeOSD-r6 ::= ENUMERATED { ws8, ws16, ws32, ws40, ws48, ws56, ws64 } -- *************************************************** -- -- TRANSPORT CHANNEL INFORMATION ELEMENTS (10.3.5) -- -- *************************************************** AddOrReconfMAC-dFlow ::= SEQUENCE { mac-hs-AddReconfQueue-List MAC-hs-AddReconfQueue-List OPTIONAL, mac-hs-DelQueue-List MAC-hs-DelQueue-List OPTIONAL } AllowedTFC-List ::= SEQUENCE (SIZE (1..maxTFC)) OF TFC-Value AllowedTFI-List ::= SEQUENCE (SIZE (1..maxTF)) OF INTEGER (0..31) BitModeRLC-SizeInfo ::= CHOICE { sizeType1 INTEGER (0..127), -- Actual value sizeType2 = (part1 * 8) + 128 + part2 sizeType2 SEQUENCE { part1 INTEGER (0..15), part2 INTEGER (1..7) OPTIONAL }, -- Actual value sizeType3 = (part1 * 16) + 256 + part2 sizeType3 SEQUENCE { part1 INTEGER (0..47), part2 INTEGER (1..15) OPTIONAL }, -- Actual value sizeType4 = (part1 * 64) + 1024 + part2 sizeType4 SEQUENCE { part1 INTEGER (0..62), part2 INTEGER (1..63) OPTIONAL } } -- Actual value BLER-QualityValue = IE value * 0.1 BLER-QualityValue ::= INTEGER (-63..0) ChannelCodingType ::= CHOICE { -- noCoding is only used for TDD in this version of the specification, -- otherwise it should be ignored noCoding NULL, convolutional CodingRate, turbo NULL } CodingRate ::= ENUMERATED { half, third } CommonDynamicTF-Info ::= SEQUENCE { rlc-Size CHOICE { fdd SEQUENCE { octetModeRLC-SizeInfoType2 OctetModeRLC-SizeInfoType2 }, tdd SEQUENCE { commonTDD-Choice CHOICE { bitModeRLC-SizeInfo BitModeRLC-SizeInfo, octetModeRLC-SizeInfoType1 OctetModeRLC-SizeInfoType1 } } }, numberOfTbSizeList SEQUENCE (SIZE (1..maxTF)) OF NumberOfTransportBlocks, logicalChannelList LogicalChannelList } CommonDynamicTF-Info-DynamicTTI ::= SEQUENCE { commonTDD-Choice CHOICE { bitModeRLC-SizeInfo BitModeRLC-SizeInfo, octetModeRLC-SizeInfoType1 OctetModeRLC-SizeInfoType1 }, numberOfTbSizeAndTTIList NumberOfTbSizeAndTTIList, logicalChannelList LogicalChannelList } CommonDynamicTF-InfoList ::= SEQUENCE (SIZE (1..maxTF)) OF CommonDynamicTF-Info CommonDynamicTF-InfoList-DynamicTTI ::= SEQUENCE (SIZE (1..maxTF)) OF CommonDynamicTF-Info-DynamicTTI CommonTransChTFS ::= SEQUENCE { tti CHOICE { tti10 CommonDynamicTF-InfoList, tti20 CommonDynamicTF-InfoList, tti40 CommonDynamicTF-InfoList, tti80 CommonDynamicTF-InfoList, dynamic CommonDynamicTF-InfoList-DynamicTTI }, semistaticTF-Information SemistaticTF-Information } CommonTransChTFS-LCR ::= SEQUENCE { tti CHOICE { tti5 CommonDynamicTF-InfoList, tti10 CommonDynamicTF-InfoList, tti20 CommonDynamicTF-InfoList, tti40 CommonDynamicTF-InfoList, tti80 CommonDynamicTF-InfoList, dynamic CommonDynamicTF-InfoList-DynamicTTI }, semistaticTF-Information SemistaticTF-Information } CPCH-SetID ::= INTEGER (1..maxCPCHsets) CRC-Size ::= ENUMERATED { crc0, crc8, crc12, crc16, crc24 } DedicatedDynamicTF-Info ::= SEQUENCE { rlc-Size CHOICE { bitMode BitModeRLC-SizeInfo, octetModeType1 OctetModeRLC-SizeInfoType1 }, numberOfTbSizeList SEQUENCE (SIZE (1..maxTF)) OF NumberOfTransportBlocks, logicalChannelList LogicalChannelList } DedicatedDynamicTF-Info-DynamicTTI ::= SEQUENCE { rlc-Size CHOICE { bitMode BitModeRLC-SizeInfo, octetModeType1 OctetModeRLC-SizeInfoType1 }, numberOfTbSizeAndTTIList NumberOfTbSizeAndTTIList, logicalChannelList LogicalChannelList } DedicatedDynamicTF-InfoList ::= SEQUENCE (SIZE (1..maxTF)) OF DedicatedDynamicTF-Info DedicatedDynamicTF-InfoList-DynamicTTI ::= SEQUENCE (SIZE (1..maxTF)) OF DedicatedDynamicTF-Info-DynamicTTI DedicatedTransChTFS ::= SEQUENCE { tti CHOICE { tti10 DedicatedDynamicTF-InfoList, tti20 DedicatedDynamicTF-InfoList, tti40 DedicatedDynamicTF-InfoList, tti80 DedicatedDynamicTF-InfoList, dynamic DedicatedDynamicTF-InfoList-DynamicTTI }, semistaticTF-Information SemistaticTF-Information } -- The maximum allowed size of DL-AddReconfTransChInfo2List sequence is 16 DL-AddReconfTransChInfo2List ::= SEQUENCE (SIZE (1..maxTrCHpreconf)) OF DL-AddReconfTransChInformation2 -- The maximum allowed size of DL-AddReconfTransChInfoList sequence is 16 DL-AddReconfTransChInfoList ::= SEQUENCE (SIZE (1..maxTrCHpreconf)) OF DL-AddReconfTransChInformation -- The maximum allowed size of DL-AddReconfTransChInfoList-r4 sequence is 16 DL-AddReconfTransChInfoList-r4 ::= SEQUENCE (SIZE (1..maxTrCHpreconf)) OF DL-AddReconfTransChInformation-r4 -- The maximum allowed size of DL-AddReconfTransChInfoList-r5 sequence is 16 DL-AddReconfTransChInfoList-r5 ::= SEQUENCE (SIZE (1..maxTrCHpreconf)) OF DL-AddReconfTransChInformation-r5 -- ASN.1 for IE "Added or Reconfigured DL TrCH information" -- in case of messages other than: Radio Bearer Release message and -- Radio Bearer Reconfiguration message DL-AddReconfTransChInformation ::= SEQUENCE { dl-TransportChannelType DL-TrCH-Type, dl-transportChannelIdentity TransportChannelIdentity, tfs-SignallingMode CHOICE { explicit-config TransportFormatSet, sameAsULTrCH UL-TransportChannelIdentity }, dch-QualityTarget QualityTarget OPTIONAL, -- dummy is not used in this version of the specification, it should -- not be sent and if received it should be ignored. dummy TM-SignallingInfo OPTIONAL } DL-AddReconfTransChInformation-r4 ::= SEQUENCE { dl-TransportChannelType DL-TrCH-Type, dl-transportChannelIdentity TransportChannelIdentity, tfs-SignallingMode CHOICE { explicit-config TransportFormatSet, sameAsULTrCH UL-TransportChannelIdentity }, dch-QualityTarget QualityTarget OPTIONAL } DL-AddReconfTransChInformation-r5 ::= SEQUENCE { dl-TransportChannelType DL-TrCH-TypeId1-r5, tfs-SignallingMode CHOICE { explicit-config TransportFormatSet, sameAsULTrCH UL-TransportChannelIdentity, hsdsch HSDSCH-Info }, dch-QualityTarget QualityTarget OPTIONAL } -- ASN.1 for IE "Added or Reconfigured DL TrCH information" -- in case of Radio Bearer Release message and -- Radio Bearer Reconfiguration message DL-AddReconfTransChInformation2 ::= SEQUENCE { dl-TransportChannelType DL-TrCH-Type, transportChannelIdentity TransportChannelIdentity, tfs-SignallingMode CHOICE { explicit-config TransportFormatSet, sameAsULTrCH UL-TransportChannelIdentity }, qualityTarget QualityTarget OPTIONAL } DL-CommonTransChInfo ::= SEQUENCE { sccpch-TFCS TFCS OPTIONAL, -- modeSpecificInfo should be optional. A new version of this IE should be defined -- to be used in later versions of messages using this IE modeSpecificInfo CHOICE { fdd SEQUENCE { dl-Parameters CHOICE { dl-DCH-TFCS TFCS, sameAsUL NULL } OPTIONAL }, tdd SEQUENCE { individualDL-CCTrCH-InfoList IndividualDL-CCTrCH-InfoList OPTIONAL } } } DL-CommonTransChInfo-r4 ::= SEQUENCE { sccpch-TFCS TFCS OPTIONAL, modeSpecificInfo CHOICE { fdd SEQUENCE { dl-Parameters CHOICE { dl-DCH-TFCS SEQUENCE { tfcs TFCS OPTIONAL }, sameAsUL NULL } OPTIONAL }, tdd SEQUENCE { individualDL-CCTrCH-InfoList IndividualDL-CCTrCH-InfoList OPTIONAL } } OPTIONAL } DL-DeletedTransChInfoList ::= SEQUENCE (SIZE (1..maxTrCH)) OF DL-TransportChannelIdentity DL-DeletedTransChInfoList-r5 ::= SEQUENCE (SIZE (1..maxTrCH)) OF DL-TransportChannelIdentity-r5 DL-TransportChannelIdentity ::= SEQUENCE { dl-TransportChannelType DL-TrCH-Type, dl-TransportChannelIdentity TransportChannelIdentity } DL-TransportChannelIdentity-r5 ::= SEQUENCE { dl-TransportChannelType DL-TrCH-TypeId2-r5 } -- The choice 窶彭sch窶 should not be used in FDD mode, and if received the UE behaviour is unspecified DL-TrCH-Type ::= ENUMERATED {dch, dsch} DL-TrCH-TypeId1-r5 ::= CHOICE { dch TransportChannelIdentity, -- The choice 窶彭sch窶 should not be used in FDD mode, and if received -- the UE behaviour is unspecified. dsch TransportChannelIdentity, hsdsch NULL } DL-TrCH-TypeId2-r5 ::= CHOICE { dch TransportChannelIdentity, -- The choice 窶彭sch窶 should not be used in FDD mode, and if received -- the UE behaviour is unspecified. dsch TransportChannelIdentity, hsdsch MAC-d-FlowIdentity } DRAC-ClassIdentity ::= INTEGER (1..maxDRACclasses) DRAC-StaticInformation ::= SEQUENCE { transmissionTimeValidity TransmissionTimeValidity, timeDurationBeforeRetry TimeDurationBeforeRetry, drac-ClassIdentity DRAC-ClassIdentity } DRAC-StaticInformationList ::= SEQUENCE (SIZE (1..maxTrCH)) OF DRAC-StaticInformation E-DCH-AddReconf-MAC-d-Flow ::= SEQUENCE { mac-d-FlowIdentity E-DCH-MAC-d-FlowIdentity, mac-d-FlowPowerOffset E-DCH-MAC-d-FlowPowerOffset OPTIONAL, mac-d-FlowMaxRetrans E-DCH-MAC-d-FlowMaxRetrans OPTIONAL, mac-d-FlowMultiplexingList E-DCH-MAC-d-FlowMultiplexingList OPTIONAL, transmissionGrantType CHOICE { non-ScheduledTransGrantInfo SEQUENCE { maxMAC-e-PDUContents INTEGER (1..19982), ms2-NonSchedTransmGrantHARQAlloc BIT STRING (SIZE (8)) OPTIONAL }, scheduledTransmissionGrantInfo NULL } OPTIONAL } E-DCH-AddReconf-MAC-d-FlowList ::= SEQUENCE (SIZE (1..maxE-DCHMACdFlow)) OF E-DCH-AddReconf-MAC-d-Flow E-DCH-MAC-d-FlowIdentity ::= INTEGER (0..maxE-DCHMACdFlow-1) E-DCH-MAC-d-FlowMaxRetrans ::= INTEGER (0..15) E-DCH-MAC-d-FlowMultiplexingList ::= BIT STRING (SIZE (maxE-DCHMACdFlow)) E-DCH-MAC-d-FlowPowerOffset ::= INTEGER (0..6) E-DCH-TTI ::= ENUMERATED { tti2, tti10 } ExplicitTFCS-Configuration ::= CHOICE { complete TFCS-ReconfAdd, addition TFCS-ReconfAdd, removal TFCS-RemovalList, replacement SEQUENCE { tfcsRemoval TFCS-RemovalList, tfcsAdd TFCS-ReconfAdd } } GainFactor ::= INTEGER (0..15) GainFactorInformation ::= CHOICE { signalledGainFactors SignalledGainFactors, computedGainFactors ReferenceTFC-ID } HSDSCH-Info ::= SEQUENCE { harqInfo HARQ-Info OPTIONAL, addOrReconfMAC-dFlow AddOrReconfMAC-dFlow OPTIONAL } HARQ-Info ::= SEQUENCE { numberOfProcesses INTEGER (1..8), memoryPartitioning CHOICE { implicit NULL, explicit SEQUENCE (SIZE (1..maxHProcesses)) OF HARQMemorySize } } HARQMemorySize ::= ENUMERATED { hms800, hms1600, hms2400, hms3200, hms4000, hms4800, hms5600, hms6400, hms7200, hms8000, hms8800, hms9600, hms10400, hms11200, hms12000, hms12800, hms13600, hms14400, hms15200, hms16000, hms17600, hms19200, hms20800, hms22400, hms24000, hms25600, hms27200, hms28800, hms30400, hms32000, hms36000, hms40000, hms44000, hms48000, hms52000, hms56000, hms60000, hms64000, hms68000, hms72000, hms76000, hms80000, hms88000, hms96000, hms104000, hms112000, hms120000, hms128000, hms136000, hms144000, hms152000, hms160000, hms176000, hms192000, hms208000, hms224000, hms240000, hms256000, hms272000, hms288000, hms304000 } IndividualDL-CCTrCH-Info ::= SEQUENCE { dl-TFCS-Identity TFCS-Identity, tfcs-SignallingMode CHOICE { explicit-config TFCS, sameAsUL TFCS-Identity } } IndividualDL-CCTrCH-InfoList ::= SEQUENCE (SIZE (1..maxCCTrCH)) OF IndividualDL-CCTrCH-Info IndividualUL-CCTrCH-Info ::= SEQUENCE { ul-TFCS-Identity TFCS-Identity, ul-TFCS TFCS , tfc-Subset TFC-Subset } IndividualUL-CCTrCH-InfoList ::= SEQUENCE (SIZE (1..maxCCTrCH)) OF IndividualUL-CCTrCH-Info LogicalChannelByRB ::= SEQUENCE { rb-Identity RB-Identity, logChOfRb INTEGER (0..1) OPTIONAL } LogicalChannelList ::= CHOICE { allSizes NULL, configured NULL, explicitList SEQUENCE (SIZE (1..15)) OF LogicalChannelByRB } MAC-d-FlowIdentityDCHandHSDSCH ::= SEQUENCE { dch-transport-ch-id TransportChannelIdentity, hsdsch-mac-d-flow-id MAC-d-FlowIdentity } MAC-d-FlowIdentity ::= INTEGER (0..7) MAC-d-PDU-SizeInfo-List ::= SEQUENCE (SIZE(1.. maxMAC-d-PDUsizes)) OF MAC-d-PDUsizeInfo --MAC-d-Pdu sizes need to be defined MAC-d-PDUsizeInfo ::= SEQUENCE{ mac-d-PDU-Size INTEGER (1..5000), mac-d-PDU-Index INTEGER(0..7) } MAC-hs-AddReconfQueue-List ::= SEQUENCE (SIZE(1..maxQueueIDs)) OF MAC-hs-AddReconfQueue MAC-hs-AddReconfQueue ::= SEQUENCE { mac-hsQueueId INTEGER(0..7), mac-dFlowId MAC-d-FlowIdentity, reorderingReleaseTimer T1-ReleaseTimer, mac-hsWindowSize MAC-hs-WindowSize, mac-d-PDU-SizeInfo-List MAC-d-PDU-SizeInfo-List OPTIONAL } MAC-hs-DelQueue-List ::= SEQUENCE (SIZE(1..maxQueueIDs)) OF MAC-hs-DelQueue MAC-hs-DelQueue ::= SEQUENCE { mac-hsQueueId INTEGER(0..7) } MAC-hs-WindowSize ::= ENUMERATED { mws4, mws6, mws8, mws12, mws16, mws24, mws32 } NumberOfTbSizeAndTTIList ::= SEQUENCE (SIZE (1..maxTF)) OF SEQUENCE { numberOfTransportBlocks NumberOfTransportBlocks, transmissionTimeInterval TransmissionTimeInterval } MessType ::= ENUMERATED { transportFormatCombinationControl } Non-allowedTFC-List ::= SEQUENCE (SIZE (1..maxTFC)) OF TFC-Value NumberOfTransportBlocks ::= CHOICE { zero NULL, one NULL, small INTEGER (2..17), large INTEGER (18..512) } OctetModeRLC-SizeInfoType1 ::= CHOICE { -- Actual size = (8 * sizeType1) + 16 sizeType1 INTEGER (0..31), sizeType2 SEQUENCE { -- Actual size = (32 * part1) + 272 + (part2 * 8) part1 INTEGER (0..23), part2 INTEGER (1..3) OPTIONAL }, sizeType3 SEQUENCE { -- Actual size = (64 * part1) + 1040 + (part2 * 8) part1 INTEGER (0..61), part2 INTEGER (1..7) OPTIONAL } } OctetModeRLC-SizeInfoType2 ::= CHOICE { -- Actual size = (sizeType1 * 8) + 48 sizeType1 INTEGER (0..31), -- Actual size = (sizeType2 * 16) + 312 sizeType2 INTEGER (0..63), -- Actual size = (sizeType3 *64) + 1384 sizeType3 INTEGER (0..56) } PowerOffsetInfoShort ::= SEQUENCE { referenceTFC TFC-Value, modeSpecificInfo CHOICE { fdd SEQUENCE { gainFactorBetaC GainFactor }, tdd NULL }, gainFactorBetaD GainFactor } PowerOffsetInformation ::= SEQUENCE { gainFactorInformation GainFactorInformation, -- PowerOffsetPp-m is always absent in TDD powerOffsetPp-m PowerOffsetPp-m OPTIONAL } PowerOffsetPp-m ::= INTEGER (-5..10) PreDefTransChConfiguration ::= SEQUENCE { ul-CommonTransChInfo UL-CommonTransChInfo, ul-AddReconfTrChInfoList UL-AddReconfTransChInfoList, dl-CommonTransChInfo DL-CommonTransChInfo, dl-TrChInfoList DL-AddReconfTransChInfoList } QualityTarget ::= SEQUENCE { bler-QualityValue BLER-QualityValue } RateMatchingAttribute ::= INTEGER (1..hiRM) ReferenceTFC-ID ::= INTEGER (0..3) RestrictedTrChInfo ::= SEQUENCE { ul-TransportChannelType UL-TrCH-Type, restrictedTrChIdentity TransportChannelIdentity, allowedTFI-List AllowedTFI-List OPTIONAL } RestrictedTrChInfoList ::= SEQUENCE (SIZE (1..maxTrCH)) OF RestrictedTrChInfo SemistaticTF-Information ::= SEQUENCE { -- TABULAR: Transmission time interval has been included in the IE CommonTransChTFS. channelCodingType ChannelCodingType, rateMatchingAttribute RateMatchingAttribute, crc-Size CRC-Size } SignalledGainFactors ::= SEQUENCE { modeSpecificInfo CHOICE { fdd SEQUENCE { gainFactorBetaC GainFactor }, tdd NULL }, gainFactorBetaD GainFactor, referenceTFC-ID ReferenceTFC-ID OPTIONAL } SplitTFCI-Signalling ::= SEQUENCE { splitType SplitType OPTIONAL, tfci-Field2-Length INTEGER (1..10) OPTIONAL, tfci-Field1-Information ExplicitTFCS-Configuration OPTIONAL, tfci-Field2-Information TFCI-Field2-Information OPTIONAL } SplitType ::= ENUMERATED { hardSplit, logicalSplit } T1-ReleaseTimer ::= ENUMERATED { rt10, rt20, rt30, rt40, rt50, rt60, rt70, rt80, rt90, rt100, rt120, rt140, rt160, rt200, rt300, rt400 } TFC-Subset ::= CHOICE { minimumAllowedTFC-Number TFC-Value, allowedTFC-List AllowedTFC-List, non-allowedTFC-List Non-allowedTFC-List, restrictedTrChInfoList RestrictedTrChInfoList, fullTFCS NULL } TFC-SubsetList ::= SEQUENCE (SIZE (1.. maxTFCsub)) OF SEQUENCE { modeSpecificInfo CHOICE { fdd NULL, tdd SEQUENCE { tfcs-ID TFCS-Identity OPTIONAL } }, tfc-Subset TFC-Subset } TFC-Value ::= INTEGER (0..1023) TFCI-Field2-Information ::= CHOICE { tfci-Range TFCI-RangeList, explicit-config ExplicitTFCS-Configuration } TFCI-Range ::= SEQUENCE { maxTFCIField2Value INTEGER (1..1023), tfcs-InfoForDSCH TFCS-InfoForDSCH } TFCI-RangeList ::= SEQUENCE (SIZE (1..maxPDSCH-TFCIgroups)) OF TFCI-Range TFCS ::= CHOICE { normalTFCI-Signalling ExplicitTFCS-Configuration, -- dummy is not used in this version of specification, it should -- not be sent and if received the UE behaviour is not specified. dummy SplitTFCI-Signalling } TFCS-Identity ::= SEQUENCE { tfcs-ID TFCS-IdentityPlain DEFAULT 1, sharedChannelIndicator BOOLEAN } TFCS-IdentityPlain ::= INTEGER (1..8) TFCS-InfoForDSCH ::= CHOICE { ctfc2bit INTEGER (0..3), ctfc4bit INTEGER (0..15), ctfc6bit INTEGER (0..63), ctfc8bit INTEGER (0..255), ctfc12bit INTEGER (0..4095), ctfc16bit INTEGER (0..65535), ctfc24bit INTEGER (0..16777215) } TFCS-ReconfAdd ::= SEQUENCE{ ctfcSize CHOICE{ ctfc2Bit SEQUENCE (SIZE (1..maxTFC)) OF SEQUENCE { ctfc2 INTEGER (0..3), powerOffsetInformation PowerOffsetInformation OPTIONAL }, ctfc4Bit SEQUENCE (SIZE (1..maxTFC)) OF SEQUENCE { ctfc4 INTEGER (0..15), powerOffsetInformation PowerOffsetInformation OPTIONAL }, ctfc6Bit SEQUENCE (SIZE (1..maxTFC)) OF SEQUENCE { ctfc6 INTEGER (0..63), powerOffsetInformation PowerOffsetInformation OPTIONAL }, ctfc8Bit SEQUENCE (SIZE (1..maxTFC)) OF SEQUENCE { ctfc8 INTEGER (0..255), powerOffsetInformation PowerOffsetInformation OPTIONAL }, ctfc12Bit SEQUENCE (SIZE(1..maxTFC)) OF SEQUENCE { ctfc12 INTEGER (0..4095), powerOffsetInformation PowerOffsetInformation OPTIONAL }, ctfc16Bit SEQUENCE (SIZE (1..maxTFC)) OF SEQUENCE { ctfc16 INTEGER(0..65535), powerOffsetInformation PowerOffsetInformation OPTIONAL }, ctfc24Bit SEQUENCE (SIZE (1..maxTFC)) OF SEQUENCE { ctfc24 INTEGER(0..16777215), powerOffsetInformation PowerOffsetInformation OPTIONAL } } } TFCS-Removal ::= SEQUENCE { tfci INTEGER (0..1023) } TFCS-RemovalList ::= SEQUENCE (SIZE (1..maxTFC)) OF TFCS-Removal TimeDurationBeforeRetry ::= INTEGER (1..256) TM-SignallingInfo ::= SEQUENCE { messType MessType, tm-SignallingMode CHOICE { mode1 NULL, mode2 SEQUENCE { -- in ul-controlledTrChList, TrCH-Type is always DCH ul-controlledTrChList UL-ControlledTrChList } } } TransmissionTimeInterval ::= ENUMERATED { tti10, tti20, tti40, tti80 } TransmissionTimeValidity ::= INTEGER (1..256) TransportChannelIdentity ::= INTEGER (1..32) TransportChannelIdentityDCHandDSCH ::= SEQUENCE { dch-transport-ch-id TransportChannelIdentity, dsch-transport-ch-id TransportChannelIdentity } TransportFormatSet ::= CHOICE { dedicatedTransChTFS DedicatedTransChTFS, commonTransChTFS CommonTransChTFS } TransportFormatSet-LCR ::= CHOICE { dedicatedTransChTFS DedicatedTransChTFS, commonTransChTFS-LCR CommonTransChTFS-LCR } -- The maximum allowed size of UL-AddReconfTransChInfoList sequence is 16 UL-AddReconfTransChInfoList ::= SEQUENCE (SIZE (1..maxTrCHpreconf)) OF UL-AddReconfTransChInformation -- The maximum allowed size of UL-AddReconfTransChInfoList-r6 sequence is 32 UL-AddReconfTransChInfoList-r6 ::= SEQUENCE (SIZE (1..maxTrCH)) OF UL-AddReconfTransChInformation-r6 UL-AddReconfTransChInformation ::= SEQUENCE { ul-TransportChannelType UL-TrCH-Type, transportChannelIdentity TransportChannelIdentity, transportFormatSet TransportFormatSet } UL-AddReconfTransChInformation-r6 ::= CHOICE { dch-usch SEQUENCE { ul-TransportChannelType UL-TrCH-Type, transportChannelIdentity TransportChannelIdentity, transportFormatSet TransportFormatSet }, e-dch SEQUENCE { tti E-DCH-TTI, harq-Info ENUMERATED { rv0, rvtable }, addReconf-MAC-d-FlowList E-DCH-AddReconf-MAC-d-FlowList OPTIONAL } } UL-CommonTransChInfo ::= SEQUENCE { -- TABULAR: tfc-subset is applicable to FDD only, TDD specifies tfc-subset in individual -- CCTrCH Info. tfc-Subset TFC-Subset OPTIONAL, prach-TFCS TFCS OPTIONAL, modeSpecificInfo CHOICE { fdd SEQUENCE { ul-TFCS TFCS }, tdd SEQUENCE { individualUL-CCTrCH-InfoList IndividualUL-CCTrCH-InfoList OPTIONAL } } OPTIONAL } UL-CommonTransChInfo-r4 ::= SEQUENCE { -- TABULAR: tfc-subset is applicable to FDD only, TDD specifies tfc-subset in individual -- CCTrCH Info. tfc-Subset TFC-Subset OPTIONAL, prach-TFCS TFCS OPTIONAL, modeSpecificInfo CHOICE { fdd SEQUENCE { ul-TFCS TFCS }, tdd SEQUENCE { individualUL-CCTrCH-InfoList IndividualUL-CCTrCH-InfoList OPTIONAL } } OPTIONAL, tfc-SubsetList TFC-SubsetList OPTIONAL } -- In UL-ControlledTrChList, TrCH-Type is always DCH UL-ControlledTrChList ::= SEQUENCE (SIZE (1..maxTrCH)) OF TransportChannelIdentity UL-DeletedTransChInfoList ::= SEQUENCE (SIZE (1..maxTrCH)) OF UL-TransportChannelIdentity UL-DeletedTransChInfoList-r6 ::= SEQUENCE (SIZE (1..maxTrCH)) OF UL-TransportChannelIdentity-r6 UL-TransportChannelIdentity ::= SEQUENCE { ul-TransportChannelType UL-TrCH-Type, ul-TransportChannelIdentity TransportChannelIdentity } UL-TransportChannelIdentity-r6 ::= CHOICE { dch-usch SEQUENCE { ul-TransportChannelType UL-TrCH-Type, ul-TransportChannelIdentity TransportChannelIdentity }, e-dch E-DCH-MAC-d-FlowIdentity } UL-TrCH-Type ::= ENUMERATED {dch, usch} USCH-TransportChannelsInfo ::= SEQUENCE (SIZE (1..maxTrCH)) OF SEQUENCE { usch-TransportChannelIdentity TransportChannelIdentity, usch-TFS TransportFormatSet } -- *************************************************** -- -- PHYSICAL CHANNEL INFORMATION ELEMENTS (10.3.6) -- -- *************************************************** ACK-NACK-repetitionFactor ::= INTEGER(1..4) AC-To-ASC-Mapping ::= INTEGER (0..7) AC-To-ASC-MappingTable ::= SEQUENCE (SIZE (maxASCmap)) OF AC-To-ASC-Mapping AccessServiceClass-FDD ::= SEQUENCE { availableSignatureStartIndex INTEGER (0..15), availableSignatureEndIndex INTEGER (0..15), assignedSubChannelNumber BIT STRING { b3(0), b2(1), b1(2), b0(3) } (SIZE(4)) } AccessServiceClass-TDD ::= SEQUENCE { channelisationCodeIndices BIT STRING { chCodeIndex7(0), chCodeIndex6(1), chCodeIndex5(2), chCodeIndex4(3), chCodeIndex3(4), chCodeIndex2(5), chCodeIndex1(6), chCodeIndex0(7) } (SIZE(8)) OPTIONAL, subchannelSize CHOICE { size1 NULL, size2 SEQUENCE { -- subch0 means bitstring '01' in the tabular, subch1 means bitsring '10' subchannels ENUMERATED { subch0, subch1 } OPTIONAL }, size4 SEQUENCE { subchannels BIT STRING { subCh3(0), subCh2(1), subCh1(2), subCh0(3) } (SIZE(4)) OPTIONAL }, size8 SEQUENCE { subchannels BIT STRING { subCh7(0), subCh6(1), subCh5(2), subCh4(3), subCh3(4), subCh2(5), subCh1(6), subCh0(7) } (SIZE(8)) OPTIONAL } } } AccessServiceClass-TDD-r7 ::= SEQUENCE { channelisationCodeIndices BIT STRING { chCodeIndex15(0), chCodeIndex14(1), chCodeIndex13(2), chCodeIndex12(3), chCodeIndex11(4), chCodeIndex10(5), chCodeIndex9(6), chCodeIndex8(7), chCodeIndex7(8), chCodeIndex6(9), chCodeIndex5(10), chCodeIndex4(11), chCodeIndex3(12), chCodeIndex2(13), chCodeIndex1(14), chCodeIndex0(15) } (SIZE(16)) OPTIONAL, subchannelSize CHOICE { size1 NULL, size2 SEQUENCE { -- subch0 means bitstring '01' in the tabular, subch1 means bitsring '10' subchannels ENUMERATED { subch0, subch1 } OPTIONAL }, size4 SEQUENCE { subchannels BIT STRING { subCh3(0), subCh2(1), subCh1(2), subCh0(3) } (SIZE(4)) OPTIONAL }, size8 SEQUENCE { subchannels BIT STRING { subCh7(0), subCh6(1), subCh5(2), subCh4(3), subCh3(4), subCh2(5), subCh1(6), subCh0(7) } (SIZE(8)) OPTIONAL }, size16 SEQUENCE { subchannels BIT STRING { subCh15(0), subCh14(1), subCh13(2), subCh12(3), subCh11(4), subCh10(5), subCh9(6), subCh8(7), subCh7(8), subCh6(9), subCh5(10), subCh4(11), subCh3(12), subCh2(13), subCh1(14), subCh0(15) } (SIZE(16)) OPTIONAL } } } AccessServiceClass-TDD-LCR-r4 ::= SEQUENCE { availableSYNC-UlCodesIndics BIT STRING { sulCodeIndex7(0), sulCodeIndex6(1), sulCodeIndex5(2), sulCodeIndex4(3), sulCodeIndex3(4), sulCodeIndex2(5), sulCodeIndex1(6), sulCodeIndex0(7) } (SIZE(8)) OPTIONAL, subchannelSize CHOICE { size1 NULL, size2 SEQUENCE { -- subch0 means bitstring '01' in the tabular, subch1 means bitsring '10'. subchannels ENUMERATED { subch0, subch1 } OPTIONAL }, size4 SEQUENCE { subchannels BIT STRING { subCh3(0), subCh2(1), subCh1(2), subCh0(3) } (SIZE(4)) OPTIONAL }, size8 SEQUENCE { subchannels BIT STRING { subCh7(0), subCh6(1), subCh5(2), subCh4(3), subCh3(4), subCh2(5), subCh1(6), subCh0(7) } (SIZE(8)) OPTIONAL } } } AdditionalPRACH-TF-and-TFCS-CCCH-IEs ::= SEQUENCE { powerOffsetInformation PowerOffsetInformation, dynamicTFInformationCCCH DynamicTFInformationCCCH } AdditionalPRACH-TF-and-TFCS-CCCH ::= SEQUENCE { additionalPRACH-TF-and-TFCS-CCCH-IEs AdditionalPRACH-TF-and-TFCS-CCCH-IEs OPTIONAL } -- The order is the same as in the PRACH-SystemInformationList AdditionalPRACH-TF-and-TFCS-CCCH-List ::= SEQUENCE (SIZE (1..maxPRACH)) OF AdditionalPRACH-TF-and-TFCS-CCCH AICH-Info ::= SEQUENCE { channelisationCode256 ChannelisationCode256, sttd-Indicator BOOLEAN, aich-TransmissionTiming AICH-TransmissionTiming } AICH-PowerOffset ::= INTEGER (-22..5) AICH-TransmissionTiming ::= ENUMERATED { e0, e1 } AllocationPeriodInfo ::= SEQUENCE { allocationActivationTime INTEGER (0..255), allocationDuration INTEGER (1..256) } -- Actual value Alpha = IE value * 0.125 Alpha ::= INTEGER (0..8) AP-AICH-ChannelisationCode ::= INTEGER (0..255) AP-PreambleScramblingCode ::= INTEGER (0..79) AP-Signature ::= INTEGER (0..15) AP-Signature-VCAM ::= SEQUENCE { ap-Signature AP-Signature, availableAP-SubchannelList AvailableAP-SubchannelList OPTIONAL } AP-Subchannel ::= INTEGER (0..11) ASCSetting-FDD ::= SEQUENCE { -- TABULAR: accessServiceClass-FDD is MD in tabular description -- Default value is previous ASC -- If this is the first ASC, the default value is all available signature and sub-channels accessServiceClass-FDD AccessServiceClass-FDD OPTIONAL } ASCSetting-TDD ::= SEQUENCE { -- TABULAR: accessServiceClass-TDD is MD in tabular description -- Default value is previous ASC -- If this is the first ASC, the default value is all available channelisation codes and -- all available sub-channels with subchannelSize=size1. accessServiceClass-TDD AccessServiceClass-TDD OPTIONAL } ASCSetting-TDD-r7 ::= SEQUENCE { -- TABULAR: accessServiceClass-TDD is MD in tabular description -- Default value is previous ASC -- If this is the first ASC, the default value is all available channelisation codes and -- all available sub-channels with subchannelSize=size1. accessServiceClass-TDD AccessServiceClass-TDD-r7 OPTIONAL } ASCSetting-TDD-LCR-r4 ::= SEQUENCE { -- TABULAR: accessServiceClass-TDD-LCR is MD in tabular description -- Default value is previous ASC -- If this is the first ASC, the default value is all available SYNC_UL codes and -- all available sub-channels with subchannelSize=size1. accessServiceClass-TDD-LCR AccessServiceClass-TDD-LCR-r4 OPTIONAL } AvailableAP-Signature-VCAMList ::= SEQUENCE (SIZE (1..maxPCPCH-APsig)) OF AP-Signature-VCAM AvailableAP-SignatureList ::= SEQUENCE (SIZE (1..maxPCPCH-APsig)) OF AP-Signature AvailableAP-SubchannelList ::= SEQUENCE (SIZE (1..maxPCPCH-APsubCh)) OF AP-Subchannel AvailableMinimumSF-ListVCAM ::= SEQUENCE (SIZE (1..maxPCPCH-SF)) OF AvailableMinimumSF-VCAM AvailableMinimumSF-VCAM ::= SEQUENCE { minimumSpreadingFactor MinimumSpreadingFactor, nf-Max NF-Max, maxAvailablePCPCH-Number MaxAvailablePCPCH-Number, availableAP-Signature-VCAMList AvailableAP-Signature-VCAMList } AvailableSignatures ::= BIT STRING { signature15(0), signature14(1), signature13(2), signature12(3), signature11(4), signature10(5), signature9(6), signature8(7), signature7(8), signature6(9), signature5(10), signature4(11), signature3(12), signature2(13), signature1(14), signature0(15) } (SIZE(16)) AvailableSubChannelNumbers ::= BIT STRING { subCh11(0), subCh10(1), subCh9(2), subCh8(3), subCh7(4), subCh6(5), subCh5(6), subCh4(7), subCh3(8), subCh2(9), subCh1(10), subCh0(11) } (SIZE(12)) BEACON-PL-Est ::= ENUMERATED { true } BurstType ::= ENUMERATED { type1, type2 } -- Actual value Bler-Target = IE value * 0.05 Bler-Target ::= INTEGER (-63..0) CCTrCH-PowerControlInfo ::= SEQUENCE { tfcs-Identity TFCS-Identity OPTIONAL, ul-DPCH-PowerControlInfo UL-DPCH-PowerControlInfo } CCTrCH-PowerControlInfo-r4 ::= SEQUENCE { tfcs-Identity TFCS-Identity OPTIONAL, ul-DPCH-PowerControlInfo UL-DPCH-PowerControlInfo-r4 } CCTrCH-PowerControlInfo-r5 ::= SEQUENCE { tfcs-Identity TFCS-Identity OPTIONAL, ul-DPCH-PowerControlInfo UL-DPCH-PowerControlInfo-r5 } CCTrCH-PowerControlInfo-r7 ::= SEQUENCE { tfcs-Identity TFCS-Identity OPTIONAL, ul-DPCH-PowerControlInfo UL-DPCH-PowerControlInfo-r7 } CD-AccessSlotSubchannel ::= INTEGER (0..11) CD-AccessSlotSubchannelList ::= SEQUENCE (SIZE (1..maxPCPCH-CDsubCh)) OF CD-AccessSlotSubchannel CD-CA-ICH-ChannelisationCode ::= INTEGER (0..255) CD-PreambleScramblingCode ::= INTEGER (0..79) CD-SignatureCode ::= INTEGER (0..15) CD-SignatureCodeList ::= SEQUENCE (SIZE (1..maxPCPCH-CDsig)) OF CD-SignatureCode CellAndChannelIdentity ::= SEQUENCE { -- burstType may be set to either value and should be ignored by the receiver for 1.28 Mcps TDD. burstType BurstType, midambleShift MidambleShiftLong, timeslot TimeslotNumber, cellParametersID CellParametersID } CellParametersID ::= INTEGER (0..127) Cfntargetsfnframeoffset ::= INTEGER(0..255) ChannelAssignmentActive ::= CHOICE { notActive NULL, isActive AvailableMinimumSF-ListVCAM } ChannelisationCode256 ::= INTEGER (0..255) ChannelReqParamsForUCSM ::= SEQUENCE { availableAP-SignatureList AvailableAP-SignatureList, availableAP-SubchannelList AvailableAP-SubchannelList OPTIONAL } ClosedLoopTimingAdjMode ::= ENUMERATED { slot1, slot2 } CodeNumberDSCH ::= INTEGER (0..255) CodeRange ::= SEQUENCE { pdsch-CodeMapList PDSCH-CodeMapList } CodeWordSet ::= ENUMERATED { longCWS, mediumCWS, shortCWS, ssdtOff } CommonTimeslotInfo ::= SEQUENCE { -- TABULAR: secondInterleavingMode is MD, but since it can be encoded in a single -- bit it is not defined as OPTIONAL. secondInterleavingMode SecondInterleavingMode, tfci-Coding TFCI-Coding OPTIONAL, puncturingLimit PuncturingLimit, repetitionPeriodAndLength RepetitionPeriodAndLength OPTIONAL } CommonTimeslotInfoSCCPCH ::= SEQUENCE { -- TABULAR: secondInterleavingMode is MD, but since it can be encoded in a single -- bit it is not defined as OPTIONAL. secondInterleavingMode SecondInterleavingMode, tfci-Coding TFCI-Coding OPTIONAL, puncturingLimit PuncturingLimit, repetitionPeriodLengthAndOffset RepetitionPeriodLengthAndOffset OPTIONAL } ConstantValue ::= INTEGER (-35..-10) ConstantValueTdd ::= INTEGER (-35..10) CPCH-PersistenceLevels ::= SEQUENCE { cpch-SetID CPCH-SetID, dynamicPersistenceLevelTF-List DynamicPersistenceLevelTF-List } CPCH-PersistenceLevelsList ::= SEQUENCE (SIZE (1..maxCPCHsets)) OF CPCH-PersistenceLevels CPCH-SetInfo ::= SEQUENCE { cpch-SetID CPCH-SetID, transportFormatSet TransportFormatSet, tfcs TFCS, ap-PreambleScramblingCode AP-PreambleScramblingCode, ap-AICH-ChannelisationCode AP-AICH-ChannelisationCode, cd-PreambleScramblingCode CD-PreambleScramblingCode, cd-CA-ICH-ChannelisationCode CD-CA-ICH-ChannelisationCode, cd-AccessSlotSubchannelList CD-AccessSlotSubchannelList OPTIONAL, cd-SignatureCodeList CD-SignatureCodeList OPTIONAL, deltaPp-m DeltaPp-m, ul-DPCCH-SlotFormat UL-DPCCH-SlotFormat, n-StartMessage N-StartMessage, n-EOT N-EOT, -- TABULAR: VCAM info has been nested inside ChannelAssignmentActive, -- which in turn is mandatory since it's only a binary choice. channelAssignmentActive ChannelAssignmentActive, cpch-StatusIndicationMode CPCH-StatusIndicationMode, pcpch-ChannelInfoList PCPCH-ChannelInfoList } CPCH-SetInfoList ::= SEQUENCE (SIZE (1..maxCPCHsets)) OF CPCH-SetInfo CPCH-StatusIndicationMode ::= ENUMERATED { pa-mode, pamsf-mode } CQI-RepetitionFactor ::= INTEGER(1..4) CSICH-PowerOffset ::= INTEGER (-10..5) -- DefaultDPCH-OffsetValueFDD and DefaultDPCH-OffsetValueTDD corresponds to -- IE "Default DPCH Offset Value" depending on the mode. -- Actual value DefaultDPCH-OffsetValueFDD = IE value * 512 DefaultDPCH-OffsetValueFDD ::= INTEGER (0..599) DefaultDPCH-OffsetValueTDD ::= INTEGER (0..7) DeltaPp-m ::= INTEGER (-10..10) DeltaCQI ::= INTEGER (0..8) DeltaNACK ::= INTEGER (0..8) DeltaACK ::= INTEGER (0..8) -- Actual value DeltaSIR = IE value * 0.1 DeltaSIR ::= INTEGER (0..30) DHS-Sync ::= INTEGER (-20..10) DL-CCTrCh ::= SEQUENCE { tfcs-ID TFCS-IdentityPlain DEFAULT 1, timeInfo TimeInfo, commonTimeslotInfo CommonTimeslotInfo OPTIONAL, dl-CCTrCH-TimeslotsCodes DownlinkTimeslotsCodes OPTIONAL, ul-CCTrChTPCList UL-CCTrChTPCList OPTIONAL } DL-CCTrCh-r4 ::= SEQUENCE { tfcs-ID TFCS-IdentityPlain DEFAULT 1, timeInfo TimeInfo, commonTimeslotInfo CommonTimeslotInfo OPTIONAL, tddOption CHOICE { tdd384 SEQUENCE { dl-CCTrCH-TimeslotsCodes DownlinkTimeslotsCodes OPTIONAL }, tdd128 SEQUENCE { dl-CCTrCH-TimeslotsCodes DownlinkTimeslotsCodes-LCR-r4 OPTIONAL } }, ul-CCTrChTPCList UL-CCTrChTPCList OPTIONAL } DL-CCTrCh-r7 ::= SEQUENCE { tfcs-ID TFCS-IdentityPlain DEFAULT 1, timeInfo TimeInfo, commonTimeslotInfo CommonTimeslotInfo OPTIONAL, tddOption CHOICE { tdd384 SEQUENCE { dl-CCTrCH-TimeslotsCodes DownlinkTimeslotsCodes OPTIONAL }, tdd768 SEQUENCE { dl-CCTrCH-TimeslotsCodes DownlinkTimeslotsCodes-VHCR OPTIONAL }, tdd128 SEQUENCE { dl-CCTrCH-TimeslotsCodes DownlinkTimeslotsCodes-LCR-r4 OPTIONAL } }, ul-CCTrChTPCList UL-CCTrChTPCList OPTIONAL } DL-CCTrChList ::= SEQUENCE (SIZE (1..maxCCTrCH)) OF DL-CCTrCh DL-CCTrChList-r7 ::= SEQUENCE (SIZE (1..maxCCTrCH)) OF DL-CCTrCh-r7 DL-CCTrChList-r4 ::= SEQUENCE (SIZE (1..maxCCTrCH)) OF DL-CCTrCh-r4 DL-CCTrChListToRemove ::= SEQUENCE (SIZE (1..maxCCTrCH)) OF TFCS-IdentityPlain DL-CCTrChTPCList ::= SEQUENCE (SIZE (0..maxCCTrCH)) OF TFCS-Identity DL-ChannelisationCode ::= SEQUENCE { secondaryScramblingCode SecondaryScramblingCode OPTIONAL, sf-AndCodeNumber SF512-AndCodeNumber, scramblingCodeChange ScramblingCodeChange OPTIONAL } DL-ChannelisationCodeList ::= SEQUENCE (SIZE (1..maxDPCH-DLchan)) OF DL-ChannelisationCode DL-CommonInformation ::= SEQUENCE { dl-DPCH-InfoCommon DL-DPCH-InfoCommon OPTIONAL, modeSpecificInfo CHOICE { fdd SEQUENCE { defaultDPCH-OffsetValue DefaultDPCH-OffsetValueFDD OPTIONAL, dpch-CompressedModeInfo DPCH-CompressedModeInfo OPTIONAL, tx-DiversityMode TX-DiversityMode OPTIONAL, -- dummy is not used in this version of the specification, it should -- not be sent and if received it should be ignored. dummy SSDT-Information OPTIONAL }, tdd SEQUENCE { defaultDPCH-OffsetValue DefaultDPCH-OffsetValueTDD OPTIONAL } } } DL-CommonInformation-r4 ::= SEQUENCE { dl-DPCH-InfoCommon DL-DPCH-InfoCommon-r4 OPTIONAL, modeSpecificInfo CHOICE { fdd SEQUENCE { defaultDPCH-OffsetValue DefaultDPCH-OffsetValueFDD OPTIONAL, dpch-CompressedModeInfo DPCH-CompressedModeInfo OPTIONAL, tx-DiversityMode TX-DiversityMode OPTIONAL, -- dummy is not used in this version of the specification, it should -- not be sent and if received it should be ignored. dummy SSDT-Information-r4 OPTIONAL }, tdd SEQUENCE { tddOption CHOICE { tdd384 NULL, tdd128 SEQUENCE { tstd-Indicator BOOLEAN } }, defaultDPCH-OffsetValue DefaultDPCH-OffsetValueTDD OPTIONAL } } } DL-CommonInformation-r5 ::= SEQUENCE { dl-DPCH-InfoCommon DL-DPCH-InfoCommon-r4 OPTIONAL, modeSpecificInfo CHOICE { fdd SEQUENCE { defaultDPCH-OffsetValue DefaultDPCH-OffsetValueFDD OPTIONAL, dpch-CompressedModeInfo DPCH-CompressedModeInfo OPTIONAL, tx-DiversityMode TX-DiversityMode OPTIONAL, -- dummy is not used in this version of the specification, it should -- not be sent and if received it should be ignored. dummy SSDT-Information-r4 OPTIONAL }, tdd SEQUENCE { tddOption CHOICE { tdd384 NULL, tdd128 SEQUENCE { tstd-Indicator BOOLEAN } }, defaultDPCH-OffsetValue DefaultDPCH-OffsetValueTDD OPTIONAL } }, mac-hsResetIndicator ENUMERATED { true } OPTIONAL } DL-CommonInformation-r6 ::= SEQUENCE { dl-dpchInfoCommon CHOICE { dl-DPCH-InfoCommon DL-DPCH-InfoCommon-r6, dl-FDPCH-InfoCommon DL-FDPCH-InfoCommon-r6 } OPTIONAL, modeSpecificInfo CHOICE { fdd SEQUENCE { defaultDPCH-OffsetValue DefaultDPCH-OffsetValueFDD OPTIONAL, dpch-CompressedModeInfo DPCH-CompressedModeInfo OPTIONAL, tx-DiversityMode TX-DiversityMode OPTIONAL }, tdd SEQUENCE { tddOption CHOICE { tdd384 NULL, tdd128 SEQUENCE { tstd-Indicator BOOLEAN } }, defaultDPCH-OffsetValue DefaultDPCH-OffsetValueTDD OPTIONAL } }, mac-hsResetIndicator ENUMERATED { true } OPTIONAL, postVerificationPeriod ENUMERATED { true } OPTIONAL } DL-CommonInformation-r7 ::= SEQUENCE { dl-dpchInfoCommon CHOICE { dl-DPCH-InfoCommon DL-DPCH-InfoCommon-r6, dl-FDPCH-InfoCommon DL-FDPCH-InfoCommon-r6 } OPTIONAL, modeSpecificInfo CHOICE { fdd SEQUENCE { defaultDPCH-OffsetValue DefaultDPCH-OffsetValueFDD OPTIONAL, dpch-CompressedModeInfo DPCH-CompressedModeInfo OPTIONAL, tx-DiversityMode TX-DiversityMode OPTIONAL }, tdd SEQUENCE { tddOption CHOICE { tdd384 NULL, tdd768 NULL, tdd128 SEQUENCE { tstd-Indicator BOOLEAN } }, defaultDPCH-OffsetValue DefaultDPCH-OffsetValueTDD OPTIONAL } }, mac-hsResetIndicator ENUMERATED { true } OPTIONAL, postVerificationPeriod ENUMERATED { true } OPTIONAL } DL-CommonInformationPost ::= SEQUENCE { dl-DPCH-InfoCommon DL-DPCH-InfoCommonPost } DL-CommonInformationPredef ::= SEQUENCE { dl-DPCH-InfoCommon DL-DPCH-InfoCommonPredef OPTIONAL } DL-CompressedModeMethod ::= ENUMERATED { -- dummy is not used in this version of the specification, it should -- not be sent and if received the UE behaviour is not specified. dummy, sf-2, higherLayerScheduling } DL-DPCH-InfoCommon ::= SEQUENCE { cfnHandling CHOICE { maintain NULL, initialise SEQUENCE { -- IE dummy is not used in this version of the specification -- The IE should not be sent and if received it should be ignored dummy Cfntargetsfnframeoffset OPTIONAL } }, modeSpecificInfo CHOICE { fdd SEQUENCE { dl-DPCH-PowerControlInfo DL-DPCH-PowerControlInfo OPTIONAL, powerOffsetPilot-pdpdch PowerOffsetPilot-pdpdch, dl-rate-matching-restriction Dl-rate-matching-restriction OPTIONAL, -- TABULAR: The number of pilot bits is nested inside the spreading factor. spreadingFactorAndPilot SF512-AndPilot, positionFixedOrFlexible PositionFixedOrFlexible, tfci-Existence BOOLEAN }, tdd SEQUENCE { dl-DPCH-PowerControlInfo DL-DPCH-PowerControlInfo OPTIONAL } } } DL-DPCH-InfoCommon-r4 ::= SEQUENCE { cfnHandling CHOICE { maintain NULL, initialise SEQUENCE { -- IE dummy is not used in this version of the specification -- The IE should not be sent and if received it should be ignored dummy Cfntargetsfnframeoffset OPTIONAL } }, modeSpecificInfo CHOICE { fdd SEQUENCE { dl-DPCH-PowerControlInfo DL-DPCH-PowerControlInfo OPTIONAL, powerOffsetPilot-pdpdch PowerOffsetPilot-pdpdch, dl-rate-matching-restriction Dl-rate-matching-restriction OPTIONAL, -- TABULAR: The number of pilot bits is nested inside the spreading factor. spreadingFactorAndPilot SF512-AndPilot, positionFixedOrFlexible PositionFixedOrFlexible, tfci-Existence BOOLEAN }, tdd SEQUENCE { dl-DPCH-PowerControlInfo DL-DPCH-PowerControlInfo OPTIONAL } }, -- The IE mac-d-HFN-initial-value should be absent in the RRCConnectionSetup-r4-IEs or -- RRCConnectionSetup-r5-IEs or HandoverToUTRANCommand-r4-IEs or HandoverToUTRANCommand-r5-IEs and -- if the IE is included, the general error handling for conditional IEs applies. mac-d-HFN-initial-value MAC-d-HFN-initial-value OPTIONAL } DL-DPCH-InfoCommon-r6 ::= SEQUENCE { cfnHandling CHOICE { maintain SEQUENCE { timingmaintainedsynchind TimingMaintainedSynchInd OPTIONAL }, initialise NULL }, modeSpecificInfo CHOICE { fdd SEQUENCE { dl-DPCH-PowerControlInfo DL-DPCH-PowerControlInfo OPTIONAL, powerOffsetPilot-pdpdch PowerOffsetPilot-pdpdch, dl-rate-matching-restriction Dl-rate-matching-restriction OPTIONAL, -- TABULAR: The number of pilot bits is nested inside the spreading factor. spreadingFactorAndPilot SF512-AndPilot, positionFixedOrFlexible PositionFixedOrFlexible, tfci-Existence BOOLEAN }, tdd SEQUENCE { dl-DPCH-PowerControlInfo DL-DPCH-PowerControlInfo OPTIONAL } }, -- The IE mac-d-HFN-initial-value should be absent in the RRCConnectionSetup and the -- HandoverToUTRANCommand messages. If the IE is included, the general error handling -- for conditional IEs applies. mac-d-HFN-initial-value MAC-d-HFN-initial-value OPTIONAL } DL-DPCH-InfoCommonPost ::= SEQUENCE { dl-DPCH-PowerControlInfo DL-DPCH-PowerControlInfo OPTIONAL } DL-DPCH-InfoCommonPredef ::= SEQUENCE { modeSpecificInfo CHOICE { fdd SEQUENCE { -- TABULAR: The number of pilot bits is nested inside the spreading factor. spreadingFactorAndPilot SF512-AndPilot, positionFixedOrFlexible PositionFixedOrFlexible, tfci-Existence BOOLEAN }, tdd SEQUENCE { commonTimeslotInfo CommonTimeslotInfo } } } DL-DPCH-InfoPerRL ::= CHOICE { fdd SEQUENCE { pCPICH-UsageForChannelEst PCPICH-UsageForChannelEst, dpch-FrameOffset DPCH-FrameOffset, secondaryCPICH-Info SecondaryCPICH-Info OPTIONAL, dl-ChannelisationCodeList DL-ChannelisationCodeList, tpc-CombinationIndex TPC-CombinationIndex, -- dummy is not used in this version of the specification, it should -- not be sent and if received it should be ignored. dummy SSDT-CellIdentity OPTIONAL, closedLoopTimingAdjMode ClosedLoopTimingAdjMode OPTIONAL }, tdd SEQUENCE { dl-CCTrChListToEstablish DL-CCTrChList OPTIONAL, dl-CCTrChListToRemove DL-CCTrChListToRemove OPTIONAL } } DL-DPCH-InfoPerRL-r4 ::= CHOICE { fdd SEQUENCE { pCPICH-UsageForChannelEst PCPICH-UsageForChannelEst, dpch-FrameOffset DPCH-FrameOffset, secondaryCPICH-Info SecondaryCPICH-Info OPTIONAL, dl-ChannelisationCodeList DL-ChannelisationCodeList, tpc-CombinationIndex TPC-CombinationIndex, -- dummy is not used in this version of the specification, it should -- not be sent and if received it should be ignored. dummy SSDT-CellIdentity OPTIONAL, closedLoopTimingAdjMode ClosedLoopTimingAdjMode OPTIONAL }, tdd SEQUENCE { dl-CCTrChListToEstablish DL-CCTrChList-r4 OPTIONAL, dl-CCTrChListToRemove DL-CCTrChListToRemove OPTIONAL } } DL-DPCH-InfoPerRL-r5 ::= CHOICE { fdd SEQUENCE { pCPICH-UsageForChannelEst PCPICH-UsageForChannelEst, dpch-FrameOffset DPCH-FrameOffset, secondaryCPICH-Info SecondaryCPICH-Info OPTIONAL, dl-ChannelisationCodeList DL-ChannelisationCodeList, tpc-CombinationIndex TPC-CombinationIndex, powerOffsetTPC-pdpdch PowerOffsetTPC-pdpdch OPTIONAL, -- dummy is not used in this version of the specification, it should -- not be sent and if received it should be ignored. dummy SSDT-CellIdentity OPTIONAL, closedLoopTimingAdjMode ClosedLoopTimingAdjMode OPTIONAL }, tdd SEQUENCE { dl-CCTrChListToEstablish DL-CCTrChList-r4 OPTIONAL, dl-CCTrChListToRemove DL-CCTrChListToRemove OPTIONAL } } DL-DPCH-InfoPerRL-r6 ::= CHOICE { fdd SEQUENCE { pCPICH-UsageForChannelEst PCPICH-UsageForChannelEst, dpch-FrameOffset DPCH-FrameOffset, secondaryCPICH-Info SecondaryCPICH-Info OPTIONAL, dl-ChannelisationCodeList DL-ChannelisationCodeList, tpc-CombinationIndex TPC-CombinationIndex, powerOffsetTPC-pdpdch PowerOffsetTPC-pdpdch OPTIONAL, closedLoopTimingAdjMode ClosedLoopTimingAdjMode OPTIONAL }, tdd SEQUENCE { dl-CCTrChListToEstablish DL-CCTrChList-r4 OPTIONAL, dl-CCTrChListToRemove DL-CCTrChListToRemove OPTIONAL } } DL-DPCH-InfoPerRL-r7 ::= CHOICE { fdd SEQUENCE { pCPICH-UsageForChannelEst PCPICH-UsageForChannelEst, dpch-FrameOffset DPCH-FrameOffset, secondaryCPICH-Info SecondaryCPICH-Info OPTIONAL, dl-ChannelisationCodeList DL-ChannelisationCodeList, tpc-CombinationIndex TPC-CombinationIndex, powerOffsetTPC-pdpdch PowerOffsetTPC-pdpdch OPTIONAL, closedLoopTimingAdjMode ClosedLoopTimingAdjMode OPTIONAL }, tdd SEQUENCE { dl-CCTrChListToEstablish DL-CCTrChList-r7 OPTIONAL, dl-CCTrChListToRemove DL-CCTrChListToRemove OPTIONAL } } DL-FDPCH-InfoPerRL-r6 ::= SEQUENCE { pCPICH-UsageForChannelEst PCPICH-UsageForChannelEst, fdpch-FrameOffset DPCH-FrameOffset, secondaryCPICH-Info SecondaryCPICH-Info OPTIONAL, secondaryScramblingCode SecondaryScramblingCode OPTIONAL, dl-ChannelisationCode INTEGER (0..255), tpc-CombinationIndex TPC-CombinationIndex } DL-DPCH-InfoPerRL-PostFDD ::= SEQUENCE { pCPICH-UsageForChannelEst PCPICH-UsageForChannelEst, dl-ChannelisationCode DL-ChannelisationCode, tpc-CombinationIndex TPC-CombinationIndex } DL-DPCH-InfoPerRL-PostTDD ::= SEQUENCE { dl-DPCH-TimeslotsCodes DownlinkTimeslotsCodes } DL-DPCH-InfoPerRL-PostTDD-LCR-r4 ::= SEQUENCE { dl-CCTrCH-TimeslotsCodes DownlinkTimeslotsCodes-LCR-r4 } DL-DPCH-PowerControlInfo ::= SEQUENCE { modeSpecificInfo CHOICE { fdd SEQUENCE { dpc-Mode DPC-Mode }, tdd SEQUENCE { tpc-StepSizeTDD TPC-StepSizeTDD OPTIONAL } } } DL-FDPCH-InfoCommon-r6 ::= SEQUENCE { cfnHandling CHOICE { maintain SEQUENCE { timingmaintainedsynchind TimingMaintainedSynchInd OPTIONAL }, initialise NULL }, dl-FDPCH-PowerControlInfo DL-DPCH-PowerControlInfo OPTIONAL, -- Actual value dl-FDPCH-TPCcommandErrorRate = IE value * 0.01 -- dl-FDPCH-TPCcommandErrorRate values 11..16 are spare and shall not be used in this version of -- the protocol dl-FDPCH-TPCcommandErrorRate INTEGER (1..16) OPTIONAL } DL-FrameType ::= ENUMERATED { dl-FrameTypeA, dl-FrameTypeB } DL-HSPDSCH-Information ::= SEQUENCE { hs-scch-Info HS-SCCH-Info OPTIONAL, measurement-feedback-Info Measurement-Feedback-Info OPTIONAL, modeSpecificInfo CHOICE { tdd CHOICE{ tdd384 SEQUENCE { dl-HSPDSCH-TS-Configuration DL-HSPDSCH-TS-Configuration OPTIONAL }, tdd128 SEQUENCE { hs-PDSCH-Midamble-Configuration-tdd128 HS-PDSCH-Midamble-Configuration-TDD128 OPTIONAL } }, fdd NULL } } DL-HSPDSCH-Information-r6 ::= SEQUENCE { hs-scch-Info HS-SCCH-Info-r6 OPTIONAL, measurement-feedback-Info Measurement-Feedback-Info OPTIONAL, modeSpecificInfo CHOICE { tdd CHOICE { tdd384 SEQUENCE { dl-HSPDSCH-TS-Configuration DL-HSPDSCH-TS-Configuration OPTIONAL }, tdd128 SEQUENCE { hs-PDSCH-Midamble-Configuration-tdd128 HS-PDSCH-Midamble-Configuration-TDD128 OPTIONAL } }, fdd NULL } } DL-HSPDSCH-Information-r7 ::= SEQUENCE { hs-scch-Info HS-SCCH-Info-r7 OPTIONAL, measurement-feedback-Info Measurement-Feedback-Info OPTIONAL, modeSpecificInfo CHOICE { tdd CHOICE { tdd384 SEQUENCE { dl-HSPDSCH-TS-Configuration DL-HSPDSCH-TS-Configuration OPTIONAL }, tdd768 SEQUENCE { dl-HSPDSCH-TS-Configuration DL-HSPDSCH-TS-Configuration-VHCR OPTIONAL }, tdd128 SEQUENCE { hs-PDSCH-Midamble-Configuration-tdd128 HS-PDSCH-Midamble-Configuration-TDD128 OPTIONAL } }, fdd NULL } } -- The IE 'DL-HSPDSCH-TS-Configuration' applies to tdd-384 REL-5 onward DL-HSPDSCH-TS-Configuration ::= SEQUENCE (SIZE (1..maxTS-1)) OF SEQUENCE { timeslot TimeslotNumber, midambleShiftAndBurstType MidambleShiftAndBurstType-DL } -- The IE 'DL-HSPDSCH-TS-Configuration-VHCR' applies to tdd-768 REL-7 onward DL-HSPDSCH-TS-Configuration-VHCR ::= SEQUENCE (SIZE (1..maxTS-1)) OF SEQUENCE { timeslot TimeslotNumber, midambleShiftAndBurstType MidambleShiftAndBurstType-DL-VHCR } DL-InformationPerRL ::= SEQUENCE { modeSpecificInfo CHOICE { fdd SEQUENCE { primaryCPICH-Info PrimaryCPICH-Info, -- dummy1 and dummy 2 are not used in this version of specification, they should -- not be sent and if received they should be ignored. dummy1 PDSCH-SHO-DCH-Info OPTIONAL, dummy2 PDSCH-CodeMapping OPTIONAL }, tdd PrimaryCCPCH-Info }, dl-DPCH-InfoPerRL DL-DPCH-InfoPerRL OPTIONAL, -- dummy is not used in this version of the specification, it should -- not be sent and if received it should be ignored. dummy SCCPCH-InfoForFACH OPTIONAL } DL-InformationPerRL-r4 ::= SEQUENCE { modeSpecificInfo CHOICE { fdd SEQUENCE { primaryCPICH-Info PrimaryCPICH-Info, -- dummy1 and dummy 2 are not used in this version of specification, they should -- not be sent and if received they should be ignored. dummy1 PDSCH-SHO-DCH-Info OPTIONAL, dummy2 PDSCH-CodeMapping OPTIONAL }, tdd PrimaryCCPCH-Info-r4 }, dl-DPCH-InfoPerRL DL-DPCH-InfoPerRL-r4 OPTIONAL, -- dummy is not used in this version of the specification, it should -- not be sent and if received it should be ignored. dummy SCCPCH-InfoForFACH-r4 OPTIONAL, cell-id CellIdentity OPTIONAL } DL-InformationPerRL-r5 ::= SEQUENCE { modeSpecificInfo CHOICE { fdd SEQUENCE { primaryCPICH-Info PrimaryCPICH-Info, -- dummy1 and dummy 2 are not used in this version of specification, they should -- not be sent and if received they should be ignored. dummy1 PDSCH-SHO-DCH-Info OPTIONAL, dummy2 PDSCH-CodeMapping OPTIONAL, servingHSDSCH-RL-indicator BOOLEAN }, tdd PrimaryCCPCH-Info-r4 }, dl-DPCH-InfoPerRL DL-DPCH-InfoPerRL-r5 OPTIONAL, -- dummy is not used in this version of the specification, it should -- not be sent and if received it should be ignored. dummy SCCPCH-InfoForFACH-r4 OPTIONAL, cell-id CellIdentity OPTIONAL } DL-InformationPerRL-r5bis ::= SEQUENCE { modeSpecificInfo CHOICE { fdd SEQUENCE { primaryCPICH-Info PrimaryCPICH-Info, -- dummy1 and dummy 2 are not used in this version of specification, they should -- not be sent and if received they should be ignored. dummy1 PDSCH-SHO-DCH-Info OPTIONAL, dummy2 PDSCH-CodeMapping OPTIONAL }, tdd PrimaryCCPCH-Info-r4 }, dl-DPCH-InfoPerRL DL-DPCH-InfoPerRL-r5 OPTIONAL, -- dummy is not used in this version of the specification, it should -- not be sent and if received it should be ignored. dummy SCCPCH-InfoForFACH-r4 OPTIONAL, cell-id CellIdentity OPTIONAL } DL-InformationPerRL-r6 ::= SEQUENCE { modeSpecificInfo CHOICE { fdd SEQUENCE { primaryCPICH-Info PrimaryCPICH-Info, servingHSDSCH-RL-indicator BOOLEAN, servingEDCH-RL-indicator BOOLEAN }, tdd PrimaryCCPCH-Info-r4 }, dl-dpchInfo CHOICE { dl-DPCH-InfoPerRL DL-DPCH-InfoPerRL-r6, dl-FDPCH-InfoPerRL DL-FDPCH-InfoPerRL-r6 } OPTIONAL, e-AGCH-Information E-AGCH-Information OPTIONAL, e-HICH-Info CHOICE { e-HICH-Information E-HICH-Information, releaseIndicator NULL } OPTIONAL, e-RGCH-Info CHOICE { e-RGCH-Information E-RGCH-Information, releaseIndicator NULL } OPTIONAL, cell-id CellIdentity OPTIONAL } DL-InformationPerRL-r7 ::= SEQUENCE { modeSpecificInfo CHOICE { fdd SEQUENCE { primaryCPICH-Info PrimaryCPICH-Info, servingHSDSCH-RL-indicator BOOLEAN, servingEDCH-RL-indicator BOOLEAN }, tdd PrimaryCCPCH-Info-r7 }, dl-dpchInfo CHOICE { dl-DPCH-InfoPerRL DL-DPCH-InfoPerRL-r7, dl-FDPCH-InfoPerRL DL-FDPCH-InfoPerRL-r6 } OPTIONAL, e-AGCH-Information E-AGCH-Information OPTIONAL, e-HICH-Info CHOICE { e-HICH-Information E-HICH-Information, releaseIndicator NULL } OPTIONAL, e-RGCH-Info CHOICE { e-RGCH-Information E-RGCH-Information, releaseIndicator NULL } OPTIONAL, cell-id CellIdentity OPTIONAL } DL-InformationPerRL-List ::= SEQUENCE (SIZE (1..maxRL)) OF DL-InformationPerRL DL-InformationPerRL-List-r4 ::= SEQUENCE (SIZE (1..maxRL)) OF DL-InformationPerRL-r4 DL-InformationPerRL-List-r5 ::= SEQUENCE (SIZE (1..maxRL)) OF DL-InformationPerRL-r5 DL-InformationPerRL-List-r6 ::= SEQUENCE (SIZE (1..maxRL)) OF DL-InformationPerRL-r6 DL-InformationPerRL-List-r5bis ::= SEQUENCE (SIZE (1..maxRL)) OF DL-InformationPerRL-r5bis DL-InformationPerRL-List-r7 ::= SEQUENCE (SIZE (1..maxRL)) OF DL-InformationPerRL-r7 DL-InformationPerRL-ListPostFDD ::= SEQUENCE (SIZE (1..maxRL)) OF DL-InformationPerRL-PostFDD DL-InformationPerRL-PostFDD ::= SEQUENCE { primaryCPICH-Info PrimaryCPICH-Info, dl-DPCH-InfoPerRL DL-DPCH-InfoPerRL-PostFDD } DL-InformationPerRL-PostTDD ::= SEQUENCE { primaryCCPCH-Info PrimaryCCPCH-InfoPost, dl-DPCH-InfoPerRL DL-DPCH-InfoPerRL-PostTDD } DL-InformationPerRL-PostTDD-LCR-r4 ::= SEQUENCE { primaryCCPCH-Info PrimaryCCPCH-InfoPostTDD-LCR-r4, dl-DPCH-InfoPerRL DL-DPCH-InfoPerRL-PostTDD-LCR-r4 } DL-PDSCH-Information ::= SEQUENCE { -- dummy1 and dummy 2 are not used in this version of specification, it should -- not be sent and if received it should be ignored. dummy1 PDSCH-SHO-DCH-Info OPTIONAL, dummy2 PDSCH-CodeMapping OPTIONAL } Dl-rate-matching-restriction ::= SEQUENCE { restrictedTrCH-InfoList RestrictedTrCH-InfoList OPTIONAL } DL-TPC-PowerOffsetPerRL ::= SEQUENCE { powerOffsetTPC-pdpdch PowerOffsetTPC-pdpdch OPTIONAL } -- NOTE: The radio links in the following list have a one-to-one mapping with the -- radio links in the message. DL-TPC-PowerOffsetPerRL-List ::= SEQUENCE (SIZE (1..maxRL)) OF DL-TPC-PowerOffsetPerRL DL-TS-ChannelisationCode ::= ENUMERATED { cc16-1, cc16-2, cc16-3, cc16-4, cc16-5, cc16-6, cc16-7, cc16-8, cc16-9, cc16-10, cc16-11, cc16-12, cc16-13, cc16-14, cc16-15, cc16-16 } DL-TS-ChannelisationCode-VHCR ::= ENUMERATED { cc32-1, cc32-2, cc32-3, cc32-4, cc132-5, cc32-6, cc32-7, cc32-8, cc32-9, cc32-10, cc32-11, cc32-12, cc32-13, cc32-14, cc32-15, cc32-16, cc32-17, cc32-18, cc32-19, cc32-20, cc32-21, cc32-22, cc32-23, cc32-24, cc32-25, cc32-26, cc32-27, cc32-28, cc32-29, cc32-30, cc32-31, cc32-32 } DL-TS-ChannelisationCodesShort ::= SEQUENCE { codesRepresentation CHOICE { consecutive SEQUENCE { firstChannelisationCode DL-TS-ChannelisationCode, lastChannelisationCode DL-TS-ChannelisationCode }, bitmap BIT STRING { chCode16-SF16(0), chCode15-SF16(1), chCode14-SF16(2), chCode13-SF16(3), chCode12-SF16(4), chCode11-SF16(5), chCode10-SF16(6), chCode9-SF16(7), chCode8-SF16(8), chCode7-SF16(9), chCode6-SF16(10), chCode5-SF16(11), chCode4-SF16(12), chCode3-SF16(13), chCode2-SF16(14), chCode1-SF16(15) } (SIZE (16)) } } DL-TS-ChannelisationCodesShort-VHCR ::= SEQUENCE { codesRepresentation CHOICE { consecutive SEQUENCE { firstChannelisationCode DL-TS-ChannelisationCode-VHCR, lastChannelisationCode DL-TS-ChannelisationCode-VHCR }, bitmap BIT STRING { chCode32-SF32(0), chCode31-SF32(1), chCode30-SF32(2), chCode29-SF32(3), chCode28-SF32(4), chCode27-SF32(5), chCode26-SF32(6), chCode25-SF32(7), chCode24-SF32(8), chCode23-SF32(9), chCode22-SF32(10), chCode21-SF32(11), chCode20-SF32(12), chCode19-SF32(13), chCode18-SF32(14), chCode17-SF32(15), chCode16-SF32(16), chCode15-SF32(17), chCode14-SF32(18), chCode13-SF32(19), chCode12-SF32(20), chCode11-SF32(21), chCode10-SF32(22), chCode9-SF32(23), chCode8-SF32(24), chCode7-SF32(25), chCode6-SF32(26), chCode5-SF32(27), chCode4-SF32(28), chCode3-SF32(29), chCode2-SF32(30), chCode1-SF32(31) } (SIZE (32)) } } DownlinkAdditionalTimeslots ::= SEQUENCE { parameters CHOICE { sameAsLast SEQUENCE { timeslotNumber TimeslotNumber }, newParameters SEQUENCE { individualTimeslotInfo IndividualTimeslotInfo, dl-TS-ChannelisationCodesShort DL-TS-ChannelisationCodesShort } } } DownlinkAdditionalTimeslots-VHCR ::= SEQUENCE { parameters CHOICE { sameAsLast SEQUENCE { timeslotNumber TimeslotNumber }, newParameters SEQUENCE { individualTimeslotInfo IndividualTimeslotInfo-VHCR, dl-TS-ChannelisationCodesShort DL-TS-ChannelisationCodesShort-VHCR } } } DownlinkAdditionalTimeslots-LCR-r4 ::= SEQUENCE { parameters CHOICE { sameAsLast SEQUENCE { timeslotNumber TimeslotNumber-LCR-r4 }, newParameters SEQUENCE { individualTimeslotInfo IndividualTimeslotInfo-LCR-r4, dl-TS-ChannelisationCodesShort DL-TS-ChannelisationCodesShort } } } DownlinkTimeslotsCodes ::= SEQUENCE { firstIndividualTimeslotInfo IndividualTimeslotInfo, dl-TS-ChannelisationCodesShort DL-TS-ChannelisationCodesShort, moreTimeslots CHOICE { noMore NULL, additionalTimeslots CHOICE { consecutive INTEGER (1..maxTS-1), timeslotList SEQUENCE (SIZE (1..maxTS-1)) OF DownlinkAdditionalTimeslots } } } DownlinkTimeslotsCodes-VHCR ::= SEQUENCE { firstIndividualTimeslotInfo IndividualTimeslotInfo-VHCR, dl-TS-ChannelisationCodesShort DL-TS-ChannelisationCodesShort, moreTimeslots CHOICE { noMore NULL, additionalTimeslots CHOICE { consecutive INTEGER (1..maxTS-1), timeslotList SEQUENCE (SIZE (1..maxTS-1)) OF DownlinkAdditionalTimeslots-VHCR } } } DownlinkTimeslotsCodes-LCR-r4 ::= SEQUENCE { firstIndividualTimeslotInfo IndividualTimeslotInfo-LCR-r4, dl-TS-ChannelisationCodesShort DL-TS-ChannelisationCodesShort, moreTimeslots CHOICE { noMore NULL, additionalTimeslots CHOICE { consecutive INTEGER (1..maxTS-LCR-1), timeslotList SEQUENCE (SIZE (1..maxTS-LCR-1)) OF DownlinkAdditionalTimeslots-LCR-r4 } } } DPC-Mode ::= ENUMERATED { singleTPC, tpcTripletInSoft } -- Actual value DPCCH-PowerOffset = IE value * 2 DPCCH-PowerOffset ::= INTEGER (-82..-3) -- Actual value DPCCH-PowerOffset2 = 2 + (IE value * 4) DPCCH-PowerOffset2 ::= INTEGER (-28..-13) DPCH-CompressedModeInfo ::= SEQUENCE { tgp-SequenceList TGP-SequenceList } DPCH-CompressedModeStatusInfo ::= SEQUENCE { tgps-Reconfiguration-CFN TGPS-Reconfiguration-CFN, tgp-SequenceShortList SEQUENCE (SIZE (1..maxTGPS)) OF TGP-SequenceShort } -- Actual value DPCH-FrameOffset = IE value * 256 DPCH-FrameOffset::= INTEGER (0..149) DSCH-Mapping ::= SEQUENCE { maxTFCI-Field2Value MaxTFCI-Field2Value, spreadingFactor SF-PDSCH, codeNumber CodeNumberDSCH, multiCodeInfo MultiCodeInfo } DSCH-MappingList ::= SEQUENCE (SIZE (1..maxPDSCH-TFCIgroups)) OF DSCH-Mapping DSCH-RadioLinkIdentifier ::= INTEGER (0..511) DSCH-TransportChannelsInfo ::= SEQUENCE (SIZE (1..maxTrCH)) OF SEQUENCE { dsch-transport-channel-identity TransportChannelIdentity, dsch-TFS TransportFormatSet } DurationTimeInfo ::= INTEGER (1..4096) DynamicPersistenceLevel ::= INTEGER (1..8) DynamicPersistenceLevelList ::= SEQUENCE (SIZE (1..maxPRACH)) OF DynamicPersistenceLevel DynamicPersistenceLevelTF-List ::= SEQUENCE (SIZE (1..maxTF-CPCH)) OF DynamicPersistenceLevel DynamicTFInformationCCCH ::= SEQUENCE { octetModeRLC-SizeInfoType2 OctetModeRLC-SizeInfoType2 } E-AGCH-ChannelisationCode ::= INTEGER (0..255) E-AGCH-Information ::= SEQUENCE { e-AGCH-ChannelisationCode E-AGCH-ChannelisationCode } E-DCH-MinimumSet-E-TFCI ::= INTEGER (0..127) E-DCH-ReconfigurationInfo ::= SEQUENCE { e-DCH-RL-InfoNewServingCell E-DCH-RL-InfoNewServingCell OPTIONAL, e-DCH-RL-InfoOtherCellList SEQUENCE (SIZE (1..maxEDCHRL)) OF E-DCH-RL-InfoOtherCell OPTIONAL } E-DCH-RL-InfoNewServingCell ::= SEQUENCE { primaryCPICH-Info PrimaryCPICH-Info, e-AGCH-Information E-AGCH-Information, servingGrant SEQUENCE { value INTEGER (0..38) OPTIONAL, primary-Secondary-GrantSelector ENUMERATED { primary, secondary } } OPTIONAL, e-DPCCH-DPCCH-PowerOffset E-DPCCH-DPCCH-PowerOffset OPTIONAL, reference-E-TFCIs E-DPDCH-Reference-E-TFCIList OPTIONAL, powerOffsetForSchedInfo INTEGER (0..6) OPTIONAL, threeIndexStepThreshold INTEGER (0..37) OPTIONAL, twoIndexStepThreshold INTEGER (0..37) OPTIONAL, e-HICH-Information E-HICH-Information OPTIONAL, e-RGCH-Info CHOICE { e-RGCH-Information E-RGCH-Information, releaseIndicator NULL } OPTIONAL } E-DCH-RL-InfoOtherCell ::= SEQUENCE { primaryCPICH-Info PrimaryCPICH-Info, e-HICH-Info CHOICE { e-HICH-Information E-HICH-Information, releaseIndicator NULL } OPTIONAL, e-RGCH-Info CHOICE { e-RGCH-Information E-RGCH-Information, releaseIndicator NULL } OPTIONAL } E-DPCCH-Info ::= SEQUENCE { e-DPCCH-DPCCH-PowerOffset E-DPCCH-DPCCH-PowerOffset, happyBit-DelayCondition HappyBit-DelayCondition } E-DPCCH-DPCCH-PowerOffset ::= INTEGER (0..8) E-DPDCH-Info ::= SEQUENCE { e-TFCI-TableIndex E-TFCI-TableIndex, e-DCH-MinimumSet-E-TFCI E-DCH-MinimumSet-E-TFCI OPTIONAL, reference-E-TFCIs E-DPDCH-Reference-E-TFCIList, maxChannelisationCodes E-DPDCH-MaxChannelisationCodes, pl-NonMax E-DPDCH-PL-NonMax, schedulingInfoConfiguration E-DPDCH-SchedulingInfoConfiguration, threeIndexStepThreshold INTEGER (0..37) OPTIONAL, twoIndexStepThreshold INTEGER (0..37) OPTIONAL } E-DPDCH-PeriodicyOfSchedInfo ::= ENUMERATED { everyEDCHTTI, ms4, ms10, ms20, ms50, ms100, ms200, ms500, ms1000 } -- The actual value of E-DPDCH-PL-NonMax is: IE value * 0.04 E-DPDCH-PL-NonMax ::= INTEGER (11..25) E-DPDCH-Reference-E-TFCI ::= SEQUENCE { reference-E-TFCI INTEGER (0..127), reference-E-TFCI-PO INTEGER (0..29) } E-DPDCH-Reference-E-TFCIList ::= SEQUENCE (SIZE (1..8)) OF E-DPDCH-Reference-E-TFCI E-DPDCH-SchedulingInfoConfiguration ::= SEQUENCE { periodicityOfSchedInfo-NoGrant E-DPDCH-PeriodicyOfSchedInfo OPTIONAL, periodicityOfSchedInfo-Grant E-DPDCH-PeriodicyOfSchedInfo OPTIONAL, powerOffsetForSchedInfo INTEGER (0..6) } E-DPDCH-SchedulingTransmConfiguration ::= SEQUENCE { ms2-SchedTransmGrantHARQAlloc BIT STRING (SIZE (8)) OPTIONAL, servingGrant SEQUENCE { value INTEGER (0..38), primary-Secondary-GrantSelector ENUMERATED { primary, secondary } } OPTIONAL } E-DPDCH-MaxChannelisationCodes ::= ENUMERATED { sf256, sf128, sf64, sf32, sf16, sf8, sf4, sf4x2, sf2x2, sf4x2-and-sf2x2 } E-HICH-ChannelisationCode ::= INTEGER (0..127) E-HICH-Information ::= SEQUENCE { channelisationCode E-HICH-ChannelisationCode, signatureSequence E-HICH-RGCH-SignatureSequence } E-HICH-RGCH-SignatureSequence ::= INTEGER (0..39) E-RGCH-CombinationIndex ::= INTEGER (0..5) E-RGCH-Information ::= SEQUENCE { signatureSequence E-HICH-RGCH-SignatureSequence, rg-CombinationIndex E-RGCH-CombinationIndex } E-TFCI-TableIndex ::= INTEGER (0..1) EXT-UL-TimingAdvance ::= SEQUENCE { modeSpecificInfo CHOICE { tdd384 SEQUENCE { ex-ul-TimingAdvance INTEGER (0..255) }, tdd768 SEQUENCE { ex-ul-TimingAdvance INTEGER (0..511) } } } FACH-PCH-Information ::= SEQUENCE { transportFormatSet TransportFormatSet, transportChannelIdentity TransportChannelIdentity, ctch-Indicator BOOLEAN } FACH-PCH-InformationList ::= SEQUENCE (SIZE (1..maxFACHPCH)) OF FACH-PCH-Information Feedback-cycle ::= ENUMERATED { fc0, fc2, fc4, fc8, fc10, fc20, fc40, fc80, fc160} FPACH-Info-r4 ::= SEQUENCE { timeslot TimeslotNumber-LCR-r4, channelisationCode TDD-FPACH-CCode16-r4, midambleShiftAndBurstType MidambleShiftAndBurstType-LCR-r4, wi Wi-LCR } FrequencyInfo ::= SEQUENCE { modeSpecificInfo CHOICE { fdd FrequencyInfoFDD, tdd FrequencyInfoTDD } } FrequencyInfoFDD ::= SEQUENCE { uarfcn-UL UARFCN OPTIONAL, uarfcn-DL UARFCN } FrequencyInfoTDD ::= SEQUENCE { uarfcn-Nt UARFCN } HappyBit-DelayCondition ::= ENUMERATED { ms2, ms10, ms20, ms50, ms100, ms200, ms500, ms1000 } HARQ-Preamble-Mode ::= INTEGER (0..1) HS-ChannelisationCode-LCR ::= ENUMERATED { cc16-1, cc16-2, cc16-3, cc16-4, cc16-5, cc16-6, cc16-7, cc16-8, cc16-9, cc16-10, cc16-11, cc16-12, cc16-13, cc16-14, cc16-15, cc16-16 } HS-PDSCH-Midamble-Configuration-TDD128 ::= SEQUENCE { midambleAllocationMode CHOICE{ defaultMidamble NULL, commonMidamble NULL, ueSpecificMidamble INTEGER (0..15) }, -- Actual value midambleConfiguration = IE value * 2 midambleConfiguration INTEGER (1..8) } HS-SCCH-Info ::= SEQUENCE { modeSpecificInfo CHOICE { fdd SEQUENCE { hS-SCCHChannelisationCodeInfo SEQUENCE (SIZE (1..maxHSSCCHs)) OF HS-SCCH-Codes, dl-ScramblingCode SecondaryScramblingCode OPTIONAL }, tdd CHOICE { tdd384 SEQUENCE { nack-ack-power-offset INTEGER (-7..8), hs-SICH-PowerControl-Info HS-SICH-Power-Control-Info-TDD384, hS-SCCH-SetConfiguration SEQUENCE (SIZE (1..maxHSSCCHs)) OF HS-SCCH-TDD384 }, tdd128 SEQUENCE (SIZE (1..maxHSSCCHs)) OF HS-SCCH-TDD128 } } } HS-SCCH-Info-r6 ::= SEQUENCE { modeSpecificInfo CHOICE { fdd SEQUENCE { hS-SCCHChannelisationCodeInfo SEQUENCE (SIZE (1..maxHSSCCHs)) OF HS-SCCH-Codes, dl-ScramblingCode SecondaryScramblingCode OPTIONAL }, tdd CHOICE { tdd384 SEQUENCE { nack-ack-power-offset INTEGER (-7..8), hs-SICH-PowerControl-Info HS-SICH-Power-Control-Info-TDD384, dhs-sync DHS-Sync OPTIONAL, bler-target Bler-Target, hS-SCCH-SetConfiguration SEQUENCE (SIZE (1..maxHSSCCHs)) OF HS-SCCH-TDD384-r6 }, tdd128 SEQUENCE (SIZE (1..maxHSSCCHs)) OF HS-SCCH-TDD128 } } } HS-SCCH-Info-r7 ::= SEQUENCE { modeSpecificInfo CHOICE { fdd SEQUENCE { hS-SCCHChannelisationCodeInfo SEQUENCE (SIZE (1..maxHSSCCHs)) OF HS-SCCH-Codes, dl-ScramblingCode SecondaryScramblingCode OPTIONAL }, tdd CHOICE { tdd384 SEQUENCE { nack-ack-power-offset INTEGER (-7..8), hs-SICH-PowerControl-Info HS-SICH-Power-Control-Info-TDD384, dhs-sync DHS-Sync OPTIONAL, hS-SCCH-SetConfiguration SEQUENCE (SIZE (1..maxHSSCCHs)) OF HS-SCCH-TDD384-r6 }, tdd768 SEQUENCE { nack-ack-power-offset INTEGER (-7..8), hs-SICH-PowerControl-Info HS-SICH-Power-Control-Info-TDD768, dhs-sync DHS-Sync OPTIONAL, bler-target Bler-Target, hS-SCCH-SetConfiguration SEQUENCE (SIZE (1..maxHSSCCHs)) OF HS-SCCH-TDD768 }, tdd128 SEQUENCE (SIZE (1..maxHSSCCHs)) OF HS-SCCH-TDD128 } } } HS-SCCH-Codes ::= INTEGER (0..127) HS-SCCH-TDD128 ::= SEQUENCE { timeslotNumber TimeslotNumber-LCR-r4, firstChannelisationCode HS-ChannelisationCode-LCR, secondChannelisationCode HS-ChannelisationCode-LCR, midambleAllocationMode CHOICE { defaultMidamble NULL, commonMidamble NULL, ueSpecificMidamble INTEGER(0..15) }, -- Actual value midambleConfiguration = IE value * 2 midambleConfiguration INTEGER (1..8), bler-target Bler-Target, hs-sich-configuration HS-SICH-Configuration-TDD128 } HS-SICH-Configuration-TDD128 ::= SEQUENCE { timeslotNumber TimeslotNumber-LCR-r4, channelisationCode HS-ChannelisationCode-LCR, midambleAllocationMode CHOICE { defaultMidamble NULL, ueSpecificMidamble SEQUENCE { midambleShift MidambleShiftLong } }, -- Actual value midambleConfiguration = IE value * 2 midambleConfiguration INTEGER (1..8), nack-ack-power-offset INTEGER (-7..8), power-level-HSSICH INTEGER (-120..-58), tpc-step-size ENUMERATED { s1, s2, s3 , spare1} } HS-SCCH-TDD384 ::= SEQUENCE { timeslotNumber TimeslotNumber, channelisationCode DL-TS-ChannelisationCode, midambleAllocationMode CHOICE { defaultMidamble NULL, commonMidamble NULL, ueSpecificMidamble SEQUENCE { midambleShift MidambleShiftLong } }, midambleconfiguration MidambleConfigurationBurstType1and3, bler-target Bler-Target, hs-sich-configuration HS-SICH-Configuration-TDD384 } HS-SCCH-TDD384-r6 ::= SEQUENCE { timeslotNumber TimeslotNumber, channelisationCode DL-TS-ChannelisationCode, midambleAllocationMode CHOICE { defaultMidamble NULL, commonMidamble NULL, ueSpecificMidamble SEQUENCE { midambleShift MidambleShiftLong } }, midambleconfiguration MidambleConfigurationBurstType1and3, hs-sich-configuration HS-SICH-Configuration-TDD384 } HS-SCCH-TDD768 ::= SEQUENCE { timeslotNumber TimeslotNumber, channelisationCode DL-TS-ChannelisationCode-VHCR, midambleAllocationMode CHOICE { defaultMidamble NULL, commonMidamble NULL, ueSpecificMidamble SEQUENCE { midambleShift MidambleShiftLong } }, midambleconfiguration MidambleConfigurationBurstType1and3, hs-sich-configuration HS-SICH-Configuration-TDD768 } HS-SICH-Configuration-TDD384 ::= SEQUENCE { timeslotNumber TimeslotNumber, channelisationCode DL-TS-ChannelisationCode, midambleAllocationMode CHOICE { defaultMidamble NULL, ueSpecificMidamble SEQUENCE { midambleShift MidambleShiftLong } }, midambleconfiguration MidambleConfigurationBurstType1and3 } HS-SICH-Configuration-TDD768 ::= SEQUENCE { timeslotNumber TimeslotNumber, channelisationCode DL-TS-ChannelisationCode-VHCR, midambleAllocationMode CHOICE { defaultMidamble NULL, ueSpecificMidamble SEQUENCE { midambleShift MidambleShiftLong } }, midambleconfiguration MidambleConfigurationBurstType1and3 } HS-SICH-Power-Control-Info-TDD384 ::= SEQUENCE { -- Actual value ul-target-SIR = IE value * 0.5 ul-target-SIR INTEGER (-22..40), hs-sich-ConstantValue ConstantValue } HS-SICH-Power-Control-Info-TDD768 ::= SEQUENCE { -- Actual value ul-target-SIR = IE value * 0.5 ul-target-SIR INTEGER (-22..40), hs-sich-ConstantValue ConstantValue } IndividualTimeslotInfo ::= SEQUENCE { timeslotNumber TimeslotNumber, tfci-Existence BOOLEAN, midambleShiftAndBurstType MidambleShiftAndBurstType } IndividualTimeslotInfo-VHCR ::= SEQUENCE { timeslotNumber TimeslotNumber, tfci-Existence BOOLEAN, midambleShiftAndBurstType-VHCR MidambleShiftAndBurstType-VHCR } IndividualTimeslotInfo-LCR-r4 ::= SEQUENCE { timeslotNumber TimeslotNumber-LCR-r4, tfci-Existence BOOLEAN, midambleShiftAndBurstType MidambleShiftAndBurstType-LCR-r4, modulation ENUMERATED { mod-QPSK, mod-8PSK }, ss-TPC-Symbols ENUMERATED { zero, one, sixteenOverSF }, additionalSS-TPC-Symbols INTEGER(1..15) OPTIONAL } IndividualTimeslotInfo-LCR-r4-ext ::= SEQUENCE { -- timeslotNumber and tfci-Existence is taken from IndividualTimeslotInfo. -- midambleShiftAndBurstType in IndividualTimeslotInfo shall be ignored. midambleShiftAndBurstType MidambleShiftAndBurstType-LCR-r4, modulation ENUMERATED { mod-QPSK, mod-8PSK }, ss-TPC-Symbols ENUMERATED { zero, one, sixteenOverSF } } IndividualTS-Interference ::= SEQUENCE { timeslot TimeslotNumber, ul-TimeslotInterference TDD-UL-Interference } IndividualTS-InterferenceList ::= SEQUENCE (SIZE (1..maxTS)) OF IndividualTS-Interference ITP ::= ENUMERATED { mode0, mode1 } NidentifyAbort ::= INTEGER (1..128) MaxAllowedUL-TX-Power ::= INTEGER (-50..33) MaxAvailablePCPCH-Number ::= INTEGER (1..64) MaxPowerIncrease-r4 ::= INTEGER (0..3) MaxTFCI-Field2Value ::= INTEGER (1..1023) Measurement-Feedback-Info ::= SEQUENCE { modeSpecificInfo CHOICE { fdd SEQUENCE { measurementPowerOffset MeasurementPowerOffset, feedback-cycle Feedback-cycle, cqi-RepetitionFactor CQI-RepetitionFactor, deltaCQI DeltaCQI }, tdd NULL } } MidambleConfigurationBurstType1and3 ::= ENUMERATED {ms4, ms8, ms16} MidambleConfigurationBurstType2 ::= ENUMERATED {ms3, ms6} MidambleConfigurationBurstType2-VHCR ::= ENUMERATED {ms4, ms8} MidambleShiftAndBurstType ::= SEQUENCE { burstType CHOICE { type1 SEQUENCE { midambleConfigurationBurstType1and3 MidambleConfigurationBurstType1and3, midambleAllocationMode CHOICE { defaultMidamble NULL, commonMidamble NULL, ueSpecificMidamble SEQUENCE { midambleShift MidambleShiftLong } } }, type2 SEQUENCE { midambleConfigurationBurstType2 MidambleConfigurationBurstType2, midambleAllocationMode CHOICE { defaultMidamble NULL, commonMidamble NULL, ueSpecificMidamble SEQUENCE { midambleShift MidambleShiftShort } } }, type3 SEQUENCE { midambleConfigurationBurstType1and3 MidambleConfigurationBurstType1and3, midambleAllocationMode CHOICE { defaultMidamble NULL, ueSpecificMidamble SEQUENCE { midambleShift MidambleShiftLong } } } } } MidambleShiftAndBurstType-VHCR ::= SEQUENCE { burstType CHOICE { type1 SEQUENCE { midambleConfigurationBurstType1and3 MidambleConfigurationBurstType1and3, midambleAllocationMode CHOICE { defaultMidamble NULL, commonMidamble NULL, ueSpecificMidamble SEQUENCE { midambleShift MidambleShiftLong } } }, type2 SEQUENCE { midambleConfigurationBurstType2 MidambleConfigurationBurstType2-VHCR, midambleAllocationMode CHOICE { defaultMidamble NULL, commonMidamble NULL, ueSpecificMidamble SEQUENCE { midambleShift MidambleShiftShort-VHCR } } }, type3 SEQUENCE { midambleConfigurationBurstType1and3 MidambleConfigurationBurstType1and3, midambleAllocationMode CHOICE { defaultMidamble NULL, ueSpecificMidamble SEQUENCE { midambleShift MidambleShiftLong } } } } } MidambleShiftAndBurstType-DL ::= SEQUENCE { burstType CHOICE { type1 SEQUENCE { midambleConfigurationBurstType1and3 MidambleConfigurationBurstType1and3, midambleAllocationMode CHOICE { defaultMidamble NULL, commonMidamble NULL, ueSpecificMidamble SEQUENCE { midambleShift MidambleShiftLong } } }, type2 SEQUENCE { midambleConfigurationBurstType2 MidambleConfigurationBurstType2, midambleAllocationMode CHOICE { defaultMidamble NULL, commonMidamble NULL, ueSpecificMidamble SEQUENCE { midambleShift MidambleShiftShort } } } } } MidambleShiftAndBurstType-DL-VHCR ::= SEQUENCE { burstType CHOICE { type1 SEQUENCE { midambleConfigurationBurstType1and3 MidambleConfigurationBurstType1and3, midambleAllocationMode CHOICE { defaultMidamble NULL, commonMidamble NULL, ueSpecificMidamble SEQUENCE { midambleShift MidambleShiftLong } } }, type2 SEQUENCE { midambleConfigurationBurstType2 MidambleConfigurationBurstType2-VHCR, midambleAllocationMode CHOICE { defaultMidamble NULL, commonMidamble NULL, ueSpecificMidamble SEQUENCE { midambleShift MidambleShiftShort-VHCR } } } } } MidambleShiftAndBurstType-LCR-r4 ::= SEQUENCE { midambleAllocationMode CHOICE { defaultMidamble NULL, commonMidamble NULL, ueSpecificMidamble SEQUENCE { midambleShift INTEGER (0..15) } }, -- Actual value midambleConfiguration = IE value * 2 midambleConfiguration INTEGER (1..8) } MidambleShiftLong ::= INTEGER (0..15) MidambleShiftShort ::= INTEGER (0..5) MidambleShiftShort-VHCR ::= INTEGER (0..7) MinimumSpreadingFactor ::= ENUMERATED { sf4, sf8, sf16, sf32, sf64, sf128, sf256 } MultiCodeInfo ::= INTEGER (1..16) N-EOT ::= INTEGER (0..7) N-GAP ::= ENUMERATED { f2, f4, f8 } N-PCH ::= INTEGER (1..8) N-StartMessage ::= INTEGER (1..8) NB01 ::= INTEGER (0..50) NF-Max ::= INTEGER (1..64) NumberOfDPDCH ::= INTEGER (1..maxDPDCH-UL) NumberOfFBI-Bits ::= INTEGER (1..2) OpenLoopPowerControl-TDD ::= SEQUENCE { primaryCCPCH-TX-Power PrimaryCCPCH-TX-Power, -- alpha, prach-ConstantValue, dpch-ConstantValue and pusch-ConstantValue -- shall be ignored in 1.28Mcps TDD mode. alpha Alpha OPTIONAL, prach-ConstantValue ConstantValueTdd, dpch-ConstantValue ConstantValueTdd, pusch-ConstantValue ConstantValueTdd OPTIONAL } OpenLoopPowerControl-IPDL-TDD-r4 ::= SEQUENCE { ipdl-alpha Alpha, maxPowerIncrease MaxPowerIncrease-r4 } PagingIndicatorLength ::= ENUMERATED { pi4, pi8, pi16 } PC-Preamble ::= INTEGER (0..7) PCP-Length ::= ENUMERATED { as0, as8 } PCPCH-ChannelInfo ::= SEQUENCE { pcpch-UL-ScramblingCode INTEGER (0..79), pcpch-DL-ChannelisationCode INTEGER (0..511), pcpch-DL-ScramblingCode SecondaryScramblingCode OPTIONAL, pcp-Length PCP-Length, ucsm-Info UCSM-Info OPTIONAL } PCPCH-ChannelInfoList ::= SEQUENCE (SIZE (1..maxPCPCHs)) OF PCPCH-ChannelInfo PCPICH-UsageForChannelEst ::= ENUMERATED { mayBeUsed, shallNotBeUsed } PDSCH-CapacityAllocationInfo ::= SEQUENCE { -- pdsch-PowerControlInfo is conditional on new-configuration branch below, if this -- selected the IE is OPTIONAL otherwise it should not be sent pdsch-PowerControlInfo PDSCH-PowerControlInfo OPTIONAL, pdsch-AllocationPeriodInfo AllocationPeriodInfo, configuration CHOICE { old-Configuration SEQUENCE { tfcs-ID TFCS-IdentityPlain DEFAULT 1, pdsch-Identity PDSCH-Identity }, new-Configuration SEQUENCE { pdsch-Info PDSCH-Info, pdsch-Identity PDSCH-Identity OPTIONAL } } } PDSCH-CapacityAllocationInfo-r4 ::= SEQUENCE { pdsch-AllocationPeriodInfo AllocationPeriodInfo, configuration CHOICE { old-Configuration SEQUENCE { tfcs-ID TFCS-IdentityPlain DEFAULT 1, pdsch-Identity PDSCH-Identity }, new-Configuration SEQUENCE { pdsch-Info PDSCH-Info-r4, pdsch-Identity PDSCH-Identity OPTIONAL, pdsch-PowerControlInfo PDSCH-PowerControlInfo OPTIONAL } } } PDSCH-CapacityAllocationInfo-r7 ::= SEQUENCE { pdsch-AllocationPeriodInfo AllocationPeriodInfo, configuration CHOICE { old-Configuration SEQUENCE { tfcs-ID TFCS-IdentityPlain DEFAULT 1, pdsch-Identity PDSCH-Identity }, new-Configuration SEQUENCE { pdsch-Info PDSCH-Info-r7, pdsch-Identity PDSCH-Identity OPTIONAL, pdsch-PowerControlInfo PDSCH-PowerControlInfo OPTIONAL } } } PDSCH-CodeInfo ::= SEQUENCE { spreadingFactor SF-PDSCH, codeNumber CodeNumberDSCH, multiCodeInfo MultiCodeInfo } PDSCH-CodeInfoList ::= SEQUENCE (SIZE (1..maxTFCI-2-Combs)) OF PDSCH-CodeInfo PDSCH-CodeMap ::= SEQUENCE { spreadingFactor SF-PDSCH, multiCodeInfo MultiCodeInfo, codeNumberStart CodeNumberDSCH, codeNumberStop CodeNumberDSCH } PDSCH-CodeMapList ::= SEQUENCE (SIZE (1..maxPDSCH-TFCIgroups)) OF PDSCH-CodeMap PDSCH-CodeMapping ::= SEQUENCE { dl-ScramblingCode SecondaryScramblingCode OPTIONAL, signallingMethod CHOICE { codeRange CodeRange, tfci-Range DSCH-MappingList, explicit-config PDSCH-CodeInfoList, replace ReplacedPDSCH-CodeInfoList } } PDSCH-Identity ::= INTEGER (1..hiPDSCHidentities) PDSCH-Info ::= SEQUENCE { tfcs-ID TFCS-IdentityPlain DEFAULT 1, commonTimeslotInfo CommonTimeslotInfo OPTIONAL, pdsch-TimeslotsCodes DownlinkTimeslotsCodes OPTIONAL } PDSCH-Info-r4 ::= SEQUENCE { tfcs-ID TFCS-IdentityPlain DEFAULT 1, commonTimeslotInfo CommonTimeslotInfo OPTIONAL, tddOption CHOICE { tdd384 SEQUENCE { pdsch-TimeslotsCodes DownlinkTimeslotsCodes OPTIONAL }, tdd128 SEQUENCE { pdsch-TimeslotsCodes DownlinkTimeslotsCodes-LCR-r4 OPTIONAL } } } PDSCH-Info-r7 ::= SEQUENCE { tfcs-ID TFCS-IdentityPlain DEFAULT 1, commonTimeslotInfo CommonTimeslotInfo OPTIONAL, tddOption CHOICE { tdd384 SEQUENCE { pdsch-TimeslotsCodes DownlinkTimeslotsCodes OPTIONAL }, tdd768 SEQUENCE { pdsch-TimeslotsCodes DownlinkTimeslotsCodes-VHCR OPTIONAL }, tdd128 SEQUENCE { pdsch-TimeslotsCodes DownlinkTimeslotsCodes-LCR-r4 OPTIONAL } } } PDSCH-Info-LCR-r4 ::= SEQUENCE { tfcs-ID TFCS-IdentityPlain DEFAULT 1, commonTimeslotInfo CommonTimeslotInfo OPTIONAL, pdsch-TimeslotsCodes DownlinkTimeslotsCodes-LCR-r4 OPTIONAL } PDSCH-PowerControlInfo ::= SEQUENCE { tpc-StepSizeTDD TPC-StepSizeTDD OPTIONAL, ul-CCTrChTPCList UL-CCTrChTPCList OPTIONAL } PDSCH-SHO-DCH-Info ::= SEQUENCE { dsch-RadioLinkIdentifier DSCH-RadioLinkIdentifier, rl-IdentifierList RL-IdentifierList OPTIONAL } PDSCH-SysInfo ::= SEQUENCE { pdsch-Identity PDSCH-Identity, pdsch-Info PDSCH-Info, dsch-TFS TransportFormatSet OPTIONAL, dsch-TFCS TFCS OPTIONAL } PDSCH-SysInfo-r7 ::= SEQUENCE { pdsch-Identity PDSCH-Identity, pdsch-Info PDSCH-Info-r7, dsch-TransportChannelsInfo DSCH-TransportChannelsInfo OPTIONAL, dsch-TFCS TFCS OPTIONAL } PDSCH-SysInfo-HCR-r5 ::= SEQUENCE { pdsch-Identity PDSCH-Identity, pdsch-Info PDSCH-Info, dsch-TransportChannelsInfo DSCH-TransportChannelsInfo OPTIONAL, dsch-TFCS TFCS OPTIONAL } PDSCH-SysInfo-LCR-r4 ::= SEQUENCE { pdsch-Identity PDSCH-Identity, pdsch-Info PDSCH-Info-LCR-r4, dsch-TFS TransportFormatSet OPTIONAL, dsch-TFCS TFCS OPTIONAL } PDSCH-SysInfoList ::= SEQUENCE (SIZE (1..maxPDSCH)) OF PDSCH-SysInfo PDSCH-SysInfoList-r7 ::= SEQUENCE (SIZE (1..maxPDSCH)) OF PDSCH-SysInfo-r7 PDSCH-SysInfoList-HCR-r5 ::= SEQUENCE (SIZE (1..maxPDSCH)) OF PDSCH-SysInfo-HCR-r5 PDSCH-SysInfoList-LCR-r4 ::= SEQUENCE (SIZE (1..maxPDSCH)) OF PDSCH-SysInfo-LCR-r4 PDSCH-SysInfoList-SFN ::= SEQUENCE (SIZE (1..maxPDSCH)) OF SEQUENCE { pdsch-SysInfo PDSCH-SysInfo, sfn-TimeInfo SFN-TimeInfo OPTIONAL } PDSCH-SysInfoList-SFN-HCR-r5 ::= SEQUENCE (SIZE (1..maxPDSCH)) OF SEQUENCE { pdsch-SysInfo PDSCH-SysInfo-HCR-r5, sfn-TimeInfo SFN-TimeInfo OPTIONAL } PDSCH-SysInfoList-SFN-LCR-r4 ::= SEQUENCE (SIZE (1..maxPDSCH)) OF SEQUENCE { pdsch-SysInfo PDSCH-SysInfo-LCR-r4, sfn-TimeInfo SFN-TimeInfo OPTIONAL } PersistenceScalingFactor ::= ENUMERATED { psf0-9, psf0-8, psf0-7, psf0-6, psf0-5, psf0-4, psf0-3, psf0-2 } PersistenceScalingFactorList ::= SEQUENCE (SIZE (1..maxASCpersist)) OF PersistenceScalingFactor PI-CountPerFrame ::= ENUMERATED { e18, e36, e72, e144 } PichChannelisationCodeList-LCR-r4 ::= SEQUENCE (SIZE (1..2)) OF DL-TS-ChannelisationCode PICH-Info ::= CHOICE { fdd SEQUENCE { channelisationCode256 ChannelisationCode256, pi-CountPerFrame PI-CountPerFrame, sttd-Indicator BOOLEAN }, tdd SEQUENCE { channelisationCode TDD-PICH-CCode OPTIONAL, timeslot TimeslotNumber OPTIONAL, midambleShiftAndBurstType MidambleShiftAndBurstType, repetitionPeriodLengthOffset RepPerLengthOffset-PICH OPTIONAL, pagingIndicatorLength PagingIndicatorLength DEFAULT pi4, n-GAP N-GAP DEFAULT f4, n-PCH N-PCH DEFAULT 2 } } PICH-Info-r7 ::= CHOICE { fdd SEQUENCE { channelisationCode256 ChannelisationCode256, pi-CountPerFrame PI-CountPerFrame, sttd-Indicator BOOLEAN }, tdd384 SEQUENCE { channelisationCode TDD-PICH-CCode OPTIONAL, timeslot TimeslotNumber OPTIONAL, midambleShiftAndBurstType MidambleShiftAndBurstType, repetitionPeriodLengthOffset RepPerLengthOffset-PICH OPTIONAL, pagingIndicatorLength PagingIndicatorLength DEFAULT pi4, n-GAP N-GAP DEFAULT f4, n-PCH N-PCH DEFAULT 2 }, tdd768 SEQUENCE { channelisationCode TDD768-PICH-CCode OPTIONAL, timeslot TimeslotNumber OPTIONAL, midambleShiftAndBurstType MidambleShiftAndBurstType, repetitionPeriodLengthOffset RepPerLengthOffset-PICH OPTIONAL, pagingIndicatorLength PagingIndicatorLength DEFAULT pi4, n-GAP N-GAP DEFAULT f4, n-PCH N-PCH DEFAULT 2 } } PICH-Info-LCR-r4 ::= SEQUENCE { timeslot TimeslotNumber-LCR-r4 OPTIONAL, pichChannelisationCodeList-LCR-r4 PichChannelisationCodeList-LCR-r4, midambleShiftAndBurstType MidambleShiftAndBurstType-LCR-r4, repetitionPeriodLengthOffset RepPerLengthOffset-PICH OPTIONAL, pagingIndicatorLength PagingIndicatorLength DEFAULT pi4, n-GAP N-GAP DEFAULT f4, n-PCH N-PCH DEFAULT 2 } PICH-PowerOffset ::= INTEGER (-10..5) PilotBits128 ::= ENUMERATED { pb4, pb8 } PilotBits256 ::= ENUMERATED { pb2, pb4, pb8 } -- Actual measurement power offset value = IE value * 0.5 MeasurementPowerOffset ::= INTEGER (-12..26) PLCCH-Info ::= SEQUENCE { plcchSequenceNumber INTEGER(1..17), timeslotNumber TimeslotNumber-LCR-r4, channelisationCode DL-TS-ChannelisationCode, tpcCommandTargetRate TPC-CommandTargetRate } PositionFixedOrFlexible ::= ENUMERATED { fixed, flexible } PowerControlAlgorithm ::= CHOICE { algorithm1 TPC-StepSizeFDD, algorithm2 NULL } PowerOffsetPilot-pdpdch ::= INTEGER (0..24) PowerOffsetTPC-pdpdch ::= INTEGER (0..24) PowerRampStep ::= INTEGER (1..8) PRACH-ChanCodes-LCR-r4 ::= SEQUENCE (SIZE (1..4)) OF TDD-PRACH-CCode-LCR-r4 PRACH-Definition-LCR-r4 ::= SEQUENCE { timeslot TimeslotNumber-PRACH-LCR-r4, prach-ChanCodes-LCR PRACH-ChanCodes-LCR-r4, midambleShiftAndBurstType MidambleShiftAndBurstType-LCR-r4, fpach-Info FPACH-Info-r4 } PRACH-Midamble ::= ENUMERATED { direct, direct-Inverted } PRACH-Partitioning ::= CHOICE { fdd SEQUENCE (SIZE (1..maxASC)) OF -- TABULAR: If only "NumASC+1" (with, NumASC+1 < maxASC) ASCSetting-FDD are listed, -- the remaining (NumASC+2 through maxASC) ASCs are unspecified. ASCSetting-FDD, tdd SEQUENCE (SIZE (1..maxASC)) OF -- TABULAR: If only "NumASC+1" (with, NumASC+1 < maxASC) ASCSetting-TDD are listed, -- the remaining (NumASC+2 through maxASC) ASCs are unspecified. ASCSetting-TDD } PRACH-Partitioning-r7 ::= CHOICE { fdd SEQUENCE (SIZE (1..maxASC)) OF -- TABULAR: If only "NumASC+1" (with, NumASC+1 < maxASC) ASCSetting-FDD are listed, -- the remaining (NumASC+2 through maxASC) ASCs are unspecified. ASCSetting-FDD, tdd SEQUENCE (SIZE (1..maxASC)) OF -- TABULAR: If only "NumASC+1" (with, NumASC+1 < maxASC) ASCSetting-TDD are listed, -- the remaining (NumASC+2 through maxASC) ASCs are unspecified. ASCSetting-TDD-r7 } PRACH-Partitioning-LCR-r4 ::= SEQUENCE (SIZE (1..maxASC)) OF -- TABULAR: If only "NumASC+1" (with, NumASC+1 < maxASC) ASCSetting-TDD-LCR-r4 are listed, -- the remaining (NumASC+2 through maxASC) ASCs are unspecified. ASCSetting-TDD-LCR-r4 PRACH-PowerOffset ::= SEQUENCE { powerRampStep PowerRampStep, preambleRetransMax PreambleRetransMax } PRACH-RACH-Info ::= SEQUENCE { modeSpecificInfo CHOICE { fdd SEQUENCE { availableSignatures AvailableSignatures, availableSF SF-PRACH, preambleScramblingCodeWordNumber PreambleScramblingCodeWordNumber, puncturingLimit PuncturingLimit, availableSubChannelNumbers AvailableSubChannelNumbers }, tdd SEQUENCE { timeslot TimeslotNumber, channelisationCodeList TDD-PRACH-CCodeList, prach-Midamble PRACH-Midamble } } } PRACH-RACH-Info-r7 ::= SEQUENCE { modeSpecificInfo CHOICE { fdd SEQUENCE { availableSignatures AvailableSignatures, availableSF SF-PRACH, preambleScramblingCodeWordNumber PreambleScramblingCodeWordNumber, puncturingLimit PuncturingLimit, availableSubChannelNumbers AvailableSubChannelNumbers }, tdd384 SEQUENCE { timeslot TimeslotNumber, channelisationCodeList TDD-PRACH-CCodeList, prach-Midamble PRACH-Midamble }, tdd768 SEQUENCE { timeslot TimeslotNumber, channelisationCodeList TDD768-PRACH-CCodeList, prach-Midamble PRACH-Midamble } } } PRACH-RACH-Info-LCR-r4 ::= SEQUENCE { sync-UL-Info SYNC-UL-Info-r4, prach-DefinitionList SEQUENCE (SIZE (1..maxPRACH-FPACH)) OF PRACH-Definition-LCR-r4 } PRACH-SystemInformation ::= SEQUENCE { prach-RACH-Info PRACH-RACH-Info, transportChannelIdentity TransportChannelIdentity, rach-TransportFormatSet TransportFormatSet OPTIONAL, rach-TFCS TFCS OPTIONAL, prach-Partitioning PRACH-Partitioning OPTIONAL, persistenceScalingFactorList PersistenceScalingFactorList OPTIONAL, ac-To-ASC-MappingTable AC-To-ASC-MappingTable OPTIONAL, modeSpecificInfo CHOICE { fdd SEQUENCE { primaryCPICH-TX-Power PrimaryCPICH-TX-Power OPTIONAL, constantValue ConstantValue OPTIONAL, prach-PowerOffset PRACH-PowerOffset OPTIONAL, rach-TransmissionParameters RACH-TransmissionParameters OPTIONAL, aich-Info AICH-Info OPTIONAL }, tdd NULL } } PRACH-SystemInformation-r7 ::= SEQUENCE { prach-RACH-Info PRACH-RACH-Info-r7, transportChannelIdentity TransportChannelIdentity, rach-TransportFormatSet TransportFormatSet OPTIONAL, rach-TFCS TFCS OPTIONAL, prach-Partitioning PRACH-Partitioning-r7 OPTIONAL, persistenceScalingFactorList PersistenceScalingFactorList OPTIONAL, ac-To-ASC-MappingTable AC-To-ASC-MappingTable OPTIONAL, modeSpecificInfo CHOICE { fdd SEQUENCE { primaryCPICH-TX-Power PrimaryCPICH-TX-Power OPTIONAL, constantValue ConstantValue OPTIONAL, prach-PowerOffset PRACH-PowerOffset OPTIONAL, rach-TransmissionParameters RACH-TransmissionParameters OPTIONAL, aich-Info AICH-Info OPTIONAL }, tdd NULL } } PRACH-SystemInformation-LCR-r4 ::= SEQUENCE { prach-RACH-Info-LCR PRACH-RACH-Info-LCR-r4, rach-TransportFormatSet-LCR TransportFormatSet-LCR OPTIONAL, prach-Partitioning-LCR PRACH-Partitioning-LCR-r4 OPTIONAL } PRACH-SystemInformationList ::= SEQUENCE (SIZE (1..maxPRACH)) OF PRACH-SystemInformation PRACH-SystemInformationList-r7 ::= SEQUENCE (SIZE (1..maxPRACH)) OF PRACH-SystemInformation-r7 PRACH-SystemInformationList-LCR-r4 ::= SEQUENCE (SIZE (1..maxPRACH)) OF PRACH-SystemInformation-LCR-r4 PreambleRetransMax ::= INTEGER (1..64) PreambleScramblingCodeWordNumber ::= INTEGER (0..15) PreDefPhyChConfiguration ::= SEQUENCE { ul-DPCH-InfoPredef UL-DPCH-InfoPredef, dl-CommonInformationPredef DL-CommonInformationPredef OPTIONAL } PrimaryCCPCH-Info ::= CHOICE { fdd SEQUENCE { tx-DiversityIndicator BOOLEAN }, tdd SEQUENCE { -- syncCase should be ignored for 1.28Mcps TDD mode syncCase CHOICE { syncCase1 SEQUENCE { timeslot TimeslotNumber }, syncCase2 SEQUENCE { timeslotSync2 TimeslotSync2 } } OPTIONAL, cellParametersID CellParametersID OPTIONAL, sctd-Indicator BOOLEAN } } PrimaryCCPCH-Info-r4 ::= CHOICE { fdd SEQUENCE { tx-DiversityIndicator BOOLEAN }, tdd SEQUENCE { tddOption CHOICE { tdd384 SEQUENCE { syncCase CHOICE { syncCase1 SEQUENCE { timeslot TimeslotNumber }, syncCase2 SEQUENCE { timeslotSync2 TimeslotSync2 } } OPTIONAL }, tdd128 SEQUENCE { tstd-Indicator BOOLEAN } }, cellParametersID CellParametersID OPTIONAL, sctd-Indicator BOOLEAN } } PrimaryCCPCH-Info-r7 ::= CHOICE { fdd SEQUENCE { tx-DiversityIndicator BOOLEAN }, tdd SEQUENCE { tddOption CHOICE { tdd384 SEQUENCE { syncCase CHOICE { syncCase1 SEQUENCE { timeslot TimeslotNumber }, syncCase2 SEQUENCE { timeslotSync2 TimeslotSync2 } } OPTIONAL }, tdd768 SEQUENCE { syncCase CHOICE { syncCase1 SEQUENCE { timeslot TimeslotNumber }, syncCase2 SEQUENCE { timeslotSync2 TimeslotSync2 } } OPTIONAL }, tdd128 SEQUENCE { tstd-Indicator BOOLEAN } }, cellParametersID CellParametersID OPTIONAL, sctd-Indicator BOOLEAN } } PrimaryCCPCH-Info-LCR-r4 ::= SEQUENCE { tstd-Indicator BOOLEAN, cellParametersID CellParametersID OPTIONAL, sctd-Indicator BOOLEAN } -- For 1.28Mcps TDD, the following IE includes elements for the PCCPCH Info additional to those -- in PrimaryCCPCH-Info PrimaryCCPCH-Info-LCR-r4-ext ::= SEQUENCE { tstd-Indicator BOOLEAN } PrimaryCCPCH-InfoPost ::= SEQUENCE { syncCase CHOICE { syncCase1 SEQUENCE { timeslot TimeslotNumber }, syncCase2 SEQUENCE { timeslotSync2 TimeslotSync2 } }, cellParametersID CellParametersID, sctd-Indicator BOOLEAN } PrimaryCCPCH-InfoPostTDD-LCR-r4 ::= SEQUENCE { tstd-Indicator BOOLEAN, cellParametersID CellParametersID, sctd-Indicator BOOLEAN } PrimaryCCPCH-TX-Power ::= INTEGER (6..43) PrimaryCPICH-Info ::= SEQUENCE { primaryScramblingCode PrimaryScramblingCode } PrimaryCPICH-TX-Power ::= INTEGER (-10..50) PrimaryScramblingCode ::= INTEGER (0..511) PuncturingLimit ::= ENUMERATED { pl0-40, pl0-44, pl0-48, pl0-52, pl0-56, pl0-60, pl0-64, pl0-68, pl0-72, pl0-76, pl0-80, pl0-84, pl0-88, pl0-92, pl0-96, pl1 } PUSCH-CapacityAllocationInfo ::= SEQUENCE { pusch-Allocation CHOICE { pusch-AllocationPending NULL, pusch-AllocationAssignment SEQUENCE { pusch-AllocationPeriodInfo AllocationPeriodInfo, pusch-PowerControlInfo UL-TargetSIR OPTIONAL, configuration CHOICE { old-Configuration SEQUENCE { tfcs-ID TFCS-IdentityPlain DEFAULT 1, pusch-Identity PUSCH-Identity }, new-Configuration SEQUENCE { pusch-Info PUSCH-Info, pusch-Identity PUSCH-Identity OPTIONAL } } } } } PUSCH-CapacityAllocationInfo-r4 ::= SEQUENCE { pusch-Allocation CHOICE { pusch-AllocationPending NULL, pusch-AllocationAssignment SEQUENCE { pusch-AllocationPeriodInfo AllocationPeriodInfo, pusch-PowerControlInfo PUSCH-PowerControlInfo-r4 OPTIONAL, configuration CHOICE { old-Configuration SEQUENCE { tfcs-ID TFCS-IdentityPlain DEFAULT 1, pusch-Identity PUSCH-Identity }, new-Configuration SEQUENCE { pusch-Info PUSCH-Info-r4, pusch-Identity PUSCH-Identity OPTIONAL } } } } } PUSCH-CapacityAllocationInfo-r7 ::= SEQUENCE { pusch-Allocation CHOICE { pusch-AllocationPending NULL, pusch-AllocationAssignment SEQUENCE { pusch-AllocationPeriodInfo AllocationPeriodInfo, pusch-PowerControlInfo PUSCH-PowerControlInfo-r7 OPTIONAL, configuration CHOICE { old-Configuration SEQUENCE { tfcs-ID TFCS-IdentityPlain DEFAULT 1, pusch-Identity PUSCH-Identity }, new-Configuration SEQUENCE { pusch-Info PUSCH-Info-VHCR, pusch-Identity PUSCH-Identity OPTIONAL } } } } } PUSCH-Identity ::= INTEGER (1..hiPUSCHidentities) PUSCH-Info ::= SEQUENCE { tfcs-ID TFCS-IdentityPlain DEFAULT 1, commonTimeslotInfo CommonTimeslotInfo OPTIONAL, pusch-TimeslotsCodes UplinkTimeslotsCodes OPTIONAL } PUSCH-Info-r4 ::= SEQUENCE { tfcs-ID TFCS-IdentityPlain DEFAULT 1, commonTimeslotInfo CommonTimeslotInfo OPTIONAL, tddOption CHOICE { tdd384 SEQUENCE { pusch-TimeslotsCodes UplinkTimeslotsCodes OPTIONAL }, tdd128 SEQUENCE { pusch-TimeslotsCodes UplinkTimeslotsCodes-LCR-r4 OPTIONAL } } } PUSCH-Info-VHCR ::= SEQUENCE { tfcs-ID TFCS-IdentityPlain DEFAULT 1, commonTimeslotInfo CommonTimeslotInfo OPTIONAL, pusch-TimeslotsCodes-VHCR UplinkTimeslotsCodes-VHCR OPTIONAL } PUSCH-Info-LCR-r4 ::= SEQUENCE { tfcs-ID TFCS-IdentityPlain DEFAULT 1, commonTimeslotInfo CommonTimeslotInfo OPTIONAL, pusch-TimeslotsCodes UplinkTimeslotsCodes-LCR-r4 OPTIONAL } PUSCH-PowerControlInfo-r4 ::= SEQUENCE { -- The IE ul-TargetSIR corresponds to PRX-PUSCHdes for 1.28Mcps TDD -- Actual value PRX-PUSCHdes = (value of IE "ul-TargetSIR" 窶 120) ul-TargetSIR UL-TargetSIR, tddOption CHOICE { tdd384 NULL, tdd128 SEQUENCE { tpc-StepSize TPC-StepSizeTDD OPTIONAL } } } PUSCH-PowerControlInfo-r7 ::= SEQUENCE { -- The IE ul-TargetSIR corresponds to PRX-PUSCHdes for 1.28Mcps TDD -- Actual value PRX-PUSCHdes = (value of IE "ul-TargetSIR" 窶 120) ul-TargetSIR UL-TargetSIR, tddOption CHOICE { tdd384 NULL, tdd768 NULL, tdd128 SEQUENCE { tpc-StepSize TPC-StepSizeTDD OPTIONAL } } } PUSCH-SysInfo ::= SEQUENCE { pusch-Identity PUSCH-Identity, pusch-Info PUSCH-Info, usch-TFS TransportFormatSet OPTIONAL, usch-TFCS TFCS OPTIONAL } PUSCH-SysInfo-VHCR ::= SEQUENCE { pusch-Identity PUSCH-Identity, pusch-Info-VHCR PUSCH-Info-VHCR, usch-TransportChannelsInfo USCH-TransportChannelsInfo OPTIONAL, usch-TFCS TFCS OPTIONAL } PUSCH-SysInfo-HCR-r5 ::= SEQUENCE { pusch-Identity PUSCH-Identity, pusch-Info PUSCH-Info, usch-TransportChannelsInfo USCH-TransportChannelsInfo OPTIONAL, usch-TFCS TFCS OPTIONAL } PUSCH-SysInfo-LCR-r4 ::= SEQUENCE { pusch-Identity PUSCH-Identity, pusch-Info PUSCH-Info-LCR-r4, usch-TFS TransportFormatSet OPTIONAL, usch-TFCS TFCS OPTIONAL } PUSCH-SysInfoList ::= SEQUENCE (SIZE (1..maxPUSCH)) OF PUSCH-SysInfo PUSCH-SysInfoList-HCR-r5 ::= SEQUENCE (SIZE (1..maxPUSCH)) OF PUSCH-SysInfo-HCR-r5 PUSCH-SysInfoList-LCR-r4 ::= SEQUENCE (SIZE (1..maxPUSCH)) OF PUSCH-SysInfo-LCR-r4 PUSCH-SysInfoList-SFN ::= SEQUENCE (SIZE (1..maxPUSCH)) OF SEQUENCE { pusch-SysInfo PUSCH-SysInfo, sfn-TimeInfo SFN-TimeInfo OPTIONAL } PUSCH-SysInfoList-SFN-HCR-r5 ::= SEQUENCE (SIZE (1..maxPUSCH)) OF SEQUENCE { pusch-SysInfo PUSCH-SysInfo-HCR-r5, sfn-TimeInfo SFN-TimeInfo OPTIONAL } PUSCH-SysInfoList-SFN-LCR-r4 ::= SEQUENCE (SIZE (1..maxPUSCH)) OF SEQUENCE { pusch-SysInfo PUSCH-SysInfo-LCR-r4, sfn-TimeInfo SFN-TimeInfo OPTIONAL } PUSCH-SysInfoList-SFN-VHCR ::= SEQUENCE (SIZE (1..maxPUSCH)) OF SEQUENCE { pusch-SysInfo-VHCR PUSCH-SysInfo-VHCR, sfn-TimeInfo SFN-TimeInfo OPTIONAL } RACH-TransmissionParameters ::= SEQUENCE { mmax INTEGER (1..32), nb01Min NB01, nb01Max NB01 } ReducedScramblingCodeNumber ::= INTEGER (0..8191) RepetitionPeriodAndLength ::= CHOICE { repetitionPeriod1 NULL, -- repetitionPeriod2 could just as well be NULL also. repetitionPeriod2 INTEGER (1..1), repetitionPeriod4 INTEGER (1..3), repetitionPeriod8 INTEGER (1..7), repetitionPeriod16 INTEGER (1..15), repetitionPeriod32 INTEGER (1..31), repetitionPeriod64 INTEGER (1..63) } RepetitionPeriodLengthAndOffset ::= CHOICE { repetitionPeriod1 NULL, repetitionPeriod2 SEQUENCE { length NULL, offset INTEGER (0..1) }, repetitionPeriod4 SEQUENCE { length INTEGER (1..3), offset INTEGER (0..3) }, repetitionPeriod8 SEQUENCE { length INTEGER (1..7), offset INTEGER (0..7) }, repetitionPeriod16 SEQUENCE { length INTEGER (1..15), offset INTEGER (0..15) }, repetitionPeriod32 SEQUENCE { length INTEGER (1..31), offset INTEGER (0..31) }, repetitionPeriod64 SEQUENCE { length INTEGER (1..63), offset INTEGER (0..63) } } ReplacedPDSCH-CodeInfo ::= SEQUENCE { tfci-Field2 MaxTFCI-Field2Value, spreadingFactor SF-PDSCH, codeNumber CodeNumberDSCH, multiCodeInfo MultiCodeInfo } ReplacedPDSCH-CodeInfoList ::= SEQUENCE (SIZE (1..maxTFCI-2-Combs)) OF ReplacedPDSCH-CodeInfo RepPerLengthOffset-PICH ::= CHOICE { rpp4-2 INTEGER (0..3), rpp8-2 INTEGER (0..7), rpp8-4 INTEGER (0..7), rpp16-2 INTEGER (0..15), rpp16-4 INTEGER (0..15), rpp32-2 INTEGER (0..31), rpp32-4 INTEGER (0..31), rpp64-2 INTEGER (0..63), rpp64-4 INTEGER (0..63) } RepPerLengthOffset-MICH ::= CHOICE { rpp4-2 INTEGER (0..3), rpp8-2 INTEGER (0..7), rpp8-4 INTEGER (0..7), rpp16-2 INTEGER (0..15), rpp16-4 INTEGER (0..15), rpp32-2 INTEGER (0..31), rpp32-4 INTEGER (0..31), rpp64-2 INTEGER (0..63), rpp64-4 INTEGER (0..63) } RestrictedTrCH ::= SEQUENCE { dl-restrictedTrCh-Type DL-TrCH-Type, restrictedDL-TrCH-Identity TransportChannelIdentity, allowedTFIList AllowedTFI-List } RestrictedTrCH-InfoList ::= SEQUENCE (SIZE(1..maxTrCH)) OF RestrictedTrCH RL-AdditionInformation ::= SEQUENCE { primaryCPICH-Info PrimaryCPICH-Info, dl-DPCH-InfoPerRL DL-DPCH-InfoPerRL, -- dummy and dummy2 are not used in this version of specification -- and the IEs should be ignored. dummy BOOLEAN, dummy2 SCCPCH-InfoForFACH OPTIONAL } RL-AdditionInformation-r6 ::= SEQUENCE { primaryCPICH-Info PrimaryCPICH-Info, cell-Id CellIdentity OPTIONAL, dl-dpchInfo CHOICE { dl-DPCH-InfoPerRL DL-DPCH-InfoPerRL-r5, dl-FDPCH-InfoPerRL DL-FDPCH-InfoPerRL-r6 }, e-HICH-Information E-HICH-Information OPTIONAL, e-RGCH-Information E-RGCH-Information OPTIONAL } RL-AdditionInformationList ::= SEQUENCE (SIZE (1..maxRL-1)) OF RL-AdditionInformation RL-AdditionInformationList-r6 ::= SEQUENCE (SIZE (1..maxRL-1)) OF RL-AdditionInformation-r6 RL-IdentifierList ::= SEQUENCE (SIZE (1..maxRL)) OF PrimaryCPICH-Info RL-RemovalInformationList ::= SEQUENCE (SIZE (1..maxRL)) OF PrimaryCPICH-Info RPP ::= ENUMERATED { mode0, mode1 } S-Field ::= ENUMERATED { e1bit, e2bits } SCCPCH-ChannelisationCode ::= ENUMERATED { cc16-1, cc16-2, cc16-3, cc16-4, cc16-5, cc16-6, cc16-7, cc16-8, cc16-9, cc16-10, cc16-11, cc16-12, cc16-13, cc16-14, cc16-15, cc16-16 } SCCPCH-ChannelisationCode-VHCR ::= ENUMERATED { cc32-1, cc32-2, cc32-3, cc32-4, cc32-5, cc32-6, cc32-7, cc32-8, cc32-9, cc32-10, cc32-11, cc32-12, cc32-13, cc32-14, cc32-15, cc32-16, cc32-17, cc32-18, cc32-19, cc32-20, cc32-21, cc32-22, cc32-23, cc32-24, cc32-25, cc32-26, cc32-27, cc32-28, cc32-29, cc32-30, cc32-31, cc32-32 } SCCPCH-ChannelisationCodeList ::= SEQUENCE (SIZE (1..16)) OF SCCPCH-ChannelisationCode SCCPCH-ChannelisationCodeList-VHCR ::= SEQUENCE (SIZE (1..32)) OF SCCPCH-ChannelisationCode-VHCR SCCPCH-InfoForFACH ::= SEQUENCE { secondaryCCPCH-Info SecondaryCCPCH-Info, tfcs TFCS, modeSpecificInfo CHOICE { fdd SEQUENCE { fach-PCH-InformationList FACH-PCH-InformationList, sib-ReferenceListFACH SIB-ReferenceListFACH }, tdd SEQUENCE { fach-PCH-InformationList FACH-PCH-InformationList } } } SCCPCH-InfoForFACH-r4 ::= SEQUENCE { secondaryCCPCH-Info SecondaryCCPCH-Info-r4, tfcs TFCS, fach-PCH-InformationList FACH-PCH-InformationList, modeSpecificInfo CHOICE { fdd SEQUENCE { sib-ReferenceListFACH SIB-ReferenceListFACH }, tdd NULL } } SCCPCH-SystemInformation ::= SEQUENCE { secondaryCCPCH-Info SecondaryCCPCH-Info, tfcs TFCS OPTIONAL, fach-PCH-InformationList FACH-PCH-InformationList OPTIONAL, pich-Info PICH-Info OPTIONAL } SCCPCH-SystemInformation-LCR-r4-ext ::= SEQUENCE { secondaryCCPCH-LCR-Extensions SecondaryCCPCH-Info-LCR-r4-ext, -- pich-Info in the SCCPCH-SystemInformation IE shall be absent, -- and instead the following used. pich-Info PICH-Info-LCR-r4 OPTIONAL } SCCPCH-SystemInformation-r7 ::= SEQUENCE { secondaryCCPCH-Info SecondaryCCPCH-Info-r7, tfcs TFCS OPTIONAL, fach-PCH-InformationList FACH-PCH-InformationList OPTIONAL, pich-Info PICH-Info-r7 OPTIONAL } SCCPCH-SystemInformationList ::= SEQUENCE (SIZE (1..maxSCCPCH)) OF SCCPCH-SystemInformation SCCPCH-SystemInformationList-r7 ::= SEQUENCE (SIZE (1..maxSCCPCH)) OF SCCPCH-SystemInformation-r7 -- SCCPCH-SystemInformationList-LCR-r4-ext includes elements additional to those in -- SCCPCH-SystemInformationList for the 1.28Mcps TDD. The order of the IEs -- indicates which SCCPCH-SystemInformation-LCR-r4-ext IE extends which -- SCCPCH-SystemInformation IE. SCCPCH-SystemInformationList-LCR-r4-ext ::= SEQUENCE (SIZE (1..maxSCCPCH)) OF SCCPCH-SystemInformation-LCR-r4-ext -- The SCCPCH-SystemInformation-MBMS-r6 is used for an S-CCPCH dedicated for MBMS purposes. SCCPCH-SystemInformation-MBMS-r6 ::= SEQUENCE { secondaryCCPCHInfo-MBMS SecondaryCCPCHInfo-MBMS-r6, transportFormatCombinationSet TFCS, fachCarryingMCCH SEQUENCE { mcch-transportFormatSet TransportFormatSet, mcch-ConfigurationInfo MBMS-MCCH-ConfigurationInfo-r6 }, fachCarryingMTCH-List MBMS-FACHCarryingMTCH-List OPTIONAL, -- If schedulingInformation is provided fachCarryingMSCH SEQUENCE { msch-transportFormatSet TransportFormatSet, msch-ConfigurationInfo MBMS-MSCH-ConfigurationInfo-r6 } OPTIONAL } -- The SCCPCH-SystemInformation-MBMS-r7 is used for an S-CCPCH dedicated for MBMS purposes. SCCPCH-SystemInformation-MBMS-r7 ::= SEQUENCE { secondaryCCPCHInfo-MBMS SecondaryCCPCHInfo-MBMS-r7, transportFormatCombinationSet TFCS, fachCarryingMCCH SEQUENCE { mcch-transportFormatSet TransportFormatSet, mcch-ConfigurationInfo MBMS-MCCH-ConfigurationInfo-r6 }, fachCarryingMTCH-List MBMS-FACHCarryingMTCH-List OPTIONAL, -- If schedulingInformation is provided fachCarryingMSCH SEQUENCE { msch-transportFormatSet TransportFormatSet, msch-ConfigurationInfo MBMS-MSCH-ConfigurationInfo-r6 } OPTIONAL } ScramblingCodeChange ::= ENUMERATED { codeChange, noCodeChange } ScramblingCodeType ::= ENUMERATED { shortSC, longSC } SecondaryCCPCH-Info ::= SEQUENCE { modeSpecificInfo CHOICE { fdd SEQUENCE { -- dummy1 is not used in this version of the specification and should be ignored. dummy1 PCPICH-UsageForChannelEst, -- dummy2 is not used in this version of the specification. It should not -- be sent and if received it should be ignored. dummy2 SecondaryCPICH-Info OPTIONAL, secondaryScramblingCode SecondaryScramblingCode OPTIONAL, sttd-Indicator BOOLEAN, sf-AndCodeNumber SF256-AndCodeNumber, pilotSymbolExistence BOOLEAN, tfci-Existence BOOLEAN, positionFixedOrFlexible PositionFixedOrFlexible, timingOffset TimingOffset DEFAULT 0 }, tdd SEQUENCE { -- TABULAR: the offset is included in CommonTimeslotInfoSCCPCH commonTimeslotInfo CommonTimeslotInfoSCCPCH, individualTimeslotInfo IndividualTimeslotInfo, channelisationCode SCCPCH-ChannelisationCodeList } } } SecondaryCCPCH-Info-r4 ::= SEQUENCE { modeSpecificInfo CHOICE { fdd SEQUENCE { secondaryScramblingCode SecondaryScramblingCode OPTIONAL, sttd-Indicator BOOLEAN, sf-AndCodeNumber SF256-AndCodeNumber, pilotSymbolExistence BOOLEAN, tfci-Existence BOOLEAN, positionFixedOrFlexible PositionFixedOrFlexible, timingOffset TimingOffset DEFAULT 0 }, tdd SEQUENCE { -- TABULAR: the offset is included in CommonTimeslotInfoSCCPCH commonTimeslotInfo CommonTimeslotInfoSCCPCH, tddOption CHOICE { tdd384 SEQUENCE { individualTimeslotInfo IndividualTimeslotInfo }, tdd128 SEQUENCE { individualTimeslotInfo IndividualTimeslotInfo-LCR-r4 } }, channelisationCode SCCPCH-ChannelisationCodeList } } } SecondaryCCPCH-Info-r7 ::= SEQUENCE { modeSpecificInfo CHOICE { fdd SEQUENCE { secondaryScramblingCode SecondaryScramblingCode OPTIONAL, sttd-Indicator BOOLEAN, sf-AndCodeNumber SF256-AndCodeNumber, pilotSymbolExistence BOOLEAN, tfci-Existence BOOLEAN, positionFixedOrFlexible PositionFixedOrFlexible, timingOffset TimingOffset DEFAULT 0 }, tdd SEQUENCE { -- TABULAR: the offset is included in CommonTimeslotInfoSCCPCH commonTimeslotInfo CommonTimeslotInfoSCCPCH, tddOption CHOICE { tdd384 SEQUENCE { individualTimeslotInfo IndividualTimeslotInfo, channelisationCode SCCPCH-ChannelisationCodeList }, tdd768 SEQUENCE { individualTimeslotInfo IndividualTimeslotInfo-VHCR, channelisationCode SCCPCH-ChannelisationCodeList-VHCR }, tdd128 SEQUENCE { individualTimeslotInfo IndividualTimeslotInfo-LCR-r4, channelisationCode SCCPCH-ChannelisationCodeList } } } } } SecondaryCCPCH-Info-LCR-r4-ext ::= SEQUENCE { individualTimeslotLCR-Ext IndividualTimeslotInfo-LCR-r4-ext } SecondaryCCPCHInfo-MBMS-r6 ::= SEQUENCE { modeSpecificInfo CHOICE { fdd SEQUENCE { secondaryScramblingCode SecondaryScramblingCode OPTIONAL, sttd-Indicator BOOLEAN, sf-AndCodeNumber SF256-AndCodeNumber, timingOffset TimingOffset DEFAULT 0 }, tdd384 DownlinkTimeslotsCodes, tdd128 DownlinkTimeslotsCodes-LCR-r4 } } SecondaryCCPCHInfo-MBMS-r7 ::= SEQUENCE { modeSpecificInfo CHOICE { fdd SEQUENCE { secondaryScramblingCode SecondaryScramblingCode OPTIONAL, sttd-Indicator BOOLEAN, sf-AndCodeNumber SF256-AndCodeNumber, timingOffset TimingOffset DEFAULT 0 }, tdd384 DownlinkTimeslotsCodes, tdd768 DownlinkTimeslotsCodes-VHCR, tdd128 DownlinkTimeslotsCodes-LCR-r4 } } SecondaryCPICH-Info ::= SEQUENCE { secondaryDL-ScramblingCode SecondaryScramblingCode OPTIONAL, channelisationCode ChannelisationCode256 } SecondaryScramblingCode ::= INTEGER (1..15) SecondInterleavingMode ::= ENUMERATED { frameRelated, timeslotRelated } -- SF256-AndCodeNumber encodes both "Spreading factor" and "Code Number" SF256-AndCodeNumber ::= CHOICE { sf4 INTEGER (0..3), sf8 INTEGER (0..7), sf16 INTEGER (0..15), sf32 INTEGER (0..31), sf64 INTEGER (0..63), sf128 INTEGER (0..127), sf256 INTEGER (0..255) } -- SF512-AndCodeNumber encodes both "Spreading factor" and "Code Number" SF512-AndCodeNumber ::= CHOICE { sf4 INTEGER (0..3), sf8 INTEGER (0..7), sf16 INTEGER (0..15), sf32 INTEGER (0..31), sf64 INTEGER (0..63), sf128 INTEGER (0..127), sf256 INTEGER (0..255), sf512 INTEGER (0..511) } -- SF512-AndPilot encodes both "Spreading factor" and "Number of bits for Pilot bits" SF512-AndPilot ::= CHOICE { sfd4 NULL, sfd8 NULL, sfd16 NULL, sfd32 NULL, sfd64 NULL, sfd128 PilotBits128, sfd256 PilotBits256, sfd512 NULL } SF-PDSCH ::= ENUMERATED { sfp4, sfp8, sfp16, sfp32, sfp64, sfp128, sfp256 } SF-PRACH ::= ENUMERATED { sfpr32, sfpr64, sfpr128, sfpr256 } SFN-TimeInfo ::= SEQUENCE { activationTimeSFN INTEGER (0..4095), physChDuration DurationTimeInfo } -- actual scheduling value = 2(signalled value +1) and is the periodicity of sending special burst frames SpecialBurstScheduling ::= INTEGER (0..7) SpreadingFactor ::= ENUMERATED { sf4, sf8, sf16, sf32, sf64, sf128, sf256 } SRB-delay ::= INTEGER (0..7) SSDT-CellIdentity ::= ENUMERATED { ssdt-id-a, ssdt-id-b, ssdt-id-c, ssdt-id-d, ssdt-id-e, ssdt-id-f, ssdt-id-g, ssdt-id-h } SSDT-Information ::= SEQUENCE { s-Field S-Field, codeWordSet CodeWordSet } SSDT-Information-r4 ::= SEQUENCE { s-Field S-Field, codeWordSet CodeWordSet, ssdt-UL-r4 SSDT-UL OPTIONAL } SSDT-UL ::= ENUMERATED { ul, ul-AndDL } SynchronisationParameters-r4 ::= SEQUENCE { sync-UL-CodesBitmap BIT STRING { code7(0), code6(1), code5(2), code4(3), code3(4), code2(5), code1(6), code0(7) } (SIZE (8)), fpach-Info FPACH-Info-r4, -- Actual value prxUpPCHdes = IE value - 120 prxUpPCHdes INTEGER (0..62), sync-UL-Procedure SYNC-UL-Procedure-r4 OPTIONAL } SYNC-UL-Procedure-r4 ::= SEQUENCE { max-SYNC-UL-Transmissions ENUMERATED { tr1, tr2, tr4, tr8 }, powerRampStep INTEGER (0..3) } SYNC-UL-Info-r4 ::= SEQUENCE { sync-UL-Codes-Bitmap BIT STRING { code7(0), code6(1), code5(2), code4(3), code3(4), code2(5), code1(6), code0(7) } ( SIZE (8)), -- Actual value prxUpPCHdes = IE value - 120 prxUpPCHdes INTEGER (0..62), powerRampStep INTEGER (0..3), max-SYNC-UL-Transmissions ENUMERATED { tr1, tr2, tr4, tr8 } , mmax INTEGER(1..32) } TDD-FPACH-CCode16-r4 ::= ENUMERATED { cc16-1, cc16-2, cc16-3, cc16-4, cc16-5, cc16-6, cc16-7, cc16-8, cc16-9, cc16-10, cc16-11, cc16-12, cc16-13, cc16-14, cc16-15, cc16-16 } TDD-UL-Interference ::= INTEGER (-110..-52) TDD-PICH-CCode ::= ENUMERATED { cc16-1, cc16-2, cc16-3, cc16-4, cc16-5, cc16-6, cc16-7, cc16-8, cc16-9, cc16-10, cc16-11, cc16-12, cc16-13, cc16-14, cc16-15, cc16-16 } TDD768-PICH-CCode ::= ENUMERATED { cc32-1, cc32-2, cc32-3, cc32-4, cc32-5, cc32-6, cc32-7, cc32-8, cc32-9, cc32-10, cc32-11, cc32-12, cc32-13, cc32-14, cc32-15, cc32-16, cc32-17, cc32-18, cc32-19, cc32-20, cc32-21, cc32-22, cc32-23, cc32-24, cc32-25, cc32-26, cc32-27, cc32-28, cc32-29, cc32-30, cc32-31, cc32-32 } TDD-PRACH-CCode8 ::= ENUMERATED { cc8-1, cc8-2, cc8-3, cc8-4, cc8-5, cc8-6, cc8-7, cc8-8 } TDD-PRACH-CCode16 ::= ENUMERATED { cc16-1, cc16-2, cc16-3, cc16-4, cc16-5, cc16-6, cc16-7, cc16-8, cc16-9, cc16-10, cc16-11, cc16-12, cc16-13, cc16-14, cc16-15, cc16-16 } TDD-PRACH-CCode-LCR-r4 ::= ENUMERATED { cc4-1, cc4-2, cc4-3, cc4-4, cc8-1, cc8-2, cc8-3, cc8-4, cc8-5, cc8-6, cc8-7, cc8-8, cc16-1, cc16-2, cc16-3, cc16-4, cc16-5, cc16-6, cc16-7, cc16-8, cc16-9, cc16-10, cc16-11, cc16-12, cc16-13, cc16-14, cc16-15, cc16-16 } TDD-PRACH-CCodeList ::= CHOICE { sf8 SEQUENCE (SIZE (1..8)) OF TDD-PRACH-CCode8, -- Channelisation codes cc16-9, cc16-10, cc16-11, cc16-12, cc16-13, cc16-14, -- cc16-15 and cc16-16 shall not be used sf16 SEQUENCE (SIZE (1..8)) OF TDD-PRACH-CCode16 } TDD768-PRACH-CCode8 ::= ENUMERATED { cc8-1, cc8-2, cc8-3, cc8-4, cc8-5, cc8-6, cc8-7, cc8-8 } TDD768-PRACH-CCode16 ::= ENUMERATED { cc16-1, cc16-2, cc16-3, cc16-4, cc16-5, cc16-6, cc16-7, cc16-8, cc16-9, cc16-10, cc16-11, cc16-12, cc16-13, cc16-14, cc16-15, cc16-16 } TDD768-PRACH-CCode32 ::= ENUMERATED { cc32-1, cc32-2, cc32-3, cc32-4, cc32-5, cc32-6, cc32-7, cc32-8, cc32-9, cc32-10, cc32-11, cc32-12, cc32-13, cc32-14, cc32-15, cc32-16 } TDD768-PRACH-CCodeList ::= CHOICE { sf32 SEQUENCE (SIZE (1..16)) OF TDD768-PRACH-CCode32, -- Channelisation codes cc32-17, cc32-18, cc32-19, cc32-20, cc32-21, cc32-22, -- cc32-23, cc32-24, cc32-25, cc32-26, cc32-27, cc32-28, cc32-29, cc32-30, cc32-31 -- and cc32-32 shall not be used sf16 SEQUENCE (SIZE (1..16)) OF TDD768-PRACH-CCode16, sf8 SEQUENCE (SIZE (1..8)) OF TDD768-PRACH-CCode8 } TFC-ControlDuration ::= ENUMERATED { tfc-cd1, tfc-cd2, tfc-cd4, tfc-cd8, tfc-cd16, tfc-cd24, tfc-cd32, tfc-cd48, tfc-cd64, tfc-cd128, tfc-cd192, tfc-cd256, tfc-cd512 } TFCI-Coding ::= ENUMERATED { tfci-bits-4, tfci-bits-8, tfci-bits-16, tfci-bits-32 } TGCFN ::= INTEGER (0..255) -- In TGD, value 270 represents "undefined" in the tabular description. TGD ::= INTEGER (15..270) TGL ::= INTEGER (1..14) TGMP ::= ENUMERATED { tdd-Measurement, fdd-Measurement, gsm-CarrierRSSIMeasurement, gsm-initialBSICIdentification, gsmBSICReconfirmation, multi-carrier } TGP-Sequence ::= SEQUENCE { tgpsi TGPSI, tgps-Status CHOICE { activate SEQUENCE { tgcfn TGCFN }, deactivate NULL }, tgps-ConfigurationParams TGPS-ConfigurationParams OPTIONAL } TGPS-Reconfiguration-CFN ::= INTEGER (0..255) TGP-SequenceList ::= SEQUENCE (SIZE (1..maxTGPS)) OF TGP-Sequence TGP-SequenceShort ::= SEQUENCE { tgpsi TGPSI, tgps-Status CHOICE { activate SEQUENCE { tgcfn TGCFN }, deactivate NULL } } TGPL ::= INTEGER (1..144) -- TABULAR: In TGPRC, value 0 represents "infinity" in the tabular description. TGPRC ::= INTEGER (0..511) TGPS-ConfigurationParams ::= SEQUENCE { tgmp TGMP, tgprc TGPRC, tgsn TGSN, tgl1 TGL, tgl2 TGL OPTIONAL, tgd TGD, tgpl1 TGPL, -- dummy is not used in this version of the specification, it should -- not be sent and if received it shall be ignored. dummy TGPL OPTIONAL, rpp RPP, itp ITP, -- TABULAR: Compressed mode method is nested inside UL-DL-Mode ul-DL-Mode UL-DL-Mode, dl-FrameType DL-FrameType, deltaSIR1 DeltaSIR, deltaSIRAfter1 DeltaSIR, deltaSIR2 DeltaSIR OPTIONAL, deltaSIRAfter2 DeltaSIR OPTIONAL, nidentifyAbort NidentifyAbort OPTIONAL, treconfirmAbort TreconfirmAbort OPTIONAL } TGPSI ::= INTEGER (1..maxTGPS) TGSN ::= INTEGER (0..14) TimeInfo ::= SEQUENCE { activationTime ActivationTime OPTIONAL, durationTimeInfo DurationTimeInfo OPTIONAL } TimeslotList ::= SEQUENCE (SIZE (1..maxTS)) OF TimeslotNumber TimeslotList-r4 ::= CHOICE { -- the choice for 7.68 Mcps TDD is as for 3.84 Mcps TDD -- tdd384 SEQUENCE (SIZE (1..maxTS)) OF TimeslotNumber, tdd128 SEQUENCE (SIZE (1..maxTS-LCR)) OF TimeslotNumber-LCR-r4 } -- If TimeslotNumber is included for a 1.28Mcps TDD description, it shall take values from 0..6 TimeslotNumber ::= INTEGER (0..14) TimeslotNumber-LCR-r4 ::= INTEGER (0..6) TimeslotNumber-PRACH-LCR-r4 ::= INTEGER (1..6) TimeslotSync2 ::= INTEGER (0..6) -- Actual value TimingOffset = IE value * 256 TimingOffset ::= INTEGER (0..149) TimingMaintainedSynchInd ::= ENUMERATED { false } TPC-CombinationIndex ::= INTEGER (0..5) TPC-CommandTargetRate ::= INTEGER (0..10) -- Actual value TPC-StepSizeFDD = IE value + 1 TPC-StepSizeFDD ::= INTEGER (0..1) TPC-StepSizeTDD ::= INTEGER (1..3) -- Actual value TreconfirmAbort = IE value * 0.5 seconds TreconfirmAbort ::= INTEGER (1..20) TX-DiversityMode ::= ENUMERATED { noDiversity, sttd, closedLoopMode1, -- dummy is not used in this version of the specification, it should -- not be sent and if received it should be ignored. dummy } UARFCN ::= INTEGER (0..16383) UCSM-Info ::= SEQUENCE { minimumSpreadingFactor MinimumSpreadingFactor, nf-Max NF-Max, channelReqParamsForUCSM ChannelReqParamsForUCSM } UL-CCTrCH ::= SEQUENCE { tfcs-ID TFCS-IdentityPlain DEFAULT 1, ul-TargetSIR UL-TargetSIR, timeInfo TimeInfo, commonTimeslotInfo CommonTimeslotInfo OPTIONAL, ul-CCTrCH-TimeslotsCodes UplinkTimeslotsCodes OPTIONAL } UL-CCTrCH-r4 ::= SEQUENCE { tfcs-ID TFCS-IdentityPlain DEFAULT 1, -- The IE ul-TargetSIR corresponds to PRX-DPCHdes for 1.28Mcps TDD -- Actual value PRX-DPCHdes = (value of IE "ul-TargetSIR" 窶 120) ul-TargetSIR UL-TargetSIR, timeInfo TimeInfo, commonTimeslotInfo CommonTimeslotInfo OPTIONAL, tddOption CHOICE { tdd384 SEQUENCE { ul-CCTrCH-TimeslotsCodes UplinkTimeslotsCodes OPTIONAL }, tdd128 SEQUENCE { ul-CCTrCH-TimeslotsCodes UplinkTimeslotsCodes-LCR-r4 OPTIONAL } } } UL-CCTrCH-r7 ::= SEQUENCE { tfcs-ID TFCS-IdentityPlain DEFAULT 1, -- The IE ul-TargetSIR corresponds to PRX-DPCHdes for 1.28Mcps TDD -- Actual value PRX-DPCHdes = (value of IE "ul-TargetSIR" 窶 120) ul-TargetSIR UL-TargetSIR, timeInfo TimeInfo, commonTimeslotInfo CommonTimeslotInfo OPTIONAL, tddOption CHOICE { tdd384 SEQUENCE { ul-CCTrCH-TimeslotsCodes UplinkTimeslotsCodes OPTIONAL }, tdd768 SEQUENCE { ul-CCTrCH-TimeslotsCodes UplinkTimeslotsCodes-VHCR OPTIONAL }, tdd128 SEQUENCE { ul-CCTrCH-TimeslotsCodes UplinkTimeslotsCodes-LCR-r7 OPTIONAL } } } UL-CCTrCHList ::= SEQUENCE (SIZE (1..maxCCTrCH)) OF UL-CCTrCH UL-CCTrCHList-r4 ::= SEQUENCE (SIZE (1..maxCCTrCH)) OF UL-CCTrCH-r4 UL-CCTrCHList-r7 ::= SEQUENCE (SIZE (1..maxCCTrCH)) OF UL-CCTrCH-r7 UL-CCTrCHListToRemove ::= SEQUENCE (SIZE (1..maxCCTrCH)) OF TFCS-IdentityPlain UL-CCTrChTPCList ::= SEQUENCE (SIZE (0..maxCCTrCH)) OF TFCS-Identity UL-ChannelRequirement ::= CHOICE { ul-DPCH-Info UL-DPCH-Info, -- dummy is not used in this version of the specification, it should -- not be sent and if received the UE behaviour is not specified. dummy CPCH-SetInfo } UL-ChannelRequirement-r4 ::= CHOICE { ul-DPCH-Info UL-DPCH-Info-r4, -- dummy is not used in this version of the specification, it should -- not be sent and if received the UE behaviour is not specified. dummy CPCH-SetInfo } UL-ChannelRequirement-r5 ::= CHOICE { ul-DPCH-Info UL-DPCH-Info-r5, -- dummy is not used in this version of the specification, it should -- not be sent and if received the UE behaviour is not specified. dummy CPCH-SetInfo } -- Note: the reference to CPCH in the element name below is incorrect. The name is not -- changed to keep it aligned with R99. UL-ChannelRequirementWithCPCH-SetID ::= CHOICE { ul-DPCH-Info UL-DPCH-Info, -- dummy1 and dummy 2 are not used in this version of the specification, they should -- not be sent and if received the UE behaviour is not specified. dummy1 CPCH-SetInfo, dummy2 CPCH-SetID } -- Note: the reference to CPCH in the element name below is incorrect. The name is not -- changed to keep it aligned with R99. UL-ChannelRequirementWithCPCH-SetID-r4 ::= CHOICE { ul-DPCH-Info UL-DPCH-Info-r4, -- dummy1 and dummy2 are not used in this version of the specification, they -- should not be sent and if received the UE behaviour is not specified. dummy1 CPCH-SetInfo, dummy2 CPCH-SetID } -- Note: the reference to CPCH in the element name below is incorrect. The name is not -- changed to keep it aligned with R99. UL-ChannelRequirementWithCPCH-SetID-r5 ::= CHOICE { ul-DPCH-Info UL-DPCH-Info-r5, -- dummy1 and dummy2 are not used in this version of the specification, they should -- not be sent and if received the UE behaviour is not specified. dummy1 CPCH-SetInfo, dummy2 CPCH-SetID } UL-CompressedModeMethod ::= ENUMERATED { sf-2, higherLayerScheduling } UL-DL-Mode ::= CHOICE { ul UL-CompressedModeMethod, dl DL-CompressedModeMethod, ul-and-dl SEQUENCE { ul UL-CompressedModeMethod, dl DL-CompressedModeMethod }} UL-DPCCH-SlotFormat ::= ENUMERATED { slf0, slf1, slf2 } UL-DPCH-Info ::= SEQUENCE { ul-DPCH-PowerControlInfo UL-DPCH-PowerControlInfo OPTIONAL, modeSpecificInfo CHOICE { fdd SEQUENCE { scramblingCodeType ScramblingCodeType, scramblingCode UL-ScramblingCode, numberOfDPDCH NumberOfDPDCH DEFAULT 1, spreadingFactor SpreadingFactor, tfci-Existence BOOLEAN, -- numberOfFBI-Bits is conditional based on history numberOfFBI-Bits NumberOfFBI-Bits OPTIONAL, puncturingLimit PuncturingLimit }, tdd SEQUENCE { ul-TimingAdvance UL-TimingAdvanceControl OPTIONAL, ul-CCTrCHList UL-CCTrCHList OPTIONAL, ul-CCTrCHListToRemove UL-CCTrCHListToRemove OPTIONAL } } } UL-DPCH-Info-r4 ::= SEQUENCE { ul-DPCH-PowerControlInfo UL-DPCH-PowerControlInfo-r4 OPTIONAL, modeSpecificInfo CHOICE { fdd SEQUENCE { scramblingCodeType ScramblingCodeType, scramblingCode UL-ScramblingCode, numberOfDPDCH NumberOfDPDCH DEFAULT 1, spreadingFactor SpreadingFactor, tfci-Existence BOOLEAN, -- numberOfFBI-Bits is conditional based on history numberOfFBI-Bits NumberOfFBI-Bits OPTIONAL, puncturingLimit PuncturingLimit }, tdd SEQUENCE { ul-TimingAdvance UL-TimingAdvanceControl-r4 OPTIONAL, ul-CCTrCHList UL-CCTrCHList-r4 OPTIONAL, ul-CCTrCHListToRemove UL-CCTrCHListToRemove OPTIONAL } } } UL-DPCH-Info-r5 ::= SEQUENCE { ul-DPCH-PowerControlInfo UL-DPCH-PowerControlInfo-r5 OPTIONAL, modeSpecificInfo CHOICE { fdd SEQUENCE { scramblingCodeType ScramblingCodeType, scramblingCode UL-ScramblingCode, numberOfDPDCH NumberOfDPDCH DEFAULT 1, spreadingFactor SpreadingFactor, tfci-Existence BOOLEAN, -- numberOfFBI-Bits is conditional based on history numberOfFBI-Bits NumberOfFBI-Bits OPTIONAL, puncturingLimit PuncturingLimit }, tdd SEQUENCE { ul-TimingAdvance UL-TimingAdvanceControl-r4 OPTIONAL, ul-CCTrCHList UL-CCTrCHList-r4 OPTIONAL, ul-CCTrCHListToRemove UL-CCTrCHListToRemove OPTIONAL } } } UL-DPCH-Info-r6 ::= SEQUENCE { ul-DPCH-PowerControlInfo UL-DPCH-PowerControlInfo-r6 OPTIONAL, modeSpecificInfo CHOICE { fdd SEQUENCE { scramblingCodeType ScramblingCodeType, scramblingCode UL-ScramblingCode, dpdchPresence CHOICE { present SEQUENCE { numberOfDPDCH NumberOfDPDCH DEFAULT 1, spreadingFactor SpreadingFactor, tfci-Existence BOOLEAN, -- numberOfFBI-Bits is conditional based on history numberOfFBI-Bits NumberOfFBI-Bits OPTIONAL, puncturingLimit PuncturingLimit }, notPresent SEQUENCE { tfci-Existence BOOLEAN, -- numberOfFBI-Bits is conditional based on history numberOfFBI-Bits NumberOfFBI-Bits OPTIONAL } } }, tdd SEQUENCE { ul-TimingAdvance UL-TimingAdvanceControl-r4 OPTIONAL, ul-CCTrCHList UL-CCTrCHList-r4 OPTIONAL, ul-CCTrCHListToRemove UL-CCTrCHListToRemove OPTIONAL } } } UL-DPCH-Info-r7 ::= SEQUENCE { ul-DPCH-PowerControlInfo UL-DPCH-PowerControlInfo-r6 OPTIONAL, modeSpecificInfo CHOICE { fdd SEQUENCE { scramblingCodeType ScramblingCodeType, scramblingCode UL-ScramblingCode, dpdchPresence CHOICE { present SEQUENCE { numberOfDPDCH NumberOfDPDCH DEFAULT 1, spreadingFactor SpreadingFactor, tfci-Existence BOOLEAN, -- numberOfFBI-Bits is conditional based on history numberOfFBI-Bits NumberOfFBI-Bits OPTIONAL, puncturingLimit PuncturingLimit }, notPresent SEQUENCE { tfci-Existence BOOLEAN, -- numberOfFBI-Bits is conditional based on history numberOfFBI-Bits NumberOfFBI-Bits OPTIONAL } } }, tdd SEQUENCE { ul-TimingAdvance UL-TimingAdvanceControl-r7 OPTIONAL, ul-CCTrCHList UL-CCTrCHList-r7 OPTIONAL, ul-CCTrCHListToRemove UL-CCTrCHListToRemove OPTIONAL } } } UL-DPCH-InfoPostFDD ::= SEQUENCE { ul-DPCH-PowerControlInfo UL-DPCH-PowerControlInfoPostFDD, scramblingCodeType ScramblingCodeType, reducedScramblingCodeNumber ReducedScramblingCodeNumber, spreadingFactor SpreadingFactor } UL-DPCH-InfoPostTDD ::= SEQUENCE { ul-DPCH-PowerControlInfo UL-DPCH-PowerControlInfoPostTDD, ul-TimingAdvance UL-TimingAdvanceControl OPTIONAL, ul-CCTrCH-TimeslotsCodes UplinkTimeslotsCodes } UL-DPCH-InfoPostTDD-LCR-r4 ::= SEQUENCE { ul-DPCH-PowerControlInfo UL-DPCH-PowerControlInfoPostTDD-LCR-r4, ul-TimingAdvance UL-TimingAdvanceControl-LCR-r4 OPTIONAL, ul-CCTrCH-TimeslotsCodes UplinkTimeslotsCodes-LCR-r4 } UL-DPCH-InfoPredef ::= SEQUENCE { ul-DPCH-PowerControlInfo UL-DPCH-PowerControlInfoPredef, modeSpecificInfo CHOICE { fdd SEQUENCE { tfci-Existence BOOLEAN, puncturingLimit PuncturingLimit }, tdd SEQUENCE { commonTimeslotInfo CommonTimeslotInfo } } } UL-DPCH-PowerControlInfo ::= CHOICE { fdd SEQUENCE { dpcch-PowerOffset DPCCH-PowerOffset, pc-Preamble PC-Preamble, sRB-delay SRB-delay, -- TABULAR: TPC step size nested inside PowerControlAlgorithm powerControlAlgorithm PowerControlAlgorithm }, tdd SEQUENCE { ul-TargetSIR UL-TargetSIR OPTIONAL, ul-OL-PC-Signalling CHOICE { broadcast-UL-OL-PC-info NULL, individuallySignalled SEQUENCE { individualTS-InterferenceList IndividualTS-InterferenceList, dpch-ConstantValue ConstantValueTdd, primaryCCPCH-TX-Power PrimaryCCPCH-TX-Power } } OPTIONAL } } UL-DPCH-PowerControlInfo-r4 ::= CHOICE { fdd SEQUENCE { dpcch-PowerOffset DPCCH-PowerOffset, pc-Preamble PC-Preamble, sRB-delay SRB-delay, -- TABULAR: TPC step size nested inside PowerControlAlgorithm powerControlAlgorithm PowerControlAlgorithm }, tdd SEQUENCE { -- The IE ul-TargetSIR corresponds to PRX-DPCHdes for 1.28Mcps TDD -- Actual value PRX-DPCHdes = (value of IE "ul-TargetSIR" 窶 120) ul-TargetSIR UL-TargetSIR OPTIONAL, ul-OL-PC-Signalling CHOICE { broadcast-UL-OL-PC-info NULL, individuallySignalled SEQUENCE { tddOption CHOICE { tdd384 SEQUENCE { individualTS-InterferenceList IndividualTS-InterferenceList, dpch-ConstantValue ConstantValue }, tdd128 SEQUENCE { tpc-StepSize TPC-StepSizeTDD } }, primaryCCPCH-TX-Power PrimaryCCPCH-TX-Power } } } } UL-DPCH-PowerControlInfo-r5 ::= CHOICE { fdd SEQUENCE { dpcch-PowerOffset DPCCH-PowerOffset, pc-Preamble PC-Preamble, sRB-delay SRB-delay, -- TABULAR: TPC step size nested inside PowerControlAlgorithm powerControlAlgorithm PowerControlAlgorithm, deltaACK DeltaACK OPTIONAL, deltaNACK DeltaNACK OPTIONAL, ack-NACK-repetition-factor ACK-NACK-repetitionFactor OPTIONAL }, tdd SEQUENCE { -- The IE ul-TargetSIR corresponds to PRX-DPCHdes for 1.28Mcps TDD -- Actual value PRX-DPCHdes = (value of IE "ul-TargetSIR" 窶 120) ul-TargetSIR UL-TargetSIR OPTIONAL, ul-OL-PC-Signalling CHOICE { broadcast-UL-OL-PC-info NULL, individuallySignalled SEQUENCE { tddOption CHOICE { tdd384 SEQUENCE { individualTS-InterferenceList IndividualTS-InterferenceList, dpch-ConstantValue ConstantValue }, tdd128 SEQUENCE { tpc-StepSize TPC-StepSizeTDD } }, primaryCCPCH-TX-Power PrimaryCCPCH-TX-Power } } } } UL-DPCH-PowerControlInfo-r6 ::= CHOICE { fdd SEQUENCE { dpcch-PowerOffset DPCCH-PowerOffset, pc-Preamble PC-Preamble, sRB-delay SRB-delay, -- TABULAR: TPC step size nested inside PowerControlAlgorithm powerControlAlgorithm PowerControlAlgorithm, deltaACK DeltaACK OPTIONAL, deltaNACK DeltaNACK OPTIONAL, ack-NACK-repetition-factor ACK-NACK-repetitionFactor OPTIONAL, harq-Preamble-Mode HARQ-Preamble-Mode }, tdd SEQUENCE { -- The IE ul-TargetSIR corresponds to PRX-DPCHdes for 1.28Mcps TDD -- Actual value PRX-DPCHdes = (value of IE "ul-TargetSIR" 窶 120) ul-TargetSIR UL-TargetSIR OPTIONAL, ul-OL-PC-Signalling CHOICE { broadcast-UL-OL-PC-info NULL, individuallySignalled SEQUENCE { tddOption CHOICE { tdd384 SEQUENCE { individualTS-InterferenceList IndividualTS-InterferenceList, dpch-ConstantValue ConstantValue }, tdd128 SEQUENCE { beaconPLEst BEACON-PL-Est OPTIONAL, tpc-StepSize TPC-StepSizeTDD } }, primaryCCPCH-TX-Power PrimaryCCPCH-TX-Power } } } } UL-DPCH-PowerControlInfo-r7 ::= CHOICE { fdd SEQUENCE { dpcch-PowerOffset DPCCH-PowerOffset, pc-Preamble PC-Preamble, sRB-delay SRB-delay, -- TABULAR: TPC step size nested inside PowerControlAlgorithm powerControlAlgorithm PowerControlAlgorithm, deltaACK DeltaACK OPTIONAL, deltaNACK DeltaNACK OPTIONAL, ack-NACK-repetition-factor ACK-NACK-repetitionFactor OPTIONAL, harq-Preamble-Mode HARQ-Preamble-Mode }, tdd SEQUENCE { -- The IE ul-TargetSIR corresponds to PRX-DPCHdes for 1.28Mcps TDD -- Actual value PRX-DPCHdes = (value of IE "ul-TargetSIR" 窶 120) ul-TargetSIR UL-TargetSIR OPTIONAL, ul-OL-PC-Signalling CHOICE { broadcast-UL-OL-PC-info NULL, individuallySignalled SEQUENCE { tddOption CHOICE { tdd384 SEQUENCE { individualTS-InterferenceList IndividualTS-InterferenceList, dpch-ConstantValue ConstantValue }, tdd768 SEQUENCE { individualTS-InterferenceList IndividualTS-InterferenceList, dpch-ConstantValue ConstantValue }, tdd128 SEQUENCE { beaconPLEst BEACON-PL-Est OPTIONAL, tpc-StepSize TPC-StepSizeTDD } }, primaryCCPCH-TX-Power PrimaryCCPCH-TX-Power } } } } UL-DPCH-PowerControlInfoPostFDD ::= SEQUENCE { -- DPCCH-PowerOffset2 has a smaller range to save bits dpcch-PowerOffset DPCCH-PowerOffset2, pc-Preamble PC-Preamble, sRB-delay SRB-delay } UL-DPCH-PowerControlInfoPostTDD ::= SEQUENCE { ul-TargetSIR UL-TargetSIR, ul-TimeslotInterference TDD-UL-Interference } UL-DPCH-PowerControlInfoPostTDD-LCR-r4 ::= SEQUENCE { -- The IE ul-TargetSIR corresponds to PRX-DPCHdes for 1.28Mcps TDD -- Actual value PRX-DPCHdes = (value of IE "ul-TargetSIR" 窶 120) ul-TargetSIR UL-TargetSIR } UL-DPCH-PowerControlInfoPredef ::= CHOICE { fdd SEQUENCE { -- TABULAR: TPC step size nested inside PowerControlAlgorithm powerControlAlgorithm PowerControlAlgorithm }, tdd SEQUENCE { -- dpch-ConstantValue shall be ignored if in 1.28Mcps TDD mode. dpch-ConstantValue ConstantValueTdd } } UL-EDCH-Information-r6 ::= SEQUENCE { mac-es-e-resetIndicator ENUMERATED { true } OPTIONAL, e-DPCCH-Info E-DPCCH-Info OPTIONAL, e-DPDCH-Info E-DPDCH-Info OPTIONAL, schedulingTransmConfiguration E-DPDCH-SchedulingTransmConfiguration OPTIONAL } UL-Interference ::= INTEGER (-110..-70) UL-ScramblingCode ::= INTEGER (0..16777215) UL-SynchronisationParameters-r4 ::= SEQUENCE { stepSize INTEGER (1..8), frequency INTEGER (1..8) } -- Actual value UL-TargetSIR = (IE value * 0.5) - 11 UL-TargetSIR ::= INTEGER (0..62) UL-TimingAdvance ::= INTEGER (0..63) UL-TimingAdvance-VHCR ::= INTEGER (0..127) UL-TimingAdvanceControl ::= CHOICE { disabled NULL, enabled SEQUENCE { ul-TimingAdvance UL-TimingAdvance OPTIONAL, activationTime ActivationTime OPTIONAL } } UL-TimingAdvanceControl-r4 ::= CHOICE { disabled NULL, enabled SEQUENCE { tddOption CHOICE { tdd384 SEQUENCE { ul-TimingAdvance UL-TimingAdvance OPTIONAL, activationTime ActivationTime OPTIONAL }, tdd128 SEQUENCE { ul-SynchronisationParameters UL-SynchronisationParameters-r4 OPTIONAL, synchronisationParameters SynchronisationParameters-r4 OPTIONAL } } } } UL-TimingAdvanceControl-r7 ::= CHOICE { disabled NULL, enabled SEQUENCE { tddOption CHOICE { tdd384 SEQUENCE { ul-TimingAdvance UL-TimingAdvance OPTIONAL, ext-ul-TimingAdvance EXT-UL-TimingAdvance OPTIONAL, activationTime ActivationTime OPTIONAL }, tdd768 SEQUENCE { ext-ul-TimingAdvance EXT-UL-TimingAdvance OPTIONAL, activationTime ActivationTime OPTIONAL }, tdd128 SEQUENCE { ul-SynchronisationParameters UL-SynchronisationParameters-r4 OPTIONAL, synchronisationParameters SynchronisationParameters-r4 OPTIONAL } } } } UL-TimingAdvanceControl-LCR-r4 ::= CHOICE { disabled NULL, enabled SEQUENCE { ul-SynchronisationParameters UL-SynchronisationParameters-r4 OPTIONAL, synchronisationParameters SynchronisationParameters-r4 OPTIONAL } } UL-TS-ChannelisationCode ::= ENUMERATED { cc1-1, cc2-1, cc2-2, cc4-1, cc4-2, cc4-3, cc4-4, cc8-1, cc8-2, cc8-3, cc8-4, cc8-5, cc8-6, cc8-7, cc8-8, cc16-1, cc16-2, cc16-3, cc16-4, cc16-5, cc16-6, cc16-7, cc16-8, cc16-9, cc16-10, cc16-11, cc16-12, cc16-13, cc16-14, cc16-15, cc16-16 } UL-TS-ChannelisationCodeList ::= SEQUENCE (SIZE (1..2)) OF UL-TS-ChannelisationCode UL-TS-ChannelisationCodeList-r7 ::= SEQUENCE (SIZE (1..2)) OF SEQUENCE { ul-TS-Channelisation-Code UL-TS-ChannelisationCode, plcch-info PLCCH-Info OPTIONAL } UL-TS-ChannelisationCode-VHCR ::= ENUMERATED { cc1-1, cc2-1, cc2-2, cc4-1, cc4-2, cc4-3, cc4-4, cc8-1, cc8-2, cc8-3, cc8-4, cc8-5, cc8-6, cc8-7, cc8-8, cc16-1, cc16-2, cc16-3, cc16-4, cc16-5, cc16-6, cc16-7, cc16-8, cc16-9, cc16-10, cc16-11, cc16-12, cc16-13, cc16-14, cc16-15, cc16-16, cc32-1, cc32-2, cc32-3, cc32-4, cc32-5, cc32-6, cc32-7, cc32-8, cc32-9, cc32-10, cc32-11, cc32-12, cc32-13, cc32-14, cc32-15, cc32-16, cc32-17, cc32-18, cc32-19, cc32-20, cc32-21, cc32-22, cc32-23, cc32-24, cc32-25, cc32-26, cc32-27, cc32-28, cc32-29, cc32-30, cc32-31, cc32-32 } UL-TS-ChannelisationCodeList-VHCR ::= SEQUENCE (SIZE (1..2)) OF UL-TS-ChannelisationCode-VHCR UplinkAdditionalTimeslots ::= SEQUENCE { parameters CHOICE { sameAsLast SEQUENCE { timeslotNumber TimeslotNumber }, newParameters SEQUENCE { individualTimeslotInfo IndividualTimeslotInfo, ul-TS-ChannelisationCodeList UL-TS-ChannelisationCodeList } } } UplinkAdditionalTimeslots-LCR-r4 ::= SEQUENCE { parameters CHOICE { sameAsLast SEQUENCE { timeslotNumber TimeslotNumber }, newParameters SEQUENCE { individualTimeslotInfo IndividualTimeslotInfo-LCR-r4, ul-TS-ChannelisationCodeList UL-TS-ChannelisationCodeList } } } UplinkAdditionalTimeslots-LCR-r7 ::= SEQUENCE { parameters CHOICE { sameAsLast SEQUENCE { timeslotNumber TimeslotNumber -- plcch-info assigned as previously defined slot }, newParameters SEQUENCE { individualTimeslotInfo IndividualTimeslotInfo-LCR-r4, ul-TS-ChannelisationCodeList UL-TS-ChannelisationCodeList-r7 } } } UplinkTimeslotsCodes ::= SEQUENCE { dynamicSFusage BOOLEAN, firstIndividualTimeslotInfo IndividualTimeslotInfo, ul-TS-ChannelisationCodeList UL-TS-ChannelisationCodeList, moreTimeslots CHOICE { noMore NULL, additionalTimeslots CHOICE { consecutive SEQUENCE { numAdditionalTimeslots INTEGER (1..maxTS-1) }, timeslotList SEQUENCE (SIZE (1..maxTS-1)) OF UplinkAdditionalTimeslots } } } UplinkTimeslotsCodes-VHCR ::= SEQUENCE { dynamicSFusage BOOLEAN, firstIndividualTimeslotInfo IndividualTimeslotInfo-VHCR, ul-TS-ChannelisationCodeList UL-TS-ChannelisationCodeList-VHCR, moreTimeslots CHOICE { noMore NULL, additionalTimeslots CHOICE { consecutive SEQUENCE { numAdditionalTimeslots INTEGER (1..maxTS-1) }, timeslotList SEQUENCE (SIZE (1..maxTS-1)) OF UplinkAdditionalTimeslots } } } UplinkTimeslotsCodes-LCR-r4 ::= SEQUENCE { dynamicSFusage BOOLEAN, firstIndividualTimeslotInfo IndividualTimeslotInfo-LCR-r4, ul-TS-ChannelisationCodeList UL-TS-ChannelisationCodeList, moreTimeslots CHOICE { noMore NULL, additionalTimeslots CHOICE { consecutive SEQUENCE { numAdditionalTimeslots INTEGER (1..maxTS-LCR-1) }, timeslotList SEQUENCE (SIZE (1..maxTS-LCR-1)) OF UplinkAdditionalTimeslots-LCR-r4 } } } UplinkTimeslotsCodes-LCR-r7 ::= SEQUENCE { dynamicSFusage BOOLEAN, firstIndividualTimeslotInfo IndividualTimeslotInfo-LCR-r4, ul-TS-ChannelisationCodeList UL-TS-ChannelisationCodeList-r7, moreTimeslots CHOICE { noMore NULL, additionalTimeslots CHOICE { consecutive SEQUENCE { -- the choice of 'consecutive' is not needed because there is only 1 option. numAdditionalTimeslots INTEGER (1..maxTS-LCR-1) }, timeslotList SEQUENCE (SIZE (1..maxTS-LCR-1)) OF UplinkAdditionalTimeslots-LCR-r7 } } } Wi-LCR ::= INTEGER(1..4) -- *************************************************** -- -- MEASUREMENT INFORMATION ELEMENTS (10.3.7) -- -- *************************************************** AcquisitionSatInfo ::= SEQUENCE { satID SatID, -- Actual value dopplerOthOrder = IE value * 2.5 doppler0thOrder INTEGER (-2048..2047), extraDopplerInfo ExtraDopplerInfo OPTIONAL, codePhase INTEGER (0..1022), integerCodePhase INTEGER (0..19), gps-BitNumber INTEGER (0..3), codePhaseSearchWindow CodePhaseSearchWindow, azimuthAndElevation AzimuthAndElevation OPTIONAL } AcquisitionSatInfoList ::= SEQUENCE (SIZE (1..maxSat)) OF AcquisitionSatInfo AdditionalMeasurementID-List ::= SEQUENCE (SIZE (1..maxAdditionalMeas)) OF MeasurementIdentity AlmanacSatInfo ::= SEQUENCE { dataID INTEGER (0..3), satID SatID, e BIT STRING (SIZE (16)), t-oa BIT STRING (SIZE (8)), deltaI BIT STRING (SIZE (16)), omegaDot BIT STRING (SIZE (16)), satHealth BIT STRING (SIZE (8)), a-Sqrt BIT STRING (SIZE (24)), omega0 BIT STRING (SIZE (24)), m0 BIT STRING (SIZE (24)), omega BIT STRING (SIZE (24)), af0 BIT STRING (SIZE (11)), af1 BIT STRING (SIZE (11)) } AlmanacSatInfoList ::= SEQUENCE (SIZE (1..maxSat)) OF AlmanacSatInfo AverageRLC-BufferPayload ::= ENUMERATED { pla0, pla4, pla8, pla16, pla32, pla64, pla128, pla256, pla512, pla1024, pla2k, pla4k, pla8k, pla16k, pla32k, pla64k, pla128k, pla256k, pla512k, pla1024k, spare12, spare11, spare10, spare9, spare8, spare7, spare6, spare5, spare4, spare3, spare2, spare1 } AzimuthAndElevation ::= SEQUENCE { -- Actual value azimuth = IE value * 11.25 azimuth INTEGER (0..31), -- Actual value elevation = IE value * 11.25 elevation INTEGER (0..7) } BadSatList ::= SEQUENCE (SIZE (1..maxSat)) OF INTEGER (0..63) Frequency-Band ::= ENUMERATED { dcs1800BandUsed, pcs1900BandUsed } BCCH-ARFCN ::= INTEGER (0..1023) BLER-MeasurementResults ::= SEQUENCE { transportChannelIdentity TransportChannelIdentity, dl-TransportChannelBLER DL-TransportChannelBLER OPTIONAL } BLER-MeasurementResultsList ::= SEQUENCE (SIZE (1..maxTrCH)) OF BLER-MeasurementResults BLER-TransChIdList ::= SEQUENCE (SIZE (1..maxTrCH)) OF TransportChannelIdentity BSIC-VerificationRequired ::= ENUMERATED { required, notRequired } BSICReported ::= CHOICE { -- Value maxCellMeas is not allowed for verifiedBSIC verifiedBSIC INTEGER (0..maxCellMeas), nonVerifiedBSIC BCCH-ARFCN } BurstModeParameters ::= SEQUENCE { burstStart INTEGER (0..15), burstLength INTEGER (10..25), burstFreq INTEGER (1..16) } CellDCH-ReportCriteria ::= CHOICE { intraFreqReportingCriteria IntraFreqReportingCriteria, periodicalReportingCriteria PeriodicalReportingCriteria } CellDCH-ReportCriteria-LCR-r4 ::= CHOICE { intraFreqReportingCriteria IntraFreqReportingCriteria-LCR-r4, periodicalReportingCriteria PeriodicalReportingCriteria } -- Actual value CellIndividualOffset = IE value * 0.5 CellIndividualOffset ::= INTEGER (-20..20) CellInfo ::= SEQUENCE { cellIndividualOffset CellIndividualOffset DEFAULT 0, referenceTimeDifferenceToCell ReferenceTimeDifferenceToCell OPTIONAL, modeSpecificInfo CHOICE { fdd SEQUENCE { primaryCPICH-Info PrimaryCPICH-Info OPTIONAL, primaryCPICH-TX-Power PrimaryCPICH-TX-Power OPTIONAL, readSFN-Indicator BOOLEAN, tx-DiversityIndicator BOOLEAN }, tdd SEQUENCE { primaryCCPCH-Info PrimaryCCPCH-Info, primaryCCPCH-TX-Power PrimaryCCPCH-TX-Power OPTIONAL, timeslotInfoList TimeslotInfoList OPTIONAL, readSFN-Indicator BOOLEAN } } } CellInfo-r4 ::= SEQUENCE { cellIndividualOffset CellIndividualOffset DEFAULT 0, referenceTimeDifferenceToCell ReferenceTimeDifferenceToCell OPTIONAL, modeSpecificInfo CHOICE { fdd SEQUENCE { primaryCPICH-Info PrimaryCPICH-Info OPTIONAL, primaryCPICH-TX-Power PrimaryCPICH-TX-Power OPTIONAL, readSFN-Indicator BOOLEAN, tx-DiversityIndicator BOOLEAN }, tdd SEQUENCE { primaryCCPCH-Info PrimaryCCPCH-Info-r4, primaryCCPCH-TX-Power PrimaryCCPCH-TX-Power OPTIONAL, timeslotInfoList TimeslotInfoList-r4 OPTIONAL, readSFN-Indicator BOOLEAN } } } CellInfoSI-RSCP ::= SEQUENCE { cellIndividualOffset CellIndividualOffset DEFAULT 0, referenceTimeDifferenceToCell ReferenceTimeDifferenceToCell OPTIONAL, modeSpecificInfo CHOICE { fdd SEQUENCE { primaryCPICH-Info PrimaryCPICH-Info OPTIONAL, primaryCPICH-TX-Power PrimaryCPICH-TX-Power OPTIONAL, readSFN-Indicator BOOLEAN, tx-DiversityIndicator BOOLEAN }, tdd SEQUENCE { primaryCCPCH-Info PrimaryCCPCH-Info, primaryCCPCH-TX-Power PrimaryCCPCH-TX-Power OPTIONAL, timeslotInfoList TimeslotInfoList OPTIONAL, readSFN-Indicator BOOLEAN } }, cellSelectionReselectionInfo CellSelectReselectInfoSIB-11-12-RSCP OPTIONAL } CellInfoSI-RSCP-LCR-r4 ::= SEQUENCE { cellIndividualOffset CellIndividualOffset DEFAULT 0, referenceTimeDifferenceToCell ReferenceTimeDifferenceToCell OPTIONAL, primaryCCPCH-Info PrimaryCCPCH-Info-LCR-r4, primaryCCPCH-TX-Power PrimaryCCPCH-TX-Power OPTIONAL, timeslotInfoList TimeslotInfoList-LCR-r4 OPTIONAL, readSFN-Indicator BOOLEAN, cellSelectionReselectionInfo CellSelectReselectInfoSIB-11-12-RSCP OPTIONAL } CellInfoSI-ECN0 ::= SEQUENCE { cellIndividualOffset CellIndividualOffset DEFAULT 0, referenceTimeDifferenceToCell ReferenceTimeDifferenceToCell OPTIONAL, modeSpecificInfo CHOICE { fdd SEQUENCE { primaryCPICH-Info PrimaryCPICH-Info OPTIONAL, primaryCPICH-TX-Power PrimaryCPICH-TX-Power OPTIONAL, readSFN-Indicator BOOLEAN, tx-DiversityIndicator BOOLEAN }, tdd SEQUENCE { primaryCCPCH-Info PrimaryCCPCH-Info, primaryCCPCH-TX-Power PrimaryCCPCH-TX-Power OPTIONAL, timeslotInfoList TimeslotInfoList OPTIONAL, readSFN-Indicator BOOLEAN } }, cellSelectionReselectionInfo CellSelectReselectInfoSIB-11-12-ECN0 OPTIONAL } CellInfoSI-ECN0-LCR-r4 ::= SEQUENCE { cellIndividualOffset CellIndividualOffset DEFAULT 0, referenceTimeDifferenceToCell ReferenceTimeDifferenceToCell OPTIONAL, primaryCCPCH-Info PrimaryCCPCH-Info-LCR-r4, primaryCCPCH-TX-Power PrimaryCCPCH-TX-Power OPTIONAL, timeslotInfoList TimeslotInfoList-LCR-r4 OPTIONAL, readSFN-Indicator BOOLEAN, cellSelectionReselectionInfo CellSelectReselectInfoSIB-11-12-ECN0 OPTIONAL } CellInfoSI-HCS-RSCP ::= SEQUENCE { cellIndividualOffset CellIndividualOffset DEFAULT 0, referenceTimeDifferenceToCell ReferenceTimeDifferenceToCell OPTIONAL, modeSpecificInfo CHOICE { fdd SEQUENCE { primaryCPICH-Info PrimaryCPICH-Info OPTIONAL, primaryCPICH-TX-Power PrimaryCPICH-TX-Power OPTIONAL, readSFN-Indicator BOOLEAN, tx-DiversityIndicator BOOLEAN }, tdd SEQUENCE { primaryCCPCH-Info PrimaryCCPCH-Info, primaryCCPCH-TX-Power PrimaryCCPCH-TX-Power OPTIONAL, timeslotInfoList TimeslotInfoList OPTIONAL, readSFN-Indicator BOOLEAN } }, cellSelectionReselectionInfo CellSelectReselectInfoSIB-11-12-HCS-RSCP OPTIONAL } CellInfoSI-HCS-RSCP-LCR-r4 ::= SEQUENCE { cellIndividualOffset CellIndividualOffset DEFAULT 0, referenceTimeDifferenceToCell ReferenceTimeDifferenceToCell OPTIONAL, primaryCCPCH-Info PrimaryCCPCH-Info-LCR-r4, primaryCCPCH-TX-Power PrimaryCCPCH-TX-Power OPTIONAL, timeslotInfoList TimeslotInfoList-LCR-r4 OPTIONAL, readSFN-Indicator BOOLEAN, cellSelectionReselectionInfo CellSelectReselectInfoSIB-11-12-HCS-RSCP OPTIONAL } CellInfoSI-HCS-ECN0 ::= SEQUENCE { cellIndividualOffset CellIndividualOffset DEFAULT 0, referenceTimeDifferenceToCell ReferenceTimeDifferenceToCell OPTIONAL, modeSpecificInfo CHOICE { fdd SEQUENCE { primaryCPICH-Info PrimaryCPICH-Info OPTIONAL, primaryCPICH-TX-Power PrimaryCPICH-TX-Power OPTIONAL, readSFN-Indicator BOOLEAN, tx-DiversityIndicator BOOLEAN }, tdd SEQUENCE { primaryCCPCH-Info PrimaryCCPCH-Info, primaryCCPCH-TX-Power PrimaryCCPCH-TX-Power OPTIONAL, timeslotInfoList TimeslotInfoList OPTIONAL, readSFN-Indicator BOOLEAN } }, cellSelectionReselectionInfo CellSelectReselectInfoSIB-11-12-HCS-ECN0 OPTIONAL } CellInfoSI-HCS-ECN0-LCR-r4 ::= SEQUENCE { cellIndividualOffset CellIndividualOffset DEFAULT 0, referenceTimeDifferenceToCell ReferenceTimeDifferenceToCell OPTIONAL, primaryCCPCH-Info PrimaryCCPCH-Info-LCR-r4, primaryCCPCH-TX-Power PrimaryCCPCH-TX-Power OPTIONAL, timeslotInfoList TimeslotInfoList-LCR-r4 OPTIONAL, readSFN-Indicator BOOLEAN, cellSelectionReselectionInfo CellSelectReselectInfoSIB-11-12-HCS-ECN0 OPTIONAL } CellMeasuredResults ::= SEQUENCE { cellIdentity CellIdentity OPTIONAL, -- dummy is not used in this version of the specification, it should -- not be sent and if received it should be ignored. dummy SFN-SFN-ObsTimeDifference OPTIONAL, cellSynchronisationInfo CellSynchronisationInfo OPTIONAL, modeSpecificInfo CHOICE { fdd SEQUENCE { primaryCPICH-Info PrimaryCPICH-Info, cpich-Ec-N0 CPICH-Ec-N0 OPTIONAL, cpich-RSCP CPICH-RSCP OPTIONAL, pathloss Pathloss OPTIONAL }, tdd SEQUENCE { cellParametersID CellParametersID, proposedTGSN TGSN OPTIONAL, primaryCCPCH-RSCP PrimaryCCPCH-RSCP OPTIONAL, pathloss Pathloss OPTIONAL, timeslotISCP-List TimeslotISCP-List OPTIONAL } } } CellMeasurementEventResults ::= CHOICE { fdd SEQUENCE (SIZE (1..maxCellMeas)) OF PrimaryCPICH-Info, tdd SEQUENCE (SIZE (1..maxCellMeas)) OF PrimaryCCPCH-Info } CellMeasurementEventResults-LCR-r4 ::= SEQUENCE (SIZE (1..maxCellMeas)) OF PrimaryCCPCH-Info-LCR-r4 CellReportingQuantities ::= SEQUENCE { -- dummy is not used in this version of the specification -- and if received it should be ignored. dummy SFN-SFN-OTD-Type, cellIdentity-reportingIndicator BOOLEAN, cellSynchronisationInfoReportingIndicator BOOLEAN, modeSpecificInfo CHOICE { fdd SEQUENCE { cpich-Ec-N0-reportingIndicator BOOLEAN, cpich-RSCP-reportingIndicator BOOLEAN, pathloss-reportingIndicator BOOLEAN }, tdd SEQUENCE { timeslotISCP-reportingIndicator BOOLEAN, proposedTGSN-ReportingRequired BOOLEAN, primaryCCPCH-RSCP-reportingIndicator BOOLEAN, pathloss-reportingIndicator BOOLEAN } } } CellSelectReselectInfoSIB-11-12 ::= SEQUENCE { q-Offset1S-N Q-OffsetS-N DEFAULT 0, q-Offset2S-N Q-OffsetS-N OPTIONAL, maxAllowedUL-TX-Power MaxAllowedUL-TX-Power OPTIONAL, hcs-NeighbouringCellInformation-RSCP HCS-NeighbouringCellInformation-RSCP OPTIONAL, modeSpecificInfo CHOICE { fdd SEQUENCE { q-QualMin Q-QualMin OPTIONAL, q-RxlevMin Q-RxlevMin OPTIONAL }, tdd SEQUENCE { q-RxlevMin Q-RxlevMin OPTIONAL }, gsm SEQUENCE { q-RxlevMin Q-RxlevMin OPTIONAL } } } CellSelectReselectInfoSIB-11-12-RSCP ::= SEQUENCE { q-OffsetS-N Q-OffsetS-N DEFAULT 0, maxAllowedUL-TX-Power MaxAllowedUL-TX-Power OPTIONAL, modeSpecificInfo CHOICE { fdd SEQUENCE { q-QualMin Q-QualMin OPTIONAL, q-RxlevMin Q-RxlevMin OPTIONAL }, tdd SEQUENCE { q-RxlevMin Q-RxlevMin OPTIONAL }, gsm SEQUENCE { q-RxlevMin Q-RxlevMin OPTIONAL } } } CellSelectReselectInfoSIB-11-12-ECN0 ::= SEQUENCE { q-Offset1S-N Q-OffsetS-N DEFAULT 0, q-Offset2S-N Q-OffsetS-N DEFAULT 0, maxAllowedUL-TX-Power MaxAllowedUL-TX-Power OPTIONAL, modeSpecificInfo CHOICE { fdd SEQUENCE { q-QualMin Q-QualMin OPTIONAL, q-RxlevMin Q-RxlevMin OPTIONAL }, tdd SEQUENCE { q-RxlevMin Q-RxlevMin OPTIONAL }, gsm SEQUENCE { q-RxlevMin Q-RxlevMin OPTIONAL } } } CellSelectReselectInfoSIB-11-12-HCS-RSCP ::= SEQUENCE { q-OffsetS-N Q-OffsetS-N DEFAULT 0, maxAllowedUL-TX-Power MaxAllowedUL-TX-Power OPTIONAL, hcs-NeighbouringCellInformation-RSCP HCS-NeighbouringCellInformation-RSCP OPTIONAL, modeSpecificInfo CHOICE { fdd SEQUENCE { q-QualMin Q-QualMin OPTIONAL, q-RxlevMin Q-RxlevMin OPTIONAL }, tdd SEQUENCE { q-RxlevMin Q-RxlevMin OPTIONAL }, gsm SEQUENCE { q-RxlevMin Q-RxlevMin OPTIONAL } } } CellSelectReselectInfoSIB-11-12-HCS-ECN0 ::= SEQUENCE { q-Offset1S-N Q-OffsetS-N DEFAULT 0, q-Offset2S-N Q-OffsetS-N DEFAULT 0, maxAllowedUL-TX-Power MaxAllowedUL-TX-Power OPTIONAL, hcs-NeighbouringCellInformation-ECN0 HCS-NeighbouringCellInformation-ECN0 OPTIONAL, modeSpecificInfo CHOICE { fdd SEQUENCE { q-QualMin Q-QualMin OPTIONAL, q-RxlevMin Q-RxlevMin OPTIONAL }, tdd SEQUENCE { q-RxlevMin Q-RxlevMin OPTIONAL }, gsm SEQUENCE { q-RxlevMin Q-RxlevMin OPTIONAL } } } CellSelectReselectInfo-v590ext ::= SEQUENCE { deltaQrxlevmin DeltaQrxlevmin OPTIONAL, deltaQhcs DeltaRSCP OPTIONAL } CellSelectReselectInfoPCHFACH-v5b0ext ::= SEQUENCE { q-Hyst-l-S-PCH Q-Hyst-S-Fine OPTIONAL, q-Hyst-l-S-FACH Q-Hyst-S-Fine OPTIONAL, q-Hyst-2-S-PCH Q-Hyst-S-Fine OPTIONAL, q-Hyst-2-S-FACH Q-Hyst-S-Fine OPTIONAL, t-Reselection-S-PCH T-Reselection-S OPTIONAL, t-Reselection-S-FACH T-Reselection-S-Fine OPTIONAL } CellSelectReselectInfoTreselectionScaling-v5c0ext ::= SEQUENCE { -- For speed detection, the same HCS parameters are utilised non-HCS-t-CR-Max T-CRMax OPTIONAL, speedDependentScalingFactor SpeedDependentScalingFactor OPTIONAL, interFrequencyTreselectionScalingFactor TreselectionScalingFactor OPTIONAL, interRATTreselectionScalingFactor TreselectionScalingFactor OPTIONAL } CellsForInterFreqMeasList ::= SEQUENCE (SIZE (1..maxCellMeas)) OF InterFreqCellID CellsForInterRATMeasList ::= SEQUENCE (SIZE (1..maxCellMeas)) OF InterRATCellID CellsForIntraFreqMeasList ::= SEQUENCE (SIZE (1..maxCellMeas)) OF IntraFreqCellID CellSynchronisationInfo ::= SEQUENCE { modeSpecificInfo CHOICE { fdd SEQUENCE { countC-SFN-Frame-difference CountC-SFN-Frame-difference OPTIONAL, tm INTEGER(0..38399) }, tdd SEQUENCE { countC-SFN-Frame-difference CountC-SFN-Frame-difference OPTIONAL } } } CellToReport ::= SEQUENCE { bsicReported BSICReported } CellToReportList ::= SEQUENCE (SIZE (1..maxCellMeas)) OF CellToReport CodePhaseSearchWindow ::= ENUMERATED { w1023, w1, w2, w3, w4, w6, w8, w12, w16, w24, w32, w48, w64, w96, w128, w192 } CountC-SFN-Frame-difference ::= SEQUENCE { -- Actual value countC-SFN-High = IE value * 256 countC-SFN-High INTEGER(0..15), off INTEGER(0..255) } -- SPARE: CPICH-Ec-No, Max = 49 -- Values above Max are spare CPICH-Ec-N0 ::= INTEGER (0..63) -- SPARE: CPICH- RSCP, Max = 91 -- Values above Max are spare CPICH-RSCP ::= INTEGER (0..127) DeltaPRC ::= INTEGER (-127..127) --Actual value DeltaQrxlevmin = IE value * 2 DeltaQrxlevmin ::= INTEGER (-2..-1) DeltaRSCP ::= INTEGER (-5..-1) DeltaRSCPPerCell ::= SEQUENCE { deltaRSCP DeltaRSCP OPTIONAL } -- Actual value DeltaRRC = IE value * 0.032 DeltaRRC ::= INTEGER (-7..7) DGPS-CorrectionSatInfo ::= SEQUENCE { satID SatID, iode IODE, udre UDRE, prc PRC, rrc RRC, -- dummy1 and dummy2 are not used in this version of the specification and should be ignored. dummy1 DeltaPRC, dummy2 DeltaRRC, -- dummy3 and dummy4 are not used in this version of the specification. They should not -- be sent and if received they should be ignored. dummy3 DeltaPRC OPTIONAL, dummy4 DeltaRRC OPTIONAL } DGPS-CorrectionSatInfoList ::= SEQUENCE (SIZE (1..maxSat)) OF DGPS-CorrectionSatInfo DiffCorrectionStatus ::= ENUMERATED { udre-1-0, udre-0-75, udre-0-5, udre-0-3, udre-0-2, udre-0-1, noData, invalidData } DL-TransportChannelBLER ::= INTEGER (0..63) DopplerUncertainty ::= ENUMERATED { hz12-5, hz25, hz50, hz100, hz200, spare3, spare2, spare1 } EllipsoidPoint ::= SEQUENCE { latitudeSign ENUMERATED { north, south }, latitude INTEGER (0..8388607), longitude INTEGER (-8388608..8388607) } EllipsoidPointAltitude ::= SEQUENCE { latitudeSign ENUMERATED { north, south }, latitude INTEGER (0..8388607), longitude INTEGER (-8388608..8388607), altitudeDirection ENUMERATED {height, depth}, altitude INTEGER (0..32767) } EllipsoidPointAltitudeEllipsoide ::= SEQUENCE { latitudeSign ENUMERATED { north, south }, latitude INTEGER (0..8388607), longitude INTEGER (-8388608..8388607), altitudeDirection ENUMERATED {height, depth}, altitude INTEGER (0..32767), uncertaintySemiMajor INTEGER (0..127), uncertaintySemiMinor INTEGER (0..127), -- Actual value orientationMajorAxis = IE value * 2 orientationMajorAxis INTEGER (0..89), uncertaintyAltitude INTEGER (0..127), confidence INTEGER (0..100) } EllipsoidPointUncertCircle ::= SEQUENCE { latitudeSign ENUMERATED { north, south }, latitude INTEGER (0..8388607), longitude INTEGER (-8388608..8388607), uncertaintyCode INTEGER (0..127) } EllipsoidPointUncertEllipse ::= SEQUENCE { latitudeSign ENUMERATED { north, south }, latitude INTEGER (0..8388607), longitude INTEGER (-8388608..8388607), uncertaintySemiMajor INTEGER (0..127), uncertaintySemiMinor INTEGER (0..127), -- Actual value orientationMajorAxis = IE value * 2 orientationMajorAxis INTEGER (0..89), confidence INTEGER (0..100) } EnvironmentCharacterisation ::= ENUMERATED { possibleHeavyMultipathNLOS, lightMultipathLOS, notDefined, spare } Event1a ::= SEQUENCE { triggeringCondition TriggeringCondition2, reportingRange ReportingRange, forbiddenAffectCellList ForbiddenAffectCellList OPTIONAL, w W, reportDeactivationThreshold ReportDeactivationThreshold, reportingAmount ReportingAmount, reportingInterval ReportingInterval } Event1a-r4 ::= SEQUENCE { triggeringCondition TriggeringCondition2, reportingRange ReportingRange, forbiddenAffectCellList ForbiddenAffectCellList-r4 OPTIONAL, w W, reportDeactivationThreshold ReportDeactivationThreshold, reportingAmount ReportingAmount, reportingInterval ReportingInterval } Event1a-LCR-r4 ::= SEQUENCE { triggeringCondition TriggeringCondition2, reportingRange ReportingRange, forbiddenAffectCellList ForbiddenAffectCellList-LCR-r4 OPTIONAL, w W, reportDeactivationThreshold ReportDeactivationThreshold, reportingAmount ReportingAmount, reportingInterval ReportingInterval } Event1b ::= SEQUENCE { triggeringCondition TriggeringCondition1, reportingRange ReportingRange, forbiddenAffectCellList ForbiddenAffectCellList OPTIONAL, w W } Event1b-r4 ::= SEQUENCE { triggeringCondition TriggeringCondition1, reportingRange ReportingRange, forbiddenAffectCellList ForbiddenAffectCellList-r4 OPTIONAL, w W } Event1b-LCR-r4 ::= SEQUENCE { triggeringCondition TriggeringCondition1, reportingRange ReportingRange, forbiddenAffectCellList ForbiddenAffectCellList-LCR-r4 OPTIONAL, w W } Event1c ::= SEQUENCE { replacementActivationThreshold ReplacementActivationThreshold, reportingAmount ReportingAmount, reportingInterval ReportingInterval } Event1d ::= SEQUENCE { triggeringCondition TriggeringCondition2 OPTIONAL, useCIO BOOLEAN OPTIONAL } Event1e ::= SEQUENCE { triggeringCondition TriggeringCondition2, thresholdUsedFrequency ThresholdUsedFrequency } Event1e-r6 ::= SEQUENCE { triggeringCondition TriggeringCondition2, thresholdUsedFrequency ThresholdUsedFrequency-r6 } Event1f ::= SEQUENCE { triggeringCondition TriggeringCondition1, thresholdUsedFrequency ThresholdUsedFrequency } Event1f-r6 ::= SEQUENCE { triggeringCondition TriggeringCondition1, thresholdUsedFrequency ThresholdUsedFrequency-r6 } Event1j-r6 ::= SEQUENCE { replacementActivationThreshold ReplacementActivationThreshold, reportingAmount ReportingAmount, reportingInterval ReportingInterval } Event2a ::= SEQUENCE { -- dummy is not used in this version of the specification and should be ignored dummy Threshold, usedFreqW W, hysteresis HysteresisInterFreq, timeToTrigger TimeToTrigger, reportingCellStatus ReportingCellStatus OPTIONAL, nonUsedFreqParameterList NonUsedFreqParameterList OPTIONAL } Event2a-r6 ::= SEQUENCE { usedFreqW W, hysteresis HysteresisInterFreq, timeToTrigger TimeToTrigger, reportingCellStatus ReportingCellStatus OPTIONAL, nonUsedFreqParameterList NonUsedFreqWList-r6 OPTIONAL } Event2b ::= SEQUENCE { usedFreqThreshold Threshold, usedFreqW W, hysteresis HysteresisInterFreq, timeToTrigger TimeToTrigger, reportingCellStatus ReportingCellStatus OPTIONAL, nonUsedFreqParameterList NonUsedFreqParameterList OPTIONAL } Event2b-r6 ::= SEQUENCE { usedFreqThreshold Threshold-r6, usedFreqW W, hysteresis HysteresisInterFreq, timeToTrigger TimeToTrigger, reportingCellStatus ReportingCellStatus OPTIONAL, nonUsedFreqParameterList NonUsedFreqParameterList-r6 OPTIONAL } Event2c ::= SEQUENCE { hysteresis HysteresisInterFreq, timeToTrigger TimeToTrigger, reportingCellStatus ReportingCellStatus OPTIONAL, nonUsedFreqParameterList NonUsedFreqParameterList OPTIONAL } Event2c-r6 ::= SEQUENCE { hysteresis HysteresisInterFreq, timeToTrigger TimeToTrigger, reportingCellStatus ReportingCellStatus OPTIONAL, nonUsedFreqParameterList NonUsedFreqParameterList-r6 OPTIONAL } Event2d ::= SEQUENCE { usedFreqThreshold Threshold, usedFreqW W, hysteresis HysteresisInterFreq, timeToTrigger TimeToTrigger, reportingCellStatus ReportingCellStatus OPTIONAL } Event2d-r6 ::= SEQUENCE { usedFreqThreshold Threshold-r6, usedFreqW W, hysteresis HysteresisInterFreq, timeToTrigger TimeToTrigger, reportingCellStatus ReportingCellStatus OPTIONAL } Event2e ::= SEQUENCE { hysteresis HysteresisInterFreq, timeToTrigger TimeToTrigger, reportingCellStatus ReportingCellStatus OPTIONAL, nonUsedFreqParameterList NonUsedFreqParameterList OPTIONAL } Event2e-r6 ::= SEQUENCE { hysteresis HysteresisInterFreq, timeToTrigger TimeToTrigger, reportingCellStatus ReportingCellStatus OPTIONAL, nonUsedFreqParameterList NonUsedFreqParameterList-r6 OPTIONAL } Event2f ::= SEQUENCE { usedFreqThreshold Threshold, usedFreqW W, hysteresis HysteresisInterFreq, timeToTrigger TimeToTrigger, reportingCellStatus ReportingCellStatus OPTIONAL } Event2f-r6 ::= SEQUENCE { usedFreqThreshold Threshold-r6, usedFreqW W, hysteresis HysteresisInterFreq, timeToTrigger TimeToTrigger, reportingCellStatus ReportingCellStatus OPTIONAL } Event3a ::= SEQUENCE { thresholdOwnSystem Threshold, w W, thresholdOtherSystem Threshold, hysteresis Hysteresis, timeToTrigger TimeToTrigger, reportingCellStatus ReportingCellStatus OPTIONAL } Event3b ::= SEQUENCE { thresholdOtherSystem Threshold, hysteresis Hysteresis, timeToTrigger TimeToTrigger, reportingCellStatus ReportingCellStatus OPTIONAL } Event3c ::= SEQUENCE { thresholdOtherSystem Threshold, hysteresis Hysteresis, timeToTrigger TimeToTrigger, reportingCellStatus ReportingCellStatus OPTIONAL } Event3d ::= SEQUENCE { hysteresis Hysteresis, timeToTrigger TimeToTrigger, reportingCellStatus ReportingCellStatus OPTIONAL } EventIDInterFreq ::= ENUMERATED { e2a, e2b, e2c, e2d, e2e, e2f, spare2, spare1 } EventIDInterRAT ::= ENUMERATED { e3a, e3b, e3c, e3d } EventIDIntraFreq ::= ENUMERATED { e1a, e1b, e1c, e1d, e1e, e1f, e1g, e1h, e1i, e1j, spare6, spare5, spare4, spare3, spare2, spare1 } EventResults ::= CHOICE { intraFreqEventResults IntraFreqEventResults, interFreqEventResults InterFreqEventResults, interRATEventResults InterRATEventResults, trafficVolumeEventResults TrafficVolumeEventResults, qualityEventResults QualityEventResults, ue-InternalEventResults UE-InternalEventResults, ue-positioning-MeasurementEventResults UE-Positioning-MeasurementEventResults, spare NULL } ExtraDopplerInfo ::= SEQUENCE { -- Actual value doppler1stOrder = IE value * 0.023 doppler1stOrder INTEGER (-42..21), dopplerUncertainty DopplerUncertainty } FACH-MeasurementOccasionInfo ::= SEQUENCE { fACH-meas-occasion-coeff INTEGER (1..12) OPTIONAL, inter-freq-FDD-meas-ind BOOLEAN, -- inter-freq-TDD-meas-ind is for 3.84Mcps TDD and 7.68 Mcps TDD. For 1.28Mcps TDD, the IE in -- FACH-MeasurementOccasionInfo-LCR-r4-ext is used. inter-freq-TDD-meas-ind BOOLEAN, inter-RAT-meas-ind SEQUENCE (SIZE (1..maxOtherRAT)) OF RAT-Type OPTIONAL } FACH-MeasurementOccasionInfo-LCR-r4-ext ::= SEQUENCE { inter-freq-TDD128-meas-ind BOOLEAN } FilterCoefficient ::= ENUMERATED { fc0, fc1, fc2, fc3, fc4, fc5, fc6, fc7, fc8, fc9, fc11, fc13, fc15, fc17, fc19, spare1 } -- Actual value FineSFN-SFN = IE value * 0.0625 FineSFN-SFN ::= INTEGER (0..15) ForbiddenAffectCell ::= CHOICE { fdd PrimaryCPICH-Info, tdd PrimaryCCPCH-Info } ForbiddenAffectCell-r4 ::= CHOICE { fdd PrimaryCPICH-Info, tdd PrimaryCCPCH-Info-r4 } ForbiddenAffectCell-LCR-r4 ::= SEQUENCE { tdd PrimaryCCPCH-Info-LCR-r4 } ForbiddenAffectCellList ::= SEQUENCE (SIZE (1..maxCellMeas)) OF ForbiddenAffectCell ForbiddenAffectCellList-r4 ::= SEQUENCE (SIZE (1..maxCellMeas)) OF ForbiddenAffectCell-r4 ForbiddenAffectCellList-LCR-r4 ::= SEQUENCE (SIZE (1..maxCellMeas)) OF ForbiddenAffectCell-LCR-r4 FreqQualityEstimateQuantity-FDD ::= ENUMERATED { cpich-Ec-N0, cpich-RSCP } FreqQualityEstimateQuantity-TDD ::= ENUMERATED { primaryCCPCH-RSCP } GPS-MeasurementParam ::= SEQUENCE { satelliteID INTEGER (0..63), c-N0 INTEGER (0..63), doppler INTEGER (-32768..32768), wholeGPS-Chips INTEGER (0..1022), fractionalGPS-Chips INTEGER (0..1023), multipathIndicator MultipathIndicator, pseudorangeRMS-Error INTEGER (0..63) } GPS-MeasurementParamList ::= SEQUENCE (SIZE (1..maxSat)) OF GPS-MeasurementParam GSM-CarrierRSSI ::= BIT STRING (SIZE (6)) GSM-MeasuredResults ::= SEQUENCE { gsm-CarrierRSSI GSM-CarrierRSSI OPTIONAL, -- dummy is not used in this version of the specification, it should -- not be sent and if received it should be ignored. dummy INTEGER (46..173) OPTIONAL, bsicReported BSICReported, -- dummy2 is not used in this version of the specification, it should -- not be sent and if received it should be ignored. dummy2 ObservedTimeDifferenceToGSM OPTIONAL } GSM-MeasuredResultsList ::= SEQUENCE (SIZE (1..maxReportedGSMCells)) OF GSM-MeasuredResults GPS-TOW-1msec ::= INTEGER (0..604799999) GPS-TOW-Assist ::= SEQUENCE { satID SatID, tlm-Message BIT STRING (SIZE (14)), tlm-Reserved BIT STRING (SIZE (2)), alert BOOLEAN, antiSpoof BOOLEAN } GPS-TOW-AssistList ::= SEQUENCE (SIZE (1..maxSat)) OF GPS-TOW-Assist HCS-CellReselectInformation-RSCP ::= SEQUENCE { -- TABULAR: The default value for penaltyTime is "notUsed" -- Temporary offset is nested inside PenaltyTime-RSCP penaltyTime PenaltyTime-RSCP } HCS-CellReselectInformation-ECN0 ::= SEQUENCE { -- TABULAR: The default value for penaltyTime is "notUsed" -- Temporary offset is nested inside PenaltyTime-ECN0 penaltyTime PenaltyTime-ECN0 } HCS-NeighbouringCellInformation-RSCP ::= SEQUENCE { hcs-PRIO HCS-PRIO DEFAULT 0, q-HCS Q-HCS DEFAULT 0, hcs-CellReselectInformation HCS-CellReselectInformation-RSCP } HCS-NeighbouringCellInformation-ECN0 ::= SEQUENCE { hcs-PRIO HCS-PRIO DEFAULT 0, q-HCS Q-HCS DEFAULT 0, hcs-CellReselectInformation HCS-CellReselectInformation-ECN0 } HCS-PRIO ::= INTEGER (0..7) HCS-ServingCellInformation ::= SEQUENCE { hcs-PRIO HCS-PRIO DEFAULT 0, q-HCS Q-HCS DEFAULT 0, t-CR-Max T-CRMax OPTIONAL } HorizontalVelocity ::= SEQUENCE { bearing INTEGER (0..359), horizontalSpeed INTEGER (0..2047) } HorizontalWithVerticalVelocity ::= SEQUENCE { verticalSpeedDirection ENUMERATED { upward, downward }, bearing INTEGER (0..359), horizontalSpeed INTEGER (0..2047), verticalSpeed INTEGER (0..255) } HorizontalVelocityWithUncertainty ::= SEQUENCE { bearing INTEGER (0..359), horizontalSpeed INTEGER (0..2047), horizontalSpeedUncertainty INTEGER (0..255) } HorizontalWithVerticalVelocityAndUncertainty ::= SEQUENCE { verticalSpeedDirection ENUMERATED { upward, downward }, bearing INTEGER (0..359), horizontalSpeed INTEGER (0..2047), verticalSpeed INTEGER (0..255), horizontalSpeedUncertainty INTEGER (0..255) } -- Actual value Hysteresis = IE value * 0.5 Hysteresis ::= INTEGER (0..15) -- Actual value HysteresisInterFreq = IE value * 0.5 HysteresisInterFreq ::= INTEGER (0..29) InterFreqCell ::= SEQUENCE { frequencyInfo FrequencyInfo, nonFreqRelatedEventResults CellMeasurementEventResults } InterFreqCell-LCR-r4 ::= SEQUENCE { frequencyInfo FrequencyInfo, nonFreqRelatedEventResults CellMeasurementEventResults-LCR-r4 } InterFreqCellID ::= INTEGER (0..maxCellMeas-1) InterFreqCellInfoList ::= SEQUENCE { removedInterFreqCellList RemovedInterFreqCellList OPTIONAL, newInterFreqCellList NewInterFreqCellList OPTIONAL, cellsForInterFreqMeasList CellsForInterFreqMeasList OPTIONAL } InterFreqCellInfoList-r4 ::= SEQUENCE { removedInterFreqCellList RemovedInterFreqCellList OPTIONAL, newInterFreqCellList NewInterFreqCellList-r4 OPTIONAL, cellsForInterFreqMeasList CellsForInterFreqMeasList OPTIONAL } InterFreqCellInfoSI-List-RSCP ::= SEQUENCE { removedInterFreqCellList RemovedInterFreqCellList OPTIONAL, newInterFreqCellList NewInterFreqCellSI-List-RSCP OPTIONAL } InterFreqCellInfoSI-List-ECN0 ::= SEQUENCE { removedInterFreqCellList RemovedInterFreqCellList OPTIONAL, newInterFreqCellList NewInterFreqCellSI-List-ECN0 OPTIONAL } InterFreqCellInfoSI-List-HCS-RSCP ::= SEQUENCE { removedInterFreqCellList RemovedInterFreqCellList OPTIONAL, newInterFreqCellList NewInterFreqCellSI-List-HCS-RSCP OPTIONAL } InterFreqCellInfoSI-List-HCS-ECN0 ::= SEQUENCE { removedInterFreqCellList RemovedInterFreqCellList OPTIONAL, newInterFreqCellList NewInterFreqCellSI-List-HCS-ECN0 OPTIONAL } InterFreqCellInfoSI-List-RSCP-LCR ::= SEQUENCE { removedInterFreqCellList RemovedInterFreqCellList OPTIONAL, newInterFreqCellList NewInterFreqCellSI-List-RSCP-LCR-r4 OPTIONAL } InterFreqCellInfoSI-List-ECN0-LCR ::= SEQUENCE { removedInterFreqCellList RemovedInterFreqCellList OPTIONAL, newInterFreqCellList NewInterFreqCellSI-List-ECN0-LCR-r4 OPTIONAL } InterFreqCellInfoSI-List-HCS-RSCP-LCR ::= SEQUENCE { removedInterFreqCellList RemovedInterFreqCellList OPTIONAL, newInterFreqCellList NewInterFreqCellSI-List-HCS-RSCP-LCR-r4 OPTIONAL } InterFreqCellInfoSI-List-HCS-ECN0-LCR ::= SEQUENCE { removedInterFreqCellList RemovedInterFreqCellList OPTIONAL, newInterFreqCellList NewInterFreqCellSI-List-HCS-ECN0-LCR-r4 OPTIONAL } InterFreqCellList ::= SEQUENCE (SIZE (1..maxFreq)) OF InterFreqCell InterFreqCellList-LCR-r4-ext ::= SEQUENCE (SIZE (1..maxFreq)) OF InterFreqCell-LCR-r4 InterFreqCellMeasuredResultsList ::= SEQUENCE (SIZE (1..maxCellMeas)) OF CellMeasuredResults InterFreqEvent ::= CHOICE { event2a Event2a, event2b Event2b, event2c Event2c, event2d Event2d, event2e Event2e, event2f Event2f } InterFreqEvent-r6 ::= CHOICE { event2a Event2a-r6, event2b Event2b-r6, event2c Event2c-r6, event2d Event2d-r6, event2e Event2e-r6, event2f Event2f-r6 } InterFreqEventList ::= SEQUENCE (SIZE (1..maxMeasEvent)) OF InterFreqEvent InterFreqEventList-r6 ::= SEQUENCE (SIZE (1..maxMeasEvent)) OF InterFreqEvent-r6 --Following IE shall be used regardless of CPICH RSCP(FDD) or Primary CCPCH RSCP(TDD) --The order of the list corresponds to the order of the cells in InterFrequencyMeasuredResultsList --The IE is only used for measured results and not for additional measured results. InterFrequencyMeasuredResultsList-v590ext ::= SEQUENCE (SIZE (1..maxCellMeas)) OF DeltaRSCPPerCell Inter-FreqEventCriteria-v590ext ::= SEQUENCE { threholdUsedFrequency-delta DeltaRSCP, threholdNonUsedFrequency-deltaList ThreholdNonUsedFrequency-deltaList OPTIONAL } --The order of the list corresponds to the order of the events in Inter-FreqEventList Inter-FreqEventCriteriaList-v590ext ::= SEQUENCE (SIZE (1..maxMeasEvent)) OF Inter-FreqEventCriteria-v590ext --The order of the list corresponds to the order of relevant events in Intra-FreqEventCriteriaList --i.e. the first element of the list corresponds to the first occurance of event 1e, 1f, 1h, 1i, --the second element of the list corresponds to the second occurance of event 1e, 1f, 1h, 1i Intra-FreqEventCriteriaList-v590ext ::= SEQUENCE (SIZE (1..maxMeasEvent)) OF DeltaRSCP --Following IE shall be used regardless of CPICH RSCP(FDD) or Primary CCPCH RSCP(TDD) --The order of the list corresponds to the order of the cells in IntraFrequencyMeasuredResultsList --The IE is only used for measured results and not for additional measured results. IntraFrequencyMeasuredResultsList-v590ext ::= SEQUENCE (SIZE (1..maxCellMeas)) OF DeltaRSCPPerCell IntraFreqReportingCriteria-1b-r5 ::= SEQUENCE { periodicReportingInfo-1b PeriodicReportingInfo-1b } PeriodicReportingInfo-1b ::= SEQUENCE { reportingAmount ReportingAmount, reportingInterval ReportingInterval } InterFreqEventResults ::= SEQUENCE { eventID EventIDInterFreq, interFreqCellList InterFreqCellList OPTIONAL } InterFreqEventResults-LCR-r4-ext ::= SEQUENCE { eventID EventIDInterFreq, interFreqCellList InterFreqCellList-LCR-r4-ext OPTIONAL } InterFreqMeasQuantity ::= SEQUENCE { reportingCriteria CHOICE { intraFreqReportingCriteria SEQUENCE { intraFreqMeasQuantity IntraFreqMeasQuantity }, interFreqReportingCriteria SEQUENCE { filterCoefficient FilterCoefficient DEFAULT fc0, modeSpecificInfo CHOICE { fdd SEQUENCE { freqQualityEstimateQuantity-FDD FreqQualityEstimateQuantity-FDD }, tdd SEQUENCE { freqQualityEstimateQuantity-TDD FreqQualityEstimateQuantity-TDD } } } } } InterFreqMeasuredResults ::= SEQUENCE { frequencyInfo FrequencyInfo OPTIONAL, utra-CarrierRSSI UTRA-CarrierRSSI OPTIONAL, interFreqCellMeasuredResultsList InterFreqCellMeasuredResultsList OPTIONAL } InterFreqMeasuredResultsList ::= SEQUENCE (SIZE (1..maxFreq)) OF InterFreqMeasuredResults InterFreqMeasurementSysInfo-RSCP ::= SEQUENCE { interFreqCellInfoSI-List InterFreqCellInfoSI-List-RSCP OPTIONAL } InterFreqMeasurementSysInfo-ECN0 ::= SEQUENCE { interFreqCellInfoSI-List InterFreqCellInfoSI-List-ECN0 OPTIONAL } InterFreqMeasurementSysInfo-HCS-RSCP ::= SEQUENCE { interFreqCellInfoSI-List InterFreqCellInfoSI-List-HCS-RSCP OPTIONAL } InterFreqMeasurementSysInfo-HCS-ECN0 ::= SEQUENCE { interFreqCellInfoSI-List InterFreqCellInfoSI-List-HCS-ECN0 OPTIONAL } InterFreqMeasurementSysInfo-RSCP-LCR-r4 ::= SEQUENCE { interFreqCellInfoSI-List InterFreqCellInfoSI-List-RSCP-LCR OPTIONAL } InterFreqMeasurementSysInfo-ECN0-LCR-r4 ::= SEQUENCE { interFreqCellInfoSI-List InterFreqCellInfoSI-List-ECN0-LCR OPTIONAL } InterFreqMeasurementSysInfo-HCS-RSCP-LCR-r4 ::= SEQUENCE { interFreqCellInfoSI-List InterFreqCellInfoSI-List-HCS-RSCP-LCR OPTIONAL } InterFreqMeasurementSysInfo-HCS-ECN0-LCR-r4 ::= SEQUENCE { interFreqCellInfoSI-List InterFreqCellInfoSI-List-HCS-ECN0-LCR OPTIONAL } InterFreqRACHRepCellsList ::= SEQUENCE (SIZE (1..maxFreq)) OF InterFreqCellID InterFreqRACHReportingInfo ::= SEQUENCE { modeSpecificInfo CHOICE { fdd SEQUENCE { interFreqRepQuantityRACH-FDD InterFreqRepQuantityRACH-FDD }, tdd SEQUENCE { interFreqRepQuantityRACH-TDDList InterFreqRepQuantityRACH-TDDList }, interFreqRACHReportingThreshold Threshold, maxReportedCellsOnRACHinterFreq MaxReportedCellsOnRACHinterFreq } } InterFreqReportCriteria ::= CHOICE { intraFreqReportingCriteria IntraFreqReportingCriteria, interFreqReportingCriteria InterFreqReportingCriteria, periodicalReportingCriteria PeriodicalWithReportingCellStatus, noReporting ReportingCellStatusOpt } InterFreqReportCriteria-r4 ::= CHOICE { intraFreqReportingCriteria IntraFreqReportingCriteria-r4, interFreqReportingCriteria InterFreqReportingCriteria, periodicalReportingCriteria PeriodicalWithReportingCellStatus, noReporting ReportingCellStatusOpt } InterFreqReportCriteria-r6 ::= CHOICE { intraFreqReportingCriteria IntraFreqReportingCriteria-r6, interFreqReportingCriteria InterFreqReportingCriteria-r6, periodicalReportingCriteria PeriodicalWithReportingCellStatus, noReporting ReportingCellStatusOpt } InterFreqReportingCriteria ::= SEQUENCE { interFreqEventList InterFreqEventList OPTIONAL } InterFreqReportingCriteria-r6 ::= SEQUENCE { interFreqEventList InterFreqEventList-r6 OPTIONAL } InterFreqReportingQuantity ::= SEQUENCE { utra-Carrier-RSSI BOOLEAN, frequencyQualityEstimate BOOLEAN, nonFreqRelatedQuantities CellReportingQuantities } InterFreqRepQuantityRACH-FDD ::= ENUMERATED { cpich-EcN0, cpich-RSCP } InterFreqRepQuantityRACH-TDD ::= ENUMERATED { timeslotISCP, primaryCCPCH-RSCP } InterFreqRepQuantityRACH-TDDList ::= SEQUENCE (SIZE (1..2)) OF InterFreqRepQuantityRACH-TDD InterFrequencyMeasurement ::= SEQUENCE { interFreqCellInfoList InterFreqCellInfoList, interFreqMeasQuantity InterFreqMeasQuantity OPTIONAL, interFreqReportingQuantity InterFreqReportingQuantity OPTIONAL, measurementValidity MeasurementValidity OPTIONAL, interFreqSetUpdate UE-AutonomousUpdateMode OPTIONAL, reportCriteria InterFreqReportCriteria } InterFrequencyMeasurement-r4 ::= SEQUENCE { interFreqCellInfoList InterFreqCellInfoList-r4, interFreqMeasQuantity InterFreqMeasQuantity OPTIONAL, interFreqReportingQuantity InterFreqReportingQuantity OPTIONAL, measurementValidity MeasurementValidity OPTIONAL, interFreqSetUpdate UE-AutonomousUpdateMode OPTIONAL, reportCriteria InterFreqReportCriteria-r4 } InterFrequencyMeasurement-r6 ::= SEQUENCE { interFreqCellInfoList InterFreqCellInfoList-r4, interFreqMeasQuantity InterFreqMeasQuantity OPTIONAL, interFreqReportingQuantity InterFreqReportingQuantity OPTIONAL, measurementValidity MeasurementValidity OPTIONAL, interFreqSetUpdate UE-AutonomousUpdateMode OPTIONAL, reportCriteria InterFreqReportCriteria-r6 } InterRAT-TargetCellDescription ::= SEQUENCE { technologySpecificInfo CHOICE { gsm SEQUENCE { bsic BSIC, frequency-band Frequency-Band, bcch-ARFCN BCCH-ARFCN, ncMode NC-Mode OPTIONAL }, is-2000 NULL, spare2 NULL, spare1 NULL } } InterRATCellID ::= INTEGER (0..maxCellMeas-1) InterRATCellInfoIndication ::= INTEGER (0..3) InterRATCellInfoList ::= SEQUENCE { removedInterRATCellList RemovedInterRATCellList, -- NOTE: Future revisions of dedicated messages including IE newInterRATCellList -- should use a corrected version of this IE newInterRATCellList NewInterRATCellList, cellsForInterRATMeasList CellsForInterRATMeasList OPTIONAL } InterRATCellInfoList-B ::= SEQUENCE { removedInterRATCellList RemovedInterRATCellList, -- NOTE: IE newInterRATCellList should be optional. However, system information -- does not support message versions. Hence, this can not be corrected newInterRATCellList NewInterRATCellList-B } InterRATCellInfoList-r4 ::= SEQUENCE { removedInterRATCellList RemovedInterRATCellList, newInterRATCellList NewInterRATCellList OPTIONAL, cellsForInterRATMeasList CellsForInterRATMeasList OPTIONAL } InterRATCellInfoList-r6 ::= SEQUENCE { removedInterRATCellList RemovedInterRATCellList, newInterRATCellList NewInterRATCellList OPTIONAL, cellsForInterRATMeasList CellsForInterRATMeasList OPTIONAL, interRATCellInfoIndication-r6 InterRATCellInfoIndication OPTIONAL } InterRATCellIndividualOffset ::= INTEGER (-50..50) InterRATEvent ::= CHOICE { event3a Event3a, event3b Event3b, event3c Event3c, event3d Event3d } InterRATEventList ::= SEQUENCE (SIZE (1..maxMeasEvent)) OF InterRATEvent InterRATEventResults ::= SEQUENCE { eventID EventIDInterRAT, cellToReportList CellToReportList } InterRATInfo ::= ENUMERATED { gsm } InterRATInfo-r6 ::= SEQUENCE { rat InterRATInfo, gsm-TargetCellInfoList GSM-TargetCellInfoList OPTIONAL } InterRATMeasQuantity ::= SEQUENCE { measQuantityUTRAN-QualityEstimate IntraFreqMeasQuantity OPTIONAL, ratSpecificInfo CHOICE { gsm SEQUENCE { measurementQuantity MeasurementQuantityGSM, filterCoefficient FilterCoefficient DEFAULT fc0, bsic-VerificationRequired BSIC-VerificationRequired }, is-2000 SEQUENCE { tadd-EcIo INTEGER (0..63), tcomp-EcIo INTEGER (0..15), softSlope INTEGER (0..63) OPTIONAL, addIntercept INTEGER (0..63) OPTIONAL } } } InterRATMeasuredResults ::= CHOICE { gsm GSM-MeasuredResultsList, spare NULL } InterRATMeasuredResultsList ::= SEQUENCE (SIZE (1..maxOtherRAT-16)) OF InterRATMeasuredResults InterRATMeasurement ::= SEQUENCE { interRATCellInfoList InterRATCellInfoList OPTIONAL, interRATMeasQuantity InterRATMeasQuantity OPTIONAL, interRATReportingQuantity InterRATReportingQuantity OPTIONAL, reportCriteria InterRATReportCriteria } InterRATMeasurement-r4 ::= SEQUENCE { interRATCellInfoList InterRATCellInfoList-r4 OPTIONAL, interRATMeasQuantity InterRATMeasQuantity OPTIONAL, interRATReportingQuantity InterRATReportingQuantity OPTIONAL, reportCriteria InterRATReportCriteria } InterRATMeasurement-r6 ::= SEQUENCE { interRATCellInfoList InterRATCellInfoList-r6 OPTIONAL, interRATMeasQuantity InterRATMeasQuantity OPTIONAL, interRATReportingQuantity InterRATReportingQuantity OPTIONAL, reportCriteria InterRATReportCriteria } InterRATMeasurementSysInfo ::= SEQUENCE { interRATCellInfoList InterRATCellInfoList OPTIONAL } InterRATMeasurementSysInfo-B ::= SEQUENCE { interRATCellInfoList InterRATCellInfoList-B OPTIONAL } InterRATReportCriteria ::= CHOICE { interRATReportingCriteria InterRATReportingCriteria, periodicalReportingCriteria PeriodicalWithReportingCellStatus, noReporting ReportingCellStatusOpt } InterRATReportingCriteria ::= SEQUENCE { interRATEventList InterRATEventList OPTIONAL } InterRATReportingQuantity ::= SEQUENCE { utran-EstimatedQuality BOOLEAN, ratSpecificInfo CHOICE { gsm SEQUENCE { -- dummy and dummy2 are not used in this version of the specification -- and when received they should be ignored. dummy BOOLEAN, dummy2 BOOLEAN, gsm-Carrier-RSSI BOOLEAN } } } IntraFreqCellID ::= INTEGER (0..maxCellMeas-1) IntraFreqCellInfoList ::= SEQUENCE { removedIntraFreqCellList RemovedIntraFreqCellList OPTIONAL, newIntraFreqCellList NewIntraFreqCellList OPTIONAL, cellsForIntraFreqMeasList CellsForIntraFreqMeasList OPTIONAL } IntraFreqCellInfoList-r4 ::= SEQUENCE { removedIntraFreqCellList RemovedIntraFreqCellList OPTIONAL, newIntraFreqCellList NewIntraFreqCellList-r4 OPTIONAL, cellsForIntraFreqMeasList CellsForIntraFreqMeasList OPTIONAL } IntraFreqCellInfoSI-List-RSCP ::= SEQUENCE { removedIntraFreqCellList RemovedIntraFreqCellList OPTIONAL, newIntraFreqCellList NewIntraFreqCellSI-List-RSCP } IntraFreqCellInfoSI-List-ECN0 ::= SEQUENCE { removedIntraFreqCellList RemovedIntraFreqCellList OPTIONAL, newIntraFreqCellList NewIntraFreqCellSI-List-ECN0 } IntraFreqCellInfoSI-List-HCS-RSCP ::= SEQUENCE { removedIntraFreqCellList RemovedIntraFreqCellList OPTIONAL, newIntraFreqCellList NewIntraFreqCellSI-List-HCS-RSCP } IntraFreqCellInfoSI-List-HCS-ECN0 ::= SEQUENCE { removedIntraFreqCellList RemovedIntraFreqCellList OPTIONAL, newIntraFreqCellList NewIntraFreqCellSI-List-HCS-ECN0 } IntraFreqCellInfoSI-List-RSCP-LCR-r4 ::= SEQUENCE { removedIntraFreqCellList RemovedIntraFreqCellList OPTIONAL, newIntraFreqCellList NewIntraFreqCellSI-List-RSCP-LCR-r4 } IntraFreqCellInfoSI-List-ECN0-LCR-r4 ::= SEQUENCE { removedIntraFreqCellList RemovedIntraFreqCellList OPTIONAL, newIntraFreqCellList NewIntraFreqCellSI-List-ECN0-LCR-r4 } IntraFreqCellInfoSI-List-HCS-RSCP-LCR-r4 ::= SEQUENCE { removedIntraFreqCellList RemovedIntraFreqCellList OPTIONAL, newIntraFreqCellList NewIntraFreqCellSI-List-HCS-RSCP-LCR-r4 } IntraFreqCellInfoSI-List-HCS-ECN0-LCR-r4 ::= SEQUENCE { removedIntraFreqCellList RemovedIntraFreqCellList OPTIONAL, newIntraFreqCellList NewIntraFreqCellSI-List-HCS-ECN0-LCR-r4 } IntraFreqEvent ::= CHOICE { e1a Event1a, e1b Event1b, e1c Event1c, e1d NULL, e1e Event1e, e1f Event1f, e1g NULL, e1h ThresholdUsedFrequency, e1i ThresholdUsedFrequency } IntraFreqEvent-r4 ::= CHOICE { e1a Event1a-r4, e1b Event1b-r4, e1c Event1c, e1d NULL, e1e Event1e, e1f Event1f, e1g NULL, e1h ThresholdUsedFrequency, e1i ThresholdUsedFrequency } IntraFreqEvent-LCR-r4 ::= CHOICE { e1a Event1a-LCR-r4, e1b Event1b-LCR-r4, e1c Event1c, e1d NULL, e1e Event1e, e1f Event1f, e1g NULL, e1h ThresholdUsedFrequency, e1i ThresholdUsedFrequency } IntraFreqEvent-r6 ::= CHOICE { e1a Event1a-r4, e1b Event1b-r4, e1c Event1c, e1d Event1d, e1e Event1e-r6, e1f Event1f-r6, e1g NULL, e1h ThresholdUsedFrequency-r6, e1i ThresholdUsedFrequency-r6, e1j Event1j-r6 } IntraFreqEvent-1d-r5 ::= SEQUENCE { triggeringCondition TriggeringCondition2 OPTIONAL, useCIO BOOLEAN OPTIONAL } IntraFreqEventCriteria ::= SEQUENCE { event IntraFreqEvent, hysteresis Hysteresis, timeToTrigger TimeToTrigger, reportingCellStatus ReportingCellStatus OPTIONAL } IntraFreqEventCriteria-r4 ::= SEQUENCE { event IntraFreqEvent-r4, hysteresis Hysteresis, timeToTrigger TimeToTrigger, reportingCellStatus ReportingCellStatus OPTIONAL } IntraFreqEventCriteria-LCR-r4 ::= SEQUENCE { event IntraFreqEvent-LCR-r4, hysteresis Hysteresis, timeToTrigger TimeToTrigger, reportingCellStatus ReportingCellStatus OPTIONAL } IntraFreqEventCriteria-r6 ::= SEQUENCE { event IntraFreqEvent-r6, hysteresis Hysteresis, timeToTrigger TimeToTrigger, reportingCellStatus ReportingCellStatus OPTIONAL } IntraFreqEventCriteriaList ::= SEQUENCE (SIZE (1..maxMeasEvent)) OF IntraFreqEventCriteria IntraFreqEventCriteriaList-r4 ::= SEQUENCE (SIZE (1..maxMeasEvent)) OF IntraFreqEventCriteria-r4 IntraFreqEventCriteriaList-LCR-r4 ::= SEQUENCE (SIZE (1..maxMeasEvent)) OF IntraFreqEventCriteria-LCR-r4 IntraFreqEventCriteriaList-r6 ::= SEQUENCE (SIZE (1..maxMeasEvent)) OF IntraFreqEventCriteria-r6 IntraFreqEventResults ::= SEQUENCE { eventID EventIDIntraFreq, cellMeasurementEventResults CellMeasurementEventResults } IntraFreqMeasQuantity ::= SEQUENCE { filterCoefficient FilterCoefficient DEFAULT fc0, modeSpecificInfo CHOICE { fdd SEQUENCE { intraFreqMeasQuantity-FDD IntraFreqMeasQuantity-FDD }, tdd SEQUENCE { intraFreqMeasQuantity-TDDList IntraFreqMeasQuantity-TDDList } } } -- If IntraFreqMeasQuantity-FDD is used in InterRATMeasQuantity, then only -- cpich-Ec-N0 and cpich-RSCP are allowed. -- dummy is not used in this version of the specification, it should -- not be sent and if received the UE behaviour is not specified. IntraFreqMeasQuantity-FDD ::= ENUMERATED { cpich-Ec-N0, cpich-RSCP, pathloss, dummy } -- dummy is not used in this version of the specification, it should -- not be sent and if received the UE behaviour is not specified. IntraFreqMeasQuantity-TDD ::= ENUMERATED { primaryCCPCH-RSCP, pathloss, timeslotISCP, dummy } IntraFreqMeasQuantity-TDDList ::= SEQUENCE (SIZE (1..4)) OF IntraFreqMeasQuantity-TDD IntraFreqMeasuredResultsList ::= SEQUENCE (SIZE (1..maxCellMeas)) OF CellMeasuredResults IntraFreqMeasurementSysInfo-RSCP ::= SEQUENCE { intraFreqMeasurementID MeasurementIdentity DEFAULT 1, intraFreqCellInfoSI-List IntraFreqCellInfoSI-List-RSCP OPTIONAL, intraFreqMeasQuantity IntraFreqMeasQuantity OPTIONAL, intraFreqReportingQuantityForRACH IntraFreqReportingQuantityForRACH OPTIONAL, maxReportedCellsOnRACH MaxReportedCellsOnRACH OPTIONAL, reportingInfoForCellDCH ReportingInfoForCellDCH OPTIONAL } IntraFreqMeasurementSysInfo-ECN0 ::= SEQUENCE { intraFreqMeasurementID MeasurementIdentity DEFAULT 1, intraFreqCellInfoSI-List IntraFreqCellInfoSI-List-ECN0 OPTIONAL, intraFreqMeasQuantity IntraFreqMeasQuantity OPTIONAL, intraFreqReportingQuantityForRACH IntraFreqReportingQuantityForRACH OPTIONAL, maxReportedCellsOnRACH MaxReportedCellsOnRACH OPTIONAL, reportingInfoForCellDCH ReportingInfoForCellDCH OPTIONAL } IntraFreqMeasurementSysInfo-HCS-RSCP ::= SEQUENCE { intraFreqMeasurementID MeasurementIdentity DEFAULT 1, intraFreqCellInfoSI-List IntraFreqCellInfoSI-List-HCS-RSCP OPTIONAL, intraFreqMeasQuantity IntraFreqMeasQuantity OPTIONAL, intraFreqReportingQuantityForRACH IntraFreqReportingQuantityForRACH OPTIONAL, maxReportedCellsOnRACH MaxReportedCellsOnRACH OPTIONAL, reportingInfoForCellDCH ReportingInfoForCellDCH OPTIONAL } IntraFreqMeasurementSysInfo-HCS-ECN0 ::= SEQUENCE { intraFreqMeasurementID MeasurementIdentity DEFAULT 1, intraFreqCellInfoSI-List IntraFreqCellInfoSI-List-HCS-ECN0 OPTIONAL, intraFreqMeasQuantity IntraFreqMeasQuantity OPTIONAL, intraFreqReportingQuantityForRACH IntraFreqReportingQuantityForRACH OPTIONAL, maxReportedCellsOnRACH MaxReportedCellsOnRACH OPTIONAL, reportingInfoForCellDCH ReportingInfoForCellDCH OPTIONAL } IntraFreqMeasurementSysInfo-RSCP-LCR-r4 ::= SEQUENCE { intraFreqMeasurementID MeasurementIdentity DEFAULT 1, intraFreqCellInfoSI-List IntraFreqCellInfoSI-List-RSCP-LCR-r4 OPTIONAL, intraFreqMeasQuantity IntraFreqMeasQuantity OPTIONAL, intraFreqReportingQuantityForRACH IntraFreqReportingQuantityForRACH OPTIONAL, maxReportedCellsOnRACH MaxReportedCellsOnRACH OPTIONAL, reportingInfoForCellDCH ReportingInfoForCellDCH-LCR-r4 OPTIONAL } IntraFreqMeasurementSysInfo-ECN0-LCR-r4 ::= SEQUENCE { intraFreqMeasurementID MeasurementIdentity DEFAULT 1, intraFreqCellInfoSI-List IntraFreqCellInfoSI-List-ECN0-LCR-r4 OPTIONAL, intraFreqMeasQuantity IntraFreqMeasQuantity OPTIONAL, intraFreqReportingQuantityForRACH IntraFreqReportingQuantityForRACH OPTIONAL, maxReportedCellsOnRACH MaxReportedCellsOnRACH OPTIONAL, reportingInfoForCellDCH ReportingInfoForCellDCH-LCR-r4 OPTIONAL } IntraFreqMeasurementSysInfo-HCS-RSCP-LCR-r4 ::= SEQUENCE { intraFreqMeasurementID MeasurementIdentity DEFAULT 1, intraFreqCellInfoSI-List IntraFreqCellInfoSI-List-HCS-RSCP-LCR-r4 OPTIONAL, intraFreqMeasQuantity IntraFreqMeasQuantity OPTIONAL, intraFreqReportingQuantityForRACH IntraFreqReportingQuantityForRACH OPTIONAL, maxReportedCellsOnRACH MaxReportedCellsOnRACH OPTIONAL, reportingInfoForCellDCH ReportingInfoForCellDCH-LCR-r4 OPTIONAL } IntraFreqMeasurementSysInfo-HCS-ECN0-LCR-r4 ::= SEQUENCE { intraFreqMeasurementID MeasurementIdentity DEFAULT 1, intraFreqCellInfoSI-List IntraFreqCellInfoSI-List-HCS-ECN0-LCR-r4 OPTIONAL, intraFreqMeasQuantity IntraFreqMeasQuantity OPTIONAL, intraFreqReportingQuantityForRACH IntraFreqReportingQuantityForRACH OPTIONAL, maxReportedCellsOnRACH MaxReportedCellsOnRACH OPTIONAL, reportingInfoForCellDCH ReportingInfoForCellDCH-LCR-r4 OPTIONAL } IntraFreqReportCriteria ::= CHOICE { intraFreqReportingCriteria IntraFreqReportingCriteria, periodicalReportingCriteria PeriodicalWithReportingCellStatus, noReporting ReportingCellStatusOpt } IntraFreqReportCriteria-r4 ::= CHOICE { intraFreqReportingCriteria IntraFreqReportingCriteria-r4, periodicalReportingCriteria PeriodicalWithReportingCellStatus, noReporting ReportingCellStatusOpt } IntraFreqReportCriteria-r6 ::= CHOICE { intraFreqReportingCriteria IntraFreqReportingCriteria-r6, periodicalReportingCriteria PeriodicalWithReportingCellStatus, noReporting ReportingCellStatusOpt } IntraFreqReportingCriteria ::= SEQUENCE { eventCriteriaList IntraFreqEventCriteriaList OPTIONAL } IntraFreqReportingCriteria-r4 ::= SEQUENCE { eventCriteriaList IntraFreqEventCriteriaList-r4 OPTIONAL } IntraFreqReportingCriteria-LCR-r4 ::= SEQUENCE { eventCriteriaList IntraFreqEventCriteriaList-LCR-r4 OPTIONAL } IntraFreqReportingCriteria-r6 ::= SEQUENCE { eventCriteriaList IntraFreqEventCriteriaList-r6 OPTIONAL } IntraFreqReportingQuantity ::= SEQUENCE { activeSetReportingQuantities CellReportingQuantities, monitoredSetReportingQuantities CellReportingQuantities, detectedSetReportingQuantities CellReportingQuantities OPTIONAL } IntraFreqReportingQuantityForRACH ::= SEQUENCE { sfn-SFN-OTD-Type SFN-SFN-OTD-Type, modeSpecificInfo CHOICE { fdd SEQUENCE { intraFreqRepQuantityRACH-FDD IntraFreqRepQuantityRACH-FDD }, tdd SEQUENCE { intraFreqRepQuantityRACH-TDDList IntraFreqRepQuantityRACH-TDDList } } } IntraFreqRepQuantityRACH-FDD ::= ENUMERATED { cpich-EcN0, cpich-RSCP, pathloss, noReport } IntraFreqRepQuantityRACH-TDD ::= ENUMERATED { timeslotISCP, primaryCCPCH-RSCP, noReport } IntraFreqRepQuantityRACH-TDDList ::= SEQUENCE (SIZE (1..2)) OF IntraFreqRepQuantityRACH-TDD IntraFrequencyMeasurement ::= SEQUENCE { intraFreqCellInfoList IntraFreqCellInfoList OPTIONAL, intraFreqMeasQuantity IntraFreqMeasQuantity OPTIONAL, intraFreqReportingQuantity IntraFreqReportingQuantity OPTIONAL, measurementValidity MeasurementValidity OPTIONAL, reportCriteria IntraFreqReportCriteria OPTIONAL } IntraFrequencyMeasurement-r4 ::= SEQUENCE { intraFreqCellInfoList IntraFreqCellInfoList-r4 OPTIONAL, intraFreqMeasQuantity IntraFreqMeasQuantity OPTIONAL, intraFreqReportingQuantity IntraFreqReportingQuantity OPTIONAL, measurementValidity MeasurementValidity OPTIONAL, reportCriteria IntraFreqReportCriteria-r4 OPTIONAL } IntraFrequencyMeasurement-r6 ::= SEQUENCE { intraFreqCellInfoList IntraFreqCellInfoList-r4 OPTIONAL, intraFreqMeasQuantity IntraFreqMeasQuantity OPTIONAL, intraFreqReportingQuantity IntraFreqReportingQuantity OPTIONAL, measurementValidity MeasurementValidity OPTIONAL, reportCriteria IntraFreqReportCriteria-r6 } IODE ::= INTEGER (0..255) IP-Length ::= ENUMERATED { ipl5, ipl10 } IP-PCCPCH-r4 ::= BOOLEAN IP-Spacing ::= ENUMERATED { e5, e7, e10, e15, e20, e30, e40, e50 } IP-Spacing-TDD ::= ENUMERATED { e30, e40, e50, e70, e100} IS-2000SpecificMeasInfo ::= ENUMERATED { frequency, timeslot, colourcode, outputpower, pn-Offset } MaxNumberOfReportingCellsType1 ::= ENUMERATED { e1, e2, e3, e4, e5, e6} MaxNumberOfReportingCellsType2 ::= ENUMERATED { e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12} MaxNumberOfReportingCellsType3 ::= ENUMERATED { viactCellsPlus1, viactCellsPlus2, viactCellsPlus3, viactCellsPlus4, viactCellsPlus5, viactCellsPlus6 } MaxReportedCellsOnRACH ::= ENUMERATED { noReport, currentCell, currentAnd-1-BestNeighbour, currentAnd-2-BestNeighbour, currentAnd-3-BestNeighbour, currentAnd-4-BestNeighbour, currentAnd-5-BestNeighbour, currentAnd-6-BestNeighbour } MaxReportedCellsOnRACHinterFreq ::= INTEGER (1..8) MeasuredResults ::= CHOICE { intraFreqMeasuredResultsList IntraFreqMeasuredResultsList, interFreqMeasuredResultsList InterFreqMeasuredResultsList, interRATMeasuredResultsList InterRATMeasuredResultsList, trafficVolumeMeasuredResultsList TrafficVolumeMeasuredResultsList, qualityMeasuredResults QualityMeasuredResults, ue-InternalMeasuredResults UE-InternalMeasuredResults, ue-positioning-MeasuredResults UE-Positioning-MeasuredResults, spare NULL } MeasuredResults-v390ext ::= SEQUENCE { ue-positioning-MeasuredResults-v390ext UE-Positioning-MeasuredResults-v390ext } MeasuredResults-v590ext ::= CHOICE { intraFrequencyMeasuredResultsList IntraFrequencyMeasuredResultsList-v590ext, interFrequencyMeasuredResultsList InterFrequencyMeasuredResultsList-v590ext } MeasuredResults-v7xyext ::= CHOICE { ueInternalMeasuredResults UE-InternalMeasuredResults-r7 } MeasuredResults-LCR-r4 ::= CHOICE { intraFreqMeasuredResultsList IntraFreqMeasuredResultsList, interFreqMeasuredResultsList InterFreqMeasuredResultsList, interRATMeasuredResultsList InterRATMeasuredResultsList, trafficVolumeMeasuredResultsList TrafficVolumeMeasuredResultsList, qualityMeasuredResults QualityMeasuredResults, ue-InternalMeasuredResults UE-InternalMeasuredResults-LCR-r4, ue-positioniing-MeasuredResults UE-Positioning-MeasuredResults, spare NULL } MeasuredResultsList ::= SEQUENCE (SIZE (1..maxAdditionalMeas)) OF MeasuredResults MeasuredResultsList-LCR-r4-ext ::= SEQUENCE (SIZE (1..maxAdditionalMeas)) OF MeasuredResults-LCR-r4 MeasuredResultsOnRACH ::= SEQUENCE { currentCell SEQUENCE { modeSpecificInfo CHOICE { fdd SEQUENCE { measurementQuantity CHOICE { cpich-Ec-N0 CPICH-Ec-N0, cpich-RSCP CPICH-RSCP, pathloss Pathloss, spare NULL } }, tdd SEQUENCE { -- For 3.84 Mcps and 7.68 Mcps TDD -- timeslotISCP TimeslotISCP-List OPTIONAL, primaryCCPCH-RSCP PrimaryCCPCH-RSCP OPTIONAL } } }, monitoredCells MonitoredCellRACH-List OPTIONAL } MeasuredResultsOnRACHinterFreq ::= SEQUENCE { interFreqCellIndication-SIB11 INTEGER (0..1), interFreqCellIndication-SIB12 INTEGER (0..1), interFreqRACHRepCellsList InterFreqRACHRepCellsList } MeasurementCommand ::= CHOICE { setup MeasurementType, modify SEQUENCE { measurementType MeasurementType OPTIONAL }, release NULL } MeasurementCommand-r4 ::= CHOICE { setup MeasurementType-r4, modify SEQUENCE { measurementType MeasurementType-r4 OPTIONAL }, release NULL } MeasurementCommand-r6 ::= CHOICE { setup MeasurementType-r6, modify SEQUENCE { measurementType MeasurementType-r6 OPTIONAL }, release NULL } MeasurementControlSysInfo ::= SEQUENCE { -- CHOICE cellSelectQualityMeasure represents PCCPCH-RSCP in TDD mode. use-of-HCS CHOICE { hcs-not-used SEQUENCE { cellSelectQualityMeasure CHOICE { cpich-RSCP SEQUENCE { intraFreqMeasurementSysInfo IntraFreqMeasurementSysInfo-RSCP OPTIONAL, interFreqMeasurementSysInfo InterFreqMeasurementSysInfo-RSCP OPTIONAL }, cpich-Ec-N0 SEQUENCE { intraFreqMeasurementSysInfo IntraFreqMeasurementSysInfo-ECN0 OPTIONAL, interFreqMeasurementSysInfo InterFreqMeasurementSysInfo-ECN0 OPTIONAL } }, interRATMeasurementSysInfo InterRATMeasurementSysInfo-B OPTIONAL }, hcs-used SEQUENCE { cellSelectQualityMeasure CHOICE { cpich-RSCP SEQUENCE { intraFreqMeasurementSysInfo IntraFreqMeasurementSysInfo-HCS-RSCP OPTIONAL, interFreqMeasurementSysInfo InterFreqMeasurementSysInfo-HCS-RSCP OPTIONAL }, cpich-Ec-N0 SEQUENCE { intraFreqMeasurementSysInfo IntraFreqMeasurementSysInfo-HCS-ECN0 OPTIONAL, interFreqMeasurementSysInfo InterFreqMeasurementSysInfo-HCS-ECN0 OPTIONAL } }, interRATMeasurementSysInfo InterRATMeasurementSysInfo OPTIONAL } }, trafficVolumeMeasSysInfo TrafficVolumeMeasSysInfo OPTIONAL, -- dummy is not used in this version of specification and it shall be ignored by the UE. dummy UE-InternalMeasurementSysInfo OPTIONAL } MeasurementControlSysInfo-LCR-r4-ext ::= SEQUENCE { -- CHOICE use-of-HCS shall have the same value as the use-of-HCS -- in MeasurementControlSysInfo -- CHOICE cellSelectQualityMeasure represents PCCPCH-RSCP in TDD mode. use-of-HCS CHOICE { hcs-not-used SEQUENCE { -- CHOICE cellSelectQualityMeasure shall have the same value as the -- cellSelectQualityMeasure in MeasurementControlSysInfo cellSelectQualityMeasure CHOICE { cpich-RSCP SEQUENCE { intraFreqMeasurementSysInfo IntraFreqMeasurementSysInfo-RSCP-LCR-r4 OPTIONAL, interFreqMeasurementSysInfo InterFreqMeasurementSysInfo-RSCP-LCR-r4 OPTIONAL }, cpich-Ec-N0 SEQUENCE { intraFreqMeasurementSysInfo IntraFreqMeasurementSysInfo-ECN0-LCR-r4 OPTIONAL, interFreqMeasurementSysInfo InterFreqMeasurementSysInfo-ECN0-LCR-r4 OPTIONAL } } }, hcs-used SEQUENCE { -- CHOICE cellSelectQualityMeasure shall have the same value as the -- cellSelectQualityMeasure in MeasurementControlSysInfo cellSelectQualityMeasure CHOICE { cpich-RSCP SEQUENCE { intraFreqMeasurementSysInfo IntraFreqMeasurementSysInfo-HCS-RSCP-LCR-r4 OPTIONAL, interFreqMeasurementSysInfo InterFreqMeasurementSysInfo-HCS-RSCP-LCR-r4 OPTIONAL }, cpich-Ec-N0 SEQUENCE { intraFreqMeasurementSysInfo IntraFreqMeasurementSysInfo-HCS-ECN0-LCR-r4 OPTIONAL, interFreqMeasurementSysInfo InterFreqMeasurementSysInfo-HCS-ECN0-LCR-r4 OPTIONAL } } } } } MeasurementIdentity ::= INTEGER (1..16) MeasurementQuantityGSM ::= ENUMERATED { gsm-CarrierRSSI, dummy } MeasurementReportingMode ::= SEQUENCE { measurementReportTransferMode TransferMode, periodicalOrEventTrigger PeriodicalOrEventTrigger } MeasurementType ::= CHOICE { intraFrequencyMeasurement IntraFrequencyMeasurement, interFrequencyMeasurement InterFrequencyMeasurement, interRATMeasurement InterRATMeasurement, ue-positioning-Measurement UE-Positioning-Measurement, trafficVolumeMeasurement TrafficVolumeMeasurement, qualityMeasurement QualityMeasurement, ue-InternalMeasurement UE-InternalMeasurement } MeasurementType-r4 ::= CHOICE { intraFrequencyMeasurement IntraFrequencyMeasurement-r4, interFrequencyMeasurement InterFrequencyMeasurement-r4, interRATMeasurement InterRATMeasurement-r4, up-Measurement UE-Positioning-Measurement-r4, trafficVolumeMeasurement TrafficVolumeMeasurement, qualityMeasurement QualityMeasurement, ue-InternalMeasurement UE-InternalMeasurement-r4 } MeasurementType-r6 ::= CHOICE { intraFrequencyMeasurement IntraFrequencyMeasurement-r6, interFrequencyMeasurement InterFrequencyMeasurement-r6, interRATMeasurement InterRATMeasurement-r6, up-Measurement UE-Positioning-Measurement-r4, trafficVolumeMeasurement TrafficVolumeMeasurement, qualityMeasurement QualityMeasurement, ue-InternalMeasurement UE-InternalMeasurement-r4 } MeasurementValidity ::= SEQUENCE { ue-State ENUMERATED { cell-DCH, all-But-Cell-DCH, all-States } } MonitoredCellRACH-List ::= SEQUENCE (SIZE (1..8)) OF MonitoredCellRACH-Result MonitoredCellRACH-Result ::= SEQUENCE { sfn-SFN-ObsTimeDifference SFN-SFN-ObsTimeDifference OPTIONAL, modeSpecificInfo CHOICE { fdd SEQUENCE { primaryCPICH-Info PrimaryCPICH-Info, measurementQuantity CHOICE { cpich-Ec-N0 CPICH-Ec-N0, cpich-RSCP CPICH-RSCP, pathloss Pathloss, spare NULL } OPTIONAL }, tdd SEQUENCE { cellParametersID CellParametersID, primaryCCPCH-RSCP PrimaryCCPCH-RSCP } } } MultipathIndicator ::= ENUMERATED { nm, low, medium, high } N-CR-T-CRMaxHyst ::= SEQUENCE { n-CR INTEGER (1..16) DEFAULT 8, t-CRMaxHyst T-CRMaxHyst } NavigationModelSatInfo ::= SEQUENCE { satID SatID, satelliteStatus SatelliteStatus, ephemerisParameter EphemerisParameter OPTIONAL } NavigationModelSatInfoList ::= SEQUENCE (SIZE (1..maxSat)) OF NavigationModelSatInfo EphemerisParameter ::= SEQUENCE { codeOnL2 BIT STRING (SIZE (2)), uraIndex BIT STRING (SIZE (4)), satHealth BIT STRING (SIZE (6)), iodc BIT STRING (SIZE (10)), l2Pflag BIT STRING (SIZE (1)), sf1Revd SubFrame1Reserved, t-GD BIT STRING (SIZE (8)), t-oc BIT STRING (SIZE (16)), af2 BIT STRING (SIZE (8)), af1 BIT STRING (SIZE (16)), af0 BIT STRING (SIZE (22)), c-rs BIT STRING (SIZE (16)), delta-n BIT STRING (SIZE (16)), m0 BIT STRING (SIZE (32)), c-uc BIT STRING (SIZE (16)), e BIT STRING (SIZE (32)), c-us BIT STRING (SIZE (16)), a-Sqrt BIT STRING (SIZE (32)), t-oe BIT STRING (SIZE (16)), fitInterval BIT STRING (SIZE (1)), aodo BIT STRING (SIZE (5)), c-ic BIT STRING (SIZE (16)), omega0 BIT STRING (SIZE (32)), c-is BIT STRING (SIZE (16)), i0 BIT STRING (SIZE (32)), c-rc BIT STRING (SIZE (16)), omega BIT STRING (SIZE (32)), omegaDot BIT STRING (SIZE (24)), iDot BIT STRING (SIZE (14)) } NC-Mode ::= BIT STRING (SIZE (3)) Neighbour ::= SEQUENCE { modeSpecificInfo CHOICE { fdd SEQUENCE { neighbourIdentity PrimaryCPICH-Info OPTIONAL, uE-RX-TX-TimeDifferenceType2Info UE-RX-TX-TimeDifferenceType2Info OPTIONAL }, tdd SEQUENCE { neighbourAndChannelIdentity CellAndChannelIdentity OPTIONAL } }, neighbourQuality NeighbourQuality, sfn-SFN-ObsTimeDifference2 SFN-SFN-ObsTimeDifference2} Neighbour-v390ext ::= SEQUENCE { modeSpecificInfo CHOICE { fdd SEQUENCE { frequencyInfo FrequencyInfo }, tdd NULL } } NeighbourList ::= SEQUENCE (SIZE (1..maxCellMeas)) OF Neighbour -- The order of the cells in IE NeighbourList-v390ext shall be the -- same as the order in IE NeighbourList NeighbourList-v390ext ::= SEQUENCE (SIZE (1..maxCellMeas)) OF Neighbour-v390ext NeighbourQuality ::= SEQUENCE { ue-Positioning-OTDOA-Quality UE-Positioning-OTDOA-Quality } NewInterFreqCell ::= SEQUENCE { interFreqCellID InterFreqCellID OPTIONAL, frequencyInfo FrequencyInfo OPTIONAL, cellInfo CellInfo } NewInterFreqCell-r4 ::= SEQUENCE { interFreqCellID InterFreqCellID OPTIONAL, frequencyInfo FrequencyInfo OPTIONAL, cellInfo CellInfo-r4 } NewInterFreqCellList ::= SEQUENCE (SIZE (1..maxCellMeas)) OF NewInterFreqCell NewInterFreqCellList-r4 ::= SEQUENCE (SIZE (1..maxCellMeas)) OF NewInterFreqCell-r4 NewInterFreqCellSI-RSCP ::= SEQUENCE { interFreqCellID InterFreqCellID OPTIONAL, frequencyInfo FrequencyInfo OPTIONAL, cellInfo CellInfoSI-RSCP } NewInterFreqCellSI-ECN0 ::= SEQUENCE { interFreqCellID InterFreqCellID OPTIONAL, frequencyInfo FrequencyInfo OPTIONAL, cellInfo CellInfoSI-ECN0 } NewInterFreqCellSI-HCS-RSCP ::= SEQUENCE { interFreqCellID InterFreqCellID OPTIONAL, frequencyInfo FrequencyInfo OPTIONAL, cellInfo CellInfoSI-HCS-RSCP } NewInterFreqCellSI-HCS-ECN0 ::= SEQUENCE { interFreqCellID InterFreqCellID OPTIONAL, frequencyInfo FrequencyInfo OPTIONAL, cellInfo CellInfoSI-HCS-ECN0 } NewInterFreqCellSI-RSCP-LCR-r4 ::= SEQUENCE { interFreqCellID InterFreqCellID OPTIONAL, frequencyInfo FrequencyInfo OPTIONAL, cellInfo CellInfoSI-RSCP-LCR-r4 } NewInterFreqCellSI-ECN0-LCR-r4 ::= SEQUENCE { interFreqCellID InterFreqCellID OPTIONAL, frequencyInfo FrequencyInfo OPTIONAL, cellInfo CellInfoSI-ECN0-LCR-r4 } NewInterFreqCellSI-HCS-RSCP-LCR-r4 ::= SEQUENCE { interFreqCellID InterFreqCellID OPTIONAL, frequencyInfo FrequencyInfo OPTIONAL, cellInfo CellInfoSI-HCS-RSCP-LCR-r4 } NewInterFreqCellSI-HCS-ECN0-LCR-r4 ::= SEQUENCE { interFreqCellID InterFreqCellID OPTIONAL, frequencyInfo FrequencyInfo OPTIONAL, cellInfo CellInfoSI-HCS-ECN0-LCR-r4 } NewInterFreqCellSI-List-ECN0 ::= SEQUENCE (SIZE (1..maxCellMeas)) OF NewInterFreqCellSI-ECN0 NewInterFreqCellSI-List-HCS-RSCP ::= SEQUENCE (SIZE (1..maxCellMeas)) OF NewInterFreqCellSI-HCS-RSCP NewInterFreqCellSI-List-HCS-ECN0 ::= SEQUENCE (SIZE (1..maxCellMeas)) OF NewInterFreqCellSI-HCS-ECN0 NewInterFreqCellSI-List-RSCP ::= SEQUENCE (SIZE (1..maxCellMeas)) OF NewInterFreqCellSI-RSCP NewInterFreqCellSI-List-ECN0-LCR-r4 ::= SEQUENCE (SIZE (1..maxCellMeas)) OF NewInterFreqCellSI-ECN0-LCR-r4 NewInterFreqCellSI-List-HCS-RSCP-LCR-r4 ::= SEQUENCE (SIZE (1..maxCellMeas)) OF NewInterFreqCellSI-HCS-RSCP-LCR-r4 NewInterFreqCellSI-List-HCS-ECN0-LCR-r4 ::= SEQUENCE (SIZE (1..maxCellMeas)) OF NewInterFreqCellSI-HCS-ECN0-LCR-r4 NewInterFreqCellSI-List-RSCP-LCR-r4 ::= SEQUENCE (SIZE (1..maxCellMeas)) OF NewInterFreqCellSI-RSCP-LCR-r4 NewInterRATCell ::= SEQUENCE { interRATCellID InterRATCellID OPTIONAL, technologySpecificInfo CHOICE { gsm SEQUENCE { cellSelectionReselectionInfo CellSelectReselectInfoSIB-11-12 OPTIONAL, interRATCellIndividualOffset InterRATCellIndividualOffset, bsic BSIC, frequency-band Frequency-Band, bcch-ARFCN BCCH-ARFCN, -- dummy is not used in this version of the specification, it should -- not be sent and if received it should be ignored. dummy NULL OPTIONAL }, is-2000 SEQUENCE { is-2000SpecificMeasInfo IS-2000SpecificMeasInfo }, -- ASN.1 inconsistency: NewInterRATCellList should be optional within -- InterRATCellInfoList. The UE shall consider IE NewInterRATCell with -- technologySpecificInfo set to "absent" as valid and handle the -- message as if the IE NewInterRATCell was absent absent NULL, spare1 NULL } } NewInterRATCell-B ::= SEQUENCE { interRATCellID InterRATCellID OPTIONAL, technologySpecificInfo CHOICE { gsm SEQUENCE { cellSelectionReselectionInfo CellSelectReselectInfoSIB-11-12 OPTIONAL, interRATCellIndividualOffset InterRATCellIndividualOffset, bsic BSIC, frequency-band Frequency-Band, bcch-ARFCN BCCH-ARFCN, -- dummy is not used in this version of the specification, it should -- not be sent and if received it should be ignored. dummy NULL OPTIONAL }, is-2000 SEQUENCE { is-2000SpecificMeasInfo IS-2000SpecificMeasInfo }, -- ASN.1 inconsistency: NewInterRATCellList-B should be optional within -- InterRATCellInfoList-B. The UE shall consider IE NewInterRATCell-B with -- technologySpecificInfo set to "absent" as valid and handle the -- message as if the IE NewInterRATCell-B was absent absent NULL, spare1 NULL } } NewInterRATCellList ::= SEQUENCE (SIZE (1..maxCellMeas)) OF NewInterRATCell NewInterRATCellList-B ::= SEQUENCE (SIZE (1..maxCellMeas)) OF NewInterRATCell-B NewIntraFreqCell ::= SEQUENCE { intraFreqCellID IntraFreqCellID OPTIONAL, cellInfo CellInfo } NewIntraFreqCell-r4 ::= SEQUENCE { intraFreqCellID IntraFreqCellID OPTIONAL, cellInfo CellInfo-r4 } NewIntraFreqCellList ::= SEQUENCE (SIZE (1..maxCellMeas)) OF NewIntraFreqCell NewIntraFreqCellList-r4 ::= SEQUENCE (SIZE (1..maxCellMeas)) OF NewIntraFreqCell-r4 NewIntraFreqCellSI-RSCP ::= SEQUENCE { intraFreqCellID IntraFreqCellID OPTIONAL, cellInfo CellInfoSI-RSCP } NewIntraFreqCellSI-ECN0 ::= SEQUENCE { intraFreqCellID IntraFreqCellID OPTIONAL, cellInfo CellInfoSI-ECN0 } NewIntraFreqCellSI-HCS-RSCP ::= SEQUENCE { intraFreqCellID IntraFreqCellID OPTIONAL, cellInfo CellInfoSI-HCS-RSCP } NewIntraFreqCellSI-HCS-ECN0 ::= SEQUENCE { intraFreqCellID IntraFreqCellID OPTIONAL, cellInfo CellInfoSI-HCS-ECN0 } NewIntraFreqCellSI-RSCP-LCR-r4 ::= SEQUENCE { intraFreqCellID IntraFreqCellID OPTIONAL, cellInfo CellInfoSI-RSCP-LCR-r4 } NewIntraFreqCellSI-ECN0-LCR-r4 ::= SEQUENCE { intraFreqCellID IntraFreqCellID OPTIONAL, cellInfo CellInfoSI-ECN0-LCR-r4 } NewIntraFreqCellSI-HCS-RSCP-LCR-r4 ::= SEQUENCE { intraFreqCellID IntraFreqCellID OPTIONAL, cellInfo CellInfoSI-HCS-RSCP-LCR-r4 } NewIntraFreqCellSI-HCS-ECN0-LCR-r4 ::= SEQUENCE { intraFreqCellID IntraFreqCellID OPTIONAL, cellInfo CellInfoSI-HCS-ECN0-LCR-r4 } NewIntraFreqCellSI-List-RSCP ::= SEQUENCE (SIZE (1..maxCellMeas)) OF NewIntraFreqCellSI-RSCP NewIntraFreqCellSI-List-ECN0 ::= SEQUENCE (SIZE (1..maxCellMeas)) OF NewIntraFreqCellSI-ECN0 NewIntraFreqCellSI-List-HCS-RSCP ::= SEQUENCE (SIZE (1..maxCellMeas)) OF NewIntraFreqCellSI-HCS-RSCP NewIntraFreqCellSI-List-HCS-ECN0 ::= SEQUENCE (SIZE (1..maxCellMeas)) OF NewIntraFreqCellSI-HCS-ECN0 NewIntraFreqCellSI-List-RSCP-LCR-r4 ::= SEQUENCE (SIZE (1..maxCellMeas)) OF NewIntraFreqCellSI-RSCP-LCR-r4 NewIntraFreqCellSI-List-ECN0-LCR-r4 ::= SEQUENCE (SIZE (1..maxCellMeas)) OF NewIntraFreqCellSI-ECN0-LCR-r4 NewIntraFreqCellSI-List-HCS-RSCP-LCR-r4 ::= SEQUENCE (SIZE (1..maxCellMeas)) OF NewIntraFreqCellSI-HCS-RSCP-LCR-r4 NewIntraFreqCellSI-List-HCS-ECN0-LCR-r4 ::= SEQUENCE (SIZE (1..maxCellMeas)) OF NewIntraFreqCellSI-HCS-ECN0-LCR-r4 -- IE "nonUsedFreqThreshold" is not needed in case of event 2a -- In case of event 2a UTRAN should include value 0 within IE "nonUsedFreqThreshold" -- In case of event 2a, the UE shall be ignore IE "nonUsedFreqThreshold" -- In later versions of the message including this IE, a special version of -- IE "NonUsedFreqParameterList" may be defined for event 2a, namely a -- version not including IE "nonUsedFreqThreshold" NonUsedFreqParameter ::= SEQUENCE { nonUsedFreqThreshold Threshold, nonUsedFreqW W } NonUsedFreqParameter-r6 ::= SEQUENCE { nonUsedFreqThreshold Threshold-r6, nonUsedFreqW W } NonUsedFreqParameterList ::= SEQUENCE (SIZE (1..maxFreq)) OF NonUsedFreqParameter NonUsedFreqParameterList-r6 ::= SEQUENCE (SIZE (1..maxFreq)) OF NonUsedFreqParameter-r6 NonUsedFreqWList-r6 ::= SEQUENCE (SIZE (1..maxFreq)) OF W ObservedTimeDifferenceToGSM ::= INTEGER (0..4095) OTDOA-SearchWindowSize ::= ENUMERATED { c20, c40, c80, c160, c320, c640, c1280, moreThan1280 } -- SPARE: Pathloss, Max = 158 -- Values above Max are spare Pathloss ::= INTEGER (46..173) PenaltyTime-RSCP ::= CHOICE { notUsed NULL, pt10 TemporaryOffset1, pt20 TemporaryOffset1, pt30 TemporaryOffset1, pt40 TemporaryOffset1, pt50 TemporaryOffset1, pt60 TemporaryOffset1 } PenaltyTime-ECN0 ::= CHOICE { notUsed NULL, pt10 TemporaryOffsetList, pt20 TemporaryOffsetList, pt30 TemporaryOffsetList, pt40 TemporaryOffsetList, pt50 TemporaryOffsetList, pt60 TemporaryOffsetList } PendingTimeAfterTrigger ::= ENUMERATED { ptat0-25, ptat0-5, ptat1, ptat2, ptat4, ptat8, ptat16 } PeriodicalOrEventTrigger ::= ENUMERATED { periodical, eventTrigger } PeriodicalReportingCriteria ::= SEQUENCE { reportingAmount ReportingAmount DEFAULT ra-Infinity, reportingInterval ReportingIntervalLong } PeriodicalWithReportingCellStatus ::= SEQUENCE { periodicalReportingCriteria PeriodicalReportingCriteria, reportingCellStatus ReportingCellStatus OPTIONAL } PLMNIdentitiesOfNeighbourCells ::= SEQUENCE { plmnsOfIntraFreqCellsList PLMNsOfIntraFreqCellsList OPTIONAL, plmnsOfInterFreqCellsList PLMNsOfInterFreqCellsList OPTIONAL, plmnsOfInterRATCellsList PLMNsOfInterRATCellsList OPTIONAL } PLMNsOfInterFreqCellsList ::= SEQUENCE (SIZE (1..maxCellMeas)) OF SEQUENCE { plmn-Identity PLMN-Identity OPTIONAL } PLMNsOfIntraFreqCellsList ::= SEQUENCE (SIZE (1..maxCellMeas)) OF SEQUENCE { plmn-Identity PLMN-Identity OPTIONAL } PLMNsOfInterRATCellsList ::= SEQUENCE (SIZE (1..maxCellMeas)) OF SEQUENCE { plmn-Identity PLMN-Identity OPTIONAL } PositionEstimate ::= CHOICE { ellipsoidPoint EllipsoidPoint, ellipsoidPointUncertCircle EllipsoidPointUncertCircle, ellipsoidPointUncertEllipse EllipsoidPointUncertEllipse, ellipsoidPointAltitude EllipsoidPointAltitude, ellipsoidPointAltitudeEllipse EllipsoidPointAltitudeEllipsoide } PositioningMethod ::= ENUMERATED { otdoa, gps, otdoaOrGPS, cellID } -- Actual value PRC = IE value * 0.32 PRC ::= INTEGER (-2047..2047) -- SPARE: PrimaryCCPCH-RSCP, Max = 91 -- Values above Max are spare PrimaryCCPCH-RSCP ::= INTEGER (0..127) Q-HCS ::= INTEGER (0..99) Q-OffsetS-N ::= INTEGER (-50..50) Q-QualMin ::= INTEGER (-24..0) -- Actual value Q-RxlevMin = (IE value * 2) + 1 Q-RxlevMin ::= INTEGER (-58..-13) QualityEventResults ::= SEQUENCE (SIZE (1..maxTrCH)) OF TransportChannelIdentity QualityMeasuredResults ::= SEQUENCE { blerMeasurementResultsList BLER-MeasurementResultsList OPTIONAL, modeSpecificInfo CHOICE { fdd NULL, tdd SEQUENCE { sir-MeasurementResults SIR-MeasurementList OPTIONAL } } } QualityMeasurement ::= SEQUENCE { qualityReportingQuantity QualityReportingQuantity OPTIONAL, reportCriteria QualityReportCriteria } QualityReportCriteria ::= CHOICE { qualityReportingCriteria QualityReportingCriteria, periodicalReportingCriteria PeriodicalReportingCriteria, noReporting NULL } QualityReportingCriteria ::= SEQUENCE (SIZE (1..maxTrCH)) OF QualityReportingCriteriaSingle QualityReportingCriteriaSingle ::= SEQUENCE { transportChannelIdentity TransportChannelIdentity, totalCRC INTEGER (1..512), badCRC INTEGER (1..512), pendingAfterTrigger INTEGER (1..512) } QualityReportingQuantity ::= SEQUENCE { dl-TransChBLER BOOLEAN, bler-dl-TransChIdList BLER-TransChIdList OPTIONAL, modeSpecificInfo CHOICE { fdd NULL, tdd SEQUENCE { sir-TFCS-List SIR-TFCS-List OPTIONAL } } } RAT-Type ::= ENUMERATED { gsm, is2000 } ReferenceCellPosition ::= CHOICE { ellipsoidPoint EllipsoidPoint, ellipsoidPointWithAltitude EllipsoidPointAltitude } -- ReferenceLocation, as defined in 23.032 ReferenceLocation ::= SEQUENCE { ellipsoidPointAltitudeEllipsoide EllipsoidPointAltitudeEllipsoide } ReferenceTimeDifferenceToCell ::= CHOICE { -- Actual value accuracy40 = IE value * 40 accuracy40 INTEGER (0..960), -- Actual value accuracy256 = IE value * 256 accuracy256 INTEGER (0..150), -- Actual value accuracy2560 = IE value * 2560 accuracy2560 INTEGER (0..15) } RemovedInterFreqCellList ::= CHOICE { removeAllInterFreqCells NULL, removeSomeInterFreqCells SEQUENCE (SIZE (1..maxCellMeas)) OF InterFreqCellID, removeNoInterFreqCells NULL } RemovedInterRATCellList ::= CHOICE { removeAllInterRATCells NULL, removeSomeInterRATCells SEQUENCE (SIZE (1..maxCellMeas)) OF InterRATCellID, removeNoInterRATCells NULL } RemovedIntraFreqCellList ::= CHOICE { removeAllIntraFreqCells NULL, removeSomeIntraFreqCells SEQUENCE (SIZE (1..maxCellMeas)) OF IntraFreqCellID, removeNoIntraFreqCells NULL } ReplacementActivationThreshold ::= ENUMERATED { notApplicable, t1, t2, t3, t4, t5, t6, t7 } ReportDeactivationThreshold ::= ENUMERATED { notApplicable, t1, t2, t3, t4, t5, t6, t7 } ReportingAmount ::= ENUMERATED { ra1, ra2, ra4, ra8, ra16, ra32, ra64, ra-Infinity } ReportingCellStatus ::= CHOICE{ withinActiveSet MaxNumberOfReportingCellsType1, withinMonitoredSetUsedFreq MaxNumberOfReportingCellsType1, withinActiveAndOrMonitoredUsedFreq MaxNumberOfReportingCellsType1, withinDetectedSetUsedFreq MaxNumberOfReportingCellsType1, withinMonitoredAndOrDetectedUsedFreq MaxNumberOfReportingCellsType1, allActiveplusMonitoredSet MaxNumberOfReportingCellsType3, allActivePlusDetectedSet MaxNumberOfReportingCellsType3, allActivePlusMonitoredAndOrDetectedSet MaxNumberOfReportingCellsType3, withinVirtualActSet MaxNumberOfReportingCellsType1, withinMonitoredSetNonUsedFreq MaxNumberOfReportingCellsType1, withinMonitoredAndOrVirtualActiveSetNonUsedFreq MaxNumberOfReportingCellsType1, allVirtualActSetplusMonitoredSetNonUsedFreq MaxNumberOfReportingCellsType3, withinActSetOrVirtualActSet-InterRATcells MaxNumberOfReportingCellsType2, withinActSetAndOrMonitoredUsedFreqOrVirtualActSetAndOrMonitoredNonUsedFreq MaxNumberOfReportingCellsType2 } ReportingCellStatusOpt ::= SEQUENCE { reportingCellStatus ReportingCellStatus OPTIONAL } ReportingInfoForCellDCH ::= SEQUENCE { intraFreqReportingQuantity IntraFreqReportingQuantity, measurementReportingMode MeasurementReportingMode, reportCriteria CellDCH-ReportCriteria } ReportingInfoForCellDCH-LCR-r4 ::= SEQUENCE { intraFreqReportingQuantity IntraFreqReportingQuantity, measurementReportingMode MeasurementReportingMode, reportCriteria CellDCH-ReportCriteria-LCR-r4 } ReportingInterval ::= ENUMERATED { noPeriodicalreporting, ri0-25, ri0-5, ri1, ri2, ri4, ri8, ri16 } ReportingIntervalLong ::= ENUMERATED { ril0, ril0-25, ril0-5, ril1, ril2, ril3, ril4, ril6, ril8, ril12, ril16, ril20, ril24, ril28, ril32, ril64 } -- When the value 窶徨il0窶 is used, the UE behaviour is not -- defined. -- Actual value ReportingRange = IE value * 0.5 ReportingRange ::= INTEGER (0..29) RL-AdditionInfoList ::= SEQUENCE (SIZE (1..maxRL)) OF PrimaryCPICH-Info RL-InformationLists ::= SEQUENCE { rl-AdditionInfoList RL-AdditionInfoList OPTIONAL, rL-RemovalInformationList RL-RemovalInformationList OPTIONAL } RLC-BuffersPayload ::= ENUMERATED { pl0, pl4, pl8, pl16, pl32, pl64, pl128, pl256, pl512, pl1024, pl2k, pl4k, pl8k, pl16k, pl32k, pl64k, pl128k, pl256k, pl512k, pl1024k, spare12, spare11, spare10, spare9, spare8, spare7, spare6, spare5, spare4, spare3, spare2, spare1 } -- Actual value RRC = IE value * 0.032 RRC ::= INTEGER (-127..127) SatData ::= SEQUENCE{ satID SatID, iode IODE } SatDataList ::= SEQUENCE (SIZE (0..maxSat)) OF SatData SatelliteStatus ::= ENUMERATED { ns-NN-U, es-SN, es-NN-U, rev2, rev } -- Identifies the satellite and is equal to (SV ID No - 1) where SV ID No is defined in [12]. SatID ::= INTEGER (0..63) SFN-Offset-Validity ::= ENUMERATED { false } SFN-SFN-Drift ::= ENUMERATED { sfnsfndrift0, sfnsfndrift1, sfnsfndrift2, sfnsfndrift3, sfnsfndrift4, sfnsfndrift5, sfnsfndrift8, sfnsfndrift10, sfnsfndrift15, sfnsfndrift25, sfnsfndrift35, sfnsfndrift50, sfnsfndrift65, sfnsfndrift80, sfnsfndrift100, sfnsfndrift-1, sfnsfndrift-2, sfnsfndrift-3, sfnsfndrift-4, sfnsfndrift-5, sfnsfndrift-8, sfnsfndrift-10, sfnsfndrift-15, sfnsfndrift-25, sfnsfndrift-35, sfnsfndrift-50, sfnsfndrift-65, sfnsfndrift-80, sfnsfndrift-100} SFN-SFN-ObsTimeDifference ::= CHOICE { type1 SFN-SFN-ObsTimeDifference1, type2 SFN-SFN-ObsTimeDifference2 } -- SPARE: SFN-SFN-ObsTimeDifference1, Max = 9830399 -- For 1.28Mcps TDD, Max value of SFN-SFN-ObsTimeDifference1 is 3276799. -- Values above Max are spare SFN-SFN-ObsTimeDifference1 ::= INTEGER (0..16777215) -- SPARE: SFN-SFN-ObsTimeDifference2, Max = 40961 -- For 1.28Mcps TDD, Max value of SFN-SFN-ObsTimeDifference2 is 27649. -- Values above Max are spare SFN-SFN-ObsTimeDifference2 ::= INTEGER (0..65535) SFN-SFN-OTD-Type ::= ENUMERATED { noReport, type1, type2 } SFN-SFN-RelTimeDifference1 ::= SEQUENCE { sfn-Offset INTEGER (0 .. 4095), sfn-sfn-Reltimedifference INTEGER (0.. 38399) } SFN-TOW-Uncertainty ::= ENUMERATED { lessThan10, moreThan10 } SIR ::= INTEGER (0..63) SIR-MeasurementList ::= SEQUENCE (SIZE (1..maxCCTrCH)) OF SIR-MeasurementResults SIR-MeasurementResults ::= SEQUENCE { tfcs-ID TFCS-IdentityPlain, sir-TimeslotList SIR-TimeslotList } SIR-TFCS ::= TFCS-IdentityPlain SIR-TFCS-List ::= SEQUENCE (SIZE (1..maxCCTrCH)) OF SIR-TFCS SIR-TimeslotList ::= SEQUENCE (SIZE (1..maxTS)) OF SIR -- SubFrame1Reserved, reserved bits in subframe 1 of the GPS navigation message SubFrame1Reserved ::= SEQUENCE { reserved1 BIT STRING (SIZE (23)), reserved2 BIT STRING (SIZE (24)), reserved3 BIT STRING (SIZE (24)), reserved4 BIT STRING (SIZE (16)) } T-ADVinfo ::= SEQUENCE { t-ADV INTEGER(0..2047), sfn INTEGER(0..4095) } T-CRMax ::= CHOICE { notUsed NULL, t30 N-CR-T-CRMaxHyst, t60 N-CR-T-CRMaxHyst, t120 N-CR-T-CRMaxHyst, t180 N-CR-T-CRMaxHyst, t240 N-CR-T-CRMaxHyst } T-CRMaxHyst ::= ENUMERATED { notUsed, t10, t20, t30, t40, t50, t60, t70 } TemporaryOffset1 ::= ENUMERATED { to3, to6, to9, to12, to15, to18, to21, infinite } TemporaryOffset2 ::= ENUMERATED { to2, to3, to4, to6, to8, to10, to12, infinite } TemporaryOffsetList ::= SEQUENCE { temporaryOffset1 TemporaryOffset1, temporaryOffset2 TemporaryOffset2 } Threshold ::= INTEGER (-115..0) Threshold-r6 ::= INTEGER (-120..0) -- The order of the list corresponds to the order of frequency defined in Inter-FreqEventCriteria ThreholdNonUsedFrequency-deltaList ::= SEQUENCE (SIZE (1..maxFreq)) OF DeltaRSCPPerCell ThresholdPositionChange ::= ENUMERATED { pc10, pc20, pc30, pc40, pc50, pc100, pc200, pc300, pc500, pc1000, pc2000, pc5000, pc10000, pc20000, pc50000, pc100000 } ThresholdSFN-GPS-TOW ::= ENUMERATED { ms1, ms2, ms3, ms5, ms10, ms20, ms50, ms100 } ThresholdSFN-SFN-Change ::= ENUMERATED { c0-25, c0-5, c1, c2, c3, c4, c5, c10, c20, c50, c100, c200, c500, c1000, c2000, c5000 } ThresholdUsedFrequency ::= INTEGER (-115..165) ThresholdUsedFrequency-r6 ::= INTEGER (-120..165) -- Actual value TimeInterval = IE value * 20. TimeInterval ::= INTEGER (1..13) TimeslotInfo ::= SEQUENCE { timeslotNumber TimeslotNumber, burstType BurstType } TimeslotInfo-LCR-r4 ::= SEQUENCE { timeslotNumber TimeslotNumber-LCR-r4 } TimeslotInfoList ::= SEQUENCE (SIZE (1..maxTS)) OF TimeslotInfo TimeslotInfoList-LCR-r4 ::= SEQUENCE (SIZE (1..maxTS-LCR)) OF TimeslotInfo-LCR-r4 TimeslotInfoList-r4 ::= CHOICE { -- the choice for 7.68 Mcps TDD is the same as for 3.84 Mcps TDD -- tdd384 SEQUENCE (SIZE (1..maxTS)) OF TimeslotInfo, tdd128 SEQUENCE (SIZE (1..maxTS-LCR)) OF TimeslotInfo-LCR-r4 } -- SPARE: TimeslotISCP, Max = 91 -- Values above Max are spare TimeslotISCP ::= INTEGER (0..127) -- TimeslotISCP-List shall not include more than 6 elements in 1.28Mcps TDD mode. TimeslotISCP-List ::= SEQUENCE (SIZE (1..maxTS)) OF TimeslotISCP TimeslotListWithISCP ::= SEQUENCE (SIZE (1..maxTS)) OF TimeslotWithISCP TimeslotWithISCP ::= SEQUENCE { timeslot TimeslotNumber, timeslotISCP TimeslotISCP } TimeToTrigger ::= ENUMERATED { ttt0, ttt10, ttt20, ttt40, ttt60, ttt80, ttt100, ttt120, ttt160, ttt200, ttt240, tt320, ttt640, ttt1280, ttt2560, ttt5000 } TrafficVolumeEventParam ::= SEQUENCE { eventID TrafficVolumeEventType, reportingThreshold TrafficVolumeThreshold, timeToTrigger TimeToTrigger OPTIONAL, pendingTimeAfterTrigger PendingTimeAfterTrigger OPTIONAL, tx-InterruptionAfterTrigger TX-InterruptionAfterTrigger OPTIONAL } TrafficVolumeEventResults ::= SEQUENCE { ul-transportChannelCausingEvent UL-TrCH-Identity, trafficVolumeEventIdentity TrafficVolumeEventType } TrafficVolumeEventType ::= ENUMERATED { e4a, e4b } TrafficVolumeMeasQuantity ::= CHOICE { rlc-BufferPayload NULL, averageRLC-BufferPayload TimeInterval, varianceOfRLC-BufferPayload TimeInterval } TrafficVolumeMeasSysInfo ::= SEQUENCE { trafficVolumeMeasurementID MeasurementIdentity DEFAULT 4, trafficVolumeMeasurementObjectList TrafficVolumeMeasurementObjectList OPTIONAL, trafficVolumeMeasQuantity TrafficVolumeMeasQuantity OPTIONAL, trafficVolumeReportingQuantity TrafficVolumeReportingQuantity OPTIONAL, -- dummy is not used in this version of specification, it should -- not be sent and if received it should be ignored. dummy TrafficVolumeReportingCriteria OPTIONAL, measurementValidity MeasurementValidity OPTIONAL, measurementReportingMode MeasurementReportingMode, reportCriteriaSysInf TrafficVolumeReportCriteriaSysInfo } TrafficVolumeMeasuredResults ::= SEQUENCE { rb-Identity RB-Identity, rlc-BuffersPayload RLC-BuffersPayload OPTIONAL, averageRLC-BufferPayload AverageRLC-BufferPayload OPTIONAL, varianceOfRLC-BufferPayload VarianceOfRLC-BufferPayload OPTIONAL } TrafficVolumeMeasuredResultsList ::= SEQUENCE (SIZE (1..maxRB)) OF TrafficVolumeMeasuredResults TrafficVolumeMeasurement ::= SEQUENCE { trafficVolumeMeasurementObjectList TrafficVolumeMeasurementObjectList OPTIONAL, trafficVolumeMeasQuantity TrafficVolumeMeasQuantity OPTIONAL, trafficVolumeReportingQuantity TrafficVolumeReportingQuantity OPTIONAL, measurementValidity MeasurementValidity OPTIONAL, reportCriteria TrafficVolumeReportCriteria } TrafficVolumeMeasurementObjectList ::= SEQUENCE (SIZE (1..maxTrCH)) OF UL-TrCH-Identity TrafficVolumeReportCriteria ::= CHOICE { trafficVolumeReportingCriteria TrafficVolumeReportingCriteria, periodicalReportingCriteria PeriodicalReportingCriteria, noReporting NULL } TrafficVolumeReportCriteriaSysInfo ::= CHOICE { trafficVolumeReportingCriteria TrafficVolumeReportingCriteria, periodicalReportingCriteria PeriodicalReportingCriteria } TrafficVolumeReportingCriteria ::= SEQUENCE { -- NOTE: transChCriteriaList should be mandatory in later versions of this message transChCriteriaList TransChCriteriaList OPTIONAL } TrafficVolumeReportingQuantity ::= SEQUENCE { rlc-RB-BufferPayload BOOLEAN, rlc-RB-BufferPayloadAverage BOOLEAN, rlc-RB-BufferPayloadVariance BOOLEAN } TrafficVolumeThreshold ::= ENUMERATED { th8, th16, th32, th64, th128, th256, th512, th1024, th2k, th3k, th4k, th6k, th8k, th12k, th16k, th24k, th32k, th48k, th64k, th96k, th128k, th192k, th256k, th384k, th512k, th768k } TransChCriteria ::= SEQUENCE { ul-transportChannelID UL-TrCH-Identity OPTIONAL, eventSpecificParameters SEQUENCE (SIZE (1..maxMeasParEvent)) OF TrafficVolumeEventParam OPTIONAL } TransChCriteriaList ::= SEQUENCE (SIZE (1..maxTrCH)) OF TransChCriteria TransferMode ::= ENUMERATED { acknowledgedModeRLC, unacknowledgedModeRLC } TransmittedPowerThreshold ::= INTEGER (-50..33) TriggeringCondition1 ::= ENUMERATED { activeSetCellsOnly, monitoredSetCellsOnly, activeSetAndMonitoredSetCells } TriggeringCondition2 ::= ENUMERATED { activeSetCellsOnly, monitoredSetCellsOnly, activeSetAndMonitoredSetCells, detectedSetCellsOnly, detectedSetAndMonitoredSetCells } TX-InterruptionAfterTrigger ::= ENUMERATED { txiat0-25, txiat0-5, txiat1, txiat2, txiat4, txiat8, txiat16 } UDRE ::= ENUMERATED { lessThan1, between1-and-4, between4-and-8, over8 } UE-6AB-Event ::= SEQUENCE { timeToTrigger TimeToTrigger, transmittedPowerThreshold TransmittedPowerThreshold } UE-6FG-Event ::= SEQUENCE { timeToTrigger TimeToTrigger, -- in 1.28 Mcps TDD ue-RX-TX-TimeDifferenceThreshold corresponds to TADV Threshold ue-RX-TX-TimeDifferenceThreshold UE-RX-TX-TimeDifferenceThreshold } -- dummy and dummy2 are not used in this version of the specification, they should -- not be sent and if received the UE behaviour is not specified. UE-AutonomousUpdateMode ::= CHOICE { dummy NULL, onWithNoReporting NULL, dummy2 RL-InformationLists } UE-InternalEventParam ::= CHOICE { event6a UE-6AB-Event, event6b UE-6AB-Event, event6c TimeToTrigger, event6d TimeToTrigger, event6e TimeToTrigger, event6f UE-6FG-Event, event6g UE-6FG-Event } UE-InternalEventParamList ::= SEQUENCE (SIZE (1..maxMeasEvent)) OF UE-InternalEventParam UE-InternalEventResults ::= CHOICE { event6a NULL, event6b NULL, event6c NULL, event6d NULL, event6e NULL, event6f PrimaryCPICH-Info, event6g PrimaryCPICH-Info, spare NULL } UE-InternalMeasQuantity ::= SEQUENCE { measurementQuantity UE-MeasurementQuantity, filterCoefficient FilterCoefficient DEFAULT fc0 } UE-InternalMeasuredResults ::= SEQUENCE { modeSpecificInfo CHOICE { fdd SEQUENCE { ue-TransmittedPowerFDD UE-TransmittedPower OPTIONAL, ue-RX-TX-ReportEntryList UE-RX-TX-ReportEntryList OPTIONAL }, tdd SEQUENCE { ue-TransmittedPowerTDD-List UE-TransmittedPowerTDD-List OPTIONAL, appliedTA UL-TimingAdvance OPTIONAL } } } UE-InternalMeasuredResults-r7 ::= SEQUENCE { modeSpecificInfo CHOICE { fdd SEQUENCE { ue-TransmittedPowerFDD UE-TransmittedPower OPTIONAL, ue-RX-TX-ReportEntryList UE-RX-TX-ReportEntryList OPTIONAL }, tdd SEQUENCE { ue-TransmittedPowerTDD-List UE-TransmittedPowerTDD-List OPTIONAL, appliedTA UL-TimingAdvance-VHCR OPTIONAL } } } UE-InternalMeasuredResults-LCR-r4 ::= SEQUENCE { ue-TransmittedPowerTDD-List UE-TransmittedPowerTDD-List OPTIONAL, t-ADVinfo T-ADVinfo OPTIONAL } UE-InternalMeasurement ::= SEQUENCE { ue-InternalMeasQuantity UE-InternalMeasQuantity OPTIONAL, ue-InternalReportingQuantity UE-InternalReportingQuantity OPTIONAL, reportCriteria UE-InternalReportCriteria } UE-InternalMeasurement-r4 ::= SEQUENCE { ue-InternalMeasQuantity UE-InternalMeasQuantity OPTIONAL, ue-InternalReportingQuantity UE-InternalReportingQuantity-r4 OPTIONAL, reportCriteria UE-InternalReportCriteria } UE-InternalMeasurementSysInfo ::= SEQUENCE { ue-InternalMeasurementID MeasurementIdentity DEFAULT 5, ue-InternalMeasQuantity UE-InternalMeasQuantity } UE-InternalReportCriteria ::= CHOICE { ue-InternalReportingCriteria UE-InternalReportingCriteria, periodicalReportingCriteria PeriodicalReportingCriteria, noReporting NULL } UE-InternalReportingCriteria ::= SEQUENCE { ue-InternalEventParamList UE-InternalEventParamList OPTIONAL } UE-InternalReportingQuantity ::= SEQUENCE { ue-TransmittedPower BOOLEAN, modeSpecificInfo CHOICE { fdd SEQUENCE { ue-RX-TX-TimeDifference BOOLEAN }, tdd SEQUENCE { appliedTA BOOLEAN } } } UE-InternalReportingQuantity-r4 ::= SEQUENCE { ue-TransmittedPower BOOLEAN, modeSpecificInfo CHOICE { fdd SEQUENCE { ue-RX-TX-TimeDifference BOOLEAN }, tdd SEQUENCE { tddOption CHOICE { -- appliedTA applies to both 3.84 Mcps TDD and to 7.68 Mcps TDD. -- Therefore, no additional choice of TDD mode is necessary tdd384 SEQUENCE { appliedTA BOOLEAN }, tdd128 SEQUENCE { t-ADVinfo BOOLEAN } } } } } -- TABULAR: UE-MeasurementQuantity, for 3.84 Mcps TDD only the first two values -- ue-TransmittedPower and utra-Carrier-RSSI are used. -- For 1.28 Mcps TDD ue-RX-TX-TimeDifference corresponds to T-ADV in the tabular UE-MeasurementQuantity ::= ENUMERATED { ue-TransmittedPower, utra-Carrier-RSSI, ue-RX-TX-TimeDifference } UE-RX-TX-ReportEntry ::= SEQUENCE { primaryCPICH-Info PrimaryCPICH-Info, ue-RX-TX-TimeDifferenceType1 UE-RX-TX-TimeDifferenceType1 } UE-RX-TX-ReportEntryList ::= SEQUENCE (SIZE (1..maxRL)) OF UE-RX-TX-ReportEntry -- SPARE: UE-RX-TX-TimeDifferenceType1, Max = 1280 -- Values above Max are spare UE-RX-TX-TimeDifferenceType1 ::= INTEGER (768..1791) UE-RX-TX-TimeDifferenceType2 ::= INTEGER (0..8191) UE-RX-TX-TimeDifferenceType2Info ::= SEQUENCE { ue-RX-TX-TimeDifferenceType2 UE-RX-TX-TimeDifferenceType2, neighbourQuality NeighbourQuality } -- In 1.28 Mcps TDD, actual value for -- T-ADV Threshold = (UE-RX-TX-TimeDifferenceThreshold - 768) * 0.125 UE-RX-TX-TimeDifferenceThreshold ::= INTEGER (768..1280) UE-TransmittedPower ::= INTEGER (0..104) UE-TransmittedPowerTDD-List ::= SEQUENCE (SIZE (1..maxTS)) OF UE-TransmittedPower UL-TrCH-Identity ::= CHOICE{ dch TransportChannelIdentity, -- Note: the reference to CPCH in the element name below is incorrect. The name is not changed -- to keep it aligned with R99. rachorcpch NULL, usch TransportChannelIdentity } UE-Positioning-Accuracy ::= BIT STRING (SIZE (7)) UE-Positioning-CipherParameters ::= SEQUENCE { cipheringKeyFlag BIT STRING (SIZE (1)), cipheringSerialNumber INTEGER (0..65535) } UE-Positioning-Error ::= SEQUENCE { errorReason UE-Positioning-ErrorCause, ue-positioning-GPS-additionalAssistanceDataRequest UE-Positioning-GPS-AdditionalAssistanceDataRequest OPTIONAL } UE-Positioning-ErrorCause ::= ENUMERATED { notEnoughOTDOA-Cells, notEnoughGPS-Satellites, assistanceDataMissing, notAccomplishedGPS-TimingOfCellFrames, undefinedError, requestDeniedByUser, notProcessedAndTimeout, referenceCellNotServingCell } UE-Positioning-EventParam ::= SEQUENCE { reportingAmount ReportingAmount, reportFirstFix BOOLEAN, measurementInterval UE-Positioning-MeasurementInterval, eventSpecificInfo UE-Positioning-EventSpecificInfo } UE-Positioning-EventParamList ::= SEQUENCE (SIZE (1..maxMeasEvent)) OF UE-Positioning-EventParam UE-Positioning-EventSpecificInfo ::= CHOICE { e7a ThresholdPositionChange, e7b ThresholdSFN-SFN-Change, e7c ThresholdSFN-GPS-TOW } UE-Positioning-GPS-AcquisitionAssistance ::= SEQUENCE { gps-ReferenceTime INTEGER (0..604799999), utran-GPSReferenceTime UTRAN-GPSReferenceTime OPTIONAL, satelliteInformationList AcquisitionSatInfoList } UE-Positioning-GPS-AdditionalAssistanceDataRequest ::= SEQUENCE { almanacRequest BOOLEAN, utcModelRequest BOOLEAN, ionosphericModelRequest BOOLEAN, navigationModelRequest BOOLEAN, dgpsCorrectionsRequest BOOLEAN, referenceLocationRequest BOOLEAN, referenceTimeRequest BOOLEAN, aquisitionAssistanceRequest BOOLEAN, realTimeIntegrityRequest BOOLEAN, navModelAddDataRequest UE-Positioning-GPS-NavModelAddDataReq OPTIONAL } UE-Positioning-GPS-Almanac ::= SEQUENCE { wn-a BIT STRING (SIZE (8)), almanacSatInfoList AlmanacSatInfoList, sv-GlobalHealth BIT STRING (SIZE (364)) OPTIONAL } UE-Positioning-GPS-AssistanceData ::= SEQUENCE { ue-positioning-GPS-ReferenceTime UE-Positioning-GPS-ReferenceTime OPTIONAL, ue-positioning-GPS-ReferenceLocation ReferenceLocation OPTIONAL, ue-positioning-GPS-DGPS-Corrections UE-Positioning-GPS-DGPS-Corrections OPTIONAL, ue-positioning-GPS-NavigationModel UE-Positioning-GPS-NavigationModel OPTIONAL, ue-positioning-GPS-IonosphericModel UE-Positioning-GPS-IonosphericModel OPTIONAL, ue-positioning-GPS-UTC-Model UE-Positioning-GPS-UTC-Model OPTIONAL, ue-positioning-GPS-Almanac UE-Positioning-GPS-Almanac OPTIONAL, ue-positioning-GPS-AcquisitionAssistance UE-Positioning-GPS-AcquisitionAssistance OPTIONAL, ue-positioning-GPS-Real-timeIntegrity BadSatList OPTIONAL, -- dummy is not used in this version of the specification, it should -- not be sent and if received it should be ignored. dummy UE-Positioning-GPS-ReferenceCellInfo OPTIONAL } UE-Positioning-GPS-DGPS-Corrections ::= SEQUENCE { gps-TOW INTEGER (0..604799), statusHealth DiffCorrectionStatus, dgps-CorrectionSatInfoList DGPS-CorrectionSatInfoList } UE-Positioning-GPS-IonosphericModel ::= SEQUENCE { alfa0 BIT STRING (SIZE (8)), alfa1 BIT STRING (SIZE (8)), alfa2 BIT STRING (SIZE (8)), alfa3 BIT STRING (SIZE (8)), beta0 BIT STRING (SIZE (8)), beta1 BIT STRING (SIZE (8)), beta2 BIT STRING (SIZE (8)), beta3 BIT STRING (SIZE (8)) } UE-Positioning-GPS-MeasurementResults ::= SEQUENCE { referenceTime CHOICE { utran-GPSReferenceTimeResult UTRAN-GPSReferenceTimeResult, gps-ReferenceTimeOnly INTEGER (0..604799999) }, gps-MeasurementParamList GPS-MeasurementParamList } UE-Positioning-GPS-NavigationModel ::= SEQUENCE { navigationModelSatInfoList NavigationModelSatInfoList } UE-Positioning-GPS-NavModelAddDataReq ::= SEQUENCE { gps-Week INTEGER (0..1023), -- SPARE: gps-Toe, Max = 167 -- Values above Max are spare gps-Toe INTEGER (0..255), -- SPARE: tToeLimit, Max = 10 -- Values above Max are spare tToeLimit INTEGER (0..15), satDataList SatDataList } UE-Positioning-GPS-ReferenceCellInfo ::= SEQUENCE{ modeSpecificInfo CHOICE { fdd SEQUENCE { referenceIdentity PrimaryCPICH-Info }, tdd SEQUENCE { referenceIdentity CellParametersID } } } UE-Positioning-GPS-ReferenceTime ::= SEQUENCE { gps-Week INTEGER (0..1023), gps-tow-1msec GPS-TOW-1msec, utran-GPSReferenceTime UTRAN-GPSReferenceTime OPTIONAL, sfn-tow-Uncertainty SFN-TOW-Uncertainty OPTIONAL, utran-GPS-DriftRate UTRAN-GPS-DriftRate OPTIONAL, gps-TOW-AssistList GPS-TOW-AssistList OPTIONAL } UE-Positioning-GPS-UTC-Model ::= SEQUENCE { a1 BIT STRING (SIZE (24)), a0 BIT STRING (SIZE (32)), t-ot BIT STRING (SIZE (8)), wn-t BIT STRING (SIZE (8)), delta-t-LS BIT STRING (SIZE (8)), wn-lsf BIT STRING (SIZE (8)), dn BIT STRING (SIZE (8)), delta-t-LSF BIT STRING (SIZE (8)) } UE-Positioning-IPDL-Parameters ::= SEQUENCE { ip-Spacing IP-Spacing, ip-Length IP-Length, ip-Offset INTEGER (0..9), seed INTEGER (0..63), burstModeParameters BurstModeParameters OPTIONAL } UE-Positioning-IPDL-Parameters-r4 ::= SEQUENCE { modeSpecificInfo CHOICE { fdd SEQUENCE { ip-Spacing IP-Spacing, ip-Length IP-Length, ip-Offset INTEGER (0..9), seed INTEGER (0..63) }, tdd SEQUENCE { ip-Spacing-TDD IP-Spacing-TDD, ip-slot INTEGER (0..14), ip-Start INTEGER (0..4095), ip-PCCPCG IP-PCCPCH-r4 OPTIONAL } }, burstModeParameters BurstModeParameters OPTIONAL } UE-Positioning-IPDL-Parameters-TDD-r4-ext ::= SEQUENCE { ip-Spacing IP-Spacing-TDD, ip-slot INTEGER (0..14), ip-Start INTEGER (0..4095), ip-PCCPCG IP-PCCPCH-r4 OPTIONAL, burstModeParameters BurstModeParameters } UE-Positioning-MeasuredResults ::= SEQUENCE { ue-positioning-OTDOA-Measurement UE-Positioning-OTDOA-Measurement OPTIONAL, ue-positioning-PositionEstimateInfo UE-Positioning-PositionEstimateInfo OPTIONAL, ue-positioning-GPS-Measurement UE-Positioning-GPS-MeasurementResults OPTIONAL, ue-positioning-Error UE-Positioning-Error OPTIONAL } UE-Positioning-MeasuredResults-v390ext ::= SEQUENCE { ue-Positioning-OTDOA-Measurement-v390ext UE-Positioning-OTDOA-Measurement-v390ext } UE-Positioning-Measurement ::= SEQUENCE { ue-positioning-ReportingQuantity UE-Positioning-ReportingQuantity, reportCriteria UE-Positioning-ReportCriteria, ue-positioning-OTDOA-AssistanceData UE-Positioning-OTDOA-AssistanceData OPTIONAL, ue-positioning-GPS-AssistanceData UE-Positioning-GPS-AssistanceData OPTIONAL } UE-Positioning-Measurement-v390ext ::= SEQUENCE { ue-positioning-ReportingQuantity-v390ext UE-Positioning-ReportingQuantity-v390ext OPTIONAL, measurementValidity MeasurementValidity OPTIONAL, ue-positioning-OTDOA-AssistanceData-UEB UE-Positioning-OTDOA-AssistanceData-UEB OPTIONAL } UE-Positioning-Measurement-r4 ::= SEQUENCE { ue-positioning-ReportingQuantity UE-Positioning-ReportingQuantity-r4, measurementValidity MeasurementValidity OPTIONAL, reportCriteria UE-Positioning-ReportCriteria, ue-positioning-OTDOA-AssistanceData UE-Positioning-OTDOA-AssistanceData-r4 OPTIONAL, ue-positioning-GPS-AssistanceData UE-Positioning-GPS-AssistanceData OPTIONAL } UE-Positioning-Measurement-v7xyext ::= SEQUENCE { ue-positioning-ReportingQuantity UE-Positioning-ReportingQuantity-v7xyext } UE-Positioning-MeasurementEventResults ::= CHOICE { event7a UE-Positioning-PositionEstimateInfo, event7b UE-Positioning-OTDOA-Measurement, event7c UE-Positioning-GPS-MeasurementResults, spare NULL } UE-Positioning-MeasurementInterval ::= ENUMERATED { e5, e15, e60, e300, e900, e1800, e3600, e7200 } UE-Positioning-MethodType ::= ENUMERATED { ue-Assisted, ue-Based, ue-BasedPreferred, ue-AssistedPreferred } UE-Positioning-OTDOA-AssistanceData ::= SEQUENCE { ue-positioning-OTDOA-ReferenceCellInfo UE-Positioning-OTDOA-ReferenceCellInfo OPTIONAL, ue-positioning-OTDOA-NeighbourCellList UE-Positioning-OTDOA-NeighbourCellList OPTIONAL } UE-Positioning-OTDOA-AssistanceData-r4 ::= SEQUENCE { ue-positioning-OTDOA-ReferenceCellInfo UE-Positioning-OTDOA-ReferenceCellInfo-r4 OPTIONAL, ue-positioning-OTDOA-NeighbourCellList UE-Positioning-OTDOA-NeighbourCellList-r4 OPTIONAL } UE-Positioning-OTDOA-AssistanceData-r4ext ::= SEQUENCE { -- In case of TDD these IPDL parameters shall be used for the reference cell instead of -- IPDL Parameters in IE UE-Positioning-OTDOA-ReferenceCellInfo ue-Positioning-IPDL-Parameters-TDD-r4-ext UE-Positioning-IPDL-Parameters-TDD-r4-ext OPTIONAL, -- These IPDL parameters shall be used for the neighbour cells in case of TDD instead of -- IPDL Parameters in IE UE-Positioning-OTDOA-NeighbourCellInfoList. The cells shall be -- listed in the same order as in IE UE-Positioning-OTDOA-NeighbourCellInfoList ue-Positioning-IPDL-Parameters-TDDList-r4-ext UE-Positioning-IPDL-Parameters-TDDList-r4-ext OPTIONAL } UE-Positioning-OTDOA-AssistanceData-UEB ::= SEQUENCE { ue-positioning-OTDOA-ReferenceCellInfo-UEB UE-Positioning-OTDOA-ReferenceCellInfo-UEB OPTIONAL, ue-positioning-OTDOA-NeighbourCellList-UEB UE-Positioning-OTDOA-NeighbourCellList-UEB OPTIONAL } UE-Positioning-IPDL-Parameters-TDDList-r4-ext ::= SEQUENCE (SIZE (1..maxCellMeas)) OF UE-Positioning-IPDL-Parameters-TDD-r4-ext UE-Positioning-OTDOA-Measurement ::= SEQUENCE { sfn INTEGER (0..4095), modeSpecificInfo CHOICE { fdd SEQUENCE { referenceCellIDentity PrimaryCPICH-Info, ue-RX-TX-TimeDifferenceType2Info UE-RX-TX-TimeDifferenceType2Info }, tdd SEQUENCE { referenceCellIdentity CellParametersID } }, neighbourList NeighbourList OPTIONAL } UE-Positioning-OTDOA-Measurement-v390ext ::= SEQUENCE { neighbourList-v390ext NeighbourList-v390ext } UE-Positioning-OTDOA-NeighbourCellInfo ::= SEQUENCE { modeSpecificInfo CHOICE { fdd SEQUENCE { primaryCPICH-Info PrimaryCPICH-Info }, tdd SEQUENCE{ cellAndChannelIdentity CellAndChannelIdentity } }, frequencyInfo FrequencyInfo OPTIONAL, ue-positioning-IPDL-Paremeters UE-Positioning-IPDL-Parameters OPTIONAL, sfn-SFN-RelTimeDifference SFN-SFN-RelTimeDifference1, sfn-SFN-Drift SFN-SFN-Drift OPTIONAL, searchWindowSize OTDOA-SearchWindowSize, positioningMode CHOICE{ ueBased SEQUENCE {}, ueAssisted SEQUENCE {} } } UE-Positioning-OTDOA-NeighbourCellInfo-r4 ::= SEQUENCE { modeSpecificInfo CHOICE { fdd SEQUENCE { primaryCPICH-Info PrimaryCPICH-Info }, tdd SEQUENCE{ cellAndChannelIdentity CellAndChannelIdentity } }, frequencyInfo FrequencyInfo OPTIONAL, ue-positioning-IPDL-Paremeters UE-Positioning-IPDL-Parameters-r4 OPTIONAL, sfn-SFN-RelTimeDifference SFN-SFN-RelTimeDifference1, sfn-Offset-Validity SFN-Offset-Validity OPTIONAL, sfn-SFN-Drift SFN-SFN-Drift OPTIONAL, searchWindowSize OTDOA-SearchWindowSize, positioningMode CHOICE { ueBased SEQUENCE { relativeNorth INTEGER (-20000..20000) OPTIONAL, relativeEast INTEGER (-20000..20000) OPTIONAL, relativeAltitude INTEGER (-4000..4000) OPTIONAL, fineSFN-SFN FineSFN-SFN OPTIONAL, -- actual value roundTripTime = (IE value * 0.0625) + 876 roundTripTime INTEGER (0.. 32766) OPTIONAL }, ueAssisted SEQUENCE {} } } UE-Positioning-OTDOA-NeighbourCellInfo-UEB ::= SEQUENCE { modeSpecificInfo CHOICE { fdd SEQUENCE { primaryCPICH-Info PrimaryCPICH-Info }, tdd SEQUENCE{ cellAndChannelIdentity CellAndChannelIdentity } }, frequencyInfo FrequencyInfo OPTIONAL, ue-positioning-IPDL-Paremeters UE-Positioning-IPDL-Parameters OPTIONAL, sfn-SFN-RelTimeDifference SFN-SFN-RelTimeDifference1, sfn-SFN-Drift SFN-SFN-Drift OPTIONAL, searchWindowSize OTDOA-SearchWindowSize, relativeNorth INTEGER (-20000..20000) OPTIONAL, relativeEast INTEGER (-20000..20000) OPTIONAL, relativeAltitude INTEGER (-4000..4000) OPTIONAL, fineSFN-SFN FineSFN-SFN, -- actual value roundTripTime = (IE value * 0.0625) + 876 roundTripTime INTEGER (0..32766) OPTIONAL } UE-Positioning-OTDOA-NeighbourCellList ::= SEQUENCE (SIZE (1..maxCellMeas)) OF UE-Positioning-OTDOA-NeighbourCellInfo UE-Positioning-OTDOA-NeighbourCellList-r4 ::= SEQUENCE (SIZE (1..maxCellMeas)) OF UE-Positioning-OTDOA-NeighbourCellInfo-r4 UE-Positioning-OTDOA-NeighbourCellList-UEB ::= SEQUENCE (SIZE (1..maxCellMeas)) OF UE-Positioning-OTDOA-NeighbourCellInfo-UEB UE-Positioning-OTDOA-Quality ::= SEQUENCE { stdResolution BIT STRING (SIZE (2)), numberOfOTDOA-Measurements BIT STRING (SIZE (3)), stdOfOTDOA-Measurements BIT STRING (SIZE (5)) } UE-Positioning-OTDOA-ReferenceCellInfo ::= SEQUENCE { sfn INTEGER (0..4095) OPTIONAL, modeSpecificInfo CHOICE { fdd SEQUENCE { primaryCPICH-Info PrimaryCPICH-Info }, tdd SEQUENCE{ cellAndChannelIdentity CellAndChannelIdentity } }, frequencyInfo FrequencyInfo OPTIONAL, positioningMode CHOICE { ueBased SEQUENCE {}, ueAssisted SEQUENCE {} }, ue-positioning-IPDL-Paremeters UE-Positioning-IPDL-Parameters OPTIONAL } UE-Positioning-OTDOA-ReferenceCellInfo-r4 ::= SEQUENCE { sfn INTEGER (0..4095) OPTIONAL, modeSpecificInfo CHOICE { fdd SEQUENCE { primaryCPICH-Info PrimaryCPICH-Info }, tdd SEQUENCE{ cellAndChannelIdentity CellAndChannelIdentity } }, frequencyInfo FrequencyInfo OPTIONAL, positioningMode CHOICE { ueBased SEQUENCE { cellPosition ReferenceCellPosition OPTIONAL, -- actual value roundTripTime = (IE value * 0.0625) + 876 roundTripTime INTEGER (0..32766) OPTIONAL }, ueAssisted SEQUENCE {} }, ue-positioning-IPDL-Paremeters UE-Positioning-IPDL-Parameters-r4 OPTIONAL } UE-Positioning-OTDOA-ReferenceCellInfo-UEB ::= SEQUENCE { sfn INTEGER (0..4095) OPTIONAL, modeSpecificInfo CHOICE { fdd SEQUENCE { primaryCPICH-Info PrimaryCPICH-Info }, tdd SEQUENCE{ cellAndChannelIdentity CellAndChannelIdentity } }, frequencyInfo FrequencyInfo OPTIONAL, cellPosition ReferenceCellPosition OPTIONAL, -- actual value roundTripTime = (IE value * 0.0625) + 876 roundTripTime INTEGER (0..32766) OPTIONAL, ue-positioning-IPDL-Paremeters UE-Positioning-IPDL-Parameters OPTIONAL } UE-Positioning-PositionEstimateInfo ::= SEQUENCE { referenceTime CHOICE { utran-GPSReferenceTimeResult UTRAN-GPSReferenceTimeResult, gps-ReferenceTimeOnly INTEGER (0..604799999), cell-Timing SEQUENCE { sfn INTEGER (0..4095), modeSpecificInfo CHOICE { fdd SEQUENCE { primaryCPICH-Info PrimaryCPICH-Info }, tdd SEQUENCE{ cellAndChannelIdentity CellAndChannelIdentity } } } }, positionEstimate PositionEstimate } UE-Positioning-ReportCriteria ::= CHOICE { ue-positioning-ReportingCriteria UE-Positioning-EventParamList, periodicalReportingCriteria PeriodicalReportingCriteria, noReporting NULL } UE-Positioning-ReportingQuantity ::= SEQUENCE { methodType UE-Positioning-MethodType, positioningMethod PositioningMethod, -- dummy1 is not used in this version of specification and it should -- be ignored. dummy1 UE-Positioning-ResponseTime, horizontal-Accuracy UE-Positioning-Accuracy OPTIONAL, gps-TimingOfCellWanted BOOLEAN, -- dummy2 is not used in this version of specification and it should -- be ignored. dummy2 BOOLEAN, additionalAssistanceDataRequest BOOLEAN, environmentCharacterisation EnvironmentCharacterisation OPTIONAL } UE-Positioning-ReportingQuantity-v390ext ::= SEQUENCE { vertical-Accuracy UE-Positioning-Accuracy } UE-Positioning-ReportingQuantity-r4 ::= SEQUENCE { methodType UE-Positioning-MethodType, positioningMethod PositioningMethod, horizontalAccuracy UE-Positioning-Accuracy OPTIONAL, verticalAccuracy UE-Positioning-Accuracy OPTIONAL, gps-TimingOfCellWanted BOOLEAN, additionalAssistanceDataReq BOOLEAN, environmentCharacterisation EnvironmentCharacterisation OPTIONAL } UE-Positioning-ReportingQuantity-v7xyext ::= SEQUENCE { velocityRequested ENUMERATED { true } OPTIONAL } UE-Positioning-ResponseTime ::= ENUMERATED { s1, s2, s4, s8, s16, s32, s64, s128 } -- SPARE: UTRA-CarrierRSSI, Max = 76 -- Values above Max are spare UTRA-CarrierRSSI ::= INTEGER (0..127) UTRAN-GPS-DriftRate ::= ENUMERATED { utran-GPSDrift0, utran-GPSDrift1, utran-GPSDrift2, utran-GPSDrift5, utran-GPSDrift10, utran-GPSDrift15, utran-GPSDrift25, utran-GPSDrift50, utran-GPSDrift-1, utran-GPSDrift-2, utran-GPSDrift-5, utran-GPSDrift-10, utran-GPSDrift-15, utran-GPSDrift-25, utran-GPSDrift-50} UTRAN-GPSReferenceTime ::= SEQUENCE { -- For utran-GPSTimingOfCell values above 2322431999999 are not -- used in this version of the specification -- Actual value utran-GPSTimingOfCell = (ms-part * 4294967296) + ls-part utran-GPSTimingOfCell SEQUENCE { ms-part INTEGER (0..1023), ls-part INTEGER (0..4294967295) }, modeSpecificInfo CHOICE { fdd SEQUENCE { referenceIdentity PrimaryCPICH-Info }, tdd SEQUENCE { referenceIdentity CellParametersID } } OPTIONAL, sfn INTEGER (0..4095) } UTRAN-GPSReferenceTimeResult ::= SEQUENCE { -- For ue-GPSTimingOfCell values above 37158911999999 are not -- used in this version of the specification -- Actual value ue-GPSTimingOfCell = (ms-part * 4294967296) + ls-part ue-GPSTimingOfCell SEQUENCE { ms-part INTEGER (0.. 16383), ls-part INTEGER (0..4294967295) }, modeSpecificInfo CHOICE { fdd SEQUENCE { referenceIdentity PrimaryCPICH-Info }, tdd SEQUENCE { referenceIdentity CellParametersID } }, sfn INTEGER (0..4095) } VarianceOfRLC-BufferPayload ::= ENUMERATED { plv0, plv4, plv8, plv16, plv32, plv64, plv128, plv256, plv512, plv1024, plv2k, plv4k, plv8k, plv16k, spare2, spare1 } VelocityEstimate ::= CHOICE { horizontalVelocity HorizontalVelocity, horizontalWithVerticalVelocity HorizontalWithVerticalVelocity, horizontalVelocityWithUncertainty HorizontalVelocityWithUncertainty, horizontalWithVerticalVelocityAndUncertainty HorizontalWithVerticalVelocityAndUncertainty } -- Actual value W = IE value * 0.1 W ::= INTEGER (0..20) -- *************************************************** -- -- OTHER INFORMATION ELEMENTS (10.3.8) -- -- *************************************************** BCC ::= INTEGER (0..7) BCCH-ModificationInfo ::= SEQUENCE { mib-ValueTag MIB-ValueTag, bcch-ModificationTime BCCH-ModificationTime OPTIONAL } -- Actual value BCCH-ModificationTime = IE value * 8 BCCH-ModificationTime ::= INTEGER (0..511) BSIC ::= SEQUENCE { ncc NCC, bcc BCC } CBS-DRX-Level1Information ::= SEQUENCE { ctch-AllocationPeriod INTEGER (1..256), cbs-FrameOffset INTEGER (0..255) } CBS-DRX-Level1Information-extension-r6 ::= ENUMERATED {p8, p16, p32, p64, p128, p256} CDMA2000-Message ::= SEQUENCE { msg-Type BIT STRING (SIZE (8)), payload BIT STRING (SIZE (1..512)) } CDMA2000-MessageList ::= SEQUENCE (SIZE (1..maxInterSysMessages)) OF CDMA2000-Message CDMA2000-UMTS-Frequency-List ::= SEQUENCE (SIZE (1..maxNumCDMA2000Freqs)) OF FrequencyInfoCDMA2000 CellValueTag ::= INTEGER (1..4) --Actual value = 2^(IE value) ExpirationTimeFactor ::= INTEGER (1..8) FDD-UMTS-Frequency-List ::= SEQUENCE (SIZE (1..maxNumFDDFreqs)) OF FrequencyInfoFDD FrequencyInfoCDMA2000 ::= SEQUENCE { band-Class BIT STRING (SIZE (5)), cdma-Freq BIT STRING (SIZE(11)) } GERAN-SystemInfoBlock ::= OCTET STRING (SIZE (1..23)) GERAN-SystemInformation ::= SEQUENCE (SIZE (1..maxGERAN-SI)) OF GERAN-SystemInfoBlock GSM-BA-Range ::= SEQUENCE { gsmLowRangeUARFCN UARFCN, gsmUpRangeUARFCN UARFCN } GSM-BA-Range-List ::= SEQUENCE (SIZE (1..maxNumGSMFreqRanges)) OF GSM-BA-Range -- This IE is formatted as 'TLV' and is coded in the same way as the Mobile Station Classmark 2 -- information element in [5]. The first octet is the Mobile station classmark 2 IEI and its value -- shall be set to 33H. The second octet is the Length of mobile station classmark 2 and its value -- shall be set to 3. The octet 3 contains the first octet of the value part of the Mobile Station -- Classmark 2 information element, the octet 4 contains the second octet of the value part of the -- Mobile Station Classmark 2 information element and so on. For each of these octets, the first/ -- leftmost/ most significant bit of the octet contains b8 of the corresponding octet of the Mobile -- Station Classmark 2. GSM-Classmark2 ::= OCTET STRING (SIZE (5)) -- This IE is formatted as 'V' and is coded in the same way as the value part in the Mobile station -- classmark 3 information element in [5] -- The value part is specified by means of CSN.1, which encoding results in a bit string, to which -- final padding may be appended upto the next octet boundary [5]. The first/ leftmost bit of the -- CSN.1 bit string is placed in the first/ leftmost/ most significant bit of the first -- octet. This continues until the last bit of the CSN.1 bit string, which is placed in the last/ -- rightmost/ least significant bit of the last octet. GSM-Classmark3 ::= OCTET STRING (SIZE (1..32)) GSM-MessageList ::= SEQUENCE (SIZE (1..maxInterSysMessages)) OF BIT STRING (SIZE (1..512)) GSM-MS-RadioAccessCapability ::= OCTET STRING (SIZE (1..64)) GsmSecurityCapability ::= BIT STRING { -- For each bit value 窶0窶 means false/ not supported a5-7(0), a5-6(1), a5-5(2), a5-4(3), a5-3(4), a5-2(5), a5-1(6) } (SIZE (7)) GSM-TargetCellInfoList ::= SEQUENCE (SIZE (1..maxGSMTargetCells)) OF GSM-TargetCellInfo GSM-TargetCellInfo ::= SEQUENCE { bcch-ARFCN BCCH-ARFCN, frequency-band Frequency-Band, bsic BSIC OPTIONAL } IdentificationOfReceivedMessage ::= SEQUENCE { rrc-TransactionIdentifier RRC-TransactionIdentifier, receivedMessageType ReceivedMessageType } InterRAT-ChangeFailureCause ::= CHOICE { configurationUnacceptable NULL, physicalChannelFailure NULL, protocolError ProtocolErrorInformation, unspecified NULL, spare4 NULL, spare3 NULL, spare2 NULL, spare1 NULL } GERANIu-MessageList ::= SEQUENCE (SIZE (1..maxInterSysMessages)) OF BIT STRING (SIZE (1..32768)) GERANIu-RadioAccessCapability ::= BIT STRING (SIZE (1..170)) InterRAT-UE-RadioAccessCapability ::= CHOICE { gsm SEQUENCE { gsm-Classmark2 GSM-Classmark2, gsm-Classmark3 GSM-Classmark3 }, cdma2000 SEQUENCE { cdma2000-MessageList CDMA2000-MessageList } } InterRAT-UE-RadioAccessCapabilityList ::= SEQUENCE (SIZE(1..maxInterSysMessages)) OF InterRAT-UE-RadioAccessCapability InterRAT-UE-RadioAccessCapability-v590ext ::= SEQUENCE { geranIu-RadioAccessCapability GERANIu-RadioAccessCapability } InterRAT-UE-RadioAccessCapability-v690ext ::= SEQUENCE { supportOfInter-RAT-PS-Handover ENUMERATED { doesSupporInter-RAT-PS-Handover } OPTIONAL, gsm-MS-RadioAccessCapability GSM-MS-RadioAccessCapability } InterRAT-UE-SecurityCapability ::= CHOICE { gsm SEQUENCE { gsmSecurityCapability GsmSecurityCapability } } InterRAT-UE-SecurityCapList ::= SEQUENCE (SIZE(1..maxInterSysMessages)) OF InterRAT-UE-SecurityCapability InterRAT-HO-FailureCause ::= CHOICE { configurationUnacceptable NULL, physicalChannelFailure NULL, protocolError ProtocolErrorInformation, interRAT-ProtocolError NULL, unspecified NULL, spare11 NULL, spare10 NULL, spare9 NULL, spare8 NULL, spare7 NULL, spare6 NULL, spare5 NULL, spare4 NULL, spare3 NULL, spare2 NULL, spare1 NULL } MasterInformationBlock ::= SEQUENCE { mib-ValueTag MIB-ValueTag, -- TABULAR: The PLMN identity and ANSI-41 core network information -- are included in PLMN-Type. plmn-Type PLMN-Type, sibSb-ReferenceList SIBSb-ReferenceList, -- Extension mechanism for non- release99 information v690NonCriticalExtensions SEQUENCE { masterInformationBlock-v690ext MasterInformationBlock-v690ext, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } MasterInformationBlock-v690ext ::= SEQUENCE { multiplePLMN-List MultiplePLMN-List-r6 OPTIONAL } MIB-ValueTag ::= INTEGER (1..8) NCC ::= INTEGER (0..7) PLMN-ValueTag ::= INTEGER (1..256) PredefinedConfigIdentityAndValueTag ::= SEQUENCE { predefinedConfigIdentity PredefinedConfigIdentity, predefinedConfigValueTag PredefinedConfigValueTag } ProtocolErrorInformation ::= SEQUENCE { diagnosticsType CHOICE { type1 SEQUENCE { protocolErrorCause ProtocolErrorCause }, spare NULL } } ReceivedMessageType ::= ENUMERATED { activeSetUpdate, cellChangeOrderFromUTRAN, cellUpdateConfirm, counterCheck, downlinkDirectTransfer, interRATHandoverCommand, measurementControl, pagingType2, physicalChannelReconfiguration, physicalSharedChannelAllocation, radioBearerReconfiguration, radioBearerRelease, radioBearerSetup, rrcConnectionRelease, rrcConnectionReject, rrcConnectionSetup, securityModeCommand, signallingConnectionRelease, transportChannelReconfiguration, transportFormatCombinationControl, ueCapabilityEnquiry, ueCapabilityInformationConfirm, uplinkPhysicalChannelControl, uraUpdateConfirm, utranMobilityInformation, assistanceDataDelivery, spare6, spare5, spare4, spare3, spare2, spare1 } Rplmn-Information ::= SEQUENCE { gsm-BA-Range-List GSM-BA-Range-List OPTIONAL, fdd-UMTS-Frequency-List FDD-UMTS-Frequency-List OPTIONAL, tdd-UMTS-Frequency-List TDD-UMTS-Frequency-List OPTIONAL, cdma2000-UMTS-Frequency-List CDMA2000-UMTS-Frequency-List OPTIONAL } Rplmn-Information-r4 ::= SEQUENCE { gsm-BA-Range-List GSM-BA-Range-List OPTIONAL, fdd-UMTS-Frequency-List FDD-UMTS-Frequency-List OPTIONAL, -- the option is the same for 7.68 Mcps TDD as for 3.84 Mcps TDD -- i.e. TDD-UMTS-Frequency-List applies tdd384-UMTS-Frequency-List TDD-UMTS-Frequency-List OPTIONAL, tdd128-UMTS-Frequency-List TDD-UMTS-Frequency-List OPTIONAL, cdma2000-UMTS-Frequency-List CDMA2000-UMTS-Frequency-List OPTIONAL } SchedulingInformation ::= SEQUENCE { scheduling SEQUENCE { segCount SegCount DEFAULT 1, sib-Pos CHOICE { -- The element name indicates the repetition period and the value -- (multiplied by two) indicates the position of the first segment. rep4 INTEGER (0..1), rep8 INTEGER (0..3), rep16 INTEGER (0..7), rep32 INTEGER (0..15), rep64 INTEGER (0..31), rep128 INTEGER (0..63), rep256 INTEGER (0..127), rep512 INTEGER (0..255), rep1024 INTEGER (0..511), rep2048 INTEGER (0..1023), rep4096 INTEGER (0..2047) }, sib-PosOffsetInfo SibOFF-List OPTIONAL } } SchedulingInformationSIB ::= SEQUENCE { sib-Type SIB-TypeAndTag, scheduling SchedulingInformation } SchedulingInformationSIBSb ::= SEQUENCE { sibSb-Type SIBSb-TypeAndTag, scheduling SchedulingInformation } SegCount ::= INTEGER (1..16) SegmentIndex ::= INTEGER (1..15) -- Actual value SFN-Prime = 2 * IE value SFN-Prime ::= INTEGER (0..2047) SIB-Data-fixed ::= BIT STRING (SIZE (222)) SIB-Data-variable ::= BIT STRING (SIZE (1..214)) SIBOccurIdentity ::= INTEGER (0..15) SIBOccurrenceIdentityAndValueTag ::= SEQUENCE { sibOccurIdentity SIBOccurIdentity, sibOccurValueTag SIBOccurValueTag } SIBOccurValueTag ::= INTEGER (0..15) SIB-ReferenceList ::= SEQUENCE (SIZE (1..maxSIB)) OF SchedulingInformationSIB SIBSb-ReferenceList ::= SEQUENCE (SIZE (1..maxSIB)) OF SchedulingInformationSIBSb SIB-ReferenceListFACH ::= SEQUENCE (SIZE (1..maxSIB-FACH)) OF SchedulingInformationSIB SIB-Type ::= ENUMERATED { masterInformationBlock, systemInformationBlockType1, systemInformationBlockType2, systemInformationBlockType3, systemInformationBlockType4, systemInformationBlockType5, systemInformationBlockType6, systemInformationBlockType7, -- dummy, dummy2 and dummy3 are not used in this version of the specification, -- they should not be sent. If they are received the UE behaviour is not specified. dummy, dummy2, dummy3, systemInformationBlockType11, systemInformationBlockType12, systemInformationBlockType13, systemInformationBlockType13-1, systemInformationBlockType13-2, systemInformationBlockType13-3, systemInformationBlockType13-4, systemInformationBlockType14, systemInformationBlockType15, systemInformationBlockType15-1, systemInformationBlockType15-2, systemInformationBlockType15-3, systemInformationBlockType16, systemInformationBlockType17, systemInformationBlockType15-4, systemInformationBlockType18, schedulingBlock1, schedulingBlock2, systemInformationBlockType15-5, systemInformationBlockType5bis, spare1 } SIB-TypeAndTag ::= CHOICE { sysInfoType1 PLMN-ValueTag, sysInfoType2 CellValueTag, sysInfoType3 CellValueTag, sysInfoType4 CellValueTag, sysInfoType5 CellValueTag, sysInfoType6 CellValueTag, sysInfoType7 NULL, -- dummy, dummy2 and dummy3 are not used in this version of the specification, -- they should not be sent. If they are received the UE behaviour is not specified. dummy CellValueTag, dummy2 NULL, dummy3 NULL, sysInfoType11 CellValueTag, sysInfoType12 CellValueTag, sysInfoType13 CellValueTag, sysInfoType13-1 CellValueTag, sysInfoType13-2 CellValueTag, sysInfoType13-3 CellValueTag, sysInfoType13-4 CellValueTag, sysInfoType14 NULL, sysInfoType15 CellValueTag, sysInfoType16 PredefinedConfigIdentityAndValueTag, sysInfoType17 NULL, sysInfoType15-1 CellValueTag, sysInfoType15-2 SIBOccurrenceIdentityAndValueTag, sysInfoType15-3 SIBOccurrenceIdentityAndValueTag, sysInfoType15-4 CellValueTag, sysInfoType18 CellValueTag, sysInfoType15-5 CellValueTag, sysInfoType5bis CellValueTag, spare4 NULL, spare3 NULL, spare2 NULL, spare1 NULL } SIBSb-TypeAndTag ::= CHOICE { sysInfoType1 PLMN-ValueTag, sysInfoType2 CellValueTag, sysInfoType3 CellValueTag, sysInfoType4 CellValueTag, sysInfoType5 CellValueTag, sysInfoType6 CellValueTag, sysInfoType7 NULL, -- dummy, dummy2 and dummy3 are not used in this version of the specification, -- they should not be sent. If they are received the UE behaviour is not specified. dummy CellValueTag, dummy2 NULL, dummy3 NULL, sysInfoType11 CellValueTag, sysInfoType12 CellValueTag, sysInfoType13 CellValueTag, sysInfoType13-1 CellValueTag, sysInfoType13-2 CellValueTag, sysInfoType13-3 CellValueTag, sysInfoType13-4 CellValueTag, sysInfoType14 NULL, sysInfoType15 CellValueTag, sysInfoType16 PredefinedConfigIdentityAndValueTag, sysInfoType17 NULL, sysInfoTypeSB1 CellValueTag, sysInfoTypeSB2 CellValueTag, sysInfoType15-1 CellValueTag, sysInfoType15-2 SIBOccurrenceIdentityAndValueTag, sysInfoType15-3 SIBOccurrenceIdentityAndValueTag, sysInfoType15-4 CellValueTag, sysInfoType18 CellValueTag, sysInfoType15-5 CellValueTag, sysInfoType5bis CellValueTag, spare2 NULL, spare1 NULL } SibOFF ::= ENUMERATED { so2, so4, so6, so8, so10, so12, so14, so16, so18, so20, so22, so24, so26, so28, so30, so32 } SibOFF-List ::= SEQUENCE (SIZE (1..15)) OF SibOFF SysInfoType1 ::= SEQUENCE { -- Core network IEs cn-CommonGSM-MAP-NAS-SysInfo NAS-SystemInformationGSM-MAP, cn-DomainSysInfoList CN-DomainSysInfoList, -- User equipment IEs ue-ConnTimersAndConstants UE-ConnTimersAndConstants OPTIONAL, ue-IdleTimersAndConstants UE-IdleTimersAndConstants OPTIONAL, -- Extension mechanism for non- release99 information v3a0NonCriticalExtensions SEQUENCE { sysInfoType1-v3a0ext SysInfoType1-v3a0ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } SysInfoType1-v3a0ext-IEs ::= SEQUENCE { ue-ConnTimersAndConstants-v3a0ext UE-ConnTimersAndConstants-v3a0ext, ue-IdleTimersAndConstants-v3a0ext UE-IdleTimersAndConstants-v3a0ext } SysInfoType2 ::= SEQUENCE { -- UTRAN mobility IEs ura-IdentityList URA-IdentityList, -- Extension mechanism for non- release99 information nonCriticalExtensions SEQUENCE {} OPTIONAL } SysInfoType3 ::= SEQUENCE { sib4indicator BOOLEAN, -- UTRAN mobility IEs cellIdentity CellIdentity, cellSelectReselectInfo CellSelectReselectInfoSIB-3-4, cellAccessRestriction CellAccessRestriction, -- Extension mechanism for non- release99 information v4b0NonCriticalExtensions SEQUENCE { sysInfoType3-v4b0ext SysInfoType3-v4b0ext-IEs, v590NonCriticalExtension SEQUENCE { sysInfoType3-v590ext SysInfoType3-v590ext, v5c0NoncriticalExtension SEQUENCE { sysInfoType3-v5c0ext SysInfoType3-v5c0ext-IEs, v670NonCriticalExtension SEQUENCE { sysInfoType3-v670ext SysInfoType3-v670ext, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } SysInfoType3-v4b0ext-IEs ::= SEQUENCE { mapping-LCR Mapping-LCR-r4 OPTIONAL } SysInfoType3-v590ext ::= SEQUENCE { cellSelectReselectInfo-v590ext CellSelectReselectInfo-v590ext OPTIONAL } SysInfoType3-v5c0ext-IEs ::= SEQUENCE { cellSelectReselectInfoTreselectionScaling-v5c0ext CellSelectReselectInfoTreselectionScaling-v5c0ext OPTIONAL } SysInfoType3-v670ext ::= SEQUENCE { domainSpecificAccessRestrictionParametersForPLMNOfMIB DomainSpecificAccessRestrictionParam-v670ext OPTIONAL, domainSpecificAccessRestictionForSharedNetwork DomainSpecificAccessRestrictionForSharedNetwork-v670ext OPTIONAL } SysInfoType4 ::= SEQUENCE { -- UTRAN mobility IEs cellIdentity CellIdentity, cellSelectReselectInfo CellSelectReselectInfoSIB-3-4, cellAccessRestriction CellAccessRestriction, -- Extension mechanism for non- release99 information v4b0NonCriticalExtensions SEQUENCE { sysInfoType4-v4b0ext SysInfoType4-v4b0ext-IEs, v590NonCriticalExtension SEQUENCE { sysInfoType4-v590ext SysInfoType4-v590ext, v5b0NonCriticalExtension SEQUENCE { sysInfoType4-v5b0ext SysInfoType4-v5b0ext-IEs, v5c0NonCriticalExtension SEQUENCE { sysInfoType4-v5c0ext SysInfoType4-v5c0ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } SysInfoType4-v4b0ext-IEs ::= SEQUENCE { mapping-LCR Mapping-LCR-r4 OPTIONAL } SysInfoType4-v590ext ::= SEQUENCE { cellSelectReselectInfo-v590ext CellSelectReselectInfo-v590ext OPTIONAL } SysInfoType4-v5b0ext-IEs ::= SEQUENCE { cellSelectReselectInfoPCHFACH-v5b0ext CellSelectReselectInfoPCHFACH-v5b0ext OPTIONAL } SysInfoType4-v5c0ext-IEs ::= SEQUENCE { cellSelectReselectInfoTreselectionScaling-v5c0ext CellSelectReselectInfoTreselectionScaling-v5c0ext OPTIONAL } SysInfoType5 ::= SEQUENCE { sib6indicator BOOLEAN, -- Physical channel IEs pich-PowerOffset PICH-PowerOffset, modeSpecificInfo CHOICE { fdd SEQUENCE { aich-PowerOffset AICH-PowerOffset }, tdd SEQUENCE { -- If PDSCH/PUSCH is configured for 1.28Mcps TDD, the following IEs should be absent -- and the info included in the tdd128SpecificInfo instead. -- If PDSCH/PUSCH is configured for 3.84Mcps TDD in R5, HCR-r5-SpecificInfo should also be -- included. pusch-SysInfoList-SFN PUSCH-SysInfoList-SFN OPTIONAL, pdsch-SysInfoList-SFN PDSCH-SysInfoList-SFN OPTIONAL, openLoopPowerControl-TDD OpenLoopPowerControl-TDD } }, primaryCCPCH-Info PrimaryCCPCH-Info OPTIONAL, prach-SystemInformationList PRACH-SystemInformationList, sCCPCH-SystemInformationList SCCPCH-SystemInformationList, -- cbs-DRX-Level1Information is conditional on any of the CTCH indicator IEs in -- sCCPCH-SystemInformationList cbs-DRX-Level1Information CBS-DRX-Level1Information OPTIONAL, -- Extension mechanism for non- release99 information v4b0NonCriticalExtensions SEQUENCE { sysInfoType5-v4b0ext SysInfoType5-v4b0ext-IEs OPTIONAL, -- Extension mechanism for non- rel-4 information v590NonCriticalExtensions SEQUENCE { sysInfoType5-v590ext SysInfoType5-v590ext-IEs OPTIONAL, v650NonCriticalExtensions SEQUENCE { sysInfoType5-v650ext SysInfoType5-v650ext-IEs OPTIONAL, v680NonCriticalExtensions SEQUENCE { sysInfoType5-v680ext SysInfoType5-v680ext-IEs OPTIONAL, v690NonCriticalExtensions SEQUENCE { sysInfoType5-v690ext SysInfoType5-v690ext-IEs, v7xyNonCriticalExtensions SEQUENCE { sysInfoType5-v7xyext SysInfoType5-v7xyext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } SysInfoType5-v4b0ext-IEs ::= SEQUENCE { --The following IE PNBSCH-Allocation-r4 shall be used for 3.84Mcps TDD only. pNBSCH-Allocation-r4 PNBSCH-Allocation-r4 OPTIONAL, -- In case of TDD, the following IE is included instead of the -- IE up-IPDL-Parameter in up-OTDOA-AssistanceData. openLoopPowerControl-IPDL-TDD OpenLoopPowerControl-IPDL-TDD-r4 OPTIONAL, -- If SysInfoType5 is sent to describe a 1.28Mcps TDD cell, the IE PRACH-RACH-Info included in -- PRACH-SystemInformationList shall be ignored, the IE PRACH-Partitioning and the -- IE rach-TransportFormatSet shall be absent and the corresponding IE in the following -- PRACH-SystemInformationList-LCR-r4 shall be used prach-SystemInformationList-LCR-r4 PRACH-SystemInformationList-LCR-r4 OPTIONAL, tdd128SpecificInfo SEQUENCE { pusch-SysInfoList-SFN PUSCH-SysInfoList-SFN-LCR-r4 OPTIONAL, pdsch-SysInfoList-SFN PDSCH-SysInfoList-SFN-LCR-r4 OPTIONAL, pCCPCH-LCR-Extensions PrimaryCCPCH-Info-LCR-r4-ext OPTIONAL, sCCPCH-LCR-ExtensionsList SCCPCH-SystemInformationList-LCR-r4-ext } OPTIONAL, frequencyBandIndicator RadioFrequencyBandFDD OPTIONAL } SysInfoType5-v590ext-IEs ::= SEQUENCE { hcr-r5-SpecificInfo SEQUENCE { pusch-SysInfoList-SFN PUSCH-SysInfoList-SFN-HCR-r5 OPTIONAL, pdsch-SysInfoList-SFN PDSCH-SysInfoList-SFN-HCR-r5 OPTIONAL } OPTIONAL } SysInfoType5-v650ext-IEs ::= SEQUENCE { frequencyBandIndicator2 RadioFrequencyBandFDD2 } SysInfoType5-v680ext-IEs ::= SEQUENCE { -- TABULAR: HSDPA Cell Indicator is MD in tabular description -- Default value is 窶僣SDPA Capability not indicated窶 hsdpa-CellIndicator ENUMERATED { hsdpa-CapableCell } OPTIONAL } SysInfoType5-v690ext-IEs ::= SEQUENCE { -- TABULAR: E-DCH Cell Indicator is MD in tabular description -- Default value is 窶僞-DCH Capability not indicated窶 edch-CellIndicator ENUMERATED { edch-CapableCell } OPTIONAL, sccpch-SystemInformation-MBMS CHOICE { mcchOnSCCPCHusedForNonMBMS MBMS-MCCH-ConfigurationInfo-r6, mcchOnSCCPCHusedOnlyForMBMS SCCPCH-SystemInformation-MBMS-r6 } OPTIONAL, additionalPRACH-TF-and-TFCS-CCCH-List AdditionalPRACH-TF-and-TFCS-CCCH-List OPTIONAL, cBS-DRX-Level1Information-extension CBS-DRX-Level1Information-extension-r6 OPTIONAL } SysInfoType5-v7xyext-IEs ::= SEQUENCE { pusch-SysInfoList-SFN-VHCR PUSCH-SysInfoList-SFN-VHCR OPTIONAL, prach-SystemInformationList-r7 PRACH-SystemInformationList-r7 OPTIONAL, pdsch-SysInfoList-SFN-r7 PDSCH-SysInfoList-r7 OPTIONAL, sccpch-SystemInformation-MBMS CHOICE { mcchOnSCCPCHusedForNonMBMS MBMS-MCCH-ConfigurationInfo-r6, mcchOnSCCPCHusedOnlyForMBMS SCCPCH-SystemInformation-MBMS-r7 } OPTIONAL, sCCPCH-SystemInformationList-r7 SCCPCH-SystemInformationList-r7 OPTIONAL } -- SysInfoType5bis uses the same structure as SysInfoType5 SysInfoType5bis ::= SysInfoType5 SysInfoType6 ::= SEQUENCE { -- Physical channel IEs pich-PowerOffset PICH-PowerOffset, modeSpecificInfo CHOICE { fdd SEQUENCE { aich-PowerOffset AICH-PowerOffset, -- dummy is not used in this version of specification, it should -- not be sent and if received it should be ignored. dummy CSICH-PowerOffset OPTIONAL }, tdd SEQUENCE { -- If PDSCH/PUSCH is configured for 1.28Mcps TDD, pusch-SysInfoList-SFN, -- pdsch-SysInfoList-SFN and openLoopPowerControl-TDD should be absent -- and the info included in the tdd128SpecificInfo instead. -- If PDSCH/PUSCH is configured for 3.84Mcps TDD in R5, HCR-r5-SpecificInfo should -- also be included. pusch-SysInfoList-SFN PUSCH-SysInfoList-SFN OPTIONAL, pdsch-SysInfoList-SFN PDSCH-SysInfoList-SFN OPTIONAL, openLoopPowerControl-TDD OpenLoopPowerControl-TDD } }, primaryCCPCH-Info PrimaryCCPCH-Info OPTIONAL, prach-SystemInformationList PRACH-SystemInformationList OPTIONAL, sCCPCH-SystemInformationList SCCPCH-SystemInformationList OPTIONAL, cbs-DRX-Level1Information CBS-DRX-Level1Information OPTIONAL, -- Conditional on any of the CTCH indicator IEs in -- sCCPCH-SystemInformationList -- Extension mechanism for non- release99 information v4b0NonCriticalExtensions SEQUENCE { sysInfoType6-v4b0ext SysInfoType6-v4b0ext-IEs OPTIONAL, -- Extension mechanism for non- rel-4 information v590NonCriticalExtensions SEQUENCE { sysInfoType6-v590ext SysInfoType6-v590ext-IEs OPTIONAL, v650nonCriticalExtensions SEQUENCE { sysInfoType6-v650ext SysInfoType6-v650ext-IEs OPTIONAL, v690nonCriticalExtensions SEQUENCE { sysInfoType6-v690ext SysInfoType6-v690ext-IEs, v7xyNonCriticalExtensions SEQUENCE { sysInfoType6-v7xyext SysInfoType6-v7xyext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } SysInfoType6-v4b0ext-IEs ::= SEQUENCE { -- openLoopPowerControl-IPDL-TDD is present only if IPDLs are applied for TDD openLoopPowerControl-IPDL-TDD OpenLoopPowerControl-IPDL-TDD-r4 OPTIONAL, -- If SysInfoType6 is sent to describe a 1.28Mcps TDD cell, the IE PRACH-RACH-Info included -- in PRACH-SystemInformationList shall be ignored, the IE PRACH-Partitioning and the -- IE rach-TransportFormatSet shall be absent and the corresponding IEs in the following -- PRACH-SystemInformationList-LCR-r4 shall be used prach-SystemInformationList-LCR-r4 PRACH-SystemInformationList-LCR-r4 OPTIONAL, tdd128SpecificInfo SEQUENCE { pusch-SysInfoList-SFN PUSCH-SysInfoList-SFN-LCR-r4 OPTIONAL, pdsch-SysInfoList-SFN PDSCH-SysInfoList-SFN-LCR-r4 OPTIONAL, pCCPCH-LCR-Extensions PrimaryCCPCH-Info-LCR-r4-ext OPTIONAL, sCCPCH-LCR-ExtensionsList SCCPCH-SystemInformationList-LCR-r4-ext OPTIONAL } OPTIONAL, frequencyBandIndicator RadioFrequencyBandFDD OPTIONAL } SysInfoType6-v590ext-IEs ::= SEQUENCE { hcr-r5-SpecificInfo SEQUENCE { pusch-SysInfoList-SFN PUSCH-SysInfoList-SFN-HCR-r5 OPTIONAL, pdsch-SysInfoList-SFN PDSCH-SysInfoList-SFN-HCR-r5 OPTIONAL } OPTIONAL } SysInfoType6-v650ext-IEs ::= SEQUENCE { frequencyBandIndicator2 RadioFrequencyBandFDD2 } SysInfoType6-v690ext-IEs ::= SEQUENCE { additionalPRACH-TF-and-TFCS-CCCH-List AdditionalPRACH-TF-and-TFCS-CCCH-List OPTIONAL } SysInfoType6-v7xyext-IEs ::= SEQUENCE { pusch-SysInfoList-SFN-VHCR PUSCH-SysInfoList-SFN-VHCR OPTIONAL, pdsch-SysInfoList-SFN-r7 PDSCH-SysInfoList-r7 OPTIONAL, prach-SystemInformationList-r7 PRACH-SystemInformationList-r7 OPTIONAL, sCCPCH-SystemInformationList-r7 SCCPCH-SystemInformationList-r7 OPTIONAL } SysInfoType7 ::= SEQUENCE { -- Physical channel IEs modeSpecificInfo CHOICE { fdd SEQUENCE { ul-Interference UL-Interference }, tdd NULL }, prach-Information-SIB5-List DynamicPersistenceLevelList, prach-Information-SIB6-List DynamicPersistenceLevelList OPTIONAL, expirationTimeFactor ExpirationTimeFactor OPTIONAL, -- Extension mechanism for non- release99 information nonCriticalExtensions SEQUENCE {} OPTIONAL } -- This IE is not used in this version of the specification. -- It was kept only for backwards compatibility reasons SysInfoType8 ::= SEQUENCE { -- User equipment IEs -- dummy1, dummy2, dummy3 are not used in this version of the specification and -- they should be ignored by the receiver. dummy1 CPCH-Parameters, -- Physical channel IEs dummy2 CPCH-SetInfoList, dummy3 CSICH-PowerOffset, -- Extension mechanism for non- release99 information nonCriticalExtensions SEQUENCE {} OPTIONAL } -- This IE is not used in this version of the specification. -- It was kept only for backwards compatibility reasons SysInfoType9 ::= SEQUENCE { -- Physical channel IEs -- dummy is not used in this version of the specification and -- it should be ignored by the receiver. dummy CPCH-PersistenceLevelsList, -- Extension mechanism for non- release99 information nonCriticalExtensions SEQUENCE {} OPTIONAL } -- This IE is not used in this version of the specification. -- It was kept only for backwards compatibility reasons SysInfoType10 ::= SEQUENCE { -- User equipment IEs -- dummy is not used in this version of the specification, it should -- not be sent and if received it should be ignored. dummy DRAC-SysInfoList, -- Extension mechanism for non- release99 information nonCriticalExtensions SEQUENCE {} OPTIONAL } SysInfoType11 ::= SEQUENCE { sib12indicator BOOLEAN, -- Measurement IEs fach-MeasurementOccasionInfo FACH-MeasurementOccasionInfo OPTIONAL, measurementControlSysInfo MeasurementControlSysInfo, -- Extension mechanism for non- release99 information v4b0NonCriticalExtensions SEQUENCE { sysInfoType11-v4b0ext SysInfoType11-v4b0ext-IEs OPTIONAL, v590NonCriticalExtension SEQUENCE { sysInfoType11-v590ext SysInfoType11-v590ext-IEs, v690NonCriticalExtensions SEQUENCE { sysInfoType11-v690ext SysInfoType11-v690ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } SysInfoType11-v4b0ext-IEs ::= SEQUENCE { fach-MeasurementOccasionInfo-LCR-Ext FACH-MeasurementOccasionInfo-LCR-r4-ext OPTIONAL, measurementControlSysInfo-LCR MeasurementControlSysInfo-LCR-r4-ext } SysInfoType11-v590ext-IEs ::= SEQUENCE { --The order of the list corresponds to the order of cell in newIntraFrequencyCellInfoList newIntraFrequencyCellInfoList-v590ext SEQUENCE (SIZE (1..maxCellMeas)) OF CellSelectReselectInfo-v590ext OPTIONAL, --The order of the list corresponds to the order of cell in newInterFrequencyCellInfoList newInterFrequencyCellInfoList-v590ext SEQUENCE (SIZE (1..maxCellMeas)) OF CellSelectReselectInfo-v590ext OPTIONAL, --The order of the list corresponds to the order of cell in newInterRATCellInfoList newInterRATCellInfoList-v590ext SEQUENCE (SIZE (1..maxCellMeas)) OF CellSelectReselectInfo-v590ext OPTIONAL, intraFreqEventCriteriaList-v590ext Intra-FreqEventCriteriaList-v590ext OPTIONAL, intraFreqReportingCriteria-1b-r5 IntraFreqReportingCriteria-1b-r5 OPTIONAL, intraFreqEvent-1d-r5 IntraFreqEvent-1d-r5 OPTIONAL } SysInfoType11-v690ext-IEs ::= SEQUENCE { -- Measurement IEs interFreqRACHReportingInfo InterFreqRACHReportingInfo OPTIONAL } SysInfoType12 ::= SEQUENCE { -- Measurement IEs fach-MeasurementOccasionInfo FACH-MeasurementOccasionInfo OPTIONAL, measurementControlSysInfo MeasurementControlSysInfo, -- Extension mechanism for non- release99 information v4b0NonCriticalExtensions SEQUENCE { sysInfoType12-v4b0ext SysInfoType12-v4b0ext-IEs OPTIONAL, v590NonCriticalExtension SEQUENCE { sysInfoType12-v590ext SysInfoType12-v590ext-IEs, v690NonCriticalExtensions SEQUENCE { sysInfoType12-v690ext SysInfoType12-v690ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } SysInfoType12-v4b0ext-IEs ::= SEQUENCE { fach-MeasurementOccasionInfo-LCR-Ext FACH-MeasurementOccasionInfo-LCR-r4-ext OPTIONAL, measurementControlSysInfo-LCR MeasurementControlSysInfo-LCR-r4-ext } SysInfoType12-v590ext-IEs ::= SEQUENCE { --The order of the list corresponds to the order of cell in newIntraFrequencyCellInfoList newIntraFrequencyCellInfoList-v590ext SEQUENCE (SIZE (1..maxCellMeas)) OF CellSelectReselectInfo-v590ext OPTIONAL, --The order of the list corresponds to the order of cell in newInterFrequencyCellInfoList newInterFrequencyCellInfoList-v590ext SEQUENCE (SIZE (1..maxCellMeas)) OF CellSelectReselectInfo-v590ext OPTIONAL, --The order of the list corresponds to the order of cell in newInterRATCellInfoList newInterRATCellInfoList-v590ext SEQUENCE (SIZE (1..maxCellMeas)) OF CellSelectReselectInfo-v590ext OPTIONAL, intraFreqEventCriteriaList-v590ext Intra-FreqEventCriteriaList-v590ext OPTIONAL, intraFreqReportingCriteria-1b-r5 IntraFreqReportingCriteria-1b-r5 OPTIONAL, intraFreqEvent-1d-r5 IntraFreqEvent-1d-r5 OPTIONAL } SysInfoType12-v690ext-IEs ::= SEQUENCE { -- Measurement IEs interFreqRACHReportingInfo InterFreqRACHReportingInfo OPTIONAL } SysInfoType13 ::= SEQUENCE { -- Core network IEs cn-DomainSysInfoList CN-DomainSysInfoList, -- User equipment IEs ue-IdleTimersAndConstants UE-IdleTimersAndConstants OPTIONAL, capabilityUpdateRequirement CapabilityUpdateRequirement OPTIONAL, -- Extension mechanism for non- release99 information v3a0NonCriticalExtensions SEQUENCE { sysInfoType13-v3a0ext SysInfoType13-v3a0ext-IEs, v4b0NonCriticalExtensions SEQUENCE { sysInfoType13-v4b0ext SysInfoType13-v4b0ext-IEs, -- Extension mechanism for non- release99 information v7xyNonCriticalExtensions SEQUENCE { sysInfoType13-v7xyext SysInfoType13-v7xyext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } SysInfoType13-v3a0ext-IEs ::= SEQUENCE { ue-IdleTimersAndConstants-v3a0ext UE-IdleTimersAndConstants-v3a0ext } SysInfoType13-v4b0ext-IEs ::= SEQUENCE { capabilityUpdateRequirement-r4Ext CapabilityUpdateRequirement-r4-ext OPTIONAL } SysInfoType13-v7xyext-IEs ::= SEQUENCE { capabilityUpdateRequirement-r7Ext CapabilityUpdateRequirement-r7-ext OPTIONAL } SysInfoType13-1 ::= SEQUENCE { -- ANSI-41 IEs ansi-41-RAND-Information ANSI-41-RAND-Information, -- Extension mechanism for non- release99 information nonCriticalExtensions SEQUENCE {} OPTIONAL } SysInfoType13-2 ::= SEQUENCE { -- ANSI-41 IEs ansi-41-UserZoneID-Information ANSI-41-UserZoneID-Information, -- Extension mechanism for non- release99 information nonCriticalExtensions SEQUENCE {} OPTIONAL } SysInfoType13-3 ::= SEQUENCE { -- ANSI-41 IEs ansi-41-PrivateNeighbourListInfo ANSI-41-PrivateNeighbourListInfo, -- Extension mechanism for non- release99 information nonCriticalExtensions SEQUENCE {} OPTIONAL } SysInfoType13-4 ::= SEQUENCE { -- ANSI-41 IEs ansi-41-GlobalServiceRedirectInfo ANSI-41-GlobalServiceRedirectInfo, -- Extension mechanism for non- release99 information nonCriticalExtensions SEQUENCE {} OPTIONAL } SysInfoType14 ::= SEQUENCE { -- Physical channel IEs individualTS-InterferenceList IndividualTS-InterferenceList, expirationTimeFactor ExpirationTimeFactor OPTIONAL, -- Extension mechanism for non- release99 information nonCriticalExtensions SEQUENCE {} OPTIONAL } SysInfoType15 ::= SEQUENCE { -- Measurement IEs ue-positioning-GPS-CipherParameters UE-Positioning-CipherParameters OPTIONAL, ue-positioning-GPS-ReferenceLocation ReferenceLocation, ue-positioning-GPS-ReferenceTime UE-Positioning-GPS-ReferenceTime, ue-positioning-GPS-Real-timeIntegrity BadSatList OPTIONAL, -- Extension mechanism for non- release99 information v4b0NonCriticalExtensions SEQUENCE { sysInfoType15-v4b0ext SysInfoType15-v4b0ext-IEs, -- Extension mechanism for non- release4 information nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } SysInfoType15-v4b0ext-IEs ::= SEQUENCE { up-Ipdl-Parameters-TDD UE-Positioning-IPDL-Parameters-TDD-r4-ext OPTIONAL } SysInfoType15-1 ::= SEQUENCE { -- DGPS corrections ue-positioning-GPS-DGPS-Corrections UE-Positioning-GPS-DGPS-Corrections, -- Extension mechanism for non- release99 information nonCriticalExtensions SEQUENCE {} OPTIONAL } SysInfoType15-2 ::= SEQUENCE { -- Ephemeris and clock corrections transmissionTOW INTEGER (0..604799), satID SatID, ephemerisParameter EphemerisParameter, -- Extension mechanism for non- release99 information nonCriticalExtensions SEQUENCE {} OPTIONAL } SysInfoType15-3 ::= SEQUENCE { -- Almanac and other data transmissionTOW INTEGER (0.. 604799), ue-positioning-GPS-Almanac UE-Positioning-GPS-Almanac OPTIONAL, ue-positioning-GPS-IonosphericModel UE-Positioning-GPS-IonosphericModel OPTIONAL, ue-positioning-GPS-UTC-Model UE-Positioning-GPS-UTC-Model OPTIONAL, satMask BIT STRING (SIZE (1..32)) OPTIONAL, lsbTOW BIT STRING (SIZE (8)) OPTIONAL, -- Extension mechanism for non- release99 information nonCriticalExtensions SEQUENCE {} OPTIONAL } SysInfoType15-4 ::= SEQUENCE { -- Measurement IEs ue-positioning-OTDOA-CipherParameters UE-Positioning-CipherParameters OPTIONAL, ue-positioning-OTDOA-AssistanceData UE-Positioning-OTDOA-AssistanceData, v3a0NonCriticalExtensions SEQUENCE { sysInfoType15-4-v3a0ext SysInfoType15-4-v3a0ext, -- Extension mechanism for non- release99 information v4b0NonCriticalExtensions SEQUENCE { sysInfoType15-4-v4b0ext SysInfoType15-4-v4b0ext, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } SysInfoType15-4-v3a0ext ::= SEQUENCE { sfn-Offset-Validity SFN-Offset-Validity OPTIONAL } SysInfoType15-4-v4b0ext ::= SEQUENCE { ue-Positioning-OTDOA-AssistanceData-r4ext UE-Positioning-OTDOA-AssistanceData-r4ext OPTIONAL } SysInfoType15-5 ::= SEQUENCE { -- Measurement IEs ue-positioning-OTDOA-AssistanceData-UEB UE-Positioning-OTDOA-AssistanceData-UEB, v3a0NonCriticalExtensions SEQUENCE { sysInfoType15-5-v3a0ext SysInfoType15-5-v3a0ext, -- Extension mechanism for non- release99 information nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } SysInfoType15-5-v3a0ext ::= SEQUENCE { sfn-Offset-Validity SFN-Offset-Validity OPTIONAL } SysInfoType16 ::= SEQUENCE { -- Radio bearer IEs preDefinedRadioConfiguration PreDefRadioConfiguration, -- Extension mechanism for non- release99 information nonCriticalExtensions SEQUENCE {} OPTIONAL } SysInfoType17 ::= SEQUENCE { -- Physical channel IEs -- If PDSCH/PUSCH is configured for 1.28Mcps TDD, pusch-SysInfoList and -- pdsch-SysInfoList should be absent and the info included in the -- tdd128SpecificInfo instead. -- If PDSCH/PUSCH is configured for 3.84Mcps TDD in R5, HCR-r5-SpecificInfo should also be -- included. pusch-SysInfoList PUSCH-SysInfoList OPTIONAL, pdsch-SysInfoList PDSCH-SysInfoList OPTIONAL, -- Extension mechanism for non- release99 information v4b0NonCriticalExtensions SEQUENCE { sysInfoType17-v4b0ext SysInfoType17-v4b0ext-IEs, v590NonCriticalExtensions SEQUENCE { sysInfoType17-v590ext SysInfoType17-v590ext-IEs OPTIONAL, v7xyNonCriticalExtensions SEQUENCE { sysInfoType17-v7xyext SysInfoType17-v7xyext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } SysInfoType17-v4b0ext-IEs ::= SEQUENCE { tdd128SpecificInfo SEQUENCE { pusch-SysInfoList PUSCH-SysInfoList-LCR-r4 OPTIONAL, pdsch-SysInfoList PDSCH-SysInfoList-LCR-r4 OPTIONAL } OPTIONAL } SysInfoType17-v590ext-IEs ::= SEQUENCE { hcr-r5-SpecificInfo SEQUENCE { pusch-SysInfoList PUSCH-SysInfoList-HCR-r5 OPTIONAL, pdsch-SysInfoList PDSCH-SysInfoList-HCR-r5 OPTIONAL } OPTIONAL } SysInfoType17-v7xyext-IEs ::= SEQUENCE { pusch-SysInfoList-SFN-VHCR PUSCH-SysInfoList-SFN-VHCR OPTIONAL, pdsch-SysInfoList-r7 PDSCH-SysInfoList-r7 OPTIONAL } SysInfoType18 ::= SEQUENCE { idleModePLMNIdentities PLMNIdentitiesOfNeighbourCells OPTIONAL, connectedModePLMNIdentities PLMNIdentitiesOfNeighbourCells OPTIONAL, -- Extension mechanism for non- release99 information nonCriticalExtensions SEQUENCE {} OPTIONAL } SysInfoTypeSB1 ::= SEQUENCE { -- Other IEs sib-ReferenceList SIB-ReferenceList, -- Extension mechanism for non- release99 information nonCriticalExtensions SEQUENCE {} OPTIONAL } SysInfoTypeSB2 ::= SEQUENCE { -- Other IEs sib-ReferenceList SIB-ReferenceList, -- Extension mechanism for non- release99 information nonCriticalExtensions SEQUENCE {} OPTIONAL } TDD-UMTS-Frequency-List ::= SEQUENCE (SIZE (1..maxNumTDDFreqs)) OF FrequencyInfoTDD -- *************************************************** -- -- ANSI-41 INFORMATION ELEMENTS (10.3.9) -- -- *************************************************** ANSI-41-GlobalServiceRedirectInfo ::= ANSI-41-NAS-Parameter ANSI-41-PrivateNeighbourListInfo ::= ANSI-41-NAS-Parameter ANSI-41-RAND-Information ::= ANSI-41-NAS-Parameter ANSI-41-UserZoneID-Information ::= ANSI-41-NAS-Parameter ANSI-41-NAS-Parameter ::= BIT STRING (SIZE (1..2048)) Min-P-REV ::= BIT STRING (SIZE (8)) NAS-SystemInformationANSI-41 ::= ANSI-41-NAS-Parameter NID ::= BIT STRING (SIZE (16)) P-REV ::= BIT STRING (SIZE (8)) SID ::= BIT STRING (SIZE (15)) -- *************************************************** -- -- MBMS INFORMATION ELEMENTS (10.3.9a) -- -- *************************************************** MBMS-AccessProbabilityFactor ::= ENUMERATED { apf0, apf32, apf64, apf96, apf128, apf160, apf192, apf224, apf256, apf288, apf320, apf352, apf384, apf416, apf448, apf480, apf512, apf544, apf576, apf608, apf640, apf672, apf704, apf736, apf768, apf800, apf832, apf864, apf896, apf928, apf960, apf1000 } MBMS-CellGroupIdentity-r6 ::= BIT STRING (SIZE (12)) MBMS-CommonCCTrChIdentity ::= INTEGER (1..32) MBMS-CommonPhyChIdentity ::= INTEGER (1..32) MBMS-CommonRBIdentity ::= INTEGER (1..32) MBMS-CommonRBInformation-r6 ::= SEQUENCE { commonRBIdentity MBMS-CommonRBIdentity, pdcp-Info PDCP-Info-r4, rlc-Info RLC-Info-MTCH-r6 } MBMS-CommonRBInformationList-r6 ::= SEQUENCE (SIZE (1..maxMBMS-CommonRB)) OF MBMS-CommonRBInformation-r6 MBMS-CommonTrChIdentity ::= INTEGER (1..32) MBMS-ConnectedModeCountingScope ::= SEQUENCE { countingForUraPCH BOOLEAN, countingForCellPCH BOOLEAN, countingForCellFACH BOOLEAN } MBMS-CurrentCell-SCCPCH-r6 ::= SEQUENCE { sccpchIdentity MBMS-SCCPCHIdentity OPTIONAL, secondaryCCPCH-Info MBMS-CommonPhyChIdentity, softComb-TimingOffset MBMS-SoftComb-TimingOffset OPTIONAL, -- If the IE transpCh-InfoCommonForAllTrCh is absent, the default TFCS as specified -- in 14.10.1 applies transpCh-InfoCommonForAllTrCh MBMS-CommonCCTrChIdentity OPTIONAL, transpCHInformation MBMS-TrCHInformation-CurrList } MBMS-CurrentCell-SCCPCHList-r6 ::= SEQUENCE (SIZE (1..maxSCCPCH)) OF MBMS-CurrentCell-SCCPCH-r6 MBMS-FACHCarryingMTCH-List ::= SEQUENCE (SIZE (1..maxFACHPCH)) OF TransportFormatSet MBMS-JoinedInformation-r6 ::= SEQUENCE { p-TMSI P-TMSI-GSM-MAP OPTIONAL } MBMS-L1CombiningSchedule-32 ::= SEQUENCE { -- Actual L1 combining schedule values (offset, start, duration) = IE value * 4 cycleOffset INTEGER (0..7) OPTIONAL, mtch-L1CombiningPeriodList SEQUENCE (SIZE (1..maxMBMS-L1CP)) OF SEQUENCE { periodStart INTEGER (0..7), periodDuration INTEGER (1..8) } } MBMS-L1CombiningSchedule-64 ::= SEQUENCE { -- Actual L1 combining schedule values (offset, start, duration) = IE value * 4 cycleOffset INTEGER (0..15) OPTIONAL, mtch-L1CombiningPeriodList SEQUENCE (SIZE (1..maxMBMS-L1CP)) OF SEQUENCE { periodStart INTEGER (0..15), periodDuration INTEGER (1..16) } } MBMS-L1CombiningSchedule-128 ::= SEQUENCE { -- Actual L1 combining schedule values (offset, start, duration) = IE value * 4 cycleOffset INTEGER (0..31) OPTIONAL, mtch-L1CombiningPeriodList SEQUENCE (SIZE (1..maxMBMS-L1CP)) OF SEQUENCE { periodStart INTEGER (0..31), periodDuration INTEGER (1..32) } } MBMS-L1CombiningSchedule-256 ::= SEQUENCE { -- Actual L1 combining schedule values (offset, start, duration) = IE value * 4 cycleOffset INTEGER (0..63) OPTIONAL, mtch-L1CombiningPeriodList SEQUENCE (SIZE (1..maxMBMS-L1CP)) OF SEQUENCE { periodStart INTEGER (0..63), periodDuration INTEGER (1..64) } } MBMS-L1CombiningSchedule-512 ::= SEQUENCE { -- Actual L1 combining schedule values (offset, start, duration) = IE value * 4 cycleOffset INTEGER (0..127) OPTIONAL, mtch-L1CombiningPeriodList SEQUENCE (SIZE (1..maxMBMS-L1CP)) OF SEQUENCE { periodStart INTEGER (0..127), periodDuration INTEGER (1..128) } } MBMS-L1CombiningSchedule-1024 ::= SEQUENCE { -- Actual L1 combining schedule values (offset, start, duration) = IE value * 4 cycleOffset INTEGER (0..255) OPTIONAL, mtch-L1CombiningPeriodList SEQUENCE (SIZE (1..maxMBMS-L1CP)) OF SEQUENCE { periodStart INTEGER (0..255), periodDuration INTEGER (1..256) } } MBMS-L1CombiningSchedule ::= CHOICE { cycleLength-32 MBMS-L1CombiningSchedule-32, cycleLength-64 MBMS-L1CombiningSchedule-64, cycleLength-128 MBMS-L1CombiningSchedule-128, cycleLength-256 MBMS-L1CombiningSchedule-256, cycleLength-512 MBMS-L1CombiningSchedule-512, cycleLength-1024 MBMS-L1CombiningSchedule-1024 } MBMS-L1CombiningTransmTimeDiff ::= INTEGER (0..3) MBMS-L23Configuration ::= CHOICE { sameAsCurrent SEQUENCE { currentCell-SCCPCH MBMS-SCCPCHIdentity, msch-ConfigurationInfo MBMS-MSCH-ConfigurationInfo-r6 OPTIONAL }, different SEQUENCE { -- If the IE transpCh-InfoCommonForAllTrCh is absent, the default TFCS as specified -- in 14.10.1 applies transpCh-InfoCommonForAllTrCh MBMS-CommonCCTrChIdentity OPTIONAL, transpCHInformation MBMS-TrCHInformation-NeighbList } } MBMS-LogicalChIdentity ::= INTEGER (1..15) MBMS-MCCH-ConfigurationInfo-r6 ::= SEQUENCE { accessInfoPeriodCoefficient INTEGER (0..3), repetitionPeriodCoefficient INTEGER (0..3), modificationPeriodCoefficient INTEGER (7..10), rlc-Info RLC-Info-MCCH-r6, tctf-Presence MBMS-TCTF-Presence OPTIONAL } MBMS-MICHConfigurationInfo-r6 ::= SEQUENCE { michPowerOffset MBMS-MICHPowerOffset, mode CHOICE { fdd SEQUENCE { channelisationCode256 ChannelisationCode256, ni-CountPerFrame MBMS-NI-CountPerFrame, sttd-Indicator BOOLEAN }, tdd384 SEQUENCE { timeslot TimeslotNumber, midambleShiftAndBurstType MidambleShiftAndBurstType, channelisationCode DL-TS-ChannelisationCode, repetitionPeriodLengthOffset RepPerLengthOffset-MICH OPTIONAL, mbmsNotificationIndLength MBMS-MICHNotificationIndLength DEFAULT mn4 }, tdd128 SEQUENCE { timeslot TimeslotNumber-LCR-r4, midambleShiftAndBurstType MidambleShiftAndBurstType-LCR-r4, channelisationCodeList SEQUENCE (SIZE (1..2)) OF DL-TS-ChannelisationCode, repetitionPeriodLengthOffset RepPerLengthOffset-MICH OPTIONAL, mbmsNotificationIndLength MBMS-MICHNotificationIndLength DEFAULT mn4 } } } MBMS-MICHConfigurationInfo-r7 ::= SEQUENCE { michPowerOffset MBMS-MICHPowerOffset, mode CHOICE { fdd SEQUENCE { channelisationCode256 ChannelisationCode256, ni-CountPerFrame MBMS-NI-CountPerFrame, sttd-Indicator BOOLEAN }, tdd384 SEQUENCE { timeslot TimeslotNumber, midambleShiftAndBurstType MidambleShiftAndBurstType, channelisationCode DL-TS-ChannelisationCode, repetitionPeriodLengthOffset RepPerLengthOffset-MICH OPTIONAL, mbmsNotificationIndLength MBMS-MICHNotificationIndLength DEFAULT mn4 }, tdd768 SEQUENCE { timeslot TimeslotNumber, midambleShiftAndBurstType MidambleShiftAndBurstType-VHCR, channelisationCode DL-TS-ChannelisationCode, repetitionPeriodLengthOffset RepPerLengthOffset-MICH OPTIONAL, mbmsNotificationIndLength MBMS-MICHNotificationIndLength DEFAULT mn4 }, tdd128 SEQUENCE { timeslot TimeslotNumber-LCR-r4, midambleShiftAndBurstType MidambleShiftAndBurstType-LCR-r4, channelisationCodeList SEQUENCE (SIZE (1..2)) OF DL-TS-ChannelisationCode, repetitionPeriodLengthOffset RepPerLengthOffset-MICH OPTIONAL, mbmsNotificationIndLength MBMS-MICHNotificationIndLength DEFAULT mn4 } } } MBMS-MICHNotificationIndLength ::= ENUMERATED { mn4, mn8, mn16 } MBMS-MICHPowerOffset ::= INTEGER (-10..5) MBMS-ModifedService-r6 ::= SEQUENCE { mbms-TransmissionIdentity MBMS-TransmissionIdentity, mbms-RequiredUEAction MBMS-RequiredUEAction-Mod, mbms-PreferredFrequency CHOICE { mcch MBMS-PFLIndex, dcch MBMS-PFLInfo } OPTIONAL, mbms-DispersionIndicator ENUMERATED { true } OPTIONAL, continueMCCHReading BOOLEAN } MBMS-ModifedServiceList-r6 ::= SEQUENCE (SIZE (1..maxMBMSservModif)) OF MBMS-ModifedService-r6 MBMS-MSCH-ConfigurationInfo-r6 ::= SEQUENCE { mschShedulingInfo MBMS-MSCHSchedulingInfo OPTIONAL, rlc-Info RLC-Info-MSCH-r6 OPTIONAL, tctf-Presence MBMS-TCTF-Presence OPTIONAL } MBMS-MSCHSchedulingInfo ::= CHOICE { schedulingPeriod-32-Offset INTEGER (0..31), schedulingPeriod-64-Offset INTEGER (0..63), schedulingPeriod-128-Offset INTEGER (0..127), schedulingPeriod-256-Offset INTEGER (0..255), schedulingPeriod-512-Offset INTEGER (0..511), schedulingPeriod-1024-Offset INTEGER (0..1023) } MBMS-NeighbouringCellSCCPCH-r6 ::= SEQUENCE { secondaryCCPCH-Info MBMS-CommonPhyChIdentity, secondaryCCPCHPwrOffsetDiff MBMS-SCCPCHPwrOffsetDiff OPTIONAL, layer1Combining CHOICE { fdd SEQUENCE { softComb-TimingOffset MBMS-SoftComb-TimingOffset, mbms-L1CombiningTransmTimeDiff MBMS-L1CombiningTransmTimeDiff, mbms-L1CombiningSchedule MBMS-L1CombiningSchedule OPTIONAL }, tdd NULL } OPTIONAL, mbms-L23Configuration MBMS-L23Configuration } MBMS-NeighbouringCellSCCPCHList-r6 ::= SEQUENCE (SIZE (1..maxSCCPCH)) OF MBMS-NeighbouringCellSCCPCH-r6 MBMS-NI-CountPerFrame ::= ENUMERATED { ni18, ni36, ni72, ni144 } MBMS-NumberOfNeighbourCells-r6 ::= INTEGER (0..32) MBMS-PFLIndex ::= INTEGER (1..maxMBMS-Freq) MBMS-PFLInfo ::= FrequencyInfo MBMS-PhyChInformation-r6 ::= SEQUENCE { mbms-CommonPhyChIdentity MBMS-CommonPhyChIdentity, secondaryCCPCHInfo-MBMS SecondaryCCPCHInfo-MBMS-r6 } MBMS-PhyChInformationList-r6 ::= SEQUENCE (SIZE (1..maxMBMS-CommonPhyCh)) OF MBMS-PhyChInformation-r6 MBMS-PL-ServiceRestrictInfo-r6 ::= ENUMERATED { true } MBMS-PreferredFreqRequest-r6 ::= SEQUENCE { preferredFreqRequest FrequencyInfo } MBMS-PreferredFrequencyInfo-r6 ::= SEQUENCE { mbmsPreferredFrequency INTEGER (1..maxMBMS-Freq) OPTIONAL, layerConvergenceInformation CHOICE { mbms-Qoffset MBMS-Qoffset, mbms-HCSoffset INTEGER (0..7) }, mbms-PL-ServiceRestrictInfo MBMS-PL-ServiceRestrictInfo-r6 OPTIONAL } MBMS-PreferredFrequencyList-r6 ::= SEQUENCE (SIZE (1..maxMBMS-Freq)) OF MBMS-PreferredFrequencyInfo-r6 MBMS-PTMActivationTime-r6 ::= INTEGER (0..2047) MBMS-PTM-RBInformation-C ::= SEQUENCE { rbInformation MBMS-CommonRBIdentity, shortTransmissionID MBMS-ShortTransmissionID, logicalChIdentity MBMS-LogicalChIdentity } MBMS-PTM-RBInformation-CList ::= SEQUENCE (SIZE (1..maxRBperTrCh)) OF MBMS-PTM-RBInformation-C MBMS-PTM-RBInformation-N ::= SEQUENCE { shortTransmissionID MBMS-ShortTransmissionID, logicalChIdentity MBMS-LogicalChIdentity, layer1-CombiningStatus BOOLEAN} MBMS-PTM-RBInformation-NList ::= SEQUENCE (SIZE (1..maxRBperTrCh)) OF MBMS-PTM-RBInformation-N MBMS-Qoffset ::= ENUMERATED { q4, q8, q12, q16, q20, q30, q40, qInfinity } MBMS-RequiredUEAction-Mod ::= ENUMERATED { none, acquireCountingInfo, acquireCountingInfoPTM-RBsUnmodified, acquirePTM-RBInfo, requestPTPRB, releasePTM-RB } MBMS-RequiredUEAction-UMod ::= ENUMERATED { none, acquirePTM-RBInfo, requestPTPRB } MBMS-SCCPCHIdentity ::= INTEGER (1..maxSCCPCH) MBMS-SCCPCHPwrOffsetDiff ::= ENUMERATED { mcpo-minus6, mcpo-minus3, mcpo-plus3, mcpo-plus6 } MBMS-ServiceAccessInfo-r6 ::= SEQUENCE { shortTransmissionID MBMS-ShortTransmissionID, accessprobabilityFactor-Idle MBMS-AccessProbabilityFactor, accessprobabilityFactor-UraPCH MBMS-AccessProbabilityFactor OPTIONAL, mbms-ConnectedModeCountingScope MBMS-ConnectedModeCountingScope } MBMS-ServiceAccessInfoList-r6 ::= SEQUENCE (SIZE (1..maxMBMSservCount)) OF MBMS-ServiceAccessInfo-r6 MBMS-ServiceIdentity-r6 ::= SEQUENCE { serviceIdentity OCTET STRING (SIZE (3)), plmn-Identity CHOICE { -- The 'sameAsMIB-PLMN-Id' choice refers to the 'PLMN Identity' (R99) in MIB. sameAsMIB-PLMN-Id NULL, other CHOICE { -- The 'sameAsMIB-MultiPLMN-Id' choice refers to one of the (1..5) PLMN Identities -- provided in the 'Multiple PLMN List' (REL-6) in MIB. sameAsMIB-MultiPLMN-Id INTEGER (1..5), explicitPLMN-Id PLMN-Identity } } } MBMS-ServiceSchedulingInfo-r6 ::= SEQUENCE { mbms-TransmissionIdentity MBMS-TransmissionIdentity, mbms-ServiceTransmInfoList MBMS-ServiceTransmInfoList OPTIONAL, nextSchedulingperiod INTEGER (0..31) } MBMS-ServiceSchedulingInfoList-r6 ::= SEQUENCE (SIZE (1..maxMBMSservSched)) OF MBMS-ServiceSchedulingInfo-r6 MBMS-ServiceTransmInfo ::= SEQUENCE { -- Actual values (start, duration) = IE values * 4 start INTEGER (0..255), duration INTEGER (1..256) } MBMS-ServiceTransmInfoList ::= SEQUENCE (SIZE (1..maxMBMSTransmis)) OF MBMS-ServiceTransmInfo MBMS-SessionIdentity ::= OCTET STRING (SIZE (1)) MBMS-ShortTransmissionID ::= INTEGER (1..maxMBMSservUnmodif) MBMS-SIBType5-SCCPCH-r6 ::= SEQUENCE { sccpchIdentity MBMS-SCCPCHIdentity, transpCHInformation MBMS-TrCHInformation-SIB5List } MBMS-SIBType5-SCCPCHList-r6 ::= SEQUENCE (SIZE (1..maxSCCPCH)) OF MBMS-SIBType5-SCCPCH-r6 MBMS-SoftComb-TimingOffset ::= ENUMERATED { ms0, ms10, ms20, ms40 } MBMS-TCTF-Presence ::= ENUMERATED { false } MBMS-TimersAndCounters-r6 ::= SEQUENCE { t-318 T-318 DEFAULT ms1000 } MBMS-TransmissionIdentity ::= SEQUENCE { mbms-ServiceIdentity MBMS-ServiceIdentity-r6, mbms-SessionIdentity MBMS-SessionIdentity OPTIONAL } MBMS-TranspChInfoForCCTrCh-r6 ::= SEQUENCE { commonCCTrChIdentity MBMS-CommonCCTrChIdentity, transportFormatCombinationSet TFCS } MBMS-TranspChInfoForEachCCTrCh-r6 ::= SEQUENCE (SIZE (1..maxMBMS-CommonCCTrCh)) OF MBMS-TranspChInfoForCCTrCh-r6 MBMS-TranspChInfoForEachTrCh-r6 ::= SEQUENCE (SIZE (1..maxMBMS-CommonTrCh)) OF MBMS-TranspChInfoForTrCh-r6 MBMS-TranspChInfoForTrCh-r6 ::= SEQUENCE { commonTrChIdentity MBMS-CommonTrChIdentity, transportFormatSet TransportFormatSet } MBMS-TrCHInformation-Curr ::= SEQUENCE { transpCh-Info MBMS-CommonTrChIdentity, rbInformation MBMS-PTM-RBInformation-CList OPTIONAL, msch-ConfigurationInfo MBMS-MSCH-ConfigurationInfo-r6 OPTIONAL } MBMS-TrCHInformation-CurrList ::= SEQUENCE (SIZE (1..maxFACHPCH)) OF MBMS-TrCHInformation-Curr MBMS-TrCHInformation-Neighb ::= SEQUENCE { transpCh-Info MBMS-CommonTrChIdentity, transpCh-CombiningStatus BOOLEAN, rbInformation MBMS-PTM-RBInformation-NList OPTIONAL, msch-ConfigurationInfo MBMS-MSCH-ConfigurationInfo-r6 OPTIONAL } MBMS-TrCHInformation-NeighbList ::= SEQUENCE (SIZE (1..maxFACHPCH)) OF MBMS-TrCHInformation-Neighb MBMS-TrCHInformation-SIB5 ::= SEQUENCE { transpCh-Identity INTEGER (1..maxFACHPCH), rbInformation MBMS-PTM-RBInformation-CList OPTIONAL, msch-ConfigurationInfo MBMS-MSCH-ConfigurationInfo-r6 OPTIONAL } MBMS-TrCHInformation-SIB5List ::= SEQUENCE (SIZE (1..maxFACHPCH)) OF MBMS-TrCHInformation-SIB5 MBMS-UnmodifiedService-r6 ::= SEQUENCE { mbms-TransmissionIdentity MBMS-TransmissionIdentity, mbms-RequiredUEAction MBMS-RequiredUEAction-UMod, mbms-PreferredFrequency MBMS-PFLIndex OPTIONAL } MBMS-UnmodifiedServiceList-r6 ::= SEQUENCE (SIZE (1..maxMBMSservUnmodif)) OF MBMS-UnmodifiedService-r6 END Constant-definitions DEFINITIONS AUTOMATIC TAGS ::= BEGIN hiPDSCHidentities INTEGER ::= 64 hiPUSCHidentities INTEGER ::= 64 hiRM INTEGER ::= 256 maxAC INTEGER ::= 16 maxAdditionalMeas INTEGER ::= 4 maxASC INTEGER ::= 8 maxASCmap INTEGER ::= 7 maxASCpersist INTEGER ::= 6 maxCCTrCH INTEGER ::= 8 maxCellMeas INTEGER ::= 32 maxCellMeas-1 INTEGER ::= 31 maxCNdomains INTEGER ::= 4 maxCPCHsets INTEGER ::= 16 maxDPCH-DLchan INTEGER ::= 8 maxDPDCH-UL INTEGER ::= 6 maxDRACclasses INTEGER ::= 8 maxE-DCHMACdFlow INTEGER ::= 8 maxE-DCHMACdFlow-1 INTEGER ::= 7 maxEDCHRL INTEGER ::= 4 maxFACHPCH INTEGER ::= 8 maxFreq INTEGER ::= 8 maxFreqBandsFDD INTEGER ::= 8 maxFreqBandsFDD-ext INTEGER ::= 15 -- maxFreqBandsFDD-ext ::= 22 窶 (maxFreqBandsFDD 窶 1) maxFreqBandsTDD INTEGER ::= 4 maxFreqBandsGSM INTEGER ::= 16 maxGERAN-SI INTEGER ::= 8 maxGSMTargetCells INTEGER ::= 32 maxHProcesses INTEGER ::= 8 maxHSDSCHTBIndex INTEGER ::= 64 maxHSDSCHTBIndex-tdd384 INTEGER ::= 512 maxHSSCCHs INTEGER ::= 4 maxInterSysMessages INTEGER ::= 4 maxLoCHperRLC INTEGER ::= 2 maxMAC-d-PDUsizes INTEGER ::= 8 maxMBMS-CommonCCTrCh INTEGER ::= 32 maxMBMS-CommonPhyCh INTEGER ::= 32 maxMBMS-CommonRB INTEGER ::= 32 maxMBMS-CommonTrCh INTEGER ::= 32 maxMBMS-Freq INTEGER ::= 4 maxMBMS-L1CP INTEGER ::= 4 maxMBMSservCount INTEGER ::= 8 maxMBMSservModif INTEGER ::= 32 maxMBMSservSched INTEGER ::= 16 maxMBMSservUnmodif INTEGER ::= 64 maxMBMSTransmis INTEGER ::= 4 maxMeasEvent INTEGER ::= 8 maxMeasIntervals INTEGER ::= 3 maxMeasParEvent INTEGER ::= 2 maxNumCDMA2000Freqs INTEGER ::= 8 maxNumGSMFreqRanges INTEGER ::= 32 maxNumFDDFreqs INTEGER ::= 8 maxNumTDDFreqs INTEGER ::= 8 maxNoOfMeas INTEGER ::= 16 maxOtherRAT INTEGER ::= 15 maxOtherRAT-16 INTEGER ::= 16 maxPage1 INTEGER ::= 8 maxPCPCH-APsig INTEGER ::= 16 maxPCPCH-APsubCh INTEGER ::= 12 maxPCPCH-CDsig INTEGER ::= 16 maxPCPCH-CDsubCh INTEGER ::= 12 maxPCPCH-SF INTEGER ::= 7 maxPCPCHs INTEGER ::= 64 maxPDCPAlgoType INTEGER ::= 8 maxPDSCH INTEGER ::= 8 maxPDSCH-TFCIgroups INTEGER ::= 256 maxPRACH INTEGER ::= 16 maxPRACH-FPACH INTEGER ::= 8 maxPredefConfig INTEGER ::= 16 maxPUSCH INTEGER ::= 8 maxQueueIDs INTEGER ::= 8 maxRABsetup INTEGER ::= 16 maxRAT INTEGER ::= 16 maxRB INTEGER ::= 32 maxRBallRABs INTEGER ::= 27 maxRBMuxOptions INTEGER ::= 8 maxRBperRAB INTEGER ::= 8 maxRBperTrCh INTEGER ::= 16 maxReportedGSMCells INTEGER ::= 8 maxRL INTEGER ::= 8 maxRL-1 INTEGER ::= 7 maxRLCPDUsizePerLogChan INTEGER ::= 32 maxRFC3095-CID INTEGER ::= 16384 maxROHC-PacketSizes-r4 INTEGER ::= 16 maxROHC-Profile-r4 INTEGER ::= 8 maxSat INTEGER ::= 16 maxSCCPCH INTEGER ::= 16 maxSIB INTEGER ::= 32 maxSIB-FACH INTEGER ::= 8 maxSIBperMsg INTEGER ::= 16 maxSRBsetup INTEGER ::= 8 maxSystemCapability INTEGER ::= 16 maxTF INTEGER ::= 32 maxTF-CPCH INTEGER ::= 16 maxTFC INTEGER ::= 1024 maxTFCsub INTEGER ::= 1024 maxTFCI-2-Combs INTEGER ::= 512 maxTGPS INTEGER ::= 6 maxTrCH INTEGER ::= 32 -- maxTrCHpreconf should be 16 but has been set to 32 for compatibility maxTrCHpreconf INTEGER ::= 32 maxTS INTEGER ::= 14 maxTS-1 INTEGER ::= 13 maxTS-2 INTEGER ::= 12 maxTS-LCR INTEGER ::= 6 maxTS-LCR-1 INTEGER ::= 5 maxURA INTEGER ::= 8 maxURNTI-Group INTEGER ::= 8 END Internode-definitions DEFINITIONS AUTOMATIC TAGS ::= BEGIN IMPORTS HandoverToUTRANCommand, MeasurementReport, PhysicalChannelReconfiguration, RadioBearerReconfiguration, RadioBearerRelease, RadioBearerSetup, RRCConnectionSetupComplete-r3-add-ext-IEs, RRC-FailureInfo, TransportChannelReconfiguration, UECapabilityInformation-r3-add-ext-IEs FROM PDU-definitions -- Core Network IEs : CN-DomainIdentity, CN-DomainInformationList, CN-DomainInformationListFull, CN-DRX-CycleLengthCoefficient, NAS-SystemInformationGSM-MAP, -- UTRAN Mobility IEs : CellIdentity, URA-Identity, -- User Equipment IEs : AccessStratumReleaseIndicator, C-RNTI, ChipRateCapability, DL-CapabilityWithSimultaneousHS-DSCHConfig, DL-PhysChCapabilityFDD-v380ext, DL-PhysChCapabilityTDD, DL-PhysChCapabilityTDD-LCR-r4, GSM-Measurements, HSDSCH-physical-layer-category, FailureCauseWithProtErr, MaxHcContextSpace, MaximumAM-EntityNumberRLC-Cap, MaximumRLC-WindowSize, MaxNoPhysChBitsReceived, MaxNoDPDCH-BitsTransmitted, MaxPhysChPerFrame, MaxPhysChPerSubFrame-r4, MaxPhysChPerTS, MaxROHC-ContextSessions-r4, MaxTS-PerFrame, MaxTS-PerSubFrame-r4, MinimumSF-DL, MultiModeCapability, MultiRAT-Capability, NetworkAssistedGPS-Supported, PhysicalChannelCapability-edch-r6, PhysicalChannelCapability-r7, RadioFrequencyBandTDDList, RF-Capability-r7, RLC-Capability, RRC-MessageSequenceNumber, SecurityCapability, SimultaneousSCCPCH-DPCH-Reception, STARTList, STARTSingle, START-Value, SupportOfDedicatedPilotsForChEstimation, TransportChannelCapability, TxRxFrequencySeparation, U-RNTI, UE-CapabilityContainer-IEs, UE-MultiModeRAT-Capability, UE-PowerClassExt, UE-RadioAccessCapabBandFDDList, UE-RadioAccessCapabBandFDDList2, UE-RadioAccessCapabBandFDDList-ext, UE-RadioAccessCapability, UE-RadioAccessCapability-v370ext, UE-RadioAccessCapability-v380ext, UE-RadioAccessCapability-v3a0ext, UE-RadioAccessCapability-v3g0ext, UE-RadioAccessCapability-v4b0ext, UE-RadioAccessCapability-v590ext, UE-RadioAccessCapability-v5c0ext, UE-RadioAccessCapability-v7xyext, UL-PhysChCapabilityFDD, UL-PhysChCapabilityFDD-r6, UL-PhysChCapabilityTDD, UL-PhysChCapabilityTDD-LCR-r4, -- Radio Bearer IEs : PredefinedConfigStatusList, PredefinedConfigValueTag, RAB-InformationSetupList, RAB-InformationSetupList-r4, RAB-InformationSetupList-r5, RAB-InformationSetupList-r6-ext, RAB-InformationSetupList-r6, RB-Identity, SRB-InformationSetupList, SRB-InformationSetupList-r5, SRB-InformationSetupList-r6, -- Transport Channel IEs : CPCH-SetID, DL-CommonTransChInfo, DL-CommonTransChInfo-r4, DL-AddReconfTransChInfoList, DL-AddReconfTransChInfoList-r4, DL-AddReconfTransChInfoList-r5, DRAC-StaticInformationList, UL-CommonTransChInfo, UL-CommonTransChInfo-r4, UL-AddReconfTransChInfoList, UL-AddReconfTransChInfoList-r6, -- Physical Channel IEs : PrimaryCPICH-Info, TPC-CombinationIndex, ScramblingCodeChange, TGCFN, TGPSI, TGPS-ConfigurationParams, -- Measurement IEs : Event1j-r6, Hysteresis, Inter-FreqEventCriteriaList-v590ext, Intra-FreqEventCriteriaList-v590ext, IntraFreqEvent-1d-r5, IntraFreqReportingCriteria-1b-r5, InterRATCellInfoIndication, MeasuredResultsOnRACHinterFreq, MeasurementIdentity, MeasurementReportingMode, MeasurementType, MeasurementType-r4, MeasurementType-r6, AdditionalMeasurementID-List, PositionEstimate, ReportingCellStatus, TimeToTrigger, -- MBMS IEs : MBMS-JoinedInformation-r6, -- Other IEs : GERANIu-RadioAccessCapability, GSM-MS-RadioAccessCapability, InterRAT-UE-RadioAccessCapabilityList, InterRAT-UE-RadioAccessCapability-v590ext, InterRAT-UE-RadioAccessCapability-v690ext, UESpecificBehaviourInformation1idle, UESpecificBehaviourInformation1interRAT FROM InformationElements maxCNdomains, maxNoOfMeas, maxRB, maxRBallRABs, maxRFC3095-CID, maxSRBsetup, maxRL, maxTGPS FROM Constant-definitions ; -- Part 1: Class definitions similar to what has been defined in 11.1 for RRC messages -- Information that is tranferred in the same direction and across the same path is grouped -- *************************************************** -- -- RRC information, to target RNC -- -- *************************************************** -- RRC Information to target RNC sent either from source RNC or from another RAT ToTargetRNC-Container ::= CHOICE { interRATHandoverInfo InterRATHandoverInfoWithInterRATCapabilities-r3, srncRelocation SRNC-RelocationInfo-r3, rfc3095-ContextInfo RFC3095-ContextInfo-r5, extension NULL } -- *************************************************** -- -- RRC information, target RNC to source RNC -- -- *************************************************** TargetRNC-ToSourceRNC-Container ::= CHOICE { radioBearerSetup RadioBearerSetup, radioBearerReconfiguration RadioBearerReconfiguration, radioBearerRelease RadioBearerRelease, transportChannelReconfiguration TransportChannelReconfiguration, physicalChannelReconfiguration PhysicalChannelReconfiguration, rrc-FailureInfo RRC-FailureInfo, -- IE dl-DCCHmessage consists of an octet string that includes the IE DL-DCCH-Message dL-DCCHmessage OCTET STRING, extension NULL } -- Part 2: Container definitions, similar to the PDU definitions in 11.2 for RRC messages -- In alphabetical order -- *************************************************** -- -- Handover to UTRAN information -- -- *************************************************** InterRATHandoverInfoWithInterRATCapabilities-r3 ::= CHOICE { r3 SEQUENCE { -- IE InterRATHandoverInfoWithInterRATCapabilities-r3-IEs also -- includes non critical extensions interRATHandoverInfo-r3 InterRATHandoverInfoWithInterRATCapabilities-r3-IEs, v390NonCriticalExtensions SEQUENCE { interRATHandoverInfoWithInterRATCapabilities-v390ext InterRATHandoverInfoWithInterRATCapabilities-v390ext-IEs, -- Reserved for future non critical extension v690NonCriticalExtensions SEQUENCE { interRATHandoverInfoWithInterRATCapabilities-v690ext InterRATHandoverInfoWithInterRATCapabilities-v690ext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL }, criticalExtensions SEQUENCE {} } InterRATHandoverInfoWithInterRATCapabilities-r3-IEs ::= SEQUENCE { -- The order of the IEs may not reflect the tabular format -- but has been chosen to simplify the handling of the information in the BSC -- Other IEs ue-RATSpecificCapability InterRAT-UE-RadioAccessCapabilityList OPTIONAL, -- interRATHandoverInfo, Octet string is used to obtain 8 bit length field prior to -- actual information. This makes it possible for BSS to transparently handle information -- received via GSM air interface even when it includes non critical extensions. -- The octet string shall include the InterRATHandoverInfo information -- The BSS can re-use the 44.018 length field received from the MS interRATHandoverInfo OCTET STRING (SIZE (0..255)) } InterRATHandoverInfoWithInterRATCapabilities-v390ext-IEs ::= SEQUENCE { -- User equipment IEs failureCauseWithProtErr FailureCauseWithProtErr OPTIONAL } InterRATHandoverInfoWithInterRATCapabilities-v690ext-IEs ::= SEQUENCE { -- Other IEs ue-RATSpecificCapability-v690ext InterRAT-UE-RadioAccessCapability-v690ext OPTIONAL } -- *************************************************** -- -- RFC3095 context, source RNC to target RNC -- -- *************************************************** RFC3095-ContextInfo-r5 ::= CHOICE { r5 SEQUENCE { rFC3095-ContextInfoList-r5 RFC3095-ContextInfoList-r5, -- Reserved for future non critical extension nonCriticalExtensions SEQUENCE {} OPTIONAL }, criticalExtensions SEQUENCE {} } RFC3095-ContextInfoList-r5 ::= SEQUENCE (SIZE (1..maxRBallRABs)) OF RFC3095-ContextInfo -- *************************************************** -- -- SRNC Relocation information -- -- *************************************************** SRNC-RelocationInfo-r3 ::= CHOICE { r3 SEQUENCE { sRNC-RelocationInfo-r3 SRNC-RelocationInfo-r3-IEs, v380NonCriticalExtensions SEQUENCE { sRNC-RelocationInfo-v380ext SRNC-RelocationInfo-v380ext-IEs, -- Reserved for future non critical extension v390NonCriticalExtensions SEQUENCE { sRNC-RelocationInfo-v390ext SRNC-RelocationInfo-v390ext-IEs, v3a0NonCriticalExtensions SEQUENCE { sRNC-RelocationInfo-v3a0ext SRNC-RelocationInfo-v3a0ext-IEs, v3b0NonCriticalExtensions SEQUENCE { sRNC-RelocationInfo-v3b0ext SRNC-RelocationInfo-v3b0ext-IEs, v3c0NonCriticalExtensions SEQUENCE { sRNC-RelocationInfo-v3c0ext SRNC-RelocationInfo-v3c0ext-IEs, laterNonCriticalExtensions SEQUENCE { sRNC-RelocationInfo-v3d0ext SRNC-RelocationInfo-v3d0ext-IEs, -- Container for additional R99 extensions sRNC-RelocationInfo-r3-add-ext BIT STRING (CONTAINING SRNC-RelocationInfo-v3h0ext-IEs) OPTIONAL, v3g0NonCriticalExtensions SEQUENCE { sRNC-RelocationInfo-v3g0ext SRNC-RelocationInfo-v3g0ext-IEs, v4b0NonCriticalExtensions SEQUENCE { sRNC-RelocationInfo-v4b0ext SRNC-RelocationInfo-v4b0ext-IEs, v590NonCriticalExtensions SEQUENCE { sRNC-RelocationInfo-v590ext SRNC-RelocationInfo-v590ext-IEs, v5a0NonCriticalExtensions SEQUENCE { sRNC-RelocationInfo-v5a0ext SRNC-RelocationInfo-v5a0ext-IEs, v5b0NonCriticalExtensions SEQUENCE { sRNC-RelocationInfo-v5b0ext SRNC-RelocationInfo-v5b0ext-IEs, v5c0NonCriticalExtensions SEQUENCE { sRNC-RelocationInfo-v5c0ext SRNC-RelocationInfo-v5c0ext-IEs, v690NonCriticalExtensions SEQUENCE { sRNC-RelocationInfo-v690ext SRNC-RelocationInfo-v690ext-IEs, v7xyNonCriticalExtensions SEQUENCE { sRNC-RelocationInfo-v7xyext SRNC-RelocationInfo-v7xyext-IEs, -- Reserved for future non critical extension nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL }, later-than-r3 CHOICE { r4 SEQUENCE { sRNC-RelocationInfo-r4 SRNC-RelocationInfo-r4-IEs, v4d0NonCriticalExtensions SEQUENCE { sRNC-RelocationInfo-v4d0ext SRNC-RelocationInfo-v4d0ext-IEs, -- Container for adding non critical extensions after freezing REL-5 sRNC-RelocationInfo-r4-add-ext BIT STRING OPTIONAL, v590NonCriticalExtensions SEQUENCE { sRNC-RelocationInfo-v590ext SRNC-RelocationInfo-v590ext-IEs, v5a0NonCriticalExtensions SEQUENCE { sRNC-RelocationInfo-v5a0ext SRNC-RelocationInfo-v5a0ext-IEs, v5b0NonCriticalExtensions SEQUENCE { sRNC-RelocationInfo-v5b0ext SRNC-RelocationInfo-v5b0ext-IEs, v5c0NonCriticalExtensions SEQUENCE { sRNC-RelocationInfo-v5c0ext SRNC-RelocationInfo-v5c0ext-IEs, v690NonCriticalExtensions SEQUENCE { sRNC-RelocationInfo-v690ext SRNC-RelocationInfo-v690ext-IEs, v7xyNonCriticalExtensions SEQUENCE { sRNC-RelocationInfo-v7xyext SRNC-RelocationInfo-v7xyext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL }, criticalExtensions CHOICE { r5 SEQUENCE { sRNC-RelocationInfo-r5 SRNC-RelocationInfo-r5-IEs, sRNC-RelocationInfo-r5-add-ext BIT STRING OPTIONAL, v5a0NonCriticalExtensions SEQUENCE { sRNC-RelocationInfo-v5a0ext SRNC-RelocationInfo-v5a0ext-IEs, v5b0NonCriticalExtensions SEQUENCE { sRNC-RelocationInfo-v5b0ext SRNC-RelocationInfo-v5b0ext-IEs, v5c0NonCriticalExtensions SEQUENCE { sRNC-RelocationInfo-v5c0ext SRNC-RelocationInfo-v5c0ext-IEs, v690NonCriticalExtensions SEQUENCE { sRNC-RelocationInfo-v690ext SRNC-RelocationInfo-v690ext-IEs, v7xyNonCriticalExtensions SEQUENCE { sRNC-RelocationInfo-v7xyext SRNC-RelocationInfo-v7xyext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL } OPTIONAL }, criticalExtensions CHOICE { r6 SEQUENCE { sRNC-RelocationInfo-r6 SRNC-RelocationInfo-r6-IEs, sRNC-RelocationInfo-r6-add-ext BIT STRING OPTIONAL, v7xyNonCriticalExtensions SEQUENCE { sRNC-RelocationInfo-v7xyext SRNC-RelocationInfo-v7xyext-IEs, nonCriticalExtensions SEQUENCE {} OPTIONAL } OPTIONAL }, criticalExtensions SEQUENCE {} } } } } SRNC-RelocationInfo-r3-IEs ::= SEQUENCE { -- Non-RRC IEs stateOfRRC StateOfRRC, stateOfRRC-Procedure StateOfRRC-Procedure, -- Ciphering related information IEs -- If the extension v380 is included use the extension for the ciphering status per CN domain cipheringStatus CipheringStatus, -- If ciphering status is started and the IE latestConfiguredCN-Domain should be included, -- the IE cn-DomainIdentity (in SRNC-RelocationInfo-v380ext-IEs) shall be used instead. calculationTimeForCiphering CalculationTimeForCiphering OPTIONAL, -- The order of occurrence in the IE cipheringInfoPerRB-List is the -- same as the RBs in SRB-InformationSetupList in RAB-InformationSetupList. -- The signalling RBs are supposed to be listed -- first. Only UM and AM RBs that are ciphered are listed here cipheringInfoPerRB-List CipheringInfoPerRB-List OPTIONAL, count-C-List COUNT-C-List OPTIONAL, integrityProtectionStatus IntegrityProtectionStatus, -- In the IE srb-SpecificIntegrityProtInfo, the first information listed corresponds to -- signalling radio bearer RB0 and after the order of occurrence is the same as the SRBs in -- SRB-InformationSetupList -- The target RNC may ignore the IE srb-SpecificIntegrityProtInfo if the -- IE integrityProtectionStatus has the value "not started". srb-SpecificIntegrityProtInfo SRB-SpecificIntegrityProtInfoList, implementationSpecificParams ImplementationSpecificParams OPTIONAL, -- User equipment IEs u-RNTI U-RNTI, c-RNTI C-RNTI OPTIONAL, ue-RadioAccessCapability UE-RadioAccessCapability, ue-Positioning-LastKnownPos UE-Positioning-LastKnownPos OPTIONAL, -- Other IEs ue-RATSpecificCapability InterRAT-UE-RadioAccessCapabilityList OPTIONAL, -- UTRAN mobility IEs ura-Identity URA-Identity OPTIONAL, -- Core network IEs cn-CommonGSM-MAP-NAS-SysInfo NAS-SystemInformationGSM-MAP, cn-DomainInformationList CN-DomainInformationList OPTIONAL, -- Measurement IEs ongoingMeasRepList OngoingMeasRepList OPTIONAL, -- Radio bearer IEs predefinedConfigStatusList PredefinedConfigStatusList, srb-InformationList SRB-InformationSetupList, rab-InformationList RAB-InformationSetupList OPTIONAL, -- Transport channel IEs ul-CommonTransChInfo UL-CommonTransChInfo OPTIONAL, ul-TransChInfoList UL-AddReconfTransChInfoList OPTIONAL, modeSpecificInfo CHOICE { fdd SEQUENCE { -- dummy and dummy2 are not used in this version of the specification, they should -- not be sent and if received they should be ignored. dummy CPCH-SetID OPTIONAL, dummy2 DRAC-StaticInformationList OPTIONAL }, tdd NULL }, dl-CommonTransChInfo DL-CommonTransChInfo OPTIONAL, dl-TransChInfoList DL-AddReconfTransChInfoList OPTIONAL, -- Measurement report measurementReport MeasurementReport OPTIONAL } SRNC-RelocationInfo-v380ext-IEs ::= SEQUENCE { -- Ciphering related information IEs -- In the SRNC-RelocationInfo-r3-IEs, the IE 'cn-DomainIdentity' is used to represent the -- IE 'Latest configured CN domain' in the tabular. cn-DomainIdentity CN-DomainIdentity, cipheringStatusList CipheringStatusList } SRNC-RelocationInfo-v390ext-IEs ::= SEQUENCE { cn-DomainInformationList-v390ext CN-DomainInformationList-v390ext OPTIONAL, ue-RadioAccessCapability-v370ext UE-RadioAccessCapability-v370ext OPTIONAL, ue-RadioAccessCapability-v380ext UE-RadioAccessCapability-v380ext OPTIONAL, dl-PhysChCapabilityFDD-v380ext DL-PhysChCapabilityFDD-v380ext, failureCauseWithProtErr FailureCauseWithProtErr OPTIONAL } SRNC-RelocationInfo-v3a0ext-IEs ::= SEQUENCE { cipheringInfoForSRB1-v3a0ext CipheringInfoPerRB-List-v3a0ext, ue-RadioAccessCapability-v3a0ext UE-RadioAccessCapability-v3a0ext OPTIONAL, -- cn-domain identity for IE startValueForCiphering-v3a0ext is specified -- in subsequent extension (SRNC-RelocationInfo-v3b0ext-IEs) startValueForCiphering-v3a0ext START-Value } SRNC-RelocationInfo-v3b0ext-IEs ::= SEQUENCE { -- cn-domain identity for IE startValueForCiphering-v3a0ext included in previous extension cn-DomainIdentity CN-DomainIdentity, -- the IE startValueForCiphering-v3b0ext contains the start values for each CN Domain. The -- value of start indicated by the IE startValueForCiphering-v3a0ext should be set to the -- same value as the start-Value for the corresponding cn-DomainIdentity in the IE -- startValueForCiphering-v3b0ext startValueForCiphering-v3b0ext STARTList2 OPTIONAL } SRNC-RelocationInfo-v3c0ext-IEs ::= SEQUENCE { -- IE rb-IdentityForHOMessage includes the identity of the RB used by the source SRNC -- to send the message contained in the IE 窶弋argetRNC-ToSourceRNC-Container窶. -- Only included if type is 窶弑E involved窶 rb-IdentityForHOMessage RB-Identity OPTIONAL } SRNC-RelocationInfo-v3d0ext-IEs ::= SEQUENCE { -- User equipment IEs uESpecificBehaviourInformation1idle UESpecificBehaviourInformation1idle OPTIONAL, uESpecificBehaviourInformation1interRAT UESpecificBehaviourInformation1interRAT OPTIONAL } SRNC-RelocationInfo-v3g0ext-IEs ::= SEQUENCE { ue-RadioAccessCapability-v3g0ext UE-RadioAccessCapability-v3g0ext OPTIONAL } SRNC-RelocationInfo-v3h0ext-IEs ::= SEQUENCE { tpc-CombinationInfoList TPC-CombinationInfoList OPTIONAL, nonCriticalExtension SEQUENCE {} OPTIONAL } SRNC-RelocationInfo-v4d0ext-IEs ::= SEQUENCE { tpc-CombinationInfoList TPC-CombinationInfoList OPTIONAL } TPC-CombinationInfoList ::= SEQUENCE (SIZE (1..maxRL)) OF TPC-Combination-Info STARTList2 ::= SEQUENCE (SIZE (2..maxCNdomains)) OF STARTSingle SRNC-RelocationInfo-v4b0ext-IEs ::= SEQUENCE { ue-RadioAccessCapability-v4b0ext UE-RadioAccessCapability-v4b0ext OPTIONAL } SRNC-RelocationInfo-v590ext-IEs ::= SEQUENCE { ue-RadioAccessCapability-v590ext UE-RadioAccessCapability-v590ext OPTIONAL, ue-RATSpecificCapability-v590ext InterRAT-UE-RadioAccessCapability-v590ext OPTIONAL } SRNC-RelocationInfo-v5a0ext-IEs ::= SEQUENCE { storedCompressedModeInfo StoredCompressedModeInfo OPTIONAL } SRNC-RelocationInfo-v5b0ext-IEs ::= SEQUENCE { interRATCellInfoIndication InterRATCellInfoIndication OPTIONAL } SRNC-RelocationInfo-v5c0ext-IEs ::= SEQUENCE { ue-RadioAccessCapability-v5c0ext UE-RadioAccessCapability-v5c0ext OPTIONAL } SRNC-RelocationInfo-v7xyext-IEs ::= SEQUENCE { ue-RadioAccessCapability-v7xyext UE-RadioAccessCapability-v7xyext OPTIONAL } CipheringInfoPerRB-List-v3a0ext ::= SEQUENCE { dl-UM-SN BIT STRING (SIZE (7)) } CipheringStatusList ::= SEQUENCE (SIZE (1..maxCNdomains)) OF CipheringStatusCNdomain CipheringStatusCNdomain ::= SEQUENCE { cn-DomainIdentity CN-DomainIdentity, cipheringStatus CipheringStatus } CodeChangeStatusList ::= SEQUENCE (SIZE (1..maxRL)) OF CodeChangeStatus CodeChangeStatus ::= SEQUENCE { primaryCPICH-Info PrimaryCPICH-Info, scramblingCodeChange ScramblingCodeChange } StoredCompressedModeInfo ::= SEQUENCE { storedTGP-SequenceList StoredTGP-SequenceList, codeChangeStatusList CodeChangeStatusList OPTIONAL } StoredTGP-SequenceList ::= SEQUENCE (SIZE (1..maxTGPS)) OF StoredTGP-Sequence StoredTGP-Sequence ::= SEQUENCE { tgpsi TGPSI, current-tgps-Status CHOICE { active SEQUENCE { tgcfn TGCFN }, inactive NULL }, tgps-ConfigurationParams TGPS-ConfigurationParams OPTIONAL } SRNC-RelocationInfo-r4-IEs ::= SEQUENCE { -- Non-RRC IEs -- IE rb-IdentityForHOMessage includes the identity of the RB used by the source SRNC -- to send the message contained in the IE 窶弋argetRNC-ToSourceRNC-Container窶. -- Only included if type is 窶弑E involved窶 rb-IdentityForHOMessage RB-Identity OPTIONAL, stateOfRRC StateOfRRC, stateOfRRC-Procedure StateOfRRC-Procedure, -- Ciphering related information IEs cipheringStatusList CipheringStatusList-r4, latestConfiguredCN-Domain CN-DomainIdentity, calculationTimeForCiphering CalculationTimeForCiphering OPTIONAL, count-C-List COUNT-C-List OPTIONAL, cipheringInfoPerRB-List CipheringInfoPerRB-List-r4 OPTIONAL, -- Integrity protection related information IEs integrityProtectionStatus IntegrityProtectionStatus, -- The target RNC may ignore the IE srb-SpecificIntegrityProtInfo if the -- IE integrityProtectionStatus has the value "not started". srb-SpecificIntegrityProtInfo SRB-SpecificIntegrityProtInfoList, implementationSpecificParams ImplementationSpecificParams OPTIONAL, -- User equipment IEs u-RNTI U-RNTI, c-RNTI C-RNTI OPTIONAL, ue-RadioAccessCapability UE-RadioAccessCapability-r4, ue-RadioAccessCapability-ext UE-RadioAccessCapabBandFDDList OPTIONAL, ue-Positioning-LastKnownPos UE-Positioning-LastKnownPos OPTIONAL, uESpecificBehaviourInformation1idle UESpecificBehaviourInformation1idle OPTIONAL, uESpecificBehaviourInformation1interRAT UESpecificBehaviourInformation1interRAT OPTIONAL, -- Other IEs ue-RATSpecificCapability InterRAT-UE-RadioAccessCapabilityList OPTIONAL, -- UTRAN mobility IEs ura-Identity URA-Identity OPTIONAL, -- Core network IEs cn-CommonGSM-MAP-NAS-SysInfo NAS-SystemInformationGSM-MAP, cn-DomainInformationList CN-DomainInformationListFull OPTIONAL, -- Measurement IEs ongoingMeasRepList OngoingMeasRepList-r4 OPTIONAL, -- Radio bearer IEs predefinedConfigStatusList PredefinedConfigStatusList, srb-InformationList SRB-InformationSetupList, rab-InformationList RAB-InformationSetupList-r4 OPTIONAL, -- Transport channel IEs ul-CommonTransChInfo UL-CommonTransChInfo-r4 OPTIONAL, ul-TransChInfoList UL-AddReconfTransChInfoList OPTIONAL, -- 'dummy', 'dummy1' and 'dummy2' are not used in this version of the specification, -- they should not be sent and if received they should be ignored. dummy CHOICE { fdd SEQUENCE { dummy1 CPCH-SetID OPTIONAL, dummy2 DRAC-StaticInformationList OPTIONAL }, tdd NULL } OPTIONAL, dl-CommonTransChInfo DL-CommonTransChInfo-r4 OPTIONAL, dl-TransChInfoList DL-AddReconfTransChInfoList-r4 OPTIONAL, -- Measurement report measurementReport MeasurementReport OPTIONAL, failureCause FailureCauseWithProtErr OPTIONAL } SRNC-RelocationInfo-r5-IEs ::= SEQUENCE { -- Non-RRC IEs -- IE rb-IdentityForHOMessage includes the identity of the RB used by the source SRNC -- to send the message contained in the IE 窶弋argetRNC-ToSourceRNC-Container窶. -- Only included if type is "UE involved" rb-IdentityForHOMessage RB-Identity OPTIONAL, stateOfRRC StateOfRRC, stateOfRRC-Procedure StateOfRRC-Procedure, -- Ciphering related information IEs cipheringStatusList CipheringStatusList-r4, latestConfiguredCN-Domain CN-DomainIdentity, calculationTimeForCiphering CalculationTimeForCiphering OPTIONAL, count-C-List COUNT-C-List OPTIONAL, cipheringInfoPerRB-List CipheringInfoPerRB-List-r4 OPTIONAL, -- Integrity protection related information IEs integrityProtectionStatus IntegrityProtectionStatus, srb-SpecificIntegrityProtInfo SRB-SpecificIntegrityProtInfoList OPTIONAL, implementationSpecificParams ImplementationSpecificParams OPTIONAL, -- User equipment IEs u-RNTI U-RNTI, c-RNTI C-RNTI OPTIONAL, ue-RadioAccessCapability UE-RadioAccessCapability-r5, ue-RadioAccessCapability-ext UE-RadioAccessCapabBandFDDList OPTIONAL, ue-Positioning-LastKnownPos UE-Positioning-LastKnownPos OPTIONAL, uESpecificBehaviourInformation1idle UESpecificBehaviourInformation1idle OPTIONAL, uESpecificBehaviourInformation1interRAT UESpecificBehaviourInformation1interRAT OPTIONAL, -- Other IEs ue-RATSpecificCapability InterRAT-UE-RadioAccessCapabilityList-r5 OPTIONAL, -- UTRAN mobility IEs ura-Identity URA-Identity OPTIONAL, -- Core network IEs cn-CommonGSM-MAP-NAS-SysInfo NAS-SystemInformationGSM-MAP, cn-DomainInformationList CN-DomainInformationListFull OPTIONAL, -- Measurement IEs ongoingMeasRepList OngoingMeasRepList-r5 OPTIONAL, -- Radio bearer IEs predefinedConfigStatusList PredefinedConfigStatusList, srb-InformationList SRB-InformationSetupList-r5, rab-InformationList RAB-InformationSetupList-r5 OPTIONAL, -- Transport channel IEs ul-CommonTransChInfo UL-CommonTransChInfo-r4 OPTIONAL, ul-TransChInfoList UL-AddReconfTransChInfoList OPTIONAL, -- 'dummy', 'dummy1' and 'dummy2' are not used in this version of the specification, -- they should not be sent and if received they should be ignored. dummy CHOICE { fdd SEQUENCE { dummy1 CPCH-SetID OPTIONAL, dummy2 DRAC-StaticInformationList OPTIONAL }, tdd NULL } OPTIONAL, dl-CommonTransChInfo DL-CommonTransChInfo-r4 OPTIONAL, dl-TransChInfoList DL-AddReconfTransChInfoList-r5 OPTIONAL, -- PhyCH IEs tpc-CombinationInfoList TPC-CombinationInfoList OPTIONAL, -- Measurement report measurementReport MeasurementReport OPTIONAL, -- Other IEs failureCause FailureCauseWithProtErr OPTIONAL } SRNC-RelocationInfo-v690ext-IEs ::= SEQUENCE { -- User equipment IEs -- IE ueCapabilityContainer is used for the transparent transfer of capability information -- received from the UE ueCapabilityContainer BIT STRING (CONTAINING UE-CapabilityContainer-IEs) OPTIONAL, -- IE ueCapabilityContainer-RSC and IE ueCapabilityContainer-UCI are used for the -- transparent transfer of capability information received from the UE that was introduced -- in a release independent manner, i.e., transferred within a VLEC. These UE capabilities -- are included both in the RRC CONNECTION SETUP COMPLETE and the UE CAPABILITY INFORMATION -- messages. Only the VLEC of one message needs to be included i.e. the one from these -- messages that was last received. -- Case 1: If the last received message was a RRC CONNECTION SETUP COMPLETE (RSC) ueCapabilityContainer-RSC BIT STRING (CONTAINING RRCConnectionSetupComplete-r3-add-ext-IEs) OPTIONAL, -- Case 2: If the last received message was a UE CAPABILITY INFORMATION (UCI) ueCapabilityContainer-UCI BIT STRING (CONTAINING UECapabilityInformation-r3-add-ext-IEs) OPTIONAL, -- Radio bearer IEs rab-InformationSetupList RAB-InformationSetupList-r6-ext OPTIONAL, -- Measurement report measuredResultsOnRACHinterFreq MeasuredResultsOnRACHinterFreq OPTIONAL, -- MBMS IEs mbms-JoinedInformation MBMS-JoinedInformation-r6 OPTIONAL, -- Measurement IEs intraFreqReportingCriteria IntraFreqReportingCriteria-r6-ext OPTIONAL } SRNC-RelocationInfo-r6-IEs ::= SEQUENCE { -- Non-RRC IEs -- IE rb-IdentityForHOMessage includes the identity of the RB used by the source SRNC -- to send the message contained in the IE 窶弋argetRNC-ToSourceRNC-Container窶. -- Only included if type is "UE involved" rb-IdentityForHOMessage RB-Identity OPTIONAL, stateOfRRC StateOfRRC, stateOfRRC-Procedure StateOfRRC-Procedure, -- Ciphering related information IEs cipheringStatusList CipheringStatusList-r4, latestConfiguredCN-Domain CN-DomainIdentity, calculationTimeForCiphering CalculationTimeForCiphering OPTIONAL, count-C-List COUNT-C-List OPTIONAL, cipheringInfoPerRB-List CipheringInfoPerRB-List-r4 OPTIONAL, -- Integrity protection related information IEs integrityProtectionStatus IntegrityProtectionStatus, srb-SpecificIntegrityProtInfo SRB-SpecificIntegrityProtInfoList OPTIONAL, implementationSpecificParams ImplementationSpecificParams OPTIONAL, -- User equipment IEs u-RNTI U-RNTI, c-RNTI C-RNTI OPTIONAL, ue-RadioAccessCapability UE-RadioAccessCapability-r6, ue-RadioAccessCapability-ext UE-RadioAccessCapabBandFDDList OPTIONAL, ue-Positioning-LastKnownPos UE-Positioning-LastKnownPos OPTIONAL, uESpecificBehaviourInformation1idle UESpecificBehaviourInformation1idle OPTIONAL, uESpecificBehaviourInformation1interRAT UESpecificBehaviourInformation1interRAT OPTIONAL, -- IE ueCapabilityContainer is used for the transparent transfer of capability information -- received from the UE ueCapabilityContainer BIT STRING (CONTAINING UE-CapabilityContainer-IEs) OPTIONAL, -- IE ueCapabilityContainer-RSC and IE ueCapabilityContainer-UCI are used for the -- transparent transfer of capability information received from the UE that was introduced -- in a release independent manner, i.e., transferred within a VLEC. These UE capabilities -- are included both in the RRC CONNECTION SETUP COMPLETE and the UE CAPABILITY INFORMATION -- messages. Only the VLEC of one message needs to be included i.e. the one from these -- messages that was last received. -- Case 1: If the last received message was a RRC CONNECTION SETUP COMPLETE (RSC) ueCapabilityContainer-RSC BIT STRING (CONTAINING RRCConnectionSetupComplete-r3-add-ext-IEs) OPTIONAL, -- Case 2: If the last received message was a UE CAPABILITY INFORMATION (UCI) ueCapabilityContainer-UCI BIT STRING (CONTAINING UECapabilityInformation-r3-add-ext-IEs) OPTIONAL, -- Other IEs ue-RATSpecificCapability InterRAT-UE-RadioAccessCapabilityList-r5 OPTIONAL, -- UTRAN mobility IEs ura-Identity URA-Identity OPTIONAL, -- Core network IEs cn-CommonGSM-MAP-NAS-SysInfo NAS-SystemInformationGSM-MAP, cn-DomainInformationList CN-DomainInformationListFull OPTIONAL, -- Measurement IEs ongoingMeasRepList OngoingMeasRepList-r6 OPTIONAL, interRATCellInfoIndication InterRATCellInfoIndication OPTIONAL, -- Radio bearer IEs predefinedConfigStatusList PredefinedConfigStatusList, srb-InformationList SRB-InformationSetupList-r6, rab-InformationList RAB-InformationSetupList-r6 OPTIONAL, -- Transport channel IEs ul-CommonTransChInfo UL-CommonTransChInfo-r4 OPTIONAL, ul-TransChInfoList UL-AddReconfTransChInfoList-r6 OPTIONAL, dl-CommonTransChInfo DL-CommonTransChInfo-r4 OPTIONAL, dl-TransChInfoList DL-AddReconfTransChInfoList-r5 OPTIONAL, -- PhyCH IEs tpc-CombinationInfoList TPC-CombinationInfoList OPTIONAL, storedCompressedModeInfo StoredCompressedModeInfo OPTIONAL, -- Measurement report measurementReport BIT STRING (CONTAINING MeasurementReport) OPTIONAL, -- Other IEs failureCause FailureCauseWithProtErr OPTIONAL, -- MBMS IEs mbms-JoinedInformation MBMS-JoinedInformation-r6 OPTIONAL } -- IE definitions CalculationTimeForCiphering ::= SEQUENCE { cell-Id CellIdentity, sfn INTEGER (0..4095) } CipheringInfoPerRB ::= SEQUENCE { dl-HFN BIT STRING (SIZE (20..25)), ul-HFN BIT STRING (SIZE (20..25)) } CipheringInfoPerRB-r4 ::= SEQUENCE { rb-Identity RB-Identity, dl-HFN BIT STRING (SIZE (20..25)), dl-UM-SN BIT STRING (SIZE (7)) OPTIONAL, ul-HFN BIT STRING (SIZE (20..25)) } -- TABULAR: CipheringInfoPerRB-List, multiplicity value numberOfRadioBearers -- has been replaced with maxRB. CipheringInfoPerRB-List ::= SEQUENCE (SIZE (1..maxRB)) OF CipheringInfoPerRB CipheringInfoPerRB-List-r4 ::= SEQUENCE (SIZE (1..maxRB)) OF CipheringInfoPerRB-r4 CipheringStatus ::= ENUMERATED { started, notStarted } CipheringStatusList-r4 ::= SEQUENCE (SIZE (1..maxCNdomains)) OF CipheringStatusCNdomain-r4 CipheringStatusCNdomain-r4 ::= SEQUENCE { cn-DomainIdentity CN-DomainIdentity, cipheringStatus CipheringStatus, start-Value START-Value } CN-DomainInformation-v390ext ::= SEQUENCE { cn-DRX-CycleLengthCoeff CN-DRX-CycleLengthCoefficient } CN-DomainInformationList-v390ext ::= SEQUENCE (SIZE (1..maxCNdomains)) OF CN-DomainInformation-v390ext CompressedModeMeasCapability-r4 ::= SEQUENCE { fdd-Measurements BOOLEAN, -- TABULAR: The IEs tdd-Measurements, gsm-Measurements and multiCarrierMeasurements -- are made optional since they are conditional based on another information element. -- Their absence corresponds to the case where the condition is not true. tdd384-Measurements BOOLEAN OPTIONAL, tdd128-Measurements BOOLEAN OPTIONAL, gsm-Measurements GSM-Measurements OPTIONAL, multiCarrierMeasurements BOOLEAN OPTIONAL } COUNT-C-List ::= SEQUENCE (SIZE (1..maxCNdomains)) OF COUNT-CSingle COUNT-CSingle ::= SEQUENCE { cn-DomainIdentity CN-DomainIdentity, count-C BIT STRING (SIZE (32)) } DL-PhysChCapabilityFDD-r4 ::= SEQUENCE { -- The IE 窶徇axNoDPCH-PDSCH-Codes窶 only gives information on the maximum number of DPCH Codes. maxNoDPCH-PDSCH-Codes INTEGER (1..8), maxNoPhysChBitsReceived MaxNoPhysChBitsReceived, supportForSF-512 BOOLEAN, -- dummy, dummy2 and dummy3 are not used in this version of the specification -- and if received they should be ignored. dummy BOOLEAN, dummy2 SimultaneousSCCPCH-DPCH-Reception, dummy3 SupportOfDedicatedPilotsForChEstimation OPTIONAL } DL-PhysChCapabilityFDD-r5 ::= SEQUENCE { -- The IE 窶徇axNoDPCH-PDSCH-Codes窶 only gives information on the maximum number of DPCH Codes. maxNoDPCH-PDSCH-Codes INTEGER (1..8), maxNoPhysChBitsReceived MaxNoPhysChBitsReceived, supportForSF-512 BOOLEAN, -- dummy, dumy2 and dummy3 are not used in this version of the specification -- and if received they should be ignored. dummy BOOLEAN, dummy2 SimultaneousSCCPCH-DPCH-Reception, dummy3 SupportOfDedicatedPilotsForChEstimation OPTIONAL, fdd-hspdsch CHOICE { supported SEQUENCE { hsdsch-physical-layer-category HSDSCH-physical-layer-category, -- dummy and dummy2 are not used in this version of the specification -- and if received they should be ignored. dummy BOOLEAN, dummy2 BOOLEAN }, unsupported NULL } } DL-PhysChCapabilityTDD-r5 ::= SEQUENCE { maxTS-PerFrame MaxTS-PerFrame, maxPhysChPerFrame MaxPhysChPerFrame, minimumSF MinimumSF-DL, supportOfPDSCH BOOLEAN, maxPhysChPerTS MaxPhysChPerTS, tdd384-hspdsch CHOICE { supported HSDSCH-physical-layer-category, unsupported NULL } } DL-PhysChCapabilityTDD-LCR-r5 ::= SEQUENCE { maxTS-PerSubFrame MaxTS-PerSubFrame-r4, maxPhysChPerFrame MaxPhysChPerSubFrame-r4, minimumSF MinimumSF-DL, supportOfPDSCH BOOLEAN, maxPhysChPerTS MaxPhysChPerTS, supportOf8PSK BOOLEAN, tdd128-hspdsch CHOICE { supported HSDSCH-physical-layer-category, unsupported NULL } } DL-RFC3095-Context ::= SEQUENCE { rfc3095-Context-Identity INTEGER (0..16383), dl-mode ENUMERATED {u, o, r}, dl-ref-ir OCTET STRING ( SIZE (1..3000)), dl-ref-time INTEGER (0..4294967295) OPTIONAL, dl-curr-time INTEGER (0..4294967295) OPTIONAL, dl-syn-offset-id INTEGER (0..65535) OPTIONAL, dl-syn-slope-ts INTEGER (0..4294967295) OPTIONAL, dl-dyn-changed BOOLEAN } ImplementationSpecificParams ::= BIT STRING (SIZE (1..512)) IntegrityProtectionStatus ::= ENUMERATED { started, notStarted } InterRAT-UE-RadioAccessCapabilityList-r5 ::= SEQUENCE { interRAT-UE-RadioAccessCapability InterRAT-UE-RadioAccessCapabilityList, geranIu-RadioAccessCapability GERANIu-RadioAccessCapability OPTIONAL } IntraFreqReportingCriteria-r6-ext ::= SEQUENCE { -- The content of the v690 non-critical extension should be -- considered as an extension of IE IntraFreqEventCriteriaList event Event1j-r6, hysteresis Hysteresis, timeToTrigger TimeToTrigger, reportingCellStatus ReportingCellStatus OPTIONAL } -- dummy is not used in this version of the specification, it should -- not be sent and if received it should be ignored. MaxHcContextSpace-r5 ::= ENUMERATED { dummy, by1024, by2048, by4096, by8192, by16384, by32768, by65536, by131072 } MeasurementCapability-r4 ::= SEQUENCE { downlinkCompressedMode CompressedModeMeasCapability-r4, uplinkCompressedMode CompressedModeMeasCapability-r4 } MeasurementCommandWithType ::= CHOICE { setup MeasurementType, modify NULL, release NULL } MeasurementCommandWithType-r4 ::= CHOICE { setup MeasurementType-r4, modify NULL, release NULL } MeasurementCommandWithType-r6 ::= CHOICE { setup MeasurementType-r6, modify NULL, release NULL } OngoingMeasRep ::= SEQUENCE { measurementIdentity MeasurementIdentity, -- TABULAR: The CHOICE Measurement in the tabular description is included -- in MeasurementCommandWithType measurementCommandWithType MeasurementCommandWithType, measurementReportingMode MeasurementReportingMode OPTIONAL, additionalMeasurementID-List AdditionalMeasurementID-List OPTIONAL } OngoingMeasRep-r4 ::= SEQUENCE { measurementIdentity MeasurementIdentity, -- TABULAR: The CHOICE Measurement in the tabular description is included -- in MeasurementCommandWithType-r4. measurementCommandWithType MeasurementCommandWithType-r4, measurementReportingMode MeasurementReportingMode OPTIONAL, additionalMeasurementID-List AdditionalMeasurementID-List OPTIONAL } OngoingMeasRep-r5 ::= SEQUENCE { measurementIdentity MeasurementIdentity, -- TABULAR: The CHOICE Measurement in the tabular description is included -- in MeasurementCommandWithType-r4. measurementCommandWithType MeasurementCommandWithType-r4, measurementReportingMode MeasurementReportingMode OPTIONAL, additionalMeasurementID-List AdditionalMeasurementID-List OPTIONAL, measurementCommand-v590ext CHOICE { -- the choice "intra-frequency" shall be used for the case of intra-frequency measurement, -- as well as when intra-frequency events are configured for inter-frequency measurement intra-frequency Intra-FreqEventCriteriaList-v590ext, inter-frequency Inter-FreqEventCriteriaList-v590ext } OPTIONAL, intraFreqReportingCriteria-1b-r5 IntraFreqReportingCriteria-1b-r5 OPTIONAL, intraFreqEvent-1d-r5 IntraFreqEvent-1d-r5 OPTIONAL } OngoingMeasRep-r6 ::= SEQUENCE { measurementIdentity MeasurementIdentity, measurementCommandWithType MeasurementCommandWithType-r6, measurementReportingMode MeasurementReportingMode OPTIONAL, additionalMeasurementID-List AdditionalMeasurementID-List OPTIONAL } OngoingMeasRepList ::= SEQUENCE (SIZE (1..maxNoOfMeas)) OF OngoingMeasRep OngoingMeasRepList-r4 ::= SEQUENCE (SIZE (1..maxNoOfMeas)) OF OngoingMeasRep-r4 OngoingMeasRepList-r5 ::= SEQUENCE (SIZE (1..maxNoOfMeas)) OF OngoingMeasRep-r5 OngoingMeasRepList-r6 ::= SEQUENCE (SIZE (1..maxNoOfMeas)) OF OngoingMeasRep-r6 PDCP-Capability-r4 ::= SEQUENCE { losslessSRNS-RelocationSupport BOOLEAN, supportForRfc2507 CHOICE { notSupported NULL, supported MaxHcContextSpace }, supportForRfc3095 CHOICE { notSupported NULL, supported SEQUENCE { maxROHC-ContextSessions MaxROHC-ContextSessions-r4 DEFAULT s16, reverseCompressionDepth INTEGER (0..65535) DEFAULT 0 } } } PDCP-Capability-r5 ::= SEQUENCE { losslessSRNS-RelocationSupport BOOLEAN, supportForRfc2507 CHOICE { notSupported NULL, supported MaxHcContextSpace-r5 }, supportForRfc3095 CHOICE { notSupported NULL, supported SEQUENCE { maxROHC-ContextSessions MaxROHC-ContextSessions-r4 DEFAULT s16, reverseCompressionDepth INTEGER (0..65535) DEFAULT 0, supportForRfc3095ContextRelocation BOOLEAN } } } PDCP-Capability-r6 ::= SEQUENCE { losslessSRNS-RelocationSupport BOOLEAN, losslessDLRLC-PDUSizeChange ENUMERATED { true } OPTIONAL, supportForRfc2507 CHOICE { notSupported NULL, supported MaxHcContextSpace-r5 }, supportForRfc3095 CHOICE { notSupported NULL, supported SEQUENCE { maxROHC-ContextSessions MaxROHC-ContextSessions-r4 DEFAULT s16, reverseCompressionDepth INTEGER (0..65535) DEFAULT 0, supportForRfc3095ContextRelocation BOOLEAN } } } PhysicalChannelCapability-r4 ::= SEQUENCE { fddPhysChCapability SEQUENCE { downlinkPhysChCapability DL-PhysChCapabilityFDD-r4, uplinkPhysChCapability UL-PhysChCapabilityFDD } OPTIONAL, tdd384-PhysChCapability SEQUENCE { downlinkPhysChCapability DL-PhysChCapabilityTDD, uplinkPhysChCapability UL-PhysChCapabilityTDD } OPTIONAL, tdd128-PhysChCapability SEQUENCE { downlinkPhysChCapability DL-PhysChCapabilityTDD-LCR-r4, uplinkPhysChCapability UL-PhysChCapabilityTDD-LCR-r4 } OPTIONAL } PhysicalChannelCapability-r5 ::= SEQUENCE { fddPhysChCapability SEQUENCE { downlinkPhysChCapability DL-PhysChCapabilityFDD-r5, uplinkPhysChCapability UL-PhysChCapabilityFDD } OPTIONAL, tdd384-PhysChCapability SEQUENCE { downlinkPhysChCapability DL-PhysChCapabilityTDD-r5, uplinkPhysChCapability UL-PhysChCapabilityTDD } OPTIONAL, tdd128-PhysChCapability SEQUENCE { downlinkPhysChCapability DL-PhysChCapabilityTDD-LCR-r5, uplinkPhysChCapability UL-PhysChCapabilityTDD-LCR-r4 } OPTIONAL } RF-Capability-r4 ::= SEQUENCE { fddRF-Capability SEQUENCE { ue-PowerClass UE-PowerClassExt, txRxFrequencySeparation TxRxFrequencySeparation } OPTIONAL, tdd384-RF-Capability SEQUENCE { ue-PowerClass UE-PowerClassExt, radioFrequencyBandTDDList RadioFrequencyBandTDDList, chipRateCapability ChipRateCapability } OPTIONAL, tdd128-RF-Capability SEQUENCE { ue-PowerClass UE-PowerClassExt, radioFrequencyBandTDDList RadioFrequencyBandTDDList, chipRateCapability ChipRateCapability } OPTIONAL } RFC3095-ContextInfo ::= SEQUENCE { rb-Identity RB-Identity, rfc3095-Context-List RFC3095-Context-List } RFC3095-Context-List ::= SEQUENCE (SIZE (1..maxRFC3095-CID)) OF SEQUENCE { dl-RFC3095-Context DL-RFC3095-Context OPTIONAL, ul-RFC3095-Context UL-RFC3095-Context OPTIONAL } RLC-Capability-r5 ::= SEQUENCE { totalRLC-AM-BufferSize TotalRLC-AM-BufferSize-r5, maximumRLC-WindowSize MaximumRLC-WindowSize, maximumAM-EntityNumber MaximumAM-EntityNumberRLC-Cap } SRB-SpecificIntegrityProtInfo ::= SEQUENCE { ul-RRC-HFN BIT STRING (SIZE (28)), dl-RRC-HFN BIT STRING (SIZE (28)), ul-RRC-SequenceNumber RRC-MessageSequenceNumber, dl-RRC-SequenceNumber RRC-MessageSequenceNumber } SRB-SpecificIntegrityProtInfoList ::= SEQUENCE (SIZE (4..maxSRBsetup)) OF SRB-SpecificIntegrityProtInfo StateOfRRC ::= ENUMERATED { cell-DCH, cell-FACH, cell-PCH, ura-PCH } StateOfRRC-Procedure ::= ENUMERATED { awaitNoRRC-Message, awaitRB-ReleaseComplete, awaitRB-SetupComplete, awaitRB-ReconfigurationComplete, awaitTransportCH-ReconfigurationComplete, awaitPhysicalCH-ReconfigurationComplete, awaitActiveSetUpdateComplete, awaitHandoverComplete, sendCellUpdateConfirm, sendUraUpdateConfirm, -- dummy is not used in this version of specification -- It should not be sent dummy, otherStates } TotalRLC-AM-BufferSize-r5 ::= ENUMERATED { kb10, kb50, kb100, kb150, kb200, kb300, kb400, kb500, kb750, kb1000 } TPC-Combination-Info ::= SEQUENCE { primaryCPICH-Info PrimaryCPICH-Info, tpc-CombinationIndex TPC-CombinationIndex } UE-MultiModeRAT-Capability-r5 ::= SEQUENCE { multiRAT-CapabilityList MultiRAT-Capability, multiModeCapability MultiModeCapability, supportOfUTRAN-ToGERAN-NACC BOOLEAN } UE-Positioning-Capability-r4 ::= SEQUENCE { standaloneLocMethodsSupported BOOLEAN, ue-BasedOTDOA-Supported BOOLEAN, networkAssistedGPS-Supported NetworkAssistedGPS-Supported, supportForUE-GPS-TimingOfCellFrames BOOLEAN, supportForIPDL BOOLEAN, rx-tx-TimeDifferenceType2Capable BOOLEAN, validity-CellPCH-UraPCH ENUMERATED { true } OPTIONAL, sfn-sfnType2Capability ENUMERATED { true } OPTIONAL } UE-Positioning-LastKnownPos ::= SEQUENCE { sfn INTEGER (0..4095), cell-id CellIdentity, positionEstimate PositionEstimate } UE-RadioAccessCapability-r4 ::= SEQUENCE { accessStratumReleaseIndicator AccessStratumReleaseIndicator, pdcp-Capability PDCP-Capability-r4, rlc-Capability RLC-Capability, transportChannelCapability TransportChannelCapability, rf-Capability RF-Capability-r4, physicalChannelCapability PhysicalChannelCapability-r4, ue-MultiModeRAT-Capability UE-MultiModeRAT-Capability, securityCapability SecurityCapability, ue-positioning-Capability UE-Positioning-Capability-r4, measurementCapability MeasurementCapability-r4 OPTIONAL } UE-RadioAccessCapability-r5 ::= SEQUENCE { accessStratumReleaseIndicator AccessStratumReleaseIndicator, dl-CapabilityWithSimultaneousHS-DSCHConfig DL-CapabilityWithSimultaneousHS-DSCHConfig OPTIONAL, pdcp-Capability PDCP-Capability-r5, rlc-Capability RLC-Capability-r5, transportChannelCapability TransportChannelCapability, rf-Capability RF-Capability-r4, physicalChannelCapability PhysicalChannelCapability-r5, ue-MultiModeRAT-Capability UE-MultiModeRAT-Capability-r5, securityCapability SecurityCapability, ue-positioning-Capability UE-Positioning-Capability-r4, measurementCapability MeasurementCapability-r4 OPTIONAL } UE-RadioAccessCapability-r6 ::= SEQUENCE { accessStratumReleaseIndicator AccessStratumReleaseIndicator, dl-CapabilityWithSimultaneousHS-DSCHConfig DL-CapabilityWithSimultaneousHS-DSCHConfig OPTIONAL, pdcp-Capability PDCP-Capability-r6, rlc-Capability RLC-Capability-r5, transportChannelCapability TransportChannelCapability, rf-Capability RF-Capability-r4, physicalChannelCapability PhysicalChannelCapability-r5, ue-MultiModeRAT-Capability UE-MultiModeRAT-Capability-r5, securityCapability SecurityCapability, ue-positioning-Capability UE-Positioning-Capability-r4, measurementCapability MeasurementCapability-r4 OPTIONAL } UE-RadioAccessCapability-r7 ::= SEQUENCE { accessStratumReleaseIndicator AccessStratumReleaseIndicator, dl-CapabilityWithSimultaneousHS-DSCHConfig DL-CapabilityWithSimultaneousHS-DSCHConfig OPTIONAL, pdcp-Capability PDCP-Capability-r6, rlc-Capability RLC-Capability-r5, transportChannelCapability TransportChannelCapability, rf-Capability RF-Capability-r7, physicalChannelCapability PhysicalChannelCapability-r7, ue-MultiModeRAT-Capability UE-MultiModeRAT-Capability-r5, securityCapability SecurityCapability, ue-positioning-Capability UE-Positioning-Capability-r4, measurementCapability MeasurementCapability-r4 OPTIONAL } UL-RFC3095-Context ::= SEQUENCE { rfc3095-Context-Identity INTEGER (0..16383), ul-mode ENUMERATED {u, o, r}, ul-ref-ir OCTET STRING ( SIZE (1..3000)), ul-ref-time INTEGER (0..4294967295) OPTIONAL, ul-curr-time INTEGER (0..4294967295) OPTIONAL, ul-syn-offset-id INTEGER (0..65535) OPTIONAL, ul-syn-slope-ts INTEGER (0..4294967295) OPTIONAL, ul-ref-sn-1 INTEGER (0..65535) OPTIONAL } END asn1c-0.9.28+dfsg/examples/sample.source.ULP/0000755000000000000000000000000013065714043017274 5ustar rootrootasn1c-0.9.28+dfsg/examples/sample.source.ULP/Makefile0000644000000000000000000002172413065714043020742 0ustar rootrootASN_MODULE_SOURCES= \ ULP-PDU.c \ UlpMessage.c \ SUPLINIT.c \ Notification.c \ NotificationType.c \ EncodingType.c \ FormatIndicator.c \ SLPMode.c \ MAC.c \ KeyIdentity.c \ SUPLSTART.c \ SETCapabilities.c \ PosTechnology.c \ PrefMethod.c \ PosProtocol.c \ SUPLRESPONSE.c \ SETAuthKey.c \ KeyIdentity4.c \ SUPLPOSINIT.c \ RequestedAssistData.c \ NavigationModel.c \ SatelliteInfo.c \ SatelliteInfoElement.c \ SUPLPOS.c \ PosPayLoad.c \ SUPLEND.c \ SUPLAUTHREQ.c \ SETNonce.c \ KeyIdentity2.c \ SUPLAUTHRESP.c \ SPCAuthKey.c \ KeyIdentity3.c \ Version.c \ SessionID.c \ SetSessionID.c \ SETId.c \ SlpSessionID.c \ IPAddress.c \ SLPAddress.c \ FQDN.c \ Ver.c \ LocationId.c \ Status.c \ CellInfo.c \ Position.c \ PositionEstimate.c \ AltitudeInfo.c \ CdmaCellInformation.c \ GsmCellInformation.c \ WcdmaCellInformation.c \ FrequencyInfo.c \ FrequencyInfoFDD.c \ FrequencyInfoTDD.c \ UARFCN.c \ NMR.c \ NMRelement.c \ MeasuredResultsList.c \ MeasuredResults.c \ CellMeasuredResultsList.c \ UTRA-CarrierRSSI.c \ CellMeasuredResults.c \ CellParametersID.c \ TGSN.c \ PrimaryCCPCH-RSCP.c \ TimeslotISCP.c \ TimeslotISCP-List.c \ PrimaryCPICH-Info.c \ CPICH-Ec-N0.c \ CPICH-RSCP.c \ Pathloss.c \ StatusCode.c \ QoP.c \ Velocity.c \ Horvel.c \ Horandvervel.c \ Horveluncert.c \ Horandveruncert.c \ PosMethod.c ASN_MODULE_HEADERS= \ ULP-PDU.h \ UlpMessage.h \ SUPLINIT.h \ Notification.h \ NotificationType.h \ EncodingType.h \ FormatIndicator.h \ SLPMode.h \ MAC.h \ KeyIdentity.h \ SUPLSTART.h \ SETCapabilities.h \ PosTechnology.h \ PrefMethod.h \ PosProtocol.h \ SUPLRESPONSE.h \ SETAuthKey.h \ KeyIdentity4.h \ SUPLPOSINIT.h \ RequestedAssistData.h \ NavigationModel.h \ SatelliteInfo.h \ SatelliteInfoElement.h \ SUPLPOS.h \ PosPayLoad.h \ SUPLEND.h \ SUPLAUTHREQ.h \ SETNonce.h \ KeyIdentity2.h \ SUPLAUTHRESP.h \ SPCAuthKey.h \ KeyIdentity3.h \ Version.h \ SessionID.h \ SetSessionID.h \ SETId.h \ SlpSessionID.h \ IPAddress.h \ SLPAddress.h \ FQDN.h \ Ver.h \ LocationId.h \ Status.h \ CellInfo.h \ Position.h \ PositionEstimate.h \ AltitudeInfo.h \ CdmaCellInformation.h \ GsmCellInformation.h \ WcdmaCellInformation.h \ FrequencyInfo.h \ FrequencyInfoFDD.h \ FrequencyInfoTDD.h \ UARFCN.h \ NMR.h \ NMRelement.h \ MeasuredResultsList.h \ MeasuredResults.h \ CellMeasuredResultsList.h \ UTRA-CarrierRSSI.h \ CellMeasuredResults.h \ CellParametersID.h \ TGSN.h \ PrimaryCCPCH-RSCP.h \ TimeslotISCP.h \ TimeslotISCP-List.h \ PrimaryCPICH-Info.h \ CPICH-Ec-N0.h \ CPICH-RSCP.h \ Pathloss.h \ StatusCode.h \ QoP.h \ Velocity.h \ Horvel.h \ Horandvervel.h \ Horveluncert.h \ Horandveruncert.h \ PosMethod.h ASN_MODULE_HEADERS+=BOOLEAN.h ASN_MODULE_SOURCES+=BOOLEAN.c ASN_MODULE_HEADERS+=ENUMERATED.h ASN_MODULE_SOURCES+=ENUMERATED.c ASN_MODULE_HEADERS+=INTEGER.h ASN_MODULE_HEADERS+=NativeEnumerated.h ASN_MODULE_HEADERS+=GeneralizedTime.h ASN_MODULE_SOURCES+=GeneralizedTime.c ASN_MODULE_HEADERS+=IA5String.h ASN_MODULE_SOURCES+=IA5String.c ASN_MODULE_SOURCES+=INTEGER.c ASN_MODULE_SOURCES+=NativeEnumerated.c ASN_MODULE_HEADERS+=NativeInteger.h ASN_MODULE_SOURCES+=NativeInteger.c ASN_MODULE_HEADERS+=UTCTime.h ASN_MODULE_SOURCES+=UTCTime.c ASN_MODULE_HEADERS+=VisibleString.h ASN_MODULE_SOURCES+=VisibleString.c ASN_MODULE_HEADERS+=asn_SEQUENCE_OF.h ASN_MODULE_SOURCES+=asn_SEQUENCE_OF.c ASN_MODULE_HEADERS+=asn_SET_OF.h ASN_MODULE_SOURCES+=asn_SET_OF.c ASN_MODULE_HEADERS+=constr_CHOICE.h ASN_MODULE_SOURCES+=constr_CHOICE.c ASN_MODULE_HEADERS+=constr_SEQUENCE.h ASN_MODULE_SOURCES+=constr_SEQUENCE.c ASN_MODULE_HEADERS+=constr_SEQUENCE_OF.h ASN_MODULE_SOURCES+=constr_SEQUENCE_OF.c ASN_MODULE_HEADERS+=constr_SET_OF.h ASN_MODULE_SOURCES+=constr_SET_OF.c ASN_MODULE_HEADERS+=asn_application.h ASN_MODULE_HEADERS+=asn_system.h ASN_MODULE_HEADERS+=asn_codecs.h ASN_MODULE_HEADERS+=asn_internal.h ASN_MODULE_HEADERS+=OCTET_STRING.h ASN_MODULE_SOURCES+=OCTET_STRING.c ASN_MODULE_HEADERS+=BIT_STRING.h ASN_MODULE_SOURCES+=BIT_STRING.c ASN_MODULE_SOURCES+=asn_codecs_prim.c ASN_MODULE_HEADERS+=asn_codecs_prim.h ASN_MODULE_HEADERS+=ber_tlv_length.h ASN_MODULE_SOURCES+=ber_tlv_length.c ASN_MODULE_HEADERS+=ber_tlv_tag.h ASN_MODULE_SOURCES+=ber_tlv_tag.c ASN_MODULE_HEADERS+=ber_decoder.h ASN_MODULE_SOURCES+=ber_decoder.c ASN_MODULE_HEADERS+=der_encoder.h ASN_MODULE_SOURCES+=der_encoder.c ASN_MODULE_HEADERS+=constr_TYPE.h ASN_MODULE_SOURCES+=constr_TYPE.c ASN_MODULE_HEADERS+=constraints.h ASN_MODULE_SOURCES+=constraints.c ASN_MODULE_HEADERS+=xer_support.h ASN_MODULE_SOURCES+=xer_support.c ASN_MODULE_HEADERS+=xer_decoder.h ASN_MODULE_SOURCES+=xer_decoder.c ASN_MODULE_HEADERS+=xer_encoder.h ASN_MODULE_SOURCES+=xer_encoder.c ASN_MODULE_HEADERS+=per_support.h ASN_MODULE_SOURCES+=per_support.c ASN_MODULE_HEADERS+=per_decoder.h ASN_MODULE_SOURCES+=per_decoder.c ASN_MODULE_HEADERS+=per_encoder.h ASN_MODULE_SOURCES+=per_encoder.c ASN_MODULE_HEADERS+=per_opentype.h ASN_MODULE_SOURCES+=per_opentype.c ASN_CONVERTER_SOURCES+=converter-sample.c ASN_CONVERTER_SOURCES+=pdu_collection.c lib_LTLIBRARIES=libsomething.la libsomething_la_SOURCES=$(ASN_MODULE_SOURCES) $(ASN_MODULE_HEADERS) # This file may be used as an input for make(3) # Remove the lines below to convert it into a pure .am file TARGET = ulp-dump CFLAGS += -DASN_CONVERTER_TITLE="OMA UserPlane Location Protocol decoder" -DHAVE_CONFIG_H -DJUNKTEST -DPDU=ULP_PDU -DASN_PDU_COLLECTION -I. OBJS=${ASN_MODULE_SOURCES:.c=.o} ${ASN_CONVERTER_SOURCES:.c=.o} all: ULP-PDU.c $(TARGET) $(TARGET): ${OBJS} $(CC) $(CFLAGS) -o $(TARGET) ${OBJS} $(LDFLAGS) $(LIBS) .SUFFIXES: .SUFFIXES: .c .o .c.o: $(CC) $(CFLAGS) -o $@ -c $< clean: rm -f $(TARGET) rm -f $(OBJS) regen: regenerate-from-asn1-source regenerate-from-asn1-source: ../../asn1c/asn1c -S ../../skeletons -pdu=ULP-PDU -pdu=SUPLINIT -fcompound-names -gen-PER ../ulp.asn1 ULP-PDU.c: ../sample.makefile.regen ../ulp.asn1 make regen-makefile @touch ULP-PDU.c make regen-makefile: TITLE="OMA UserPlane Location Protocol decoder" \ ASN1CMDOPTS="-pdu=SUPLINIT -fcompound-names -gen-PER" \ ASN1MODULES="../ulp.asn1" \ ASN1PDU=ULP-PDU \ PROGNAME=ulp-dump \ ../sample.makefile.regen check: ${TARGET} check-ber check-xer check-per @echo ================ @echo All tests passed @echo ================ check-ber: @if test -f sample-ULP-PDU-1.[db]er ; then \ for f in sample-ULP-PDU-*.[db]er; do \ for b in 1 17 33 980 8192; do \ echo "Recoding $$f into XER and back ($$b)..."; \ ./${TARGET} -b $$b -iber -oxer $$f > ./.tmp.1.$$$$ || exit 2; \ ./${TARGET} -b $$b -ixer -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \ diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 4; \ rm -f ./.tmp.[12].$$$$; \ echo "Test junking $$f (please wait)..."; \ ./${TARGET} -J0.0001 -n 1000 -b $$b -iber -onull $$f || exit 5; \ ./${TARGET} -J0.001 -n 1000 -b $$b -iber -onull $$f || exit 6; \ done; done; fi check-xer: @if test -f sample-ULP-PDU-1.xer ; then \ for f in sample-ULP-PDU-*.xer; do \ for b in 1 17 33 980 8192; do \ echo "Recoding $$f into DER and back ($$b)..."; \ ./${TARGET} -b $$b -ixer -oder $$f > ./.tmp.1.$$$$ || exit 2; \ ./${TARGET} -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \ diff $$f ./.tmp.2.$$$$ || exit 4; \ rm -f ./.tmp.[12].$$$$; \ echo "Test junking $$f (please wait)..."; \ ./${TARGET} -J0.0001 -n 1000 -b $$b -ixer -onull $$f || exit 5; \ ./${TARGET} -J0.001 -n 1000 -b $$b -ixer -onull $$f || exit 6; \ done; done; fi check-per: @if test -f sample-ULP-PDU-1-nopad.per ; then \ for f in sample-ULP-PDU-[1-9]-nopad.per; do \ for b in 1 17 33 980 8192; do \ echo "Recoding non-padded $$f into DER into XER and back ($$b)..."; \ ./${TARGET} -b $$b -per-nopad -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \ ./${TARGET} -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \ ./${TARGET} -b $$b -ixer -oder ./.tmp.2.$$$$ > ./.tmp.3.$$$$ || exit 4; \ diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 5; \ rm -f ./.tmp.[123].$$$$; \ echo "Test junking $$f (please wait)..."; \ ./${TARGET} -J0.0001 -n 1000 -b $$b -per-nopad -iper -onull $$f || exit 6; \ ./${TARGET} -J0.001 -n 1000 -b $$b -per-nopad -iper -onull $$f || exit 7; \ done; done; fi @if test -f sample-ULP-PDU-1.per ; then \ for f in sample-*-[1-9].per; do \ pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z-]+)-[0-9].*/\1/"`; \ for b in 1 17 33 980 8192; do \ echo "Recoding $$f into DER into XER and back ($$b)..."; \ ./${TARGET} -b $$b -p $$pdu -iper -oder $$f > ./.tmp.1.$$$$ || exit 3; \ ./${TARGET} -b $$b -p $$pdu -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 4; \ ./${TARGET} -b $$b -p $$pdu -ixer -oper ./.tmp.2.$$$$ > ./.tmp.1.$$$$ || exit 5; \ diff $$f ./.tmp.1.$$$$ || exit 6; \ rm -f ./.tmp.[12].$$$$; \ echo "Test junking $$f (please wait)..."; \ ./${TARGET} -J0.0001 -n 1000 -b $$b -iper -onull $$f || exit 7; \ ./${TARGET} -J0.001 -n 1000 -b $$b -iper -onull $$f || exit 8; \ done; done; fi distclean: clean rm -f $(ASN_MODULE_SOURCES) rm -f $(ASN_MODULE_HEADERS) rm -f $(ASN_CONVERTER_SOURCES) $(ASN_CONVERTER_HEADERS) rm -f Makefile.am.sample asn1c-0.9.28+dfsg/examples/sample.source.ULP/sample-ULP-PDU-1.xer0000644000000000000000000000323013065714043022515 0ustar rootroot 29 1 0 0 1 61 01 08 34 06 04 00 F0 310 41 2021 12044 4 15 7 asn1c-0.9.28+dfsg/examples/sample.source.ULP/README0000644000000000000000000000350013065714043020152 0ustar rootroot GENERAL INFORMATION =================== The OMA ULP (UserPlane Location Protocol) decoder. Invoking `make` will compile the ASN.1 specifications from the ../ulp.asn1 file. THERE IS NO ulp.asn1 FILE THERE YET! OBTAINING THE ULP SPECIFICATION =============================== Due to unclear stanza of Open Mobile Alliance regarding the extraction of ASN.1 modules from their documents, and also due to some OMA membership concerns, asn1c can not include the ULP ASN.1 module in its distribution. To obtain the ULP ASN.1 specification, you should go to http://www.openmobilealliance.org/UseAgreement.html and agree with their licensing terms by clicking the "I ACCEPT" button. Then, go to http://member.openmobilealliance.org/ftp/Public_documents/LOC/Permanent_documents/ and download the necessary specification file. For example, one of these: Version 1.0 specifications (Candidate versions): OMA-TS-ULP-V1_0-20070122-C.zip (V1.0, 2007 January 22) OMA-TS-ULP-V1_0-20070613-C.zip (V1.0, 2007 June 13) Version 2.0 specification (Draft version): OMA-TS-ULP-V2_0-20070625-D.zip (V2.0, 2007 April 25) A .ZIP file with several Microsoft Word .DOC files will download shortly. You should extract the ASN.1 module from the section 8 of these .DOC files and save it as the ../ulp.asn1 file. The ../ulp.asn1 file should start with the following line "ULP DEFINITIONS IMPLICIT TAGS ::=" and end with the "END" token. Be careful not to copy any non-ASN.1 preambles from that .DOC file. After obtaining the tap3.asn1, type `make` in the directory containing this README file. ulp-dump USAGE ============== The ulp-dump utility may be used to dump the contents of the PER-encoded ULP message record file: ./ulp-dump ulpfile.per # Print as XML (BASIC-XER) The full list of recognized command line options may be obtained with > ./ulp-dump -h asn1c-0.9.28+dfsg/examples/sample.source.ULP/sample-ULP-PDU-1.per0000644000000000000000000000003513065714043022505 0ustar rootrootA ミタQ@`、半0ィAasn1c-0.9.28+dfsg/examples/sample.source.ULP/sample-ULP-PDU-2.per0000644000000000000000000000001013065714043022477 0ustar rootroot タasn1c-0.9.28+dfsg/examples/sample.source.ULP/config.h0000644000000000000000000000031013065714043020704 0ustar rootroot extern int opt_debug; #define ASN_DEBUG(fmt, args...) do { \ if(opt_debug < 2) break; \ fprintf(stderr, fmt, ##args); \ fprintf(stderr, " (%s:%d)\n", \ __FILE__, __LINE__); \ } while(0) asn1c-0.9.28+dfsg/examples/sample.source.PKIX1/0000755000000000000000000000000013065714043017470 5ustar rootrootasn1c-0.9.28+dfsg/examples/sample.source.PKIX1/Makefile0000644000000000000000000003054113065714043021133 0ustar rootrootASN_MODULE_SOURCES= \ Attribute.c \ AttributeType.c \ AttributeValue.c \ AttributeTypeAndValue.c \ X520name.c \ X520CommonName.c \ X520LocalityName.c \ X520StateOrProvinceName.c \ X520OrganizationName.c \ X520OrganizationalUnitName.c \ X520Title.c \ X520dnQualifier.c \ X520countryName.c \ X520SerialNumber.c \ X520Pseudonym.c \ DomainComponent.c \ EmailAddress.c \ Name.c \ RDNSequence.c \ DistinguishedName.c \ RelativeDistinguishedName.c \ DirectoryString.c \ Certificate.c \ TBSCertificate.c \ Version.c \ CertificateSerialNumber.c \ Validity.c \ Time.c \ UniqueIdentifier.c \ SubjectPublicKeyInfo.c \ Extensions.c \ Extension.c \ CertificateList.c \ TBSCertList.c \ AlgorithmIdentifier.c \ ORAddress.c \ BuiltInStandardAttributes.c \ CountryName.c \ AdministrationDomainName.c \ NetworkAddress.c \ X121Address.c \ TerminalIdentifier.c \ PrivateDomainName.c \ OrganizationName.c \ NumericUserIdentifier.c \ PersonalName.c \ OrganizationalUnitNames.c \ OrganizationalUnitName.c \ BuiltInDomainDefinedAttributes.c \ BuiltInDomainDefinedAttribute.c \ ExtensionAttributes.c \ ExtensionAttribute.c \ CommonName.c \ TeletexCommonName.c \ TeletexOrganizationName.c \ TeletexPersonalName.c \ TeletexOrganizationalUnitNames.c \ TeletexOrganizationalUnitName.c \ PDSName.c \ PhysicalDeliveryCountryName.c \ PostalCode.c \ PhysicalDeliveryOfficeName.c \ PhysicalDeliveryOfficeNumber.c \ ExtensionORAddressComponents.c \ PhysicalDeliveryPersonalName.c \ PhysicalDeliveryOrganizationName.c \ ExtensionPhysicalDeliveryAddressComponents.c \ UnformattedPostalAddress.c \ StreetAddress.c \ PostOfficeBoxAddress.c \ PosteRestanteAddress.c \ UniquePostalName.c \ LocalPostalAttributes.c \ PDSParameter.c \ ExtendedNetworkAddress.c \ PresentationAddress.c \ TerminalType.c \ TeletexDomainDefinedAttributes.c \ TeletexDomainDefinedAttribute.c \ AuthorityKeyIdentifier.c \ KeyIdentifier.c \ SubjectKeyIdentifier.c \ KeyUsage.c \ PrivateKeyUsagePeriod.c \ CertificatePolicies.c \ PolicyInformation.c \ CertPolicyId.c \ PolicyQualifierInfo.c \ PolicyQualifierId.c \ CPSuri.c \ UserNotice.c \ NoticeReference.c \ DisplayText.c \ PolicyMappings.c \ SubjectAltName.c \ GeneralNames.c \ GeneralName.c \ AnotherName.c \ EDIPartyName.c \ IssuerAltName.c \ SubjectDirectoryAttributes.c \ BasicConstraints.c \ NameConstraints.c \ GeneralSubtrees.c \ GeneralSubtree.c \ BaseDistance.c \ PolicyConstraints.c \ SkipCerts.c \ CRLDistributionPoints.c \ DistributionPoint.c \ DistributionPointName.c \ ReasonFlags.c \ ExtKeyUsageSyntax.c \ KeyPurposeId.c \ InhibitAnyPolicy.c \ FreshestCRL.c \ AuthorityInfoAccessSyntax.c \ AccessDescription.c \ SubjectInfoAccessSyntax.c \ CRLNumber.c \ IssuingDistributionPoint.c \ BaseCRLNumber.c \ CRLReason.c \ CertificateIssuer.c \ HoldInstructionCode.c \ InvalidityDate.c ASN_MODULE_HEADERS= \ Attribute.h \ AttributeType.h \ AttributeValue.h \ AttributeTypeAndValue.h \ X520name.h \ X520CommonName.h \ X520LocalityName.h \ X520StateOrProvinceName.h \ X520OrganizationName.h \ X520OrganizationalUnitName.h \ X520Title.h \ X520dnQualifier.h \ X520countryName.h \ X520SerialNumber.h \ X520Pseudonym.h \ DomainComponent.h \ EmailAddress.h \ Name.h \ RDNSequence.h \ DistinguishedName.h \ RelativeDistinguishedName.h \ DirectoryString.h \ Certificate.h \ TBSCertificate.h \ Version.h \ CertificateSerialNumber.h \ Validity.h \ Time.h \ UniqueIdentifier.h \ SubjectPublicKeyInfo.h \ Extensions.h \ Extension.h \ CertificateList.h \ TBSCertList.h \ AlgorithmIdentifier.h \ ORAddress.h \ BuiltInStandardAttributes.h \ CountryName.h \ AdministrationDomainName.h \ NetworkAddress.h \ X121Address.h \ TerminalIdentifier.h \ PrivateDomainName.h \ OrganizationName.h \ NumericUserIdentifier.h \ PersonalName.h \ OrganizationalUnitNames.h \ OrganizationalUnitName.h \ BuiltInDomainDefinedAttributes.h \ BuiltInDomainDefinedAttribute.h \ ExtensionAttributes.h \ ExtensionAttribute.h \ CommonName.h \ TeletexCommonName.h \ TeletexOrganizationName.h \ TeletexPersonalName.h \ TeletexOrganizationalUnitNames.h \ TeletexOrganizationalUnitName.h \ PDSName.h \ PhysicalDeliveryCountryName.h \ PostalCode.h \ PhysicalDeliveryOfficeName.h \ PhysicalDeliveryOfficeNumber.h \ ExtensionORAddressComponents.h \ PhysicalDeliveryPersonalName.h \ PhysicalDeliveryOrganizationName.h \ ExtensionPhysicalDeliveryAddressComponents.h \ UnformattedPostalAddress.h \ StreetAddress.h \ PostOfficeBoxAddress.h \ PosteRestanteAddress.h \ UniquePostalName.h \ LocalPostalAttributes.h \ PDSParameter.h \ ExtendedNetworkAddress.h \ PresentationAddress.h \ TerminalType.h \ TeletexDomainDefinedAttributes.h \ TeletexDomainDefinedAttribute.h \ AuthorityKeyIdentifier.h \ KeyIdentifier.h \ SubjectKeyIdentifier.h \ KeyUsage.h \ PrivateKeyUsagePeriod.h \ CertificatePolicies.h \ PolicyInformation.h \ CertPolicyId.h \ PolicyQualifierInfo.h \ PolicyQualifierId.h \ CPSuri.h \ UserNotice.h \ NoticeReference.h \ DisplayText.h \ PolicyMappings.h \ SubjectAltName.h \ GeneralNames.h \ GeneralName.h \ AnotherName.h \ EDIPartyName.h \ IssuerAltName.h \ SubjectDirectoryAttributes.h \ BasicConstraints.h \ NameConstraints.h \ GeneralSubtrees.h \ GeneralSubtree.h \ BaseDistance.h \ PolicyConstraints.h \ SkipCerts.h \ CRLDistributionPoints.h \ DistributionPoint.h \ DistributionPointName.h \ ReasonFlags.h \ ExtKeyUsageSyntax.h \ KeyPurposeId.h \ InhibitAnyPolicy.h \ FreshestCRL.h \ AuthorityInfoAccessSyntax.h \ AccessDescription.h \ SubjectInfoAccessSyntax.h \ CRLNumber.h \ IssuingDistributionPoint.h \ BaseCRLNumber.h \ CRLReason.h \ CertificateIssuer.h \ HoldInstructionCode.h \ InvalidityDate.h ASN_MODULE_HEADERS+=ANY.h ASN_MODULE_SOURCES+=ANY.c ASN_MODULE_HEADERS+=BMPString.h ASN_MODULE_SOURCES+=BMPString.c ASN_MODULE_HEADERS+=UTF8String.h ASN_MODULE_HEADERS+=BOOLEAN.h ASN_MODULE_SOURCES+=BOOLEAN.c ASN_MODULE_HEADERS+=INTEGER.h ASN_MODULE_HEADERS+=NativeEnumerated.h ASN_MODULE_HEADERS+=GeneralizedTime.h ASN_MODULE_SOURCES+=GeneralizedTime.c ASN_MODULE_HEADERS+=IA5String.h ASN_MODULE_SOURCES+=IA5String.c ASN_MODULE_SOURCES+=INTEGER.c ASN_MODULE_SOURCES+=NativeEnumerated.c ASN_MODULE_HEADERS+=NativeInteger.h ASN_MODULE_SOURCES+=NativeInteger.c ASN_MODULE_HEADERS+=NumericString.h ASN_MODULE_SOURCES+=NumericString.c ASN_MODULE_HEADERS+=OBJECT_IDENTIFIER.h ASN_MODULE_SOURCES+=OBJECT_IDENTIFIER.c ASN_MODULE_HEADERS+=PrintableString.h ASN_MODULE_SOURCES+=PrintableString.c ASN_MODULE_HEADERS+=TeletexString.h ASN_MODULE_SOURCES+=TeletexString.c ASN_MODULE_HEADERS+=UTCTime.h ASN_MODULE_SOURCES+=UTCTime.c ASN_MODULE_SOURCES+=UTF8String.c ASN_MODULE_HEADERS+=UniversalString.h ASN_MODULE_SOURCES+=UniversalString.c ASN_MODULE_HEADERS+=VisibleString.h ASN_MODULE_SOURCES+=VisibleString.c ASN_MODULE_HEADERS+=asn_SEQUENCE_OF.h ASN_MODULE_SOURCES+=asn_SEQUENCE_OF.c ASN_MODULE_HEADERS+=asn_SET_OF.h ASN_MODULE_SOURCES+=asn_SET_OF.c ASN_MODULE_HEADERS+=constr_CHOICE.h ASN_MODULE_SOURCES+=constr_CHOICE.c ASN_MODULE_HEADERS+=constr_SEQUENCE.h ASN_MODULE_SOURCES+=constr_SEQUENCE.c ASN_MODULE_HEADERS+=constr_SEQUENCE_OF.h ASN_MODULE_SOURCES+=constr_SEQUENCE_OF.c ASN_MODULE_HEADERS+=constr_SET_OF.h ASN_MODULE_HEADERS+=constr_SET.h ASN_MODULE_SOURCES+=constr_SET.c ASN_MODULE_SOURCES+=constr_SET_OF.c ASN_MODULE_HEADERS+=asn_application.h ASN_MODULE_HEADERS+=asn_system.h ASN_MODULE_HEADERS+=asn_codecs.h ASN_MODULE_HEADERS+=asn_internal.h ASN_MODULE_HEADERS+=OCTET_STRING.h ASN_MODULE_SOURCES+=OCTET_STRING.c ASN_MODULE_HEADERS+=BIT_STRING.h ASN_MODULE_SOURCES+=BIT_STRING.c ASN_MODULE_SOURCES+=asn_codecs_prim.c ASN_MODULE_HEADERS+=asn_codecs_prim.h ASN_MODULE_HEADERS+=ber_tlv_length.h ASN_MODULE_SOURCES+=ber_tlv_length.c ASN_MODULE_HEADERS+=ber_tlv_tag.h ASN_MODULE_SOURCES+=ber_tlv_tag.c ASN_MODULE_HEADERS+=ber_decoder.h ASN_MODULE_SOURCES+=ber_decoder.c ASN_MODULE_HEADERS+=der_encoder.h ASN_MODULE_SOURCES+=der_encoder.c ASN_MODULE_HEADERS+=constr_TYPE.h ASN_MODULE_SOURCES+=constr_TYPE.c ASN_MODULE_HEADERS+=constraints.h ASN_MODULE_SOURCES+=constraints.c ASN_MODULE_HEADERS+=xer_support.h ASN_MODULE_SOURCES+=xer_support.c ASN_MODULE_HEADERS+=xer_decoder.h ASN_MODULE_SOURCES+=xer_decoder.c ASN_MODULE_HEADERS+=xer_encoder.h ASN_MODULE_SOURCES+=xer_encoder.c ASN_MODULE_HEADERS+=per_support.h ASN_MODULE_SOURCES+=per_support.c ASN_MODULE_HEADERS+=per_decoder.h ASN_MODULE_SOURCES+=per_decoder.c ASN_MODULE_HEADERS+=per_encoder.h ASN_MODULE_SOURCES+=per_encoder.c ASN_MODULE_HEADERS+=per_opentype.h ASN_MODULE_SOURCES+=per_opentype.c ASN_CONVERTER_SOURCES+=converter-sample.c lib_LTLIBRARIES=libsomething.la libsomething_la_SOURCES=$(ASN_MODULE_SOURCES) $(ASN_MODULE_HEADERS) # This file may be used as an input for make(3) # Remove the lines below to convert it into a pure .am file TARGET = x509dump CFLAGS += -DHAVE_CONFIG_H -DJUNKTEST -DPDU=Certificate -I. OBJS=${ASN_MODULE_SOURCES:.c=.o} ${ASN_CONVERTER_SOURCES:.c=.o} all: Certificate.c $(TARGET) $(TARGET): ${OBJS} $(CC) $(CFLAGS) -o $(TARGET) ${OBJS} $(LDFLAGS) $(LIBS) .SUFFIXES: .SUFFIXES: .c .o .c.o: $(CC) $(CFLAGS) -o $@ -c $< clean: rm -f $(TARGET) rm -f $(OBJS) regen: regenerate-from-asn1-source regenerate-from-asn1-source: ../../asn1c/asn1c -S ../../skeletons -pdu=Certificate ../rfc3280-PKIX1Explicit88.asn1 ../rfc3280-PKIX1Implicit88.asn1 Certificate.c: ../sample.makefile.regen ../rfc3280-*.asn1 make regen-makefile @touch Certificate.c make regen-makefile: ASN1CMDOPTS="" \ ASN1MODULES="../rfc3280-*.asn1" \ ASN1PDU=Certificate \ PROGNAME=x509dump \ ../sample.makefile.regen check: ${TARGET} check-ber check-xer check-per @echo ================ @echo All tests passed @echo ================ check-ber: @if test -f sample-Certificate-1.[db]er ; then \ for f in sample-Certificate-*.[db]er; do \ for b in 1 17 33 980 8192; do \ echo "Recoding $$f into XER and back ($$b)..."; \ ./${TARGET} -b $$b -iber -oxer $$f > ./.tmp.1.$$$$ || exit 2; \ ./${TARGET} -b $$b -ixer -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \ diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 4; \ rm -f ./.tmp.[12].$$$$; \ echo "Test junking $$f (please wait)..."; \ ./${TARGET} -J0.0001 -n 1000 -b $$b -iber -onull $$f || exit 5; \ ./${TARGET} -J0.001 -n 1000 -b $$b -iber -onull $$f || exit 6; \ done; done; fi check-xer: @if test -f sample-Certificate-1.xer ; then \ for f in sample-Certificate-*.xer; do \ for b in 1 17 33 980 8192; do \ echo "Recoding $$f into DER and back ($$b)..."; \ ./${TARGET} -b $$b -ixer -oder $$f > ./.tmp.1.$$$$ || exit 2; \ ./${TARGET} -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \ diff $$f ./.tmp.2.$$$$ || exit 4; \ rm -f ./.tmp.[12].$$$$; \ echo "Test junking $$f (please wait)..."; \ ./${TARGET} -J0.0001 -n 1000 -b $$b -ixer -onull $$f || exit 5; \ ./${TARGET} -J0.001 -n 1000 -b $$b -ixer -onull $$f || exit 6; \ done; done; fi check-per: @if test -f sample-Certificate-1-nopad.per ; then \ for f in sample-Certificate-[1-9]-nopad.per; do \ for b in 1 17 33 980 8192; do \ echo "Recoding non-padded $$f into DER into XER and back ($$b)..."; \ ./${TARGET} -b $$b -per-nopad -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \ ./${TARGET} -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \ ./${TARGET} -b $$b -ixer -oder ./.tmp.2.$$$$ > ./.tmp.3.$$$$ || exit 4; \ diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 5; \ rm -f ./.tmp.[123].$$$$; \ echo "Test junking $$f (please wait)..."; \ ./${TARGET} -J0.0001 -n 1000 -b $$b -per-nopad -iper -onull $$f || exit 6; \ ./${TARGET} -J0.001 -n 1000 -b $$b -per-nopad -iper -onull $$f || exit 7; \ done; done; fi @if test -f sample-Certificate-1.per ; then \ for f in sample-*-[1-9].per; do \ pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z-]+)-[0-9].*/\1/"`; \ for b in 1 17 33 980 8192; do \ echo "Recoding $$f into DER into XER and back ($$b)..."; \ ./${TARGET} -b $$b -p $$pdu -iper -oder $$f > ./.tmp.1.$$$$ || exit 3; \ ./${TARGET} -b $$b -p $$pdu -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 4; \ ./${TARGET} -b $$b -p $$pdu -ixer -oper ./.tmp.2.$$$$ > ./.tmp.1.$$$$ || exit 5; \ diff $$f ./.tmp.1.$$$$ || exit 6; \ rm -f ./.tmp.[12].$$$$; \ echo "Test junking $$f (please wait)..."; \ ./${TARGET} -J0.0001 -n 1000 -b $$b -iper -onull $$f || exit 7; \ ./${TARGET} -J0.001 -n 1000 -b $$b -iper -onull $$f || exit 8; \ done; done; fi distclean: clean rm -f $(ASN_MODULE_SOURCES) rm -f $(ASN_MODULE_HEADERS) rm -f $(ASN_CONVERTER_SOURCES) $(ASN_CONVERTER_HEADERS) rm -f Makefile.am.sample asn1c-0.9.28+dfsg/examples/sample.source.PKIX1/sample-Certificate-1.der0000644000000000000000000000215013065714043024021 0ustar rootroot0d0LDセ 輝$エモ60Kタ3w0  *H 0▲1 0 UUS1 0 UUT10USalt Lake City10U The USERTRUST Network1!0U http://www.usertrust.com1+0)U"UTN-USERFirst-Network Applications0 990709184839Z 190709185749Z0▲1 0 UUS1 0 UUT10USalt Lake City10U The USERTRUST Network1!0U http://www.usertrust.com1+0)U"UTN-USERFirst-Network Applications0"0  *H 0 ウ贈6Uャ4[唸イオwΠ2アv檀#Jノv?纜カ7yケォi%カg莢saJ閙ヘモ/d罔| 」 G碓Qq/?ク遠% 咾J$v(Y5。タd ,モI、エタaQh操ヒ・ユ;:^`Yァ4rクxナム;Jo~e'ケ、UナケoC、ナ,丗R、xLウ@kCニーz{k"?ヒィミ:Kv榑ムニ.聟W2「クo閹ヲ?pォ蚪牒D@P悒b舁nネ゙窶B/靜2楯差」5<ン榲ョ律」¢0℃0 Uニ0U00Uノロ犲騙Kィヨ゚モ疔<0OUH0F0DB@>http://crl.usertrust.com/UTN-USERFirst-NetworkApplications.crl0  *H 、%フムヤ巣"ミフ2ォ尠N4禅 %4a_*瘠ェ}dQマ シ}リ!jxヒ/QoB3スオ{氾テゥ-゚ム)?サィE*ムnU$篏1?セ霈@+ヤV8萍Dしa !ge 4・ツ悒\@燈゙Oヤ'ゥカ・ヘs1?クe'マヤSャn欅 〒)トZスdWrュ;マ7ヲ佝ュエワ」ユ)、繭gJ形E暃#垈徂オ榔モ.弾アH>!セ0* オ 」k?ョW翻゚oン0,e@JヘhケrqvT jヲ8ャトasn1c-0.9.28+dfsg/examples/sample.source.PKIX1/README0000644000000000000000000000160613065714043020353 0ustar rootroot GENERAL INFORMATION =================== The X.509 (PKIX1) certificate decoder. Invoking `make` will compile the ASN.1 specifications from the rfc3280.txt in the above directory. x509dump USAGE ============== To use the x509dump, you'll have to prepare an X.509 certificate in DER encoding. The typical X.509 certificate will have a PEM format (DER encoded data wrapped in base64, wrapped in PEM "BEGIN" and "END" sections). The openssl x509 utility may be used to convert between PEM and DER. EXAMPLE: Convert 'certificate.pem' into 'certificate.der': openssl x509 -inform PEM -in certificate.pem \ -outform DER -out certificate.der After convertsion, the x509dump utility may be used to dump the contents of the DER-encoded X.509 certificate: ./x509dump certificate.der # Print as XML (BASIC-XER) The full list of recognized command line options may be obtained with > ./x509dump -h asn1c-0.9.28+dfsg/examples/sample.source.PKIX1/config.h0000644000000000000000000000031013065714043021100 0ustar rootroot extern int opt_debug; #define ASN_DEBUG(fmt, args...) do { \ if(opt_debug < 2) break; \ fprintf(stderr, fmt, ##args); \ fprintf(stderr, " (%s:%d)\n", \ __FILE__, __LINE__); \ } while(0) asn1c-0.9.28+dfsg/libasn1print/0000755000000000000000000000000013065714043014645 5ustar rootrootasn1c-0.9.28+dfsg/libasn1print/Makefile.am0000644000000000000000000000031213065714043016675 0ustar rootroot AM_CFLAGS = @ADD_CFLAGS@ AM_CPPFLAGS = \ -I$(top_srcdir)/libasn1parser \ -I$(top_srcdir)/libasn1fix noinst_LTLIBRARIES = libasn1print.la libasn1print_la_SOURCES = \ asn1print.c asn1print.h asn1c-0.9.28+dfsg/libasn1print/asn1print.h0000644000000000000000000000075713065714043016746 0ustar rootroot#ifndef ASN1PRINT_H #define ASN1PRINT_H enum asn1print_flags { APF_NOFLAGS, APF_NOINDENT = 0x01, /* Disable indentation */ APF_LINE_COMMENTS = 0x02, /* Include line comments */ APF_PRINT_XML_DTD = 0x04, /* Generate XML DTD */ APF_PRINT_CONSTRAINTS = 0x08, /* Explain constraints */ APF_PRINT_CLASS_MATRIX = 0x10, /* Dump class matrix */ }; /* * Print the contents of the parsed ASN.1 syntax tree. */ int asn1print(asn1p_t *asn, enum asn1print_flags flags); #endif /* ASN1PRINT_H */ asn1c-0.9.28+dfsg/libasn1print/README0000644000000000000000000000023013065714043015520 0ustar rootroot Ad hoc ASN tree printing procedures. Use for debugging purposes, this library isn't thought through enough to be universally useful or even accurate. asn1c-0.9.28+dfsg/libasn1print/asn1print.c0000644000000000000000000005737013065714043016744 0ustar rootroot#include #include #include #include #include #include #include #include #include "asn1print.h" #define INDENT(fmt, args...) do { \ if(!(flags & APF_NOINDENT)) { \ int tmp_i = level; \ while(tmp_i--) safe_printf(" "); \ } \ safe_printf(fmt, ##args); \ } while(0) static int asn1print_module(asn1p_t *asn, asn1p_module_t *mod, enum asn1print_flags flags); static int asn1print_oid(int prior_len, asn1p_oid_t *oid, enum asn1print_flags flags); static int asn1print_ref(asn1p_ref_t *ref, enum asn1print_flags flags); static int asn1print_tag(asn1p_expr_t *tc, enum asn1print_flags flags); static int asn1print_params(asn1p_paramlist_t *pl,enum asn1print_flags flags); static int asn1print_with_syntax(asn1p_wsyntx_t *wx, enum asn1print_flags flags); static int asn1print_constraint(asn1p_constraint_t *, enum asn1print_flags); static int asn1print_value(asn1p_value_t *val, enum asn1print_flags flags); static int asn1print_expr(asn1p_t *asn, asn1p_module_t *mod, asn1p_expr_t *tc, enum asn1print_flags flags, int level); static int asn1print_expr_dtd(asn1p_t *asn, asn1p_module_t *mod, asn1p_expr_t *tc, enum asn1print_flags flags, int level); /* Check printf's error code, to be pedantic. */ static int safe_printf(const char *fmt, ...) { va_list ap; va_start(ap, fmt); int ret = vprintf(fmt, ap); assert(ret >= 0); va_end(ap); return ret; } /* Pedantically check fwrite's return value. */ static size_t safe_fwrite(const void *ptr, size_t size, size_t nitems, FILE *stream) { size_t ret = fwrite(ptr, 1, size * nitems, stream); assert(ret == size * nitems); return ret; } /* * Print the contents of the parsed ASN tree. */ int asn1print(asn1p_t *asn, enum asn1print_flags flags) { asn1p_module_t *mod; int modno = 0; if(asn == NULL) { errno = EINVAL; return -1; } if(flags & APF_PRINT_XML_DTD) safe_printf("\n\n"); TQ_FOR(mod, &(asn->modules), mod_next) { if(mod->_tags & MT_STANDARD_MODULE) return 0; /* Ignore modules imported from skeletons */ if(modno++) safe_printf("\n"); asn1print_module(asn, mod, flags); } if(flags & APF_PRINT_XML_DTD) { /* Values for BOOLEAN */ safe_printf("\n"); safe_printf("\n"); } return 0; } static int asn1print_module(asn1p_t *asn, asn1p_module_t *mod, enum asn1print_flags flags) { asn1p_expr_t *tc; if(flags & APF_PRINT_XML_DTD) safe_printf("\n\n"); TQ_FOR(tc, &(mod->members), next) { asn1print_expr_dtd(asn, mod, tc, flags, 0); } return 0; } safe_printf("DEFINITIONS"); if(mod->module_flags & MSF_TAG_INSTRUCTIONS) safe_printf(" TAG INSTRUCTIONS"); if(mod->module_flags & MSF_XER_INSTRUCTIONS) safe_printf(" XER INSTRUCTIONS"); if(mod->module_flags & MSF_EXPLICIT_TAGS) safe_printf(" EXPLICIT TAGS"); if(mod->module_flags & MSF_IMPLICIT_TAGS) safe_printf(" IMPLICIT TAGS"); if(mod->module_flags & MSF_AUTOMATIC_TAGS) safe_printf(" AUTOMATIC TAGS"); if(mod->module_flags & MSF_EXTENSIBILITY_IMPLIED) safe_printf(" EXTENSIBILITY IMPLIED"); safe_printf(" ::=\n"); safe_printf("BEGIN\n\n"); TQ_FOR(tc, &(mod->members), next) { asn1print_expr(asn, mod, tc, flags, 0); if(flags & APF_PRINT_CONSTRAINTS) safe_printf("\n"); else safe_printf("\n\n"); } safe_printf("END\n"); return 0; } static int asn1print_oid(int prior_len, asn1p_oid_t *oid, enum asn1print_flags flags) { size_t accum = prior_len; int ac; (void)flags; /* Unused argument */ safe_printf("{"); for(ac = 0; ac < oid->arcs_count; ac++) { const char *arcname = oid->arcs[ac].name; if(accum + strlen(arcname ? arcname : "") > 72) { safe_printf("\n\t"); accum = 8; } else { accum += safe_printf(" "); } if(arcname) { accum += safe_printf("%s", arcname); if(oid->arcs[ac].number >= 0) { accum += safe_printf("(%" PRIdASN ")", oid->arcs[ac].number); } } else { accum += safe_printf("%" PRIdASN, oid->arcs[ac].number); } } safe_printf(" }"); return 0; } static int asn1print_ref(asn1p_ref_t *ref, enum asn1print_flags flags) { int cc; (void)flags; /* Unused argument */ for(cc = 0; cc < ref->comp_count; cc++) { if(cc) safe_printf("."); safe_printf("%s", ref->components[cc].name); } return 0; } static int asn1print_tag(asn1p_expr_t *tc, enum asn1print_flags flags) { struct asn1p_type_tag_s *tag = &tc->tag; (void)flags; /* Unused argument */ safe_printf("%s", asn1p_tag2string(tag, 0)); return 0; } static int asn1print_value(asn1p_value_t *val, enum asn1print_flags flags) { if(val == NULL) return 0; switch(val->type) { case ATV_NOVALUE: break; case ATV_NULL: safe_printf("NULL"); return 0; case ATV_REAL: safe_printf("%f", val->value.v_double); return 0; case ATV_TYPE: asn1print_expr(val->value.v_type->module->asn1p, val->value.v_type->module, val->value.v_type, flags, 0); return 0; case ATV_INTEGER: safe_printf("%" PRIdASN, val->value.v_integer); return 0; case ATV_MIN: safe_printf("MIN"); return 0; case ATV_MAX: safe_printf("MAX"); return 0; case ATV_FALSE: safe_printf("FALSE"); return 0; case ATV_TRUE: safe_printf("TRUE"); return 0; case ATV_TUPLE: safe_printf("{%d, %d}", (int)(val->value.v_integer >> 4), (int)(val->value.v_integer & 0x0f)); return 0; case ATV_QUADRUPLE: safe_printf("{%d, %d, %d, %d}", (int)((val->value.v_integer >> 24) & 0xff), (int)((val->value.v_integer >> 16) & 0xff), (int)((val->value.v_integer >> 8) & 0xff), (int)((val->value.v_integer >> 0) & 0xff) ); return 0; case ATV_STRING: { char *p = (char *)val->value.string.buf; putchar('"'); if(strchr(p, '"')) { /* Mask quotes */ for(; *p; p++) { if(*p == '"') putchar(*p); putchar(*p); } } else { fputs(p, stdout); } putchar('"'); } return 0; case ATV_UNPARSED: fputs((char *)val->value.string.buf, stdout); return 0; case ATV_BITVECTOR: { uint8_t *bitvector; int bits; int i; bitvector = val->value.binary_vector.bits; bits = val->value.binary_vector.size_in_bits; safe_printf("'"); if(bits%8) { for(i = 0; i < bits; i++) { uint8_t uc; uc = bitvector[i>>3]; putchar(((uc >> (7-(i%8)))&1)?'1':'0'); } safe_printf("'B"); } else { char hextable[16] = "0123456789ABCDEF"; for(i = 0; i < (bits>>3); i++) { putchar(hextable[bitvector[i] >> 4]); putchar(hextable[bitvector[i] & 0x0f]); } safe_printf("'H"); } return 0; } case ATV_REFERENCED: return asn1print_ref(val->value.reference, flags); case ATV_VALUESET: return asn1print_constraint(val->value.constraint, flags); case ATV_CHOICE_IDENTIFIER: safe_printf("%s: ", val->value.choice_identifier.identifier); return asn1print_value(val->value.choice_identifier.value, flags); } assert(val->type || !"Unknown"); return 0; } static int asn1print_constraint(asn1p_constraint_t *ct, enum asn1print_flags flags) { int symno = 0; if(ct == 0) return 0; if(ct->type == ACT_CA_SET) safe_printf("("); switch(ct->type) { case ACT_EL_TYPE: asn1print_value(ct->containedSubtype, flags); break; case ACT_EL_VALUE: asn1print_value(ct->value, flags); break; case ACT_EL_RANGE: case ACT_EL_LLRANGE: case ACT_EL_RLRANGE: case ACT_EL_ULRANGE: asn1print_value(ct->range_start, flags); switch(ct->type) { case ACT_EL_RANGE: safe_printf(".."); break; case ACT_EL_LLRANGE: safe_printf("<.."); break; case ACT_EL_RLRANGE: safe_printf("..<"); break; case ACT_EL_ULRANGE: safe_printf("<..<"); break; default: safe_printf("?..?"); break; } asn1print_value(ct->range_stop, flags); break; case ACT_EL_EXT: safe_printf("..."); break; case ACT_CT_SIZE: case ACT_CT_FROM: switch(ct->type) { case ACT_CT_SIZE: safe_printf("SIZE("); break; case ACT_CT_FROM: safe_printf("FROM("); break; default: safe_printf("??? ("); break; } assert(ct->el_count != 0); assert(ct->el_count == 1); asn1print_constraint(ct->elements[0], flags); safe_printf(")"); break; case ACT_CT_WCOMP: assert(ct->el_count != 0); assert(ct->el_count == 1); safe_printf("WITH COMPONENT ("); asn1print_constraint(ct->elements[0], flags); safe_printf(")"); break; case ACT_CT_WCOMPS: { unsigned int i; safe_printf("WITH COMPONENTS { "); for(i = 0; i < ct->el_count; i++) { asn1p_constraint_t *cel = ct->elements[i]; if(i) safe_printf(", "); safe_fwrite(cel->value->value.string.buf, 1, cel->value->value.string.size, stdout); if(cel->el_count) { assert(cel->el_count == 1); safe_printf(" "); asn1print_constraint(cel->elements[0], flags); } switch(cel->presence) { case ACPRES_DEFAULT: break; case ACPRES_PRESENT: safe_printf(" PRESENT"); break; case ACPRES_ABSENT: safe_printf(" ABSENT"); break; case ACPRES_OPTIONAL: safe_printf(" OPTIONAL");break; } } safe_printf(" }"); } break; case ACT_CT_CTDBY: safe_printf("CONSTRAINED BY "); assert(ct->value->type == ATV_UNPARSED); safe_fwrite(ct->value->value.string.buf, 1, ct->value->value.string.size, stdout); break; case ACT_CT_CTNG: safe_printf("CONTAINING "); asn1print_expr(ct->value->value.v_type->module->asn1p, ct->value->value.v_type->module, ct->value->value.v_type, flags, 1); break; case ACT_CT_PATTERN: safe_printf("PATTERN "); asn1print_value(ct->value, flags); break; case ACT_CA_SET: symno++; case ACT_CA_CRC: symno++; case ACT_CA_CSV: symno++; case ACT_CA_UNI: symno++; case ACT_CA_INT: symno++; case ACT_CA_EXC: { char *symtable[] = { " EXCEPT ", " ^ ", " | ", ",", "", "(" }; unsigned int i; for(i = 0; i < ct->el_count; i++) { if(i) fputs(symtable[symno], stdout); if(ct->type == ACT_CA_CRC) fputs("{", stdout); asn1print_constraint(ct->elements[i], flags); if(ct->type == ACT_CA_CRC) fputs("}", stdout); if(i+1 < ct->el_count && ct->type == ACT_CA_SET) fputs(")", stdout); } } break; case ACT_CA_AEX: assert(ct->el_count == 1); safe_printf("ALL EXCEPT "); asn1print_constraint(ct->elements[0], flags); break; case ACT_INVALID: assert(ct->type != ACT_INVALID); break; } if(ct->type == ACT_CA_SET) safe_printf(")"); return 0; } static int asn1print_params(asn1p_paramlist_t *pl, enum asn1print_flags flags) { if(pl) { int i; safe_printf("{"); for(i = 0; i < pl->params_count; i++) { if(i) safe_printf(", "); if(pl->params[i].governor) { asn1print_ref(pl->params[i].governor, flags); safe_printf(":"); } safe_printf("%s", pl->params[i].argument); } safe_printf("}"); } return 0; } static int asn1print_with_syntax(asn1p_wsyntx_t *wx, enum asn1print_flags flags) { if(wx) { asn1p_wsyntx_chunk_t *wc; TQ_FOR(wc, &(wx->chunks), next) { switch(wc->type) { case WC_LITERAL: case WC_WHITESPACE: case WC_FIELD: safe_printf("%s", wc->content.token); break; case WC_OPTIONALGROUP: safe_printf("["); asn1print_with_syntax(wc->content.syntax,flags); safe_printf("]"); break; } } } return 0; } static int asn1print_crange_value(asn1cnst_edge_t *edge, int as_char) { switch(edge->type) { case ARE_MIN: safe_printf("MIN"); break; case ARE_MAX: safe_printf("MAX"); break; case ARE_VALUE: if(as_char) { safe_printf("\"%c\"", (unsigned char)edge->value); } else { safe_printf("%" PRIdASN, edge->value); } } return 0; } static int asn1print_constraint_explain_type(asn1p_expr_type_e expr_type, asn1p_constraint_t *ct, enum asn1p_constraint_type_e type, int strict_PER_visible) { asn1cnst_range_t *range; int as_char = (type==ACT_CT_FROM); int i; range = asn1constraint_compute_PER_range(expr_type, ct, type, 0, 0, strict_PER_visible ? CPR_strict_PER_visibility : 0); if(!range) return -1; if(range->incompatible || (strict_PER_visible && range->not_PER_visible)) { asn1constraint_range_free(range); return 0; } switch(type) { case ACT_CT_FROM: safe_printf("(FROM("); break; case ACT_CT_SIZE: safe_printf("(SIZE("); break; default: safe_printf("("); break; } for(i = -1; i < range->el_count; i++) { asn1cnst_range_t *r; if(i == -1) { if(range->el_count) continue; r = range; } else { r = range->elements[i]; } if(i > 0) { safe_printf(" | "); } asn1print_crange_value(&r->left, as_char); if(r->left.type != r->right.type || r->left.value != r->right.value) { safe_printf(".."); asn1print_crange_value(&r->right, as_char); } } if(range->extensible) safe_printf(",..."); safe_printf(type==ACT_EL_RANGE?")":"))"); if(range->empty_constraint) safe_printf(":Empty!"); asn1constraint_range_free(range); return 0; } static int asn1print_constraint_explain(asn1p_expr_type_e expr_type, asn1p_constraint_t *ct, int s_PV) { asn1print_constraint_explain_type(expr_type, ct, ACT_EL_RANGE, s_PV); safe_printf(" "); asn1print_constraint_explain_type(expr_type, ct, ACT_CT_SIZE, s_PV); safe_printf(" "); asn1print_constraint_explain_type(expr_type, ct, ACT_CT_FROM, s_PV); return 0; } static int asn1print_expr(asn1p_t *asn, asn1p_module_t *mod, asn1p_expr_t *tc, enum asn1print_flags flags, int level) { int SEQ_OF = 0; if(flags & APF_LINE_COMMENTS && !(flags & APF_NOINDENT)) INDENT("-- #line %d\n", tc->_lineno); /* Reconstruct compiler directive information */ if((tc->marker.flags & EM_INDIRECT) && (tc->marker.flags & EM_OMITABLE) != EM_OMITABLE) { if((flags & APF_NOINDENT)) safe_printf(" ---- "); else INDENT("----\n"); } if(tc->Identifier && (!(tc->meta_type == AMT_VALUE && tc->expr_type == A1TC_REFERENCE) || level == 0)) INDENT("%s", tc->Identifier); if(tc->lhs_params) { asn1print_params(tc->lhs_params, flags); } if(tc->meta_type != AMT_VALUE && tc->meta_type != AMT_VALUESET && tc->expr_type != A1TC_EXTENSIBLE) { if(level) { if(tc->Identifier && !(flags & APF_NOINDENT)) safe_printf("\t"); } else { safe_printf(" ::="); } } if(tc->tag.tag_class) { safe_printf(" "); asn1print_tag(tc, flags); } switch(tc->expr_type) { case A1TC_EXTENSIBLE: if(tc->value) { safe_printf("!"); asn1print_value(tc->value, flags); } break; case A1TC_COMPONENTS_OF: SEQ_OF = 1; /* Equivalent to SET OF for printint purposes */ safe_printf(" COMPONENTS OF"); break; case A1TC_REFERENCE: case A1TC_UNIVERVAL: break; case A1TC_CLASSDEF: safe_printf(" CLASS"); break; case A1TC_CLASSFIELD_TFS ... A1TC_CLASSFIELD_OSFS: /* Nothing to print here */ break; case ASN_CONSTR_SET_OF: case ASN_CONSTR_SEQUENCE_OF: SEQ_OF = 1; if(tc->expr_type == ASN_CONSTR_SET_OF) safe_printf(" SET"); else safe_printf(" SEQUENCE"); if(tc->constraints) { safe_printf(" "); asn1print_constraint(tc->constraints, flags); } safe_printf(" OF"); break; case A1TC_VALUESET: break; default: { char *p = ASN_EXPR_TYPE2STR(tc->expr_type); safe_printf(" %s", p?p:""); } break; } /* * Put the name of the referred type. */ if(tc->reference) { safe_printf(" "); asn1print_ref(tc->reference, flags); } if(tc->meta_type == AMT_VALUESET && level == 0) safe_printf(" ::="); /* * Display the descendants (children) of the current type. */ if(TQ_FIRST(&(tc->members)) || (tc->expr_type & ASN_CONSTR_MASK) || tc->meta_type == AMT_OBJECT || tc->meta_type == AMT_OBJECTCLASS || tc->meta_type == AMT_OBJECTFIELD ) { asn1p_expr_t *se; /* SubExpression */ int put_braces = (!SEQ_OF) /* Don't need 'em, if SET OF... */ && (tc->meta_type != AMT_OBJECTFIELD); if(put_braces) { if(flags & APF_NOINDENT) { safe_printf("{"); if(!TQ_FIRST(&tc->members)) safe_printf("}"); } else { safe_printf(" {"); if(TQ_FIRST(&tc->members)) safe_printf("\n"); else safe_printf(" }"); } } TQ_FOR(se, &(tc->members), next) { /* * Print the expression as it were a stand-alone type. */ asn1print_expr(asn, mod, se, flags, level + 1); if((se->marker.flags & EM_DEFAULT) == EM_DEFAULT) { safe_printf(" DEFAULT "); asn1print_value(se->marker.default_value, flags); } else if((se->marker.flags & EM_OPTIONAL) == EM_OPTIONAL) { safe_printf(" OPTIONAL"); } if(TQ_NEXT(se, next)) { safe_printf(","); if(!(flags & APF_NOINDENT)) INDENT("\n"); } } if(put_braces && TQ_FIRST(&tc->members)) { if(!(flags & APF_NOINDENT)) safe_printf("\n"); INDENT("}"); } } if(tc->with_syntax) { safe_printf(" WITH SYNTAX {"); asn1print_with_syntax(tc->with_syntax, flags); safe_printf("}\n"); } /* Right hand specialization */ if(tc->rhs_pspecs) { asn1p_expr_t *se; safe_printf("{"); TQ_FOR(se, &(tc->rhs_pspecs->members), next) { asn1print_expr(asn, mod, se, flags, level + 1); if(TQ_NEXT(se, next)) safe_printf(", "); } safe_printf("}"); } if(!SEQ_OF && tc->constraints) { safe_printf(" "); if(tc->meta_type == AMT_VALUESET) safe_printf("{"); asn1print_constraint(tc->constraints, flags); if(tc->meta_type == AMT_VALUESET) safe_printf("}"); } if(tc->unique) { safe_printf(" UNIQUE"); } if(tc->meta_type == AMT_VALUE && tc->expr_type != A1TC_EXTENSIBLE) { if(tc->expr_type == A1TC_UNIVERVAL) { if(tc->value) { safe_printf("("); asn1print_value(tc->value, flags); safe_printf(")"); } } else { if(level == 0) safe_printf(" ::= "); asn1print_value(tc->value, flags); } } /* * The following section exists entirely for debugging. */ if(flags & APF_PRINT_CONSTRAINTS && tc->expr_type != A1TC_EXTENSIBLE) { asn1p_expr_t *top_parent; if(tc->combined_constraints) { safe_printf("\n-- Combined constraints: "); asn1print_constraint(tc->combined_constraints, flags); } top_parent = asn1f_find_terminal_type_ex(asn, tc); if(top_parent) { safe_printf("\n-- Practical constraints (%s): ", top_parent->Identifier); asn1print_constraint_explain(top_parent->expr_type, tc->combined_constraints, 0); safe_printf("\n-- PER-visible constraints (%s): ", top_parent->Identifier); asn1print_constraint_explain(top_parent->expr_type, tc->combined_constraints, 1); } safe_printf("\n"); } if(flags & APF_PRINT_CLASS_MATRIX && tc->expr_type == A1TC_CLASSDEF) do { int r, col, maxidlen; if(tc->object_class_matrix.rows == 0) { safe_printf("\n-- Class matrix is empty"); break; } safe_printf("\n-- Class matrix has %d entr%s:\n", tc->object_class_matrix.rows, tc->object_class_matrix.rows==1 ? "y" : "ies"); maxidlen = tc->object_class_matrix.max_identifier_length; for(r = -1; r < tc->object_class_matrix.rows; r++) { struct asn1p_ioc_row_s *row; row = tc->object_class_matrix.row[r<0?0:r]; if(r < 0) safe_printf("-- %s", r > 9 ? " " : ""); else safe_printf("-- [%*d]", r > 9 ? 2 : 1, r+1); for(col = 0; col < row->columns; col++) { struct asn1p_ioc_cell_s *cell; cell = &row->column[col]; if(r < 0) { safe_printf("[%*s]", maxidlen, cell->field->Identifier); continue; } if(!cell->value) { safe_printf(" %*s ", maxidlen, ""); continue; } safe_printf(" %*s ", maxidlen, cell->value->Identifier); } safe_printf("\n"); } } while(0); if(flags & APF_PRINT_CLASS_MATRIX && tc->lhs_params) do { int i; if(tc->specializations.pspecs_count == 0) { safe_printf("\n-- No specializations found\n"); break; } safe_printf("\n-- Specializations list has %d entr%s:\n", tc->specializations.pspecs_count, tc->specializations.pspecs_count == 1 ? "y" : "ies"); for(i = 0; i < tc->specializations.pspecs_count; i++) { asn1p_expr_t *se; struct asn1p_pspec_s *pspec; pspec = &tc->specializations.pspec[i]; safe_printf("-- "); TQ_FOR(se, &(pspec->rhs_pspecs->members), next) { asn1print_expr(asn, mod, se, flags, level+1); } safe_printf("\n"); } } while(0); return 0; } static int asn1print_expr_dtd(asn1p_t *asn, asn1p_module_t *mod, asn1p_expr_t *expr, enum asn1print_flags flags, int level) { asn1p_expr_t *se; int expr_unordered = 0; int dont_involve_children = 0; switch(expr->meta_type) { case AMT_TYPE: case AMT_TYPEREF: break; default: if(expr->expr_type == A1TC_UNIVERVAL) break; return 0; } if(!expr->Identifier) return 0; if(flags & APF_LINE_COMMENTS) INDENT("\n", expr->_lineno); INDENT("Identifier); if(expr->expr_type == A1TC_REFERENCE) { se = asn1f_find_terminal_type_ex(asn, expr); if(!se) { safe_printf(" (ANY)"); return 0; } expr = se; dont_involve_children = 1; } if(expr->expr_type == ASN_CONSTR_CHOICE || expr->expr_type == ASN_CONSTR_SEQUENCE_OF || expr->expr_type == ASN_CONSTR_SET_OF || expr->expr_type == ASN_CONSTR_SET || expr->expr_type == ASN_BASIC_INTEGER || expr->expr_type == ASN_BASIC_ENUMERATED) { expr_unordered = 1; } if(TQ_FIRST(&expr->members)) { int extensible = 0; if(expr->expr_type == ASN_BASIC_BIT_STRING) dont_involve_children = 1; safe_printf(" ("); TQ_FOR(se, &(expr->members), next) { if(se->expr_type == A1TC_EXTENSIBLE) { extensible = 1; continue; } else if(!se->Identifier && se->expr_type == A1TC_REFERENCE) { asn1print_ref(se->reference, flags); } else if(se->Identifier) { safe_printf("%s", se->Identifier); } else { safe_printf("ANY"); } if(expr->expr_type != ASN_CONSTR_SET && expr->expr_type != ASN_CONSTR_CHOICE && expr->expr_type != ASN_BASIC_INTEGER && expr->expr_type != ASN_BASIC_ENUMERATED) { if(expr_unordered) safe_printf("*"); else if(se->marker.flags) safe_printf("?"); else if(expr->expr_type == ASN_BASIC_BIT_STRING) safe_printf("?"); } if(TQ_NEXT(se, next) && TQ_NEXT(se, next)->expr_type != A1TC_EXTENSIBLE) { safe_printf(expr_unordered?"|":", "); } } if(extensible) { safe_printf(expr_unordered?"|":", "); safe_printf("ANY"); if(expr->expr_type != ASN_CONSTR_SET && expr->expr_type != ASN_CONSTR_CHOICE && expr->expr_type != ASN_BASIC_INTEGER && expr->expr_type != ASN_BASIC_ENUMERATED) safe_printf("*"); } safe_printf(")"); if(expr->expr_type == ASN_CONSTR_SET) safe_printf("*"); } else switch(expr->expr_type) { case ASN_BASIC_BOOLEAN: safe_printf(" (true|false)"); break; case ASN_CONSTR_CHOICE: case ASN_CONSTR_SET: case ASN_CONSTR_SET_OF: case ASN_CONSTR_SEQUENCE: case ASN_CONSTR_SEQUENCE_OF: case ASN_BASIC_NULL: case A1TC_UNIVERVAL: safe_printf(" EMPTY"); break; case ASN_TYPE_ANY: safe_printf(" ANY"); break; case ASN_BASIC_BIT_STRING: case ASN_BASIC_OCTET_STRING: case ASN_BASIC_OBJECT_IDENTIFIER: case ASN_BASIC_RELATIVE_OID: case ASN_BASIC_INTEGER: case ASN_BASIC_UTCTime: case ASN_BASIC_GeneralizedTime: case ASN_STRING_NumericString: case ASN_STRING_PrintableString: safe_printf(" (#PCDATA)"); break; case ASN_STRING_VisibleString: case ASN_STRING_ISO646String: /* Entity references, but not XML elements may be present */ safe_printf(" (#PCDATA)"); break; case ASN_BASIC_REAL: /* e.g. */ case ASN_BASIC_ENUMERATED: /* e.g. */ default: /* * XML elements are allowed. * For example, a UTF8String may contain "". */ safe_printf(" ANY"); } safe_printf(">\n"); /* * Display the descendants (children) of the current type. */ if(!dont_involve_children) { TQ_FOR(se, &(expr->members), next) { if(se->expr_type == A1TC_EXTENSIBLE) continue; asn1print_expr_dtd(asn, mod, se, flags, level + 1); } } return 0; } asn1c-0.9.28+dfsg/libasn1parser/0000755000000000000000000000000013065714043015005 5ustar rootrootasn1c-0.9.28+dfsg/libasn1parser/asn1p_expr2uclass.h0000644000000000000000000000552213065714043020537 0ustar rootroot#ifndef ASN1_PARSER_EXPR2UCLASS_H #define ASN1_PARSER_EXPR2UCLASS_H #ifndef __GNUC__ #define __attribute__(x) /* unused */ #endif static int expr_type2uclass_value[ASN_EXPR_TYPE_MAX] __attribute__ ((unused)) = { [ ASN_BASIC_BOOLEAN ] = 1, [ ASN_BASIC_INTEGER ] = 2, [ ASN_BASIC_BIT_STRING ] = 3, [ ASN_BASIC_OCTET_STRING ] = 4, [ ASN_BASIC_NULL ] = 5, [ ASN_BASIC_OBJECT_IDENTIFIER ] = 6, [ ASN_STRING_ObjectDescriptor ] = 7, [ ASN_BASIC_EXTERNAL ] = 8, [ ASN_BASIC_REAL ] = 9, [ ASN_BASIC_ENUMERATED ] = 10, [ ASN_BASIC_EMBEDDED_PDV ] = 11, [ ASN_STRING_UTF8String ] = 12, [ ASN_BASIC_RELATIVE_OID ] = 13, [ ASN_CONSTR_SEQUENCE ] = 16, [ ASN_CONSTR_SEQUENCE_OF ] = 16, [ ASN_CONSTR_SET ] = 17, [ ASN_CONSTR_SET_OF ] = 17, [ ASN_STRING_NumericString ] = 18, [ ASN_STRING_PrintableString ] = 19, [ ASN_STRING_TeletexString ] = 20, [ ASN_STRING_T61String ] = 20, [ ASN_STRING_VideotexString ] = 21, [ ASN_STRING_IA5String ] = 22, [ ASN_BASIC_UTCTime ] = 23, [ ASN_BASIC_GeneralizedTime ] = 24, [ ASN_STRING_GraphicString ] = 25, [ ASN_STRING_VisibleString ] = 26, [ ASN_STRING_ISO646String ] = 26, [ ASN_STRING_GeneralString ] = 27, [ ASN_STRING_UniversalString ] = 28, [ ASN_BASIC_CHARACTER_STRING ] = 29, [ ASN_STRING_BMPString ] = 30, }; static enum asn1p_expr_type expr_utag2type[32] __attribute__ ((unused)) = { [ 0 ] = 0, /* If zero length, end-of-content */ [ 1 ] = ASN_BASIC_BOOLEAN, [ 2 ] = ASN_BASIC_INTEGER, [ 3 ] = ASN_BASIC_BIT_STRING, [ 4 ] = ASN_BASIC_OCTET_STRING, [ 5 ] = ASN_BASIC_NULL, [ 6 ] = ASN_BASIC_OBJECT_IDENTIFIER, [ 7 ] = ASN_STRING_ObjectDescriptor, [ 8 ] = ASN_BASIC_EXTERNAL, [ 9 ] = ASN_BASIC_REAL, [ 10 ] = ASN_BASIC_ENUMERATED, [ 11 ] = ASN_BASIC_EMBEDDED_PDV, [ 12 ] = ASN_STRING_UTF8String, [ 13 ] = ASN_BASIC_RELATIVE_OID, [ 14 ] = 0, [ 15 ] = 0, [ 16 ] = ASN_CONSTR_SEQUENCE, /* Or SEQUENCE OF */ [ 17 ] = ASN_CONSTR_SET, /* Or SET OF */ [ 18 ] = ASN_STRING_NumericString, /* " "|"0".."9" */ [ 19 ] = ASN_STRING_PrintableString, [ 20 ] = ASN_STRING_TeletexString, [ 21 ] = ASN_STRING_VideotexString, [ 22 ] = ASN_STRING_IA5String, [ 23 ] = ASN_BASIC_UTCTime, [ 24 ] = ASN_BASIC_GeneralizedTime, [ 25 ] = ASN_STRING_GraphicString, [ 26 ] = ASN_STRING_VisibleString, [ 27 ] = ASN_STRING_GeneralString, [ 28 ] = ASN_STRING_UniversalString, /* 32-bit UCS-4 */ [ 29 ] = ASN_BASIC_CHARACTER_STRING, [ 30 ] = ASN_STRING_BMPString, /* 16-bit UCS-2 */ }; /* * Convert the [UNIVERSAL value] into the internal type or a string. */ #define ASN_UNIVERSAL_TAG2TYPE(utag) \ ( \ (((int)(utag)) < 0 \ || ((int)(utag)) >= (int)(sizeof(expr_utag2type) \ / sizeof(expr_utag2type[0]))) \ ? 0 \ : expr_utag2type[(int)(utag)] \ ) #define ASN_UNIVERSAL_TAG2STR(utag) \ ASN_EXPR_TYPE2STR(ASN_UNIVERSAL_TAG2TYPE(utag)) #endif /* ASN1_PARSER_EXPR2UCLASS_H */ asn1c-0.9.28+dfsg/libasn1parser/asn1p_module.h0000644000000000000000000000360713065714043017553 0ustar rootroot/* * A Module definition structure used by the ASN.1 parser. */ #ifndef ASN1_PARSER_MODULE_H #define ASN1_PARSER_MODULE_H struct asn1p_module_s; /* * A simple container for several modules. */ typedef struct asn1p_s { TQ_HEAD(struct asn1p_module_s) modules; } asn1p_t; asn1p_t *asn1p_new(void); void asn1p_delete(asn1p_t *asn); /* * Flags specific to a module. */ typedef enum asn1p_module_flags { MSF_NOFLAGS, MSF_unk_INSTRUCTIONS = 0x001, MSF_TAG_INSTRUCTIONS = 0x002, MSF_XER_INSTRUCTIONS = 0x004, MSF_EXPLICIT_TAGS = 0x010, MSF_IMPLICIT_TAGS = 0x020, MSF_AUTOMATIC_TAGS = 0x040, MSF_EXTENSIBILITY_IMPLIED = 0x100, } asn1p_module_flags_e; #define MSF_MASK_INSTRUCTIONS 0x0f #define MSF_MASK_TAGS 0xf0 /* * === EXAMPLE === * MySyntax DEFINITIONS AUTOMATIC TAGS ::= * BEGIN * ... * END * === EOF === */ typedef struct asn1p_module_s { /* * Name of the source file. */ char *source_file_name; /* * Human-readable module reference. */ char *ModuleName; /* * Unique module identifier, OID. */ asn1p_oid_t *module_oid; /* Optional OID of the module */ /* * Module flags. */ asn1p_module_flags_e module_flags; /* AUTOMATIC TAGS? */ /* * List of everything that this module EXPORTS. */ TQ_HEAD(struct asn1p_xports_s) exports; /* * List of everything that this module IMPORTS. */ TQ_HEAD(struct asn1p_xports_s) imports; /* * List of everything that this module defines itself. */ TQ_HEAD(struct asn1p_expr_s) members; /* * Next module in the list. */ TQ_ENTRY(struct asn1p_module_s) mod_next; /* All modules */ asn1p_t *asn1p; /* * Internally useful properties. */ enum { MT_STANDARD_MODULE = 0x01, /* Module came from standard-modules */ } _tags; } asn1p_module_t; /* * Constructor and destructor. */ asn1p_module_t *asn1p_module_new(void); void asn1p_module_free(asn1p_module_t *mod); #endif /* ASN1_PARSER_MODULE_H */ asn1c-0.9.28+dfsg/libasn1parser/Makefile.am0000644000000000000000000000126413065714043017044 0ustar rootroot AM_CFLAGS = @ADD_CFLAGS@ AM_YFLAGS = -p asn1p_ -d AM_LFLAGS = -s -p -Cem -Pasn1p_ -olex.yy.c noinst_LTLIBRARIES = libasn1parser.la libasn1parser_la_SOURCES = \ asn1parser.c asn1parser.h \ asn1p_y.c asn1p_y.h asn1p_l.c \ asn1p_module.c asn1p_module.h \ asn1p_oid.c asn1p_oid.h \ asn1p_value.c asn1p_value.h \ asn1p_expr.c asn1p_expr.h \ asn1p_expr_str.h \ asn1p_expr2uclass.h \ asn1p_xports.c asn1p_xports.h \ asn1p_constr.c asn1p_constr.h \ asn1p_param.c asn1p_param.h \ asn1p_class.c asn1p_class.h \ asn1p_ref.c asn1p_ref.h \ asn1p_list.h asn1parser.h: asn1p_expr_str.h asn1p_expr_str.h: expr-h.pl asn1p_expr.h ./expr-h.pl asn1p_expr.h > $@ EXTRA_DIST = expr-h.pl asn1c-0.9.28+dfsg/libasn1parser/asn1p_class.c0000644000000000000000000000655713065714043017375 0ustar rootroot#include #include #include #include #include #include "asn1parser.h" asn1p_ioc_row_t * asn1p_ioc_row_new(asn1p_expr_t *oclass) { asn1p_ioc_row_t *row; asn1p_expr_t *field; int columns = 0; assert(oclass->expr_type == A1TC_CLASSDEF); row = calloc(1, sizeof *row); if(!row) return NULL; TQ_FOR(field, &oclass->members, next) columns++; row->column = calloc(columns, sizeof *row->column); if(!row->column) { free(row); return NULL; } row->columns = columns; columns = 0; TQ_FOR(field, &oclass->members, next) { int fieldIdLen = strlen(field->Identifier); if(fieldIdLen > row->max_identifier_length) row->max_identifier_length = fieldIdLen; row->column[columns].field = field; row->column[columns].value = NULL; columns++; } return row; } void asn1p_ioc_row_delete(asn1p_ioc_row_t *row) { if(row) { if(row->column) { free(row->column); } free(row); } } struct asn1p_ioc_cell_s * asn1p_ioc_row_cell_fetch(asn1p_ioc_row_t *row, const char *fieldname) { int i; for(i = 0; i < row->columns; i++) { if(strcmp(row->column[i].field->Identifier, fieldname) == 0) return &row->column[i]; } errno = ESRCH; return NULL; } asn1p_wsyntx_chunk_t * asn1p_wsyntx_chunk_new() { asn1p_wsyntx_chunk_t *wc; wc = calloc(1, sizeof(*wc)); return wc; } void asn1p_wsyntx_chunk_free(asn1p_wsyntx_chunk_t *wc) { if(wc) { switch(wc->type) { case WC_LITERAL: case WC_WHITESPACE: case WC_FIELD: free(wc->content.token); break; case WC_OPTIONALGROUP: asn1p_wsyntx_free(wc->content.syntax); break; } free(wc); } } asn1p_wsyntx_chunk_t * asn1p_wsyntx_chunk_clone(asn1p_wsyntx_chunk_t *wc) { asn1p_wsyntx_chunk_t *nc; nc = asn1p_wsyntx_chunk_new(); if(nc) { nc->type = wc->type; switch(wc->type) { case WC_LITERAL: case WC_WHITESPACE: case WC_FIELD: nc->content.token = malloc(strlen(wc->content.token)+1); strcpy(nc->content.token, wc->content.token); break; case WC_OPTIONALGROUP: nc->content.syntax = asn1p_wsyntx_clone(wc->content.syntax); break; } } return nc; } asn1p_wsyntx_t * asn1p_wsyntx_new() { asn1p_wsyntx_t *wx; wx = calloc(1, sizeof(*wx)); if(wx) { TQ_INIT(&(wx->chunks)); } return wx; } void asn1p_wsyntx_free(asn1p_wsyntx_t *wx) { if(wx) { asn1p_wsyntx_chunk_t *wc; while((wc = TQ_REMOVE(&(wx->chunks), next))) asn1p_wsyntx_chunk_free(wc); free(wx); } } asn1p_wsyntx_t * asn1p_wsyntx_clone(asn1p_wsyntx_t *wx) { asn1p_wsyntx_t *nw; nw = asn1p_wsyntx_new(); if(nw) { asn1p_wsyntx_chunk_t *wc; asn1p_wsyntx_chunk_t *nc; TQ_FOR(wc, &(wx->chunks), next) { nc = asn1p_wsyntx_chunk_clone(wc); if(nc) { TQ_ADD(&(nw->chunks), nc, next); } else { asn1p_wsyntx_free(nw); return NULL; } } } return nw; } asn1p_wsyntx_chunk_t * asn1p_wsyntx_chunk_fromstring(char *token, int do_copy) { asn1p_wsyntx_chunk_t *wc; if(do_copy) { static asn1p_wsyntx_chunk_t tmp; tmp.type = WC_LITERAL; tmp.content.token = token; wc = asn1p_wsyntx_chunk_clone(&tmp); } else { wc = asn1p_wsyntx_chunk_new(); if(wc) { wc->type = WC_LITERAL; wc->content.token = token; } } return wc; } asn1p_wsyntx_chunk_t * asn1p_wsyntx_chunk_fromsyntax(asn1p_wsyntx_t *syntax) { asn1p_wsyntx_chunk_t *wc; wc = asn1p_wsyntx_chunk_new(); if(wc) { wc->type = WC_OPTIONALGROUP; wc->content.syntax = syntax; } return wc; } asn1c-0.9.28+dfsg/libasn1parser/asn1p_l.l0000644000000000000000000003321213065714043016520 0ustar rootroot%{ #include #include #include #include "asn1parser.h" #include "asn1p_y.h" int asn1p_lex(void); void asn1p_lexer_hack_push_opaque_state(void); /* Used in .y */ void asn1p_lexer_hack_enable_with_syntax(void); /* Used in .y */ void asn1p_lexer_hack_push_encoding_control(void); /* Used in .y */ #define YY_FATAL_ERROR(msg) do { \ fprintf(stderr, \ "lexer error at line %d, " \ "text \"%s\"\n", \ yylineno, yytext); \ exit(1); \ } while(0) int asn1p_lexer_pedantic_1990 = 0; int asn1p_lexer_types_year = 0; int asn1p_lexer_constructs_year = 0; int asn1p_as_pointer; static asn1c_integer_t _lex_atoi(const char *ptr); static double _lex_atod(const char *ptr); /* * Check that the type is defined in the year of the standard choosen. */ #define TYPE_LIFETIME(fyr, lyr) \ (!asn1p_lexer_types_year \ || (fyr && fyr <= asn1p_lexer_types_year) \ || (lyr && lyr > asn1p_lexer_types_year)) /* * Check the the construction (or concept, i.e. CLASS) is defined in * a given year. */ #define CONSTRUCT_LIFETIME(fyr, lyr) \ (!asn1p_lexer_constructs_year \ || (fyr && fyr <= asn1p_lexer_constructs_year) \ || (lyr && lyr > asn1p_lexer_constructs_year)) /* * Append quoted string. */ #define QAPPEND(text, tlen) do { \ char *prev_text = asn1p_lval.tv_opaque.buf; \ int prev_len = asn1p_lval.tv_opaque.len; \ char *p; \ \ p = malloc((tlen) + prev_len + 1); \ if(p == NULL) return -1; \ \ if(prev_text) memcpy(p, prev_text, prev_len); \ memcpy(p + prev_len, text, tlen); \ p[prev_len + (tlen)] = '\0'; \ \ free(asn1p_lval.tv_opaque.buf); \ asn1p_lval.tv_opaque.buf = p; \ asn1p_lval.tv_opaque.len = (tlen) + prev_len; \ } while(0) %} %option never-interactive %option noinput %option noyywrap stack /* Performance penalty is OK */ %option yylineno /* Controlled from within application */ %option debug %pointer %x dash_comment %x idash_comment %x cpp_comment %x quoted %x opaque %x encoding_control %x with_syntax /* Newline */ NL [\r\v\f\n] /* White-space */ WSP [\t\r\v\f\n ] %% -{3,}/[\r\n] /* Immediately terminated long comment */ -{3,}/[^-\r\n] yy_push_state(idash_comment); /* Incorrect, but acceptable */ { -{3,} yy_pop_state(); /* Acceptable end of comment */ } --<[ \t]*ASN1C.RepresentAsPointer[ \t]*>-- asn1p_as_pointer = 1; -- yy_push_state(dash_comment); { {NL} yy_pop_state(); -- yy_pop_state(); /* End of comment */ - /* Eat single dash */ [^\r\v\f\n-]+ /* Eat */ } "/*" yy_push_state(cpp_comment); { [^*/<] /* Eat */ "*/" yy_pop_state(); . /* Eat */ } /* * This is state is being set from corresponding .y module when * higher-level data is necessary to make proper parsing of the * underlying data. Thus, we enter the state and save * everything for later processing. */ { "{" { yy_push_state(opaque); asn1p_lval.tv_opaque.buf = strdup(yytext); asn1p_lval.tv_opaque.len = yyleng; return TOK_opaque; } "}" { yy_pop_state(); asn1p_lval.tv_opaque.buf = strdup(yytext); asn1p_lval.tv_opaque.len = yyleng; return TOK_opaque; } [^{}:=]+ { asn1p_lval.tv_opaque.buf = strdup(yytext); asn1p_lval.tv_opaque.len = yyleng; return TOK_opaque; } "::=" { fprintf(stderr, "ASN.1 Parser syncronization failure: " "\"%s\" at line %d must not appear " "inside value definition\n", yytext, yylineno); return -1; } [:=] { asn1p_lval.tv_opaque.buf = strdup(yytext); asn1p_lval.tv_opaque.len = yyleng; return TOK_opaque; } } \"[^\"]* { asn1p_lval.tv_opaque.buf = 0; asn1p_lval.tv_opaque.len = 0; QAPPEND(yytext+1, yyleng-1); yy_push_state(quoted); } { \"\" { QAPPEND(yytext, yyleng-1); } /* Add a single quote */ [^\"]+ { QAPPEND(yytext, yyleng); } \" { yy_pop_state(); /* Do not append last quote: // QAPPEND(yytext, yyleng); */ if(asn1p_lexer_pedantic_1990 && strchr(yytext, '\n')) { fprintf(stderr, "%s: " "Newlines are prohibited by ASN.1:1990\n", asn1p_lval.tv_opaque.buf); return -1; } return TOK_cstring; } } { ENCODING-CONTROL { const char *s = "ENCODING-CONTROL"; const char *p = s + sizeof("ENCODING-CONTROL") - 2; for(; p >= s; p--) unput(*p); yy_pop_state(); } END unput('D'); unput('N'); unput('E'); yy_pop_state(); [^{} \t\r\v\f\n]+ [[:alnum:]]+ . /* Eat everything else */ "\n" } '[0-9A-F \t\r\v\f\n]+'H { /* " \t\r\n" weren't allowed in ASN.1:1990. */ asn1p_lval.tv_str = yytext; return TOK_hstring; } '[01 \t\r\v\f\n]+'B { /* " \t\r\n" weren't allowed in ASN.1:1990. */ asn1p_lval.tv_str = strdup(yytext); return TOK_bstring; } -[1-9][0-9]* { asn1p_lval.a_int = _lex_atoi(yytext); if(errno == ERANGE) return -1; return TOK_number_negative; } [1-9][0-9]* { asn1p_lval.a_int = _lex_atoi(yytext); if(errno == ERANGE) return -1; return TOK_number; } "0" { asn1p_lval.a_int = _lex_atoi(yytext); if(errno == ERANGE) return -1; return TOK_number; } [-+]?[0-9]+[.]?([eE][-+]?)?[0-9]+ { asn1p_lval.a_dbl = _lex_atod(yytext); if(errno == ERANGE) return -1; return TOK_realnumber; } ABSENT return TOK_ABSENT; ALL return TOK_ALL; ANY { /* Appeared in 1990, removed in 1997 */ if(TYPE_LIFETIME(1990, 1997)) return TOK_ANY; fprintf(stderr, "Keyword \"%s\" at line %d " "is obsolete\n", yytext, yylineno); REJECT; } APPLICATION return TOK_APPLICATION; AUTOMATIC return TOK_AUTOMATIC; BEGIN return TOK_BEGIN; BIT return TOK_BIT; BMPString { if(TYPE_LIFETIME(1994, 0)) return TOK_BMPString; REJECT; } BOOLEAN return TOK_BOOLEAN; BY return TOK_BY; CHARACTER return TOK_CHARACTER; CHOICE return TOK_CHOICE; CLASS return TOK_CLASS; COMPONENT return TOK_COMPONENT; COMPONENTS return TOK_COMPONENTS; CONSTRAINED return TOK_CONSTRAINED; CONTAINING return TOK_CONTAINING; DEFAULT return TOK_DEFAULT; DEFINED { /* Appeared in 1990, removed in 1997 */ if(TYPE_LIFETIME(1990, 1997)) return TOK_DEFINED; fprintf(stderr, "Keyword \"%s\" at line %d " "is obsolete\n", yytext, yylineno); /* Deprecated since */ REJECT; } DEFINITIONS return TOK_DEFINITIONS; EMBEDDED return TOK_EMBEDDED; ENCODED return TOK_ENCODED; ENCODING-CONTROL return TOK_ENCODING_CONTROL; END return TOK_END; ENUMERATED return TOK_ENUMERATED; EXCEPT return TOK_EXCEPT; EXPLICIT return TOK_EXPLICIT; EXPORTS return TOK_EXPORTS; EXTENSIBILITY return TOK_EXTENSIBILITY; EXTERNAL return TOK_EXTERNAL; FALSE return TOK_FALSE; FROM return TOK_FROM; GeneralizedTime return TOK_GeneralizedTime; GeneralString return TOK_GeneralString; GraphicString return TOK_GraphicString; IA5String return TOK_IA5String; IDENTIFIER return TOK_IDENTIFIER; IMPLICIT return TOK_IMPLICIT; IMPLIED return TOK_IMPLIED; IMPORTS return TOK_IMPORTS; INCLUDES return TOK_INCLUDES; INSTANCE return TOK_INSTANCE; INSTRUCTIONS return TOK_INSTRUCTIONS; INTEGER return TOK_INTEGER; INTERSECTION return TOK_INTERSECTION; ISO646String return TOK_ISO646String; MAX return TOK_MAX; MIN return TOK_MIN; MINUS-INFINITY return TOK_MINUS_INFINITY; NULL return TOK_NULL; NumericString return TOK_NumericString; OBJECT return TOK_OBJECT; ObjectDescriptor return TOK_ObjectDescriptor; OCTET return TOK_OCTET; OF return TOK_OF; OPTIONAL return TOK_OPTIONAL; PATTERN return TOK_PATTERN; PDV return TOK_PDV; PLUS-INFINITY return TOK_PLUS_INFINITY; PRESENT return TOK_PRESENT; PrintableString return TOK_PrintableString; PRIVATE return TOK_PRIVATE; REAL return TOK_REAL; RELATIVE-OID return TOK_RELATIVE_OID; SEQUENCE return TOK_SEQUENCE; SET return TOK_SET; SIZE return TOK_SIZE; STRING return TOK_STRING; SYNTAX return TOK_SYNTAX; T61String return TOK_T61String; TAGS return TOK_TAGS; TeletexString return TOK_TeletexString; TRUE return TOK_TRUE; UNION return TOK_UNION; UNIQUE return TOK_UNIQUE; UNIVERSAL return TOK_UNIVERSAL; UniversalString { if(TYPE_LIFETIME(1994, 0)) return TOK_UniversalString; REJECT; } UTCTime return TOK_UTCTime; UTF8String { if(TYPE_LIFETIME(1994, 0)) return TOK_UTF8String; REJECT; } VideotexString return TOK_VideotexString; VisibleString return TOK_VisibleString; WITH return TOK_WITH; &[A-Z][A-Za-z0-9]*([-][A-Za-z0-9]+)* { asn1p_lval.tv_str = strdup(yytext); return TOK_typefieldreference; } &[a-z][a-zA-Z0-9]*([-][a-zA-Z0-9]+)* { asn1p_lval.tv_str = strdup(yytext); return TOK_valuefieldreference; } [a-z][a-zA-Z0-9]*([-][a-zA-Z0-9]+)* { asn1p_lval.tv_str = strdup(yytext); return TOK_identifier; } /* * objectclassreference */ [A-Z][A-Z0-9]*([-][A-Z0-9]+)* { asn1p_lval.tv_str = strdup(yytext); return TOK_capitalreference; } /* * typereference, modulereference * NOTE: TOK_objectclassreference must be combined * with this token to produce true typereference. */ [A-Z][A-Za-z0-9]*([-][A-Za-z0-9]+)* { asn1p_lval.tv_str = strdup(yytext); return TOK_typereference; } "::=" return TOK_PPEQ; "..." return TOK_ThreeDots; ".." return TOK_TwoDots; { [A-Z][A-Za-z0-9]*([-][A-Za-z0-9]+)* { asn1p_lval.tv_str = strdup(yytext); return TOK_Literal; } "," { asn1p_lval.tv_str = strdup(yytext); return TOK_Literal; } "{" { yy_push_state(with_syntax); asn1p_lval.tv_str = strdup(yytext); return TOK_Literal; } "[" return '['; "]" return ']'; {WSP}+ { asn1p_lval.tv_opaque.buf = strdup(yytext); asn1p_lval.tv_opaque.len = yyleng; return TOK_whitespace; } "}" { yy_pop_state(); if(YYSTATE == with_syntax) { asn1p_lval.tv_str = strdup(yytext); return TOK_Literal; } else { return '}'; } } } {WSP}+ /* Ignore whitespace */ [{][\t\r\v\f\n ]*[0-7][,][\t\r\v\f\n ]*[0-9]+[\t\r\v\f\n ]*[}] { asn1c_integer_t v1 = -1, v2 = -1; char *p; for(p = yytext; *p; p++) if(*p >= '0' && *p <= '9') { v1 = _lex_atoi(p); break; } while(*p >= '0' && *p <= '9') p++; /* Skip digits */ for(; *p; p++) if(*p >= '0' && *p <= '9') { v2 = _lex_atoi(p); break; } if(v1 < 0 || v1 > 7) { fprintf(stderr, "%s at line %d: X.680:2003, #37.14 " "mandates 0..7 range for Tuple's TableColumn\n", yytext, yylineno); return -1; } if(v2 < 0 || v2 > 15) { fprintf(stderr, "%s at line %d: X.680:2003, #37.14 " "mandates 0..15 range for Tuple's TableRow\n", yytext, yylineno); return -1; } asn1p_lval.a_int = (v1 << 4) + v2; return TOK_tuple; } [{][\t\r\v\f\n ]*[0-9]+[,][\t\r\v\f\n ]*[0-9]+[,][\t\r\v\f\n ]*[0-9]+[,][\t\r\v\f\n ]*[0-9]+[\t\r\v\f\n ]*[}] { asn1c_integer_t v1 = -1, v2 = -1, v3 = -1, v4 = -1; char *p; for(p = yytext; *p; p++) if(*p >= '0' && *p <= '9') { v1 = _lex_atoi(p); break; } while(*p >= '0' && *p <= '9') p++; /* Skip digits */ for(; *p; p++) if(*p >= '0' && *p <= '9') { v2 = _lex_atoi(p); break; } while(*p >= '0' && *p <= '9') p++; for(; *p; p++) if(*p >= '0' && *p <= '9') { v3 = _lex_atoi(p); break; } while(*p >= '0' && *p <= '9') p++; for(; *p; p++) if(*p >= '0' && *p <= '9') { v4 = _lex_atoi(p); break; } if(v1 < 0 || v1 > 127) { fprintf(stderr, "%s at line %d: X.680:2003, #37.12 " "mandates 0..127 range for Quadruple's Group\n", yytext, yylineno); return -1; } if(v2 < 0 || v2 > 255) { fprintf(stderr, "%s at line %d: X.680:2003, #37.12 " "mandates 0..255 range for Quadruple's Plane\n", yytext, yylineno); return -1; } if(v3 < 0 || v3 > 255) { fprintf(stderr, "%s at line %d: X.680:2003, #37.12 " "mandates 0..255 range for Quadruple's Row\n", yytext, yylineno); return -1; } if(v4 < 0 || v4 > 255) { fprintf(stderr, "%s at line %d: X.680:2003, #37.12 " "mandates 0..255 range for Quadruple's Cell\n", yytext, yylineno); return -1; } asn1p_lval.a_int = (v1 << 24) | (v2 << 16) | (v3 << 8) | v4; return TOK_quadruple; } "[[" return TOK_VBracketLeft; "]]" return TOK_VBracketRight; [(){},;:|!.&@\[\]^] return yytext[0]; [^A-Za-z0-9:=,{}<.@()[]'\"|&^*;!-] { if(TYPE_LIFETIME(1994, 0)) fprintf(stderr, "ERROR: "); fprintf(stderr, "Symbol '%c' at line %d is prohibited " "by ASN.1:1994 and ASN.1:1997\n", yytext[0], yylineno); if(TYPE_LIFETIME(1994, 0)) return -1; } <*>. { fprintf(stderr, "Unexpected token at line %d: \"%s\"\n", yylineno, yytext); while(YYSTATE != INITIAL) yy_pop_state(); if(0) { yy_top_state(); /* Just to use this function. */ yy_fatal_error("Parse error"); } return -1; } <*><> { while(YYSTATE != INITIAL) yy_pop_state(); yyterminate(); } %% /* * Very dirty but wonderful hack allowing to rule states from within .y file. */ void asn1p_lexer_hack_push_opaque_state() { yy_push_state(opaque); } /* * Another hack which disables recognizing some tokens when inside WITH SYNTAX. */ void asn1p_lexer_hack_enable_with_syntax() { yy_push_state(with_syntax); } /* Yet another */ void asn1p_lexer_hack_push_encoding_control() { yy_push_state(encoding_control); } static asn1c_integer_t _lex_atoi(const char *ptr) { asn1c_integer_t value; if(asn1p_atoi(ptr, &value)) { fprintf(stderr, "Value \"%s\" at line %d is too large " "for this compiler! Please contact the asn1c author.\n", ptr, yylineno); errno = ERANGE; } return value; } static double _lex_atod(const char *ptr) { double value; errno = 0; value = strtod(ptr, 0); if(errno) { fprintf(stderr, "Value \"%s\" at line %d is outside of `double` range " "in this compiler! Please contact the asn1c author.\n", ptr, yylineno); errno = ERANGE; } return value; } asn1c-0.9.28+dfsg/libasn1parser/asn1p_oid.h0000644000000000000000000000254313065714043017037 0ustar rootroot/* * Object Identifier definition. */ #ifndef ASN1_PARSER_OID_H #define ASN1_PARSER_OID_H /******************************** * Single Object Identifier Arc * ********************************/ /* * Object identifier arc (one number in the hierarchy). */ typedef struct asn1p_oid_arc_s { asn1c_integer_t number; /* -1 if not yet defined */ char *name; /* 0 if not defined */ } asn1p_oid_arc_t; /* * Arc constructor. */ asn1p_oid_arc_t *asn1p_oid_arc_new( const char *optName, asn1c_integer_t optNumber /* = -1 */); /* * Arc destructor. */ void asn1p_oid_arc_free(asn1p_oid_arc_t *); /************************************************** * Object Identifier itself, a collection of arcs * **************************************************/ /* * Object Identifier as a collection of arcs. */ typedef struct asn1p_oid_s { asn1p_oid_arc_t *arcs; int arcs_count; } asn1p_oid_t; /* * OID constructors. */ asn1p_oid_t *asn1p_oid_new(void); asn1p_oid_t *asn1p_oid_construct(asn1p_oid_arc_t *, int narcs); /* * Add another arc using given one as a template */ int asn1p_oid_add_arc(asn1p_oid_t *, asn1p_oid_arc_t *template); /* * OID destructor. */ void asn1p_oid_free(asn1p_oid_t *); /* * RETURN VALUES: * 0: The specified OIDs are equal. * -1 or 1 otherwise. */ int asn1p_oid_compare(asn1p_oid_t *a, asn1p_oid_t *b); #endif /* ASN1_PARSER_OID_H */ asn1c-0.9.28+dfsg/libasn1parser/asn1p_expr.c0000644000000000000000000001717313065714043017242 0ustar rootroot#include #include #include #include #include #include "asn1parser.h" static asn1p_expr_t *asn1p_expr_clone_impl(asn1p_expr_t *expr, int skip_extensions, asn1p_expr_t *(*)(asn1p_expr_t *, void *), void *); static asn1p_value_t *value_resolver(asn1p_value_t *, void *arg); /* * Construct a new empty types collection. */ asn1p_expr_t * asn1p_expr_new(int _lineno, asn1p_module_t *mod) { asn1p_expr_t *expr; expr = calloc(1, sizeof *expr); if(expr) { TQ_INIT(&(expr->members)); expr->spec_index = -1; expr->module = mod; expr->_lineno = _lineno; } return expr; } asn1p_expr_t * asn1p_expr_clone(asn1p_expr_t *expr, int skip_extensions) { return asn1p_expr_clone_impl(expr, skip_extensions, 0, 0); } asn1p_expr_t * asn1p_expr_clone_with_resolver(asn1p_expr_t *expr, asn1p_expr_t *(*r)(asn1p_expr_t *, void *), void *rarg) { return asn1p_expr_clone_impl(expr, 0, r, rarg); } static asn1p_expr_t * asn1p_expr_clone_impl(asn1p_expr_t *expr, int skip_extensions, asn1p_expr_t *(*r)(asn1p_expr_t *, void *), void *rarg) { asn1p_value_t *(*vr)(asn1p_value_t *, void *) = 0; asn1p_expr_t *clone = 0; asn1p_expr_t *tcmemb; /* Child of tc */ int hit_ext = 0; #define CLCOPY(field) do { clone->field = expr->field; } while(0) #define CLCLONE(field, func) do { if(expr->field) { \ clone->field = func(expr->field); \ if(clone->field == NULL) { \ asn1p_expr_free(clone); \ return NULL; \ } \ } } while(0) #define CLVRCLONE(field, func) do { if(expr->field) { \ clone->field = func(expr->field, vr, rarg); \ if(clone->field == NULL) { \ asn1p_expr_free(clone); \ return NULL; \ } \ } } while(0) if(r) { vr = value_resolver; clone = r(expr, rarg); if(clone) { /* Merge constraints */ if(expr->constraints) { asn1p_constraint_t *tmpct = asn1p_constraint_clone_with_resolver(expr->constraints, vr, rarg); if(clone->constraints) { if(asn1p_constraint_insert(clone->constraints, tmpct)) { asn1p_constraint_free(tmpct); asn1p_expr_free(clone); return NULL; } } else { clone->constraints = tmpct; } assert(expr->combined_constraints == 0); } /* Merge defaults */ CLCOPY(marker.flags); CLVRCLONE(marker.default_value, asn1p_value_clone_with_resolver); if(clone->tag.tag_class == TC_NOCLASS) { CLCOPY(tag); } else if(expr->tag.tag_class != TC_NOCLASS) { fprintf(stderr, "asn1c does not support " "nested tagging in parameterization, " "necessary at line %d\n", expr->_lineno); asn1p_expr_free(clone); return NULL; } return clone; } else if(errno != ESRCH) { return NULL; /* Hard error */ } } if(!clone) clone = asn1p_expr_new(expr->_lineno, expr->module); if(!clone) return NULL; /* * Copy simple fields. */ CLCOPY(meta_type); CLCOPY(expr_type); CLCOPY(tag); CLCOPY(marker.flags); /* OPTIONAL/DEFAULT */ CLCOPY(_mark); clone->data = 0; /* Do not clone this */ clone->data_free = 0; /* Do not clone this */ /* * Clone complex fields. */ CLCLONE(Identifier, strdup); CLCLONE(reference, asn1p_ref_clone); CLVRCLONE(constraints, asn1p_constraint_clone_with_resolver); CLVRCLONE(combined_constraints, asn1p_constraint_clone_with_resolver); CLCLONE(lhs_params, asn1p_paramlist_clone); CLVRCLONE(value, asn1p_value_clone_with_resolver); CLVRCLONE(marker.default_value, asn1p_value_clone_with_resolver); CLCLONE(with_syntax, asn1p_wsyntx_clone); /* * Copy all the children of this expr. */ TQ_FOR(tcmemb, &(expr->members), next) { asn1p_expr_t *cmemb; if(skip_extensions && tcmemb->expr_type == A1TC_EXTENSIBLE) { hit_ext++; /* Even if hit_ext wraps around, we're OK. */ continue; } if(hit_ext == 1) continue; /* Skip between ...'s */ cmemb = asn1p_expr_clone_impl(tcmemb, skip_extensions, r, rarg); if(cmemb == NULL) { asn1p_expr_free(clone); return NULL; } asn1p_expr_add(clone, cmemb); } return clone; } static asn1p_value_t * value_resolver(asn1p_value_t *value, void *rarg) { asn1p_value_t *cval; asn1p_expr_t *tmpexpr; asn1p_expr_t *target; asn1p_ref_t *ref; struct { asn1p_expr_t *(*expr_resolve)(asn1p_expr_t *, void *arg); } *varg = rarg; if(!value || value->type != ATV_REFERENCED) { errno = ESRCH; return NULL; } ref = value->value.reference; tmpexpr = asn1p_expr_new(ref->_lineno, 0); tmpexpr->meta_type = AMT_TYPEREF; tmpexpr->expr_type = A1TC_REFERENCE; tmpexpr->reference = ref; target = varg->expr_resolve(tmpexpr, rarg); tmpexpr->reference = 0; asn1p_expr_free(tmpexpr); if(!target) return NULL; /* errno's are compatible */ if(target->meta_type == AMT_VALUE) { if(!target->value) { fprintf(stderr, "FATAL: Parameterization did not resolve " "value reference at line %d\n", ref->_lineno); asn1p_expr_free(target); errno = EPERM; return NULL; } cval = asn1p_value_clone(target->value); } else if(target->meta_type == AMT_VALUESET) { if(!target->constraints) { fprintf(stderr, "FATAL: Parameterization did not resolve " "value set reference at line %d\n", ref->_lineno); asn1p_expr_free(target); errno = EPERM; return NULL; } cval = asn1p_value_fromconstr(target->constraints, 1); } else { errno = EPERM; cval = NULL; } asn1p_expr_free(target); return cval; } /* * Add expression as a member of another. */ void asn1p_expr_add(asn1p_expr_t *to, asn1p_expr_t *what) { TQ_ADD(&(to->members), what, next); what->parent_expr = to; } /* * Add inner expressions as members of another. */ void asn1p_expr_add_many(asn1p_expr_t *to, asn1p_expr_t *from_what) { asn1p_expr_t *expr; TQ_FOR(expr, &(from_what->members), next) { expr->parent_expr = to; } TQ_CONCAT(&(to->members), &(from_what->members), next); } /* * Destruct the types collection structure. */ void asn1p_expr_free(asn1p_expr_t *expr) { if(expr) { asn1p_expr_t *tm; /* Remove all children */ while((tm = TQ_REMOVE(&(expr->members), next))) { if(tm->parent_expr != expr) printf("<%s:%p !-> %s:%p>\n", tm->Identifier, tm->parent_expr, expr->Identifier, expr); assert(tm->parent_expr == expr); asn1p_expr_free(tm); } free(expr->Identifier); if(expr->reference) asn1p_ref_free(expr->reference); if(expr->constraints) asn1p_constraint_free(expr->constraints); if(expr->combined_constraints) asn1p_constraint_free(expr->combined_constraints); if(expr->lhs_params) asn1p_paramlist_free(expr->lhs_params); if(expr->value) asn1p_value_free(expr->value); if(expr->marker.default_value) asn1p_value_free(expr->marker.default_value); if(expr->with_syntax) asn1p_wsyntx_free(expr->with_syntax); if(expr->data && expr->data_free) expr->data_free(expr->data); memset(expr, 0, sizeof(*expr)); free(expr); } } char *asn1p_tag2string(struct asn1p_type_tag_s *tag, char *buf) { static char buf_stat[TAG2STRING_BUFFER_SIZE]; char *start; char *end; if(!buf) buf = buf_stat; start = buf; end = buf + TAG2STRING_BUFFER_SIZE; if(tag->tag_class == TC_NOCLASS) { *buf = 0; return buf; } strcpy(buf, "["); switch(tag->tag_class) { case TC_NOCLASS: assert(tag->tag_class != TC_NOCLASS); break; case TC_UNIVERSAL: strcat(buf, "UNIVERSAL "); break; case TC_PRIVATE: strcat(buf, "PRIVATE "); break; case TC_APPLICATION: strcat(buf, "APPLICATION "); break; case TC_CONTEXT_SPECIFIC: break; } buf += snprintf(buf + strlen(buf), end - buf, "%" PRIdASN "]", tag->tag_value); assert((unsigned int)(buf - end) > sizeof(" IMPLICIT ")); switch(tag->tag_mode) { case TM_DEFAULT: break; case TM_IMPLICIT: strcat(buf, " IMPLICIT"); break; case TM_EXPLICIT: strcat(buf, " EXPLICIT"); break; } return start; } asn1c-0.9.28+dfsg/libasn1parser/asn1p_module.c0000644000000000000000000000155613065714043017547 0ustar rootroot#include #include #include "asn1parser.h" /* * Construct a new empty module. */ asn1p_module_t * asn1p_module_new() { asn1p_module_t *mod; mod = calloc(1, sizeof *mod); if(mod) { TQ_INIT(&(mod->exports)); TQ_INIT(&(mod->imports)); TQ_INIT(&(mod->members)); } return mod; } /* * Destroy the module. */ void asn1p_module_free(asn1p_module_t *mod) { if(mod) { asn1p_expr_t *expr; free(mod->ModuleName); asn1p_oid_free(mod->module_oid); while((expr = TQ_REMOVE(&(mod->members), next))) asn1p_expr_free(expr); free(mod); } } asn1p_t * asn1p_new() { asn1p_t *asn; asn = calloc(1, sizeof(*asn)); if(asn) { TQ_INIT(&(asn->modules)); } return asn; } void asn1p_delete(asn1p_t *asn) { if(asn) { asn1p_module_t *mod; while((mod = TQ_REMOVE(&(asn->modules), mod_next))) asn1p_module_free(mod); free(asn); } } asn1c-0.9.28+dfsg/libasn1parser/asn1p_constr.h0000644000000000000000000000510213065714043017566 0ustar rootroot/* * Type constraints. */ #ifndef ASN1_PARSER_CONSTRAINT_H #define ASN1_PARSER_CONSTRAINT_H typedef struct asn1p_constraint_s { enum asn1p_constraint_type_e { ACT_INVALID, /* for assertions */ /* * Constraint elements. */ ACT_EL_TYPE, /* T (contained subtype) */ ACT_EL_VALUE, /* 123, "A", (elementary value) */ ACT_EL_RANGE, /* 1..2 (elementary range) */ ACT_EL_LLRANGE, /* 1<..2 (elementary range) */ ACT_EL_RLRANGE, /* 1..<2 (elementary range) */ ACT_EL_ULRANGE, /* 1<..<2 (elementary range) */ ACT_EL_EXT, /* ... (extensibility mark) */ /* * Constraint types. */ ACT_CT_SIZE, /* SIZE constraint type */ ACT_CT_FROM, /* FROM constraint type */ ACT_CT_WCOMP, /* WITH COMPONENT */ ACT_CT_WCOMPS, /* WITH COMPONENTS */ ACT_CT_CTDBY, /* CONSTRAINED BY */ ACT_CT_CTNG, /* CONTAINING Type */ ACT_CT_PATTERN, /* PATTERN Value */ /* * Arrays of constraints. */ ACT_CA_SET, /* A set of constraints: (c1)(c2) */ ACT_CA_CRC, /* Comp. relation c-t: ({a}{@b}) */ ACT_CA_CSV, /* Comma-separated constraints array */ ACT_CA_UNI, /* UNION (|) */ ACT_CA_INT, /* INTERSECTION (^) */ ACT_CA_EXC, /* EXCEPT */ ACT_CA_AEX, /* ALL EXCEPT */ } type; enum asn1p_constr_pres_e { ACPRES_DEFAULT, ACPRES_PRESENT, ACPRES_ABSENT, ACPRES_OPTIONAL, } presence; /* * Separate types and values. */ asn1p_value_t *containedSubtype; asn1p_value_t *value; asn1p_value_t *range_start; asn1p_value_t *range_stop; /* * A collection of constraint elements. */ struct asn1p_constraint_s **elements; unsigned int el_count; /* Number of meaningful elements */ unsigned int el_size; /* Size of the allocated (elements) */ int _lineno; /* Position in a source file */ } asn1p_constraint_t; /* Human-readable constraint type description */ char *asn1p_constraint_type2str(enum asn1p_constraint_type_e); /* * Constructors and a recursive destructor. */ asn1p_constraint_t *asn1p_constraint_new(int _lineno); void asn1p_constraint_free(asn1p_constraint_t *); /* * Clone the constraint and all its children. */ asn1p_constraint_t *asn1p_constraint_clone(asn1p_constraint_t *source_to_clone); asn1p_constraint_t *asn1p_constraint_clone_with_resolver( asn1p_constraint_t *source_to_clone, asn1p_value_t *(*resolver)(asn1p_value_t *, void *), void *); /* * Insert additional element into the element array of a (to) constraint. */ int asn1p_constraint_insert(asn1p_constraint_t *into, asn1p_constraint_t *what); int asn1p_constraint_prepend(asn1p_constraint_t *before, asn1p_constraint_t *what); #endif /* ASN1_PARSER_CONSTRAINT_H */ asn1c-0.9.28+dfsg/libasn1parser/asn1p_y.h0000644000000000000000000002111013065714043016523 0ustar rootroot/* A Bison parser, made by GNU Bison 2.3. */ /* Skeleton interface for Bison's Yacc-like parsers in C Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { TOK_PPEQ = 258, TOK_VBracketLeft = 259, TOK_VBracketRight = 260, TOK_whitespace = 261, TOK_opaque = 262, TOK_bstring = 263, TOK_cstring = 264, TOK_hstring = 265, TOK_identifier = 266, TOK_number = 267, TOK_number_negative = 268, TOK_realnumber = 269, TOK_tuple = 270, TOK_quadruple = 271, TOK_typereference = 272, TOK_capitalreference = 273, TOK_typefieldreference = 274, TOK_valuefieldreference = 275, TOK_Literal = 276, TOK_ABSENT = 277, TOK_ABSTRACT_SYNTAX = 278, TOK_ALL = 279, TOK_ANY = 280, TOK_APPLICATION = 281, TOK_AUTOMATIC = 282, TOK_BEGIN = 283, TOK_BIT = 284, TOK_BMPString = 285, TOK_BOOLEAN = 286, TOK_BY = 287, TOK_CHARACTER = 288, TOK_CHOICE = 289, TOK_CLASS = 290, TOK_COMPONENT = 291, TOK_COMPONENTS = 292, TOK_CONSTRAINED = 293, TOK_CONTAINING = 294, TOK_DEFAULT = 295, TOK_DEFINITIONS = 296, TOK_DEFINED = 297, TOK_EMBEDDED = 298, TOK_ENCODED = 299, TOK_ENCODING_CONTROL = 300, TOK_END = 301, TOK_ENUMERATED = 302, TOK_EXPLICIT = 303, TOK_EXPORTS = 304, TOK_EXTENSIBILITY = 305, TOK_EXTERNAL = 306, TOK_FALSE = 307, TOK_FROM = 308, TOK_GeneralizedTime = 309, TOK_GeneralString = 310, TOK_GraphicString = 311, TOK_IA5String = 312, TOK_IDENTIFIER = 313, TOK_IMPLICIT = 314, TOK_IMPLIED = 315, TOK_IMPORTS = 316, TOK_INCLUDES = 317, TOK_INSTANCE = 318, TOK_INSTRUCTIONS = 319, TOK_INTEGER = 320, TOK_ISO646String = 321, TOK_MAX = 322, TOK_MIN = 323, TOK_MINUS_INFINITY = 324, TOK_NULL = 325, TOK_NumericString = 326, TOK_OBJECT = 327, TOK_ObjectDescriptor = 328, TOK_OCTET = 329, TOK_OF = 330, TOK_OPTIONAL = 331, TOK_PATTERN = 332, TOK_PDV = 333, TOK_PLUS_INFINITY = 334, TOK_PRESENT = 335, TOK_PrintableString = 336, TOK_PRIVATE = 337, TOK_REAL = 338, TOK_RELATIVE_OID = 339, TOK_SEQUENCE = 340, TOK_SET = 341, TOK_SIZE = 342, TOK_STRING = 343, TOK_SYNTAX = 344, TOK_T61String = 345, TOK_TAGS = 346, TOK_TeletexString = 347, TOK_TRUE = 348, TOK_TYPE_IDENTIFIER = 349, TOK_UNIQUE = 350, TOK_UNIVERSAL = 351, TOK_UniversalString = 352, TOK_UTCTime = 353, TOK_UTF8String = 354, TOK_VideotexString = 355, TOK_VisibleString = 356, TOK_WITH = 357, TOK_EXCEPT = 358, TOK_INTERSECTION = 359, TOK_UNION = 360, TOK_TwoDots = 361, TOK_ThreeDots = 362 }; #endif /* Tokens. */ #define TOK_PPEQ 258 #define TOK_VBracketLeft 259 #define TOK_VBracketRight 260 #define TOK_whitespace 261 #define TOK_opaque 262 #define TOK_bstring 263 #define TOK_cstring 264 #define TOK_hstring 265 #define TOK_identifier 266 #define TOK_number 267 #define TOK_number_negative 268 #define TOK_realnumber 269 #define TOK_tuple 270 #define TOK_quadruple 271 #define TOK_typereference 272 #define TOK_capitalreference 273 #define TOK_typefieldreference 274 #define TOK_valuefieldreference 275 #define TOK_Literal 276 #define TOK_ABSENT 277 #define TOK_ABSTRACT_SYNTAX 278 #define TOK_ALL 279 #define TOK_ANY 280 #define TOK_APPLICATION 281 #define TOK_AUTOMATIC 282 #define TOK_BEGIN 283 #define TOK_BIT 284 #define TOK_BMPString 285 #define TOK_BOOLEAN 286 #define TOK_BY 287 #define TOK_CHARACTER 288 #define TOK_CHOICE 289 #define TOK_CLASS 290 #define TOK_COMPONENT 291 #define TOK_COMPONENTS 292 #define TOK_CONSTRAINED 293 #define TOK_CONTAINING 294 #define TOK_DEFAULT 295 #define TOK_DEFINITIONS 296 #define TOK_DEFINED 297 #define TOK_EMBEDDED 298 #define TOK_ENCODED 299 #define TOK_ENCODING_CONTROL 300 #define TOK_END 301 #define TOK_ENUMERATED 302 #define TOK_EXPLICIT 303 #define TOK_EXPORTS 304 #define TOK_EXTENSIBILITY 305 #define TOK_EXTERNAL 306 #define TOK_FALSE 307 #define TOK_FROM 308 #define TOK_GeneralizedTime 309 #define TOK_GeneralString 310 #define TOK_GraphicString 311 #define TOK_IA5String 312 #define TOK_IDENTIFIER 313 #define TOK_IMPLICIT 314 #define TOK_IMPLIED 315 #define TOK_IMPORTS 316 #define TOK_INCLUDES 317 #define TOK_INSTANCE 318 #define TOK_INSTRUCTIONS 319 #define TOK_INTEGER 320 #define TOK_ISO646String 321 #define TOK_MAX 322 #define TOK_MIN 323 #define TOK_MINUS_INFINITY 324 #define TOK_NULL 325 #define TOK_NumericString 326 #define TOK_OBJECT 327 #define TOK_ObjectDescriptor 328 #define TOK_OCTET 329 #define TOK_OF 330 #define TOK_OPTIONAL 331 #define TOK_PATTERN 332 #define TOK_PDV 333 #define TOK_PLUS_INFINITY 334 #define TOK_PRESENT 335 #define TOK_PrintableString 336 #define TOK_PRIVATE 337 #define TOK_REAL 338 #define TOK_RELATIVE_OID 339 #define TOK_SEQUENCE 340 #define TOK_SET 341 #define TOK_SIZE 342 #define TOK_STRING 343 #define TOK_SYNTAX 344 #define TOK_T61String 345 #define TOK_TAGS 346 #define TOK_TeletexString 347 #define TOK_TRUE 348 #define TOK_TYPE_IDENTIFIER 349 #define TOK_UNIQUE 350 #define TOK_UNIVERSAL 351 #define TOK_UniversalString 352 #define TOK_UTCTime 353 #define TOK_UTF8String 354 #define TOK_VideotexString 355 #define TOK_VisibleString 356 #define TOK_WITH 357 #define TOK_EXCEPT 358 #define TOK_INTERSECTION 359 #define TOK_UNION 360 #define TOK_TwoDots 361 #define TOK_ThreeDots 362 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE #line 88 "asn1p_y.y" { asn1p_t *a_grammar; asn1p_module_flags_e a_module_flags; asn1p_module_t *a_module; asn1p_expr_type_e a_type; /* ASN.1 Type */ asn1p_expr_t *a_expr; /* Constructed collection */ asn1p_constraint_t *a_constr; /* Constraint */ enum asn1p_constraint_type_e a_ctype;/* Constraint type */ asn1p_xports_t *a_xports; /* IMports/EXports */ struct AssignedIdentifier a_aid; /* Assigned Identifier */ asn1p_oid_t *a_oid; /* Object Identifier */ asn1p_oid_arc_t a_oid_arc; /* Single OID's arc */ struct asn1p_type_tag_s a_tag; /* A tag */ asn1p_ref_t *a_ref; /* Reference to custom type */ asn1p_wsyntx_t *a_wsynt; /* WITH SYNTAX contents */ asn1p_wsyntx_chunk_t *a_wchunk; /* WITH SYNTAX chunk */ struct asn1p_ref_component_s a_refcomp; /* Component of a reference */ asn1p_value_t *a_value; /* Number, DefinedValue, etc */ struct asn1p_param_s a_parg; /* A parameter argument */ asn1p_paramlist_t *a_plist; /* A pargs list */ struct asn1p_expr_marker_s a_marker; /* OPTIONAL/DEFAULT */ enum asn1p_constr_pres_e a_pres; /* PRESENT/ABSENT/OPTIONAL */ asn1c_integer_t a_int; double a_dbl; char *tv_str; struct { char *buf; int len; } tv_opaque; struct { char *name; struct asn1p_type_tag_s tag; } tv_nametag; } /* Line 1529 of yacc.c. */ #line 298 "y.tab.h" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 #endif extern YYSTYPE asn1p_lval; asn1c-0.9.28+dfsg/libasn1parser/asn1p_y.y0000644000000000000000000014651713065714043016567 0ustar rootroot%{ #include #include #include #include #include #include "asn1parser.h" #define YYPARSE_PARAM param #define YYPARSE_PARAM_TYPE void ** #define YYERROR_VERBOSE int yylex(void); int yyerror(const char *msg); #ifdef YYBYACC int yyparse(void **param); /* byacc does not produce a prototype */ #endif void asn1p_lexer_hack_push_opaque_state(void); void asn1p_lexer_hack_enable_with_syntax(void); void asn1p_lexer_hack_push_encoding_control(void); #define yylineno asn1p_lineno extern int asn1p_lineno; /* * Process directives as */ extern int asn1p_as_pointer; /* * This temporary variable is used to solve the shortcomings of 1-lookahead * parser. */ static struct AssignedIdentifier *saved_aid; static asn1p_value_t *_convert_bitstring2binary(char *str, int base); static void _fixup_anonymous_identifier(asn1p_expr_t *expr); static asn1p_module_t *currentModule; #define NEW_EXPR() (asn1p_expr_new(yylineno, currentModule)) #define checkmem(ptr) do { \ if(!(ptr)) \ return yyerror("Memory failure"); \ } while(0) #define CONSTRAINT_INSERT(root, constr_type, arg1, arg2) do { \ if(arg1->type != constr_type) { \ int __ret; \ root = asn1p_constraint_new(yylineno); \ checkmem(root); \ root->type = constr_type; \ __ret = asn1p_constraint_insert(root, \ arg1); \ checkmem(__ret == 0); \ } else { \ root = arg1; \ } \ if(arg2) { \ int __ret \ = asn1p_constraint_insert(root, arg2); \ checkmem(__ret == 0); \ } \ } while(0) #ifdef AL_IMPORT #error AL_IMPORT DEFINED ELSEWHERE! #endif #define AL_IMPORT(to,where,from,field) do { \ if(!(from)) break; \ while(TQ_FIRST(&((from)->where))) { \ TQ_ADD(&((to)->where), \ TQ_REMOVE(&((from)->where), field), \ field); \ } \ assert(TQ_FIRST(&((from)->where)) == 0); \ } while(0) %} /* * Token value definition. * a_*: ASN-specific types. * tv_*: Locally meaningful types. */ %union { asn1p_t *a_grammar; asn1p_module_flags_e a_module_flags; asn1p_module_t *a_module; asn1p_expr_type_e a_type; /* ASN.1 Type */ asn1p_expr_t *a_expr; /* Constructed collection */ asn1p_constraint_t *a_constr; /* Constraint */ enum asn1p_constraint_type_e a_ctype;/* Constraint type */ asn1p_xports_t *a_xports; /* IMports/EXports */ struct AssignedIdentifier a_aid; /* Assigned Identifier */ asn1p_oid_t *a_oid; /* Object Identifier */ asn1p_oid_arc_t a_oid_arc; /* Single OID's arc */ struct asn1p_type_tag_s a_tag; /* A tag */ asn1p_ref_t *a_ref; /* Reference to custom type */ asn1p_wsyntx_t *a_wsynt; /* WITH SYNTAX contents */ asn1p_wsyntx_chunk_t *a_wchunk; /* WITH SYNTAX chunk */ struct asn1p_ref_component_s a_refcomp; /* Component of a reference */ asn1p_value_t *a_value; /* Number, DefinedValue, etc */ struct asn1p_param_s a_parg; /* A parameter argument */ asn1p_paramlist_t *a_plist; /* A pargs list */ struct asn1p_expr_marker_s a_marker; /* OPTIONAL/DEFAULT */ enum asn1p_constr_pres_e a_pres; /* PRESENT/ABSENT/OPTIONAL */ asn1c_integer_t a_int; double a_dbl; char *tv_str; struct { char *buf; int len; } tv_opaque; struct { char *name; struct asn1p_type_tag_s tag; } tv_nametag; }; /* * Token types returned by scanner. */ %token TOK_PPEQ /* "::=", Pseudo Pascal EQuality */ %token TOK_VBracketLeft TOK_VBracketRight /* "[[", "]]" */ %token TOK_whitespace /* A span of whitespace */ %token TOK_opaque /* opaque data (driven from .y) */ %token TOK_bstring %token TOK_cstring %token TOK_hstring %token TOK_identifier %token TOK_number %token TOK_number_negative %token TOK_realnumber %token TOK_tuple %token TOK_quadruple %token TOK_typereference %token TOK_capitalreference /* "CLASS1" */ %token TOK_typefieldreference /* "&Pork" */ %token TOK_valuefieldreference /* "&id" */ %token TOK_Literal /* "BY" */ /* * Token types representing ASN.1 standard keywords. */ %token TOK_ABSENT %token TOK_ABSTRACT_SYNTAX %token TOK_ALL %token TOK_ANY %token TOK_APPLICATION %token TOK_AUTOMATIC %token TOK_BEGIN %token TOK_BIT %token TOK_BMPString %token TOK_BOOLEAN %token TOK_BY %token TOK_CHARACTER %token TOK_CHOICE %token TOK_CLASS %token TOK_COMPONENT %token TOK_COMPONENTS %token TOK_CONSTRAINED %token TOK_CONTAINING %token TOK_DEFAULT %token TOK_DEFINITIONS %token TOK_DEFINED %token TOK_EMBEDDED %token TOK_ENCODED %token TOK_ENCODING_CONTROL %token TOK_END %token TOK_ENUMERATED %token TOK_EXPLICIT %token TOK_EXPORTS %token TOK_EXTENSIBILITY %token TOK_EXTERNAL %token TOK_FALSE %token TOK_FROM %token TOK_GeneralizedTime %token TOK_GeneralString %token TOK_GraphicString %token TOK_IA5String %token TOK_IDENTIFIER %token TOK_IMPLICIT %token TOK_IMPLIED %token TOK_IMPORTS %token TOK_INCLUDES %token TOK_INSTANCE %token TOK_INSTRUCTIONS %token TOK_INTEGER %token TOK_ISO646String %token TOK_MAX %token TOK_MIN %token TOK_MINUS_INFINITY %token TOK_NULL %token TOK_NumericString %token TOK_OBJECT %token TOK_ObjectDescriptor %token TOK_OCTET %token TOK_OF %token TOK_OPTIONAL %token TOK_PATTERN %token TOK_PDV %token TOK_PLUS_INFINITY %token TOK_PRESENT %token TOK_PrintableString %token TOK_PRIVATE %token TOK_REAL %token TOK_RELATIVE_OID %token TOK_SEQUENCE %token TOK_SET %token TOK_SIZE %token TOK_STRING %token TOK_SYNTAX %token TOK_T61String %token TOK_TAGS %token TOK_TeletexString %token TOK_TRUE %token TOK_TYPE_IDENTIFIER %token TOK_UNIQUE %token TOK_UNIVERSAL %token TOK_UniversalString %token TOK_UTCTime %token TOK_UTF8String %token TOK_VideotexString %token TOK_VisibleString %token TOK_WITH %nonassoc TOK_EXCEPT %left '^' TOK_INTERSECTION %left '|' TOK_UNION /* Misc tags */ %token TOK_TwoDots /* .. */ %token TOK_ThreeDots /* ... */ /* * Types defined herein. */ %type ModuleList %type ModuleDefinition %type ModuleBody %type AssignmentList %type Assignment %type optModuleBody /* Optional */ %type optModuleDefinitionFlags %type ModuleDefinitionFlags /* Set of FL */ %type ModuleDefinitionFlag /* Single FL */ %type optImports %type optExports %type ImportsDefinition %type optImportsBundleSet %type ImportsBundleSet %type ImportsBundle %type ImportsList %type ExportsDefinition %type ExportsBody %type ImportsElement %type ExportsElement %type ExtensionAndException %type Type %type TypeDeclaration %type TypeDeclarationSet %type ComplexTypeReference %type ComplexTypeReferenceAmpList %type ComplexTypeReferenceElement %type PrimitiveFieldReference %type FieldSpec %type FieldName %type DefinedObjectClass %type ClassField %type ObjectClass %type DataTypeReference /* Type1 ::= Type2 */ %type DefinedType %type ValueSet /* {a|b|c}*/ %type ValueSetTypeAssignment /* Val INTEGER ::= {1|2} */ %type ValueAssignment /* val INTEGER ::= 1*/ %type Value %type SimpleValue %type DefinedValue %type SignedNumber %type RealValue %type BitStringValue %type optComponentTypeLists %type ComponentTypeLists %type ComponentType %type AlternativeTypeLists %type AlternativeType %type UniverationDefinition %type UniverationList %type UniverationElement %type TypeRefName %type ObjectClassReference %type Identifier %type optIdentifier %type ParameterArgumentName %type ParameterArgumentList %type ActualParameter %type ActualParameterList %type AssignedIdentifier /* OID/DefinedValue */ %type ObjectIdentifier /* OID */ %type optObjectIdentifier /* Optional OID */ %type ObjectIdentifierBody %type ObjectIdentifierElement %type BasicType %type BasicTypeId %type BasicTypeId_UniverationCompatible %type BasicString %type Opaque %type Tag /* [UNIVERSAL 0] IMPLICIT */ %type TagClass TagTypeValue TagPlicit %type optTag /* [UNIVERSAL 0] IMPLICIT */ %type optConstraints %type Constraint %type SubtypeConstraint %type GeneralConstraint %type SetOfConstraints %type ElementSetSpecs /* 1..2,...,3 */ %type ElementSetSpec /* 1..2,...,3 */ %type Unions %type Intersections %type IntersectionElements %type ConstraintSubtypeElement /* 1..2 */ %type SimpleTableConstraint %type UserDefinedConstraint %type TableConstraint %type ContentsConstraint %type PatternConstraint %type InnerTypeConstraint %type WithComponentsList %type WithComponentsElement %type ComponentRelationConstraint %type AtNotationList %type AtNotationElement %type SingleValue %type ContainedSubtype %type ConstraintSpec %type ConstraintRangeSpec %type RestrictedCharacterStringValue %type optWithSyntax %type WithSyntax %type WithSyntaxList %type WithSyntaxToken %type optMarker Marker %type optUnique %type optPresenceConstraint PresenceConstraint %type ComponentIdList %type NSTD_IndirectMarker %% ParsedGrammar: ModuleList { *(void **)param = $1; } ; ModuleList: ModuleDefinition { $$ = asn1p_new(); checkmem($$); TQ_ADD(&($$->modules), $1, mod_next); } | ModuleList ModuleDefinition { $$ = $1; TQ_ADD(&($$->modules), $2, mod_next); } ; /* * ASN module definition. * === EXAMPLE === * MySyntax DEFINITIONS AUTOMATIC TAGS ::= * BEGIN * ... * END * === EOF === */ ModuleDefinition: TypeRefName { currentModule = asn1p_module_new(); } optObjectIdentifier TOK_DEFINITIONS optModuleDefinitionFlags TOK_PPEQ TOK_BEGIN optModuleBody TOK_END { $$ = currentModule; if($8) { asn1p_module_t tmp = *($$); *($$) = *($8); *($8) = tmp; asn1p_module_free($8); } else { /* There's a chance that a module is just plain empty */ } $$->ModuleName = $1; $$->module_oid = $3; $$->module_flags = $5; } ; /* * Object Identifier Definition * { iso member-body(2) 3 } */ optObjectIdentifier: { $$ = 0; } | ObjectIdentifier { $$ = $1; } ; ObjectIdentifier: '{' ObjectIdentifierBody '}' { $$ = $2; } | '{' '}' { $$ = 0; } ; ObjectIdentifierBody: ObjectIdentifierElement { $$ = asn1p_oid_new(); asn1p_oid_add_arc($$, &$1); if($1.name) free($1.name); } | ObjectIdentifierBody ObjectIdentifierElement { $$ = $1; asn1p_oid_add_arc($$, &$2); if($2.name) free($2.name); } ; ObjectIdentifierElement: Identifier { /* iso */ $$.name = $1; $$.number = -1; } | Identifier '(' TOK_number ')' { /* iso(1) */ $$.name = $1; $$.number = $3; } | TOK_number { /* 1 */ $$.name = 0; $$.number = $1; } ; /* * Optional module flags. */ optModuleDefinitionFlags: { $$ = MSF_NOFLAGS; } | ModuleDefinitionFlags { $$ = $1; } ; /* * Module flags. */ ModuleDefinitionFlags: ModuleDefinitionFlag { $$ = $1; } | ModuleDefinitionFlags ModuleDefinitionFlag { $$ = $1 | $2; } ; /* * Single module flag. */ ModuleDefinitionFlag: TOK_EXPLICIT TOK_TAGS { $$ = MSF_EXPLICIT_TAGS; } | TOK_IMPLICIT TOK_TAGS { $$ = MSF_IMPLICIT_TAGS; } | TOK_AUTOMATIC TOK_TAGS { $$ = MSF_AUTOMATIC_TAGS; } | TOK_EXTENSIBILITY TOK_IMPLIED { $$ = MSF_EXTENSIBILITY_IMPLIED; } /* EncodingReferenceDefault */ | TOK_capitalreference TOK_INSTRUCTIONS { /* X.680Amd1 specifies TAG and XER */ if(strcmp($1, "TAG") == 0) { $$ = MSF_TAG_INSTRUCTIONS; } else if(strcmp($1, "XER") == 0) { $$ = MSF_XER_INSTRUCTIONS; } else { fprintf(stderr, "WARNING: %s INSTRUCTIONS at line %d: " "Unrecognized encoding reference\n", $1, yylineno); $$ = MSF_unk_INSTRUCTIONS; } free($1); } ; /* * Optional module body. */ optModuleBody: { $$ = 0; } | ModuleBody { $$ = $1; } ; /* * ASN.1 Module body. */ ModuleBody: optExports optImports AssignmentList { $$ = asn1p_module_new(); AL_IMPORT($$, exports, $1, xp_next); AL_IMPORT($$, imports, $2, xp_next); AL_IMPORT($$, members, $3, next); } ; AssignmentList: Assignment { $$ = $1; } | AssignmentList Assignment { if($1) { $$ = $1; } else { $$ = $2; break; } AL_IMPORT($$, members, $2, next); } ; /* * One of the elements of ASN.1 module specification. */ Assignment: DataTypeReference { $$ = asn1p_module_new(); checkmem($$); assert($1->expr_type != A1TC_INVALID); assert($1->meta_type != AMT_INVALID); TQ_ADD(&($$->members), $1, next); } | ValueAssignment { $$ = asn1p_module_new(); checkmem($$); assert($1->expr_type != A1TC_INVALID); assert($1->meta_type != AMT_INVALID); TQ_ADD(&($$->members), $1, next); } /* * Value set definition * === EXAMPLE === * EvenNumbers INTEGER ::= { 2 | 4 | 6 | 8 } * === EOF === */ | ValueSetTypeAssignment { $$ = asn1p_module_new(); checkmem($$); assert($1->expr_type != A1TC_INVALID); assert($1->meta_type != AMT_INVALID); TQ_ADD(&($$->members), $1, next); } | TOK_ENCODING_CONTROL TOK_capitalreference { asn1p_lexer_hack_push_encoding_control(); } { fprintf(stderr, "WARNING: ENCODING-CONTROL %s " "specification at line %d ignored\n", $2, yylineno); free($2); $$ = 0; } /* * Erroneous attemps */ | BasicString { return yyerror( "Attempt to redefine a standard basic string type, " "please comment out or remove this type redefinition."); } ; /* * === EXAMPLE === * IMPORTS Type1, value FROM Module { iso standard(0) } ; * === EOF === */ optImports: { $$ = 0; } | ImportsDefinition; ImportsDefinition: TOK_IMPORTS optImportsBundleSet ';' { if(!saved_aid && 0) return yyerror("Unterminated IMPORTS FROM, " "expected semicolon ';'"); saved_aid = 0; $$ = $2; } /* * Some error cases. */ | TOK_IMPORTS TOK_FROM /* ... */ { return yyerror("Empty IMPORTS list"); } ; optImportsBundleSet: { $$ = asn1p_module_new(); } | ImportsBundleSet; ImportsBundleSet: ImportsBundle { $$ = asn1p_module_new(); checkmem($$); TQ_ADD(&($$->imports), $1, xp_next); } | ImportsBundleSet ImportsBundle { $$ = $1; TQ_ADD(&($$->imports), $2, xp_next); } ; AssignedIdentifier: { memset(&$$, 0, sizeof($$)); } | ObjectIdentifier { $$.oid = $1; }; /* | DefinedValue { $$.value = $1; }; // Handled through saved_aid */ ImportsBundle: ImportsList TOK_FROM TypeRefName AssignedIdentifier { $$ = $1; $$->fromModuleName = $3; $$->identifier = $4; /* This stupid thing is used for look-back hack. */ saved_aid = $$->identifier.oid ? 0 : &($$->identifier); checkmem($$); } ; ImportsList: ImportsElement { $$ = asn1p_xports_new(); checkmem($$); TQ_ADD(&($$->members), $1, next); } | ImportsList ',' ImportsElement { $$ = $1; TQ_ADD(&($$->members), $3, next); } ; ImportsElement: TypeRefName { $$ = NEW_EXPR(); checkmem($$); $$->Identifier = $1; $$->expr_type = A1TC_REFERENCE; } | TypeRefName '{' '}' { /* Completely equivalent to above */ $$ = NEW_EXPR(); checkmem($$); $$->Identifier = $1; $$->expr_type = A1TC_REFERENCE; } | Identifier { $$ = NEW_EXPR(); checkmem($$); $$->Identifier = $1; $$->expr_type = A1TC_REFERENCE; } ; optExports: { $$ = 0; } | ExportsDefinition { $$ = asn1p_module_new(); checkmem($$); if($1) { TQ_ADD(&($$->exports), $1, xp_next); } else { /* "EXPORTS ALL;" */ } } ; ExportsDefinition: TOK_EXPORTS ExportsBody ';' { $$ = $2; } | TOK_EXPORTS TOK_ALL ';' { $$ = 0; } | TOK_EXPORTS ';' { /* Empty EXPORTS clause effectively prohibits export. */ $$ = asn1p_xports_new(); checkmem($$); } ; ExportsBody: ExportsElement { $$ = asn1p_xports_new(); assert($$); TQ_ADD(&($$->members), $1, next); } | ExportsBody ',' ExportsElement { $$ = $1; TQ_ADD(&($$->members), $3, next); } ; ExportsElement: TypeRefName { $$ = NEW_EXPR(); checkmem($$); $$->Identifier = $1; $$->expr_type = A1TC_EXPORTVAR; } | TypeRefName '{' '}' { $$ = NEW_EXPR(); checkmem($$); $$->Identifier = $1; $$->expr_type = A1TC_EXPORTVAR; } | Identifier { $$ = NEW_EXPR(); checkmem($$); $$->Identifier = $1; $$->expr_type = A1TC_EXPORTVAR; } ; ValueSet: '{' ElementSetSpecs '}' { $$ = $2; }; ValueSetTypeAssignment: TypeRefName DefinedType TOK_PPEQ ValueSet { $$ = $2; assert($$->Identifier == 0); $$->Identifier = $1; $$->meta_type = AMT_VALUESET; $$->constraints = $4; } ; DefinedType: BasicType { $$ = $1; } /* * A DefinedType reference. * "CLASS1.&id.&id2" * or * "Module.Type" * or * "Module.identifier" * or * "Type" */ | ComplexTypeReference { $$ = NEW_EXPR(); checkmem($$); $$->reference = $1; $$->expr_type = A1TC_REFERENCE; $$->meta_type = AMT_TYPEREF; } /* * A parameterized assignment. */ | ComplexTypeReference '{' ActualParameterList '}' { $$ = NEW_EXPR(); checkmem($$); $$->reference = $1; $$->rhs_pspecs = $3; $$->expr_type = A1TC_REFERENCE; $$->meta_type = AMT_TYPEREF; } ; /* * Data Type Reference. * === EXAMPLE === * Type3 ::= CHOICE { a Type1, b Type 2 } * === EOF === */ DataTypeReference: /* * Optionally tagged type definition. */ TypeRefName TOK_PPEQ Type { $$ = $3; $$->Identifier = $1; assert($$->expr_type); assert($$->meta_type); } | TypeRefName TOK_PPEQ ObjectClass { $$ = $3; $$->Identifier = $1; assert($$->expr_type == A1TC_CLASSDEF); assert($$->meta_type == AMT_OBJECTCLASS); } /* * Parameterized declaration: * === EXAMPLE === * SIGNED { ToBeSigned } ::= SEQUENCE { * toBeSigned ToBeSigned, * algorithm AlgorithmIdentifier, * signature BIT STRING * } * === EOF === */ | TypeRefName '{' ParameterArgumentList '}' TOK_PPEQ Type { $$ = $6; $$->Identifier = $1; $$->lhs_params = $3; } /* Parameterized CLASS declaration */ | TypeRefName '{' ParameterArgumentList '}' TOK_PPEQ ObjectClass { $$ = $6; $$->Identifier = $1; $$->lhs_params = $3; } ; ParameterArgumentList: ParameterArgumentName { int ret; $$ = asn1p_paramlist_new(yylineno); checkmem($$); ret = asn1p_paramlist_add_param($$, $1.governor, $1.argument); checkmem(ret == 0); if($1.governor) asn1p_ref_free($1.governor); if($1.argument) free($1.argument); } | ParameterArgumentList ',' ParameterArgumentName { int ret; $$ = $1; ret = asn1p_paramlist_add_param($$, $3.governor, $3.argument); checkmem(ret == 0); if($3.governor) asn1p_ref_free($3.governor); if($3.argument) free($3.argument); } ; ParameterArgumentName: TypeRefName { $$.governor = NULL; $$.argument = $1; } | TypeRefName ':' Identifier { int ret; $$.governor = asn1p_ref_new(yylineno); ret = asn1p_ref_add_component($$.governor, $1, 0); checkmem(ret == 0); $$.argument = $3; } | TypeRefName ':' TypeRefName { int ret; $$.governor = asn1p_ref_new(yylineno); ret = asn1p_ref_add_component($$.governor, $1, 0); checkmem(ret == 0); $$.argument = $3; } | BasicTypeId ':' Identifier { int ret; $$.governor = asn1p_ref_new(yylineno); ret = asn1p_ref_add_component($$.governor, ASN_EXPR_TYPE2STR($1), 1); checkmem(ret == 0); $$.argument = $3; } | BasicTypeId ':' TypeRefName { int ret; $$.governor = asn1p_ref_new(yylineno); ret = asn1p_ref_add_component($$.governor, ASN_EXPR_TYPE2STR($1), 1); checkmem(ret == 0); $$.argument = $3; } ; ActualParameterList: ActualParameter { $$ = NEW_EXPR(); checkmem($$); asn1p_expr_add($$, $1); } | ActualParameterList ',' ActualParameter { $$ = $1; asn1p_expr_add($$, $3); } ; ActualParameter: Type { $$ = $1; } | SimpleValue { $$ = NEW_EXPR(); checkmem($$); $$->Identifier = "?"; $$->expr_type = A1TC_REFERENCE; $$->meta_type = AMT_VALUE; $$->value = $1; } | Identifier { asn1p_ref_t *ref; $$ = NEW_EXPR(); checkmem($$); $$->Identifier = $1; $$->expr_type = A1TC_REFERENCE; $$->meta_type = AMT_VALUE; ref = asn1p_ref_new(yylineno); asn1p_ref_add_component(ref, $1, RLT_lowercase); $$->value = asn1p_value_fromref(ref, 0); } | ValueSet { $$ = NEW_EXPR(); $$->expr_type = A1TC_VALUESET; $$->meta_type = AMT_VALUESET; $$->constraints = $1; } ; /* | '{' ActualParameter '}' { $$ = NEW_EXPR(); checkmem($$); asn1p_expr_add($$, $2); $$->expr_type = A1TC_PARAMETRIZED; $$->meta_type = AMT_TYPE; } ; */ /* * A collection of constructed data type members. */ optComponentTypeLists: { $$ = NEW_EXPR(); } | ComponentTypeLists { $$ = $1; }; ComponentTypeLists: ComponentType { $$ = NEW_EXPR(); checkmem($$); asn1p_expr_add($$, $1); } | ComponentTypeLists ',' ComponentType { $$ = $1; asn1p_expr_add($$, $3); } | ComponentTypeLists ',' TOK_VBracketLeft ComponentTypeLists TOK_VBracketRight { $$ = $1; asn1p_expr_add_many($$, $4); } ; ComponentType: Identifier Type optMarker { $$ = $2; assert($$->Identifier == 0); $$->Identifier = $1; $3.flags |= $$->marker.flags; $$->marker = $3; } | Type optMarker { $$ = $1; $2.flags |= $$->marker.flags; $$->marker = $2; _fixup_anonymous_identifier($$); } | TOK_COMPONENTS TOK_OF Type { $$ = NEW_EXPR(); checkmem($$); $$->meta_type = $3->meta_type; $$->expr_type = A1TC_COMPONENTS_OF; asn1p_expr_add($$, $3); } | ExtensionAndException { $$ = $1; } ; AlternativeTypeLists: AlternativeType { $$ = NEW_EXPR(); checkmem($$); asn1p_expr_add($$, $1); } | AlternativeTypeLists ',' AlternativeType { $$ = $1; asn1p_expr_add($$, $3); } ; AlternativeType: Identifier Type { $$ = $2; assert($$->Identifier == 0); $$->Identifier = $1; } | ExtensionAndException { $$ = $1; } | Type { $$ = $1; _fixup_anonymous_identifier($$); } ; ObjectClass: TOK_CLASS '{' FieldSpec '}' optWithSyntax { $$ = $3; checkmem($$); $$->with_syntax = $5; assert($$->expr_type == A1TC_CLASSDEF); assert($$->meta_type == AMT_OBJECTCLASS); } ; optUnique: { $$ = 0; } | TOK_UNIQUE { $$ = 1; } ; FieldSpec: ClassField { $$ = NEW_EXPR(); checkmem($$); $$->expr_type = A1TC_CLASSDEF; $$->meta_type = AMT_OBJECTCLASS; asn1p_expr_add($$, $1); } | FieldSpec ',' ClassField { $$ = $1; asn1p_expr_add($$, $3); } ; /* X.681 */ ClassField: /* TypeFieldSpec ::= typefieldreference TypeOptionalitySpec? */ TOK_typefieldreference optMarker { $$ = NEW_EXPR(); checkmem($$); $$->Identifier = $1; $$->meta_type = AMT_OBJECTFIELD; $$->expr_type = A1TC_CLASSFIELD_TFS; /* TypeFieldSpec */ $$->marker = $2; } /* FixedTypeValueFieldSpec ::= valuefieldreference Type UNIQUE ? ValueOptionalitySpec ? */ | TOK_valuefieldreference Type optUnique optMarker { $$ = NEW_EXPR(); $$->Identifier = $1; $$->meta_type = AMT_OBJECTFIELD; $$->expr_type = A1TC_CLASSFIELD_FTVFS; /* FixedTypeValueFieldSpec */ $$->unique = $3; $$->marker = $4; asn1p_expr_add($$, $2); } /* VariableTypeValueFieldSpec ::= valuefieldreference FieldName ValueOptionalitySpec ? */ | TOK_valuefieldreference FieldName optMarker { $$ = NEW_EXPR(); $$->Identifier = $1; $$->meta_type = AMT_OBJECTFIELD; $$->expr_type = A1TC_CLASSFIELD_VTVFS; $$->reference = $2; $$->marker = $3; } /* ObjectFieldSpec ::= objectfieldreference DefinedObjectClass ObjectOptionalitySpec ? */ | TOK_valuefieldreference DefinedObjectClass optMarker { $$ = NEW_EXPR(); checkmem($$); $$->Identifier = $1; $$->reference = $2; $$->meta_type = AMT_OBJECTFIELD; $$->expr_type = A1TC_CLASSFIELD_OFS; $$->marker = $3; } /* VariableTypeValueSetFieldSpec ::= valuesetfieldreference FieldName ValueOptionalitySpec ? */ | TOK_typefieldreference FieldName optMarker { $$ = NEW_EXPR(); $$->Identifier = $1; $$->meta_type = AMT_OBJECTFIELD; $$->expr_type = A1TC_CLASSFIELD_VTVSFS; $$->reference = $2; $$->marker = $3; } /* FixedTypeValueSetFieldSpec ::= valuesetfieldreference Type ValueSetOptionalitySpec ? */ | TOK_typefieldreference Type optMarker { $$ = NEW_EXPR(); checkmem($$); $$->Identifier = $1; $$->meta_type = AMT_OBJECTFIELD; $$->expr_type = A1TC_CLASSFIELD_FTVSFS; asn1p_expr_add($$, $2); $$->marker = $3; } /* ObjectSetFieldSpec ::= objectsetfieldreference DefinedObjectClass ObjectOptionalitySpec ? */ | TOK_typefieldreference DefinedObjectClass optMarker { $$ = NEW_EXPR(); checkmem($$); $$->Identifier = $1; $$->reference = $2; $$->meta_type = AMT_OBJECTFIELD; $$->expr_type = A1TC_CLASSFIELD_OSFS; $$->marker = $3; } ; optWithSyntax: { $$ = 0; } | WithSyntax { $$ = $1; } ; WithSyntax: TOK_WITH TOK_SYNTAX '{' { asn1p_lexer_hack_enable_with_syntax(); } WithSyntaxList '}' { $$ = $5; } ; WithSyntaxList: WithSyntaxToken { $$ = asn1p_wsyntx_new(); TQ_ADD(&($$->chunks), $1, next); } | WithSyntaxList WithSyntaxToken { $$ = $1; TQ_ADD(&($$->chunks), $2, next); } ; WithSyntaxToken: TOK_whitespace { $$ = asn1p_wsyntx_chunk_fromstring($1.buf, 0); $$->type = WC_WHITESPACE; } | TOK_Literal { $$ = asn1p_wsyntx_chunk_fromstring($1, 0); } | PrimitiveFieldReference { $$ = asn1p_wsyntx_chunk_fromstring($1.name, 0); $$->type = WC_FIELD; } | '[' WithSyntaxList ']' { $$ = asn1p_wsyntx_chunk_fromsyntax($2); } ; ExtensionAndException: TOK_ThreeDots { $$ = NEW_EXPR(); checkmem($$); $$->Identifier = strdup("..."); checkmem($$->Identifier); $$->expr_type = A1TC_EXTENSIBLE; $$->meta_type = AMT_TYPE; } | TOK_ThreeDots '!' DefinedValue { $$ = NEW_EXPR(); checkmem($$); $$->Identifier = strdup("..."); checkmem($$->Identifier); $$->value = $3; $$->expr_type = A1TC_EXTENSIBLE; $$->meta_type = AMT_TYPE; } | TOK_ThreeDots '!' SignedNumber { $$ = NEW_EXPR(); checkmem($$); $$->Identifier = strdup("..."); $$->value = $3; checkmem($$->Identifier); $$->expr_type = A1TC_EXTENSIBLE; $$->meta_type = AMT_TYPE; } ; Type: optTag TypeDeclaration optConstraints { $$ = $2; $$->tag = $1; /* * Outer constraint for SEQUENCE OF and SET OF applies * to the inner type. */ if($$->expr_type == ASN_CONSTR_SEQUENCE_OF || $$->expr_type == ASN_CONSTR_SET_OF) { assert(!TQ_FIRST(&($$->members))->constraints); TQ_FIRST(&($$->members))->constraints = $3; } else { if($$->constraints) { assert(!$2); } else { $$->constraints = $3; } } } ; NSTD_IndirectMarker: { $$ = asn1p_as_pointer ? EM_INDIRECT : 0; asn1p_as_pointer = 0; } ; TypeDeclaration: NSTD_IndirectMarker TypeDeclarationSet { $$ = $2; $$->marker.flags |= $1; if(($$->marker.flags & EM_INDIRECT) && ($$->marker.flags & EM_OPTIONAL) != EM_OPTIONAL) { fprintf(stderr, "INFO: Directive " "applied to %s at line %d\n", ASN_EXPR_TYPE2STR($$->expr_type) ? ASN_EXPR_TYPE2STR($$->expr_type) : "member", $$->_lineno ); } } ; TypeDeclarationSet: DefinedType { $$ = $1; } | TOK_CHOICE '{' AlternativeTypeLists '}' { $$ = $3; assert($$->expr_type == A1TC_INVALID); $$->expr_type = ASN_CONSTR_CHOICE; $$->meta_type = AMT_TYPE; } | TOK_SEQUENCE '{' optComponentTypeLists '}' { $$ = $3; assert($$->expr_type == A1TC_INVALID); $$->expr_type = ASN_CONSTR_SEQUENCE; $$->meta_type = AMT_TYPE; } | TOK_SET '{' optComponentTypeLists '}' { $$ = $3; assert($$->expr_type == A1TC_INVALID); $$->expr_type = ASN_CONSTR_SET; $$->meta_type = AMT_TYPE; } | TOK_SEQUENCE optConstraints TOK_OF optIdentifier optTag TypeDeclaration { $$ = NEW_EXPR(); checkmem($$); $$->constraints = $2; $$->expr_type = ASN_CONSTR_SEQUENCE_OF; $$->meta_type = AMT_TYPE; $6->Identifier = $4; $6->tag = $5; asn1p_expr_add($$, $6); } | TOK_SET optConstraints TOK_OF optIdentifier optTag TypeDeclaration { $$ = NEW_EXPR(); checkmem($$); $$->constraints = $2; $$->expr_type = ASN_CONSTR_SET_OF; $$->meta_type = AMT_TYPE; $6->Identifier = $4; $6->tag = $5; asn1p_expr_add($$, $6); } | TOK_ANY { $$ = NEW_EXPR(); checkmem($$); $$->expr_type = ASN_TYPE_ANY; $$->meta_type = AMT_TYPE; } | TOK_ANY TOK_DEFINED TOK_BY Identifier { int ret; $$ = NEW_EXPR(); checkmem($$); $$->reference = asn1p_ref_new(yylineno); ret = asn1p_ref_add_component($$->reference, $4, RLT_lowercase); checkmem(ret == 0); $$->expr_type = ASN_TYPE_ANY; $$->meta_type = AMT_TYPE; } | TOK_INSTANCE TOK_OF ComplexTypeReference { $$ = NEW_EXPR(); checkmem($$); $$->reference = $3; $$->expr_type = A1TC_INSTANCE; $$->meta_type = AMT_TYPE; } ; /* * A type name consisting of several components. * === EXAMPLE === * === EOF === */ ComplexTypeReference: TOK_typereference { int ret; $$ = asn1p_ref_new(yylineno); checkmem($$); ret = asn1p_ref_add_component($$, $1, RLT_UNKNOWN); checkmem(ret == 0); free($1); } | TOK_typereference '.' TypeRefName { int ret; $$ = asn1p_ref_new(yylineno); checkmem($$); ret = asn1p_ref_add_component($$, $1, RLT_UNKNOWN); checkmem(ret == 0); ret = asn1p_ref_add_component($$, $3, RLT_UNKNOWN); checkmem(ret == 0); free($1); } | ObjectClassReference '.' TypeRefName { int ret; $$ = asn1p_ref_new(yylineno); checkmem($$); ret = asn1p_ref_add_component($$, $1, RLT_UNKNOWN); checkmem(ret == 0); ret = asn1p_ref_add_component($$, $3, RLT_UNKNOWN); checkmem(ret == 0); free($1); } | TOK_typereference '.' Identifier { int ret; $$ = asn1p_ref_new(yylineno); checkmem($$); ret = asn1p_ref_add_component($$, $1, RLT_UNKNOWN); checkmem(ret == 0); ret = asn1p_ref_add_component($$, $3, RLT_lowercase); checkmem(ret == 0); free($1); } | ObjectClassReference { int ret; $$ = asn1p_ref_new(yylineno); checkmem($$); ret = asn1p_ref_add_component($$, $1, RLT_CAPITALS); free($1); checkmem(ret == 0); } | ObjectClassReference '.' ComplexTypeReferenceAmpList { int ret; $$ = $3; ret = asn1p_ref_add_component($$, $1, RLT_CAPITALS); free($1); checkmem(ret == 0); /* * Move the last element infront. */ { struct asn1p_ref_component_s tmp_comp; tmp_comp = $$->components[$$->comp_count-1]; memmove(&$$->components[1], &$$->components[0], sizeof($$->components[0]) * ($$->comp_count - 1)); $$->components[0] = tmp_comp; } } ; ComplexTypeReferenceAmpList: ComplexTypeReferenceElement { int ret; $$ = asn1p_ref_new(yylineno); checkmem($$); ret = asn1p_ref_add_component($$, $1.name, $1.lex_type); free($1.name); checkmem(ret == 0); } | ComplexTypeReferenceAmpList '.' ComplexTypeReferenceElement { int ret; $$ = $1; ret = asn1p_ref_add_component($$, $3.name, $3.lex_type); free($3.name); checkmem(ret == 0); } ; ComplexTypeReferenceElement: PrimitiveFieldReference; PrimitiveFieldReference: /* "&Type1" */ TOK_typefieldreference { $$.lex_type = RLT_AmpUppercase; $$.name = $1; } /* "&id" */ | TOK_valuefieldreference { $$.lex_type = RLT_Amplowercase; $$.name = $1; } ; FieldName: /* "&Type1" */ TOK_typefieldreference { $$ = asn1p_ref_new(yylineno); asn1p_ref_add_component($$, $1, RLT_AmpUppercase); } | FieldName '.' TOK_typefieldreference { $$ = $$; asn1p_ref_add_component($$, $3, RLT_AmpUppercase); } | FieldName '.' TOK_valuefieldreference { $$ = $$; asn1p_ref_add_component($$, $3, RLT_Amplowercase); } ; DefinedObjectClass: TOK_capitalreference { $$ = asn1p_ref_new(yylineno); asn1p_ref_add_component($$, $1, RLT_CAPITALS); } /* | TypeRefName '.' TOK_capitalreference { $$ = asn1p_ref_new(yylineno); asn1p_ref_add_component($$, $1, RLT_AmpUppercase); asn1p_ref_add_component($$, $3, RLT_CAPITALS); } */ ; /* * === EXAMPLE === * value INTEGER ::= 1 * === EOF === */ ValueAssignment: Identifier Type TOK_PPEQ Value { $$ = $2; assert($$->Identifier == NULL); $$->Identifier = $1; $$->meta_type = AMT_VALUE; $$->value = $4; } ; Value: SimpleValue | DefinedValue | Identifier ':' Value { $$ = asn1p_value_fromint(0); checkmem($$); $$->type = ATV_CHOICE_IDENTIFIER; $$->value.choice_identifier.identifier = $1; $$->value.choice_identifier.value = $3; } | '{' { asn1p_lexer_hack_push_opaque_state(); } Opaque /* '}' */ { $$ = asn1p_value_frombuf($3.buf, $3.len, 0); checkmem($$); $$->type = ATV_UNPARSED; } | TOK_NULL { $$ = asn1p_value_fromint(0); checkmem($$); $$->type = ATV_NULL; } ; SimpleValue: TOK_FALSE { $$ = asn1p_value_fromint(0); checkmem($$); $$->type = ATV_FALSE; } | TOK_TRUE { $$ = asn1p_value_fromint(0); checkmem($$); $$->type = ATV_TRUE; } | TOK_bstring { $$ = _convert_bitstring2binary($1, 'B'); checkmem($$); } | TOK_hstring { $$ = _convert_bitstring2binary($1, 'H'); checkmem($$); } | RestrictedCharacterStringValue { $$ = $$; } | SignedNumber { $$ = $1; } ; DefinedValue: Identifier { asn1p_ref_t *ref; int ret; ref = asn1p_ref_new(yylineno); checkmem(ref); ret = asn1p_ref_add_component(ref, $1, RLT_lowercase); checkmem(ret == 0); $$ = asn1p_value_fromref(ref, 0); checkmem($$); free($1); } | TypeRefName '.' Identifier { asn1p_ref_t *ref; int ret; ref = asn1p_ref_new(yylineno); checkmem(ref); ret = asn1p_ref_add_component(ref, $1, RLT_UNKNOWN); checkmem(ret == 0); ret = asn1p_ref_add_component(ref, $3, RLT_lowercase); checkmem(ret == 0); $$ = asn1p_value_fromref(ref, 0); checkmem($$); free($1); free($3); } ; RestrictedCharacterStringValue: TOK_cstring { $$ = asn1p_value_frombuf($1.buf, $1.len, 0); checkmem($$); } | TOK_tuple { $$ = asn1p_value_fromint($1); checkmem($$); $$->type = ATV_TUPLE; } | TOK_quadruple { $$ = asn1p_value_fromint($1); checkmem($$); $$->type = ATV_QUADRUPLE; } ; Opaque: TOK_opaque { $$.len = $1.len + 1; $$.buf = malloc($$.len + 1); checkmem($$.buf); $$.buf[0] = '{'; memcpy($$.buf + 1, $1.buf, $1.len); $$.buf[$$.len] = '\0'; free($1.buf); } | Opaque TOK_opaque { int newsize = $1.len + $2.len; char *p = malloc(newsize + 1); checkmem(p); memcpy(p , $1.buf, $1.len); memcpy(p + $1.len, $2.buf, $2.len); p[newsize] = '\0'; free($1.buf); free($2.buf); $$.buf = p; $$.len = newsize; } ; BasicTypeId: TOK_BOOLEAN { $$ = ASN_BASIC_BOOLEAN; } | TOK_NULL { $$ = ASN_BASIC_NULL; } | TOK_REAL { $$ = ASN_BASIC_REAL; } | BasicTypeId_UniverationCompatible { $$ = $1; } | TOK_OCTET TOK_STRING { $$ = ASN_BASIC_OCTET_STRING; } | TOK_OBJECT TOK_IDENTIFIER { $$ = ASN_BASIC_OBJECT_IDENTIFIER; } | TOK_RELATIVE_OID { $$ = ASN_BASIC_RELATIVE_OID; } | TOK_EXTERNAL { $$ = ASN_BASIC_EXTERNAL; } | TOK_EMBEDDED TOK_PDV { $$ = ASN_BASIC_EMBEDDED_PDV; } | TOK_CHARACTER TOK_STRING { $$ = ASN_BASIC_CHARACTER_STRING; } | TOK_UTCTime { $$ = ASN_BASIC_UTCTime; } | TOK_GeneralizedTime { $$ = ASN_BASIC_GeneralizedTime; } | BasicString { $$ = $1; } ; /* * A type identifier which may be used with "{ a(1), b(2) }" clause. */ BasicTypeId_UniverationCompatible: TOK_INTEGER { $$ = ASN_BASIC_INTEGER; } | TOK_ENUMERATED { $$ = ASN_BASIC_ENUMERATED; } | TOK_BIT TOK_STRING { $$ = ASN_BASIC_BIT_STRING; } ; BasicType: BasicTypeId { $$ = NEW_EXPR(); checkmem($$); $$->expr_type = $1; $$->meta_type = AMT_TYPE; } | BasicTypeId_UniverationCompatible UniverationDefinition { if($2) { $$ = $2; } else { $$ = NEW_EXPR(); checkmem($$); } $$->expr_type = $1; $$->meta_type = AMT_TYPE; } ; BasicString: TOK_BMPString { $$ = ASN_STRING_BMPString; } | TOK_GeneralString { $$ = ASN_STRING_GeneralString; fprintf(stderr, "WARNING: GeneralString is not fully supported\n"); } | TOK_GraphicString { $$ = ASN_STRING_GraphicString; fprintf(stderr, "WARNING: GraphicString is not fully supported\n"); } | TOK_IA5String { $$ = ASN_STRING_IA5String; } | TOK_ISO646String { $$ = ASN_STRING_ISO646String; } | TOK_NumericString { $$ = ASN_STRING_NumericString; } | TOK_PrintableString { $$ = ASN_STRING_PrintableString; } | TOK_T61String { $$ = ASN_STRING_T61String; fprintf(stderr, "WARNING: T61String is not fully supported\n"); } | TOK_TeletexString { $$ = ASN_STRING_TeletexString; } | TOK_UniversalString { $$ = ASN_STRING_UniversalString; } | TOK_UTF8String { $$ = ASN_STRING_UTF8String; } | TOK_VideotexString { $$ = ASN_STRING_VideotexString; fprintf(stderr, "WARNING: VideotexString is not fully supported\n"); } | TOK_VisibleString { $$ = ASN_STRING_VisibleString; } | TOK_ObjectDescriptor { $$ = ASN_STRING_ObjectDescriptor; } ; /* * Data type constraints. */ UnionMark: '|' | TOK_UNION; IntersectionMark: '^' | TOK_INTERSECTION; optConstraints: { $$ = 0; } | Constraint { $$ = $1; } ; Constraint: SubtypeConstraint ; SubtypeConstraint: SetOfConstraints { CONSTRAINT_INSERT($$, ACT_CA_SET, $1, 0); } | TOK_SIZE '(' ElementSetSpecs ')' { /* * This is a special case, for compatibility purposes. * It goes without parentheses. */ CONSTRAINT_INSERT($$, ACT_CT_SIZE, $3, 0); } ; SetOfConstraints: '(' ElementSetSpecs ')' { $$ = $2; } | SetOfConstraints '(' ElementSetSpecs ')' { CONSTRAINT_INSERT($$, ACT_CA_SET, $1, $3); } ; ElementSetSpecs: TOK_ThreeDots { $$ = asn1p_constraint_new(yylineno); $$->type = ACT_EL_EXT; } | ElementSetSpec { $$ = $1; } | ElementSetSpec ',' TOK_ThreeDots { asn1p_constraint_t *ct; ct = asn1p_constraint_new(yylineno); ct->type = ACT_EL_EXT; CONSTRAINT_INSERT($$, ACT_CA_CSV, $1, ct); } | ElementSetSpec ',' TOK_ThreeDots ',' ElementSetSpec { asn1p_constraint_t *ct; ct = asn1p_constraint_new(yylineno); ct->type = ACT_EL_EXT; CONSTRAINT_INSERT($$, ACT_CA_CSV, $1, ct); ct = $$; CONSTRAINT_INSERT($$, ACT_CA_CSV, ct, $5); } | GeneralConstraint { $$ = $1; } ; ElementSetSpec: Unions | TOK_ALL TOK_EXCEPT ConstraintSubtypeElement { CONSTRAINT_INSERT($$, ACT_CA_AEX, $3, 0); } ; Unions: Intersections | Unions UnionMark Intersections { CONSTRAINT_INSERT($$, ACT_CA_UNI, $1, $3); } ; Intersections: IntersectionElements | Intersections IntersectionMark IntersectionElements { CONSTRAINT_INSERT($$, ACT_CA_INT, $1, $3); } ; IntersectionElements: ConstraintSubtypeElement | ConstraintSubtypeElement TOK_EXCEPT ConstraintSubtypeElement { CONSTRAINT_INSERT($$, ACT_CA_EXC, $1, $3); } ; ConstraintSubtypeElement: ConstraintSpec '(' ElementSetSpecs ')' { int ret; $$ = asn1p_constraint_new(yylineno); checkmem($$); $$->type = $1; ret = asn1p_constraint_insert($$, $3); checkmem(ret == 0); } | '(' ElementSetSpecs ')' { int ret; $$ = asn1p_constraint_new(yylineno); checkmem($$); $$->type = ACT_CA_SET; ret = asn1p_constraint_insert($$, $2); checkmem(ret == 0); } | SingleValue { $$ = asn1p_constraint_new(yylineno); checkmem($$); $$->type = ACT_EL_VALUE; $$->value = $1; } | ContainedSubtype { $$ = asn1p_constraint_new(yylineno); checkmem($$); $$->type = ACT_EL_TYPE; $$->containedSubtype = $1; } | SingleValue ConstraintRangeSpec SingleValue { $$ = asn1p_constraint_new(yylineno); checkmem($$); $$->type = $2; $$->range_start = $1; $$->range_stop = $3; } | TOK_MIN ConstraintRangeSpec SingleValue { $$ = asn1p_constraint_new(yylineno); checkmem($$); $$->type = $2; $$->range_start = asn1p_value_fromint(-123); $$->range_stop = $3; $$->range_start->type = ATV_MIN; } | SingleValue ConstraintRangeSpec TOK_MAX { $$ = asn1p_constraint_new(yylineno); checkmem($$); $$->type = $2; $$->range_start = $1; $$->range_stop = asn1p_value_fromint(321); $$->range_stop->type = ATV_MAX; } | TOK_MIN ConstraintRangeSpec TOK_MAX { $$ = asn1p_constraint_new(yylineno); checkmem($$); $$->type = $2; $$->range_start = asn1p_value_fromint(-123); $$->range_stop = asn1p_value_fromint(321); $$->range_start->type = ATV_MIN; $$->range_stop->type = ATV_MAX; } | InnerTypeConstraint { $$ = $1; } | PatternConstraint { $$ = $1; } ; PatternConstraint: TOK_PATTERN TOK_cstring { $$ = asn1p_constraint_new(yylineno); $$->type = ACT_CT_PATTERN; $$->value = asn1p_value_frombuf($2.buf, $2.len, 0); } | TOK_PATTERN Identifier { asn1p_ref_t *ref; $$ = asn1p_constraint_new(yylineno); $$->type = ACT_CT_PATTERN; ref = asn1p_ref_new(yylineno); asn1p_ref_add_component(ref, $2, RLT_lowercase); $$->value = asn1p_value_fromref(ref, 0); } ; ConstraintSpec: TOK_SIZE { $$ = ACT_CT_SIZE; } | TOK_FROM { $$ = ACT_CT_FROM; } ; SingleValue: TOK_FALSE { $$ = asn1p_value_fromint(0); checkmem($$); $$->type = ATV_FALSE; } | TOK_TRUE { $$ = asn1p_value_fromint(1); checkmem($$); $$->type = ATV_TRUE; } | RealValue | RestrictedCharacterStringValue | BitStringValue | Identifier { asn1p_ref_t *ref; int ret; ref = asn1p_ref_new(yylineno); checkmem(ref); ret = asn1p_ref_add_component(ref, $1, RLT_lowercase); checkmem(ret == 0); $$ = asn1p_value_fromref(ref, 0); checkmem($$); free($1); } ; BitStringValue: TOK_bstring { $$ = _convert_bitstring2binary($1, 'B'); checkmem($$); } | TOK_hstring { $$ = _convert_bitstring2binary($1, 'H'); checkmem($$); } ; ContainedSubtype: TypeRefName { asn1p_ref_t *ref; int ret; ref = asn1p_ref_new(yylineno); checkmem(ref); ret = asn1p_ref_add_component(ref, $1, RLT_UNKNOWN); checkmem(ret == 0); $$ = asn1p_value_fromref(ref, 0); checkmem($$); free($1); } ; InnerTypeConstraint: TOK_WITH TOK_COMPONENT SetOfConstraints { CONSTRAINT_INSERT($$, ACT_CT_WCOMP, $3, 0); } | TOK_WITH TOK_COMPONENTS '{' WithComponentsList '}' { CONSTRAINT_INSERT($$, ACT_CT_WCOMPS, $4, 0); } ; WithComponentsList: WithComponentsElement { $$ = $1; } | WithComponentsList ',' WithComponentsElement { CONSTRAINT_INSERT($$, ACT_CT_WCOMPS, $1, $3); } ; WithComponentsElement: TOK_ThreeDots { $$ = asn1p_constraint_new(yylineno); checkmem($$); $$->type = ACT_EL_EXT; $$->value = asn1p_value_frombuf("...", 3, 1); } | Identifier optConstraints optPresenceConstraint { $$ = asn1p_constraint_new(yylineno); checkmem($$); $$->type = ACT_EL_VALUE; $$->value = asn1p_value_frombuf($1, strlen($1), 0); $$->presence = $3; if($2) asn1p_constraint_insert($$, $2); } ; /* * presence constraint for WithComponents */ optPresenceConstraint: { $$ = ACPRES_DEFAULT; } | PresenceConstraint { $$ = $1; } ; PresenceConstraint: TOK_PRESENT { $$ = ACPRES_PRESENT; } | TOK_ABSENT { $$ = ACPRES_ABSENT; } | TOK_OPTIONAL { $$ = ACPRES_OPTIONAL; } ; /* X.682 */ GeneralConstraint: UserDefinedConstraint | TableConstraint | ContentsConstraint ; UserDefinedConstraint: TOK_CONSTRAINED TOK_BY '{' { asn1p_lexer_hack_push_opaque_state(); } Opaque /* '}' */ { $$ = asn1p_constraint_new(yylineno); checkmem($$); $$->type = ACT_CT_CTDBY; $$->value = asn1p_value_frombuf($5.buf, $5.len, 0); checkmem($$->value); $$->value->type = ATV_UNPARSED; } ; ContentsConstraint: TOK_CONTAINING Type { $$ = asn1p_constraint_new(yylineno); $$->type = ACT_CT_CTNG; $$->value = asn1p_value_fromtype($2); } ; ConstraintRangeSpec: TOK_TwoDots { $$ = ACT_EL_RANGE; } | TOK_TwoDots '<' { $$ = ACT_EL_RLRANGE; } | '<' TOK_TwoDots { $$ = ACT_EL_LLRANGE; } | '<' TOK_TwoDots '<' { $$ = ACT_EL_ULRANGE; } ; TableConstraint: SimpleTableConstraint { $$ = $1; } | ComponentRelationConstraint { $$ = $1; } ; /* * "{ExtensionSet}" */ SimpleTableConstraint: '{' TypeRefName '}' { asn1p_ref_t *ref = asn1p_ref_new(yylineno); asn1p_constraint_t *ct; int ret; ret = asn1p_ref_add_component(ref, $2, 0); checkmem(ret == 0); ct = asn1p_constraint_new(yylineno); checkmem($$); ct->type = ACT_EL_VALUE; ct->value = asn1p_value_fromref(ref, 0); CONSTRAINT_INSERT($$, ACT_CA_CRC, ct, 0); } ; ComponentRelationConstraint: SimpleTableConstraint '{' AtNotationList '}' { CONSTRAINT_INSERT($$, ACT_CA_CRC, $1, $3); } ; AtNotationList: AtNotationElement { $$ = asn1p_constraint_new(yylineno); checkmem($$); $$->type = ACT_EL_VALUE; $$->value = asn1p_value_fromref($1, 0); } | AtNotationList ',' AtNotationElement { asn1p_constraint_t *ct; ct = asn1p_constraint_new(yylineno); checkmem(ct); ct->type = ACT_EL_VALUE; ct->value = asn1p_value_fromref($3, 0); CONSTRAINT_INSERT($$, ACT_CA_CSV, $1, ct); } ; /* * @blah */ AtNotationElement: '@' ComponentIdList { char *p = malloc(strlen($2) + 2); int ret; *p = '@'; strcpy(p + 1, $2); $$ = asn1p_ref_new(yylineno); ret = asn1p_ref_add_component($$, p, 0); checkmem(ret == 0); free(p); free($2); } | '@' '.' ComponentIdList { char *p = malloc(strlen($3) + 3); int ret; p[0] = '@'; p[1] = '.'; strcpy(p + 2, $3); $$ = asn1p_ref_new(yylineno); ret = asn1p_ref_add_component($$, p, 0); checkmem(ret == 0); free(p); free($3); } ; /* identifier "." ... */ ComponentIdList: Identifier { $$ = $1; } | ComponentIdList '.' Identifier { int l1 = strlen($1); int l3 = strlen($3); $$ = malloc(l1 + 1 + l3 + 1); memcpy($$, $1, l1); $$[l1] = '.'; memcpy($$ + l1 + 1, $3, l3); $$[l1 + 1 + l3] = '\0'; } ; /* * MARKERS */ optMarker: { $$.flags = EM_NOMARK; $$.default_value = 0; } | Marker { $$ = $1; } ; Marker: TOK_OPTIONAL { $$.flags = EM_OPTIONAL | EM_INDIRECT; $$.default_value = 0; } | TOK_DEFAULT Value { $$.flags = EM_DEFAULT; $$.default_value = $2; } ; /* * Universal enumeration definition to use in INTEGER and ENUMERATED. * === EXAMPLE === * Gender ::= ENUMERATED { unknown(0), male(1), female(2) } * Temperature ::= INTEGER { absolute-zero(-273), freezing(0), boiling(100) } * === EOF === */ /* optUniverationDefinition: { $$ = 0; } | UniverationDefinition { $$ = $1; } ; */ UniverationDefinition: '{' '}' { $$ = NEW_EXPR(); checkmem($$); } | '{' UniverationList '}' { $$ = $2; } ; UniverationList: UniverationElement { $$ = NEW_EXPR(); checkmem($$); asn1p_expr_add($$, $1); } | UniverationList ',' UniverationElement { $$ = $1; asn1p_expr_add($$, $3); } ; UniverationElement: Identifier { $$ = NEW_EXPR(); checkmem($$); $$->expr_type = A1TC_UNIVERVAL; $$->meta_type = AMT_VALUE; $$->Identifier = $1; } | Identifier '(' SignedNumber ')' { $$ = NEW_EXPR(); checkmem($$); $$->expr_type = A1TC_UNIVERVAL; $$->meta_type = AMT_VALUE; $$->Identifier = $1; $$->value = $3; } | Identifier '(' DefinedValue ')' { $$ = NEW_EXPR(); checkmem($$); $$->expr_type = A1TC_UNIVERVAL; $$->meta_type = AMT_VALUE; $$->Identifier = $1; $$->value = $3; } | SignedNumber { $$ = NEW_EXPR(); checkmem($$); $$->expr_type = A1TC_UNIVERVAL; $$->meta_type = AMT_VALUE; $$->value = $1; } | TOK_ThreeDots { $$ = NEW_EXPR(); checkmem($$); $$->Identifier = strdup("..."); checkmem($$->Identifier); $$->expr_type = A1TC_EXTENSIBLE; $$->meta_type = AMT_VALUE; } ; SignedNumber: TOK_number { $$ = asn1p_value_fromint($1); checkmem($$); } | TOK_number_negative { $$ = asn1p_value_fromint($1); checkmem($$); } ; RealValue: SignedNumber | TOK_realnumber { $$ = asn1p_value_fromdouble($1); checkmem($$); } ; /* * SEQUENCE definition. * === EXAMPLE === * Struct1 ::= SEQUENCE { * memb1 Struct2, * memb2 SEQUENCE OF { * memb2-1 Struct 3 * } * } * === EOF === */ /* * SET definition. * === EXAMPLE === * Person ::= SET { * name [0] PrintableString (SIZE(1..20)), * country [1] PrintableString (SIZE(1..20)) DEFAULT default-country, * } * === EOF === */ optTag: { memset(&$$, 0, sizeof($$)); } | Tag { $$ = $1; } ; Tag: TagTypeValue TagPlicit { $$ = $1; $$.tag_mode = $2.tag_mode; } ; TagTypeValue: '[' TagClass TOK_number ']' { $$ = $2; $$.tag_value = $3; }; TagClass: { $$.tag_class = TC_CONTEXT_SPECIFIC; } | TOK_UNIVERSAL { $$.tag_class = TC_UNIVERSAL; } | TOK_APPLICATION { $$.tag_class = TC_APPLICATION; } | TOK_PRIVATE { $$.tag_class = TC_PRIVATE; } ; TagPlicit: { $$.tag_mode = TM_DEFAULT; } | TOK_IMPLICIT { $$.tag_mode = TM_IMPLICIT; } | TOK_EXPLICIT { $$.tag_mode = TM_EXPLICIT; } ; TypeRefName: TOK_typereference { checkmem($1); $$ = $1; } | TOK_capitalreference { checkmem($1); $$ = $1; } ; ObjectClassReference: TOK_capitalreference { checkmem($1); $$ = $1; } ; optIdentifier: { $$ = 0; } | Identifier { $$ = $1; } ; Identifier: TOK_identifier { checkmem($1); $$ = $1; } ; %% /* * Convert Xstring ('0101'B or '5'H) to the binary vector. */ static asn1p_value_t * _convert_bitstring2binary(char *str, int base) { asn1p_value_t *val; int slen; int memlen; int baselen; int bits; uint8_t *binary_vector; uint8_t *bv_ptr; uint8_t cur_val; assert(str); assert(str[0] == '\''); switch(base) { case 'B': baselen = 1; break; case 'H': baselen = 4; break; default: assert(base == 'B' || base == 'H'); errno = EINVAL; return NULL; } slen = strlen(str); assert(str[slen - 1] == base); assert(str[slen - 2] == '\''); memlen = slen / (8 / baselen); /* Conservative estimate */ bv_ptr = binary_vector = malloc(memlen + 1); if(bv_ptr == NULL) /* ENOMEM */ return NULL; cur_val = 0; bits = 0; while(*(++str) != '\'') { switch(baselen) { case 1: switch(*str) { case '1': cur_val |= 1 << (7 - (bits % 8)); case '0': break; default: assert(!"_y UNREACH1"); case ' ': case '\r': case '\n': continue; } break; case 4: switch(*str) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': cur_val |= (*str - '0') << (4 - (bits % 8)); break; case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': cur_val |= ((*str - 'A') + 10) << (4 - (bits % 8)); break; default: assert(!"_y UNREACH2"); case ' ': case '\r': case '\n': continue; } break; } bits += baselen; if((bits % 8) == 0) { *bv_ptr++ = cur_val; cur_val = 0; } } *bv_ptr = cur_val; assert((bv_ptr - binary_vector) <= memlen); val = asn1p_value_frombits(binary_vector, bits, 0); if(val == NULL) { free(binary_vector); } return val; } /* * For unnamed types (used in old X.208 compliant modules) * generate some sort of interim names, to not to force human being to fix * the specification's compliance to modern ASN.1 standards. */ static void _fixup_anonymous_identifier(asn1p_expr_t *expr) { char *p; assert(expr->Identifier == 0); /* * Try to figure out the type name * without going too much into details */ expr->Identifier = ASN_EXPR_TYPE2STR(expr->expr_type); if(expr->reference && expr->reference->comp_count > 0) expr->Identifier = expr->reference->components[0].name; fprintf(stderr, "WARNING: Line %d: expected lower-case member identifier, " "found an unnamed %s.\n" "WARNING: Obsolete X.208 syntax detected, " "please give the member a name.\n", yylineno, expr->Identifier ? expr->Identifier : "type"); if(!expr->Identifier) expr->Identifier = "unnamed"; expr->Identifier = strdup(expr->Identifier); assert(expr->Identifier); /* Make a lowercase identifier from the type name */ for(p = expr->Identifier; *p; p++) { switch(*p) { case 'A' ... 'Z': *p += 32; break; case ' ': *p = '_'; break; case '-': *p = '_'; break; } } fprintf(stderr, "NOTE: Assigning temporary identifier \"%s\". " "Name clash may occur later.\n", expr->Identifier); } int yyerror(const char *msg) { extern char *asn1p_text; fprintf(stderr, "ASN.1 grammar parse error " "near line %d (token \"%s\"): %s\n", yylineno, asn1p_text, msg); return -1; } asn1c-0.9.28+dfsg/libasn1parser/asn1p_ref.c0000644000000000000000000000470313065714043017033 0ustar rootroot#include #include #include #include #include #include "asn1parser.h" /* * Construct a new empty reference. */ asn1p_ref_t * asn1p_ref_new(int _lineno) { asn1p_ref_t *ref; ref = calloc(1, sizeof *ref); if(ref) { ref->_lineno = _lineno; } return ref; } void asn1p_ref_free(asn1p_ref_t *ref) { if(ref) { if(ref->components) { int i = ref->comp_count; while(i--) { free(ref->components[i].name); ref->components[i].name = 0; } free(ref->components); ref->components = 0; } free(ref); } } static enum asn1p_ref_lex_type_e asn1p_ref_name2lextype(char *name) { enum asn1p_ref_lex_type_e lex_type; int has_lowercase = 0; if(*name == '&') { if(name[1] >= 'A' && name[1] <= 'Z') { lex_type = RLT_AmpUppercase; } else { lex_type = RLT_Amplowercase; } } else if(*name >= 'A' && *name <= 'Z') { char *p; for(p = name; *p; p++) { if(*p >= 'a' && *p <= 'z') { has_lowercase = 1; break; } } if(has_lowercase) { lex_type = RLT_Uppercase; } else { lex_type = RLT_CAPITALS; } } else if(*name == '@') { if(name[1] == '.') lex_type = RLT_AtDotlowercase; else lex_type = RLT_Atlowercase; } else { lex_type = RLT_lowercase; } return lex_type; } int asn1p_ref_add_component(asn1p_ref_t *ref, char *name, enum asn1p_ref_lex_type_e lex_type) { if(!ref || !name || (int)lex_type < RLT_UNKNOWN || lex_type >= RLT_MAX) { errno = EINVAL; return -1; } if(ref->comp_count == ref->comp_size) { int newsize = ref->comp_size?(ref->comp_size<<2):4; void *p = realloc(ref->components, newsize * sizeof(ref->components[0])); if(p) { ref->components = p; ref->comp_size = newsize; } else { return -1; } } if(lex_type == RLT_UNKNOWN) { lex_type = asn1p_ref_name2lextype(name); } else { assert(lex_type == asn1p_ref_name2lextype(name)); } ref->components[ref->comp_count].name = strdup(name); ref->components[ref->comp_count].lex_type = lex_type; if(ref->components[ref->comp_count].name) { ref->comp_count++; return 0; } else { return -1; } } asn1p_ref_t * asn1p_ref_clone(asn1p_ref_t *ref) { asn1p_ref_t *newref; newref = asn1p_ref_new(ref->_lineno); if(newref) { int i; for(i = 0; i < ref->comp_count; i++) { if(asn1p_ref_add_component(newref, ref->components[i].name, ref->components[i].lex_type )) { asn1p_ref_free(newref); newref = NULL; break; } } } return newref; } asn1c-0.9.28+dfsg/libasn1parser/asn1p_class.h0000644000000000000000000000341413065714043017367 0ustar rootroot/* * CLASS-related stuff. */ #ifndef ASN1_PARSER_CLASS_H #define ASN1_PARSER_CLASS_H #include "asn1p_ref.h" struct asn1p_expr_s; /* Forward declaration */ typedef struct asn1p_ioc_row_s { struct asn1p_ioc_cell_s { struct asn1p_expr_s *field; /* may never be NULL */ struct asn1p_expr_s *value; /* may be left uninitialized */ } *column; int columns; int max_identifier_length; } asn1p_ioc_row_t; asn1p_ioc_row_t *asn1p_ioc_row_new(struct asn1p_expr_s *oclass); void asn1p_ioc_row_delete(asn1p_ioc_row_t *); struct asn1p_ioc_cell_s *asn1p_ioc_row_cell_fetch(asn1p_ioc_row_t *, const char *fieldname); /* * WITH SYNTAX free-form chunks. */ typedef struct asn1p_wsyntx_chunk_s { enum { WC_LITERAL, WC_WHITESPACE, WC_FIELD, WC_OPTIONALGROUP } type; /* * WC_LITERAL -> {token} * WC_WHITESPACE -> {token} * WC_FIELD -> {token} * WC_OPTIONALGROUP -> {syntax} */ union { char *token; struct asn1p_wsyntx_s *syntax; } content; TQ_ENTRY(struct asn1p_wsyntx_chunk_s) next; } asn1p_wsyntx_chunk_t; typedef struct asn1p_wsyntx_s { TQ_HEAD(struct asn1p_wsyntx_chunk_s) chunks; } asn1p_wsyntx_t; /* * Constructor, destructor and cloning function. */ asn1p_wsyntx_chunk_t *asn1p_wsyntx_chunk_new(void); void asn1p_wsyntx_chunk_free(asn1p_wsyntx_chunk_t *); asn1p_wsyntx_chunk_t *asn1p_wsyntx_chunk_clone(asn1p_wsyntx_chunk_t *); asn1p_wsyntx_t *asn1p_wsyntx_new(void); void asn1p_wsyntx_free(asn1p_wsyntx_t *); asn1p_wsyntx_t *asn1p_wsyntx_clone(asn1p_wsyntx_t *); /* * RETURN VALUES: * 0: Component has been added * -1: Failure to add component (refer to errno) */ asn1p_wsyntx_chunk_t *asn1p_wsyntx_chunk_fromstring(char *token, int _copy); asn1p_wsyntx_chunk_t *asn1p_wsyntx_chunk_fromsyntax(asn1p_wsyntx_t *syntax); #endif /* ASN1_PARSER_CLASS_H */ asn1c-0.9.28+dfsg/libasn1parser/asn1p_xports.c0000644000000000000000000000074013065714043017613 0ustar rootroot#include #include #include "asn1parser.h" /* * Construct a new structure that would hold the EXPORTS or IMPORTS * clause data. */ asn1p_xports_t * asn1p_xports_new() { asn1p_xports_t *xp; xp = calloc(1, sizeof *xp); if(xp) { TQ_INIT(&(xp->members)); } return xp; } /* * Destroy the xports structure. */ void asn1p_xports_free(asn1p_xports_t *xp) { if(xp) { free(xp->fromModuleName); asn1p_oid_free(xp->identifier.oid); free(xp); } } asn1c-0.9.28+dfsg/libasn1parser/expr-h.pl0000755000000000000000000000206113065714043016547 0ustar rootroot#!/usr/bin/env perl print< #ifndef __GNUC__ #define __attribute__(x) /* unused */ #endif static char *asn1p_expr_type2str[] __attribute__ ((unused)) = { EOM while(<>) { chomp; next if(/TYPE_MAX/); next unless(/^[ \t]+(ASN_[A-Z]+_([A-Za-z0-9_]+))/); print "\t[ $1 ]\t = "; $_ = $2; if($_ eq "RELATIVE_OID") { print '"RELATIVE-OID"'; } else { s/_/ /; print '"'.$_.'"'; } print ",\n"; } print<= 0); if(type < sizeof(asn1p_expr_type2str)/sizeof(asn1p_expr_type2str[0])) return asn1p_expr_type2str[type]; return NULL; } #endif /* ASN1_PARSER_EXPR_STR_H */ EOM asn1c-0.9.28+dfsg/libasn1parser/asn1p_value.c0000644000000000000000000001313613065714043017373 0ustar rootroot#include #include #include #include #include "asn1parser.h" asn1p_value_t * asn1p_value_fromref(asn1p_ref_t *ref, int do_copy) { if(ref) { asn1p_value_t *v = calloc(1, sizeof *v); if(v) { if(do_copy) { v->value.reference = asn1p_ref_clone(ref); if(v->value.reference == NULL) { free(v); return NULL; } } else { v->value.reference = ref; } v->type = ATV_REFERENCED; } return v; } else { errno = EINVAL; return NULL; } } asn1p_value_t * asn1p_value_fromconstr(asn1p_constraint_t *ct, int do_copy) { if(ct) { asn1p_value_t *v = calloc(1, sizeof *v); if(v) { if(do_copy) { v->value.constraint = asn1p_constraint_clone(ct); if(v->value.constraint == NULL) { free(v); return NULL; } } else { v->value.constraint = ct; } v->type = ATV_VALUESET; } return v; } else { errno = EINVAL; return NULL; } } asn1p_value_t * asn1p_value_frombits(uint8_t *bits, int size_in_bits, int do_copy) { if(bits) { asn1p_value_t *v = calloc(1, sizeof *v); assert(size_in_bits >= 0); if(v) { if(do_copy) { int size = ((size_in_bits + 7) >> 3); void *p; p = malloc(size + 1); if(p) { memcpy(p, bits, size); ((char *)p)[size] = '\0'; /* JIC */ } else { free(v); return NULL; } v->value.binary_vector.bits = p; } else { v->value.binary_vector.bits = (void *)bits; } v->value.binary_vector.size_in_bits = size_in_bits; v->type = ATV_BITVECTOR; } return v; } else { errno = EINVAL; return NULL; } } asn1p_value_t * asn1p_value_frombuf(char *buffer, int size, int do_copy) { if(buffer) { asn1p_value_t *v = calloc(1, sizeof *v); assert(size >= 0); if(v) { if(do_copy) { void *p = malloc(size + 1); if(p) { memcpy(p, buffer, size); ((char *)p)[size] = '\0'; /* JIC */ } else { free(v); return NULL; } v->value.string.buf = p; } else { v->value.string.buf = (uint8_t *)buffer; } v->value.string.size = size; v->type = ATV_STRING; } return v; } else { errno = EINVAL; return NULL; } } asn1p_value_t * asn1p_value_fromdouble(double d) { asn1p_value_t *v = calloc(1, sizeof *v); if(v) { v->value.v_double = d; v->type = ATV_REAL; } return v; } asn1p_value_t * asn1p_value_fromint(asn1c_integer_t i) { asn1p_value_t *v = calloc(1, sizeof *v); if(v) { v->value.v_integer = i; v->type = ATV_INTEGER; } return v; } asn1p_value_t * asn1p_value_fromtype(asn1p_expr_t *expr) { asn1p_value_t *v = calloc(1, sizeof *v); if(v) { v->value.v_type = expr; v->type = ATV_TYPE; } return v; } asn1p_value_t * asn1p_value_clone(asn1p_value_t *v) { return asn1p_value_clone_with_resolver(v, 0, 0); } asn1p_value_t * asn1p_value_clone_with_resolver(asn1p_value_t *v, asn1p_value_t *(*resolver)(asn1p_value_t *, void *rarg), void *rarg) { asn1p_value_t *clone = NULL; if(v) { switch(v->type) { case ATV_NOVALUE: case ATV_NULL: return calloc(1, sizeof(*clone)); case ATV_REAL: return asn1p_value_fromdouble(v->value.v_double); case ATV_TYPE: return asn1p_value_fromtype(v->value.v_type); case ATV_INTEGER: case ATV_MIN: case ATV_MAX: case ATV_FALSE: case ATV_TRUE: case ATV_TUPLE: case ATV_QUADRUPLE: clone = asn1p_value_fromint(v->value.v_integer); if(clone) clone->type = v->type; return clone; case ATV_STRING: clone = asn1p_value_frombuf((char *)v->value.string.buf, v->value.string.size, 1); if(clone) clone->type = v->type; return clone; case ATV_UNPARSED: clone = asn1p_value_frombuf((char *)v->value.string.buf, v->value.string.size, 1); if(clone) clone->type = ATV_UNPARSED; return clone; case ATV_BITVECTOR: return asn1p_value_frombits(v->value.binary_vector.bits, v->value.binary_vector.size_in_bits, 1); case ATV_REFERENCED: if(resolver) { clone = resolver(v, rarg); if(clone) return clone; else if(errno != ESRCH) return NULL; } return asn1p_value_fromref(v->value.reference, 1); case ATV_VALUESET: if(resolver) { clone = resolver(v, rarg); if(clone) return clone; else if(errno != ESRCH) return NULL; } return asn1p_value_fromconstr(v->value.constraint, 1); case ATV_CHOICE_IDENTIFIER: { char *id = v->value.choice_identifier.identifier; clone = calloc(1, sizeof(*clone)); if(!clone) return NULL; clone->type = v->type; id = strdup(id); if(!id) { asn1p_value_free(clone); return NULL; } clone->value.choice_identifier.identifier = id; v = asn1p_value_clone(v->value.choice_identifier.value); if(!v) { asn1p_value_free(clone); return NULL; } clone->value.choice_identifier.value = v; return clone; } } assert(!"UNREACHABLE"); } return v; } void asn1p_value_free(asn1p_value_t *v) { if(v) { switch(v->type) { case ATV_NOVALUE: case ATV_NULL: break; case ATV_TYPE: asn1p_expr_free(v->value.v_type); break; case ATV_REAL: case ATV_INTEGER: case ATV_MIN: case ATV_MAX: case ATV_FALSE: case ATV_TRUE: case ATV_TUPLE: case ATV_QUADRUPLE: /* No freeing necessary */ break; case ATV_STRING: case ATV_UNPARSED: assert(v->value.string.buf); free(v->value.string.buf); break; case ATV_BITVECTOR: assert(v->value.binary_vector.bits); free(v->value.binary_vector.bits); break; case ATV_REFERENCED: asn1p_ref_free(v->value.reference); break; case ATV_VALUESET: asn1p_constraint_free(v->value.constraint); break; case ATV_CHOICE_IDENTIFIER: free(v->value.choice_identifier.identifier); asn1p_value_free(v->value.choice_identifier.value); break; } free(v); } } asn1c-0.9.28+dfsg/libasn1parser/asn1p_param.h0000644000000000000000000000134713065714043017365 0ustar rootroot/* * Structures and prototypes related to parameterization */ #ifndef ASN1_PARSER_PARAMETERIZATION_H #define ASN1_PARSER_PARAMETERIZATION_H struct asn1p_expr_s; /* Forward declaration */ typedef struct asn1p_paramlist_s { struct asn1p_param_s { /* Translated from */ asn1p_ref_t *governor; char *argument; } *params; int params_count; int params_size; int _lineno; } asn1p_paramlist_t; /* * Constructor and destructor. */ asn1p_paramlist_t *asn1p_paramlist_new(int _lineno); void asn1p_paramlist_free(asn1p_paramlist_t *); asn1p_paramlist_t *asn1p_paramlist_clone(asn1p_paramlist_t *ref); int asn1p_paramlist_add_param(asn1p_paramlist_t *, asn1p_ref_t *opt_gov, char *arg); #endif /* ASN1_PARSER_PARAMETERIZATION_H */ asn1c-0.9.28+dfsg/libasn1parser/asn1p_ref.h0000644000000000000000000000300513065714043017032 0ustar rootroot/* * Generic reference to the yet unknown type defined elsewhere. */ #ifndef ASN1_PARSER_REFERENCE_H #define ASN1_PARSER_REFERENCE_H typedef struct asn1p_ref_s { /* * A set of reference name components. * A reference name consists of several components separated by dots: * "OBJECT-CLASS.&Algorithm.&id" */ struct asn1p_ref_component_s { enum asn1p_ref_lex_type_e { RLT_UNKNOWN, /* Invalid? */ /* * Object class reference "OCLASS1", * type reference "Type1", * value reference "id", * type field reference "&Type1", * value field reference "&id", * "OBJECT-CLASS" */ RLT_CAPITALS, RLT_Uppercase, RLT_lowercase, RLT_AmpUppercase, RLT_Amplowercase, RLT_Atlowercase, RLT_AtDotlowercase, RLT_MAX } lex_type; /* Inferred lexical type of the identifier */ char *name; /* An identifier */ } *components; int comp_count; /* Number of the components in the reference name. */ int comp_size; /* Number of allocated structures */ int _lineno; /* Number of line in the file */ } asn1p_ref_t; /* * Constructor and destructor. */ asn1p_ref_t *asn1p_ref_new(int _lineno); void asn1p_ref_free(asn1p_ref_t *); asn1p_ref_t *asn1p_ref_clone(asn1p_ref_t *ref); /* * Add a new reference component to the existing reference structure. * * RETURN VALUES: * 0: All clear. * -1/EINVAL: Invalid arguments * -1/ENOMEM: Memory allocation failed */ int asn1p_ref_add_component(asn1p_ref_t *, char *name, enum asn1p_ref_lex_type_e); #endif /* ASN1_PARSER_REFERENCE_H */ asn1c-0.9.28+dfsg/libasn1parser/asn1p_oid.c0000644000000000000000000000354313065714043017033 0ustar rootroot#include #include #include #include "asn1parser.h" asn1p_oid_t * asn1p_oid_construct(asn1p_oid_arc_t *arc, int narcs) { asn1p_oid_t *oid; if(narcs <= 0) return NULL; oid = asn1p_oid_new(); if(oid) { for(; narcs--; arc++) { if(asn1p_oid_add_arc(oid, arc)) { asn1p_oid_free(oid); return NULL; } } } return oid; } asn1p_oid_t * asn1p_oid_new() { return calloc(1, sizeof(asn1p_oid_t)); } int asn1p_oid_add_arc(asn1p_oid_t *oid, asn1p_oid_arc_t *template) { void *p; p = realloc(oid->arcs, (oid->arcs_count + 1) * sizeof(oid->arcs[0])); if(p) { oid->arcs = p; oid->arcs[oid->arcs_count].name = template->name?strdup(template->name):0; oid->arcs[oid->arcs_count].number = template->number; oid->arcs_count++; return 0; } else { return -1; } } void asn1p_oid_free(asn1p_oid_t *oid) { if(oid) { if(oid->arcs) { while(oid->arcs_count--) { free(oid->arcs[oid->arcs_count].name); } } free(oid); } } asn1p_oid_arc_t * asn1p_oid_arc_new(const char *optName, asn1c_integer_t optNumber /* = -1 */) { asn1p_oid_arc_t *arc; arc = calloc(1, sizeof *arc); if(arc) { if(optName) arc->name = strdup(optName); arc->number = optNumber; } return arc; } void asn1p_oid_arc_free(asn1p_oid_arc_t *arc) { if(arc) { free(arc->name); free(arc); } } int asn1p_oid_compare(asn1p_oid_t *a, asn1p_oid_t *b) { int i; for(i = 0; ; i++) { asn1c_integer_t cmp; if(b->arcs_count > i) { if(a->arcs_count <= i) return -1; } else if(a->arcs_count > i) { if(b->arcs_count <= i) return 1; } else if(b->arcs_count <= i && a->arcs_count <= i) { cmp = b->arcs_count - a->arcs_count; if(cmp < 0) return -1; else if(cmp > 0) return 1; return 0; } cmp = b->arcs[i].number - a->arcs[i].number; if(cmp < 0) return -1; else if(cmp > 0) return 1; } } asn1c-0.9.28+dfsg/libasn1parser/asn1p_param.c0000644000000000000000000000413613065714043017357 0ustar rootroot#include #include #include #include #include #include "asn1parser.h" /* * Construct a new empty parameters list. */ asn1p_paramlist_t * asn1p_paramlist_new(int _lineno) { asn1p_paramlist_t *pl; pl = calloc(1, sizeof *pl); if(pl) { pl->_lineno = _lineno; } return pl; } void asn1p_paramlist_free(asn1p_paramlist_t *pl) { if(pl) { if(pl->params) { int i = pl->params_count; while(i--) { if(pl->params[i].governor) asn1p_ref_free(pl->params[i].governor); free(pl->params[i].argument); pl->params[i].governor = 0; pl->params[i].argument = 0; } free(pl->params); pl->params = 0; } free(pl); } } int asn1p_paramlist_add_param(asn1p_paramlist_t *pl, asn1p_ref_t *gov, char *arg) { if(!pl || !arg) { errno = EINVAL; return -1; } /* * Make sure there's enough space to insert a new element. */ if(pl->params_count == pl->params_size) { int newsize = pl->params_size?pl->params_size<<2:4; void *p; p = realloc(pl->params, newsize * sizeof(pl->params[0])); if(p) { pl->params = p; pl->params_size = newsize; memset(&pl->params[pl->params_count], 0, (newsize - pl->params_size) * sizeof(pl->params[0])); } else { return -1; } } if(gov) { pl->params[pl->params_count].governor = asn1p_ref_clone(gov); if(pl->params[pl->params_count].governor == NULL) return -1; } else { pl->params[pl->params_count].governor = 0; } pl->params[pl->params_count].argument = strdup(arg); if(pl->params[pl->params_count].argument) { pl->params_count++; return 0; } else { if(pl->params[pl->params_count].governor) asn1p_ref_free(pl->params[pl->params_count].governor); return -1; } } asn1p_paramlist_t * asn1p_paramlist_clone(asn1p_paramlist_t *pl) { asn1p_paramlist_t *newpl; newpl = asn1p_paramlist_new(pl->_lineno); if(newpl) { int i; for(i = 0; i < pl->params_count; i++) { if(asn1p_paramlist_add_param(newpl, pl->params[i].governor, pl->params[i].argument )) { asn1p_paramlist_free(newpl); newpl = NULL; break; } } } return newpl; } asn1c-0.9.28+dfsg/libasn1parser/asn1p_constr.c0000644000000000000000000000775713065714043017603 0ustar rootroot#include #include #include #include #include #include "asn1parser.h" asn1p_constraint_t * asn1p_constraint_new(int _lineno) { asn1p_constraint_t *ct; ct = calloc(1, sizeof(*ct)); if(ct) { ct->_lineno = _lineno; } return ct; } void asn1p_constraint_free(asn1p_constraint_t *ct) { if(ct) { if(ct->containedSubtype) asn1p_value_free(ct->containedSubtype); if(ct->value) asn1p_value_free(ct->value); if(ct->range_start) asn1p_value_free(ct->range_start); if(ct->range_stop) asn1p_value_free(ct->range_stop); if(ct->elements) { while(ct->el_count--) { asn1p_constraint_free( ct->elements[ct->el_count]); } free(ct->elements); } free(ct); } } asn1p_constraint_t * asn1p_constraint_clone(asn1p_constraint_t *src) { return asn1p_constraint_clone_with_resolver(src, 0, 0); } asn1p_constraint_t * asn1p_constraint_clone_with_resolver(asn1p_constraint_t *src, asn1p_value_t *(*vr)(asn1p_value_t *, void *varg), void *varg) { asn1p_constraint_t *clone; #define CLONE(field, func) do { if(src->field) { \ clone->field = func(src->field, vr, varg); \ if(clone->field == NULL) { \ asn1p_constraint_free(clone); \ return NULL; \ } \ } } while(0) clone = asn1p_constraint_new(src->_lineno); if(clone) { unsigned int i; clone->type = src->type; clone->presence = src->presence; CLONE(containedSubtype, asn1p_value_clone_with_resolver); CLONE(value, asn1p_value_clone_with_resolver); CLONE(range_start, asn1p_value_clone_with_resolver); CLONE(range_stop, asn1p_value_clone_with_resolver); for(i = 0; i < src->el_count; i++) { asn1p_constraint_t *t; t = asn1p_constraint_clone_with_resolver(src->elements[i], vr, varg); if(!t) { asn1p_constraint_free(clone); return NULL; } if(asn1p_constraint_insert(clone, t)) { asn1p_constraint_free(clone); asn1p_constraint_free(t); return NULL; } } assert(clone->el_count == src->el_count); clone->_lineno = src->_lineno; } return clone; } /* * Make sure there's enough space to add an element. */ static int asn1p_constraint_make_memory(asn1p_constraint_t *ct) { if(ct->el_count == ct->el_size) { unsigned int newsize = ct->el_size ? ct->el_size << 2 : 4; void *p; p = realloc(ct->elements, newsize * sizeof(ct->elements[0])); if(p) { ct->elements = p; ct->el_size = newsize; } else { return -1; } } return 0; } int asn1p_constraint_insert(asn1p_constraint_t *into, asn1p_constraint_t *what) { assert(into); assert(what); if(asn1p_constraint_make_memory(into)) return -1; into->elements[into->el_count++] = what; return 0; } int asn1p_constraint_prepend(asn1p_constraint_t *before, asn1p_constraint_t *what) { assert(before); assert(what); if(asn1p_constraint_make_memory(before)) return -1; memmove(&before->elements[1], &before->elements[0], before->el_count * sizeof(before->elements[0])); before->elements[0] = what; before->el_count++; return 0; } char * asn1p_constraint_type2str(enum asn1p_constraint_type_e type) { switch(type) { case ACT_INVALID: return "INVALID"; case ACT_EL_TYPE: return "ContainedSubtype"; case ACT_EL_VALUE: return "SingleValue"; case ACT_EL_RANGE: case ACT_EL_LLRANGE: case ACT_EL_RLRANGE: case ACT_EL_ULRANGE: return "ValueRange"; case ACT_EL_EXT: return "..."; case ACT_CT_SIZE: return "SizeConstraint"; case ACT_CT_FROM: return "PermittedAlphabet"; case ACT_CT_WCOMP: return "SingleTypeConstraint"; case ACT_CT_WCOMPS: return "MultipleTypeConstraints"; case ACT_CT_CTDBY: return "UserDefinedConstraint"; case ACT_CT_CTNG: return "ContentsConstraint"; case ACT_CT_PATTERN: return "PatternConstraint"; case ACT_CA_SET: return "SET"; case ACT_CA_CRC: return "ComponentRelationConstraint"; case ACT_CA_CSV: return "CSV"; case ACT_CA_UNI: return "UNION"; case ACT_CA_INT: return "INTERSECTION"; case ACT_CA_EXC: return "EXCEPT"; case ACT_CA_AEX: return "ALL EXCEPT"; } return "UNKNOWN"; } asn1c-0.9.28+dfsg/libasn1parser/asn1parser.h0000644000000000000000000000413113065714043017234 0ustar rootroot/* * This is a parser of the ASN.1 grammar. */ #ifndef ASN1PARSER_H #define ASN1PARSER_H #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ #ifdef HAVE_SYS_TYPES_H #include #endif /* HAVE_SYS_TYPES_H */ #ifdef HAVE_INTTYPES_H #include /* POSIX 1003.1-2001, C99 */ #else /* HAVE_INTTYPES_H */ #ifdef HAVE_STDINT_H #include /* SUSv2+ */ #endif /* HAVE_STDINT_H */ #endif /* HAVE_INTTYPES_H */ /* * Basic integer type used in numerous places. * ASN.1 does not define any limits on this number, so it must be sufficiently * large to accomodate typical inputs. It does not have to be a dynamically * allocated type with potentially unlimited width: consider the width of * an integer defined here as one of the "compiler limitations". * NOTE: this is NOT a type for ASN.1 "INTEGER" type representation, this * type is used by the compiler itself to handle large integer values * specified inside ASN.1 grammar. */ typedef intmax_t asn1c_integer_t; #ifdef PRIdMAX #define PRIdASN PRIdMAX #define PRIuASN PRIuMAX #else #define PRIdASN "lld" /* Or j? */ #define PRIuASN "llu" /* Or j? */ #endif #include "asn1p_list.h" #include "asn1p_oid.h" /* Object identifiers (OIDs) */ #include "asn1p_ref.h" /* References to custom types */ #include "asn1p_value.h" /* Value definition */ #include "asn1p_param.h" /* Parameterization */ #include "asn1p_constr.h" /* Type Constraints */ #include "asn1p_xports.h" /* IMports/EXports */ #include "asn1p_module.h" /* ASN.1 definition module */ #include "asn1p_class.h" /* CLASS-related stuff */ #include "asn1p_expr.h" /* A single ASN.1 expression */ /* * Parser flags. */ enum asn1p_flags { A1P_NOFLAGS, /* * Enable verbose debugging output from lexer. */ A1P_LEXER_DEBUG = 0x0001 }; /* * Perform low-level parsing of ASN.1 module[s] * and return a list of module trees. */ asn1p_t *asn1p_parse_file(const char *filename, enum asn1p_flags); asn1p_t *asn1p_parse_buffer(const char *buffer, int size /* = -1 */, enum asn1p_flags); int asn1p_atoi(const char *ptr, asn1c_integer_t *r_value); #endif /* ASN1PARSER_H */ asn1c-0.9.28+dfsg/libasn1parser/asn1p_expr.h0000644000000000000000000001644713065714043017252 0ustar rootroot/* * A collection of data members of unspecified types. */ #ifndef ASN1_PARSER_EXPR_H #define ASN1_PARSER_EXPR_H /* * Meta type of the ASN expression. */ typedef enum asn1p_expr_meta { AMT_INVALID, AMT_TYPE, /* Type1 ::= INTEGER */ AMT_TYPEREF, /* Type2 ::= Type1 */ AMT_VALUE, /* value1 Type1 ::= 1 */ AMT_VALUESET, /* ValueSet Type1 ::= { value1 } */ AMT_OBJECT, /* object CLASS ::= {...} */ AMT_OBJECTCLASS, /* FUNCTION ::= CLASS {...} */ AMT_OBJECTFIELD, /* ... */ AMT_EXPR_META_MAX } asn1p_expr_meta_e; /* * ASN type of the expression. */ typedef enum asn1p_expr_type { /* * Internal types. */ A1TC_INVALID, /* Invalid type */ A1TC_REFERENCE, /* Reference to the type defined elsewhere */ A1TC_EXPORTVAR, /* We're exporting this definition */ A1TC_UNIVERVAL, /* A value of an ENUMERATED, INTEGER or BS */ A1TC_BITVECTOR, /* A plain collection of bits */ A1TC_OPAQUE, /* Opaque data encoded as a bitvector */ A1TC_EXTENSIBLE, /* An extension marker "..." */ A1TC_COMPONENTS_OF, /* COMPONENTS OF clause */ A1TC_VALUESET, /* Value set definition */ A1TC_CLASSDEF, /* Information Object Class */ A1TC_INSTANCE, /* Instance of Object Class */ /* * ASN.1 Class field types */ #define ASN_CLASSFIELD_MASK 0x10 /* Every class field type */ A1TC_CLASSFIELD_TFS = ASN_CLASSFIELD_MASK, /* TypeFieldSpec */ A1TC_CLASSFIELD_FTVFS, /* FixedTypeValueFieldSpec */ A1TC_CLASSFIELD_VTVFS, /* VariableTypeValueFieldSpec */ A1TC_CLASSFIELD_FTVSFS, /* FixedTypeValueSetFieldSpec */ A1TC_CLASSFIELD_VTVSFS, /* VariableTypeValueSetFieldSpec */ A1TC_CLASSFIELD_OFS, /* ObjectFieldSpec */ A1TC_CLASSFIELD_OSFS, /* ObjectSetFieldSpec */ /* * ASN.1 Constructed types */ #define ASN_CONSTR_MASK 0x20 /* Every constructed type */ ASN_CONSTR_SEQUENCE = ASN_CONSTR_MASK, /* SEQUENCE */ ASN_CONSTR_CHOICE, /* CHOICE */ ASN_CONSTR_SET, /* SET */ ASN_CONSTR_SEQUENCE_OF, /* SEQUENCE OF */ ASN_CONSTR_SET_OF, /* SET OF */ /* * ASN.1 Basic types */ #define ASN_BASIC_MASK 0x40 /* Every basic type */ ASN_TYPE_ANY = ASN_BASIC_MASK, /* ANY (deprecated) */ ASN_BASIC_BOOLEAN, ASN_BASIC_NULL, ASN_BASIC_INTEGER, ASN_BASIC_REAL, ASN_BASIC_ENUMERATED, ASN_BASIC_BIT_STRING, ASN_BASIC_OCTET_STRING, ASN_BASIC_OBJECT_IDENTIFIER, ASN_BASIC_RELATIVE_OID, ASN_BASIC_EXTERNAL, ASN_BASIC_EMBEDDED_PDV, ASN_BASIC_CHARACTER_STRING, ASN_BASIC_UTCTime, ASN_BASIC_GeneralizedTime, /* * ASN.1 String types */ #define ASN_STRING_KM_MASK 0x100 /* Known multiplier */ #define ASN_STRING_NKM_MASK 0x200 /* Not a known multiplier */ #define ASN_STRING_MASK 0x300 /* Every restricted string type */ ASN_STRING_IA5String = ASN_STRING_KM_MASK, ASN_STRING_PrintableString, ASN_STRING_VisibleString, ASN_STRING_ISO646String, /* aka VisibleString */ ASN_STRING_NumericString, ASN_STRING_UniversalString, ASN_STRING_BMPString, ASN_STRING_UTF8String = ASN_STRING_NKM_MASK, ASN_STRING_GeneralString, ASN_STRING_GraphicString, ASN_STRING_TeletexString, ASN_STRING_T61String, ASN_STRING_VideotexString, ASN_STRING_ObjectDescriptor, ASN_EXPR_TYPE_MAX } asn1p_expr_type_e; #include "asn1p_expr_str.h" #include "asn1p_expr2uclass.h" struct asn1p_module_s; /* Forward declaration */ /* * A named collection of types. */ typedef struct asn1p_expr_s { /* * Human readable name. */ char *Identifier; /* * Meta type of the expression (type, value, value set, etc). */ asn1p_expr_meta_e meta_type; /* * ASN type of the expression. */ asn1p_expr_type_e expr_type; /* * Referenced type, defined elsewhere. * (If expr_type == A1TC_REFERENCE) */ asn1p_ref_t *reference; /* * Constraints for the type. */ asn1p_constraint_t *constraints; /* * This field is holding the transformed constraints, with all the * parent constraints taken into account. */ asn1p_constraint_t *combined_constraints; /* * Left hand side parameters for parametrized type declaration * Type{Param1, Param2} ::= SEQUENCE { a Param1, b Param2 } */ asn1p_paramlist_t *lhs_params; /* * Right hand type specialization. * Type2 ::= Type{Param1} */ struct asn1p_expr_s *rhs_pspecs; /* ->members */ /* * If lhs_params is defined, this structure represents all possible * specializations of the parent expression. */ struct { struct asn1p_pspec_s { struct asn1p_expr_s *rhs_pspecs; struct asn1p_expr_s *my_clone; } *pspec; int pspecs_count; /* Number of specializations */ } specializations; int spec_index; /* -1, or 0-based specialization index in the parent */ /* * The actual value (DefinedValue or inlined value). */ asn1p_value_t *value; /* * The WITH SYNTAX clause. */ asn1p_wsyntx_t *with_syntax; /* Information Object Class matrix, specific for this class */ struct asn1p_ioc_matrix_s { asn1p_ioc_row_t **row; int rows; int max_identifier_length; } object_class_matrix; /* * A tag. */ struct asn1p_type_tag_s { enum { TC_NOCLASS, TC_UNIVERSAL, TC_APPLICATION, TC_CONTEXT_SPECIFIC, TC_PRIVATE, } tag_class; enum { TM_DEFAULT, TM_IMPLICIT, TM_EXPLICIT, } tag_mode; asn1c_integer_t tag_value; } tag; struct asn1p_expr_marker_s { enum asn1p_expr_marker_e { EM_NOMARK, EM_INDIRECT = 0x01, /* 00001 Represent as pointer */ EM_OMITABLE = 0x02, /* 00010 May be absent in encoding */ EM_OPTIONAL = 0x07, /* 00111 Optional member */ EM_DEFAULT = 0x0F, /* 01111 default_value */ EM_UNRECURSE = 0x10, /* 10000 Use safe naming */ } flags; asn1p_value_t *default_value; /* For EM_DEFAULT case */ } marker; int unique; /* UNIQUE */ /* * Whether automatic tagging may be applied for subtypes. */ int auto_tags_OK; /* * Members of the constructed type. */ TQ_HEAD(struct asn1p_expr_s) members; /* * Next expression in the list. */ TQ_ENTRY(struct asn1p_expr_s) next; struct asn1p_expr_s *parent_expr; /* optional */ struct asn1p_module_s *module; /* Defined in module */ /* * Line number where this structure is defined in the original * grammar source. */ int _lineno; /* * Marks are used for various purposes. * Here are some predefined ones. */ enum { TM_NOMARK = 0, TM_RECURSION = (1<<0), /* Used to break recursion */ TM_BROKEN = (1<<1), /* A warning was already issued */ TM_PERFROMCT = (1<<2), /* PER FROM() constraint tables emitted */ } _mark; /* * Some tags used by the compiler. */ int _anonymous_type; /* This type is unnamed */ int _type_unique_index; /* A per top-level-type unique index */ int _type_referenced; /* This type is referenced from another place */ /* * Opaque data may be attached to this structure, * probably by compiler. */ void *data; void (*data_free)(void *data); } asn1p_expr_t; /* * Constructor and destructor. */ asn1p_expr_t *asn1p_expr_new(int _lineno, struct asn1p_module_s *); asn1p_expr_t *asn1p_expr_clone(asn1p_expr_t *, int skip_extensions); asn1p_expr_t *asn1p_expr_clone_with_resolver(asn1p_expr_t *, asn1p_expr_t *(*resolver)(asn1p_expr_t *to_resolve, void *resolver_arg), void *resolver_arg); void asn1p_expr_add(asn1p_expr_t *to, asn1p_expr_t *what); void asn1p_expr_add_many(asn1p_expr_t *to, asn1p_expr_t *from_what); void asn1p_expr_free(asn1p_expr_t *expr); #define TAG2STRING_BUFFER_SIZE 64 /* buf should be at least this big */ char *asn1p_tag2string(struct asn1p_type_tag_s *tag, char *opt_buf); #endif /* ASN1_PARSER_EXPR_H */ asn1c-0.9.28+dfsg/libasn1parser/asn1p_list.h0000644000000000000000000000323413065714043017235 0ustar rootroot/* * Singly linked tail queue support. */ #ifndef ASN1_PARSER_LIST_H #define ASN1_PARSER_LIST_H #define TQ_HEAD(type) \ struct { \ type *tq_head; \ type**tq_tail; \ } #define TQ_MOVE(to, from) do { \ if(&(TQ_FIRST(from)) == (from)->tq_tail) { \ TQ_INIT(to); \ } else { \ (to)->tq_head = (from)->tq_head; \ (to)->tq_tail = (from)->tq_tail; \ } \ TQ_INIT(from); \ } while(0) #define TQ_ENTRY(type) \ struct { \ type *tq_next; \ } #define TQ_FIRST(headp) ((headp)->tq_head) #define TQ_NEXT(el, field) ((el)->field.tq_next) #define TQ_INIT(head) do { \ TQ_FIRST((head)) = 0; \ (head)->tq_tail = &TQ_FIRST((head)); \ } while(0) #define TQ_FOR(var, head, field) \ for((var) = TQ_FIRST((head)); \ (var); (var) = TQ_NEXT((var), field)) /* MSVC does not have typeof(), cannot prevent side effects! */ #define TQ_ADD(head, xel, field) do { \ typeof(xel) __el = (xel); \ assert(TQ_NEXT((__el), field) == 0); \ *(head)->tq_tail = (__el); \ (head)->tq_tail = &TQ_NEXT((__el), field); \ } while(0) #define TQ_CONCAT(head1, head2, field) do { \ if(TQ_FIRST(head2)) { \ *(head1)->tq_tail = (head2)->tq_head; \ (head1)->tq_tail = (head2)->tq_tail; \ TQ_INIT(head2); \ } \ } while(0) /* * Remove the first element and return it. */ #define TQ_REMOVE(head, field) ({ \ typeof(TQ_FIRST((head))) __fel; \ __fel = TQ_FIRST((head)); \ if(__fel == 0 \ || (TQ_FIRST((head)) = TQ_NEXT(__fel, field)) \ == 0) { \ (head)->tq_tail = &TQ_FIRST((head)); \ } else { \ TQ_NEXT(__fel, field) = 0; \ } \ __fel; }) #endif /* ASN1_PARSER_LIST_H */ asn1c-0.9.28+dfsg/libasn1parser/asn1p_xports.h0000644000000000000000000000153313065714043017621 0ustar rootroot/* * Imports and exports structure. */ #ifndef ASN1_PARSE_XPORTS_H #define ASN1_PARSE_XPORTS_H typedef struct asn1p_xports_s { /* * Type of the xports structure. */ enum asn1p_xports { XPT_IMPORTS, XPT_EXPORTS, } xports_type; /* * Module name and optional OID, occur after FROM. */ char *fromModuleName; /* Name of the module */ struct AssignedIdentifier { asn1p_oid_t *oid; /* Optional OID of the module */ asn1p_value_t *value; /* DefinedValue */ } identifier; /* * Number of entities to import. */ TQ_HEAD(struct asn1p_expr_s) members; /* * Pointer to the next xports structure in whatever list. */ TQ_ENTRY(struct asn1p_xports_s) xp_next; } asn1p_xports_t; /* * Constructor and destructor. */ asn1p_xports_t *asn1p_xports_new(void); void asn1p_xports_free(asn1p_xports_t *); #endif /* ASN1_PARSE_XPORTS_H */ asn1c-0.9.28+dfsg/libasn1parser/asn1p_expr_str.h0000644000000000000000000000436613065714043020137 0ustar rootroot/* * This file is automatically generated by ./expr-h.pl * DO NOT EDIT MANUALLY, fix the ./expr-h.pl instead if necessary. */ #ifndef ASN1_PARSER_EXPR_STR_H #define ASN1_PARSER_EXPR_STR_H #include #ifndef __GNUC__ #define __attribute__(x) /* unused */ #endif static char *asn1p_expr_type2str[] __attribute__ ((unused)) = { [ ASN_CONSTR_SEQUENCE ] = "SEQUENCE", [ ASN_CONSTR_CHOICE ] = "CHOICE", [ ASN_CONSTR_SET ] = "SET", [ ASN_CONSTR_SEQUENCE_OF ] = "SEQUENCE OF", [ ASN_CONSTR_SET_OF ] = "SET OF", [ ASN_TYPE_ANY ] = "ANY", [ ASN_BASIC_BOOLEAN ] = "BOOLEAN", [ ASN_BASIC_NULL ] = "NULL", [ ASN_BASIC_INTEGER ] = "INTEGER", [ ASN_BASIC_REAL ] = "REAL", [ ASN_BASIC_ENUMERATED ] = "ENUMERATED", [ ASN_BASIC_BIT_STRING ] = "BIT STRING", [ ASN_BASIC_OCTET_STRING ] = "OCTET STRING", [ ASN_BASIC_OBJECT_IDENTIFIER ] = "OBJECT IDENTIFIER", [ ASN_BASIC_RELATIVE_OID ] = "RELATIVE-OID", [ ASN_BASIC_EXTERNAL ] = "EXTERNAL", [ ASN_BASIC_EMBEDDED_PDV ] = "EMBEDDED PDV", [ ASN_BASIC_CHARACTER_STRING ] = "CHARACTER STRING", [ ASN_BASIC_UTCTime ] = "UTCTime", [ ASN_BASIC_GeneralizedTime ] = "GeneralizedTime", [ ASN_STRING_IA5String ] = "IA5String", [ ASN_STRING_PrintableString ] = "PrintableString", [ ASN_STRING_VisibleString ] = "VisibleString", [ ASN_STRING_ISO646String ] = "ISO646String", [ ASN_STRING_NumericString ] = "NumericString", [ ASN_STRING_UniversalString ] = "UniversalString", [ ASN_STRING_BMPString ] = "BMPString", [ ASN_STRING_UTF8String ] = "UTF8String", [ ASN_STRING_GeneralString ] = "GeneralString", [ ASN_STRING_GraphicString ] = "GraphicString", [ ASN_STRING_TeletexString ] = "TeletexString", [ ASN_STRING_T61String ] = "T61String", [ ASN_STRING_VideotexString ] = "VideotexString", [ ASN_STRING_ObjectDescriptor ] = "ObjectDescriptor", }; /* * Convert the ASN.1 expression type back into the string representation. */ #define ASN_EXPR_TYPE2STR(type) _asn1p_expr_type2string(type) static inline char * __attribute__((unused)) _asn1p_expr_type2string(asn1p_expr_type_e type) { assert((signed int)type >= 0); if(type < sizeof(asn1p_expr_type2str)/sizeof(asn1p_expr_type2str[0])) return asn1p_expr_type2str[type]; return NULL; } #endif /* ASN1_PARSER_EXPR_STR_H */ asn1c-0.9.28+dfsg/libasn1parser/asn1p_y.c0000644000000000000000000045572113065714043016541 0ustar rootroot/* A Bison parser, made by GNU Bison 2.3. */ /* Skeleton implementation for Bison's Yacc-like parsers in C Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ #define YYBISON_VERSION "2.3" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 0 /* Using locations. */ #define YYLSP_NEEDED 0 /* Substitute the variable and function names. */ #define yyparse asn1p_parse #define yylex asn1p_lex #define yyerror asn1p_error #define yylval asn1p_lval #define yychar asn1p_char #define yydebug asn1p_debug #define yynerrs asn1p_nerrs /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { TOK_PPEQ = 258, TOK_VBracketLeft = 259, TOK_VBracketRight = 260, TOK_whitespace = 261, TOK_opaque = 262, TOK_bstring = 263, TOK_cstring = 264, TOK_hstring = 265, TOK_identifier = 266, TOK_number = 267, TOK_number_negative = 268, TOK_realnumber = 269, TOK_tuple = 270, TOK_quadruple = 271, TOK_typereference = 272, TOK_capitalreference = 273, TOK_typefieldreference = 274, TOK_valuefieldreference = 275, TOK_Literal = 276, TOK_ABSENT = 277, TOK_ABSTRACT_SYNTAX = 278, TOK_ALL = 279, TOK_ANY = 280, TOK_APPLICATION = 281, TOK_AUTOMATIC = 282, TOK_BEGIN = 283, TOK_BIT = 284, TOK_BMPString = 285, TOK_BOOLEAN = 286, TOK_BY = 287, TOK_CHARACTER = 288, TOK_CHOICE = 289, TOK_CLASS = 290, TOK_COMPONENT = 291, TOK_COMPONENTS = 292, TOK_CONSTRAINED = 293, TOK_CONTAINING = 294, TOK_DEFAULT = 295, TOK_DEFINITIONS = 296, TOK_DEFINED = 297, TOK_EMBEDDED = 298, TOK_ENCODED = 299, TOK_ENCODING_CONTROL = 300, TOK_END = 301, TOK_ENUMERATED = 302, TOK_EXPLICIT = 303, TOK_EXPORTS = 304, TOK_EXTENSIBILITY = 305, TOK_EXTERNAL = 306, TOK_FALSE = 307, TOK_FROM = 308, TOK_GeneralizedTime = 309, TOK_GeneralString = 310, TOK_GraphicString = 311, TOK_IA5String = 312, TOK_IDENTIFIER = 313, TOK_IMPLICIT = 314, TOK_IMPLIED = 315, TOK_IMPORTS = 316, TOK_INCLUDES = 317, TOK_INSTANCE = 318, TOK_INSTRUCTIONS = 319, TOK_INTEGER = 320, TOK_ISO646String = 321, TOK_MAX = 322, TOK_MIN = 323, TOK_MINUS_INFINITY = 324, TOK_NULL = 325, TOK_NumericString = 326, TOK_OBJECT = 327, TOK_ObjectDescriptor = 328, TOK_OCTET = 329, TOK_OF = 330, TOK_OPTIONAL = 331, TOK_PATTERN = 332, TOK_PDV = 333, TOK_PLUS_INFINITY = 334, TOK_PRESENT = 335, TOK_PrintableString = 336, TOK_PRIVATE = 337, TOK_REAL = 338, TOK_RELATIVE_OID = 339, TOK_SEQUENCE = 340, TOK_SET = 341, TOK_SIZE = 342, TOK_STRING = 343, TOK_SYNTAX = 344, TOK_T61String = 345, TOK_TAGS = 346, TOK_TeletexString = 347, TOK_TRUE = 348, TOK_TYPE_IDENTIFIER = 349, TOK_UNIQUE = 350, TOK_UNIVERSAL = 351, TOK_UniversalString = 352, TOK_UTCTime = 353, TOK_UTF8String = 354, TOK_VideotexString = 355, TOK_VisibleString = 356, TOK_WITH = 357, TOK_EXCEPT = 358, TOK_INTERSECTION = 359, TOK_UNION = 360, TOK_TwoDots = 361, TOK_ThreeDots = 362 }; #endif /* Tokens. */ #define TOK_PPEQ 258 #define TOK_VBracketLeft 259 #define TOK_VBracketRight 260 #define TOK_whitespace 261 #define TOK_opaque 262 #define TOK_bstring 263 #define TOK_cstring 264 #define TOK_hstring 265 #define TOK_identifier 266 #define TOK_number 267 #define TOK_number_negative 268 #define TOK_realnumber 269 #define TOK_tuple 270 #define TOK_quadruple 271 #define TOK_typereference 272 #define TOK_capitalreference 273 #define TOK_typefieldreference 274 #define TOK_valuefieldreference 275 #define TOK_Literal 276 #define TOK_ABSENT 277 #define TOK_ABSTRACT_SYNTAX 278 #define TOK_ALL 279 #define TOK_ANY 280 #define TOK_APPLICATION 281 #define TOK_AUTOMATIC 282 #define TOK_BEGIN 283 #define TOK_BIT 284 #define TOK_BMPString 285 #define TOK_BOOLEAN 286 #define TOK_BY 287 #define TOK_CHARACTER 288 #define TOK_CHOICE 289 #define TOK_CLASS 290 #define TOK_COMPONENT 291 #define TOK_COMPONENTS 292 #define TOK_CONSTRAINED 293 #define TOK_CONTAINING 294 #define TOK_DEFAULT 295 #define TOK_DEFINITIONS 296 #define TOK_DEFINED 297 #define TOK_EMBEDDED 298 #define TOK_ENCODED 299 #define TOK_ENCODING_CONTROL 300 #define TOK_END 301 #define TOK_ENUMERATED 302 #define TOK_EXPLICIT 303 #define TOK_EXPORTS 304 #define TOK_EXTENSIBILITY 305 #define TOK_EXTERNAL 306 #define TOK_FALSE 307 #define TOK_FROM 308 #define TOK_GeneralizedTime 309 #define TOK_GeneralString 310 #define TOK_GraphicString 311 #define TOK_IA5String 312 #define TOK_IDENTIFIER 313 #define TOK_IMPLICIT 314 #define TOK_IMPLIED 315 #define TOK_IMPORTS 316 #define TOK_INCLUDES 317 #define TOK_INSTANCE 318 #define TOK_INSTRUCTIONS 319 #define TOK_INTEGER 320 #define TOK_ISO646String 321 #define TOK_MAX 322 #define TOK_MIN 323 #define TOK_MINUS_INFINITY 324 #define TOK_NULL 325 #define TOK_NumericString 326 #define TOK_OBJECT 327 #define TOK_ObjectDescriptor 328 #define TOK_OCTET 329 #define TOK_OF 330 #define TOK_OPTIONAL 331 #define TOK_PATTERN 332 #define TOK_PDV 333 #define TOK_PLUS_INFINITY 334 #define TOK_PRESENT 335 #define TOK_PrintableString 336 #define TOK_PRIVATE 337 #define TOK_REAL 338 #define TOK_RELATIVE_OID 339 #define TOK_SEQUENCE 340 #define TOK_SET 341 #define TOK_SIZE 342 #define TOK_STRING 343 #define TOK_SYNTAX 344 #define TOK_T61String 345 #define TOK_TAGS 346 #define TOK_TeletexString 347 #define TOK_TRUE 348 #define TOK_TYPE_IDENTIFIER 349 #define TOK_UNIQUE 350 #define TOK_UNIVERSAL 351 #define TOK_UniversalString 352 #define TOK_UTCTime 353 #define TOK_UTF8String 354 #define TOK_VideotexString 355 #define TOK_VisibleString 356 #define TOK_WITH 357 #define TOK_EXCEPT 358 #define TOK_INTERSECTION 359 #define TOK_UNION 360 #define TOK_TwoDots 361 #define TOK_ThreeDots 362 /* Copy the first part of user declarations. */ #line 1 "asn1p_y.y" #include #include #include #include #include #include "asn1parser.h" #define YYPARSE_PARAM param #define YYPARSE_PARAM_TYPE void ** #define YYERROR_VERBOSE int yylex(void); int yyerror(const char *msg); #ifdef YYBYACC int yyparse(void **param); /* byacc does not produce a prototype */ #endif void asn1p_lexer_hack_push_opaque_state(void); void asn1p_lexer_hack_enable_with_syntax(void); void asn1p_lexer_hack_push_encoding_control(void); #define yylineno asn1p_lineno extern int asn1p_lineno; /* * Process directives as */ extern int asn1p_as_pointer; /* * This temporary variable is used to solve the shortcomings of 1-lookahead * parser. */ static struct AssignedIdentifier *saved_aid; static asn1p_value_t *_convert_bitstring2binary(char *str, int base); static void _fixup_anonymous_identifier(asn1p_expr_t *expr); static asn1p_module_t *currentModule; #define NEW_EXPR() (asn1p_expr_new(yylineno, currentModule)) #define checkmem(ptr) do { \ if(!(ptr)) \ return yyerror("Memory failure"); \ } while(0) #define CONSTRAINT_INSERT(root, constr_type, arg1, arg2) do { \ if(arg1->type != constr_type) { \ int __ret; \ root = asn1p_constraint_new(yylineno); \ checkmem(root); \ root->type = constr_type; \ __ret = asn1p_constraint_insert(root, \ arg1); \ checkmem(__ret == 0); \ } else { \ root = arg1; \ } \ if(arg2) { \ int __ret \ = asn1p_constraint_insert(root, arg2); \ checkmem(__ret == 0); \ } \ } while(0) #ifdef AL_IMPORT #error AL_IMPORT DEFINED ELSEWHERE! #endif #define AL_IMPORT(to,where,from,field) do { \ if(!(from)) break; \ while(TQ_FIRST(&((from)->where))) { \ TQ_ADD(&((to)->where), \ TQ_REMOVE(&((from)->where), field), \ field); \ } \ assert(TQ_FIRST(&((from)->where)) == 0); \ } while(0) /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else # define YYERROR_VERBOSE 0 #endif /* Enabling the token table. */ #ifndef YYTOKEN_TABLE # define YYTOKEN_TABLE 0 #endif #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE #line 88 "asn1p_y.y" { asn1p_t *a_grammar; asn1p_module_flags_e a_module_flags; asn1p_module_t *a_module; asn1p_expr_type_e a_type; /* ASN.1 Type */ asn1p_expr_t *a_expr; /* Constructed collection */ asn1p_constraint_t *a_constr; /* Constraint */ enum asn1p_constraint_type_e a_ctype;/* Constraint type */ asn1p_xports_t *a_xports; /* IMports/EXports */ struct AssignedIdentifier a_aid; /* Assigned Identifier */ asn1p_oid_t *a_oid; /* Object Identifier */ asn1p_oid_arc_t a_oid_arc; /* Single OID's arc */ struct asn1p_type_tag_s a_tag; /* A tag */ asn1p_ref_t *a_ref; /* Reference to custom type */ asn1p_wsyntx_t *a_wsynt; /* WITH SYNTAX contents */ asn1p_wsyntx_chunk_t *a_wchunk; /* WITH SYNTAX chunk */ struct asn1p_ref_component_s a_refcomp; /* Component of a reference */ asn1p_value_t *a_value; /* Number, DefinedValue, etc */ struct asn1p_param_s a_parg; /* A parameter argument */ asn1p_paramlist_t *a_plist; /* A pargs list */ struct asn1p_expr_marker_s a_marker; /* OPTIONAL/DEFAULT */ enum asn1p_constr_pres_e a_pres; /* PRESENT/ABSENT/OPTIONAL */ asn1c_integer_t a_int; double a_dbl; char *tv_str; struct { char *buf; int len; } tv_opaque; struct { char *name; struct asn1p_type_tag_s tag; } tv_nametag; } /* Line 193 of yacc.c. */ #line 434 "y.tab.c" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 #endif /* Copy the second part of user declarations. */ /* Line 216 of yacc.c. */ #line 447 "y.tab.c" #ifdef short # undef short #endif #ifdef YYTYPE_UINT8 typedef YYTYPE_UINT8 yytype_uint8; #else typedef unsigned char yytype_uint8; #endif #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; #elif (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) typedef signed char yytype_int8; #else typedef short int yytype_int8; #endif #ifdef YYTYPE_UINT16 typedef YYTYPE_UINT16 yytype_uint16; #else typedef unsigned short int yytype_uint16; #endif #ifdef YYTYPE_INT16 typedef YYTYPE_INT16 yytype_int16; #else typedef short int yytype_int16; #endif #ifndef YYSIZE_T # ifdef __SIZE_TYPE__ # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else # define YYSIZE_T unsigned int # endif #endif #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ # if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) # endif # endif # ifndef YY_ # define YY_(msgid) msgid # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(e) ((void) (e)) #else # define YYUSE(e) /* empty */ #endif /* Identity function, used to suppress warnings about constant conditions. */ #ifndef lint # define YYID(n) (n) #else #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int YYID (int i) #else static int YYID (i) int i; #endif { return i; } #endif #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # elif defined __BUILTIN_VA_ARG_INCR # include /* INFRINGES ON USER NAME SPACE */ # elif defined _AIX # define YYSTACK_ALLOC __alloca # elif defined _MSC_VER # include /* INFRINGES ON USER NAME SPACE */ # define alloca _alloca # else # define YYSTACK_ALLOC alloca # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif # endif # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif # else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif # if (defined __cplusplus && ! defined _STDLIB_H \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { yytype_int16 yyss; YYSTYPE yyvs; }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else # define YYCOPY(To, From, Count) \ do \ { \ YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ while (YYID (0)) # endif # endif /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ # define YYSTACK_RELOCATE(Stack) \ do \ { \ YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack, Stack, yysize); \ Stack = &yyptr->Stack; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (YYID (0)) #endif /* YYFINAL -- State number of the termination state. */ #define YYFINAL 7 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 793 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 123 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 122 /* YYNRULES -- Number of rules. */ #define YYNRULES 313 /* YYNRULES -- Number of states. */ #define YYNSTATES 473 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 362 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 119, 2, 2, 2, 2, 2, 2, 112, 113, 2, 2, 115, 2, 120, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 116, 114, 121, 2, 2, 2, 122, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 117, 2, 118, 104, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 110, 106, 111, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 105, 107, 108, 109 }; #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ static const yytype_uint16 yyprhs[] = { 0, 0, 3, 5, 7, 10, 11, 21, 22, 24, 28, 31, 33, 36, 38, 43, 45, 46, 48, 50, 53, 56, 59, 62, 65, 68, 69, 71, 75, 77, 80, 82, 84, 86, 87, 91, 93, 94, 96, 100, 103, 104, 106, 108, 111, 112, 114, 119, 121, 125, 127, 131, 133, 134, 136, 140, 144, 147, 149, 153, 155, 159, 161, 165, 170, 172, 174, 179, 183, 187, 194, 201, 203, 207, 209, 213, 217, 221, 225, 227, 231, 233, 235, 237, 239, 240, 242, 244, 248, 254, 258, 261, 265, 267, 269, 273, 276, 278, 280, 286, 287, 289, 291, 295, 298, 303, 307, 311, 315, 319, 323, 324, 326, 327, 334, 336, 339, 341, 343, 345, 349, 351, 355, 359, 363, 364, 367, 369, 374, 379, 384, 391, 398, 400, 405, 409, 411, 415, 419, 423, 425, 429, 431, 435, 437, 439, 441, 443, 447, 451, 453, 458, 460, 462, 466, 467, 471, 473, 475, 477, 479, 481, 483, 485, 487, 491, 493, 495, 497, 499, 502, 504, 506, 508, 510, 513, 516, 518, 520, 523, 526, 528, 530, 532, 534, 536, 539, 541, 544, 546, 548, 550, 552, 554, 556, 558, 560, 562, 564, 566, 568, 570, 572, 574, 576, 578, 580, 581, 583, 585, 587, 592, 596, 601, 603, 605, 609, 615, 617, 619, 623, 625, 629, 631, 635, 637, 641, 646, 650, 652, 654, 658, 662, 666, 670, 672, 674, 677, 680, 682, 684, 686, 688, 690, 692, 694, 696, 698, 700, 702, 706, 712, 714, 718, 720, 724, 725, 727, 729, 731, 733, 735, 737, 739, 740, 746, 749, 751, 754, 757, 761, 763, 765, 769, 774, 776, 780, 783, 787, 789, 793, 794, 796, 798, 801, 804, 808, 810, 814, 816, 821, 826, 828, 830, 832, 834, 836, 838, 839, 841, 844, 849, 850, 852, 854, 856, 857, 859, 861, 863, 865, 867, 868, 870 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int16 yyrhs[] = { 124, 0, -1, 125, -1, 126, -1, 125, 126, -1, -1, 241, 127, 128, 41, 132, 3, 28, 135, 46, -1, -1, 129, -1, 110, 130, 111, -1, 110, 111, -1, 131, -1, 130, 131, -1, 244, -1, 244, 112, 12, 113, -1, 12, -1, -1, 133, -1, 134, -1, 133, 134, -1, 48, 91, -1, 59, 91, -1, 27, 91, -1, 50, 60, -1, 18, 64, -1, -1, 136, -1, 148, 140, 137, -1, 138, -1, 137, 138, -1, 155, -1, 185, -1, 153, -1, -1, 45, 18, 139, -1, 195, -1, -1, 141, -1, 61, 142, 114, -1, 61, 53, -1, -1, 143, -1, 145, -1, 143, 145, -1, -1, 129, -1, 146, 53, 241, 144, -1, 147, -1, 146, 115, 147, -1, 241, -1, 241, 110, 111, -1, 244, -1, -1, 149, -1, 49, 150, 114, -1, 49, 24, 114, -1, 49, 114, -1, 151, -1, 150, 115, 151, -1, 241, -1, 241, 110, 111, -1, 244, -1, 110, 202, 111, -1, 241, 154, 3, 152, -1, 194, -1, 179, -1, 179, 110, 158, 111, -1, 241, 3, 175, -1, 241, 3, 165, -1, 241, 110, 156, 111, 3, 175, -1, 241, 110, 156, 111, 3, 165, -1, 157, -1, 156, 115, 157, -1, 241, -1, 241, 116, 244, -1, 241, 116, 241, -1, 192, 116, 244, -1, 192, 116, 241, -1, 159, -1, 158, 115, 159, -1, 175, -1, 188, -1, 244, -1, 152, -1, -1, 161, -1, 162, -1, 161, 115, 162, -1, 161, 115, 4, 161, 5, -1, 244, 175, 229, -1, 175, 229, -1, 37, 75, 175, -1, 174, -1, 164, -1, 163, 115, 164, -1, 244, 175, -1, 174, -1, 175, -1, 35, 110, 167, 111, 169, -1, -1, 95, -1, 168, -1, 167, 115, 168, -1, 19, 229, -1, 20, 175, 166, 229, -1, 20, 183, 229, -1, 20, 184, 229, -1, 19, 183, 229, -1, 19, 175, 229, -1, 19, 184, 229, -1, -1, 170, -1, -1, 102, 89, 110, 171, 172, 111, -1, 173, -1, 172, 173, -1, 6, -1, 21, -1, 182, -1, 117, 172, 118, -1, 109, -1, 109, 119, 189, -1, 109, 119, 234, -1, 236, 177, 198, -1, -1, 176, 178, -1, 154, -1, 34, 110, 163, 111, -1, 85, 110, 160, 111, -1, 86, 110, 160, 111, -1, 85, 198, 75, 243, 236, 177, -1, 86, 198, 75, 243, 236, 177, -1, 25, -1, 25, 42, 32, 244, -1, 63, 75, 179, -1, 17, -1, 17, 120, 241, -1, 242, 120, 241, -1, 17, 120, 244, -1, 242, -1, 242, 120, 180, -1, 181, -1, 180, 120, 181, -1, 182, -1, 19, -1, 20, -1, 19, -1, 183, 120, 19, -1, 183, 120, 20, -1, 18, -1, 244, 175, 3, 186, -1, 188, -1, 189, -1, 244, 116, 186, -1, -1, 110, 187, 191, -1, 70, -1, 52, -1, 93, -1, 8, -1, 10, -1, 190, -1, 234, -1, 244, -1, 241, 120, 244, -1, 9, -1, 15, -1, 16, -1, 7, -1, 191, 7, -1, 31, -1, 70, -1, 83, -1, 193, -1, 74, 88, -1, 72, 58, -1, 84, -1, 51, -1, 43, 78, -1, 33, 88, -1, 98, -1, 54, -1, 195, -1, 65, -1, 47, -1, 29, 88, -1, 192, -1, 193, 231, -1, 30, -1, 55, -1, 56, -1, 57, -1, 66, -1, 71, -1, 81, -1, 90, -1, 92, -1, 97, -1, 99, -1, 100, -1, 101, -1, 73, -1, 106, -1, 107, -1, 104, -1, 105, -1, -1, 199, -1, 200, -1, 201, -1, 87, 112, 202, 113, -1, 112, 202, 113, -1, 201, 112, 202, 113, -1, 109, -1, 203, -1, 203, 115, 109, -1, 203, 115, 109, 115, 203, -1, 218, -1, 204, -1, 24, 103, 207, -1, 205, -1, 204, 196, 205, -1, 206, -1, 205, 197, 206, -1, 207, -1, 207, 103, 207, -1, 209, 112, 202, 113, -1, 112, 202, 113, -1, 210, -1, 212, -1, 210, 222, 210, -1, 68, 222, 210, -1, 210, 222, 67, -1, 68, 222, 67, -1, 213, -1, 208, -1, 77, 9, -1, 77, 244, -1, 87, -1, 53, -1, 52, -1, 93, -1, 235, -1, 190, -1, 211, -1, 244, -1, 8, -1, 10, -1, 241, -1, 102, 36, 201, -1, 102, 37, 110, 214, 111, -1, 215, -1, 214, 115, 215, -1, 109, -1, 244, 198, 216, -1, -1, 217, -1, 80, -1, 22, -1, 76, -1, 219, -1, 223, -1, 221, -1, -1, 38, 32, 110, 220, 191, -1, 39, 175, -1, 108, -1, 108, 121, -1, 121, 108, -1, 121, 108, 121, -1, 224, -1, 225, -1, 110, 241, 111, -1, 224, 110, 226, 111, -1, 227, -1, 226, 115, 227, -1, 122, 228, -1, 122, 120, 228, -1, 244, -1, 228, 120, 244, -1, -1, 230, -1, 76, -1, 40, 186, -1, 110, 111, -1, 110, 232, 111, -1, 233, -1, 232, 115, 233, -1, 244, -1, 244, 112, 234, 113, -1, 244, 112, 189, 113, -1, 234, -1, 109, -1, 12, -1, 13, -1, 234, -1, 14, -1, -1, 237, -1, 238, 240, -1, 117, 239, 12, 118, -1, -1, 96, -1, 26, -1, 82, -1, -1, 59, -1, 48, -1, 17, -1, 18, -1, 18, -1, -1, 244, -1, 11, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { 0, 357, 357, 363, 368, 385, 385, 414, 415, 419, 422, 428, 434, 443, 447, 451, 461, 462, 471, 474, 483, 486, 489, 492, 496, 517, 518, 527, 536, 539, 555, 562, 575, 583, 582, 596, 609, 610, 613, 623, 629, 630, 633, 638, 645, 646, 650, 661, 666, 673, 679, 685, 695, 696, 708, 711, 714, 722, 727, 734, 740, 746, 755, 758, 768, 781, 791, 811, 817, 833, 839, 847, 856, 867, 871, 878, 885, 893, 904, 909, 916, 919, 927, 938, 961, 962, 965, 970, 974, 981, 988, 994, 1001, 1007, 1012, 1019, 1024, 1027, 1034, 1044, 1045, 1049, 1056, 1066, 1076, 1087, 1097, 1108, 1118, 1129, 1141, 1142, 1149, 1148, 1157, 1161, 1168, 1172, 1175, 1179, 1185, 1193, 1202, 1214, 1236, 1243, 1262, 1265, 1271, 1277, 1283, 1293, 1303, 1309, 1320, 1335, 1343, 1353, 1363, 1373, 1381, 1403, 1411, 1420, 1424, 1429, 1438, 1442, 1446, 1453, 1473, 1483, 1484, 1485, 1492, 1492, 1497, 1505, 1510, 1515, 1519, 1523, 1526, 1532, 1543, 1561, 1565, 1570, 1578, 1587, 1602, 1603, 1604, 1605, 1606, 1607, 1608, 1609, 1610, 1611, 1612, 1613, 1614, 1621, 1622, 1623, 1627, 1633, 1646, 1647, 1651, 1655, 1656, 1657, 1658, 1659, 1663, 1664, 1665, 1666, 1670, 1671, 1678, 1678, 1679, 1679, 1682, 1683, 1689, 1693, 1696, 1706, 1709, 1715, 1719, 1722, 1728, 1736, 1742, 1743, 1749, 1750, 1756, 1757, 1764, 1765, 1771, 1779, 1787, 1793, 1799, 1806, 1814, 1822, 1831, 1834, 1840, 1845, 1856, 1859, 1865, 1870, 1875, 1876, 1877, 1878, 1892, 1896, 1903, 1917, 1920, 1926, 1929, 1935, 1941, 1955, 1956, 1960, 1963, 1966, 1974, 1975, 1976, 1981, 1980, 1992, 2000, 2001, 2002, 2003, 2006, 2009, 2018, 2033, 2039, 2045, 2059, 2070, 2086, 2089, 2107, 2111, 2115, 2119, 2142, 2146, 2152, 2157, 2164, 2171, 2179, 2187, 2194, 2205, 2209, 2216, 2217, 2248, 2249, 2253, 2260, 2266, 2267, 2268, 2269, 2273, 2274, 2275, 2279, 2283, 2291, 2298, 2299, 2305 }; #endif #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "TOK_PPEQ", "TOK_VBracketLeft", "TOK_VBracketRight", "TOK_whitespace", "TOK_opaque", "TOK_bstring", "TOK_cstring", "TOK_hstring", "TOK_identifier", "TOK_number", "TOK_number_negative", "TOK_realnumber", "TOK_tuple", "TOK_quadruple", "TOK_typereference", "TOK_capitalreference", "TOK_typefieldreference", "TOK_valuefieldreference", "TOK_Literal", "TOK_ABSENT", "TOK_ABSTRACT_SYNTAX", "TOK_ALL", "TOK_ANY", "TOK_APPLICATION", "TOK_AUTOMATIC", "TOK_BEGIN", "TOK_BIT", "TOK_BMPString", "TOK_BOOLEAN", "TOK_BY", "TOK_CHARACTER", "TOK_CHOICE", "TOK_CLASS", "TOK_COMPONENT", "TOK_COMPONENTS", "TOK_CONSTRAINED", "TOK_CONTAINING", "TOK_DEFAULT", "TOK_DEFINITIONS", "TOK_DEFINED", "TOK_EMBEDDED", "TOK_ENCODED", "TOK_ENCODING_CONTROL", "TOK_END", "TOK_ENUMERATED", "TOK_EXPLICIT", "TOK_EXPORTS", "TOK_EXTENSIBILITY", "TOK_EXTERNAL", "TOK_FALSE", "TOK_FROM", "TOK_GeneralizedTime", "TOK_GeneralString", "TOK_GraphicString", "TOK_IA5String", "TOK_IDENTIFIER", "TOK_IMPLICIT", "TOK_IMPLIED", "TOK_IMPORTS", "TOK_INCLUDES", "TOK_INSTANCE", "TOK_INSTRUCTIONS", "TOK_INTEGER", "TOK_ISO646String", "TOK_MAX", "TOK_MIN", "TOK_MINUS_INFINITY", "TOK_NULL", "TOK_NumericString", "TOK_OBJECT", "TOK_ObjectDescriptor", "TOK_OCTET", "TOK_OF", "TOK_OPTIONAL", "TOK_PATTERN", "TOK_PDV", "TOK_PLUS_INFINITY", "TOK_PRESENT", "TOK_PrintableString", "TOK_PRIVATE", "TOK_REAL", "TOK_RELATIVE_OID", "TOK_SEQUENCE", "TOK_SET", "TOK_SIZE", "TOK_STRING", "TOK_SYNTAX", "TOK_T61String", "TOK_TAGS", "TOK_TeletexString", "TOK_TRUE", "TOK_TYPE_IDENTIFIER", "TOK_UNIQUE", "TOK_UNIVERSAL", "TOK_UniversalString", "TOK_UTCTime", "TOK_UTF8String", "TOK_VideotexString", "TOK_VisibleString", "TOK_WITH", "TOK_EXCEPT", "'^'", "TOK_INTERSECTION", "'|'", "TOK_UNION", "TOK_TwoDots", "TOK_ThreeDots", "'{'", "'}'", "'('", "')'", "';'", "','", "':'", "'['", "']'", "'!'", "'.'", "'<'", "'@'", "$accept", "ParsedGrammar", "ModuleList", "ModuleDefinition", "@1", "optObjectIdentifier", "ObjectIdentifier", "ObjectIdentifierBody", "ObjectIdentifierElement", "optModuleDefinitionFlags", "ModuleDefinitionFlags", "ModuleDefinitionFlag", "optModuleBody", "ModuleBody", "AssignmentList", "Assignment", "@2", "optImports", "ImportsDefinition", "optImportsBundleSet", "ImportsBundleSet", "AssignedIdentifier", "ImportsBundle", "ImportsList", "ImportsElement", "optExports", "ExportsDefinition", "ExportsBody", "ExportsElement", "ValueSet", "ValueSetTypeAssignment", "DefinedType", "DataTypeReference", "ParameterArgumentList", "ParameterArgumentName", "ActualParameterList", "ActualParameter", "optComponentTypeLists", "ComponentTypeLists", "ComponentType", "AlternativeTypeLists", "AlternativeType", "ObjectClass", "optUnique", "FieldSpec", "ClassField", "optWithSyntax", "WithSyntax", "@3", "WithSyntaxList", "WithSyntaxToken", "ExtensionAndException", "Type", "NSTD_IndirectMarker", "TypeDeclaration", "TypeDeclarationSet", "ComplexTypeReference", "ComplexTypeReferenceAmpList", "ComplexTypeReferenceElement", "PrimitiveFieldReference", "FieldName", "DefinedObjectClass", "ValueAssignment", "Value", "@4", "SimpleValue", "DefinedValue", "RestrictedCharacterStringValue", "Opaque", "BasicTypeId", "BasicTypeId_UniverationCompatible", "BasicType", "BasicString", "UnionMark", "IntersectionMark", "optConstraints", "Constraint", "SubtypeConstraint", "SetOfConstraints", "ElementSetSpecs", "ElementSetSpec", "Unions", "Intersections", "IntersectionElements", "ConstraintSubtypeElement", "PatternConstraint", "ConstraintSpec", "SingleValue", "BitStringValue", "ContainedSubtype", "InnerTypeConstraint", "WithComponentsList", "WithComponentsElement", "optPresenceConstraint", "PresenceConstraint", "GeneralConstraint", "UserDefinedConstraint", "@5", "ContentsConstraint", "ConstraintRangeSpec", "TableConstraint", "SimpleTableConstraint", "ComponentRelationConstraint", "AtNotationList", "AtNotationElement", "ComponentIdList", "optMarker", "Marker", "UniverationDefinition", "UniverationList", "UniverationElement", "SignedNumber", "RealValue", "optTag", "Tag", "TagTypeValue", "TagClass", "TagPlicit", "TypeRefName", "ObjectClassReference", "optIdentifier", "Identifier", 0 }; #endif # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 94, 359, 124, 360, 361, 362, 123, 125, 40, 41, 59, 44, 58, 91, 93, 33, 46, 60, 64 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { 0, 123, 124, 125, 125, 127, 126, 128, 128, 129, 129, 130, 130, 131, 131, 131, 132, 132, 133, 133, 134, 134, 134, 134, 134, 135, 135, 136, 137, 137, 138, 138, 138, 139, 138, 138, 140, 140, 141, 141, 142, 142, 143, 143, 144, 144, 145, 146, 146, 147, 147, 147, 148, 148, 149, 149, 149, 150, 150, 151, 151, 151, 152, 153, 154, 154, 154, 155, 155, 155, 155, 156, 156, 157, 157, 157, 157, 157, 158, 158, 159, 159, 159, 159, 160, 160, 161, 161, 161, 162, 162, 162, 162, 163, 163, 164, 164, 164, 165, 166, 166, 167, 167, 168, 168, 168, 168, 168, 168, 168, 169, 169, 171, 170, 172, 172, 173, 173, 173, 173, 174, 174, 174, 175, 176, 177, 178, 178, 178, 178, 178, 178, 178, 178, 178, 179, 179, 179, 179, 179, 179, 180, 180, 181, 182, 182, 183, 183, 183, 184, 185, 186, 186, 186, 187, 186, 186, 188, 188, 188, 188, 188, 188, 189, 189, 190, 190, 190, 191, 191, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 193, 193, 193, 194, 194, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 196, 196, 197, 197, 198, 198, 199, 200, 200, 201, 201, 202, 202, 202, 202, 202, 203, 203, 204, 204, 205, 205, 206, 206, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 208, 208, 209, 209, 210, 210, 210, 210, 210, 210, 211, 211, 212, 213, 213, 214, 214, 215, 215, 216, 216, 217, 217, 217, 218, 218, 218, 220, 219, 221, 222, 222, 222, 222, 223, 223, 224, 225, 226, 226, 227, 227, 228, 228, 229, 229, 230, 230, 231, 231, 232, 232, 233, 233, 233, 233, 233, 234, 234, 235, 235, 236, 236, 237, 238, 239, 239, 239, 239, 240, 240, 240, 241, 241, 242, 243, 243, 244 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 1, 1, 2, 0, 9, 0, 1, 3, 2, 1, 2, 1, 4, 1, 0, 1, 1, 2, 2, 2, 2, 2, 2, 0, 1, 3, 1, 2, 1, 1, 1, 0, 3, 1, 0, 1, 3, 2, 0, 1, 1, 2, 0, 1, 4, 1, 3, 1, 3, 1, 0, 1, 3, 3, 2, 1, 3, 1, 3, 1, 3, 4, 1, 1, 4, 3, 3, 6, 6, 1, 3, 1, 3, 3, 3, 3, 1, 3, 1, 1, 1, 1, 0, 1, 1, 3, 5, 3, 2, 3, 1, 1, 3, 2, 1, 1, 5, 0, 1, 1, 3, 2, 4, 3, 3, 3, 3, 3, 0, 1, 0, 6, 1, 2, 1, 1, 1, 3, 1, 3, 3, 3, 0, 2, 1, 4, 4, 4, 6, 6, 1, 4, 3, 1, 3, 3, 3, 1, 3, 1, 3, 1, 1, 1, 1, 3, 3, 1, 4, 1, 1, 3, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 4, 3, 4, 1, 1, 3, 5, 1, 1, 3, 1, 3, 1, 3, 1, 3, 4, 3, 1, 1, 3, 3, 3, 3, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 5, 1, 3, 1, 3, 0, 1, 1, 1, 1, 1, 1, 1, 0, 5, 2, 1, 2, 2, 3, 1, 1, 3, 4, 1, 3, 2, 3, 1, 3, 0, 1, 1, 2, 2, 3, 1, 3, 1, 4, 4, 1, 1, 1, 1, 1, 1, 0, 1, 2, 4, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const yytype_uint16 yydefact[] = { 0, 308, 309, 0, 2, 3, 5, 1, 4, 7, 0, 0, 8, 313, 15, 10, 0, 11, 13, 16, 9, 12, 0, 0, 0, 0, 0, 0, 0, 17, 18, 0, 24, 22, 20, 23, 21, 0, 19, 14, 52, 0, 0, 26, 36, 53, 0, 56, 0, 57, 59, 61, 6, 40, 0, 37, 55, 54, 0, 0, 39, 0, 41, 42, 0, 47, 49, 51, 188, 0, 189, 190, 191, 192, 193, 201, 194, 195, 196, 197, 198, 199, 200, 27, 28, 32, 30, 31, 35, 0, 297, 58, 60, 38, 43, 0, 0, 0, 33, 29, 297, 135, 310, 0, 170, 0, 0, 184, 177, 181, 183, 171, 0, 0, 172, 176, 180, 0, 0, 65, 186, 173, 64, 182, 139, 301, 0, 124, 298, 305, 44, 48, 50, 34, 0, 68, 67, 0, 185, 179, 178, 175, 174, 0, 71, 0, 173, 73, 0, 297, 0, 187, 0, 303, 304, 302, 0, 0, 0, 206, 307, 306, 299, 45, 46, 0, 136, 138, 0, 0, 0, 0, 0, 63, 159, 165, 160, 293, 294, 166, 167, 157, 158, 83, 0, 78, 80, 81, 161, 162, 82, 292, 284, 0, 286, 291, 288, 144, 145, 140, 141, 143, 137, 0, 156, 154, 150, 151, 152, 0, 163, 132, 0, 0, 206, 206, 126, 125, 0, 0, 123, 207, 208, 209, 297, 297, 0, 101, 297, 72, 77, 76, 75, 74, 246, 247, 296, 0, 0, 297, 240, 239, 0, 0, 238, 241, 0, 213, 0, 0, 243, 0, 214, 218, 220, 222, 224, 235, 0, 228, 244, 229, 234, 217, 260, 262, 261, 270, 271, 295, 242, 248, 245, 66, 297, 285, 0, 0, 0, 300, 0, 0, 0, 0, 297, 0, 297, 0, 297, 0, 0, 0, 0, 149, 146, 0, 282, 280, 280, 280, 103, 281, 99, 280, 280, 110, 0, 70, 69, 0, 0, 265, 266, 0, 0, 236, 237, 0, 0, 0, 0, 62, 0, 202, 203, 0, 204, 205, 0, 0, 0, 0, 0, 79, 287, 0, 0, 163, 142, 168, 155, 164, 153, 0, 120, 0, 93, 96, 97, 297, 134, 0, 0, 85, 86, 92, 280, 297, 311, 0, 311, 0, 211, 0, 283, 108, 0, 107, 109, 100, 280, 105, 106, 0, 98, 111, 102, 219, 263, 267, 268, 233, 231, 249, 0, 272, 227, 215, 221, 223, 225, 0, 232, 230, 0, 0, 274, 290, 289, 169, 133, 0, 127, 297, 95, 297, 128, 297, 90, 280, 297, 312, 129, 297, 210, 212, 147, 148, 104, 0, 0, 269, 253, 0, 251, 206, 0, 226, 0, 276, 278, 273, 0, 121, 122, 94, 91, 297, 87, 89, 124, 124, 112, 264, 250, 0, 255, 216, 277, 0, 275, 0, 130, 131, 0, 252, 258, 259, 257, 254, 256, 279, 88, 116, 117, 0, 0, 114, 118, 0, 113, 115, 119 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { -1, 3, 4, 5, 9, 11, 12, 16, 17, 28, 29, 30, 42, 43, 83, 84, 133, 54, 55, 61, 62, 164, 63, 64, 65, 44, 45, 48, 49, 183, 85, 118, 86, 143, 144, 184, 185, 352, 353, 354, 345, 346, 135, 370, 226, 227, 374, 375, 454, 466, 467, 355, 356, 158, 159, 217, 119, 199, 200, 468, 298, 299, 87, 206, 280, 207, 208, 250, 340, 120, 121, 122, 123, 325, 328, 220, 221, 222, 223, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 423, 424, 459, 460, 263, 264, 420, 265, 314, 266, 267, 268, 395, 396, 429, 300, 301, 151, 193, 194, 269, 270, 127, 128, 129, 156, 162, 271, 124, 410, 272 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF -276 static const yytype_int16 yypact[] = { 223, -276, -276, 28, 223, -276, -276, -276, -276, -61, 13, 25, -276, -276, -276, -276, 42, -276, -56, 229, -276, -276, 90, 54, 32, 64, 129, 79, 193, 229, -276, 104, -276, -276, -276, -276, -276, 197, -276, -276, 133, 66, 185, -276, 191, -276, 144, -276, 154, -276, 176, -276, -276, 196, 524, -276, -276, -276, 237, 149, -276, 177, 237, -276, -26, -276, 189, -276, -276, 291, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, 524, -276, -276, -276, -276, -276, 272, 200, -276, -276, -276, -276, 223, 237, 209, -276, -276, -18, 202, -276, 247, -276, 253, 269, -276, -276, -276, -276, -276, 296, 261, -276, -276, -276, 692, 356, 255, -276, 258, -276, -276, 243, 77, 372, -276, -276, 184, -61, -276, -276, -276, 266, -276, -276, 237, -276, -276, -276, -276, -276, -64, -276, 262, -276, 263, 267, 99, 84, -276, 294, -276, -276, -276, 368, 211, 616, -57, -276, -276, -276, -276, -276, 288, -276, -276, 378, 692, 237, 237, 399, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, 150, -276, -276, -276, -276, -276, -276, -276, -276, 169, -276, -276, 271, -276, -276, 265, -276, -276, -276, 268, -276, -276, -276, -276, -276, 270, 273, 345, 278, 317, 78, 124, -276, -276, 282, 399, -276, -276, -276, 283, 219, 46, 181, -276, -18, -276, -276, -276, -276, -276, -276, -276, -276, 293, 366, 200, -276, -276, 63, 199, -276, -276, 295, -276, 223, 399, -276, 289, 284, 218, 235, -276, 298, -276, 290, 63, -276, -276, -276, -276, -276, -276, -276, 309, -276, -276, -276, -276, -276, -276, 99, -276, 69, 233, 332, -276, 396, 393, 211, 373, 49, 340, 8, 346, 8, 347, 399, 307, 399, -276, -276, 211, -276, -8, 110, -8, -276, -276, 329, 110, -8, 323, 288, -276, -276, 550, 316, -276, 308, 320, 190, -276, -276, 318, 321, 322, 319, -276, 325, -276, -276, 550, -276, -276, 550, 550, 399, 432, 314, -276, -276, 336, 337, -276, -276, -276, 457, -276, -276, 393, 349, 182, -276, -276, -276, 200, -276, 390, 355, 357, -276, -276, -8, 200, 393, 359, 393, 358, -276, 360, -276, -276, 341, -276, -276, -276, -8, -276, -276, 385, -276, -276, -276, -276, -276, -276, 354, -276, -276, 283, 74, -276, -276, 362, 235, -276, -276, 365, -276, -276, 0, 183, -276, -276, -276, -276, -276, 233, -276, 49, -276, 200, -276, 4, -276, -8, 200, -276, -276, 200, -276, -276, -276, -276, -276, 369, 396, -276, -276, 195, -276, -57, 445, -276, 393, 361, -276, -276, 314, -276, -276, -276, -276, 68, -276, -276, -276, -276, -276, 457, -276, 74, 159, -276, 361, 393, -276, 11, -276, -276, 55, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, 55, 17, -276, -276, 51, -276, -276, -276 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { -276, -276, -276, 476, -276, -276, 352, -276, 467, -276, -276, 456, -276, -276, -276, 404, -276, -276, -276, -276, -276, -276, 426, -276, 394, -276, -276, -276, 431, 343, -276, 335, -276, -276, 326, -276, 220, 208, 65, 93, -276, 100, 276, -276, -276, 201, -276, -276, -276, 40, -275, -270, -87, -276, -74, -276, 221, -276, 232, -148, 287, 292, -276, -166, -276, -142, -265, -139, 94, -91, -75, -276, 15, -276, -276, -213, -276, -276, 198, -199, 92, -276, 194, 188, -165, -276, -276, -227, -276, -276, -276, -276, 75, -276, -276, -276, -276, -276, -276, 264, -276, -276, -276, -276, 89, 96, -264, -276, -276, -276, 250, -128, -276, -195, -276, -276, -276, -276, 5, -276, 167, -10 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -281 static const yytype_int16 yytable[] = { 18, 287, 289, 126, 201, 6, 18, 187, 437, 6, 188, 13, 335, 136, 347, 13, 462, 134, 188, 13, 291, 189, 195, 463, 13, 14, 145, 95, 7, 189, 218, 51, 295, 365, 367, 368, 197, 198, 464, 371, 372, 351, 146, 67, 90, 351, 50, 168, 51, 10, 320, 169, 67, 13, 14, 219, 22, 463, 66, 89, 13, 463, 186, 50, 293, 294, 19, 66, 296, 88, 197, 198, 464, 90, 197, 198, 464, 13, 145, 13, 13, 177, 178, 1, 2, 13, 67, 382, 89, 96, 46, 361, 408, 363, 146, 13, 177, 178, 88, 125, 130, 66, 31, 153, 393, 351, 418, 174, 175, 176, 13, 177, 178, 344, 179, 180, 342, 344, 32, -84, 428, 125, 147, 33, 15, 125, 407, 167, 470, 364, 201, 391, 187, 347, 465, 188, 433, 297, 302, 190, 196, 308, 166, 188, 377, 439, 189, 210, 195, 336, 295, 181, 311, 20, 189, 34, 188, 202, 344, 154, 231, 233, 209, 125, 390, 218, 125, 189, 465, 472, 36, 312, 465, 155, 147, 230, 232, 344, 191, -25, 47, 456, 41, 422, 313, 125, 296, 186, 286, 35, 219, 471, 182, 191, 471, 192, 37, 348, 234, 175, 235, 13, 177, 178, 236, 179, 180, 13, 315, 172, 13, 218, 446, 1, 2, 440, 125, 39, 441, 174, 175, 176, 13, 177, 178, 40, 179, 180, 1, 2, 366, 52, 160, 316, 288, 457, 219, 293, 294, 458, 1, 2, 240, 161, 13, 177, 178, 23, 13, 60, 1, 2, 53, 319, 1, 2, 24, 381, 56, 295, 92, 273, 404, 181, 190, 274, 196, 337, 57, 58, 409, 341, 210, 434, 349, 100, 357, 25, 357, 26, 275, 204, 209, 245, 276, 210, 59, 209, 27, 101, 102, 93, 305, 402, 431, 296, 306, 403, 432, 97, 209, 103, 68, 104, 182, 105, 444, 224, 225, 98, 445, 1, 2, 197, 198, 106, 348, 125, 436, 107, 132, 205, 137, 108, 323, 324, 109, 70, 71, 72, -280, 317, 318, 400, -280, 138, 125, 110, 73, 326, 327, 139, 111, 74, 112, 75, 113, 140, 411, 142, 411, 197, 198, 76, 141, 114, 115, 101, 102, 148, 416, 417, 77, 152, 78, 149, 452, 453, 150, 79, 116, 80, 81, 82, 425, 157, 165, 172, 170, 171, 203, 228, 117, 277, 430, 278, 279, 283, 284, 282, 281, 337, 285, 349, 290, 292, 309, 357, 310, 322, 321, 329, 330, 339, 13, 343, 209, 234, 175, 235, 13, 177, 178, 236, 179, 180, 1, 2, 430, 332, 362, 358, 360, 237, 369, 373, 378, 357, 380, 379, 219, 384, 386, 385, 387, 425, 394, 238, 239, 461, 234, 175, 235, 13, 177, 178, 236, 179, 180, 397, 398, 240, 241, 234, 175, 235, 13, 177, 178, 236, 179, 180, 1, 2, 399, 405, 406, 242, 401, 237, 412, 414, 407, 415, 419, 421, 243, 426, 427, 442, 8, 449, 163, 21, 240, 38, 244, 99, 94, 91, 131, 173, 245, 216, 333, 229, 359, 240, 241, 392, 438, 246, 451, 435, 307, 469, 350, 376, 247, 248, 338, 249, 303, 242, 443, 383, 389, 304, 447, 388, 455, 450, 243, 331, 448, 245, 334, 413, 0, 0, 0, 0, 244, 0, 0, 13, 0, 0, 245, 0, 0, 1, 2, 0, 0, 0, 0, 246, 0, 0, 0, 0, 0, 0, 68, 0, 0, 249, 234, 175, 235, 13, 177, 178, 236, 179, 180, 1, 2, 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 70, 71, 72, 0, 0, 0, 0, 0, 0, 0, 0, 73, 0, 0, 0, 0, 74, 0, 75, 0, 0, 0, 0, 240, 241, 0, 76, 0, 0, 0, 0, 0, 0, 0, 0, 77, 0, 78, 0, 242, 0, 0, 79, 0, 80, 81, 82, 0, 243, 0, 0, 0, 0, 0, 101, 102, 0, 0, 244, 0, 0, 0, 211, 0, 245, 0, 103, 68, 104, 0, 105, 212, 0, 246, 0, 0, 0, 0, 0, 0, 106, 0, 0, 249, 107, 0, 0, 0, 108, 0, 0, 109, 70, 71, 72, 0, 0, 0, 0, 0, 213, 0, 110, 73, 0, 0, 0, 111, 74, 112, 75, 113, 0, 0, 0, 0, 0, 0, 76, 0, 114, 115, 214, 215, 0, 0, 0, 77, 0, 78, 1, 2, 0, 0, 79, 116, 80, 81, 82, 0, 0, 0, 103, 68, 104, 0, 105, 0, 0, 0, 0, 0, 0, 0, 0, 0, 106, 0, 0, 0, 107, 0, 0, 0, 108, 0, 0, 109, 70, 71, 72, 0, 0, 0, 0, 0, 0, 0, 110, 73, 0, 0, 0, 111, 74, 112, 75, 113, 0, 0, 0, 0, 0, 0, 76, 0, 114, 115, 0, 0, 0, 0, 0, 77, 0, 78, 0, 0, 0, 0, 79, 116, 80, 81, 82 }; static const yytype_int16 yycheck[] = { 10, 214, 215, 90, 152, 0, 16, 149, 4, 4, 149, 11, 277, 100, 284, 11, 5, 35, 157, 11, 219, 149, 150, 6, 11, 12, 117, 53, 0, 157, 87, 41, 40, 297, 298, 299, 19, 20, 21, 303, 304, 37, 117, 53, 54, 37, 41, 111, 58, 110, 249, 115, 62, 11, 12, 112, 112, 6, 53, 54, 11, 6, 149, 58, 18, 19, 41, 62, 76, 54, 19, 20, 21, 83, 19, 20, 21, 11, 169, 11, 11, 12, 13, 17, 18, 11, 96, 314, 83, 115, 24, 290, 356, 292, 169, 11, 12, 13, 83, 117, 95, 96, 12, 26, 331, 37, 370, 8, 9, 10, 11, 12, 13, 109, 15, 16, 282, 109, 64, 111, 120, 117, 117, 91, 111, 117, 115, 137, 111, 295, 278, 330, 274, 403, 117, 274, 401, 224, 225, 149, 150, 228, 137, 282, 309, 409, 274, 157, 276, 277, 40, 52, 239, 111, 282, 91, 295, 152, 109, 82, 170, 171, 157, 117, 329, 87, 117, 295, 117, 118, 91, 108, 117, 96, 169, 170, 171, 109, 109, 46, 114, 22, 49, 109, 121, 117, 76, 274, 110, 60, 112, 466, 93, 109, 469, 111, 3, 284, 8, 9, 10, 11, 12, 13, 14, 15, 16, 11, 9, 110, 11, 87, 425, 17, 18, 410, 117, 113, 413, 8, 9, 10, 11, 12, 13, 28, 15, 16, 17, 18, 120, 46, 48, 243, 110, 76, 112, 18, 19, 80, 17, 18, 52, 59, 11, 12, 13, 18, 11, 53, 17, 18, 61, 248, 17, 18, 27, 67, 114, 40, 111, 111, 349, 52, 274, 115, 276, 277, 114, 115, 357, 281, 282, 401, 284, 3, 286, 48, 288, 50, 111, 70, 277, 93, 115, 295, 110, 282, 59, 17, 18, 114, 111, 111, 111, 76, 115, 115, 115, 110, 295, 29, 30, 31, 93, 33, 111, 19, 20, 18, 115, 17, 18, 19, 20, 43, 403, 117, 405, 47, 111, 110, 120, 51, 106, 107, 54, 55, 56, 57, 111, 36, 37, 343, 115, 88, 117, 65, 66, 104, 105, 88, 70, 71, 72, 73, 74, 78, 358, 88, 360, 19, 20, 81, 58, 83, 84, 17, 18, 3, 19, 20, 90, 120, 92, 110, 440, 441, 110, 97, 98, 99, 100, 101, 384, 3, 110, 110, 116, 116, 12, 3, 110, 112, 394, 120, 118, 42, 110, 116, 120, 401, 75, 403, 112, 112, 103, 407, 32, 115, 111, 103, 112, 7, 11, 32, 401, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 428, 110, 113, 75, 75, 24, 95, 102, 110, 437, 108, 121, 112, 110, 113, 111, 109, 445, 122, 38, 39, 449, 8, 9, 10, 11, 12, 13, 14, 15, 16, 113, 113, 52, 53, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 7, 75, 111, 68, 119, 24, 111, 113, 115, 113, 89, 121, 77, 115, 113, 110, 4, 120, 130, 16, 52, 29, 87, 83, 62, 58, 96, 148, 93, 158, 274, 169, 288, 52, 53, 67, 407, 102, 437, 403, 228, 465, 285, 306, 109, 110, 278, 112, 225, 68, 420, 317, 328, 225, 426, 325, 445, 432, 77, 259, 428, 93, 276, 360, -1, -1, -1, -1, 87, -1, -1, 11, -1, -1, 93, -1, -1, 17, 18, -1, -1, -1, -1, 102, -1, -1, -1, -1, -1, -1, 30, -1, -1, 112, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 45, -1, -1, -1, -1, -1, -1, -1, -1, -1, 55, 56, 57, -1, -1, -1, -1, -1, -1, -1, -1, 66, -1, -1, -1, -1, 71, -1, 73, -1, -1, -1, -1, 52, 53, -1, 81, -1, -1, -1, -1, -1, -1, -1, -1, 90, -1, 92, -1, 68, -1, -1, 97, -1, 99, 100, 101, -1, 77, -1, -1, -1, -1, -1, 17, 18, -1, -1, 87, -1, -1, -1, 25, -1, 93, -1, 29, 30, 31, -1, 33, 34, -1, 102, -1, -1, -1, -1, -1, -1, 43, -1, -1, 112, 47, -1, -1, -1, 51, -1, -1, 54, 55, 56, 57, -1, -1, -1, -1, -1, 63, -1, 65, 66, -1, -1, -1, 70, 71, 72, 73, 74, -1, -1, -1, -1, -1, -1, 81, -1, 83, 84, 85, 86, -1, -1, -1, 90, -1, 92, 17, 18, -1, -1, 97, 98, 99, 100, 101, -1, -1, -1, 29, 30, 31, -1, 33, -1, -1, -1, -1, -1, -1, -1, -1, -1, 43, -1, -1, -1, 47, -1, -1, -1, 51, -1, -1, 54, 55, 56, 57, -1, -1, -1, -1, -1, -1, -1, 65, 66, -1, -1, -1, 70, 71, 72, 73, 74, -1, -1, -1, -1, -1, -1, 81, -1, 83, 84, -1, -1, -1, -1, -1, 90, -1, 92, -1, -1, -1, -1, 97, 98, 99, 100, 101 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { 0, 17, 18, 124, 125, 126, 241, 0, 126, 127, 110, 128, 129, 11, 12, 111, 130, 131, 244, 41, 111, 131, 112, 18, 27, 48, 50, 59, 132, 133, 134, 12, 64, 91, 91, 60, 91, 3, 134, 113, 28, 49, 135, 136, 148, 149, 24, 114, 150, 151, 241, 244, 46, 61, 140, 141, 114, 114, 115, 110, 53, 142, 143, 145, 146, 147, 241, 244, 30, 45, 55, 56, 57, 66, 71, 73, 81, 90, 92, 97, 99, 100, 101, 137, 138, 153, 155, 185, 195, 241, 244, 151, 111, 114, 145, 53, 115, 110, 18, 138, 3, 17, 18, 29, 31, 33, 43, 47, 51, 54, 65, 70, 72, 74, 83, 84, 98, 110, 154, 179, 192, 193, 194, 195, 242, 117, 175, 236, 237, 238, 241, 147, 111, 139, 35, 165, 175, 120, 88, 88, 78, 58, 88, 156, 157, 192, 193, 241, 3, 110, 110, 231, 120, 26, 82, 96, 239, 3, 176, 177, 48, 59, 240, 129, 144, 110, 241, 244, 111, 115, 116, 116, 110, 152, 8, 9, 10, 12, 13, 15, 16, 52, 93, 152, 158, 159, 175, 188, 190, 234, 244, 109, 111, 232, 233, 234, 244, 19, 20, 180, 181, 182, 241, 12, 70, 110, 186, 188, 189, 241, 244, 25, 34, 63, 85, 86, 154, 178, 87, 112, 198, 199, 200, 201, 19, 20, 167, 168, 3, 157, 241, 244, 241, 244, 8, 10, 14, 24, 38, 39, 52, 53, 68, 77, 87, 93, 102, 109, 110, 112, 190, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 218, 219, 221, 223, 224, 225, 234, 235, 241, 244, 111, 115, 111, 115, 112, 120, 118, 187, 120, 116, 42, 110, 75, 110, 198, 110, 198, 112, 202, 112, 18, 19, 40, 76, 175, 183, 184, 229, 230, 175, 183, 184, 111, 115, 165, 175, 103, 32, 175, 108, 121, 222, 9, 244, 36, 37, 241, 202, 111, 115, 106, 107, 196, 104, 105, 197, 103, 112, 222, 110, 159, 233, 189, 234, 244, 181, 7, 191, 244, 186, 32, 109, 163, 164, 174, 175, 244, 179, 37, 160, 161, 162, 174, 175, 244, 75, 160, 75, 202, 113, 202, 186, 229, 120, 229, 229, 95, 166, 229, 229, 102, 169, 170, 168, 207, 110, 121, 108, 67, 210, 201, 110, 111, 113, 109, 205, 206, 207, 202, 67, 210, 122, 226, 227, 113, 113, 7, 244, 119, 111, 115, 175, 75, 111, 115, 229, 175, 243, 244, 111, 243, 113, 113, 19, 20, 229, 89, 220, 121, 109, 214, 215, 244, 115, 113, 120, 228, 244, 111, 115, 189, 234, 164, 175, 4, 162, 229, 236, 236, 110, 191, 111, 115, 198, 203, 228, 120, 227, 161, 177, 177, 171, 215, 22, 76, 80, 216, 217, 244, 5, 6, 21, 117, 172, 173, 182, 172, 111, 173, 118 }; #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ { \ yychar = (Token); \ yylval = (Value); \ yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK (1); \ goto yybackup; \ } \ else \ { \ yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (YYID (0)) #define YYTERROR 1 #define YYERRCODE 256 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. If N is 0, then set CURRENT to the empty location which ends the previous symbol: RHS[0] (always defined). */ #define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ if (YYID (N)) \ { \ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ } \ else \ { \ (Current).first_line = (Current).last_line = \ YYRHSLOC (Rhs, 0).last_line; \ (Current).first_column = (Current).last_column = \ YYRHSLOC (Rhs, 0).last_column; \ } \ while (YYID (0)) #endif /* YY_LOCATION_PRINT -- Print the location on the stream. This macro was not mandated originally: define only if we know we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ (Loc).last_line, (Loc).last_column) # else # define YY_LOCATION_PRINT(File, Loc) ((void) 0) # endif #endif /* YYLEX -- calling `yylex' with the right arguments. */ #ifdef YYLEX_PARAM # define YYLEX yylex (YYLEX_PARAM) #else # define YYLEX yylex () #endif /* Enable debugging if requested. */ #if YYDEBUG # ifndef YYFPRINTF # include /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (YYID (0)) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ Type, Value); \ YYFPRINTF (stderr, "\n"); \ } \ } while (YYID (0)) /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) #else static void yy_symbol_value_print (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; #endif { if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); # else YYUSE (yyoutput); # endif switch (yytype) { default: break; } } /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) #else static void yy_symbol_print (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; #endif { if (yytype < YYNTOKENS) YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); else YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); yy_symbol_value_print (yyoutput, yytype, yyvaluep); YYFPRINTF (yyoutput, ")"); } /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) #else static void yy_stack_print (bottom, top) yytype_int16 *bottom; yytype_int16 *top; #endif { YYFPRINTF (stderr, "Stack now"); for (; bottom <= top; ++bottom) YYFPRINTF (stderr, " %d", *bottom); YYFPRINTF (stderr, "\n"); } # define YY_STACK_PRINT(Bottom, Top) \ do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ } while (YYID (0)) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_reduce_print (YYSTYPE *yyvsp, int yyrule) #else static void yy_reduce_print (yyvsp, yyrule) YYSTYPE *yyvsp; int yyrule; #endif { int yynrhs = yyr2[yyrule]; int yyi; unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { fprintf (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) ); fprintf (stderr, "\n"); } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ yy_reduce_print (yyvsp, Rule); \ } while (YYID (0)) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif #if YYERROR_VERBOSE # ifndef yystrlen # if defined __GLIBC__ && defined _STRING_H # define yystrlen strlen # else /* Return the length of YYSTR. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static YYSIZE_T yystrlen (const char *yystr) #else static YYSIZE_T yystrlen (yystr) const char *yystr; #endif { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; } # endif # endif # ifndef yystpcpy # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static char * yystpcpy (char *yydest, const char *yysrc) #else static char * yystpcpy (yydest, yysrc) char *yydest; const char *yysrc; #endif { char *yyd = yydest; const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif # endif # ifndef yytnamerr /* Copy to YYRES the contents of YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string contains an apostrophe, a comma, or backslash (other than backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ static YYSIZE_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { YYSIZE_T yyn = 0; char const *yyp = yystr; for (;;) switch (*++yyp) { case '\'': case ',': goto do_not_strip_quotes; case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; /* Fall through. */ default: if (yyres) yyres[yyn] = *yyp; yyn++; break; case '"': if (yyres) yyres[yyn] = '\0'; return yyn; } do_not_strip_quotes: ; } if (! yyres) return yystrlen (yystr); return yystpcpy (yyres, yystr) - yyres; } # endif /* Copy into YYRESULT an error message about the unexpected token YYCHAR while in state YYSTATE. Return the number of bytes copied, including the terminating null byte. If YYRESULT is null, do not copy anything; just return the number of bytes that would be copied. As a special case, return 0 if an ordinary "syntax error" message will do. Return YYSIZE_MAXIMUM if overflow occurs during size calculation. */ static YYSIZE_T yysyntax_error (char *yyresult, int yystate, int yychar) { int yyn = yypact[yystate]; if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) return 0; else { int yytype = YYTRANSLATE (yychar); YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); YYSIZE_T yysize = yysize0; YYSIZE_T yysize1; int yysize_overflow = 0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; int yyx; # if 0 /* This is so xgettext sees the translatable formats that are constructed on the fly. */ YY_("syntax error, unexpected %s"); YY_("syntax error, unexpected %s, expecting %s"); YY_("syntax error, unexpected %s, expecting %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); # endif char *yyfmt; char const *yyf; static char const yyunexpected[] = "syntax error, unexpected %s"; static char const yyexpecting[] = ", expecting %s"; static char const yyor[] = " or %s"; char yyformat[sizeof yyunexpected + sizeof yyexpecting - 1 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) * (sizeof yyor - 1))]; char const *yyprefix = yyexpecting; /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn + 1; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yycount = 1; yyarg[0] = yytname[yytype]; yyfmt = yystpcpy (yyformat, yyunexpected); for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; yyformat[sizeof yyunexpected - 1] = '\0'; break; } yyarg[yycount++] = yytname[yyx]; yysize1 = yysize + yytnamerr (0, yytname[yyx]); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; yyfmt = yystpcpy (yyfmt, yyprefix); yyprefix = yyor; } yyf = YY_(yyformat); yysize1 = yysize + yystrlen (yyf); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; if (yysize_overflow) return YYSIZE_MAXIMUM; if (yyresult) { /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ char *yyp = yyresult; int yyi = 0; while ((*yyp = *yyf) != '\0') { if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yyarg[yyi++]); yyf += 2; } else { yyp++; yyf++; } } } return yysize; } } #endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) #else static void yydestruct (yymsg, yytype, yyvaluep) const char *yymsg; int yytype; YYSTYPE *yyvaluep; #endif { YYUSE (yyvaluep); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); switch (yytype) { default: break; } } /* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); #else int yyparse (); #endif #else /* ! YYPARSE_PARAM */ #if defined __STDC__ || defined __cplusplus int yyparse (void); #else int yyparse (); #endif #endif /* ! YYPARSE_PARAM */ /* The look-ahead symbol. */ int yychar; /* The semantic value of the look-ahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ int yynerrs; /*----------. | yyparse. | `----------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void *YYPARSE_PARAM) #else int yyparse (YYPARSE_PARAM) void *YYPARSE_PARAM; #endif #else /* ! YYPARSE_PARAM */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void) #else int yyparse () #endif #endif { int yystate; int yyn; int yyresult; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* Look-ahead token as an internal (translated) token number. */ int yytoken = 0; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif /* Three stacks and their tools: `yyss': related to states, `yyvs': related to semantic values, `yyls': related to locations. Refer to the stacks thru separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ yytype_int16 yyssa[YYINITDEPTH]; yytype_int16 *yyss = yyssa; yytype_int16 *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs = yyvsa; YYSTYPE *yyvsp; #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) YYSIZE_T yystacksize = YYINITDEPTH; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ yyssp = yyss; yyvsp = yyvs; goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; yysetstate: *yyssp = yystate; if (yyss + yystacksize - 1 <= yyssp) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE goto yyexhaustedlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. Read a look-ahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; /* Not known => get a look-ahead token if don't already have one. */ /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; } if (yychar <= YYEOF) { yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yytoken = YYTRANSLATE (yychar); YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ yyn += yytoken; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; yyn = yytable[yyn]; if (yyn <= 0) { if (yyn == 0 || yyn == YYTABLE_NINF) goto yyerrlab; yyn = -yyn; goto yyreduce; } if (yyn == YYFINAL) YYACCEPT; /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; /* Shift the look-ahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); /* Discard the shifted token unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: `$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; YY_REDUCE_PRINT (yyn); switch (yyn) { case 2: #line 357 "asn1p_y.y" { *(void **)param = (yyvsp[(1) - (1)].a_grammar); } break; case 3: #line 363 "asn1p_y.y" { (yyval.a_grammar) = asn1p_new(); checkmem((yyval.a_grammar)); TQ_ADD(&((yyval.a_grammar)->modules), (yyvsp[(1) - (1)].a_module), mod_next); } break; case 4: #line 368 "asn1p_y.y" { (yyval.a_grammar) = (yyvsp[(1) - (2)].a_grammar); TQ_ADD(&((yyval.a_grammar)->modules), (yyvsp[(2) - (2)].a_module), mod_next); } break; case 5: #line 385 "asn1p_y.y" { currentModule = asn1p_module_new(); } break; case 6: #line 390 "asn1p_y.y" { (yyval.a_module) = currentModule; if((yyvsp[(8) - (9)].a_module)) { asn1p_module_t tmp = *((yyval.a_module)); *((yyval.a_module)) = *((yyvsp[(8) - (9)].a_module)); *((yyvsp[(8) - (9)].a_module)) = tmp; asn1p_module_free((yyvsp[(8) - (9)].a_module)); } else { /* There's a chance that a module is just plain empty */ } (yyval.a_module)->ModuleName = (yyvsp[(1) - (9)].tv_str); (yyval.a_module)->module_oid = (yyvsp[(3) - (9)].a_oid); (yyval.a_module)->module_flags = (yyvsp[(5) - (9)].a_module_flags); } break; case 7: #line 414 "asn1p_y.y" { (yyval.a_oid) = 0; } break; case 8: #line 415 "asn1p_y.y" { (yyval.a_oid) = (yyvsp[(1) - (1)].a_oid); } break; case 9: #line 419 "asn1p_y.y" { (yyval.a_oid) = (yyvsp[(2) - (3)].a_oid); } break; case 10: #line 422 "asn1p_y.y" { (yyval.a_oid) = 0; } break; case 11: #line 428 "asn1p_y.y" { (yyval.a_oid) = asn1p_oid_new(); asn1p_oid_add_arc((yyval.a_oid), &(yyvsp[(1) - (1)].a_oid_arc)); if((yyvsp[(1) - (1)].a_oid_arc).name) free((yyvsp[(1) - (1)].a_oid_arc).name); } break; case 12: #line 434 "asn1p_y.y" { (yyval.a_oid) = (yyvsp[(1) - (2)].a_oid); asn1p_oid_add_arc((yyval.a_oid), &(yyvsp[(2) - (2)].a_oid_arc)); if((yyvsp[(2) - (2)].a_oid_arc).name) free((yyvsp[(2) - (2)].a_oid_arc).name); } break; case 13: #line 443 "asn1p_y.y" { /* iso */ (yyval.a_oid_arc).name = (yyvsp[(1) - (1)].tv_str); (yyval.a_oid_arc).number = -1; } break; case 14: #line 447 "asn1p_y.y" { /* iso(1) */ (yyval.a_oid_arc).name = (yyvsp[(1) - (4)].tv_str); (yyval.a_oid_arc).number = (yyvsp[(3) - (4)].a_int); } break; case 15: #line 451 "asn1p_y.y" { /* 1 */ (yyval.a_oid_arc).name = 0; (yyval.a_oid_arc).number = (yyvsp[(1) - (1)].a_int); } break; case 16: #line 461 "asn1p_y.y" { (yyval.a_module_flags) = MSF_NOFLAGS; } break; case 17: #line 462 "asn1p_y.y" { (yyval.a_module_flags) = (yyvsp[(1) - (1)].a_module_flags); } break; case 18: #line 471 "asn1p_y.y" { (yyval.a_module_flags) = (yyvsp[(1) - (1)].a_module_flags); } break; case 19: #line 474 "asn1p_y.y" { (yyval.a_module_flags) = (yyvsp[(1) - (2)].a_module_flags) | (yyvsp[(2) - (2)].a_module_flags); } break; case 20: #line 483 "asn1p_y.y" { (yyval.a_module_flags) = MSF_EXPLICIT_TAGS; } break; case 21: #line 486 "asn1p_y.y" { (yyval.a_module_flags) = MSF_IMPLICIT_TAGS; } break; case 22: #line 489 "asn1p_y.y" { (yyval.a_module_flags) = MSF_AUTOMATIC_TAGS; } break; case 23: #line 492 "asn1p_y.y" { (yyval.a_module_flags) = MSF_EXTENSIBILITY_IMPLIED; } break; case 24: #line 496 "asn1p_y.y" { /* X.680Amd1 specifies TAG and XER */ if(strcmp((yyvsp[(1) - (2)].tv_str), "TAG") == 0) { (yyval.a_module_flags) = MSF_TAG_INSTRUCTIONS; } else if(strcmp((yyvsp[(1) - (2)].tv_str), "XER") == 0) { (yyval.a_module_flags) = MSF_XER_INSTRUCTIONS; } else { fprintf(stderr, "WARNING: %s INSTRUCTIONS at line %d: " "Unrecognized encoding reference\n", (yyvsp[(1) - (2)].tv_str), yylineno); (yyval.a_module_flags) = MSF_unk_INSTRUCTIONS; } free((yyvsp[(1) - (2)].tv_str)); } break; case 25: #line 517 "asn1p_y.y" { (yyval.a_module) = 0; } break; case 26: #line 518 "asn1p_y.y" { (yyval.a_module) = (yyvsp[(1) - (1)].a_module); } break; case 27: #line 527 "asn1p_y.y" { (yyval.a_module) = asn1p_module_new(); AL_IMPORT((yyval.a_module), exports, (yyvsp[(1) - (3)].a_module), xp_next); AL_IMPORT((yyval.a_module), imports, (yyvsp[(2) - (3)].a_module), xp_next); AL_IMPORT((yyval.a_module), members, (yyvsp[(3) - (3)].a_module), next); } break; case 28: #line 536 "asn1p_y.y" { (yyval.a_module) = (yyvsp[(1) - (1)].a_module); } break; case 29: #line 539 "asn1p_y.y" { if((yyvsp[(1) - (2)].a_module)) { (yyval.a_module) = (yyvsp[(1) - (2)].a_module); } else { (yyval.a_module) = (yyvsp[(2) - (2)].a_module); break; } AL_IMPORT((yyval.a_module), members, (yyvsp[(2) - (2)].a_module), next); } break; case 30: #line 555 "asn1p_y.y" { (yyval.a_module) = asn1p_module_new(); checkmem((yyval.a_module)); assert((yyvsp[(1) - (1)].a_expr)->expr_type != A1TC_INVALID); assert((yyvsp[(1) - (1)].a_expr)->meta_type != AMT_INVALID); TQ_ADD(&((yyval.a_module)->members), (yyvsp[(1) - (1)].a_expr), next); } break; case 31: #line 562 "asn1p_y.y" { (yyval.a_module) = asn1p_module_new(); checkmem((yyval.a_module)); assert((yyvsp[(1) - (1)].a_expr)->expr_type != A1TC_INVALID); assert((yyvsp[(1) - (1)].a_expr)->meta_type != AMT_INVALID); TQ_ADD(&((yyval.a_module)->members), (yyvsp[(1) - (1)].a_expr), next); } break; case 32: #line 575 "asn1p_y.y" { (yyval.a_module) = asn1p_module_new(); checkmem((yyval.a_module)); assert((yyvsp[(1) - (1)].a_expr)->expr_type != A1TC_INVALID); assert((yyvsp[(1) - (1)].a_expr)->meta_type != AMT_INVALID); TQ_ADD(&((yyval.a_module)->members), (yyvsp[(1) - (1)].a_expr), next); } break; case 33: #line 583 "asn1p_y.y" { asn1p_lexer_hack_push_encoding_control(); } break; case 34: #line 584 "asn1p_y.y" { fprintf(stderr, "WARNING: ENCODING-CONTROL %s " "specification at line %d ignored\n", (yyvsp[(2) - (3)].tv_str), yylineno); free((yyvsp[(2) - (3)].tv_str)); (yyval.a_module) = 0; } break; case 35: #line 596 "asn1p_y.y" { return yyerror( "Attempt to redefine a standard basic string type, " "please comment out or remove this type redefinition."); } break; case 36: #line 609 "asn1p_y.y" { (yyval.a_module) = 0; } break; case 38: #line 613 "asn1p_y.y" { if(!saved_aid && 0) return yyerror("Unterminated IMPORTS FROM, " "expected semicolon ';'"); saved_aid = 0; (yyval.a_module) = (yyvsp[(2) - (3)].a_module); } break; case 39: #line 623 "asn1p_y.y" { return yyerror("Empty IMPORTS list"); } break; case 40: #line 629 "asn1p_y.y" { (yyval.a_module) = asn1p_module_new(); } break; case 42: #line 633 "asn1p_y.y" { (yyval.a_module) = asn1p_module_new(); checkmem((yyval.a_module)); TQ_ADD(&((yyval.a_module)->imports), (yyvsp[(1) - (1)].a_xports), xp_next); } break; case 43: #line 638 "asn1p_y.y" { (yyval.a_module) = (yyvsp[(1) - (2)].a_module); TQ_ADD(&((yyval.a_module)->imports), (yyvsp[(2) - (2)].a_xports), xp_next); } break; case 44: #line 645 "asn1p_y.y" { memset(&(yyval.a_aid), 0, sizeof((yyval.a_aid))); } break; case 45: #line 646 "asn1p_y.y" { (yyval.a_aid).oid = (yyvsp[(1) - (1)].a_oid); } break; case 46: #line 650 "asn1p_y.y" { (yyval.a_xports) = (yyvsp[(1) - (4)].a_xports); (yyval.a_xports)->fromModuleName = (yyvsp[(3) - (4)].tv_str); (yyval.a_xports)->identifier = (yyvsp[(4) - (4)].a_aid); /* This stupid thing is used for look-back hack. */ saved_aid = (yyval.a_xports)->identifier.oid ? 0 : &((yyval.a_xports)->identifier); checkmem((yyval.a_xports)); } break; case 47: #line 661 "asn1p_y.y" { (yyval.a_xports) = asn1p_xports_new(); checkmem((yyval.a_xports)); TQ_ADD(&((yyval.a_xports)->members), (yyvsp[(1) - (1)].a_expr), next); } break; case 48: #line 666 "asn1p_y.y" { (yyval.a_xports) = (yyvsp[(1) - (3)].a_xports); TQ_ADD(&((yyval.a_xports)->members), (yyvsp[(3) - (3)].a_expr), next); } break; case 49: #line 673 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); (yyval.a_expr)->Identifier = (yyvsp[(1) - (1)].tv_str); (yyval.a_expr)->expr_type = A1TC_REFERENCE; } break; case 50: #line 679 "asn1p_y.y" { /* Completely equivalent to above */ (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); (yyval.a_expr)->Identifier = (yyvsp[(1) - (3)].tv_str); (yyval.a_expr)->expr_type = A1TC_REFERENCE; } break; case 51: #line 685 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); (yyval.a_expr)->Identifier = (yyvsp[(1) - (1)].tv_str); (yyval.a_expr)->expr_type = A1TC_REFERENCE; } break; case 52: #line 695 "asn1p_y.y" { (yyval.a_module) = 0; } break; case 53: #line 696 "asn1p_y.y" { (yyval.a_module) = asn1p_module_new(); checkmem((yyval.a_module)); if((yyvsp[(1) - (1)].a_xports)) { TQ_ADD(&((yyval.a_module)->exports), (yyvsp[(1) - (1)].a_xports), xp_next); } else { /* "EXPORTS ALL;" */ } } break; case 54: #line 708 "asn1p_y.y" { (yyval.a_xports) = (yyvsp[(2) - (3)].a_xports); } break; case 55: #line 711 "asn1p_y.y" { (yyval.a_xports) = 0; } break; case 56: #line 714 "asn1p_y.y" { /* Empty EXPORTS clause effectively prohibits export. */ (yyval.a_xports) = asn1p_xports_new(); checkmem((yyval.a_xports)); } break; case 57: #line 722 "asn1p_y.y" { (yyval.a_xports) = asn1p_xports_new(); assert((yyval.a_xports)); TQ_ADD(&((yyval.a_xports)->members), (yyvsp[(1) - (1)].a_expr), next); } break; case 58: #line 727 "asn1p_y.y" { (yyval.a_xports) = (yyvsp[(1) - (3)].a_xports); TQ_ADD(&((yyval.a_xports)->members), (yyvsp[(3) - (3)].a_expr), next); } break; case 59: #line 734 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); (yyval.a_expr)->Identifier = (yyvsp[(1) - (1)].tv_str); (yyval.a_expr)->expr_type = A1TC_EXPORTVAR; } break; case 60: #line 740 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); (yyval.a_expr)->Identifier = (yyvsp[(1) - (3)].tv_str); (yyval.a_expr)->expr_type = A1TC_EXPORTVAR; } break; case 61: #line 746 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); (yyval.a_expr)->Identifier = (yyvsp[(1) - (1)].tv_str); (yyval.a_expr)->expr_type = A1TC_EXPORTVAR; } break; case 62: #line 755 "asn1p_y.y" { (yyval.a_constr) = (yyvsp[(2) - (3)].a_constr); } break; case 63: #line 758 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(2) - (4)].a_expr); assert((yyval.a_expr)->Identifier == 0); (yyval.a_expr)->Identifier = (yyvsp[(1) - (4)].tv_str); (yyval.a_expr)->meta_type = AMT_VALUESET; (yyval.a_expr)->constraints = (yyvsp[(4) - (4)].a_constr); } break; case 64: #line 768 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(1) - (1)].a_expr); } break; case 65: #line 781 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); (yyval.a_expr)->reference = (yyvsp[(1) - (1)].a_ref); (yyval.a_expr)->expr_type = A1TC_REFERENCE; (yyval.a_expr)->meta_type = AMT_TYPEREF; } break; case 66: #line 791 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); (yyval.a_expr)->reference = (yyvsp[(1) - (4)].a_ref); (yyval.a_expr)->rhs_pspecs = (yyvsp[(3) - (4)].a_expr); (yyval.a_expr)->expr_type = A1TC_REFERENCE; (yyval.a_expr)->meta_type = AMT_TYPEREF; } break; case 67: #line 811 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(3) - (3)].a_expr); (yyval.a_expr)->Identifier = (yyvsp[(1) - (3)].tv_str); assert((yyval.a_expr)->expr_type); assert((yyval.a_expr)->meta_type); } break; case 68: #line 817 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(3) - (3)].a_expr); (yyval.a_expr)->Identifier = (yyvsp[(1) - (3)].tv_str); assert((yyval.a_expr)->expr_type == A1TC_CLASSDEF); assert((yyval.a_expr)->meta_type == AMT_OBJECTCLASS); } break; case 69: #line 833 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(6) - (6)].a_expr); (yyval.a_expr)->Identifier = (yyvsp[(1) - (6)].tv_str); (yyval.a_expr)->lhs_params = (yyvsp[(3) - (6)].a_plist); } break; case 70: #line 839 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(6) - (6)].a_expr); (yyval.a_expr)->Identifier = (yyvsp[(1) - (6)].tv_str); (yyval.a_expr)->lhs_params = (yyvsp[(3) - (6)].a_plist); } break; case 71: #line 847 "asn1p_y.y" { int ret; (yyval.a_plist) = asn1p_paramlist_new(yylineno); checkmem((yyval.a_plist)); ret = asn1p_paramlist_add_param((yyval.a_plist), (yyvsp[(1) - (1)].a_parg).governor, (yyvsp[(1) - (1)].a_parg).argument); checkmem(ret == 0); if((yyvsp[(1) - (1)].a_parg).governor) asn1p_ref_free((yyvsp[(1) - (1)].a_parg).governor); if((yyvsp[(1) - (1)].a_parg).argument) free((yyvsp[(1) - (1)].a_parg).argument); } break; case 72: #line 856 "asn1p_y.y" { int ret; (yyval.a_plist) = (yyvsp[(1) - (3)].a_plist); ret = asn1p_paramlist_add_param((yyval.a_plist), (yyvsp[(3) - (3)].a_parg).governor, (yyvsp[(3) - (3)].a_parg).argument); checkmem(ret == 0); if((yyvsp[(3) - (3)].a_parg).governor) asn1p_ref_free((yyvsp[(3) - (3)].a_parg).governor); if((yyvsp[(3) - (3)].a_parg).argument) free((yyvsp[(3) - (3)].a_parg).argument); } break; case 73: #line 867 "asn1p_y.y" { (yyval.a_parg).governor = NULL; (yyval.a_parg).argument = (yyvsp[(1) - (1)].tv_str); } break; case 74: #line 871 "asn1p_y.y" { int ret; (yyval.a_parg).governor = asn1p_ref_new(yylineno); ret = asn1p_ref_add_component((yyval.a_parg).governor, (yyvsp[(1) - (3)].tv_str), 0); checkmem(ret == 0); (yyval.a_parg).argument = (yyvsp[(3) - (3)].tv_str); } break; case 75: #line 878 "asn1p_y.y" { int ret; (yyval.a_parg).governor = asn1p_ref_new(yylineno); ret = asn1p_ref_add_component((yyval.a_parg).governor, (yyvsp[(1) - (3)].tv_str), 0); checkmem(ret == 0); (yyval.a_parg).argument = (yyvsp[(3) - (3)].tv_str); } break; case 76: #line 885 "asn1p_y.y" { int ret; (yyval.a_parg).governor = asn1p_ref_new(yylineno); ret = asn1p_ref_add_component((yyval.a_parg).governor, ASN_EXPR_TYPE2STR((yyvsp[(1) - (3)].a_type)), 1); checkmem(ret == 0); (yyval.a_parg).argument = (yyvsp[(3) - (3)].tv_str); } break; case 77: #line 893 "asn1p_y.y" { int ret; (yyval.a_parg).governor = asn1p_ref_new(yylineno); ret = asn1p_ref_add_component((yyval.a_parg).governor, ASN_EXPR_TYPE2STR((yyvsp[(1) - (3)].a_type)), 1); checkmem(ret == 0); (yyval.a_parg).argument = (yyvsp[(3) - (3)].tv_str); } break; case 78: #line 904 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); asn1p_expr_add((yyval.a_expr), (yyvsp[(1) - (1)].a_expr)); } break; case 79: #line 909 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(1) - (3)].a_expr); asn1p_expr_add((yyval.a_expr), (yyvsp[(3) - (3)].a_expr)); } break; case 80: #line 916 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(1) - (1)].a_expr); } break; case 81: #line 919 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); (yyval.a_expr)->Identifier = "?"; (yyval.a_expr)->expr_type = A1TC_REFERENCE; (yyval.a_expr)->meta_type = AMT_VALUE; (yyval.a_expr)->value = (yyvsp[(1) - (1)].a_value); } break; case 82: #line 927 "asn1p_y.y" { asn1p_ref_t *ref; (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); (yyval.a_expr)->Identifier = (yyvsp[(1) - (1)].tv_str); (yyval.a_expr)->expr_type = A1TC_REFERENCE; (yyval.a_expr)->meta_type = AMT_VALUE; ref = asn1p_ref_new(yylineno); asn1p_ref_add_component(ref, (yyvsp[(1) - (1)].tv_str), RLT_lowercase); (yyval.a_expr)->value = asn1p_value_fromref(ref, 0); } break; case 83: #line 938 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); (yyval.a_expr)->expr_type = A1TC_VALUESET; (yyval.a_expr)->meta_type = AMT_VALUESET; (yyval.a_expr)->constraints = (yyvsp[(1) - (1)].a_constr); } break; case 84: #line 961 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); } break; case 85: #line 962 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(1) - (1)].a_expr); } break; case 86: #line 965 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); asn1p_expr_add((yyval.a_expr), (yyvsp[(1) - (1)].a_expr)); } break; case 87: #line 970 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(1) - (3)].a_expr); asn1p_expr_add((yyval.a_expr), (yyvsp[(3) - (3)].a_expr)); } break; case 88: #line 974 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(1) - (5)].a_expr); asn1p_expr_add_many((yyval.a_expr), (yyvsp[(4) - (5)].a_expr)); } break; case 89: #line 981 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(2) - (3)].a_expr); assert((yyval.a_expr)->Identifier == 0); (yyval.a_expr)->Identifier = (yyvsp[(1) - (3)].tv_str); (yyvsp[(3) - (3)].a_marker).flags |= (yyval.a_expr)->marker.flags; (yyval.a_expr)->marker = (yyvsp[(3) - (3)].a_marker); } break; case 90: #line 988 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(1) - (2)].a_expr); (yyvsp[(2) - (2)].a_marker).flags |= (yyval.a_expr)->marker.flags; (yyval.a_expr)->marker = (yyvsp[(2) - (2)].a_marker); _fixup_anonymous_identifier((yyval.a_expr)); } break; case 91: #line 994 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); (yyval.a_expr)->meta_type = (yyvsp[(3) - (3)].a_expr)->meta_type; (yyval.a_expr)->expr_type = A1TC_COMPONENTS_OF; asn1p_expr_add((yyval.a_expr), (yyvsp[(3) - (3)].a_expr)); } break; case 92: #line 1001 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(1) - (1)].a_expr); } break; case 93: #line 1007 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); asn1p_expr_add((yyval.a_expr), (yyvsp[(1) - (1)].a_expr)); } break; case 94: #line 1012 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(1) - (3)].a_expr); asn1p_expr_add((yyval.a_expr), (yyvsp[(3) - (3)].a_expr)); } break; case 95: #line 1019 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(2) - (2)].a_expr); assert((yyval.a_expr)->Identifier == 0); (yyval.a_expr)->Identifier = (yyvsp[(1) - (2)].tv_str); } break; case 96: #line 1024 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(1) - (1)].a_expr); } break; case 97: #line 1027 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(1) - (1)].a_expr); _fixup_anonymous_identifier((yyval.a_expr)); } break; case 98: #line 1034 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(3) - (5)].a_expr); checkmem((yyval.a_expr)); (yyval.a_expr)->with_syntax = (yyvsp[(5) - (5)].a_wsynt); assert((yyval.a_expr)->expr_type == A1TC_CLASSDEF); assert((yyval.a_expr)->meta_type == AMT_OBJECTCLASS); } break; case 99: #line 1044 "asn1p_y.y" { (yyval.a_int) = 0; } break; case 100: #line 1045 "asn1p_y.y" { (yyval.a_int) = 1; } break; case 101: #line 1049 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); (yyval.a_expr)->expr_type = A1TC_CLASSDEF; (yyval.a_expr)->meta_type = AMT_OBJECTCLASS; asn1p_expr_add((yyval.a_expr), (yyvsp[(1) - (1)].a_expr)); } break; case 102: #line 1056 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(1) - (3)].a_expr); asn1p_expr_add((yyval.a_expr), (yyvsp[(3) - (3)].a_expr)); } break; case 103: #line 1066 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); (yyval.a_expr)->Identifier = (yyvsp[(1) - (2)].tv_str); (yyval.a_expr)->meta_type = AMT_OBJECTFIELD; (yyval.a_expr)->expr_type = A1TC_CLASSFIELD_TFS; /* TypeFieldSpec */ (yyval.a_expr)->marker = (yyvsp[(2) - (2)].a_marker); } break; case 104: #line 1076 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); (yyval.a_expr)->Identifier = (yyvsp[(1) - (4)].tv_str); (yyval.a_expr)->meta_type = AMT_OBJECTFIELD; (yyval.a_expr)->expr_type = A1TC_CLASSFIELD_FTVFS; /* FixedTypeValueFieldSpec */ (yyval.a_expr)->unique = (yyvsp[(3) - (4)].a_int); (yyval.a_expr)->marker = (yyvsp[(4) - (4)].a_marker); asn1p_expr_add((yyval.a_expr), (yyvsp[(2) - (4)].a_expr)); } break; case 105: #line 1087 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); (yyval.a_expr)->Identifier = (yyvsp[(1) - (3)].tv_str); (yyval.a_expr)->meta_type = AMT_OBJECTFIELD; (yyval.a_expr)->expr_type = A1TC_CLASSFIELD_VTVFS; (yyval.a_expr)->reference = (yyvsp[(2) - (3)].a_ref); (yyval.a_expr)->marker = (yyvsp[(3) - (3)].a_marker); } break; case 106: #line 1097 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); (yyval.a_expr)->Identifier = (yyvsp[(1) - (3)].tv_str); (yyval.a_expr)->reference = (yyvsp[(2) - (3)].a_ref); (yyval.a_expr)->meta_type = AMT_OBJECTFIELD; (yyval.a_expr)->expr_type = A1TC_CLASSFIELD_OFS; (yyval.a_expr)->marker = (yyvsp[(3) - (3)].a_marker); } break; case 107: #line 1108 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); (yyval.a_expr)->Identifier = (yyvsp[(1) - (3)].tv_str); (yyval.a_expr)->meta_type = AMT_OBJECTFIELD; (yyval.a_expr)->expr_type = A1TC_CLASSFIELD_VTVSFS; (yyval.a_expr)->reference = (yyvsp[(2) - (3)].a_ref); (yyval.a_expr)->marker = (yyvsp[(3) - (3)].a_marker); } break; case 108: #line 1118 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); (yyval.a_expr)->Identifier = (yyvsp[(1) - (3)].tv_str); (yyval.a_expr)->meta_type = AMT_OBJECTFIELD; (yyval.a_expr)->expr_type = A1TC_CLASSFIELD_FTVSFS; asn1p_expr_add((yyval.a_expr), (yyvsp[(2) - (3)].a_expr)); (yyval.a_expr)->marker = (yyvsp[(3) - (3)].a_marker); } break; case 109: #line 1129 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); (yyval.a_expr)->Identifier = (yyvsp[(1) - (3)].tv_str); (yyval.a_expr)->reference = (yyvsp[(2) - (3)].a_ref); (yyval.a_expr)->meta_type = AMT_OBJECTFIELD; (yyval.a_expr)->expr_type = A1TC_CLASSFIELD_OSFS; (yyval.a_expr)->marker = (yyvsp[(3) - (3)].a_marker); } break; case 110: #line 1141 "asn1p_y.y" { (yyval.a_wsynt) = 0; } break; case 111: #line 1142 "asn1p_y.y" { (yyval.a_wsynt) = (yyvsp[(1) - (1)].a_wsynt); } break; case 112: #line 1149 "asn1p_y.y" { asn1p_lexer_hack_enable_with_syntax(); } break; case 113: #line 1151 "asn1p_y.y" { (yyval.a_wsynt) = (yyvsp[(5) - (6)].a_wsynt); } break; case 114: #line 1157 "asn1p_y.y" { (yyval.a_wsynt) = asn1p_wsyntx_new(); TQ_ADD(&((yyval.a_wsynt)->chunks), (yyvsp[(1) - (1)].a_wchunk), next); } break; case 115: #line 1161 "asn1p_y.y" { (yyval.a_wsynt) = (yyvsp[(1) - (2)].a_wsynt); TQ_ADD(&((yyval.a_wsynt)->chunks), (yyvsp[(2) - (2)].a_wchunk), next); } break; case 116: #line 1168 "asn1p_y.y" { (yyval.a_wchunk) = asn1p_wsyntx_chunk_fromstring((yyvsp[(1) - (1)].tv_opaque).buf, 0); (yyval.a_wchunk)->type = WC_WHITESPACE; } break; case 117: #line 1172 "asn1p_y.y" { (yyval.a_wchunk) = asn1p_wsyntx_chunk_fromstring((yyvsp[(1) - (1)].tv_str), 0); } break; case 118: #line 1175 "asn1p_y.y" { (yyval.a_wchunk) = asn1p_wsyntx_chunk_fromstring((yyvsp[(1) - (1)].a_refcomp).name, 0); (yyval.a_wchunk)->type = WC_FIELD; } break; case 119: #line 1179 "asn1p_y.y" { (yyval.a_wchunk) = asn1p_wsyntx_chunk_fromsyntax((yyvsp[(2) - (3)].a_wsynt)); } break; case 120: #line 1185 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); (yyval.a_expr)->Identifier = strdup("..."); checkmem((yyval.a_expr)->Identifier); (yyval.a_expr)->expr_type = A1TC_EXTENSIBLE; (yyval.a_expr)->meta_type = AMT_TYPE; } break; case 121: #line 1193 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); (yyval.a_expr)->Identifier = strdup("..."); checkmem((yyval.a_expr)->Identifier); (yyval.a_expr)->value = (yyvsp[(3) - (3)].a_value); (yyval.a_expr)->expr_type = A1TC_EXTENSIBLE; (yyval.a_expr)->meta_type = AMT_TYPE; } break; case 122: #line 1202 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); (yyval.a_expr)->Identifier = strdup("..."); (yyval.a_expr)->value = (yyvsp[(3) - (3)].a_value); checkmem((yyval.a_expr)->Identifier); (yyval.a_expr)->expr_type = A1TC_EXTENSIBLE; (yyval.a_expr)->meta_type = AMT_TYPE; } break; case 123: #line 1214 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(2) - (3)].a_expr); (yyval.a_expr)->tag = (yyvsp[(1) - (3)].a_tag); /* * Outer constraint for SEQUENCE OF and SET OF applies * to the inner type. */ if((yyval.a_expr)->expr_type == ASN_CONSTR_SEQUENCE_OF || (yyval.a_expr)->expr_type == ASN_CONSTR_SET_OF) { assert(!TQ_FIRST(&((yyval.a_expr)->members))->constraints); TQ_FIRST(&((yyval.a_expr)->members))->constraints = (yyvsp[(3) - (3)].a_constr); } else { if((yyval.a_expr)->constraints) { assert(!(yyvsp[(2) - (3)].a_expr)); } else { (yyval.a_expr)->constraints = (yyvsp[(3) - (3)].a_constr); } } } break; case 124: #line 1236 "asn1p_y.y" { (yyval.a_int) = asn1p_as_pointer ? EM_INDIRECT : 0; asn1p_as_pointer = 0; } break; case 125: #line 1243 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(2) - (2)].a_expr); (yyval.a_expr)->marker.flags |= (yyvsp[(1) - (2)].a_int); if(((yyval.a_expr)->marker.flags & EM_INDIRECT) && ((yyval.a_expr)->marker.flags & EM_OPTIONAL) != EM_OPTIONAL) { fprintf(stderr, "INFO: Directive " "applied to %s at line %d\n", ASN_EXPR_TYPE2STR((yyval.a_expr)->expr_type) ? ASN_EXPR_TYPE2STR((yyval.a_expr)->expr_type) : "member", (yyval.a_expr)->_lineno ); } } break; case 126: #line 1262 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(1) - (1)].a_expr); } break; case 127: #line 1265 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(3) - (4)].a_expr); assert((yyval.a_expr)->expr_type == A1TC_INVALID); (yyval.a_expr)->expr_type = ASN_CONSTR_CHOICE; (yyval.a_expr)->meta_type = AMT_TYPE; } break; case 128: #line 1271 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(3) - (4)].a_expr); assert((yyval.a_expr)->expr_type == A1TC_INVALID); (yyval.a_expr)->expr_type = ASN_CONSTR_SEQUENCE; (yyval.a_expr)->meta_type = AMT_TYPE; } break; case 129: #line 1277 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(3) - (4)].a_expr); assert((yyval.a_expr)->expr_type == A1TC_INVALID); (yyval.a_expr)->expr_type = ASN_CONSTR_SET; (yyval.a_expr)->meta_type = AMT_TYPE; } break; case 130: #line 1283 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); (yyval.a_expr)->constraints = (yyvsp[(2) - (6)].a_constr); (yyval.a_expr)->expr_type = ASN_CONSTR_SEQUENCE_OF; (yyval.a_expr)->meta_type = AMT_TYPE; (yyvsp[(6) - (6)].a_expr)->Identifier = (yyvsp[(4) - (6)].tv_str); (yyvsp[(6) - (6)].a_expr)->tag = (yyvsp[(5) - (6)].a_tag); asn1p_expr_add((yyval.a_expr), (yyvsp[(6) - (6)].a_expr)); } break; case 131: #line 1293 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); (yyval.a_expr)->constraints = (yyvsp[(2) - (6)].a_constr); (yyval.a_expr)->expr_type = ASN_CONSTR_SET_OF; (yyval.a_expr)->meta_type = AMT_TYPE; (yyvsp[(6) - (6)].a_expr)->Identifier = (yyvsp[(4) - (6)].tv_str); (yyvsp[(6) - (6)].a_expr)->tag = (yyvsp[(5) - (6)].a_tag); asn1p_expr_add((yyval.a_expr), (yyvsp[(6) - (6)].a_expr)); } break; case 132: #line 1303 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); (yyval.a_expr)->expr_type = ASN_TYPE_ANY; (yyval.a_expr)->meta_type = AMT_TYPE; } break; case 133: #line 1309 "asn1p_y.y" { int ret; (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); (yyval.a_expr)->reference = asn1p_ref_new(yylineno); ret = asn1p_ref_add_component((yyval.a_expr)->reference, (yyvsp[(4) - (4)].tv_str), RLT_lowercase); checkmem(ret == 0); (yyval.a_expr)->expr_type = ASN_TYPE_ANY; (yyval.a_expr)->meta_type = AMT_TYPE; } break; case 134: #line 1320 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); (yyval.a_expr)->reference = (yyvsp[(3) - (3)].a_ref); (yyval.a_expr)->expr_type = A1TC_INSTANCE; (yyval.a_expr)->meta_type = AMT_TYPE; } break; case 135: #line 1335 "asn1p_y.y" { int ret; (yyval.a_ref) = asn1p_ref_new(yylineno); checkmem((yyval.a_ref)); ret = asn1p_ref_add_component((yyval.a_ref), (yyvsp[(1) - (1)].tv_str), RLT_UNKNOWN); checkmem(ret == 0); free((yyvsp[(1) - (1)].tv_str)); } break; case 136: #line 1343 "asn1p_y.y" { int ret; (yyval.a_ref) = asn1p_ref_new(yylineno); checkmem((yyval.a_ref)); ret = asn1p_ref_add_component((yyval.a_ref), (yyvsp[(1) - (3)].tv_str), RLT_UNKNOWN); checkmem(ret == 0); ret = asn1p_ref_add_component((yyval.a_ref), (yyvsp[(3) - (3)].tv_str), RLT_UNKNOWN); checkmem(ret == 0); free((yyvsp[(1) - (3)].tv_str)); } break; case 137: #line 1353 "asn1p_y.y" { int ret; (yyval.a_ref) = asn1p_ref_new(yylineno); checkmem((yyval.a_ref)); ret = asn1p_ref_add_component((yyval.a_ref), (yyvsp[(1) - (3)].tv_str), RLT_UNKNOWN); checkmem(ret == 0); ret = asn1p_ref_add_component((yyval.a_ref), (yyvsp[(3) - (3)].tv_str), RLT_UNKNOWN); checkmem(ret == 0); free((yyvsp[(1) - (3)].tv_str)); } break; case 138: #line 1363 "asn1p_y.y" { int ret; (yyval.a_ref) = asn1p_ref_new(yylineno); checkmem((yyval.a_ref)); ret = asn1p_ref_add_component((yyval.a_ref), (yyvsp[(1) - (3)].tv_str), RLT_UNKNOWN); checkmem(ret == 0); ret = asn1p_ref_add_component((yyval.a_ref), (yyvsp[(3) - (3)].tv_str), RLT_lowercase); checkmem(ret == 0); free((yyvsp[(1) - (3)].tv_str)); } break; case 139: #line 1373 "asn1p_y.y" { int ret; (yyval.a_ref) = asn1p_ref_new(yylineno); checkmem((yyval.a_ref)); ret = asn1p_ref_add_component((yyval.a_ref), (yyvsp[(1) - (1)].tv_str), RLT_CAPITALS); free((yyvsp[(1) - (1)].tv_str)); checkmem(ret == 0); } break; case 140: #line 1381 "asn1p_y.y" { int ret; (yyval.a_ref) = (yyvsp[(3) - (3)].a_ref); ret = asn1p_ref_add_component((yyval.a_ref), (yyvsp[(1) - (3)].tv_str), RLT_CAPITALS); free((yyvsp[(1) - (3)].tv_str)); checkmem(ret == 0); /* * Move the last element infront. */ { struct asn1p_ref_component_s tmp_comp; tmp_comp = (yyval.a_ref)->components[(yyval.a_ref)->comp_count-1]; memmove(&(yyval.a_ref)->components[1], &(yyval.a_ref)->components[0], sizeof((yyval.a_ref)->components[0]) * ((yyval.a_ref)->comp_count - 1)); (yyval.a_ref)->components[0] = tmp_comp; } } break; case 141: #line 1403 "asn1p_y.y" { int ret; (yyval.a_ref) = asn1p_ref_new(yylineno); checkmem((yyval.a_ref)); ret = asn1p_ref_add_component((yyval.a_ref), (yyvsp[(1) - (1)].a_refcomp).name, (yyvsp[(1) - (1)].a_refcomp).lex_type); free((yyvsp[(1) - (1)].a_refcomp).name); checkmem(ret == 0); } break; case 142: #line 1411 "asn1p_y.y" { int ret; (yyval.a_ref) = (yyvsp[(1) - (3)].a_ref); ret = asn1p_ref_add_component((yyval.a_ref), (yyvsp[(3) - (3)].a_refcomp).name, (yyvsp[(3) - (3)].a_refcomp).lex_type); free((yyvsp[(3) - (3)].a_refcomp).name); checkmem(ret == 0); } break; case 144: #line 1424 "asn1p_y.y" { (yyval.a_refcomp).lex_type = RLT_AmpUppercase; (yyval.a_refcomp).name = (yyvsp[(1) - (1)].tv_str); } break; case 145: #line 1429 "asn1p_y.y" { (yyval.a_refcomp).lex_type = RLT_Amplowercase; (yyval.a_refcomp).name = (yyvsp[(1) - (1)].tv_str); } break; case 146: #line 1438 "asn1p_y.y" { (yyval.a_ref) = asn1p_ref_new(yylineno); asn1p_ref_add_component((yyval.a_ref), (yyvsp[(1) - (1)].tv_str), RLT_AmpUppercase); } break; case 147: #line 1442 "asn1p_y.y" { (yyval.a_ref) = (yyval.a_ref); asn1p_ref_add_component((yyval.a_ref), (yyvsp[(3) - (3)].tv_str), RLT_AmpUppercase); } break; case 148: #line 1446 "asn1p_y.y" { (yyval.a_ref) = (yyval.a_ref); asn1p_ref_add_component((yyval.a_ref), (yyvsp[(3) - (3)].tv_str), RLT_Amplowercase); } break; case 149: #line 1453 "asn1p_y.y" { (yyval.a_ref) = asn1p_ref_new(yylineno); asn1p_ref_add_component((yyval.a_ref), (yyvsp[(1) - (1)].tv_str), RLT_CAPITALS); } break; case 150: #line 1473 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(2) - (4)].a_expr); assert((yyval.a_expr)->Identifier == NULL); (yyval.a_expr)->Identifier = (yyvsp[(1) - (4)].tv_str); (yyval.a_expr)->meta_type = AMT_VALUE; (yyval.a_expr)->value = (yyvsp[(4) - (4)].a_value); } break; case 153: #line 1485 "asn1p_y.y" { (yyval.a_value) = asn1p_value_fromint(0); checkmem((yyval.a_value)); (yyval.a_value)->type = ATV_CHOICE_IDENTIFIER; (yyval.a_value)->value.choice_identifier.identifier = (yyvsp[(1) - (3)].tv_str); (yyval.a_value)->value.choice_identifier.value = (yyvsp[(3) - (3)].a_value); } break; case 154: #line 1492 "asn1p_y.y" { asn1p_lexer_hack_push_opaque_state(); } break; case 155: #line 1492 "asn1p_y.y" { (yyval.a_value) = asn1p_value_frombuf((yyvsp[(3) - (3)].tv_opaque).buf, (yyvsp[(3) - (3)].tv_opaque).len, 0); checkmem((yyval.a_value)); (yyval.a_value)->type = ATV_UNPARSED; } break; case 156: #line 1497 "asn1p_y.y" { (yyval.a_value) = asn1p_value_fromint(0); checkmem((yyval.a_value)); (yyval.a_value)->type = ATV_NULL; } break; case 157: #line 1505 "asn1p_y.y" { (yyval.a_value) = asn1p_value_fromint(0); checkmem((yyval.a_value)); (yyval.a_value)->type = ATV_FALSE; } break; case 158: #line 1510 "asn1p_y.y" { (yyval.a_value) = asn1p_value_fromint(0); checkmem((yyval.a_value)); (yyval.a_value)->type = ATV_TRUE; } break; case 159: #line 1515 "asn1p_y.y" { (yyval.a_value) = _convert_bitstring2binary((yyvsp[(1) - (1)].tv_str), 'B'); checkmem((yyval.a_value)); } break; case 160: #line 1519 "asn1p_y.y" { (yyval.a_value) = _convert_bitstring2binary((yyvsp[(1) - (1)].tv_str), 'H'); checkmem((yyval.a_value)); } break; case 161: #line 1523 "asn1p_y.y" { (yyval.a_value) = (yyval.a_value); } break; case 162: #line 1526 "asn1p_y.y" { (yyval.a_value) = (yyvsp[(1) - (1)].a_value); } break; case 163: #line 1532 "asn1p_y.y" { asn1p_ref_t *ref; int ret; ref = asn1p_ref_new(yylineno); checkmem(ref); ret = asn1p_ref_add_component(ref, (yyvsp[(1) - (1)].tv_str), RLT_lowercase); checkmem(ret == 0); (yyval.a_value) = asn1p_value_fromref(ref, 0); checkmem((yyval.a_value)); free((yyvsp[(1) - (1)].tv_str)); } break; case 164: #line 1543 "asn1p_y.y" { asn1p_ref_t *ref; int ret; ref = asn1p_ref_new(yylineno); checkmem(ref); ret = asn1p_ref_add_component(ref, (yyvsp[(1) - (3)].tv_str), RLT_UNKNOWN); checkmem(ret == 0); ret = asn1p_ref_add_component(ref, (yyvsp[(3) - (3)].tv_str), RLT_lowercase); checkmem(ret == 0); (yyval.a_value) = asn1p_value_fromref(ref, 0); checkmem((yyval.a_value)); free((yyvsp[(1) - (3)].tv_str)); free((yyvsp[(3) - (3)].tv_str)); } break; case 165: #line 1561 "asn1p_y.y" { (yyval.a_value) = asn1p_value_frombuf((yyvsp[(1) - (1)].tv_opaque).buf, (yyvsp[(1) - (1)].tv_opaque).len, 0); checkmem((yyval.a_value)); } break; case 166: #line 1565 "asn1p_y.y" { (yyval.a_value) = asn1p_value_fromint((yyvsp[(1) - (1)].a_int)); checkmem((yyval.a_value)); (yyval.a_value)->type = ATV_TUPLE; } break; case 167: #line 1570 "asn1p_y.y" { (yyval.a_value) = asn1p_value_fromint((yyvsp[(1) - (1)].a_int)); checkmem((yyval.a_value)); (yyval.a_value)->type = ATV_QUADRUPLE; } break; case 168: #line 1578 "asn1p_y.y" { (yyval.tv_opaque).len = (yyvsp[(1) - (1)].tv_opaque).len + 1; (yyval.tv_opaque).buf = malloc((yyval.tv_opaque).len + 1); checkmem((yyval.tv_opaque).buf); (yyval.tv_opaque).buf[0] = '{'; memcpy((yyval.tv_opaque).buf + 1, (yyvsp[(1) - (1)].tv_opaque).buf, (yyvsp[(1) - (1)].tv_opaque).len); (yyval.tv_opaque).buf[(yyval.tv_opaque).len] = '\0'; free((yyvsp[(1) - (1)].tv_opaque).buf); } break; case 169: #line 1587 "asn1p_y.y" { int newsize = (yyvsp[(1) - (2)].tv_opaque).len + (yyvsp[(2) - (2)].tv_opaque).len; char *p = malloc(newsize + 1); checkmem(p); memcpy(p , (yyvsp[(1) - (2)].tv_opaque).buf, (yyvsp[(1) - (2)].tv_opaque).len); memcpy(p + (yyvsp[(1) - (2)].tv_opaque).len, (yyvsp[(2) - (2)].tv_opaque).buf, (yyvsp[(2) - (2)].tv_opaque).len); p[newsize] = '\0'; free((yyvsp[(1) - (2)].tv_opaque).buf); free((yyvsp[(2) - (2)].tv_opaque).buf); (yyval.tv_opaque).buf = p; (yyval.tv_opaque).len = newsize; } break; case 170: #line 1602 "asn1p_y.y" { (yyval.a_type) = ASN_BASIC_BOOLEAN; } break; case 171: #line 1603 "asn1p_y.y" { (yyval.a_type) = ASN_BASIC_NULL; } break; case 172: #line 1604 "asn1p_y.y" { (yyval.a_type) = ASN_BASIC_REAL; } break; case 173: #line 1605 "asn1p_y.y" { (yyval.a_type) = (yyvsp[(1) - (1)].a_type); } break; case 174: #line 1606 "asn1p_y.y" { (yyval.a_type) = ASN_BASIC_OCTET_STRING; } break; case 175: #line 1607 "asn1p_y.y" { (yyval.a_type) = ASN_BASIC_OBJECT_IDENTIFIER; } break; case 176: #line 1608 "asn1p_y.y" { (yyval.a_type) = ASN_BASIC_RELATIVE_OID; } break; case 177: #line 1609 "asn1p_y.y" { (yyval.a_type) = ASN_BASIC_EXTERNAL; } break; case 178: #line 1610 "asn1p_y.y" { (yyval.a_type) = ASN_BASIC_EMBEDDED_PDV; } break; case 179: #line 1611 "asn1p_y.y" { (yyval.a_type) = ASN_BASIC_CHARACTER_STRING; } break; case 180: #line 1612 "asn1p_y.y" { (yyval.a_type) = ASN_BASIC_UTCTime; } break; case 181: #line 1613 "asn1p_y.y" { (yyval.a_type) = ASN_BASIC_GeneralizedTime; } break; case 182: #line 1614 "asn1p_y.y" { (yyval.a_type) = (yyvsp[(1) - (1)].a_type); } break; case 183: #line 1621 "asn1p_y.y" { (yyval.a_type) = ASN_BASIC_INTEGER; } break; case 184: #line 1622 "asn1p_y.y" { (yyval.a_type) = ASN_BASIC_ENUMERATED; } break; case 185: #line 1623 "asn1p_y.y" { (yyval.a_type) = ASN_BASIC_BIT_STRING; } break; case 186: #line 1627 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); (yyval.a_expr)->expr_type = (yyvsp[(1) - (1)].a_type); (yyval.a_expr)->meta_type = AMT_TYPE; } break; case 187: #line 1633 "asn1p_y.y" { if((yyvsp[(2) - (2)].a_expr)) { (yyval.a_expr) = (yyvsp[(2) - (2)].a_expr); } else { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); } (yyval.a_expr)->expr_type = (yyvsp[(1) - (2)].a_type); (yyval.a_expr)->meta_type = AMT_TYPE; } break; case 188: #line 1646 "asn1p_y.y" { (yyval.a_type) = ASN_STRING_BMPString; } break; case 189: #line 1647 "asn1p_y.y" { (yyval.a_type) = ASN_STRING_GeneralString; fprintf(stderr, "WARNING: GeneralString is not fully supported\n"); } break; case 190: #line 1651 "asn1p_y.y" { (yyval.a_type) = ASN_STRING_GraphicString; fprintf(stderr, "WARNING: GraphicString is not fully supported\n"); } break; case 191: #line 1655 "asn1p_y.y" { (yyval.a_type) = ASN_STRING_IA5String; } break; case 192: #line 1656 "asn1p_y.y" { (yyval.a_type) = ASN_STRING_ISO646String; } break; case 193: #line 1657 "asn1p_y.y" { (yyval.a_type) = ASN_STRING_NumericString; } break; case 194: #line 1658 "asn1p_y.y" { (yyval.a_type) = ASN_STRING_PrintableString; } break; case 195: #line 1659 "asn1p_y.y" { (yyval.a_type) = ASN_STRING_T61String; fprintf(stderr, "WARNING: T61String is not fully supported\n"); } break; case 196: #line 1663 "asn1p_y.y" { (yyval.a_type) = ASN_STRING_TeletexString; } break; case 197: #line 1664 "asn1p_y.y" { (yyval.a_type) = ASN_STRING_UniversalString; } break; case 198: #line 1665 "asn1p_y.y" { (yyval.a_type) = ASN_STRING_UTF8String; } break; case 199: #line 1666 "asn1p_y.y" { (yyval.a_type) = ASN_STRING_VideotexString; fprintf(stderr, "WARNING: VideotexString is not fully supported\n"); } break; case 200: #line 1670 "asn1p_y.y" { (yyval.a_type) = ASN_STRING_VisibleString; } break; case 201: #line 1671 "asn1p_y.y" { (yyval.a_type) = ASN_STRING_ObjectDescriptor; } break; case 206: #line 1682 "asn1p_y.y" { (yyval.a_constr) = 0; } break; case 207: #line 1683 "asn1p_y.y" { (yyval.a_constr) = (yyvsp[(1) - (1)].a_constr); } break; case 209: #line 1693 "asn1p_y.y" { CONSTRAINT_INSERT((yyval.a_constr), ACT_CA_SET, (yyvsp[(1) - (1)].a_constr), 0); } break; case 210: #line 1696 "asn1p_y.y" { /* * This is a special case, for compatibility purposes. * It goes without parentheses. */ CONSTRAINT_INSERT((yyval.a_constr), ACT_CT_SIZE, (yyvsp[(3) - (4)].a_constr), 0); } break; case 211: #line 1706 "asn1p_y.y" { (yyval.a_constr) = (yyvsp[(2) - (3)].a_constr); } break; case 212: #line 1709 "asn1p_y.y" { CONSTRAINT_INSERT((yyval.a_constr), ACT_CA_SET, (yyvsp[(1) - (4)].a_constr), (yyvsp[(3) - (4)].a_constr)); } break; case 213: #line 1715 "asn1p_y.y" { (yyval.a_constr) = asn1p_constraint_new(yylineno); (yyval.a_constr)->type = ACT_EL_EXT; } break; case 214: #line 1719 "asn1p_y.y" { (yyval.a_constr) = (yyvsp[(1) - (1)].a_constr); } break; case 215: #line 1722 "asn1p_y.y" { asn1p_constraint_t *ct; ct = asn1p_constraint_new(yylineno); ct->type = ACT_EL_EXT; CONSTRAINT_INSERT((yyval.a_constr), ACT_CA_CSV, (yyvsp[(1) - (3)].a_constr), ct); } break; case 216: #line 1728 "asn1p_y.y" { asn1p_constraint_t *ct; ct = asn1p_constraint_new(yylineno); ct->type = ACT_EL_EXT; CONSTRAINT_INSERT((yyval.a_constr), ACT_CA_CSV, (yyvsp[(1) - (5)].a_constr), ct); ct = (yyval.a_constr); CONSTRAINT_INSERT((yyval.a_constr), ACT_CA_CSV, ct, (yyvsp[(5) - (5)].a_constr)); } break; case 217: #line 1736 "asn1p_y.y" { (yyval.a_constr) = (yyvsp[(1) - (1)].a_constr); } break; case 219: #line 1743 "asn1p_y.y" { CONSTRAINT_INSERT((yyval.a_constr), ACT_CA_AEX, (yyvsp[(3) - (3)].a_constr), 0); } break; case 221: #line 1750 "asn1p_y.y" { CONSTRAINT_INSERT((yyval.a_constr), ACT_CA_UNI, (yyvsp[(1) - (3)].a_constr), (yyvsp[(3) - (3)].a_constr)); } break; case 223: #line 1757 "asn1p_y.y" { CONSTRAINT_INSERT((yyval.a_constr), ACT_CA_INT, (yyvsp[(1) - (3)].a_constr), (yyvsp[(3) - (3)].a_constr)); } break; case 225: #line 1765 "asn1p_y.y" { CONSTRAINT_INSERT((yyval.a_constr), ACT_CA_EXC, (yyvsp[(1) - (3)].a_constr), (yyvsp[(3) - (3)].a_constr)); } break; case 226: #line 1771 "asn1p_y.y" { int ret; (yyval.a_constr) = asn1p_constraint_new(yylineno); checkmem((yyval.a_constr)); (yyval.a_constr)->type = (yyvsp[(1) - (4)].a_ctype); ret = asn1p_constraint_insert((yyval.a_constr), (yyvsp[(3) - (4)].a_constr)); checkmem(ret == 0); } break; case 227: #line 1779 "asn1p_y.y" { int ret; (yyval.a_constr) = asn1p_constraint_new(yylineno); checkmem((yyval.a_constr)); (yyval.a_constr)->type = ACT_CA_SET; ret = asn1p_constraint_insert((yyval.a_constr), (yyvsp[(2) - (3)].a_constr)); checkmem(ret == 0); } break; case 228: #line 1787 "asn1p_y.y" { (yyval.a_constr) = asn1p_constraint_new(yylineno); checkmem((yyval.a_constr)); (yyval.a_constr)->type = ACT_EL_VALUE; (yyval.a_constr)->value = (yyvsp[(1) - (1)].a_value); } break; case 229: #line 1793 "asn1p_y.y" { (yyval.a_constr) = asn1p_constraint_new(yylineno); checkmem((yyval.a_constr)); (yyval.a_constr)->type = ACT_EL_TYPE; (yyval.a_constr)->containedSubtype = (yyvsp[(1) - (1)].a_value); } break; case 230: #line 1799 "asn1p_y.y" { (yyval.a_constr) = asn1p_constraint_new(yylineno); checkmem((yyval.a_constr)); (yyval.a_constr)->type = (yyvsp[(2) - (3)].a_ctype); (yyval.a_constr)->range_start = (yyvsp[(1) - (3)].a_value); (yyval.a_constr)->range_stop = (yyvsp[(3) - (3)].a_value); } break; case 231: #line 1806 "asn1p_y.y" { (yyval.a_constr) = asn1p_constraint_new(yylineno); checkmem((yyval.a_constr)); (yyval.a_constr)->type = (yyvsp[(2) - (3)].a_ctype); (yyval.a_constr)->range_start = asn1p_value_fromint(-123); (yyval.a_constr)->range_stop = (yyvsp[(3) - (3)].a_value); (yyval.a_constr)->range_start->type = ATV_MIN; } break; case 232: #line 1814 "asn1p_y.y" { (yyval.a_constr) = asn1p_constraint_new(yylineno); checkmem((yyval.a_constr)); (yyval.a_constr)->type = (yyvsp[(2) - (3)].a_ctype); (yyval.a_constr)->range_start = (yyvsp[(1) - (3)].a_value); (yyval.a_constr)->range_stop = asn1p_value_fromint(321); (yyval.a_constr)->range_stop->type = ATV_MAX; } break; case 233: #line 1822 "asn1p_y.y" { (yyval.a_constr) = asn1p_constraint_new(yylineno); checkmem((yyval.a_constr)); (yyval.a_constr)->type = (yyvsp[(2) - (3)].a_ctype); (yyval.a_constr)->range_start = asn1p_value_fromint(-123); (yyval.a_constr)->range_stop = asn1p_value_fromint(321); (yyval.a_constr)->range_start->type = ATV_MIN; (yyval.a_constr)->range_stop->type = ATV_MAX; } break; case 234: #line 1831 "asn1p_y.y" { (yyval.a_constr) = (yyvsp[(1) - (1)].a_constr); } break; case 235: #line 1834 "asn1p_y.y" { (yyval.a_constr) = (yyvsp[(1) - (1)].a_constr); } break; case 236: #line 1840 "asn1p_y.y" { (yyval.a_constr) = asn1p_constraint_new(yylineno); (yyval.a_constr)->type = ACT_CT_PATTERN; (yyval.a_constr)->value = asn1p_value_frombuf((yyvsp[(2) - (2)].tv_opaque).buf, (yyvsp[(2) - (2)].tv_opaque).len, 0); } break; case 237: #line 1845 "asn1p_y.y" { asn1p_ref_t *ref; (yyval.a_constr) = asn1p_constraint_new(yylineno); (yyval.a_constr)->type = ACT_CT_PATTERN; ref = asn1p_ref_new(yylineno); asn1p_ref_add_component(ref, (yyvsp[(2) - (2)].tv_str), RLT_lowercase); (yyval.a_constr)->value = asn1p_value_fromref(ref, 0); } break; case 238: #line 1856 "asn1p_y.y" { (yyval.a_ctype) = ACT_CT_SIZE; } break; case 239: #line 1859 "asn1p_y.y" { (yyval.a_ctype) = ACT_CT_FROM; } break; case 240: #line 1865 "asn1p_y.y" { (yyval.a_value) = asn1p_value_fromint(0); checkmem((yyval.a_value)); (yyval.a_value)->type = ATV_FALSE; } break; case 241: #line 1870 "asn1p_y.y" { (yyval.a_value) = asn1p_value_fromint(1); checkmem((yyval.a_value)); (yyval.a_value)->type = ATV_TRUE; } break; case 245: #line 1878 "asn1p_y.y" { asn1p_ref_t *ref; int ret; ref = asn1p_ref_new(yylineno); checkmem(ref); ret = asn1p_ref_add_component(ref, (yyvsp[(1) - (1)].tv_str), RLT_lowercase); checkmem(ret == 0); (yyval.a_value) = asn1p_value_fromref(ref, 0); checkmem((yyval.a_value)); free((yyvsp[(1) - (1)].tv_str)); } break; case 246: #line 1892 "asn1p_y.y" { (yyval.a_value) = _convert_bitstring2binary((yyvsp[(1) - (1)].tv_str), 'B'); checkmem((yyval.a_value)); } break; case 247: #line 1896 "asn1p_y.y" { (yyval.a_value) = _convert_bitstring2binary((yyvsp[(1) - (1)].tv_str), 'H'); checkmem((yyval.a_value)); } break; case 248: #line 1903 "asn1p_y.y" { asn1p_ref_t *ref; int ret; ref = asn1p_ref_new(yylineno); checkmem(ref); ret = asn1p_ref_add_component(ref, (yyvsp[(1) - (1)].tv_str), RLT_UNKNOWN); checkmem(ret == 0); (yyval.a_value) = asn1p_value_fromref(ref, 0); checkmem((yyval.a_value)); free((yyvsp[(1) - (1)].tv_str)); } break; case 249: #line 1917 "asn1p_y.y" { CONSTRAINT_INSERT((yyval.a_constr), ACT_CT_WCOMP, (yyvsp[(3) - (3)].a_constr), 0); } break; case 250: #line 1920 "asn1p_y.y" { CONSTRAINT_INSERT((yyval.a_constr), ACT_CT_WCOMPS, (yyvsp[(4) - (5)].a_constr), 0); } break; case 251: #line 1926 "asn1p_y.y" { (yyval.a_constr) = (yyvsp[(1) - (1)].a_constr); } break; case 252: #line 1929 "asn1p_y.y" { CONSTRAINT_INSERT((yyval.a_constr), ACT_CT_WCOMPS, (yyvsp[(1) - (3)].a_constr), (yyvsp[(3) - (3)].a_constr)); } break; case 253: #line 1935 "asn1p_y.y" { (yyval.a_constr) = asn1p_constraint_new(yylineno); checkmem((yyval.a_constr)); (yyval.a_constr)->type = ACT_EL_EXT; (yyval.a_constr)->value = asn1p_value_frombuf("...", 3, 1); } break; case 254: #line 1941 "asn1p_y.y" { (yyval.a_constr) = asn1p_constraint_new(yylineno); checkmem((yyval.a_constr)); (yyval.a_constr)->type = ACT_EL_VALUE; (yyval.a_constr)->value = asn1p_value_frombuf((yyvsp[(1) - (3)].tv_str), strlen((yyvsp[(1) - (3)].tv_str)), 0); (yyval.a_constr)->presence = (yyvsp[(3) - (3)].a_pres); if((yyvsp[(2) - (3)].a_constr)) asn1p_constraint_insert((yyval.a_constr), (yyvsp[(2) - (3)].a_constr)); } break; case 255: #line 1955 "asn1p_y.y" { (yyval.a_pres) = ACPRES_DEFAULT; } break; case 256: #line 1956 "asn1p_y.y" { (yyval.a_pres) = (yyvsp[(1) - (1)].a_pres); } break; case 257: #line 1960 "asn1p_y.y" { (yyval.a_pres) = ACPRES_PRESENT; } break; case 258: #line 1963 "asn1p_y.y" { (yyval.a_pres) = ACPRES_ABSENT; } break; case 259: #line 1966 "asn1p_y.y" { (yyval.a_pres) = ACPRES_OPTIONAL; } break; case 263: #line 1981 "asn1p_y.y" { asn1p_lexer_hack_push_opaque_state(); } break; case 264: #line 1981 "asn1p_y.y" { (yyval.a_constr) = asn1p_constraint_new(yylineno); checkmem((yyval.a_constr)); (yyval.a_constr)->type = ACT_CT_CTDBY; (yyval.a_constr)->value = asn1p_value_frombuf((yyvsp[(5) - (5)].tv_opaque).buf, (yyvsp[(5) - (5)].tv_opaque).len, 0); checkmem((yyval.a_constr)->value); (yyval.a_constr)->value->type = ATV_UNPARSED; } break; case 265: #line 1992 "asn1p_y.y" { (yyval.a_constr) = asn1p_constraint_new(yylineno); (yyval.a_constr)->type = ACT_CT_CTNG; (yyval.a_constr)->value = asn1p_value_fromtype((yyvsp[(2) - (2)].a_expr)); } break; case 266: #line 2000 "asn1p_y.y" { (yyval.a_ctype) = ACT_EL_RANGE; } break; case 267: #line 2001 "asn1p_y.y" { (yyval.a_ctype) = ACT_EL_RLRANGE; } break; case 268: #line 2002 "asn1p_y.y" { (yyval.a_ctype) = ACT_EL_LLRANGE; } break; case 269: #line 2003 "asn1p_y.y" { (yyval.a_ctype) = ACT_EL_ULRANGE; } break; case 270: #line 2006 "asn1p_y.y" { (yyval.a_constr) = (yyvsp[(1) - (1)].a_constr); } break; case 271: #line 2009 "asn1p_y.y" { (yyval.a_constr) = (yyvsp[(1) - (1)].a_constr); } break; case 272: #line 2018 "asn1p_y.y" { asn1p_ref_t *ref = asn1p_ref_new(yylineno); asn1p_constraint_t *ct; int ret; ret = asn1p_ref_add_component(ref, (yyvsp[(2) - (3)].tv_str), 0); checkmem(ret == 0); ct = asn1p_constraint_new(yylineno); checkmem((yyval.a_constr)); ct->type = ACT_EL_VALUE; ct->value = asn1p_value_fromref(ref, 0); CONSTRAINT_INSERT((yyval.a_constr), ACT_CA_CRC, ct, 0); } break; case 273: #line 2033 "asn1p_y.y" { CONSTRAINT_INSERT((yyval.a_constr), ACT_CA_CRC, (yyvsp[(1) - (4)].a_constr), (yyvsp[(3) - (4)].a_constr)); } break; case 274: #line 2039 "asn1p_y.y" { (yyval.a_constr) = asn1p_constraint_new(yylineno); checkmem((yyval.a_constr)); (yyval.a_constr)->type = ACT_EL_VALUE; (yyval.a_constr)->value = asn1p_value_fromref((yyvsp[(1) - (1)].a_ref), 0); } break; case 275: #line 2045 "asn1p_y.y" { asn1p_constraint_t *ct; ct = asn1p_constraint_new(yylineno); checkmem(ct); ct->type = ACT_EL_VALUE; ct->value = asn1p_value_fromref((yyvsp[(3) - (3)].a_ref), 0); CONSTRAINT_INSERT((yyval.a_constr), ACT_CA_CSV, (yyvsp[(1) - (3)].a_constr), ct); } break; case 276: #line 2059 "asn1p_y.y" { char *p = malloc(strlen((yyvsp[(2) - (2)].tv_str)) + 2); int ret; *p = '@'; strcpy(p + 1, (yyvsp[(2) - (2)].tv_str)); (yyval.a_ref) = asn1p_ref_new(yylineno); ret = asn1p_ref_add_component((yyval.a_ref), p, 0); checkmem(ret == 0); free(p); free((yyvsp[(2) - (2)].tv_str)); } break; case 277: #line 2070 "asn1p_y.y" { char *p = malloc(strlen((yyvsp[(3) - (3)].tv_str)) + 3); int ret; p[0] = '@'; p[1] = '.'; strcpy(p + 2, (yyvsp[(3) - (3)].tv_str)); (yyval.a_ref) = asn1p_ref_new(yylineno); ret = asn1p_ref_add_component((yyval.a_ref), p, 0); checkmem(ret == 0); free(p); free((yyvsp[(3) - (3)].tv_str)); } break; case 278: #line 2086 "asn1p_y.y" { (yyval.tv_str) = (yyvsp[(1) - (1)].tv_str); } break; case 279: #line 2089 "asn1p_y.y" { int l1 = strlen((yyvsp[(1) - (3)].tv_str)); int l3 = strlen((yyvsp[(3) - (3)].tv_str)); (yyval.tv_str) = malloc(l1 + 1 + l3 + 1); memcpy((yyval.tv_str), (yyvsp[(1) - (3)].tv_str), l1); (yyval.tv_str)[l1] = '.'; memcpy((yyval.tv_str) + l1 + 1, (yyvsp[(3) - (3)].tv_str), l3); (yyval.tv_str)[l1 + 1 + l3] = '\0'; } break; case 280: #line 2107 "asn1p_y.y" { (yyval.a_marker).flags = EM_NOMARK; (yyval.a_marker).default_value = 0; } break; case 281: #line 2111 "asn1p_y.y" { (yyval.a_marker) = (yyvsp[(1) - (1)].a_marker); } break; case 282: #line 2115 "asn1p_y.y" { (yyval.a_marker).flags = EM_OPTIONAL | EM_INDIRECT; (yyval.a_marker).default_value = 0; } break; case 283: #line 2119 "asn1p_y.y" { (yyval.a_marker).flags = EM_DEFAULT; (yyval.a_marker).default_value = (yyvsp[(2) - (2)].a_value); } break; case 284: #line 2142 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); } break; case 285: #line 2146 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(2) - (3)].a_expr); } break; case 286: #line 2152 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); asn1p_expr_add((yyval.a_expr), (yyvsp[(1) - (1)].a_expr)); } break; case 287: #line 2157 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(1) - (3)].a_expr); asn1p_expr_add((yyval.a_expr), (yyvsp[(3) - (3)].a_expr)); } break; case 288: #line 2164 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); (yyval.a_expr)->expr_type = A1TC_UNIVERVAL; (yyval.a_expr)->meta_type = AMT_VALUE; (yyval.a_expr)->Identifier = (yyvsp[(1) - (1)].tv_str); } break; case 289: #line 2171 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); (yyval.a_expr)->expr_type = A1TC_UNIVERVAL; (yyval.a_expr)->meta_type = AMT_VALUE; (yyval.a_expr)->Identifier = (yyvsp[(1) - (4)].tv_str); (yyval.a_expr)->value = (yyvsp[(3) - (4)].a_value); } break; case 290: #line 2179 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); (yyval.a_expr)->expr_type = A1TC_UNIVERVAL; (yyval.a_expr)->meta_type = AMT_VALUE; (yyval.a_expr)->Identifier = (yyvsp[(1) - (4)].tv_str); (yyval.a_expr)->value = (yyvsp[(3) - (4)].a_value); } break; case 291: #line 2187 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); (yyval.a_expr)->expr_type = A1TC_UNIVERVAL; (yyval.a_expr)->meta_type = AMT_VALUE; (yyval.a_expr)->value = (yyvsp[(1) - (1)].a_value); } break; case 292: #line 2194 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); (yyval.a_expr)->Identifier = strdup("..."); checkmem((yyval.a_expr)->Identifier); (yyval.a_expr)->expr_type = A1TC_EXTENSIBLE; (yyval.a_expr)->meta_type = AMT_VALUE; } break; case 293: #line 2205 "asn1p_y.y" { (yyval.a_value) = asn1p_value_fromint((yyvsp[(1) - (1)].a_int)); checkmem((yyval.a_value)); } break; case 294: #line 2209 "asn1p_y.y" { (yyval.a_value) = asn1p_value_fromint((yyvsp[(1) - (1)].a_int)); checkmem((yyval.a_value)); } break; case 296: #line 2217 "asn1p_y.y" { (yyval.a_value) = asn1p_value_fromdouble((yyvsp[(1) - (1)].a_dbl)); checkmem((yyval.a_value)); } break; case 297: #line 2248 "asn1p_y.y" { memset(&(yyval.a_tag), 0, sizeof((yyval.a_tag))); } break; case 298: #line 2249 "asn1p_y.y" { (yyval.a_tag) = (yyvsp[(1) - (1)].a_tag); } break; case 299: #line 2253 "asn1p_y.y" { (yyval.a_tag) = (yyvsp[(1) - (2)].a_tag); (yyval.a_tag).tag_mode = (yyvsp[(2) - (2)].a_tag).tag_mode; } break; case 300: #line 2260 "asn1p_y.y" { (yyval.a_tag) = (yyvsp[(2) - (4)].a_tag); (yyval.a_tag).tag_value = (yyvsp[(3) - (4)].a_int); } break; case 301: #line 2266 "asn1p_y.y" { (yyval.a_tag).tag_class = TC_CONTEXT_SPECIFIC; } break; case 302: #line 2267 "asn1p_y.y" { (yyval.a_tag).tag_class = TC_UNIVERSAL; } break; case 303: #line 2268 "asn1p_y.y" { (yyval.a_tag).tag_class = TC_APPLICATION; } break; case 304: #line 2269 "asn1p_y.y" { (yyval.a_tag).tag_class = TC_PRIVATE; } break; case 305: #line 2273 "asn1p_y.y" { (yyval.a_tag).tag_mode = TM_DEFAULT; } break; case 306: #line 2274 "asn1p_y.y" { (yyval.a_tag).tag_mode = TM_IMPLICIT; } break; case 307: #line 2275 "asn1p_y.y" { (yyval.a_tag).tag_mode = TM_EXPLICIT; } break; case 308: #line 2279 "asn1p_y.y" { checkmem((yyvsp[(1) - (1)].tv_str)); (yyval.tv_str) = (yyvsp[(1) - (1)].tv_str); } break; case 309: #line 2283 "asn1p_y.y" { checkmem((yyvsp[(1) - (1)].tv_str)); (yyval.tv_str) = (yyvsp[(1) - (1)].tv_str); } break; case 310: #line 2291 "asn1p_y.y" { checkmem((yyvsp[(1) - (1)].tv_str)); (yyval.tv_str) = (yyvsp[(1) - (1)].tv_str); } break; case 311: #line 2298 "asn1p_y.y" { (yyval.tv_str) = 0; } break; case 312: #line 2299 "asn1p_y.y" { (yyval.tv_str) = (yyvsp[(1) - (1)].tv_str); } break; case 313: #line 2305 "asn1p_y.y" { checkmem((yyvsp[(1) - (1)].tv_str)); (yyval.tv_str) = (yyvsp[(1) - (1)].tv_str); } break; /* Line 1267 of yacc.c. */ #line 4799 "y.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; /*------------------------------------. | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); #else { YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) { YYSIZE_T yyalloc = 2 * yysize; if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) yyalloc = YYSTACK_ALLOC_MAXIMUM; if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); yymsg = (char *) YYSTACK_ALLOC (yyalloc); if (yymsg) yymsg_alloc = yyalloc; else { yymsg = yymsgbuf; yymsg_alloc = sizeof yymsgbuf; } } if (0 < yysize && yysize <= yymsg_alloc) { (void) yysyntax_error (yymsg, yystate, yychar); yyerror (yymsg); } else { yyerror (YY_("syntax error")); if (yysize != 0) goto yyexhaustedlab; } } #endif } if (yyerrstatus == 3) { /* If just tried and failed to reuse look-ahead token after an error, discard it. */ if (yychar <= YYEOF) { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; } else { yydestruct ("Error: discarding", yytoken, &yylval); yychar = YYEMPTY; } } /* Else will try to reuse look-ahead token after shifting the error token. */ goto yyerrlab1; /*---------------------------------------------------. | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: /* Pacify compilers like GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ if (/*CONSTCOND*/ 0) goto yyerrorlab; /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (yyn != YYPACT_NINF) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { yyn = yytable[yyn]; if (0 < yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) YYABORT; yydestruct ("Error: popping", yystos[yystate], yyvsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } if (yyn == YYFINAL) YYACCEPT; *++yyvsp = yylval; /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; #ifndef yyoverflow /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: yyerror (YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: if (yychar != YYEOF && yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", yystos[*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif #if YYERROR_VERBOSE if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif /* Make sure YYID is used. */ return YYID (yyresult); } #line 2311 "asn1p_y.y" /* * Convert Xstring ('0101'B or '5'H) to the binary vector. */ static asn1p_value_t * _convert_bitstring2binary(char *str, int base) { asn1p_value_t *val; int slen; int memlen; int baselen; int bits; uint8_t *binary_vector; uint8_t *bv_ptr; uint8_t cur_val; assert(str); assert(str[0] == '\''); switch(base) { case 'B': baselen = 1; break; case 'H': baselen = 4; break; default: assert(base == 'B' || base == 'H'); errno = EINVAL; return NULL; } slen = strlen(str); assert(str[slen - 1] == base); assert(str[slen - 2] == '\''); memlen = slen / (8 / baselen); /* Conservative estimate */ bv_ptr = binary_vector = malloc(memlen + 1); if(bv_ptr == NULL) /* ENOMEM */ return NULL; cur_val = 0; bits = 0; while(*(++str) != '\'') { switch(baselen) { case 1: switch(*str) { case '1': cur_val |= 1 << (7 - (bits % 8)); case '0': break; default: assert(!"_y UNREACH1"); case ' ': case '\r': case '\n': continue; } break; case 4: switch(*str) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': cur_val |= (*str - '0') << (4 - (bits % 8)); break; case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': cur_val |= ((*str - 'A') + 10) << (4 - (bits % 8)); break; default: assert(!"_y UNREACH2"); case ' ': case '\r': case '\n': continue; } break; } bits += baselen; if((bits % 8) == 0) { *bv_ptr++ = cur_val; cur_val = 0; } } *bv_ptr = cur_val; assert((bv_ptr - binary_vector) <= memlen); val = asn1p_value_frombits(binary_vector, bits, 0); if(val == NULL) { free(binary_vector); } return val; } /* * For unnamed types (used in old X.208 compliant modules) * generate some sort of interim names, to not to force human being to fix * the specification's compliance to modern ASN.1 standards. */ static void _fixup_anonymous_identifier(asn1p_expr_t *expr) { char *p; assert(expr->Identifier == 0); /* * Try to figure out the type name * without going too much into details */ expr->Identifier = ASN_EXPR_TYPE2STR(expr->expr_type); if(expr->reference && expr->reference->comp_count > 0) expr->Identifier = expr->reference->components[0].name; fprintf(stderr, "WARNING: Line %d: expected lower-case member identifier, " "found an unnamed %s.\n" "WARNING: Obsolete X.208 syntax detected, " "please give the member a name.\n", yylineno, expr->Identifier ? expr->Identifier : "type"); if(!expr->Identifier) expr->Identifier = "unnamed"; expr->Identifier = strdup(expr->Identifier); assert(expr->Identifier); /* Make a lowercase identifier from the type name */ for(p = expr->Identifier; *p; p++) { switch(*p) { case 'A' ... 'Z': *p += 32; break; case ' ': *p = '_'; break; case '-': *p = '_'; break; } } fprintf(stderr, "NOTE: Assigning temporary identifier \"%s\". " "Name clash may occur later.\n", expr->Identifier); } int yyerror(const char *msg) { extern char *asn1p_text; fprintf(stderr, "ASN.1 grammar parse error " "near line %d (token \"%s\"): %s\n", yylineno, asn1p_text, msg); return -1; } asn1c-0.9.28+dfsg/libasn1parser/asn1parser.c0000644000000000000000000000601013065714043017225 0ustar rootroot#include #include #include #include #include #include #include #include "asn1parser.h" #include "asn1p_list.h" int asn1p_parse(void **param); void *asn1p__scan_bytes(const char *, int len); void *asn1p__delete_buffer(void *); void *asn1p_restart(FILE *); extern int asn1p_lineno; static int _asn1p_set_flags(enum asn1p_flags flags); static int _asn1p_fix_modules(asn1p_t *a, const char *fname); /* * Parse the given buffer. */ asn1p_t * asn1p_parse_buffer(const char *buffer, int size /* = -1 */, enum asn1p_flags flags) { asn1p_t *a = 0; void *ap; void *ybuf; int ret; if(_asn1p_set_flags(flags)) { /* EINVAL */ return 0; } if(size < 0) size = (int)strlen(buffer); ybuf = asn1p__scan_bytes(buffer, size); if(!ybuf) { assert(ybuf); return 0; } asn1p_lineno = 1; ap = (void *)&a; ret = asn1p_parse(ap); asn1p__delete_buffer(ybuf); if(ret == 0) { assert(a); if(_asn1p_fix_modules(a, "-")) return NULL; /* FIXME: destroy (a) */ } else if(a) { asn1p_delete(a); a = NULL; } return a; } /* * Parse the file identified by its name. */ asn1p_t * asn1p_parse_file(const char *filename, enum asn1p_flags flags) { #ifndef _WIN32 struct stat sb; #endif asn1p_t *a = 0; void *ap; FILE *fp; int ret; if(_asn1p_set_flags(flags)) { /* EINVAL */ return 0; } fp = fopen(filename, "r"); if(fp == NULL) { perror(filename); return NULL; } #ifndef _WIN32 if(fstat(fileno(fp), &sb) || !S_ISREG(sb.st_mode)) { fclose(fp); fprintf(stderr, "%s file not recognized: Bad file format\n", filename); errno = EINVAL; return NULL; } #endif /* _WIN32 */ asn1p_lineno = 1; asn1p_restart(fp); ap = (void *)&a; ret = asn1p_parse(ap); fclose(fp); if(ret == 0) { assert(a); if(_asn1p_fix_modules(a, filename)) return NULL; /* FIXME: destroy (a) */ } else if(a) { asn1p_delete(a); a = NULL; } return a; } extern int asn1p_lexer_types_year; extern int asn1p_lexer_constructs_year; extern int asn1p__flex_debug; static int _asn1p_set_flags(enum asn1p_flags flags) { asn1p_lexer_types_year = 0; asn1p_lexer_constructs_year = 0; asn1p__flex_debug = 0; /* * Enable debugging in lexer. */ if(flags & A1P_LEXER_DEBUG) { flags &= ~A1P_LEXER_DEBUG; asn1p__flex_debug = 1; } /* * Check that we haven't missed an unknown flag. */ if(flags) { errno = EINVAL; return -1; } return 0; } static int _asn1p_fix_modules(asn1p_t *a, const char *fname) { asn1p_module_t *mod; TQ_FOR(mod, &(a->modules), mod_next) { mod->source_file_name = strdup(fname); if(mod->source_file_name == NULL) return -1; mod->asn1p = a; } return 0; } int asn1p_atoi(const char *ptr, asn1c_integer_t *value) { errno = 0; /* Clear the error code */ if(sizeof(*value) <= sizeof(int)) { *value = strtol(ptr, 0, 10); } else { #ifdef HAVE_STRTOIMAX *value = strtoimax(ptr, 0, 10); #elif HAVE_STRTOLL *value = strtoll(ptr, 0, 10); #else *value = strtol(ptr, 0, 10); #endif } return errno == 0 ? 0 : -1; } asn1c-0.9.28+dfsg/libasn1parser/asn1p_value.h0000644000000000000000000000437513065714043017405 0ustar rootroot/* * A generic value of different syntaxes. */ #ifndef ASN1_PARSER_VALUE_H #define ASN1_PARSER_VALUE_H struct asn1p_constraint_s; /* Forward declaration */ struct asn1p_expr_s; /* * A wrapper around various kinds of values. */ typedef struct asn1p_value_s { /* * The value of the element. */ enum { ATV_NOVALUE, ATV_TYPE, /* A type (as in CONTAINING Type) */ ATV_NULL, /* A "NULL" value of type NULL. */ ATV_REAL, /* A constant floating-point value */ ATV_INTEGER, /* An integer constant */ ATV_MAX, ATV_MIN, ATV_TRUE, ATV_FALSE, ATV_TUPLE, /* { 1, 15 } */ ATV_QUADRUPLE, /* { 0, 14, 0, 255 } */ ATV_STRING, /* "abcdef" */ ATV_UNPARSED, ATV_BITVECTOR, ATV_VALUESET, /* { 1 | 2 | 3 } */ ATV_REFERENCED, /* Reference to a value defined elsewhere */ ATV_CHOICE_IDENTIFIER, /* ChoiceIdentifier value */ } type; /* Value type and location */ union { struct asn1p_constraint_s *constraint; /* ValueSet */ struct asn1p_expr_s *v_type; /* Type */ asn1p_ref_t *reference; asn1c_integer_t v_integer; double v_double; /* * Binary bits vector. */ struct { uint8_t *buf; int size; } string; struct { uint8_t *bits; int size_in_bits; } binary_vector; struct { char *identifier; struct asn1p_value_s *value; } choice_identifier; } value; } asn1p_value_t; /* * Destructor and constructors for value. * If ref, bits or buffer are omitted, the corresponding function returns * (asn1p_value_t *)0 with errno = EINVAL. * Allocated value (where applicable) is guaranteed to be NUL-terminated. */ void asn1p_value_free(asn1p_value_t *); asn1p_value_t *asn1p_value_fromref(asn1p_ref_t *ref, int do_copy); asn1p_value_t *asn1p_value_fromconstr(struct asn1p_constraint_s *ct, int dc); asn1p_value_t *asn1p_value_frombits(uint8_t *bits, int size_in_bits, int dc); asn1p_value_t *asn1p_value_frombuf(char *buffer, int size, int do_copy); asn1p_value_t *asn1p_value_fromdouble(double); asn1p_value_t *asn1p_value_fromint(asn1c_integer_t); asn1p_value_t *asn1p_value_fromtype(struct asn1p_expr_s *); asn1p_value_t *asn1p_value_clone(asn1p_value_t *); asn1p_value_t *asn1p_value_clone_with_resolver(asn1p_value_t *, asn1p_value_t *(*resolver)(asn1p_value_t *, void *rarg), void *rarg); #endif /* ASN1_PARSER_VALUE_H */ asn1c-0.9.28+dfsg/libasn1parser/asn1p_l.c0000644000000000000000000046633113065714043016523 0ustar rootroot#line 2 "lex.yy.c" #line 4 "lex.yy.c" #define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ /* %not-for-header */ /* %if-c-only */ /* %if-not-reentrant */ #define yy_create_buffer asn1p__create_buffer #define yy_delete_buffer asn1p__delete_buffer #define yy_flex_debug asn1p__flex_debug #define yy_init_buffer asn1p__init_buffer #define yy_flush_buffer asn1p__flush_buffer #define yy_load_buffer_state asn1p__load_buffer_state #define yy_switch_to_buffer asn1p__switch_to_buffer #define yyin asn1p_in #define yyleng asn1p_leng #define yylex asn1p_lex #define yylineno asn1p_lineno #define yyout asn1p_out #define yyrestart asn1p_restart #define yytext asn1p_text #define yywrap asn1p_wrap #define yyalloc asn1p_alloc #define yyrealloc asn1p_realloc #define yyfree asn1p_free /* %endif */ /* %endif */ /* %ok-for-header */ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 #define YY_FLEX_SUBMINOR_VERSION 35 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif /* %if-c++-only */ /* %endif */ /* %if-c-only */ /* %endif */ /* %if-c-only */ /* %endif */ /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ /* %if-c-only */ #include #include #include #include /* %endif */ /* %if-tables-serialization */ /* %endif */ /* end standard C headers. */ /* %if-c-or-c++ */ /* flex integer type definitions */ #ifndef FLEXINT_H #define FLEXINT_H /* C99 systems have . Non-C99 systems may or may not. */ #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, * if you want the limit (max/min) macros for int types. */ #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS 1 #endif #include typedef int8_t flex_int8_t; typedef uint8_t flex_uint8_t; typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; #endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN #define INT8_MIN (-128) #endif #ifndef INT16_MIN #define INT16_MIN (-32767-1) #endif #ifndef INT32_MIN #define INT32_MIN (-2147483647-1) #endif #ifndef INT8_MAX #define INT8_MAX (127) #endif #ifndef INT16_MAX #define INT16_MAX (32767) #endif #ifndef INT32_MAX #define INT32_MAX (2147483647) #endif #ifndef UINT8_MAX #define UINT8_MAX (255U) #endif #ifndef UINT16_MAX #define UINT16_MAX (65535U) #endif #ifndef UINT32_MAX #define UINT32_MAX (4294967295U) #endif #endif /* ! FLEXINT_H */ /* %endif */ /* %if-c++-only */ /* %endif */ #ifdef __cplusplus /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST #else /* ! __cplusplus */ /* C99 requires __STDC__ to be defined as 1. */ #if defined (__STDC__) #define YY_USE_CONST #endif /* defined (__STDC__) */ #endif /* ! __cplusplus */ #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif /* %not-for-header */ /* Returned upon end-of-file. */ #define YY_NULL 0 /* %ok-for-header */ /* %not-for-header */ /* Promotes a possibly negative, possibly signed char to an unsigned * integer for use as an array index. If the signed char is negative, * we want to instead treat it as an 8-bit unsigned char, hence the * double cast. */ #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* %ok-for-header */ /* %if-reentrant */ /* %endif */ /* %if-not-reentrant */ /* %endif */ /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN (yy_start) = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ #define YY_NEW_FILE asn1p_restart(asn1p_in ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #ifndef YY_BUF_SIZE #define YY_BUF_SIZE 16384 #endif /* The state buf must be large enough to hold one state per character in the main buffer. */ #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) #ifndef YY_TYPEDEF_YY_BUFFER_STATE #define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef size_t yy_size_t; #endif /* %if-not-reentrant */ extern yy_size_t asn1p_leng; /* %endif */ /* %if-c-only */ /* %if-not-reentrant */ extern FILE *asn1p_in, *asn1p_out; /* %endif */ /* %endif */ #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires * access to the local variable yy_act. Since yyless() is a macro, it would break * existing scanners that call yyless() from OUTSIDE asn1p_lex. * One obvious solution it to make yy_act a global. I tried that, and saw * a 5% performance hit in a non-asn1p_lineno scanner, because yy_act is * normally declared as a register variable-- so it is not worth it. */ #define YY_LESS_LINENO(n) \ do { \ yy_size_t yyl;\ for ( yyl = n; yyl < asn1p_leng; ++yyl )\ if ( asn1p_text[yyl] == '\n' )\ --asn1p_lineno;\ }while(0) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up asn1p_text. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up asn1p_text again */ \ } \ while ( 0 ) #define unput(c) yyunput( c, (yytext_ptr) ) #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state { /* %if-c-only */ FILE *yy_input_file; /* %endif */ /* %if-c++-only */ /* %endif */ char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ yy_size_t yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ yy_size_t yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to * delete it. */ int yy_is_our_buffer; /* Whether this is an "interactive" input source; if so, and * if we're using stdio for input, then we want to use getc() * instead of fread(), to make sure we stop fetching input after * each newline. */ int yy_is_interactive; /* Whether we're considered to be at the beginning of a line. * If so, '^' rules will be active on the next match, otherwise * not. */ int yy_at_bol; int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process * then we mark the buffer as YY_EOF_PENDING, to indicate that we * shouldn't try reading from the input source any more. We might * still have a bunch of tokens to match, though, because of * possible backing-up. * * When we actually see the EOF, we change the status to "new" * (via asn1p_restart()), so that the user can continue scanning by * just pointing asn1p_in at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ /* %if-c-only Standard (non-C++) definition */ /* %not-for-header */ /* %if-not-reentrant */ /* Stack of input buffers. */ static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* %endif */ /* %ok-for-header */ /* %endif */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". * * Returns the top of the stack, or NULL. */ #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ : NULL) /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] /* %if-c-only Standard (non-C++) definition */ /* %if-not-reentrant */ /* %not-for-header */ /* yy_hold_char holds the character lost when asn1p_text is formed. */ static char yy_hold_char; static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ yy_size_t asn1p_leng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* Flag which is used to allow asn1p_wrap()'s to do buffer switches * instead of setting up a fresh asn1p_in. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; /* %ok-for-header */ /* %endif */ void asn1p_restart (FILE *input_file ); void asn1p__switch_to_buffer (YY_BUFFER_STATE new_buffer ); YY_BUFFER_STATE asn1p__create_buffer (FILE *file,int size ); void asn1p__delete_buffer (YY_BUFFER_STATE b ); void asn1p__flush_buffer (YY_BUFFER_STATE b ); void asn1p_push_buffer_state (YY_BUFFER_STATE new_buffer ); void asn1p_pop_buffer_state (void ); static void asn1p_ensure_buffer_stack (void ); static void asn1p__load_buffer_state (void ); static void asn1p__init_buffer (YY_BUFFER_STATE b,FILE *file ); #define YY_FLUSH_BUFFER asn1p__flush_buffer(YY_CURRENT_BUFFER ) YY_BUFFER_STATE asn1p__scan_buffer (char *base,yy_size_t size ); YY_BUFFER_STATE asn1p__scan_string (yyconst char *yy_str ); YY_BUFFER_STATE asn1p__scan_bytes (yyconst char *bytes,yy_size_t len ); /* %endif */ void *asn1p_alloc (yy_size_t ); void *asn1p_realloc (void *,yy_size_t ); void asn1p_free (void * ); #define yy_new_buffer asn1p__create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ asn1p_ensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ asn1p__create_buffer(asn1p_in,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ asn1p_ensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ asn1p__create_buffer(asn1p_in,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* %% [1.0] asn1p_text/asn1p_in/asn1p_out/yy_state_type/asn1p_lineno etc. def's & init go here */ /* Begin user sect3 */ #define asn1p_wrap(n) 1 #define YY_SKIP_YYWRAP #define FLEX_DEBUG typedef unsigned char YY_CHAR; FILE *asn1p_in = (FILE *) 0, *asn1p_out = (FILE *) 0; typedef int yy_state_type; extern int asn1p_lineno; int asn1p_lineno = 1; extern char *asn1p_text; #define yytext_ptr asn1p_text /* %if-c-only Standard (non-C++) definition */ static yy_state_type yy_get_previous_state (void ); static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); static int yy_get_next_buffer (void ); static void yy_fatal_error (yyconst char msg[] ); /* %endif */ /* Done after the current pattern has been matched and before the * corresponding action - sets up asn1p_text. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ /* %% [2.0] code to fiddle asn1p_text and asn1p_leng for yymore() goes here \ */\ asn1p_leng = (yy_size_t) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ /* %% [3.0] code to copy yytext_ptr to asn1p_text[] goes here, if %array \ */\ (yy_c_buf_p) = yy_cp; /* %% [4.0] data tables for the DFA and the user's section 1 definitions go here */ #define YY_NUM_RULES 140 #define YY_END_OF_BUFFER 141 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info { flex_int32_t yy_verify; flex_int32_t yy_nxt; }; static yyconst flex_int16_t yy_acclist[1272] = { 0, 141, 139, 140, 132, 139, 140, 132, 140, 137, 139, 140, 19, 139, 140, 137, 139, 140, 139, 140, 137, 139, 140, 139, 140, 139, 140, 137, 139, 140, 139, 140, 33, 139, 140, 32, 139, 140, 137, 139, 140, 139, 140, 120, 121, 139, 140, 120, 121, 139, 140, 120, 121, 139, 140, 120, 121, 139, 140, 120, 121, 139, 140, 120, 121, 139, 140, 120, 121, 139, 140, 120, 121, 139, 140, 120, 121, 139, 140, 120, 121, 139, 140, 120, 121, 139, 140, 120, 121, 139, 140, 120, 121, 139, 140, 120, 121, 139, 140, 120, 121, 139, 140, 120, 121, 139, 140, 120, 121, 139, 140, 120, 121, 139, 140, 120, 121, 139, 140, 137, 139, 140, 137, 139, 140, 119, 139, 140, 137, 139, 140, 9, 139, 140, 6, 140, 6, 139, 140, 8, 139, 140, 8, 139, 140, 11, 13, 139, 140, 11, 140, 13, 139, 140, 13, 139, 140, 13, 139, 140, 21, 139, 140, 21, 140, 22, 139, 140, 16, 139, 140, 16, 140, 18, 139, 140, 18, 139, 140, 14, 139, 140, 15, 139, 140, 25, 27, 139, 140, 27, 139, 140, 28, 140, 25, 26, 27, 139, 140, 25, 26, 27, 139, 140, 130, 139, 140, 130, 140, 139, 140, 126, 139, 140, 139, 140, 139, 140, 125, 139, 140, 128, 139, 140, 129, 139, 140, 127, 139, 140, 131, 139, 140, 132, 19, 19, 117, 118, 5, 31, 124, 10, 34, 32, 34, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 121, 120, 121, 120, 121, 120, 121, 120, 121, 44, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 121, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 121, 120, 121, 120, 121, 89, 120, 121, 120, 121, 121, 120, 121, 120, 121, 120, 121, 120, 121, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 121, 120, 121, 120, 121, 121, 121, 120, 121, 135, 136, 119, 9, 7, 7, 12, 21, 20, 16, 25, 25, 26, 25, 26, 130, 5, 125, 138, 117, 118, 31, 34, 123, 34, 122, 120, 121, 121, 120, 121, 36, 120, 121, 37, 120, 121, 120, 121, 120, 121, 120, 121, 41, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 58, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 121, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 81, 120, 121, 82, 120, 121, 120, 121, 121, 120, 121, 120, 121, 120, 121, 121, 120, 121, 92, 120, 121, 120, 121, 120, 121, 120, 121, 121, 120, 121, 120, 121, 120, 121, 100, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 121, 120, 121, 120, 121, 120, 121, 121, 121, 121, 120, 121, 119, 3, 17, 25, 26, 24, 25, 26, 125, 117, 118, 30, 29, 2, 1, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 66, 120, 121, 121, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 84, 120, 121, 121, 120, 121, 120, 121, 120, 121, 121, 120, 121, 120, 121, 120, 121, 120, 121, 121, 97, 120, 121, 120, 121, 120, 121, 101, 120, 121, 120, 121, 120, 121, 120, 121, 105, 120, 121, 107, 120, 121, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 121, 121, 121, 116, 120, 121, 3, 25, 26, 120, 121, 120, 121, 120, 121, 40, 120, 121, 121, 120, 121, 120, 121, 120, 121, 47, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 65, 120, 121, 121, 121, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 121, 120, 121, 88, 120, 121, 120, 121, 121, 120, 121, 120, 121, 120, 121, 121, 120, 121, 120, 121, 120, 121, 120, 121, 121, 121, 108, 120, 121, 120, 121, 120, 121, 121, 120, 121, 121, 121, 121, 133, 25, 26, 35, 120, 121, 120, 121, 120, 121, 121, 120, 121, 120, 121, 46, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 60, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 121, 121, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 121, 86, 120, 121, 120, 121, 121, 120, 121, 120, 121, 120, 121, 120, 121, 121, 120, 121, 120, 121, 102, 120, 121, 103, 120, 121, 121, 121, 109, 120, 121, 120, 121, 121, 121, 121, 121, 121, 25, 26, 120, 121, 120, 121, 121, 43, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 52, 120, 121, 53, 120, 121, 120, 121, 120, 121, 56, 120, 121, 120, 121, 120, 121, 120, 121, 62, 120, 121, 120, 121, 120, 121, 121, 121, 121, 120, 121, 120, 121, 73, 120, 121, 74, 120, 121, 120, 121, 120, 121, 120, 121, 78, 120, 121, 120, 121, 120, 121, 120, 121, 121, 120, 121, 121, 91, 120, 121, 120, 121, 94, 120, 121, 96, 120, 121, 121, 120, 121, 120, 121, 121, 121, 120, 121, 112, 121, 121, 121, 121, 121, 25, 26, 120, 121, 120, 121, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 55, 120, 121, 120, 121, 120, 121, 61, 120, 121, 120, 121, 64, 120, 121, 121, 121, 121, 121, 120, 121, 72, 120, 121, 75, 120, 121, 76, 120, 121, 120, 121, 120, 121, 121, 120, 121, 121, 90, 120, 121, 121, 120, 121, 121, 120, 121, 99, 120, 121, 121, 121, 120, 121, 121, 121, 121, 121, 25, 26, 120, 121, 39, 120, 121, 42, 121, 45, 120, 121, 48, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 120, 121, 121, 121, 121, 70, 121, 120, 121, 120, 121, 120, 121, 121, 120, 121, 121, 121, 120, 121, 121, 104, 121, 121, 110, 120, 121, 121, 121, 121, 121, 134, 25, 120, 121, 49, 120, 121, 120, 121, 51, 120, 121, 120, 121, 120, 121, 59, 120, 121, 120, 121, 121, 121, 121, 71, 120, 121, 120, 121, 120, 121, 121, 120, 121, 121, 121, 120, 121, 121, 120, 121, 121, 113, 121, 121, 121, 121, 25, 38, 120, 121, 50, 120, 121, 54, 120, 121, 120, 121, 120, 121, 121, 121, 121, 120, 121, 120, 121, 121, 120, 121, 121, 121, 120, 121, 121, 120, 121, 121, 121, 121, 121, 25, 120, 121, 120, 121, 121, 121, 121, 77, 120, 121, 79, 120, 121, 80, 121, 120, 121, 121, 121, 120, 121, 121, 98, 120, 121, 121, 121, 121, 121, 25, 120, 121, 63, 120, 121, 68, 121, 121, 69, 121, 120, 121, 85, 121, 121, 93, 120, 121, 121, 106, 121, 121, 121, 115, 121, 25, 120, 121, 121, 83, 120, 121, 121, 121, 121, 114, 121, 25, 120, 121, 67, 121, 121, 95, 121, 111, 121, 25, 57, 120, 121, 87, 121, 23, 25, 4 } ; static yyconst flex_int16_t yy_accept[747] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 7, 9, 12, 15, 18, 20, 23, 25, 27, 30, 32, 35, 38, 41, 43, 47, 51, 55, 59, 63, 67, 71, 75, 79, 83, 87, 91, 95, 99, 103, 107, 111, 115, 119, 122, 125, 128, 131, 134, 136, 139, 142, 145, 149, 151, 154, 157, 160, 163, 165, 168, 171, 173, 176, 179, 182, 185, 189, 192, 194, 199, 204, 207, 209, 211, 214, 216, 218, 221, 224, 227, 230, 233, 233, 234, 235, 236, 236, 237, 237, 238, 238, 238, 238, 239, 240, 241, 242, 242, 243, 243, 245, 245, 245, 247, 249, 251, 253, 255, 257, 258, 260, 262, 264, 266, 269, 271, 273, 275, 277, 279, 281, 283, 285, 287, 288, 289, 291, 293, 295, 297, 299, 301, 303, 305, 306, 308, 310, 313, 315, 316, 318, 320, 322, 324, 325, 327, 329, 331, 333, 335, 337, 339, 341, 342, 344, 346, 347, 348, 350, 351, 352, 352, 353, 353, 353, 353, 354, 355, 356, 357, 358, 359, 360, 360, 361, 363, 365, 366, 367, 367, 368, 369, 369, 369, 370, 370, 371, 371, 371, 371, 371, 373, 374, 375, 375, 376, 378, 379, 381, 384, 387, 389, 391, 391, 393, 396, 398, 400, 402, 404, 406, 408, 410, 412, 414, 416, 419, 421, 423, 425, 427, 429, 431, 432, 433, 435, 437, 439, 441, 443, 445, 447, 450, 453, 455, 456, 458, 460, 462, 463, 465, 468, 470, 472, 474, 475, 477, 479, 481, 484, 486, 488, 490, 492, 494, 496, 497, 499, 501, 503, 504, 505, 506, 508, 509, 509, 509, 510, 511, 513, 516, 517, 517, 518, 519, 520, 521, 522, 523, 523, 523, 523, 525, 527, 529, 531, 533, 535, 537, 539, 541, 543, 545, 547, 549, 551, 553, 555, 557, 559, 561, 563, 565, 567, 570, 571, 572, 574, 576, 578, 580, 582, 584, 586, 588, 590, 593, 594, 596, 598, 600, 601, 603, 605, 607, 609, 610, 613, 615, 617, 620, 622, 624, 626, 629, 632, 633, 635, 637, 639, 641, 643, 644, 645, 646, 649, 649, 649, 649, 649, 650, 652, 652, 654, 656, 658, 661, 662, 664, 666, 668, 671, 673, 675, 677, 679, 681, 683, 685, 687, 689, 691, 693, 695, 697, 700, 701, 702, 703, 705, 707, 709, 711, 713, 715, 717, 719, 721, 723, 724, 726, 729, 731, 732, 734, 734, 736, 738, 739, 741, 743, 745, 747, 748, 749, 752, 754, 756, 757, 759, 760, 761, 762, 762, 762, 763, 765, 765, 768, 770, 772, 773, 775, 777, 780, 782, 784, 786, 788, 790, 792, 794, 796, 798, 800, 803, 805, 807, 809, 811, 812, 813, 814, 816, 818, 820, 822, 824, 826, 828, 830, 832, 834, 834, 835, 838, 840, 841, 843, 845, 847, 849, 850, 852, 854, 857, 860, 861, 862, 865, 867, 868, 869, 870, 871, 872, 872, 872, 874, 874, 876, 878, 879, 882, 884, 886, 888, 890, 893, 896, 898, 900, 903, 905, 907, 909, 912, 914, 916, 917, 918, 919, 921, 923, 926, 929, 931, 933, 935, 938, 940, 942, 944, 945, 947, 948, 951, 953, 956, 959, 960, 962, 964, 965, 966, 968, 970, 971, 972, 973, 974, 974, 976, 976, 978, 980, 981, 983, 985, 987, 989, 991, 994, 996, 998, 1001, 1003, 1006, 1007, 1008, 1009, 1010, 1012, 1015, 1018, 1021, 1023, 1025, 1026, 1028, 1029, 1032, 1033, 1035, 1036, 1038, 1041, 1042, 1043, 1045, 1046, 1047, 1048, 1049, 1049, 1049, 1051, 1051, 1053, 1056, 1058, 1061, 1064, 1066, 1068, 1070, 1070, 1072, 1074, 1075, 1076, 1077, 1079, 1081, 1083, 1085, 1086, 1088, 1089, 1090, 1092, 1093, 1093, 1095, 1096, 1099, 1100, 1101, 1102, 1103, 1103, 1104, 1105, 1105, 1107, 1110, 1112, 1115, 1117, 1119, 1122, 1124, 1125, 1126, 1127, 1130, 1132, 1134, 1135, 1137, 1138, 1139, 1141, 1142, 1144, 1145, 1147, 1148, 1149, 1150, 1151, 1151, 1154, 1157, 1160, 1162, 1164, 1165, 1166, 1167, 1169, 1171, 1172, 1174, 1175, 1176, 1178, 1179, 1181, 1182, 1183, 1184, 1185, 1186, 1186, 1188, 1190, 1191, 1192, 1193, 1196, 1199, 1201, 1203, 1204, 1205, 1207, 1208, 1211, 1212, 1213, 1214, 1215, 1216, 1216, 1218, 1221, 1223, 1224, 1226, 1228, 1230, 1231, 1234, 1235, 1237, 1238, 1239, 1241, 1242, 1242, 1244, 1245, 1248, 1249, 1250, 1251, 1253, 1254, 1254, 1256, 1258, 1259, 1261, 1263, 1264, 1264, 1267, 1269, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1272, 1272 } ; static yyconst flex_int32_t yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 4, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 6, 7, 1, 1, 1, 8, 9, 10, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 19, 23, 24, 25, 26, 27, 28, 29, 1, 10, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 1, 57, 58, 1, 1, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 64, 69, 70, 71, 72, 73, 64, 74, 75, 76, 77, 78, 64, 79, 64, 80, 81, 82, 83, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; static yyconst flex_int32_t yy_meta[84] = { 0, 1, 2, 3, 4, 4, 1, 5, 1, 6, 1, 1, 1, 1, 7, 1, 1, 8, 8, 8, 8, 8, 8, 8, 8, 9, 1, 1, 9, 1, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 1, 1, 1, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 1, 13 } ; static yyconst flex_int16_t yy_base[772] = { 0, 0, 0, 81, 84, 87, 99, 94, 96, 93, 108, 91, 103, 186, 269, 352, 0, 1666, 1656, 130, 138, 1650, 1648, 427, 146, 4507, 158, 207, 1640, 109, 230, 493, 1629, 4507, 543, 268, 115, 274, 289, 488, 593, 191, 599, 509, 215, 491, 621, 406, 638, 655, 658, 678, 689, 1596, 100, 1634, 733, 0, 4507, 4507, 1632, 1631, 4507, 4507, 1628, 1632, 4507, 0, 0, 1630, 0, 0, 1608, 4507, 4507, 4507, 0, 4507, 4507, 757, 839, 122, 166, 127, 4507, 1615, 1616, 1612, 4507, 4507, 4507, 4507, 1613, 201, 0, 1611, 1606, 1596, 96, 1595, 656, 1594, 772, 103, 807, 1584, 4507, 839, 857, 886, 907, 1569, 912, 681, 757, 892, 903, 909, 962, 1581, 963, 978, 979, 994, 1000, 1016, 1022, 1033, 1046, 1049, 1069, 1066, 1077, 1090, 147, 79, 1105, 1108, 1116, 1131, 1142, 1153, 1159, 1170, 169, 1183, 1186, 1199, 1207, 94, 1210, 1223, 1234, 1247, 152, 1263, 1269, 1280, 1286, 1297, 1308, 1314, 1325, 193, 1331, 1347, 194, 226, 1346, 4507, 4507, 0, 1579, 757, 943, 1381, 0, 4507, 1578, 4507, 0, 4507, 0, 1558, 0, 1541, 257, 333, 4507, 0, 1568, 4507, 1565, 0, 1561, 0, 1554, 186, 1529, 252, 143, 1391, 4507, 866, 894, 4507, 1441, 1550, 1385, 1386, 1401, 1402, 1417, 1549, 1425, 1428, 1441, 1449, 1491, 1492, 1508, 1509, 1524, 1540, 1546, 1557, 1563, 1574, 1580, 1591, 1597, 1608, 1619, 196, 272, 1632, 1640, 1643, 1658, 1661, 1664, 1690, 1682, 1693, 1706, 224, 1714, 1727, 1735, 277, 1738, 1751, 1759, 1767, 1775, 438, 1788, 1791, 1799, 1812, 1820, 1828, 1836, 1849, 1857, 1870, 506, 1878, 1894, 1895, 470, 507, 249, 1910, 1548, 1954, 1962, 1547, 4507, 285, 1517, 1543, 1491, 1533, 1532, 4507, 4507, 4507, 4507, 436, 207, 1497, 1956, 1957, 1972, 1978, 1989, 1995, 2011, 2012, 2027, 2035, 2043, 2059, 2056, 2067, 2080, 2083, 2098, 2104, 2115, 2121, 2132, 2147, 2153, 469, 535, 2164, 2170, 2185, 2186, 2201, 2207, 2222, 2225, 2233, 2246, 554, 2254, 2257, 2270, 510, 2278, 2291, 2299, 2307, 523, 2315, 2323, 2336, 2344, 2347, 2365, 2362, 2368, 2383, 617, 2386, 2389, 2406, 2412, 2423, 612, 528, 631, 2439, 2473, 2496, 2519, 2531, 1530, 271, 1500, 2515, 2530, 2546, 2543, 623, 2564, 2567, 2570, 2585, 2588, 2596, 2609, 2617, 2630, 2641, 2647, 2658, 2669, 2684, 2690, 2701, 2707, 2722, 611, 613, 632, 2723, 2743, 2740, 2761, 2760, 2776, 2782, 2793, 2806, 2817, 643, 2814, 2830, 2838, 639, 2846, 309, 2854, 2867, 619, 2880, 2883, 2891, 2904, 668, 621, 2915, 2921, 2932, 634, 2943, 727, 641, 625, 816, 2987, 4507, 303, 1513, 2971, 2987, 2984, 649, 2995, 3008, 3011, 3028, 3034, 3045, 3051, 3066, 3072, 3089, 3095, 3106, 3112, 3123, 3129, 3140, 3146, 3162, 730, 511, 676, 3163, 3178, 3184, 3195, 3201, 3216, 3222, 3233, 3248, 3254, 711, 783, 3265, 3281, 700, 3278, 1486, 3289, 3302, 809, 3310, 3325, 3328, 3331, 878, 732, 3346, 3349, 880, 734, 636, 905, 933, 3398, 3410, 1485, 1494, 3364, 3404, 733, 3405, 3422, 3421, 3437, 3438, 3453, 3454, 3469, 3475, 3486, 3492, 3503, 3514, 3525, 3531, 3542, 984, 789, 822, 3548, 3559, 3570, 3576, 3587, 3593, 3608, 3609, 3624, 3630, 1482, 795, 3641, 937, 3647, 1489, 3658, 3664, 802, 3679, 3685, 887, 988, 3701, 1479, 981, 955, 918, 1001, 3735, 101, 0, 3729, 3730, 1003, 3745, 3753, 3756, 3769, 3777, 3785, 3793, 3806, 3814, 3822, 3830, 925, 1002, 1012, 1004, 3843, 3851, 3854, 3867, 3875, 3878, 1019, 1453, 1028, 3891, 1020, 1443, 1016, 3912, 3899, 1040, 1041, 3915, 1042, 1056, 1089, 1048, 3964, 1381, 1109, 1432, 3930, 3948, 1463, 3959, 3965, 3980, 3981, 3996, 514, 4002, 4013, 1070, 1114, 1071, 1443, 4019, 4030, 4041, 1115, 1415, 1142, 1127, 1406, 1116, 798, 1427, 1151, 4047, 1124, 1157, 1092, 1193, 1493, 4507, 1408, 1376, 4058, 4064, 4079, 4080, 4095, 1374, 4096, 4111, 1156, 1129, 1179, 4117, 4128, 4139, 1161, 1309, 1194, 1196, 1303, 1204, 1299, 1205, 1320, 1207, 1225, 1220, 1238, 1126, 4145, 4156, 4162, 1154, 4173, 1198, 1118, 1231, 4184, 4190, 1233, 1157, 1249, 1229, 1120, 1248, 1127, 1272, 1287, 1257, 1275, 1111, 1012, 1024, 4205, 1244, 1277, 1289, 4206, 4221, 1057, 1009, 1302, 1164, 986, 1281, 0, 1357, 1293, 1349, 1359, 906, 886, 891, 4222, 922, 1262, 824, 780, 819, 1407, 0, 1366, 818, 1379, 1409, 803, 763, 483, 511, 1424, 0, 1393, 1420, 1462, 539, 501, 481, 489, 441, 1291, 440, 434, 405, 374, 0, 430, 0, 367, 412, 363, 304, 272, 276, 262, 231, 172, 159, 319, 711, 115, 100, 4507, 4507, 4272, 4285, 4298, 4311, 4324, 4337, 4349, 4353, 4364, 4377, 4390, 4401, 4412, 4417, 4422, 4427, 4431, 4436, 4440, 4444, 4448, 4452, 4463, 4470, 4481, 4493 } ; static yyconst flex_int16_t yy_def[772] = { 0, 745, 1, 746, 746, 746, 746, 747, 747, 748, 748, 749, 749, 750, 750, 745, 15, 745, 745, 745, 745, 745, 751, 745, 752, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 745, 745, 753, 745, 754, 745, 745, 745, 745, 745, 745, 745, 745, 745, 755, 755, 745, 756, 756, 745, 745, 745, 745, 757, 745, 745, 758, 758, 745, 745, 23, 745, 745, 745, 759, 745, 745, 745, 745, 745, 745, 751, 751, 745, 760, 745, 761, 752, 752, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 762, 34, 34, 34, 34, 34, 34, 763, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 763, 763, 34, 34, 34, 34, 34, 34, 34, 34, 763, 34, 34, 34, 34, 763, 34, 34, 34, 34, 763, 34, 34, 34, 34, 34, 34, 34, 34, 763, 34, 34, 763, 763, 34, 745, 745, 764, 753, 745, 745, 745, 754, 745, 745, 745, 755, 745, 756, 745, 757, 80, 80, 745, 745, 765, 759, 745, 745, 766, 760, 767, 761, 745, 745, 768, 745, 745, 745, 745, 745, 745, 762, 769, 34, 34, 34, 34, 34, 769, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 763, 763, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 763, 34, 34, 34, 763, 34, 34, 34, 34, 34, 763, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 763, 34, 34, 34, 763, 763, 763, 34, 764, 745, 745, 745, 745, 80, 80, 765, 745, 766, 767, 745, 745, 745, 745, 768, 745, 745, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 763, 763, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 763, 34, 34, 34, 763, 34, 34, 34, 34, 763, 34, 34, 34, 34, 34, 34, 34, 34, 34, 763, 34, 34, 34, 34, 34, 763, 763, 763, 34, 745, 745, 745, 745, 745, 80, 745, 34, 34, 34, 34, 763, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 763, 763, 763, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 763, 34, 34, 34, 763, 34, 206, 34, 34, 763, 34, 34, 34, 34, 763, 763, 34, 34, 34, 763, 34, 763, 763, 763, 745, 745, 745, 80, 745, 34, 34, 34, 763, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 763, 763, 763, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 206, 763, 34, 34, 763, 34, 206, 34, 34, 763, 34, 34, 34, 34, 763, 763, 34, 34, 763, 763, 763, 763, 763, 745, 745, 80, 745, 34, 34, 763, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 763, 763, 763, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 206, 763, 34, 763, 34, 206, 34, 34, 763, 34, 34, 763, 763, 34, 763, 763, 763, 763, 763, 745, 80, 770, 34, 34, 763, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 763, 763, 763, 763, 34, 34, 34, 34, 34, 34, 763, 206, 763, 34, 763, 206, 763, 34, 34, 763, 763, 34, 763, 763, 763, 763, 745, 771, 80, 745, 34, 34, 763, 34, 34, 34, 34, 34, 206, 34, 34, 763, 763, 763, 763, 34, 34, 34, 763, 206, 763, 763, 206, 763, 206, 763, 763, 34, 763, 763, 763, 763, 745, 745, 757, 745, 34, 34, 34, 34, 34, 206, 34, 34, 763, 763, 763, 34, 34, 34, 763, 206, 763, 763, 206, 763, 206, 763, 763, 763, 763, 763, 757, 745, 34, 34, 34, 206, 34, 763, 763, 763, 34, 34, 763, 206, 763, 763, 206, 763, 206, 763, 763, 763, 763, 757, 745, 206, 34, 763, 763, 763, 34, 34, 763, 206, 763, 763, 206, 763, 206, 763, 763, 763, 763, 757, 745, 206, 34, 763, 763, 763, 206, 763, 763, 206, 763, 763, 763, 763, 763, 757, 745, 206, 763, 206, 763, 763, 763, 763, 757, 745, 206, 763, 763, 763, 763, 757, 745, 206, 763, 757, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 0, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745 } ; static yyconst flex_int16_t yy_nxt[4591] = { 0, 18, 19, 20, 19, 19, 21, 22, 23, 24, 25, 18, 26, 25, 27, 28, 29, 30, 31, 31, 31, 31, 31, 31, 31, 32, 21, 33, 33, 18, 34, 35, 36, 37, 38, 39, 40, 41, 42, 41, 41, 41, 43, 44, 45, 46, 41, 47, 48, 49, 50, 51, 52, 41, 41, 41, 53, 54, 21, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 56, 21, 25, 58, 59, 59, 58, 59, 59, 58, 59, 59, 213, 71, 60, 68, 63, 60, 63, 69, 61, 58, 59, 59, 64, 71, 64, 213, 92, 65, 68, 65, 61, 744, 69, 72, 199, 92, 73, 106, 66, 96, 66, 187, 187, 187, 187, 72, 743, 200, 73, 93, 93, 93, 93, 745, 586, 234, 92, 93, 93, 93, 93, 185, 290, 113, 92, 100, 100, 100, 100, 125, 745, 98, 92, 126, 170, 113, 127, 113, 213, 249, 100, 100, 113, 213, 92, 187, 187, 187, 187, 74, 291, 75, 102, 102, 102, 102, 102, 102, 102, 102, 213, 74, 745, 75, 76, 77, 78, 77, 77, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 93, 93, 93, 93, 213, 213, 290, 213, 76, 76, 76, 76, 76, 92, 285, 233, 255, 80, 103, 113, 286, 102, 104, 104, 104, 104, 104, 104, 104, 113, 740, 113, 739, 113, 291, 213, 245, 213, 113, 76, 76, 76, 107, 113, 108, 108, 108, 108, 108, 108, 108, 108, 288, 113, 288, 113, 315, 113, 270, 266, 213, 109, 143, 289, 77, 76, 77, 76, 77, 78, 77, 77, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 213, 327, 271, 279, 280, 213, 144, 109, 76, 76, 76, 76, 76, 113, 185, 272, 120, 80, 426, 113, 121, 738, 128, 113, 122, 113, 123, 113, 185, 113, 354, 113, 113, 113, 113, 741, 124, 745, 113, 76, 76, 76, 185, 361, 113, 129, 130, 737, 113, 187, 187, 187, 187, 113, 331, 488, 131, 736, 735, 316, 185, 469, 742, 734, 77, 76, 77, 33, 81, 82, 81, 81, 33, 33, 83, 33, 33, 33, 33, 84, 85, 33, 86, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 88, 89, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 90, 33, 91, 92, 113, 733, 288, 155, 288, 732, 731, 213, 730, 729, 113, 213, 113, 289, 113, 213, 96, 213, 213, 113, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 213, 213, 98, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 107, 336, 110, 110, 110, 110, 110, 110, 110, 110, 132, 113, 213, 213, 145, 146, 213, 213, 147, 109, 745, 113, 727, 113, 113, 113, 113, 133, 148, 213, 113, 141, 113, 113, 213, 386, 726, 725, 629, 142, 352, 213, 113, 149, 113, 213, 113, 720, 109, 112, 719, 113, 113, 113, 113, 113, 113, 113, 113, 113, 213, 346, 353, 403, 510, 113, 114, 113, 113, 113, 113, 113, 113, 113, 113, 113, 115, 113, 116, 113, 117, 113, 113, 113, 113, 118, 113, 113, 113, 113, 113, 408, 421, 387, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 113, 213, 213, 213, 399, 136, 113, 213, 137, 213, 113, 213, 113, 213, 113, 213, 113, 138, 139, 113, 113, 213, 213, 140, 213, 113, 213, 150, 113, 213, 151, 213, 134, 213, 100, 100, 100, 100, 152, 213, 113, 197, 113, 135, 153, 113, 450, 113, 156, 100, 100, 420, 157, 160, 472, 113, 451, 113, 213, 113, 478, 161, 113, 158, 113, 113, 213, 422, 159, 414, 485, 154, 113, 431, 113, 113, 113, 164, 162, 113, 481, 113, 452, 165, 113, 113, 464, 538, 113, 741, 213, 467, 492, 484, 163, 113, 113, 113, 113, 113, 113, 745, 113, 168, 113, 166, 113, 113, 113, 525, 113, 173, 173, 173, 173, 113, 742, 213, 477, 511, 213, 167, 213, 213, 213, 522, 174, 174, 174, 174, 174, 174, 175, 175, 184, 173, 173, 173, 173, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 174, 174, 174, 174, 174, 174, 175, 175, 184, 184, 184, 184, 184, 107, 113, 108, 108, 108, 108, 108, 108, 108, 108, 213, 113, 509, 113, 483, 113, 213, 546, 208, 109, 113, 537, 213, 718, 534, 745, 184, 184, 184, 213, 213, 423, 423, 423, 423, 107, 213, 201, 201, 201, 201, 201, 201, 201, 201, 213, 213, 713, 109, 213, 560, 213, 184, 184, 109, 644, 570, 523, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 203, 203, 203, 203, 203, 203, 203, 203, 184, 184, 184, 184, 184, 530, 109, 574, 107, 109, 108, 108, 108, 108, 108, 108, 108, 108, 186, 203, 203, 203, 203, 203, 203, 203, 203, 109, 213, 561, 213, 184, 184, 184, 204, 425, 204, 213, 109, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 213, 109, 184, 107, 113, 110, 110, 110, 110, 110, 110, 110, 110, 213, 209, 113, 113, 213, 113, 711, 213, 113, 109, 113, 536, 113, 533, 113, 213, 113, 710, 113, 213, 113, 113, 211, 709, 275, 210, 577, 113, 175, 175, 175, 175, 175, 175, 175, 175, 539, 213, 109, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 113, 113, 213, 540, 582, 213, 214, 572, 599, 213, 113, 113, 113, 113, 113, 113, 113, 113, 212, 113, 113, 581, 213, 213, 213, 213, 113, 113, 113, 113, 113, 216, 113, 213, 215, 113, 113, 213, 113, 558, 213, 213, 113, 578, 113, 217, 113, 703, 113, 213, 113, 113, 113, 218, 113, 580, 583, 113, 559, 220, 113, 213, 213, 213, 113, 700, 113, 219, 113, 213, 113, 113, 113, 113, 113, 590, 602, 213, 213, 113, 695, 113, 221, 222, 113, 113, 611, 224, 223, 600, 113, 213, 213, 694, 113, 601, 113, 113, 113, 113, 606, 113, 609, 113, 113, 228, 113, 113, 225, 226, 213, 608, 613, 213, 113, 113, 113, 113, 229, 113, 616, 113, 230, 113, 614, 231, 227, 113, 113, 113, 622, 619, 617, 235, 113, 213, 213, 213, 113, 213, 113, 232, 113, 113, 618, 213, 113, 113, 213, 236, 213, 632, 634, 113, 113, 113, 113, 113, 113, 185, 113, 693, 113, 213, 113, 113, 113, 688, 237, 113, 238, 643, 213, 113, 678, 648, 686, 213, 213, 113, 113, 113, 213, 113, 633, 213, 239, 240, 113, 638, 113, 113, 113, 241, 113, 641, 646, 113, 658, 113, 213, 113, 683, 113, 675, 113, 674, 113, 113, 243, 113, 113, 647, 242, 213, 213, 113, 213, 244, 213, 113, 113, 113, 640, 113, 213, 213, 113, 213, 246, 657, 113, 645, 113, 113, 113, 113, 113, 113, 662, 113, 213, 247, 113, 702, 113, 213, 113, 113, 113, 213, 113, 213, 659, 213, 113, 113, 113, 113, 113, 113, 113, 113, 248, 113, 213, 250, 113, 664, 213, 213, 113, 113, 113, 649, 113, 677, 665, 213, 669, 113, 251, 113, 213, 113, 113, 113, 667, 253, 673, 670, 252, 254, 213, 672, 113, 213, 113, 213, 113, 256, 113, 213, 685, 113, 682, 671, 113, 213, 679, 213, 257, 213, 113, 213, 113, 697, 113, 113, 113, 113, 113, 258, 213, 113, 259, 113, 684, 113, 687, 113, 691, 113, 263, 113, 113, 113, 113, 113, 712, 261, 213, 260, 113, 668, 113, 113, 262, 666, 113, 689, 698, 113, 692, 113, 704, 113, 264, 113, 663, 113, 699, 113, 113, 113, 113, 113, 706, 690, 113, 213, 113, 728, 113, 701, 113, 267, 113, 213, 113, 213, 113, 265, 113, 113, 113, 268, 213, 113, 269, 620, 620, 620, 620, 113, 113, 113, 113, 113, 113, 213, 276, 273, 113, 113, 175, 175, 175, 175, 175, 175, 175, 175, 107, 213, 201, 201, 201, 201, 201, 201, 201, 201, 113, 113, 655, 292, 707, 213, 705, 213, 708, 109, 113, 113, 113, 113, 113, 113, 113, 113, 213, 113, 113, 715, 213, 651, 650, 213, 113, 293, 113, 113, 113, 113, 113, 642, 716, 113, 113, 639, 109, 112, 113, 213, 113, 113, 113, 294, 113, 295, 621, 722, 113, 113, 113, 113, 113, 113, 113, 113, 717, 113, 213, 213, 113, 623, 113, 610, 113, 714, 113, 723, 113, 721, 607, 296, 297, 113, 113, 213, 113, 620, 620, 620, 620, 113, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 113, 113, 573, 569, 543, 724, 542, 527, 299, 489, 113, 113, 113, 113, 113, 113, 298, 113, 113, 113, 113, 427, 360, 362, 195, 193, 191, 113, 113, 113, 113, 113, 301, 113, 300, 189, 113, 113, 185, 360, 171, 745, 213, 113, 286, 113, 195, 113, 304, 113, 302, 303, 113, 193, 621, 113, 305, 282, 306, 113, 189, 113, 185, 113, 278, 113, 113, 113, 113, 113, 277, 171, 113, 213, 113, 205, 113, 202, 113, 307, 113, 198, 113, 113, 113, 113, 113, 195, 193, 113, 192, 113, 309, 113, 308, 113, 191, 113, 191, 113, 113, 113, 113, 113, 189, 106, 113, 188, 113, 312, 310, 183, 113, 311, 113, 181, 113, 113, 113, 113, 113, 106, 179, 178, 177, 113, 171, 113, 113, 113, 169, 113, 111, 105, 313, 95, 113, 92, 113, 314, 113, 113, 113, 92, 745, 745, 745, 113, 745, 113, 745, 113, 113, 113, 745, 113, 745, 745, 317, 113, 113, 318, 319, 113, 113, 320, 113, 113, 113, 745, 113, 113, 745, 113, 745, 745, 323, 321, 745, 113, 113, 113, 113, 113, 113, 113, 113, 113, 322, 113, 324, 113, 113, 745, 745, 745, 745, 745, 745, 113, 745, 113, 113, 113, 745, 113, 745, 745, 745, 113, 113, 113, 113, 113, 113, 113, 113, 745, 113, 745, 745, 325, 745, 113, 745, 326, 328, 113, 745, 113, 745, 745, 745, 113, 113, 113, 113, 113, 745, 329, 745, 745, 113, 745, 113, 745, 113, 113, 113, 745, 113, 330, 745, 745, 113, 113, 113, 113, 113, 113, 113, 113, 745, 113, 745, 332, 113, 745, 113, 745, 113, 745, 113, 745, 113, 745, 113, 745, 113, 113, 113, 745, 113, 745, 113, 333, 113, 113, 113, 745, 113, 745, 745, 334, 113, 113, 113, 113, 113, 338, 113, 745, 745, 113, 335, 745, 745, 337, 113, 113, 113, 113, 113, 745, 113, 745, 113, 745, 113, 113, 113, 113, 113, 745, 745, 745, 745, 339, 745, 113, 745, 113, 340, 113, 745, 113, 745, 113, 745, 113, 113, 113, 745, 113, 341, 113, 745, 113, 113, 113, 745, 113, 745, 745, 745, 113, 113, 113, 113, 113, 745, 745, 745, 342, 113, 745, 113, 745, 113, 745, 113, 745, 113, 745, 745, 343, 113, 113, 113, 113, 113, 745, 345, 344, 745, 113, 745, 113, 745, 113, 745, 113, 745, 113, 745, 745, 351, 113, 113, 113, 347, 113, 348, 113, 113, 745, 113, 349, 745, 745, 745, 745, 745, 113, 113, 113, 113, 113, 113, 113, 745, 350, 113, 113, 745, 355, 745, 745, 745, 113, 745, 113, 745, 113, 356, 356, 356, 356, 113, 745, 745, 745, 358, 358, 358, 358, 745, 745, 745, 357, 357, 357, 357, 357, 357, 357, 357, 359, 359, 359, 359, 359, 359, 359, 359, 113, 113, 745, 745, 745, 745, 745, 745, 364, 745, 113, 113, 363, 113, 113, 113, 113, 745, 745, 113, 113, 745, 113, 745, 745, 745, 113, 365, 113, 745, 113, 745, 113, 113, 366, 113, 113, 745, 745, 113, 745, 113, 368, 113, 745, 113, 745, 113, 745, 113, 745, 113, 113, 113, 369, 113, 113, 370, 113, 745, 745, 745, 745, 745, 745, 113, 113, 113, 113, 113, 113, 113, 745, 745, 113, 113, 745, 745, 367, 113, 745, 113, 745, 113, 745, 113, 745, 113, 371, 113, 113, 113, 372, 113, 745, 745, 745, 113, 113, 113, 113, 113, 374, 113, 745, 373, 113, 745, 745, 745, 113, 113, 113, 113, 113, 113, 745, 113, 745, 375, 745, 113, 113, 376, 113, 113, 377, 113, 745, 378, 113, 745, 745, 745, 113, 745, 113, 113, 113, 113, 745, 113, 113, 113, 745, 379, 113, 745, 113, 745, 745, 745, 113, 745, 113, 745, 113, 745, 113, 113, 113, 113, 380, 745, 745, 113, 381, 113, 745, 113, 745, 113, 745, 113, 745, 113, 113, 113, 113, 113, 745, 382, 745, 745, 113, 745, 113, 745, 383, 745, 113, 113, 384, 745, 385, 113, 745, 113, 745, 745, 745, 113, 745, 113, 745, 113, 745, 113, 113, 113, 113, 113, 745, 745, 113, 745, 113, 745, 113, 745, 113, 745, 113, 745, 113, 745, 113, 113, 113, 113, 113, 745, 389, 113, 745, 745, 390, 745, 745, 113, 113, 113, 113, 113, 113, 113, 391, 745, 113, 113, 393, 113, 745, 388, 745, 113, 745, 113, 397, 113, 745, 113, 745, 113, 392, 113, 113, 394, 745, 113, 113, 395, 745, 745, 745, 745, 113, 113, 113, 113, 113, 113, 396, 113, 745, 113, 745, 113, 113, 113, 113, 113, 745, 745, 398, 745, 113, 745, 113, 400, 113, 113, 113, 745, 113, 745, 745, 745, 113, 113, 113, 113, 113, 113, 113, 113, 745, 113, 405, 401, 113, 745, 113, 745, 113, 404, 113, 402, 113, 745, 745, 745, 113, 113, 113, 113, 113, 745, 745, 745, 745, 113, 745, 113, 745, 113, 406, 113, 745, 113, 407, 113, 745, 113, 113, 113, 745, 113, 745, 113, 745, 113, 113, 113, 745, 113, 745, 113, 745, 113, 113, 113, 745, 113, 745, 745, 745, 113, 113, 113, 113, 113, 745, 410, 745, 409, 113, 745, 113, 745, 113, 113, 113, 745, 113, 745, 745, 745, 113, 113, 113, 113, 113, 411, 745, 113, 113, 113, 412, 113, 113, 745, 113, 745, 745, 745, 113, 745, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 745, 113, 113, 745, 113, 745, 745, 745, 113, 745, 113, 113, 113, 415, 113, 113, 113, 113, 113, 745, 113, 113, 413, 416, 417, 745, 745, 113, 745, 745, 745, 113, 745, 113, 745, 113, 745, 113, 113, 113, 113, 113, 745, 745, 745, 745, 113, 745, 113, 745, 113, 745, 113, 745, 113, 419, 745, 113, 745, 356, 356, 356, 356, 418, 113, 745, 113, 745, 113, 745, 745, 745, 745, 113, 357, 357, 357, 357, 357, 357, 357, 357, 423, 423, 423, 423, 745, 745, 745, 745, 745, 745, 745, 424, 745, 745, 745, 357, 357, 357, 357, 357, 357, 357, 357, 358, 358, 358, 358, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 359, 359, 359, 359, 359, 359, 359, 359, 424, 745, 113, 745, 359, 359, 359, 359, 359, 359, 359, 359, 113, 745, 113, 745, 113, 113, 429, 745, 428, 113, 745, 745, 745, 745, 745, 113, 745, 113, 113, 113, 430, 113, 745, 425, 113, 745, 745, 745, 113, 745, 113, 113, 113, 113, 745, 113, 745, 113, 432, 113, 113, 745, 113, 433, 745, 113, 745, 745, 434, 113, 745, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 745, 113, 113, 745, 745, 745, 745, 745, 113, 113, 113, 113, 113, 435, 745, 113, 745, 113, 745, 113, 113, 113, 113, 113, 745, 436, 745, 745, 113, 437, 113, 745, 113, 745, 113, 745, 113, 745, 745, 745, 438, 113, 113, 113, 113, 745, 439, 745, 745, 113, 440, 745, 745, 113, 113, 113, 441, 113, 745, 745, 113, 745, 113, 442, 113, 745, 113, 443, 113, 745, 113, 113, 113, 113, 113, 745, 745, 745, 745, 113, 745, 113, 113, 113, 745, 113, 745, 444, 745, 745, 113, 745, 113, 745, 113, 745, 113, 113, 446, 745, 445, 113, 745, 113, 745, 745, 745, 113, 745, 113, 745, 113, 745, 113, 113, 113, 113, 113, 745, 745, 113, 447, 113, 745, 113, 745, 113, 745, 113, 745, 113, 448, 449, 113, 113, 113, 113, 745, 745, 113, 745, 745, 745, 453, 745, 113, 113, 113, 113, 113, 113, 745, 745, 113, 113, 113, 113, 454, 745, 455, 745, 745, 745, 113, 745, 113, 113, 113, 113, 745, 113, 456, 113, 113, 113, 113, 457, 745, 745, 745, 745, 745, 745, 113, 113, 458, 113, 113, 113, 113, 745, 745, 113, 113, 745, 113, 745, 745, 460, 113, 745, 113, 745, 113, 745, 113, 113, 113, 459, 113, 462, 745, 745, 463, 113, 745, 113, 745, 113, 113, 113, 745, 745, 461, 745, 113, 745, 113, 745, 113, 113, 113, 745, 113, 745, 745, 745, 113, 113, 113, 113, 113, 113, 113, 113, 465, 113, 745, 745, 113, 745, 113, 745, 113, 745, 113, 745, 113, 745, 113, 745, 113, 113, 466, 745, 113, 745, 113, 745, 113, 113, 113, 745, 113, 745, 468, 745, 113, 113, 470, 113, 113, 745, 745, 745, 745, 113, 745, 745, 745, 113, 745, 113, 113, 113, 745, 113, 745, 471, 113, 473, 745, 745, 113, 113, 113, 113, 113, 474, 475, 113, 745, 113, 745, 113, 113, 113, 113, 113, 745, 745, 745, 745, 113, 745, 745, 745, 113, 113, 113, 745, 113, 745, 745, 113, 745, 113, 479, 113, 476, 113, 745, 113, 745, 113, 113, 113, 113, 113, 745, 745, 745, 745, 113, 745, 113, 113, 113, 745, 113, 745, 480, 745, 745, 113, 745, 113, 745, 113, 745, 113, 486, 486, 486, 486, 113, 745, 745, 745, 745, 745, 745, 745, 745, 113, 745, 487, 487, 487, 487, 487, 487, 487, 487, 113, 745, 113, 113, 113, 490, 113, 482, 745, 113, 745, 745, 745, 113, 113, 113, 113, 113, 113, 745, 113, 491, 113, 745, 113, 113, 493, 113, 113, 745, 113, 745, 745, 113, 745, 745, 745, 113, 745, 113, 113, 113, 113, 745, 113, 494, 113, 113, 745, 113, 495, 745, 496, 113, 745, 745, 745, 113, 745, 113, 745, 113, 745, 113, 113, 113, 113, 113, 745, 745, 113, 745, 113, 745, 113, 745, 497, 745, 113, 745, 113, 745, 113, 113, 113, 113, 745, 499, 498, 113, 745, 113, 745, 745, 745, 113, 745, 113, 745, 113, 745, 113, 745, 113, 113, 113, 745, 745, 113, 500, 113, 501, 745, 745, 113, 745, 502, 745, 113, 745, 113, 745, 113, 745, 113, 113, 113, 113, 113, 745, 504, 113, 745, 113, 745, 113, 745, 503, 745, 113, 745, 113, 113, 113, 113, 113, 745, 745, 113, 745, 113, 745, 113, 745, 113, 505, 113, 745, 113, 113, 113, 113, 113, 745, 745, 113, 745, 113, 745, 113, 745, 113, 507, 113, 745, 113, 506, 113, 113, 113, 508, 113, 113, 745, 113, 745, 512, 745, 745, 745, 745, 113, 113, 113, 113, 113, 113, 113, 745, 745, 113, 113, 745, 113, 513, 514, 745, 113, 745, 113, 745, 113, 745, 113, 113, 113, 113, 113, 745, 745, 113, 745, 113, 516, 113, 745, 113, 745, 113, 745, 113, 515, 113, 113, 113, 113, 517, 745, 745, 113, 745, 113, 518, 745, 745, 113, 745, 113, 745, 113, 745, 113, 113, 113, 113, 113, 745, 745, 745, 745, 113, 745, 113, 745, 113, 745, 113, 113, 519, 745, 520, 113, 745, 113, 745, 745, 745, 113, 745, 113, 745, 113, 745, 113, 113, 113, 113, 113, 745, 745, 521, 745, 113, 745, 113, 745, 113, 113, 113, 524, 113, 745, 745, 113, 745, 745, 745, 113, 113, 526, 113, 113, 113, 745, 113, 745, 113, 745, 113, 113, 113, 113, 113, 745, 529, 745, 528, 113, 745, 113, 745, 113, 745, 113, 745, 113, 745, 745, 745, 113, 113, 113, 745, 113, 113, 532, 745, 113, 113, 531, 113, 745, 745, 745, 113, 745, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 745, 113, 113, 745, 745, 745, 745, 745, 113, 745, 113, 113, 113, 113, 745, 113, 113, 113, 535, 745, 113, 486, 486, 486, 486, 745, 113, 745, 113, 745, 113, 745, 745, 745, 544, 113, 487, 487, 487, 487, 487, 487, 487, 487, 541, 745, 745, 745, 487, 487, 487, 487, 487, 487, 487, 487, 113, 113, 745, 745, 745, 745, 745, 545, 745, 745, 113, 113, 113, 113, 113, 113, 745, 113, 113, 113, 113, 547, 745, 745, 745, 745, 745, 113, 113, 548, 113, 113, 113, 113, 113, 745, 113, 113, 745, 745, 549, 550, 745, 113, 113, 113, 113, 113, 113, 113, 113, 745, 113, 113, 745, 745, 745, 745, 745, 113, 113, 113, 113, 113, 113, 113, 745, 745, 113, 113, 745, 113, 551, 552, 745, 113, 745, 113, 745, 113, 745, 113, 113, 113, 113, 113, 745, 745, 113, 745, 113, 745, 113, 553, 113, 745, 113, 745, 113, 113, 113, 113, 113, 745, 745, 745, 745, 113, 745, 113, 113, 113, 745, 113, 745, 745, 745, 554, 113, 745, 113, 113, 113, 745, 113, 745, 745, 556, 555, 113, 745, 113, 745, 113, 745, 113, 745, 113, 113, 113, 113, 113, 745, 745, 113, 745, 113, 745, 557, 745, 113, 562, 113, 745, 113, 113, 113, 113, 113, 745, 745, 745, 745, 113, 745, 113, 113, 113, 745, 113, 745, 745, 113, 563, 113, 745, 113, 745, 113, 745, 113, 745, 113, 113, 113, 113, 113, 745, 745, 113, 745, 113, 565, 113, 745, 113, 745, 113, 745, 113, 564, 113, 113, 113, 113, 113, 745, 745, 113, 745, 745, 745, 745, 745, 113, 113, 113, 113, 113, 113, 113, 567, 566, 113, 113, 745, 113, 745, 745, 745, 113, 745, 113, 745, 113, 745, 113, 113, 113, 113, 113, 745, 745, 113, 745, 113, 745, 571, 745, 113, 745, 113, 745, 113, 113, 113, 113, 113, 745, 745, 113, 745, 113, 745, 113, 745, 113, 745, 113, 745, 113, 568, 113, 113, 113, 113, 745, 745, 575, 113, 745, 113, 745, 745, 576, 113, 745, 113, 745, 113, 745, 113, 745, 113, 113, 113, 579, 113, 745, 745, 113, 745, 584, 584, 584, 584, 745, 113, 745, 113, 745, 113, 745, 745, 745, 745, 113, 585, 585, 585, 585, 585, 585, 585, 585, 113, 113, 589, 745, 745, 745, 745, 588, 745, 745, 113, 113, 113, 113, 113, 113, 113, 745, 745, 113, 113, 745, 745, 745, 113, 745, 113, 113, 113, 745, 113, 745, 591, 745, 113, 113, 113, 113, 113, 593, 113, 113, 592, 113, 745, 745, 113, 596, 113, 745, 113, 745, 594, 745, 113, 745, 113, 745, 113, 113, 113, 595, 113, 745, 113, 745, 113, 113, 113, 745, 113, 745, 745, 745, 113, 113, 113, 113, 113, 745, 597, 745, 745, 113, 745, 113, 745, 113, 745, 113, 745, 113, 745, 113, 745, 113, 113, 113, 745, 113, 598, 113, 745, 113, 113, 113, 745, 113, 745, 745, 745, 113, 113, 113, 113, 113, 745, 603, 745, 745, 113, 745, 113, 745, 113, 113, 113, 745, 113, 745, 745, 745, 113, 113, 113, 113, 113, 113, 113, 113, 745, 113, 745, 745, 113, 745, 113, 745, 113, 113, 113, 745, 113, 604, 745, 745, 113, 113, 113, 113, 113, 113, 113, 113, 745, 113, 612, 605, 113, 745, 113, 745, 113, 745, 113, 745, 113, 745, 745, 745, 113, 113, 113, 113, 113, 745, 113, 745, 745, 113, 745, 745, 745, 113, 745, 113, 615, 113, 113, 745, 113, 113, 113, 745, 745, 113, 584, 584, 584, 584, 745, 113, 745, 113, 624, 113, 745, 745, 745, 113, 113, 585, 585, 585, 585, 585, 585, 585, 585, 113, 113, 113, 745, 113, 745, 745, 113, 745, 113, 745, 113, 745, 113, 745, 113, 745, 113, 745, 113, 113, 113, 113, 113, 625, 626, 113, 745, 627, 745, 745, 745, 113, 113, 113, 113, 113, 113, 113, 745, 745, 113, 113, 745, 113, 745, 630, 745, 113, 745, 628, 745, 113, 745, 113, 113, 113, 113, 113, 745, 745, 113, 745, 113, 745, 631, 745, 113, 745, 113, 745, 113, 113, 113, 113, 113, 745, 635, 745, 745, 113, 745, 113, 113, 113, 636, 113, 745, 745, 113, 637, 113, 745, 113, 745, 113, 745, 113, 745, 113, 113, 113, 113, 113, 745, 745, 113, 745, 113, 745, 113, 745, 652, 745, 113, 745, 113, 745, 113, 113, 113, 113, 113, 653, 745, 113, 745, 745, 745, 745, 745, 113, 113, 113, 113, 113, 113, 113, 113, 745, 113, 113, 745, 745, 745, 745, 745, 113, 113, 113, 113, 113, 113, 113, 654, 745, 113, 113, 745, 113, 656, 745, 745, 113, 745, 113, 745, 113, 745, 113, 113, 113, 113, 113, 745, 745, 745, 745, 113, 745, 113, 113, 660, 745, 113, 745, 745, 113, 745, 113, 745, 113, 745, 113, 661, 113, 745, 113, 113, 113, 113, 113, 745, 745, 113, 745, 113, 745, 113, 745, 113, 745, 113, 745, 113, 113, 113, 113, 113, 745, 745, 745, 745, 113, 745, 113, 113, 113, 745, 113, 745, 745, 113, 676, 113, 745, 113, 745, 113, 745, 113, 745, 113, 680, 681, 113, 113, 113, 113, 745, 745, 113, 745, 745, 745, 745, 745, 113, 113, 113, 113, 113, 113, 113, 113, 745, 113, 113, 745, 745, 696, 745, 745, 113, 113, 113, 113, 113, 113, 745, 745, 745, 113, 113, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 94, 94, 94, 94, 745, 94, 94, 94, 94, 94, 94, 94, 94, 101, 101, 101, 745, 101, 745, 101, 745, 101, 172, 172, 745, 172, 172, 176, 176, 745, 745, 176, 176, 745, 176, 176, 176, 176, 176, 176, 180, 180, 180, 180, 745, 180, 180, 180, 180, 180, 180, 180, 180, 182, 182, 182, 182, 182, 182, 182, 182, 745, 182, 182, 184, 745, 745, 745, 184, 184, 184, 184, 184, 184, 184, 185, 745, 745, 745, 185, 185, 185, 185, 185, 185, 185, 190, 190, 745, 190, 190, 194, 194, 745, 194, 194, 196, 196, 745, 196, 196, 206, 745, 206, 206, 119, 119, 745, 119, 119, 274, 745, 274, 274, 281, 745, 281, 281, 283, 745, 283, 283, 284, 745, 284, 284, 287, 287, 287, 287, 287, 287, 287, 287, 287, 287, 287, 287, 287, 207, 207, 745, 207, 207, 587, 587, 745, 587, 587, 587, 587, 587, 587, 587, 587, 587, 587, 585, 585, 585, 745, 745, 745, 585, 745, 745, 745, 745, 585, 17, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745 } ; static yyconst flex_int16_t yy_chk[4591] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 4, 4, 4, 5, 5, 5, 135, 11, 3, 9, 7, 4, 8, 9, 5, 6, 6, 6, 7, 12, 8, 149, 54, 7, 10, 8, 6, 743, 10, 11, 103, 29, 11, 29, 7, 98, 8, 81, 81, 81, 81, 12, 742, 103, 12, 19, 19, 19, 19, 83, 542, 135, 19, 20, 20, 20, 20, 542, 200, 36, 20, 24, 24, 24, 24, 36, 83, 98, 24, 36, 54, 36, 36, 36, 134, 149, 24, 24, 36, 154, 26, 82, 82, 82, 82, 11, 200, 11, 26, 26, 26, 26, 26, 26, 26, 26, 144, 12, 83, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 93, 93, 93, 93, 163, 166, 290, 233, 13, 13, 13, 13, 13, 27, 197, 134, 154, 13, 27, 41, 197, 27, 27, 27, 27, 27, 27, 27, 27, 41, 739, 41, 738, 41, 290, 245, 144, 167, 41, 13, 13, 13, 30, 44, 30, 30, 30, 30, 30, 30, 30, 30, 199, 44, 199, 44, 233, 44, 166, 163, 272, 30, 44, 199, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 234, 245, 167, 186, 186, 249, 44, 30, 14, 14, 14, 14, 14, 35, 186, 167, 35, 14, 361, 37, 35, 737, 37, 35, 35, 35, 35, 35, 361, 37, 272, 37, 35, 37, 38, 740, 35, 405, 37, 14, 14, 14, 279, 279, 38, 38, 38, 736, 38, 187, 187, 187, 187, 38, 249, 426, 38, 735, 734, 234, 426, 405, 740, 733, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 23, 47, 732, 289, 47, 289, 731, 730, 728, 726, 725, 47, 724, 47, 289, 47, 255, 23, 723, 721, 47, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 315, 270, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 31, 255, 31, 31, 31, 31, 31, 31, 31, 31, 39, 39, 266, 271, 45, 45, 331, 451, 45, 31, 596, 39, 720, 39, 45, 39, 45, 39, 45, 336, 39, 43, 43, 45, 353, 315, 719, 718, 596, 43, 270, 316, 43, 45, 43, 717, 43, 711, 31, 34, 710, 43, 34, 34, 34, 34, 34, 34, 34, 34, 327, 266, 271, 331, 451, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 336, 353, 316, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 40, 386, 352, 387, 327, 42, 42, 346, 42, 408, 40, 414, 40, 367, 40, 422, 42, 42, 42, 40, 42, 354, 388, 42, 418, 42, 483, 46, 46, 403, 46, 421, 40, 399, 100, 100, 100, 100, 46, 431, 46, 100, 46, 40, 46, 48, 386, 46, 48, 100, 100, 352, 48, 49, 408, 48, 387, 48, 413, 48, 414, 49, 49, 48, 48, 50, 452, 354, 48, 346, 422, 46, 49, 367, 49, 50, 49, 50, 49, 50, 418, 49, 388, 50, 50, 51, 399, 483, 113, 741, 467, 403, 431, 421, 49, 51, 52, 51, 113, 51, 113, 463, 113, 52, 51, 50, 52, 113, 52, 467, 52, 56, 56, 56, 56, 52, 741, 420, 413, 452, 450, 51, 478, 492, 482, 463, 56, 56, 56, 56, 56, 56, 56, 56, 79, 173, 173, 173, 173, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 173, 173, 173, 173, 173, 173, 173, 173, 79, 79, 79, 79, 79, 102, 114, 102, 102, 102, 102, 102, 102, 102, 102, 464, 114, 450, 114, 420, 114, 510, 492, 114, 102, 114, 482, 523, 709, 478, 612, 79, 79, 79, 530, 708, 423, 423, 423, 423, 104, 472, 104, 104, 104, 104, 104, 104, 104, 104, 705, 701, 700, 102, 511, 510, 699, 79, 80, 104, 612, 523, 464, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 107, 107, 107, 107, 107, 107, 107, 107, 80, 80, 80, 80, 80, 472, 104, 530, 108, 107, 108, 108, 108, 108, 108, 108, 108, 108, 80, 203, 203, 203, 203, 203, 203, 203, 203, 108, 477, 511, 481, 80, 80, 80, 109, 423, 109, 533, 107, 109, 109, 109, 109, 109, 109, 109, 109, 204, 204, 204, 204, 204, 204, 204, 204, 484, 108, 80, 110, 115, 110, 110, 110, 110, 110, 110, 110, 110, 539, 115, 116, 115, 697, 115, 695, 558, 117, 110, 115, 481, 116, 477, 116, 485, 116, 694, 117, 525, 117, 116, 117, 693, 174, 116, 533, 117, 174, 174, 174, 174, 174, 174, 174, 174, 484, 538, 110, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 118, 120, 537, 485, 539, 509, 120, 525, 558, 534, 118, 120, 118, 120, 118, 120, 121, 122, 118, 118, 120, 538, 540, 559, 546, 561, 121, 122, 121, 122, 121, 122, 123, 560, 121, 121, 122, 574, 124, 509, 568, 572, 123, 534, 123, 123, 123, 686, 124, 570, 124, 123, 124, 125, 125, 537, 540, 124, 509, 126, 126, 577, 578, 580, 125, 683, 125, 125, 125, 583, 126, 127, 126, 125, 126, 546, 561, 581, 682, 126, 675, 127, 127, 127, 128, 127, 574, 129, 128, 559, 127, 599, 601, 674, 128, 560, 128, 129, 128, 129, 568, 129, 572, 128, 131, 131, 129, 130, 130, 130, 582, 570, 577, 618, 131, 132, 131, 130, 131, 130, 580, 130, 131, 131, 578, 132, 130, 132, 133, 132, 586, 583, 581, 136, 132, 600, 606, 611, 133, 658, 133, 133, 133, 136, 582, 616, 137, 133, 609, 137, 633, 599, 601, 136, 138, 136, 137, 136, 137, 586, 137, 673, 136, 608, 138, 137, 138, 668, 138, 139, 139, 611, 614, 138, 658, 618, 666, 632, 617, 139, 140, 139, 638, 139, 600, 685, 139, 139, 139, 606, 140, 141, 140, 140, 140, 609, 616, 142, 633, 140, 634, 141, 663, 141, 655, 141, 651, 142, 143, 142, 141, 142, 617, 141, 619, 640, 142, 641, 143, 657, 143, 145, 143, 608, 146, 643, 645, 143, 647, 145, 632, 145, 614, 145, 146, 145, 146, 147, 146, 638, 145, 649, 146, 146, 685, 148, 648, 147, 150, 147, 665, 147, 659, 634, 662, 148, 147, 148, 150, 148, 150, 151, 150, 148, 148, 677, 150, 150, 640, 667, 664, 151, 152, 151, 619, 151, 657, 641, 671, 645, 151, 151, 152, 698, 152, 153, 152, 643, 153, 650, 647, 152, 153, 669, 649, 153, 672, 153, 678, 153, 155, 155, 687, 665, 153, 662, 648, 156, 670, 659, 679, 155, 722, 155, 690, 155, 677, 156, 157, 156, 155, 156, 156, 684, 158, 156, 156, 664, 157, 667, 157, 671, 157, 160, 158, 159, 158, 157, 158, 698, 158, 646, 157, 158, 644, 159, 160, 159, 642, 159, 669, 678, 161, 672, 159, 687, 160, 161, 160, 639, 160, 679, 161, 162, 161, 160, 161, 690, 670, 164, 691, 161, 722, 162, 684, 162, 164, 162, 689, 164, 692, 164, 162, 164, 168, 165, 165, 704, 164, 165, 585, 585, 585, 585, 168, 165, 168, 165, 168, 165, 706, 175, 168, 168, 165, 175, 175, 175, 175, 175, 175, 175, 175, 201, 714, 201, 201, 201, 201, 201, 201, 201, 201, 208, 209, 629, 208, 691, 702, 689, 707, 692, 201, 208, 209, 208, 209, 208, 209, 210, 211, 715, 208, 209, 704, 712, 623, 622, 613, 210, 211, 210, 211, 210, 211, 212, 610, 706, 210, 211, 607, 201, 206, 214, 602, 212, 215, 212, 212, 212, 214, 585, 714, 214, 212, 214, 215, 214, 215, 216, 215, 707, 214, 716, 590, 215, 587, 217, 573, 216, 702, 216, 715, 216, 712, 569, 216, 217, 216, 217, 536, 217, 620, 620, 620, 620, 217, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 218, 219, 527, 522, 489, 716, 488, 469, 219, 427, 218, 219, 218, 219, 218, 219, 218, 220, 221, 218, 219, 362, 360, 291, 284, 283, 282, 220, 221, 220, 221, 220, 221, 222, 220, 281, 220, 221, 280, 277, 274, 213, 207, 222, 198, 222, 196, 222, 223, 223, 222, 222, 222, 194, 620, 224, 223, 192, 224, 223, 190, 223, 185, 223, 183, 224, 225, 224, 223, 224, 178, 172, 226, 119, 224, 111, 225, 105, 225, 225, 225, 101, 226, 227, 226, 225, 226, 99, 97, 228, 96, 226, 228, 227, 227, 227, 95, 227, 92, 228, 229, 228, 227, 228, 87, 86, 230, 85, 228, 230, 229, 72, 229, 229, 229, 69, 230, 231, 230, 229, 230, 65, 64, 61, 60, 230, 55, 231, 232, 231, 53, 231, 32, 28, 231, 22, 231, 21, 232, 232, 232, 235, 232, 18, 17, 0, 0, 232, 0, 236, 0, 235, 237, 235, 0, 235, 0, 0, 235, 236, 235, 236, 237, 236, 237, 237, 237, 238, 236, 0, 239, 237, 0, 240, 0, 0, 240, 238, 0, 238, 239, 238, 239, 240, 239, 240, 238, 240, 239, 239, 241, 242, 240, 0, 0, 0, 0, 0, 0, 241, 0, 242, 243, 242, 0, 242, 0, 0, 0, 241, 242, 241, 243, 241, 243, 244, 243, 0, 241, 0, 0, 243, 0, 246, 0, 244, 246, 244, 0, 244, 0, 0, 0, 246, 244, 246, 247, 246, 0, 247, 0, 0, 246, 0, 248, 0, 247, 250, 247, 0, 247, 248, 0, 0, 248, 247, 248, 250, 248, 250, 251, 250, 0, 248, 0, 250, 250, 0, 252, 0, 251, 0, 251, 0, 251, 0, 253, 0, 252, 251, 252, 0, 252, 0, 254, 252, 253, 252, 253, 0, 253, 0, 0, 253, 254, 253, 254, 256, 254, 257, 257, 0, 0, 254, 254, 0, 0, 256, 258, 256, 257, 256, 257, 0, 257, 0, 256, 0, 258, 257, 258, 259, 258, 0, 0, 0, 0, 258, 0, 260, 0, 259, 260, 259, 0, 259, 0, 261, 0, 260, 259, 260, 0, 260, 261, 262, 0, 261, 260, 261, 0, 261, 0, 0, 0, 262, 261, 262, 263, 262, 0, 0, 0, 262, 262, 0, 264, 0, 263, 0, 263, 0, 263, 0, 0, 263, 264, 263, 264, 265, 264, 0, 265, 264, 0, 264, 0, 267, 0, 265, 0, 265, 0, 265, 0, 0, 269, 267, 265, 267, 267, 267, 267, 268, 269, 0, 267, 267, 0, 0, 0, 0, 0, 268, 269, 268, 269, 268, 269, 273, 0, 268, 268, 269, 0, 273, 0, 0, 0, 273, 0, 273, 0, 273, 275, 275, 275, 275, 273, 0, 0, 0, 276, 276, 276, 276, 0, 0, 0, 275, 275, 275, 275, 275, 275, 275, 275, 276, 276, 276, 276, 276, 276, 276, 276, 292, 293, 0, 0, 0, 0, 0, 0, 293, 0, 292, 293, 292, 293, 292, 293, 294, 0, 0, 292, 293, 0, 295, 0, 0, 0, 294, 294, 294, 0, 294, 0, 295, 296, 295, 294, 295, 0, 0, 297, 0, 295, 297, 296, 0, 296, 0, 296, 0, 297, 0, 297, 296, 297, 298, 298, 299, 299, 297, 0, 0, 0, 0, 0, 0, 298, 299, 298, 299, 298, 299, 300, 0, 0, 298, 299, 0, 0, 296, 301, 0, 300, 0, 300, 0, 300, 0, 302, 300, 301, 300, 301, 301, 301, 0, 0, 0, 302, 301, 302, 304, 302, 303, 303, 0, 302, 302, 0, 0, 0, 304, 305, 304, 303, 304, 303, 0, 303, 0, 304, 0, 305, 303, 305, 306, 305, 306, 307, 0, 307, 305, 0, 0, 0, 306, 0, 306, 307, 306, 307, 0, 307, 308, 306, 0, 308, 307, 0, 309, 0, 0, 0, 308, 0, 308, 0, 308, 0, 309, 310, 309, 308, 309, 0, 0, 311, 310, 309, 0, 310, 0, 310, 0, 310, 0, 311, 312, 311, 310, 311, 0, 311, 0, 0, 311, 0, 312, 0, 312, 0, 312, 313, 312, 0, 313, 312, 0, 314, 0, 0, 0, 313, 0, 313, 0, 313, 0, 314, 317, 314, 313, 314, 0, 0, 318, 0, 314, 0, 317, 0, 317, 0, 317, 0, 318, 0, 318, 317, 318, 319, 320, 0, 318, 318, 0, 0, 319, 0, 0, 319, 320, 319, 320, 319, 320, 321, 320, 0, 319, 320, 322, 322, 0, 317, 0, 321, 0, 321, 324, 321, 0, 322, 0, 322, 321, 322, 323, 322, 0, 324, 322, 323, 0, 0, 0, 0, 323, 325, 323, 324, 323, 324, 323, 324, 0, 323, 0, 325, 324, 325, 326, 325, 0, 0, 325, 0, 325, 0, 328, 328, 326, 329, 326, 0, 326, 0, 0, 0, 328, 326, 328, 329, 328, 329, 330, 329, 0, 328, 333, 329, 329, 0, 332, 0, 330, 332, 330, 330, 330, 0, 0, 0, 332, 330, 332, 333, 332, 0, 0, 0, 0, 332, 0, 334, 0, 333, 334, 333, 0, 333, 335, 335, 0, 334, 333, 334, 0, 334, 0, 337, 0, 335, 334, 335, 0, 335, 0, 338, 0, 337, 335, 337, 0, 337, 0, 0, 0, 338, 337, 338, 339, 338, 0, 339, 0, 338, 338, 0, 340, 0, 339, 341, 339, 0, 339, 0, 0, 0, 340, 339, 340, 341, 340, 341, 0, 341, 343, 340, 342, 342, 341, 0, 344, 0, 0, 0, 343, 0, 343, 342, 343, 342, 344, 342, 344, 343, 344, 345, 342, 0, 347, 344, 0, 348, 0, 0, 0, 345, 0, 345, 347, 345, 347, 348, 347, 348, 345, 348, 0, 347, 349, 343, 348, 349, 0, 0, 350, 0, 0, 0, 349, 0, 349, 0, 349, 0, 350, 351, 350, 349, 350, 0, 0, 0, 0, 350, 0, 351, 0, 351, 0, 351, 0, 355, 351, 0, 351, 0, 356, 356, 356, 356, 350, 355, 0, 355, 0, 355, 0, 0, 0, 0, 355, 356, 356, 356, 356, 356, 356, 356, 356, 357, 357, 357, 357, 0, 0, 0, 0, 0, 0, 0, 357, 0, 0, 0, 357, 357, 357, 357, 357, 357, 357, 357, 358, 358, 358, 358, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 358, 358, 358, 358, 358, 358, 358, 358, 359, 0, 363, 0, 359, 359, 359, 359, 359, 359, 359, 359, 363, 0, 363, 0, 363, 364, 364, 0, 363, 363, 0, 0, 0, 0, 0, 364, 0, 364, 366, 364, 365, 365, 0, 357, 364, 0, 0, 0, 366, 0, 366, 365, 366, 365, 0, 365, 0, 366, 368, 368, 365, 0, 369, 369, 0, 370, 0, 0, 370, 368, 0, 368, 369, 368, 369, 370, 369, 370, 368, 370, 371, 369, 0, 372, 370, 0, 0, 0, 0, 0, 371, 373, 371, 372, 371, 372, 0, 372, 0, 371, 0, 373, 372, 373, 374, 373, 0, 373, 0, 0, 373, 374, 375, 0, 374, 0, 374, 0, 374, 0, 0, 0, 375, 374, 375, 376, 375, 0, 376, 0, 0, 375, 376, 0, 0, 376, 377, 376, 377, 376, 0, 0, 378, 0, 376, 378, 377, 0, 377, 378, 377, 0, 378, 379, 378, 377, 378, 0, 0, 0, 0, 378, 0, 379, 380, 379, 0, 379, 0, 379, 0, 0, 379, 0, 380, 0, 380, 0, 380, 381, 381, 0, 380, 380, 0, 382, 0, 0, 0, 381, 0, 381, 0, 381, 0, 382, 383, 382, 381, 382, 0, 0, 384, 382, 382, 0, 383, 0, 383, 0, 383, 0, 384, 383, 384, 383, 384, 385, 389, 0, 0, 384, 0, 0, 0, 389, 0, 385, 389, 385, 389, 385, 389, 0, 0, 391, 385, 389, 390, 390, 0, 390, 0, 0, 0, 391, 0, 391, 390, 391, 390, 0, 390, 391, 391, 393, 392, 390, 392, 0, 0, 0, 0, 0, 0, 393, 392, 393, 392, 393, 392, 394, 0, 0, 393, 392, 0, 395, 0, 0, 395, 394, 0, 394, 0, 394, 0, 395, 396, 395, 394, 395, 397, 0, 0, 398, 395, 0, 396, 0, 396, 397, 396, 0, 0, 396, 0, 396, 0, 400, 0, 397, 398, 397, 0, 397, 0, 0, 0, 400, 397, 400, 398, 400, 398, 401, 398, 400, 400, 0, 0, 398, 0, 402, 0, 401, 0, 401, 0, 401, 0, 404, 0, 402, 401, 402, 0, 402, 0, 406, 0, 404, 402, 404, 0, 404, 0, 404, 0, 406, 404, 406, 407, 406, 0, 0, 0, 0, 406, 0, 0, 0, 407, 0, 407, 409, 407, 0, 410, 0, 407, 407, 409, 0, 0, 409, 411, 409, 410, 409, 410, 411, 410, 0, 409, 0, 411, 410, 411, 412, 411, 0, 0, 0, 0, 411, 0, 0, 0, 412, 415, 412, 0, 412, 0, 0, 416, 0, 412, 416, 415, 412, 415, 0, 415, 0, 416, 417, 416, 415, 416, 0, 0, 0, 0, 416, 0, 417, 419, 417, 0, 417, 0, 417, 0, 0, 417, 0, 419, 0, 419, 0, 419, 424, 424, 424, 424, 419, 0, 0, 0, 0, 0, 0, 0, 0, 428, 0, 424, 424, 424, 424, 424, 424, 424, 424, 428, 0, 428, 430, 428, 429, 429, 419, 0, 428, 0, 0, 0, 430, 432, 430, 429, 430, 429, 0, 429, 430, 430, 0, 432, 429, 432, 433, 432, 0, 434, 0, 0, 432, 0, 0, 0, 433, 0, 433, 434, 433, 434, 0, 434, 433, 433, 435, 0, 434, 435, 0, 436, 436, 0, 0, 0, 435, 0, 435, 0, 435, 0, 436, 437, 436, 435, 436, 0, 0, 438, 0, 436, 0, 437, 0, 437, 0, 437, 0, 438, 0, 438, 437, 438, 439, 0, 439, 438, 438, 0, 440, 0, 0, 0, 439, 0, 439, 0, 439, 0, 440, 0, 440, 439, 440, 0, 0, 441, 440, 440, 441, 0, 0, 442, 0, 442, 0, 441, 0, 441, 0, 441, 0, 442, 443, 442, 441, 442, 0, 444, 444, 0, 442, 0, 443, 0, 443, 0, 443, 0, 444, 445, 444, 443, 444, 0, 0, 446, 0, 444, 0, 445, 0, 445, 446, 445, 0, 446, 447, 446, 445, 446, 0, 0, 448, 0, 446, 0, 447, 0, 447, 448, 447, 0, 448, 447, 448, 447, 448, 449, 449, 453, 0, 448, 0, 453, 0, 0, 0, 0, 449, 453, 449, 453, 449, 453, 454, 0, 0, 449, 453, 0, 455, 454, 455, 0, 454, 0, 454, 0, 454, 0, 455, 456, 455, 454, 455, 0, 0, 457, 0, 455, 457, 456, 0, 456, 0, 456, 0, 457, 456, 457, 456, 457, 458, 458, 0, 0, 457, 0, 459, 459, 0, 0, 458, 0, 458, 0, 458, 0, 459, 460, 459, 458, 459, 0, 0, 0, 0, 459, 0, 460, 0, 460, 0, 460, 461, 460, 0, 461, 460, 0, 462, 0, 0, 0, 461, 0, 461, 0, 461, 0, 462, 465, 462, 461, 462, 0, 0, 462, 0, 462, 0, 465, 0, 465, 468, 465, 466, 466, 0, 0, 465, 0, 0, 0, 468, 470, 468, 466, 468, 466, 0, 466, 0, 468, 0, 470, 466, 470, 471, 470, 0, 471, 0, 470, 470, 0, 473, 0, 471, 0, 471, 0, 471, 0, 0, 0, 473, 471, 473, 0, 473, 474, 474, 0, 475, 473, 473, 476, 0, 0, 0, 474, 0, 474, 475, 474, 475, 476, 475, 476, 474, 476, 479, 475, 0, 480, 476, 0, 0, 0, 0, 0, 479, 0, 479, 480, 479, 480, 0, 480, 490, 479, 480, 0, 480, 486, 486, 486, 486, 0, 490, 0, 490, 0, 490, 0, 0, 0, 490, 490, 486, 486, 486, 486, 486, 486, 486, 486, 487, 0, 0, 0, 487, 487, 487, 487, 487, 487, 487, 487, 491, 493, 0, 0, 0, 0, 0, 491, 0, 0, 491, 493, 491, 493, 491, 493, 0, 495, 494, 491, 493, 494, 0, 0, 0, 0, 0, 495, 494, 495, 494, 495, 494, 496, 497, 0, 495, 494, 0, 0, 496, 497, 0, 496, 497, 496, 497, 496, 497, 498, 499, 0, 496, 497, 0, 0, 0, 0, 0, 498, 499, 498, 499, 498, 499, 500, 0, 0, 498, 499, 0, 501, 500, 501, 0, 500, 0, 500, 0, 500, 0, 501, 502, 501, 500, 501, 0, 0, 503, 0, 501, 0, 502, 503, 502, 0, 502, 0, 503, 504, 503, 502, 503, 0, 0, 0, 0, 503, 0, 504, 505, 504, 0, 504, 0, 0, 0, 504, 504, 0, 505, 506, 505, 0, 505, 0, 0, 507, 505, 505, 0, 506, 0, 506, 0, 506, 0, 507, 508, 507, 506, 507, 0, 0, 512, 0, 507, 0, 508, 0, 508, 512, 508, 0, 512, 513, 512, 508, 512, 0, 0, 0, 0, 512, 0, 513, 514, 513, 0, 513, 0, 0, 515, 513, 513, 0, 514, 0, 514, 0, 514, 0, 515, 516, 515, 514, 515, 0, 0, 517, 0, 515, 517, 516, 0, 516, 0, 516, 0, 517, 516, 517, 516, 517, 518, 519, 0, 0, 517, 0, 0, 0, 0, 0, 518, 519, 518, 519, 518, 519, 520, 520, 518, 518, 519, 0, 521, 0, 0, 0, 520, 0, 520, 0, 520, 0, 521, 524, 521, 520, 521, 0, 0, 526, 0, 521, 0, 524, 0, 524, 0, 524, 0, 526, 528, 526, 524, 526, 0, 0, 529, 0, 526, 0, 528, 0, 528, 0, 528, 0, 529, 521, 529, 528, 529, 531, 0, 0, 531, 529, 0, 532, 0, 0, 532, 531, 0, 531, 0, 531, 0, 532, 0, 532, 531, 532, 535, 535, 0, 0, 532, 0, 541, 541, 541, 541, 0, 535, 0, 535, 0, 535, 0, 0, 0, 0, 535, 541, 541, 541, 541, 541, 541, 541, 541, 544, 545, 545, 0, 0, 0, 0, 544, 0, 0, 544, 545, 544, 545, 544, 545, 547, 0, 0, 544, 545, 0, 0, 0, 548, 0, 547, 549, 547, 0, 547, 0, 547, 0, 548, 547, 548, 549, 548, 549, 550, 549, 548, 548, 0, 0, 549, 553, 551, 0, 550, 0, 550, 0, 550, 0, 552, 0, 551, 550, 551, 551, 551, 0, 553, 0, 552, 551, 552, 0, 552, 0, 0, 0, 553, 552, 553, 554, 553, 0, 554, 0, 0, 553, 0, 555, 0, 554, 0, 554, 0, 554, 0, 556, 0, 555, 554, 555, 0, 555, 556, 557, 0, 556, 555, 556, 0, 556, 0, 0, 0, 557, 556, 557, 562, 557, 0, 562, 0, 0, 557, 0, 563, 0, 562, 564, 562, 0, 562, 0, 0, 0, 563, 562, 563, 564, 563, 564, 565, 564, 0, 563, 0, 0, 564, 0, 566, 0, 565, 567, 565, 0, 565, 566, 0, 0, 566, 565, 566, 567, 566, 567, 571, 567, 0, 566, 575, 567, 567, 0, 576, 0, 571, 0, 571, 0, 571, 0, 0, 0, 576, 571, 576, 575, 576, 0, 579, 0, 0, 576, 0, 0, 0, 575, 0, 575, 579, 575, 579, 0, 579, 588, 575, 0, 0, 579, 584, 584, 584, 584, 0, 588, 0, 588, 588, 588, 0, 0, 0, 589, 588, 584, 584, 584, 584, 584, 584, 584, 584, 589, 591, 589, 0, 589, 0, 0, 592, 0, 589, 0, 591, 0, 591, 0, 591, 0, 592, 0, 592, 591, 592, 593, 594, 592, 593, 592, 0, 594, 0, 0, 0, 593, 594, 593, 594, 593, 594, 595, 0, 0, 593, 594, 0, 597, 0, 597, 0, 595, 0, 595, 0, 595, 0, 597, 598, 597, 595, 597, 0, 0, 603, 0, 597, 0, 598, 0, 598, 0, 598, 0, 603, 604, 603, 598, 603, 0, 603, 0, 0, 603, 0, 604, 605, 604, 604, 604, 0, 0, 615, 605, 604, 0, 605, 0, 605, 0, 605, 0, 615, 624, 615, 605, 615, 0, 0, 625, 0, 615, 0, 624, 0, 624, 0, 624, 0, 625, 0, 625, 624, 625, 626, 627, 626, 0, 625, 0, 0, 0, 0, 0, 626, 627, 626, 627, 626, 627, 628, 630, 0, 626, 627, 0, 0, 0, 0, 0, 628, 630, 628, 630, 628, 630, 631, 628, 0, 628, 630, 0, 635, 631, 0, 0, 631, 0, 631, 0, 631, 0, 635, 636, 635, 631, 635, 0, 0, 0, 0, 635, 0, 636, 637, 636, 0, 636, 0, 0, 652, 0, 636, 0, 637, 0, 637, 637, 637, 0, 652, 653, 652, 637, 652, 0, 0, 654, 0, 652, 0, 653, 0, 653, 0, 653, 0, 654, 656, 654, 653, 654, 0, 0, 0, 0, 654, 0, 656, 660, 656, 0, 656, 0, 0, 661, 656, 656, 0, 660, 0, 660, 0, 660, 0, 661, 660, 661, 660, 661, 676, 680, 0, 0, 661, 0, 0, 0, 0, 0, 676, 680, 676, 680, 676, 680, 681, 696, 0, 676, 680, 0, 0, 676, 0, 0, 681, 696, 681, 696, 681, 696, 0, 0, 0, 681, 696, 746, 746, 746, 746, 746, 746, 746, 746, 746, 746, 746, 746, 746, 747, 747, 747, 747, 747, 747, 747, 747, 747, 747, 747, 747, 747, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 749, 749, 749, 749, 749, 749, 749, 749, 749, 749, 749, 749, 749, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 751, 751, 751, 751, 0, 751, 751, 751, 751, 751, 751, 751, 751, 752, 752, 752, 0, 752, 0, 752, 0, 752, 753, 753, 0, 753, 753, 754, 754, 0, 0, 754, 754, 0, 754, 754, 754, 754, 754, 754, 755, 755, 755, 755, 0, 755, 755, 755, 755, 755, 755, 755, 755, 756, 756, 756, 756, 756, 756, 756, 756, 0, 756, 756, 757, 0, 0, 0, 757, 757, 757, 757, 757, 757, 757, 758, 0, 0, 0, 758, 758, 758, 758, 758, 758, 758, 759, 759, 0, 759, 759, 760, 760, 0, 760, 760, 761, 761, 0, 761, 761, 762, 0, 762, 762, 763, 763, 0, 763, 763, 764, 0, 764, 764, 765, 0, 765, 765, 766, 0, 766, 766, 767, 0, 767, 767, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 769, 769, 0, 769, 769, 770, 770, 0, 770, 770, 770, 770, 770, 770, 770, 770, 770, 770, 771, 771, 771, 0, 0, 0, 771, 0, 0, 0, 0, 771, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745 } ; /* Table of booleans, true if rule could match eol. */ static yyconst flex_int32_t yy_rule_can_match_eol[141] = { 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, }; extern int asn1p__flex_debug; int asn1p__flex_debug = 1; static yyconst flex_int16_t yy_rule_linenum[140] = { 0, 96, 97, 99, 102, 104, 107, 109, 110, 111, 114, 116, 117, 118, 130, 137, 144, 150, 159, 167, 175, 176, 178, 197, 203, 204, 205, 206, 207, 210, 216, 223, 230, 237, 244, 251, 252, 253, 261, 262, 263, 264, 265, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 351, 352, 357, 358, 359, 362, 367, 373, 381, 391, 396, 398, 399, 403, 408, 413, 419, 420, 422, 428, 441, 444, 469, 513, 514, 516, 518, 529 } ; static yy_state_type *yy_state_buf=0, *yy_state_ptr=0; static char *yy_full_match; static int yy_lp; #define REJECT \ { \ *yy_cp = (yy_hold_char); /* undo effects of setting up asn1p_text */ \ yy_cp = (yy_full_match); /* restore poss. backed-over text */ \ ++(yy_lp); \ goto find_rule; \ } #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *asn1p_text; #line 1 "asn1p_l.l" #line 2 "asn1p_l.l" #include #include #include #include "asn1parser.h" #include "asn1p_y.h" int asn1p_lex(void); void asn1p_lexer_hack_push_opaque_state(void); /* Used in .y */ void asn1p_lexer_hack_enable_with_syntax(void); /* Used in .y */ void asn1p_lexer_hack_push_encoding_control(void); /* Used in .y */ #define YY_FATAL_ERROR(msg) do { \ fprintf(stderr, \ "lexer error at line %d, " \ "text \"%s\"\n", \ asn1p_lineno, asn1p_text); \ exit(1); \ } while(0) int asn1p_lexer_pedantic_1990 = 0; int asn1p_lexer_types_year = 0; int asn1p_lexer_constructs_year = 0; int asn1p_as_pointer; static asn1c_integer_t _lex_atoi(const char *ptr); static double _lex_atod(const char *ptr); /* * Check that the type is defined in the year of the standard choosen. */ #define TYPE_LIFETIME(fyr, lyr) \ (!asn1p_lexer_types_year \ || (fyr && fyr <= asn1p_lexer_types_year) \ || (lyr && lyr > asn1p_lexer_types_year)) /* * Check the the construction (or concept, i.e. CLASS) is defined in * a given year. */ #define CONSTRUCT_LIFETIME(fyr, lyr) \ (!asn1p_lexer_constructs_year \ || (fyr && fyr <= asn1p_lexer_constructs_year) \ || (lyr && lyr > asn1p_lexer_constructs_year)) /* * Append quoted string. */ #define QAPPEND(text, tlen) do { \ char *prev_text = asn1p_lval.tv_opaque.buf; \ int prev_len = asn1p_lval.tv_opaque.len; \ char *p; \ \ p = malloc((tlen) + prev_len + 1); \ if(p == NULL) return -1; \ \ if(prev_text) memcpy(p, prev_text, prev_len); \ memcpy(p + prev_len, text, tlen); \ p[prev_len + (tlen)] = '\0'; \ \ free(asn1p_lval.tv_opaque.buf); \ asn1p_lval.tv_opaque.buf = p; \ asn1p_lval.tv_opaque.len = (tlen) + prev_len; \ } while(0) #define YY_NO_INPUT 1 /* Performance penalty is OK */ /* Controlled from within application */ /* Newline */ /* White-space */ #line 2090 "lex.yy.c" #define INITIAL 0 #define dash_comment 1 #define idash_comment 2 #define cpp_comment 3 #define quoted 4 #define opaque 5 #define encoding_control 6 #define with_syntax 7 #ifndef YY_NO_UNISTD_H /* Special case for "unistd.h", since it is non-ANSI. We include it way * down here because we want the user's section 1 to have been scanned first. * The user has a chance to override it with an option. */ /* %if-c-only */ #include /* %endif */ /* %if-c++-only */ /* %endif */ #endif #ifndef YY_EXTRA_TYPE #define YY_EXTRA_TYPE void * #endif /* %if-c-only Reentrant structure and macros (non-C++). */ /* %if-reentrant */ /* %if-c-only */ static int yy_init_globals (void ); /* %endif */ /* %if-reentrant */ /* %endif */ /* %endif End reentrant structures and macros. */ /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ int asn1p_lex_destroy (void ); int asn1p_get_debug (void ); void asn1p_set_debug (int debug_flag ); YY_EXTRA_TYPE asn1p_get_extra (void ); void asn1p_set_extra (YY_EXTRA_TYPE user_defined ); FILE *asn1p_get_in (void ); void asn1p_set_in (FILE * in_str ); FILE *asn1p_get_out (void ); void asn1p_set_out (FILE * out_str ); yy_size_t asn1p_get_leng (void ); char *asn1p_get_text (void ); int asn1p_get_lineno (void ); void asn1p_set_lineno (int line_number ); /* %if-bison-bridge */ /* %endif */ /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int asn1p_wrap (void ); #else extern int asn1p_wrap (void ); #endif #endif /* %not-for-header */ static void yyunput (int c,char *buf_ptr ); /* %ok-for-header */ /* %endif */ #ifndef yytext_ptr static void yy_flex_strncpy (char *,yyconst char *,int ); #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * ); #endif #ifndef YY_NO_INPUT /* %if-c-only Standard (non-C++) definition */ /* %not-for-header */ #ifdef __cplusplus static int yyinput (void ); #else static int input (void ); #endif /* %ok-for-header */ /* %endif */ #endif /* %if-c-only */ static int yy_start_stack_ptr = 0; static int yy_start_stack_depth = 0; static int *yy_start_stack = NULL; static void yy_push_state (int new_state ); static void yy_pop_state (void ); static int yy_top_state (void ); /* %endif */ /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE #define YY_READ_BUF_SIZE 8192 #endif /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO /* %if-c-only Standard (non-C++) definition */ /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ #define ECHO fwrite( asn1p_text, asn1p_leng, 1, asn1p_out ) /* %endif */ /* %if-c++-only C++ definition */ /* %endif */ #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ /* %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \ */\ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ yy_size_t n; \ for ( n = 0; n < max_size && \ (c = getc( asn1p_in )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ if ( c == EOF && ferror( asn1p_in ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ while ( (result = fread(buf, 1, max_size, asn1p_in))==0 && ferror(asn1p_in)) \ { \ if( errno != EINTR) \ { \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ break; \ } \ errno=0; \ clearerr(asn1p_in); \ } \ }\ \ /* %if-c++-only C++ definition \ */\ /* %endif */ #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */ #ifndef yyterminate #define yyterminate() return YY_NULL #endif /* Number of entries by which start-condition stack grows. */ #ifndef YY_START_STACK_INCR #define YY_START_STACK_INCR 25 #endif /* Report a fatal error. */ #ifndef YY_FATAL_ERROR /* %if-c-only */ #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) /* %endif */ /* %if-c++-only */ /* %endif */ #endif /* %if-tables-serialization structures and prototypes */ /* %not-for-header */ /* %ok-for-header */ /* %not-for-header */ /* %tables-yydmap generated elements */ /* %endif */ /* end tables serialization structures and prototypes */ /* %ok-for-header */ /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL_IS_OURS 1 /* %if-c-only Standard (non-C++) definition */ extern int asn1p_lex (void); #define YY_DECL int asn1p_lex (void) /* %endif */ /* %if-c++-only C++ definition */ /* %endif */ #endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after asn1p_text and asn1p_leng * have been set up. */ #ifndef YY_USER_ACTION #define YY_USER_ACTION #endif /* Code executed at the end of each rule. */ #ifndef YY_BREAK #define YY_BREAK break; #endif /* %% [6.0] YY_RULE_SETUP definition goes here */ #define YY_RULE_SETUP \ YY_USER_ACTION /* %not-for-header */ /** The main scanner function which does all the work. */ YY_DECL { register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; /* %% [7.0] user's declarations go here */ #line 94 "asn1p_l.l" #line 2352 "lex.yy.c" if ( !(yy_init) ) { (yy_init) = 1; #ifdef YY_USER_INIT YY_USER_INIT; #endif /* Create the reject buffer large enough to save one state per allowed character. */ if ( ! (yy_state_buf) ) (yy_state_buf) = (yy_state_type *)asn1p_alloc(YY_STATE_BUF_SIZE ); if ( ! (yy_state_buf) ) YY_FATAL_ERROR( "out of dynamic memory in asn1p_lex()" ); if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ if ( ! asn1p_in ) /* %if-c-only */ asn1p_in = stdin; /* %endif */ /* %if-c++-only */ /* %endif */ if ( ! asn1p_out ) /* %if-c-only */ asn1p_out = stdout; /* %endif */ /* %if-c++-only */ /* %endif */ if ( ! YY_CURRENT_BUFFER ) { asn1p_ensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = asn1p__create_buffer(asn1p_in,YY_BUF_SIZE ); } asn1p__load_buffer_state( ); } while ( 1 ) /* loops until end-of-file is reached */ { /* %% [8.0] yymore()-related code goes here */ yy_cp = (yy_c_buf_p); /* Support of asn1p_text. */ *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; /* %% [9.0] code to set up and find next match goes here */ yy_current_state = (yy_start); (yy_state_ptr) = (yy_state_buf); *(yy_state_ptr)++ = yy_current_state; yy_match: do { register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 746 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; *(yy_state_ptr)++ = yy_current_state; ++yy_cp; } while ( yy_current_state != 745 ); yy_find_action: /* %% [10.0] code to find the action number goes here */ yy_current_state = *--(yy_state_ptr); (yy_lp) = yy_accept[yy_current_state]; goto find_rule; /* Shut up GCC warning -Wall */ find_rule: /* we branch to this label when backing up */ for ( ; ; ) /* until we find what rule we matched */ { if ( (yy_lp) && (yy_lp) < yy_accept[yy_current_state + 1] ) { yy_act = yy_acclist[(yy_lp)]; { (yy_full_match) = yy_cp; break; } } --yy_cp; yy_current_state = *--(yy_state_ptr); (yy_lp) = yy_accept[yy_current_state]; } YY_DO_BEFORE_ACTION; /* %% [11.0] code for asn1p_lineno update goes here */ if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) { yy_size_t yyl; for ( yyl = 0; yyl < asn1p_leng; ++yyl ) if ( asn1p_text[yyl] == '\n' ) asn1p_lineno++; ; } do_action: /* This label is used only to access EOF actions. */ /* %% [12.0] debug code goes here */ if ( asn1p__flex_debug ) { if ( yy_act == 0 ) fprintf( stderr, "--scanner backing up\n" ); else if ( yy_act < 140 ) fprintf( stderr, "--accepting rule at line %ld (\"%s\")\n", (long)yy_rule_linenum[yy_act], asn1p_text ); else if ( yy_act == 140 ) fprintf( stderr, "--accepting default rule (\"%s\")\n", asn1p_text ); else if ( yy_act == 141 ) fprintf( stderr, "--(end of buffer or a NUL)\n" ); else fprintf( stderr, "--EOF (start condition %d)\n", YY_START ); } switch ( yy_act ) { /* beginning of action switch */ /* %% [13.0] actions go here */ case 1: /* rule 1 can match eol */ *yy_cp = (yy_hold_char); /* undo effects of setting up asn1p_text */ (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up asn1p_text again */ YY_RULE_SETUP #line 96 "asn1p_l.l" /* Immediately terminated long comment */ YY_BREAK case 2: *yy_cp = (yy_hold_char); /* undo effects of setting up asn1p_text */ (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up asn1p_text again */ YY_RULE_SETUP #line 97 "asn1p_l.l" yy_push_state(idash_comment); /* Incorrect, but acceptable */ YY_BREAK case 3: YY_RULE_SETUP #line 99 "asn1p_l.l" yy_pop_state(); /* Acceptable end of comment */ YY_BREAK case 4: YY_RULE_SETUP #line 102 "asn1p_l.l" asn1p_as_pointer = 1; YY_BREAK case 5: YY_RULE_SETUP #line 104 "asn1p_l.l" yy_push_state(dash_comment); YY_BREAK case 6: /* rule 6 can match eol */ YY_RULE_SETUP #line 107 "asn1p_l.l" yy_pop_state(); YY_BREAK case 7: YY_RULE_SETUP #line 109 "asn1p_l.l" yy_pop_state(); /* End of comment */ YY_BREAK case 8: YY_RULE_SETUP #line 110 "asn1p_l.l" /* Eat single dash */ YY_BREAK case 9: YY_RULE_SETUP #line 111 "asn1p_l.l" /* Eat */ YY_BREAK case 10: YY_RULE_SETUP #line 114 "asn1p_l.l" yy_push_state(cpp_comment); YY_BREAK case 11: /* rule 11 can match eol */ YY_RULE_SETUP #line 116 "asn1p_l.l" /* Eat */ YY_BREAK case 12: YY_RULE_SETUP #line 117 "asn1p_l.l" yy_pop_state(); YY_BREAK case 13: YY_RULE_SETUP #line 118 "asn1p_l.l" /* Eat */ YY_BREAK /* * This is state is being set from corresponding .y module when * higher-level data is necessary to make proper parsing of the * underlying data. Thus, we enter the state and save * everything for later processing. */ case 14: YY_RULE_SETUP #line 130 "asn1p_l.l" { yy_push_state(opaque); asn1p_lval.tv_opaque.buf = strdup(asn1p_text); asn1p_lval.tv_opaque.len = asn1p_leng; return TOK_opaque; } YY_BREAK case 15: YY_RULE_SETUP #line 137 "asn1p_l.l" { yy_pop_state(); asn1p_lval.tv_opaque.buf = strdup(asn1p_text); asn1p_lval.tv_opaque.len = asn1p_leng; return TOK_opaque; } YY_BREAK case 16: /* rule 16 can match eol */ YY_RULE_SETUP #line 144 "asn1p_l.l" { asn1p_lval.tv_opaque.buf = strdup(asn1p_text); asn1p_lval.tv_opaque.len = asn1p_leng; return TOK_opaque; } YY_BREAK case 17: YY_RULE_SETUP #line 150 "asn1p_l.l" { fprintf(stderr, "ASN.1 Parser syncronization failure: " "\"%s\" at line %d must not appear " "inside value definition\n", asn1p_text, asn1p_lineno); return -1; } YY_BREAK case 18: YY_RULE_SETUP #line 159 "asn1p_l.l" { asn1p_lval.tv_opaque.buf = strdup(asn1p_text); asn1p_lval.tv_opaque.len = asn1p_leng; return TOK_opaque; } YY_BREAK case 19: /* rule 19 can match eol */ YY_RULE_SETUP #line 167 "asn1p_l.l" { asn1p_lval.tv_opaque.buf = 0; asn1p_lval.tv_opaque.len = 0; QAPPEND(asn1p_text+1, asn1p_leng-1); yy_push_state(quoted); } YY_BREAK case 20: YY_RULE_SETUP #line 175 "asn1p_l.l" { QAPPEND(asn1p_text, asn1p_leng-1); } /* Add a single quote */ YY_BREAK case 21: /* rule 21 can match eol */ YY_RULE_SETUP #line 176 "asn1p_l.l" { QAPPEND(asn1p_text, asn1p_leng); } YY_BREAK case 22: YY_RULE_SETUP #line 178 "asn1p_l.l" { yy_pop_state(); /* Do not append last quote: // QAPPEND(asn1p_text, asn1p_leng); */ if(asn1p_lexer_pedantic_1990 && strchr(asn1p_text, '\n')) { fprintf(stderr, "%s: " "Newlines are prohibited by ASN.1:1990\n", asn1p_lval.tv_opaque.buf); return -1; } return TOK_cstring; } YY_BREAK case 23: YY_RULE_SETUP #line 197 "asn1p_l.l" { const char *s = "ENCODING-CONTROL"; const char *p = s + sizeof("ENCODING-CONTROL") - 2; for(; p >= s; p--) unput(*p); yy_pop_state(); } YY_BREAK case 24: YY_RULE_SETUP #line 203 "asn1p_l.l" unput('D'); unput('N'); unput('E'); yy_pop_state(); YY_BREAK case 25: YY_RULE_SETUP #line 204 "asn1p_l.l" YY_BREAK case 26: YY_RULE_SETUP #line 205 "asn1p_l.l" YY_BREAK case 27: YY_RULE_SETUP #line 206 "asn1p_l.l" /* Eat everything else */ YY_BREAK case 28: /* rule 28 can match eol */ YY_RULE_SETUP #line 207 "asn1p_l.l" YY_BREAK case 29: /* rule 29 can match eol */ YY_RULE_SETUP #line 210 "asn1p_l.l" { /* " \t\r\n" weren't allowed in ASN.1:1990. */ asn1p_lval.tv_str = asn1p_text; return TOK_hstring; } YY_BREAK case 30: /* rule 30 can match eol */ YY_RULE_SETUP #line 216 "asn1p_l.l" { /* " \t\r\n" weren't allowed in ASN.1:1990. */ asn1p_lval.tv_str = strdup(asn1p_text); return TOK_bstring; } YY_BREAK case 31: YY_RULE_SETUP #line 223 "asn1p_l.l" { asn1p_lval.a_int = _lex_atoi(asn1p_text); if(errno == ERANGE) return -1; return TOK_number_negative; } YY_BREAK case 32: YY_RULE_SETUP #line 230 "asn1p_l.l" { asn1p_lval.a_int = _lex_atoi(asn1p_text); if(errno == ERANGE) return -1; return TOK_number; } YY_BREAK case 33: YY_RULE_SETUP #line 237 "asn1p_l.l" { asn1p_lval.a_int = _lex_atoi(asn1p_text); if(errno == ERANGE) return -1; return TOK_number; } YY_BREAK case 34: YY_RULE_SETUP #line 244 "asn1p_l.l" { asn1p_lval.a_dbl = _lex_atod(asn1p_text); if(errno == ERANGE) return -1; return TOK_realnumber; } YY_BREAK case 35: YY_RULE_SETUP #line 251 "asn1p_l.l" return TOK_ABSENT; YY_BREAK case 36: YY_RULE_SETUP #line 252 "asn1p_l.l" return TOK_ALL; YY_BREAK case 37: YY_RULE_SETUP #line 253 "asn1p_l.l" { /* Appeared in 1990, removed in 1997 */ if(TYPE_LIFETIME(1990, 1997)) return TOK_ANY; fprintf(stderr, "Keyword \"%s\" at line %d " "is obsolete\n", asn1p_text, asn1p_lineno); REJECT; } YY_BREAK case 38: YY_RULE_SETUP #line 261 "asn1p_l.l" return TOK_APPLICATION; YY_BREAK case 39: YY_RULE_SETUP #line 262 "asn1p_l.l" return TOK_AUTOMATIC; YY_BREAK case 40: YY_RULE_SETUP #line 263 "asn1p_l.l" return TOK_BEGIN; YY_BREAK case 41: YY_RULE_SETUP #line 264 "asn1p_l.l" return TOK_BIT; YY_BREAK case 42: YY_RULE_SETUP #line 265 "asn1p_l.l" { if(TYPE_LIFETIME(1994, 0)) return TOK_BMPString; REJECT; } YY_BREAK case 43: YY_RULE_SETUP #line 270 "asn1p_l.l" return TOK_BOOLEAN; YY_BREAK case 44: YY_RULE_SETUP #line 271 "asn1p_l.l" return TOK_BY; YY_BREAK case 45: YY_RULE_SETUP #line 272 "asn1p_l.l" return TOK_CHARACTER; YY_BREAK case 46: YY_RULE_SETUP #line 273 "asn1p_l.l" return TOK_CHOICE; YY_BREAK case 47: YY_RULE_SETUP #line 274 "asn1p_l.l" return TOK_CLASS; YY_BREAK case 48: YY_RULE_SETUP #line 275 "asn1p_l.l" return TOK_COMPONENT; YY_BREAK case 49: YY_RULE_SETUP #line 276 "asn1p_l.l" return TOK_COMPONENTS; YY_BREAK case 50: YY_RULE_SETUP #line 277 "asn1p_l.l" return TOK_CONSTRAINED; YY_BREAK case 51: YY_RULE_SETUP #line 278 "asn1p_l.l" return TOK_CONTAINING; YY_BREAK case 52: YY_RULE_SETUP #line 279 "asn1p_l.l" return TOK_DEFAULT; YY_BREAK case 53: YY_RULE_SETUP #line 280 "asn1p_l.l" { /* Appeared in 1990, removed in 1997 */ if(TYPE_LIFETIME(1990, 1997)) return TOK_DEFINED; fprintf(stderr, "Keyword \"%s\" at line %d " "is obsolete\n", asn1p_text, asn1p_lineno); /* Deprecated since */ REJECT; } YY_BREAK case 54: YY_RULE_SETUP #line 289 "asn1p_l.l" return TOK_DEFINITIONS; YY_BREAK case 55: YY_RULE_SETUP #line 290 "asn1p_l.l" return TOK_EMBEDDED; YY_BREAK case 56: YY_RULE_SETUP #line 291 "asn1p_l.l" return TOK_ENCODED; YY_BREAK case 57: YY_RULE_SETUP #line 292 "asn1p_l.l" return TOK_ENCODING_CONTROL; YY_BREAK case 58: YY_RULE_SETUP #line 293 "asn1p_l.l" return TOK_END; YY_BREAK case 59: YY_RULE_SETUP #line 294 "asn1p_l.l" return TOK_ENUMERATED; YY_BREAK case 60: YY_RULE_SETUP #line 295 "asn1p_l.l" return TOK_EXCEPT; YY_BREAK case 61: YY_RULE_SETUP #line 296 "asn1p_l.l" return TOK_EXPLICIT; YY_BREAK case 62: YY_RULE_SETUP #line 297 "asn1p_l.l" return TOK_EXPORTS; YY_BREAK case 63: YY_RULE_SETUP #line 298 "asn1p_l.l" return TOK_EXTENSIBILITY; YY_BREAK case 64: YY_RULE_SETUP #line 299 "asn1p_l.l" return TOK_EXTERNAL; YY_BREAK case 65: YY_RULE_SETUP #line 300 "asn1p_l.l" return TOK_FALSE; YY_BREAK case 66: YY_RULE_SETUP #line 301 "asn1p_l.l" return TOK_FROM; YY_BREAK case 67: YY_RULE_SETUP #line 302 "asn1p_l.l" return TOK_GeneralizedTime; YY_BREAK case 68: YY_RULE_SETUP #line 303 "asn1p_l.l" return TOK_GeneralString; YY_BREAK case 69: YY_RULE_SETUP #line 304 "asn1p_l.l" return TOK_GraphicString; YY_BREAK case 70: YY_RULE_SETUP #line 305 "asn1p_l.l" return TOK_IA5String; YY_BREAK case 71: YY_RULE_SETUP #line 306 "asn1p_l.l" return TOK_IDENTIFIER; YY_BREAK case 72: YY_RULE_SETUP #line 307 "asn1p_l.l" return TOK_IMPLICIT; YY_BREAK case 73: YY_RULE_SETUP #line 308 "asn1p_l.l" return TOK_IMPLIED; YY_BREAK case 74: YY_RULE_SETUP #line 309 "asn1p_l.l" return TOK_IMPORTS; YY_BREAK case 75: YY_RULE_SETUP #line 310 "asn1p_l.l" return TOK_INCLUDES; YY_BREAK case 76: YY_RULE_SETUP #line 311 "asn1p_l.l" return TOK_INSTANCE; YY_BREAK case 77: YY_RULE_SETUP #line 312 "asn1p_l.l" return TOK_INSTRUCTIONS; YY_BREAK case 78: YY_RULE_SETUP #line 313 "asn1p_l.l" return TOK_INTEGER; YY_BREAK case 79: YY_RULE_SETUP #line 314 "asn1p_l.l" return TOK_INTERSECTION; YY_BREAK case 80: YY_RULE_SETUP #line 315 "asn1p_l.l" return TOK_ISO646String; YY_BREAK case 81: YY_RULE_SETUP #line 316 "asn1p_l.l" return TOK_MAX; YY_BREAK case 82: YY_RULE_SETUP #line 317 "asn1p_l.l" return TOK_MIN; YY_BREAK case 83: YY_RULE_SETUP #line 318 "asn1p_l.l" return TOK_MINUS_INFINITY; YY_BREAK case 84: YY_RULE_SETUP #line 319 "asn1p_l.l" return TOK_NULL; YY_BREAK case 85: YY_RULE_SETUP #line 320 "asn1p_l.l" return TOK_NumericString; YY_BREAK case 86: YY_RULE_SETUP #line 321 "asn1p_l.l" return TOK_OBJECT; YY_BREAK case 87: YY_RULE_SETUP #line 322 "asn1p_l.l" return TOK_ObjectDescriptor; YY_BREAK case 88: YY_RULE_SETUP #line 323 "asn1p_l.l" return TOK_OCTET; YY_BREAK case 89: YY_RULE_SETUP #line 324 "asn1p_l.l" return TOK_OF; YY_BREAK case 90: YY_RULE_SETUP #line 325 "asn1p_l.l" return TOK_OPTIONAL; YY_BREAK case 91: YY_RULE_SETUP #line 326 "asn1p_l.l" return TOK_PATTERN; YY_BREAK case 92: YY_RULE_SETUP #line 327 "asn1p_l.l" return TOK_PDV; YY_BREAK case 93: YY_RULE_SETUP #line 328 "asn1p_l.l" return TOK_PLUS_INFINITY; YY_BREAK case 94: YY_RULE_SETUP #line 329 "asn1p_l.l" return TOK_PRESENT; YY_BREAK case 95: YY_RULE_SETUP #line 330 "asn1p_l.l" return TOK_PrintableString; YY_BREAK case 96: YY_RULE_SETUP #line 331 "asn1p_l.l" return TOK_PRIVATE; YY_BREAK case 97: YY_RULE_SETUP #line 332 "asn1p_l.l" return TOK_REAL; YY_BREAK case 98: YY_RULE_SETUP #line 333 "asn1p_l.l" return TOK_RELATIVE_OID; YY_BREAK case 99: YY_RULE_SETUP #line 334 "asn1p_l.l" return TOK_SEQUENCE; YY_BREAK case 100: YY_RULE_SETUP #line 335 "asn1p_l.l" return TOK_SET; YY_BREAK case 101: YY_RULE_SETUP #line 336 "asn1p_l.l" return TOK_SIZE; YY_BREAK case 102: YY_RULE_SETUP #line 337 "asn1p_l.l" return TOK_STRING; YY_BREAK case 103: YY_RULE_SETUP #line 338 "asn1p_l.l" return TOK_SYNTAX; YY_BREAK case 104: YY_RULE_SETUP #line 339 "asn1p_l.l" return TOK_T61String; YY_BREAK case 105: YY_RULE_SETUP #line 340 "asn1p_l.l" return TOK_TAGS; YY_BREAK case 106: YY_RULE_SETUP #line 341 "asn1p_l.l" return TOK_TeletexString; YY_BREAK case 107: YY_RULE_SETUP #line 342 "asn1p_l.l" return TOK_TRUE; YY_BREAK case 108: YY_RULE_SETUP #line 343 "asn1p_l.l" return TOK_UNION; YY_BREAK case 109: YY_RULE_SETUP #line 344 "asn1p_l.l" return TOK_UNIQUE; YY_BREAK case 110: YY_RULE_SETUP #line 345 "asn1p_l.l" return TOK_UNIVERSAL; YY_BREAK case 111: YY_RULE_SETUP #line 346 "asn1p_l.l" { if(TYPE_LIFETIME(1994, 0)) return TOK_UniversalString; REJECT; } YY_BREAK case 112: YY_RULE_SETUP #line 351 "asn1p_l.l" return TOK_UTCTime; YY_BREAK case 113: YY_RULE_SETUP #line 352 "asn1p_l.l" { if(TYPE_LIFETIME(1994, 0)) return TOK_UTF8String; REJECT; } YY_BREAK case 114: YY_RULE_SETUP #line 357 "asn1p_l.l" return TOK_VideotexString; YY_BREAK case 115: YY_RULE_SETUP #line 358 "asn1p_l.l" return TOK_VisibleString; YY_BREAK case 116: YY_RULE_SETUP #line 359 "asn1p_l.l" return TOK_WITH; YY_BREAK case 117: YY_RULE_SETUP #line 362 "asn1p_l.l" { asn1p_lval.tv_str = strdup(asn1p_text); return TOK_typefieldreference; } YY_BREAK case 118: YY_RULE_SETUP #line 367 "asn1p_l.l" { asn1p_lval.tv_str = strdup(asn1p_text); return TOK_valuefieldreference; } YY_BREAK case 119: YY_RULE_SETUP #line 373 "asn1p_l.l" { asn1p_lval.tv_str = strdup(asn1p_text); return TOK_identifier; } YY_BREAK /* * objectclassreference */ case 120: YY_RULE_SETUP #line 381 "asn1p_l.l" { asn1p_lval.tv_str = strdup(asn1p_text); return TOK_capitalreference; } YY_BREAK /* * typereference, modulereference * NOTE: TOK_objectclassreference must be combined * with this token to produce true typereference. */ case 121: YY_RULE_SETUP #line 391 "asn1p_l.l" { asn1p_lval.tv_str = strdup(asn1p_text); return TOK_typereference; } YY_BREAK case 122: YY_RULE_SETUP #line 396 "asn1p_l.l" return TOK_PPEQ; YY_BREAK case 123: YY_RULE_SETUP #line 398 "asn1p_l.l" return TOK_ThreeDots; YY_BREAK case 124: YY_RULE_SETUP #line 399 "asn1p_l.l" return TOK_TwoDots; YY_BREAK case 125: YY_RULE_SETUP #line 403 "asn1p_l.l" { asn1p_lval.tv_str = strdup(asn1p_text); return TOK_Literal; } YY_BREAK case 126: YY_RULE_SETUP #line 408 "asn1p_l.l" { asn1p_lval.tv_str = strdup(asn1p_text); return TOK_Literal; } YY_BREAK case 127: YY_RULE_SETUP #line 413 "asn1p_l.l" { yy_push_state(with_syntax); asn1p_lval.tv_str = strdup(asn1p_text); return TOK_Literal; } YY_BREAK case 128: YY_RULE_SETUP #line 419 "asn1p_l.l" return '['; YY_BREAK case 129: YY_RULE_SETUP #line 420 "asn1p_l.l" return ']'; YY_BREAK case 130: /* rule 130 can match eol */ YY_RULE_SETUP #line 422 "asn1p_l.l" { asn1p_lval.tv_opaque.buf = strdup(asn1p_text); asn1p_lval.tv_opaque.len = asn1p_leng; return TOK_whitespace; } YY_BREAK case 131: YY_RULE_SETUP #line 428 "asn1p_l.l" { yy_pop_state(); if(YYSTATE == with_syntax) { asn1p_lval.tv_str = strdup(asn1p_text); return TOK_Literal; } else { return '}'; } } YY_BREAK case 132: /* rule 132 can match eol */ YY_RULE_SETUP #line 441 "asn1p_l.l" /* Ignore whitespace */ YY_BREAK case 133: /* rule 133 can match eol */ YY_RULE_SETUP #line 444 "asn1p_l.l" { asn1c_integer_t v1 = -1, v2 = -1; char *p; for(p = asn1p_text; *p; p++) if(*p >= '0' && *p <= '9') { v1 = _lex_atoi(p); break; } while(*p >= '0' && *p <= '9') p++; /* Skip digits */ for(; *p; p++) if(*p >= '0' && *p <= '9') { v2 = _lex_atoi(p); break; } if(v1 < 0 || v1 > 7) { fprintf(stderr, "%s at line %d: X.680:2003, #37.14 " "mandates 0..7 range for Tuple's TableColumn\n", asn1p_text, asn1p_lineno); return -1; } if(v2 < 0 || v2 > 15) { fprintf(stderr, "%s at line %d: X.680:2003, #37.14 " "mandates 0..15 range for Tuple's TableRow\n", asn1p_text, asn1p_lineno); return -1; } asn1p_lval.a_int = (v1 << 4) + v2; return TOK_tuple; } YY_BREAK case 134: /* rule 134 can match eol */ YY_RULE_SETUP #line 469 "asn1p_l.l" { asn1c_integer_t v1 = -1, v2 = -1, v3 = -1, v4 = -1; char *p; for(p = asn1p_text; *p; p++) if(*p >= '0' && *p <= '9') { v1 = _lex_atoi(p); break; } while(*p >= '0' && *p <= '9') p++; /* Skip digits */ for(; *p; p++) if(*p >= '0' && *p <= '9') { v2 = _lex_atoi(p); break; } while(*p >= '0' && *p <= '9') p++; for(; *p; p++) if(*p >= '0' && *p <= '9') { v3 = _lex_atoi(p); break; } while(*p >= '0' && *p <= '9') p++; for(; *p; p++) if(*p >= '0' && *p <= '9') { v4 = _lex_atoi(p); break; } if(v1 < 0 || v1 > 127) { fprintf(stderr, "%s at line %d: X.680:2003, #37.12 " "mandates 0..127 range for Quadruple's Group\n", asn1p_text, asn1p_lineno); return -1; } if(v2 < 0 || v2 > 255) { fprintf(stderr, "%s at line %d: X.680:2003, #37.12 " "mandates 0..255 range for Quadruple's Plane\n", asn1p_text, asn1p_lineno); return -1; } if(v3 < 0 || v3 > 255) { fprintf(stderr, "%s at line %d: X.680:2003, #37.12 " "mandates 0..255 range for Quadruple's Row\n", asn1p_text, asn1p_lineno); return -1; } if(v4 < 0 || v4 > 255) { fprintf(stderr, "%s at line %d: X.680:2003, #37.12 " "mandates 0..255 range for Quadruple's Cell\n", asn1p_text, asn1p_lineno); return -1; } asn1p_lval.a_int = (v1 << 24) | (v2 << 16) | (v3 << 8) | v4; return TOK_quadruple; } YY_BREAK case 135: YY_RULE_SETUP #line 513 "asn1p_l.l" return TOK_VBracketLeft; YY_BREAK case 136: YY_RULE_SETUP #line 514 "asn1p_l.l" return TOK_VBracketRight; YY_BREAK case 137: YY_RULE_SETUP #line 516 "asn1p_l.l" return asn1p_text[0]; YY_BREAK case 138: /* rule 138 can match eol */ YY_RULE_SETUP #line 518 "asn1p_l.l" { if(TYPE_LIFETIME(1994, 0)) fprintf(stderr, "ERROR: "); fprintf(stderr, "Symbol '%c' at line %d is prohibited " "by ASN.1:1994 and ASN.1:1997\n", asn1p_text[0], asn1p_lineno); if(TYPE_LIFETIME(1994, 0)) return -1; } YY_BREAK case 139: YY_RULE_SETUP #line 529 "asn1p_l.l" { fprintf(stderr, "Unexpected token at line %d: \"%s\"\n", asn1p_lineno, asn1p_text); while(YYSTATE != INITIAL) yy_pop_state(); if(0) { yy_top_state(); /* Just to use this function. */ yy_fatal_error("Parse error"); } return -1; } YY_BREAK case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(dash_comment): case YY_STATE_EOF(idash_comment): case YY_STATE_EOF(cpp_comment): case YY_STATE_EOF(quoted): case YY_STATE_EOF(opaque): case YY_STATE_EOF(encoding_control): case YY_STATE_EOF(with_syntax): #line 542 "asn1p_l.l" { while(YYSTATE != INITIAL) yy_pop_state(); yyterminate(); } YY_BREAK case 140: YY_RULE_SETUP #line 549 "asn1p_l.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK #line 3474 "lex.yy.c" case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = (yy_hold_char); YY_RESTORE_YY_MORE_OFFSET if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed asn1p_in at a new source and called * asn1p_lex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; YY_CURRENT_BUFFER_LVALUE->yy_input_file = asn1p_in; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the * end-of-buffer state). Contrast this with the test * in input(). */ if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) { /* This was really a NUL. */ yy_state_type yy_next_state; (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we don't * want to build jamming into it because then it * will run more slowly). */ yy_next_state = yy_try_NUL_trans( yy_current_state ); yy_bp = (yytext_ptr) + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ yy_cp = ++(yy_c_buf_p); yy_current_state = yy_next_state; goto yy_match; } else { /* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */ yy_cp = (yy_c_buf_p); goto yy_find_action; } } else switch ( yy_get_next_buffer( ) ) { case EOB_ACT_END_OF_FILE: { (yy_did_buffer_switch_on_eof) = 0; if ( asn1p_wrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * asn1p_text, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; } else { if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: (yy_c_buf_p) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_find_action; } break; } default: YY_FATAL_ERROR( "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ } /* end of asn1p_lex */ /* %ok-for-header */ /* %if-c++-only */ /* %not-for-header */ /* %ok-for-header */ /* %endif */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ /* %if-c-only */ static int yy_get_next_buffer (void) /* %endif */ /* %if-c++-only */ /* %endif */ { register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; register char *source = (yytext_ptr); register int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; } else { /* We matched some text prior to the EOB, first * process it. */ return EOB_ACT_LAST_MATCH; } } /* Try to read more data. */ /* First move last chars to start of buffer. */ number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; else { yy_size_t num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ YY_FATAL_ERROR( "input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), (yy_n_chars), num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } if ( (yy_n_chars) == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; asn1p_restart(asn1p_in ); } else { ret_val = EOB_ACT_LAST_MATCH; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) asn1p_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); } (yy_n_chars) += number_to_move; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ /* %if-c-only */ /* %not-for-header */ static yy_state_type yy_get_previous_state (void) /* %endif */ /* %if-c++-only */ /* %endif */ { register yy_state_type yy_current_state; register char *yy_cp; /* %% [15.0] code to get the start state into yy_current_state goes here */ yy_current_state = (yy_start); (yy_state_ptr) = (yy_state_buf); *(yy_state_ptr)++ = yy_current_state; for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { /* %% [16.0] code to find the next state goes here */ register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 746 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; *(yy_state_ptr)++ = yy_current_state; } return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ /* %if-c-only */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) /* %endif */ /* %if-c++-only */ /* %endif */ { register int yy_is_jam; /* %% [17.0] code to find the next state, and perhaps do backing up, goes here */ register YY_CHAR yy_c = 1; while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 746 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 745); if ( ! yy_is_jam ) *(yy_state_ptr)++ = yy_current_state; return yy_is_jam ? 0 : yy_current_state; } /* %if-c-only */ static void yyunput (int c, register char * yy_bp ) /* %endif */ /* %if-c++-only */ /* %endif */ { register char *yy_cp; yy_cp = (yy_c_buf_p); /* undo effects of setting up asn1p_text */ *yy_cp = (yy_hold_char); if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ register yy_size_t number_to_move = (yy_n_chars) + 2; register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; register char *source = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) *--dest = *--source; yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); } *--yy_cp = (char) c; /* %% [18.0] update asn1p_lineno here */ if ( c == '\n' ){ --asn1p_lineno; } (yytext_ptr) = yy_bp; (yy_hold_char) = *yy_cp; (yy_c_buf_p) = yy_cp; } /* %if-c-only */ /* %endif */ /* %if-c-only */ #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) #else static int input (void) #endif /* %endif */ /* %if-c++-only */ /* %endif */ { int c; *(yy_c_buf_p) = (yy_hold_char); if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) /* This was really a NUL. */ *(yy_c_buf_p) = '\0'; else { /* need more input */ yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() * sees that we've accumulated a * token and flags that we need to * try matching the token before * proceeding. But for input(), * there's no matching to consider. * So convert the EOB_ACT_LAST_MATCH * to EOB_ACT_END_OF_FILE. */ /* Reset buffer status. */ asn1p_restart(asn1p_in ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { if ( asn1p_wrap( ) ) return 0; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); #else return input(); #endif } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + offset; break; } } } c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ *(yy_c_buf_p) = '\0'; /* preserve asn1p_text */ (yy_hold_char) = *++(yy_c_buf_p); /* %% [19.0] update BOL and asn1p_lineno */ if ( c == '\n' ) asn1p_lineno++; ; return c; } /* %if-c-only */ #endif /* ifndef YY_NO_INPUT */ /* %endif */ /** Immediately switch to a different input stream. * @param input_file A readable stream. * * @note This function does not reset the start condition to @c INITIAL . */ /* %if-c-only */ void asn1p_restart (FILE * input_file ) /* %endif */ /* %if-c++-only */ /* %endif */ { if ( ! YY_CURRENT_BUFFER ){ asn1p_ensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = asn1p__create_buffer(asn1p_in,YY_BUF_SIZE ); } asn1p__init_buffer(YY_CURRENT_BUFFER,input_file ); asn1p__load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * */ /* %if-c-only */ void asn1p__switch_to_buffer (YY_BUFFER_STATE new_buffer ) /* %endif */ /* %if-c++-only */ /* %endif */ { /* TODO. We should be able to replace this entire function body * with * asn1p_pop_buffer_state(); * asn1p_push_buffer_state(new_buffer); */ asn1p_ensure_buffer_stack (); if ( YY_CURRENT_BUFFER == new_buffer ) return; if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } YY_CURRENT_BUFFER_LVALUE = new_buffer; asn1p__load_buffer_state( ); /* We don't actually know whether we did this switch during * EOF (asn1p_wrap()) processing, but the only time this flag * is looked at is after asn1p_wrap() is called, so it's safe * to go ahead and always set it. */ (yy_did_buffer_switch_on_eof) = 1; } /* %if-c-only */ static void asn1p__load_buffer_state (void) /* %endif */ /* %if-c++-only */ /* %endif */ { (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; asn1p_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file; (yy_hold_char) = *(yy_c_buf_p); } /** Allocate and initialize an input buffer state. * @param file A readable stream. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. * * @return the allocated buffer state. */ /* %if-c-only */ YY_BUFFER_STATE asn1p__create_buffer (FILE * file, int size ) /* %endif */ /* %if-c++-only */ /* %endif */ { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) asn1p_alloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in asn1p__create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->yy_ch_buf = (char *) asn1p_alloc(b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in asn1p__create_buffer()" ); b->yy_is_our_buffer = 1; asn1p__init_buffer(b,file ); return b; } /** Destroy the buffer. * @param b a buffer created with asn1p__create_buffer() * */ /* %if-c-only */ void asn1p__delete_buffer (YY_BUFFER_STATE b ) /* %endif */ /* %if-c++-only */ /* %endif */ { if ( ! b ) return; if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) asn1p_free((void *) b->yy_ch_buf ); asn1p_free((void *) b ); } /* %if-c-only */ /* %endif */ /* %if-c++-only */ /* %endif */ /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a asn1p_restart() or at EOF. */ /* %if-c-only */ static void asn1p__init_buffer (YY_BUFFER_STATE b, FILE * file ) /* %endif */ /* %if-c++-only */ /* %endif */ { int oerrno = errno; asn1p__flush_buffer(b ); b->yy_input_file = file; b->yy_fill_buffer = 1; /* If b is the current buffer, then asn1p__init_buffer was _probably_ * called from asn1p_restart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ if (b != YY_CURRENT_BUFFER){ b->yy_bs_lineno = 1; b->yy_bs_column = 0; } /* %if-c-only */ b->yy_is_interactive = 0; /* %endif */ /* %if-c++-only */ /* %endif */ errno = oerrno; } /** Discard all buffered characters. On the next scan, YY_INPUT will be called. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * */ /* %if-c-only */ void asn1p__flush_buffer (YY_BUFFER_STATE b ) /* %endif */ /* %if-c++-only */ /* %endif */ { if ( ! b ) return; b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; b->yy_buf_pos = &b->yy_ch_buf[0]; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) asn1p__load_buffer_state( ); } /* %if-c-or-c++ */ /** Pushes the new state onto the stack. The new state becomes * the current state. This function will allocate the stack * if necessary. * @param new_buffer The new state. * */ /* %if-c-only */ void asn1p_push_buffer_state (YY_BUFFER_STATE new_buffer ) /* %endif */ /* %if-c++-only */ /* %endif */ { if (new_buffer == NULL) return; asn1p_ensure_buffer_stack(); /* This block is copied from asn1p__switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } /* Only push if top exists. Otherwise, replace top. */ if (YY_CURRENT_BUFFER) (yy_buffer_stack_top)++; YY_CURRENT_BUFFER_LVALUE = new_buffer; /* copied from asn1p__switch_to_buffer. */ asn1p__load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } /* %endif */ /* %if-c-or-c++ */ /** Removes and deletes the top of the stack, if present. * The next element becomes the new top. * */ /* %if-c-only */ void asn1p_pop_buffer_state (void) /* %endif */ /* %if-c++-only */ /* %endif */ { if (!YY_CURRENT_BUFFER) return; asn1p__delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { asn1p__load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } } /* %endif */ /* %if-c-or-c++ */ /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ /* %if-c-only */ static void asn1p_ensure_buffer_stack (void) /* %endif */ /* %if-c++-only */ /* %endif */ { yy_size_t num_to_alloc; if (!(yy_buffer_stack)) { /* First allocation is just for 2 elements, since we don't know if this * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ num_to_alloc = 1; (yy_buffer_stack) = (struct yy_buffer_state**)asn1p_alloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in asn1p_ensure_buffer_stack()" ); memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; } if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ /* Increase the buffer to prepare for a possible push. */ int grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; (yy_buffer_stack) = (struct yy_buffer_state**)asn1p_realloc ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in asn1p_ensure_buffer_stack()" ); /* zero only the new slots.*/ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; } } /* %endif */ /* %if-c-only */ /** Setup the input buffer state to scan directly from a user-specified character buffer. * @param base the character buffer * @param size the size in bytes of the character buffer * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE asn1p__scan_buffer (char * base, yy_size_t size ) { YY_BUFFER_STATE b; if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; b = (YY_BUFFER_STATE) asn1p_alloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in asn1p__scan_buffer()" ); b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; b->yy_input_file = 0; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; asn1p__switch_to_buffer(b ); return b; } /* %endif */ /* %if-c-only */ /** Setup the input buffer state to scan a string. The next call to asn1p_lex() will * scan from a @e copy of @a str. * @param yystr a NUL-terminated string to scan * * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use * asn1p__scan_bytes() instead. */ YY_BUFFER_STATE asn1p__scan_string (yyconst char * yystr ) { return asn1p__scan_bytes(yystr,strlen(yystr) ); } /* %endif */ /* %if-c-only */ /** Setup the input buffer state to scan the given bytes. The next call to asn1p_lex() will * scan from a @e copy of @a bytes. * @param bytes the byte buffer to scan * @param len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE asn1p__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) { YY_BUFFER_STATE b; char *buf; yy_size_t n, i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; buf = (char *) asn1p_alloc(n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in asn1p__scan_bytes()" ); for ( i = 0; i < _yybytes_len; ++i ) buf[i] = yybytes[i]; buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; b = asn1p__scan_buffer(buf,n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in asn1p__scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. */ b->yy_is_our_buffer = 1; return b; } /* %endif */ /* %if-c-only */ static void yy_push_state (int new_state ) /* %endif */ /* %if-c++-only */ /* %endif */ { if ( (yy_start_stack_ptr) >= (yy_start_stack_depth) ) { yy_size_t new_size; (yy_start_stack_depth) += YY_START_STACK_INCR; new_size = (yy_start_stack_depth) * sizeof( int ); if ( ! (yy_start_stack) ) (yy_start_stack) = (int *) asn1p_alloc(new_size ); else (yy_start_stack) = (int *) asn1p_realloc((void *) (yy_start_stack),new_size ); if ( ! (yy_start_stack) ) YY_FATAL_ERROR( "out of memory expanding start-condition stack" ); } (yy_start_stack)[(yy_start_stack_ptr)++] = YY_START; BEGIN(new_state); } /* %if-c-only */ static void yy_pop_state (void) /* %endif */ /* %if-c++-only */ /* %endif */ { if ( --(yy_start_stack_ptr) < 0 ) YY_FATAL_ERROR( "start-condition stack underflow" ); BEGIN((yy_start_stack)[(yy_start_stack_ptr)]); } /* %if-c-only */ static int yy_top_state (void) /* %endif */ /* %if-c++-only */ /* %endif */ { return (yy_start_stack)[(yy_start_stack_ptr) - 1]; } #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif /* %if-c-only */ static void yy_fatal_error (yyconst char* msg ) { (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } /* %endif */ /* %if-c++-only */ /* %endif */ /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ do \ { \ /* Undo effects of setting up asn1p_text. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ asn1p_text[asn1p_leng] = (yy_hold_char); \ (yy_c_buf_p) = asn1p_text + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ *(yy_c_buf_p) = '\0'; \ asn1p_leng = yyless_macro_arg; \ } \ while ( 0 ) /* Accessor methods (get/set functions) to struct members. */ /* %if-c-only */ /* %if-reentrant */ /* %endif */ /** Get the current line number. * */ int asn1p_get_lineno (void) { return asn1p_lineno; } /** Get the input stream. * */ FILE *asn1p_get_in (void) { return asn1p_in; } /** Get the output stream. * */ FILE *asn1p_get_out (void) { return asn1p_out; } /** Get the length of the current token. * */ yy_size_t asn1p_get_leng (void) { return asn1p_leng; } /** Get the current token. * */ char *asn1p_get_text (void) { return asn1p_text; } /* %if-reentrant */ /* %endif */ /** Set the current line number. * @param line_number * */ void asn1p_set_lineno (int line_number ) { asn1p_lineno = line_number; } /** Set the input stream. This does not discard the current * input buffer. * @param in_str A readable stream. * * @see asn1p__switch_to_buffer */ void asn1p_set_in (FILE * in_str ) { asn1p_in = in_str ; } void asn1p_set_out (FILE * out_str ) { asn1p_out = out_str ; } int asn1p_get_debug (void) { return asn1p__flex_debug; } void asn1p_set_debug (int bdebug ) { asn1p__flex_debug = bdebug ; } /* %endif */ /* %if-reentrant */ /* %if-bison-bridge */ /* %endif */ /* %endif if-c-only */ /* %if-c-only */ static int yy_init_globals (void) { /* Initialization is the same as for the non-reentrant scanner. * This function is called from asn1p_lex_destroy(), so don't allocate here. */ /* We do not touch asn1p_lineno unless the option is enabled. */ asn1p_lineno = 1; (yy_buffer_stack) = 0; (yy_buffer_stack_top) = 0; (yy_buffer_stack_max) = 0; (yy_c_buf_p) = (char *) 0; (yy_init) = 0; (yy_start) = 0; (yy_start_stack_ptr) = 0; (yy_start_stack_depth) = 0; (yy_start_stack) = NULL; (yy_state_buf) = 0; (yy_state_ptr) = 0; (yy_full_match) = 0; (yy_lp) = 0; /* Defined in main.c */ #ifdef YY_STDINIT asn1p_in = stdin; asn1p_out = stdout; #else asn1p_in = (FILE *) 0; asn1p_out = (FILE *) 0; #endif /* For future reference: Set errno on error, since we are called by * asn1p_lex_init() */ return 0; } /* %endif */ /* %if-c-only SNIP! this currently causes conflicts with the c++ scanner */ /* asn1p_lex_destroy is for both reentrant and non-reentrant scanners. */ int asn1p_lex_destroy (void) { /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ asn1p__delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; asn1p_pop_buffer_state(); } /* Destroy the stack itself. */ asn1p_free((yy_buffer_stack) ); (yy_buffer_stack) = NULL; /* Destroy the start condition stack. */ asn1p_free((yy_start_stack) ); (yy_start_stack) = NULL; asn1p_free ( (yy_state_buf) ); (yy_state_buf) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time * asn1p_lex() is called, initialization will occur. */ yy_init_globals( ); /* %if-reentrant */ /* %endif */ return 0; } /* %endif */ /* * Internal utility routines. */ #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) { register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * s ) { register int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif void *asn1p_alloc (yy_size_t size ) { return (void *) malloc( size ); } void *asn1p_realloc (void * ptr, yy_size_t size ) { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter * because both ANSI C and C++ allow castless assignment from * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); } void asn1p_free (void * ptr ) { free( (char *) ptr ); /* see asn1p_realloc() for (char *) cast */ } /* %if-tables-serialization definitions */ /* %define-yytables The name for this specific scanner's tables. */ #define YYTABLES_NAME "yytables" /* %endif */ /* %ok-for-header */ #line 549 "asn1p_l.l" /* * Very dirty but wonderful hack allowing to rule states from within .y file. */ void asn1p_lexer_hack_push_opaque_state() { yy_push_state(opaque); } /* * Another hack which disables recognizing some tokens when inside WITH SYNTAX. */ void asn1p_lexer_hack_enable_with_syntax() { yy_push_state(with_syntax); } /* Yet another */ void asn1p_lexer_hack_push_encoding_control() { yy_push_state(encoding_control); } static asn1c_integer_t _lex_atoi(const char *ptr) { asn1c_integer_t value; if(asn1p_atoi(ptr, &value)) { fprintf(stderr, "Value \"%s\" at line %d is too large " "for this compiler! Please contact the asn1c author.\n", ptr, asn1p_lineno); errno = ERANGE; } return value; } static double _lex_atod(const char *ptr) { double value; errno = 0; value = strtod(ptr, 0); if(errno) { fprintf(stderr, "Value \"%s\" at line %d is outside of `double` range " "in this compiler! Please contact the asn1c author.\n", ptr, asn1p_lineno); errno = ERANGE; } return value; } asn1c-0.9.28+dfsg/README.md0000644000000000000000000000717013065714043013523 0ustar rootroot# About ASN.1 to C compiler takes the ASN.1 module files (example) and generates the C++ compatible C source code. That code can be used to serialize the native C structures into compact and unambiguous BER/XER/PER-based data files, and deserialize the files back. Various ASN.1 based formats are widely used in the industry, such as to encode the X.509 certificates employed in the HTTPS handshake, to exchange control data between mobile phones and cellular networks, to car-to-car communication in intelligent transportation networks. The ASN.1 standard is large and complex and no open source compiler supports it in its entirety. The asn1c is arguably the most evolved open source ASN.1 compiler. # Build and Install If you haven't installed the asn1c yet, read the [INSTALL.md](INSTALL.md) file for a short installation guide. [![Build Status](https://travis-ci.org/vlm/asn1c.svg?branch=master)](https://travis-ci.org/vlm/asn1c) # Documentation For the list of asn1c command line options, see `asn1c -h` or `man asn1c`. The comprehensive documentation on this compiler is in [doc/asn1c-usage.pdf](doc/asn1c-usage.pdf). Please also read the [FAQ](FAQ) file. An excellent book on ASN.1 is written by Olivier Dubuisson: "ASN.1 Communication between heterogeneous systems", ISBN:0-12-6333361-0. # Quick start (also check out [doc/asn1c-quick.pdf](doc/asn1c-quick.pdf)) After installing the compiler (see [INSTALL.md](INSTALL.md)), you may use the asn1c command to compile the ASN.1 specification: asn1c # Compile module If several specifications contain interdependencies, all of them must be specified at the same time: asn1c ... # Compile interdependent modules The asn1c source tarball contains the [examples/](examples/) directory with several ASN.1 modules and a [script](examples/crfc2asn1.pl) to extract the ASN.1 modules from RFC documents. Refer to the [examples/README](examples/README) file in that directory. To compile the X.509 PKI module: ./asn1c/asn1c -P ./examples/rfc3280-*.asn1 # Compile-n-print In this example, the **-P** option is to print the compiled text on the standard output. The default behavior is that asn1c compiler creates multiple .c and .h files for every ASN.1 type found inside the specified ASN.1 modules. The compiler's **-E** and **-EF** options are used for testing the parser and the semantic fixer, respectively. These options will instruct the compiler to dump out the parsed (and fixed) ASN.1 specification as it was "understood" by the compiler. It might be useful for checking whether a particular syntactic construction is properly supported by the compiler. asn1c -EF # Check semantic validity # Model of operation The asn1c compiler works by processing the ASN.1 module specifications in several stages: 1. During the first stage, the ASN.1 file is parsed. (Parsing produces an ASN.1 syntax tree for the subsequent levels) 2. During the second stage, the syntax tree is "fixed". (Fixing is a process of checking the tree for semantic errors, accompanied by the tree transformation into the canonical form) 3. During the third stage, the syntax tree is compiled into the target language. There are several command-line options reserved for printing the results after each stage of operation: => print (-E) => => print (-E -F) => => => print (-P) => => => save-compiled [default] -- Lev Walkin vlm@lionet.info asn1c-0.9.28+dfsg/AUTHORS0000644000000000000000000000036013065714043013306 0ustar rootrootFull list of copyright holders: Lev Walkin mkhon @ github ymbirtt @ github Wim L Bartosz Marcinkiewicz Daniele Varrazzo Bent Nicolaisen asn1c-0.9.28+dfsg/configure.ac0000644000000000000000000001066013065714043014530 0ustar rootrootAC_INIT([asn1c],[0.9.28],[vlm@lionet.info]) AC_CONFIG_AUX_DIR(config) AC_CONFIG_HEADER([config.h]) AM_INIT_AUTOMAKE([foreign]) AC_CONFIG_MACRO_DIR([m4]) LT_INIT dnl Checks for programs. AC_PROG_CC AC_PROG_CPP AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET AC_PROG_YACC AM_PROG_LEX AC_PATH_PROG(AR, ar, ar, $PATH:/usr/ucb:/usr/ccs/bin) dnl for Solaris dnl If you need to see the details, just run make V=1. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) case "$host_os" in cygwin) case "$target" in *mingw*) CC="$CC -mno-cygwin" esac ;; esac AC_ARG_ENABLE([ASN_DEBUG], [AS_HELP_STRING([--enable-ASN_DEBUG], [produce debug log during `make check` testing])], [enable_asn_debug=$enableval], [enable_asn_debug=no]) AS_IF([test x$enable_asn_debug != xno], [ TESTSUITE_CFLAGS="-DEMIT_ASN_DEBUG" SKELETONS_CFLAGS="-DEMIT_ASN_DEBUG" ]) AX_CHECK_COMPILE_FLAG([-Wall], [CFLAGS="$CFLAGS -Wall"]) AX_CHECK_COMPILE_FLAG([-Wcast-qual], [CFLAGS="$CFLAGS -Wcast-qual"]) AX_CHECK_COMPILE_FLAG([-Wchar-subscripts], [CFLAGS="$CFLAGS -Wchar-subscripts"]) AX_CHECK_COMPILE_FLAG([-Wmissing-prototypes], [CFLAGS="$CFLAGS -Wmissing-prototypes"]) AX_CHECK_COMPILE_FLAG([-Wmissing-declarations], [CFLAGS="$CFLAGS -Wmissing-declarations"]) dnl There are legitimate uses for these features, disable warnings/errors. AX_CHECK_COMPILE_FLAG([-Wno-error=cast-align], [CFLAGS="$CFLAGS -Wno-error=cast-align"]) AX_CHECK_COMPILE_FLAG([-Wno-error=visibility], [CFLAGS="$CFLAGS -Wno-error=visibility"]) AX_CHECK_COMPILE_FLAG([-Wno-error=parentheses-equality], [CFLAGS="$CFLAGS -Wno-error=parentheses-equality"]) AX_CHECK_COMPILE_FLAG([-std=gnu99], [TESTSUITE_CFLAGS="$TESTSUITE_CFLAGS -std=gnu99"]) AX_CHECK_COMPILE_FLAG([-Wno-error=unused-variable], [TESTSUITE_CFLAGS="$TESTSUITE_CFLAGS -Wno-error=unused-variable"]) AC_ARG_ENABLE(Werror, [AS_HELP_STRING([--enable-Werror], [abort compilation after any C compiler warning])], [enable_werror=$enableval], [enable_werror=no]) AS_IF([test x$enable_werror != xno], [ ADD_CFLAGS="-Werror -W -Wpointer-arith" ]) AC_ARG_ENABLE(test-Werror, [AS_HELP_STRING([--enable-test-Werror], [abort compiling tests after any C compiler warning])], [enable_test_werror=$enableval], [enable_test_werror=no]) AS_IF([test x$enable_test_werror != xno], [ TESTSUITE_CFLAGS="-Werror -W -Wpointer-arith" ]) AC_SUBST(ADD_CFLAGS) AC_SUBST(TESTSUITE_CFLAGS) dnl Skeletons should be very compatible with most of the compilers, hence dnl very strict backward compatibility flags. SKELETONS_CFLAGS="${ADD_CFLAGS} ${SKELETONS_CFLAGS}" AX_CHECK_COMPILE_FLAG([-std=c89], [SKELETONS_CFLAGS="$SKELETONS_CFLAGS -std=c89"]) AX_CHECK_COMPILE_FLAG([-Wpedantic], [SKELETONS_CFLAGS="$SKELETONS_CFLAGS -Wpedantic"]) AX_CHECK_COMPILE_FLAG([-Wno-duplicate-decl-specifier], [SKELETONS_CFLAGS="$SKELETONS_CFLAGS -Wno-duplicate-decl-specifier"]) AC_SUBST(SKELETONS_CFLAGS) dnl Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS(sys/param.h) AC_CHECK_HEADERS(alloca.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_BIGENDIAN AC_TYPE_OFF_T AC_TYPE_SIZE_T AC_STRUCT_TM AC_CHECK_TYPE(intmax_t, int64_t) dnl Test if we should check features that depend on 64-bitness. AC_MSG_CHECKING(size of long is longer than 32 bit) AS_VAR_PUSHDEF([WIDE_LONG], [WIDE_LONG]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include "confdefs.h" #include ]], [[switch (0) case 0: case (sizeof ($1) >= 8):;]])],[WIDE_LONG=yes],[WIDE_LONG=no]) AC_MSG_RESULT($WIDE_LONG) AM_CONDITIONAL([TEST_64BIT], [test x$WIDE_LONG = xyes]) AS_VAR_POPDEF([WIDE_LONG]) dnl For mingw AC_SEARCH_LIBS(getopt, iberty) AC_CHECK_FUNCS(strtoimax strtoll) AC_CHECK_FUNCS(mergesort) AC_CHECK_FUNCS(mkstemps) AC_CHECK_FUNCS(timegm) AC_CHECK_DECLS(alloca strcasecmp) AC_TRY_LINK_FUNC([symlink],[AC_DEFINE([HAVE_SYMLINK], 1, [Define to 1 if you have the symlink function.])]) dnl Use pandoc to generate manual pages. AC_PATH_PROG([PANDOC], pandoc) AM_CONDITIONAL([HAVE_PANDOC], [test -n "$PANDOC"]) AC_CONFIG_FILES([\ asn1c/tests/check-src/Makefile \ skeletons/tests/Makefile \ libasn1compiler/Makefile \ libasn1parser/Makefile \ libasn1print/Makefile \ asn1c/tests/Makefile \ libasn1fix/Makefile \ doc/docsrc/Makefile \ skeletons/Makefile \ examples/Makefile \ doc/man/Makefile \ tests/Makefile \ asn1c/Makefile \ doc/Makefile \ Makefile \ ]) AC_OUTPUT asn1c-0.9.28+dfsg/TODO0000644000000000000000000000050213065714043012724 0ustar rootroot1. MAJOR: 1.1 Support for Information Object Classes. Status: Support for parsing IOCs is mostly present. Support for slicing the IOCs to produce "views" is not yet designed. 2. MEDIUM: 2.1 Support for EXTERNAL, EMBEDDED-PDV and CHARACTER STRING types. Requires something from 1.2 (Information Object Classes). asn1c-0.9.28+dfsg/libasn1fix/0000755000000000000000000000000013065714043014277 5ustar rootrootasn1c-0.9.28+dfsg/libasn1fix/asn1fix.h0000644000000000000000000000157413065714043016030 0ustar rootroot/* * This is the public interface for the processor (fixer) of the ASN.1 tree * produced by the libasn1parser. */ #ifndef ASN1FIX_H #define ASN1FIX_H #include /* * Operation flags for the function below. */ enum asn1f_flags { A1F_NOFLAGS, A1F_DEBUG = 0x01, /* Print debugging output */ A1F_EXTENDED_SizeConstraint = 0x02, /* Enable constraint gen code */ }; /* * Perform a set of semantics checks, transformations and small fixes * on the given tree. * RETURN VALUES: * -1: Some fatal problems were encountered. * 0: No inconsistencies were found. * 1: Some warnings were issued, but no fatal problems encountered. */ int asn1f_process(asn1p_t *_asn, enum asn1f_flags, void (*error_log_callback)(int _severity, const char *fmt, ...)); /* * Explicitly mark type as known. */ int asn1f_make_known_external_type(const char *); #endif /* ASN1FIX_H */ asn1c-0.9.28+dfsg/libasn1fix/asn1fix_derefv.c0000644000000000000000000000254513065714043017355 0ustar rootroot#include "asn1fix_internal.h" /* * Dereference DefinedValues: */ int asn1f_fix_dereference_values(arg_t *arg) { asn1p_expr_t *expr = arg->expr; int r_value = 0; if(expr->value && expr->meta_type == AMT_VALUE) { if(asn1f_value_resolve(arg, expr, 0)) { /* This function will emit messages */ r_value = -1; } } return r_value; } /* * Dereference DEFAULT values */ int asn1f_fix_dereference_defaults(arg_t *arg) { asn1p_expr_t *expr = arg->expr; int r_value = 0; if(expr->marker.default_value) { arg_t tmparg = *arg; asn1p_expr_t tmpexpr = *expr; switch(expr->marker.default_value->type) { default: return r_value; case ATV_REFERENCED: break; } if(expr->expr_type == A1TC_CLASSFIELD_FTVFS) { asn1p_expr_t *child = TQ_FIRST(&expr->members); int ret; assert(child); assert(child->marker.default_value == 0); tmparg.expr = child; child->marker.default_value=expr->marker.default_value; ret = asn1f_fix_dereference_defaults(&tmparg); expr->marker.default_value = child->marker.default_value; if(ret == 0) return 0; /* Finished */ } tmparg.expr = &tmpexpr; tmpexpr.meta_type = AMT_VALUE; tmpexpr.marker.default_value = 0; tmpexpr.value = expr->marker.default_value; if(asn1f_value_resolve(&tmparg, &tmpexpr, 0)) r_value = -1; expr->marker.default_value = tmpexpr.value; } return r_value; } asn1c-0.9.28+dfsg/libasn1fix/Makefile.am0000644000000000000000000000260213065714043016333 0ustar rootroot AM_CFLAGS = @ADD_CFLAGS@ AM_CPPFLAGS = \ -I$(top_srcdir)/libasn1parser noinst_LTLIBRARIES = libasn1fix.la libasn1fix_la_SOURCES = \ asn1fix.c asn1fix.h \ asn1fix_internal.h \ asn1fix_misc.c asn1fix_misc.h \ asn1fix_value.c asn1fix_value.h \ asn1fix_compat.c asn1fix_compat.h \ asn1fix_constr.c asn1fix_constr.h \ asn1fix_cstring.c asn1fix_cstring.h \ asn1fix_retrieve.c asn1fix_retrieve.h \ asn1fix_bitstring.c asn1fix_bitstring.h \ asn1fix_constraint.c asn1fix_constraint.h \ asn1fix_integer.c asn1fix_integer.h \ asn1fix_crange.c asn1fix_crange.h \ asn1fix_dereft.c asn1fix_dereft.h \ asn1fix_derefv.c asn1fix_derefv.h \ asn1fix_export.c asn1fix_export.h \ asn1fix_param.c asn1fix_param.h \ asn1fix_class.c asn1fix_class.h \ asn1fix_tags.c asn1fix_tags.h \ asn1fix_enum.c asn1fix_enum.h \ asn1fix_cws.c asn1fix_cws.h \ asn1fix_constraint_compat.c check_fixer_LDADD = $(noinst_LTLIBRARIES) \ $(top_builddir)/libasn1parser/libasn1parser.la check_fixer_CPPFLAGS = -DTOP_SRCDIR=${top_srcdir} $(AM_CPPFLAGS) check_crange_SOURCES = asn1fix_crange.c asn1fix_constraint_compat.c check_crange_CPPFLAGS = -DUNIT_TEST $(AM_CPPFLAGS) check_crange_LDADD = $(noinst_LTLIBRARIES) \ $(top_builddir)/libasn1parser/libasn1parser.la check_PROGRAMS = check_crange check_fixer TESTS_ENVIRONMENT = ASN1_TESTS_DIR=${top_srcdir}/tests TESTS = ${check_PROGRAMS} asn1c-0.9.28+dfsg/libasn1fix/asn1fix_enum.c0000644000000000000000000000774713065714043017057 0ustar rootroot#include "asn1fix_internal.h" /* * Check the validity of an enumeration. */ int asn1f_fix_enum(arg_t *arg) { asn1p_expr_t *expr = arg->expr; asn1p_expr_t *ev; asn1c_integer_t max_value = -1; asn1c_integer_t max_value_ext = -1; int rvalue = 0; asn1p_expr_t *ext_marker = NULL; /* "..." position */ int ret; /* Keep track of value collisions */ asn1c_integer_t *used_vals; int used_vals_sz = 50; int used_vals_next = 0; if(expr->expr_type != ASN_BASIC_ENUMERATED) return 0; /* Just ignore it */ DEBUG("(%s)", expr->Identifier); used_vals = (asn1c_integer_t *) malloc(sizeof(asn1c_integer_t) * used_vals_sz); if (!used_vals) { FATAL("Out of memory"); return -1; } /* * 1. Scan the enumeration values in search for inconsistencies. */ TQ_FOR(ev, &(expr->members), next) { asn1c_integer_t eval; if(ev->value) DEBUG("\tItem %s(%s)", ev->Identifier, asn1f_printable_value(ev->value)); else DEBUG("\tItem %s", ev->Identifier); /* * 1.1 Found an extension mark "...", check correctness. */ if(ev->expr_type == A1TC_EXTENSIBLE) { if(ext_marker) { FATAL("Enumeration %s at line %d: " "Second extension marker is not allowed", expr->Identifier, ev->_lineno); rvalue = -1; } else { /* * Remember the marker's position. */ ext_marker = ev; } continue; } else if(ev->Identifier == NULL || ev->expr_type != A1TC_UNIVERVAL) { FATAL( "Enumeration %s at line %d: " "Unsupported enumeration element %s", expr->Identifier, ev->_lineno, ev->Identifier?ev->Identifier:""); rvalue = -1; continue; } /* * 1.2 Compute the value of the enumeration element. */ if(ev->value) { switch(ev->value->type) { case ATV_INTEGER: eval = ev->value->value.v_integer; break; case ATV_REFERENCED: FATAL("HERE HERE HERE", 1); rvalue = -1; continue; break; default: FATAL("ENUMERATED type %s at line %d " "contain element %s(%s) at line %d", expr->Identifier, expr->_lineno, ev->Identifier, asn1f_printable_value(ev->value), ev->_lineno); rvalue = -1; continue; } } else { eval = max_value + 1; ev->value = asn1p_value_fromint(eval); if(ev->value == NULL) { rvalue = -1; continue; } } /* * 1.3 Check the applicability of this value. */ /* * Enumeration is allowed to be unordered * before the first marker, but after the marker * the values must be ordered. */ if (ext_marker) { if (eval > max_value_ext) { max_value_ext = eval; } else { FATAL( "Enumeration %s at line %d: " "Explicit value \"%s(%" PRIdASN ")\" " "is not greater " "than previous values (max %" PRIdASN ")", expr->Identifier, ev->_lineno, ev->Identifier, eval, max_value_ext); rvalue = -1; } } if (eval > max_value) { max_value = eval; } /* * 1.4 Check that all identifiers are unique */ int unique = 1; int uv_idx; for (uv_idx = 0; uv_idx < used_vals_next; uv_idx++) { if (used_vals[uv_idx] == eval) { FATAL( "Enumeration %s at line %d: " "Explicit value \"%s(%" PRIdASN ")\" " "collides with previous values", expr->Identifier, ev->_lineno, ev->Identifier, eval); rvalue = -1; unique = 0; } } if (unique) { /* Grow the array if needed */ if (used_vals_next >= used_vals_sz) { asn1c_integer_t *temp; int new_sz = used_vals_sz + 50; temp = (asn1c_integer_t *) realloc(used_vals, sizeof(asn1c_integer_t) * new_sz); if (!temp) return -1; used_vals = temp; used_vals_sz = new_sz; } used_vals[used_vals_next++] = eval; } /* * 1.5 Check that all identifiers before the current one * differs from it. */ ret = asn1f_check_unique_expr_child(arg, ev, 0, "identifier"); RET2RVAL(ret, rvalue); } free(used_vals); /* * 2. Reorder the first half (before optional "...") of the * identifiers alphabetically. */ // TODO return rvalue; } asn1c-0.9.28+dfsg/libasn1fix/asn1fix_bitstring.c0000644000000000000000000001567413065714043020116 0ustar rootroot#include "asn1fix_internal.h" static int asn1f_fix_bit_string_type(arg_t *arg); static int asn1f_fix_bit_string_value(arg_t *arg, asn1p_expr_t *ttype); static void asn1f_BS_remove_trailing_zero_bits(asn1p_value_t *value); static int asn1f_BS_unparsed_convert(arg_t *arg, asn1p_value_t *value, asn1p_expr_t *ttype); int asn1f_fix_bit_string(arg_t *arg) { asn1p_expr_t *expr = arg->expr; int r_value = 0; int ret; if(expr->meta_type == AMT_VALUE) { asn1p_expr_t *ttype; DEBUG("(%s) for line %d", expr->Identifier, expr->_lineno); ttype = asn1f_find_terminal_type(arg, expr); if(ttype && ttype->expr_type == ASN_BASIC_BIT_STRING) { ret = asn1f_fix_bit_string_value(arg, ttype); RET2RVAL(ret, r_value); } } if(expr->meta_type == AMT_TYPE && expr->expr_type == ASN_BASIC_BIT_STRING) { ret = asn1f_fix_bit_string_type(arg); RET2RVAL(ret, r_value); } return r_value; } static int _compare_value(asn1p_expr_t *expr1, asn1p_expr_t *expr2) { return expr2->value->value.v_integer - expr1->value->value.v_integer; } static int asn1f_fix_bit_string_type(arg_t *arg) { asn1p_expr_t *expr = arg->expr; asn1p_expr_t *v; int r_value = 0; int ret; TQ_FOR(v, &(expr->members), next) { if(v->expr_type == A1TC_EXTENSIBLE) { FATAL("Extension marker (...) is not allowed " "as a BIT STRING NamedBit at line %d ", v->_lineno); return -1; } if(v->expr_type != A1TC_UNIVERVAL) { FATAL("BIT STRING value at line %d " "is not an identifier", v->_lineno); return -1; } /* 21.1 */ if(v->value == NULL) { FATAL("BIT STRING NamedBit value at line %d " "must be explicitly specified in braces", v->_lineno); return -1; } else if(v->value->type == ATV_REFERENCED) { /* Resolve the value */ if(asn1f_value_resolve(arg, v, 0)) return -1; } if(v->value->type != ATV_INTEGER || v->value->value.v_integer < 0) { FATAL("BIT STRING NamedBit value at line %d: " "non-negative integer value expected", v->_lineno); return -1; } /* Check value uniqueness as per 21.4 */ ret = asn1f_check_unique_expr_child(arg, v, _compare_value, "value"); RET2RVAL(ret, r_value); /* Check identifier uniqueness as per 21.5 */ ret = asn1f_check_unique_expr_child(arg, v, 0, "identifier"); RET2RVAL(ret, r_value); } return r_value; } static int asn1f_fix_bit_string_value(arg_t *arg, asn1p_expr_t *ttype) { asn1p_expr_t *expr = arg->expr; int r_value = 0; DEBUG("(%s) for line %d", expr->Identifier, expr->_lineno); switch(expr->value->type) { case ATV_UNPARSED: /* * Most definitely we have something like * value BitStringType1 ::= { a, b, c } * which could not be parsed by the LALR parser, mostly * because it requires knowledge about BitStringType1 * during the parsing. So, here's a little hack: we create * a buffer containing the full specification of a module, * which contains some pre-defined INTEGER type with the * opaque definition "{ a, b, c }" from the bit string. */ if(asn1f_BS_unparsed_convert(arg, expr->value, ttype)) { r_value = -1; break; } /* Fall through: remove trailing zero bits */ case ATV_BITVECTOR: asn1f_BS_remove_trailing_zero_bits(expr->value); break; default: break; } return r_value; } static void asn1f_BS_remove_trailing_zero_bits(asn1p_value_t *value) { int lmfb = -1; /* Last meaningful byte position */ int bits; /* Number of bits in the BIT STRING value */ int b; assert(value->type == ATV_BITVECTOR); bits = value->value.binary_vector.size_in_bits; /* * Figure out the rightmost meaningful byte. */ for(b = 0; b < ((bits + 7) >> 3); b++) { uint8_t uc = value->value.binary_vector.bits[b]; if(uc && b > lmfb) lmfb = b; } if(lmfb == -1) { bits = 0; } else { uint8_t uc; uc = value->value.binary_vector.bits[lmfb]; bits = (lmfb+1) * 8; /* * Squeeze the bit string width until the rightmost * bit is set. */ for(; uc && (uc & 1) == 0; uc >>= 1) bits--; if(uc == 0) { bits = lmfb * 8; } } value->value.binary_vector.size_in_bits = bits; } static int asn1f_BS_unparsed_convert(arg_t *arg, asn1p_value_t *value, asn1p_expr_t *ttype) { asn1p_t *asn; asn1p_module_t *mod; asn1p_expr_t *V; asn1p_expr_t *bit; asn1c_integer_t aI; uint8_t *bitbuf; int bits; int psize; char *p; int ret; int r_value = 0; assert(value->type == ATV_UNPARSED); psize = value->value.string.size + 64; p = malloc(psize); if(p == NULL) return -1; ret = snprintf(p, psize, "M DEFINITIONS ::=\nBEGIN\n" "V ::= INTEGER %s\n" "END\n", value->value.string.buf ); assert(ret < psize); psize = ret; asn = asn1p_parse_buffer(p, psize, A1P_NOFLAGS); free(p); if(asn == NULL) { FATAL("Cannot parse BIT STRING value %s " "defined as %s at line %d", arg->expr->Identifier, value->value.string.buf, arg->expr->_lineno ); return -1; } mod = TQ_FIRST(&(asn->modules)); assert(mod); V = TQ_FIRST(&(mod->members)); assert(V); assert(strcmp(V->Identifier, "V") == 0); assert(TQ_FIRST(&(V->members))); /* * Simple loop just to fetch the maximal bit position * out of the BIT STRING value defined as NamedBitList. */ aI = -1; TQ_FOR(bit, &(V->members), next) { asn1p_expr_t *bitdef; bitdef = asn1f_lookup_child(ttype, bit->Identifier); if(bitdef && bitdef->value && bitdef->value->type == ATV_INTEGER) { if(bitdef->value->value.v_integer > aI) aI = bitdef->value->value.v_integer; } } if(aI > 1024 * 1024 * 8) { /* One megabyte */ FATAL("Unsupportedly large BIT STRING value \"%s\" " "defined at line %d " "(larger than 1MByte)", arg->expr->Identifier, arg->expr->_lineno ); asn1p_delete(asn); return -1; } bits = aI + 1; /* Number of bits is more than a last bit position */ bitbuf = calloc(1, 1 + ((bits + 7) / 8)); if(bitbuf == NULL) { asn1p_delete(asn); return -1; } TQ_FOR(bit, &(V->members), next) { asn1p_expr_t *bitdef; int set_bit_pos; if(bit->value) { WARNING("Identifier \"%s\" at line %d " "must not have a value", bit->Identifier, bit->_lineno); RET2RVAL(1, r_value); } bitdef = asn1f_lookup_child(ttype, bit->Identifier); if(bitdef == NULL) { FATAL("Identifier \"%s\" at line %d is not defined " "in the \"%s\" type definition at line %d", bit->Identifier, bit->_lineno, ttype->Identifier, ttype->_lineno ); RET2RVAL(-1, r_value); continue; } if(bitdef->value == NULL || bitdef->value->type != ATV_INTEGER) { FATAL("Broken identifier " "\"%s\" at line %d " "referenced by \"%s\" at line %d", bitdef->Identifier, bitdef->_lineno, arg->expr->Identifier, arg->expr->_lineno ); RET2RVAL(-1, r_value); continue; } assert(bitdef->value->value.v_integer < bits); set_bit_pos = bitdef->value->value.v_integer; bitbuf[set_bit_pos>>3] |= 1 << (7-(set_bit_pos % 8)); } asn1p_delete(asn); free(value->value.string.buf); value->type = ATV_BITVECTOR; value->value.binary_vector.bits = bitbuf; value->value.binary_vector.size_in_bits = bits; return r_value; } asn1c-0.9.28+dfsg/libasn1fix/asn1fix_crange.c0000644000000000000000000006001413065714043017334 0ustar rootroot#include "asn1fix_internal.h" #include "asn1fix_constraint.h" #include "asn1fix_crange.h" #undef FATAL #define FATAL(fmt, args...) do { \ fprintf(stderr, "FATAL: "); \ fprintf(stderr, fmt, ##args); \ fprintf(stderr, "\n"); \ } while(0) void asn1constraint_range_free(asn1cnst_range_t *cr) { if(cr) { int i; if(cr->elements) { for(i = 0; i < cr->el_count; i++) asn1constraint_range_free(cr->elements[i]); free(cr->elements); } free(cr); } } #define _range_free(foo) asn1constraint_range_free(foo) static asn1cnst_range_t *_range_new() { asn1cnst_range_t *r; r = calloc(1, sizeof(*r)); if(r) { r->left.type = ARE_MIN; r->right.type = ARE_MAX; } return r; } static void _range_remove_element(asn1cnst_range_t *range, int idx) { assert(idx >= 0 && idx < range->el_count); assert(!range->elements[idx]->elements); _range_free(range->elements[idx]); memmove(&range->elements[idx], &range->elements[idx + 1], (range->el_count - idx - 1) * sizeof(range->elements[0]) ); range->el_count--; range->elements[range->el_count] = 0; /* JIC */ if(range->el_count == 0) { range->el_size = 0; free(range->elements); range->elements = 0; } } static int _range_insert(asn1cnst_range_t *into, asn1cnst_range_t *cr) { assert(!cr->elements); if(into->el_count == into->el_size) { void *p; int n = into->el_size?(into->el_size << 1):4; p = realloc(into->elements, n * sizeof(into->elements[0])); if(p) { into->el_size = n; into->elements = p; } else { assert(p); return -1; } } into->elements[into->el_count++] = cr; return 0; } static asn1cnst_range_t *_range_clone(const asn1cnst_range_t *range) { asn1cnst_range_t *clone; int i; clone = _range_new(); if(!clone) return NULL; *clone = *range; clone->elements = 0; clone->el_count = 0; clone->el_size = 0; for(i = 0; i < range->el_count; i++) { asn1cnst_range_t *r = _range_clone(range->elements[i]); if(!r || _range_insert(clone, r)) { _range_free(clone); _range_free(r); return NULL; } } return clone; } static int _edge_compare(const asn1cnst_edge_t *el, const asn1cnst_edge_t *er) { switch(el->type) { case ARE_MIN: switch(er->type) { case ARE_MIN: return 0; case ARE_MAX: return -1; case ARE_VALUE: return -1; } break; case ARE_MAX: switch(er->type) { case ARE_MIN: return 1; case ARE_MAX: return 0; case ARE_VALUE: return 1; } break; case ARE_VALUE: switch(er->type) { case ARE_MIN: return 1; case ARE_MAX: return -1; case ARE_VALUE: if(el->value < er->value) return -1; if(el->value > er->value) return 1; return 0; } break; } return 0; } static int _range_compare(const void *a, const void *b) { const asn1cnst_range_t *ra = *(const asn1cnst_range_t * const *)a; const asn1cnst_range_t *rb = *(const asn1cnst_range_t * const *)b; int ret; ret = _edge_compare(&ra->left, &rb->left); if(!ret) { ret = _edge_compare(&ra->right, &rb->right); } return ret; } static char * _edge_value(const asn1cnst_edge_t *edge) { static char buf[128]; *buf = '\0'; switch(edge->type) { case ARE_MIN: strcpy(buf, "MIN"); break; case ARE_MAX: strcpy(buf, "MAX"); break; case ARE_VALUE: snprintf(buf, sizeof(buf), "%" PRIdASN, edge->value); break; default: assert(!"edge->type"); } return buf; } static int _edge_is_within(const asn1cnst_range_t *range, const asn1cnst_edge_t *edge) { int i; for(i = -1; i < range->el_count; i++) { const asn1cnst_range_t *r; if(i == -1) { if(range->el_count) continue; r = range; } else { r = range->elements[i]; } if(_edge_compare(&r->left, edge) <= 0 && _edge_compare(&r->right, edge) >= 0) return 1; } return 0; } static int _check_edges_within(const asn1cnst_range_t *range, const asn1cnst_range_t *r) { if(!_edge_is_within(range, &r->left)) { FATAL("Constraint value %s at line %d " "is not within " "a parent constraint range", _edge_value(&r->left), r->left.lineno ); return -1; } if(!_edge_is_within(range, &r->right)) { FATAL("Constraint value %s at line %d " "is not within " "a parent constraint range", _edge_value(&r->right), r->right.lineno ); return -1; } return 0; } static int _range_merge_in(asn1cnst_range_t *into, asn1cnst_range_t *cr) { asn1cnst_range_t *r; int prev_count = into->el_count; int i; into->not_PER_visible |= cr->not_PER_visible; into->extensible |= cr->extensible; /* * Add the element OR all its children "into". */ for(i = -1; i < cr->el_count; i++) { if(i == -1) { if(cr->el_count) continue; r = cr; } else { r = cr->elements[i]; } if(_range_insert(into, r)) { into->el_count = prev_count; /* Undo */ return -1; } } if(cr->el_count) { cr->el_count = 0; _range_free(cr); } else { /* This range is linked into "into". */ } return 0; } static int _range_fill(asn1p_value_t *val, const asn1cnst_range_t *minmax, asn1cnst_edge_t *edge, asn1cnst_range_t *range, enum asn1p_constraint_type_e type, int lineno) { unsigned char *p, *pend; edge->lineno = lineno; switch(val->type) { case ATV_INTEGER: if(type != ACT_EL_RANGE && type != ACT_CT_SIZE) { FATAL("Integer %" PRIdASN " value invalid " "for %s constraint at line %d", val->value.v_integer, asn1p_constraint_type2str(type), lineno); return -1; } edge->type = ARE_VALUE; edge->value = val->value.v_integer; return 0; case ATV_MIN: if(type != ACT_EL_RANGE && type != ACT_CT_SIZE) { FATAL("MIN invalid for %s constraint at line %d", asn1p_constraint_type2str(type), lineno); return -1; } edge->type = ARE_MIN; if(minmax) *edge = minmax->left; edge->lineno = lineno; /* Restore lineno */ return 0; case ATV_MAX: if(type != ACT_EL_RANGE && type != ACT_CT_SIZE) { FATAL("MAX invalid for %s constraint at line %d", asn1p_constraint_type2str(type), lineno); return -1; } edge->type = ARE_MAX; if(minmax) *edge = minmax->right; edge->lineno = lineno; /* Restore lineno */ return 0; case ATV_FALSE: case ATV_TRUE: if(type != ACT_EL_RANGE) { FATAL("%s is invalid for %s constraint at line %d", val->type==ATV_TRUE?"TRUE":"FALSE", asn1p_constraint_type2str(type), lineno); return -1; } edge->type = ARE_VALUE; edge->value = (val->type==ATV_TRUE); return 0; case ATV_TUPLE: case ATV_QUADRUPLE: edge->type = ARE_VALUE; edge->value = val->value.v_integer; return 0; case ATV_STRING: if(type != ACT_CT_FROM) return 0; break; case ATV_REFERENCED: FATAL("Unresolved constraint element \"%s\" at line %d", asn1f_printable_reference(val->value.reference), lineno); return -1; default: FATAL("Unrecognized constraint element at line %d", lineno); return -1; } assert(val->type == ATV_STRING); p = val->value.string.buf; pend = p + val->value.string.size; if(p == pend) return 0; edge->type = ARE_VALUE; if(val->value.string.size == 1) { edge->value = *p; } else { /* * Else this is a set: * (FROM("abcdef")) * However, (FROM("abc".."def")) is forbidden. * See also 47.4.4. */ asn1c_integer_t vmin, vmax; vmin = vmax = *p; for(; p < pend; p++) { asn1cnst_range_t *nr = _range_new(); int ret; assert(nr); if(*p < vmin) vmin = *p; if(*p > vmax) vmax = *p; ret = _range_insert(range, nr); assert(ret == 0); nr->left.type = ARE_VALUE; nr->left.value = *p; nr->left.lineno = lineno; nr->right = nr->left; } edge->value = (edge == &range->right) ? vmin : vmax; } return 0; } /* * Check if ranges contain common elements. */ static int _range_overlap(const asn1cnst_range_t *ra, const asn1cnst_range_t *rb) { int lr, rl; const asn1cnst_edge_t *ra_l = &ra->left; const asn1cnst_edge_t *ra_r = &ra->right; const asn1cnst_edge_t *rb_l = &rb->left; const asn1cnst_edge_t *rb_r = &rb->right; assert(_edge_compare(ra_l, ra_r) <= 0); assert(_edge_compare(rb_l, rb_r) <= 0); lr = _edge_compare(ra_l, rb_r); rl = _edge_compare(ra_r, rb_l); /* * L: |---| * R: |---| */ if(lr > 0) return 0; /* * L: |---| * R: |---| */ if(rl < 0) return 0; return 1; } static int _range_partial_compare(const void *pa, const void *pb) { const asn1cnst_range_t *ra = *(const void * const *)pa; const asn1cnst_range_t *rb = *(const void * const *)pb; return _edge_compare(&ra->left, &rb->left); } static void _range_partial_sort_elements(asn1cnst_range_t *r) { qsort(r->elements, r->el_count, sizeof(r->elements[0]), _range_partial_compare); } /* * (MIN..20) x (10..15) = (MIN..9,10..15,16..20) */ static asn1cnst_range_t * _range_split(asn1cnst_range_t *ra, const asn1cnst_range_t *rb) { asn1cnst_range_t *range, *nr; int ll, rr; assert(ra); assert(rb); assert(!ra->el_count); assert(!rb->el_count); if(!_range_overlap(ra, rb)) { errno = 0; return 0; } ll = _edge_compare(&ra->left, &rb->left); rr = _edge_compare(&ra->right, &rb->right); /* * L: |---| * R: |-------| */ if(ll >= 0 && rr <= 0) { errno = 0; return 0; } range = _range_new(); assert(range); nr = _range_new(); assert(nr); /* * L: |---... * R: |--.. */ while(ll < 0) { nr->left = ra->left; nr->right = rb->left; if(nr->right.type == ARE_VALUE) { if(nr->right.value == INTMAX_MIN) { /* We've hit the limit here. */ break; } nr->right.value--; } _range_insert(range, nr); nr = _range_new(); assert(nr); break; } /* * L: ...---| * R: ..--| */ while(rr > 0) { nr->left = rb->right; nr->right = ra->right; if(nr->left.type == ARE_VALUE) { if(nr->left.value == INTMAX_MAX) { /* We've hit the limit here. */ break; } nr->left.value++; } _range_insert(range, nr); nr = _range_new(); assert(nr); break; } /* * L: |---| * R: |-----| */ nr->left = ra->left; nr->right = ra->right; if(_edge_compare(&ra->left, &rb->left) < 0) nr->left = rb->left; if(_edge_compare(&ra->right, &rb->right) > 0) nr->right = rb->right; _range_insert(range, nr); _range_partial_sort_elements(range); return range; } static int _range_intersection(asn1cnst_range_t *range, const asn1cnst_range_t *with, int strict_edge_check) { int ret; int i, j; assert(!range->incompatible); /* Propagate errors */ range->extensible |= with->extensible; range->not_PER_visible |= with->not_PER_visible; range->empty_constraint |= with->empty_constraint; if(range->empty_constraint) { /* No use in intersecting empty constraints */ return 0; } /* * This is an AND operation. */ /* If this is the only element, insert it into itself as a child */ if(range->el_count == 0) { asn1cnst_range_t *r = _range_new(); r->left = range->left; r->right = range->right; _range_insert(range, r); assert(range->el_count == 1); } /* * Make sure we're dealing with sane data. * G.4.2.3 */ if(strict_edge_check) { for(j = -1; j < with->el_count; j++) { if(j == -1) { if(with->el_count) continue; if(_check_edges_within(range, with)) return -1; } else { if(_check_edges_within(range, with->elements[j])) return -1; } } } /* * Split range in pieces. */ for(i = 0; i < range->el_count; i++) { for(j = -1; j < with->el_count; j++) { const asn1cnst_range_t *wel; asn1cnst_range_t *r; if(j == -1) { if(with->el_count) continue; wel = with; } else { wel = with->elements[j]; assert(!wel->el_count); /* non-compound item! */ } r = _range_split(range->elements[i], wel); if(r) { int ec; /* Substitute the current element with a split */ _range_remove_element(range, i); assert(r->el_count); for(ec = 0; ec < r->el_count; ec++) { ret = _range_insert(range, r->elements[ec]); assert(ret == 0); } r->el_count = 0; _range_free(r); i--; break; /* Try again from this point */ } } } assert(range->el_count); /* * Remove pieces which aren't AND-compatible "with" range. */ for(i = 0; i < range->el_count; i++) { for(j = -1; j < with->el_count; j++) { const asn1cnst_range_t *wel; if(j == -1) { if(with->el_count) continue; wel = with; } else { wel = with->elements[j]; } if(_range_overlap(range->elements[i], wel)) break; } if(j == with->el_count) { _range_remove_element(range, i); i--; } } if(range->el_count == 0) range->empty_constraint = 1; return 0; } static int _range_union(asn1cnst_range_t *range) { int i; qsort(range->elements, range->el_count, sizeof(range->elements[0]), _range_compare); /* * The range is sorted by the start values. */ for(i = 1; i < range->el_count; i++) { asn1cnst_range_t *ra = range->elements[i - 1]; asn1cnst_range_t *rb = range->elements[i]; if(_range_overlap(ra, rb)) { if(_edge_compare(&ra->left, &rb->left) < 0) rb->left = ra->left; if(_edge_compare(&ra->right, &rb->right) > 0) rb->right = ra->right; } else { /* * Still, range may be joined: (1..4)(5..10). * This logic is valid only for whole numbers * (i.e., not REAL type, but REAL constraints * are not PER-visible (X.691, #9.3.12). */ if(ra->right.type == ARE_VALUE && rb->left.type == ARE_VALUE && (rb->left.value - ra->right.value) == 1) { /* (1..10) */ rb->left = ra->left; } else { continue; } } /* * Squeeze the array by removing the ra. */ _range_remove_element(range, i - 1); i--; /* Retry from the current point */ } return 0; } static int _range_canonicalize(asn1cnst_range_t *range) { if(range->el_count == 0) { /* * Switch left and right edges, make them sorted. * It might be a mild warning though. */ if(_edge_compare(&range->left, &range->right) > 0) { asn1cnst_edge_t tmp = range->left; range->left = range->right; range->right = tmp; } if(range->elements) { free(range->elements); range->elements = 0; } range->el_size = 0; return 0; } /* * Remove duplicates and overlaps by merging them in. */ _range_union(range); /* Refine the left edge of a parent */ range->left = range->elements[0]->left; /* Refine the right edge of a parent */ range->right = range->elements[range->el_count - 1]->right; /* Remove the child, if it's a single one */ if(range->el_count == 1) { _range_remove_element(range, 0); } return 0; } asn1cnst_range_t * asn1constraint_compute_PER_range(asn1p_expr_type_e expr_type, const asn1p_constraint_t *ct, enum asn1p_constraint_type_e type, const asn1cnst_range_t *minmax, int *exmet, enum cpr_flags cpr_flags) { asn1cnst_range_t *range; asn1cnst_range_t *tmp; asn1p_value_t *vmin; asn1p_value_t *vmax; int expectation_met; unsigned int i; int ret; if(!exmet) { exmet = &expectation_met; *exmet = 0; } /* * Check if the requested constraint is theoretically compatible * with the given expression type. */ if(asn1constraint_compatible(expr_type, type, cpr_flags & CPR_simulate_fbless_SIZE) != 1) { errno = EINVAL; return 0; } /* Check arguments' validity. */ switch(type) { case ACT_EL_RANGE: if(exmet == &expectation_met) *exmet = 1; break; case ACT_CT_FROM: if(!minmax) { minmax = asn1constraint_default_alphabet(expr_type); if(minmax) { break; } } /* Fall through */ case ACT_CT_SIZE: if(!minmax) { static asn1cnst_range_t mm; mm.left.type = ARE_VALUE; mm.left.value = 0; mm.right.type = ARE_MAX; minmax = &mm; } break; default: errno = EINVAL; return 0; } if(minmax) { range = _range_clone(minmax); } else { range = _range_new(); } /* * X.691, #9.3.6 * Constraints on restricter character string types * which are not known-multiplier are not PER-visible. */ if((expr_type & ASN_STRING_NKM_MASK)) range->not_PER_visible = 1; if(!ct || (range->not_PER_visible && (cpr_flags & CPR_strict_PER_visibility))) return range; switch(ct->type) { case ACT_EL_VALUE: vmin = vmax = ct->value; break; case ACT_EL_RANGE: case ACT_EL_LLRANGE: case ACT_EL_RLRANGE: case ACT_EL_ULRANGE: vmin = ct->range_start; vmax = ct->range_stop; break; case ACT_EL_EXT: if(!*exmet) { range->incompatible = 1; } else { _range_free(range); errno = ERANGE; range = 0; } return range; case ACT_CT_SIZE: case ACT_CT_FROM: if(type == ct->type) { *exmet = 1; } else { range->incompatible = 1; return range; } assert(ct->el_count == 1); tmp = asn1constraint_compute_PER_range(expr_type, ct->elements[0], type, minmax, exmet, cpr_flags); if(tmp) { _range_free(range); } else { if(errno == ERANGE) { range->empty_constraint = 1; range->extensible = 1; tmp = range; } else { _range_free(range); } } return tmp; case ACT_CA_SET: /* (10..20)(15..17) */ case ACT_CA_INT: /* SIZE(1..2) ^ FROM("ABCD") */ /* AND constraints, one after another. */ for(i = 0; i < ct->el_count; i++) { tmp = asn1constraint_compute_PER_range(expr_type, ct->elements[i], type, ct->type==ACT_CA_SET?range:minmax, exmet, cpr_flags); if(!tmp) { if(errno == ERANGE) { continue; } else { _range_free(range); return NULL; } } if(tmp->incompatible) { /* * Ignore constraints * incompatible with arguments: * SIZE(1..2) ^ FROM("ABCD") * either SIZE or FROM will be ignored. */ _range_free(tmp); continue; } if(tmp->not_PER_visible && (cpr_flags & CPR_strict_PER_visibility)) { if(ct->type == ACT_CA_SET) { /* * X.691, #9.3.18: * Ignore this separate component. */ } else { /* * X.691, #9.3.19: * Ignore not PER-visible INTERSECTION */ } _range_free(tmp); continue; } ret = _range_intersection(range, tmp, ct->type == ACT_CA_SET); _range_free(tmp); if(ret) { _range_free(range); errno = EPERM; return NULL; } _range_canonicalize(range); } return range; case ACT_CA_CSV: /* SIZE(1..2, 3..4) */ case ACT_CA_UNI: /* SIZE(1..2) | FROM("ABCD") */ /* * Grab the first valid constraint. */ tmp = 0; for(i = 0; i < ct->el_count; i++) { tmp = asn1constraint_compute_PER_range(expr_type, ct->elements[i], type, minmax, exmet, cpr_flags); if(!tmp) { if(errno == ERANGE) { range->extensible = 1; continue; } else { _range_free(range); return NULL; } } if(tmp->incompatible) { _range_free(tmp); tmp = 0; } break; } if(tmp) { tmp->extensible |= range->extensible; tmp->empty_constraint |= range->empty_constraint; _range_free(range); range = tmp; } else { range->incompatible = 1; return range; } /* * Merge with the rest of them. * Canonicalizator will do the union magic. */ for(; i < ct->el_count; i++) { tmp = asn1constraint_compute_PER_range(expr_type, ct->elements[i], type, minmax, exmet, cpr_flags); if(!tmp) { if(errno == ERANGE) { range->extensible = 1; continue; } else { _range_free(range); return NULL; } } if(tmp->incompatible) { _range_free(tmp); _range_canonicalize(range); range->incompatible = 1; return range; } if(tmp->empty_constraint) { /* * Ignore empty constraints in OR logic. */ range->extensible |= tmp->extensible; _range_free(tmp); continue; } _range_merge_in(range, tmp); } _range_canonicalize(range); if(range->extensible && type == ACT_CT_FROM) { /* * X.691, #9.3.10: * Extensible permitted alphabet constraints * are not PER-visible. */ range->not_PER_visible = 1; } if(range->not_PER_visible && (cpr_flags & CPR_strict_PER_visibility)) { /* * X.691, #9.3.19: * If not PER-visible constraint is part of UNION, * the whole resulting constraint is not PER-visible. */ _range_free(range); if(minmax) range = _range_clone(minmax); else range = _range_new(); range->not_PER_visible = 1; range->incompatible = 1; } return range; case ACT_CA_EXC: /* FROM("ABCD") EXCEPT FROM("AB") */ /* * X.691, #9.3.19: * EXCEPT and the following value set is completely ignored. */ assert(ct->el_count >= 1); _range_free(range); range = asn1constraint_compute_PER_range(expr_type, ct->elements[0], type, minmax, exmet, cpr_flags); return range; default: range->incompatible = 1; return range; } if(!*exmet) { /* * Expectation is not met. Return the default range. */ range->incompatible = 1; return range; } _range_free(range); range = _range_new(); ret = _range_fill(vmin, minmax, &range->left, range, type, ct->_lineno); if(!ret) ret = _range_fill(vmax, minmax, &range->right, range, type, ct->_lineno); if(ret) { _range_free(range); errno = EPERM; return NULL; } if(minmax) { asn1cnst_range_t *clone; clone = _range_clone(minmax); /* Constrain parent type with given data. */ ret = _range_intersection(clone, range, 1); _range_free(range); if(ret) { _range_free(clone); errno = EPERM; return NULL; } range = clone; } /* * Recompute elements's min/max, remove duplicates, etc. */ _range_canonicalize(range); return range; } #ifdef UNIT_TEST int main() { asn1cnst_range_t *ra = _range_new(); asn1cnst_range_t *rb = _range_new(); fprintf(stderr, "Testing (MIN..20) x (10..15) => (MIN..9,10..15,16..20)\n"); /* (MIN..20) */ ra->left.type = ARE_MIN; ra->right.type = ARE_VALUE; ra->right.value = 20; /* (10..15) */ rb->left.type = ARE_VALUE; rb->left.value = 10; rb->right.type = ARE_VALUE; rb->right.value = 15; /* * (MIN..20) x (10..15) = (MIN..9,10..15,16..20) */ asn1cnst_range_t *r = _range_split(ra, rb); assert(r); assert(r->left.type == ARE_MIN); assert(r->right.type == ARE_MAX); assert(r->el_count == 3); assert(r->elements[0]->elements == NULL); assert(r->elements[1]->elements == NULL); assert(r->elements[2]->elements == NULL); /* (MIN..9) */ fprintf(stderr, "[0].left = %s\n", _edge_value(&r->elements[0]->left)); fprintf(stderr, "[0].right = %s\n", _edge_value(&r->elements[0]->right)); assert(r->elements[0]->left.type == ARE_MIN); assert(r->elements[0]->right.type == ARE_VALUE); assert(r->elements[0]->right.value == 9); /* (10..15) */ fprintf(stderr, "[1].left = %s\n", _edge_value(&r->elements[1]->left)); fprintf(stderr, "[1].right = %s\n", _edge_value(&r->elements[1]->right)); assert(r->elements[1]->left.type == ARE_VALUE); assert(r->elements[1]->left.value == 10); assert(r->elements[1]->right.type == ARE_VALUE); assert(r->elements[1]->right.value == 15); /* (16..20) */ fprintf(stderr, "[2].left = %s\n", _edge_value(&r->elements[2]->left)); fprintf(stderr, "[2].right = %s\n", _edge_value(&r->elements[2]->right)); assert(r->elements[2]->left.type == ARE_VALUE); assert(r->elements[2]->left.value == 16); assert(r->elements[2]->right.type == ARE_VALUE); assert(r->elements[2]->right.value == 20); _range_free(r); fprintf(stderr, "Testing (MIN..20) x (..15) => (..15,16..20)\n"); /* (MIN..20) */ ra->left.type = ARE_MIN; ra->right.type = ARE_VALUE; ra->right.value = 20; /* (..15) */ rb->left.type = ARE_VALUE; rb->left.value = INTMAX_MIN; rb->right.type = ARE_VALUE; rb->right.value = 15; r = _range_split(ra, rb); assert(r); assert(r->left.type == ARE_MIN); assert(r->right.type == ARE_MAX); assert(r->el_count == 2); assert(r->elements[0]->elements == NULL); assert(r->elements[1]->elements == NULL); /* (..16) */ fprintf(stderr, "[0].left = %s\n", _edge_value(&r->elements[0]->left)); fprintf(stderr, "[0].right = %s\n", _edge_value(&r->elements[0]->right)); assert(r->elements[0]->left.type == ARE_VALUE); assert(r->elements[0]->left.value == INTMAX_MIN); assert(r->elements[0]->right.type == ARE_VALUE); assert(r->elements[0]->right.value == 15); /* (16..20) */ fprintf(stderr, "[1].left = %s\n", _edge_value(&r->elements[1]->left)); fprintf(stderr, "[1].right = %s\n", _edge_value(&r->elements[1]->right)); assert(r->elements[1]->left.type == ARE_VALUE); assert(r->elements[1]->left.value == 16); assert(r->elements[1]->right.type == ARE_VALUE); assert(r->elements[1]->right.value == 20); _range_free(r); return 0; } #endif asn1c-0.9.28+dfsg/libasn1fix/asn1fix_derefv.h0000644000000000000000000000025313065714043017354 0ustar rootroot#ifndef ASN1FIX_DEREFV_H #define ASN1FIX_DEREFV_H int asn1f_fix_dereference_values(arg_t *); int asn1f_fix_dereference_defaults(arg_t *); #endif /* ASN1FIX_DEREFV_H */ asn1c-0.9.28+dfsg/libasn1fix/asn1fix_constraint.c0000644000000000000000000002031713065714043020263 0ustar rootroot#include "asn1fix_internal.h" #include "asn1fix_constraint.h" #include "asn1fix_crange.h" static void _remove_extensions(arg_t *arg, asn1p_constraint_t *ct, int flast); static int constraint_type_resolve(arg_t *arg, asn1p_constraint_t *ct); static int constraint_value_resolve(arg_t *arg, asn1p_value_t **value, enum asn1p_constraint_type_e real_ctype); int asn1constraint_pullup(arg_t *arg) { asn1p_expr_t *expr = arg->expr; asn1p_expr_t *top_parent; asn1p_constraint_t *ct_parent; asn1p_constraint_t *ct_expr; int ret; if(expr->combined_constraints) return 0; /* Operation already performed earlier */ switch(expr->meta_type) { case AMT_TYPE: case AMT_TYPEREF: break; default: return 0; /* Nothing to do */ } if(expr->expr_type == A1TC_REFERENCE) { asn1p_ref_t *ref = expr->reference; asn1p_expr_t *parent_expr; assert(ref); parent_expr = asn1f_lookup_symbol(arg, expr->module, expr->rhs_pspecs, ref); if(!parent_expr) { if(errno != EEXIST) { DEBUG("\tWhile fetching parent constraints: " "type \"%s\" not found: %s", asn1f_printable_reference(ref), strerror(errno)); return -1; } else { /* * -fknown-extern-type is given. * Assume there are no constraints there. */ WARNING("External type \"%s\": " "assuming no constraints", asn1f_printable_reference(ref)); ct_parent = 0; } } else { arg->expr = parent_expr; ret = asn1constraint_pullup(arg); arg->expr = expr; if(ret) return ret; ct_parent = parent_expr->combined_constraints; } } else { ct_parent = 0; } ct_expr = expr->constraints; if(!ct_parent && !ct_expr) return 0; /* No constraints to consider */ /* * Resolve constraints, if not already resolved. */ top_parent = asn1f_find_terminal_type(arg, arg->expr); ret = asn1constraint_resolve(arg, ct_expr, top_parent ? top_parent->expr_type : A1TC_INVALID, 0); if(ret) return ret; /* * Copy parent type constraints. */ if(ct_parent) { ct_parent = asn1p_constraint_clone(ct_parent); assert(ct_parent); } /* * If the current type does not have constraints, it inherits * the constraints of a parent. */ if(ct_parent && !ct_expr) { expr->combined_constraints = ct_parent; return 0; } ct_expr = asn1p_constraint_clone(ct_expr); assert(ct_expr); /* * Now we have a set of current expression's constraints, * and an optional set of the parent expression's constraints. */ if(ct_parent) { /* * If we have a parent, remove all the extensions (46.4). */ _remove_extensions(arg, ct_parent, 0); expr->combined_constraints = ct_parent; if(ct_expr->type == ACT_CA_SET) { unsigned int i; for(i = 0; i < ct_expr->el_count; i++) { if(asn1p_constraint_insert( expr->combined_constraints, ct_expr->elements[i])) { expr->combined_constraints = 0; asn1p_constraint_free(ct_expr); asn1p_constraint_free(ct_parent); return -1; } else { ct_expr->elements[i] = 0; } } asn1p_constraint_free(ct_expr); } else { asn1p_constraint_insert(expr->combined_constraints, ct_expr); } } else { _remove_extensions(arg, ct_expr, 1); expr->combined_constraints = ct_expr; } return 0; } int asn1constraint_resolve(arg_t *arg, asn1p_constraint_t *ct, asn1p_expr_type_e etype, enum asn1p_constraint_type_e effective_type) { enum asn1p_constraint_type_e real_constraint_type; unsigned int el; int rvalue = 0; int ret; DEBUG("(\"%s\")", arg->expr->Identifier); if(!ct) return 0; /* Don't touch information object classes */ switch(ct->type) { case ACT_CT_SIZE: case ACT_CT_FROM: if(effective_type && effective_type != ct->type) { FATAL("%s at line %d: " "Incompatible nested %s within %s", arg->expr->Identifier, ct->_lineno, asn1p_constraint_type2str(ct->type), asn1p_constraint_type2str(effective_type) ); } effective_type = ct->type; break; case ACT_CT_WCOMP: case ACT_CT_WCOMPS: case ACT_CA_CRC: return 0; default: break; } real_constraint_type = effective_type ? effective_type : ct->type; if(etype != A1TC_INVALID) { ret = asn1constraint_compatible(etype, real_constraint_type, arg->flags & A1F_EXTENDED_SizeConstraint); switch(ret) { case -1: /* If unknown, assume OK. */ case 1: break; case 0: default: FATAL("%s at line %d: " "Constraint type %s is not applicable to %s", arg->expr->Identifier, ct->_lineno, asn1p_constraint_type2str(real_constraint_type), ASN_EXPR_TYPE2STR(etype) ); rvalue = -1; break; } } else { WARNING("%s at line %d: " "Constraints ignored: Unresolved parent type", arg->expr->Identifier, arg->expr->_lineno); } /* * Resolve all possible references, wherever they occur. */ if(ct->containedSubtype) { ret = constraint_type_resolve(arg, ct); RET2RVAL(ret, rvalue); } if(ct->value && ct->value->type == ATV_REFERENCED) { ret = constraint_value_resolve(arg, &ct->value, real_constraint_type); RET2RVAL(ret, rvalue); } if(ct->range_start && ct->range_start->type == ATV_REFERENCED) { ret = constraint_value_resolve(arg, &ct->range_start, real_constraint_type); RET2RVAL(ret, rvalue); } if(ct->range_stop && ct->range_stop->type == ATV_REFERENCED) { ret = constraint_value_resolve(arg, &ct->range_stop, real_constraint_type); RET2RVAL(ret, rvalue); } /* * Proceed recursively. */ for(el = 0; el < ct->el_count; el++) { ret = asn1constraint_resolve(arg, ct->elements[el], etype, effective_type); RET2RVAL(ret, rvalue); } return rvalue; } static void _remove_extensions(arg_t *arg, asn1p_constraint_t *ct, int forgive_last) { unsigned int i; if(!ct) return; for(i = 0; i < ct->el_count; i++) { if(ct->elements[i]->type == ACT_EL_EXT) break; if(forgive_last && ct->type == ACT_CA_SET && i + 1 == ct->el_count) return; _remove_extensions(arg, ct->elements[i], 0); } /* Remove the elements at and after the extensibility mark */ for(; i < ct->el_count; ct->el_count--) { asn1p_constraint_t *rm; rm = ct->elements[ct->el_count-1]; asn1p_constraint_free(rm); } if(i < ct->el_size) ct->elements[i] = 0; } static int constraint_type_resolve(arg_t *arg, asn1p_constraint_t *ct) { asn1p_constraint_t *ct_expr; int ret; DEBUG("(\"%s\")", asn1f_printable_value(ct->containedSubtype)); if(ct->containedSubtype->type == ATV_VALUESET) { ct_expr = ct->containedSubtype->value.constraint; DEBUG("Found %s in constraints", "ValueSet"); } else if(ct->containedSubtype->type == ATV_REFERENCED) { asn1p_expr_t *rtype; arg_t tmparg; rtype = asn1f_lookup_symbol(arg, arg->expr->module, arg->expr->rhs_pspecs, ct->containedSubtype->value.reference); if(!rtype) { FATAL("Cannot find type \"%s\" in constraints " "at line %d", asn1f_printable_value(ct->containedSubtype), ct->_lineno); return -1; } tmparg = *arg; tmparg.expr = rtype; tmparg.mod = rtype->module; ret = asn1constraint_pullup(&tmparg); if(ret) return ret; ct_expr = rtype->combined_constraints; if(!ct_expr) return 0; } else { FATAL("Unsupported feature at line %d", ct->_lineno); return -1; } ct_expr = asn1p_constraint_clone(ct_expr); assert(ct_expr); _remove_extensions(arg, ct_expr, 0); if(ct_expr->type == ACT_CA_SET) { unsigned int i; for(i = 0; i < ct_expr->el_count; i++) { if(asn1p_constraint_insert( ct, ct_expr->elements[i])) { asn1p_constraint_free(ct_expr); return -1; } else { ct_expr->elements[i] = 0; } } asn1p_constraint_free(ct_expr); } else { ret = asn1p_constraint_insert(ct, ct_expr); assert(ret == 0); } ct->type = ACT_CA_SET; asn1p_value_free(ct->containedSubtype); ct->containedSubtype = NULL; return 0; } static int constraint_value_resolve(arg_t *arg, asn1p_value_t **value, enum asn1p_constraint_type_e real_ctype) { asn1p_expr_t static_expr; arg_t tmp_arg; int rvalue = 0; int ret; DEBUG("(\"%s\", within <%s>)", asn1f_printable_value(*value), asn1p_constraint_type2str(real_ctype)); static_expr = *arg->expr; static_expr.value = *value; static_expr.meta_type = AMT_VALUE; tmp_arg = *arg; tmp_arg.mod = arg->expr->module; tmp_arg.expr = &static_expr; ret = asn1f_value_resolve(&tmp_arg, &static_expr, &real_ctype); RET2RVAL(ret, rvalue); assert(static_expr.value); *value = static_expr.value; return rvalue; } asn1c-0.9.28+dfsg/libasn1fix/asn1fix_constraint_compat.c0000644000000000000000000001416413065714043021631 0ustar rootroot#include "asn1fix_internal.h" #include "asn1fix_crange.h" /* * Check that a specific constraint is compatible * with the given expression type. */ int asn1constraint_compatible(asn1p_expr_type_e expr_type, enum asn1p_constraint_type_e constr_type, int fbless_SIZE) { if(expr_type == ASN_BASIC_REAL) return -1; /* Not yet supported */ /* * X.680-0207, Table 9. */ switch(constr_type) { case ACT_INVALID: return 0; case ACT_EL_TYPE: return 1; case ACT_EL_VALUE: return 1; case ACT_EL_RANGE: case ACT_EL_LLRANGE: case ACT_EL_RLRANGE: case ACT_EL_ULRANGE: switch(expr_type) { case ASN_BASIC_ENUMERATED: case ASN_BASIC_BOOLEAN: /* * The ValueRange constraint is not formally * applicable to the above types. However, we * support it just fine. */ /* Fall through */ case ASN_BASIC_INTEGER: case ASN_BASIC_REAL: return 1; default: if(expr_type & ASN_STRING_MASK) return 1; } return 0; case ACT_EL_EXT: return -1; case ACT_CT_FROM: if(expr_type & ASN_STRING_MASK) return 1; return 0; case ACT_CT_SIZE: switch(expr_type) { case ASN_BASIC_INTEGER: case ASN_BASIC_ENUMERATED: if(fbless_SIZE) return 1; break; case ASN_BASIC_BIT_STRING: case ASN_BASIC_OCTET_STRING: case ASN_BASIC_CHARACTER_STRING: case ASN_CONSTR_SEQUENCE_OF: case ASN_CONSTR_SET_OF: return 1; default: if(expr_type & ASN_STRING_MASK) return 1; } return 0; case ACT_CT_WCOMP: case ACT_CT_WCOMPS: switch(expr_type) { case A1TC_INSTANCE: case ASN_BASIC_EXTERNAL: case ASN_BASIC_EMBEDDED_PDV: case ASN_BASIC_REAL: case ASN_BASIC_CHARACTER_STRING: case ASN_CONSTR_CHOICE: case ASN_CONSTR_SEQUENCE: case ASN_CONSTR_SEQUENCE_OF: case ASN_CONSTR_SET: case ASN_CONSTR_SET_OF: return 1; default: break; } return 0; case ACT_CT_CTDBY: return 1; case ACT_CT_CTNG: /* X.682, #11 */ switch(expr_type) { case ASN_BASIC_OCTET_STRING: case ASN_BASIC_BIT_STRING: return 1; default: return 0; } case ACT_CT_PATTERN: if(expr_type & ASN_STRING_MASK) return 1; return 0; case ACT_CA_SET: case ACT_CA_CRC: case ACT_CA_CSV: case ACT_CA_UNI: case ACT_CA_INT: case ACT_CA_EXC: case ACT_CA_AEX: return 1; } return -1; } #define DECL_RANGE(foo, val1, val2, pv) \ static asn1cnst_range_t range_ ## foo = { \ { ARE_VALUE, 0, val1 }, \ { ARE_VALUE, 0, val2 }, \ 0, 0, 0, 0, 0, 0, pv } #define DECL(foo, val1, val2) DECL_RANGE(foo, val1, val2, 0) #define DECL_notPV(foo, val1, val2) DECL_RANGE(foo, val1, val2, 1) asn1cnst_range_t * asn1constraint_default_alphabet(asn1p_expr_type_e expr_type) { DECL_notPV(octstr, 0x00, 0xff); /* Not PER-visible */ DECL_notPV(utf8, 0x00, 0x7fffffff); /* Not PER-visible */ DECL(bmp, 0x00, 65533); /* 64K-2 cells */ DECL(uint7, 0x00, 0x7f); DECL(uint32, 0x00, 0xffffffff); DECL(Space, 0x20, 0x20); DECL(ApostropheAndParens, 0x27, 0x29); DECL(PlusTillColon, 0x2b, 0x3a); DECL(Equal, 0x3d, 0x3d); DECL(QuestionMark, 0x3f, 0x3f); DECL(Digits, 0x30, 0x39); DECL(AlphaCap, 0x41, 0x5a); DECL(AlphaLow, 0x61, 0x7a); DECL(PlusCommaMinusDot, 0x2b, 0x2e); DECL(Plus, 0x2b, 0x2b); DECL(MinusDot, 0x2d, 0x2e); DECL(Z, 0x5a, 0x5a); static asn1cnst_range_t *range_NumericString_array[] = { &range_Space, &range_Digits }; static asn1cnst_range_t *range_PrintableString_array[] = { &range_Space, &range_ApostropheAndParens, &range_PlusTillColon, &range_Equal, &range_QuestionMark, &range_AlphaCap, &range_AlphaLow }; static asn1cnst_range_t *range_UTCTime_array[] = { &range_Plus, &range_MinusDot, &range_Digits, &range_Z }; static asn1cnst_range_t *range_GeneralizedTime_array[] = { &range_PlusCommaMinusDot, &range_Digits, &range_Z }; static asn1cnst_range_t range_notPERVisible = { { ARE_MIN, 0, 0 }, { ARE_MAX, 0, 0 }, 0, 0, 0, 0, 0, 0, 1 }; static asn1cnst_range_t range_NumericString = { { ARE_VALUE, 0, 0x20 }, { ARE_VALUE, 0, 0x39 }, range_NumericString_array, sizeof(range_NumericString_array) /sizeof(range_NumericString_array[0]), 0, 0, 0, 0, 0 }; static asn1cnst_range_t range_PrintableString = { { ARE_VALUE, 0, 0x20 }, { ARE_VALUE, 0, 0x7a }, range_PrintableString_array, sizeof(range_PrintableString_array) /sizeof(range_PrintableString_array[0]), 0, 0, 0, 0, 0 }; static asn1cnst_range_t range_VisibleString = { { ARE_VALUE, 0, 0x20 }, { ARE_VALUE, 0, 0x7e }, 0, 0, 0, 0, 0, 0, 0 }; static asn1cnst_range_t range_UTCTime = { { ARE_VALUE, 0, 0x2b }, { ARE_VALUE, 0, 0x5a }, range_UTCTime_array, sizeof(range_UTCTime_array) /sizeof(range_UTCTime_array[0]), 0, 0, 0, 0, 1 }; static asn1cnst_range_t range_GeneralizedTime = { { ARE_VALUE, 0, 0x2b }, { ARE_VALUE, 0, 0x5a }, range_GeneralizedTime_array, sizeof(range_GeneralizedTime_array) /sizeof(range_GeneralizedTime_array[0]), 0, 0, 0, 0, 1 }; switch(expr_type) { case ASN_STRING_NumericString: return &range_NumericString; case ASN_STRING_PrintableString: return &range_PrintableString; case ASN_STRING_VisibleString: return &range_VisibleString; case ASN_STRING_IA5String: return &range_uint7; case ASN_STRING_BMPString: return &range_bmp; case ASN_STRING_UTF8String: /* * X.691, #9.3.6 * Not a known-multipler character string type. */ assert(range_utf8.not_PER_visible); return &range_utf8; case ASN_STRING_UniversalString: return &range_uint32; case ASN_BASIC_UTCTime: /* Permitted alphabet constraint is not applicable */ assert(range_UTCTime.not_PER_visible); return &range_UTCTime; case ASN_BASIC_GeneralizedTime: /* Permitted alphabet constraint is not applicable */ assert(range_GeneralizedTime.not_PER_visible); return &range_GeneralizedTime; case ASN_BASIC_OCTET_STRING: /* * Permitted alphabet constraint is not applicable * to this type. However, we support it, albeit not * in a strict PER mode. */ assert(range_octstr.not_PER_visible); return &range_octstr; default: if(!(expr_type & ASN_STRING_MASK)) break; assert(expr_type & ASN_STRING_NKM_MASK); /* * X.691, 9.3.6 * Not a known-multiplier character string. */ return &range_notPERVisible; } return NULL; } asn1c-0.9.28+dfsg/libasn1fix/asn1fix_crange.h0000644000000000000000000000370413065714043017344 0ustar rootroot#ifndef ASN1FIX_CRANGE_H #define ASN1FIX_CRANGE_H typedef struct asn1cnst_edge_s { enum asn1cnst_range_edge { ARE_MIN, ARE_MAX, ARE_VALUE, } type; int lineno; /* Line where the corresponding token was found */ asn1c_integer_t value; /* Value when type is ARE_VALUE */ } asn1cnst_edge_t; typedef struct asn1cnst_range_s { asn1cnst_edge_t left; /* MIN from (MIN..10) */ asn1cnst_edge_t right; /* 10 from (MIN..10) */ /* If range is split in parts, these are the parts */ struct asn1cnst_range_s **elements; int el_count; int el_size; int empty_constraint; /* If yes, too bad. */ int extensible; /* Extension marker (...) is in effect. */ int incompatible; /* Constraint incompatible with argument */ int not_PER_visible; /* Contains not PER-visible components */ } asn1cnst_range_t; /* * Compute the constraint range with variable PER visibility restrictions. * * (expr_type) must have the type of the top-level parent ASN.1 type. * (required_type) must be one of ACT_EL_RANGE, ACT_CT_SIZE or ACT_CT_FROM. * (minmax) and (expectation_met) should be 0. * ERRORS: * EINVAL: Mandatory arguments missing. * ENOMEM: Memory allocation failure. * EPERM: Invalid constraint reference. */ enum cpr_flags { CPR_noflags = 0x00, CPR_strict_PER_visibility = 0x01, CPR_simulate_fbless_SIZE = 0x02, }; asn1cnst_range_t *asn1constraint_compute_PER_range(asn1p_expr_type_e expr_type, const asn1p_constraint_t *ct, enum asn1p_constraint_type_e required_type, const asn1cnst_range_t *minmax, int *expectation_met, enum cpr_flags); void asn1constraint_range_free(asn1cnst_range_t *); /* * Check that a specific constraint is compatible * with the given expression type. */ int asn1constraint_compatible(asn1p_expr_type_e expr_type, enum asn1p_constraint_type_e constr_type, int fbless_SIZE); /* * Fetch a default alphabet for this type. */ asn1cnst_range_t *asn1constraint_default_alphabet(asn1p_expr_type_e expr_type); #endif /* ASN1FIX_CRANGE_H */ asn1c-0.9.28+dfsg/libasn1fix/asn1fix_compat.c0000644000000000000000000000675613065714043017375 0ustar rootroot#include "asn1fix_internal.h" static int asn1f_check_same_children(arg_t *arg, asn1p_expr_t *a, asn1p_expr_t *b); /* * Check that the expressions given are compatible in their type. * ORDER DOES MATTER! (See .h). */ int asn1f_check_type_compatibility(arg_t *arg, asn1p_expr_t *a, asn1p_expr_t *b) { asn1p_expr_type_e atype, btype; atype = a->expr_type; btype = b->expr_type; DEBUG("(%s:%x@%d, %s:%x@%d)", a->Identifier, atype, a->_lineno, b->Identifier, btype, b->_lineno); /* * Expected terminal type! */ assert(atype != A1TC_REFERENCE); assert(btype != A1TC_REFERENCE); if(a == b) return 0; /* Fairly obviously */ if(atype != btype) { /* * Limited cross-compatibility of integer types. */ if((atype == A1TC_UNIVERVAL && btype == ASN_BASIC_INTEGER) || (atype == A1TC_UNIVERVAL && btype == ASN_BASIC_ENUMERATED) ) return 0; /* Limited cross-compatibility of string types */ if((atype & ASN_STRING_MASK) && (btype & ASN_STRING_MASK)) { /* X.680, B.5 */ int akm = (atype & ASN_STRING_KM_MASK) || atype == ASN_STRING_UTF8String; int bkm = (btype & ASN_STRING_KM_MASK) || btype == ASN_STRING_UTF8String; return (akm == bkm) ? 0 : -1; } DEBUG("\t%s and %s are not compatible", a->Identifier, b->Identifier); return -1; /* Fairly obviously */ } switch(atype) { case ASN_BASIC_INTEGER: /* All integers are compatible, X.680, B.4.5 */ return 0; case ASN_BASIC_ENUMERATED: /* * Enumerations are not compatible * unless their definitions are the same. */ if(asn1f_check_same_children(arg, a, b)) { DEBUG("\tEnumerations are different %s and %s", a->Identifier, b->Identifier); return -1; } return 0; default: if((atype & ASN_STRING_MASK) && (btype & ASN_STRING_MASK)) { /* String type is compatible with the same type */ return 0; } /* Compatibility is not defined yet */ DEBUG("\tCompatibility rule is not defined for %s and %s", a->Identifier, b->Identifier); return -1; } return 0; } /* * Check that the children are exactly same. */ static int asn1f_check_same_children(arg_t *arg, asn1p_expr_t *a, asn1p_expr_t *b) { asn1p_expr_t *achild; asn1p_expr_t *bchild; achild = TQ_FIRST(&(a->members)); bchild = TQ_FIRST(&(b->members)); while(1) { if(achild->expr_type != bchild->expr_type) return -1; if(achild->Identifier && bchild->Identifier) { if(strcmp(achild->Identifier, bchild->Identifier)) return -1; } else if(!(!achild->Identifier && !bchild->Identifier)) { return -1; } if(achild->value && bchild->value) { if(achild->value->type != bchild->value->type) return -1; switch(achild->value->type) { case ATV_INTEGER: if(achild->value->value.v_integer != bchild->value->value.v_integer) return -1; break; case ATV_REFERENCED: default: DEBUG("Value %s at lines %d and " "%d cannot be used in " "semantical equality check", asn1f_printable_value(achild->value), achild->value->value.reference->_lineno, bchild->value->value.reference->_lineno ); return -1; } } else if(!(!achild->value && !bchild->value)) { /* One of values is defined, and another is not */ return -1; } achild = TQ_NEXT(achild, next); bchild = TQ_NEXT(bchild, next); if(achild && bchild) continue; else if(!achild && !bchild) break; else return -1; } DEBUG("\t%s:%x@%d and %s:%x@%d are semantically equivalent", a->Identifier, a->expr_type, a->_lineno, b->Identifier, b->expr_type, b->_lineno); return 0; } asn1c-0.9.28+dfsg/libasn1fix/asn1fix_dereft.h0000644000000000000000000000017413065714043017354 0ustar rootroot#ifndef ASN1FIX_DEREFT_H #define ASN1FIX_DEREFT_H int asn1f_fix_dereference_types(arg_t *); #endif /* ASN1FIX_DEREFT_H */ asn1c-0.9.28+dfsg/libasn1fix/asn1fix_enum.h0000644000000000000000000000023113065714043017041 0ustar rootroot#ifndef ASN1FIX_ENUM_H #define ASN1FIX_ENUM_H int asn1f_fix_enum(arg_t *); /* Enumeration ::= ENUMERATED { a(1), b(2) } */ #endif /* ASN1FIX_ENUM_H */ asn1c-0.9.28+dfsg/libasn1fix/asn1fix_tags.c0000644000000000000000000001064113065714043017034 0ustar rootroot#include "asn1fix_internal.h" #define ADD_TAG(skip, newtag) do { \ void *__p; \ if(skip && !(flags & AFT_FULL_COLLECT)) { \ if(newtag.tag_mode != TM_IMPLICIT) \ skip--; \ break; \ } else { \ if(newtag.tag_mode == TM_IMPLICIT) \ skip++; \ } \ __p = realloc((*tags), \ sizeof(struct asn1p_type_tag_s) * (count + 1)); \ if(!__p) return -1; \ *tags = __p; \ (*tags)[count++] = newtag; \ if((flags & AFT_FETCH_OUTMOST)) return count; \ } while(0) /* X.691, #22.2 */ static int asn1f_fetch_minimal_choice_root_tag(arg_t *arg, struct asn1p_type_tag_s *tag, enum asn1f_aft_flags_e flags); static int asn1f_fetch_tags_impl(arg_t *arg, struct asn1p_type_tag_s **tags, int count, int skip, enum asn1f_aft_flags_e flags) { asn1p_expr_t *expr = arg->expr; DEBUG("Fetching tag from %s: meta %d, type %s", expr->Identifier, expr->meta_type, expr->expr_type); /* If this type is tagged, add this tag first */ if(expr->tag.tag_class != TC_NOCLASS) ADD_TAG(skip, expr->tag); /* REMOVE ME */ if(expr->expr_type == A1TC_EXTENSIBLE) { struct asn1p_type_tag_s tt; memset(&tt, 0, sizeof(tt)); tt.tag_class = -1; ADD_TAG(skip, tt); return count; } if(expr->meta_type == AMT_TYPE) { struct asn1p_type_tag_s tt; memset(&tt, 0, sizeof(tt)); tt.tag_class = TC_UNIVERSAL; tt.tag_value = expr_type2uclass_value[expr->expr_type]; if(tt.tag_value == 0) { if(expr->expr_type == ASN_TYPE_ANY && (flags & AFT_IMAGINARY_ANY)) tt.tag_value = -1; else if(expr->expr_type != ASN_CONSTR_CHOICE) return -1; else if(count) return count; else if((flags & AFT_CANON_CHOICE) == 0) return -1; else if(asn1f_fetch_minimal_choice_root_tag(arg, &tt, flags)) return -1; } ADD_TAG(skip, tt); return count; } if(expr->meta_type == AMT_TYPEREF) { asn1p_expr_t *nexpr; DEBUG("Following the reference %s", expr->Identifier); nexpr = asn1f_lookup_symbol(arg, expr->module, expr->rhs_pspecs, expr->reference); if(nexpr == NULL) { if(errno != EEXIST) /* -fknown-extern-type */ return -1; if(!count) return 0; /* OK */ if((*tags)[count-1].tag_mode == TM_IMPLICIT) { WARNING("Tagging mode for %s " "is IMPLICIT, assuming %s " "has exactly one tag", expr->Identifier, asn1f_printable_reference(expr->reference) ); return count; } FATAL("Tagging mode %s -> %s " "dangerously incompatible", expr->Identifier, asn1f_printable_reference(expr->reference) ); return -1; } else { arg->expr = nexpr; } if(expr->_mark & TM_RECURSION) return -1; expr->_mark |= TM_RECURSION; count = asn1f_fetch_tags_impl(arg, tags, count, skip, flags); expr->_mark &= ~TM_RECURSION; return count; } DEBUG("No tags discovered for type %d", expr->expr_type); return -1; } static int asn1f_fetch_minimal_choice_root_tag(arg_t *arg, struct asn1p_type_tag_s *tag, enum asn1f_aft_flags_e flags) { struct asn1p_type_tag_s min_tag; asn1p_expr_t *v; memset(&min_tag, 0, sizeof(min_tag)); min_tag.tag_class = TC_PRIVATE + 1; TQ_FOR(v, &(arg->expr->members), next) { arg_t tmparg = *arg; struct asn1p_type_tag_s *tags = 0; int count; if(v->expr_type == A1TC_EXTENSIBLE) break; /* Search only within extension root */ tmparg.expr = v; count = asn1f_fetch_tags_impl(&tmparg, &tags, 0, 0, flags); if(count <= 0) continue; if(tags[0].tag_class < min_tag.tag_class) min_tag = tags[0]; else if(tags[0].tag_class == min_tag.tag_class && tags[0].tag_value < min_tag.tag_value) min_tag = tags[0]; free(tags); } if(min_tag.tag_class == TC_PRIVATE + 1) return -1; else *tag = min_tag; return 0; } int asn1f_fetch_outmost_tag(asn1p_t *asn, asn1p_module_t *mod, asn1p_expr_t *expr, struct asn1p_type_tag_s *tag, enum asn1f_aft_flags_e flags) { struct asn1p_type_tag_s *tags; int count; flags |= AFT_FETCH_OUTMOST; count = asn1f_fetch_tags(asn, mod, expr, &tags, flags); if(count <= 0) return count; *tag = tags[0]; free(tags); return 0; } int asn1f_fetch_tags(asn1p_t *asn, asn1p_module_t *mod, asn1p_expr_t *expr, struct asn1p_type_tag_s **tags_r, enum asn1f_aft_flags_e flags) { arg_t arg; struct asn1p_type_tag_s *tags = 0; int count; memset(&arg, 0, sizeof(arg)); arg.asn = asn; arg.mod = mod; arg.expr = expr; count = asn1f_fetch_tags_impl(&arg, &tags, 0, 0, flags); if(count <= 0 && tags) { free(tags); tags = 0; } *tags_r = tags; return count; } asn1c-0.9.28+dfsg/libasn1fix/asn1fix_cws.c0000644000000000000000000001416013065714043016672 0ustar rootroot#include "asn1fix_internal.h" #include "asn1fix_cws.h" static int _asn1f_parse_class_object_data(arg_t *, asn1p_expr_t *eclass, struct asn1p_ioc_row_s *row, asn1p_wsyntx_t *syntax, uint8_t *buf, const uint8_t *bend, int optional_mode, uint8_t **newpos); static int _asn1f_assign_cell_value(arg_t *arg, struct asn1p_ioc_row_s *row, struct asn1p_ioc_cell_s *cell, uint8_t *buf, const uint8_t *bend); int asn1f_parse_class_object(arg_t *arg) { asn1p_expr_t *expr = arg->expr; asn1p_expr_t *eclass; asn1p_ioc_row_t *row; void *new_rows_ptr; int ret; if(expr->meta_type != AMT_VALUE || expr->expr_type != A1TC_REFERENCE || !expr->value || expr->value->type != ATV_UNPARSED) return 0; /* * Find the governing class. */ eclass = asn1f_find_terminal_type(arg, expr); if(!eclass || eclass->meta_type != AMT_OBJECTCLASS || eclass->expr_type != A1TC_CLASSDEF) { return 0; } DEBUG("Value %s of CLASS %s found at line %d", expr->Identifier, eclass->Identifier, expr->_lineno); if(!eclass->with_syntax) { DEBUG("Can't process classes without %s just yet", "WITH SYNTAX"); return 0; } row = asn1p_ioc_row_new(eclass); assert(row); ret = _asn1f_parse_class_object_data(arg, eclass, row, eclass->with_syntax, expr->value->value.string.buf + 1, expr->value->value.string.buf + expr->value->value.string.size - 1, 0, 0); if(ret) { LOG((int)(ret < 0), "Cannot parse %s of CLASS %s found at line %d", expr->Identifier, eclass->Identifier, expr->_lineno); asn1p_ioc_row_delete(row); return ret; } new_rows_ptr = realloc(eclass->object_class_matrix.row, (eclass->object_class_matrix.rows + 1) * sizeof(eclass->object_class_matrix.row[0])); assert(new_rows_ptr); eclass->object_class_matrix.row = new_rows_ptr; eclass->object_class_matrix.row[eclass->object_class_matrix.rows] = row; eclass->object_class_matrix.rows++; /* Propagate max identifier length */ if(eclass->object_class_matrix.max_identifier_length < row->max_identifier_length) eclass->object_class_matrix.max_identifier_length = row->max_identifier_length; return 0; } #define SKIPSPACES for(; buf < bend && isspace(*buf); buf++) static int _asn1f_parse_class_object_data(arg_t *arg, asn1p_expr_t *eclass, struct asn1p_ioc_row_s *row, asn1p_wsyntx_t *syntax, uint8_t *buf, const uint8_t *bend, int optional_mode, uint8_t **newpos) { struct asn1p_wsyntx_chunk_s *chunk; int ret; TQ_FOR(chunk, (&syntax->chunks), next) { switch(chunk->type) { case WC_LITERAL: { int token_len = strlen(chunk->content.token); SKIPSPACES; if(bend - buf < token_len || memcmp(buf, chunk->content.token, token_len)) { if(!optional_mode) { FATAL("While parsing object class value %s at line %d: Expected: \"%s\", found: \"%s\"", arg->expr->Identifier, arg->expr->_lineno, chunk->content.token, buf); } if(newpos) *newpos = buf; return -1; } buf += token_len; } break; case WC_WHITESPACE: break; /* Ignore whitespace */ case WC_FIELD: { struct asn1p_ioc_cell_s *cell; int lbraces = 0; uint8_t *p; SKIPSPACES; p = buf; if(p < bend && *p == '{') lbraces = 1, p++; for(; p < bend; p++) { if(lbraces) { /* Search the terminating brace */ switch(*p) { case '}': lbraces--; break; case '{': lbraces++; break; } } else if(isspace(*p)) { break; } } if(lbraces) { FATAL("Field reference %s found in class value definition for %s at line %d can not be satisfied by broken value \"%s\"", chunk->content.token, arg->expr->Identifier, arg->expr->_lineno, buf); if(newpos) *newpos = buf; return -1; } cell = asn1p_ioc_row_cell_fetch(row, chunk->content.token); if(cell == NULL) { FATAL("Field reference %s found in WITH SYNAX {} clause does not match actual field in Object Class %s", chunk->content.token, eclass->Identifier, eclass->_lineno); if(newpos) *newpos = buf; return -1; } DEBUG("Reference %s satisfied by %s (%d)", chunk->content.token, buf, p - buf); ret = _asn1f_assign_cell_value(arg, row, cell, buf, p); if(ret) return ret; buf = p; if(newpos) *newpos = buf; } break; case WC_OPTIONALGROUP: { uint8_t *np = 0; SKIPSPACES; ret = _asn1f_parse_class_object_data(arg, eclass, row, chunk->content.syntax, buf, bend, 1, &np); if(newpos) *newpos = np; if(ret && np != buf) return ret; buf = np; } break; } } if(newpos) *newpos = buf; return 0; } static int _asn1f_assign_cell_value(arg_t *arg, struct asn1p_ioc_row_s *row, struct asn1p_ioc_cell_s *cell, uint8_t *buf, const uint8_t *bend) { asn1p_expr_t *expr; asn1p_ref_t *ref; int idLength; char *p; if((bend - buf) <= 0) { FATAL("Assignment warning: empty string is being assigned into %s for %s at line %d", cell->field->Identifier, arg->expr->Identifier, arg->expr->_lineno); return -1; } p = malloc(bend - buf + 1); assert(p); memcpy(p, buf, bend - buf); p[bend - buf] = '\0'; if(!isalpha(*p)) { if(isdigit(*p)) { asn1c_integer_t value; if(asn1p_atoi(p, &value)) { FATAL("Value %s at line %d is too large for this compiler! Contact the asn1c author.\n", p, arg->expr->_lineno); return -1; } expr = asn1p_expr_new(arg->expr->_lineno, arg->expr->module); expr->Identifier = p; expr->meta_type = AMT_VALUE; expr->expr_type = ASN_BASIC_INTEGER; expr->value = asn1p_value_fromint(value); } else { WARNING("asn1c is not yet able to parse arbitrary direct values; try converting %s at line %d to a reference.", p, arg->expr->_lineno); free(p); return 1; } } else { ref = asn1p_ref_new(arg->expr->_lineno); asn1p_ref_add_component(ref, p, RLT_UNKNOWN); assert(ref); expr = asn1f_lookup_symbol(arg, arg->mod, arg->expr->rhs_pspecs, ref); if(!expr) { FATAL("Cannot find %s referenced by %s at line %d", p, arg->expr->Identifier, arg->expr->_lineno); return -1; } } DEBUG("Field %s assignment of %s got %s", cell->field->Identifier, p, expr->Identifier); cell->value = expr; idLength = strlen(expr->Identifier); if(row->max_identifier_length < idLength) row->max_identifier_length = idLength; return 0; } asn1c-0.9.28+dfsg/libasn1fix/asn1fix_compat.h0000644000000000000000000000054513065714043017370 0ustar rootroot#ifndef ASN1FIX_COMPAT_H #define ASN1FIX_COMPAT_H /* * Check that the expressions given are compatible in their type. * ORDER DOES MATTER! * The compatibility is being checked as if the value of b were used * to assign it to type a. */ int asn1f_check_type_compatibility(arg_t *arg, asn1p_expr_t *a, asn1p_expr_t *b); #endif /* ASN1FIX_COMPAT_H */ asn1c-0.9.28+dfsg/libasn1fix/asn1fix_param.c0000644000000000000000000001247213065714043017202 0ustar rootroot#include "asn1fix_internal.h" typedef struct resolver_arg { asn1p_expr_t *(*resolver)(asn1p_expr_t *, void *arg); arg_t *arg; asn1p_expr_t *original_expr; asn1p_paramlist_t *lhs_params; asn1p_expr_t *rhs_pspecs; } resolver_arg_t; static asn1p_expr_t *resolve_expr(asn1p_expr_t *, void *resolver_arg); static int compare_specializations(arg_t *, asn1p_expr_t *a, asn1p_expr_t *b); static asn1p_expr_t *find_target_specialization_byref(resolver_arg_t *rarg, asn1p_ref_t *ref); static asn1p_expr_t *find_target_specialization_bystr(resolver_arg_t *rarg, char *str); asn1p_expr_t * asn1f_parameterization_fork(arg_t *arg, asn1p_expr_t *expr, asn1p_expr_t *rhs_pspecs) { resolver_arg_t rarg; /* resolver argument */ asn1p_expr_t *exc; /* expr clone */ asn1p_expr_t *rpc; /* rhs_pspecs clone */ void *p; struct asn1p_pspec_s *pspec; int npspecs; assert(rhs_pspecs); assert(expr->lhs_params); assert(expr->parent_expr == 0); DEBUG("Forking parameterization at %d for %s (%d alr)", rhs_pspecs->_lineno, expr->Identifier, expr->specializations.pspecs_count); /* * Find if this exact specialization has been used already. */ for(npspecs = 0; npspecs < expr->specializations.pspecs_count; npspecs++) { if(compare_specializations(arg, rhs_pspecs, expr->specializations.pspec[npspecs].rhs_pspecs) == 0) { DEBUG("Reused parameterization for %s", expr->Identifier); return expr->specializations.pspec[npspecs].my_clone; } } rarg.resolver = resolve_expr; rarg.arg = arg; rarg.original_expr = expr; rarg.lhs_params = expr->lhs_params; rarg.rhs_pspecs = rhs_pspecs; exc = asn1p_expr_clone_with_resolver(expr, resolve_expr, &rarg); if(!exc) return NULL; rpc = asn1p_expr_clone(rhs_pspecs, 0); assert(rpc); /* * Create a new specialization. */ npspecs = expr->specializations.pspecs_count; p = realloc(expr->specializations.pspec, (npspecs + 1) * sizeof(expr->specializations.pspec[0])); assert(p); expr->specializations.pspec = p; pspec = &expr->specializations.pspec[npspecs]; memset(pspec, 0, sizeof *pspec); pspec->rhs_pspecs = rpc; pspec->my_clone = exc; exc->spec_index = npspecs; DEBUG("Forked new parameterization for %s", expr->Identifier); /* Commit */ expr->specializations.pspecs_count = npspecs + 1; return exc; } static int compare_specializations(arg_t *arg, asn1p_expr_t *a, asn1p_expr_t *b) { asn1p_expr_t *ac = TQ_FIRST(&a->members); asn1p_expr_t *bc = TQ_FIRST(&b->members); for(;ac && bc; ac = TQ_NEXT(ac, next), bc = TQ_NEXT(bc, next)) { retry: if(ac == bc) continue; if(ac->meta_type != bc->meta_type) break; if(ac->expr_type != bc->expr_type) break; if(!ac->reference && !bc->reference) continue; if(ac->reference) { ac = asn1f_lookup_symbol(arg, ac->module, ac->rhs_pspecs, ac->reference); if(!ac) break; } if(bc->reference) { bc = asn1f_lookup_symbol(arg, bc->module, bc->rhs_pspecs, bc->reference); if(!bc) break; } goto retry; } if(ac || bc) /* Specializations do not match: different size option sets */ return -1; return 0; } static asn1p_expr_t * resolve_expr(asn1p_expr_t *expr_to_resolve, void *resolver_arg) { resolver_arg_t *rarg = resolver_arg; arg_t *arg = rarg->arg; asn1p_expr_t *expr; asn1p_expr_t *nex; DEBUG("Resolving %s (meta %d)", expr_to_resolve->Identifier, expr_to_resolve->meta_type); if(expr_to_resolve->meta_type == AMT_TYPEREF) { expr = find_target_specialization_byref(rarg, expr_to_resolve->reference); if(!expr) return NULL; } else if(expr_to_resolve->meta_type == AMT_VALUE) { assert(expr_to_resolve->value); expr = find_target_specialization_bystr(rarg, expr_to_resolve->Identifier); if(!expr) return NULL; } else { errno = ESRCH; return NULL; } DEBUG("Found target %s (%d/%x)", expr->Identifier, expr->meta_type, expr->expr_type); if(expr->meta_type == AMT_TYPE || expr->meta_type == AMT_VALUE || expr->meta_type == AMT_TYPEREF || expr->meta_type == AMT_VALUESET) { DEBUG("Target is a simple type %s", ASN_EXPR_TYPE2STR(expr->expr_type)); nex = asn1p_expr_clone(expr, 0); free(nex->Identifier); nex->Identifier = expr_to_resolve->Identifier ? strdup(expr_to_resolve->Identifier) : 0; return nex; } else { FATAL("Feature not implemented for %s (%d/%x), " "please contact the asn1c author", rarg->original_expr->Identifier, expr->meta_type, expr->expr_type); errno = EPERM; return NULL; } return NULL; } static asn1p_expr_t * find_target_specialization_byref(resolver_arg_t *rarg, asn1p_ref_t *ref) { char *refstr; if(!ref || ref->comp_count != 1) { errno = ESRCH; return NULL; } refstr = ref->components[0].name; /* T */ return find_target_specialization_bystr(rarg, refstr); } static asn1p_expr_t * find_target_specialization_bystr(resolver_arg_t *rarg, char *refstr) { arg_t *arg = rarg->arg; asn1p_expr_t *target; int i; target = TQ_FIRST(&rarg->rhs_pspecs->members); for(i = 0; i < rarg->lhs_params->params_count; i++, target = TQ_NEXT(target, next)) { struct asn1p_param_s *param = &rarg->lhs_params->params[i]; if(!target) break; if(strcmp(param->argument, refstr)) continue; return target; } if(i != rarg->lhs_params->params_count) { FATAL("Parameterization of %s failed: " "parameters number mismatch", rarg->original_expr->Identifier); errno = EPERM; return NULL; } errno = ESRCH; return NULL; } asn1c-0.9.28+dfsg/libasn1fix/asn1fix_internal.h0000644000000000000000000000715513065714043017725 0ustar rootroot#ifndef ASN1FIX_INTERNAL_H #define ASN1FIX_INTERNAL_H #ifdef HAVE_CONFIG_H #include #endif /* * System headers required in various modules. */ #include #include #include #include #include /* isupper() */ #include #include #ifdef HAVE_UNISTD_H #include #endif #include /* Our lovely ASN.1 parser module */ #include "asn1fix.h" #ifdef _WIN32 #define EX_NOINPUT 66 #define EX_DATAERR 65 #define snprintf _snprintf #if defined HAVE_DECL_STRCASECMP && !HAVE_DECL_STRCASECMP #define strcasecmp stricmp #endif #endif #ifndef ETOOMANYREFS #define ETOOMANYREFS 144 #endif /* * A definition of a function that will log error messages. */ typedef void (*error_logger_f)(int _is_fatal, const char *fmt, ...); /* * Universal argument. */ typedef struct arg_s { asn1p_t *asn; asn1p_module_t *mod; asn1p_expr_t *expr; error_logger_f eh; error_logger_f debug; void *key; /* The next level key */ enum asn1f_flags flags; } arg_t; /* * Functions performing normalization of various types. */ #include "asn1fix_misc.h" /* Support functions */ #include "asn1fix_value.h" /* Value processing */ #include "asn1fix_cstring.h" /* Fix cstring values */ #include "asn1fix_compat.h" /* Data compatibility */ #include "asn1fix_constr.h" /* Constructed types */ #include "asn1fix_class.h" /* CLASS support */ #include "asn1fix_cws.h" /* CLASS WITH SYNTAX support */ #include "asn1fix_param.h" /* Parameterization */ #include "asn1fix_retrieve.h" /* Data retrieval */ #include "asn1fix_enum.h" /* Process ENUMERATED */ #include "asn1fix_integer.h" /* Process INTEGER */ #include "asn1fix_bitstring.h" /* Process BIT STRING */ #include "asn1fix_dereft.h" /* Dereference types */ #include "asn1fix_derefv.h" /* Dereference values */ #include "asn1fix_tags.h" /* Tags-related stuff */ #include "asn1fix_constraint.h" /* Constraint manipulation */ #include "asn1fix_crange.h" /* Constraint groking, exportable */ #include "asn1fix_export.h" /* Exported functions */ /* * Merge the return value of the called function with the already * partially computed return value of the current function. */ #define RET2RVAL(ret,rv) do { \ int __ret = ret; \ switch(__ret) { \ case 0: break; \ case 1: if(rv) break; \ case -1: rv = __ret; break; \ default: \ assert(__ret >= -1 && __ret <= 1); \ rv = -1; \ } \ } while(0) /* * Temporary substitute module for the purposes of evaluating expression. */ #define WITH_MODULE(tmp_mod, expr) do { \ void *_saved_mod = arg->mod; \ arg->mod = tmp_mod; \ do { expr; } while(0); \ arg->mod = _saved_mod; \ } while(0) #define LOG(code, fmt, args...) do { \ int _save_errno = errno; \ if(code < 0) { \ if(arg->debug) \ arg->debug(code, \ "%s: " fmt " in %s (%s:%d)", \ __func__, ##args, \ arg->mod->source_file_name, \ __FILE__, __LINE__); \ } else if(arg->eh) { \ arg->eh(code, fmt " in %s", ##args, \ arg->mod->source_file_name); \ } \ errno = _save_errno; \ } while(0) #define DEBUG(fmt, args...) LOG(-1, fmt, ##args) #define FATAL(fmt, args...) LOG( 1, fmt, ##args) #define WARNING(fmt, args...) LOG( 0, fmt, ##args) /* * Define the symbol corresponding to the name of the current function. */ #if __STDC_VERSION__ < 199901 #if !(__GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ >= 3) #define __func__ (char *)0 /* Name of the current function */ #endif /* GNUC */ /* __func__ is supposed to be defined */ #endif #endif /* ASN1FIX_INTERNAL_H */ asn1c-0.9.28+dfsg/libasn1fix/asn1fix_retrieve.c0000644000000000000000000002751313065714043017731 0ustar rootroot#include "asn1fix_internal.h" enum ftt_what { FTT_TYPE, /* Find the type of the given expression */ FTT_VALUE, /* Find the value of the given expression */ }; static asn1p_expr_t *asn1f_find_terminal_thing(arg_t *arg, asn1p_expr_t *expr, enum ftt_what); static int asn1f_compatible_with_exports(arg_t *arg, asn1p_module_t *mod, const char *name); /* * Lookup a child by its name. */ asn1p_expr_t * asn1f_lookup_child(asn1p_expr_t *tc, const char *name) { asn1p_expr_t *child_tc; TQ_FOR(child_tc, &(tc->members), next) { if(child_tc->Identifier && strcmp(child_tc->Identifier, name) == 0) { return child_tc; } } errno = ESRCH; return NULL; } asn1p_module_t * asn1f_lookup_in_imports(arg_t *arg, asn1p_module_t *mod, const char *name) { asn1p_xports_t *xp; asn1p_expr_t *tc; /* * Search in which exactly module this name is defined. */ TQ_FOR(xp, &(mod->imports), xp_next) { TQ_FOR(tc, &(xp->members), next) { if(strcmp(name, tc->Identifier) == 0) break; } if(tc) break; } if(xp == NULL) { errno = ESRCH; return NULL; } /* * Okay, right now we have a module name and, hopefully, an OID. * Search the arg->asn for the specified module. */ mod = asn1f_lookup_module(arg, xp->fromModuleName, xp->identifier.oid); if(mod == NULL) { /* Conditional debug */ if(!(arg->expr->_mark & TM_BROKEN)) { arg->expr->_mark |= TM_BROKEN; FATAL("Cannot find external module \"%s\" " "mentioned for " "\"%s\" at line %d. " "Obtain this module and instruct compiler to process it too.", xp->fromModuleName, name, arg->expr->_lineno); } /* ENOENT/ETOOMANYREFS */ return NULL; } /* * Check that the EXPORTS section of this module contains * the symbol we care about, or it is EXPORTS ALL. */ if(asn1f_compatible_with_exports(arg, mod, name)) { errno = EPERM; return NULL; } return mod; } asn1p_module_t * asn1f_lookup_module(arg_t *arg, const char *module_name, asn1p_oid_t *oid) { asn1p_module_t *mod; assert(module_name); /* * If OID is given, the module_name is unused. * If OID is not given, the module_name may mean * either the real module's name, or the symbol which is the * result of renaming. Check this first. */ if(oid == 0) { asn1p_xports_t *xp; /* * Check inside the IMPORTS section for possible renaming. * Renaming practically means that a module_name is mentioned * somewhere in the IMPORTS section AND OID is given. */ TQ_FOR(xp, &(arg->mod->imports), xp_next) { if(strcmp(module_name, xp->fromModuleName)) continue; if(oid) { FATAL("Ambiguous reference: " "%s " "matches several modules", module_name); errno = ETOOMANYREFS; return NULL; } /* * Yes, there is a renaming. * Make lookup use OID instead. */ oid = xp->identifier.oid; } } /* * Perform lookup using OID or module_name. */ TQ_FOR(mod, &(arg->asn->modules), mod_next) { if(oid) { if(mod->module_oid) { if(asn1p_oid_compare(oid, mod->module_oid)) { continue; } else { /* Match! Even if name doesn't. */ return mod; } } else { /* Not match, even if name is the same. */ continue; } } if(strcmp(module_name, mod->ModuleName) == 0) return mod; } DEBUG("\tModule \"%s\" not found", module_name); errno = ENOENT; return NULL; } static asn1p_expr_t * asn1f_lookup_symbol_impl(arg_t *arg, asn1p_module_t *mod, asn1p_expr_t *rhs_pspecs, asn1p_ref_t *ref, int recursion_depth) { asn1p_expr_t *ref_tc; /* Referenced tc */ asn1p_module_t *imports_from; char *modulename; char *identifier; /* * First of all, a reference to a symbol may be specified * using several possible forms: * a) simple identifier * v INTEGER ::= value * b) external reference * v INTEGER ::= Module1.value * c) class-related stuff (the most complex stuff) * v ::= <[A-Z][A-Z0-9a-z-]*>.&<[A-Z0-9a-z-]+>. * All other forms are not implemented at this moment. */ DEBUG("(%s) in %s for line %d", asn1f_printable_reference(ref), mod->ModuleName, ref->_lineno); if(recursion_depth++ > 30 /* Arbitrary constant */) { FATAL("Excessive circular referencing detected in module %s for %s at line %d", mod->ModuleName, asn1f_printable_reference(ref), ref->_lineno); errno = ETOOMANYREFS; return NULL; } if(ref->comp_count == 1) { modulename = NULL; identifier = ref->components[0].name; } else if(ref->comp_count == 2 && ref->components[1].name[0] != '&') { modulename = ref->components[0].name; identifier = ref->components[1].name; } else if(ref->comp_count > 1 && isupper(ref->components[0].name[0]) && ref->components[1].name[0] == '&') { asn1p_expr_t *extract; /* * This is a reference to a CLASS-related stuff. * Employ a separate function for that. */ extract = asn1f_class_access(arg, mod, rhs_pspecs, ref); return extract; } else { DEBUG("\tToo many components: %d", ref->comp_count); errno = EINVAL; return NULL; } /* * If module name is specified explicitly * OR the current module's IMPORTS clause contains the identifier, * fetch that module. */ if(modulename) { imports_from = asn1f_lookup_module(arg, modulename, 0); if(imports_from == NULL) { FATAL("Module \"%s\" " "mentioned at line %d is not found", modulename, ref->_lineno); return NULL; } /* * Check that the EXPORTS section of this module contains * the symbol we care about, or it is EXPORTS ALL. */ if(asn1f_compatible_with_exports(arg,imports_from,identifier)) { errno = EPERM; return NULL; } } else { /* Search inside the IMPORTS section of the current module */ imports_from = asn1f_lookup_in_imports(arg, mod, identifier); if(imports_from == NULL && errno != ESRCH) { /* * Return only of the name was not found. * If module was not found or more serious error * encountered, just return preserving the errno. */ return NULL; } } /* * The symbol is being imported from another module. */ importing: if(imports_from) { asn1p_ref_t tmpref = *ref; asn1p_expr_t *expr; if(modulename) { /* * The modulename is specified inside this reference. * To avoid recursion, reformat the reference * as it were local to that module. */ tmpref.components++; /* Hide the first element */ tmpref.comp_count--; assert(tmpref.comp_count > 0); } expr = asn1f_lookup_symbol_impl(arg, imports_from, rhs_pspecs, &tmpref, recursion_depth); if(!expr && !(arg->expr->_mark & TM_BROKEN) && !(imports_from->_tags & MT_STANDARD_MODULE)) { arg->expr->_mark |= TM_BROKEN; if(modulename) { FATAL("Module %s referred by %s in module %s " "does not contain the requested symbol", imports_from->ModuleName, asn1f_printable_reference(ref), mod->ModuleName); } else { FATAL("Module %s referred in IMPORTS section " "for %s of module %s does not contain " "the requested symbol", imports_from->ModuleName, asn1f_printable_reference(ref), mod->ModuleName); } } return expr; } /* * Now we know where to search for a value: in the current module. */ TQ_FOR(ref_tc, &(mod->members), next) { if(ref_tc->Identifier) if(strcmp(ref_tc->Identifier, identifier) == 0) break; } if(ref_tc) { if(rhs_pspecs && !ref_tc->lhs_params) { FATAL("Parameterized type %s expected " "for %s at line %d", ref_tc->Identifier, asn1f_printable_reference(ref), ref->_lineno); errno = EPERM; return NULL; } if(!rhs_pspecs && ref_tc->lhs_params) { FATAL("Type %s expects specialization " "from %s at line %d", ref_tc->Identifier, asn1f_printable_reference(ref), ref->_lineno); errno = EPERM; return NULL; } if(rhs_pspecs && ref_tc->lhs_params) { /* Specialize the target */ ref_tc = asn1f_parameterization_fork(arg, ref_tc, rhs_pspecs); } return ref_tc; } /* * Not found in the current module. * Search in our default standard module. */ { /* Search inside standard module */ static asn1p_oid_t *uioc_oid; if(!uioc_oid) { asn1p_oid_arc_t arcs[] = { { 1, "iso" }, { 3, "org" }, { 6, "dod" }, { 1, "internet" }, { 4, "private" }, { 1, "enterprise" }, { 9363, "spelio" }, { 1, "software" }, { 5, "asn1c" }, { 3, "standard-modules" }, { 0, "auto-imported" }, { 1, 0 } }; uioc_oid = asn1p_oid_construct(arcs, sizeof(arcs)/sizeof(arcs[0])); } if(!imports_from && (!mod->module_oid || asn1p_oid_compare(mod->module_oid, uioc_oid))) { imports_from = asn1f_lookup_module(arg, "ASN1C-UsefulInformationObjectClasses", uioc_oid); if(imports_from) goto importing; } } DEBUG("Module \"%s\" does not contain \"%s\" " "mentioned at line %d: %s", mod->ModuleName, identifier, ref->_lineno, strerror(errno)); if(asn1f_check_known_external_type(identifier) == 0) { errno = EEXIST; /* Exists somewhere */ } else { errno = ESRCH; } return NULL; } asn1p_expr_t * asn1f_lookup_symbol(arg_t *arg, asn1p_module_t *mod, asn1p_expr_t *rhs_pspecs, asn1p_ref_t *ref) { return asn1f_lookup_symbol_impl(arg, mod, rhs_pspecs, ref, 0); } asn1p_expr_t * asn1f_find_terminal_type(arg_t *arg, asn1p_expr_t *expr) { return asn1f_find_terminal_thing(arg, expr, FTT_TYPE); } asn1p_expr_t * asn1f_find_terminal_value(arg_t *arg, asn1p_expr_t *expr) { return asn1f_find_terminal_thing(arg, expr, FTT_VALUE); } static asn1p_expr_t * asn1f_find_terminal_thing(arg_t *arg, asn1p_expr_t *expr, enum ftt_what what) { asn1p_ref_t *ref = 0; asn1p_expr_t *tc; switch(what) { case FTT_TYPE: /* Expression may be a terminal type itself */ if(expr->expr_type != A1TC_REFERENCE) return expr; ref = expr->reference; break; case FTT_VALUE: assert(expr->meta_type == AMT_VALUE); assert(expr->value); /* Expression may be a terminal type itself */ if(expr->value->type != ATV_REFERENCED) return expr; ref = expr->value->value.reference; break; } DEBUG("%s(%s->%s) for line %d", (what == FTT_VALUE)?"VALUE":"TYPE", expr->Identifier, asn1f_printable_reference(ref), expr->_lineno); assert(ref); /* * Lookup inside the type itself (ENUMERATED, INTEGER, etc). */ if(what == FTT_VALUE) { asn1p_expr_t *val_type_tc; val_type_tc = asn1f_find_terminal_type(arg, expr); if(val_type_tc && asn1f_look_value_in_type(arg, val_type_tc, expr)) return NULL; if(expr->value->type != ATV_REFERENCED) { return expr; } assert(ref == expr->value->value.reference); ref = expr->value->value.reference; } /* * Lookup inside the default module and its IMPORTS section. */ tc = asn1f_lookup_symbol(arg, expr->module, expr->rhs_pspecs, ref); if(tc == NULL) { DEBUG("\tSymbol \"%s\" not found: %s", asn1f_printable_reference(ref), strerror(errno)); return NULL; } /* * Recursive loops detection. */ if(tc->_mark & TM_RECURSION) { DEBUG("Recursion loop detected for %s at line %d", asn1f_printable_reference(ref), ref->_lineno); errno = EPERM; return NULL; } tc->_type_referenced = 1; tc->_mark |= TM_RECURSION; WITH_MODULE(tc->module, expr = asn1f_find_terminal_thing(arg, tc, what)); tc->_mark &= ~TM_RECURSION; return expr; } /* * Make sure that the specified name is present or otherwise does * not contradict with the EXPORTS clause of the specified module. */ static int asn1f_compatible_with_exports(arg_t *arg, asn1p_module_t *mod, const char *name) { asn1p_xports_t *exports; asn1p_expr_t *item; assert(mod); assert(name); exports = TQ_FIRST(&(mod->exports)); if(exports == NULL) { /* No EXPORTS section or EXPORTS ALL; */ return 0; } TQ_FOR(item, &(exports->members), next) { if(strcmp(item->Identifier, name) == 0) return 0; } /* Conditional debug */ if(!(arg->expr->_mark & TM_BROKEN)) { arg->expr->_mark |= TM_BROKEN; FATAL("EXPORTS section of module %s in %s " "does not mention %s at line %d", mod->ModuleName, mod->source_file_name, name, arg->expr->_lineno); } errno = ESRCH; return -1; } asn1c-0.9.28+dfsg/libasn1fix/asn1fix_bitstring.h0000644000000000000000000000020113065714043020077 0ustar rootroot#ifndef ASN1FIX_BIT_STRING_H #define ASN1FIX_BIT_STRING_H int asn1f_fix_bit_string(arg_t *); #endif /* ASN1FIX_BIT_STRING_H */ asn1c-0.9.28+dfsg/libasn1fix/asn1fix_value.h0000644000000000000000000000155413065714043017222 0ustar rootroot/* * Functions related with processing values. */ #ifndef ASN1FIX_VALUE_H #define ASN1FIX_VALUE_H /* * Resolve the value given by reference. * This function also takes a parameter which specifies the desired * value's type. * * RETURN VALUES: * 0: Value resolved successfully. * -1/EPERM: Recursive looping detected. * -1/EEXIST: Reference is not compatible with the desired type. * -1/ESRCH: Cannot find the terminal reference. */ int asn1f_value_resolve(arg_t *arg, asn1p_expr_t *tc, const enum asn1p_constraint_type_e *opt_constr_type); /* * Check if a value in value_expr refers to the enumeration or integer element * within the type provided. If yes, it will replace referenced value with * the appropriate inline value. */ int asn1f_look_value_in_type(arg_t *arg, asn1p_expr_t *type_expr, asn1p_expr_t *value_expr); #endif /* ASN1FIX_VALUE_H */ asn1c-0.9.28+dfsg/libasn1fix/asn1fix_retrieve.h0000644000000000000000000000420013065714043017722 0ustar rootroot/* * Miscellaneous functions necessary for several other modules. */ #ifndef ASN1FIX_RETRIEVE_H #define ASN1FIX_RETRIEVE_H /* * Simple search for the label in the descendants of the given node. * ERRORS: * NULL/ESRCH */ asn1p_expr_t *asn1f_lookup_child(asn1p_expr_t *tc, const char *name); /* * Return a module which contain a specified name, as stated in appropriate * IMPORTS section of the current module (arg->mod). * * RETURN VALUES: * NULL/ESRCH: The name was not found in IMPORTS section. * NULL/EPERM: The name was not found in EXPORTS section of the source module. * Also, NULL with errno values defined by asn1f_lookup_module(). */ asn1p_module_t *asn1f_lookup_in_imports(arg_t *arg, asn1p_module_t *mod, const char *name); /* * Return a module by its name or optional OID. * * RETURN VALUES: * NULL/ENOENT: No module was found by the specified name and oid * NULL/ETOOMANYREFS: Several modules are matching the specified name and oid */ asn1p_module_t *asn1f_lookup_module(arg_t *arg, const char *module_name, asn1p_oid_t *module_oid); /* * Return the reference to a destination of the given reference, * symbol lookup. Not a recursive function. */ asn1p_expr_t *asn1f_lookup_symbol(arg_t *arg, asn1p_module_t *mod, asn1p_expr_t *rhs_pspecs, asn1p_ref_t *ref); /* * Recursively find the original type for the given expression. * i.e.: * If the original specification defines * v Type1 ::= 5 * Type1 ::= Type2 (1..5) * Type3 ::= Type4 (2..7) * Type4 ::= INTEGER (1..10) * Then this function, given the the first expression as an argument, * would return an expression for Type4. * WARNING: No attempts are made to honor constraints at this moment. */ asn1p_expr_t *asn1f_find_terminal_type(arg_t *arg, asn1p_expr_t *tc); /* * Recursively find the original value for the given expression. * i.e.: * If the original specification defines * v Type1 ::= value * value Type2 ::= value2 * value2 Type3 ::= 3 * Then this function will return the expression for value2 if given * the v as an argment. */ asn1p_expr_t *asn1f_find_terminal_value(arg_t *arg, asn1p_expr_t *tc); #endif /* ASN1FIX_RETRIEVE_H */ asn1c-0.9.28+dfsg/libasn1fix/asn1fix_value.c0000644000000000000000000001266113065714043017216 0ustar rootroot#include "asn1fix_internal.h" static int _asn1f_copy_value(arg_t *arg, asn1p_expr_t *to,asn1p_expr_t *from); int asn1f_value_resolve(arg_t *arg, asn1p_expr_t *expr, const enum asn1p_constraint_type_e *opt_constr_type) { asn1p_expr_t *val_type_expr; asn1p_expr_t *value_expr; asn1p_expr_t *type_expr; int ret; /* Make sure this IS a value assignment */ assert(expr->meta_type == AMT_VALUE); assert(expr->value); if(expr->value->type != ATV_REFERENCED) return 0; DEBUG("(=\"%s\", %x%s%s)", asn1f_printable_value(expr->value), expr->expr_type, opt_constr_type ? ", " : "", opt_constr_type ? asn1p_constraint_type2str(*opt_constr_type) : "" ); /* * 1. Find the terminal type for this assignment. */ type_expr = asn1f_find_terminal_type(arg, expr); if(type_expr == 0) { if(errno == EEXIST) { DEBUG("External type for %s at line %d", expr->Identifier, expr->_lineno); return 0; } else { FATAL("Terminal type for %s at line %d not found", expr->Identifier, expr->_lineno); return -1; } } if(asn1f_look_value_in_type(arg, type_expr, expr) == -1) { FATAL("Value not found in type for %s at line %d", expr->Identifier, expr->_lineno); return -1; } /* * 2. Find the terminal value also. */ value_expr = asn1f_find_terminal_value(arg, expr); if(value_expr) { DEBUG("Terminal value for %s->%s is %s at line %d", expr->Identifier, asn1f_printable_value(expr->value), value_expr->Identifier, value_expr->_lineno); } else { FATAL("Terminal value for %s->%s not found", expr->Identifier, asn1f_printable_value(expr->value)); return -1; } /* * 3. Find the _type_ of a _terminal value_. */ WITH_MODULE(value_expr->module, val_type_expr = asn1f_find_terminal_type(arg, value_expr)); if(val_type_expr) { DEBUG("Terminal type of value %s->%s is %s at line %d", expr->Identifier, asn1f_printable_value(expr->value), val_type_expr->Identifier, val_type_expr->_lineno); } else { FATAL("Terminal type of value %s->%s not found", expr->Identifier, asn1f_printable_value(expr->value)); return -1; } /* * 4. Check compatibility between the type of the current expression * and the type of the discovered value. */ if(opt_constr_type) ret = asn1constraint_compatible(val_type_expr->expr_type, *opt_constr_type, 0 /* must not matter here */); else ret = asn1f_check_type_compatibility(arg, type_expr, val_type_expr); if(ret == -1) { switch(type_expr->expr_type) { default: if(!(type_expr->expr_type & ASN_STRING_MASK)) break; /* Compatibility rules are not defined */ /* Fall through */ case ASN_BASIC_INTEGER: case ASN_BASIC_ENUMERATED: FATAL("Incompatible type of \"%s\" (%s) at line %d " "with \"%s\" (%s) at line %d", type_expr->Identifier, ASN_EXPR_TYPE2STR(type_expr->expr_type), type_expr->_lineno, val_type_expr->Identifier, ASN_EXPR_TYPE2STR(val_type_expr->expr_type), val_type_expr->_lineno); return -1; case ASN_BASIC_OBJECT_IDENTIFIER: /* * Ignore this for now. * We can't deal with OIDs inheritance properly yet. */ return 0; } WARNING("Possibly incompatible type of \"%s\" (%s) at line %d " "with \"%s\" (%s) at line %d", type_expr->Identifier, ASN_EXPR_TYPE2STR(type_expr->expr_type), type_expr->_lineno, val_type_expr->Identifier, ASN_EXPR_TYPE2STR(val_type_expr->expr_type), val_type_expr->_lineno); return 1; } if(asn1f_look_value_in_type(arg, val_type_expr, expr) == -1) return -1; /* * 5. Copy value from the terminal value into the current expression. */ ret = _asn1f_copy_value(arg, expr, value_expr); if(ret == -1) { FATAL("Value %s cannot be copied from line %d to line %d", asn1f_printable_value(value_expr->value), value_expr->_lineno, expr->_lineno); return -1; } DEBUG("Final value for \"%s\" at line %d is %s", expr->Identifier, expr->_lineno, asn1f_printable_value(expr->value)); return 0; } static int _asn1f_copy_value(arg_t *arg, asn1p_expr_t *to, asn1p_expr_t *from) { asn1p_value_t *v; v = asn1p_value_clone(from->value); if(v) { asn1p_value_free(to->value); to->value = v; DEBUG("Copied value %s from \"%s\" on line %d " "to \"%s\" on line %d", asn1f_printable_value(v), from->Identifier, from->_lineno, to->Identifier, to->_lineno ); return 0; } else { return -1; } } int asn1f_look_value_in_type(arg_t *arg, asn1p_expr_t *type_expr, asn1p_expr_t *value_expr) { asn1p_expr_t *child_expr; char *identifier; if(value_expr->value->type != ATV_REFERENCED || value_expr->value->value.reference->comp_count != 1) return 0; if(type_expr->expr_type != ASN_BASIC_INTEGER && type_expr->expr_type != ASN_BASIC_ENUMERATED) return 0; DEBUG("(for %s in %s %x) for line %d", asn1f_printable_value(value_expr->value), type_expr->Identifier, type_expr->expr_type, value_expr->_lineno); /* * Look into the definitions of the type itself: * Type1 ::= INTEGER { a(1), b(2) } * value Type1 = b -- will assign 2 */ identifier = value_expr->value->value.reference->components[0].name; child_expr = asn1f_lookup_child(type_expr, identifier); DEBUG("Looking into a type %s at line %d for %s at line %d: %s", type_expr->Identifier, type_expr->_lineno, identifier, value_expr->_lineno, child_expr ? asn1f_printable_value(child_expr->value) : "" ); if(child_expr && child_expr->value) { if(_asn1f_copy_value(arg, value_expr, child_expr)) return -1; /* Fall through */ } return 0; } asn1c-0.9.28+dfsg/libasn1fix/asn1fix_misc.h0000644000000000000000000000170713065714043017041 0ustar rootroot/* * Miscellaneous functions necessary for several other modules. */ #ifndef ASN1FIX_MISC_H #define ASN1FIX_MISC_H /* * Recursively invoke a given function over the given expr and all its * children. */ int asn1f_recurse_expr(arg_t *arg, int (*f)(arg_t *arg)); /* * Check that every child of a given expr has unique identifier. */ int asn1f_check_unique_expr(arg_t *arg); /* * Check that every preceeding child of the given expr is not * having the name of the given one. * If opt_compare == NULL, the default comparison of the argument's * names (identifiers) will be performed. */ int asn1f_check_unique_expr_child(arg_t *arg, asn1p_expr_t *child, int (*opt_compare)(asn1p_expr_t *a, asn1p_expr_t *b), const char *opt_property_name); /* * Return number of children. */ int asn1f_count_children(asn1p_expr_t *parent); /* * Check if type is explicitly known. */ int asn1f_check_known_external_type(const char *); #endif /* ASN1FIX_MISC_H */ asn1c-0.9.28+dfsg/libasn1fix/asn1fix_constr.c0000644000000000000000000002656313065714043017420 0ustar rootroot#include "asn1fix_internal.h" static int _asn1f_check_if_tag_must_be_explicit(arg_t *arg, asn1p_expr_t *v); static int _asn1f_compare_tags(arg_t *arg, asn1p_expr_t *a, asn1p_expr_t *b); static int _asn1f_fix_type_tag(arg_t *arg, asn1p_expr_t *expr); int asn1f_pull_components_of(arg_t *arg) { TQ_HEAD(asn1p_expr_t) list; asn1p_expr_t *expr = arg->expr; asn1p_expr_t *memb; int r_value = 0; switch(expr->expr_type) { case ASN_CONSTR_SEQUENCE: case ASN_CONSTR_SET: break; default: return 0; } TQ_INIT(&list); /* * Look into */ while((memb = TQ_REMOVE(&(expr->members), next))) { asn1p_expr_t *coft; /* COMPONENTS OF thing itself */ asn1p_expr_t *terminal; /* Terminal of the referenced type */ if(memb->expr_type != A1TC_COMPONENTS_OF) { TQ_ADD(&list, memb, next); continue; } coft = TQ_FIRST(&memb->members); assert(coft); assert(!TQ_NEXT(coft, next)); /* * Find the referenced type. */ terminal = asn1f_find_terminal_type(arg, coft); if(!terminal || (terminal->expr_type != expr->expr_type)) { FATAL("COMPONENTS OF at line %d " "must reference a %s type", coft->_lineno, expr->expr_type==ASN_CONSTR_SET ? "SET" : "SEQUENCE" ); TQ_ADD(&list, memb, next); r_value = -1; continue; } /* * Clone the final structure. */ coft = asn1p_expr_clone(terminal, 1 /* Skip extensions */); if(!coft) return -1; /* ENOMEM */ if(0) { asn1p_expr_free(memb); /* Don't need it anymore*/ } else { /* Actual removal clashes with constraints... skip. */ } /* * Move all components of the cloned structure * into the current one. */ while((memb = TQ_REMOVE(&(coft->members), next))) { TQ_ADD(&list, memb, next); memb->parent_expr = expr; } asn1p_expr_free(coft); /* Remove wrapper */ } /* Move the stuff back */ TQ_MOVE(&(expr->members), &list); return r_value; } /* * Fix extensibility parts inside constructed types (SEQUENCE, SET, CHOICE). */ int asn1f_fix_constr_ext(arg_t *arg) { asn1p_expr_t *expr = arg->expr; asn1p_expr_t *v; TQ_HEAD(asn1p_expr_t) root_list; TQ_HEAD(asn1p_expr_t) ext_list; TQ_HEAD(asn1p_expr_t) *cur_list; int r_value = 0; int ext_count = 0; switch(expr->expr_type) { case ASN_CONSTR_SEQUENCE: case ASN_CONSTR_SET: case ASN_CONSTR_CHOICE: break; default: return 0; } DEBUG("(%s) for line %d", expr->Identifier, expr->_lineno); TQ_INIT(&root_list); TQ_INIT(&ext_list); cur_list = (void *)&root_list; /* * Split the set of fields into two lists, the root list * and the extensions list. */ while((v = TQ_REMOVE(&(expr->members), next))) { if(v->expr_type == A1TC_EXTENSIBLE) { ext_count++; switch(ext_count) { case 1: cur_list = (void *)&ext_list; break; case 2: cur_list = (void *)&root_list; if(v->value) { FATAL("Optional extension marker " "must not contain " "an exception mark " "at line %d", v->_lineno); r_value = -1; } asn1p_expr_free(v); continue; case 3: FATAL("Third extension marker " "is not allowed at line %d", v->_lineno); default: r_value = -1; } } TQ_ADD(cur_list, v, next); } /* * Copy the root list and extension list back into the main list. */ TQ_MOVE(&(expr->members), &root_list); while((v = TQ_REMOVE(&ext_list, next))) TQ_ADD(&(expr->members), v, next); if(arg->mod->module_flags & MSF_EXTENSIBILITY_IMPLIED && ext_count == 0) { v = asn1p_expr_new(0, arg->mod); if(v) { v->Identifier = strdup("..."); v->expr_type = A1TC_EXTENSIBLE; v->meta_type = AMT_TYPE; v->_lineno = expr->_lineno; /* The best we can do */ if(v->Identifier == NULL) { asn1p_expr_free(v); r_value = -1; } else { asn1p_expr_add(expr, v); } } else { r_value = -1; } } return r_value; } int asn1f_fix_constr_tag(arg_t *arg, int fix_top_level) { asn1p_expr_t *expr = arg->expr; asn1p_expr_t *v; int root_tagged = 0; /* The root component is manually tagged */ int ext_tagged = 0; /* The extensions are manually tagged */ int component_number = 0; int r_value = 0; DEBUG("(%s) for line %d", expr->Identifier, expr->_lineno); /* * Fix the top-level type itself first. */ if(fix_top_level) { if(expr->tag.tag_class == TC_NOCLASS) return r_value; if(_asn1f_fix_type_tag(arg, expr)) r_value = -1; return r_value; } switch(expr->expr_type) { case ASN_CONSTR_SEQUENCE: case ASN_CONSTR_SET: case ASN_CONSTR_CHOICE: break; default: return 0; } TQ_FOR(v, &(expr->members), next) { if(v->expr_type == A1TC_EXTENSIBLE) { component_number++; continue; } if(v->tag.tag_class == TC_NOCLASS) { continue; } switch(component_number) { case 0: case 2: root_tagged = 1; break; default: ext_tagged = 1; break; } if(_asn1f_fix_type_tag(arg, v)) r_value = -1; } if((arg->mod->module_flags & MSF_AUTOMATIC_TAGS) && !root_tagged) { if(ext_tagged) { /* X.690: 28.4 */ FATAL("In %s at line %d: " "extensions are tagged " "but root components are not", expr->Identifier, expr->_lineno); r_value = -1; } else { /* Make a decision on automatic tagging */ expr->auto_tags_OK = 1; } } return r_value; } static int _asn1f_fix_type_tag(arg_t *arg, asn1p_expr_t *expr) { int must_explicit = _asn1f_check_if_tag_must_be_explicit(arg, expr); int module_impl_tags = (arg->mod->module_flags & (MSF_IMPLICIT_TAGS | MSF_AUTOMATIC_TAGS)); int r_value = 0; if(expr->tag.tag_mode == TM_DEFAULT) { if(must_explicit || module_impl_tags == 0) expr->tag.tag_mode = TM_EXPLICIT; else expr->tag.tag_mode = TM_IMPLICIT; } /* * Perform a final sanity check. */ if(must_explicit) { if(expr->tag.tag_mode == TM_IMPLICIT) { FATAL("%s tagged in IMPLICIT mode " "but must be EXPLICIT at line %d", expr->Identifier, expr->_lineno); r_value = -1; } else { expr->tag.tag_mode = TM_EXPLICIT; } } return r_value; } int asn1f_fix_constr_autotag(arg_t *arg) { asn1p_expr_t *expr = arg->expr; asn1p_expr_t *v; asn1c_integer_t tag_value = 0; int r_value = 0; switch(expr->expr_type) { case ASN_CONSTR_SEQUENCE: case ASN_CONSTR_SET: case ASN_CONSTR_CHOICE: if(expr->auto_tags_OK) break; /* Automatic tagging is not applicable */ /* Fall through */ default: return 0; } DEBUG("(%s) for line %d", expr->Identifier, expr->_lineno); TQ_FOR(v, &(expr->members), next) { int must_explicit; if(v->expr_type == A1TC_EXTENSIBLE) { /* 28.5, d) */ continue; } if(0) { /* This may be not true in case COMPONENTS OF */ assert(v->tag.tag_class == TC_NOCLASS); } must_explicit = _asn1f_check_if_tag_must_be_explicit(arg, v); v->tag.tag_class = TC_CONTEXT_SPECIFIC; v->tag.tag_mode = must_explicit ? TM_EXPLICIT : TM_IMPLICIT; v->tag.tag_value = tag_value++; } return r_value; } /* * Check that tags are distinct. */ int asn1f_check_constr_tags_distinct(arg_t *arg) { asn1p_expr_t *expr = arg->expr; asn1p_expr_t *v; int r_value = 0; switch(expr->expr_type) { case ASN_CONSTR_SEQUENCE: case ASN_CONSTR_SET: case ASN_CONSTR_CHOICE: break; default: return 0; } TQ_FOR(v, &(expr->members), next) { /* * In every series of non-mandatory components, * the tags must be distinct from each other AND the * tag of the following mandatory component. * For SET and CHOICE treat everything as a big set of * non-mandatory components. */ if(expr->expr_type != ASN_CONSTR_SEQUENCE || v->marker.flags) { asn1p_expr_t *nv; for(nv = v; (nv = TQ_NEXT(nv, next));) { DEBUG("S/C comparing tags %s s. %s", v->Identifier, nv->Identifier); if(_asn1f_compare_tags(arg, v, nv)) r_value = -1; if(expr->expr_type == ASN_CONSTR_SEQUENCE && !nv->marker.flags) break; } } } return r_value; } static int _asn1f_check_if_tag_must_be_explicit(arg_t *arg, asn1p_expr_t *v) { struct asn1p_type_tag_s tag; struct asn1p_type_tag_s save_tag; asn1p_expr_t *reft; int ret; /* * Fetch the _next_ tag for this type. */ save_tag = v->tag; /* Save existing tag */ memset(&v->tag, 0, sizeof(v->tag)); /* Remove it temporarily */ ret = asn1f_fetch_outmost_tag(arg->asn, arg->mod, v, &tag, 0); v->tag = save_tag; /* Restore the tag back */ if(ret == 0) return 0; /* If found tag, it's okay */ reft = asn1f_find_terminal_type(arg, v); if(reft) { switch(reft->expr_type) { case ASN_TYPE_ANY: case ASN_CONSTR_CHOICE: return 1; default: return 0; } } return 0; } /* * Check that the tags are distinct. */ static int _asn1f_compare_tags(arg_t *arg, asn1p_expr_t *a, asn1p_expr_t *b) { struct asn1p_type_tag_s ta, tb; int ra, rb; int ret; ra = asn1f_fetch_outmost_tag(arg->asn, arg->mod, a, &ta, AFT_IMAGINARY_ANY); rb = asn1f_fetch_outmost_tag(arg->asn, arg->mod, b, &tb, AFT_IMAGINARY_ANY); /* * If both tags are explicitly or implicitly given, use them. */ DEBUG("Fetching outmost tags: %d, %d", ra, rb); if(ra == 0 && rb == 0) { /* * Simple case: fetched both tags. */ if((ta.tag_value == tb.tag_value && ta.tag_class == tb.tag_class) || ta.tag_value == -1 /* Spread IMAGINARY ANY tag... */ || tb.tag_value == -1 /* ...it is an evil virus, fear it! */ ) { char tagbuf[2][TAG2STRING_BUFFER_SIZE]; char *p = (a->expr_type == A1TC_EXTENSIBLE) ?"potentially ":""; FATAL("Processing %s at line %d: component \"%s\" at line %d %shas the same tag " "as component \"%s\" at line %d", arg->expr->Identifier, arg->expr->_lineno, a->Identifier, a->_lineno, p, b->Identifier, b->_lineno ); FATAL("Consider adding AUTOMATIC TAGS " "after module %s DEFINITIONS, " "or manually tag components", arg->expr->module->ModuleName); DEBUG("Tags: %s %s vs. %s %s", asn1p_tag2string(&ta, tagbuf[0]), a->Identifier, asn1p_tag2string(&tb, tagbuf[1]), b->Identifier ); if((arg->mod->module_flags & MSF_EXTENSIBILITY_IMPLIED) && (a->expr_type == A1TC_EXTENSIBLE) && (b->expr_type == A1TC_EXTENSIBLE)) { FATAL("The previous error is due to " "improper use of " "EXTENSIBILITY IMPLIED flag " "of module %s", arg->mod->ModuleName); } return -1; } else { /* Tags are distinct */ return 0; } } /********************************************************** * Now we must perform some very funny recursion to check * multiple components of CHOICE type, etc. */ DEBUG("Comparing tags %s:%x <-> %s:%x", a->Identifier, a->expr_type, b->Identifier, b->expr_type); if(ra && a->meta_type == AMT_TYPEREF) { DEBUG(" %s is a type reference", a->Identifier); a = asn1f_lookup_symbol(arg, a->module, a->rhs_pspecs, a->reference); if(!a) return 0; /* Already FATAL()'ed somewhere else */ WITH_MODULE(a->module, ret = _asn1f_compare_tags(arg, a, b)); return ret; } if(ra && a->expr_type == ASN_CONSTR_CHOICE) { asn1p_expr_t *v; DEBUG(" %s is a choice type (%d)", a->Identifier, a->_mark); /* * Iterate over members of CHOICE. */ //if(a->_mark & TM_RECURSION) return 0; TQ_FOR(v, &(a->members), next) { //a->_mark |= TM_RECURSION; ret = _asn1f_compare_tags(arg, v, b); //a->_mark &= ~TM_RECURSION; if(ret) return ret; } return 0; } if(rb && b->expr_type == ASN_CONSTR_CHOICE) { return _asn1f_compare_tags(arg, b, a); } if(a->_mark & TM_RECURSION) return 0; if(b->_mark & TM_RECURSION) return 0; a->_mark |= TM_RECURSION; b->_mark |= TM_RECURSION; ret = _asn1f_compare_tags(arg, b, a); a->_mark &= ~TM_RECURSION; b->_mark &= ~TM_RECURSION; return ret; } asn1c-0.9.28+dfsg/libasn1fix/asn1fix_dereft.c0000644000000000000000000000224213065714043017345 0ustar rootroot#include "asn1fix_internal.h" int asn1f_fix_dereference_types(arg_t *arg) { asn1p_expr_t *expr = arg->expr; asn1p_expr_t *type_expr; int r_value = 0; if(expr->expr_type != A1TC_REFERENCE || expr->meta_type != AMT_TYPEREF) { //assert(expr->reference == 0); return 0; /* Just ignore it */ } DEBUG("(\"%s\":%x ::= \"%s\") for line %d", expr->Identifier, expr->expr_type, asn1f_printable_value(expr->value), expr->_lineno); assert(TQ_FIRST(&(expr->members)) == 0); assert(expr->reference); /* * Follow the reference. */ type_expr = asn1f_find_terminal_type(arg, expr); if(type_expr == NULL) { const char *type_name; asn1p_expr_t *idexpr; if(errno == EEXIST) { /* Ignore missing type * if known to be defined externally: * -fknown-extern-type= */ return 0; } type_name = asn1f_printable_reference(expr->reference); /* Avoid NULL in case of unnamed T ::= SEQUENCE OF ... */ for(idexpr = expr; !idexpr->Identifier && idexpr->parent_expr; idexpr = idexpr->parent_expr); FATAL("Unknown type \"%s\" referenced by \"%s\" at line %d", type_name, idexpr->Identifier, expr->_lineno); return -1; } return r_value; } asn1c-0.9.28+dfsg/libasn1fix/asn1fix_export.h0000644000000000000000000000202413065714043017420 0ustar rootroot/* * This header exports fixer procedures that are common enough to be used * in other modules. */ #ifndef ASN1FIX_EXPORT_H #define ASN1FIX_EXPORT_H #include "asn1fix_tags.h" /* * Create a human-readable representation of a reference and value. */ char const *asn1f_printable_reference(asn1p_ref_t *ref); char const *asn1f_printable_value(asn1p_value_t *value); /* * Exportable version of an asn1f_lookup_symbol(). */ asn1p_expr_t *asn1f_lookup_symbol_ex( asn1p_t *asn, asn1p_expr_t *expr, asn1p_ref_t *ref); /* * Exportable version of an asn1f_class_access(). */ asn1p_expr_t *asn1f_class_access_ex(asn1p_t *asn, asn1p_module_t *mod, asn1p_expr_t *expr, asn1p_expr_t *rhs_rspecs, asn1p_ref_t *); /* * Exportable version of asn1f_find_terminal_type(). */ asn1p_expr_t *asn1f_find_terminal_type_ex(asn1p_t *asn, asn1p_expr_t *tc); /* * Exportable version of asn1f_fix_dereference_values(); */ int asn1f_fix_dereference_values_ex(asn1p_t *asn, asn1p_module_t *mod, asn1p_expr_t *expr); #endif /* ASN1FIX_EXPORT_H */ asn1c-0.9.28+dfsg/libasn1fix/asn1fix_misc.c0000644000000000000000000002071713065714043017036 0ustar rootroot#include "asn1fix_internal.h" #include "asn1fix.h" char const * asn1f_printable_reference(asn1p_ref_t *ref) { if(ref) { asn1p_value_t v; v.type = ATV_REFERENCED; v.value.reference = ref; return asn1f_printable_value(&v); } else { return ""; } } char const * asn1f_printable_value(asn1p_value_t *v) { static char buf[128]; static char *managedptr; static size_t managedptr_len; int ret; #define ENSURE(len) do { \ size_t tmp_len = (len); \ if(tmp_len >= managedptr_len) { \ free(managedptr); \ managedptr = malloc(tmp_len + 1); \ if(managedptr) { \ managedptr_len = tmp_len; \ } else { \ managedptr_len = 0; \ return ""; \ } \ } \ } while(0) if(v == NULL) return ""; switch(v->type) { case ATV_NOVALUE: return ""; case ATV_NULL: return "NULL"; case ATV_REAL: ret = snprintf(buf, sizeof(buf), "%f", v->value.v_double); if(ret >= (ssize_t)sizeof(buf)) memcpy(buf + sizeof(buf) - 4, "...", 4); return buf; case ATV_INTEGER: ret = snprintf(buf, sizeof(buf), "%" PRIdASN, v->value.v_integer); if(ret >= (ssize_t)sizeof(buf)) memcpy(buf + sizeof(buf) - 4, "...", 4); return buf; case ATV_MIN: return "MIN"; case ATV_MAX: return "MAX"; case ATV_FALSE: return "FALSE"; case ATV_TRUE: return "TRUE"; case ATV_TUPLE: ret = snprintf(buf, sizeof(buf), "{%d, %d}", (int)(v->value.v_integer >> 4), (int)(v->value.v_integer & 0xff)); if(ret >= (ssize_t)sizeof(buf)) memcpy(buf + sizeof(buf) - 4, "...", 4); return buf; case ATV_QUADRUPLE: ret = snprintf(buf, sizeof(buf), "{%d, %d, %d, %d}", (int)((v->value.v_integer >> 24) & 0xff), (int)((v->value.v_integer >> 16) & 0xff), (int)((v->value.v_integer >> 8) & 0xff), (int)(v->value.v_integer & 0xff)); if(ret >= (ssize_t)sizeof(buf)) memcpy(buf + sizeof(buf) - 4, "...", 4); return buf; case ATV_STRING: case ATV_UNPARSED: /* Buffer is guaranteed to be null-terminated */ assert(v->value.string.buf[v->value.string.size] == '\0'); return (char *)v->value.string.buf; case ATV_TYPE: return ""; case ATV_BITVECTOR: { uint8_t *bitvector; char *ptr; size_t len; int i; /* * Compute number of bytes necessary * to represend the binary value. */ int bits = v->value.binary_vector.size_in_bits; len = ((bits%8)?bits:(bits >> 2)) + sizeof("''H"); /* * Reallocate managed buffer */ ENSURE(len); /* * Fill the buffer. */ ptr = managedptr; bitvector = v->value.binary_vector.bits; *ptr++ = '\''; if(bits%8) { /* * Dump bit by bit. */ for(i = 0; i < bits; i++) { uint8_t uc; uc = bitvector[i>>3]; *ptr++ = ((uc >> (7-(i%8)))&1)?'1':'0'; } } else { static const char *hextable="0123456789ABCDEF"; /* * Dump byte by byte. */ for(i = 0; i < (bits >> 3); i++) { *ptr++ = hextable[bitvector[i] >> 4]; *ptr++ = hextable[bitvector[i] & 0x0f]; } } *ptr++ = '\''; *ptr++ = (bits%8)?'B':'H'; *ptr++ = 'H'; assert(len == (size_t)(ptr - managedptr)); return managedptr; } case ATV_REFERENCED: { asn1p_ref_t *ref; size_t reflen; char *ptr; int i; assert(v->value.reference); ref = v->value.reference; reflen = ref->comp_count; /* Number of dots */ for(i = 0; i < ref->comp_count; i++) reflen += strlen(ref->components[i].name); /* * Make sure we have a buffer of this size. */ ENSURE(reflen); /* * Fill-up the buffer. */ ptr = managedptr; for(i = 0; i < ref->comp_count; i++) { char *nc; if(i) *ptr++ = '.'; for(nc = ref->components[i].name; *nc; nc++) *ptr++ = *nc; } *ptr++ = '\0'; assert(reflen == (size_t)(ptr - managedptr)); return managedptr; } case ATV_VALUESET: return ""; case ATV_CHOICE_IDENTIFIER: { char *cid = v->value.choice_identifier.identifier; char const *vptr = asn1f_printable_value( v->value.choice_identifier.value); char *val; val = strdup(vptr); if(!val) return ""; ENSURE(strlen(cid) + sizeof(": ") + strlen(val)); ret = snprintf(managedptr, managedptr_len + 1, "%s: %s", cid, val); assert(ret >= 0 && (size_t)ret <= managedptr_len); free(val); return managedptr; } } return ""; } /* * Recursively invoke a given function over the given expr and all its * children. */ int asn1f_recurse_expr(arg_t *arg, int (*callback)(arg_t *arg)) { asn1p_expr_t *expr = arg->expr; int rvalue = 0; int ret; assert(expr); if(expr->lhs_params && expr->spec_index == -1) { int i; for(i = 0; i < expr->specializations.pspecs_count; i++) { arg->expr = expr->specializations.pspec[i].my_clone; ret = asn1f_recurse_expr(arg, callback); RET2RVAL(ret, rvalue); } arg->expr = expr; /* revert */ return rvalue; } /* * Invoke the callback at this very level. */ ret = callback(arg); RET2RVAL(ret, rvalue); /* * Recursively invoke myself * to iterate over each element in the tree. */ TQ_FOR(arg->expr, &(expr->members), next) { assert(arg->expr->expr_type != A1TC_INVALID); assert(arg->expr->parent_expr == expr); ret = asn1f_recurse_expr(arg, callback); RET2RVAL(ret, rvalue); } arg->expr = expr; /* Restore original position */ return rvalue; } /* * Check that every child of a given expr has unique name or does not have any. */ int asn1f_check_unique_expr(arg_t *arg) { asn1p_expr_t *expr; int rvalue = 0; TQ_FOR(expr, &(arg->expr->members), next) { if(expr->Identifier) { int ret = asn1f_check_unique_expr_child(arg, expr, 0, "identifier"); if(ret) rvalue = -1; } else { /* * No point of comparing this child with any other: * this one does not have a name. */ } } return rvalue; } /* * Check that every preceeding child of the given expr is not * having the name of the given one. */ int asn1f_check_unique_expr_child(arg_t *arg, asn1p_expr_t *child, int (*opt_compare)(asn1p_expr_t *a, asn1p_expr_t *b), const char *opt_property_name) { asn1p_expr_t *expr; if(!opt_property_name) opt_property_name = "property"; assert(child); assert(opt_compare || child->Identifier); TQ_FOR(expr, &(arg->expr->members), next) { int ret; if(expr == child) break; /* * Compare according to the custom rule or default * names comparisons. */ if(opt_compare) { ret = opt_compare(expr, child); } else { if(expr->Identifier == NULL || expr->expr_type == A1TC_EXTENSIBLE) continue; ret = strcmp(expr->Identifier, child->Identifier); } if(ret == 0) { FATAL("Clash detected: " "\"%s\" at line %d has similar %s with " "\"%s\" at line %d", expr->Identifier, expr->_lineno, opt_property_name, child->Identifier, child->_lineno ); return -1; } } return 0; } int asn1f_count_children(asn1p_expr_t *expr) { asn1p_expr_t *child; int count = 0; TQ_FOR(child, &(expr->members), next) { count++; } return count; } static char **known_types; static int known_types_count; static int known_types_size; static int _known_types_cmp(const void *ap, const void *bp) { const char *a = *(const char * const *)ap; const char *b = *(const char * const *)bp; return strcmp(a, b); } int asn1f_make_known_external_type(const char *type_name) { char *tname; /* Check for duplicates */ if(asn1f_check_known_external_type(type_name) == 0) { errno = EEXIST; return -1; } /* Ensure enough space */ if(known_types_count <= known_types_size) { int n = known_types_size ? known_types_size << 1 : 4; void *p; p = realloc(known_types, n * sizeof(known_types[0])); if(!p) return -1; known_types = p; known_types_size = n; } tname = strdup(type_name); if(!tname) return -1; known_types[known_types_count++] = tname; #ifdef HAVE_MERGESORT mergesort #else qsort #endif (known_types, known_types_count, sizeof(known_types[0]), _known_types_cmp); return 0; } int asn1f_check_known_external_type(const char *type_name) { if(known_types_count) { void *p = bsearch(&type_name, known_types, known_types_count, sizeof(known_types[0]), _known_types_cmp); if(p) return 0; } errno = ESRCH; return -1; } asn1c-0.9.28+dfsg/libasn1fix/asn1fix_export.c0000644000000000000000000000314613065714043017421 0ustar rootroot#include "asn1fix_internal.h" #include "asn1fix_export.h" extern arg_t a1f_replace_me_with_proper_interface_arg; asn1p_expr_t * asn1f_lookup_symbol_ex( asn1p_t *asn, asn1p_expr_t *expr, asn1p_ref_t *ref) { arg_t arg; memset(&arg, 0, sizeof(arg)); arg.asn = asn; arg.mod = expr->module; arg.expr = expr; arg.eh = a1f_replace_me_with_proper_interface_arg.eh; arg.debug = a1f_replace_me_with_proper_interface_arg.debug; return asn1f_lookup_symbol(&arg, expr->module, expr->rhs_pspecs, ref); } asn1p_expr_t * asn1f_class_access_ex(asn1p_t *asn, asn1p_module_t *mod, asn1p_expr_t *expr, asn1p_expr_t *rhs_pspecs, asn1p_ref_t *ref) { arg_t arg; memset(&arg, 0, sizeof(arg)); arg.asn = asn; arg.mod = mod; arg.expr = expr; arg.eh = a1f_replace_me_with_proper_interface_arg.eh; arg.debug = a1f_replace_me_with_proper_interface_arg.debug; return asn1f_class_access(&arg, mod, rhs_pspecs, ref); } asn1p_expr_t * asn1f_find_terminal_type_ex(asn1p_t *asn, asn1p_expr_t *expr) { arg_t arg; memset(&arg, 0, sizeof(arg)); arg.asn = asn; arg.mod = expr->module; arg.expr = expr; arg.eh = a1f_replace_me_with_proper_interface_arg.eh; arg.debug = a1f_replace_me_with_proper_interface_arg.debug; return asn1f_find_terminal_type(&arg, expr); } int asn1f_fix_dereference_values_ex(asn1p_t *asn, asn1p_module_t *mod, asn1p_expr_t *expr) { arg_t arg; memset(&arg, 0, sizeof(arg)); arg.asn = asn; arg.mod = mod; arg.expr = expr; arg.eh = a1f_replace_me_with_proper_interface_arg.eh; arg.debug = a1f_replace_me_with_proper_interface_arg.debug; return asn1f_fix_dereference_values(&arg); } asn1c-0.9.28+dfsg/libasn1fix/asn1fix_integer.h0000644000000000000000000000023513065714043017536 0ustar rootroot#ifndef ASN1FIX_INTEGER_H #define ASN1FIX_INTEGER_H int asn1f_fix_integer(arg_t *); /* Type1 ::= INTEGER { a(1), b(2) } */ #endif /* ASN1FIX_INTEGER_H */ asn1c-0.9.28+dfsg/libasn1fix/asn1fix_cstring.c0000644000000000000000000000261013065714043017544 0ustar rootroot#include "asn1fix_internal.h" struct _cstring_pattern { char *start; size_t length; }; static int _asn1f_cstring_find_line_pattern(char *s, struct _cstring_pattern *); int asn1f_fix_cstring(arg_t *arg) { asn1p_expr_t *expr = arg->expr; int r_value = 0; if(expr->value && expr->value->type == ATV_STRING) { struct _cstring_pattern cp; char *buf = (char *)expr->value->value.string.buf; int buflen = expr->value->value.string.size; int start = 0; DEBUG("(%s) for line %d", expr->Identifier, expr->_lineno); while(_asn1f_cstring_find_line_pattern(buf + start, &cp)) { assert(cp.length); memmove(cp.start, cp.start + cp.length, buflen - ((cp.start + cp.length) - buf)); buflen -= cp.length; start = cp.start - buf; buf[buflen] = '\0'; } } return r_value; } /* * If a string has a newline, the tabulation and spaces before and * after it must be eliminated. */ static int _asn1f_cstring_find_line_pattern(char *s, struct _cstring_pattern *cp) { int newline_found = 0; cp->start = NULL; for(;;s++) { switch(*s) { case '\r': case '\n': newline_found = 1; /* Fall through */ case ' ': case '\t': if(cp->start == NULL) cp->start = s; continue; case '\0': default: if(newline_found) { cp->length = (size_t)(s - cp->start); return 1; } cp->start = NULL; if(*s == '\0') break; continue; } break; } return 0; } asn1c-0.9.28+dfsg/libasn1fix/asn1fix_cws.h0000644000000000000000000000027313065714043016677 0ustar rootroot#ifndef ASN1FIX_CLASS_WITH_SYNTAX_H #define ASN1FIX_CLASS_WITH_SYNTAX_H /* * Parse class objects */ int asn1f_parse_class_object(arg_t *arg); #endif /* ASN1FIX_CLASS_WITH_SYNTAX_H */ asn1c-0.9.28+dfsg/libasn1fix/asn1fix_param.h0000644000000000000000000000032513065714043017201 0ustar rootroot#ifndef ASN1FIX_PARAMETERIZATION_H #define ASN1FIX_PARAMETERIZATION_H asn1p_expr_t *asn1f_parameterization_fork(arg_t *arg, asn1p_expr_t *expr, asn1p_expr_t *rhs_pspecs); #endif /* ASN1FIX_PARAMETERIZATION_H */ asn1c-0.9.28+dfsg/libasn1fix/asn1fix_class.c0000644000000000000000000000433013065714043017201 0ustar rootroot#include "asn1fix_internal.h" asn1p_expr_t * asn1f_class_access(arg_t *arg, asn1p_module_t *mod, asn1p_expr_t *rhs_pspecs, asn1p_ref_t *ref) { asn1p_expr_t *ioclass; asn1p_expr_t *classfield; asn1p_expr_t *expr; asn1p_ref_t tmpref; assert(ref->comp_count > 1); DEBUG("ClassAccess lookup (%s) for line %d", asn1f_printable_reference(ref), ref->_lineno); /* * Fetch the first part of the reference (OBJECT or ObjectSet). * OBJECT.&... * ObjectSet.&... */ assert(isupper(ref->components[0].name[0])); tmpref = *ref; tmpref.comp_count = 1; ioclass = asn1f_lookup_symbol(arg, mod, rhs_pspecs, &tmpref); if(ioclass == NULL) { errno = ESRCH; return NULL; } if(ioclass->expr_type == A1TC_REFERENCE) { ioclass = asn1f_lookup_symbol(arg, ioclass->module, ioclass->rhs_pspecs, ioclass->reference); if(ioclass == NULL) { errno = ESRCH; return NULL; } } if(ioclass->expr_type != A1TC_CLASSDEF) { if(!(ioclass->_mark & TM_BROKEN)) { ioclass->_mark |= TM_BROKEN; FATAL("Class field %s lookup at line %d in something that is not a class: %s at line %d", asn1f_printable_reference(ref), ref->_lineno, ioclass->Identifier, ioclass->_lineno); } errno = EINVAL; return NULL; } classfield = asn1f_lookup_child(ioclass, ref->components[1].name); if(classfield == NULL) { DEBUG("CLASS %s does not contain field %s", ioclass->Identifier, ref->components[1].name); errno = ESRCH; return NULL; } assert(classfield->meta_type == AMT_OBJECTFIELD); DEBUG("CLASS %s -> %s (%d)", ioclass->Identifier, classfield->Identifier, classfield->expr_type); switch(classfield->expr_type) { case A1TC_CLASSFIELD_TFS: if(TQ_FIRST(&classfield->members)) { /* Already have something */ } else { expr = asn1p_expr_new(classfield->_lineno, mod); expr->expr_type = ASN_TYPE_ANY; expr->meta_type = AMT_TYPE; asn1p_expr_add(classfield, expr); } /* Fall through */ case A1TC_CLASSFIELD_FTVFS: expr = TQ_FIRST(&classfield->members); assert(expr); return expr; break; default: FATAL("%s.%s: field type not yet supported. " "Consider donation to the asn1c author.", ioclass->Identifier, classfield->Identifier); return NULL; } return NULL; } asn1c-0.9.28+dfsg/libasn1fix/asn1fix_constr.h0000644000000000000000000000102613065714043017410 0ustar rootroot#ifndef ASN1FIX_CONSTRUCTED_H #define ASN1FIX_CONSTRUCTED_H /* * Pull in COMPONENTS OF. */ int asn1f_pull_components_of(arg_t *); /* * Fix extensions in constructed types. */ int asn1f_fix_constr_ext(arg_t *); /* * Fix tagging in constructed types. */ int asn1f_fix_constr_tag(arg_t *, int fix_top_level); /* * Check distinctive tagging in constructed types. */ int asn1f_check_constr_tags_distinct(arg_t *); /* * Perform automatic tagging. */ int asn1f_fix_constr_autotag(arg_t *); #endif /* ASN1FIX_CONSTRUCTED_H */ asn1c-0.9.28+dfsg/libasn1fix/asn1fix_constraint.h0000644000000000000000000000111613065714043020264 0ustar rootroot#ifndef ASN1FIX_CONSTRAINT_H #define ASN1FIX_CONSTRAINT_H /* * Resolve referenced values inside constraints. */ int asn1constraint_resolve(arg_t *arg, asn1p_constraint_t *ct, asn1p_expr_type_e topmost_parent_expression_type, enum asn1p_constraint_type_e effective_constraint_type); /* * Collect all subtype constraints from all parents of this type and * the type itself, forming a full constraint structure. * Honors the constraints extensibility rules (46.8) * and does other useful transformations. */ int asn1constraint_pullup(arg_t *arg); #endif /* ASN1FIX_CONSTRAINT_H */ asn1c-0.9.28+dfsg/libasn1fix/asn1fix.c0000644000000000000000000003001713065714043016015 0ustar rootroot#include "asn1fix_internal.h" #include "asn1fix.h" /* Print everything to stderr */ static void _default_error_logger(int _severity, const char *fmt, ...); /* * Internal check functions. */ static int asn1f_fix_module__phase_1(arg_t *arg); static int asn1f_fix_module__phase_2(arg_t *arg); static int asn1f_fix_simple(arg_t *arg); /* For INTEGER/ENUMERATED */ static int asn1f_fix_constructed(arg_t *arg); /* For SEQUENCE/SET/CHOICE */ static int asn1f_resolve_constraints(arg_t *arg); /* For subtype constraints */ static int asn1f_check_constraints(arg_t *arg); /* For subtype constraints */ static int asn1f_check_duplicate(arg_t *arg); static int asn1f_apply_unique_index(arg_t *arg); static int phase_1_1(arg_t *arg, int prm2); arg_t a1f_replace_me_with_proper_interface_arg; /* * Scan every module defined here in search for inconsistences. */ int asn1f_process(asn1p_t *asn, enum asn1f_flags flags, error_logger_f error_logger) { arg_t arg; int fatals = 0; int warnings = 0; int ret; /* * Check validity of arguments. */ if(asn == NULL) { errno = EINVAL; return -1; } /* * If errors handler is not specified, default to internal one. */ if(error_logger == 0) { error_logger = _default_error_logger; } memset(&arg, 0, sizeof(arg)); arg.asn = asn; arg.eh = error_logger; if(flags & A1F_DEBUG) { arg.debug = arg.eh; arg.debug(-1, "Called %s() with flags %d", __func__, flags); flags &= ~A1F_DEBUG; } /* Allow SIZE() constraint for INTEGER and other types */ if(flags & A1F_EXTENDED_SizeConstraint) { arg.flags |= A1F_EXTENDED_SizeConstraint; flags &= ~A1F_EXTENDED_SizeConstraint; if(arg.debug) { arg.debug(-1, "Extended SizeConstraint support enabled"); } } a1f_replace_me_with_proper_interface_arg = arg; /* * Check that we haven't missed an unknown flag. */ if(flags) { errno = EINVAL; return -1; } /* * Process each module in the list. * PHASE I. */ TQ_FOR(arg.mod, &(asn->modules), mod_next) { ret = asn1f_fix_module__phase_1(&arg); /* * These lines are used for illustration purposes. * RET2RVAL() is used everywhere else. */ if(ret == -1) fatals++; if(ret == 1) warnings++; } /* PHASE II. */ TQ_FOR(arg.mod, &(asn->modules), mod_next) { ret = asn1f_fix_module__phase_2(&arg); if(ret == -1) fatals++; if(ret == 1) warnings++; } memset(&a1f_replace_me_with_proper_interface_arg, 0, sizeof(arg_t)); /* * Compute a return value. */ return fatals?-1:warnings?1:0; } /* * Check the internals of a single module. */ static int asn1f_fix_module__phase_1(arg_t *arg) { asn1p_expr_t *expr; int rvalue = 0; int ret; asn1p_module_t *omod; /* * Check that we don't have a similarly named module. */ TQ_FOR(omod, &arg->asn->modules, mod_next) { int sameNames; if(omod == arg->mod) break; sameNames = strcmp(omod->ModuleName, arg->mod->ModuleName)?0:1; if(omod->module_oid && arg->mod->module_oid) { /* Compare only the OID. */ if(asn1p_oid_compare(omod->module_oid, arg->mod->module_oid) == 0) { FATAL("ASN.1 module %s in %s " "has the same OBJECT IDENTIFIER" " as module %s", omod->ModuleName, omod->source_file_name, arg->mod->ModuleName ); RET2RVAL(-1, rvalue); } else if(sameNames) { WARNING("ASN.1 module %s is defined more than once, with different OIDs", omod->ModuleName); RET2RVAL(1, rvalue); } } else if(sameNames) { FATAL("ASN.1 module %s is defined more than once", omod->ModuleName); RET2RVAL(-1, rvalue); } } switch((arg->mod->module_flags & MSF_MASK_TAGS)) { case MSF_NOFLAGS: case MSF_EXPLICIT_TAGS: case MSF_IMPLICIT_TAGS: case MSF_AUTOMATIC_TAGS: break; default: FATAL("Module %s defined with ambiguous global tagging mode", arg->mod->ModuleName); RET2RVAL(-1, rvalue); } switch((arg->mod->module_flags & MSF_MASK_INSTRUCTIONS)) { case MSF_NOFLAGS: /* * arg->mod->module_flags |= MSF_TAG_INSTRUCTIONS; */ break; case MSF_unk_INSTRUCTIONS: WARNING("Module %s defined with unrecognized " "encoding reference", arg->mod->ModuleName); RET2RVAL(1, rvalue); /* Fall through */ case MSF_TAG_INSTRUCTIONS: case MSF_XER_INSTRUCTIONS: break; default: FATAL("Module %s defined with ambiguous encoding reference", arg->mod->ModuleName); RET2RVAL(-1, rvalue); } /* * Do various non-recursive transformations. */ TQ_FOR(expr, &(arg->mod->members), next) { arg->expr = expr; ret = phase_1_1(arg, 0); RET2RVAL(ret, rvalue); /* * Make sure everybody's behaving well. */ assert(arg->expr == expr); } TQ_FOR(expr, &(arg->mod->members), next) { arg->expr = expr; ret = phase_1_1(arg, 1); RET2RVAL(ret, rvalue); assert(arg->expr == expr); } /* * 5. Automatic tagging */ TQ_FOR(expr, &(arg->mod->members), next) { arg->expr = expr; ret = asn1f_recurse_expr(arg, asn1f_fix_constr_autotag); RET2RVAL(ret, rvalue); assert(arg->expr == expr); } /* * 8. fix BIT STRING * 9. fix spaces in cstrings */ TQ_FOR(expr, &(arg->mod->members), next) { arg->expr = expr; ret = asn1f_recurse_expr(arg, asn1f_fix_bit_string); RET2RVAL(ret, rvalue); ret = asn1f_recurse_expr(arg, asn1f_fix_cstring); RET2RVAL(ret, rvalue); assert(arg->expr == expr); } /* * ... Check for tags distinctness. */ TQ_FOR(expr, &(arg->mod->members), next) { arg->expr = expr; ret = asn1f_recurse_expr(arg, asn1f_check_constr_tags_distinct); RET2RVAL(ret, rvalue); assert(arg->expr == expr); } return rvalue; } static int asn1f_fix_module__phase_2(arg_t *arg) { asn1p_expr_t *expr; int rvalue = 0; int ret; TQ_FOR(expr, &(arg->mod->members), next) { arg->expr = expr; /* * Dereference DEFAULT values. */ ret = asn1f_recurse_expr(arg, asn1f_fix_dereference_defaults); RET2RVAL(ret, rvalue); /* * Check semantic validity of constraints. */ ret = asn1f_recurse_expr(arg, asn1f_check_constraints); RET2RVAL(ret, rvalue); /* * Uniquely tag each inner type. */ asn1f_apply_unique_index(0); ret = asn1f_recurse_expr(arg, asn1f_apply_unique_index); RET2RVAL(ret, rvalue); assert(arg->expr == expr); } return rvalue; } static int phase_1_1(arg_t *arg, int prm2) { asn1p_expr_t *expr = arg->expr; int rvalue = 0; int ret; if(expr->lhs_params && expr->spec_index == -1) { int i; if(!prm2) /* Do not process the parameterized type just yet */ return 0; for(i = 0; i < expr->specializations.pspecs_count; i++) { arg->expr = expr->specializations.pspec[i].my_clone; ret = phase_1_1(arg, 0); RET2RVAL(ret, rvalue); } arg->expr = expr; /* revert */ return rvalue; } else if(prm2) { return 0; /* Already done! */ } /* Check whether this type is a duplicate */ if(!expr->lhs_params) { ret = asn1f_check_duplicate(arg); RET2RVAL(ret, rvalue); } DEBUG("=== Now processing \"%s\" (%d/0x%x) at line %d ===", expr->Identifier, expr->meta_type, expr->expr_type, expr->_lineno); assert(expr->meta_type != AMT_INVALID); /* * 2.1 Pre-process simple types (ENUMERATED, INTEGER, etc). */ ret = asn1f_recurse_expr(arg, asn1f_fix_simple); RET2RVAL(ret, rvalue); /* * 2.5.4 */ ret = asn1f_recurse_expr(arg, asn1f_fix_dereference_types); RET2RVAL(ret, rvalue); /* * Fix tagging of top-level types. */ ret = asn1f_fix_constr_tag(arg, 1); RET2RVAL(ret, rvalue); /* * 2.[234] Process SEQUENCE/SET/CHOICE types. */ ret = asn1f_recurse_expr(arg, asn1f_fix_constructed); RET2RVAL(ret, rvalue); /* * 2.5.5 */ ret = asn1f_recurse_expr(arg, asn1f_fix_dereference_values); RET2RVAL(ret, rvalue); /* * Parse class objects and fill up the object class with data. */ ret = asn1f_parse_class_object(arg); RET2RVAL(ret, rvalue); /* * Resolve references in constraints. */ ret = asn1f_recurse_expr(arg, asn1f_resolve_constraints); RET2RVAL(ret, rvalue); /* * 6. INTEGER value processed at 2.5.4. */ return rvalue; } static int asn1f_fix_simple(arg_t *arg) { int rvalue = 0; int ret; ret = asn1f_fix_enum(arg); RET2RVAL(ret, rvalue); ret = asn1f_fix_integer(arg); RET2RVAL(ret, rvalue); return rvalue; } static int asn1f_fix_constructed(arg_t *arg) { int rvalue = 0; int ret; switch(arg->expr->expr_type) { case ASN_CONSTR_SEQUENCE: case ASN_CONSTR_SET: case ASN_CONSTR_CHOICE: break; default: return 0; } /* Check identifier distinctness */ ret = asn1f_check_unique_expr(arg); RET2RVAL(ret, rvalue); /* Fix extensibility */ ret = asn1f_fix_constr_ext(arg); RET2RVAL(ret, rvalue); /* Fix tagging */ ret = asn1f_fix_constr_tag(arg, 0); RET2RVAL(ret, rvalue); /* Import COMPONENTS OF stuff */ ret = asn1f_pull_components_of(arg); RET2RVAL(ret, rvalue); return rvalue; } static int asn1f_resolve_constraints(arg_t *arg) { asn1p_expr_t *top_parent; asn1p_expr_type_e etype; int rvalue = 0; int ret; top_parent = asn1f_find_terminal_type(arg, arg->expr); if(top_parent) etype = top_parent->expr_type; else etype = A1TC_INVALID; DEBUG("(%s)", arg->expr->Identifier); ret = asn1constraint_resolve(arg, arg->expr->constraints, etype, 0); RET2RVAL(ret, rvalue); return rvalue; } static int asn1f_check_constraints(arg_t *arg) { static enum asn1p_constraint_type_e test_types[] = { ACT_EL_RANGE, ACT_CT_SIZE, ACT_CT_FROM }; asn1p_expr_t *top_parent; asn1cnst_range_t *range; asn1p_expr_type_e etype; unsigned int i; int rvalue = 0; int ret; DEBUG("(%s{%d/%d})", arg->expr->Identifier, arg->expr->meta_type, arg->expr->expr_type); top_parent = asn1f_find_terminal_type(arg, arg->expr); if(!top_parent) return 0; etype = top_parent->expr_type; ret = asn1constraint_pullup(arg); RET2RVAL(ret, rvalue); for(i = 0; i < sizeof(test_types)/sizeof(test_types[0]); i++) { range = asn1constraint_compute_PER_range( etype, arg->expr->combined_constraints, test_types[i], 0, 0, CPR_noflags /* ignore -fbless-SIZE */); if(!range && errno == EPERM) { FATAL("This error happened for \"%s\" (meta %d) " "at line %d", arg->expr->Identifier, arg->expr->meta_type, arg->expr->_lineno); return -1; } asn1constraint_range_free(range); } return rvalue; } static int asn1f_check_duplicate(arg_t *arg) { arg_t tmparg = *arg; int rvalue = 0; /* * This is a linear scan in search of a similar type. * The linear scan is just fine for the task, no need to over-optimize. */ TQ_FOR(tmparg.mod, &arg->asn->modules, mod_next) { int critical = 1; /* FATAL */ if((arg->mod->_tags & MT_STANDARD_MODULE) != (tmparg.mod->_tags & MT_STANDARD_MODULE)) { /* Ignore clashes with standard module */ critical = 0; /* WARNING */ } TQ_FOR(tmparg.expr, &(tmparg.mod->members), next) { int diff_files; /* different files */ assert(tmparg.expr->Identifier); assert(arg->expr->Identifier); if(arg->expr->spec_index != -1) continue; if(tmparg.expr == arg->expr) break; if(strcmp(tmparg.expr->Identifier, arg->expr->Identifier)) continue; diff_files = strcmp(arg->mod->source_file_name, tmparg.mod->source_file_name) ? 1 : 0; LOG(critical, "ASN.1 expression \"%s\" at line %d of module %s\n" "clashes with expression \"%s\" at line %d of module %s" "%s%s%s.\n" "Rename or remove either instance " "to resolve the conflict", arg->expr->Identifier, arg->expr->_lineno, arg->mod->ModuleName, tmparg.expr->Identifier, tmparg.expr->_lineno, tmparg.mod->ModuleName, diff_files ? " (" : "", diff_files ? tmparg.mod->source_file_name : "", diff_files ? ")" : ""); if(critical) return -1; RET2RVAL(1, rvalue); } if(tmparg.mod == arg->mod) break; } return rvalue; } static int asn1f_apply_unique_index(arg_t *arg) { static int unique_index; if(!arg) { unique_index = 0; return 0; } arg->expr->_type_unique_index = ++unique_index; return 0; } /* * Print everything to stderr */ static void _default_error_logger(int _severity, const char *fmt, ...) { va_list ap; char *pfx = ""; switch(_severity) { case -1: pfx = "DEBUG: "; break; case 0: pfx = "WARNING: "; break; case 1: pfx = "FATAL: "; break; } fprintf(stderr, "%s", pfx); va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); fprintf(stderr, "\n"); } asn1c-0.9.28+dfsg/libasn1fix/asn1fix_tags.h0000644000000000000000000000174613065714043017047 0ustar rootroot#ifndef ASN1FIX_TAGS_H #define ASN1FIX_TAGS_H enum asn1f_aft_flags_e { AFT_IMAGINARY_ANY = 0x01, /* Treat ANY tag as [IMAGINARY ANY] */ AFT_FETCH_OUTMOST = 0x02, /* Fetch only outmost tag */ AFT_FULL_COLLECT = 0x04, /* Collect all tags */ AFT_CANON_CHOICE = 0x08, /* Fetch the minimal CHOICE root tag */ }; /* * Allocate and return an array of tags for the given type. * Type1 ::= [2] EXPLICIT Type2 * Type2 ::= [3] IMPLICIT Type3 * Type3 ::= [4] EXPLICIT SEQUENCE { ... } * Will return [2][3][UNIVERSAL 16] for the Type1. */ int asn1f_fetch_tags(asn1p_t *asn, asn1p_module_t *mod, asn1p_expr_t *expr, struct asn1p_type_tag_s **tags, enum asn1f_aft_flags_e flags); /* * Fetch the outmost tag of the given type. * Type1 ::= Type2 * Type2 ::= [2] Type3 * Type3 ::= SEQUENCE { ... } * Will yield [2] for Type1. */ int asn1f_fetch_outmost_tag(asn1p_t *asn, asn1p_module_t *mod, asn1p_expr_t *expr, struct asn1p_type_tag_s *tag, enum asn1f_aft_flags_e); #endif /* ASN1FIX_TAGS_H */ asn1c-0.9.28+dfsg/libasn1fix/asn1fix_class.h0000644000000000000000000000041313065714043017204 0ustar rootroot#ifndef ASN1FIX_CLASS_H #define ASN1FIX_CLASS_H /* * Fetch the element from the class-related stuff (thing) by its reference. */ asn1p_expr_t *asn1f_class_access(arg_t *, asn1p_module_t *mod, asn1p_expr_t *rhs_pspecs, asn1p_ref_t *); #endif /* ASN1FIX_CLASS_H */ asn1c-0.9.28+dfsg/libasn1fix/check_fixer.c0000644000000000000000000001773013065714043016725 0ustar rootroot#undef NDEBUG #include "asn1fix_internal.h" #ifdef _WIN32 #include #include #define chdir _chdir #else #include #include #endif #include #include "asn1fix.h" #ifndef TOP_SRCDIR #define TOP_SRCDIR_S ".." #else #define STRINGIFY_MACRO2(x) #x #define STRINGIFY_MACRO(x) STRINGIFY_MACRO2(x) #define TOP_SRCDIR_S STRINGIFY_MACRO(TOP_SRCDIR) #endif static int check(const char *fname, enum asn1p_flags parser_flags, enum asn1f_flags fixer_flags); static int post_fix_check(asn1p_t *asn); static int post_fix_check_element(asn1p_module_t *mod, asn1p_expr_t *expr); int main(int ac, char **av) { #ifdef _WIN32 intptr_t dir; struct _finddata_t c_file; #else struct dirent *dp; DIR *dir; #endif int failed = 0; int completed = 0; enum asn1p_flags parser_flags = A1P_NOFLAGS; enum asn1f_flags fixer_flags = A1F_NOFLAGS; const char *filename; size_t len; int ret; /* * Just in case when one decides that some flags better be * enabled during `ASN1_FIXER_FLAGS=1 make check` or some * similar usage. */ if(getenv("ASN1_PARSER_FLAGS")) parser_flags = atoi(getenv("ASN1_PARSER_FLAGS")); if(getenv("ASN1_FIXER_FLAGS")) fixer_flags = atoi(getenv("ASN1_FIXER_FLAGS")); /* * Go into a directory with tests. */ if(ac <= 1) { const char *asn1_tests_dir = getenv("ASN1_TESTS_DIR"); if(!asn1_tests_dir) asn1_tests_dir = TOP_SRCDIR_S "/tests"; fprintf(stderr, "Testing in %s...\n", asn1_tests_dir); ret = chdir(asn1_tests_dir); if(ret == -1) fprintf(stderr, "%s: %s\n", asn1_tests_dir, strerror(errno)); assert(ret == 0); /* For some reasons, tests could be hidden under extra tests dir. */ #ifdef _WIN32 dir = _findfirst("*.asn1", &c_file); assert(dir != -1L); #else dir = opendir("."); assert(dir); #endif /* _WIN32 */ } else { dir = 0; } /* * Scan every *.asn1 file and try to parse and fix it. */ if(dir) { #ifdef _WIN32 do { filename = c_file.name; #else while((dp = readdir(dir))) { filename = dp->d_name; #endif /* _WIN32 */ len = strlen(filename); if(len <= 5 || strcmp(filename + len - 5, ".asn1")) continue; ret = check(filename, parser_flags, fixer_flags); if(ret) { fprintf(stderr, "FAILED: %s\n", filename); failed++; } completed++; #ifdef _WIN32 } while(_findnext(dir, &c_file) == 0); _findclose(dir); #else } closedir(dir); #endif /* _WIN32 */ fprintf(stderr, "Tests COMPLETED: %d\n" "Tests FAILED: %d\n" , completed, failed ); } else { int i; for(i = 1; i < ac; i++) { ret = check(av[i], parser_flags, fixer_flags); if(ret) { fprintf(stderr, "FAILED: %s\n", av[i]); failed++; } completed++; } } if(completed == 0) { fprintf(stderr, "No tests defined?!\n"); exit(EX_NOINPUT); } if(failed) exit(EX_DATAERR); return 0; } static int check(const char *fname, enum asn1p_flags parser_flags, enum asn1f_flags fixer_flags) { asn1p_t *asn; int expected_parseable; /* Is it expected to be parseable? */ int expected_fix_code; /* What code a fixer must return */ int r_value = 0; /* * Figure out how the processing should go by inferring * expectations from the file name. */ if(strstr(fname, "-OK.")) { expected_parseable = 1; expected_fix_code = 0; } else if(strstr(fname, "-NP.")) { expected_parseable = 0; expected_fix_code = 123; /* Does not matter */ } else if(strstr(fname, "-SE.")) { expected_parseable = 1; expected_fix_code = -1; /* Semantically incorrect */ } else if(strstr(fname, "-SW.")) { expected_parseable = 1; expected_fix_code = 1; /* Semantically suspicious */ } else { fprintf(stderr, "%s: Invalid file name format\n", fname); return -1; } /* Flag modifiers */ if(strstr(fname, "-blessSize-")) fixer_flags |= A1F_EXTENDED_SizeConstraint; fprintf(stderr, "[=> %s]\n", fname); /* * Perform low-level parsing. */ if(!expected_parseable) fprintf(stderr, "Expecting error...\n"); asn = asn1p_parse_file(fname, parser_flags); if(asn == NULL) { if(expected_parseable) { fprintf(stderr, "Cannot parse file \"%s\"\n", fname); r_value = -1; } else { fprintf(stderr, "Previous error is EXPECTED, no worry\n"); } } else if(!expected_parseable) { fprintf(stderr, "The file \"%s\" is not expected to be parseable, " "yet parsing was successfull!\n", fname); r_value = -1; } if(!asn) return r_value; if(r_value == 0) { asn1p_t *std_asn; std_asn = asn1p_parse_file("../skeletons/standard-modules/ASN1C-UsefulInformationObjectClasses.asn1", A1P_NOFLAGS); if(std_asn) { asn1p_module_t *mod; while((mod = TQ_REMOVE(&(std_asn->modules), mod_next))) { mod->_tags |= MT_STANDARD_MODULE; TQ_ADD(&(asn->modules), mod, mod_next); } asn1p_delete(std_asn); } } /* * Perform semantical checks and fixes. */ if(r_value == 0) { int ret; if(expected_fix_code) fprintf(stderr, "Expecting some problems...\n"); ret = asn1f_process(asn, fixer_flags, 0); if(ret) { if(ret == expected_fix_code) { fprintf(stderr, "Previous error is EXPECTED, " "no worry\n"); } else { fprintf(stderr, "Cannot process file \"%s\": %d\n", fname, ret); r_value = -1; } } else if(ret != expected_fix_code) { fprintf(stderr, "File \"%s\" is expected " "to be semantically incorrect, " "yet processing was successful!\n", fname); r_value = -1; } } /* * Check validity of some values, if grammar has special * instructions for that. */ if(r_value == 0) { if(post_fix_check(asn)) r_value = -1; } /* * Destroy the asn. */ #ifdef CLEAN_EVERYTHING asn1p_delete(asn); #endif return r_value; } static int post_fix_check(asn1p_t *asn) { asn1p_module_t *mod; asn1p_expr_t *expr; int r_value = 0; TQ_FOR(mod, &(asn->modules), mod_next) { TQ_FOR(expr, &(mod->members), next) { assert(expr->Identifier); if(strncmp(expr->Identifier, "check-", 6) == 0) { if(post_fix_check_element(mod, expr)) r_value = -1; } } } return r_value; } static int post_fix_check_element(asn1p_module_t *mod, asn1p_expr_t *check_expr) { asn1p_expr_t *expr = NULL; char *name; asn1p_value_t *value; if(check_expr->expr_type != ASN_BASIC_INTEGER || check_expr->meta_type != AMT_VALUE) { fprintf(stderr, "CHECKER: Unsupported type of \"%s\" value: " "%d at line %d of %s\n", check_expr->Identifier, check_expr->expr_type, check_expr->_lineno, mod->source_file_name ); return -1; } assert(check_expr->meta_type == AMT_VALUE); value = check_expr->value; if(value == NULL || value->type != ATV_INTEGER) { fprintf(stderr, "CHECKER: Unsupported value type of \"%s\": " "%d at line %d of %s\n", check_expr->Identifier, value?(signed)value->type:-1, expr->_lineno, mod->source_file_name ); return -1; } name = check_expr->Identifier + sizeof("check-") - 1; /* * Scan in search for the original. */ TQ_FOR(expr, &(mod->members), next) { if(strcmp(expr->Identifier, name) == 0) break; } if(expr == NULL) { fprintf(stderr, "CHECKER: Value \"%s\" requested by " "\"check-%s\" at line %d of %s is not found!\n", name, name, check_expr->_lineno, mod->source_file_name ); return -1; } if(0 && expr->expr_type != check_expr->expr_type) { fprintf(stderr, "CHECKER: Value type of \"%s\" (=%d) at line %d " "does not have desired type %d as requested by " "\"check-%s\" in %s\n", expr->Identifier, expr->expr_type, expr->_lineno, check_expr->expr_type, name, mod->source_file_name ); return -1; } if(expr->value == NULL || expr->value->type != value->type) { fprintf(stderr, "CHECKER: Value of \"%s\" (\"%s\", type=%d) at line %d " "does not have desired type %d as requested by " "\"check-%s\" in %s\n", expr->Identifier, asn1f_printable_value(expr->value), expr->value->type, expr->_lineno, value->type, name, mod->source_file_name ); return -1; } assert(value->type = ATV_INTEGER); return 0; } asn1c-0.9.28+dfsg/libasn1fix/asn1fix_integer.c0000644000000000000000000000653613065714043017543 0ustar rootroot#include "asn1fix_internal.h" static int _compare_value(asn1p_expr_t *expr1, asn1p_expr_t *expr2) { if(expr2->value->type == ATV_INTEGER && expr1->value->type == ATV_INTEGER) { return expr2->value->value.v_integer - expr1->value->value.v_integer; } else { return -1; } } /* * Check the validity of an INTEGER type. */ int asn1f_fix_integer(arg_t *arg) { asn1p_expr_t *expr = arg->expr; asn1p_expr_t *iv; int rvalue = 0; int ret; if(expr->expr_type != ASN_BASIC_INTEGER) return 0; /* Just ignore it */ DEBUG("(\"%s\", %x) for line %d", expr->Identifier, expr->expr_type, expr->_lineno); /* * Scan the integer values in search for inconsistencies. */ TQ_FOR(iv, &(expr->members), next) { DEBUG("\tItem %s(%s)", iv->Identifier, asn1f_printable_value(iv->value)); /* * Found "...", check correctness. */ if(iv->expr_type == A1TC_EXTENSIBLE) { FATAL("INTEGER %s at line %d: " "Extension marker is not allowed", expr->Identifier, iv->_lineno); rvalue = -1; continue; } if(iv->Identifier == NULL || iv->expr_type != A1TC_UNIVERVAL) { FATAL("INTEGER %s at line %d: " "Unsupported enumeration element %s", expr->Identifier, iv->_lineno, iv->Identifier?iv->Identifier:"" ); rvalue = -1; continue; } if(iv->value == NULL) { FATAL("INTEGER %s at line %d: " "Value for the identifier %s " "must be set explicitly", expr->Identifier, iv->_lineno, iv->Identifier ); rvalue = -1; continue; } else if(iv->value->type == ATV_REFERENCED) { /* * Resolve the value, once and for all. */ if(asn1f_value_resolve(arg, iv, 0)) { /* This function will emit messages */ rvalue = -1; continue; } } if(iv->value->type != ATV_INTEGER) { FATAL("INTEGER %s at line %d: " "Value for the identifier %s " "is not compatible with INTEGER type", expr->Identifier, iv->_lineno); rvalue = -1; continue; } /* * Check that all identifiers are distinct. */ ret = asn1f_check_unique_expr_child(arg, iv, 0, "identifier"); RET2RVAL(ret, rvalue); /* * Check that all values are distinct. */ ret = asn1f_check_unique_expr_child(arg, iv, _compare_value, "value"); RET2RVAL(ret, rvalue); } return rvalue; } #if 0 static int _asn1f_make_sure_type_is(arg_t *arg, asn1p_expr_t *expr, asn1p_expr_type_e type) { asn1p_expr_t *next_expr; asn1p_expr_type_e expr_type; int ret; expr_type = expr->expr_type; /* * Here we're trying to make sure that the type of the given * expression is really what is expected. * This is ensured in two ways. * First, if the immediate type matches the provided one, * this is a clear hit. */ if(expr_type == type) return 0; /* * Otherwise, it must be either a reference or a different type. */ if(expr_type != A1TC_REFERENCE) { errno = EPERM; return -1; } assert(expr_type == A1TC_REFERENCE); assert(expr->reference); /* * Then, it is a reference. For a reference, try to resolve type * and try again. */ next_expr = asn1f_lookup_symbol(arg, expr->module, expr->rhs_pspecs, expr->reference); if(next_expr == NULL) { errno = ESRCH; return -1; } /* * If symbol is here, recursively check that it conforms to the type. */ WITH_MODULE(next_expr->module, ret = _asn1f_make_sure_type_is(arg, next_expr, type)); return ret; } #endif asn1c-0.9.28+dfsg/libasn1fix/asn1fix_cstring.h0000644000000000000000000000016513065714043017554 0ustar rootroot#ifndef ASN1FIX_CSTRING_H #define ASN1FIX_CSTRING_H int asn1f_fix_cstring(arg_t *); #endif /* ASN1FIX_CSTRING_H */ asn1c-0.9.28+dfsg/LICENSE0000644000000000000000000000244713065714043013253 0ustar rootrootCopyright (c) 2003-2017 Lev Walkin and contributors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. asn1c-0.9.28+dfsg/asn1c/0000755000000000000000000000000013065714043013244 5ustar rootrootasn1c-0.9.28+dfsg/asn1c/Makefile.am0000644000000000000000000000130213065714043015274 0ustar rootroot SUBDIRS = . tests AM_CFLAGS = @ADD_CFLAGS@ AM_CPPFLAGS = \ -I${top_srcdir}/libasn1compiler \ -I${top_srcdir}/libasn1parser \ -I${top_srcdir}/libasn1print \ -I${top_srcdir}/libasn1fix \ -I${top_srcdir}/skeletons \ -DDATADIR=\"$(pkgdatadir)\" asn1c_LDADD = \ $(top_builddir)/libasn1parser/libasn1parser.la \ $(top_builddir)/libasn1print/libasn1print.la \ $(top_builddir)/libasn1fix/libasn1fix.la \ $(top_builddir)/libasn1compiler/libasn1compiler.la bin_PROGRAMS = asn1c unber enber noinst_HEADERS = sys-common.h dist_check_SCRIPTS = check-xxber.sh check-parsing.sh TESTS_ENVIRONMENT= top_srcdir=${top_srcdir} TESTS = $(dist_check_SCRIPTS) CLEANFILES = .check-xxber.*.tmp .check-parsing.*.tmp asn1c-0.9.28+dfsg/asn1c/check-parsing.sh0000755000000000000000000000232313065714043016321 0ustar rootroot#!/bin/sh # Test diff(1) capabilities diff -a . . 2>/dev/null && diffArgs="-a" # Assume text files diff -u . . 2>/dev/null && diffArgs="$diffArgs -u" # Unified diff output ec=0 set -e PROCESSING="" print_status() { echo "Error while processing $PROCESSING" } trap print_status EXIT if [ "x${top_srcdir}" = "x" ]; then top_srcdir=".." fi for ref in ${top_srcdir}/tests/*.asn1.-*; do # Figure out the initial source file used to generate this output. src=$(echo "$ref" | sed -e 's/\.-[-a-zA-Z0-9=]*$//') # Figure out compiler flags used to create the file. flags=$(echo "$ref" | sed -e 's/.*\.-//') echo "Checking $src against $ref" template=.tmp.check-parsing.$$ oldversion=${template}.old newversion=${template}.new PROCESSING="$ref (from $src)" LANG=C sed -e 's/^found in .*/found in .../' < "$ref" > "$oldversion" (./asn1c -S ${top_srcdir}/skeletons "-$flags" "$src" | LANG=C sed -e 's/^found in .*/found in .../' > "$newversion") || ec=$? if [ $? = 0 ]; then diff $diffArgs "$oldversion" "$newversion" || ec=$? fi rm -f $oldversion $newversion if [ "$1" = "regenerate" ]; then ./asn1c -S ${top_srcdir}/skeletons "-$flags" "$src" > "$ref" fi done if [ $ec = 0 ]; then trap '' EXIT fi exit $ec asn1c-0.9.28+dfsg/asn1c/enber.c0000644000000000000000000002713613065714043014514 0ustar rootroot/*- * Copyright (c) 2004, 2005 Lev Walkin . All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $Id$ */ #include "sys-common.h" #include /* For static string tables */ #include #include #include #include #undef COPYRIGHT #define COPYRIGHT "Copyright (c) 2004, 2005 Lev Walkin \n" static void usage(const char *av0, int); /* Print the Usage screen and exit */ static int process(const char *fname); /* Perform the BER decoding */ static int process_line(const char *fname, char *line, int lineno); static int no_validation; /* -n */ int main(int ac, char **av) { int ch; /* Command line character */ int i; /* Index in some loops */ /* * Process command-line options. */ while((ch = getopt(ac, av, "nhv")) != -1) switch(ch) { case 'n': no_validation++; break; case 'v': usage(av[0], 1); break; case 'h': default: usage(av[0], 0); } /* * Ensure that there are some input files present. */ if(ac > optind) { ac -= optind; av += optind; } else { fprintf(stderr, "%s: No input files specified\n", av[0]); exit(1); } setvbuf(stdout, 0, _IOLBF, 0); /* * Iterate over input files and parse each. * All syntax trees from all files will be bundled together. */ for(i = 0; i < ac; i++) { if(process(av[i])) exit(EX_DATAERR); } return 0; } /* * Print the usage screen and exit(EX_USAGE). */ static void usage(const char *av0, int copyright_only) { fprintf(stderr, "Convert unber(1)'s output back into BER, " "v" VERSION "\n" COPYRIGHT); if(copyright_only) exit(0); fprintf(stderr, "Usage: %s [-n] [-] [file ...]\n" "Options:\n" " -n Disable XML input validation\n", av0); exit(EX_USAGE); } /* * Open the file and initiate recursive processing. */ static int process(const char *fname) { char buf[8192]; char *collector = 0; size_t collector_size = sizeof(buf); size_t collector_offset = 0; int lineno = 0; FILE *fp; if(strcmp(fname, "-")) { fp = fopen(fname, "r"); if(!fp) { perror(fname); return -1; } } else { fp = stdin; } while(fgets(buf, sizeof(buf), fp) || !feof(fp)) { size_t len = strlen(buf); if(!len) continue; if(collector_offset || buf[len - 1] != '\n') { if((collector_size - collector_offset) <= len || !collector) { collector_size <<= 1; collector = REALLOC(collector, collector_size); if(!collector) { perror("realloc()"); exit(EX_OSERR); } } memcpy(collector + collector_offset, buf, len + 1); collector_offset += len; } if(buf[len - 1] != '\n') continue; if(collector_offset) { assert(collector[collector_offset - 1] == '\n'); process_line(fname, collector, ++lineno); collector_offset = 0; } else { process_line(fname, buf, ++lineno); } } if(fp != stdin) fclose(fp); return 0; } static int process_line(const char *fname, char *line, int lineno) { char buf[32]; char *op; /* '<' */ char *cl; /* '>' */ char *tcl_pos; /* tag class (T=") position */ char *tl_pos; /* tag length (TL=") position */ char *v_pos; /* value length (V=") position */ int constr; ber_tlv_tag_t tag_value; ber_tlv_tag_t tag_class; ber_tlv_tag_t tlv_tag; ber_tlv_len_t tlv_len; ber_tlv_len_t opt_tl_len; /* optional TL length */ ssize_t ret; (void)fname; /* Skip the whitespace */ for(; *line == ' ' || *line == '\t'; line++) ; /* Find a tag opening angle bracket */ op = line; switch(*op) { case '<': /* That's what we want! A tag opening */ break; case '-': /* This is a comment (dash-dash) */ if(op[1] == *op) case '\r': case '\n': case '#': /* This is a comment */ return 0; default: fprintf(stderr, "%s: Missing '<' after whitespace at line %d\n", fname, lineno); exit(EX_DATAERR); } /* Find a tag closing angle bracket */ for(; *line && *line != '>'; line++) { if(*line < ' ') { fprintf(stderr, "%s: Invalid charset (%d) at line %d\n", fname, *(const unsigned char *)line, lineno); exit(EX_DATAERR); } } cl = line; if(*cl != '>') { fprintf(stderr, "%s: Missing '>' at line %d\n", fname, lineno); exit(EX_DATAERR); } /* Ignore closing tags */ if(op[1] == '/') { if(strchr(cl, '<')) { /* We are not very robust */ fprintf(stderr, "%s: Multiple tags per line at line %d\n", fname, lineno); exit(EX_DATAERR); } /* End-of-content octets */ if(op[2] == 'I') { buf[0] = buf[1] = 0x00; fwrite(buf, 1, 2, stdout); } return 0; } switch(op[1]) { case '!': return 0; /* A comment */ case '?': return 0; /* An XML preamble */ case 'C': constr = 1; break; case 'P': constr = 0; break; case 'I': constr = 2; break; default: fprintf(stderr, "%s: Expected \"C\"/\"P\"/\"I\" as the XML tag name (%c) at " "line %d\n", fname, op[1], lineno); exit(EX_DATAERR); } *cl = '\0'; if(cl[-1] == 'F') { fprintf(stderr, "%s: Detected pretty-printing of primitive types at line %d. " "Re-run `unber` with -p option to disable pretty-printing.\n", fname, lineno); exit(EX_DATAERR); } tcl_pos = strstr(op, "T=\"["); tl_pos = strstr(op, "TL=\""); v_pos = strstr(op, "V=\""); if(!tcl_pos || (!v_pos && constr != 2)) { fprintf(stderr, "%s: Mandatory attribute %s is not found at line %d\n", fname, (!tcl_pos) ? "T" : "V", lineno); exit(EX_DATAERR); } errno = 0; opt_tl_len = tl_pos ? strtoul(tl_pos + 4, 0, 10) : 0; if(constr == 2) { tlv_len = 0; } else { tlv_len = strtoul(v_pos + 3, 0, 10); } if(errno || (opt_tl_len && opt_tl_len < 2) || tlv_len < 0) { fprintf(stderr, "%s: Invalid TL or V value at line %d\n", fname, lineno); exit(EX_DATAERR); } /* clang-format off */ tcl_pos += 4; switch(*tcl_pos) { case 'U': /* UNIVERSAL */ tag_class = ASN_TAG_CLASS_UNIVERSAL; break; case 'P': /* PRIVATE */ tag_class = ASN_TAG_CLASS_PRIVATE; break; case 'A': /* APPLICATION */ tag_class = ASN_TAG_CLASS_APPLICATION; break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': /* context */ tag_class = ASN_TAG_CLASS_CONTEXT; break; default: fprintf(stderr, "%s: Invalid tag class (%c) at line %d\n", fname, tcl_pos[4], lineno); exit(EX_DATAERR); } for(;; tcl_pos++) { switch(*tcl_pos) { case '"': tcl_pos = ""; case '\0': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; default: continue; } break; } /* clang-format on */ unsigned long tag_value_UL; errno = 0; if(!*tcl_pos || ((tag_value_UL = strtoul(tcl_pos, 0, 10)) > UINT_MAX) || errno) { fprintf(stderr, "%s: Invalid tag value (%c) at line %d\n", fname, *tcl_pos, lineno); exit(EX_DATAERR); } else { tag_value = tag_value_UL; } tlv_tag = ((tag_value << 2) | tag_class); ret = ber_tlv_tag_serialize(tlv_tag, buf, sizeof(buf)); assert(ret >= 1 && (size_t)ret < sizeof(buf)); if(constr == 2) { buf[ret] = 0x80; ret += 1; } else { ret += der_tlv_length_serialize(tlv_len, buf + ret, sizeof(buf) - ret); assert(ret >= 2 && (size_t)ret < sizeof(buf)); } if(opt_tl_len && ret != opt_tl_len) { fprintf(stderr, "%s: Cannot encode TL at line %d " "in the given number of bytes (%ld!=%ld)\n", fname, lineno, (long)ret, (long)opt_tl_len); exit(EX_DATAERR); } if(constr) *buf |= 0x20; /* Enable "constructed" bit */ fwrite(buf, 1, ret, stdout); if(!constr) { ber_tlv_len_t len; for(len = 0, cl++; *cl && *cl != '<'; cl++, len++) { unsigned char v; int h; if(*cl != '&') { fputc(*cl, stdout); continue; } cl++; if(*cl != '#') { fputc(*cl, stdout); continue; } cl++; if(*cl != 'x') { fprintf(stderr, "%s: Expected \"&#xNN;\" at line %d\n", fname, lineno); exit(EX_DATAERR); } for(v = 0, h = 0; h < 2; h++) { unsigned char clv = *++cl; v <<= 4; /* clang-format off */ switch(clv) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': v |= clv - '0'; break; case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': v |= clv - 'A' + 10; break; case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': v |= clv - 'a' + 10; break; default: fprintf(stderr, "%s: Expected \"&#xNN;\" at line %d (%c)\n", fname, lineno, clv); exit(EX_DATAERR); } /* clang-format on */ } cl++; if(*cl != ';') { fprintf(stderr, "%s: Expected \"&#xNN;\" at line %d\n", fname, lineno); exit(EX_DATAERR); } fputc(v, stdout); } if(len != tlv_len) { if(no_validation) fprintf(stderr, "Warning: "); fprintf(stderr, "%s: Could not encode value of %ld chars " "at line %d in %ld bytes\n", fname, (long)len, lineno, (long)tlv_len); if(!no_validation) exit(EX_DATAERR); } } return 0; } asn1c-0.9.28+dfsg/asn1c/asn1c.c0000644000000000000000000004104413065714043014420 0ustar rootroot/*- * Copyright (c) 2003-2016 * Lev Walkin . All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $Id$ */ /* * This is the program that connects the libasn1* libraries together. * It uses them in turn to parse, fix and then compile or print the ASN.1 tree. */ #include "sys-common.h" #undef COPYRIGHT #define COPYRIGHT "Copyright (c) 2003-2016 Lev Walkin \n" #include /* Parse the ASN.1 file and build a tree */ #include /* Fix the ASN.1 tree */ #include /* Print the ASN.1 tree */ #include /* Compile the ASN.1 tree */ #include /* Portable basename(3) and dirname(3) */ #ifdef _WIN32 #include #include #else #include #endif static void usage(const char *av0); /* Print the Usage screen and exit */ static int importStandardModules(asn1p_t *asn, const char *skeletons_dir); int main(int ac, char **av) { enum asn1p_flags asn1_parser_flags = A1P_NOFLAGS; enum asn1f_flags asn1_fixer_flags = A1F_NOFLAGS; enum asn1c_flags asn1_compiler_flags = A1C_NO_C99; enum asn1print_flags asn1_printer_flags = APF_NOFLAGS; int print_arg__print_out = 0; /* Don't compile, just print parsed */ int print_arg__fix_n_print = 0; /* Fix and print */ int warnings_as_errors = 0; /* Treat warnings as errors */ char *skeletons_dir = NULL; /* Directory with supplementary stuff */ asn1p_t *asn = 0; /* An ASN.1 parsed tree */ int ret; /* Return value from misc functions */ int ch; /* Command line character */ int i; /* Index in some loops */ /* * Process command-line options. */ while((ch = getopt(ac, av, "EFf:g:hLPp:RS:vW:X")) != -1) switch(ch) { case 'E': print_arg__print_out = 1; break; case 'F': print_arg__fix_n_print = 1; break; case 'f': if(strcmp(optarg, "all-defs-global") == 0) { asn1_compiler_flags |= A1C_ALL_DEFS_GLOBAL; } else if(strcmp(optarg, "bless-SIZE") == 0) { asn1_fixer_flags |= A1F_EXTENDED_SizeConstraint; } else if(strcmp(optarg, "compound-names") == 0) { asn1_compiler_flags |= A1C_COMPOUND_NAMES; } else if(strcmp(optarg, "indirect-choice") == 0) { asn1_compiler_flags |= A1C_INDIRECT_CHOICE; } else if(strncmp(optarg, "known-extern-type=", 18) == 0) { char *known_type = optarg + 18; ret = asn1f_make_known_external_type(known_type); assert(ret == 0 || errno == EEXIST); } else if(strcmp(optarg, "native-types") == 0) { fprintf(stderr, "-f%s: Deprecated option\n", optarg); asn1_compiler_flags &= ~A1C_USE_WIDE_TYPES; } else if(strcmp(optarg, "wide-types") == 0) { asn1_compiler_flags |= A1C_USE_WIDE_TYPES; } else if(strcmp(optarg, "line-refs") == 0) { asn1_compiler_flags |= A1C_LINE_REFS; } else if(strcmp(optarg, "no-constraints") == 0) { asn1_compiler_flags |= A1C_NO_CONSTRAINTS; } else if(strcmp(optarg, "no-include-deps") == 0) { asn1_compiler_flags |= A1C_NO_INCLUDE_DEPS; } else if(strcmp(optarg, "includes-quoted") == 0) { asn1_compiler_flags |= A1C_INCLUDES_QUOTED; } else if(strcmp(optarg, "unnamed-unions") == 0) { asn1_compiler_flags |= A1C_UNNAMED_UNIONS; } else if(strcmp(optarg, "skeletons-copy") == 0) { fprintf(stderr, "-f%s: Deprecated option\n", optarg); asn1_compiler_flags &= ~A1C_LINK_SKELETONS; } else if(strcmp(optarg, "link-skeletons") == 0) { asn1_compiler_flags |= A1C_LINK_SKELETONS; } else { fprintf(stderr, "-f%s: Invalid argument\n", optarg); exit(EX_USAGE); } break; case 'g': if(strcmp(optarg, "en-PER") == 0) { asn1_compiler_flags |= A1C_GEN_PER; } else { fprintf(stderr, "-g%s: Invalid argument\n", optarg); exit(EX_USAGE); } break; case 'h': usage(av[0]); case 'P': asn1_compiler_flags |= A1C_PRINT_COMPILED; asn1_compiler_flags &= ~A1C_NO_C99; break; case 'p': if(strncmp(optarg, "du=", 3) == 0) { char *pduname = optarg + 3; if(strcmp(pduname, "all") == 0) { asn1_compiler_flags |= A1C_PDU_ALL; } else if(strcmp(pduname, "auto") == 0) { asn1_compiler_flags |= A1C_PDU_AUTO; } else if(pduname[0] >= 'A' && pduname[0] <= 'Z') { asn1c__add_pdu_type(pduname); asn1_compiler_flags |= A1C_PDU_TYPE; } else { fprintf(stderr, "-pdu=%s: expected -pdu={all|auto|Type}\n", pduname); exit(EX_USAGE); } } else if(strcmp(optarg, "rint-class-matrix") == 0) { asn1_printer_flags |= APF_PRINT_CLASS_MATRIX; } else if(strcmp(optarg, "rint-constraints") == 0) { asn1_printer_flags |= APF_PRINT_CONSTRAINTS; } else if(strcmp(optarg, "rint-lines") == 0) { asn1_printer_flags |= APF_LINE_COMMENTS; } else { fprintf(stderr, "-p%s: Invalid argument\n", optarg); exit(EX_USAGE); } break; case 'R': asn1_compiler_flags |= A1C_OMIT_SUPPORT_CODE; break; case 'S': skeletons_dir = optarg; break; case 'v': fprintf(stderr, "ASN.1 Compiler, v" VERSION "\n" COPYRIGHT); exit(0); break; case 'W': if(strcmp(optarg, "error") == 0) { warnings_as_errors = 1; break; } else if(strcmp(optarg, "debug-lexer") == 0) { asn1_parser_flags |= A1P_LEXER_DEBUG; break; } else if(strcmp(optarg, "debug-fixer") == 0) { asn1_fixer_flags |= A1F_DEBUG; break; } else if(strcmp(optarg, "debug-compiler") == 0) { asn1_compiler_flags |= A1C_DEBUG; break; } else { fprintf(stderr, "-W%s: Invalid argument\n", optarg); exit(EX_USAGE); } break; case 'X': print_arg__print_out = 1; /* Implicit -E */ print_arg__fix_n_print = 1; /* Implicit -F */ asn1_printer_flags |= APF_PRINT_XML_DTD; break; default: usage(av[0]); } /* * Validate the options combination. */ if(!print_arg__print_out) { if(print_arg__fix_n_print) { fprintf(stderr, "Error: -F requires -E\n"); exit(EX_USAGE); } if(asn1_printer_flags) { fprintf(stderr, "Error: -print-... arguments require -E\n"); exit(EX_USAGE); } } /* * Ensure that there are some input files present. */ if(ac > optind) { ac -= optind; av += optind; } else { char *bin_name = a1c_basename(av[0]); fprintf(stderr, "%s: No input files specified. " "Try '%s -h' for more information\n", bin_name, bin_name); exit(1); } /* * Make sure the skeleton directory is out there. */ if(skeletons_dir == NULL) { struct stat sb; skeletons_dir = DATADIR; if((av[-optind][0] == '.' || av[-optind][1] == '/') && stat(skeletons_dir, &sb)) { /* * The default skeletons directory does not exist, * compute it from my file name: * ./asn1c/asn1c -> ./skeletons */ char *p; size_t len; p = a1c_dirname(av[-optind]); len = strlen(p) + sizeof("/../skeletons"); skeletons_dir = malloc(len); assert(skeletons_dir); snprintf(skeletons_dir, len, "%s/../skeletons", p); if(stat(skeletons_dir, &sb)) { fprintf(stderr, "WARNING: skeletons are neither in " "\"%s\" nor in \"%s\"!\n", DATADIR, skeletons_dir); if(warnings_as_errors) exit(EX_OSFILE); } } } /* * Iterate over input files and parse each. * All syntax trees from all files will be bundled together. */ for(i = 0; i < ac; i++) { asn1p_t *new_asn; new_asn = asn1p_parse_file(av[i], asn1_parser_flags); if(new_asn == NULL) { fprintf(stderr, "Cannot parse \"%s\"\n", av[i]); exit(EX_DATAERR); } /* * Bundle the parsed tree with existing one. */ if(asn) { asn1p_module_t *mod; while((mod = TQ_REMOVE(&(new_asn->modules), mod_next))) TQ_ADD(&(asn->modules), mod, mod_next); asn1p_delete(new_asn); } else { asn = new_asn; } } /* These are mostly notes for the human readers */ assert(asn); assert(skeletons_dir); /* * Dump the parsed ASN.1 tree if -E specified and -F is NOT given. */ if(print_arg__print_out && !print_arg__fix_n_print) { if(asn1print(asn, asn1_printer_flags)) exit(EX_SOFTWARE); return 0; } /* * Read in the files from skeletons/standard-modules */ if(importStandardModules(asn, skeletons_dir)) { if(warnings_as_errors) exit(EX_DATAERR); } /* * Process the ASN.1 specification: perform semantic checks, * expand references, etc, etc. * This function will emit necessary warnings and error messages. */ ret = asn1f_process(asn, asn1_fixer_flags, NULL /* default fprintf(stderr) */); switch(ret) { case 1: if(!warnings_as_errors) /* Fall through */ case 0: break; /* All clear */ case -1: exit(EX_DATAERR); /* Fatal failure */ } /* * Dump the parsed ASN.1 tree if -E specified and -F is given. */ if(print_arg__print_out && print_arg__fix_n_print) { if(asn1print(asn, asn1_printer_flags)) exit(EX_SOFTWARE); return 0; } /* * Compile the ASN.1 tree into a set of source files * of another language. */ if(asn1_compile(asn, skeletons_dir, asn1_compiler_flags, ac + optind, optind, av - optind)) { exit(EX_SOFTWARE); } return 0; } /* * Parse and import *.asn1 from skeletons/standard-modules */ static int importStandardModules(asn1p_t *asn, const char *skeletons_dir) { asn1p_t *new_asn; asn1p_module_t *mod; const char *filename; char *fullname; char *target_dir; int target_dir_len; int len; #ifdef _WIN32 intptr_t dir; struct _finddata_t c_file; char *pattern; #else struct dirent *dp; DIR *dir; #endif int ret = 0; /* Notes for the human reader */ assert(asn); assert(skeletons_dir); /* * Figure out the standard-modules directory. */ target_dir_len = strlen(skeletons_dir) + sizeof("/standard-modules") - 1; target_dir = malloc(target_dir_len + 1); assert(target_dir); snprintf(target_dir, target_dir_len + 1, "%s/standard-modules", skeletons_dir); #ifdef _WIN32 len = target_dir_len + sizeof("/*.asn1"); pattern = malloc(len); assert(pattern); snprintf(pattern, len, "%s/*.asn1", target_dir); dir = _findfirst(pattern, &c_file); if(dir == -1L) { #else dir = opendir(target_dir); if(!dir) { #endif fprintf(stderr, "WARNING: Cannot find standard modules in %s\n", target_dir); return -1; } #ifdef _WIN32 do { filename = c_file.name; #else while((dp = readdir(dir))) { filename = dp->d_name; #endif len = strlen(filename); if(len <= 5 || strcmp(filename + len - 5, ".asn1")) continue; len = target_dir_len + 1 + len + 1; fullname = malloc(len); if(!fullname) continue; /* Just skip it, no big deal */ snprintf(fullname, len, "%s/%s", target_dir, filename); filename = fullname; new_asn = asn1p_parse_file(filename, A1P_NOFLAGS); if(new_asn == NULL) { fprintf(stderr, "WARNING: Cannot parse standard module \"%s\"\n", filename); ret = -1; continue; } /* Import these modules and mark them as "standard" */ while((mod = TQ_REMOVE(&(new_asn->modules), mod_next))) { mod->_tags |= MT_STANDARD_MODULE; TQ_ADD(&(asn->modules), mod, mod_next); } asn1p_delete(new_asn); #ifdef _WIN32 } while(_findnext(dir, &c_file) == 0); _findclose(dir); #else free(fullname); } /* while(readdir()) */ closedir(dir); #endif return ret; } /* * Print the usage screen and exit(EX_USAGE). */ static void usage(const char *av0) { /* clang-format off */ fprintf(stderr, "ASN.1 Compiler, v" VERSION "\n" COPYRIGHT "Usage: %s [options] file ...\n" "Options:\n" " -E Run only the ASN.1 parser and print out the tree\n" " -F During -E operation, also perform tree fixing\n" "\n" " -P Concatenate and print the compiled text\n" " -R Restrict output (tables only, no support code)\n" " -S
Directory with support (skeleton?) files\n" " (Default is \"%s\")\n" " -X Generate and print the XML DTD\n" "\n" " -Werror Treat warnings as errors; abort if any warning\n" " -Wdebug-lexer Enable verbose debugging output from lexer\n" " -Wdebug-fixer --//-- semantics processor\n" " -Wdebug-compiler --//-- compiler\n" "\n" " -fbless-SIZE Allow SIZE() constraint for INTEGER etc (non-std.)\n" " -fcompound-names Disambiguate C's struct NAME's inside top-level types\n" " -findirect-choice Compile members of CHOICE as indirect pointers\n" " -fincludes-quoted Generate #includes in \"double\" instead of quotes\n" " -fknown-extern-type= Pretend the specified type is known\n" " -fline-refs Include ASN.1 module's line numbers in comments\n" " -fno-constraints Do not generate constraint checking code\n" " -fno-include-deps Do not generate courtesy #includes for dependencies\n" " -funnamed-unions Enable unnamed unions in structures\n" " -fwide-types Use INTEGER_t instead of \"long\" by default, etc.\n" "\n" " -gen-PER Generate PER support code\n" " -pdu={all|auto|Type} Generate PDU table (discover PDUs automatically)\n" "\n" " -print-class-matrix Print out the collected object class matrix (debug)\n" " -print-constraints Explain subtype constraints (debug)\n" " -print-lines Generate \"-- #line\" comments in -E output\n" , a1c_basename(av0), DATADIR); /* clang-format on */ exit(EX_USAGE); } asn1c-0.9.28+dfsg/asn1c/README0000644000000000000000000000014713065714043014126 0ustar rootrootasn1c - The ASN.1 Compiler unber - The ASN.1 BER Decoder enber - Reverse unber(1) output back into BER asn1c-0.9.28+dfsg/asn1c/tests/0000755000000000000000000000000013065714043014406 5ustar rootrootasn1c-0.9.28+dfsg/asn1c/tests/check-src/0000755000000000000000000000000013065714043016250 5ustar rootrootasn1c-0.9.28+dfsg/asn1c/tests/check-src/check-41.c0000644000000000000000000001221613065714043017715 0ustar rootroot#undef NDEBUG #include #include #include #include #include #include uint8_t buf1[] = { 32 | (2 << 6), /* [0], constructed */ 25, /* L */ /* string [0] IMPLICIT UTF8String, */ (2 << 6), /* [0] */ 16, /* L */ 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', /* beta [2] IMPLICIT INTEGER OPTIONAL */ (2 << 6) + 2, /* [2] */ 5, /* L */ 0, 75, 0x4b, 75, 75, }; uint8_t buf1_reconstr[] = { 32 | (2 << 6), /* [0], constructed */ 24, /* L */ /* string [0] IMPLICIT UTF8String, */ (2 << 6), /* [0] */ 16, /* L */ 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', /* beta [2] IMPLICIT INTEGER OPTIONAL */ (2 << 6) + 2, /* [2] */ 4, /* L */ 75, 75, 75, 0x4b, }; static void check(T_t *tp, uint8_t *buf, size_t size, size_t consumed) { asn_dec_rval_t rval; tp = memset(tp, 0, sizeof(*tp)); fprintf(stderr, "Buf %p (%zd)\n", buf, size); rval = ber_decode(0, &asn_DEF_T, (void **)&tp, buf, size); fprintf(stderr, "Returned code %d, consumed %zd\n", (int)rval.code, rval.consumed); assert(rval.code == RC_OK); assert(rval.consumed == consumed); assert(tp->choice.seq.string.size == 16); assert(strcmp((char *)tp->choice.seq.string.buf, "zzzzzzzzzzzzzzzz") == 0); assert(tp->choice.seq.alpha == NULL); assert(tp->choice.seq.beta); assert(*tp->choice.seq.beta == 0x4b4b4b4b); } size_t buf_pos; size_t buf_size; uint8_t *buf; static int buf_fill(const void *buffer, size_t size, void *app_key) { (void)app_key; /* Unused argument */ if(buf_pos + size > buf_size) { fprintf(stderr, "%zd + %zd > %zd\n", buf_pos, size, buf_size); return -1; } memcpy(buf + buf_pos, buffer, size); buf_pos += size; fprintf(stderr, " written %zd (%zd)\n", size, buf_pos); return 0; } static void compare(T_t *tp, uint8_t *cmp_buf, int cmp_buf_size) { asn_enc_rval_t erval; int i; buf_size = cmp_buf_size + 100; buf = alloca(buf_size); buf_pos = 0; /* * Try to re-create using DER encoding. */ erval = der_encode(&asn_DEF_T, tp, buf_fill, 0); assert(erval.encoded != -1); if(erval.encoded != cmp_buf_size) { printf("%zd != %zd\n", erval.encoded, cmp_buf_size); } assert(erval.encoded == cmp_buf_size); for(i = 0; i < cmp_buf_size; i++) { if(buf[i] != cmp_buf[i]) { fprintf(stderr, "Recreated buffer content mismatch:\n"); fprintf(stderr, "Byte %d, %x != %x (%d != %d)\n", i, buf[i], cmp_buf[i], buf[i], cmp_buf[i] ); } assert(buf[i] == cmp_buf[i]); } } static void partial_read(uint8_t *buf_0, size_t size) { T_t t, *tp; asn_dec_rval_t rval; size_t i1, i2; uint8_t *buf_1 = alloca(size); uint8_t *buf_2 = alloca(size); uint8_t *buf_3 = alloca(size); fprintf(stderr, "\nPartial read sequence...\n"); /* * Divide the space (size) into three blocks in various combinations: * |<----->i1<----->i2<----->| * ^ buf_0 ^ buf_0+size * Try to read block by block. */ for(i1 = 0; i1 < size; i1++) { for(i2 = i1; i2 < size; i2++) { uint8_t *chunk1 = buf_0; size_t size1 = i1; uint8_t *chunk2 = buf_0 + size1; size_t size2 = i2 - i1; uint8_t *chunk3 = buf_0 + size1 + size2; size_t size3 = size - size1 - size2; fprintf(stderr, "\n%zd:{%zd, %zd, %zd}...\n", size, size1, size2, size3); memset(buf_1, 0, size); memset(buf_2, 0, size); memset(buf_3, 0, size); memcpy(buf_1, chunk1, size1); memcpy(buf_2, chunk2, size2); memcpy(buf_3, chunk3, size3); tp = memset(&t, 0, sizeof(t)); fprintf(stderr, "=> Chunk 1 (%zd):\n", size1); rval = ber_decode(0, &asn_DEF_T, (void **)&tp, buf_1, size1); assert(rval.code == RC_WMORE); assert(rval.consumed <= size1); if(rval.consumed < size1) { int leftover = size1 - rval.consumed; memcpy(buf_2, buf_1 + rval.consumed, leftover); memcpy(buf_2 + leftover, chunk2, size2); size2 += leftover; } fprintf(stderr, "=> Chunk 2 (%zd):\n", size2); rval = ber_decode(0, &asn_DEF_T, (void **)&tp, buf_2, size2); assert(rval.code == RC_WMORE); assert(rval.consumed <= size2); if(rval.consumed < size2) { int leftover = size2 - rval.consumed; memcpy(buf_3, buf_2 + rval.consumed, leftover); memcpy(buf_3 + leftover, chunk3, size3); size3 += leftover; } fprintf(stderr, "=> Chunk 3 (%zd):\n", size3); rval = ber_decode(0, &asn_DEF_T, (void **)&tp, buf_3, size3); assert(rval.code == RC_OK); assert(rval.consumed == size3); asn_DEF_T.free_struct(&asn_DEF_T, &t, 1); } } } int main(int ac, char **av) { T_t t; (void)ac; /* Unused argument */ (void)av; /* Unused argument */ /* Check exact buf1 */ check(&t, buf1, sizeof(buf1), sizeof(buf1)); compare(&t, buf1_reconstr, sizeof(buf1_reconstr)); asn_fprint(stderr, &asn_DEF_T, &t); asn_DEF_T.free_struct(&asn_DEF_T, &t, 1); /* Check slightly more than buf1 */ check(&t, buf1, sizeof(buf1) + 10, sizeof(buf1)); compare(&t, buf1_reconstr, sizeof(buf1_reconstr)); asn_fprint(stderr, &asn_DEF_T, &t); asn_DEF_T.free_struct(&asn_DEF_T, &t, 1); /* Split the buffer in parts and check decoder restartability */ partial_read(buf1, sizeof(buf1)); return 0; } asn1c-0.9.28+dfsg/asn1c/tests/check-src/check-131.-gen-PER.c0000644000000000000000000000273213065714043021250 0ustar rootroot#undef NDEBUG #include #include #include #include #include #include "T.h" #include "per_opentype.h" int main() { asn_per_data_t pd; asn_per_outp_t po; asn_dec_rval_t rv; T_t t; T_t *t2 = 0; size_t i; memset(&po, 0, sizeof po); po.buffer = po.tmpspace; po.nbits = sizeof(po.tmpspace) * 8; memset(&t, 0, sizeof t); printf("Checking uper_open_type_put():\n"); assert(0 == uper_open_type_put(&asn_DEF_T, 0, &t, &po)); assert(po.nbits == (-1 + sizeof(po.tmpspace)) * 8); printf("po{nboff=%zd; nbits=%zd; buffer=%p; tmpspace=%p}\n", po.nboff, po.nbits, po.buffer, po.tmpspace); /* One byte length and one byte 0x00 */ assert( (po.nboff == 8 && po.buffer == &po.tmpspace[1]) || (po.nboff == 0 && po.buffer == &po.tmpspace[2])); assert(po.tmpspace[0] == 0x01); assert(po.tmpspace[1] == 0x00); printf("\nChecking uper_open_type_get():\n"); for(i = 0; i < 16; i++) { FREEMEM(t2); t2 = 0; memset(&pd, 0, sizeof pd); pd.buffer = po.tmpspace; pd.nboff = 0; pd.nbits = i; rv = uper_open_type_get(0, &asn_DEF_T, 0, (void **)&t2, &pd); assert(rv.code == RC_WMORE); } memset(&pd, 0, sizeof pd); pd.buffer = po.tmpspace; pd.nboff = 0; pd.nbits = 16; rv = uper_open_type_get(0, &asn_DEF_T, 0, (void **)&t2, &pd); assert(rv.code == RC_OK); assert( (pd.nboff == 8 && pd.buffer == &po.tmpspace[1]) || (pd.nboff == 16 && pd.buffer == &po.tmpspace[0])); assert(pd.nboff + pd.nbits == 16); return 0; } asn1c-0.9.28+dfsg/asn1c/tests/check-src/check-42.c0000644000000000000000000000571613065714043017725 0ustar rootroot#undef NDEBUG #include #include #include #include #include #include uint8_t buf0[] = { 48, /* LogLine SEQUENCE */ 24, /* L */ 22, /* IA5String */ 4, /* L */ /* "zzz\007" */ 122, 122, 122, 7, 48, /* varsets SEQUENCE OF VariablePartSet */ 16, /* L */ 48, /* VariablePart */ 14, /* L */ 48, /* vparts SEQUENCE OF VariablePart */ 7, /* L */ 49, /* VariablePart */ 5, 26, /* VisibleString */ 3, 49, 50, 51, /* 1 2 3 */ 48, /* ActionItem SEQUENCE */ 3, /* L */ 10, /* accept-as ENUMERATED */ 1, /* L */ 0, }; uint8_t buf1[] = { 48, /* LogLine SEQUENCE */ 19, /* L */ 22, /* IA5String */ 6, /* L */ /* "static" */ 115, 116, 97, 116, 105, 99, 48, /* varsets SEQUENCE OF VariablePartSet */ 9, /* L */ 48, /* VariablePart */ 7, /* L */ 48, /* vparts SEQUENCE OF VariablePart */ 0, /* L */ 48, /* ActionItem SEQUENCE */ 3, /* L */ 10, /* accept-as ENUMERATED */ 1, /* L */ 0, }; static void check(LogLine_t *tp, uint8_t *ptr, size_t size, size_t consumed) { asn_dec_rval_t rval; tp = memset(tp, 0, sizeof(*tp)); fprintf(stderr, "Buf %p (%zd)\n", ptr, size); rval = ber_decode(0, &asn_DEF_LogLine, (void **)&tp, ptr, size); fprintf(stderr, "Returned code %d, consumed %zd\n", (int)rval.code, rval.consumed); assert(rval.code == RC_OK); assert(rval.consumed == consumed); asn_fprint(stderr, &asn_DEF_LogLine, tp); asn_DEF_LogLine.free_struct(&asn_DEF_LogLine, tp, 1); } uint8_t *buf; uint8_t buf_size; uint8_t buf_pos; static int buf_fill(const void *buffer, size_t size, void *app_key) { (void)app_key; /* Unused argument */ assert(buf_pos + size <= buf_size); memcpy(buf + buf_pos, buffer, size); buf_pos += size; return 0; } static void check_serialize() { LogLine_t ll; VariablePartSet_t vps; VariablePart_t vp; VisibleString_t vpart; asn_enc_rval_t erval; int i; memset(&ll, 0, sizeof(ll)); memset(&vps, 0, sizeof(vps)); memset(&vp, 0, sizeof(vp)); memset(&vpart, 0, sizeof(vpart)); vpart.buf = (uint8_t *)"123"; vpart.size = 3; vp.present = VariablePart_PR_vset; ASN_SET_ADD(&vp.choice.vset, &vpart); vps.resolution.accept_as = accept_as_unknown; ASN_SEQUENCE_ADD(&vps.vparts, &vp); ASN_SEQUENCE_ADD(&ll.varsets, &vps); ll.line_digest.buf = (uint8_t *)"zzz\007"; ll.line_digest.size = 4; asn_fprint(stderr, &asn_DEF_LogLine, &ll); buf_size = 128; buf = alloca(buf_size); erval = der_encode(&asn_DEF_LogLine, &ll, buf_fill, 0); assert(erval.encoded > 1); fprintf(stderr, "Encoded in %zd bytes\n", erval.encoded); fprintf(stderr, "\n"); for(i = 0; i < buf_pos; i++) { fprintf(stderr, "%d ", buf[i]); } fprintf(stderr, "\n\n"); assert(erval.encoded == sizeof(buf0)); assert(memcmp(buf0, buf, sizeof(buf0)) == 0); } int main(int ac, char **av) { LogLine_t t; (void)ac; /* Unused argument */ (void)av; /* Unused argument */ check_serialize(); check(&t, buf0, sizeof(buf0), sizeof(buf0)); check(&t, buf1, sizeof(buf1), sizeof(buf1)); return 0; } asn1c-0.9.28+dfsg/asn1c/tests/check-src/Makefile.am0000644000000000000000000000004313065714043020301 0ustar rootroot EXTRA_DIST = $(srcdir)/check-*.c asn1c-0.9.28+dfsg/asn1c/tests/check-src/check-30.-fwide-types.c0000644000000000000000000001202513065714043022225 0ustar rootroot#undef NDEBUG #include #include #include #include #include #include /* * Test that the optional member (c) is really optional. */ uint8_t buf1[] = { 32 | 17, /* [UNIVERSAL 17], constructed */ 8, /* L */ /* a INTEGER */ 64 | 3, /* [APPLICATION 3] */ 1, /* L */ 96, /* b IA5String */ 22, /* [UNIVERSAL 22] */ 3, /* L */ 'x', 'y', 'z' }; /* * This buffer aims at checking the duplication. */ uint8_t buf2[] = { 32 | 17, /* [UNIVERSAL 17], constructed */ 8, /* L */ /* a INTEGER */ 64 | 3, /* [APPLICATION 3] */ 1, /* L */ 96, /* a INTEGER _again_ */ 64 | 3, /* [APPLICATION 3] */ 1, /* L */ 97, }; /* * This buffer checks that an unexpected member may be properly ignored. */ uint8_t buf3[] = { 32 | 17, /* [UNIVERSAL 17], constructed */ 14, /* L */ /* INTEGER */ 64 | 3, /* [APPLICATION 3] */ 1, /* L */ 96, /* IA5String */ 22, /* [UNIVERSAL 22] */ 3, /* L */ 'x', 'y', 'z', /* unexpected INTEGER */ 64 | 4, /* [APPLICATION 4] */ 1, /* L */ 96, /* [2] BOOLEAN */ ((2 << 6) + 2), /* [2] */ 1, /* L */ 0xff }; /* * This buffer checks that an unexpected member may be properly ignored. * This time, with indefinite length encoding. */ uint8_t buf4[] = { 32 | 17, /* [UNIVERSAL 17], constructed */ 16, /* L */ /* a INTEGER */ 64 | 3, /* [APPLICATION 3] */ 1, /* L */ 96, /* b IA5String */ 22, /* [UNIVERSAL 22] */ 3, /* L */ 'x', 'y', 'z', /* unexpected data structure */ 32 | 64 | 4, /* [APPLICATION 4] */ 0x80, /* indefinite L */ 64 | 1, /* [APPLICATION 1] */ 2, /* L */ 'a', 'b', 0x00, 0x00 }; /* * This buffer checks that an unexpected member may be properly ignored. * This time, with indefinite length encoding at the outer level too. */ uint8_t buf5[] = { 32 | 17, /* [UNIVERSAL 17], constructed */ 0x80, /* indefinite L */ /* INTEGER */ 64 | 3, /* [APPLICATION 3] */ 1, /* L */ 96, /* IA5String */ 22, /* [UNIVERSAL 22] */ 3, /* L */ 'x', 'y', 'z', /* unexpected data structure */ 32 | 64 | 4, /* [APPLICATION 4] */ 0x80, /* indefinite L */ 64 | 1, /* [APPLICATION 1] */ 2, /* L */ 'a', 'b', 0x00, 0x00, 0x00, 0x00 }; static void check(int is_ok, uint8_t *buf, size_t size, size_t consumed) { T_t t, *tp; asn_dec_rval_t rval; fprintf(stderr, "\nMust %s:\n", is_ok?"suceed":"fail"); tp = memset(&t, 0, sizeof(t)); fprintf(stderr, "Buf %p\n", buf); rval = ber_decode(0, &asn_DEF_T, (void **)&tp, buf, size); fprintf(stderr, "Returned code %d, consumed %zd (out of %zd)\n", (int)rval.code, rval.consumed, size); if(is_ok) { assert(rval.code == RC_OK); assert(rval.consumed == consumed); assert(t.i.size == 1); assert(t.i.buf[0] == 96); assert(t.s.size == 3); assert(strcmp((char *)t.s.buf, "xyz") == 0); if(buf == buf3) { assert(t.b); } else { assert(t.b == 0); } } else { if(rval.code == RC_OK) { assert(t.i.size != 1 || t.s.size != 3 || !t.b ); } assert(rval.consumed <= consumed); } } static char xer_buf[128]; static int xer_off; static int xer_cb(const void *buffer, size_t size, void *key) { (void)key; assert(xer_off + size < sizeof(xer_buf)); memcpy(xer_buf + xer_off, buffer, size); xer_off += size; return 0; } static void check_xer(uint8_t *buf, uint8_t size, char *xer_sample) { T_t *tp = 0; asn_dec_rval_t rval; asn_enc_rval_t er; int xer_sample_len = strlen(xer_sample); rval = ber_decode(0, &asn_DEF_T, (void **)&tp, buf, size); assert(rval.code == RC_OK); assert(rval.consumed == size); assert(tp); xer_off = 0; er = xer_encode(&asn_DEF_T, tp, XER_F_CANONICAL, xer_cb, 0); assert(er.encoded == xer_off); assert(xer_off); xer_buf[xer_off] = 0; printf("[%s] vs [%s]\n", xer_buf, xer_sample); assert(xer_off == xer_sample_len); assert(memcmp(xer_buf, xer_sample, xer_off) == 0); } static void try_corrupt(uint8_t *buf, size_t size) { uint8_t *tmp; int i; fprintf(stderr, "\nCorrupting...\n"); tmp = alloca(size); for(i = 0; i < 1000; i++) { int loc; memcpy(tmp, buf, size); /* Corrupt random _non-value_ location. */ do { loc = random() % size; } while(tmp[loc] >= 70); do { tmp[loc] = buf[loc] ^ random(); } while( (tmp[loc] == buf[loc]) || (buf[loc] == 0 && tmp[loc] == 0x80)); fprintf(stderr, "\nTry %d: corrupting byte %d (%d->%d)\n", i, loc, buf[loc], tmp[loc]); check(0, tmp, size, size); } } int main(int ac, char **av) { (void)ac; /* Unused argument */ (void)av; /* Unused argument */ check(1, buf1, sizeof(buf1) + 20, sizeof(buf1)); check(0, buf2, sizeof(buf2) + 1, 5); check(1, buf3, sizeof(buf3) + 1, sizeof(buf3)); check(1, buf4, sizeof(buf4), sizeof(buf4)); check(1, buf5, sizeof(buf5), sizeof(buf5)); check(1, buf5, sizeof(buf5) + 1, sizeof(buf5)); check(0, buf5, sizeof(buf5) - 1, sizeof(buf5)); check_xer(buf1, sizeof(buf1), "xyz96"); check_xer(buf3, sizeof(buf3), "xyz96"); fprintf(stderr, "\nPseudo-random buffer corruptions must fail\n"); try_corrupt(buf1, sizeof(buf1)); return 0; } asn1c-0.9.28+dfsg/asn1c/tests/check-src/check-35.c0000644000000000000000000001601313065714043017717 0ustar rootroot#undef NDEBUG #include #include #include #include #include #include uint8_t buf1[] = { 32 | 17, /* [UNIVERSAL 17], constructed */ 15, /* L */ /* b CHOICE { b2 ObjectDescriptor }*/ 7, /* [UNIVERSAL 7] */ 1, /* L */ 'z', /* c BOOLEAN */ 1, /* [UNIVERSAL 1] */ 0, /* L */ /* a NumericString */ 18, /* [UNIVERSAL 18] */ 4, /* L */ '=', '<', '&', '>', /* d.r-oid RELATIVE-OID */ 13, /* [UNIVERSAL 13] */ 2, /* L */ 85, 79, }; uint8_t buf1_reconstr[] = { 32 | 17, /* [UNIVERSAL 17], constructed */ 16, /* L */ /* c BOOLEAN */ 1, /* [UNIVERSAL 1] */ 1, /* L */ 0, /* b CHOICE { b2 ObjectDescriptor }*/ 7, /* [UNIVERSAL 7] */ 1, /* L */ 'z', /* d.r-oid RELATIVE-OID */ 13, /* [UNIVERSAL 1] */ 2, /* L */ 85, 79, /* a NumericString */ 18, /* [UNIVERSAL 18] */ 4, /* L */ '=', '<', '&', '>', }; uint8_t buf2[] = { 32 | 17, /* [UNIVERSAL 17], constructed */ 15, /* L */ /* a NumericString */ 18, /* [UNIVERSAL 18] */ 4, /* L */ '=', '<', '&', '>', /* c BOOLEAN */ 1, /* [UNIVERSAL 1] */ 1, /* L */ 2, /* True */ /* b CHOICE { b1 IA5String }*/ 22, /* [UNIVERSAL 22] */ 1, /* L */ 'z', /* d.oid RELATIVE-OID */ 6, /* [UNIVERSAL 6] */ 1, /* L */ 81, }; uint8_t buf2_reconstr[] = { 32 | 17, /* [UNIVERSAL 17], constructed */ 15, /* L */ /* c BOOLEAN */ 1, /* [UNIVERSAL 1] */ 1, /* L */ 0xff, /* Canonical True */ /* d.oid RELATIVE-OID */ 6, /* [UNIVERSAL 6] */ 1, /* L */ 81, /* a NumericString */ 18, /* [UNIVERSAL 18] */ 4, /* L */ '=', '<', '&', '>', /* b CHOICE { b1 IA5String }*/ 22, /* [UNIVERSAL 22] */ 1, /* L */ 'z' }; static void check(T_t *tp, uint8_t *buf, size_t size, size_t consumed) { asn_dec_rval_t rval; tp = memset(tp, 0, sizeof(*tp)); fprintf(stderr, "Buf %p (%zd)\n", buf, size); rval = ber_decode(0, &asn_DEF_T, (void **)&tp, buf, size); fprintf(stderr, "Returned code %d, consumed %zd\n", (int)rval.code, rval.consumed); assert(rval.code == RC_OK); assert(rval.consumed == consumed); assert(strcmp((char *)tp->a.buf, "=<&>") == 0); assert(strcmp((char *)tp->b.choice.b1.buf, "z") == 0 && strcmp((char *)tp->b.choice.b2.buf, "z") == 0); asn_fprint(stderr, &asn_DEF_T, tp); xer_fprint(stderr, &asn_DEF_T, tp); } size_t buf_pos; size_t buf_size; uint8_t *buf; static int buf_fill(const void *buffer, size_t size, void *app_key) { (void)app_key; if(buf_pos + size > buf_size) { fprintf(stderr, "%zd + %zd > %zd\n", buf_pos, size, buf_size); return -1; } memcpy(buf + buf_pos, buffer, size); buf_pos += size; fprintf(stderr, " written %zd (%zd)\n", size, buf_pos); return 0; } static void compare(T_t *tp, uint8_t *cmp_buf, size_t cmp_buf_size) { asn_enc_rval_t erval; size_t i; buf_size = cmp_buf_size + 100; buf = alloca(buf_size); buf_pos = 0; /* * Try to re-create using DER encoding. */ erval = der_encode(&asn_DEF_T, tp, buf_fill, 0); assert(erval.encoded != -1); if(erval.encoded != (ssize_t)cmp_buf_size) { printf("%zd != %zd\n", erval.encoded, cmp_buf_size); } assert(erval.encoded == (ssize_t)cmp_buf_size); for(i = 0; i < cmp_buf_size; i++) { if(buf[i] != cmp_buf[i]) { fprintf(stderr, "Recreated buffer content mismatch:\n"); fprintf(stderr, "Byte %d, %x != %x (%d != %d)\n", (int)i, buf[i], cmp_buf[i], buf[i], cmp_buf[i] ); } assert(buf[i] == cmp_buf[i]); } } static void partial_read(uint8_t *data, size_t size) { T_t t, *tp; asn_dec_rval_t rval; size_t i1, i2; uint8_t *data1 = alloca(size); uint8_t *data2 = alloca(size); uint8_t *data3 = alloca(size); fprintf(stderr, "\nPartial read sequence...\n"); /* * Divide the space (size) into three blocks in various combinations: * |<----->i1<----->i2<----->| * ^ data ^ data+size * Try to read block by block. */ for(i1 = 0; i1 < size; i1++) { for(i2 = i1; i2 < size; i2++) { uint8_t *chunk1 = data; size_t size1 = i1; uint8_t *chunk2 = data + size1; size_t size2 = i2 - i1; uint8_t *chunk3 = data + size1 + size2; size_t size3 = size - size1 - size2; fprintf(stderr, "\n%zd:{%zd, %zd, %zd}...\n", size, size1, size2, size3); memset(data1, 0, size); memset(data2, 0, size); memset(data3, 0, size); memcpy(data1, chunk1, size1); memcpy(data2, chunk2, size2); memcpy(data3, chunk3, size3); tp = memset(&t, 0, sizeof(t)); fprintf(stderr, "=> Chunk 1 (%zd):\n", size1); rval = ber_decode(0, &asn_DEF_T, (void **)&tp, data1, size1); assert(rval.code == RC_WMORE); assert(rval.consumed <= size1); if(rval.consumed < size1) { int leftover = size1 - rval.consumed; memcpy(data2, data1 + rval.consumed, leftover); memcpy(data2 + leftover, chunk2, size2); size2 += leftover; } fprintf(stderr, "=> Chunk 2 (%zd):\n", size2); rval = ber_decode(0, &asn_DEF_T, (void **)&tp, data2, size2); assert(rval.code == RC_WMORE); assert(rval.consumed <= size2); if(rval.consumed < size2) { int leftover = size2 - rval.consumed; memcpy(data3, data2 + rval.consumed, leftover); memcpy(data3 + leftover, chunk3, size3); size3 += leftover; } fprintf(stderr, "=> Chunk 3 (%zd):\n", size3); rval = ber_decode(0, &asn_DEF_T, (void **)&tp, data3, size3); assert(rval.code == RC_OK); assert(rval.consumed == size3); asn_DEF_T.free_struct(&asn_DEF_T, &t, 1); } } } static char xer_buf[128]; static size_t xer_off; static int xer_cb(const void *buffer, size_t size, void *key) { (void)key; assert(xer_off + size < sizeof(xer_buf)); memcpy(xer_buf + xer_off, buffer, size); xer_off += size; return 0; } static void check_xer(uint8_t *data, uint8_t size, char *xer_sample) { T_t *tp = 0; asn_dec_rval_t rval; asn_enc_rval_t er; size_t xer_sample_len = strlen(xer_sample); rval = ber_decode(0, &asn_DEF_T, (void **)&tp, data, size); assert(rval.code == RC_OK); assert(rval.consumed == size); assert(tp); xer_off = 0; er = xer_encode(&asn_DEF_T, tp, XER_F_CANONICAL, xer_cb, 0); assert(xer_off); xer_buf[xer_off] = 0; printf("[%s] (%zd/%zd) vs [%s] (%zd)\n", xer_buf, er.encoded, xer_off, xer_sample, xer_sample_len); assert(er.encoded == (ssize_t)xer_off); assert(xer_off == xer_sample_len); assert(memcmp(xer_buf, xer_sample, xer_off) == 0); } int main(int ac, char **av) { T_t t; (void)ac; /* Unused argument */ (void)av; /* Unused argument */ check(&t, buf1, sizeof(buf1) + 10, sizeof(buf1)); compare(&t, buf1_reconstr, sizeof(buf1_reconstr)); asn_DEF_T.free_struct(&asn_DEF_T, &t, 1); check_xer(buf1, sizeof(buf1), "z=<&>85.79"); check(&t, buf2, sizeof(buf2) + 10, sizeof(buf2)); compare(&t, buf2_reconstr, sizeof(buf2_reconstr)); asn_DEF_T.free_struct(&asn_DEF_T, &t, 1); check_xer(buf2, sizeof(buf2), "z=<&>2.1"); /* Split the buffer in parts and check decoder restartability */ partial_read(buf1, sizeof(buf1)); return 0; } asn1c-0.9.28+dfsg/asn1c/tests/check-src/check-33.c0000644000000000000000000000055013065714043017714 0ustar rootroot#undef NDEBUG #include #include #include #include #include #include int main(int ac, char **av) { T_t t; (void)ac; /* Unused argument */ (void)av; /* Unused argument */ memset(&t, 0, sizeof(t)); /* * No plans to fill it up: just checking whether it compiles or not. */ return 0; } asn1c-0.9.28+dfsg/asn1c/tests/check-src/check-92.-findirect-choice.c0000644000000000000000000000057213065714043023200 0ustar rootroot#undef NDEBUG #include #include #include #include #include #include int main(int ac, char **av) { Everything_t t; (void)ac; /* Unused argument */ (void)av; /* Unused argument */ memset(&t, 0, sizeof(t)); /* * No plans to fill it up: just checking whether it compiles or not. */ return 0; } asn1c-0.9.28+dfsg/asn1c/tests/check-src/check-119.-gen-PER.c0000644000000000000000000002160713065714043021260 0ustar rootroot/* * Mode of operation: * Each of the *.in files is XER-decoded, then converted into PER, * then decoded back from PER, then encoded into XER again, * and finally compared to the original encoding. */ #undef NDEBUG #include #include #include #include /* for chdir(2) */ #include #include #include #include #include #include #ifndef SRCDIR #define SRCDIR_S ".." #else #define STRINGIFY_MACRO2(x) #x #define STRINGIFY_MACRO(x) STRINGIFY_MACRO2(x) #define SRCDIR_S STRINGIFY_MACRO(SRCDIR) #endif enum expectation { EXP_OK, /* Encoding/decoding must succeed */ EXP_CXER_EXACT, /* Encoding/decoding using CXER must be exact */ EXP_CXER_DIFF, /* Encoding/decoding using CXER must be different */ EXP_BROKEN, /* Decoding must fail */ EXP_DIFFERENT, /* Reconstruction will yield different encoding */ EXP_PER_NOCOMP, /* Not PER compatible */ }; static unsigned char buf[4096]; static size_t buf_offset; static int _buf_writer(const void *buffer, size_t size, void *app_key) { unsigned char *b, *bend; (void)app_key; assert(buf_offset + size < sizeof(buf)); memcpy(buf + buf_offset, buffer, size); b = buf + buf_offset; bend = b + size; #ifdef EMIT_ASN_DEBUG fprintf(stderr, "=> ["); for(; b < bend; b++) { if(*b >= 32 && *b < 127 && *b != '%') fprintf(stderr, "%c", *b); else fprintf(stderr, "%%%02x", *b); } fprintf(stderr, "]:%zd\n", size); #endif buf_offset += size; return 0; } enum enctype { AS_PER, AS_DER, AS_XER, AS_CXER, }; static void save_object_as(PDU_t *st, enum expectation exp, enum enctype how) { asn_enc_rval_t rval; /* Return value */ buf_offset = 0; /* * Save object using specified method. */ switch(how) { case AS_PER: rval = uper_encode(&asn_DEF_PDU, st, _buf_writer, 0); if(exp == EXP_PER_NOCOMP) assert(rval.encoded == -1); else assert(rval.encoded > 0); fprintf(stderr, "SAVED OBJECT IN SIZE %zd\n", buf_offset); return; case AS_DER: rval = der_encode(&asn_DEF_PDU, st, _buf_writer, 0); break; case AS_XER: rval = xer_encode(&asn_DEF_PDU, st, XER_F_BASIC, _buf_writer, 0); break; case AS_CXER: rval = xer_encode(&asn_DEF_PDU, st, XER_F_CANONICAL, _buf_writer, 0); break; } if (rval.encoded == -1) { fprintf(stderr, "Cannot encode %s: %s\n", rval.failed_type->name, strerror(errno)); assert(rval.encoded != -1); return; } fprintf(stderr, "SAVED OBJECT IN SIZE %zd\n", buf_offset); } static PDU_t * load_object_from(const char *fname, enum expectation expectation, unsigned char *fbuf, size_t size, enum enctype how) { asn_dec_rval_t rval; PDU_t *st = 0; size_t csize = 1; if(getenv("INITIAL_CHUNK_SIZE")) csize = atoi(getenv("INITIAL_CHUNK_SIZE")); /* Perform multiple iterations with multiple chunks sizes */ for(; csize < 20; csize += 1) { int fbuf_offset = 0; int fbuf_left = size; int fbuf_chunk = csize; fprintf(stderr, "LOADING OBJECT OF SIZE %zd FROM [%s] as %s," " chunks %zd\n", size, fname, how==AS_PER?"PER":"XER", csize); if(st) asn_DEF_PDU.free_struct(&asn_DEF_PDU, st, 0); st = 0; do { ASN_DEBUG("Decoding bytes %d..%d (left %d)", fbuf_offset, fbuf_chunk < fbuf_left ? fbuf_chunk : fbuf_left, fbuf_left); #ifdef EMIT_ASN_DEBUG if(st) { fprintf(stderr, "=== currently ===\n"); asn_fprint(stderr, &asn_DEF_PDU, st); fprintf(stderr, "=== end ===\n"); } #endif switch(how) { case AS_XER: rval = xer_decode(0, &asn_DEF_PDU, (void **)&st, fbuf + fbuf_offset, fbuf_chunk < fbuf_left ? fbuf_chunk : fbuf_left); break; case AS_PER: rval = uper_decode(0, &asn_DEF_PDU, (void **)&st, fbuf + fbuf_offset, fbuf_chunk < fbuf_left ? fbuf_chunk : fbuf_left, 0, 0); if(rval.code == RC_WMORE) { rval.consumed = 0; /* Not restartable */ ASN_STRUCT_FREE(asn_DEF_PDU, st); st = 0; ASN_DEBUG("-> PER wants more"); } else { ASN_DEBUG("-> PER ret %d/%zd", rval.code, rval.consumed); /* uper_decode() returns _bits_ */ rval.consumed += 7; rval.consumed /= 8; } break; case AS_DER: case AS_CXER: assert(!"Unexpected DER or CXER load request"); } fbuf_offset += rval.consumed; fbuf_left -= rval.consumed; if(rval.code == RC_WMORE) fbuf_chunk += 1; /* Give little more */ else fbuf_chunk = csize; /* Back off */ } while(fbuf_left && rval.code == RC_WMORE); if(expectation != EXP_BROKEN) { assert(rval.code == RC_OK); if(how == AS_PER) { fprintf(stderr, "[left %d, off %d, size %zd]\n", fbuf_left, fbuf_offset, size); assert(fbuf_offset == (ssize_t)size); } else { assert(fbuf_offset - size < 2 || (fbuf_offset + 1 /* "\n" */ == (ssize_t)size && fbuf[size - 1] == '\n') || (fbuf_offset + 2 /* "\r\n" */ == (ssize_t)size && fbuf[size - 2] == '\r' && fbuf[size - 1] == '\n') ); } } else { assert(rval.code != RC_OK); fprintf(stderr, "Failed, but this was expected\n"); asn_DEF_PDU.free_struct(&asn_DEF_PDU, st, 0); st = 0; /* ignore leak for now */ } } if(st) asn_fprint(stderr, &asn_DEF_PDU, st); return st; } static int xer_encoding_equal(void *obufp, size_t osize, void *nbufp, size_t nsize) { char *obuf = obufp; char *nbuf = nbufp; char *oend = obuf + osize; char *nend = nbuf + nsize; if((osize && !nsize) || (!osize && nsize)) return 0; /* not equal apriori */ while(1) { while(obuf < oend && isspace(*obuf)) obuf++; while(nbuf < nend && isspace(*nbuf)) nbuf++; if(obuf == oend || nbuf == nend) { if(obuf == oend && nbuf == nend) break; fprintf(stderr, "%s data in reconstructed encoding\n", (obuf == oend) ? "More" : "Less"); return 0; } if(*obuf != *nbuf) { printf("%c%c != %c%c\n", obuf[0], obuf[1], nbuf[0], nbuf[1]); return 0; } obuf++, nbuf++; } return 1; } static void process_XER_data(const char *fname, enum expectation expectation, unsigned char *fbuf, ssize_t size) { PDU_t *st; st = load_object_from(fname, expectation, fbuf, size, AS_XER); if(!st) return; /* Save and re-load as PER */ save_object_as(st, expectation, AS_PER); if(expectation == EXP_PER_NOCOMP) return; /* Already checked */ st = load_object_from("buffer", expectation, buf, buf_offset, AS_PER); assert(st); save_object_as(st, expectation, (expectation == EXP_CXER_EXACT || expectation == EXP_CXER_DIFF) ? AS_CXER : AS_XER); fprintf(stderr, "=== original ===\n"); fwrite(fbuf, 1, size, stderr); fprintf(stderr, "=== re-encoded ===\n"); fwrite(buf, 1, buf_offset, stderr); fprintf(stderr, "=== end ===\n"); switch(expectation) { case EXP_DIFFERENT: assert(!xer_encoding_equal(fbuf, size, buf, buf_offset)); break; case EXP_BROKEN: assert(!xer_encoding_equal(fbuf, size, buf, buf_offset)); break; case EXP_CXER_EXACT: buf[buf_offset++] = '\n'; assert((ssize_t)size == (ssize_t)buf_offset); assert(memcmp(fbuf, buf, size) == 0); break; case EXP_CXER_DIFF: buf[buf_offset++] = '\n'; assert((ssize_t)size != (ssize_t)buf_offset || memcmp(fbuf, buf, size)); break; case EXP_OK: case EXP_PER_NOCOMP: assert(xer_encoding_equal(fbuf, size, buf, buf_offset)); break; } asn_DEF_PDU.free_struct(&asn_DEF_PDU, st, 0); } /* * Decode the .der files and try to regenerate them. */ static int process(const char *fname) { unsigned char fbuf[4096]; char *ext = strrchr(fname, '.'); enum expectation expectation; int rd; FILE *fp; if(ext == 0 || strcmp(ext, ".in")) return 0; switch(ext[-1]) { case 'B': /* The file is intentionally broken */ expectation = EXP_BROKEN; break; case 'D': /* Reconstructing should yield different data */ expectation = EXP_DIFFERENT; break; case 'E': /* Byte to byte exact reconstruction */ expectation = EXP_CXER_EXACT; break; case 'X': /* Should fail byte-to-byte comparison */ expectation = EXP_CXER_DIFF; break; case 'P': /* Incompatible with PER */ expectation = EXP_PER_NOCOMP; break; default: expectation = EXP_OK; break; } fprintf(stderr, "\nProcessing file [../%s]\n", fname); snprintf((char *)fbuf, sizeof(fbuf), SRCDIR_S "/data-119/%s", fname); fp = fopen((char *)fbuf, "r"); assert(fp); rd = fread(fbuf, 1, sizeof(fbuf), fp); fclose(fp); assert(rd < (ssize_t)sizeof(fbuf)); /* expect small files */ process_XER_data(fname, expectation, fbuf, rd); fprintf(stderr, "Finished [%s]\n", fname); return 1; } int main() { DIR *dir; struct dirent *dent; int processed_files = 0; char *str; /* Process a specific test file */ str = getenv("DATA_119_FILE"); if(str && strncmp(str, "data-119-", 9) == 0) { process(str); return 0; } dir = opendir(SRCDIR_S "/data-119"); assert(dir); /* * Process each file in that directory. */ while((dent = readdir(dir))) { if(strncmp(dent->d_name, "data-119-", 9) == 0) if(process(dent->d_name)) processed_files++; } assert(processed_files); closedir(dir); return 0; } asn1c-0.9.28+dfsg/asn1c/tests/check-src/check-19.c0000644000000000000000000000055613065714043017726 0ustar rootroot#undef NDEBUG #include #include #include #include #include #include int main(int ac, char **av) { Name_t t; (void)ac; /* Unused argument */ (void)av; /* Unused argument */ memset(&t, 0, sizeof(t)); /* * No plans to fill it up: just checking whether it compiles or not. */ return 0; } asn1c-0.9.28+dfsg/asn1c/tests/check-src/check-73.c0000644000000000000000000000070613065714043017723 0ustar rootroot#undef NDEBUG #include #include #include #include #include #include int main(int ac, char **av) { Type_t t; Epyt_t ept; Ypet_t ypt; (void)ac; /* Unused argument */ (void)av; /* Unused argument */ memset(&t, 0, sizeof(t)); memset(&ept, 0, sizeof(ept)); memset(&ypt, 0, sizeof(ypt)); /* * No plans to fill it up: just checking whether it compiles or not. */ return 0; } asn1c-0.9.28+dfsg/asn1c/tests/check-src/check-59.c0000644000000000000000000000056213065714043017727 0ustar rootroot#undef NDEBUG #include #include #include #include #include #include int main(int ac, char **av) { Choice_t t; (void)ac; /* Unused argument */ (void)av; /* Unused argument */ memset(&t, 0, sizeof(t)); /* * No plans to fill it up: just checking whether it compiles or not. */ return 0; } asn1c-0.9.28+dfsg/asn1c/tests/check-src/check-133.-gen-PER.c0000644000000000000000000000350613065714043021252 0ustar rootroot#undef NDEBUG #include #include #include #include #include #include #include #include static void verify(int testNo, T_t *ti) { asn_enc_rval_t er; asn_dec_rval_t rv; unsigned char buf[8]; T_t *to = 0; er = uper_encode_to_buffer(&asn_DEF_T, ti, buf, sizeof buf); fprintf(stderr, "%d IN: %d => %zd\n", testNo, ti->present, er.encoded); assert(er.encoded >= 1); assert(er.encoded <= (ssize_t)(8 * sizeof(buf))); rv = uper_decode(0, &asn_DEF_T, (void *)&to, buf, sizeof buf, 0, 0); assert(rv.code == RC_OK); fprintf(stderr, "%d ENC: %2x%2x\n", testNo, buf[0], buf[1]); fprintf(stderr, "%d OUT: %d\n", testNo, ti->present); assert(ti->present == to->present); switch(ti->present) { case T_PR_NOTHING: assert(ti->present != T_PR_NOTHING); break; case T_PR_first: assert(ti->choice.first.present == to->choice.first.present); assert(ti->choice.first.choice.nothing == to->choice.first.choice.nothing); break; case T_PR_second: assert(ti->choice.second == to->choice.second); break; case T_PR_third: assert(ti->choice.third == to->choice.third); break; } xer_fprint(stderr, &asn_DEF_T, ti); xer_fprint(stderr, &asn_DEF_T, to); } int main() { T_t t; return 0; // this test fails, but not important atm. memset(&t, 0, sizeof(t)); t.present = T_PR_first; t.choice.first.present = first_PR_nothing; t.choice.first.choice.nothing = 5; verify(0, &t); memset(&t, 0, sizeof(t)); t.present = T_PR_second; t.choice.second = -5; verify(1, &t); memset(&t, 0, sizeof(t)); t.present = T_PR_second; t.choice.second = 10; verify(2, &t); memset(&t, 0, sizeof(t)); t.present = T_PR_third; t.choice.third = -10; verify(3, &t); memset(&t, 0, sizeof(t)); t.present = T_PR_third; t.choice.third = 4097; verify(4, &t); return 0; } asn1c-0.9.28+dfsg/asn1c/tests/check-src/check-50.c0000644000000000000000000000061313065714043017713 0ustar rootroot#undef NDEBUG #include #include #include #include #include #include #include #include #include int main(int ac, char **av) { (void)ac; /* Unused argument */ (void)av; /* Unused argument */ /* * No plans to fill it up: just checking whether it compiles or not. */ return 0; } asn1c-0.9.28+dfsg/asn1c/tests/check-src/check-25.-fwide-types.c0000644000000000000000000001366513065714043022244 0ustar rootroot#undef NDEBUG #include #include #include #include #include #include uint8_t buf1[] = { 32 | 16, /* [UNIVERSAL 16], constructed */ 128, /* L */ /* a INTEGER */ 2, /* [UNIVERSAL 2] */ 2, /* L */ 150, 70, /* b [2] IMPLICIT BOOLEAN */ 128 | 2, /* [2] */ 1, /* L */ 0xff, /* c NULL */ 5, /* [UNIVERSAL 5] */ 0, /* L */ /* d ENUMERATED */ 10, /* [UNIVERSAL 10] */ 1, /* L */ 222, /* e OCTET STRING */ 4, /* [UNIVERSAL 4] */ 3, /* L */ 'x', 'y', 'z', /* * X.690 specifies that inner structures must be tagged by * stripping off the outer tag for each subsequent level. */ /* f [5] IMPLICIT VisibleString */ 128 | 32 | 5, /* [5], constructed */ 128, /* L indefinite */ 26, /* [UNIVERSAL 26] (VisibleString), primitive */ 2, 'l', 'o', 32 | 26, /* [UNIVERSAL 26], recursively constructed */ 128, 4, /* [UNIVERSAL 4] (OCTET STRING), primitive */ 1, 'v', 4, /* [UNIVERSAL 4], primitive */ 2, 'e', '_', 0, 0, 26, /* [UNIVERSAL 26], primitive */ 2, 'i', 't', 0, 0, /* g BIT STRING */ 3, /* [UNIVERSAL 3], primitive */ 3, /* L */ 2, /* Skip 2 bits */ 147, 150, /* => 148 */ /* h [7] BIT STRING */ 128 | 32 | 7, /* [7], constructed */ 128, /* L indefinite */ 3, /* [UNIVERSAL 3], primitive */ 3, /* L */ 0, /* Skip 0 bits */ 140, 141, 3, /* [UNIVERSAL 3], primitive */ 2, /* L */ 1, /* Skip 1 bit */ 143, /* => 142 */ 0, /* End of h */ 0, 0, /* End of the whole structure */ 0, /* Three bytes of planned leftover */ 111, 222, 223 }; static void check(int is_ok, uint8_t *buf, size_t size, size_t consumed) { T_t t, *tp; asn_dec_rval_t rval; tp = memset(&t, 0, sizeof(t)); fprintf(stderr, "Buf %p (%zd)\n", buf, size); rval = ber_decode(0, &asn_DEF_T, (void **)&tp, buf, size); fprintf(stderr, "Returned code %d, consumed %zd, expected %zd\n", (int)rval.code, rval.consumed, consumed); if(is_ok) { assert(rval.code == RC_OK); assert(rval.consumed == consumed); assert(strcmp((char *)t.e->buf, "xyz") == 0); assert(strcmp((char *)t.f->buf, "love_it") == 0); assert(t.g->size == 2); assert(t.g->bits_unused == 2); fprintf(stderr, "%d %d\n", t.g->buf[0], t.g->buf[1]); assert(t.g->buf[0] == 147); assert(t.g->buf[1] != 150); assert(t.g->buf[1] == 148); assert(t.h->size == 3); assert(t.h->bits_unused == 1); assert(t.h->buf[0] == 140); assert(t.h->buf[1] == 141); assert(t.h->buf[2] == 142); } else { if(rval.code == RC_OK) { assert(t.a.size != 2 || !t.d || t.d->size != 1 || !t.e || t.e->size != 3 || !t.f || t.f->size != 7 || !t.g || t.g->size != 2 || !t.h || t.h->size != 3 ); } fprintf(stderr, "%zd %zd\n", rval.consumed, consumed); assert(rval.consumed <= consumed); } asn_DEF_T.free_struct(&asn_DEF_T, &t, 1); } static void try_corrupt(uint8_t *buf, size_t size, int allow_consume) { uint8_t *tmp; int i; fprintf(stderr, "\nCorrupting...\n"); tmp = alloca(size); for(i = 0; i < 1000; i++) { int loc; memcpy(tmp, buf, size); /* Corrupt random _non-value_ location. */ do { loc = random() % size; } while( loc == 44 /* bit skips */ || loc == 51 /* bit skips */ || loc == 56 /* bit skips */ || tmp[loc] >= 70); do { tmp[loc] = buf[loc] ^ random(); } while( (tmp[loc] == buf[loc]) || (buf[loc] == 0 && tmp[loc] == 0x80)); fprintf(stderr, "\nTry %d: corrupting byte %d (%d->%d)\n", i, loc, buf[loc], tmp[loc]); check(0, tmp, size, allow_consume); } } static void partial_read(uint8_t *buf, size_t size) { T_t t, *tp; asn_dec_rval_t rval; size_t i1, i2; uint8_t *tbuf1 = alloca(size); uint8_t *tbuf2 = alloca(size); uint8_t *tbuf3 = alloca(size); fprintf(stderr, "\nPartial read sequence...\n"); /* * Divide the space (size) into three blocks in various combinations: * |<----->i1<----->i2<----->| * ^ buf ^ buf+size * Try to read block by block. */ for(i1 = 0; i1 < size; i1++) { for(i2 = i1; i2 < size; i2++) { uint8_t *chunk1 = buf; size_t size1 = i1; uint8_t *chunk2 = buf + size1; size_t size2 = i2 - i1; uint8_t *chunk3 = buf + size1 + size2; size_t size3 = size - size1 - size2; fprintf(stderr, "\n%d:{%d, %d, %d}...\n", (int)size, (int)size1, (int)size2, (int)size3); memset(tbuf1, 0, size); memset(tbuf2, 0, size); memset(tbuf3, 0, size); memcpy(tbuf1, chunk1, size1); memcpy(tbuf2, chunk2, size2); memcpy(tbuf3, chunk3, size3); tp = memset(&t, 0, sizeof(t)); fprintf(stderr, "=> Chunk 1 (%d):\n", (int)size1); rval = ber_decode(0, &asn_DEF_T, (void **)&tp, tbuf1, size1); assert(rval.code == RC_WMORE); assert(rval.consumed <= size1); if(rval.consumed < size1) { int leftover = size1 - rval.consumed; memcpy(tbuf2, tbuf1 + rval.consumed, leftover); memcpy(tbuf2 + leftover, chunk2, size2); size2 += leftover; } fprintf(stderr, "=> Chunk 2 (%d):\n", (int)size2); rval = ber_decode(0, &asn_DEF_T, (void **)&tp, tbuf2, size2); assert(rval.code == RC_WMORE); assert(rval.consumed <= size2); if(rval.consumed < size2) { int leftover = size2 - rval.consumed; memcpy(tbuf3, tbuf2 + rval.consumed, leftover); memcpy(tbuf3 + leftover, chunk3, size3); size3 += leftover; } fprintf(stderr, "=> Chunk 3 (%d):\n", (int)size3); rval = ber_decode(0, &asn_DEF_T, (void **)&tp, tbuf3, size3); assert(rval.code == RC_OK); assert(rval.consumed == size3); asn_DEF_T.free_struct(&asn_DEF_T, &t, 1); } } } int main(int ac, char **av) { (void)ac; /* Unused argument */ (void)av; /* Unused argument */ /* Check that the full buffer may be decoded normally */ check(1, buf1, sizeof(buf1), sizeof(buf1) - 3); /* Check that some types of buffer corruptions will lead to failure */ try_corrupt(buf1, sizeof(buf1) - 3, sizeof(buf1) - 3); /* Split the buffer in parts and check decoder restartability */ partial_read(buf1, sizeof(buf1) - 3); return 0; } asn1c-0.9.28+dfsg/asn1c/tests/check-src/check64-134.-gen-PER.c0000644000000000000000000000776013065714043021433 0ustar rootroot/* * Verify INTEGER values with greater than 32 bits range. */ #undef NDEBUG #include #include #include #include #include #include #include #include static unsigned long i2ul(const INTEGER_t *i) { unsigned long l; int ret = asn_INTEGER2ulong(i, &l); assert(ret == 0); return l; } static long i2l(const INTEGER_t *i) { long l; int ret = asn_INTEGER2long(i, &l); assert(ret == 0); return l; } static void ul2i(INTEGER_t *i, unsigned long l) { int ret = asn_ulong2INTEGER(i, l); assert(ret == 0); } static void l2i(INTEGER_t *i, long l) { int ret = asn_long2INTEGER(i, l); assert(ret == 0); } static void verify(int testNo, T_t *ti) { asn_enc_rval_t er; asn_dec_rval_t rv; unsigned char buf[20]; T_t *to = 0; fprintf(stderr, "%d IN: { %lu, %lu, %ld, %ld }\n", testNo, i2ul(&ti->unsigned33), i2ul(&ti->unsigned42), i2l(&ti->signed33), i2l(&ti->signed33ext) ); er = uper_encode_to_buffer(&asn_DEF_T, ti, buf, sizeof buf); assert(er.encoded >= 33 + 42 + 33 + 1 + 33); rv = uper_decode(0, &asn_DEF_T, (void *)&to, buf, sizeof buf, 0, 0); assert(rv.code == RC_OK); fprintf(stderr, "%d ENC: %2x%2x%2x%2x %2x%2x%2x%2x\n", testNo, buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]); fprintf(stderr, "%d OUT: { %lu, %lu, %ld, %ld } vs { %lu, %lu, %ld, %ld }\n", testNo, i2ul(&ti->unsigned33), i2ul(&ti->unsigned42), i2l(&ti->signed33), i2l(&ti->signed33ext), i2ul(&to->unsigned33), i2ul(&to->unsigned42), i2l(&to->signed33), i2l(&to->signed33ext)); assert(i2ul(&ti->unsigned33) == i2ul(&to->unsigned33)); assert(i2ul(&ti->unsigned42) == i2ul(&to->unsigned42)); assert(i2l(&ti->signed33) == i2l(&to->signed33)); assert(i2l(&ti->signed33ext) == i2l(&to->signed33ext)); xer_fprint(stderr, &asn_DEF_T, ti); xer_fprint(stderr, &asn_DEF_T, to); } static void NO_encode(int testNo, T_t *ti) { asn_enc_rval_t er; unsigned char buf[16]; fprintf(stderr, "%d IN: { %lu, %lu, %ld, %ld }\n", testNo, i2ul(&ti->unsigned33), i2ul(&ti->unsigned42), i2l(&ti->signed33), i2l(&ti->signed33ext) ); er = uper_encode_to_buffer(&asn_DEF_T, ti, buf, sizeof buf); assert(er.encoded == -1); } int main() { T_t ti; memset(&ti, 0, sizeof(ti)); ul2i(&ti.unsigned33, 0); ul2i(&ti.unsigned42, 0); l2i(&ti.signed33, 0); l2i(&ti.signed33ext, 0); verify(1, &ti); ul2i(&ti.unsigned33, 1); ul2i(&ti.unsigned42, 1); l2i(&ti.signed33, 1); l2i(&ti.signed33ext, 1); verify(2, &ti); ul2i(&ti.unsigned33, 5000000000); ul2i(&ti.unsigned42, 3153600000000); l2i(&ti.signed33, 4000000000); l2i(&ti.signed33ext, 4000000000); verify(3, &ti); ul2i(&ti.unsigned33, -1); ul2i(&ti.unsigned42, 0); l2i(&ti.signed33, 0); l2i(&ti.signed33ext, 0); NO_encode(4, &ti); ul2i(&ti.unsigned33, 0); ul2i(&ti.unsigned42, -1); l2i(&ti.signed33, 0); l2i(&ti.signed33ext, 0); NO_encode(5, &ti); ul2i(&ti.unsigned33, 0); ul2i(&ti.unsigned42, 0); l2i(&ti.signed33, -4000000000-1); l2i(&ti.signed33ext, 0); NO_encode(6, &ti); ul2i(&ti.unsigned33, 0); ul2i(&ti.unsigned42, 0); l2i(&ti.signed33, 0); l2i(&ti.signed33ext, -4000000000-1); assert(ti.signed33ext.size == 5); verify(7, &ti); /* signed33ext is extensible */ ul2i(&ti.unsigned33, 5000000000 + 1); ul2i(&ti.unsigned42, 0); l2i(&ti.signed33, 0); l2i(&ti.signed33ext, 0); NO_encode(8, &ti); ul2i(&ti.unsigned33, 0); ul2i(&ti.unsigned42, 3153600000000 + 1); l2i(&ti.signed33, 0); l2i(&ti.signed33ext, 0); NO_encode(9, &ti); ul2i(&ti.unsigned33, 5000000000 - 1); ul2i(&ti.unsigned42, 3153600000000 - 1); l2i(&ti.signed33, 4000000000 - 1); l2i(&ti.signed33ext, 4000000000 - 1); verify(10, &ti); ul2i(&ti.unsigned33, 0); ul2i(&ti.unsigned42, 0); l2i(&ti.signed33, 0); l2i(&ti.signed33ext, 4000000000 + 1); verify(11, &ti); return 0; } asn1c-0.9.28+dfsg/asn1c/tests/check-src/check-132.-gen-PER.c0000644000000000000000000000272513065714043021253 0ustar rootroot#undef NDEBUG #include #include #include #include #include #include #include #include static void verify(int testNo, T_t *ti) { asn_enc_rval_t er; asn_dec_rval_t rv; unsigned char buf[2]; T_t *to = 0; er = uper_encode_to_buffer(&asn_DEF_T, ti, buf, sizeof buf); fprintf(stderr, "%d IN: %d => %zd\n", testNo, ti->present, er.encoded); assert(er.encoded >= 1 && er.encoded <= (ssize_t)(8 * sizeof(buf))); rv = uper_decode(0, &asn_DEF_T, (void *)&to, buf, sizeof buf, 0, 0); assert(rv.code == RC_OK); fprintf(stderr, "%d ENC: %2x%2x\n", testNo, buf[0], buf[1]); fprintf(stderr, "%d OUT: %d\n", testNo, ti->present); assert(ti->present == to->present); if(ti->present == T_PR_second) { assert(ti->choice.second == to->choice.second); } else { assert(ti->choice.first.present == to->choice.first.present); assert(ti->choice.first.choice.nothing == to->choice.first.choice.nothing); } xer_fprint(stderr, &asn_DEF_T, ti); xer_fprint(stderr, &asn_DEF_T, to); } int main() { T_t t; memset(&t, 0, sizeof(t)); t.present = T_PR_first; t.choice.first.present = first_PR_nothing; t.choice.first.choice.nothing = 5; verify(0, &t); memset(&t, 0, sizeof(t)); t.present = T_PR_first; t.choice.first.present = first_PR_nothing; t.choice.first.choice.nothing = 6; verify(1, &t); memset(&t, 0, sizeof(t)); t.present = T_PR_second; t.choice.second = 7; verify(2, &t); return 0; } asn1c-0.9.28+dfsg/asn1c/tests/check-src/check-65.c0000644000000000000000000000431713065714043017726 0ustar rootroot#undef NDEBUG #include #include #include #include #include #include #include uint8_t buf1[] = { 32 | ((2 << 6) + 2), /* [2], constructed */ 6, 32 | ((2 << 6) + 3), /* [3], constructed */ 4, 32 | ((2 << 6) + 4), /* [4], constructed */ 2, 0 | ((2 << 6) + 6), /* [6], primitive */ 0 }; uint8_t buf2[] = { 32 | ((2 << 6) + 0), /* [0], constructed */ 23, 32 | ((2 << 6) + 1), /* [1], constructed */ 6, 32 | ((2 << 6) + 4), /* [4], constructed */ 4, 0 | ((2 << 6) + 6), /* [6], primitive */ 2, 0xC0, 0x00, 32 | ((2 << 6) + 2), /* [2], constructed */ 6, 32 | ((2 << 6) + 4), /* [4], constructed */ 4, 0 | ((2 << 6) + 6), /* [6], primitive */ 2, 0x80, 0x00, 32 | ((2 << 6) + 3), /* [3], constructed */ 5, 0 | ((2 << 6) + 6), /* [6], primitive */ 3, 0x80, 0x01, 0x02, }; static void check_1(int is_ok, uint8_t *buf, size_t size, size_t consumed) { asn_TYPE_descriptor_t *td = &asn_DEF_T1; asn_dec_rval_t rval; T1_t t, *tp; tp = memset(&t, 0, sizeof(t)); fprintf(stderr, "Buf %p\n", buf); rval = ber_decode(0, td, (void **)&tp, buf, size); fprintf(stderr, "Returned code %d, consumed %zd\n", (int)rval.code, rval.consumed); if(is_ok) { assert(rval.code == RC_OK); assert(rval.consumed == consumed); } else { if(rval.code == RC_OK) { } assert(rval.consumed <= consumed); } } static void check_2(int is_ok, uint8_t *buf, size_t size, size_t consumed) { asn_TYPE_descriptor_t *td = &asn_DEF_T; asn_dec_rval_t rval; T_t t, *tp; tp = memset(&t, 0, sizeof(t)); fprintf(stderr, "Buf %p\n", buf); rval = ber_decode(0, td, (void **)&tp, buf, size); fprintf(stderr, "Returned code %d, consumed %zd\n", (int)rval.code, rval.consumed); if(is_ok) { assert(rval.code == RC_OK); assert(rval.consumed == consumed); } else { if(rval.code == RC_OK) { } assert(rval.consumed <= consumed); } } int main(int ac, char **av) { (void)ac; /* Unused argument */ (void)av; /* Unused argument */ check_1(1, buf1, sizeof(buf1), sizeof(buf1)); check_1(0, buf1, sizeof(buf1) - 1, sizeof(buf1) - 1); check_2(1, buf2, sizeof(buf2), sizeof(buf2)); check_2(0, buf2, sizeof(buf2) - 1, sizeof(buf2) - 1); return 0; } asn1c-0.9.28+dfsg/asn1c/tests/check-src/check-03.-fwide-types.c0000644000000000000000000000262213065714043022227 0ustar rootroot#undef NDEBUG #include #include #include #include #include #include "Enum2.h" #include "xer_decoder.h" static char buf[4096]; static int buf_offset; static int buf_writer(const void *buffer, size_t size, void *app_key) { char *b, *bend; (void)app_key; assert(buf_offset + size < sizeof(buf)); memcpy(buf + buf_offset, buffer, size); b = buf + buf_offset; bend = b + size; buf_offset += size; return 0; } static void check_xer(e_Enum2 eval, char *xer_string) { asn_dec_rval_t rv; char buf2[128]; Enum2_t *e = 0; long val; rv = xer_decode(0, &asn_DEF_Enum2, (void **)&e, xer_string, strlen(xer_string)); assert(rv.code == RC_OK); assert(rv.consumed == strlen(xer_string)); asn_INTEGER2long(e, &val); printf("%s -> %ld == %d\n", xer_string, val, eval); assert(val == eval); buf_offset = 0; xer_encode(&asn_DEF_Enum2, e, XER_F_CANONICAL, buf_writer, 0); buf[buf_offset] = 0; sprintf(buf2, "%s", xer_string); printf("%d -> %s == %s\n", eval, buf, buf2); assert(0 == strcmp(buf, buf2)); } int main() { check_xer(Enum2_red, ""); check_xer(Enum2_green, ""); check_xer(Enum2_blue, ""); check_xer(Enum2_orange, ""); check_xer(Enum2_alpha, ""); check_xer(Enum2_beta, ""); check_xer(Enum2_gamma, ""); return 0; } asn1c-0.9.28+dfsg/asn1c/tests/check-src/check-46.c0000644000000000000000000000145713065714043017727 0ustar rootroot#undef NDEBUG #include #include #include #include #include #include uint8_t buf1[] = { 32 | ((2 << 6) + 3), /* [3], constructed */ 5, ((2 << 6) + 5), /* [5], primitive */ 3, /* L */ 'a', 'b', 'c', }; static void check(uint8_t *buf, size_t size, size_t consumed) { T_t t, *tp; asn_dec_rval_t rval; tp = memset(&t, 0, sizeof(t)); fprintf(stderr, "Buf %p\n", buf); rval = ber_decode(0, &asn_DEF_T, (void **)&tp, buf, size); fprintf(stderr, "Returned code %d, consumed %zd\n", (int)rval.code, rval.consumed); assert(rval.code == RC_OK); assert(rval.consumed == consumed); } int main(int ac, char **av) { (void)ac; /* Unused argument */ (void)av; /* Unused argument */ check(buf1, sizeof(buf1), sizeof(buf1)); return 0; } asn1c-0.9.28+dfsg/asn1c/tests/check-src/check-48.c0000644000000000000000000000372313065714043017727 0ustar rootroot#undef NDEBUG #include #include #include #include #include #include #include static unsigned char buf[4096]; static int buf_offset; static int _buf_writer(const void *buffer, size_t size, void *app_key) { unsigned char *b, *bend; (void)app_key; assert(buf_offset + size < sizeof(buf)); memcpy(buf + buf_offset, buffer, size); b = buf + buf_offset; bend = b + size; printf("=> ["); for(; b < bend; b++) printf(" %02X", *b); printf("]:%zd\n", size); buf_offset += size; return 0; } static int save_object(void *bs, asn_TYPE_descriptor_t *td) { asn_enc_rval_t rval; /* Return value */ int i; rval = der_encode(td, bs, _buf_writer, 0); if (rval.encoded == -1) { fprintf(stderr, "Cannot encode %s: %s\n", rval.failed_type->name, strerror(errno)); assert(rval.encoded != -1); return -1; /* JIC */ } buf[buf_offset++] = 123; /* Finalize with garbage */ asn_fprint(stderr, td, bs); xer_fprint(stderr, td, bs); printf("OUT: ["); for(i = 0; i < buf_offset; i++) printf(" %02x", buf[i]); printf("]\n"); return 0; } static int load_object(void *bs, asn_TYPE_descriptor_t *td) { asn_dec_rval_t rval; fprintf(stderr, "\nLOADING OBJECT OF SIZE %d\n", buf_offset); rval = ber_decode(0, td, (void **)&bs, buf, buf_offset); assert(rval.code == RC_OK); asn_fprint(stderr, td, bs); xer_fprint(stderr, td, bs); return (rval.code == RC_OK)?0:-1; } int main() { asn_TYPE_descriptor_t *td = &asn_DEF_UserIdentifier; UserIdentifier_t user; UserIdentifier_t user_new; int ret; memset(&user, 0, sizeof user); memset(&user_new, 0, sizeof user_new); user.present = UserIdentifier_PR_phoneNumber; OCTET_STRING_fromBuf( &user.choice.phoneNumber, "0123456789", -1); /* Save->Load must succeed */ save_object(&user, td); ret = load_object(&user_new, td); assert(user_new.present == UserIdentifier_PR_phoneNumber); assert(ret == 0); printf("OK\n"); return ret; } asn1c-0.9.28+dfsg/asn1c/tests/check-src/check-127.-gen-PER.c0000644000000000000000000000401013065714043021244 0ustar rootroot#undef NDEBUG #include #include #include #include #include #include #include #include static void verify(int testNo, T_t *ti) { asn_enc_rval_t er; asn_dec_rval_t rv; unsigned char buf[16]; T_t *to = 0; fprintf(stderr, "%d IN: { %ld, %ld, %lu, %lu }\n", testNo, ti->small32range, ti->full32range, ti->unsigned32, ti->unsplit32); er = uper_encode_to_buffer(&asn_DEF_T, ti, buf, sizeof buf); assert(er.encoded == 8 * sizeof(buf)); rv = uper_decode(0, &asn_DEF_T, (void *)&to, buf, sizeof buf, 0, 0); assert(rv.code == RC_OK); fprintf(stderr, "%d ENC: %2x%2x%2x%2x %2x%2x%2x%2x\n", testNo, buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]); fprintf(stderr, "%d OUT: { %ld, %ld, %lu, %lu } vs { %ld, %ld, %lu, %lu }\n", testNo, ti->small32range, ti->full32range, ti->unsigned32, ti->unsplit32, to->small32range, to->full32range, to->unsigned32, to->unsplit32); assert(ti->small32range == to->small32range); assert(ti->full32range == to->full32range); assert(ti->unsigned32 == to->unsigned32); assert(ti->unsplit32 == to->unsplit32); xer_fprint(stderr, &asn_DEF_T, ti); xer_fprint(stderr, &asn_DEF_T, to); } int main() { T_t ti; ti.small32range = 0; ti.full32range = 0; ti.unsigned32 = 0; ti.unsplit32 = 5; verify(1, &ti); ti.small32range = -1; ti.full32range = -1; ti.unsigned32 = 1; ti.unsplit32 = 300; verify(2, &ti); ti.small32range = -2000000000; ti.full32range = (-2147483647L - 1); ti.unsigned32 = 4000000000; ti.unsplit32 = 500; verify(3, &ti); ti.small32range = -1999999999; ti.full32range = (-2147483647L); ti.unsigned32 = 4294967295UL; ti.unsplit32 = 600; verify(4, &ti); ti.small32range = 2000000000; ti.full32range = 2147483647; ti.unsigned32 = 4294967295UL - 100; ti.unsplit32 = 4294967290UL; verify(5, &ti); ti.small32range = 1999999999; ti.full32range = 2147483647 - 1; ti.unsigned32 = 4294967295UL - 1; ti.unsplit32 = 4294967290UL - 1; verify(6, &ti); return 0; } asn1c-0.9.28+dfsg/asn1c/tests/check-src/check-119.-fwide-types.-gen-PER.c0000644000000000000000000002153713065714043023576 0ustar rootroot/* * Mode of operation: * Each of the *.in files is XER-decoded, then converted into PER, * then decoded back from PER, then encoded into XER again, * and finally compared to the original encoding. */ #undef NDEBUG #include #include #include #include /* for chdir(2) */ #include #include #include #include #include #include #ifndef SRCDIR #define SRCDIR_S ".." #else #define STRINGIFY_MACRO2(x) #x #define STRINGIFY_MACRO(x) STRINGIFY_MACRO2(x) #define SRCDIR_S STRINGIFY_MACRO(SRCDIR) #endif enum expectation { EXP_OK, /* Encoding/decoding must succeed */ EXP_CXER_EXACT, /* Encoding/decoding using CXER must be exact */ EXP_CXER_DIFF, /* Encoding/decoding using CXER must be different */ EXP_BROKEN, /* Decoding must fail */ EXP_DIFFERENT, /* Reconstruction will yield different encoding */ EXP_PER_NOCOMP, /* Not PER compatible */ }; static unsigned char buf[4096]; static size_t buf_offset; static int _buf_writer(const void *buffer, size_t size, void *app_key) { unsigned char *b, *bend; (void)app_key; assert(buf_offset + size < sizeof(buf)); memcpy(buf + buf_offset, buffer, size); b = buf + buf_offset; bend = b + size; #ifdef EMIT_ASN_DEBUG fprintf(stderr, "=> ["); for(; b < bend; b++) { if(*b >= 32 && *b < 127 && *b != '%') fprintf(stderr, "%c", *b); else fprintf(stderr, "%%%02x", *b); } fprintf(stderr, "]:%zd\n", size); #endif buf_offset += size; return 0; } enum enctype { AS_PER, AS_DER, AS_XER, AS_CXER, }; static void save_object_as(PDU_t *st, enum expectation exp, enum enctype how) { asn_enc_rval_t rval; /* Return value */ buf_offset = 0; /* * Save object using specified method. */ switch(how) { case AS_PER: rval = uper_encode(&asn_DEF_PDU, st, _buf_writer, 0); if(exp == EXP_PER_NOCOMP) assert(rval.encoded == -1); else assert(rval.encoded > 0); fprintf(stderr, "SAVED OBJECT IN SIZE %zd\n", buf_offset); return; case AS_DER: rval = der_encode(&asn_DEF_PDU, st, _buf_writer, 0); break; case AS_XER: rval = xer_encode(&asn_DEF_PDU, st, XER_F_BASIC, _buf_writer, 0); break; case AS_CXER: rval = xer_encode(&asn_DEF_PDU, st, XER_F_CANONICAL, _buf_writer, 0); break; } if (rval.encoded == -1) { fprintf(stderr, "Cannot encode %s: %s\n", rval.failed_type->name, strerror(errno)); assert(rval.encoded != -1); return; } fprintf(stderr, "SAVED OBJECT IN SIZE %zd\n", buf_offset); } static PDU_t * load_object_from(const char *fname, enum expectation expectation, unsigned char *fbuf, size_t size, enum enctype how) { asn_dec_rval_t rval; PDU_t *st = 0; size_t csize = 1; if(getenv("INITIAL_CHUNK_SIZE")) csize = atoi(getenv("INITIAL_CHUNK_SIZE")); /* Perform multiple iterations with multiple chunks sizes */ for(; csize < 20; csize += 1) { int fbuf_offset = 0; int fbuf_left = size; int fbuf_chunk = csize; fprintf(stderr, "LOADING OBJECT OF SIZE %zd FROM [%s] as %s," " chunks %zd\n", size, fname, how==AS_PER?"PER":"XER", csize); if(st) asn_DEF_PDU.free_struct(&asn_DEF_PDU, st, 0); st = 0; do { ASN_DEBUG("Decoding bytes %d..%d (left %d)", fbuf_offset, fbuf_chunk < fbuf_left ? fbuf_chunk : fbuf_left, fbuf_left); #ifdef EMIT_ASN_DEBUG if(st) { fprintf(stderr, "=== currently ===\n"); asn_fprint(stderr, &asn_DEF_PDU, st); fprintf(stderr, "=== end ===\n"); } #endif switch(how) { case AS_XER: rval = xer_decode(0, &asn_DEF_PDU, (void **)&st, fbuf + fbuf_offset, fbuf_chunk < fbuf_left ? fbuf_chunk : fbuf_left); break; case AS_PER: rval = uper_decode(0, &asn_DEF_PDU, (void **)&st, fbuf + fbuf_offset, fbuf_chunk < fbuf_left ? fbuf_chunk : fbuf_left, 0, 0); if(rval.code == RC_WMORE) { rval.consumed = 0; /* Not restartable */ ASN_STRUCT_FREE(asn_DEF_PDU, st); st = 0; ASN_DEBUG("-> PER wants more"); } else { ASN_DEBUG("-> PER ret %d/%ld", rval.code, rval.consumed); /* uper_decode() returns _bits_ */ rval.consumed += 7; rval.consumed /= 8; } break; case AS_DER: case AS_CXER: assert(!"DER or CXER not supported for load"); } fbuf_offset += rval.consumed; fbuf_left -= rval.consumed; if(rval.code == RC_WMORE) fbuf_chunk += 1; /* Give little more */ else fbuf_chunk = csize; /* Back off */ } while(fbuf_left && rval.code == RC_WMORE); if(expectation != EXP_BROKEN) { assert(rval.code == RC_OK); if(how == AS_PER) { fprintf(stderr, "[left %d, off %d, size %zd]\n", fbuf_left, fbuf_offset, size); assert(fbuf_offset == (ssize_t)size); } else { assert(fbuf_offset - size < 2 || (fbuf_offset + 1 /* "\n" */ == (ssize_t)size && fbuf[size - 1] == '\n') || (fbuf_offset + 2 /* "\r\n" */ == (ssize_t)size && fbuf[size - 2] == '\r' && fbuf[size - 1] == '\n') ); } } else { assert(rval.code != RC_OK); fprintf(stderr, "Failed, but this was expected\n"); asn_DEF_PDU.free_struct(&asn_DEF_PDU, st, 0); st = 0; /* ignore leak for now */ } } if(st) asn_fprint(stderr, &asn_DEF_PDU, st); return st; } static int xer_encoding_equal(char *obuf, size_t osize, char *nbuf, size_t nsize) { char *oend = obuf + osize; char *nend = nbuf + nsize; if((osize && !nsize) || (!osize && nsize)) return 0; /* not equal apriori */ while(1) { while(obuf < oend && isspace(*obuf)) obuf++; while(nbuf < nend && isspace(*nbuf)) nbuf++; if(obuf == oend || nbuf == nend) { if(obuf == oend && nbuf == nend) break; fprintf(stderr, "%s data in reconstructed encoding\n", (obuf == oend) ? "More" : "Less"); return 0; } if(*obuf != *nbuf) { printf("%c%c != %c%c\n", obuf[0], obuf[1], nbuf[0], nbuf[1]); return 0; } obuf++, nbuf++; } return 1; } static void process_XER_data(const char *fname, enum expectation expectation, unsigned char *fbuf, size_t size) { PDU_t *st; st = load_object_from(fname, expectation, fbuf, size, AS_XER); if(!st) return; /* Save and re-load as PER */ save_object_as(st, expectation, AS_PER); if(expectation == EXP_PER_NOCOMP) return; /* Already checked */ st = load_object_from("buffer", expectation, buf, buf_offset, AS_PER); assert(st); save_object_as(st, expectation, (expectation == EXP_CXER_EXACT || expectation == EXP_CXER_DIFF) ? AS_CXER : AS_XER); fprintf(stderr, "=== original ===\n"); fwrite(fbuf, 1, size, stderr); fprintf(stderr, "=== re-encoded ===\n"); fwrite(buf, 1, buf_offset, stderr); fprintf(stderr, "=== end ===\n"); switch(expectation) { case EXP_DIFFERENT: assert(!xer_encoding_equal((char *)fbuf, size, (char *)buf, buf_offset)); break; case EXP_BROKEN: assert(!xer_encoding_equal((char *)fbuf, size, (char *)buf, buf_offset)); break; case EXP_CXER_EXACT: buf[buf_offset++] = '\n'; assert(size == buf_offset); assert(memcmp(fbuf, buf, size) == 0); break; case EXP_CXER_DIFF: buf[buf_offset++] = '\n'; assert(size != buf_offset || memcmp(fbuf, buf, size)); break; case EXP_OK: case EXP_PER_NOCOMP: assert(xer_encoding_equal((char *)fbuf, size, (char *)buf, buf_offset)); break; } asn_DEF_PDU.free_struct(&asn_DEF_PDU, st, 0); } /* * Decode the .der files and try to regenerate them. */ static int process(const char *fname) { unsigned char fbuf[4096]; char *ext = strrchr(fname, '.'); enum expectation expectation; int rd; FILE *fp; if(ext == 0 || strcmp(ext, ".in")) return 0; switch(ext[-1]) { case 'B': /* The file is intentionally broken */ expectation = EXP_BROKEN; break; case 'D': /* Reconstructing should yield different data */ expectation = EXP_DIFFERENT; break; case 'E': /* Byte to byte exact reconstruction */ expectation = EXP_CXER_EXACT; break; case 'X': /* Should fail byte-to-byte comparison */ expectation = EXP_CXER_DIFF; break; case 'P': /* Incompatible with PER */ expectation = EXP_PER_NOCOMP; break; default: expectation = EXP_OK; break; } fprintf(stderr, "\nProcessing file [../%s]\n", fname); snprintf((char *)fbuf, sizeof(fbuf), SRCDIR_S "/data-119/%s", fname); fp = fopen((char *)fbuf, "r"); assert(fp); rd = fread(fbuf, 1, sizeof(fbuf), fp); fclose(fp); assert(rd < (ssize_t)sizeof(fbuf)); /* expect small files */ process_XER_data(fname, expectation, fbuf, rd); fprintf(stderr, "Finished [%s]\n", fname); return 1; } int main() { DIR *dir; struct dirent *dent; int processed_files = 0; char *str; /* Process a specific test file */ str = getenv("DATA_119_FILE"); if(str && strncmp(str, "data-119-", 9) == 0) { process(str); return 0; } dir = opendir(SRCDIR_S "/data-119"); assert(dir); /* * Process each file in that directory. */ while((dent = readdir(dir))) { if(strncmp(dent->d_name, "data-119-", 9) == 0) if(process(dent->d_name)) processed_files++; } assert(processed_files); closedir(dir); return 0; } asn1c-0.9.28+dfsg/asn1c/tests/check-src/check-70.c0000644000000000000000000001565013065714043017724 0ustar rootroot/* * Mode of operation: * Each of the *.in files is XER-decoded, then converted into DER, * then decoded from DER and encoded into XER again. The resulting * stream is compared with the corresponding .out file. */ #undef NDEBUG #include #include #include #include /* for chdir(2), getcwd(3) */ #include #include #include /* for isspace(3) */ #include #include #include #ifndef SRCDIR #define SRCDIR_S ".." #else #define STRINGIFY_MACRO2(x) #x #define STRINGIFY_MACRO(x) STRINGIFY_MACRO2(x) #define SRCDIR_S STRINGIFY_MACRO(SRCDIR) #endif enum expectation { EXP_OK, /* Encoding/decoding must succeed */ EXP_BROKEN, /* Decoding must fail */ EXP_DIFFERENT, /* Reconstruction will yield different encoding */ }; static unsigned char buf[4096]; static int buf_offset; static int _buf_writer(const void *buffer, size_t size, void *app_key) { unsigned char *b, *bend; (void)app_key; assert(buf_offset + size < sizeof(buf)); memcpy(buf + buf_offset, buffer, size); b = buf + buf_offset; bend = b + size; fprintf(stderr, "=> ["); for(; b < bend; b++) fprintf(stderr, "%c", *b); fprintf(stderr, "]:%zd\n", size); buf_offset += size; return 0; } enum der_or_xer { AS_DER, AS_XER, }; static void save_object_as(PDU_t *st, enum der_or_xer how) { asn_enc_rval_t rval; /* Return value */ buf_offset = 0; /* * Save object using specified method. */ switch(how) { case AS_DER: rval = der_encode(&asn_DEF_PDU, st, _buf_writer, 0); break; case AS_XER: rval = xer_encode(&asn_DEF_PDU, st, XER_F_BASIC, _buf_writer, 0); break; } if (rval.encoded == -1) { fprintf(stderr, "Cannot encode %s: %s\n", rval.failed_type->name, strerror(errno)); assert(rval.encoded != -1); return; } fprintf(stderr, "SAVED OBJECT IN SIZE %d\n", buf_offset); } static PDU_t * load_object_from(enum expectation expectation, unsigned char *fbuf, size_t size, enum der_or_xer how) { asn_dec_rval_t rval; asn_dec_rval_t (*zer_decode)(struct asn_codec_ctx_s *, asn_TYPE_descriptor_t *, void **, const void *, size_t); PDU_t *st = 0; size_t csize = 1; if(how == AS_DER) zer_decode = ber_decode; else zer_decode = xer_decode; if(getenv("INITIAL_CHUNK_SIZE")) csize = atoi(getenv("INITIAL_CHUNK_SIZE")); /* Perform multiple iterations with multiple chunks sizes */ for(; csize < 20; csize += 1) { int fbuf_offset = 0; int fbuf_left = size; int fbuf_chunk = csize; fprintf(stderr, "LOADING OBJECT OF SIZE %zd, chunks %zd\n", size, csize); if(st) asn_DEF_PDU.free_struct(&asn_DEF_PDU, st, 0); st = 0; do { ASN_DEBUG("Decoding bytes %d..%d (left %d)", fbuf_offset, fbuf_chunk < fbuf_left ? fbuf_chunk : fbuf_left, fbuf_left); #ifdef EMIT_ASN_DEBUG if(st) { fprintf(stderr, "=== currently ===\n"); asn_fprint(stderr, &asn_DEF_PDU, st); fprintf(stderr, "=== end ===\n"); } #endif rval = zer_decode(0, &asn_DEF_PDU, (void **)&st, fbuf + fbuf_offset, fbuf_chunk < fbuf_left ? fbuf_chunk : fbuf_left); fbuf_offset += rval.consumed; fbuf_left -= rval.consumed; if(rval.code == RC_WMORE) fbuf_chunk += 1; /* Give little more */ else fbuf_chunk = csize; /* Back off */ } while(fbuf_left && rval.code == RC_WMORE); if(expectation != EXP_BROKEN) { assert(rval.code == RC_OK); if(how == AS_DER) { assert(fbuf_offset == (ssize_t)size); } else { assert(fbuf_offset - size < 2 || (fbuf_offset + 1 /* "\n" */ == (ssize_t)size && fbuf[size - 1] == '\n') || (fbuf_offset + 2 /* "\r\n" */ == (ssize_t)size && fbuf[size - 2] == '\r' && fbuf[size - 1] == '\n') ); } } else { assert(rval.code != RC_OK); fprintf(stderr, "Failed, but this was expected\n"); asn_DEF_PDU.free_struct(&asn_DEF_PDU, st, 0); st = 0; /* ignore leak for now */ } } if(st) asn_fprint(stderr, &asn_DEF_PDU, st); return st; } static int xer_encoding_equal(void *obufp, size_t osize, void *nbufp, size_t nsize) { char *obuf = obufp; char *nbuf = nbufp; char *oend = obuf + osize; char *nend = nbuf + nsize; if((osize && !nsize) || (!osize && nsize)) return 0; /* not equal apriori */ while(1) { while(obuf < oend && isspace(*obuf)) obuf++; while(nbuf < nend && isspace(*nbuf)) nbuf++; if(obuf == oend || nbuf == nend) { if(obuf == oend && nbuf == nend) break; fprintf(stderr, "%s data in reconstructed encoding\n", (obuf == oend) ? "More" : "Less"); return 0; } if(*obuf != *nbuf) { printf("%c%c != %c%c\n", obuf[0], obuf[1], nbuf[0], nbuf[1]); return 0; } obuf++, nbuf++; } return 1; } static void process_XER_data(enum expectation expectation, unsigned char *fbuf, size_t size) { PDU_t *st; st = load_object_from(expectation, fbuf, size, AS_XER); if(!st) return; /* Save and re-load as DER */ save_object_as(st, AS_DER); st = load_object_from(expectation, buf, buf_offset, AS_DER); assert(st); save_object_as(st, AS_XER); fprintf(stderr, "=== original ===\n"); fwrite(fbuf, 1, size, stderr); fprintf(stderr, "=== re-encoded ===\n"); fwrite(buf, 1, buf_offset, stderr); fprintf(stderr, "=== end ===\n"); switch(expectation) { case EXP_DIFFERENT: assert(!xer_encoding_equal(fbuf, size, buf, buf_offset)); break; case EXP_BROKEN: assert(!xer_encoding_equal(fbuf, size, buf, buf_offset)); break; case EXP_OK: assert(xer_encoding_equal(fbuf, size, buf, buf_offset)); break; } asn_DEF_PDU.free_struct(&asn_DEF_PDU, st, 0); } /* * Decode the .der files and try to regenerate them. */ static int process(const char *fname) { char prevdir[256]; unsigned char fbuf[4096]; char *ext = strrchr(fname, '.'); enum expectation expectation; int ret; int rd; FILE *fp; if(ext == 0 || strcmp(ext, ".in")) return 0; switch(ext[-1]) { case 'B': /* The file is intentionally broken */ expectation = EXP_BROKEN; break; case 'X': case 'D': /* Reconstructing should yield different data */ expectation = EXP_DIFFERENT; break; case 'E': default: expectation = EXP_OK; break; } fprintf(stderr, "\nProcessing file [../%s]\n", fname); getcwd(prevdir, sizeof(prevdir)); ret = chdir(SRCDIR_S "/data-70"); assert(ret == 0); fp = fopen(fname, "r"); ret = chdir(prevdir); assert(ret == 0); assert(fp); rd = fread(fbuf, 1, sizeof(fbuf), fp); fclose(fp); assert(rd > 0 && (size_t)rd < sizeof(fbuf)); /* expect small files */ process_XER_data(expectation, fbuf, rd); return 1; } int main() { DIR *dir; struct dirent *dent; int processed_files = 0; char *str; /* Process a specific test file */ str = getenv("DATA_70_FILE"); if(str && strncmp(str, "data-70-", 8) == 0) process(str); dir = opendir(SRCDIR_S "/data-70"); assert(dir); /* * Process each file in that directory. */ while((dent = readdir(dir))) { if(strncmp(dent->d_name, "data-70-", 8) == 0) if(process(dent->d_name)) processed_files++; } assert(processed_files); closedir(dir); return 0; } asn1c-0.9.28+dfsg/asn1c/tests/check-src/check-72.-fcompound-names.c0000644000000000000000000000055613065714043023074 0ustar rootroot#undef NDEBUG #include #include #include #include #include #include int main(int ac, char **av) { Type_t t; (void)ac; /* Unused argument */ (void)av; /* Unused argument */ memset(&t, 0, sizeof(t)); /* * No plans to fill it up: just checking whether it compiles or not. */ return 0; } asn1c-0.9.28+dfsg/asn1c/tests/check-src/check-44.c0000644000000000000000000000265313065714043017724 0ustar rootroot#undef NDEBUG #include #include #include #include #include #include uint8_t buf1[] = { 32 | ((3 << 6) + 1), /* [PRIVATE 1], constructed */ 4, /* L */ ((3 << 6) + 2), /* [PRIVATE 2], primitive */ 0, /* L */ ((3 << 6) + 5), /* [PRIVATE 5], primitive */ 0, /* L */ }; uint8_t buf2[] = { 32 | ((3 << 6) + 1), /* [PRIVATE 1], constructed */ 6, /* L */ ((3 << 6) + 2), /* [PRIVATE 2], primitive */ 0, /* L */ 32 | ((3 << 6) + 9), /* [PRIVATE 9], constructed */ 2, ((3 << 6) + 1), /* [PRIVATE 1], primitive */ 0, /* L */ }; static void check(int is_ok, uint8_t *buf, size_t size, size_t consumed) { T_t t, *tp; asn_dec_rval_t rval; tp = memset(&t, 0, sizeof(t)); fprintf(stderr, "Buf %p\n", buf); rval = ber_decode(0, &asn_DEF_T, (void **)&tp, buf, size); fprintf(stderr, "Returned code %d, consumed %zd\n", (int)rval.code, rval.consumed); if(is_ok) { assert(rval.code == RC_OK); assert(rval.consumed == consumed); } else { if(rval.code == RC_OK) { } assert(rval.consumed <= consumed); } } int main(int ac, char **av) { (void)ac; /* Unused argument */ (void)av; /* Unused argument */ check(1, buf1, sizeof(buf1), sizeof(buf1)); check(0, buf1, sizeof(buf1) - 1, sizeof(buf1) - 1); check(0, buf1, sizeof(buf1) - 2, sizeof(buf1) - 2); check(1, buf2, sizeof(buf2), sizeof(buf2)); check(0, buf2, sizeof(buf2) - 1, sizeof(buf2)); return 0; } asn1c-0.9.28+dfsg/asn1c/tests/check-src/check-32.c0000644000000000000000000000351513065714043017717 0ustar rootroot#undef NDEBUG #include #include #include #include #include #include #include #include int main(int ac, char **av) { Programming_t p; SeqWithMandatory_t swm; SeqWithOptional_t *swo = 0; Error_t *err; asn_enc_rval_t erv; asn_dec_rval_t drv; char buf[128]; (void)ac; /* Unused argument */ (void)av; /* Unused argument */ /* * No plans to fill Programming_t up: * just checking whether it compiles or not. */ memset(&p, 0, sizeof(p)); /* * Construct a dummy sequence: * SeqWithMandatory ::= { * seqOfMan [0] EXPLICIT SEQUENCE OF Error * } */ err = calloc(1, sizeof *err); memset(&swm, 0, sizeof swm); OCTET_STRING_fromBuf(&swm.someString, "Oley", 4); ASN_SEQUENCE_ADD(&swm.seqOfMan, err); /* * Encode the sequence. */ erv = der_encode_to_buffer(&asn_DEF_SeqWithMandatory, &swm, buf, sizeof buf); assert(erv.encoded > 0); buf[erv.encoded] = '\0'; /* * Try to decode it using a compatible type. */ drv = ber_decode(0, &asn_DEF_SeqWithOptional, (void **)&swo, buf, erv.encoded); assert(drv.code == RC_OK); assert((ssize_t)drv.consumed == erv.encoded); assert(swo->seqOfOpt != 0); xer_fprint(stderr, &asn_DEF_SeqWithOptional, swo); swo->seqOfOpt = 0; erv = der_encode_to_buffer(&asn_DEF_SeqWithOptional, swo, buf, sizeof buf); assert(erv.encoded > 0); buf[erv.encoded] = '\0'; swo = 0; drv = ber_decode(0, &asn_DEF_SeqWithMandatory, (void **)&swo, buf, erv.encoded); assert(drv.code != RC_OK); swo = 0; drv = ber_decode(0, &asn_DEF_SeqWithOptional, (void **)&swo, buf, erv.encoded); assert(drv.code == RC_OK); assert((ssize_t)drv.consumed == erv.encoded); assert(swo->seqOfOpt == 0); xer_fprint(stderr, &asn_DEF_SeqWithOptional, swo); printf("Finished\n"); return 0; } asn1c-0.9.28+dfsg/asn1c/tests/check-src/check-43.c0000644000000000000000000000072213065714043017716 0ustar rootroot#undef NDEBUG #include #include #include #include #include #include #include int main(int ac, char **av) { Test_structure_1_t ts1; Choice_1_t cs1; (void)ac; /* Unused argument */ (void)av; /* Unused argument */ memset(&ts1, 0, sizeof(ts1)); memset(&cs1, 0, sizeof(cs1)); /* * No plans to fill it up: just checking whether it compiles or not. */ return 0; } asn1c-0.9.28+dfsg/asn1c/tests/check-src/check-24.-fwide-types.c0000644000000000000000000000347213065714043022236 0ustar rootroot#undef NDEBUG #include #include #include #include #include #include uint8_t buf1[] = { 32 | ((2 << 6) + 5), /* [5], constructed */ 17, /* L */ 32 | 16, /* [UNIVERSAL 16], constructed */ 15, /* L */ /* INTEGER a */ 2, /* [UNIVERSAL 2] */ 2, /* L */ 150, 70, /* INTEGER b */ ((2 << 6) + 0), /* [0] */ 1, /* L */ 123, /* INTEGER c */ ((2 << 6) + 1), /* [1] */ 1, /* L */ 123, /* INTEGER d */ 32 | ((2 << 6) + 5), /* [5], constructed */ 3, 2, 1, /* L */ 123, }; static void check(int is_ok, uint8_t *buf, size_t size, size_t consumed) { T_t t, *tp; asn_dec_rval_t rval; tp = memset(&t, 0, sizeof(t)); fprintf(stderr, "Buf %p\n", buf); rval = ber_decode(0, &asn_DEF_T, (void **)&tp, buf, size); fprintf(stderr, "Returned code %d, consumed %zd\n", (int)rval.code, rval.consumed); if(is_ok) { assert(rval.code == RC_OK); assert(rval.consumed == consumed); } else { if(rval.code == RC_OK) { assert(t.a.size != 2 || (!t.b || t.b->size != 1) || (!t.c || t.c->size != 1) || t.d.size != 1 ); } assert(rval.consumed <= consumed); } } static void try_corrupt(uint8_t *buf, size_t size) { uint8_t *tmp; int i; fprintf(stderr, "\nCorrupting...\n"); tmp = alloca(size); for(i = 0; i < 1000; i++) { int loc; memcpy(tmp, buf, size); /* Corrupt random _non-value_ location. */ do { loc = random() % size; } while(tmp[loc] >= 70); do { tmp[loc] ^= random(); } while(tmp[loc] == buf[loc]); fprintf(stderr, "\nTry %d: corrupting byte %d (%d->%d)\n", i, loc, buf[loc], tmp[loc]); check(0, tmp, size, size); } } int main(int ac, char **av) { (void)ac; /* Unused argument */ (void)av; /* Unused argument */ check(1, buf1, sizeof(buf1), sizeof(buf1)); try_corrupt(buf1, sizeof(buf1)); return 0; } asn1c-0.9.28+dfsg/asn1c/tests/check-src/check-31.-fwide-types.c0000644000000000000000000001117313065714043022231 0ustar rootroot#undef NDEBUG #include #include #include #include #include #include uint8_t buf1[] = { 32 | 17, /* [UNIVERSAL 17], constructed */ 128, /* L, indefinite */ 32 | 16, /* [UNIVERSAL 16], constructed */ 6, /* L */ /* height INTEGER */ 2, /* [UNIVERSAL 2] */ 1, /* L */ 100, /* width INTEGER */ 2, /* [UNIVERSAL 2] */ 1, /* L */ 80, 32 | 16, /* [UNIVERSAL 16], constructed */ 6, /* L */ /* height INTEGER */ 2, /* [UNIVERSAL 2] */ 1, /* L */ 110, /* width INTEGER */ 2, /* [UNIVERSAL 2] */ 1, /* L */ 82, 0, /* End of forest */ 0 }; uint8_t buf1_reconstr[] = { 32 | 17, /* [UNIVERSAL 17], constructed */ 16, /* L */ 32 | 16, /* [UNIVERSAL 16], constructed */ 6, /* L */ /* height INTEGER */ 2, /* [UNIVERSAL 2] */ 1, /* L */ 100, /* width INTEGER */ 2, /* [UNIVERSAL 2] */ 1, /* L */ 80, 32 | 16, /* [UNIVERSAL 16], constructed */ 6, /* L */ /* height INTEGER */ 2, /* [UNIVERSAL 2] */ 1, /* L */ 110, /* width INTEGER */ 2, /* [UNIVERSAL 2] */ 1, /* L */ 82 }; size_t buf_pos; static int bytes_compare(const void *bufferp, size_t size, void *key) { const uint8_t *buffer = bufferp; assert(buf_pos + size <= sizeof(buf1_reconstr)); (void)key; /* Unused argument */ fprintf(stderr, " writing %zd (%zd)\n", size, buf_pos + size); for(; size; buf_pos++, size--, buffer++) { if(buf1_reconstr[buf_pos] != *buffer) { fprintf(stderr, "Byte %zd is different: %d != %d (%x != %x)\n", buf_pos, *buffer, buf1_reconstr[buf_pos], *buffer, buf1_reconstr[buf_pos] ); assert(buf1_reconstr[buf_pos] == *buffer); } } return 0; } static void check(int is_ok, uint8_t *buf, size_t size, size_t consumed) { Forest_t t, *tp; asn_dec_rval_t rval; tp = memset(&t, 0, sizeof(t)); fprintf(stderr, "Buf %p\n", buf); rval = ber_decode(0, &asn_DEF_Forest, (void **)&tp, buf, size); fprintf(stderr, "Returned code %d, consumed %d\n", (int)rval.code, (int)rval.consumed); if(is_ok) { assert(rval.code == RC_OK); assert(rval.consumed == consumed); assert(t.list.count == 2); assert(t.list.array[0]->height.size == 1); assert(t.list.array[0]->width.size == 1); assert(t.list.array[1]->height.size == 1); assert(t.list.array[1]->width.size == 1); } else { if(rval.code == RC_OK) { assert(t.list.count != 2 || t.list.array[0]->height.size != 1 || t.list.array[0]->width.size != 1 || t.list.array[1]->height.size != 1 || t.list.array[1]->width.size != 1 ); } assert(rval.consumed <= consumed); return; } /* * Try to re-create the buffer. */ buf_pos = 0; der_encode(&asn_DEF_Forest, &t, bytes_compare, buf1_reconstr); assert(buf_pos == (ssize_t)sizeof(buf1_reconstr)); asn_fprint(stderr, &asn_DEF_Forest, &t); xer_fprint(stderr, &asn_DEF_Forest, &t); asn_DEF_Forest.free_struct(&asn_DEF_Forest, &t, 1); } static char xer_buf[512]; static int xer_off; static int xer_cb(const void *buffer, size_t size, void *key) { (void)key; assert(xer_off + size < sizeof(xer_buf)); memcpy(xer_buf + xer_off, buffer, size); xer_off += size; return 0; } static void check_xer(uint8_t *buf, uint8_t size, char *xer_sample) { Forest_t *tp = 0; asn_dec_rval_t rval; asn_enc_rval_t er; int xer_sample_len = strlen(xer_sample); rval = ber_decode(0, &asn_DEF_Forest, (void **)&tp, buf, size); assert(rval.code == RC_OK); assert(rval.consumed == size); assert(tp); xer_off = 0; er = xer_encode(&asn_DEF_Forest, tp, XER_F_CANONICAL, xer_cb, 0); assert(er.encoded == xer_off); assert(xer_off); xer_buf[xer_off] = 0; printf("[%s] vs [%s]\n", xer_buf, xer_sample); assert(xer_off == xer_sample_len); assert(memcmp(xer_buf, xer_sample, xer_off) == 0); } static void try_corrupt(uint8_t *buf, size_t size) { uint8_t *tmp; int i; fprintf(stderr, "\nCorrupting...\n"); tmp = alloca(size); for(i = 0; i < 1000; i++) { int loc; memcpy(tmp, buf, size); /* Corrupt random _non-value_ location. */ do { loc = random() % size; } while(tmp[loc] >= 70); do { tmp[loc] = buf[loc] ^ random(); } while( (tmp[loc] == buf[loc]) || (buf[loc] == 0 && tmp[loc] == 0x80)); fprintf(stderr, "\nTry %d: corrupting byte %d (%d->%d)\n", i, loc, buf[loc], tmp[loc]); check(0, tmp, size, size); } } int main(int ac, char **av) { (void)ac; /* Unused argument */ (void)av; /* Unused argument */ check(1, buf1, sizeof(buf1), sizeof(buf1)); check_xer(buf1, sizeof(buf1), "1008011082"); try_corrupt(buf1, sizeof(buf1)); check(1, buf1, sizeof(buf1) + 20, sizeof(buf1)); return 0; } asn1c-0.9.28+dfsg/asn1c/tests/check-src/check-41.-fwide-types.c0000644000000000000000000002254413065714043022236 0ustar rootroot#undef NDEBUG #include #include #include #include #include #include uint8_t buf0[] = { 32 | ((2 << 6) + 1), /* [1], constructed */ 18, /* string [0] IMPLICIT UTF8String, */ (2 << 6), /* [0] */ 16, /* L */ 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', }; uint8_t buf0_reconstr[] = { 32 | ((2 << 6) + 1), /* [1], constructed */ 18, /* string [0] IMPLICIT UTF8String, */ (2 << 6), /* [0] */ 16, /* L */ 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', }; uint8_t buf1[] = { 32 | (2 << 6), /* [0], constructed */ 0x80 | 1, /* L */ 134, /* string [0] IMPLICIT UTF8String, */ (2 << 6), /* [0] */ 0x80 | 1, /* L */ 128, 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', /* alpha [1] IMPLICIT INTEGER OPTIONAL */ (2 << 6) + 1, /* [1] */ 1, /* L */ 75, }; uint8_t buf1_reconstr[] = { 32 | (2 << 6), /* [0], constructed */ 0x80 | 1, /* L */ 134, /* string [0] IMPLICIT UTF8String, */ (2 << 6), /* [0] */ 0x80 | 1, /* L */ 128, 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', /* alpha [1] IMPLICIT INTEGER OPTIONAL */ (2 << 6) + 1, /* [1] */ 1, /* L */ 75, }; uint8_t buf2[] = { 32 | ((2 << 6) + 1), /* [1], constructed */ 0x80 | 1, /* L */ 134, /* string [0] IMPLICIT UTF8String, */ (2 << 6), /* [0] */ 0x80 | 1, /* L */ 128, 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', /* beta [2] IMPLICIT INTEGER OPTIONAL */ (2 << 6) + 2, /* [2] */ 1, /* L */ 75, }; uint8_t buf2_reconstr[] = { 32 | ((2 << 6) + 1), /* [1], constructed */ 0x80 | 1, /* L */ 134, /* string [0] IMPLICIT UTF8String, */ (2 << 6), /* [0] */ 0x80 | 1, /* L */ 128, 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z', /* beta [2] IMPLICIT INTEGER OPTIONAL */ (2 << 6) + 2, /* [2] */ 1, /* L */ 75, }; static void check(T_t *tp, uint8_t *buf, size_t size, size_t consumed) { asn_dec_rval_t rval; int ret; tp = memset(tp, 0, sizeof(*tp)); fprintf(stderr, "Buf %p (%zd)\n", buf, size); rval = ber_decode(0, &asn_DEF_T, (void **)&tp, buf, size); fprintf(stderr, "Returned code %d, consumed %zd\n", (int)rval.code, rval.consumed); assert(rval.code == RC_OK); assert(rval.consumed == consumed); fprintf(stderr, "=== asn_fprint() ===\n"); ret = asn_fprint(stderr, &asn_DEF_T, tp); assert(ret == 0); fprintf(stderr, "=== xer_fprint() ===\n"); ret = xer_fprint(stderr, &asn_DEF_T, tp); fprintf(stderr, "=== END ===\n"); assert(ret == 0); /* assert(tp->string.size == 128); assert(strncmp(tp->string.buf, "zz") == 0); assert(strcmp((char *)tp->b.choice.b1.buf, "z") == 0 && strcmp((char *)tp->b.choice.b2.buf, "z") == 0); */ } size_t buf_pos; size_t buf_size; uint8_t *buffer; static int buf_fill(const void *bufp, size_t size, void *app_key) { (void)app_key; /* Unused argument */ if(buf_pos + size > buf_size) { fprintf(stderr, "%zd + %zd > %zd\n", buf_pos, size, buf_size); return -1; } memcpy(buffer + buf_pos, bufp, size); buf_pos += size; fprintf(stderr, " written %zd (%zd)\n", size, buf_pos); return 0; } static void compare(T_t *tp, uint8_t *cmp_buf, size_t cmp_buf_size) { asn_enc_rval_t erval; size_t i; buf_size = cmp_buf_size + 100; buffer = alloca(buf_size); buf_pos = 0; /* * Try to re-create using DER encoding. */ erval = der_encode(&asn_DEF_T, tp, buf_fill, 0); assert(erval.encoded != -1); if(erval.encoded != (ssize_t)cmp_buf_size) { printf("%zd != %zd\n", erval.encoded, cmp_buf_size); } assert(erval.encoded == (ssize_t)cmp_buf_size); for(i = 0; i < cmp_buf_size; i++) { if(buffer[i] != cmp_buf[i]) { fprintf(stderr, "Recreated buffer content mismatch:\n"); fprintf(stderr, "Byte %d, %x != %x (%d != %d)\n", (int)i, buffer[i], cmp_buf[i], buffer[i], cmp_buf[i] ); } assert(buffer[i] == cmp_buf[i]); } } static void partial_read(uint8_t *data, size_t size) { T_t t, *tp; asn_dec_rval_t rval; size_t i1, i2; uint8_t *data1 = alloca(size); uint8_t *data2 = alloca(size); uint8_t *data3 = alloca(size); fprintf(stderr, "\nPartial read sequence...\n"); /* * Divide the space (size) into three blocks in various combinations: * |<----->i1<----->i2<----->| * ^ data ^ data+size * Try to read block by block. */ for(i1 = 0; i1 < size; i1++) { for(i2 = i1; i2 < size; i2++) { uint8_t *chunk1 = data; size_t size1 = i1; uint8_t *chunk2 = data + size1; size_t size2 = i2 - i1; uint8_t *chunk3 = data + size1 + size2; size_t size3 = size - size1 - size2; fprintf(stderr, "\n%zd:{%zd, %zd, %zd}...\n", size, size1, size2, size3); memset(data1, 0, size); memset(data2, 0, size); memset(data3, 0, size); memcpy(data1, chunk1, size1); memcpy(data2, chunk2, size2); memcpy(data3, chunk3, size3); tp = memset(&t, 0, sizeof(t)); fprintf(stderr, "=> Chunk 1 (%zd):\n", size1); rval = ber_decode(0, &asn_DEF_T, (void **)&tp, data1, size1); assert(rval.code == RC_WMORE); assert(rval.consumed <= size1); if(rval.consumed < size1) { int leftover = size1 - rval.consumed; memcpy(data2, data1 + rval.consumed, leftover); memcpy(data2 + leftover, chunk2, size2); size2 += leftover; } fprintf(stderr, "=> Chunk 2 (%zd):\n", size2); rval = ber_decode(0, &asn_DEF_T, (void **)&tp, data2, size2); assert(rval.code == RC_WMORE); assert(rval.consumed <= size2); if(rval.consumed < size2) { int leftover = size2 - rval.consumed; memcpy(data3, data2 + rval.consumed, leftover); memcpy(data3 + leftover, chunk3, size3); size3 += leftover; } fprintf(stderr, "=> Chunk 3 (%zd):\n", size3); rval = ber_decode(0, &asn_DEF_T, (void **)&tp, data3, size3); assert(rval.code == RC_OK); assert(rval.consumed == size3); asn_DEF_T.free_struct(&asn_DEF_T, &t, 1); } } } int main() { T_t t; /* Check exact buf0 */ check(&t, buf0, sizeof(buf0), sizeof(buf0)); compare(&t, buf0_reconstr, sizeof(buf0_reconstr)); asn_DEF_T.free_struct(&asn_DEF_T, &t, 1); /* Check exact buf1 */ check(&t, buf1, sizeof(buf1), sizeof(buf1)); compare(&t, buf1_reconstr, sizeof(buf1_reconstr)); asn_DEF_T.free_struct(&asn_DEF_T, &t, 1); /* Check slightly more than buf1 */ check(&t, buf1, sizeof(buf1) + 10, sizeof(buf1)); compare(&t, buf1_reconstr, sizeof(buf1_reconstr)); asn_DEF_T.free_struct(&asn_DEF_T, &t, 1); /* Check exact buf2 */ check(&t, buf2, sizeof(buf2), sizeof(buf2)); compare(&t, buf2_reconstr, sizeof(buf2_reconstr)); asn_DEF_T.free_struct(&asn_DEF_T, &t, 1); /* Check slightly more than buf2 */ check(&t, buf2, sizeof(buf2) + 10, sizeof(buf2)); compare(&t, buf2_reconstr, sizeof(buf2_reconstr)); asn_DEF_T.free_struct(&asn_DEF_T, &t, 1); /* Split the buffer in parts and check decoder restartability */ partial_read(buf0, sizeof(buf0)); return 0; } asn1c-0.9.28+dfsg/asn1c/tests/check-src/check-62.c0000644000000000000000000001144713065714043017725 0ustar rootroot#undef NDEBUG #include #include #include #include /* for chdir(2), getcwd(3) */ #include #include #include #include #include #ifndef SRCDIR #define SRCDIR_S ".." #else #define STRINGIFY_MACRO2(x) #x #define STRINGIFY_MACRO(x) STRINGIFY_MACRO2(x) #define SRCDIR_S STRINGIFY_MACRO(SRCDIR) #endif enum expectation { EXP_OK, /* Encoding/decoding must succeed */ EXP_BROKEN, /* Decoding must fail */ EXP_RECLESS, /* Reconstruction is allowed to yield less data */ EXP_DIFFERENT, /* Reconstruction will yield different encoding */ }; static unsigned char buf[4096]; static int buf_offset; static int _buf_writer(const void *buffer, size_t size, void *app_key) { unsigned char *b, *bend; (void)app_key; assert(buf_offset + size < sizeof(buf)); memcpy(buf + buf_offset, buffer, size); b = buf + buf_offset; bend = b + size; printf("=> ["); for(; b < bend; b++) printf(" %02X", *b); printf("]:%zd\n", size); buf_offset += size; return 0; } static int save_object(T_t *st) { asn_enc_rval_t rval; /* Return value */ buf_offset = 0; rval = der_encode(&asn_DEF_T, st, _buf_writer, 0); if (rval.encoded == -1) { fprintf(stderr, "Cannot encode %s: %s\n", rval.failed_type->name, strerror(errno)); assert(rval.encoded != -1); return -1; /* JIC */ } fprintf(stderr, "SAVED OBJECT IN SIZE %d\n", buf_offset); return 0; } static T_t * load_object(enum expectation expectation, unsigned char *fbuf, size_t size) { asn_dec_rval_t rval; T_t *st = 0; int csize; fprintf(stderr, "LOADING OBJECT OF SIZE %d\n", (int)size); /* Perform multiple iterations with multiple chunks sizes */ for(csize = 1; csize < 20; csize += 1) { int fbuf_offset = 0; int fbuf_left = size; int fbuf_chunk = csize; if(st) asn_DEF_T.free_struct(&asn_DEF_T, st, 0); st = 0; do { fprintf(stderr, "Decoding from %d with %d (left %d)\n", fbuf_offset, fbuf_chunk, fbuf_left); rval = ber_decode(0, &asn_DEF_T, (void **)&st, fbuf + fbuf_offset, fbuf_chunk < fbuf_left ? fbuf_chunk : fbuf_left); fbuf_offset += rval.consumed; fbuf_left -= rval.consumed; if(rval.code == RC_WMORE) fbuf_chunk += 1; /* Give little more */ else fbuf_chunk = csize; /* Back off */ } while(fbuf_left && rval.code == RC_WMORE); if(expectation != EXP_BROKEN) { assert(rval.code == RC_OK); assert(fbuf_offset == (ssize_t)size); } else { assert(rval.code != RC_OK); fprintf(stderr, "Failed, but this was expected\n"); asn_DEF_T.free_struct(&asn_DEF_T, st, 0); st = 0; /* ignore leak for now */ } } if(st) asn_fprint(stderr, &asn_DEF_T, st); return st; } static void process_data(enum expectation expectation, unsigned char *fbuf, ssize_t size) { T_t *st; int ret; st = load_object(expectation, fbuf, size); if(!st) return; ret = save_object(st); assert(buf_offset < (ssize_t)sizeof(buf)); assert(ret == 0); switch(expectation) { case EXP_RECLESS: assert(buf_offset > 0 && buf_offset < size); assert(memcmp(buf + 2, fbuf + 2, buf_offset - 2) == 0); break; case EXP_DIFFERENT: assert(buf_offset > 0 && buf_offset < size); break; case EXP_BROKEN: assert(buf_offset != size || memcmp(buf, fbuf, buf_offset)); break; case EXP_OK: assert(buf_offset == (ssize_t)size); assert(memcmp(buf, fbuf, buf_offset) == 0); break; } asn_DEF_T.free_struct(&asn_DEF_T, st, 0); } /* * Decode the .der files and try to regenerate them. */ static int process(const char *fname) { char prevdir[256]; unsigned char fbuf[4096]; char *ext = strrchr(fname, '.'); enum expectation expectation; int ret; int rd; FILE *fp; if(ext == 0 || strcmp(ext, ".ber")) return 0; switch(ext[-1]) { case 'B': /* The file is intentionally broken */ expectation = EXP_BROKEN; break; case 'D': /* Reconstructing should yield different data */ expectation = EXP_DIFFERENT; break; case 'L': /* Extensions are present */ expectation = EXP_RECLESS; break; default: expectation = EXP_OK; break; } fprintf(stderr, "\nProcessing file [../%s]\n", fname); getcwd(prevdir, sizeof(prevdir)); ret = chdir(SRCDIR_S "/data-62"); assert(ret == 0); fp = fopen(fname, "r"); ret = chdir(prevdir); assert(ret == 0); assert(fp); rd = fread(fbuf, 1, sizeof(fbuf), fp); fclose(fp); assert(rd < (ssize_t)sizeof(fbuf)); /* expect small files */ process_data(expectation, fbuf, rd); return 1; } int main() { DIR *dir; struct dirent *dent; int processed_files = 0; char *str; dir = opendir(SRCDIR_S "/data-62"); assert(dir); str = getenv("DATA_62_FILE"); if(str && strncmp(str, "data-62-", 8) == 0) process(str); while((dent = readdir(dir))) { if(strncmp(dent->d_name, "data-62-", 8) == 0) if(process(dent->d_name)) processed_files++; } assert(processed_files); closedir(dir); return 0; } asn1c-0.9.28+dfsg/asn1c/tests/check-src/check-22.-fwide-types.c0000644000000000000000000000624313065714043022233 0ustar rootroot#undef NDEBUG #include #include #include #include #include #include uint8_t buf1[] = { 32 | 16, /* [UNIVERSAL 16], constructed */ 12, /* L */ /* INTEGER a */ ((2 << 6) + 0), /* [0], primitive */ 2, /* L */ 150, 70, /* b [1] EXPLICIT CHOICE */ 32 | ((2 << 6) + 1), /* [1] */ 3, /* L */ ((2 << 6) + 1), /* [1] */ 1, 'i', /* UTF8String c */ ((2 << 6) + 2), /* [2], primitive */ 1, /* L */ 'x' }; uint8_t buf2[128]; int buf2_pos; static int buf2_fill(const void *buffer, size_t size, void *app_key) { (void)app_key; if(buf2_pos + size > sizeof(buf2)) return -1; memcpy(buf2 + buf2_pos, buffer, size); buf2_pos += size; return 0; } static void check(int is_ok, uint8_t *buf, size_t size, size_t consumed) { T1_t t, *tp; void *tpp = &tp; asn_dec_rval_t rval; asn_enc_rval_t erval; int ret; int i; tp = memset(&t, 0, sizeof(t)); fprintf(stderr, "Buf %p\n", buf); rval = ber_decode(0, &asn_DEF_T1, (void **)tpp, buf, size); fprintf(stderr, "Returned code %d, consumed %d\n", (int)rval.code, (int)rval.consumed); if(is_ok) { assert(rval.code == RC_OK); assert(rval.consumed == (size_t)consumed); assert(t.a.size == 2); assert(t.b.present == b_PR_n); assert(t.b.choice.n.size == 1); assert(t.b.choice.n.buf[0] == 'i'); assert(t.c.size == 1); assert(t.c.buf[0] == 'x'); } else { if(rval.code == RC_OK) { assert(t.a.size != 2 || t.b.present != b_PR_n || t.b.choice.n.size != 1 || t.c.size != 1 ); } assert(rval.consumed <= (size_t)consumed); return; } fprintf(stderr, "=> Re-creating using DER encoder <=\n"); /* * Try to re-create using DER encoding. */ buf2_pos = 0; erval = der_encode(&asn_DEF_T1, tp, buf2_fill, 0); assert(erval.encoded != -1); if(erval.encoded != sizeof(buf1)) { printf("%d != %d\n", (int)erval.encoded, (int)sizeof(buf1)); } assert(erval.encoded == (ssize_t)sizeof(buf1)); for(i = 0; i < (ssize_t)sizeof(buf1); i++) { if(buf1[i] != buf2[i]) { fprintf(stderr, "Recreated buffer content mismatch:\n"); fprintf(stderr, "Byte %d, %x != %x (%d != %d)\n", i, buf1[i], buf2[i], buf1[i], buf2[i] ); } assert(buf1[i] == buf2[i]); } fprintf(stderr, "=== asn_fprint() ===\n"); ret = asn_fprint(stderr, &asn_DEF_T1, tp); assert(ret == 0); fprintf(stderr, "=== xer_fprint() ===\n"); ret = xer_fprint(stderr, &asn_DEF_T1, tp); assert(ret == 0); fprintf(stderr, "=== EOF ===\n"); } static void try_corrupt(uint8_t *buf, size_t size) { uint8_t *tmp; int i; fprintf(stderr, "\nCorrupting...\n"); tmp = alloca(size); for(i = 0; i < 1000; i++) { int loc; memcpy(tmp, buf, size); /* Corrupt random _non-value_ location. */ do { loc = random() % size; } while(tmp[loc] >= 70); do { tmp[loc] ^= random(); } while(tmp[loc] == buf[loc]); fprintf(stderr, "\nTry %d: corrupting byte %d (%d->%d)\n", i, loc, buf[loc], tmp[loc]); check(0, tmp, size, size); } } int main(int ac, char **av) { (void)ac; /* Unused argument */ (void)av; /* Unused argument */ check(1, buf1, sizeof(buf1), sizeof(buf1)); try_corrupt(buf1, sizeof(buf1)); check(1, buf1, sizeof(buf1) + 10, sizeof(buf1)); return 0; } asn1c-0.9.28+dfsg/asn1c/tests/check-src/check-70.-fwide-types.c0000644000000000000000000001736313065714043022243 0ustar rootroot/* * Mode of operation: * Each of the *.in files is XER-decoded, then converted into DER, * then decoded from DER and encoded into XER again. The resulting * stream is checked against rules specified in ../data-70/README file. */ #undef NDEBUG #include #include #include #include /* for chdir(2), getcwd(3) */ #include #include #include #include #include #include #ifndef SRCDIR #define SRCDIR_S ".." #else #define STRINGIFY_MACRO2(x) #x #define STRINGIFY_MACRO(x) STRINGIFY_MACRO2(x) #define SRCDIR_S STRINGIFY_MACRO(SRCDIR) #endif enum expectation { EXP_OK, /* Encoding/decoding must succeed */ EXP_CXER_EXACT, /* Encoding/decoding using CXER must be exact */ EXP_CXER_DIFF, /* Encoding/decoding using CXER must be different */ EXP_BROKEN, /* Decoding must fail */ EXP_DIFFERENT, /* Reconstruction will yield different encoding */ }; static unsigned char buf[4096]; static int buf_offset; static int _buf_writer(const void *buffer, size_t size, void *app_key) { unsigned char *b, *bend; (void)app_key; assert(buf_offset + size < sizeof(buf)); memcpy(buf + buf_offset, buffer, size); b = buf + buf_offset; bend = b + size; fprintf(stderr, "=> ["); for(; b < bend; b++) { if(*b >= 32 && *b < 127 && *b != '%') fprintf(stderr, "%c", *b); else fprintf(stderr, "%%%02x", *b); } fprintf(stderr, "]:%zd\n", size); buf_offset += size; return 0; } enum der_or_xer { AS_DER, AS_XER, AS_CXER, }; static void save_object_as(PDU_t *st, enum der_or_xer how) { asn_enc_rval_t rval; /* Return value */ buf_offset = 0; /* * Save object using specified method. */ switch(how) { case AS_DER: rval = der_encode(&asn_DEF_PDU, st, _buf_writer, 0); break; case AS_XER: rval = xer_encode(&asn_DEF_PDU, st, XER_F_BASIC, _buf_writer, 0); break; case AS_CXER: rval = xer_encode(&asn_DEF_PDU, st, XER_F_CANONICAL, _buf_writer, 0); break; } if (rval.encoded == -1) { fprintf(stderr, "Cannot encode %s: %s\n", rval.failed_type->name, strerror(errno)); assert(rval.encoded != -1); return; } fprintf(stderr, "SAVED OBJECT IN SIZE %d\n", buf_offset); } static PDU_t * load_object_from(enum expectation expectation, unsigned char *fbuf, size_t size, enum der_or_xer how) { asn_dec_rval_t rval; asn_dec_rval_t (*zer_decode)(struct asn_codec_ctx_s *, asn_TYPE_descriptor_t *, void **, const void *, size_t); PDU_t *st = 0; size_t csize = 1; if(how == AS_DER) zer_decode = ber_decode; else zer_decode = xer_decode; if(getenv("INITIAL_CHUNK_SIZE")) csize = atoi(getenv("INITIAL_CHUNK_SIZE")); /* Perform multiple iterations with multiple chunks sizes */ for(; csize < 20; csize += 1) { int fbuf_offset = 0; int fbuf_left = size; int fbuf_chunk = csize; fprintf(stderr, "LOADING OBJECT OF SIZE %zd, chunks %zd\n", size, csize); if(st) asn_DEF_PDU.free_struct(&asn_DEF_PDU, st, 0); st = 0; do { ASN_DEBUG("Decoding bytes %d..%d (left %d)", fbuf_offset, fbuf_chunk < fbuf_left ? fbuf_chunk : fbuf_left, fbuf_left); #ifdef EMIT_ASN_DEBUG if(st) { fprintf(stderr, "=== currently ===\n"); asn_fprint(stderr, &asn_DEF_PDU, st); fprintf(stderr, "=== end ===\n"); } #endif rval = zer_decode(0, &asn_DEF_PDU, (void **)&st, fbuf + fbuf_offset, fbuf_chunk < fbuf_left ? fbuf_chunk : fbuf_left); fbuf_offset += rval.consumed; fbuf_left -= rval.consumed; if(rval.code == RC_WMORE) fbuf_chunk += 1; /* Give little more */ else fbuf_chunk = csize; /* Back off */ } while(fbuf_left && rval.code == RC_WMORE); if(expectation != EXP_BROKEN) { assert(rval.code == RC_OK); if(how == AS_DER) { assert(fbuf_offset == (ssize_t)size); } else { assert(fbuf_offset - size < 2 || (fbuf_offset + 1 /* "\n" */ == (ssize_t)size && fbuf[size - 1] == '\n') || (fbuf_offset + 2 /* "\r\n" */ == (ssize_t)size && fbuf[size - 2] == '\r' && fbuf[size - 1] == '\n') ); } } else { assert(rval.code != RC_OK); fprintf(stderr, "Failed, but this was expected\n"); asn_DEF_PDU.free_struct(&asn_DEF_PDU, st, 0); st = 0; /* ignore leak for now */ } } if(st) asn_fprint(stderr, &asn_DEF_PDU, st); return st; } static int xer_encoding_equal(void *obufp, size_t osize, void *nbufp, size_t nsize) { char *obuf = obufp; char *nbuf = nbufp; char *oend = obuf + osize; char *nend = nbuf + nsize; if((osize && !nsize) || (!osize && nsize)) return 0; /* not equal apriori */ while(1) { while(obuf < oend && isspace(*obuf)) obuf++; while(nbuf < nend && isspace(*nbuf)) nbuf++; if(obuf == oend || nbuf == nend) { if(obuf == oend && nbuf == nend) break; fprintf(stderr, "%s data in reconstructed encoding\n", (obuf == oend) ? "More" : "Less"); return 0; } if(*obuf != *nbuf) { printf("%c%c != %c%c\n", obuf[0], obuf[1], nbuf[0], nbuf[1]); return 0; } obuf++, nbuf++; } return 1; } static void process_XER_data(enum expectation expectation, unsigned char *fbuf, size_t size) { PDU_t *st; st = load_object_from(expectation, fbuf, size, AS_XER); if(!st) return; /* Save and re-load as DER */ save_object_as(st, AS_DER); st = load_object_from(expectation, buf, buf_offset, AS_DER); assert(st); save_object_as(st, (expectation == EXP_CXER_EXACT || expectation == EXP_CXER_DIFF) ? AS_CXER : AS_XER); fprintf(stderr, "=== original ===\n"); fwrite(fbuf, 1, size, stderr); fprintf(stderr, "=== re-encoded ===\n"); fwrite(buf, 1, buf_offset, stderr); fprintf(stderr, "=== end ===\n"); switch(expectation) { case EXP_DIFFERENT: assert(!xer_encoding_equal(fbuf, size, buf, buf_offset)); break; case EXP_BROKEN: assert(!xer_encoding_equal(fbuf, size, buf, buf_offset)); break; case EXP_CXER_EXACT: buf[buf_offset++] = '\n'; assert((ssize_t)size == buf_offset); assert(memcmp(fbuf, buf, size) == 0); break; case EXP_CXER_DIFF: buf[buf_offset++] = '\n'; assert((ssize_t)size != buf_offset || memcmp(fbuf, buf, size)); break; case EXP_OK: assert(xer_encoding_equal(fbuf, size, buf, buf_offset)); break; } asn_DEF_PDU.free_struct(&asn_DEF_PDU, st, 0); } /* * Decode the .der files and try to regenerate them. */ static int process(const char *fname) { char prevdir[256]; unsigned char fbuf[4096]; char *ext = strrchr(fname, '.'); enum expectation expectation; int ret; int rd; FILE *fp; if(ext == 0 || strcmp(ext, ".in")) return 0; switch(ext[-1]) { case 'B': /* The file is intentionally broken */ expectation = EXP_BROKEN; break; case 'D': /* Reconstructing should yield different data */ expectation = EXP_DIFFERENT; break; case 'E': /* Byte to byte exact reconstruction */ expectation = EXP_CXER_EXACT; break; case 'X': /* Should fail byte-to-byte comparison */ expectation = EXP_CXER_DIFF; break; default: expectation = EXP_OK; break; } fprintf(stderr, "\nProcessing file [../%s]\n", fname); getcwd(prevdir, sizeof(prevdir)); ret = chdir(SRCDIR_S "/data-70"); assert(ret == 0); fp = fopen(fname, "r"); ret = chdir(prevdir); assert(ret == 0); assert(fp); rd = fread(fbuf, 1, sizeof(fbuf), fp); fclose(fp); assert(rd < (ssize_t)sizeof(fbuf)); /* expect small files */ process_XER_data(expectation, fbuf, rd); return 1; } int main() { DIR *dir; struct dirent *dent; int processed_files = 0; char *str; /* Process a specific test file */ str = getenv("DATA_70_FILE"); if(str && strncmp(str, "data-70-", 8) == 0) { process(str); return 0; } dir = opendir(SRCDIR_S "/data-70"); assert(dir); /* * Process each file in that directory. */ while((dent = readdir(dir))) { if(strncmp(dent->d_name, "data-70-", 8) == 0) if(process(dent->d_name)) processed_files++; } assert(processed_files); closedir(dir); return 0; } asn1c-0.9.28+dfsg/asn1c/tests/check-src/check-60.c0000644000000000000000000001062313065714043017716 0ustar rootroot#undef NDEBUG #include #include #include #include #include #include #include #include static unsigned char buf[4096]; static int buf_offset; static int _buf_writer(const void *buffer, size_t size, void *app_key) { unsigned char *b, *bend; (void)app_key; assert(buf_offset + size < sizeof(buf)); memcpy(buf + buf_offset, buffer, size); b = buf + buf_offset; bend = b + size; printf("=> ["); for(; b < bend; b++) printf(" %02X", *b); printf("]:%zd\n", size); buf_offset += size; return 0; } static int save_object(void *bs, asn_TYPE_descriptor_t *td) { asn_enc_rval_t rval; /* Return value */ int i; buf_offset = 0; rval = der_encode(td, bs, _buf_writer, 0); if (rval.encoded == -1) { fprintf(stderr, "Cannot encode %s: %s\n", rval.failed_type->name, strerror(errno)); assert(rval.encoded != -1); return -1; /* JIC */ } buf[buf_offset++] = 0xab; /* Finalize with garbage */ asn_fprint(stderr, td, bs); printf("OUT: ["); for(i = 0; i < buf_offset; i++) printf(" %02x", buf[i]); printf("]\n"); return 0; } static int load_object(void *bs, asn_TYPE_descriptor_t *td) { asn_dec_rval_t rval; fprintf(stderr, "\nLOADING OBJECT OF SIZE %d\n", buf_offset); rval = ber_decode(0, td, (void **)&bs, buf, buf_offset); assert(rval.code == RC_OK); asn_fprint(stderr, td, bs); return (rval.code == RC_OK)?0:-1; } /* [3] IMPLICIT SEQUENCE { b BOOLEAN } */ uint8_t test_any_buf1[] = { 0xa3, 0x80, /* [3], constructed, indefinite */ 0x01, 0x01, 0xff, /* b BOOLEAN ::= TRUE */ 0x00, 0x00 /* End of content octets */ }; /* b BOOLEAN */ uint8_t test_any_buf2[] = { 0x01, 0x01, 0x13 }; int main() { asn_TYPE_descriptor_t *td1 = &asn_DEF_T1; asn_TYPE_descriptor_t *td2 = &asn_DEF_T2; T1_t t1, t1_new; T2_t t2, t2_new; int ret; /* * Test the T1 with constructed indefinite length ANY encoding. */ memset(&t1, 0, sizeof(t1)); memset(&t1_new, 0, sizeof(t1_new)); t1.i = 112233; t1.any.buf = test_any_buf1; t1.any.size = sizeof(test_any_buf1); /* Save->Load must succeed */ save_object(&t1, td1); ret = load_object(&t1_new, td1); assert(ret == 0); assert(t1_new.i == 112233); assert(t1_new.any.size == (ssize_t)sizeof(test_any_buf1)); assert(memcmp(t1_new.any.buf, test_any_buf1, sizeof(test_any_buf1)) == 0); /* * Test the T1 with primitive encoding. */ memset(&t1, 0, sizeof(t1)); memset(&t1_new, 0, sizeof(t1_new)); t1.i = -112233; t1.any.buf = test_any_buf2; t1.any.size = sizeof(test_any_buf2); /* Save->Load must succeed */ save_object(&t1, td1); ret = load_object(&t1_new, td1); assert(ret == 0); assert(t1_new.i == -112233); assert(t1_new.any.size == (ssize_t)sizeof(test_any_buf2)); assert(memcmp(t1_new.any.buf, test_any_buf2, sizeof(test_any_buf2)) == 0); /* * Test the T2 empty sequence. */ memset(&t2, 0, sizeof(t2)); memset(&t2_new, 0, sizeof(t2_new)); t2.i = 332211; t2.any = calloc(1, sizeof(*t2.any)); t2.any->buf = 0; t2.any->size = 0; /* Save->Load must succeed */ save_object(&t2, td2); ret = load_object(&t2_new, td2); assert(ret == 0); assert(t2_new.i == 332211); assert(t2_new.any->size == 0); /* * Test the T2 sequence. */ memset(&t2, 0, sizeof(t2)); memset(&t2_new, 0, sizeof(t2_new)); t2.i = 332211; t2.any = calloc(1, sizeof(*t2.any)); t2.any->buf = test_any_buf1; t2.any->size = sizeof(test_any_buf1); /* Save->Load must succeed */ save_object(&t2, td2); ret = load_object(&t2_new, td2); assert(ret == 0); assert(t2_new.i == 332211); assert(t2_new.any->size == (ssize_t)sizeof(test_any_buf1)); assert(memcmp(t2_new.any->buf, test_any_buf1, sizeof(test_any_buf1)) == 0); /* * Test the T2 sequence with primitive encoding. */ memset(&t2, 0, sizeof(t2)); memset(&t2_new, 0, sizeof(t2_new)); t2.i = 0; t2.any = calloc(1, sizeof(*t2.any)); t2.any->buf = test_any_buf2; t2.any->size = sizeof(test_any_buf2); /* Save->Load must succeed */ save_object(&t2, td2); ret = load_object(&t2_new, td2); assert(ret == 0); assert(t2_new.i == 0); assert(t2_new.any->size == (ssize_t)sizeof(test_any_buf2)); assert(memcmp(t2_new.any->buf, test_any_buf2, sizeof(test_any_buf2)) == 0); /* * Test T2 with ANY element omitted. */ free(t2.any); t2.any = 0; memset(&t2_new, 0, sizeof(t2_new)); save_object(&t2, td2); ret = load_object(&t2_new, td2); assert(ret == 0); assert(t2_new.i == 0); assert(t2_new.any == 0); printf("OK\n"); return ret; } asn1c-0.9.28+dfsg/asn1c/tests/check-src/check-92.c0000644000000000000000000000057213065714043017725 0ustar rootroot#undef NDEBUG #include #include #include #include #include #include int main(int ac, char **av) { Everything_t t; (void)ac; /* Unused argument */ (void)av; /* Unused argument */ memset(&t, 0, sizeof(t)); /* * No plans to fill it up: just checking whether it compiles or not. */ return 0; } asn1c-0.9.28+dfsg/asn1c/tests/check-src/check-126.-gen-PER.c0000644000000000000000000002133013065714043021247 0ustar rootroot/* * Mode of operation: * Each of the *.in files is XER-decoded, then converted into PER, * compared with *.out file, then decoded and compared with the original. */ #undef NDEBUG #include #include #include #include /* for chdir(2) */ #include #include #include #include #include #include #ifndef SRCDIR #define SRCDIR_S ".." #else #define STRINGIFY_MACRO2(x) #x #define STRINGIFY_MACRO(x) STRINGIFY_MACRO2(x) #define SRCDIR_S STRINGIFY_MACRO(SRCDIR) #endif static unsigned char buf[4096]; static int buf_offset; static int _buf_writer(const void *buffer, size_t size, void *app_key) { unsigned char *b, *bend; (void)app_key; assert(buf_offset + size < sizeof(buf)); memcpy(buf + buf_offset, buffer, size); b = buf + buf_offset; bend = b + size; #ifdef EMIT_ASN_DEBUG fprintf(stderr, "=> ["); for(; b < bend; b++) { if(*b >= 32 && *b < 127 && *b != '%') fprintf(stderr, "%c", *b); else fprintf(stderr, "%%%02x", *b); } fprintf(stderr, "]:%zd\n", size); #endif buf_offset += size; return 0; } enum enctype { AS_PER, AS_DER, AS_XER, }; static void save_object_as(PDU_t *st, enum enctype how) { asn_enc_rval_t rval; /* Return value */ buf_offset = 0; /* * Save object using specified method. */ switch(how) { case AS_PER: rval = uper_encode(&asn_DEF_PDU, st, _buf_writer, 0); assert(rval.encoded > 0); fprintf(stderr, "SAVED OBJECT IN SIZE %d\n", buf_offset); return; case AS_DER: rval = der_encode(&asn_DEF_PDU, st, _buf_writer, 0); break; case AS_XER: rval = xer_encode(&asn_DEF_PDU, st, XER_F_BASIC, _buf_writer, 0); break; } if (rval.encoded == -1) { fprintf(stderr, "Cannot encode %s: %s\n", rval.failed_type->name, strerror(errno)); assert(rval.encoded != -1); return; } fprintf(stderr, "SAVED OBJECT IN SIZE %d\n", buf_offset); } static PDU_t * load_object_from(const char *fname, unsigned char *fbuf, size_t size, enum enctype how, int mustfail) { asn_dec_rval_t rval; PDU_t *st = 0; ssize_t csize = 1; if(getenv("INITIAL_CHUNK_SIZE")) csize = atoi(getenv("INITIAL_CHUNK_SIZE")); /* Perform multiple iterations with multiple chunks sizes */ for(; csize < 20; csize += 1) { int fbuf_offset = 0; int fbuf_left = size; int fbuf_chunk = csize; fprintf(stderr, "LOADING OBJECT OF SIZE %zd FROM [%s] as %s," " chunks %zd\n", size, fname, how==AS_PER?"PER":"XER", csize); if(st) asn_DEF_PDU.free_struct(&asn_DEF_PDU, st, 0); st = 0; do { ASN_DEBUG("\nDecoding bytes %d..%d (left %d) [%s]", fbuf_offset, fbuf_chunk < fbuf_left ? fbuf_chunk : fbuf_left, fbuf_left, fname); #ifdef EMIT_ASN_DEBUG if(st) { fprintf(stderr, "=== currently ===\n"); asn_fprint(stderr, &asn_DEF_PDU, st); fprintf(stderr, "=== end ===\n"); } #endif switch(how) { case AS_XER: rval = xer_decode(0, &asn_DEF_PDU, (void **)&st, fbuf + fbuf_offset, fbuf_chunk < fbuf_left ? fbuf_chunk : fbuf_left); break; case AS_DER: assert(0); break; case AS_PER: rval = uper_decode(0, &asn_DEF_PDU, (void **)&st, fbuf + fbuf_offset, fbuf_chunk < fbuf_left ? fbuf_chunk : fbuf_left, 0, 0); if(rval.code == RC_WMORE) { if(fbuf_chunk == fbuf_left) { fprintf(stderr, "-> PER decode error (%zd bits of %zd bytes (c=%d,l=%d)) \n", rval.consumed, size, fbuf_chunk, fbuf_left); rval.code = RC_FAIL; rval.consumed += 7; rval.consumed /= 8; if(mustfail) { fprintf(stderr, "-> (this was expected failure)\n"); return 0; } } else { rval.consumed = 0; /* Not restartable */ ASN_STRUCT_FREE(asn_DEF_PDU, st); st = 0; ASN_DEBUG("-> PER wants more"); } } else { ASN_DEBUG("-> PER ret %d/%zd mf=%d", rval.code, rval.consumed, mustfail); /* uper_decode() returns _bits_ */ rval.consumed += 7; rval.consumed /= 8; if((mustfail?1:0) == (rval.code == RC_FAIL)) { if(mustfail) { fprintf(stderr, "-> (this was expected failure)\n"); return 0; } } else { fprintf(stderr, "-> (unexpected %s)\n", mustfail ? "success" : "failure"); rval.code = RC_FAIL; } } break; } fbuf_offset += rval.consumed; fbuf_left -= rval.consumed; if(rval.code == RC_WMORE) fbuf_chunk += 1; /* Give little more */ else fbuf_chunk = csize; /* Back off */ } while(fbuf_left && rval.code == RC_WMORE); assert(rval.code == RC_OK); if(how == AS_PER) { fprintf(stderr, "[left %d, off %d, size %zd]\n", fbuf_left, fbuf_offset, size); assert(fbuf_offset == (ssize_t)size); } else { assert(fbuf_offset - size < 2 || (fbuf_offset + 1 /* "\n" */ == (ssize_t)size && fbuf[size - 1] == '\n') || (fbuf_offset + 2 /* "\r\n" */ == (ssize_t)size && fbuf[size - 2] == '\r' && fbuf[size - 1] == '\n') ); } } if(st) asn_fprint(stderr, &asn_DEF_PDU, st); return st; } static int xer_encoding_equal(void *obufp, size_t osize, void *nbufp, size_t nsize) { char *obuf = obufp; char *nbuf = nbufp; char *oend = obuf + osize; char *nend = nbuf + nsize; if((osize && !nsize) || (!osize && nsize)) return 0; /* not equal apriori */ while(1) { while(obuf < oend && isspace(*obuf)) obuf++; while(nbuf < nend && isspace(*nbuf)) nbuf++; if(obuf == oend || nbuf == nend) { if(obuf == oend && nbuf == nend) break; fprintf(stderr, "%s data in reconstructed encoding\n", (obuf == oend) ? "More" : "Less"); return 0; } if(*obuf != *nbuf) { printf("%c%c != %c%c\n", obuf[0], obuf[1], nbuf[0], nbuf[1]); return 0; } obuf++, nbuf++; } return 1; } static void compare_with_data_out(const char *fname, void *datap, size_t size) { char *data = datap; char outName[sizeof(SRCDIR_S) + 256]; unsigned char fbuf[1024]; size_t rd; FILE *f; char lastChar; int mustfail, compare; sprintf(outName, SRCDIR_S "/data-126/%s", fname); strcpy(outName + strlen(outName) - 3, ".out"); fprintf(stderr, "Comparing PER output with [%s]\n", outName); lastChar = outName[strlen(outName)-5]; mustfail = lastChar == 'P'; compare = lastChar != 'C'; if((compare && !mustfail) && getenv("REGENERATE")) { f = fopen(outName, "w"); fwrite(data, 1, size, f); fclose(f); } else { f = fopen(outName, "r"); assert(f); rd = fread(fbuf, 1, sizeof(fbuf), f); assert(rd); fclose(f); fprintf(stderr, "Trying to decode [%s]\n", outName); load_object_from(outName, fbuf, rd, AS_PER, mustfail); if(mustfail) return; if(compare) { assert(rd == (size_t)size); assert(memcmp(fbuf, data, rd) == 0); fprintf(stderr, "XER->PER recoding .in->.out match.\n"); } else { assert(rd != (size_t)size || memcmp(fbuf, data, rd)); fprintf(stderr, "XER->PER recoding .in->.out diverge.\n"); } } } static void process_XER_data(const char *fname, unsigned char *fbuf, size_t size) { PDU_t *st; st = load_object_from(fname, fbuf, size, AS_XER, 0); if(!st) return; /* Save and re-load as PER */ save_object_as(st, AS_PER); compare_with_data_out(fname, buf, buf_offset); st = load_object_from("buffer", buf, buf_offset, AS_PER, 0); assert(st); save_object_as(st, AS_XER); fprintf(stderr, "=== original ===\n"); fwrite(fbuf, 1, size, stderr); fprintf(stderr, "=== re-encoded ===\n"); fwrite(buf, 1, buf_offset, stderr); fprintf(stderr, "=== end ===\n"); if(fname[strlen(fname) - 4] == 'X') assert(!xer_encoding_equal((char *)fbuf, size, (char *)buf, buf_offset)); else assert(xer_encoding_equal((char *)fbuf, size, (char *)buf, buf_offset)); asn_DEF_PDU.free_struct(&asn_DEF_PDU, st, 0); } /* * Decode the .der files and try to regenerate them. */ static int process(const char *fname) { unsigned char fbuf[sizeof(SRCDIR_S) + 4096]; char *ext = strrchr(fname, '.'); int rd; FILE *fp; if(ext == 0 || strcmp(ext, ".in")) return 0; fprintf(stderr, "\nProcessing file [../%s]\n", fname); snprintf((char *)fbuf, sizeof(fbuf), SRCDIR_S "/data-126/%s", fname); fp = fopen((char *)fbuf, "r"); assert(fp); rd = fread(fbuf, 1, sizeof(fbuf), fp); fclose(fp); assert((size_t)rd < sizeof(fbuf)); /* expect small files */ process_XER_data(fname, fbuf, rd); fprintf(stderr, "Finished [%s]\n", fname); return 1; } int main() { DIR *dir; struct dirent *dent; int processed_files = 0; char *str; /* Process a specific test file */ str = getenv("DATA_126_FILE"); if(str && strncmp(str, "data-126-", 9) == 0) { process(str); return 0; } dir = opendir(SRCDIR_S "/data-126"); assert(dir); /* * Process each file in that directory. */ while((dent = readdir(dir))) { if(strncmp(dent->d_name, "data-126-", 9) == 0) if(process(dent->d_name)) processed_files++; } assert(processed_files); closedir(dir); return 0; } asn1c-0.9.28+dfsg/asn1c/tests/check-src/check-39.c0000644000000000000000000000055013065714043017722 0ustar rootroot#undef NDEBUG #include #include #include #include #include #include int main(int ac, char **av) { T_t t; (void)ac; /* Unused argument */ (void)av; /* Unused argument */ memset(&t, 0, sizeof(t)); /* * No plans to fill it up: just checking whether it compiles or not. */ return 0; } asn1c-0.9.28+dfsg/asn1c/tests/check-assembly.sh0000755000000000000000000000411713065714043017642 0ustar rootroot#!/bin/sh # # This script is designed to quickly create lots of files in underlying # test-* directories, do lots of other magic stuff and exit cleanly. # set -e if [ "x$1" = "x" ]; then echo "Usage: $0 " exit fi srcdir="${srcdir:-.}" abs_top_srcdir="${abs_top_srcdir:-$(pwd)/../../}" abs_top_builddir="${abs_top_builddir:-$(pwd)/../../}" if echo "$*" | grep -q -- -- ; then TEST_DRIVER=$(echo "$*" | sed -e 's/ -- .*/--/g') source_full=$(echo "$*" | sed -e 's/.* //g') else TEST_DRIVER="" source_full="$1" fi # Compute the .asn1 spec name by the given file name. source_short=$(echo "$source_full" | sed -e 's/.*\///') testno=$(echo "$source_short" | cut -f2 -d'-' | cut -f1 -d'.') args=$(echo "$source_short" | sed -e 's/\.c[c]*$//') OFS=$IFS IFS="." set $args shift IFS=$OFS AFLAGS="$*" # Assume the test fails. Will be removed when it passes well. testdir=test-${args} if [ -f "${testdir}-FAILED" ]; then rm -rf "${testdir}" fi touch "${testdir}-FAILED" mkdir -p "${testdir}" ln -fns "../${source_full}" "${testdir}" asn_module=$(echo "${abs_top_srcdir}/tests/${testno}"-*.asn1) # Create a Makefile for the project. cat > "$testdir/Makefile" <.c asn1c-0.9.28+dfsg/asn1c/tests/data-62/0000755000000000000000000000000013065714043015544 5ustar rootrootasn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-22.xbr0000644000000000000000000000035013065714043017636 0ustar rootroot

asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-16.xbr0000644000000000000000000000023613065714043017644 0ustar rootroot

test

asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-30-L.ber0000644000000000000000000000003513065714043020003 0ustar rootrootー79」  79023700808asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-11.ber0000644000000000000000000000001413065714043017606 0ustar rootroot0 。。。asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-03-B.xbr0000644000000000000000000000024413065714043020016 0ustar rootroot

&x05;

test

asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-17-B.xbr0000644000000000000000000000023713065714043020025 0ustar rootroot

test2

asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-17-B.ber0000644000000000000000000000001713065714043017776 0ustar rootroot0 。 痼test2asn1c-0.9.28+dfsg/asn1c/tests/data-62/Makefile0000644000000000000000000000034013065714043017201 0ustar rootroot all: @for xbr in *.xbr; do \ ber=`echo "$$xbr" | sed -e 's/\.xbr$$/\.ber/'`; \ if [ $$xbr -nt $$ber ]; then \ echo "../../enber $$xbr > $$ber"; \ ../../enber $$xbr > $$ber || exit $$?; \ fi; \ done asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-09-L.xbr0000644000000000000000000000110113065714043020027 0ustar rootroot

&x05;

test

-- extra component

&xff;

-- another extra component -- yet another extra component

z

-- and yet another one
asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-13-B.ber0000644000000000000000000000001213065714043017765 0ustar rootroot0。痼窶asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-14.ber0000644000000000000000000000002013065714043017606 0ustar rootroot0。 痼窶縲asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-18-B.ber0000644000000000000000000000001613065714043017776 0ustar rootroot0 。 痼testasn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-11.xbr0000644000000000000000000000020213065714043017630 0ustar rootroot asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-03-B.ber0000644000000000000000000000001513065714043017767 0ustar rootroot0 。testasn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-19-B.ber0000644000000000000000000000001613065714043017777 0ustar rootroot0 。 痼testasn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-22.ber0000644000000000000000000000001713065714043017613 0ustar rootroot0 。 痼ソ{キasn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-02-B.ber0000644000000000000000000000001513065714043017766 0ustar rootroot0 。testasn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-23-B.xbr0000644000000000000000000000035013065714043020016 0ustar rootroot

asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-07-B.xbr0000644000000000000000000000024513065714043020023 0ustar rootroot

&x05;

test

asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-02-B.xbr0000644000000000000000000000024513065714043020016 0ustar rootroot

&x05;

test

asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-09-L.ber0000644000000000000000000000004413065714043020011 0ustar rootroot0"。test。 痼ソ{キz痼asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-31-D.xbr0000644000000000000000000000047113065714043020023 0ustar rootroot

&x37;&x39;

&x00;

79023700808

&x00;

asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-30-L.xbr0000644000000000000000000000043013065714043020025 0ustar rootroot

&x37;&x39;

&x00;

79023700808

&x00;

asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-26-B.xbr0000644000000000000000000000036213065714043020024 0ustar rootroot

z

asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-32.xbr0000644000000000000000000000010013065714043017630 0ustar rootroot

123

asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-23-B.ber0000644000000000000000000000001713065714043017773 0ustar rootroot0 。 痼ソ{キasn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-24-L.ber0000644000000000000000000000002413065714043020004 0ustar rootroot0。痼ソ{キzasn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-25.xbr0000644000000000000000000000035213065714043017643 0ustar rootroot

z

asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-28-D.ber0000644000000000000000000000000613065714043020000 0ustar rootroot0。asn1c-0.9.28+dfsg/asn1c/tests/data-62/README0000644000000000000000000000017313065714043016425 0ustar rootroot*-B.* - The file is intentionally broken *-D.* - Reconstructing should yield different data *-L.* - Extensions are present asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-05-B.xbr0000644000000000000000000000024413065714043020020 0ustar rootroot

&x05;

test

asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-18-B.xbr0000644000000000000000000000023613065714043020025 0ustar rootroot

test

asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-10.ber0000644000000000000000000000001113065714043017602 0ustar rootroot0。{asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-06-B.xbr0000644000000000000000000000024413065714043020021 0ustar rootroot

&x05;

test

asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-20.ber0000644000000000000000000000001313065714043017605 0ustar rootroot0 。痼ソ{asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-12-B.ber0000644000000000000000000000000613065714043017767 0ustar rootroot0。。asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-04-B.xbr0000644000000000000000000000024413065714043020017 0ustar rootroot

&x05;

test

asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-15-B.xbr0000644000000000000000000000030513065714043020017 0ustar rootroot -- missing EOC asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-28-D.xbr0000644000000000000000000000011113065714043020020 0ustar rootroot asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-27.ber0000644000000000000000000000000413065714043017614 0ustar rootroot0。asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-27.xbr0000644000000000000000000000011113065714043017636 0ustar rootroot asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-32.ber0000644000000000000000000000001013065714043017605 0ustar rootrootソ5123asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-29-L.xbr0000644000000000000000000000056013065714043020041 0ustar rootroot

&x05;

test

-- extra component -- another one

&xff;

-- and yet another
asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-26-B.ber0000644000000000000000000000002213065714043017772 0ustar rootroot0。痼ソ{キzasn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-13-B.xbr0000644000000000000000000000030713065714043020017 0ustar rootroot -- Do not terminate: no end-of-content octets is intended. asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-24-L.xbr0000644000000000000000000000043313065714043020033 0ustar rootroot

z

asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-07-B.ber0000644000000000000000000000001513065714043017773 0ustar rootroot0 。testasn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-08-L.ber0000644000000000000000000000001713065714043020010 0ustar rootroot0 。testasn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-05-B.ber0000644000000000000000000000001513065714043017771 0ustar rootroot0。testasn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-01.ber0000644000000000000000000000001513065714043017606 0ustar rootroot0 。testasn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-14.xbr0000644000000000000000000000027313065714043017643 0ustar rootroot asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-21-B.ber0000644000000000000000000000001713065714043017771 0ustar rootroot0 。痼ソ{キasn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-10.xbr0000644000000000000000000000020213065714043017627 0ustar rootroot asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-21-B.xbr0000644000000000000000000000034613065714043020021 0ustar rootroot

asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-15-B.ber0000644000000000000000000000001613065714043017773 0ustar rootroot0 。 痼窶縲asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-29-L.ber0000644000000000000000000000003413065714043020012 0ustar rootroot0。test痼痼asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-19-B.xbr0000644000000000000000000000023613065714043020026 0ustar rootroot

test

asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-01.xbr0000644000000000000000000000024513065714043017636 0ustar rootroot

&x05;

test

asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-20.xbr0000644000000000000000000000022313065714043017633 0ustar rootroot asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-25.ber0000644000000000000000000000002013065714043017610 0ustar rootroot0。 痼ソ{キzasn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-08-L.xbr0000644000000000000000000000034013065714043020032 0ustar rootroot

&x05;

test

-- extra component
asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-31-D.ber0000644000000000000000000000003713065714043017776 0ustar rootrootー79」 79023700808asn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-06-B.ber0000644000000000000000000000001513065714043017772 0ustar rootroot0。testasn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-04-B.ber0000644000000000000000000000001513065714043017770 0ustar rootroot0。testasn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-16.ber0000644000000000000000000000001613065714043017615 0ustar rootroot0 。 痼testasn1c-0.9.28+dfsg/asn1c/tests/data-62/data-62-12-B.xbr0000644000000000000000000000023213065714043020013 0ustar rootroot -- Do not terminate: no end-of-content octets is intended asn1c-0.9.28+dfsg/asn1c/tests/data-119/0000755000000000000000000000000013065714043015627 5ustar rootrootasn1c-0.9.28+dfsg/asn1c/tests/data-119/data-119-09.in0000644000000000000000000000015113065714043017623 0ustar rootroot asn1c-0.9.28+dfsg/asn1c/tests/data-119/data-119-19.in0000644000000000000000000000040313065714043017624 0ustar rootroot kadabra AAAAZZZZ ム威オムムび! ABC ABCabc (extensibility in play) ABXZ asn1c-0.9.28+dfsg/asn1c/tests/data-119/data-119-22-P.in0000644000000000000000000000003613065714043020015 0ustar rootroot asn1c-0.9.28+dfsg/asn1c/tests/data-119/data-119-12-P.in0000644000000000000000000000004213065714043020011 0ustar rootroot FAIL asn1c-0.9.28+dfsg/asn1c/tests/data-119/data-119-15.in0000644000000000000000000000005213065714043017620 0ustar rootroot ABCabc,12234 asn1c-0.9.28+dfsg/asn1c/tests/data-119/data-119-17.in0000644000000000000000000000006013065714043017621 0ustar rootroot 1.3.6.1.4.1.9363.1.5.1 asn1c-0.9.28+dfsg/asn1c/tests/data-119/data-119-14-P.in0000644000000000000000000000004013065714043020011 0ustar rootroot 13 asn1c-0.9.28+dfsg/asn1c/tests/data-119/data-119-11-P.in0000644000000000000000000000004413065714043020012 0ustar rootroot FAIL asn1c-0.9.28+dfsg/asn1c/tests/data-119/data-119-06-P.in0000644000000000000000000000004013065714043020012 0ustar rootroot ムツフマヒマ asn1c-0.9.28+dfsg/asn1c/tests/data-119/data-119-24-P.in0000644000000000000000000000004113065714043020013 0ustar rootroot ABC asn1c-0.9.28+dfsg/asn1c/tests/data-119/README0000644000000000000000000000070213065714043016506 0ustar rootrootMode of operation: Each of the *.in files is XER-decoded, then converted into PER, then decoded back from PER, then encoded into XER again, and finally compared to the original encoding. Naming conventions: *-B.in - The file is intentionally broken *-P.in - Is not PER compatible, PER encoding must fail. *-E.in - CXER reconstruction should yield byte-wise identical data. Otherwise, a reconstructed buffer should loosely match the original. asn1c-0.9.28+dfsg/asn1c/tests/data-119/data-119-23-P.in0000644000000000000000000000003613065714043020016 0ustar rootroot asn1c-0.9.28+dfsg/asn1c/tests/data-119/data-119-03.in0000644000000000000000000000003113065714043017612 0ustar rootroot asn1c-0.9.28+dfsg/asn1c/tests/data-119/data-119-07-P.in0000644000000000000000000000005213065714043020016 0ustar rootroot non-capitals asn1c-0.9.28+dfsg/asn1c/tests/data-119/data-119-18.in0000644000000000000000000000041013065714043017621 0ustar rootroot abra kadabra AAAAZZZZ ム威オムムび! ABC ABCabc (extensibility in play) ABXZ asn1c-0.9.28+dfsg/asn1c/tests/data-119/data-119-20-P.in0000644000000000000000000000004013065714043020006 0ustar rootroot abcd asn1c-0.9.28+dfsg/asn1c/tests/data-119/data-119-13-P.in0000644000000000000000000000004213065714043020012 0ustar rootroot FAIL asn1c-0.9.28+dfsg/asn1c/tests/data-119/data-119-02.in0000644000000000000000000000004213065714043017613 0ustar rootroot 0123456789 asn1c-0.9.28+dfsg/asn1c/tests/data-119/data-119-16.in0000644000000000000000000000004613065714043017624 0ustar rootroot 3.14159265 asn1c-0.9.28+dfsg/asn1c/tests/data-119/data-119-05.in0000644000000000000000000000006313065714043017621 0ustar rootroot yabloko yabloko asn1c-0.9.28+dfsg/asn1c/tests/data-119/data-119-08.in0000644000000000000000000000007513065714043017627 0ustar rootroot CAPITALS CAPITALS asn1c-0.9.28+dfsg/asn1c/tests/data-119/data-119-04-P.in0000644000000000000000000000003113065714043020010 0ustar rootroot z asn1c-0.9.28+dfsg/asn1c/tests/data-119/data-119-21-P.in0000644000000000000000000000004013065714043020007 0ustar rootroot abcd asn1c-0.9.28+dfsg/asn1c/tests/data-119/data-119-25-P.in0000644000000000000000000000004113065714043020014 0ustar rootroot ABC asn1c-0.9.28+dfsg/asn1c/tests/data-119/data-119-01.in0000644000000000000000000000003013065714043017607 0ustar rootroot asn1c-0.9.28+dfsg/asn1c/tests/data-119/data-119-10.in0000644000000000000000000000032113065714043017612 0ustar rootroot BAZ BAZ BAZ 19 Do not respect SIZE constraint Do not respect SIZE constraint ABCabc asn1c-0.9.28+dfsg/asn1c/tests/data-70/0000755000000000000000000000000013065714043015543 5ustar rootrootasn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-39.in0000644000000000000000000000012513065714043017457 0ustar rootroot 123 asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-12.in0000644000000000000000000000006013065714043017444 0ustar rootroot asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-23-D.in0000644000000000000000000000024313065714043017632 0ustar rootroot 234 asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-22-D.in0000644000000000000000000000024013065714043017626 0ustar rootroot 0 in improper place one two asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-54-D.in0000644000000000000000000000011013065714043017627 0ustar rootroot 1 asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-52-D.in0000644000000000000000000000007613065714043017640 0ustar rootroot 1 asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-33.in0000644000000000000000000000011013065714043017443 0ustar rootroot asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-07-D.in0000644000000000000000000000016013065714043017632 0ustar rootroot 123.456.789.101112 asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-08-B.in0000644000000000000000000000017313065714043017635 0ustar rootroot 123.456.789.101112 1.2.3.4 asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-16-B.in0000644000000000000000000000012213065714043017626 0ustar rootroot one two asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-40-D.in0000644000000000000000000000016713065714043017636 0ustar rootroot 123 one two asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-26-B.in0000644000000000000000000000006213065714043017632 0ustar rootroot asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-25.in0000644000000000000000000000010613065714043017451 0ustar rootroot asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-05-B.in0000644000000000000000000000013413065714043017627 0ustar rootroot 231234 string asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-29-D.in0000644000000000000000000000010013065714043017630 0ustar rootroot asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-04-B.in0000644000000000000000000000001513065714043017624 0ustar rootroot asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-19.in0000644000000000000000000000013413065714043017455 0ustar rootroot one two asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-57-D.in0000644000000000000000000000011013065714043017632 0ustar rootroot 123.456.789.101112 asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-41-D.in0000644000000000000000000000016113065714043017631 0ustar rootroot asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-35-B.in0000644000000000000000000000015513065714043017635 0ustar rootroot 35 35 asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-58-D.in0000644000000000000000000000010613065714043017640 0ustar rootroot 123.456.789.101112 asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-49.in0000644000000000000000000000010113065714043017452 0ustar rootroot 1.0 asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-10.in0000644000000000000000000000004313065714043017443 0ustar rootroot asn1c-0.9.28+dfsg/asn1c/tests/data-70/README0000644000000000000000000000100113065714043016413 0ustar rootrootMode of operation: Each of the *.in files is XER-decoded, then converted into DER, then decoded back from DER, then encoded into XER again, and finally compared to the original encoding. Naming conventions: *-B.in - The file is intentionally (B)roken *-D.in - Reconstructing should yield (D)ifferent data *-E.in - CXER reconstruction should yield byte-wise identical data. *-X.in - CXER reconstruction should yield non-identical data. Otherwise, a reconstructed buffer should loosely match the original. asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-15.in0000644000000000000000000000012213065714043017446 0ustar rootroot one two asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-31-B.in0000644000000000000000000000011113065714043017621 0ustar rootroot 7 asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-46-X.in0000644000000000000000000000012713065714043017664 0ustar rootroot20040512224355+0000 asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-14-D.in0000644000000000000000000000014413065714043017632 0ustar rootroot something here asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-55.in0000644000000000000000000000007613065714043017462 0ustar rootroot 123.456.789.101112 asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-43-E.in0000644000000000000000000000012713065714043017636 0ustar rootroot20040512224355.123Z asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-02.in0000644000000000000000000000010713065714043017445 0ustar rootroot-1 asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-45-X.in0000644000000000000000000000012713065714043017663 0ustar rootroot20040512224355.120Z asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-17-D.in0000644000000000000000000000016313065714043017636 0ustar rootroot asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-11.in0000644000000000000000000000012413065714043017444 0ustar rootroot 8 7 6 9 asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-51.in0000644000000000000000000000010113065714043017443 0ustar rootroot 1 asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-34-B.in0000644000000000000000000000017013065714043017631 0ustar rootroot asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-24-D.in0000644000000000000000000000017313065714043017635 0ustar rootroot 234 asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-37-D.in0000644000000000000000000000011313065714043017633 0ustar rootroot 123.456.789 asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-28.in0000644000000000000000000000010313065714043017451 0ustar rootroot asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-56.in0000644000000000000000000000010013065714043017447 0ustar rootroot 123.456.789.101112 asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-62-D.in0000644000000000000000000000022513065714043017635 0ustar rootroot 123.456.789.101112 asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-48.in0000644000000000000000000000007313065714043017461 0ustar rootroot 1.0 asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-61-D.in0000644000000000000000000000011013065714043017625 0ustar rootroot 123.456.789.101112 asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-60-D.in0000644000000000000000000000010713065714043017632 0ustar rootroot 123.456.789.101112 asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-09-D.in0000644000000000000000000000015013065714043017633 0ustar rootroot 3.14 asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-30-B.in0000644000000000000000000000010013065714043017616 0ustar rootroot asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-13-D.in0000644000000000000000000000012713065714043017632 0ustar rootroot something here asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-21-D.in0000644000000000000000000000023213065714043017626 0ustar rootroot one two asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-03.in0000644000000000000000000000017413065714043017452 0ustar rootroot 231234 01 01 11 01 string asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-36.in0000644000000000000000000000007613065714043017461 0ustar rootroot 123.456.789.101112 asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-59-D.in0000644000000000000000000000010713065714043017642 0ustar rootroot 123.456.789.101112 asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-47.in0000644000000000000000000000011513065714043017455 0ustar rootroot asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-20-D.in0000644000000000000000000000016513065714043017632 0ustar rootroot 123 one two asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-01.in0000644000000000000000000000014313065714043017444 0ustar rootroot 128 string asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-27.in0000644000000000000000000000006213065714043017454 0ustar rootroot asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-32.in0000644000000000000000000000010413065714043017445 0ustar rootroot 1 7 asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-53.in0000644000000000000000000000011313065714043017450 0ustar rootroot 1 asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-42-E.in0000644000000000000000000000012313065714043017631 0ustar rootroot20040512224355Z asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-18.in0000644000000000000000000000007213065714043017455 0ustar rootroot asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-44-X.in0000644000000000000000000000012713065714043017662 0ustar rootroot20040512224355,123Z asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-50.in0000644000000000000000000000011413065714043017446 0ustar rootroot asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-06-B.in0000644000000000000000000000004613065714043017632 0ustar rootroot asn1c-0.9.28+dfsg/asn1c/tests/data-70/data-70-38-B.in0000644000000000000000000000007413065714043017640 0ustar rootroot 123.456.789 345 asn1c-0.9.28+dfsg/asn1c/tests/data-126/0000755000000000000000000000000013065714043015625 5ustar rootrootasn1c-0.9.28+dfsg/asn1c/tests/data-126/data-126-04-P.in0000644000000000000000000000003613065714043020011 0ustar rootroot asn1c-0.9.28+dfsg/asn1c/tests/data-126/data-126-04-P.out0000644000000000000000000000000513065714043020206 0ustar rootroot asn1c-0.9.28+dfsg/asn1c/tests/data-126/data-126-08-P.out0000644000000000000000000000000313065714043020210 0ustar rootroot asn1c-0.9.28+dfsg/asn1c/tests/data-126/data-126-20.in0000644000000000000000000000023213065714043017610 0ustar rootroot some long string spanning multiple bytes zzz-zzz-zzz-zzz 13 asn1c-0.9.28+dfsg/asn1c/tests/data-126/data-126-21.in0000644000000000000000000000014213065714043017611 0ustar rootroot 0 asn1c-0.9.28+dfsg/asn1c/tests/data-126/data-126-17.in0000644000000000000000000000010113065714043017611 0ustar rootroot ab z asn1c-0.9.28+dfsg/asn1c/tests/data-126/data-126-05-P.in0000644000000000000000000000003613065714043020012 0ustar rootroot asn1c-0.9.28+dfsg/asn1c/tests/data-126/data-126-13.out0000644000000000000000000000001013065714043020005 0ustar rootrootチ  (asn1c-0.9.28+dfsg/asn1c/tests/data-126/data-126-12.in0000644000000000000000000000007613065714043017617 0ustar rootroot asn1c-0.9.28+dfsg/asn1c/tests/data-126/data-126-18-X.out0000644000000000000000000000001013065714043020217 0ustar rootrootチ0,8asn1c-0.9.28+dfsg/asn1c/tests/data-126/data-126-15.out0000644000000000000000000000000613065714043020014 0ustar rootrootチasn1c-0.9.28+dfsg/asn1c/tests/data-126/data-126-17.out0000644000000000000000000000001013065714043020011 0ustar rootrootチ0,8asn1c-0.9.28+dfsg/asn1c/tests/data-126/data-126-02-P.out0000644000000000000000000000000513065714043020204 0ustar rootroot タasn1c-0.9.28+dfsg/asn1c/tests/data-126/data-126-21.out0000644000000000000000000000001413065714043020010 0ustar rootrootパ(H asn1c-0.9.28+dfsg/asn1c/tests/data-126/data-126-11-C.in0000644000000000000000000000003613065714043017772 0ustar rootroot asn1c-0.9.28+dfsg/asn1c/tests/data-126/data-126-06-P.in0000644000000000000000000000003613065714043020013 0ustar rootroot asn1c-0.9.28+dfsg/asn1c/tests/data-126/data-126-09-C.in0000644000000000000000000000003613065714043020001 0ustar rootroot asn1c-0.9.28+dfsg/asn1c/tests/data-126/README0000644000000000000000000000057513065714043016514 0ustar rootrootMode of operation: Each of the *.in files is XER-decoded, then converted into PER, then compared with the .out file, then decoded back into XER and compared to the original .in file content. Naming conventions: *-C.in - Comparison of .out might fail, but decoding succeeds *-P.in - PER decoding of .out file must fail. *-X.in - Final XER comparison must fail. asn1c-0.9.28+dfsg/asn1c/tests/data-126/data-126-16.out0000644000000000000000000000000713065714043020016 0ustar rootrootチ  asn1c-0.9.28+dfsg/asn1c/tests/data-126/data-126-02-P.in0000644000000000000000000000003613065714043020007 0ustar rootroot asn1c-0.9.28+dfsg/asn1c/tests/data-126/data-126-20.out0000644000000000000000000000007413065714043020015 0ustar rootrootビB施蘂ウ~9蟋vtaンサN6ルモO 儕bモ/0ッ^愈駮ッ^愈H ミasn1c-0.9.28+dfsg/asn1c/tests/data-126/data-126-12.out0000644000000000000000000000000713065714043020012 0ustar rootrootチ(asn1c-0.9.28+dfsg/asn1c/tests/data-126/data-126-01.in0000644000000000000000000000003613065714043017611 0ustar rootroot asn1c-0.9.28+dfsg/asn1c/tests/data-126/data-126-13.in0000644000000000000000000000007713065714043017621 0ustar rootroot a asn1c-0.9.28+dfsg/asn1c/tests/data-126/data-126-15.in0000644000000000000000000000007713065714043017623 0ustar rootroot z asn1c-0.9.28+dfsg/asn1c/tests/data-126/data-126-08-P.in0000644000000000000000000000003613065714043020015 0ustar rootroot asn1c-0.9.28+dfsg/asn1c/tests/data-126/data-126-19.in0000644000000000000000000000023213065714043017620 0ustar rootroot some long string spanning multiple bytes zzz-zzz-zzz-zzz
42
asn1c-0.9.28+dfsg/asn1c/tests/data-126/data-126-18-X.in0000644000000000000000000000006113065714043020024 0ustar rootroot ab asn1c-0.9.28+dfsg/asn1c/tests/data-126/data-126-16.in0000644000000000000000000000010013065714043017607 0ustar rootroot a z asn1c-0.9.28+dfsg/asn1c/tests/data-126/data-126-06-P.out0000644000000000000000000000000313065714043020206 0ustar rootroot asn1c-0.9.28+dfsg/asn1c/tests/data-126/data-126-05-P.out0000644000000000000000000000000413065714043020206 0ustar rootroot @@asn1c-0.9.28+dfsg/asn1c/tests/data-126/data-126-07-P.in0000644000000000000000000000003613065714043020014 0ustar rootroot asn1c-0.9.28+dfsg/asn1c/tests/data-126/data-126-03-P.in0000644000000000000000000000003613065714043020010 0ustar rootroot asn1c-0.9.28+dfsg/asn1c/tests/data-126/data-126-11-C.out0000644000000000000000000000000413065714043020166 0ustar rootroot @asn1c-0.9.28+dfsg/asn1c/tests/data-126/data-126-07-P.out0000644000000000000000000000000313065714043020207 0ustar rootroot @asn1c-0.9.28+dfsg/asn1c/tests/data-126/data-126-19.out0000644000000000000000000000007313065714043020024 0ustar rootrootビB施蘂ウ~9蟋vtaンサN6ルモO 儕bモ/0ッ^愈駮ッ^愈0 Pasn1c-0.9.28+dfsg/asn1c/tests/data-126/data-126-03-P.out0000644000000000000000000000000413065714043020204 0ustar rootroot asn1c-0.9.28+dfsg/asn1c/tests/data-126/data-126-14.in0000644000000000000000000000010013065714043017605 0ustar rootroot ab asn1c-0.9.28+dfsg/asn1c/tests/data-126/data-126-10-C.in0000644000000000000000000000003613065714043017771 0ustar rootroot asn1c-0.9.28+dfsg/asn1c/tests/data-126/data-126-14.out0000644000000000000000000000001113065714043020007 0ustar rootrootチ0,8(asn1c-0.9.28+dfsg/asn1c/tests/data-126/data-126-09-C.out0000644000000000000000000000000413065714043020175 0ustar rootroot@ asn1c-0.9.28+dfsg/asn1c/tests/data-126/data-126-01.out0000644000000000000000000000000413065714043020005 0ustar rootrootァasn1c-0.9.28+dfsg/asn1c/tests/data-126/data-126-10-C.out0000644000000000000000000000000613065714043020167 0ustar rootroot拭asn1c-0.9.28+dfsg/asn1c/tests/check-42.cc0000644000000000000000000000046413065714043016221 0ustar rootroot/* * This file checks that the output may be compiled by the C++ compiler. */ #undef NDEBUG #include #include #include #include #include #include int main() { VariablePart_t t; t.present = VariablePart_PR_vrange; return 0; } asn1c-0.9.28+dfsg/asn1c/unber.c0000644000000000000000000006314413065714043014533 0ustar rootroot/*- * Copyright (c) 2004, 2005, 2006 Lev Walkin . * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $Id$ */ #include "sys-common.h" #define ASN_DISABLE_PER_SUPPORT 1 #include /* For static string tables */ #include #include #include #include #include #include #include #include #undef COPYRIGHT #define COPYRIGHT "Copyright (c) 2004, 2005 Lev Walkin \n" static void usage(const char *av0); /* Print the Usage screen and exit */ static int process(const char *fname); /* Perform the BER decoding */ static int decode_tlv_from_string(const char *datastring); static int single_type_decoding = 0; /* -1 enables that */ static int minimalistic = 0; /* -m enables that */ static int pretty_printing = 1; /* -p disables that */ static int skip_bytes = 0; /* -s controls that */ static char indent_bytes[16] = " "; /* -i controls that */ int main(int ac, char **av) { int ch; /* Command line character */ int i; /* Index in some loops */ /* * Process command-line options. */ while((ch = getopt(ac, av, "1hi:mps:t:v")) != -1) switch(ch) { case '1': single_type_decoding = 1; break; case 'i': i = atoi(optarg); if(i >= 0 && i < (int)sizeof(indent_bytes)) { memset(indent_bytes, ' ', i); indent_bytes[i] = '\0'; } else { fprintf(stderr, "-i %s: Invalid indent value\n", optarg); exit(EX_USAGE); } break; case 'm': minimalistic = 1; break; case 'p': pretty_printing = 0; break; case 's': skip_bytes = atoi(optarg); if(skip_bytes < 0) { fprintf(stderr, "-s %s: positive value expected\n", optarg); exit(EX_USAGE); } break; case 't': if(decode_tlv_from_string(optarg)) exit(EX_DATAERR); exit(0); case 'v': fprintf(stderr, "ASN.1 BER Decoder, v" VERSION "\n" COPYRIGHT); exit(0); break; case 'h': default: usage(av[0]); } /* * Ensure that there are some input files present. */ if(ac > optind) { ac -= optind; av += optind; } else { fprintf(stderr, "%s: No input files specified\n", av[0]); exit(1); } setvbuf(stdout, 0, _IOLBF, 0); /* * Iterate over input files and parse each. * All syntax trees from all files will be bundled together. */ for(i = 0; i < ac; i++) { if(process(av[i])) exit(EX_DATAERR); } return 0; } /* * Print the usage screen and exit(EX_USAGE). */ static void usage(const char *av0) { /* clang-format off */ fprintf(stderr, "ASN.1 BER Decoder, v" VERSION "\n" COPYRIGHT "Usage: %s [options] [-] [file ...]\n" "Options:\n" " -1 Decode only the first BER structure (otherwise, until EOF)\n" " -i Amount of spaces for output indentation (default is 4)\n" " -m Minimalistic mode: print as little as possible\n" " -p Do not attempt pretty-printing of known ASN.1 types\n" " -s Ignore first bytes of input\n" " -t Decode the given tag[/length] sequence (e.g. -t \"bf20\")\n" "\n" "The XML opening tag format is as follows:\n" " \n" "Where:\n" " tform Which form the value is in: constructed (\"C\", \"I\") or primitive (\"P\")\n" " off Offset of the encoded element in the unber input stream\n" " tag The tag class and value in human readable form\n" " tl_len The length of the TL (BER Tag and Length) encoding\n" " v_len The length of the value (V, encoded by the L), may be \"Indefinite\"\n" " type Likely name of the underlying ASN.1 type (for [UNIVERSAL n] tags)\n" " [F] Indicates that the value was reformatted (pretty-printed)\n" "See the manual page for details\n" , av0); /* clang-format on */ exit(EX_USAGE); } typedef enum pd_code { PD_FAILED = -1, PD_FINISHED = 0, PD_EOF = 1, } pd_code_e; static pd_code_e process_deeper(const char *fname, FILE *fp, asn1c_integer_t *offset, int level, ssize_t limit, ber_tlv_len_t *frame_size, ber_tlv_len_t effective_size, int expect_eoc); static void print_TL(int fin, asn1c_integer_t offset, int level, int constr, ssize_t tlen, ber_tlv_tag_t, ber_tlv_len_t, ber_tlv_len_t effective_frame_size); static int print_V(const char *fname, FILE *fp, ber_tlv_tag_t, ber_tlv_len_t); /* * Open the file and initiate recursive processing. */ static int process(const char *fname) { FILE *fp; pd_code_e pdc; asn1c_integer_t offset = 0; /* Stream decoding position */ ber_tlv_len_t frame_size = 0; /* Single frame size */ if(strcmp(fname, "-")) { fp = fopen(fname, "rb"); if(!fp) { perror(fname); return -1; } } else { fp = stdin; } /* * Skip the requested amount of bytes. */ for(; offset < skip_bytes; offset++) { if(fgetc(fp) == -1) { fprintf(stderr, "%s: input source (%" PRIdASN " bytes) " "has less data than \"-s %d\" switch " "wants to skip\n", fname, offset, skip_bytes); if(fp != stdin) fclose(fp); return -1; } } /* * Fetch out BER-encoded data until EOF or error. */ do { pdc = process_deeper(fname, fp, &offset, 0, -1, &frame_size, 0, 0); } while(pdc == PD_FINISHED && !single_type_decoding); if(fp != stdin) fclose(fp); if(pdc == PD_FAILED) return -1; return 0; } /* * Process the TLV recursively. */ static pd_code_e process_deeper(const char *fname, FILE *fp, asn1c_integer_t *offset, int level, ssize_t limit, ber_tlv_len_t *frame_size, ber_tlv_len_t effective_size, int expect_eoc) { unsigned char tagbuf[32]; ssize_t tblen = 0; pd_code_e pdc = PD_FINISHED; ber_tlv_tag_t tlv_tag; ber_tlv_len_t tlv_len; ssize_t t_len; ssize_t l_len; for(;;) { ber_tlv_len_t local_esize = 0; int constr; int ch; if(limit == 0) return PD_FINISHED; if(limit >= 0 && tblen >= limit) { fprintf(stderr, "%s: Too long TL sequence (%ld >= %ld)" " at %" PRIdASN ". " "Broken or maliciously constructed file\n", fname, (long)tblen, (long)limit, *offset); return PD_FAILED; } /* Get the next byte from the input stream */ ch = fgetc(fp); if(ch == -1) { if(limit > 0 || expect_eoc) { fprintf(stderr, "%s: Unexpected end of file (TL)" " at %" PRIdASN "\n", fname, *offset); return PD_FAILED; } else { return PD_EOF; } } tagbuf[tblen++] = ch; /* * Decode the TLV tag. */ t_len = ber_fetch_tag(tagbuf, tblen, &tlv_tag); switch(t_len) { case -1: fprintf(stderr, "%s: Fatal error decoding tag" " at %" PRIdASN "+%ld\n", fname, *offset, (long)tblen); return PD_FAILED; case 0: /* More data expected */ continue; } /* * Decode the TLV length. */ constr = BER_TLV_CONSTRUCTED(tagbuf); l_len = ber_fetch_length(constr, tagbuf + t_len, tblen - t_len, &tlv_len); switch(l_len) { case -1: fprintf(stderr, "%s: Fatal error decoding value length" " at %" PRIdASN "\n", fname, *offset + t_len); return PD_FAILED; case 0: /* More data expected */ continue; } /* Make sure the T & L decoders took exactly the whole buffer */ assert((t_len + l_len) == tblen); if(!expect_eoc || tagbuf[0] || tagbuf[1]) print_TL(0, *offset, level, constr, tblen, tlv_tag, tlv_len, effective_size); if(limit != -1) { /* If limit is set, account for the TL sequence */ limit -= (t_len + l_len); assert(limit >= 0); if(tlv_len > limit) { fprintf(stderr, "%s: Structure advertizes length (%ld) " "greater than of a parent container (%ld)\n", fname, (long)tlv_len, (long)limit); return PD_FAILED; } } *offset += t_len + l_len; *frame_size += t_len + l_len; effective_size += t_len + l_len; local_esize += t_len + l_len; if(expect_eoc && !tagbuf[0] && !tagbuf[1]) { /* End of content octets */ print_TL(1, *offset - 2, level - 1, 1, 2, 0, -1, effective_size); return PD_FINISHED; } if(constr) { ber_tlv_len_t dec = 0; /* * This is a constructed type. Process recursively. */ printf(">\n"); /* Close the opening tag */ if(tlv_len != -1 && limit != -1) { assert(limit >= tlv_len); } pdc = process_deeper(fname, fp, offset, level + 1, tlv_len == -1 ? limit : tlv_len, &dec, t_len + l_len, tlv_len == -1); if(pdc == PD_FAILED) return pdc; if(limit != -1) { assert(limit >= dec); limit -= dec; } *frame_size += dec; effective_size += dec; local_esize += dec; if(tlv_len == -1) { tblen = 0; if(pdc == PD_FINISHED && limit < 0 && !expect_eoc) return pdc; continue; } } else { assert(tlv_len >= 0); if(print_V(fname, fp, tlv_tag, tlv_len)) return PD_FAILED; if(limit != -1) { assert(limit >= tlv_len); limit -= tlv_len; } *offset += tlv_len; *frame_size += tlv_len; effective_size += tlv_len; local_esize += tlv_len; } print_TL(1, *offset, level, constr, tblen, tlv_tag, tlv_len, local_esize); tblen = 0; /* Report success for a single top level TLV */ if(level == 0 && limit == -1 && !expect_eoc) break; } /* for(;;) */ return pdc; } static void print_TL(int fin, asn1c_integer_t offset, int level, int constr, ssize_t tlen, ber_tlv_tag_t tlv_tag, ber_tlv_len_t tlv_len, ber_tlv_len_t effective_size) { if(fin && !constr) { printf("

\n"); return; } while(level-- > 0) fputs(indent_bytes, stdout); /* Print indent */ printf(fin ? "\n"); } } /* * Print the value in binary form, or reformat for pretty-printing. */ static int print_V(const char *fname, FILE *fp, ber_tlv_tag_t tlv_tag, ber_tlv_len_t tlv_len) { asn1c_integer_t *arcs = 0; /* Object identifier arcs */ unsigned char *vbuf = 0; asn1p_expr_type_e etype = 0; asn1c_integer_t collector = 0; int special_format = 0; ssize_t i; /* Figure out what type is it */ if(BER_TAG_CLASS(tlv_tag) == ASN_TAG_CLASS_UNIVERSAL && pretty_printing) { ber_tlv_tag_t tvalue = BER_TAG_VALUE(tlv_tag); etype = ASN_UNIVERSAL_TAG2TYPE(tvalue); } /* * Determine how to print the value, either in its native binary form, * encoded with &xNN characters, or using pretty-printing. * The basic string types (including "useful types", like UTCTime) * are excempt from this determination logic, because their alphabets * are subsets of the XML's native UTF-8 encoding. */ switch(etype) { case ASN_BASIC_BOOLEAN: if(tlv_len == 1) special_format = 1; else etype = 0; break; case ASN_BASIC_INTEGER: case ASN_BASIC_ENUMERATED: if((size_t)tlv_len <= sizeof(collector)) special_format = 1; else etype = 0; break; case ASN_BASIC_OBJECT_IDENTIFIER: case ASN_BASIC_RELATIVE_OID: if(tlv_len > 0 && tlv_len < 128 * 1024 /* VERY long OID! */) { arcs = MALLOC(sizeof(*arcs) * (tlv_len + 1)); if(arcs) { vbuf = MALLOC(tlv_len + 1); /* Not checking is intentional */ } } case ASN_BASIC_UTCTime: case ASN_BASIC_GeneralizedTime: case ASN_STRING_NumericString: case ASN_STRING_PrintableString: case ASN_STRING_VisibleString: case ASN_STRING_IA5String: case ASN_STRING_UTF8String: break; /* Directly compatible with UTF-8 */ case ASN_STRING_BMPString: case ASN_STRING_UniversalString: break; /* Not directly compatible with UTF-8 */ default: /* Conditionally compatible with UTF-8 */ if(((etype & ASN_STRING_MASK) || (etype == ASN_BASIC_OCTET_STRING) || /* * AUTOMATIC TAGS or IMPLICIT TAGS in effect, * Treat this primitive type as OCTET_STRING. */ (BER_TAG_CLASS(tlv_tag) != ASN_TAG_CLASS_UNIVERSAL && pretty_printing)) && (tlv_len > 0 && tlv_len < 128 * 1024)) { vbuf = MALLOC(tlv_len + 1); /* Not checking is intentional */ } break; } /* If collection vbuf is present, defer printing the F flag. */ if(!vbuf) printf(special_format ? " F>" : ">"); /* * Print the value in binary or text form, * or collect the bytes into vbuf. */ for(i = 0; i < tlv_len; i++) { int ch = fgetc(fp); if(ch == -1) { fprintf(stderr, "%s: Unexpected end of file (V)\n", fname); if(vbuf) FREEMEM(vbuf); if(arcs) FREEMEM(arcs); return -1; } switch(etype) { case ASN_BASIC_UTCTime: case ASN_BASIC_GeneralizedTime: case ASN_STRING_NumericString: case ASN_STRING_PrintableString: case ASN_STRING_VisibleString: case ASN_STRING_IA5String: case ASN_STRING_UTF8String: switch(ch) { default: if(((etype == ASN_STRING_UTF8String) || !(ch & 0x80)) && (ch >= 0x20)) { printf("%c", ch); break; } /* Fall through */ case 0x3c: case 0x3e: case 0x26: printf("&#x%02x;", ch); } break; case ASN_BASIC_BOOLEAN: switch(ch) { case 0: printf(""); break; case 0xff: printf(""); break; default: printf("", ch); } break; case ASN_BASIC_INTEGER: case ASN_BASIC_ENUMERATED: if(i) collector = collector * 256 + ch; else collector = (int)(signed char)ch; break; default: if(vbuf) { vbuf[i] = ch; } else { printf("&#x%02x;", ch); } } } /* Do post-processing */ switch(etype) { case ASN_BASIC_INTEGER: case ASN_BASIC_ENUMERATED: printf("%" PRIdASN, collector); break; case ASN_BASIC_OBJECT_IDENTIFIER: if(vbuf) { OBJECT_IDENTIFIER_t oid; int arcno; oid.buf = vbuf; oid.size = tlv_len; arcno = OBJECT_IDENTIFIER_get_arcs(&oid, arcs, sizeof(*arcs), tlv_len + 1); if(arcno >= 0) { assert(arcno <= (tlv_len + 1)); printf(" F>"); for(i = 0; i < arcno; i++) { if(i) printf("."); printf("%" PRIuASN, arcs[i]); } FREEMEM(vbuf); vbuf = 0; } } break; case ASN_BASIC_RELATIVE_OID: if(vbuf) { RELATIVE_OID_t oid; int arcno; oid.buf = vbuf; oid.size = tlv_len; arcno = RELATIVE_OID_get_arcs(&oid, arcs, sizeof(*arcs), tlv_len); if(arcno >= 0) { assert(arcno <= (tlv_len + 1)); printf(" F>"); for(i = 0; i < arcno; i++) { if(i) printf("."); printf("%" PRIuASN, arcs[i]); } FREEMEM(vbuf); vbuf = 0; } } break; default: break; } /* * If the buffer was not consumed, print it out. * It might be an OCTET STRING or other primitive type, * which might actually be printable, but we need to figure it out. */ if(vbuf) { int binary; /* * Check whether the data could be represented as text */ binary = -1 * (tlv_len >> 3); /* Threshold is 12.5% binary */ for(i = 0; i < tlv_len; i++) { switch(vbuf[i]) { case 0x1b: binary = 1; break; case 0x09: case 0x0a: case 0x0d: continue; default: if(vbuf[i] < 0x20 || vbuf[i] >= 0x7f) if(++binary > 0) /* Way too many */ break; continue; } break; } printf(">"); for(i = 0; i < tlv_len; i++) { if(binary > 0 || vbuf[i] < 0x20 || vbuf[i] >= 0x7f || vbuf[i] == 0x26 /* '&' */ || vbuf[i] == 0x3c /* '<' */ || vbuf[i] == 0x3e /* '>' */ ) printf("&#x%02x;", vbuf[i]); else printf("%c", vbuf[i]); } FREEMEM(vbuf); } if(arcs) FREEMEM(arcs); return 0; } static int decode_tlv_from_string(const char *datastring) { unsigned char *data, *dp; size_t dsize; /* Data size */ ssize_t len; ber_tlv_tag_t tlv_tag; ber_tlv_len_t tlv_len; const char *p; int half; dsize = strlen(datastring) + 1; dp = data = CALLOC(1, dsize); assert(data); for(half = 0, p = datastring; *p; p++) { /* clang-format off */ switch(*p) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': *dp |= *p - '0'; break; case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': *dp |= *p - 'A' + 10; break; case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': *dp |= *p - 'a' + 10; break; case ' ': case '\t': case '\r': case '\n': continue; default: fprintf(stderr, "Unexpected symbols in data string:\n"); fprintf(stderr, "%s\n", datastring); for(dp = data; datastring < p; datastring++, dp++) *dp = ' '; *dp = '\0'; fprintf(stderr, "%s^ <- here\n", (char *)data); return -1; } /* clang-format on */ if(half) dp++; else (*dp) <<= 4; half = !half; } assert((size_t)(dp - data) <= dsize); dsize = dp - data; printf("BER: "); for(dp = data; dp < data + dsize; dp++) printf("%02X", *dp); printf("\n"); len = ber_fetch_tag(data, dsize, &tlv_tag); switch(len) { case -1: fprintf(stderr, "TAG: Fatal error decoding tag\n"); return -1; case 0: fprintf(stderr, "TAG: More data expected\n"); return -1; default: printf("TAG: "); ber_tlv_tag_fwrite(tlv_tag, stdout); if(BER_TLV_CONSTRUCTED(data)) { printf(" (constructed)"); } else if(dsize >= 2 && data[0] == 0 && data[1] == 0) { printf(" (end-of-content)"); } else { printf(" (primitive)"); } if(BER_TAG_CLASS(tlv_tag) == ASN_TAG_CLASS_UNIVERSAL) { const char *str; ber_tlv_tag_t tvalue = BER_TAG_VALUE(tlv_tag); str = ASN_UNIVERSAL_TAG2STR(tvalue); if(str) printf(" \"%s\"", str); } printf("\n"); } if(dsize > (size_t)len) { len = ber_fetch_length(BER_TLV_CONSTRUCTED(data), data + len, dsize - len, &tlv_len); switch(len) { case -1: fprintf(stderr, "LEN: Fatal error decoding length\n"); return -1; case 0: fprintf(stderr, "LEN: More data expected\n"); return -1; default: if(tlv_len == (ber_tlv_len_t)-1) printf("LEN: Indefinite length encoding\n"); else printf("LEN: %ld bytes\n", (long)tlv_len); } } return 0; } /* * Dummy functions. */ asn_dec_rval_t ber_check_tags(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_struct_ctx_t *opt_ctx, const void *ptr, size_t size, int tag_mode, int last_tag_form, ber_tlv_len_t *last_length, int *opt_tlv_form) { asn_dec_rval_t rv = {0, 0}; (void)opt_codec_ctx; (void)td; (void)opt_ctx; (void)ptr; (void)size; (void)tag_mode; (void)last_tag_form; (void)last_length; (void)opt_tlv_form; return rv; } ssize_t der_write_tags(asn_TYPE_descriptor_t *td, size_t slen, int tag_mode, int last_tag_form, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key) { (void)td; (void)slen; (void)tag_mode; (void)last_tag_form; (void)tag; (void)cb; (void)app_key; return -1; } asn_dec_rval_t xer_decode_general(asn_codec_ctx_t *opt_codec_ctx, asn_struct_ctx_t *ctx, void *struct_key, const char *xml_tag, const void *buf_ptr, size_t size, int (*otd)(void *struct_key, const void *chunk_buf, size_t chunk_size), ssize_t (*br)(void *struct_key, const void *chunk_buf, size_t chunk_size, int have_more)) { asn_dec_rval_t rv = {0, 0}; (void)opt_codec_ctx; (void)ctx; (void)struct_key; (void)xml_tag; (void)buf_ptr; (void)size; (void)otd; (void)br; return rv; } asn_dec_rval_t OCTET_STRING_decode_uper(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *cts, void **sptr, asn_per_data_t *pd) { asn_dec_rval_t rv = {0, 0}; (void)ctx; (void)td; (void)cts; (void)sptr; (void)pd; return rv; } asn_enc_rval_t OCTET_STRING_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *cts, void *sptr, asn_per_outp_t *po) { asn_enc_rval_t er = {0, 0, 0}; (void)td; (void)cts; (void)sptr; (void)po; return er; } size_t xer_whitespace_span(const void *chunk_buf, size_t chunk_size) { (void)chunk_buf; (void)chunk_size; return 0; } asn1c-0.9.28+dfsg/asn1c/check-xxber.sh0000755000000000000000000000300213065714043016001 0ustar rootroot#!/bin/sh ORIG="./.check-xxber.orig.$$.tmp" TEST="./.check-xxber.test.$$.tmp" # Test diff(1) capabilities diff -a . . 2>/dev/null && diffArgs="-a" # Assume text files diff -u . . 2>/dev/null && diffArgs="$diffArgs -u" # Unified diff output cat< $ORIG

US

1¦ G

1¦ G

1¦ G

EOM ./enber $ORIG | ./unber -p -i 0 - > $TEST 2>&1 diff $diffArgs "$ORIG" "$TEST" >/dev/null 2>&1 diffExitCode=$? if [ "$diffExitCode" = "0" ]; then echo "FAILED: $0: expected failure, got success" exit 42; fi # Append necessary terminator echo '
' >> $ORIG # Try trancoding again ./enber $ORIG | ./unber -p -i 0 - > $TEST 2>&1 diff $diffArgs "$ORIG" "$TEST" diffExitCode=$? rm -f $ORIG $TEST exit $diffExitCode asn1c-0.9.28+dfsg/asn1c/sys-common.h0000644000000000000000000000416113065714043015523 0ustar rootroot/*- * Copyright (c) 2005 Lev Walkin . All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $Id$ */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_STAT_H #include /* for stat(2) */ #endif #ifndef _WIN32 #include /* for EX_USAGE & others */ #else /* _WIN32 */ #ifndef EX_USAGE #define EX_USAGE 64 #endif #ifndef EX_DATAERR #define EX_DATAERR 65 #endif #ifndef EX_SOFTWARE #define EX_SOFTWARE 70 #endif #ifndef EX_OSERR #define EX_OSERR 71 #endif #ifndef EX_OSFILE #define EX_OSFILE 72 #endif #if defined HAVE_DECL_ALLOCA && !HAVE_DECL_ALLOCA #define alloca _alloca #endif #define snprintf _snprintf #endif /* _WIN32 */ asn1c-0.9.28+dfsg/.clang-format0000644000000000000000000000051713065714043014615 0ustar rootroot--- Language: Cpp BasedOnStyle: Google AllowShortFunctionsOnASingleLine: None AlwaysBreakAfterDefinitionReturnType: TopLevel BreakBeforeBinaryOperators: NonAssignment ForEachMacros: [ TQ_FOR ] IndentCaseLabels: false IndentWidth: 4 MaxEmptyLinesToKeep: 2 SpaceBeforeParens: false TabWidth: 4 ... asn1c-0.9.28+dfsg/stamp-h.in0000644000000000000000000000001213065714043014131 0ustar rootroottimestamp asn1c-0.9.28+dfsg/BUGS0000644000000000000000000000273513065714043012731 0ustar rootroot 0. ASN.1 grammar parser is written mostly with respect to constructing a tree, so a tree destruction is not fully supported and certain memory leaks are known. Not a huge problem for run-once programs like a compiler. NOTE: This statement does not apply to the target code _produced_ by the compiler. 1. For purposes of compilation, INTEGER type is modelled using a large static type (asn_integer_t), but defined as any positive or negative value by ASN.1. Not a problem as most specifications use very small values anyway. NOTE: This statement does not apply to the target code _produced_ by the compiler. 2. A MACRO facility is part of obsolete ASN.1 standard, and is not supported. 3. Multiple tags applied at the same level are not supported: BadTags ::= [0] EXPLICIT [2] IMPLICIT OtherType The same thing could be achieved by using the indirection: GoodTags ::= [0] EXPLICIT OtherTypePtr OtherTypePtr ::= [2] IMPLICIT OtherType 4. Mixed definite/indefinite length in a _single_ BER tags sequence is not supported. Should not be a problem in the real world. Please note that it is still possible, for example, to encode a wrapper structure using definite length, and encode its substructure member using indefinite length. The BER decoder is perfectly capable of decoding such sequences. 5. Encoding or decoding of structures with combined length greater than 16MB is not tested. 6. XER codec does not support integer (INTEGER, ENUMERATED) values outside the signed long range.