mirror of
				https://gitea.osmocom.org/cellular-infrastructure/osmo-cbc.git
				synced 2025-10-31 12:13:52 +00:00 
			
		
		
		
	Compare commits
	
		
			31 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 91ea92868a | ||
|  | 1b402db278 | ||
|  | c5afbd3336 | ||
|  | da85d1f75a | ||
|  | 2c34f95a04 | ||
|  | 1a454c9174 | ||
|  | f25277e872 | ||
|  | 28d66aa8ec | ||
|  | 80184a4e41 | ||
|  | cc02c15505 | ||
|  | f4fa15cb0e | ||
|  | 16daffdc52 | ||
|  | 3bb05bafce | ||
|  | 637874eaf9 | ||
|  | f6a2a6ba4f | ||
|  | bd50b41eeb | ||
|  | f18c9d6f9c | ||
|  | 9fad2713c3 | ||
|  | b3743e9603 | ||
|  | 538bc4c699 | ||
|  | da8b98cf88 | ||
|  | 36a7759e39 | ||
|  | 7ae4b6d61f | ||
|  | 311673c365 | ||
|  | 7fbd6aa472 | ||
|  | 66221e60d6 | ||
|  | 0422a10253 | ||
|  | 292b2e895b | ||
|  | a7aca0333b | ||
|  | d04fe38e73 | ||
|  | eb82cbc249 | 
							
								
								
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -2,6 +2,7 @@ | |||||||
| *.a | *.a | ||||||
| *.lo | *.lo | ||||||
| *.la | *.la | ||||||
|  | *~ | ||||||
| .deps | .deps | ||||||
| Makefile | Makefile | ||||||
| Makefile.in | Makefile.in | ||||||
| @@ -20,7 +21,6 @@ depcomp | |||||||
| install-sh | install-sh | ||||||
| missing | missing | ||||||
| stamp-h1 | stamp-h1 | ||||||
| configure~ |  | ||||||
|  |  | ||||||
| # libtool | # libtool | ||||||
| ltmain.sh | ltmain.sh | ||||||
| @@ -62,3 +62,4 @@ doc/manuals/vty/cbc_vty_reference.xml | |||||||
|  |  | ||||||
| contrib/osmo-cbc.spec | contrib/osmo-cbc.spec | ||||||
| libosmo-sbcap.pc | libosmo-sbcap.pc | ||||||
|  | include/osmocom/sbcap/version.h | ||||||
|   | |||||||
| @@ -11,7 +11,7 @@ pkgconfig_DATA = \ | |||||||
| EXTRA_DIST = .version \ | EXTRA_DIST = .version \ | ||||||
| 	README.md \ | 	README.md \ | ||||||
| 	git-version-gen \ | 	git-version-gen \ | ||||||
| 	contrib/osmo-cbc.spec.in \ | 	debian \ | ||||||
| 	cbc.schema.json \ | 	cbc.schema.json \ | ||||||
| 	smscb.schema.json \ | 	smscb.schema.json \ | ||||||
| 	$(NULL) | 	$(NULL) | ||||||
|   | |||||||
							
								
								
									
										29
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										29
									
								
								README.md
									
									
									
									
									
								
							| @@ -60,10 +60,37 @@ Contributing | |||||||
