Git Product home page Git Product logo

Comments (12)

raoufkh avatar raoufkh commented on August 14, 2024 1

Ah okay I see better now what you want to see

  • the offending variable was asn_PER_memb_OCTET_STRING_CONTAINING_PDUSessionResourceReleaseResponseTransfer__constr_44 in a file ProtocolExtensionField.c
  • I edited that file, changing it to memb_OCTET_STRING_CONTAINING_PDUSessionResourceReleaseResponseTransfer__constraint_648 ==> this was proposed by the cc compiler or even when you compile with `make -f conterter-example.mk
  • For this replacement, I've run sed -i 's/asn_PER_memb_OCTET_STRING_CONTAINING_PDUSessionResourceReleaseResponseTransfer__constr_44/memb_OCTET_STRING_CONTAINING_PDUSessionResourceReleaseResponseTransfer__constraint_648/g' ProtocolExtensionField.c
  • now it all compiles without errors

from asn1c.

gatopeich avatar gatopeich commented on August 14, 2024 1

I edited that file, changing it to memb_OCTET_STRING_CONTAINING_PDUSessionResourceReleaseResponseTransfer__constraint_648 ==> this was proposed by the cc compiler or even when you compile with `make -f conterter-example.mk

That it was proposed by compiler does NOT mean it is correct for encoding decoding, just that the name is similar enough!

This is likely an issue of including the required headers in the right order, which sometimes can be hard...

from asn1c.

raoufkh avatar raoufkh commented on August 14, 2024

Update: The issue of not finding skeleton headers has been solved by specifying the path where to search for headers using -I parameter:

cc -DPDU=NGAP-PDU -I. -o NgapDecoder.o *.c 

Now, I've another issue, the cc compiler tell me that several types begining with ProtocolIE_SingleContainer_ are not defined. I will take an example of the ProtocolIE_SingleContainer_128P31_t type.

In file included from ProtocolExtensionField.h:19:0,
                 from ProtocolExtensionContainer.h:3234,
                 from EndpointIPAddressAndPort.h:44,
                 from ProtocolIE-Field.h:22,
                 from ProtocolIE-SingleContainer.h:15,
                 from CPTransportLayerInformation.h:16,
                 from AMF-TNLAssociationSetupItem.h:15,
                 from AMF-TNLAssociationSetupItem.c:8:
UPTransportLayerInformation.h:35:3: error: unknown type name ‘ProtocolIE_SingleContainer_9553P47_t’
   ProtocolIE_SingleContainer_9553P47_t  choice_Extensions;

When I search for the definition of the ProtocolIE_SingleContainer_128P31_t I find this:

./ProtocolIE-SingleContainer.h:typedef NPN_Support_ExtIEs_t	 ProtocolIE_SingleContainer_128P31_t;

and ProtocolIE-SingleContainer.h is included in UPTransportLayerInformation.h

in ./ProtocolIE-Field.h I expect that the type NPN_Support_ExtIEs_t is well defined:

typedef struct NPN_Support_ExtIEs {
	ProtocolIE_ID_t	 id;
	Criticality_t	 criticality;
	struct NPN_Support_ExtIEs__value {
		NPN_Support_ExtIEs__value_PR present;
		union NPN_Support_ExtIEs__value_u {
		} choice;
		
		/* Context for parsing across buffer boundaries */
		asn_struct_ctx_t _asn_ctx;
	} value;
	
	/* Context for parsing across buffer boundaries */
	asn_struct_ctx_t _asn_ctx;
} NPN_Support_ExtIEs_t;

The header ProtocolIE-Field.h is included in the file ./ProtocolIE-SingleContainer.h like this:
#include "ProtocolIE-Field.h"

Do I have to specify the order to the compiler?

from asn1c.

raoufkh avatar raoufkh commented on August 14, 2024

By trying to compile with make instead of cc, I think I figured out where the problem is coming from. Some data types are not defined. I've checked for these types in all headers and I didn't find any definition for them.

ProtocolIE-SingleContainer.h:62:9: error: unknown type name ‘UserLocationInformation_ExtIEs_t’
 typedef UserLocationInformation_ExtIEs_t  ProtocolIE_SingleContainer_9331P40_t;
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ProtocolIE-SingleContainer.h:63:9: error: unknown type name ‘UserLocationInformationW_AGF_ExtIEs_t’
 typedef UserLocationInformationW_AGF_ExtIEs_t  ProtocolIE_SingleContainer_9331P41_t;
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ProtocolIE-SingleContainer.h:64:9: error: unknown type name ‘W_AGF_ID_ExtIEs_t’
 typedef W_AGF_ID_ExtIEs_t  ProtocolIE_SingleContainer_9331P42_t;
         ^~~~~~~~~~~~~~~~~
ProtocolIE-SingleContainer.h:65:9: error: unknown type name ‘WarningAreaList_ExtIEs_t’
 typedef WarningAreaList_ExtIEs_t  ProtocolIE_SingleContainer_9331P43_t;
         ^~~~~~~~~~~~~~~~~~~~~~~~

I mention that when compiling the ASN1 file, I have lots of warnings:

.
.
.
WARNING: Parameterized type NGAP-PROTOCOL-EXTENSION expected for NGAP-PROTOCOL-EXTENSION at line 9382 in ngap.asn
WARNING: Parameterized type NGAP-PROTOCOL-EXTENSION expected for NGAP-PROTOCOL-EXTENSION at line 9382 in ngap.asn
WARNING: Parameterized type NGAP-PROTOCOL-EXTENSION expected for NGAP-PROTOCOL-EXTENSION at line 9383 in ngap.asn
WARNING: Parameterized type NGAP-PROTOCOL-EXTENSION expected for NGAP-PROTOCOL-EXTENSION at line 9383 in ngap.asn
WARNING: Parameterized type NGAP-PROTOCOL-EXTENSION expected for NGAP-PROTOCOL-EXTENSION at line 9383 in ngap.asn
WARNING: Parameterized type NGAP-PROTOCOL-EXTENSION expected for NGAP-PROTOCOL-EXTENSION at line 9384 in ngap.asn
WARNING: Parameterized type NGAP-PROTOCOL-EXTENSION expected for NGAP-PROTOCOL-EXTENSION at line 9384 in ngap.asn
WARNING: Parameterized type NGAP-PROTOCOL-EXTENSION expected for NGAP-PROTOCOL-EXTENSION at line 9384 in ngap.asn
WARNING: Parameterized type NGAP-PRIVATE-IES expected for NGAP-PRIVATE-IES at line 9398 in ngap.asn
WARNING: Parameterized type NGAP-PRIVATE-IES expected for NGAP-PRIVATE-IES at line 9399 in ngap.asn
WARNING: Parameterized type NGAP-PRIVATE-IES expected for NGAP-PRIVATE-IES at line 9400 in ngap.asn
WARNING: Parameterized type NGAP-PRIVATE-IES expected for NGAP-PRIVATE-IES at line 9398 in ngap.asn
WARNING: Parameterized type NGAP-PRIVATE-IES expected for NGAP-PRIVATE-IES at line 9398 in ngap.asn
WARNING: Parameterized type NGAP-PRIVATE-IES expected for NGAP-PRIVATE-IES at line 9398 in ngap.asn
WARNING: Parameterized type NGAP-PRIVATE-IES expected for NGAP-PRIVATE-IES at line 9399 in ngap.asn
WARNING: Parameterized type NGAP-PRIVATE-IES expected for NGAP-PRIVATE-IES at line 9399 in ngap.asn
WARNING: Parameterized type NGAP-PRIVATE-IES expected for NGAP-PRIVATE-IES at line 9399 in ngap.asn
WARNING: Parameterized type NGAP-PRIVATE-IES expected for NGAP-PRIVATE-IES at line 9400 in ngap.asn
WARNING: Parameterized type NGAP-PRIVATE-IES expected for NGAP-PRIVATE-IES at line 9400 in ngap.asn
WARNING: Parameterized type NGAP-PRIVATE-IES expected for NGAP-PRIVATE-IES at line 9400 in ngap.asn

I am using the ASN1 spec of NGAP (3GPP 38413 v16.5.0) according to the standard compliant with ITU-T Rec X.691, IUT-T Rec X.680 and ITU-T Rec X.681

from asn1c.

mouse07410 avatar mouse07410 commented on August 14, 2024

I don't think I can help with this problem, as 3GPP NGAP tends to push ASN.1 to limits that this compiler currently doesn't seem to support.