| Our coding standards are described at | Our coding standards are described at | ||||||
| https://osmocom.org/projects/cellular-infrastructure/wiki/Coding_standards | https://osmocom.org/projects/cellular-infrastructure/wiki/Coding_standards | ||||||
|  |  | ||||||
| We us a gerrit based patch submission/review process for managing | We use a Gerrit based patch submission/review process for managing | ||||||
| contributions.  Please see | contributions.  Please see | ||||||
| https://osmocom.org/projects/cellular-infrastructure/wiki/Gerrit for | https://osmocom.org/projects/cellular-infrastructure/wiki/Gerrit for | ||||||
| more details | more details | ||||||
|  |  | ||||||
| The current patch queue for osmo-cbc can be seen at | The current patch queue for osmo-cbc can be seen at | ||||||
| https://gerrit.osmocom.org/#/q/project:osmo-cbc+status:open | https://gerrit.osmocom.org/#/q/project:osmo-cbc+status:open | ||||||
|  |  | ||||||
|  |  | ||||||
|  | Generating asn1c code | ||||||
|  | --------------------- | ||||||
|  |  | ||||||
|  | Upstream master as1nc from [vlm](https://github.com/vlm/asn1c) [doesn't support | ||||||
|  | APER encoding](https://github.com/vlm/asn1c/issues/452). Nevertheless, the | ||||||
|  | upstream fork maintained by a big contributor | ||||||
|  | [mouse07410](https://github.com/mouse07410/asn1c) does support it, and it is | ||||||
|  | used in osmo-cbc to generate the SBc-AP code from ASN.1 files present in | ||||||
|  | src/sbcap/asn1/. | ||||||
|  |  | ||||||
|  | In order to regenerate the code, one shall adjust the ASN1C_SKELETON_PATH and | ||||||
|  | ASN1C_BIN_PATH in configure.ac to point to the built & installed asn1c from | ||||||
|  | mouse07410 (usually `vlm_master` branch). Last generated code was built using | ||||||
|  | commit hash 08b293e8aa342d465d26805d1d66f3595b2ce261. | ||||||
|  |  | ||||||
|  | Then, do the usual `autoreconf -fi && ./configure`, using a buildir != srcdir | ||||||
|  | (important, in order to avoid ending up with tempotary files in srcdir and | ||||||
|  | making it difficult to stash the relevant changes). | ||||||
|  |  | ||||||
|  | Finally, run `make -C src/ regen`, which will regenerate the files and copy over | ||||||
|  | the skeletons, with git possibily showing changes in the following paths: | ||||||
|  | - include/osmocom/sbcap/ | ||||||
|  | - src/sbcap/gen/ | ||||||
|  | - src/sbcap/skel/ | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										9
									
								
								TODO-RELEASE
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								TODO-RELEASE
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | |||||||
|  | # When cleaning up this file: bump API version in corresponding Makefile.am and rename corresponding debian/lib*.install | ||||||
|  | # according to https://osmocom.org/projects/cellular-infrastructure/wiki/Make_a_new_release | ||||||
|  | # In short: https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html#Updating-version-info | ||||||
|  | # LIBVERSION=c:r:a | ||||||
|  | # If the library source code has changed at all since the last update, then increment revision: c:r + 1:a. | ||||||
|  | # If any interfaces have been added, removed, or changed since the last update: c + 1:0:a. | ||||||
|  | # If any interfaces have been added since the last public release: c:r:a + 1. | ||||||
|  | # If any interfaces have been removed or changed since the last public release: c:r:0. | ||||||
|  | #library	what			description / commit summary line | ||||||
| @@ -31,10 +31,10 @@ if test "x$PKG_CONFIG_INSTALLED" = "xno"; then | |||||||
| fi | fi | ||||||
| PKG_PROG_PKG_CONFIG([0.20]) | PKG_PROG_PKG_CONFIG([0.20]) | ||||||
|  |  | ||||||
| PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.8.0) | PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.10.0) | ||||||
| PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.8.0) | PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.10.0) | ||||||
| PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.8.0) | PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.10.0) | ||||||
| PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 1.3.0) | PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 1.5.0) | ||||||
| PKG_CHECK_MODULES(ULFIUS, libulfius) | PKG_CHECK_MODULES(ULFIUS, libulfius) | ||||||
| PKG_CHECK_MODULES(JANSSON, jansson) | PKG_CHECK_MODULES(JANSSON, jansson) | ||||||
| PKG_CHECK_MODULES(ORCANIA, liborcania) | PKG_CHECK_MODULES(ORCANIA, liborcania) | ||||||
| @@ -196,7 +196,6 @@ AC_OUTPUT( | |||||||
|     include/osmocom/cbc/Makefile |     include/osmocom/cbc/Makefile | ||||||
|     include/osmocom/sbcap/Makefile |     include/osmocom/sbcap/Makefile | ||||||
|     contrib/Makefile |     contrib/Makefile | ||||||
|     contrib/osmo-cbc.spec |  | ||||||
|     tests/Makefile |     tests/Makefile | ||||||
|     tests/sbcap/Makefile |     tests/sbcap/Makefile | ||||||
|     doc/Makefile |     doc/Makefile | ||||||
|   | |||||||
| @@ -63,7 +63,7 @@ def do_create_cbs(args): | |||||||
|             }, |             }, | ||||||
|             'payload': { |             'payload': { | ||||||
|                 'payload_decoded': { |                 'payload_decoded': { | ||||||
|                     'character_set': "gsm", |                     'character_set': args.character_set, | ||||||
|                     #'language': 'en', |                     #'language': 'en', | ||||||
|                     'data_utf8': args.payload_data_utf8, |                     'data_utf8': args.payload_data_utf8, | ||||||
|                     #'data_utf8': "Mahlzeit1 Mahlzeit2 Mahlzeit3 Mahlzeit4 Mahlzeit5 Mahlzeit6 Mahlzeit7 Mahlzeit8" |                     #'data_utf8': "Mahlzeit1 Mahlzeit2 Mahlzeit3 Mahlzeit4 Mahlzeit5 Mahlzeit6 Mahlzeit7 Mahlzeit8" | ||||||
| @@ -126,6 +126,7 @@ def main(argv): | |||||||
|     parser_c_cbs.add_argument("--repetition-period", type=int, help='Repetition Period', default=5) |     parser_c_cbs.add_argument("--repetition-period", type=int, help='Repetition Period', default=5) | ||||||
|     parser_c_cbs.add_argument("--num-of-bcast", type=int, help='Number of Broadcasts', default=999) |     parser_c_cbs.add_argument("--num-of-bcast", type=int, help='Number of Broadcasts', default=999) | ||||||
|     parser_c_cbs.add_argument("--payload-data-utf8", type=str, help='Payload Data in UTF8', required=True) |     parser_c_cbs.add_argument("--payload-data-utf8", type=str, help='Payload Data in UTF8', required=True) | ||||||
|  |     parser_c_cbs.add_argument("--character-set", type=str, help='Character Set', default="gsm", choices=["gsm","ucs2","8bit"]) | ||||||
|     parser_c_cbs.set_defaults(func=do_create_cbs) |     parser_c_cbs.set_defaults(func=do_create_cbs) | ||||||
|  |  | ||||||
|     parser_c_etws = subparsers.add_parser('create-etws', help='Create a new ETWS message') |     parser_c_etws = subparsers.add_parser('create-etws', help='Create a new ETWS message') | ||||||
|   | |||||||
| @@ -30,7 +30,6 @@ export LD_LIBRARY_PATH="$inst/lib" | |||||||
| export PATH="$inst/bin:$PATH" | export PATH="$inst/bin:$PATH" | ||||||
|  |  | ||||||
| osmo-build-dep.sh libosmocore "" --disable-doxygen | osmo-build-dep.sh libosmocore "" --disable-doxygen | ||||||
| osmo-build-dep.sh libosmo-abis |  | ||||||
| osmo-build-dep.sh libosmo-netif "" --disable-doxygen | osmo-build-dep.sh libosmo-netif "" --disable-doxygen | ||||||
|  |  | ||||||
| # Additional configure options and depends | # Additional configure options and depends | ||||||
|   | |||||||
| @@ -1,128 +0,0 @@ | |||||||
| # |  | ||||||
| # spec file for package osmo-cbc |  | ||||||
| # |  | ||||||
| # Copyright (c) 2021, Harald Welte <laforge@gnumonks.org> |  | ||||||
| # |  | ||||||
| # All modifications and additions to the file contributed by third parties |  | ||||||
| # remain the property of their copyright owners, unless otherwise agreed |  | ||||||
| # upon. The license for this file, and modifications and additions to the |  | ||||||
| # file, is the same license as for the pristine package itself (unless the |  | ||||||
| # license for the pristine package is not an Open Source License, in which |  | ||||||
| # case the license is the MIT License). An "Open Source License" is a |  | ||||||
| # license that conforms to the Open Source Definition (Version 1.9) |  | ||||||
| # published by the Open Source Initiative. |  | ||||||
|  |  | ||||||
| ## Disable LTO for now since it breaks compilation of the tests |  | ||||||
| ## https://osmocom.org/issues/4113 |  | ||||||
| %define _lto_cflags %{nil} |  | ||||||
|  |  | ||||||
| Name:           osmo-cbc |  | ||||||
| Version:        @VERSION@ |  | ||||||
| Release:        0 |  | ||||||
| Summary:        OsmoCBC: Osmocom's Cell Broadcast Centre for 3GPP mobile networks |  | ||||||
| License:        AGPL-3.0-or-later |  | ||||||
| Group:          Hardware/Mobile |  | ||||||
| URL:            https://osmocom.org/projects/osmo-cbc |  | ||||||
| Source:         %{name}-%{version}.tar.xz |  | ||||||
| BuildRequires:  automake >= 1.9 |  | ||||||
| BuildRequires:  libtool >= 2 |  | ||||||
| BuildRequires:  pkgconfig >= 0.20 |  | ||||||
| %if 0%{?suse_version} |  | ||||||
| BuildRequires:  systemd-rpm-macros |  | ||||||
| %endif |  | ||||||
| BuildRequires:  pkgconfig(libsctp) |  | ||||||
| BuildRequires:  pkgconfig(libosmocore) >= 1.8.0 |  | ||||||
| BuildRequires:  pkgconfig(libosmogsm) >= 1.8.0 |  | ||||||
| BuildRequires:  pkgconfig(libosmovty) >= 1.8.0 |  | ||||||
| BuildRequires:  pkgconfig(libosmo-netif) >= 1.3.0 |  | ||||||
| BuildRequires:  pkgconfig(talloc) |  | ||||||
| BuildRequires:  pkgconfig(libulfius) |  | ||||||
| %{?systemd_requires} |  | ||||||
|  |  | ||||||
| %description |  | ||||||
| OsmoCBC: Osmocom's Cell Broadcast Centre for 3GPP mobile networks. |  | ||||||
|  |  | ||||||
| %package utils |  | ||||||
| Summary:	CLI utility to interface osmo-cbc REST interface |  | ||||||
| License:	MIT |  | ||||||
| Group:		Productivity/Telephony/Utilities |  | ||||||
|  |  | ||||||
| %description utils |  | ||||||
| CLI utility to interface with the osmo-cbc REST interface (ECBE). |  | ||||||
|  |  | ||||||
| %package -n libosmo-sbcap0 |  | ||||||
| Summary:	Osmocom's library to encode/decode SBc-AP messages |  | ||||||
| Group:          System/Libraries |  | ||||||
|  |  | ||||||
| %description -n libosmo-sbcap0 |  | ||||||
| Osmocom's library to encode/decode SBc-AP messages. |  | ||||||
|  |  | ||||||
| %package -n libosmo-sbcap-devel |  | ||||||
| Summary:        Development files for libosmo-sbcap |  | ||||||
| Group:          Development/Libraries/C and C++ |  | ||||||
| Requires:       libosmo-sbcap0 = %{version} |  | ||||||
|  |  | ||||||
| %description -n libosmo-sbcap-devel |  | ||||||
| Osmocom's library to encode/decode SBc-AP messages. |  | ||||||
|  |  | ||||||
| This subpackage contains libraries and header files for developing |  | ||||||
| applications that want to make use of libosmo-sbcap. |  | ||||||
|  |  | ||||||
| %prep |  | ||||||
| %setup -q |  | ||||||
|  |  | ||||||
| %build |  | ||||||
| echo "%{version}" >.tarball-version |  | ||||||
| autoreconf -fi |  | ||||||
| %configure \ |  | ||||||
|   --docdir=%{_docdir}/%{name} \ |  | ||||||
|   --with-systemdsystemunitdir=%{_unitdir} |  | ||||||
| make %{?_smp_mflags} |  | ||||||
|  |  | ||||||
| %install |  | ||||||
| %make_install |  | ||||||
| install -m 755 contrib/cbc-apitool.py %{buildroot}/usr/bin/cbc-apitool.py |  | ||||||
| find %{buildroot} \( -name '*.la' -o -name '*.a' \) -delete -print |  | ||||||
|  |  | ||||||
| %if 0%{?suse_version} |  | ||||||
| %preun |  | ||||||
| %service_del_preun %{name}.service |  | ||||||
|  |  | ||||||
| %postun |  | ||||||
| %service_del_postun %{name}.service |  | ||||||
|  |  | ||||||
| %pre |  | ||||||
| %service_add_pre %{name}.service |  | ||||||
|  |  | ||||||
| %post |  | ||||||
| %service_add_post %{name}.service |  | ||||||
| %endif |  | ||||||
|  |  | ||||||
| %check |  | ||||||
| make %{?_smp_mflags} check || (find . -name testsuite.log -exec cat {} +) |  | ||||||
|  |  | ||||||
| %files |  | ||||||
| %license COPYING |  | ||||||
| %doc README.md |  | ||||||
| %{_bindir}/osmo-cbc |  | ||||||
| %dir %{_docdir}/%{name}/examples |  | ||||||
| %dir %{_docdir}/%{name}/examples/osmo-cbc |  | ||||||
| %{_docdir}/%{name}/examples/osmo-cbc/osmo-cbc*.cfg |  | ||||||
| %dir %{_sysconfdir}/osmocom |  | ||||||
| %config(noreplace) %{_sysconfdir}/osmocom/osmo-cbc.cfg |  | ||||||
| %{_unitdir}/%{name}.service |  | ||||||
|  |  | ||||||
| %files utils |  | ||||||
| %{_bindir}/cbc-apitool.py |  | ||||||
|  |  | ||||||
| %files -n libosmo-sbcap0 |  | ||||||
| %{_libdir}/libosmo-sbcap.so.0* |  | ||||||
|  |  | ||||||
| %files -n libosmo-sbcap-devel |  | ||||||
| %{_libdir}/libosmo-sbcap.so |  | ||||||
| %{_libdir}/pkgconfig/libosmo-sbcap.pc |  | ||||||
| %dir %{_includedir}/osmocom |  | ||||||
| %dir %{_includedir}/osmocom/sbcap |  | ||||||
| %{_includedir}/osmocom/sbcap/*.h |  | ||||||
|  |  | ||||||
| %changelog |  | ||||||
| @@ -1,11 +1,15 @@ | |||||||
| [Unit] | [Unit] | ||||||
| Description=Osmocom CBC (Cell Broadcasting Centre) | Description=Osmocom CBC (Cell Broadcasting Centre) | ||||||
|  | After=network-online.target | ||||||
|  | Wants=network-online.target | ||||||
|  |  | ||||||
| [Service] | [Service] | ||||||
| Type=simple | Type=simple | ||||||
| StateDirectory=osmocom | StateDirectory=osmocom | ||||||
| WorkingDirectory=%S/osmocom | WorkingDirectory=%S/osmocom | ||||||
| Restart=always | Restart=always | ||||||
|  | User=osmocom | ||||||
|  | Group=osmocom | ||||||
| ExecStart=/usr/bin/osmo-cbc -c /etc/osmocom/osmo-cbc.cfg | ExecStart=/usr/bin/osmo-cbc -c /etc/osmocom/osmo-cbc.cfg | ||||||
| RestartSec=2 | RestartSec=2 | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										55
									
								
								debian/changelog
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										55
									
								
								debian/changelog
									
									
									
									
										vendored
									
									
								
							| @@ -1,3 +1,58 @@ | |||||||
|  | osmo-cbc (0.5.1) unstable; urgency=medium | ||||||
|  |  | ||||||
|  |   [ Oliver Smith ] | ||||||
|  |   * contrib/jenkins: libosmo-abis after libosmo-netif | ||||||
|  |  | ||||||
|  |   [ Pau Espin Pedrol ] | ||||||
|  |   * .gitignore: Add *~ | ||||||
|  |   * cbsp_link: Log unexpected return error codes | ||||||
|  |   * abis: Fix reusing link->conn while it is being destroyed | ||||||
|  |   * jenkins.sh: Skip building unneeded libosmo-abis | ||||||
|  |  | ||||||
|  |  -- Oliver Smith <osmith@sysmocom.de>  Wed, 12 Feb 2025 14:30:50 +0100 | ||||||
|  |  | ||||||
|  | osmo-cbc (0.5.0) unstable; urgency=medium | ||||||
|  |  | ||||||
|  |   [ Harald Welte ] | ||||||
|  |   * cbc-apitool: Make character set configurable | ||||||
|  |  | ||||||
|  |   [ Andreas Eversberg ] | ||||||
|  |   * Use uniform log format for default config files | ||||||
|  |  | ||||||
|  |   [ Vadim Yanitskiy ] | ||||||
|  |   * build: include debian/ into the release tarball | ||||||
|  |   * README.md: cosmetic: fix a typo | ||||||
|  |  | ||||||
|  |   [ Pau Espin Pedrol ] | ||||||
|  |   * SBcAP: Update as1nc skeleton and generated code | ||||||
|  |  | ||||||
|  |   [ Max ] | ||||||
|  |   * .deb/.rpm: add osmocom user during package install | ||||||
|  |  | ||||||
|  |   [ Oliver Smith ] | ||||||
|  |   * .deb/.rpm: various fixes related to non-root | ||||||
|  |   * contrib: remove rpm spec file | ||||||
|  |   * debian/postinst: add checks, be verbose | ||||||
|  |  | ||||||
|  |  -- Oliver Smith <osmith@sysmocom.de>  Thu, 25 Jul 2024 09:46:02 +0200 | ||||||
|  |  | ||||||
|  | osmo-cbc (0.4.2) unstable; urgency=medium | ||||||
|  |  | ||||||
|  |   [ Vadim Yanitskiy ] | ||||||
|  |   * {src,tests/sbcap}/Makefile.am: reorder libraries in LDADD | ||||||
|  |   * tests: use -no-install libtool flag to avoid ./lt-* scripts | ||||||
|  |  | ||||||
|  |   [ Oliver Smith ] | ||||||
|  |   * debian: set compat level to 10 | ||||||
|  |   * systemd: depend on networking-online.target | ||||||
|  |  | ||||||
|  |   [ Pau Espin Pedrol ] | ||||||
|  |   * sbcap: Update asn1c skeleton files | ||||||
|  |   * README.md: Document generation of SBcAP code from ASN.1 files | ||||||
|  |   * Catch and forbid configuring peers before configuring main protocol node | ||||||
|  |  | ||||||
|  |  -- Pau Espin Pedrol <pespin@sysmocom.de>  Tue, 12 Sep 2023 17:08:37 +0200 | ||||||
|  |  | ||||||
| osmo-cbc (0.4.1) unstable; urgency=medium | osmo-cbc (0.4.1) unstable; urgency=medium | ||||||
|  |  | ||||||
|   [ Vadim Yanitskiy ] |   [ Vadim Yanitskiy ] | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								debian/compat
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								debian/compat
									
									
									
									
										vendored
									
									
								
							| @@ -1 +1 @@ | |||||||
| 9 | 10 | ||||||
|   | |||||||
							
								
								
									
										12
									
								
								debian/control
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								debian/control
									
									
									
									
										vendored
									
									
								
							| @@ -2,7 +2,7 @@ Source: osmo-cbc | |||||||
| Section: net | Section: net | ||||||
| Priority: extra | Priority: extra | ||||||
| Maintainer: Osmocom team <openbsc@lists.osmocom.org> | Maintainer: Osmocom team <openbsc@lists.osmocom.org> | ||||||
| Build-Depends: debhelper (>=9), | Build-Depends: debhelper (>= 10), | ||||||
|                dh-autoreconf, |                dh-autoreconf, | ||||||
|                autotools-dev, |                autotools-dev, | ||||||
|                autoconf, |                autoconf, | ||||||
| @@ -11,12 +11,12 @@ Build-Depends: debhelper (>=9), | |||||||
|                pkg-config, |                pkg-config, | ||||||
|                python3-minimal, |                python3-minimal, | ||||||
|                libtalloc-dev, |                libtalloc-dev, | ||||||
|                libosmocore-dev (>= 1.8.0), |                libosmocore-dev (>= 1.10.0), | ||||||
|                libosmo-netif-dev (>= 1.3.0), |                libosmo-netif-dev (>= 1.5.0), | ||||||
|                libulfius-dev, |                libulfius-dev, | ||||||
|                libjansson-dev, |                libjansson-dev, | ||||||
|                libsctp-dev, |                libsctp-dev, | ||||||
|                osmo-gsm-manuals-dev |                osmo-gsm-manuals-dev (>= 1.6.0) | ||||||
| Standards-Version: 3.9.8 | Standards-Version: 3.9.8 | ||||||
| Vcs-Git: https://gitea.osmocom.org/cellular-infrastructure/osmo-cbc | Vcs-Git: https://gitea.osmocom.org/cellular-infrastructure/osmo-cbc | ||||||
| Vcs-Browser: https://gitea.osmocom.org/cellular-infrastructure/osmo-cbc | Vcs-Browser: https://gitea.osmocom.org/cellular-infrastructure/osmo-cbc | ||||||
| @@ -50,7 +50,7 @@ Description: ${misc:Package} PDF documentation | |||||||
|  Various manuals: user manual, VTY reference manual and/or |  Various manuals: user manual, VTY reference manual and/or | ||||||
|  protocol/interface manuals. |  protocol/interface manuals. | ||||||
|  |  | ||||||
| Package: libosmo-sbcap0 | Package: libosmo-sbcap2 | ||||||
| Section: libs | Section: libs | ||||||
| Architecture: any | Architecture: any | ||||||
| Multi-Arch: same | Multi-Arch: same | ||||||
| @@ -62,5 +62,5 @@ Package: libosmo-sbcap-dev | |||||||
| Section: libdevel | Section: libdevel | ||||||
| Architecture: any | Architecture: any | ||||||
| Multi-Arch: same | Multi-Arch: same | ||||||
| Depends: libosmo-sbcap0 (= ${binary:Version}), ${misc:Depends} | Depends: libosmo-sbcap2 (= ${binary:Version}), ${misc:Depends} | ||||||
| Description: libosmo-sbcap: Osmocom's library to encode/decode SBc-AP messages | Description: libosmo-sbcap: Osmocom's library to encode/decode SBc-AP messages | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								debian/osmo-cbc.install
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								debian/osmo-cbc.install
									
									
									
									
										vendored
									
									
								
							| @@ -1,4 +1,4 @@ | |||||||
| /etc/osmocom/osmo-cbc.cfg | /etc/osmocom/osmo-cbc.cfg | ||||||
| lib/systemd/system/osmo-cbc.service | lib/systemd/system/osmo-cbc.service | ||||||
| usr/bin/osmo-cbc | usr/bin/osmo-cbc | ||||||
| usr/share/doc/osmo-cbc/examples/osmo-cbc/*.cfg usr/share/doc/osmo-bsc/examples | usr/share/doc/osmo-cbc/examples/osmo-cbc/*.cfg usr/share/doc/osmo-cbc/examples | ||||||
|   | |||||||
							
								
								
									
										38
									
								
								debian/postinst
									
									
									
									
										vendored
									
									
										Executable file
									
								
							
							
						
						
									
										38
									
								
								debian/postinst
									
									
									
									
										vendored
									
									
										Executable file
									
								
							| @@ -0,0 +1,38 @@ | |||||||
|  | #!/bin/sh -e | ||||||
|  | case "$1" in | ||||||
|  | 	configure) | ||||||
|  | 		# Create the osmocom group and user (if it doesn't exist yet) | ||||||
|  | 		if ! getent group osmocom >/dev/null; then | ||||||
|  | 			groupadd --system osmocom | ||||||
|  | 		fi | ||||||
|  | 		if ! getent passwd osmocom >/dev/null; then | ||||||
|  | 			useradd \ | ||||||
|  | 				--system \ | ||||||
|  | 				--gid osmocom \ | ||||||
|  | 				--home-dir /var/lib/osmocom \ | ||||||
|  | 				--shell /sbin/nologin \ | ||||||
|  | 				--comment "Open Source Mobile Communications" \ | ||||||
|  | 				osmocom | ||||||
|  | 		fi | ||||||
|  |  | ||||||
|  | 		# Fix permissions of previous (root-owned) install (OS#4107) | ||||||
|  | 		if dpkg --compare-versions "$2" le "0.5.0"; then | ||||||
|  | 			if [ -e /etc/osmocom/osmo-cbc.cfg ]; then | ||||||
|  | 				chown -v osmocom:osmocom /etc/osmocom/osmo-cbc.cfg | ||||||
|  | 				chmod -v 0660 /etc/osmocom/osmo-cbc.cfg | ||||||
|  | 			fi | ||||||
|  |  | ||||||
|  | 			if [ -d /etc/osmocom ]; then | ||||||
|  | 				chown -v root:osmocom /etc/osmocom | ||||||
|  | 				chmod -v 2775 /etc/osmocom | ||||||
|  | 			fi | ||||||
|  |  | ||||||
|  | 			mkdir -p /var/lib/osmocom | ||||||
|  | 			chown -R -v osmocom:osmocom /var/lib/osmocom | ||||||
|  | 		fi | ||||||
|  | 		;; | ||||||
|  | esac | ||||||
|  |  | ||||||
|  | # dh_installdeb(1) will replace this with shell code automatically | ||||||
|  | # generated by other debhelper scripts. | ||||||
|  | #DEBHELPER# | ||||||
| @@ -1,4 +1,10 @@ | |||||||
| log stderr | log stderr | ||||||
|  |  logging color 1 | ||||||
|  |  logging print category-hex 0 | ||||||
|  |  logging print category 1 | ||||||
|  |  logging timestamp 0 | ||||||
|  |  logging print file basename last | ||||||
|  |  logging print level 1 | ||||||
|  logging level main notice |  logging level main notice | ||||||
|  logging level smscb notice |  logging level smscb notice | ||||||
|  logging level cbsp notice |  logging level cbsp notice | ||||||
|   | |||||||
| @@ -50,6 +50,8 @@ You can create a new CBS message using `cbc-apitool create-cbs`. | |||||||
| *--payload-data-utf8 PAYLOAD_DATA_UTF8*:: | *--payload-data-utf8 PAYLOAD_DATA_UTF8*:: | ||||||
|         Payload data (typically text message) in UTF8 encoding.  Will be |         Payload data (typically text message) in UTF8 encoding.  Will be | ||||||
|         transcoded to 7bit GSM alphabet internally. |         transcoded to 7bit GSM alphabet internally. | ||||||
|  | *--character-set {gsm,8bit,ucs2}*:: | ||||||
|  |         Character set to be used for the message.  Default: gsm | ||||||
|  |  | ||||||
|  |  | ||||||
| ==== `create-etws` Options | ==== `create-etws` Options | ||||||
|   | |||||||
| @@ -17,5 +17,5 @@ arguments: | |||||||
| 	Fork the process as a daemon into background. | 	Fork the process as a daemon into background. | ||||||
| *-c, --config-file 'CONFIGFILE'*:: | *-c, --config-file 'CONFIGFILE'*:: | ||||||
| 	Specify the file and path name of the configuration file to be | 	Specify the file and path name of the configuration file to be | ||||||
| 	used. If none is specified, use `osmo-bsc.cfg` in the current | 	used. If none is specified, use `osmo-cbc.cfg` in the current | ||||||
| 	working directory. | 	working directory. | ||||||
|   | |||||||
| @@ -57,11 +57,13 @@ struct cbc { | |||||||
| 		struct { | 		struct { | ||||||
| 			char *local_host; | 			char *local_host; | ||||||
| 			int local_port; | 			int local_port; | ||||||
|  | 			bool configured; | ||||||
| 		} cbsp; | 		} cbsp; | ||||||
| 		struct { | 		struct { | ||||||
| 			char *local_host[CBC_MAX_LOC_ADDRS]; | 			char *local_host[CBC_MAX_LOC_ADDRS]; | ||||||
| 			unsigned int num_local_host; | 			unsigned int num_local_host; | ||||||
| 			int local_port; | 			int local_port; | ||||||
|  | 			bool configured; | ||||||
| 		} sbcap; | 		} sbcap; | ||||||
| 		struct { | 		struct { | ||||||
| 			char *local_host; | 			char *local_host; | ||||||
| @@ -87,6 +89,7 @@ struct cbc { | |||||||
| extern struct cbc *g_cbc; | extern struct cbc *g_cbc; | ||||||
| struct cbc *cbc_alloc(void *ctx); | struct cbc *cbc_alloc(void *ctx); | ||||||
| int cbc_start(struct cbc *cbc); | int cbc_start(struct cbc *cbc); | ||||||
|  | void cbc_add_sbcap_default_local_host_if_needed(struct cbc *cbc); | ||||||
|  |  | ||||||
| /* rest_api.c */ | /* rest_api.c */ | ||||||
| int rest_api_init(void *ctx, const char *bind_addr, uint16_t port); | int rest_api_init(void *ctx, const char *bind_addr, uint16_t port); | ||||||
|   | |||||||
| @@ -1,3 +1,16 @@ | |||||||
|  | version.h: version.h.tpl | ||||||
|  | 	$(AM_V_GEN)$(MKDIR_P) $(dir $@) | ||||||
|  | 	$(AM_V_GEN)sed \ | ||||||
|  | 		-e "s/{{VERSION}}/$$(echo '@VERSION@' | cut -d. -f1-3)/g" \ | ||||||
|  | 		-e "s/{{VERSION_MAJOR}}/$$(echo '@VERSION@' | cut -d. -f1)/g" \ | ||||||
|  | 		-e "s/{{VERSION_MINOR}}/$$(echo '@VERSION@' | cut -d. -f2)/g" \ | ||||||
|  | 		-e "s/{{VERSION_PATCH}}/$$(echo '@VERSION@' | cut -d. -f3)/g" \ | ||||||
|  | 		$< > $@ | ||||||
|  |  | ||||||
|  | EXTRA_DIST = \ | ||||||
|  | 	version.h.tpl \ | ||||||
|  | 	$(NULL) | ||||||
|  |  | ||||||
| sbcap_HEADERS = \ | sbcap_HEADERS = \ | ||||||
| 	sbcap_common.h \ | 	sbcap_common.h \ | ||||||
| 	sbcap_internal.h \ | 	sbcap_internal.h \ | ||||||
| @@ -115,6 +128,7 @@ sbcap_HEADERS = \ | |||||||
| 	SBcAP_Write-Replace-Warning-Indication.h \ | 	SBcAP_Write-Replace-Warning-Indication.h \ | ||||||
| 	SBcAP_Write-Replace-Warning-Request.h \ | 	SBcAP_Write-Replace-Warning-Request.h \ | ||||||
| 	SBcAP_Write-Replace-Warning-Response.h \ | 	SBcAP_Write-Replace-Warning-Response.h \ | ||||||
|  | 	version.h \ | ||||||
| 	$(NULL) | 	$(NULL) | ||||||
|  |  | ||||||
| sbcapdir = $(includedir)/osmocom/sbcap | sbcapdir = $(includedir)/osmocom/sbcap | ||||||
|   | |||||||
| @@ -29,12 +29,12 @@ typedef long	 SBcAP_Concurrent_Warning_Message_Indicator_t; | |||||||
| /* Implementation */ | /* Implementation */ | ||||||
| extern asn_per_constraints_t asn_PER_type_SBcAP_Concurrent_Warning_Message_Indicator_constr_1; | extern asn_per_constraints_t asn_PER_type_SBcAP_Concurrent_Warning_Message_Indicator_constr_1; | ||||||
| extern asn_TYPE_descriptor_t asn_DEF_SBcAP_Concurrent_Warning_Message_Indicator; | extern asn_TYPE_descriptor_t asn_DEF_SBcAP_Concurrent_Warning_Message_Indicator; | ||||||
| extern const asn_INTEGER_specifics_t asn_SPC_Concurrent_Warning_Message_Indicator_specs_1; | extern const asn_INTEGER_specifics_t asn_SPC_SBcAP_Concurrent_Warning_Message_Indicator_specs_1; | ||||||
| asn_struct_free_f Concurrent_Warning_Message_Indicator_free; | asn_struct_free_f SBcAP_Concurrent_Warning_Message_Indicator_free; | ||||||
| asn_struct_print_f Concurrent_Warning_Message_Indicator_print; | asn_struct_print_f SBcAP_Concurrent_Warning_Message_Indicator_print; | ||||||
| asn_constr_check_f Concurrent_Warning_Message_Indicator_constraint; | asn_constr_check_f SBcAP_Concurrent_Warning_Message_Indicator_constraint; | ||||||
| per_type_decoder_f Concurrent_Warning_Message_Indicator_decode_aper; | per_type_decoder_f SBcAP_Concurrent_Warning_Message_Indicator_decode_aper; | ||||||
| per_type_encoder_f Concurrent_Warning_Message_Indicator_encode_aper; | per_type_encoder_f SBcAP_Concurrent_Warning_Message_Indicator_encode_aper; | ||||||
|  |  | ||||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||||
| } | } | ||||||
|   | |||||||
| @@ -31,12 +31,12 @@ typedef long	 SBcAP_Criticality_t; | |||||||
| /* Implementation */ | /* Implementation */ | ||||||
| extern asn_per_constraints_t asn_PER_type_SBcAP_Criticality_constr_1; | extern asn_per_constraints_t asn_PER_type_SBcAP_Criticality_constr_1; | ||||||
| extern asn_TYPE_descriptor_t asn_DEF_SBcAP_Criticality; | extern asn_TYPE_descriptor_t asn_DEF_SBcAP_Criticality; | ||||||
| extern const asn_INTEGER_specifics_t asn_SPC_Criticality_specs_1; | extern const asn_INTEGER_specifics_t asn_SPC_SBcAP_Criticality_specs_1; | ||||||
| asn_struct_free_f Criticality_free; | asn_struct_free_f SBcAP_Criticality_free; | ||||||
| asn_struct_print_f Criticality_print; | asn_struct_print_f SBcAP_Criticality_print; | ||||||
| asn_constr_check_f Criticality_constraint; | asn_constr_check_f SBcAP_Criticality_constraint; | ||||||
| per_type_decoder_f Criticality_decode_aper; | per_type_decoder_f SBcAP_Criticality_decode_aper; | ||||||
| per_type_encoder_f Criticality_encode_aper; | per_type_encoder_f SBcAP_Criticality_encode_aper; | ||||||
|  |  | ||||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||||
| } | } | ||||||
|   | |||||||
| @@ -33,6 +33,8 @@ typedef struct SBcAP_Error_Indication { | |||||||
|  |  | ||||||
| /* Implementation */ | /* Implementation */ | ||||||
| extern asn_TYPE_descriptor_t asn_DEF_SBcAP_Error_Indication; | extern asn_TYPE_descriptor_t asn_DEF_SBcAP_Error_Indication; | ||||||
|  | extern asn_SEQUENCE_specifics_t asn_SPC_SBcAP_Error_Indication_specs_1; | ||||||
|  | extern asn_TYPE_member_t asn_MBR_SBcAP_Error_Indication_1[1]; | ||||||
|  |  | ||||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||||
| } | } | ||||||
|   | |||||||
| @@ -37,6 +37,8 @@ typedef struct SBcAP_PWS_Failure_Indication { | |||||||
|  |  | ||||||
| /* Implementation */ | /* Implementation */ | ||||||
| extern asn_TYPE_descriptor_t asn_DEF_SBcAP_PWS_Failure_Indication; | extern asn_TYPE_descriptor_t asn_DEF_SBcAP_PWS_Failure_Indication; | ||||||
|  | extern asn_SEQUENCE_specifics_t asn_SPC_SBcAP_PWS_Failure_Indication_specs_1; | ||||||
|  | extern asn_TYPE_member_t asn_MBR_SBcAP_PWS_Failure_Indication_1[2]; | ||||||
|  |  | ||||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||||
| } | } | ||||||
|   | |||||||
| @@ -37,6 +37,8 @@ typedef struct SBcAP_PWS_Restart_Indication { | |||||||
|  |  | ||||||
| /* Implementation */ | /* Implementation */ | ||||||
| extern asn_TYPE_descriptor_t asn_DEF_SBcAP_PWS_Restart_Indication; | extern asn_TYPE_descriptor_t asn_DEF_SBcAP_PWS_Restart_Indication; | ||||||
|  | extern asn_SEQUENCE_specifics_t asn_SPC_SBcAP_PWS_Restart_Indication_specs_1; | ||||||
|  | extern asn_TYPE_member_t asn_MBR_SBcAP_PWS_Restart_Indication_1[2]; | ||||||
|  |  | ||||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||||
| } | } | ||||||
|   | |||||||
| @@ -31,12 +31,12 @@ typedef long	 SBcAP_Presence_t; | |||||||
| /* Implementation */ | /* Implementation */ | ||||||
| extern asn_per_constraints_t asn_PER_type_SBcAP_Presence_constr_1; | extern asn_per_constraints_t asn_PER_type_SBcAP_Presence_constr_1; | ||||||
| extern asn_TYPE_descriptor_t asn_DEF_SBcAP_Presence; | extern asn_TYPE_descriptor_t asn_DEF_SBcAP_Presence; | ||||||
| extern const asn_INTEGER_specifics_t asn_SPC_Presence_specs_1; | extern const asn_INTEGER_specifics_t asn_SPC_SBcAP_Presence_specs_1; | ||||||
| asn_struct_free_f Presence_free; | asn_struct_free_f SBcAP_Presence_free; | ||||||
| asn_struct_print_f Presence_print; | asn_struct_print_f SBcAP_Presence_print; | ||||||
| asn_constr_check_f Presence_constraint; | asn_constr_check_f SBcAP_Presence_constraint; | ||||||
| per_type_decoder_f Presence_decode_aper; | per_type_decoder_f SBcAP_Presence_decode_aper; | ||||||
| per_type_encoder_f Presence_encode_aper; | per_type_encoder_f SBcAP_Presence_encode_aper; | ||||||
|  |  | ||||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||||
| } | } | ||||||
|   | |||||||
| @@ -29,12 +29,12 @@ typedef long	 SBcAP_RAT_Selector_5GS_t; | |||||||
| /* Implementation */ | /* Implementation */ | ||||||
| extern asn_per_constraints_t asn_PER_type_SBcAP_RAT_Selector_5GS_constr_1; | extern asn_per_constraints_t asn_PER_type_SBcAP_RAT_Selector_5GS_constr_1; | ||||||
| extern asn_TYPE_descriptor_t asn_DEF_SBcAP_RAT_Selector_5GS; | extern asn_TYPE_descriptor_t asn_DEF_SBcAP_RAT_Selector_5GS; | ||||||
| extern const asn_INTEGER_specifics_t asn_SPC_RAT_Selector_5GS_specs_1; | extern const asn_INTEGER_specifics_t asn_SPC_SBcAP_RAT_Selector_5GS_specs_1; | ||||||
| asn_struct_free_f RAT_Selector_5GS_free; | asn_struct_free_f SBcAP_RAT_Selector_5GS_free; | ||||||
| asn_struct_print_f RAT_Selector_5GS_print; | asn_struct_print_f SBcAP_RAT_Selector_5GS_print; | ||||||
| asn_constr_check_f RAT_Selector_5GS_constraint; | asn_constr_check_f SBcAP_RAT_Selector_5GS_constraint; | ||||||
| per_type_decoder_f RAT_Selector_5GS_decode_aper; | per_type_decoder_f SBcAP_RAT_Selector_5GS_decode_aper; | ||||||
| per_type_encoder_f RAT_Selector_5GS_encode_aper; | per_type_encoder_f SBcAP_RAT_Selector_5GS_encode_aper; | ||||||
|  |  | ||||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||||
| } | } | ||||||
|   | |||||||
| @@ -29,12 +29,12 @@ typedef long	 SBcAP_Send_Stop_Warning_Indication_t; | |||||||
| /* Implementation */ | /* Implementation */ | ||||||
| extern asn_per_constraints_t asn_PER_type_SBcAP_Send_Stop_Warning_Indication_constr_1; | extern asn_per_constraints_t asn_PER_type_SBcAP_Send_Stop_Warning_Indication_constr_1; | ||||||
| extern asn_TYPE_descriptor_t asn_DEF_SBcAP_Send_Stop_Warning_Indication; | extern asn_TYPE_descriptor_t asn_DEF_SBcAP_Send_Stop_Warning_Indication; | ||||||
| extern const asn_INTEGER_specifics_t asn_SPC_Send_Stop_Warning_Indication_specs_1; | extern const asn_INTEGER_specifics_t asn_SPC_SBcAP_Send_Stop_Warning_Indication_specs_1; | ||||||
| asn_struct_free_f Send_Stop_Warning_Indication_free; | asn_struct_free_f SBcAP_Send_Stop_Warning_Indication_free; | ||||||
| asn_struct_print_f Send_Stop_Warning_Indication_print; | asn_struct_print_f SBcAP_Send_Stop_Warning_Indication_print; | ||||||
| asn_constr_check_f Send_Stop_Warning_Indication_constraint; | asn_constr_check_f SBcAP_Send_Stop_Warning_Indication_constraint; | ||||||
| per_type_decoder_f Send_Stop_Warning_Indication_decode_aper; | per_type_decoder_f SBcAP_Send_Stop_Warning_Indication_decode_aper; | ||||||
| per_type_encoder_f Send_Stop_Warning_Indication_encode_aper; | per_type_encoder_f SBcAP_Send_Stop_Warning_Indication_encode_aper; | ||||||
|  |  | ||||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||||
| } | } | ||||||
|   | |||||||
| @@ -29,12 +29,12 @@ typedef long	 SBcAP_Send_Write_Replace_Warning_Indication_t; | |||||||
| /* Implementation */ | /* Implementation */ | ||||||
| extern asn_per_constraints_t asn_PER_type_SBcAP_Send_Write_Replace_Warning_Indication_constr_1; | extern asn_per_constraints_t asn_PER_type_SBcAP_Send_Write_Replace_Warning_Indication_constr_1; | ||||||
| extern asn_TYPE_descriptor_t asn_DEF_SBcAP_Send_Write_Replace_Warning_Indication; | extern asn_TYPE_descriptor_t asn_DEF_SBcAP_Send_Write_Replace_Warning_Indication; | ||||||
| extern const asn_INTEGER_specifics_t asn_SPC_Send_Write_Replace_Warning_Indication_specs_1; | extern const asn_INTEGER_specifics_t asn_SPC_SBcAP_Send_Write_Replace_Warning_Indication_specs_1; | ||||||
| asn_struct_free_f Send_Write_Replace_Warning_Indication_free; | asn_struct_free_f SBcAP_Send_Write_Replace_Warning_Indication_free; | ||||||
| asn_struct_print_f Send_Write_Replace_Warning_Indication_print; | asn_struct_print_f SBcAP_Send_Write_Replace_Warning_Indication_print; | ||||||
| asn_constr_check_f Send_Write_Replace_Warning_Indication_constraint; | asn_constr_check_f SBcAP_Send_Write_Replace_Warning_Indication_constraint; | ||||||
| per_type_decoder_f Send_Write_Replace_Warning_Indication_decode_aper; | per_type_decoder_f SBcAP_Send_Write_Replace_Warning_Indication_decode_aper; | ||||||
| per_type_encoder_f Send_Write_Replace_Warning_Indication_encode_aper; | per_type_encoder_f SBcAP_Send_Write_Replace_Warning_Indication_encode_aper; | ||||||
|  |  | ||||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||||
| } | } | ||||||
|   | |||||||
| @@ -29,12 +29,12 @@ typedef long	 SBcAP_Stop_All_Indicator_t; | |||||||
| /* Implementation */ | /* Implementation */ | ||||||
| extern asn_per_constraints_t asn_PER_type_SBcAP_Stop_All_Indicator_constr_1; | extern asn_per_constraints_t asn_PER_type_SBcAP_Stop_All_Indicator_constr_1; | ||||||
| extern asn_TYPE_descriptor_t asn_DEF_SBcAP_Stop_All_Indicator; | extern asn_TYPE_descriptor_t asn_DEF_SBcAP_Stop_All_Indicator; | ||||||
| extern const asn_INTEGER_specifics_t asn_SPC_Stop_All_Indicator_specs_1; | extern const asn_INTEGER_specifics_t asn_SPC_SBcAP_Stop_All_Indicator_specs_1; | ||||||
| asn_struct_free_f Stop_All_Indicator_free; | asn_struct_free_f SBcAP_Stop_All_Indicator_free; | ||||||
| asn_struct_print_f Stop_All_Indicator_print; | asn_struct_print_f SBcAP_Stop_All_Indicator_print; | ||||||
| asn_constr_check_f Stop_All_Indicator_constraint; | asn_constr_check_f SBcAP_Stop_All_Indicator_constraint; | ||||||
| per_type_decoder_f Stop_All_Indicator_decode_aper; | per_type_decoder_f SBcAP_Stop_All_Indicator_decode_aper; | ||||||
| per_type_encoder_f Stop_All_Indicator_encode_aper; | per_type_encoder_f SBcAP_Stop_All_Indicator_encode_aper; | ||||||
|  |  | ||||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||||
| } | } | ||||||
|   | |||||||
| @@ -37,6 +37,8 @@ typedef struct SBcAP_Stop_Warning_Indication { | |||||||
|  |  | ||||||
| /* Implementation */ | /* Implementation */ | ||||||
| extern asn_TYPE_descriptor_t asn_DEF_SBcAP_Stop_Warning_Indication; | extern asn_TYPE_descriptor_t asn_DEF_SBcAP_Stop_Warning_Indication; | ||||||
|  | extern asn_SEQUENCE_specifics_t asn_SPC_SBcAP_Stop_Warning_Indication_specs_1; | ||||||
|  | extern asn_TYPE_member_t asn_MBR_SBcAP_Stop_Warning_Indication_1[2]; | ||||||
|  |  | ||||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||||
| } | } | ||||||
|   | |||||||
| @@ -37,6 +37,8 @@ typedef struct SBcAP_Stop_Warning_Request { | |||||||
|  |  | ||||||
| /* Implementation */ | /* Implementation */ | ||||||
| extern asn_TYPE_descriptor_t asn_DEF_SBcAP_Stop_Warning_Request; | extern asn_TYPE_descriptor_t asn_DEF_SBcAP_Stop_Warning_Request; | ||||||
|  | extern asn_SEQUENCE_specifics_t asn_SPC_SBcAP_Stop_Warning_Request_specs_1; | ||||||
|  | extern asn_TYPE_member_t asn_MBR_SBcAP_Stop_Warning_Request_1[2]; | ||||||
|  |  | ||||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||||
| } | } | ||||||
|   | |||||||
| @@ -37,6 +37,8 @@ typedef struct SBcAP_Stop_Warning_Response { | |||||||
|  |  | ||||||
| /* Implementation */ | /* Implementation */ | ||||||
| extern asn_TYPE_descriptor_t asn_DEF_SBcAP_Stop_Warning_Response; | extern asn_TYPE_descriptor_t asn_DEF_SBcAP_Stop_Warning_Response; | ||||||
|  | extern asn_SEQUENCE_specifics_t asn_SPC_SBcAP_Stop_Warning_Response_specs_1; | ||||||
|  | extern asn_TYPE_member_t asn_MBR_SBcAP_Stop_Warning_Response_1[2]; | ||||||
|  |  | ||||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||||
| } | } | ||||||
|   | |||||||
| @@ -32,12 +32,12 @@ typedef long	 SBcAP_TriggeringMessage_t; | |||||||
| /* Implementation */ | /* Implementation */ | ||||||
| extern asn_per_constraints_t asn_PER_type_SBcAP_TriggeringMessage_constr_1; | extern asn_per_constraints_t asn_PER_type_SBcAP_TriggeringMessage_constr_1; | ||||||
| extern asn_TYPE_descriptor_t asn_DEF_SBcAP_TriggeringMessage; | extern asn_TYPE_descriptor_t asn_DEF_SBcAP_TriggeringMessage; | ||||||
| extern const asn_INTEGER_specifics_t asn_SPC_TriggeringMessage_specs_1; | extern const asn_INTEGER_specifics_t asn_SPC_SBcAP_TriggeringMessage_specs_1; | ||||||
| asn_struct_free_f TriggeringMessage_free; | asn_struct_free_f SBcAP_TriggeringMessage_free; | ||||||
| asn_struct_print_f TriggeringMessage_print; | asn_struct_print_f SBcAP_TriggeringMessage_print; | ||||||
| asn_constr_check_f TriggeringMessage_constraint; | asn_constr_check_f SBcAP_TriggeringMessage_constraint; | ||||||
| per_type_decoder_f TriggeringMessage_decode_aper; | per_type_decoder_f SBcAP_TriggeringMessage_decode_aper; | ||||||
| per_type_encoder_f TriggeringMessage_encode_aper; | per_type_encoder_f SBcAP_TriggeringMessage_encode_aper; | ||||||
|  |  | ||||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||||
| } | } | ||||||
|   | |||||||
| @@ -33,12 +33,12 @@ typedef long	 SBcAP_TypeOfError_t; | |||||||
| /* Implementation */ | /* Implementation */ | ||||||
| extern asn_per_constraints_t asn_PER_type_SBcAP_TypeOfError_constr_1; | extern asn_per_constraints_t asn_PER_type_SBcAP_TypeOfError_constr_1; | ||||||
| extern asn_TYPE_descriptor_t asn_DEF_SBcAP_TypeOfError; | extern asn_TYPE_descriptor_t asn_DEF_SBcAP_TypeOfError; | ||||||
| extern const asn_INTEGER_specifics_t asn_SPC_TypeOfError_specs_1; | extern const asn_INTEGER_specifics_t asn_SPC_SBcAP_TypeOfError_specs_1; | ||||||
| asn_struct_free_f TypeOfError_free; | asn_struct_free_f SBcAP_TypeOfError_free; | ||||||
| asn_struct_print_f TypeOfError_print; | asn_struct_print_f SBcAP_TypeOfError_print; | ||||||
| asn_constr_check_f TypeOfError_constraint; | asn_constr_check_f SBcAP_TypeOfError_constraint; | ||||||
| per_type_decoder_f TypeOfError_decode_aper; | per_type_decoder_f SBcAP_TypeOfError_decode_aper; | ||||||
| per_type_encoder_f TypeOfError_encode_aper; | per_type_encoder_f SBcAP_TypeOfError_encode_aper; | ||||||
|  |  | ||||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||||
| } | } | ||||||
|   | |||||||
| @@ -37,6 +37,8 @@ typedef struct SBcAP_Write_Replace_Warning_Indication { | |||||||
|  |  | ||||||
| /* Implementation */ | /* Implementation */ | ||||||
| extern asn_TYPE_descriptor_t asn_DEF_SBcAP_Write_Replace_Warning_Indication; | extern asn_TYPE_descriptor_t asn_DEF_SBcAP_Write_Replace_Warning_Indication; | ||||||
|  | extern asn_SEQUENCE_specifics_t asn_SPC_SBcAP_Write_Replace_Warning_Indication_specs_1; | ||||||
|  | extern asn_TYPE_member_t asn_MBR_SBcAP_Write_Replace_Warning_Indication_1[2]; | ||||||
|  |  | ||||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||||
| } | } | ||||||
|   | |||||||
| @@ -37,6 +37,8 @@ typedef struct SBcAP_Write_Replace_Warning_Request { | |||||||
|  |  | ||||||
| /* Implementation */ | /* Implementation */ | ||||||
| extern asn_TYPE_descriptor_t asn_DEF_SBcAP_Write_Replace_Warning_Request; | extern asn_TYPE_descriptor_t asn_DEF_SBcAP_Write_Replace_Warning_Request; | ||||||
|  | extern asn_SEQUENCE_specifics_t asn_SPC_SBcAP_Write_Replace_Warning_Request_specs_1; | ||||||
|  | extern asn_TYPE_member_t asn_MBR_SBcAP_Write_Replace_Warning_Request_1[2]; | ||||||
|  |  | ||||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||||
| } | } | ||||||
|   | |||||||
| @@ -37,6 +37,8 @@ typedef struct SBcAP_Write_Replace_Warning_Response { | |||||||
|  |  | ||||||
| /* Implementation */ | /* Implementation */ | ||||||
| extern asn_TYPE_descriptor_t asn_DEF_SBcAP_Write_Replace_Warning_Response; | extern asn_TYPE_descriptor_t asn_DEF_SBcAP_Write_Replace_Warning_Response; | ||||||
|  | extern asn_SEQUENCE_specifics_t asn_SPC_SBcAP_Write_Replace_Warning_Response_specs_1; | ||||||
|  | extern asn_TYPE_member_t asn_MBR_SBcAP_Write_Replace_Warning_Response_1[2]; | ||||||
|  |  | ||||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||||
| } | } | ||||||
|   | |||||||
							
								
								
									
										16
									
								
								include/osmocom/sbcap/version.h.tpl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								include/osmocom/sbcap/version.h.tpl
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | |||||||
|  | #pragma once | ||||||
|  |  | ||||||
|  | #define LIBOSMO_SBCAP_VERSION {{VERSION}} | ||||||
|  | #define LIBOSMO_SBCAP_VERSION_STR "{{VERSION}}" | ||||||
|  |  | ||||||
|  | #define LIBOSMO_SBCAP_VERSION_MAJOR {{VERSION_MAJOR}} | ||||||
|  | #define LIBOSMO_SBCAP_VERSION_MINOR {{VERSION_MINOR}} | ||||||
|  | #define LIBOSMO_SBCAP_VERSION_PATCH {{VERSION_PATCH}} | ||||||
|  |  | ||||||
|  | #define LIBOSMO_SBCAP_VERSION_GREATER_EQUAL(major, minor, patch) \ | ||||||
|  | 	(LIBOSMO_SBCAP_VERSION_MAJOR > (major) || \ | ||||||
|  | 	 (LIBOSMO_SBCAP_VERSION_MAJOR == (major) && \ | ||||||
|  | 	  LIBOSMO_SBCAP_VERSION_MINOR > (minor)) || \ | ||||||
|  | 	 (LIBOSMO_SBCAP_VERSION_MAJOR == (major) && \ | ||||||
|  | 	  LIBOSMO_SBCAP_VERSION_MINOR == (minor) && \ | ||||||
|  | 	  LIBOSMO_SBCAP_VERSION_PATCH >= (patch))) | ||||||
| @@ -30,10 +30,17 @@ osmo_cbc_SOURCES = \ | |||||||
| 	smscb_peer_fsm.c \ | 	smscb_peer_fsm.c \ | ||||||
| 	$(NULL) | 	$(NULL) | ||||||
|  |  | ||||||
| osmo_cbc_LDADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(LIBOSMOVTY_LIBS) \ | osmo_cbc_LDADD = \ | ||||||
|  | 	sbcap/libosmo-sbcap.la \ | ||||||
|  | 	$(LIBOSMOCORE_LIBS) \ | ||||||
|  | 	$(LIBOSMOGSM_LIBS) \ | ||||||
|  | 	$(LIBOSMOVTY_LIBS) \ | ||||||
| 	$(LIBOSMONETIF_LIBS) \ | 	$(LIBOSMONETIF_LIBS) \ | ||||||
| 		 $(ULFIUS_LIBS) $(JANSSON_LIBS) $(ORCANIA_LIBS) $(LIBSCTP_LIBS) \ | 	$(ULFIUS_LIBS) \ | ||||||
| 		 sbcap/libosmo-sbcap.la | 	$(JANSSON_LIBS) \ | ||||||
|  | 	$(ORCANIA_LIBS) \ | ||||||
|  | 	$(LIBSCTP_LIBS) \ | ||||||
|  | 	$(NULL) | ||||||
|  |  | ||||||
| regen: | regen: | ||||||
| 	$(MAKE) -C sbcap regen | 	$(MAKE) -C sbcap regen | ||||||
|   | |||||||
| @@ -85,7 +85,9 @@ struct cbc *cbc_alloc(void *ctx) | |||||||
| 	INIT_LLIST_HEAD(&cbc->expired_messages); | 	INIT_LLIST_HEAD(&cbc->expired_messages); | ||||||
| 	cbc->config.cbsp.local_host = talloc_strdup(cbc, "127.0.0.1"); | 	cbc->config.cbsp.local_host = talloc_strdup(cbc, "127.0.0.1"); | ||||||
| 	cbc->config.cbsp.local_port = CBSP_TCP_PORT; | 	cbc->config.cbsp.local_port = CBSP_TCP_PORT; | ||||||
| 	/* cbc->config.sbcap local_host set up during VTY (and vty_go_parent) */ | 	/* Due to SCTP multi-home support, cbc->config.sbcap.local_host is not set here, | ||||||
|  | 	 * but through VTY (user or vty_go_parent()), or if not set default is set after | ||||||
|  | 	 * VTY cfg read, during cbc_start(). */ | ||||||
| 	cbc->config.sbcap.local_port = SBcAP_SCTP_PORT; | 	cbc->config.sbcap.local_port = SBcAP_SCTP_PORT; | ||||||
| 	cbc->config.ecbe.local_host = talloc_strdup(cbc, "127.0.0.1"); | 	cbc->config.ecbe.local_host = talloc_strdup(cbc, "127.0.0.1"); | ||||||
| 	cbc->config.ecbe.local_port = 12345; | 	cbc->config.ecbe.local_port = 12345; | ||||||
| @@ -103,6 +105,17 @@ struct cbc *cbc_alloc(void *ctx) | |||||||
| 	return cbc; | 	return cbc; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /* If no local addr set, add a default one: */ | ||||||
|  | void cbc_add_sbcap_default_local_host_if_needed(struct cbc *cbc) | ||||||
|  | { | ||||||
|  | 	if (g_cbc->config.sbcap.num_local_host > 0) | ||||||
|  | 		return; | ||||||
|  |  | ||||||
|  | 	g_cbc->config.sbcap.local_host[0] = talloc_strdup(g_cbc, "127.0.0.1"); | ||||||
|  | 	g_cbc->config.sbcap.local_host[1] = talloc_strdup(g_cbc, "::1"); | ||||||
|  | 	g_cbc->config.sbcap.num_local_host = 2; | ||||||
|  | } | ||||||
|  |  | ||||||
| int cbc_start(struct cbc *cbc) | int cbc_start(struct cbc *cbc) | ||||||
| { | { | ||||||
| 	void *tall_rest_ctx; | 	void *tall_rest_ctx; | ||||||
| @@ -115,6 +128,12 @@ int cbc_start(struct cbc *cbc) | |||||||
| 		return rc; | 		return rc; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	/* User didn't configure an SBcAP node with a local address, use default: */ | ||||||
|  | 	if (!cbc->config.sbcap.configured) { | ||||||
|  | 		cbc_add_sbcap_default_local_host_if_needed(cbc); | ||||||
|  | 		cbc->config.sbcap.configured = true; | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	if ((rc = cbc_sbcap_mgr_open_srv(cbc->sbcap.mgr)) < 0) { | 	if ((rc = cbc_sbcap_mgr_open_srv(cbc->sbcap.mgr)) < 0) { | ||||||
| 		LOGP(DMAIN, LOGL_ERROR, "Error binding SBc-AP port\n"); | 		LOGP(DMAIN, LOGL_ERROR, "Error binding SBc-AP port\n"); | ||||||
| 		return rc; | 		return rc; | ||||||
|   | |||||||
| @@ -108,12 +108,13 @@ static const struct log_info log_info = { | |||||||
| static int cbc_vty_go_parent(struct vty *vty) | static int cbc_vty_go_parent(struct vty *vty) | ||||||
| { | { | ||||||
| 	switch (vty->node) { | 	switch (vty->node) { | ||||||
|  | 	case CBSP_NODE: | ||||||
|  | 		g_cbc->config.cbsp.configured = true; | ||||||
|  | 		break; | ||||||
| 	case SBcAP_NODE: | 	case SBcAP_NODE: | ||||||
| 		/* If no local addr set, add a default one: */ | 		/* If no local addr set, add a default one: */ | ||||||
| 		if (g_cbc->config.sbcap.num_local_host == 0) { | 		cbc_add_sbcap_default_local_host_if_needed(g_cbc); | ||||||
| 			g_cbc->config.sbcap.local_host[0] = talloc_strdup(g_cbc, "127.0.0.1"); | 		g_cbc->config.sbcap.configured = true; | ||||||
| 				g_cbc->config.sbcap.num_local_host = 1; |  | ||||||
| 		} |  | ||||||
| 		vty->node = CONFIG_NODE; | 		vty->node = CONFIG_NODE; | ||||||
| 		vty->index = NULL; | 		vty->index = NULL; | ||||||
| 		break; | 		break; | ||||||
| @@ -143,7 +144,6 @@ static struct vty_app_info vty_info = { | |||||||
| 	.copyright = cbc_copyright, | 	.copyright = cbc_copyright, | ||||||
| 	.go_parent_cb	= cbc_vty_go_parent, | 	.go_parent_cb	= cbc_vty_go_parent, | ||||||
| 	.version = PACKAGE_VERSION, | 	.version = PACKAGE_VERSION, | ||||||
| 	.is_config_node = NULL, |  | ||||||
| }; | }; | ||||||
|  |  | ||||||
| static struct { | static struct { | ||||||
| @@ -270,6 +270,8 @@ int main(int argc, char **argv) | |||||||
| 	sbcap_set_log_area(DSBcAP, DASN1C); | 	sbcap_set_log_area(DSBcAP, DASN1C); | ||||||
| 	osmo_stats_init(tall_cbc_ctx); | 	osmo_stats_init(tall_cbc_ctx); | ||||||
| 	osmo_fsm_log_timeouts(true); | 	osmo_fsm_log_timeouts(true); | ||||||
|  |  | ||||||
|  | 	vty_info.tall_ctx = tall_cbc_ctx; | ||||||
| 	vty_init(&vty_info); | 	vty_init(&vty_info); | ||||||
|  |  | ||||||
| 	g_cbc = cbc_alloc(tall_cbc_ctx); | 	g_cbc = cbc_alloc(tall_cbc_ctx); | ||||||
| @@ -280,6 +282,8 @@ int main(int argc, char **argv) | |||||||
|  |  | ||||||
| 	logging_vty_add_cmds(); | 	logging_vty_add_cmds(); | ||||||
| 	osmo_fsm_vty_add_cmds(); | 	osmo_fsm_vty_add_cmds(); | ||||||
|  | 	osmo_stats_vty_add_cmds(); | ||||||
|  | 	osmo_talloc_vty_add_cmds(); | ||||||
|  |  | ||||||
| 	rc = vty_read_config_file(cmdline_config.config_file, NULL); | 	rc = vty_read_config_file(cmdline_config.config_file, NULL); | ||||||
| 	if (rc < 0) { | 	if (rc < 0) { | ||||||
|   | |||||||
| @@ -551,9 +551,10 @@ DEFUN_DEPRECATED(cfg_cbc_peer_old, cfg_cbc_peer_old_cmd, | |||||||
| { | { | ||||||
| 	struct cbc_peer *peer; | 	struct cbc_peer *peer; | ||||||
|  |  | ||||||
| 	vty_out(vty, "%% This function is deprecated, use " | 	vty_out(vty, "%% '%s' is deprecated, use " | ||||||
| 		"'peer " CBC_PEER_PROTO_NAME_VTY_CMD " NAME' instead. " | 		"'peer " CBC_PEER_PROTO_NAME_VTY_CMD " NAME' instead. " | ||||||
| 		"Assuming 'cbsp' for peers being created%s", VTY_NEWLINE); | 		"Assuming 'cbsp' for peers being created%s", | ||||||
|  | 		self->string, VTY_NEWLINE); | ||||||
|  |  | ||||||
| 	peer = cbc_peer_by_name(argv[0]); | 	peer = cbc_peer_by_name(argv[0]); | ||||||
| 	if (!peer) | 	if (!peer) | ||||||
| @@ -576,6 +577,26 @@ DEFUN(cfg_cbc_peer, cfg_cbc_peer_cmd, | |||||||
| 	enum cbc_peer_protocol proto; | 	enum cbc_peer_protocol proto; | ||||||
|  |  | ||||||
| 	proto = get_string_value(cbc_peer_proto_name_vty, argv[0]); | 	proto = get_string_value(cbc_peer_proto_name_vty, argv[0]); | ||||||
|  | 	switch (proto) { | ||||||
|  | 	case CBC_PEER_PROTO_CBSP: | ||||||
|  | 		if (!g_cbc->config.cbsp.configured) { | ||||||
|  | 			vty_out(vty, "%% Node '%s' must be configured before configuring node 'peer'!%s", | ||||||
|  | 				argv[0], VTY_NEWLINE); | ||||||
|  | 			return CMD_WARNING; | ||||||
|  | 		} | ||||||
|  | 		break; | ||||||
|  | 	case CBC_PEER_PROTO_SBcAP: | ||||||
|  | 		if (!g_cbc->config.sbcap.configured) { | ||||||
|  | 			vty_out(vty, "%% Node '%s' must be configured before configuring node 'peer'!%s", | ||||||
|  | 				argv[0], VTY_NEWLINE); | ||||||
|  | 			return CMD_WARNING; | ||||||
|  | 		} | ||||||
|  | 		break; | ||||||
|  | 	case CBC_PEER_PROTO_SABP: | ||||||
|  | 	default: | ||||||
|  | 		return CMD_WARNING; | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	peer = cbc_peer_by_name(argv[1]); | 	peer = cbc_peer_by_name(argv[1]); | ||||||
| 	if (!peer) | 	if (!peer) | ||||||
| 		peer = cbc_peer_create(argv[1], proto); | 		peer = cbc_peer_create(argv[1], proto); | ||||||
| @@ -609,8 +630,9 @@ DEFUN_DEPRECATED(cfg_peer_proto, cfg_peer_proto_cmd, | |||||||
| 	"Configure Protocol of Peer\n" | 	"Configure Protocol of Peer\n" | ||||||
| 	CBC_PEER_PROTO_NAME_VTY_STR) | 	CBC_PEER_PROTO_NAME_VTY_STR) | ||||||
| { | { | ||||||
| 	vty_out(vty, "%% This function is deprecated and does nothing, use " | 	vty_out(vty, "%% '%s' is deprecated and does nothing, use " | ||||||
| 		"'peer " CBC_PEER_PROTO_NAME_VTY_CMD " NAME' instead%s", VTY_NEWLINE); | 		"'peer " CBC_PEER_PROTO_NAME_VTY_CMD " NAME' instead%s", | ||||||
|  | 		self->string, VTY_NEWLINE); | ||||||
| 	return CMD_SUCCESS; | 	return CMD_SUCCESS; | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -102,6 +102,8 @@ static int cbc_cbsp_link_cli_connect_cb(struct osmo_stream_cli *conn) | |||||||
| static int cbc_cbsp_link_cli_disconnect_cb(struct osmo_stream_cli *conn) | static int cbc_cbsp_link_cli_disconnect_cb(struct osmo_stream_cli *conn) | ||||||
| { | { | ||||||
| 	struct cbc_cbsp_link *link = osmo_stream_cli_get_data(conn); | 	struct cbc_cbsp_link *link = osmo_stream_cli_get_data(conn); | ||||||
|  | 	if (!link->conn) /* conn is being destroyed by us, we called osmo_stream_cli_destroy() */ | ||||||
|  | 		return 0; | ||||||
| 	LOGPCC(link, LOGL_NOTICE, "Disconnected.\n"); | 	LOGPCC(link, LOGL_NOTICE, "Disconnected.\n"); | ||||||
| 	LOGPCC(link, LOGL_NOTICE, "Reconnecting...\n"); | 	LOGPCC(link, LOGL_NOTICE, "Reconnecting...\n"); | ||||||
| 	osmo_stream_cli_reconnect(conn); | 	osmo_stream_cli_reconnect(conn); | ||||||
| @@ -121,6 +123,7 @@ static int cbc_cbsp_link_cli_read_cb(struct osmo_stream_cli *conn) | |||||||
| 	/* message de-segmentation */ | 	/* message de-segmentation */ | ||||||
| 	rc = osmo_cbsp_recv_buffered(conn, ofd->fd, &msg, &link->rx_msg); | 	rc = osmo_cbsp_recv_buffered(conn, ofd->fd, &msg, &link->rx_msg); | ||||||
| 	if (rc <= 0) { | 	if (rc <= 0) { | ||||||
|  | 		LOGPCC(link, LOGL_NOTICE, "osmo_cbsp_recv_buffered() ret %d\n", rc); | ||||||
| 		if (rc == -EAGAIN || rc == -EINTR) { | 		if (rc == -EAGAIN || rc == -EINTR) { | ||||||
| 			/* more data needs to be read */ | 			/* more data needs to be read */ | ||||||
| 			return 0; | 			return 0; | ||||||
| @@ -205,6 +208,7 @@ static int cbsp_cbc_srv_read_cb(struct osmo_stream_srv *conn) | |||||||
| 	/* message de-segmentation */ | 	/* message de-segmentation */ | ||||||
| 	rc = osmo_cbsp_recv_buffered(conn, ofd->fd, &msg, &link->rx_msg); | 	rc = osmo_cbsp_recv_buffered(conn, ofd->fd, &msg, &link->rx_msg); | ||||||
| 	if (rc <= 0) { | 	if (rc <= 0) { | ||||||
|  | 		LOGPCC(link, LOGL_NOTICE, "osmo_cbsp_recv_buffered() ret %d\n", rc); | ||||||
| 		if (rc == -EAGAIN || rc == -EINTR) { | 		if (rc == -EAGAIN || rc == -EINTR) { | ||||||
| 			/* more data needs to be read */ | 			/* more data needs to be read */ | ||||||
| 			return 0; | 			return 0; | ||||||
| @@ -362,10 +366,11 @@ void cbc_cbsp_link_close(struct cbc_cbsp_link *link) | |||||||
| 		return; | 		return; | ||||||
|  |  | ||||||
| 	if (link->is_client) { | 	if (link->is_client) { | ||||||
| 		osmo_stream_cli_destroy(link->cli_conn); | 		struct osmo_stream_cli *cli_conn = link->cli_conn; | ||||||
|  | 		link->cli_conn = NULL; | ||||||
|  | 		osmo_stream_cli_destroy(cli_conn); | ||||||
| 		if (link->peer) | 		if (link->peer) | ||||||
| 			link->peer->link.cbsp = NULL; | 			link->peer->link.cbsp = NULL; | ||||||
| 		link->cli_conn = NULL; |  | ||||||
| 		if (link->fi) | 		if (link->fi) | ||||||
| 			osmo_fsm_inst_dispatch(link->fi, CBSP_LINK_E_CMD_CLOSE, NULL); | 			osmo_fsm_inst_dispatch(link->fi, CBSP_LINK_E_CMD_CLOSE, NULL); | ||||||
| 	} else { | 	} else { | ||||||
|   | |||||||
| @@ -33,6 +33,8 @@ ASN_MODULE_SRC = \ | |||||||
| 	gen/constr_SET_OF_print.c \ | 	gen/constr_SET_OF_print.c \ | ||||||
| 	gen/constr_SET_OF_rfill.c \ | 	gen/constr_SET_OF_rfill.c \ | ||||||
| 	gen/constr_TYPE.c \ | 	gen/constr_TYPE.c \ | ||||||
|  | 	gen/ENUMERATED.c \ | ||||||
|  | 	gen/ENUMERATED_aper.c \ | ||||||
| 	gen/GraphicString.c \ | 	gen/GraphicString.c \ | ||||||
| 	gen/INTEGER_aper.c \ | 	gen/INTEGER_aper.c \ | ||||||
| 	gen/INTEGER.c \ | 	gen/INTEGER.c \ | ||||||
| @@ -348,7 +350,9 @@ SKEL_HEADER_FILES = \ | |||||||
| 	skel/constr_TYPE.h \ | 	skel/constr_TYPE.h \ | ||||||
| 	skel/constraints.h \ | 	skel/constraints.h \ | ||||||
| 	skel/der_encoder.h \ | 	skel/der_encoder.h \ | ||||||
|  | 	skel/jer_decoder.h \ | ||||||
| 	skel/jer_encoder.h \ | 	skel/jer_encoder.h \ | ||||||
|  | 	skel/jer_support.h \ | ||||||
| 	skel/oer_decoder.h \ | 	skel/oer_decoder.h \ | ||||||
| 	skel/oer_encoder.h \ | 	skel/oer_encoder.h \ | ||||||
| 	skel/oer_support.h \ | 	skel/oer_support.h \ | ||||||
| @@ -374,7 +378,7 @@ noinst_LTLIBRARIES=libosmo-asn1-sbcap.la | |||||||
| libosmo_asn1_sbcap_la_SOURCES=$(ASN_MODULE_SRC) | libosmo_asn1_sbcap_la_SOURCES=$(ASN_MODULE_SRC) | ||||||
| libosmo_asn1_sbcap_la_LIBADD=$(ASN1C_LDADD) | libosmo_asn1_sbcap_la_LIBADD=$(ASN1C_LDADD) | ||||||
|  |  | ||||||
| sbcap_LIBVERSION=0:0:0 | sbcap_LIBVERSION=2:0:0 | ||||||
| lib_LTLIBRARIES = libosmo-sbcap.la | lib_LTLIBRARIES = libosmo-sbcap.la | ||||||
| libosmo_sbcap_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(sbcap_LIBVERSION) -no-undefined | libosmo_sbcap_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(sbcap_LIBVERSION) -no-undefined | ||||||
| libosmo_sbcap_la_LIBADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(LIBOSMOVTY_LIBS) \ | libosmo_sbcap_la_LIBADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(LIBOSMOVTY_LIBS) \ | ||||||
|   | |||||||
| @@ -18,6 +18,7 @@ asn_TYPE_operation_t asn_OP_ANY = { | |||||||
|     0, |     0, | ||||||
| #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | ||||||
|     OCTET_STRING_compare, |     OCTET_STRING_compare, | ||||||
|  |     OCTET_STRING_copy, | ||||||
| #if !defined(ASN_DISABLE_BER_SUPPORT) | #if !defined(ASN_DISABLE_BER_SUPPORT) | ||||||
|     OCTET_STRING_decode_ber, |     OCTET_STRING_decode_ber, | ||||||
|     OCTET_STRING_encode_der, |     OCTET_STRING_encode_der, | ||||||
| @@ -33,9 +34,11 @@ asn_TYPE_operation_t asn_OP_ANY = { | |||||||
|     0, |     0, | ||||||
| #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | ||||||
| #if !defined(ASN_DISABLE_JER_SUPPORT) | #if !defined(ASN_DISABLE_JER_SUPPORT) | ||||||
|  |     OCTET_STRING_decode_jer_hex, | ||||||
|     ANY_encode_jer, |     ANY_encode_jer, | ||||||
| #else | #else | ||||||
|     0, |     0, | ||||||
|  |     0, | ||||||
| #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | ||||||
| #if !defined(ASN_DISABLE_OER_SUPPORT) | #if !defined(ASN_DISABLE_OER_SUPPORT) | ||||||
|     0, |     0, | ||||||
|   | |||||||
| @@ -24,6 +24,7 @@ asn_TYPE_operation_t asn_OP_BIT_STRING = { | |||||||
|     0, |     0, | ||||||
| #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | ||||||
|     BIT_STRING_compare, |     BIT_STRING_compare, | ||||||
|  |     BIT_STRING_copy, | ||||||
| #if !defined(ASN_DISABLE_BER_SUPPORT) | #if !defined(ASN_DISABLE_BER_SUPPORT) | ||||||
|     OCTET_STRING_decode_ber,   /* Implemented in terms of OCTET STRING */ |     OCTET_STRING_decode_ber,   /* Implemented in terms of OCTET STRING */ | ||||||
|     OCTET_STRING_encode_der,   /* Implemented in terms of OCTET STRING */ |     OCTET_STRING_encode_der,   /* Implemented in terms of OCTET STRING */ | ||||||
| @@ -39,9 +40,11 @@ asn_TYPE_operation_t asn_OP_BIT_STRING = { | |||||||
|     0, |     0, | ||||||
| #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | ||||||
| #if !defined(ASN_DISABLE_JER_SUPPORT) | #if !defined(ASN_DISABLE_JER_SUPPORT) | ||||||
|  |     OCTET_STRING_decode_jer_hex, | ||||||
|     BIT_STRING_encode_jer, |     BIT_STRING_encode_jer, | ||||||
| #else | #else | ||||||
|     0, |     0, | ||||||
|  |     0, | ||||||
| #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | ||||||
| #if !defined(ASN_DISABLE_OER_SUPPORT) | #if !defined(ASN_DISABLE_OER_SUPPORT) | ||||||
|     BIT_STRING_decode_oer, |     BIT_STRING_decode_oer, | ||||||
| @@ -211,3 +214,37 @@ BIT_STRING_compare(const asn_TYPE_descriptor_t *td, const void *aptr, | |||||||
|         return 1; |         return 1; | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | int | ||||||
|  | BIT_STRING_copy(const asn_TYPE_descriptor_t *td, void **aptr, | ||||||
|  |                 const void *bptr) { | ||||||
|  |     const asn_OCTET_STRING_specifics_t *specs = td->specifics; | ||||||
|  |     BIT_STRING_t *a = (BIT_STRING_t *)*aptr; | ||||||
|  |     const BIT_STRING_t *b = (const BIT_STRING_t *)bptr; | ||||||
|  |  | ||||||
|  |     if(!b) { | ||||||
|  |         if(a) { | ||||||
|  |             FREEMEM(a->buf); | ||||||
|  |             FREEMEM(a); | ||||||
|  |             *aptr = 0; | ||||||
|  |         } | ||||||
|  |         return 0; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     if(!a) { | ||||||
|  |         a = *aptr = CALLOC(1, specs->struct_size); | ||||||
|  |         if(!a) return -1; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     uint8_t* buf = MALLOC(b->size + 1); | ||||||
|  |     if(!buf) return -1; | ||||||
|  |     memcpy(buf, b->buf, b->size); | ||||||
|  |     buf[b->size] = 0; | ||||||
|  |  | ||||||
|  |     FREEMEM(a->buf); | ||||||
|  |     a->buf = buf; | ||||||
|  |     a->size = b->size; | ||||||
|  |     a->bits_unused = b->bits_unused; | ||||||
|  |  | ||||||
|  |     return 0; | ||||||
|  | } | ||||||
|   | |||||||
							
								
								
									
										92
									
								
								src/sbcap/gen/ENUMERATED.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										92
									
								
								src/sbcap/gen/ENUMERATED.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,92 @@ | |||||||
|  | /*- | ||||||
|  |  * Copyright (c) 2003, 2005, 2006 Lev Walkin <vlm@lionet.info>. | ||||||
|  |  * All rights reserved. | ||||||
|  |  * Redistribution and modifications are permitted subject to BSD license. | ||||||
|  |  */ | ||||||
|  | #include <asn_internal.h> | ||||||
|  | #include <ENUMERATED.h> | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * ENUMERATED basic type description. | ||||||
|  |  */ | ||||||
|  | static const ber_tlv_tag_t asn_DEF_ENUMERATED_tags[] = { | ||||||
|  |     (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)) | ||||||
|  | }; | ||||||
|  | asn_TYPE_operation_t asn_OP_ENUMERATED = { | ||||||
|  |     ASN__PRIMITIVE_TYPE_free, | ||||||
|  | #if !defined(ASN_DISABLE_PRINT_SUPPORT) | ||||||
|  |     INTEGER_print,  /* Implemented in terms of INTEGER */ | ||||||
|  | #else | ||||||
|  |     0, | ||||||
|  | #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | ||||||
|  |     INTEGER_compare,  /* Implemented in terms of INTEGER */ | ||||||
|  |     INTEGER_copy,  /* Implemented in terms of INTEGER */ | ||||||
|  | #if !defined(ASN_DISABLE_BER_SUPPORT) | ||||||
|  |     ber_decode_primitive, | ||||||
|  |     INTEGER_encode_der,  /* Implemented in terms of INTEGER */ | ||||||
|  | #else | ||||||
|  |     0, | ||||||
|  |     0, | ||||||
|  | #endif  /* !defined(ASN_DISABLE_BER_SUPPORT) */ | ||||||
|  | #if !defined(ASN_DISABLE_XER_SUPPORT) | ||||||
|  |     INTEGER_decode_xer,  /* This is temporary! */ | ||||||
|  |     INTEGER_encode_xer, | ||||||
|  | #else | ||||||
|  |     0, | ||||||
|  |     0, | ||||||
|  | #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | ||||||
|  | #if !defined(ASN_DISABLE_JER_SUPPORT) | ||||||
|  |     ENUMERATED_decode_jer, | ||||||
|  |     INTEGER_encode_jer, | ||||||
|  | #else | ||||||
|  |     0, | ||||||
|  |     0, | ||||||
|  | #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | ||||||
|  | #if !defined(ASN_DISABLE_OER_SUPPORT) | ||||||
|  |     ENUMERATED_decode_oer, | ||||||
|  |     ENUMERATED_encode_oer, | ||||||
|  | #else | ||||||
|  |     0, | ||||||
|  |     0, | ||||||
|  | #endif  /* !defined(ASN_DISABLE_OER_SUPPORT) */ | ||||||
|  | #if !defined(ASN_DISABLE_UPER_SUPPORT) | ||||||
|  |     ENUMERATED_decode_uper,  /* Unaligned PER decoder */ | ||||||
|  |     ENUMERATED_encode_uper,  /* Unaligned PER encoder */ | ||||||
|  | #else | ||||||
|  |     0, | ||||||
|  |     0, | ||||||
|  | #endif  /* !defined(ASN_DISABLE_UPER_SUPPORT) */ | ||||||
|  | #if !defined(ASN_DISABLE_APER_SUPPORT) | ||||||
|  |     ENUMERATED_decode_aper,  /* Aligned PER decoder */ | ||||||
|  |     ENUMERATED_encode_aper,  /* Aligned PER encoder */ | ||||||
|  | #else | ||||||
|  |     0, | ||||||
|  |     0, | ||||||
|  | #endif  /* !defined(ASN_DISABLE_APER_SUPPORT) */ | ||||||
|  | #if !defined(ASN_DISABLE_RFILL_SUPPORT) | ||||||
|  |     ENUMERATED_random_fill, | ||||||
|  | #else | ||||||
|  |     0, | ||||||
|  | #endif  /* !defined(ASN_DISABLE_RFILL_SUPPORT) */ | ||||||
|  |     0  /* Use generic outmost tag fetcher */ | ||||||
|  | }; | ||||||
|  | asn_TYPE_descriptor_t asn_DEF_ENUMERATED = { | ||||||
|  |     "ENUMERATED", | ||||||
|  |     "ENUMERATED", | ||||||
|  |     &asn_OP_ENUMERATED, | ||||||
|  |     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]), | ||||||
|  |     { | ||||||
|  | #if !defined(ASN_DISABLE_OER_SUPPORT) | ||||||
|  |         0, | ||||||
|  | #endif  /* !defined(ASN_DISABLE_OER_SUPPORT) */ | ||||||
|  | #if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) | ||||||
|  |         0, | ||||||
|  | #endif  /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */ | ||||||
|  |         asn_generic_no_constraint | ||||||
|  |     }, | ||||||
|  |     0, 0,  /* No members */ | ||||||
|  |     0  /* No specifics */ | ||||||
|  | }; | ||||||
							
								
								
									
										43
									
								
								src/sbcap/gen/ENUMERATED_aper.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								src/sbcap/gen/ENUMERATED_aper.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,43 @@ | |||||||
|  | /* | ||||||
|  |  * Copyright (c) 2017 Lev Walkin <vlm@lionet.info>. | ||||||
|  |  * All rights reserved. | ||||||
|  |  * Redistribution and modifications are permitted subject to BSD license. | ||||||
|  |  */ | ||||||
|  | #include <asn_internal.h> | ||||||
|  | #include <ENUMERATED.h> | ||||||
|  | #include <NativeEnumerated.h> | ||||||
|  |  | ||||||
|  | asn_dec_rval_t | ||||||
|  | ENUMERATED_decode_aper(const asn_codec_ctx_t *opt_codec_ctx, | ||||||
|  |                        const asn_TYPE_descriptor_t *td, | ||||||
|  |                        const 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_aper(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_aper(const asn_TYPE_descriptor_t *td, | ||||||
|  |                        const asn_per_constraints_t *constraints, | ||||||
|  |                        const void *sptr, asn_per_outp_t *po) { | ||||||
|  |     const ENUMERATED_t *st = (const ENUMERATED_t *)sptr; | ||||||
|  |     long value; | ||||||
|  |  | ||||||
|  |     if(asn_INTEGER2long(st, &value)) | ||||||
|  |         ASN__ENCODE_FAILED; | ||||||
|  |  | ||||||
|  |     return NativeEnumerated_encode_aper(td, constraints, &value, po); | ||||||
|  | } | ||||||
| @@ -20,6 +20,7 @@ asn_TYPE_operation_t asn_OP_GraphicString = { | |||||||
|     0, |     0, | ||||||
| #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | ||||||
|     OCTET_STRING_compare, |     OCTET_STRING_compare, | ||||||
|  |     OCTET_STRING_copy, | ||||||
| #if !defined(ASN_DISABLE_BER_SUPPORT) | #if !defined(ASN_DISABLE_BER_SUPPORT) | ||||||
|     OCTET_STRING_decode_ber,  /* Implemented in terms of OCTET STRING */ |     OCTET_STRING_decode_ber,  /* Implemented in terms of OCTET STRING */ | ||||||
|     OCTET_STRING_encode_der, |     OCTET_STRING_encode_der, | ||||||
| @@ -35,9 +36,11 @@ asn_TYPE_operation_t asn_OP_GraphicString = { | |||||||
|     0, |     0, | ||||||
| #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | ||||||
| #if !defined(ASN_DISABLE_JER_SUPPORT) | #if !defined(ASN_DISABLE_JER_SUPPORT) | ||||||
|  |     OCTET_STRING_decode_jer_hex, | ||||||
|     OCTET_STRING_encode_jer,  /* Can't expect it to be ASCII/UTF8 */ |     OCTET_STRING_encode_jer,  /* Can't expect it to be ASCII/UTF8 */ | ||||||
| #else | #else | ||||||
|     0, |     0, | ||||||
|  |     0, | ||||||
| #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | ||||||
| #if !defined(ASN_DISABLE_OER_SUPPORT) | #if !defined(ASN_DISABLE_OER_SUPPORT) | ||||||
|     OCTET_STRING_decode_oer, |     OCTET_STRING_decode_oer, | ||||||
|   | |||||||
| @@ -22,6 +22,7 @@ asn_TYPE_operation_t asn_OP_INTEGER = { | |||||||
|     0, |     0, | ||||||
| #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | ||||||
|     INTEGER_compare, |     INTEGER_compare, | ||||||
|  |     INTEGER_copy, | ||||||
| #if !defined(ASN_DISABLE_BER_SUPPORT) | #if !defined(ASN_DISABLE_BER_SUPPORT) | ||||||
|     ber_decode_primitive, |     ber_decode_primitive, | ||||||
|     INTEGER_encode_der, |     INTEGER_encode_der, | ||||||
| @@ -37,9 +38,11 @@ asn_TYPE_operation_t asn_OP_INTEGER = { | |||||||
|     0, |     0, | ||||||
| #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | ||||||
| #if !defined(ASN_DISABLE_JER_SUPPORT) | #if !defined(ASN_DISABLE_JER_SUPPORT) | ||||||
|  |     INTEGER_decode_jer, | ||||||
|     INTEGER_encode_jer, |     INTEGER_encode_jer, | ||||||
| #else | #else | ||||||
|     0, |     0, | ||||||
|  |     0, | ||||||
| #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | ||||||
| #if !defined(ASN_DISABLE_OER_SUPPORT) | #if !defined(ASN_DISABLE_OER_SUPPORT) | ||||||
|     INTEGER_decode_oer,  /* OER decoder */ |     INTEGER_decode_oer,  /* OER decoder */ | ||||||
| @@ -361,7 +364,8 @@ asn_imax2INTEGER(INTEGER_t *st, intmax_t value) { | |||||||
| 		break; | 		break; | ||||||
| 	} | 	} | ||||||
| 	/* Copy the integer body */ | 	/* Copy the integer body */ | ||||||
| 	for(bp = buf, pend1 += add; p != pend1; p += add) | 	pend1 += add; | ||||||
|  | 	for(bp = buf; p != pend1; p += add) | ||||||
| 		*bp++ = *p; | 		*bp++ = *p; | ||||||
|  |  | ||||||
| 	if(st->buf) FREEMEM(st->buf); | 	if(st->buf) FREEMEM(st->buf); | ||||||
| @@ -411,6 +415,33 @@ asn_ulong2INTEGER(INTEGER_t *st, unsigned long value) { | |||||||
|     return asn_imax2INTEGER(st, value); |     return asn_imax2INTEGER(st, value); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | int asn_INTEGER2int64(const INTEGER_t *st, int64_t *value) { | ||||||
|  |     intmax_t v; | ||||||
|  |     if(asn_INTEGER2imax(st, &v) == 0) { | ||||||
|  |         if(v < INT64_MIN || v > INT64_MAX) { | ||||||
|  |             errno = ERANGE; | ||||||
|  |             return -1; | ||||||
|  |         } | ||||||
|  |         *value = v; | ||||||
|  |         return 0; | ||||||
|  |     } else { | ||||||
|  |         return -1; | ||||||
|  |     } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | int asn_INTEGER2uint64(const INTEGER_t *st, uint64_t *value) { | ||||||
|  |     uintmax_t v; | ||||||
|  |     if(asn_INTEGER2umax(st, &v) == 0) { | ||||||
|  |         if(v > UINT64_MAX) { | ||||||
|  |             errno = ERANGE; | ||||||
|  |             return -1; | ||||||
|  |         } | ||||||
|  |         *value = v; | ||||||
|  |         return 0; | ||||||
|  |     } else { | ||||||
|  |         return -1; | ||||||
|  |     } | ||||||
|  | } | ||||||
|  |  | ||||||
| int | int | ||||||
| asn_uint642INTEGER(INTEGER_t *st, uint64_t value) { | asn_uint642INTEGER(INTEGER_t *st, uint64_t value) { | ||||||
| @@ -736,3 +767,40 @@ INTEGER_compare(const asn_TYPE_descriptor_t *td, const void *aptr, | |||||||
|     } |     } | ||||||
|  |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  | int | ||||||
|  | INTEGER_copy(const asn_TYPE_descriptor_t *td, void **aptr, | ||||||
|  |                      const void *bptr) { | ||||||
|  |     (void)td; | ||||||
|  |     INTEGER_t *a = *aptr; | ||||||
|  |     const INTEGER_t *b = bptr; | ||||||
|  |  | ||||||
|  |     if(!b) { | ||||||
|  |         if(a) { | ||||||
|  |             FREEMEM(a->buf); | ||||||
|  |             FREEMEM(a); | ||||||
|  |             *aptr = 0; | ||||||
|  |         } | ||||||
|  |         return 0; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     if(!a) { | ||||||
|  |         a = *aptr = CALLOC(1, sizeof(*a)); | ||||||
|  |         if(!a) return -1; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     if(b->size) { | ||||||
|  |         uint8_t* buf = MALLOC(b->size); | ||||||
|  |         if(!buf) return -1; | ||||||
|  |         memcpy(buf, b->buf, b->size); | ||||||
|  |         FREEMEM(a->buf); | ||||||
|  |         a->buf = buf; | ||||||
|  |         a->size = b->size; | ||||||
|  |     } else { | ||||||
|  |         FREEMEM(a->buf); | ||||||
|  |         a->buf = 0; | ||||||
|  |         a->size = 0; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     return 0; | ||||||
|  | } | ||||||
|   | |||||||
| @@ -57,7 +57,7 @@ INTEGER_decode_aper(const asn_codec_ctx_t *opt_codec_ctx, | |||||||
|                 int max_range_bytes = (ct->range_bits >> 3) + |                 int max_range_bytes = (ct->range_bits >> 3) + | ||||||
|                                       (((ct->range_bits % 8) > 0) ? 1 : 0); |                                       (((ct->range_bits % 8) > 0) ? 1 : 0); | ||||||
|                 int length = 0, i; |                 int length = 0, i; | ||||||
|                 long value = 0; |                 intmax_t value = 0; | ||||||
|  |  | ||||||
|                 for (i = 1; ; i++) { |                 for (i = 1; ; i++) { | ||||||
|                     int upper = 1 << i; |                     int upper = 1 << i; | ||||||
| @@ -79,18 +79,18 @@ INTEGER_decode_aper(const asn_codec_ctx_t *opt_codec_ctx, | |||||||
|                     int buf = per_get_few_bits(pd, 8); |                     int buf = per_get_few_bits(pd, 8); | ||||||
|                     if (buf < 0) |                     if (buf < 0) | ||||||
|                         ASN__DECODE_FAILED; |                         ASN__DECODE_FAILED; | ||||||
|                     value += (((long)buf) << (8 * length)); |                     value += (((intmax_t)buf) << (8 * length)); | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|                 value += ct->lower_bound; |                 value += ct->lower_bound; | ||||||
|                 if((specs && specs->field_unsigned) |                 if((specs && specs->field_unsigned) | ||||||
|                         ? asn_uint642INTEGER(st, (unsigned long)value) |                         ? asn_umax2INTEGER(st, (uintmax_t)value) | ||||||
|                         : asn_int642INTEGER(st, value)) |                         : asn_imax2INTEGER(st, value)) | ||||||
|                     ASN__DECODE_FAILED; |                     ASN__DECODE_FAILED; | ||||||
|                 ASN_DEBUG("Got value %ld + low %lld", |                 ASN_DEBUG("Got value %"ASN_PRIdMAX" + low %"ASN_PRIdMAX"", | ||||||
|                           value, (long long int)ct->lower_bound); |                           value, (intmax_t)ct->lower_bound); | ||||||
|             } else { |             } else { | ||||||
|                 long value = 0; |                 intmax_t value = 0; | ||||||
|                 if (ct->range_bits < 8) { |                 if (ct->range_bits < 8) { | ||||||
|                     value = per_get_few_bits(pd, ct->range_bits); |                     value = per_get_few_bits(pd, ct->range_bits); | ||||||
|                     if(value < 0) ASN__DECODE_STARVED; |                     if(value < 0) ASN__DECODE_STARVED; | ||||||
| @@ -108,11 +108,11 @@ INTEGER_decode_aper(const asn_codec_ctx_t *opt_codec_ctx, | |||||||
|                 } |                 } | ||||||
|                 value += ct->lower_bound; |                 value += ct->lower_bound; | ||||||
|                 if((specs && specs->field_unsigned) |                 if((specs && specs->field_unsigned) | ||||||
|                         ? asn_ulong2INTEGER(st, value) |                         ? asn_umax2INTEGER(st, (uintmax_t)value) | ||||||
|                         : asn_long2INTEGER(st, value)) |                         : asn_imax2INTEGER(st, value)) | ||||||
|                     ASN__DECODE_FAILED; |                     ASN__DECODE_FAILED; | ||||||
|                 ASN_DEBUG("Got value %ld + low %lld", |                 ASN_DEBUG("Got value %"ASN_PRIdMAX" + low %"ASN_PRIdMAX"", | ||||||
|                           value, (long long int)ct->lower_bound); |                           value, (intmax_t)ct->lower_bound); | ||||||
|             } |             } | ||||||
|             return rval; |             return rval; | ||||||
|         } else { |         } else { | ||||||
| @@ -167,7 +167,7 @@ INTEGER_encode_aper(const asn_TYPE_descriptor_t *td, | |||||||
|     const uint8_t *buf; |     const uint8_t *buf; | ||||||
|     const uint8_t *end; |     const uint8_t *end; | ||||||
|     const asn_per_constraint_t *ct; |     const asn_per_constraint_t *ct; | ||||||
|     long value = 0; |     intmax_t value = 0; | ||||||
|  |  | ||||||
|     if(!st || st->size == 0) ASN__ENCODE_FAILED; |     if(!st || st->size == 0) ASN__ENCODE_FAILED; | ||||||
|  |  | ||||||
| @@ -179,26 +179,26 @@ INTEGER_encode_aper(const asn_TYPE_descriptor_t *td, | |||||||
|     if(ct) { |     if(ct) { | ||||||
|         int inext = 0; |         int inext = 0; | ||||||
|         if(specs && specs->field_unsigned) { |         if(specs && specs->field_unsigned) { | ||||||
|             unsigned long uval; |             uintmax_t uval; | ||||||
|             if(asn_INTEGER2ulong(st, &uval)) |             if(asn_INTEGER2umax(st, &uval)) | ||||||
|                 ASN__ENCODE_FAILED; |                 ASN__ENCODE_FAILED; | ||||||
|             /* Check proper range */ |             /* Check proper range */ | ||||||
|             if(ct->flags & APC_SEMI_CONSTRAINED) { |             if(ct->flags & APC_SEMI_CONSTRAINED) { | ||||||
|                 if(uval < (unsigned long)ct->lower_bound) |                 if(uval < (uintmax_t)ct->lower_bound) | ||||||
|                     inext = 1; |                     inext = 1; | ||||||
|             } else if(ct->range_bits >= 0) { |             } else if(ct->range_bits >= 0) { | ||||||
|                 if(uval < (unsigned long)ct->lower_bound |                 if(uval < (uintmax_t)ct->lower_bound | ||||||
|                         || uval > (unsigned long)ct->upper_bound) |                         || uval > (uintmax_t)ct->upper_bound) | ||||||
|                     inext = 1; |                     inext = 1; | ||||||
|             } |             } | ||||||
|             ASN_DEBUG("Value %lu (%02x/%zu) lb %lld ub %lld %s", |             ASN_DEBUG("Value %"ASN_PRIdMAX" (%02x/%"ASN_PRI_SIZE") lb %"ASN_PRIdMAX" ub %"ASN_PRIdMAX" %s", | ||||||
|                       uval, st->buf[0], st->size, |                       uval, st->buf[0], st->size, | ||||||
|                       (long long int)ct->lower_bound, |                       (intmax_t)ct->lower_bound, | ||||||
|                       (long long int)ct->upper_bound, |                       (intmax_t)ct->upper_bound, | ||||||
|                       inext ? "ext" : "fix"); |                       inext ? "ext" : "fix"); | ||||||
|             value = uval; |             value = uval; | ||||||
|         } else { |         } else { | ||||||
|             if(asn_INTEGER2long(st, &value)) ASN__ENCODE_FAILED; |             if(asn_INTEGER2imax(st, &value)) ASN__ENCODE_FAILED; | ||||||
|             /* Check proper range */ |             /* Check proper range */ | ||||||
|             if(ct->flags & APC_SEMI_CONSTRAINED) { |             if(ct->flags & APC_SEMI_CONSTRAINED) { | ||||||
|                 if(value < ct->lower_bound) |                 if(value < ct->lower_bound) | ||||||
| @@ -208,10 +208,10 @@ INTEGER_encode_aper(const asn_TYPE_descriptor_t *td, | |||||||
|                         || value > ct->upper_bound) |                         || value > ct->upper_bound) | ||||||
|                     inext = 1; |                     inext = 1; | ||||||
|             } |             } | ||||||
|             ASN_DEBUG("Value %lu (%02x/%zu) lb %lld ub %lld %s", |             ASN_DEBUG("Value %"ASN_PRIdMAX" (%02x/%"ASN_PRI_SIZE") lb %"ASN_PRIdMAX" ub %"ASN_PRIdMAX" %s", | ||||||
|                       value, st->buf[0], st->size, |                       value, st->buf[0], st->size, | ||||||
|                       (long long int)ct->lower_bound, |                       (intmax_t)ct->lower_bound, | ||||||
|                       (long long int)ct->upper_bound, |                       (intmax_t)ct->upper_bound, | ||||||
|                       inext ? "ext" : "fix"); |                       inext ? "ext" : "fix"); | ||||||
|         } |         } | ||||||
|         if(ct->flags & APC_EXTENSIBLE) { |         if(ct->flags & APC_EXTENSIBLE) { | ||||||
| @@ -225,11 +225,11 @@ INTEGER_encode_aper(const asn_TYPE_descriptor_t *td, | |||||||
|  |  | ||||||
|     /* X.691, #12.2.2 */ |     /* X.691, #12.2.2 */ | ||||||
|     if(ct && ct->range_bits >= 0) { |     if(ct && ct->range_bits >= 0) { | ||||||
|         unsigned long v; |         uintmax_t v; | ||||||
|  |  | ||||||
|         /* #10.5.6 */ |         /* #10.5.6 */ | ||||||
|         ASN_DEBUG("Encoding integer %ld (%lld) with range %d bits", |         ASN_DEBUG("Encoding integer %"ASN_PRIdMAX" (%"ASN_PRIdMAX") with range %d bits", | ||||||
|                   value, (long long int)(value - ct->lower_bound), |                   value, (intmax_t)(value - ct->lower_bound), | ||||||
|                   ct->range_bits); |                   ct->range_bits); | ||||||
|  |  | ||||||
|         v = value - ct->lower_bound; |         v = value - ct->lower_bound; | ||||||
| @@ -287,7 +287,7 @@ INTEGER_encode_aper(const asn_TYPE_descriptor_t *td, | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     if(ct && ct->lower_bound) { |     if(ct && ct->lower_bound) { | ||||||
|         ASN_DEBUG("Adjust lower bound to %lld", (long long int)ct->lower_bound); |         ASN_DEBUG("Adjust lower bound to %"ASN_PRIdMAX"", (intmax_t)ct->lower_bound); | ||||||
|         /* TODO: adjust lower bound */ |         /* TODO: adjust lower bound */ | ||||||
|         ASN__ENCODE_FAILED; |         ASN__ENCODE_FAILED; | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -26,6 +26,7 @@ asn_TYPE_operation_t asn_OP_NativeEnumerated = { | |||||||
|     0, |     0, | ||||||
| #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | ||||||
|     NativeInteger_compare, |     NativeInteger_compare, | ||||||
|  |     NativeInteger_copy, | ||||||
| #if !defined(ASN_DISABLE_BER_SUPPORT) | #if !defined(ASN_DISABLE_BER_SUPPORT) | ||||||
|     NativeInteger_decode_ber, |     NativeInteger_decode_ber, | ||||||
|     NativeInteger_encode_der, |     NativeInteger_encode_der, | ||||||
| @@ -41,9 +42,11 @@ asn_TYPE_operation_t asn_OP_NativeEnumerated = { | |||||||
|     0, |     0, | ||||||
| #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | ||||||
| #if !defined(ASN_DISABLE_JER_SUPPORT) | #if !defined(ASN_DISABLE_JER_SUPPORT) | ||||||
|  |     NativeEnumerated_decode_jer, | ||||||
|     NativeEnumerated_encode_jer, |     NativeEnumerated_encode_jer, | ||||||
| #else | #else | ||||||
|     0, |     0, | ||||||
|  |     0, | ||||||
| #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | ||||||
| #if !defined(ASN_DISABLE_OER_SUPPORT) | #if !defined(ASN_DISABLE_OER_SUPPORT) | ||||||
|     NativeEnumerated_decode_oer, |     NativeEnumerated_decode_oer, | ||||||
|   | |||||||
| @@ -64,7 +64,7 @@ NativeEnumerated_decode_aper(const asn_codec_ctx_t *opt_codec_ctx, | |||||||
|          */ |          */ | ||||||
|  |  | ||||||
|         /* XXX handle indefinite index length > 64k */ |         /* XXX handle indefinite index length > 64k */ | ||||||
|         value = aper_get_nsnnwn(pd, 65537); |         value = aper_get_nsnnwn(pd); | ||||||
|         if(value < 0) ASN__DECODE_STARVED; |         if(value < 0) ASN__DECODE_STARVED; | ||||||
|         value += specs->extension - 1; |         value += specs->extension - 1; | ||||||
|         //if(value >= specs->map_count) |         //if(value >= specs->map_count) | ||||||
| @@ -148,9 +148,7 @@ NativeEnumerated_encode_aper(const asn_TYPE_descriptor_t *td, | |||||||
|     ASN_DEBUG("value = %ld, ext = %d, inext = %d, res = %ld", |     ASN_DEBUG("value = %ld, ext = %d, inext = %d, res = %ld", | ||||||
|               value, specs->extension, inext, |               value, specs->extension, inext, | ||||||
|               value - (inext ? (specs->extension - 1) : 0)); |               value - (inext ? (specs->extension - 1) : 0)); | ||||||
|     if(aper_put_nsnnwn(po, |     if(aper_put_nsnnwn(po, value - (inext ? (specs->extension - 1) : 0))) | ||||||
|                        ct->upper_bound - ct->lower_bound + 1, |  | ||||||
|                        value - (inext ? (specs->extension - 1) : 0))) |  | ||||||
|         ASN__ENCODE_FAILED; |         ASN__ENCODE_FAILED; | ||||||
|  |  | ||||||
|     ASN__ENCODED_OK(er); |     ASN__ENCODED_OK(er); | ||||||
|   | |||||||
| @@ -27,6 +27,7 @@ asn_TYPE_operation_t asn_OP_NativeInteger = { | |||||||
|     0, |     0, | ||||||
| #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | ||||||
|     NativeInteger_compare, |     NativeInteger_compare, | ||||||
|  |     NativeInteger_copy, | ||||||
| #if !defined(ASN_DISABLE_BER_SUPPORT) | #if !defined(ASN_DISABLE_BER_SUPPORT) | ||||||
|     NativeInteger_decode_ber, |     NativeInteger_decode_ber, | ||||||
|     NativeInteger_encode_der, |     NativeInteger_encode_der, | ||||||
| @@ -42,9 +43,11 @@ asn_TYPE_operation_t asn_OP_NativeInteger = { | |||||||
|     0, |     0, | ||||||
| #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | ||||||
| #if !defined(ASN_DISABLE_JER_SUPPORT) | #if !defined(ASN_DISABLE_JER_SUPPORT) | ||||||
|  |     NativeInteger_decode_jer, | ||||||
|     NativeInteger_encode_jer, |     NativeInteger_encode_jer, | ||||||
| #else | #else | ||||||
|     0, |     0, | ||||||
|  |     0, | ||||||
| #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | ||||||
| #if !defined(ASN_DISABLE_OER_SUPPORT) | #if !defined(ASN_DISABLE_OER_SUPPORT) | ||||||
|     NativeInteger_decode_oer,  /* OER decoder */ |     NativeInteger_decode_oer,  /* OER decoder */ | ||||||
| @@ -150,3 +153,30 @@ NativeInteger_compare(const asn_TYPE_descriptor_t *td, const void *aptr, const v | |||||||
|         return 1; |         return 1; | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | int | ||||||
|  | NativeInteger_copy(const asn_TYPE_descriptor_t *td, void **aptr, const void *bptr) { | ||||||
|  |     unsigned long *a = *aptr; | ||||||
|  |     const unsigned long *b = bptr; | ||||||
|  |  | ||||||
|  |     (void)td; | ||||||
|  |  | ||||||
|  |     /* Check if source has data */ | ||||||
|  |     if(!b) { | ||||||
|  |         /* Clear destination */ | ||||||
|  |         if(a) { | ||||||
|  |             FREEMEM(a); | ||||||
|  |             *aptr = 0; | ||||||
|  |         } | ||||||
|  |         return 0; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     if(!a) { | ||||||
|  |         a = *aptr = MALLOC(sizeof(*a)); | ||||||
|  |         if(!a) return -1; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     *a = *b; | ||||||
|  |  | ||||||
|  |     return 0; | ||||||
|  | } | ||||||
|   | |||||||
| @@ -63,8 +63,10 @@ NativeInteger_random_fill(const asn_TYPE_descriptor_t *td, void **sptr, | |||||||
|                 0, sizeof(variants) / sizeof(variants[0]) - 1)]; |                 0, sizeof(variants) / sizeof(variants[0]) - 1)]; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         if(!constraints) constraints = &td->encoding_constraints; |  | ||||||
| #if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) | #if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) | ||||||
|  |         if(!constraints || !constraints->per_constraints)  | ||||||
|  |             constraints = &td->encoding_constraints; | ||||||
|  |        | ||||||
|         const asn_per_constraints_t *ct; |         const asn_per_constraints_t *ct; | ||||||
|  |  | ||||||
|         ct = constraints ? constraints->per_constraints : 0; |         ct = constraints ? constraints->per_constraints : 0; | ||||||
| @@ -74,6 +76,8 @@ NativeInteger_random_fill(const asn_TYPE_descriptor_t *td, void **sptr, | |||||||
|                                            ct->value.upper_bound); |                                            ct->value.upper_bound); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  | #else | ||||||
|  |       if(!constraints) constraints = &td->encoding_constraints; | ||||||
| #endif  /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */ | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -24,6 +24,7 @@ asn_TYPE_operation_t asn_OP_OBJECT_IDENTIFIER = { | |||||||
|     0, |     0, | ||||||
| #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | ||||||
|     OCTET_STRING_compare,   /* Implemented in terms of a string comparison */ |     OCTET_STRING_compare,   /* Implemented in terms of a string comparison */ | ||||||
|  |     OCTET_STRING_copy,      /* Implemented in terms of a string copy */ | ||||||
| #if !defined(ASN_DISABLE_BER_SUPPORT) | #if !defined(ASN_DISABLE_BER_SUPPORT) | ||||||
|     ber_decode_primitive, |     ber_decode_primitive, | ||||||
|     der_encode_primitive, |     der_encode_primitive, | ||||||
| @@ -39,9 +40,11 @@ asn_TYPE_operation_t asn_OP_OBJECT_IDENTIFIER = { | |||||||
|     0, |     0, | ||||||
| #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | ||||||
| #if !defined(ASN_DISABLE_JER_SUPPORT) | #if !defined(ASN_DISABLE_JER_SUPPORT) | ||||||
|  |     OBJECT_IDENTIFIER_decode_jer, | ||||||
|     OBJECT_IDENTIFIER_encode_jer, |     OBJECT_IDENTIFIER_encode_jer, | ||||||
| #else | #else | ||||||
|     0, |     0, | ||||||
|  |     0, | ||||||
| #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | ||||||
| #if !defined(ASN_DISABLE_OER_SUPPORT) | #if !defined(ASN_DISABLE_OER_SUPPORT) | ||||||
|     OBJECT_IDENTIFIER_decode_oer, |     OBJECT_IDENTIFIER_decode_oer, | ||||||
|   | |||||||
| @@ -26,6 +26,7 @@ asn_TYPE_operation_t asn_OP_OCTET_STRING = { | |||||||
|     0, |     0, | ||||||
| #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | ||||||
|     OCTET_STRING_compare, |     OCTET_STRING_compare, | ||||||
|  |     OCTET_STRING_copy, | ||||||
| #if !defined(ASN_DISABLE_BER_SUPPORT) | #if !defined(ASN_DISABLE_BER_SUPPORT) | ||||||
|     OCTET_STRING_decode_ber, |     OCTET_STRING_decode_ber, | ||||||
|     OCTET_STRING_encode_der, |     OCTET_STRING_encode_der, | ||||||
| @@ -41,9 +42,11 @@ asn_TYPE_operation_t asn_OP_OCTET_STRING = { | |||||||
|     0, |     0, | ||||||
| #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | ||||||
| #if !defined(ASN_DISABLE_JER_SUPPORT) | #if !defined(ASN_DISABLE_JER_SUPPORT) | ||||||
|  |     OCTET_STRING_decode_jer_hex, | ||||||
|     OCTET_STRING_encode_jer, |     OCTET_STRING_encode_jer, | ||||||
| #else | #else | ||||||
|     0, |     0, | ||||||
|  |     0, | ||||||
| #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | ||||||
| #if !defined(ASN_DISABLE_OER_SUPPORT) | #if !defined(ASN_DISABLE_OER_SUPPORT) | ||||||
|     OCTET_STRING_decode_oer, |     OCTET_STRING_decode_oer, | ||||||
| @@ -247,6 +250,43 @@ OCTET_STRING_compare(const asn_TYPE_descriptor_t *td, const void *aptr, | |||||||
|  |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  | int | ||||||
|  | OCTET_STRING_copy(const asn_TYPE_descriptor_t *td, void **aptr, | ||||||
|  |                      const void *bptr) { | ||||||
|  |     const asn_OCTET_STRING_specifics_t *specs =  | ||||||
|  |         td->specifics ? (const asn_OCTET_STRING_specifics_t *)td->specifics | ||||||
|  |                       : &asn_SPC_OCTET_STRING_specs; | ||||||
|  |     OCTET_STRING_t *a = *aptr; | ||||||
|  |     const OCTET_STRING_t *b = bptr; | ||||||
|  |  | ||||||
|  |     if(!b) { | ||||||
|  |         if(a) { | ||||||
|  |             FREEMEM(a->buf); | ||||||
|  |             a->buf = 0; | ||||||
|  |             a->size = 0; | ||||||
|  |             FREEMEM(a); | ||||||
|  |         } | ||||||
|  |         *aptr = 0; | ||||||
|  |         return 0; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     if(!a) { | ||||||
|  |         a = *aptr = (OCTET_STRING_t *)CALLOC(1, specs->struct_size); | ||||||
|  |         if(!a) return -1; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     void *buf = MALLOC(b->size + 1); | ||||||
|  |     if(!buf) return -1; | ||||||
|  |     memcpy(buf, b->buf, b->size); | ||||||
|  |     ((uint8_t *)buf)[b->size] = '\0'; | ||||||
|  |  | ||||||
|  |     FREEMEM(a->buf); | ||||||
|  |     a->buf = (uint8_t *)buf; | ||||||
|  |     a->size = b->size; | ||||||
|  |  | ||||||
|  |     return 0; | ||||||
|  | } | ||||||
|  |  | ||||||
| #if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) | #if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) | ||||||
| int | int | ||||||
| OCTET_STRING_per_get_characters(asn_per_data_t *po, uint8_t *buf, | OCTET_STRING_per_get_characters(asn_per_data_t *po, uint8_t *buf, | ||||||
|   | |||||||
| @@ -179,7 +179,6 @@ OCTET_STRING_decode_aper(const asn_codec_ctx_t *opt_codec_ctx, | |||||||
|             raw_len = aper_get_length(pd, csiz->lower_bound, csiz->upper_bound, |             raw_len = aper_get_length(pd, csiz->lower_bound, csiz->upper_bound, | ||||||
|                                       csiz->effective_bits, &repeat); |                                       csiz->effective_bits, &repeat); | ||||||
|         if(raw_len < 0) RETURN(RC_WMORE); |         if(raw_len < 0) RETURN(RC_WMORE); | ||||||
|         raw_len += csiz->lower_bound; |  | ||||||
|  |  | ||||||
|         ASN_DEBUG("Got PER length eb %ld, len %ld, %s (%s)", |         ASN_DEBUG("Got PER length eb %ld, len %ld, %s (%s)", | ||||||
|                   (long)csiz->effective_bits, (long)raw_len, |                   (long)csiz->effective_bits, (long)raw_len, | ||||||
|   | |||||||
| @@ -14,6 +14,7 @@ asn_TYPE_operation_t asn_OP_OPEN_TYPE = { | |||||||
|     0, |     0, | ||||||
| #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | ||||||
|     OPEN_TYPE_compare, |     OPEN_TYPE_compare, | ||||||
|  |     OPEN_TYPE_copy, | ||||||
| #if !defined(ASN_DISABLE_BER_SUPPORT) | #if !defined(ASN_DISABLE_BER_SUPPORT) | ||||||
|     OPEN_TYPE_decode_ber, |     OPEN_TYPE_decode_ber, | ||||||
|     OPEN_TYPE_encode_der, |     OPEN_TYPE_encode_der, | ||||||
| @@ -29,9 +30,11 @@ asn_TYPE_operation_t asn_OP_OPEN_TYPE = { | |||||||
|     0, |     0, | ||||||
| #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | ||||||
| #if !defined(ASN_DISABLE_JER_SUPPORT) | #if !defined(ASN_DISABLE_JER_SUPPORT) | ||||||
|  |     OPEN_TYPE_decode_jer, | ||||||
|     OPEN_TYPE_encode_jer, |     OPEN_TYPE_encode_jer, | ||||||
| #else | #else | ||||||
|     0, |     0, | ||||||
|  |     0, | ||||||
| #endif /* !defined(ASN_DISABLE_JER_SUPPORT) */ | #endif /* !defined(ASN_DISABLE_JER_SUPPORT) */ | ||||||
| #if !defined(ASN_DISABLE_OER_SUPPORT) | #if !defined(ASN_DISABLE_OER_SUPPORT) | ||||||
|     OPEN_TYPE_decode_oer, |     OPEN_TYPE_decode_oer, | ||||||
|   | |||||||
| @@ -53,7 +53,8 @@ OPEN_TYPE_aper_get(const asn_codec_ctx_t *opt_codec_ctx, | |||||||
|         (char *)*memb_ptr2 |         (char *)*memb_ptr2 | ||||||
|         + elm->type->elements[selected.presence_index - 1].memb_offset; |         + elm->type->elements[selected.presence_index - 1].memb_offset; | ||||||
|  |  | ||||||
|     rv = aper_open_type_get(opt_codec_ctx, selected.type_descriptor, NULL, |     rv = aper_open_type_get(opt_codec_ctx, selected.type_descriptor, | ||||||
|  |                             elm->type->elements[selected.presence_index - 1].encoding_constraints.per_constraints, | ||||||
|                             &inner_value, pd); |                             &inner_value, pd); | ||||||
|     switch(rv.code) { |     switch(rv.code) { | ||||||
|     case RC_OK: |     case RC_OK: | ||||||
| @@ -110,7 +111,7 @@ OPEN_TYPE_encode_aper(const asn_TYPE_descriptor_t *td, | |||||||
|         memb_ptr = (const char *)sptr + elm->memb_offset; |         memb_ptr = (const char *)sptr + elm->memb_offset; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     if(aper_open_type_put(elm->type, NULL, memb_ptr, po) < 0) { |     if(aper_open_type_put(elm->type, elm->encoding_constraints.per_constraints, memb_ptr, po) < 0) { | ||||||
|         ASN__ENCODE_FAILED; |         ASN__ENCODE_FAILED; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -20,6 +20,7 @@ asn_TYPE_operation_t asn_OP_ObjectDescriptor = { | |||||||
|     0, |     0, | ||||||
| #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | ||||||
|     OCTET_STRING_compare, |     OCTET_STRING_compare, | ||||||
|  |     OCTET_STRING_copy, | ||||||
| #if !defined(ASN_DISABLE_BER_SUPPORT) | #if !defined(ASN_DISABLE_BER_SUPPORT) | ||||||
|     OCTET_STRING_decode_ber,  /* Implemented in terms of OCTET STRING */ |     OCTET_STRING_decode_ber,  /* Implemented in terms of OCTET STRING */ | ||||||
|     OCTET_STRING_encode_der, |     OCTET_STRING_encode_der, | ||||||
| @@ -35,9 +36,11 @@ asn_TYPE_operation_t asn_OP_ObjectDescriptor = { | |||||||
|     0, |     0, | ||||||
| #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | ||||||
| #if !defined(ASN_DISABLE_JER_SUPPORT) | #if !defined(ASN_DISABLE_JER_SUPPORT) | ||||||
|  |     OCTET_STRING_decode_jer_utf8, | ||||||
|     OCTET_STRING_encode_jer_utf8, |     OCTET_STRING_encode_jer_utf8, | ||||||
| #else | #else | ||||||
|     0, |     0, | ||||||
|  |     0, | ||||||
| #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | ||||||
| #if !defined(ASN_DISABLE_OER_SUPPORT) | #if !defined(ASN_DISABLE_OER_SUPPORT) | ||||||
|     0, |     0, | ||||||
|   | |||||||
| @@ -7,7 +7,7 @@ | |||||||
|  |  | ||||||
| #include <osmocom/sbcap/SBcAP_Error-Indication.h> | #include <osmocom/sbcap/SBcAP_Error-Indication.h> | ||||||
|  |  | ||||||
| static asn_TYPE_member_t asn_MBR_SBcAP_Error_Indication_1[] = { | asn_TYPE_member_t asn_MBR_SBcAP_Error_Indication_1[] = { | ||||||
| 	{ ATF_NOFLAGS, 0, offsetof(struct SBcAP_Error_Indication, protocolIEs), | 	{ ATF_NOFLAGS, 0, offsetof(struct SBcAP_Error_Indication, protocolIEs), | ||||||
| 		(ASN_TAG_CLASS_CONTEXT | (0 << 2)), | 		(ASN_TAG_CLASS_CONTEXT | (0 << 2)), | ||||||
| 		-1,	/* IMPLICIT tag at current level */ | 		-1,	/* IMPLICIT tag at current level */ | ||||||
| @@ -32,7 +32,7 @@ static const ber_tlv_tag_t asn_DEF_SBcAP_Error_Indication_tags_1[] = { | |||||||
| static const asn_TYPE_tag2member_t asn_MAP_SBcAP_Error_Indication_tag2el_1[] = { | static const asn_TYPE_tag2member_t asn_MAP_SBcAP_Error_Indication_tag2el_1[] = { | ||||||
|     { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* protocolIEs */ |     { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* protocolIEs */ | ||||||
| }; | }; | ||||||
| static asn_SEQUENCE_specifics_t asn_SPC_SBcAP_Error_Indication_specs_1 = { | asn_SEQUENCE_specifics_t asn_SPC_SBcAP_Error_Indication_specs_1 = { | ||||||
| 	sizeof(struct SBcAP_Error_Indication), | 	sizeof(struct SBcAP_Error_Indication), | ||||||
| 	offsetof(struct SBcAP_Error_Indication, _asn_ctx), | 	offsetof(struct SBcAP_Error_Indication, _asn_ctx), | ||||||
| 	asn_MAP_SBcAP_Error_Indication_tag2el_1, | 	asn_MAP_SBcAP_Error_Indication_tag2el_1, | ||||||
|   | |||||||
| @@ -7,7 +7,7 @@ | |||||||
|  |  | ||||||
| #include <osmocom/sbcap/SBcAP_PWS-Failure-Indication.h> | #include <osmocom/sbcap/SBcAP_PWS-Failure-Indication.h> | ||||||
|  |  | ||||||
| static asn_TYPE_member_t asn_MBR_SBcAP_PWS_Failure_Indication_1[] = { | asn_TYPE_member_t asn_MBR_SBcAP_PWS_Failure_Indication_1[] = { | ||||||
| 	{ ATF_NOFLAGS, 0, offsetof(struct SBcAP_PWS_Failure_Indication, protocolIEs), | 	{ ATF_NOFLAGS, 0, offsetof(struct SBcAP_PWS_Failure_Indication, protocolIEs), | ||||||
| 		(ASN_TAG_CLASS_CONTEXT | (0 << 2)), | 		(ASN_TAG_CLASS_CONTEXT | (0 << 2)), | ||||||
| 		-1,	/* IMPLICIT tag at current level */ | 		-1,	/* IMPLICIT tag at current level */ | ||||||
| @@ -51,7 +51,7 @@ static const asn_TYPE_tag2member_t asn_MAP_SBcAP_PWS_Failure_Indication_tag2el_1 | |||||||
|     { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* protocolIEs */ |     { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* protocolIEs */ | ||||||
|     { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* protocolExtensions */ |     { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* protocolExtensions */ | ||||||
| }; | }; | ||||||
| static asn_SEQUENCE_specifics_t asn_SPC_SBcAP_PWS_Failure_Indication_specs_1 = { | asn_SEQUENCE_specifics_t asn_SPC_SBcAP_PWS_Failure_Indication_specs_1 = { | ||||||
| 	sizeof(struct SBcAP_PWS_Failure_Indication), | 	sizeof(struct SBcAP_PWS_Failure_Indication), | ||||||
| 	offsetof(struct SBcAP_PWS_Failure_Indication, _asn_ctx), | 	offsetof(struct SBcAP_PWS_Failure_Indication, _asn_ctx), | ||||||
| 	asn_MAP_SBcAP_PWS_Failure_Indication_tag2el_1, | 	asn_MAP_SBcAP_PWS_Failure_Indication_tag2el_1, | ||||||
|   | |||||||
| @@ -7,7 +7,7 @@ | |||||||
|  |  | ||||||
| #include <osmocom/sbcap/SBcAP_PWS-Restart-Indication.h> | #include <osmocom/sbcap/SBcAP_PWS-Restart-Indication.h> | ||||||
|  |  | ||||||
| static asn_TYPE_member_t asn_MBR_SBcAP_PWS_Restart_Indication_1[] = { | asn_TYPE_member_t asn_MBR_SBcAP_PWS_Restart_Indication_1[] = { | ||||||
| 	{ ATF_NOFLAGS, 0, offsetof(struct SBcAP_PWS_Restart_Indication, protocolIEs), | 	{ ATF_NOFLAGS, 0, offsetof(struct SBcAP_PWS_Restart_Indication, protocolIEs), | ||||||
| 		(ASN_TAG_CLASS_CONTEXT | (0 << 2)), | 		(ASN_TAG_CLASS_CONTEXT | (0 << 2)), | ||||||
| 		-1,	/* IMPLICIT tag at current level */ | 		-1,	/* IMPLICIT tag at current level */ | ||||||
| @@ -51,7 +51,7 @@ static const asn_TYPE_tag2member_t asn_MAP_SBcAP_PWS_Restart_Indication_tag2el_1 | |||||||
|     { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* protocolIEs */ |     { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* protocolIEs */ | ||||||
|     { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* protocolExtensions */ |     { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* protocolExtensions */ | ||||||
| }; | }; | ||||||
| static asn_SEQUENCE_specifics_t asn_SPC_SBcAP_PWS_Restart_Indication_specs_1 = { | asn_SEQUENCE_specifics_t asn_SPC_SBcAP_PWS_Restart_Indication_specs_1 = { | ||||||
| 	sizeof(struct SBcAP_PWS_Restart_Indication), | 	sizeof(struct SBcAP_PWS_Restart_Indication), | ||||||
| 	offsetof(struct SBcAP_PWS_Restart_Indication, _asn_ctx), | 	offsetof(struct SBcAP_PWS_Restart_Indication, _asn_ctx), | ||||||
| 	asn_MAP_SBcAP_PWS_Restart_Indication_tag2el_1, | 	asn_MAP_SBcAP_PWS_Restart_Indication_tag2el_1, | ||||||
|   | |||||||
| @@ -7,7 +7,7 @@ | |||||||
|  |  | ||||||
| #include <osmocom/sbcap/SBcAP_Stop-Warning-Indication.h> | #include <osmocom/sbcap/SBcAP_Stop-Warning-Indication.h> | ||||||
|  |  | ||||||
| static asn_TYPE_member_t asn_MBR_SBcAP_Stop_Warning_Indication_1[] = { | asn_TYPE_member_t asn_MBR_SBcAP_Stop_Warning_Indication_1[] = { | ||||||
| 	{ ATF_NOFLAGS, 0, offsetof(struct SBcAP_Stop_Warning_Indication, protocolIEs), | 	{ ATF_NOFLAGS, 0, offsetof(struct SBcAP_Stop_Warning_Indication, protocolIEs), | ||||||
| 		(ASN_TAG_CLASS_CONTEXT | (0 << 2)), | 		(ASN_TAG_CLASS_CONTEXT | (0 << 2)), | ||||||
| 		-1,	/* IMPLICIT tag at current level */ | 		-1,	/* IMPLICIT tag at current level */ | ||||||
| @@ -51,7 +51,7 @@ static const asn_TYPE_tag2member_t asn_MAP_SBcAP_Stop_Warning_Indication_tag2el_ | |||||||
|     { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* protocolIEs */ |     { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* protocolIEs */ | ||||||
|     { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* protocolExtensions */ |     { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* protocolExtensions */ | ||||||
| }; | }; | ||||||
| static asn_SEQUENCE_specifics_t asn_SPC_SBcAP_Stop_Warning_Indication_specs_1 = { | asn_SEQUENCE_specifics_t asn_SPC_SBcAP_Stop_Warning_Indication_specs_1 = { | ||||||
| 	sizeof(struct SBcAP_Stop_Warning_Indication), | 	sizeof(struct SBcAP_Stop_Warning_Indication), | ||||||
| 	offsetof(struct SBcAP_Stop_Warning_Indication, _asn_ctx), | 	offsetof(struct SBcAP_Stop_Warning_Indication, _asn_ctx), | ||||||
| 	asn_MAP_SBcAP_Stop_Warning_Indication_tag2el_1, | 	asn_MAP_SBcAP_Stop_Warning_Indication_tag2el_1, | ||||||
|   | |||||||
| @@ -7,7 +7,7 @@ | |||||||
|  |  | ||||||
| #include <osmocom/sbcap/SBcAP_Stop-Warning-Request.h> | #include <osmocom/sbcap/SBcAP_Stop-Warning-Request.h> | ||||||
|  |  | ||||||
| static asn_TYPE_member_t asn_MBR_SBcAP_Stop_Warning_Request_1[] = { | asn_TYPE_member_t asn_MBR_SBcAP_Stop_Warning_Request_1[] = { | ||||||
| 	{ ATF_NOFLAGS, 0, offsetof(struct SBcAP_Stop_Warning_Request, protocolIEs), | 	{ ATF_NOFLAGS, 0, offsetof(struct SBcAP_Stop_Warning_Request, protocolIEs), | ||||||
| 		(ASN_TAG_CLASS_CONTEXT | (0 << 2)), | 		(ASN_TAG_CLASS_CONTEXT | (0 << 2)), | ||||||
| 		-1,	/* IMPLICIT tag at current level */ | 		-1,	/* IMPLICIT tag at current level */ | ||||||
| @@ -51,7 +51,7 @@ static const asn_TYPE_tag2member_t asn_MAP_SBcAP_Stop_Warning_Request_tag2el_1[] | |||||||
|     { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* protocolIEs */ |     { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* protocolIEs */ | ||||||
|     { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* protocolExtensions */ |     { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* protocolExtensions */ | ||||||
| }; | }; | ||||||
| static asn_SEQUENCE_specifics_t asn_SPC_SBcAP_Stop_Warning_Request_specs_1 = { | asn_SEQUENCE_specifics_t asn_SPC_SBcAP_Stop_Warning_Request_specs_1 = { | ||||||
| 	sizeof(struct SBcAP_Stop_Warning_Request), | 	sizeof(struct SBcAP_Stop_Warning_Request), | ||||||
| 	offsetof(struct SBcAP_Stop_Warning_Request, _asn_ctx), | 	offsetof(struct SBcAP_Stop_Warning_Request, _asn_ctx), | ||||||
| 	asn_MAP_SBcAP_Stop_Warning_Request_tag2el_1, | 	asn_MAP_SBcAP_Stop_Warning_Request_tag2el_1, | ||||||
|   | |||||||
| @@ -7,7 +7,7 @@ | |||||||
|  |  | ||||||
| #include <osmocom/sbcap/SBcAP_Stop-Warning-Response.h> | #include <osmocom/sbcap/SBcAP_Stop-Warning-Response.h> | ||||||
|  |  | ||||||
| static asn_TYPE_member_t asn_MBR_SBcAP_Stop_Warning_Response_1[] = { | asn_TYPE_member_t asn_MBR_SBcAP_Stop_Warning_Response_1[] = { | ||||||
| 	{ ATF_NOFLAGS, 0, offsetof(struct SBcAP_Stop_Warning_Response, protocolIEs), | 	{ ATF_NOFLAGS, 0, offsetof(struct SBcAP_Stop_Warning_Response, protocolIEs), | ||||||
| 		(ASN_TAG_CLASS_CONTEXT | (0 << 2)), | 		(ASN_TAG_CLASS_CONTEXT | (0 << 2)), | ||||||
| 		-1,	/* IMPLICIT tag at current level */ | 		-1,	/* IMPLICIT tag at current level */ | ||||||
| @@ -51,7 +51,7 @@ static const asn_TYPE_tag2member_t asn_MAP_SBcAP_Stop_Warning_Response_tag2el_1[ | |||||||
|     { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* protocolIEs */ |     { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* protocolIEs */ | ||||||
|     { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* protocolExtensions */ |     { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* protocolExtensions */ | ||||||
| }; | }; | ||||||
| static asn_SEQUENCE_specifics_t asn_SPC_SBcAP_Stop_Warning_Response_specs_1 = { | asn_SEQUENCE_specifics_t asn_SPC_SBcAP_Stop_Warning_Response_specs_1 = { | ||||||
| 	sizeof(struct SBcAP_Stop_Warning_Response), | 	sizeof(struct SBcAP_Stop_Warning_Response), | ||||||
| 	offsetof(struct SBcAP_Stop_Warning_Response, _asn_ctx), | 	offsetof(struct SBcAP_Stop_Warning_Response, _asn_ctx), | ||||||
| 	asn_MAP_SBcAP_Stop_Warning_Response_tag2el_1, | 	asn_MAP_SBcAP_Stop_Warning_Response_tag2el_1, | ||||||
|   | |||||||
| @@ -7,7 +7,7 @@ | |||||||
|  |  | ||||||
| #include <osmocom/sbcap/SBcAP_Write-Replace-Warning-Indication.h> | #include <osmocom/sbcap/SBcAP_Write-Replace-Warning-Indication.h> | ||||||
|  |  | ||||||
| static asn_TYPE_member_t asn_MBR_SBcAP_Write_Replace_Warning_Indication_1[] = { | asn_TYPE_member_t asn_MBR_SBcAP_Write_Replace_Warning_Indication_1[] = { | ||||||
| 	{ ATF_NOFLAGS, 0, offsetof(struct SBcAP_Write_Replace_Warning_Indication, protocolIEs), | 	{ ATF_NOFLAGS, 0, offsetof(struct SBcAP_Write_Replace_Warning_Indication, protocolIEs), | ||||||
| 		(ASN_TAG_CLASS_CONTEXT | (0 << 2)), | 		(ASN_TAG_CLASS_CONTEXT | (0 << 2)), | ||||||
| 		-1,	/* IMPLICIT tag at current level */ | 		-1,	/* IMPLICIT tag at current level */ | ||||||
| @@ -51,7 +51,7 @@ static const asn_TYPE_tag2member_t asn_MAP_SBcAP_Write_Replace_Warning_Indicatio | |||||||
|     { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* protocolIEs */ |     { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* protocolIEs */ | ||||||
|     { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* protocolExtensions */ |     { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* protocolExtensions */ | ||||||
| }; | }; | ||||||
| static asn_SEQUENCE_specifics_t asn_SPC_SBcAP_Write_Replace_Warning_Indication_specs_1 = { | asn_SEQUENCE_specifics_t asn_SPC_SBcAP_Write_Replace_Warning_Indication_specs_1 = { | ||||||
| 	sizeof(struct SBcAP_Write_Replace_Warning_Indication), | 	sizeof(struct SBcAP_Write_Replace_Warning_Indication), | ||||||
| 	offsetof(struct SBcAP_Write_Replace_Warning_Indication, _asn_ctx), | 	offsetof(struct SBcAP_Write_Replace_Warning_Indication, _asn_ctx), | ||||||
| 	asn_MAP_SBcAP_Write_Replace_Warning_Indication_tag2el_1, | 	asn_MAP_SBcAP_Write_Replace_Warning_Indication_tag2el_1, | ||||||
|   | |||||||
| @@ -7,7 +7,7 @@ | |||||||
|  |  | ||||||
| #include <osmocom/sbcap/SBcAP_Write-Replace-Warning-Request.h> | #include <osmocom/sbcap/SBcAP_Write-Replace-Warning-Request.h> | ||||||
|  |  | ||||||
| static asn_TYPE_member_t asn_MBR_SBcAP_Write_Replace_Warning_Request_1[] = { | asn_TYPE_member_t asn_MBR_SBcAP_Write_Replace_Warning_Request_1[] = { | ||||||
| 	{ ATF_NOFLAGS, 0, offsetof(struct SBcAP_Write_Replace_Warning_Request, protocolIEs), | 	{ ATF_NOFLAGS, 0, offsetof(struct SBcAP_Write_Replace_Warning_Request, protocolIEs), | ||||||
| 		(ASN_TAG_CLASS_CONTEXT | (0 << 2)), | 		(ASN_TAG_CLASS_CONTEXT | (0 << 2)), | ||||||
| 		-1,	/* IMPLICIT tag at current level */ | 		-1,	/* IMPLICIT tag at current level */ | ||||||
| @@ -51,7 +51,7 @@ static const asn_TYPE_tag2member_t asn_MAP_SBcAP_Write_Replace_Warning_Request_t | |||||||
|     { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* protocolIEs */ |     { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* protocolIEs */ | ||||||
|     { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* protocolExtensions */ |     { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* protocolExtensions */ | ||||||
| }; | }; | ||||||
| static asn_SEQUENCE_specifics_t asn_SPC_SBcAP_Write_Replace_Warning_Request_specs_1 = { | asn_SEQUENCE_specifics_t asn_SPC_SBcAP_Write_Replace_Warning_Request_specs_1 = { | ||||||
| 	sizeof(struct SBcAP_Write_Replace_Warning_Request), | 	sizeof(struct SBcAP_Write_Replace_Warning_Request), | ||||||
| 	offsetof(struct SBcAP_Write_Replace_Warning_Request, _asn_ctx), | 	offsetof(struct SBcAP_Write_Replace_Warning_Request, _asn_ctx), | ||||||
| 	asn_MAP_SBcAP_Write_Replace_Warning_Request_tag2el_1, | 	asn_MAP_SBcAP_Write_Replace_Warning_Request_tag2el_1, | ||||||
|   | |||||||
| @@ -7,7 +7,7 @@ | |||||||
|  |  | ||||||
| #include <osmocom/sbcap/SBcAP_Write-Replace-Warning-Response.h> | #include <osmocom/sbcap/SBcAP_Write-Replace-Warning-Response.h> | ||||||
|  |  | ||||||
| static asn_TYPE_member_t asn_MBR_SBcAP_Write_Replace_Warning_Response_1[] = { | asn_TYPE_member_t asn_MBR_SBcAP_Write_Replace_Warning_Response_1[] = { | ||||||
| 	{ ATF_NOFLAGS, 0, offsetof(struct SBcAP_Write_Replace_Warning_Response, protocolIEs), | 	{ ATF_NOFLAGS, 0, offsetof(struct SBcAP_Write_Replace_Warning_Response, protocolIEs), | ||||||
| 		(ASN_TAG_CLASS_CONTEXT | (0 << 2)), | 		(ASN_TAG_CLASS_CONTEXT | (0 << 2)), | ||||||
| 		-1,	/* IMPLICIT tag at current level */ | 		-1,	/* IMPLICIT tag at current level */ | ||||||
| @@ -51,7 +51,7 @@ static const asn_TYPE_tag2member_t asn_MAP_SBcAP_Write_Replace_Warning_Response_ | |||||||
|     { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* protocolIEs */ |     { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* protocolIEs */ | ||||||
|     { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* protocolExtensions */ |     { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* protocolExtensions */ | ||||||
| }; | }; | ||||||
| static asn_SEQUENCE_specifics_t asn_SPC_SBcAP_Write_Replace_Warning_Response_specs_1 = { | asn_SEQUENCE_specifics_t asn_SPC_SBcAP_Write_Replace_Warning_Response_specs_1 = { | ||||||
| 	sizeof(struct SBcAP_Write_Replace_Warning_Response), | 	sizeof(struct SBcAP_Write_Replace_Warning_Response), | ||||||
| 	offsetof(struct SBcAP_Write_Replace_Warning_Response, _asn_ctx), | 	offsetof(struct SBcAP_Write_Replace_Warning_Response, _asn_ctx), | ||||||
| 	asn_MAP_SBcAP_Write_Replace_Warning_Response_tag2el_1, | 	asn_MAP_SBcAP_Write_Replace_Warning_Response_tag2el_1, | ||||||
|   | |||||||
| @@ -25,8 +25,7 @@ aper_get_length(asn_per_data_t *pd, ssize_t lb, ssize_t ub, | |||||||
| 	*repeat = 0; | 	*repeat = 0; | ||||||
|  |  | ||||||
| 	if (constrained && ub < 65536) { | 	if (constrained && ub < 65536) { | ||||||
| 		int range = ub - lb + 1; | 		return aper_get_constrained_whole_number(pd, lb, ub); | ||||||
| 		return aper_get_nsnnwn(pd, range); |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if (aper_get_align(pd) < 0) | 	if (aper_get_align(pd) < 0) | ||||||
| @@ -70,55 +69,117 @@ aper_get_nslength(asn_per_data_t *pd) { | |||||||
| } | } | ||||||
|  |  | ||||||
| ssize_t | ssize_t | ||||||
| aper_get_nsnnwn(asn_per_data_t *pd, int range) { | aper_get_nsnnwn(asn_per_data_t *pd) { | ||||||
| 	ssize_t value; | 	int b; | ||||||
| 	int bytes = 0; |  | ||||||
|  |  | ||||||
| 	ASN_DEBUG("getting nsnnwn with range %d", range); |  | ||||||
|  |  | ||||||
| 	if(range <= 255) { |  | ||||||
| 		int i; |  | ||||||
|  |  | ||||||
| 		if (range < 0) return -1; |  | ||||||
| 		/* 1 -> 8 bits */ |  | ||||||
| 		for (i = 1; i <= 8; i++) { |  | ||||||
| 			int upper = 1 << i; |  | ||||||
| 			if (upper >= range) |  | ||||||
| 				break; |  | ||||||
| 		} |  | ||||||
| 		value = per_get_few_bits(pd, i); |  | ||||||
| 		return value; |  | ||||||
| 	} else if (range == 256){ |  | ||||||
| 		/* 1 byte */ |  | ||||||
| 		bytes = 1; |  | ||||||
| 	} else if (range <= 65536) { |  | ||||||
| 		/* 2 bytes */ |  | ||||||
| 		bytes = 2; |  | ||||||
| 	} else { |  | ||||||
| 		//return -1; |  | ||||||
| 	int length; | 	int length; | ||||||
|  |  | ||||||
| 		/* handle indefinite range */ | 	ASN_DEBUG("getting nsnnwn"); | ||||||
| 		length = per_get_few_bits(pd, 1); |  | ||||||
| 		if (length == 0) | 	b = per_get_few_bits(pd, 1); | ||||||
|  | 	if (b == -1) | ||||||
|  | 		return -1; | ||||||
|  |  | ||||||
|  | 	/* X.691 2002 10.6.1 */ | ||||||
|  | 	if (b == 0) | ||||||
| 		return per_get_few_bits(pd, 6); | 		return per_get_few_bits(pd, 6); | ||||||
|  |  | ||||||
| 	if (aper_get_align(pd) < 0) | 	if (aper_get_align(pd) < 0) | ||||||
| 		return -1; | 		return -1; | ||||||
|  |  | ||||||
| 		length = per_get_few_bits(pd, 8); | 	/* X.691 2002 10.6.2 */ | ||||||
| 		/* the length is not likely to be that big */ | 	/* X.691 2002 10.9.3.5 */ | ||||||
| 		if (length > 4) | 	b = per_get_few_bits(pd, 1); | ||||||
|  | 	if (b == -1) | ||||||
| 		return -1; | 		return -1; | ||||||
| 		value = 0; |  | ||||||
| 		if (per_get_many_bits(pd, (uint8_t *)&value, 0, length * 8) < 0) | 	if (b == 1) { | ||||||
|  | 		/* other 10.9.3.x cases not handled, it's doubtful we reach them in practice */ | ||||||
|  | 		ASN_DEBUG("todo: X.691 2002 10.9.3.x"); | ||||||
| 		return -1; | 		return -1; | ||||||
| 		return value; |  | ||||||
| 	} | 	} | ||||||
| 	if (aper_get_align(pd) < 0) |  | ||||||
|  | 	/* X.691 2002 10.9.3.6 */ | ||||||
|  | 	length = per_get_few_bits(pd, 7); | ||||||
|  | 	if (length > 4) { | ||||||
|  | 		/* todo */ | ||||||
|  | 		ASN_DEBUG("todo: X.691 2002 10.9.3.6 for length > 4"); | ||||||
| 		return -1; | 		return -1; | ||||||
| 	value = per_get_few_bits(pd, 8 * bytes); | 	} | ||||||
| 	return value; | 	ASN_DEBUG("length %d\n", length); | ||||||
|  |  | ||||||
|  | 	/* todo: 0xffffffff will be seen as -1 and will lead to decoding failure */ | ||||||
|  | 	return per_get_few_bits(pd, length * 8); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | /* X.691 2002 10.5 - Decoding of a constrained whole number */ | ||||||
|  | long | ||||||
|  | aper_get_constrained_whole_number(asn_per_data_t *pd, long lb, long ub) { | ||||||
|  | 	assert(ub >= lb); | ||||||
|  | 	long range = ub - lb + 1; | ||||||
|  | 	int range_len; | ||||||
|  | 	int value_len; | ||||||
|  | 	long value; | ||||||
|  |  | ||||||
|  | 	ASN_DEBUG("aper get constrained_whole_number with lb %ld and ub %ld", lb, ub); | ||||||
|  |  | ||||||
|  | 	/* X.691 2002 10.5.4 */ | ||||||
|  | 	if (range == 1) | ||||||
|  | 		return lb; | ||||||
|  |  | ||||||
|  | 	/* X.691 2002 10.5.7.1 - The bit-field case. */ | ||||||
|  | 	if (range <= 255) { | ||||||
|  | 		int bitfield_size = 8; | ||||||
|  | 		for (bitfield_size = 8; bitfield_size >= 2; bitfield_size--) | ||||||
|  | 			if ((range - 1) & (1 << (bitfield_size-1))) | ||||||
|  | 				break; | ||||||
|  | 		value = per_get_few_bits(pd, bitfield_size); | ||||||
|  | 		if (value < 0 || value >= range) | ||||||
|  | 			return -1; | ||||||
|  | 		return value + lb; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/* X.691 2002 10.5.7.2 - The one-octet case. */ | ||||||
|  | 	if (range == 256) { | ||||||
|  | 		if (aper_get_align(pd)) | ||||||
|  | 			return -1; | ||||||
|  | 		value = per_get_few_bits(pd, 8); | ||||||
|  | 		if (value < 0 || value >= range) | ||||||
|  | 			return -1; | ||||||
|  | 		return value + lb; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/* X.691 2002 10.5.7.3 - The two-octet case. */ | ||||||
|  | 	if (range <= 65536) { | ||||||
|  | 		if (aper_get_align(pd)) | ||||||
|  | 			return -1; | ||||||
|  | 		value = per_get_few_bits(pd, 16); | ||||||
|  | 		if (value < 0 || value >= range) | ||||||
|  | 			return -1; | ||||||
|  | 		return value + lb; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/* X.691 2002 10.5.7.4 - The indefinite length case. */ | ||||||
|  | 	/* since we limit input to be 'long' we don't handle all numbers */ | ||||||
|  | 	/* and so length determinant is retrieved as X.691 2002 10.9.3.3 */ | ||||||
|  | 	/* number of bytes to store the range */ | ||||||
|  | 	for (range_len = 3; ; range_len++) { | ||||||
|  | 		long bits = ((long)1) << (8 * range_len); | ||||||
|  | 		if (range - 1 < bits) | ||||||
|  | 			break; | ||||||
|  | 	} | ||||||
|  | 	value_len = aper_get_constrained_whole_number(pd, 1, range_len); | ||||||
|  | 	if (value_len == -1) | ||||||
|  | 		return -1; | ||||||
|  | 	if (value_len > 4) { | ||||||
|  | 		ASN_DEBUG("todo: aper_get_constrained_whole_number: value_len > 4"); | ||||||
|  | 		return -1; | ||||||
|  | 	} | ||||||
|  | 	if (aper_get_align(pd)) | ||||||
|  | 		return -1; | ||||||
|  | 	value = per_get_few_bits(pd, value_len * 8); | ||||||
|  | 	if (value < 0 || value >= range) | ||||||
|  | 		return -1; | ||||||
|  | 	return value + lb; | ||||||
| } | } | ||||||
|  |  | ||||||
| int aper_put_align(asn_per_outp_t *po) { | int aper_put_align(asn_per_outp_t *po) { | ||||||
| @@ -142,11 +203,9 @@ aper_put_length(asn_per_outp_t *po, ssize_t lb, ssize_t ub, size_t n, int *need_ | |||||||
|  |  | ||||||
| 	ASN_DEBUG("APER put length %zu with range (%zd..%zd)", n, lb, ub); | 	ASN_DEBUG("APER put length %zu with range (%zd..%zd)", n, lb, ub); | ||||||
|  |  | ||||||
| 	/* 11.9 X.691 Note 2 */ | 	/* X.691 2002 10.9.3.3 */ | ||||||
| 	if (constrained && ub < 65536) { | 	if (constrained && ub < 65536) | ||||||
| 		int range = ub - lb + 1; | 		return aper_put_constrained_whole_number(po, lb, ub, n + lb) ? -1 : (ssize_t)n; | ||||||
| 		return aper_put_nsnnwn(po, range, n) ? -1 : (ssize_t)n; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	if (aper_put_align(po) < 0) | 	if (aper_put_align(po) < 0) | ||||||
| 		return -1; | 		return -1; | ||||||
| @@ -189,51 +248,113 @@ aper_put_nslength(asn_per_outp_t *po, size_t length) { | |||||||
| } | } | ||||||
|  |  | ||||||
| int | int | ||||||
| aper_put_nsnnwn(asn_per_outp_t *po, int range, int number) { | aper_put_nsnnwn(asn_per_outp_t *po, int number) { | ||||||
| 	int bytes; | 	int len; | ||||||
|  |  | ||||||
| 	ASN_DEBUG("aper put nsnnwn %d with range %d", number, range); | 	ASN_DEBUG("aper put nsnnwn %d", number); | ||||||
| 	/* 10.5.7.1 X.691 */ |  | ||||||
| 	if(range < 0) { | 	if (number <= 63) { | ||||||
| 		int i; | 		if (per_put_few_bits(po, 0, 1)) | ||||||
| 		for (i = 1; ; i++) { |  | ||||||
| 			int bits = 1 << (8 * i); |  | ||||||
| 			if (number <= bits) |  | ||||||
| 				break; |  | ||||||
| 		} |  | ||||||
| 		bytes = i; |  | ||||||
| 		assert(i <= 4); |  | ||||||
| 	} |  | ||||||
| 	if(range <= 255) { |  | ||||||
| 		int i; |  | ||||||
| 		for (i = 1; i <= 8; i++) { |  | ||||||
| 			int bits = 1 << i; |  | ||||||
| 			if (range <= bits) |  | ||||||
| 				break; |  | ||||||
| 		} |  | ||||||
| 		return per_put_few_bits(po, number, i); |  | ||||||
| 	} else if(range == 256) { |  | ||||||
| 		if (number >= range) |  | ||||||
| 			return -1; | 			return -1; | ||||||
| 		bytes = 1; | 		return per_put_few_bits(po, number, 6); | ||||||
| 	} else if(range <= 65536) { | 	} | ||||||
| 		if (number >= range) |  | ||||||
|  | 	if (per_put_few_bits(po, 1, 1)) | ||||||
| 		return -1; | 		return -1; | ||||||
| 		bytes = 2; |  | ||||||
| 	} else { /* Ranges > 64K */ | 	if (number < 256) { | ||||||
|  | 		len = 1; | ||||||
|  | 	} else if (number < 65536) { | ||||||
|  | 		len = 2; | ||||||
|  | 	} else { /* number > 64K */ | ||||||
| 		int i; | 		int i; | ||||||
| 		for (i = 1; ; i++) { | 		for (i = 3; ; i++) { | ||||||
| 			int bits = 1 << (8 * i); | 			int bits = 1 << (8 * i); | ||||||
| 			if (range <= bits) | 			if (number < bits) | ||||||
| 				break; | 				break; | ||||||
| 		} | 		} | ||||||
| 		assert(i <= 4); | 		len = i; | ||||||
| 		bytes = i; | 	} | ||||||
|  |  | ||||||
|  | 	if (aper_put_align(po) < 0) | ||||||
|  | 		return -1; | ||||||
|  |  | ||||||
|  | 	/* put the length which is a non-constrained whole number */ | ||||||
|  | 	if (len <= 127) { | ||||||
|  | 		if(per_put_few_bits(po, 0, 1)) | ||||||
|  | 			return -1; | ||||||
|  | 		if(per_put_few_bits(po, len, 7)) | ||||||
|  | 			return -1; | ||||||
|  | 	} else { | ||||||
|  | 		/* todo but not big problem, it's very doubtful that the | ||||||
|  | 		 * number of bytes to encode 'number' will be > 127 | ||||||
|  | 		 */ | ||||||
|  | 		return -1; | ||||||
| 	} | 	} | ||||||
| 	if(aper_put_align(po) < 0) /* Aligning on octet */ | 	if(aper_put_align(po) < 0) /* Aligning on octet */ | ||||||
| 		return -1; | 		return -1; | ||||||
| /* 	if(per_put_few_bits(po, bytes, 8)) | 	return per_put_few_bits(po, number, 8 * len); | ||||||
| 		return -1; | } | ||||||
| */ |  | ||||||
| 	return per_put_few_bits(po, number, 8 * bytes); | /* X.691 2002 10.5 - Encoding of a constrained whole number */ | ||||||
|  | int | ||||||
|  | aper_put_constrained_whole_number(asn_per_outp_t *po, long lb, long ub, long number) { | ||||||
|  | 	assert(ub >= lb); | ||||||
|  | 	long range = ub - lb + 1; | ||||||
|  | 	long value = number - lb; | ||||||
|  | 	int range_len; | ||||||
|  | 	int value_len; | ||||||
|  |  | ||||||
|  | 	ASN_DEBUG("aper put constrained_whole_number %ld with lb %ld and ub %ld", number, lb, ub); | ||||||
|  |  | ||||||
|  | 	if (number < lb || number > ub) | ||||||
|  | 		return -1; | ||||||
|  |  | ||||||
|  | 	/* X.691 2002 10.5.4 */ | ||||||
|  | 	if (range == 1) | ||||||
|  | 		return 0; | ||||||
|  |  | ||||||
|  | 	/* X.691 2002 10.5.7.1 - The bit-field case. */ | ||||||
|  | 	if (range <= 255) { | ||||||
|  | 		int bitfield_size = 8; | ||||||
|  | 		for (bitfield_size = 8; bitfield_size >= 2; bitfield_size--) | ||||||
|  | 			if ((range - 1) & (1 << (bitfield_size-1))) | ||||||
|  | 				break; | ||||||
|  | 		return per_put_few_bits(po, value, bitfield_size); | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/* X.691 2002 10.5.7.2 - The one-octet case. */ | ||||||
|  | 	if (range == 256) { | ||||||
|  | 		if (aper_put_align(po)) | ||||||
|  | 			return -1; | ||||||
|  | 		return per_put_few_bits(po, value, 8); | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/* X.691 2002 10.5.7.3 - The two-octet case. */ | ||||||
|  | 	if (range <= 65536) { | ||||||
|  | 		if (aper_put_align(po)) | ||||||
|  | 			return -1; | ||||||
|  | 		return per_put_few_bits(po, value, 16); | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/* X.691 2002 10.5.7.4 - The indefinite length case. */ | ||||||
|  | 	/* since we limit input to be 'long' we don't handle all numbers */ | ||||||
|  | 	/* and so length determinant is stored as X.691 2002 10.9.3.3 */ | ||||||
|  | 	/* number of bytes to store the range */ | ||||||
|  | 	for (range_len = 3; ; range_len++) { | ||||||
|  | 		int bits = 1 << (8 * range_len); | ||||||
|  | 		if (range - 1 < bits) | ||||||
|  | 			break; | ||||||
|  | 	} | ||||||
|  | 	/* number of bytes to store the value */ | ||||||
|  | 	for (value_len = 1; ; value_len++) { | ||||||
|  | 		long bits = ((long)1) << (8 * value_len); | ||||||
|  | 		if (value < bits) | ||||||
|  | 			break; | ||||||
|  | 	} | ||||||
|  | 	if (aper_put_constrained_whole_number(po, 1, range_len, value_len)) | ||||||
|  | 		return -1; | ||||||
|  | 	if (aper_put_align(po)) | ||||||
|  | 		return -1; | ||||||
|  | 	return per_put_few_bits(po, value, value_len * 8); | ||||||
| } | } | ||||||
|   | |||||||
| @@ -229,6 +229,9 @@ asn_encode_internal(const asn_codec_ctx_t *opt_codec_ctx, | |||||||
| #if !defined(ASN_DISABLE_XER_SUPPORT) | #if !defined(ASN_DISABLE_XER_SUPPORT) | ||||||
|     enum xer_encoder_flags_e xer_flags = XER_F_CANONICAL; |     enum xer_encoder_flags_e xer_flags = XER_F_CANONICAL; | ||||||
| #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | ||||||
|  | #if !defined(ASN_DISABLE_JER_SUPPORT) | ||||||
|  |     enum jer_encoder_flags_e jer_flags = JER_F; | ||||||
|  | #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | ||||||
|  |  | ||||||
|     (void)opt_codec_ctx; /* Parameters are not checked on encode yet. */ |     (void)opt_codec_ctx; /* Parameters are not checked on encode yet. */ | ||||||
|  |  | ||||||
| @@ -432,9 +435,15 @@ asn_encode_internal(const asn_codec_ctx_t *opt_codec_ctx, | |||||||
| #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | ||||||
|  |  | ||||||
| #if !defined(ASN_DISABLE_JER_SUPPORT) | #if !defined(ASN_DISABLE_JER_SUPPORT) | ||||||
|     case ATS_BASIC_JER: |     case ATS_JER_MINIFIED: | ||||||
|  |         /* Currently JER_F and JER_F_MINIFIED have opposite purposes | ||||||
|  |         *  so we just flip the flag. */ | ||||||
|  |         jer_flags &= ~JER_F; | ||||||
|  |         jer_flags |= JER_F_MINIFIED; | ||||||
|  |         /* Fall through. */ | ||||||
|  |     case ATS_JER: | ||||||
|         if(td->op->jer_encoder) { |         if(td->op->jer_encoder) { | ||||||
|             er = jer_encode(td, sptr, callback, callback_key); |             er = jer_encode(td, sptr, jer_flags, callback, callback_key); | ||||||
|             if(er.encoded == -1) { |             if(er.encoded == -1) { | ||||||
|                 if(er.failed_type && er.failed_type->op->jer_encoder) { |                 if(er.failed_type && er.failed_type->op->jer_encoder) { | ||||||
|                     errno = EBADF;   /* Structure has incorrect form. */ |                     errno = EBADF;   /* Structure has incorrect form. */ | ||||||
| @@ -533,6 +542,15 @@ asn_decode(const asn_codec_ctx_t *opt_codec_ctx, | |||||||
|         errno = ENOENT; |         errno = ENOENT; | ||||||
|         ASN__DECODE_FAILED; |         ASN__DECODE_FAILED; | ||||||
| #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | ||||||
|  |  | ||||||
|  |     case ATS_JER: | ||||||
|  |     case ATS_JER_MINIFIED: | ||||||
|  | #if !defined(ASN_DISABLE_JER_SUPPORT) | ||||||
|  |         return jer_decode(opt_codec_ctx, td, sptr, buffer, size); | ||||||
|  | #else | ||||||
|  |         errno = ENOENT; | ||||||
|  |         ASN__DECODE_FAILED; | ||||||
|  | #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -26,7 +26,9 @@ asn__format_to_callback(int (*cb)(const void *, size_t, void *key), void *key, | |||||||
|         buf_size <<= 1; |         buf_size <<= 1; | ||||||
|         if(buf == scratch) { |         if(buf == scratch) { | ||||||
|             buf = MALLOC(buf_size); |             buf = MALLOC(buf_size); | ||||||
|             if(!buf) return -1; |             if(!buf) { | ||||||
|  |               return -1; | ||||||
|  |             } | ||||||
|         } else { |         } else { | ||||||
|             void *p = REALLOC(buf, buf_size); |             void *p = REALLOC(buf, buf_size); | ||||||
|             if(!p) { |             if(!p) { | ||||||
|   | |||||||
| @@ -6,6 +6,7 @@ | |||||||
| #include <asn_internal.h> | #include <asn_internal.h> | ||||||
| #include <asn_random_fill.h> | #include <asn_random_fill.h> | ||||||
| #include <constr_TYPE.h> | #include <constr_TYPE.h> | ||||||
|  | #include <stdlib.h> | ||||||
|  |  | ||||||
| int | int | ||||||
| asn_random_fill(const struct asn_TYPE_descriptor_s *td, void **struct_ptr, | asn_random_fill(const struct asn_TYPE_descriptor_s *td, void **struct_ptr, | ||||||
| @@ -42,17 +43,22 @@ asn_random_between(intmax_t lb, intmax_t rb) { | |||||||
|         uintmax_t range = asn__intmax_range(lb, rb); |         uintmax_t range = asn__intmax_range(lb, rb); | ||||||
|         uintmax_t value = 0; |         uintmax_t value = 0; | ||||||
|         uintmax_t got_entropy = 0; |         uintmax_t got_entropy = 0; | ||||||
|  |  | ||||||
|         (void)intmax_max; |         (void)intmax_max; | ||||||
|         assert(RAND_MAX > 0xffffff);    /* Seen 7ffffffd! */ |         int max = 0xffffff; | ||||||
|  |  | ||||||
|  | #ifdef __WIN32__ | ||||||
|  |         max = RAND_MAX-1; | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  |         assert(RAND_MAX > max);    /* Seen 7ffffffd! */ | ||||||
|         assert(range < intmax_max); |         assert(range < intmax_max); | ||||||
|  |  | ||||||
|         for(; got_entropy < range;) { |         for(; got_entropy < range;) { | ||||||
|             got_entropy = (got_entropy << 24) | 0xffffff; |             got_entropy = (got_entropy << 24) | max; | ||||||
| #ifdef HAVE_RANDOM | #ifdef HAVE_RANDOM | ||||||
|             value = (value << 24) | (random() % 0xffffff); |             value = (value << 24) | (random() % max); | ||||||
| #else | #else | ||||||
|             value = (value << 24) | (rand() % 0xffffff); |             value = (value << 24) | (rand() % max); | ||||||
| #endif | #endif | ||||||
|         } |         } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -13,6 +13,7 @@ asn_TYPE_operation_t asn_OP_CHOICE = { | |||||||
|     0, |     0, | ||||||
| #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | ||||||
|     CHOICE_compare, |     CHOICE_compare, | ||||||
|  |     CHOICE_copy, | ||||||
| #if !defined(ASN_DISABLE_BER_SUPPORT) | #if !defined(ASN_DISABLE_BER_SUPPORT) | ||||||
|     CHOICE_decode_ber, |     CHOICE_decode_ber, | ||||||
|     CHOICE_encode_der, |     CHOICE_encode_der, | ||||||
| @@ -28,9 +29,11 @@ asn_TYPE_operation_t asn_OP_CHOICE = { | |||||||
|     0, |     0, | ||||||
| #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | ||||||
| #if !defined(ASN_DISABLE_JER_SUPPORT) | #if !defined(ASN_DISABLE_JER_SUPPORT) | ||||||
|  |     CHOICE_decode_jer, | ||||||
|     CHOICE_encode_jer, |     CHOICE_encode_jer, | ||||||
| #else | #else | ||||||
|     0, |     0, | ||||||
|  |     0, | ||||||
| #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | ||||||
| #if !defined(ASN_DISABLE_OER_SUPPORT) | #if !defined(ASN_DISABLE_OER_SUPPORT) | ||||||
|     CHOICE_decode_oer, |     CHOICE_decode_oer, | ||||||
| @@ -154,13 +157,14 @@ CHOICE_constraint(const asn_TYPE_descriptor_t *td, const void *sptr, | |||||||
| void | void | ||||||
| CHOICE_free(const asn_TYPE_descriptor_t *td, void *ptr, | CHOICE_free(const asn_TYPE_descriptor_t *td, void *ptr, | ||||||
|             enum asn_struct_free_method method) { |             enum asn_struct_free_method method) { | ||||||
|     const asn_CHOICE_specifics_t *specs = |     const asn_CHOICE_specifics_t *specs; | ||||||
|         (const asn_CHOICE_specifics_t *)td->specifics; |  | ||||||
|     unsigned present; |     unsigned present; | ||||||
|  |  | ||||||
| 	if(!td || !ptr) | 	if(!td || !ptr) | ||||||
| 		return; | 		return; | ||||||
|  |  | ||||||
|  |     specs = (const asn_CHOICE_specifics_t *)td->specifics; | ||||||
|  |  | ||||||
| 	ASN_DEBUG("Freeing %s as CHOICE", td->name); | 	ASN_DEBUG("Freeing %s as CHOICE", td->name); | ||||||
|  |  | ||||||
| 	/* | 	/* | ||||||
| @@ -311,6 +315,59 @@ CHOICE_compare(const asn_TYPE_descriptor_t *td, const void *aptr, const void *bp | |||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | int | ||||||
|  | CHOICE_copy(const asn_TYPE_descriptor_t *td, void **aptr, const void *bptr) { | ||||||
|  |     if(!td) return -1; | ||||||
|  |  | ||||||
|  |     void *st = *aptr; | ||||||
|  |     const asn_CHOICE_specifics_t *specs = | ||||||
|  |         (const asn_CHOICE_specifics_t *)td->specifics; | ||||||
|  |     const asn_TYPE_member_t *elm;  /* CHOICE's element */ | ||||||
|  |     int present; | ||||||
|  |     int ret; | ||||||
|  | 	void *amemb; | ||||||
|  |     void **amembp; | ||||||
|  |     const void *bmemb; | ||||||
|  |  | ||||||
|  |     if(!bptr) { | ||||||
|  |         if(st) { | ||||||
|  |             ASN_STRUCT_FREE(*td, st); | ||||||
|  |             *aptr = NULL; | ||||||
|  |         } | ||||||
|  |         return 0; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     if(!st) { | ||||||
|  |         st = *aptr = CALLOC(1, specs->struct_size); | ||||||
|  |         if(!st) return -1; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     present = _fetch_present_idx(bptr, | ||||||
|  |                                  specs->pres_offset, specs->pres_size); | ||||||
|  |  | ||||||
|  |     if(present <= 0 && (unsigned)present > td->elements_count) return -1; | ||||||
|  |     --present; | ||||||
|  |  | ||||||
|  |     elm = &td->elements[present]; | ||||||
|  |     if(elm->flags & ATF_POINTER) { | ||||||
|  |         /* Member is a pointer to another structure */ | ||||||
|  |         amembp = (void **)((char *)st + elm->memb_offset); | ||||||
|  |         bmemb = *(const void* const*)((const char*)bptr + elm->memb_offset); | ||||||
|  |     } else { | ||||||
|  |         amemb = (char *)st + elm->memb_offset; | ||||||
|  |         amembp = &amemb; | ||||||
|  |         bmemb = (const void*)((const char*)bptr + elm->memb_offset); | ||||||
|  |     } | ||||||
|  |     ret = elm->type->op->copy_struct(elm->type, amembp, bmemb); | ||||||
|  |     if (ret != 0) return ret; | ||||||
|  |  | ||||||
|  |     _set_present_idx(st, | ||||||
|  |             specs->pres_offset, | ||||||
|  |             specs->pres_size, present + 1); | ||||||
|  |  | ||||||
|  |     return 0; | ||||||
|  | } | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  * Return the 1-based choice variant presence index. |  * Return the 1-based choice variant presence index. | ||||||
|  * Returns 0 in case of error. |  * Returns 0 in case of error. | ||||||
|   | |||||||
| @@ -40,6 +40,8 @@ CHOICE_decode_aper(const asn_codec_ctx_t *opt_codec_ctx, | |||||||
|         value = per_get_few_bits(pd, 1); |         value = per_get_few_bits(pd, 1); | ||||||
|         if(value < 0) ASN__DECODE_STARVED; |         if(value < 0) ASN__DECODE_STARVED; | ||||||
|         if(value) ct = 0;  /* Not restricted */ |         if(value) ct = 0;  /* Not restricted */ | ||||||
|  |         if((unsigned)value >= td->elements_count) | ||||||
|  |             ASN__DECODE_FAILED; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     if(ct && ct->range_bits >= 0) { |     if(ct && ct->range_bits >= 0) { | ||||||
| @@ -53,8 +55,8 @@ CHOICE_decode_aper(const asn_codec_ctx_t *opt_codec_ctx, | |||||||
|         if(specs->ext_start == -1) |         if(specs->ext_start == -1) | ||||||
|             ASN__DECODE_FAILED; |             ASN__DECODE_FAILED; | ||||||
|  |  | ||||||
|         if (ct && ct->upper_bound >= ct->lower_bound) { |         if(specs && specs->tag2el_count > (unsigned)specs->ext_start) { | ||||||
|             value = aper_get_nsnnwn(pd, ct->upper_bound - ct->lower_bound + 1); |             value = aper_get_nsnnwn(pd); /* extension elements range */ | ||||||
|             if(value < 0) ASN__DECODE_STARVED; |             if(value < 0) ASN__DECODE_STARVED; | ||||||
|             value += specs->ext_start; |             value += specs->ext_start; | ||||||
|             if((unsigned)value >= td->elements_count) |             if((unsigned)value >= td->elements_count) | ||||||
| @@ -166,11 +168,7 @@ CHOICE_encode_aper(const asn_TYPE_descriptor_t *td, | |||||||
|         asn_enc_rval_t rval = {0,0,0}; |         asn_enc_rval_t rval = {0,0,0}; | ||||||
|         if(specs->ext_start == -1) |         if(specs->ext_start == -1) | ||||||
|             ASN__ENCODE_FAILED; |             ASN__ENCODE_FAILED; | ||||||
|         int n = present - specs->ext_start; |         if(aper_put_nsnnwn(po, present - specs->ext_start)) | ||||||
|         if(n <= 63) { |  | ||||||
|             if(n < 0) ASN__ENCODE_FAILED; |  | ||||||
|             if(per_put_few_bits(po, n, 7)) ASN__ENCODE_FAILED; |  | ||||||
|         } else |  | ||||||
|             ASN__ENCODE_FAILED; |             ASN__ENCODE_FAILED; | ||||||
|         if(aper_open_type_put(elm->type, elm->encoding_constraints.per_constraints, |         if(aper_open_type_put(elm->type, elm->encoding_constraints.per_constraints, | ||||||
|                               memb_ptr, po)) |                               memb_ptr, po)) | ||||||
|   | |||||||
| @@ -14,6 +14,7 @@ asn_TYPE_operation_t asn_OP_SEQUENCE = { | |||||||
|     0, |     0, | ||||||
| #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | ||||||
|     SEQUENCE_compare, |     SEQUENCE_compare, | ||||||
|  |     SEQUENCE_copy, | ||||||
| #if !defined(ASN_DISABLE_BER_SUPPORT) | #if !defined(ASN_DISABLE_BER_SUPPORT) | ||||||
|     SEQUENCE_decode_ber, |     SEQUENCE_decode_ber, | ||||||
|     SEQUENCE_encode_der, |     SEQUENCE_encode_der, | ||||||
| @@ -29,9 +30,11 @@ asn_TYPE_operation_t asn_OP_SEQUENCE = { | |||||||
|     0, |     0, | ||||||
| #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | ||||||
| #if !defined(ASN_DISABLE_JER_SUPPORT) | #if !defined(ASN_DISABLE_JER_SUPPORT) | ||||||
|  |     SEQUENCE_decode_jer, | ||||||
|     SEQUENCE_encode_jer, |     SEQUENCE_encode_jer, | ||||||
| #else | #else | ||||||
|     0, |     0, | ||||||
|  |     0, | ||||||
| #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | ||||||
| #if !defined(ASN_DISABLE_OER_SUPPORT) | #if !defined(ASN_DISABLE_OER_SUPPORT) | ||||||
|     SEQUENCE_decode_oer, |     SEQUENCE_decode_oer, | ||||||
| @@ -66,13 +69,14 @@ void | |||||||
| SEQUENCE_free(const asn_TYPE_descriptor_t *td, void *sptr, | SEQUENCE_free(const asn_TYPE_descriptor_t *td, void *sptr, | ||||||
|               enum asn_struct_free_method method) { |               enum asn_struct_free_method method) { | ||||||
|     size_t edx; |     size_t edx; | ||||||
|     const asn_SEQUENCE_specifics_t *specs = |     const asn_SEQUENCE_specifics_t *specs;  | ||||||
|         (const asn_SEQUENCE_specifics_t *)td->specifics; |  | ||||||
|     asn_struct_ctx_t *ctx; /* Decoder context */ |     asn_struct_ctx_t *ctx; /* Decoder context */ | ||||||
|  |  | ||||||
| 	if(!td || !sptr) | 	if(!td || !sptr) | ||||||
| 		return; | 		return; | ||||||
|  |  | ||||||
|  |     specs = (const asn_SEQUENCE_specifics_t *)td->specifics; | ||||||
|  |  | ||||||
| 	ASN_DEBUG("Freeing %s as SEQUENCE", td->name); | 	ASN_DEBUG("Freeing %s as SEQUENCE", td->name); | ||||||
|  |  | ||||||
| 	for(edx = 0; edx < td->elements_count; edx++) { | 	for(edx = 0; edx < td->elements_count; edx++) { | ||||||
| @@ -124,6 +128,8 @@ SEQUENCE_constraint(const asn_TYPE_descriptor_t *td, const void *sptr, | |||||||
| 	for(edx = 0; edx < td->elements_count; edx++) { | 	for(edx = 0; edx < td->elements_count; edx++) { | ||||||
| 		asn_TYPE_member_t *elm = &td->elements[edx]; | 		asn_TYPE_member_t *elm = &td->elements[edx]; | ||||||
| 		const void *memb_ptr; | 		const void *memb_ptr; | ||||||
|  | 		asn_constr_check_f *constr; | ||||||
|  | 		int ret; | ||||||
|  |  | ||||||
| 		if(elm->flags & ATF_POINTER) { | 		if(elm->flags & ATF_POINTER) { | ||||||
| 			memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset); | 			memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset); | ||||||
| @@ -139,14 +145,12 @@ SEQUENCE_constraint(const asn_TYPE_descriptor_t *td, const void *sptr, | |||||||
| 			memb_ptr = (const void *)((const char *)sptr + elm->memb_offset); | 			memb_ptr = (const void *)((const char *)sptr + elm->memb_offset); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if(elm->encoding_constraints.general_constraints) { | 		constr = elm->encoding_constraints.general_constraints; | ||||||
| 			int ret = elm->encoding_constraints.general_constraints(elm->type, memb_ptr, | 		if(!constr) | ||||||
| 				ctfailcb, app_key); | 			constr = elm->type->encoding_constraints.general_constraints; | ||||||
|  |  | ||||||
|  | 		ret = constr(elm->type, memb_ptr, ctfailcb, app_key); | ||||||
| 		if(ret) return ret; | 		if(ret) return ret; | ||||||
| 		} else { |  | ||||||
| 			return elm->type->encoding_constraints.general_constraints(elm->type, |  | ||||||
| 				memb_ptr, ctfailcb, app_key); |  | ||||||
| 		} |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	return 0; | 	return 0; | ||||||
| @@ -195,3 +199,53 @@ SEQUENCE_compare(const asn_TYPE_descriptor_t *td, const void *aptr, | |||||||
|  |  | ||||||
|     return 0; |     return 0; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | int | ||||||
|  | SEQUENCE_copy(const asn_TYPE_descriptor_t *td, void **aptr, | ||||||
|  |                  const void *bptr) { | ||||||
|  |     if(!td) return -1; | ||||||
|  |  | ||||||
|  |     const asn_SEQUENCE_specifics_t *specs =  | ||||||
|  |         (const asn_SEQUENCE_specifics_t *)td->specifics; | ||||||
|  |     size_t edx; | ||||||
|  |     void *st = *aptr;        /* Target structure */ | ||||||
|  |  | ||||||
|  |     if(!bptr) { | ||||||
|  |         if(st) { | ||||||
|  |             SEQUENCE_free(td, st, 0); | ||||||
|  |             *aptr = 0; | ||||||
|  |         } | ||||||
|  |         return 0; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /* | ||||||
|  |      * Create the target structure if it is not present already. | ||||||
|  |      */ | ||||||
|  |     if(st == 0) { | ||||||
|  |         st = *aptr = CALLOC(1, specs->struct_size); | ||||||
|  |         if(st == 0) return -1; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  | 	for(edx = 0; edx < td->elements_count; edx++) { | ||||||
|  | 		asn_TYPE_member_t *elm = &td->elements[edx]; | ||||||
|  | 		void *amemb; | ||||||
|  | 		void **amembp; | ||||||
|  | 		const void *bmemb; | ||||||
|  |         int ret; | ||||||
|  |  | ||||||
|  |         if(elm->flags & ATF_POINTER) { | ||||||
|  |             /* Member is a pointer to another structure */ | ||||||
|  |             amembp = (void **)((char *)st + elm->memb_offset); | ||||||
|  |             bmemb = *(const void* const*)((const char*)bptr + elm->memb_offset); | ||||||
|  |         } else { | ||||||
|  |             amemb = (char *)st + elm->memb_offset; | ||||||
|  |             amembp = &amemb; | ||||||
|  |             bmemb = (const void*)((const char*)bptr + elm->memb_offset); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         ret = elm->type->op->copy_struct(elm->type, amembp, bmemb); | ||||||
|  |         if(ret != 0) return ret; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     return 0; | ||||||
|  | } | ||||||
|   | |||||||
| @@ -15,6 +15,7 @@ asn_TYPE_operation_t asn_OP_SEQUENCE_OF = { | |||||||
|     0, |     0, | ||||||
| #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | ||||||
|     SEQUENCE_OF_compare, |     SEQUENCE_OF_compare, | ||||||
|  |     SEQUENCE_OF_copy, | ||||||
| #if !defined(ASN_DISABLE_BER_SUPPORT) | #if !defined(ASN_DISABLE_BER_SUPPORT) | ||||||
|     SEQUENCE_OF_decode_ber, |     SEQUENCE_OF_decode_ber, | ||||||
|     SEQUENCE_OF_encode_der, |     SEQUENCE_OF_encode_der, | ||||||
| @@ -30,9 +31,11 @@ asn_TYPE_operation_t asn_OP_SEQUENCE_OF = { | |||||||
|     0, |     0, | ||||||
| #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | ||||||
| #if !defined(ASN_DISABLE_JER_SUPPORT) | #if !defined(ASN_DISABLE_JER_SUPPORT) | ||||||
|  |     SEQUENCE_OF_decode_jer, | ||||||
|     SEQUENCE_OF_encode_jer, |     SEQUENCE_OF_encode_jer, | ||||||
| #else | #else | ||||||
|     0, |     0, | ||||||
|  |     0, | ||||||
| #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | ||||||
| #if !defined(ASN_DISABLE_OER_SUPPORT) | #if !defined(ASN_DISABLE_OER_SUPPORT) | ||||||
|     SEQUENCE_OF_decode_oer,  /* Same as SET OF decoder. */ |     SEQUENCE_OF_decode_oer,  /* Same as SET OF decoder. */ | ||||||
|   | |||||||
| @@ -14,6 +14,7 @@ asn_TYPE_operation_t asn_OP_SET_OF = { | |||||||
|     0, |     0, | ||||||
| #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | ||||||
|     SET_OF_compare, |     SET_OF_compare, | ||||||
|  |     SET_OF_copy, | ||||||
| #if !defined(ASN_DISABLE_BER_SUPPORT) | #if !defined(ASN_DISABLE_BER_SUPPORT) | ||||||
|     SET_OF_decode_ber, |     SET_OF_decode_ber, | ||||||
|     SET_OF_encode_der, |     SET_OF_encode_der, | ||||||
| @@ -29,9 +30,11 @@ asn_TYPE_operation_t asn_OP_SET_OF = { | |||||||
|     0, |     0, | ||||||
| #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | ||||||
| #if !defined(ASN_DISABLE_JER_SUPPORT) | #if !defined(ASN_DISABLE_JER_SUPPORT) | ||||||
|  |     SET_OF_decode_jer, | ||||||
|     SET_OF_encode_jer, |     SET_OF_encode_jer, | ||||||
| #else | #else | ||||||
|     0, |     0, | ||||||
|  |     0, | ||||||
| #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | ||||||
| #if !defined(ASN_DISABLE_OER_SUPPORT) | #if !defined(ASN_DISABLE_OER_SUPPORT) | ||||||
|     SET_OF_decode_oer, |     SET_OF_decode_oer, | ||||||
| @@ -369,3 +372,58 @@ SET_OF_compare(const asn_TYPE_descriptor_t *td, const void *aptr, | |||||||
|  |  | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | int | ||||||
|  | SET_OF_copy(const asn_TYPE_descriptor_t *td, void **aptr, | ||||||
|  |             const void *bptr) { | ||||||
|  |     if(!td) return -1; | ||||||
|  |  | ||||||
|  |     const asn_SET_OF_specifics_t *specs =  | ||||||
|  |         (const asn_SET_OF_specifics_t *)td->specifics; | ||||||
|  |     void *st = *aptr; | ||||||
|  |  | ||||||
|  |     if(!bptr) { | ||||||
|  |         if(*aptr) { | ||||||
|  |             asn_set_empty(_A_SET_FROM_VOID(*aptr)); | ||||||
|  |             *aptr = 0; | ||||||
|  |         } | ||||||
|  |         return 0; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     if(st == 0) { | ||||||
|  |         st = *aptr = CALLOC(1, specs->struct_size); | ||||||
|  |         if(st == 0) return -1; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     asn_anonymous_set_ *a = _A_SET_FROM_VOID(*aptr); | ||||||
|  |     const asn_anonymous_set_ *b = _A_CSET_FROM_VOID(bptr); | ||||||
|  |  | ||||||
|  |     if(b->size) { | ||||||
|  | 		void *_new_arr; | ||||||
|  | 		_new_arr = REALLOC(a->array, b->size * sizeof(b->array[0])); | ||||||
|  | 		if(_new_arr) { | ||||||
|  | 			a->array = (void **)_new_arr; | ||||||
|  | 			a->size = b->size; | ||||||
|  | 		} else { | ||||||
|  |             return -1; | ||||||
|  |         } | ||||||
|  |         a->count = b->count; | ||||||
|  |  | ||||||
|  |         for(int i = 0; i < b->count; i++) { | ||||||
|  |             void *bmemb = b->array[i]; | ||||||
|  |             if(bmemb) { | ||||||
|  |                 void *amemb = 0; | ||||||
|  |                 int ret; | ||||||
|  |                 ret = td->elements->type->op->copy_struct( | ||||||
|  |                                                     td->elements->type, | ||||||
|  |                                                     &amemb, bmemb); | ||||||
|  |                 if(ret != 0) return ret; | ||||||
|  |                 a->array[i] = amemb; | ||||||
|  |             } else { | ||||||
|  |                 a->array[i] = 0; | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|  | 	return 0; | ||||||
|  | } | ||||||
|   | |||||||
| @@ -129,13 +129,12 @@ SET_OF_decode_aper(const asn_codec_ctx_t *opt_codec_ctx, | |||||||
|         if(value) ct = 0;  /* Not restricted! */ |         if(value) ct = 0;  /* Not restricted! */ | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     if(ct && ct->effective_bits >= 0) { |     if(ct && ct->upper_bound >= 1 && ct->upper_bound <= 65535 | ||||||
|  |        && ct->upper_bound == ct->lower_bound) { | ||||||
|         /* X.691, #19.5: No length determinant */ |         /* X.691, #19.5: No length determinant */ | ||||||
|         nelems = aper_get_nsnnwn(pd, ct->upper_bound - ct->lower_bound + 1); |         nelems = ct->upper_bound; | ||||||
|         ASN_DEBUG("Preparing to fetch %ld+%lld elements from %s", |         ASN_DEBUG("Preparing to fetch %ld elements from %s", | ||||||
|                   (long)nelems, (long long int)ct->lower_bound, td->name); |                   (long)nelems, td->name); | ||||||
|         if(nelems < 0)  ASN__DECODE_STARVED; |  | ||||||
|         nelems += ct->lower_bound; |  | ||||||
|     } else { |     } else { | ||||||
|         nelems = -1; |         nelems = -1; | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -9,7 +9,7 @@ | |||||||
| /* | /* | ||||||
|  * Version of the ASN.1 infrastructure shipped with compiler. |  * Version of the ASN.1 infrastructure shipped with compiler. | ||||||
|  */ |  */ | ||||||
| int get_asn1c_environment_version() { return ASN1C_ENVIRONMENT_VERSION; } | int get_asn1c_environment_version(void) { return ASN1C_ENVIRONMENT_VERSION; } | ||||||
|  |  | ||||||
| static asn_app_consume_bytes_f _print2fp; | static asn_app_consume_bytes_f _print2fp; | ||||||
|  |  | ||||||
| @@ -54,6 +54,26 @@ asn_fprint(FILE *stream, const asn_TYPE_descriptor_t *td, | |||||||
|     return fflush(stream); |     return fflush(stream); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * Copy a structuture. | ||||||
|  |  */ | ||||||
|  | int | ||||||
|  | asn_copy(const asn_TYPE_descriptor_t *td, | ||||||
|  |          void **struct_dst, const void *struct_src) { | ||||||
|  |  | ||||||
|  |     if(!td || !struct_dst || !struct_src) { | ||||||
|  |         errno = EINVAL; | ||||||
|  |         return -1; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     if(!td->op) { | ||||||
|  |         errno = ENOSYS; | ||||||
|  |         return -1; | ||||||
|  |     } | ||||||
|  |      | ||||||
|  |     return td->op->copy_struct(td, struct_dst, struct_src); | ||||||
|  | } | ||||||
|  |  | ||||||
| /* Dump the data into the specified stdio stream */ | /* Dump the data into the specified stdio stream */ | ||||||
| static int | static int | ||||||
| _print2fp(const void *buffer, size_t size, void *app_key) { | _print2fp(const void *buffer, size_t size, void *app_key) { | ||||||
|   | |||||||
| @@ -29,6 +29,7 @@ extern asn_OCTET_STRING_specifics_t asn_SPC_ANY_specs; | |||||||
| #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | ||||||
|  |  | ||||||
| #define ANY_compare OCTET_STRING_compare | #define ANY_compare OCTET_STRING_compare | ||||||
|  | #define ANY_copy    OCTET_STRING_copy | ||||||
|  |  | ||||||
| #define ANY_constraint asn_generic_no_constraint | #define ANY_constraint asn_generic_no_constraint | ||||||
|  |  | ||||||
| @@ -43,6 +44,7 @@ xer_type_encoder_f ANY_encode_xer; | |||||||
| #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | ||||||
|  |  | ||||||
| #if !defined(ASN_DISABLE_JER_SUPPORT) | #if !defined(ASN_DISABLE_JER_SUPPORT) | ||||||
|  | jer_type_decoder_f ANY_decode_jer; | ||||||
| jer_type_encoder_f ANY_encode_jer; | jer_type_encoder_f ANY_encode_jer; | ||||||
| #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | ||||||
|  |  | ||||||
|   | |||||||
| @@ -31,6 +31,7 @@ asn_struct_print_f BIT_STRING_print;  /* Human-readable output */ | |||||||
| #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | ||||||
|  |  | ||||||
| asn_struct_compare_f BIT_STRING_compare; | asn_struct_compare_f BIT_STRING_compare; | ||||||
|  | asn_struct_copy_f    BIT_STRING_copy; | ||||||
|  |  | ||||||
| asn_constr_check_f BIT_STRING_constraint; | asn_constr_check_f BIT_STRING_constraint; | ||||||
|  |  | ||||||
| @@ -45,6 +46,7 @@ xer_type_encoder_f BIT_STRING_encode_xer; | |||||||
| #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | ||||||
|  |  | ||||||
| #if !defined(ASN_DISABLE_JER_SUPPORT) | #if !defined(ASN_DISABLE_JER_SUPPORT) | ||||||
|  | #define BIT_STRING_decode_jer OCTET_STRING_decode_jer_binary | ||||||
| jer_type_encoder_f BIT_STRING_encode_jer; | jer_type_encoder_f BIT_STRING_encode_jer; | ||||||
| #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | ||||||
|  |  | ||||||
|   | |||||||
| @@ -28,6 +28,7 @@ asn_struct_print_f BMPString_print;	/* Human-readable output */ | |||||||
| #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | ||||||
|  |  | ||||||
| #define BMPString_compare OCTET_STRING_compare | #define BMPString_compare OCTET_STRING_compare | ||||||
|  | #define BMPString_copy    OCTET_STRING_copy    | ||||||
|  |  | ||||||
| asn_constr_check_f BMPString_constraint; | asn_constr_check_f BMPString_constraint; | ||||||
|  |  | ||||||
| @@ -42,6 +43,7 @@ xer_type_encoder_f BMPString_encode_xer; | |||||||
| #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | ||||||
|  |  | ||||||
| #if !defined(ASN_DISABLE_JER_SUPPORT) | #if !defined(ASN_DISABLE_JER_SUPPORT) | ||||||
|  | jer_type_decoder_f BMPString_decode_jer; | ||||||
| jer_type_encoder_f BMPString_encode_jer; | jer_type_encoder_f BMPString_encode_jer; | ||||||
| #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | ||||||
|  |  | ||||||
|   | |||||||
| @@ -28,6 +28,7 @@ asn_struct_print_f BOOLEAN_print; | |||||||
| #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | ||||||
|  |  | ||||||
| asn_struct_compare_f BOOLEAN_compare; | asn_struct_compare_f BOOLEAN_compare; | ||||||
|  | asn_struct_copy_f    BOOLEAN_copy; | ||||||
|  |  | ||||||
| #define BOOLEAN_constraint asn_generic_no_constraint | #define BOOLEAN_constraint asn_generic_no_constraint | ||||||
|  |  | ||||||
| @@ -42,6 +43,7 @@ xer_type_encoder_f BOOLEAN_encode_xer; | |||||||
| #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | ||||||
|  |  | ||||||
| #if !defined(ASN_DISABLE_JER_SUPPORT) | #if !defined(ASN_DISABLE_JER_SUPPORT) | ||||||
|  | jer_type_decoder_f BOOLEAN_decode_jer; | ||||||
| jer_type_encoder_f BOOLEAN_encode_jer; | jer_type_encoder_f BOOLEAN_encode_jer; | ||||||
| #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | ||||||
|  |  | ||||||
|   | |||||||
| @@ -23,6 +23,7 @@ extern asn_TYPE_operation_t asn_OP_ENUMERATED; | |||||||
| #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | ||||||
|  |  | ||||||
| #define ENUMERATED_compare INTEGER_compare | #define ENUMERATED_compare INTEGER_compare | ||||||
|  | #define ENUMERATED_copy    INTEGER_copy | ||||||
|  |  | ||||||
| #define ENUMERATED_constraint asn_generic_no_constraint | #define ENUMERATED_constraint asn_generic_no_constraint | ||||||
|  |  | ||||||
| @@ -37,6 +38,7 @@ extern asn_TYPE_operation_t asn_OP_ENUMERATED; | |||||||
| #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | ||||||
|  |  | ||||||
| #if !defined(ASN_DISABLE_JER_SUPPORT) | #if !defined(ASN_DISABLE_JER_SUPPORT) | ||||||
|  | jer_type_decoder_f ENUMERATED_decode_jer; | ||||||
| #define ENUMERATED_encode_jer INTEGER_encode_jer | #define ENUMERATED_encode_jer INTEGER_encode_jer | ||||||
| #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | ||||||
|  |  | ||||||
|   | |||||||
| @@ -23,6 +23,7 @@ extern asn_TYPE_operation_t asn_OP_GeneralString; | |||||||
| #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | ||||||
|  |  | ||||||
| #define GeneralString_compare OCTET_STRING_compare | #define GeneralString_compare OCTET_STRING_compare | ||||||
|  | #define GeneralString_copy    OCTET_STRING_copy | ||||||
|  |  | ||||||
| #define GeneralString_constraint asn_generic_unknown_constraint | #define GeneralString_constraint asn_generic_unknown_constraint | ||||||
|  |  | ||||||
| @@ -37,6 +38,7 @@ extern asn_TYPE_operation_t asn_OP_GeneralString; | |||||||
| #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | ||||||
|  |  | ||||||
| #if !defined(ASN_DISABLE_JER_SUPPORT) | #if !defined(ASN_DISABLE_JER_SUPPORT) | ||||||
|  | #define GeneralString_decode_jer OCTET_STRING_decode_jer_hex | ||||||
| #define GeneralString_encode_jer OCTET_STRING_encode_jer | #define GeneralString_encode_jer OCTET_STRING_encode_jer | ||||||
| #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | ||||||
|  |  | ||||||
|   | |||||||
| @@ -23,6 +23,7 @@ asn_struct_print_f GeneralizedTime_print; | |||||||
| #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | ||||||
|  |  | ||||||
| asn_struct_compare_f GeneralizedTime_compare; | asn_struct_compare_f GeneralizedTime_compare; | ||||||
|  | #define GeneralizedTime_copy OCTET_STRING_copy | ||||||
|  |  | ||||||
| asn_constr_check_f GeneralizedTime_constraint; | asn_constr_check_f GeneralizedTime_constraint; | ||||||
|  |  | ||||||
| @@ -37,6 +38,7 @@ xer_type_encoder_f GeneralizedTime_encode_xer; | |||||||
| #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | ||||||
|  |  | ||||||
| #if !defined(ASN_DISABLE_JER_SUPPORT) | #if !defined(ASN_DISABLE_JER_SUPPORT) | ||||||
|  | #define GeneralizedTime_decode_jer OCTET_STRING_decode_jer_utf8 | ||||||
| jer_type_encoder_f GeneralizedTime_encode_jer; | jer_type_encoder_f GeneralizedTime_encode_jer; | ||||||
| #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | ||||||
|  |  | ||||||
|   | |||||||
| @@ -23,6 +23,7 @@ extern asn_TYPE_operation_t asn_OP_GraphicString; | |||||||
| #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | ||||||
|  |  | ||||||
| #define GraphicString_compare OCTET_STRING_compare | #define GraphicString_compare OCTET_STRING_compare | ||||||
|  | #define GraphicString_copy    OCTET_STRING_copy | ||||||
|  |  | ||||||
| #define GraphicString_constraint asn_generic_unknown_constraint | #define GraphicString_constraint asn_generic_unknown_constraint | ||||||
|  |  | ||||||
| @@ -37,6 +38,7 @@ extern asn_TYPE_operation_t asn_OP_GraphicString; | |||||||
| #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | ||||||
|  |  | ||||||
| #if !defined(ASN_DISABLE_JER_SUPPORT) | #if !defined(ASN_DISABLE_JER_SUPPORT) | ||||||
|  | #define GraphicString_decode_jer OCTET_STRING_decode_jer | ||||||
| #define GraphicString_encode_jer OCTET_STRING_encode_jer | #define GraphicString_encode_jer OCTET_STRING_encode_jer | ||||||
| #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | ||||||
|  |  | ||||||
|   | |||||||
| @@ -26,6 +26,7 @@ extern asn_TYPE_operation_t asn_OP_IA5String; | |||||||
| #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | ||||||
|  |  | ||||||
| #define IA5String_compare OCTET_STRING_compare | #define IA5String_compare OCTET_STRING_compare | ||||||
|  | #define IA5String_copy    OCTET_STRING_copy | ||||||
|  |  | ||||||
| asn_constr_check_f IA5String_constraint; | asn_constr_check_f IA5String_constraint; | ||||||
|  |  | ||||||
| @@ -40,6 +41,7 @@ asn_constr_check_f IA5String_constraint; | |||||||
| #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | ||||||
|  |  | ||||||
| #if !defined(ASN_DISABLE_JER_SUPPORT) | #if !defined(ASN_DISABLE_JER_SUPPORT) | ||||||
|  | #define IA5String_decode_jer OCTET_STRING_decode_jer_utf8 | ||||||
| #define IA5String_encode_jer OCTET_STRING_encode_jer_utf8 | #define IA5String_encode_jer OCTET_STRING_encode_jer_utf8 | ||||||
| #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | ||||||
|  |  | ||||||
|   | |||||||
| @@ -47,6 +47,7 @@ asn_struct_print_f INTEGER_print; | |||||||
| #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | ||||||
|  |  | ||||||
| asn_struct_compare_f INTEGER_compare; | asn_struct_compare_f INTEGER_compare; | ||||||
|  | asn_struct_copy_f INTEGER_copy; | ||||||
|  |  | ||||||
| #define INTEGER_constraint asn_generic_no_constraint | #define INTEGER_constraint asn_generic_no_constraint | ||||||
|  |  | ||||||
| @@ -61,6 +62,7 @@ xer_type_encoder_f INTEGER_encode_xer; | |||||||
| #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | ||||||
|  |  | ||||||
| #if !defined(ASN_DISABLE_JER_SUPPORT) | #if !defined(ASN_DISABLE_JER_SUPPORT) | ||||||
|  | jer_type_decoder_f INTEGER_decode_jer; | ||||||
| jer_type_encoder_f INTEGER_encode_jer; | jer_type_encoder_f INTEGER_encode_jer; | ||||||
| #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | ||||||
|  |  | ||||||
| @@ -106,6 +108,8 @@ int asn_INTEGER2long(const INTEGER_t *i, long *l); | |||||||
| int asn_INTEGER2ulong(const INTEGER_t *i, unsigned long *l); | int asn_INTEGER2ulong(const INTEGER_t *i, unsigned long *l); | ||||||
| int asn_long2INTEGER(INTEGER_t *i, long l); | int asn_long2INTEGER(INTEGER_t *i, long l); | ||||||
| int asn_ulong2INTEGER(INTEGER_t *i, unsigned long l); | int asn_ulong2INTEGER(INTEGER_t *i, unsigned long l); | ||||||
|  | int asn_INTEGER2int64(const INTEGER_t *i, int64_t *l); | ||||||
|  | int asn_INTEGER2uint64(const INTEGER_t *i, uint64_t *l); | ||||||
| int asn_int642INTEGER(INTEGER_t *i, int64_t l); | int asn_int642INTEGER(INTEGER_t *i, int64_t l); | ||||||
| int asn_uint642INTEGER(INTEGER_t *i, uint64_t l); | int asn_uint642INTEGER(INTEGER_t *i, uint64_t l); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -24,6 +24,7 @@ extern asn_TYPE_operation_t asn_OP_ISO646String; | |||||||
| #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | ||||||
|  |  | ||||||
| #define ISO646String_compare OCTET_STRING_compare | #define ISO646String_compare OCTET_STRING_compare | ||||||
|  | #define ISO646String_copy    OCTET_STRING_copy    | ||||||
|  |  | ||||||
| #define ISO646String_constraint VisibleString_constraint | #define ISO646String_constraint VisibleString_constraint | ||||||
|  |  | ||||||
| @@ -38,6 +39,7 @@ extern asn_TYPE_operation_t asn_OP_ISO646String; | |||||||
| #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | ||||||
|  |  | ||||||
| #if !defined(ASN_DISABLE_JER_SUPPORT) | #if !defined(ASN_DISABLE_JER_SUPPORT) | ||||||
|  | #define ISO646String_decode_jer OCTET_STRING_decode_jer_utf8 | ||||||
| #define ISO646String_encode_jer OCTET_STRING_encode_jer_utf8 | #define ISO646String_encode_jer OCTET_STRING_encode_jer_utf8 | ||||||
| #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | ||||||
|  |  | ||||||
|   | |||||||
| @@ -27,6 +27,7 @@ asn_struct_print_f NULL_print; | |||||||
| #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | ||||||
|  |  | ||||||
| asn_struct_compare_f NULL_compare; | asn_struct_compare_f NULL_compare; | ||||||
|  | asn_struct_copy_f    NULL_copy; | ||||||
|  |  | ||||||
| #define NULL_constraint asn_generic_no_constraint | #define NULL_constraint asn_generic_no_constraint | ||||||
|  |  | ||||||
| @@ -41,6 +42,7 @@ xer_type_encoder_f NULL_encode_xer; | |||||||
| #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | ||||||
|  |  | ||||||
| #if !defined(ASN_DISABLE_JER_SUPPORT) | #if !defined(ASN_DISABLE_JER_SUPPORT) | ||||||
|  | jer_type_decoder_f NULL_decode_jer; | ||||||
| jer_type_encoder_f NULL_encode_jer; | jer_type_encoder_f NULL_encode_jer; | ||||||
| #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | ||||||
|  |  | ||||||
|   | |||||||
| @@ -13,6 +13,7 @@ | |||||||
| #define	_NativeEnumerated_H_ | #define	_NativeEnumerated_H_ | ||||||
|  |  | ||||||
| #include <NativeInteger.h> | #include <NativeInteger.h> | ||||||
|  | #include <ENUMERATED.h> | ||||||
|  |  | ||||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||||
| extern "C" { | extern "C" { | ||||||
| @@ -28,6 +29,7 @@ extern asn_TYPE_operation_t asn_OP_NativeEnumerated; | |||||||
| #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | ||||||
|  |  | ||||||
| #define NativeEnumerated_compare NativeInteger_compare | #define NativeEnumerated_compare NativeInteger_compare | ||||||
|  | #define NativeEnumerated_copy    NativeInteger_copy | ||||||
|  |  | ||||||
| #define NativeEnumerated_constraint asn_generic_no_constraint | #define NativeEnumerated_constraint asn_generic_no_constraint | ||||||
|  |  | ||||||
| @@ -42,6 +44,7 @@ xer_type_encoder_f NativeEnumerated_encode_xer; | |||||||
| #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | ||||||
|  |  | ||||||
| #if !defined(ASN_DISABLE_JER_SUPPORT) | #if !defined(ASN_DISABLE_JER_SUPPORT) | ||||||
|  | jer_type_decoder_f NativeEnumerated_decode_jer; | ||||||
| jer_type_encoder_f NativeEnumerated_encode_jer; | jer_type_encoder_f NativeEnumerated_encode_jer; | ||||||
| #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | ||||||
|  |  | ||||||
|   | |||||||
| @@ -29,6 +29,7 @@ asn_struct_print_f NativeInteger_print; | |||||||
| #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | ||||||
|  |  | ||||||
| asn_struct_compare_f NativeInteger_compare; | asn_struct_compare_f NativeInteger_compare; | ||||||
|  | asn_struct_copy_f    NativeInteger_copy; | ||||||
|  |  | ||||||
| #define NativeInteger_constraint asn_generic_no_constraint | #define NativeInteger_constraint asn_generic_no_constraint | ||||||
|  |  | ||||||
| @@ -43,6 +44,7 @@ xer_type_encoder_f NativeInteger_encode_xer; | |||||||
| #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | ||||||
|  |  | ||||||
| #if !defined(ASN_DISABLE_JER_SUPPORT) | #if !defined(ASN_DISABLE_JER_SUPPORT) | ||||||
|  | jer_type_decoder_f NativeInteger_decode_jer; | ||||||
| jer_type_encoder_f NativeInteger_encode_jer; | jer_type_encoder_f NativeInteger_encode_jer; | ||||||
| #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | ||||||
|  |  | ||||||
|   | |||||||
| @@ -37,6 +37,7 @@ asn_struct_print_f NativeReal_print; | |||||||
| #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | ||||||
|  |  | ||||||
| asn_struct_compare_f NativeReal_compare; | asn_struct_compare_f NativeReal_compare; | ||||||
|  | asn_struct_copy_f    NativeReal_copy; | ||||||
|  |  | ||||||
| #define NativeReal_constraint asn_generic_no_constraint | #define NativeReal_constraint asn_generic_no_constraint | ||||||
|  |  | ||||||
| @@ -51,6 +52,7 @@ xer_type_encoder_f NativeReal_encode_xer; | |||||||
| #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | ||||||
|  |  | ||||||
| #if !defined(ASN_DISABLE_JER_SUPPORT) | #if !defined(ASN_DISABLE_JER_SUPPORT) | ||||||
|  | jer_type_decoder_f NativeReal_decode_jer; | ||||||
| jer_type_encoder_f NativeReal_encode_jer; | jer_type_encoder_f NativeReal_encode_jer; | ||||||
| #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | ||||||
|  |  | ||||||
|   | |||||||
| @@ -23,6 +23,7 @@ extern asn_TYPE_operation_t asn_OP_NumericString; | |||||||
| #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | ||||||
|  |  | ||||||
| #define NumericString_compare OCTET_STRING_compare | #define NumericString_compare OCTET_STRING_compare | ||||||
|  | #define NumericString_copy    OCTET_STRING_copy | ||||||
|  |  | ||||||
| asn_constr_check_f NumericString_constraint; | asn_constr_check_f NumericString_constraint; | ||||||
|  |  | ||||||
| @@ -37,6 +38,7 @@ asn_constr_check_f NumericString_constraint; | |||||||
| #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | ||||||
|  |  | ||||||
| #if !defined(ASN_DISABLE_JER_SUPPORT) | #if !defined(ASN_DISABLE_JER_SUPPORT) | ||||||
|  | #define NumericString_decode_jer OCTET_STRING_decode_jer_utf8 | ||||||
| #define NumericString_encode_jer OCTET_STRING_encode_jer_utf8 | #define NumericString_encode_jer OCTET_STRING_encode_jer_utf8 | ||||||
| #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | ||||||
|  |  | ||||||
|   | |||||||
| @@ -32,6 +32,7 @@ asn_struct_print_f OBJECT_IDENTIFIER_print; | |||||||
| #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | ||||||
|  |  | ||||||
| #define OBJECT_IDENTIFIER_compare OCTET_STRING_compare | #define OBJECT_IDENTIFIER_compare OCTET_STRING_compare | ||||||
|  | #define OBJECT_IDENTIFIER_copy    OCTET_STRING_copy | ||||||
|  |  | ||||||
| asn_constr_check_f OBJECT_IDENTIFIER_constraint; | asn_constr_check_f OBJECT_IDENTIFIER_constraint; | ||||||
|  |  | ||||||
| @@ -46,6 +47,7 @@ xer_type_encoder_f OBJECT_IDENTIFIER_encode_xer; | |||||||
| #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | ||||||
|  |  | ||||||
| #if !defined(ASN_DISABLE_JER_SUPPORT) | #if !defined(ASN_DISABLE_JER_SUPPORT) | ||||||
|  | jer_type_decoder_f OBJECT_IDENTIFIER_decode_jer; | ||||||
| jer_type_encoder_f OBJECT_IDENTIFIER_encode_jer; | jer_type_encoder_f OBJECT_IDENTIFIER_encode_jer; | ||||||
| #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | ||||||
|  |  | ||||||
|   | |||||||
| @@ -29,6 +29,7 @@ asn_struct_print_f OCTET_STRING_print_utf8; | |||||||
| #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ | ||||||
|  |  | ||||||
| asn_struct_compare_f OCTET_STRING_compare; | asn_struct_compare_f OCTET_STRING_compare; | ||||||
|  | asn_struct_copy_f    OCTET_STRING_copy; | ||||||
|  |  | ||||||
| #define OCTET_STRING_constraint asn_generic_no_constraint | #define OCTET_STRING_constraint asn_generic_no_constraint | ||||||
|  |  | ||||||
| @@ -46,6 +47,8 @@ xer_type_encoder_f OCTET_STRING_encode_xer_utf8; | |||||||
| #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */ | ||||||
|  |  | ||||||
| #if !defined(ASN_DISABLE_JER_SUPPORT) | #if !defined(ASN_DISABLE_JER_SUPPORT) | ||||||
|  | jer_type_decoder_f OCTET_STRING_decode_jer_hex;     /* Hexadecimal */ | ||||||
|  | jer_type_decoder_f OCTET_STRING_decode_jer_utf8;    /* ASCII/UTF-8 */ | ||||||
| jer_type_encoder_f OCTET_STRING_encode_jer; | jer_type_encoder_f OCTET_STRING_encode_jer; | ||||||
| jer_type_encoder_f OCTET_STRING_encode_jer_utf8; | jer_type_encoder_f OCTET_STRING_encode_jer_utf8; | ||||||
| #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | #endif  /* !defined(ASN_DISABLE_JER_SUPPORT) */ | ||||||
|   | |||||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user