Please see #48 , and maybe folks at the upstream would be able to help.

Also, @brchiu and @velichkov do you have any recommendation or workaround here?

from asn1c.

raoufkh avatar raoufkh commented on August 14, 2024

Hello @mouse07410 mouse07410

I'm now able to compile the ASN1 files with both https://github.com/mouse07410/asn1c/ and https://github.com/velichkov/asn1c forks.

When trying to compile the converter example, there is some errors to solve manually (false declarations of variables in funtions).

I'll put here the command I used to compile, when I'll have access to my another PC.

Thank you,
Abderaouf

from asn1c.

raoufkh avatar raoufkh commented on August 14, 2024

I would like to say thanks fo your effort.

from asn1c.

mouse07410 avatar mouse07410 commented on August 14, 2024

@raoufkh you're very welcome.

It would be great if you could post your workaround here, as I'm sure it would be helpful for many others facing the same problem. Thanks!

from asn1c.

raoufkh avatar raoufkh commented on August 14, 2024

I've compiled asn1c as shown in the documentation. Then I use this command to compile ASN files.

asn1c \
    -pdu=NGAP-PDU \
    -fcompound-names \
    -fno-include-deps \
    -findirect-choice \
    -gen-APER \
    -no-gen-BER \
    -no-gen-XER \
    -no-gen-OER \
    -no-gen-UPER \
    ngap-v16.5.0.asn

Then I compile the converter example:

asn1c \
    -pdu=NGAP-PDU \
    -fcompound-names \
    -fno-include-deps \
    -findirect-choice \
    -gen-APER \
    -no-gen-BER \
    -no-gen-XER \
    -no-gen-OER \
    -no-gen-UPER \
    ngap-v16.5.0.asn

Then I corrected manually errors by replacing the not defined variables. In ly case,
it was asn_PER_memb_OCTET_STRING_CONTAINING_PDUSessionResourceReleaseResponseTransfer__constr_44.

You can then recompile and you'll have the example executable.

from asn1c.

mouse07410 avatar mouse07410 commented on August 14, 2024

Thanks. But I think your post needs correction.

First - instead of showing the compile command for the converter example, you showed again the ASN.1 compiling.

Second - I think it would be useful for everybody to see exactly what you replaced the missing names with.

I also don't think you need to explicitly set the -gen-APER flag - it's supposed to be on by default.

from asn1c.

raoufkh avatar raoufkh commented on August 14, 2024

Because without these parameters (except -gen-APER which is enabled by default), I wasn't able to to confine errors in only one. So I recommend to use -fno-include-deps -findirect-choice to minimize variables which will be present in the compiled files.

Then, the paramater to correct change from one compilation to another but it begins always by asn_PER_memb_OCTET_STRING_CONTAINING_PDUSessionResourceReleaseResponseTransfer__constr. In case someone has generated files for another encoding rules he'll have to correct the same parameter but with the new encoding rules instead of _PER_

I'll explain more the message error: this variablewas used in a function were it wasn't defined locally. The parameter in the function was memb_OCTET_STRING_CONTAINING_PDUSessionResourceReleaseResponseTransfer__constraint_648 and so the user will have to do replacements in that function.

The compiler cc will suggest which parameter to replace the undefined variable.

Is that more clear?

from asn1c.

mouse07410 avatar mouse07410 commented on August 14, 2024

Because without these parameters (except -gen-APER which is enabled by default), I wasn't able to to confine errors in only one

I meant that the -gen-APER could be omitted, and just having -no-gen-<whatever> would be sufficient. But I agree that your way is clearer for the reader.

So I recommend to use -fno-include-deps -findirect-choice

I don't think I'd agree with -fno-include-deps, but whatever works...

. . . he'll have to correct the same parameter . . .

What I wanted to see here was what to change it to. I.e., you're changing
asn_PER_memb_OCTET_STRING_CONTAINING_PDUSessionResourceReleaseResponseTransfer__constr to what? And where?

The compiler cc will suggest which parameter to replace the undefined variable.

That's great to know. I'd still prefer to see it explicitly posted here. Something like

  • the offending variable was asn_PER_whatever_a in a file something.c
  • I edited that file, changing it to asn_PER_whatever_b
  • now it all compiles without errors

Is that more clear?

Yes, thanks - but some more clarification would help, I think.

from asn1c.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.