Giter Site home page Giter Site logo

pyasn1gen.py parsing fails about asn1ate HOT 7 OPEN

kimgr avatar kimgr commented on July 18, 2024
pyasn1gen.py parsing fails

from asn1ate.

Comments (7)

kimgr avatar kimgr commented on July 18, 2024 1

Thanks Ilya! Looks like there's a pretty simple mechanical translation from the fancy syntax.

from asn1ate.

kimgr avatar kimgr commented on July 18, 2024

Error reporting in asn1ate is terrible, but the line number usually gives a hint. Near line 218 I found this:

EndApplicationMessage ::= SEQUENCE {
    endApplication-Message-id           ISO14827-MESSAGE.&id,
    endApplication-Message-msg          ISO14827-MESSAGE.&MessageBody
}

The & syntax is not supported by the parser (yet), so if you can phrase that with simpler mechanisms, it might work.

Development of asn1ate is driven mostly by my own needs, so I might not get to this within any reasonable timeframe.

from asn1ate.

hillfolk avatar hillfolk commented on July 18, 2024

thank for answer.
I have question.
it is ASN.1 Information Objects (X.681)
you have support plan?

GENERAL-PROCEDURE ::= CLASS {
&Message,
&Reply               OPTIONAL,
&Error               OPTIONAL,
&id          PrintableString UNIQUE }

I think this is a memory pointer.
In Python, can I use it?
Give me a little hint.
I do not have good idea
Sorry
My English is not good enough.

I always thank you.

from asn1ate.

kimgr avatar kimgr commented on July 18, 2024

I'd would like to support parsing all of ASN.1, and code-generation for elements that have a reasonable representation in pyasn1. But I realistically don't have time to work on more uncommon features unless I happen to need them for my own projects.

Patches are of course always welcome!

from asn1ate.

Maja46 avatar Maja46 commented on July 18, 2024

Hello,
I wonder if I stumble on the same problem with "&", e.g. for DMI-EXTENSION .&id and
DMI-EXTENSION .&Value in
identifier DMI-EXTENSION .&id ( {
,
...} ) ,

I got the task to build a decoder for PS CDR files according to the 3GPP specs Rel 10 and beyond. Therefore I downloaded from "http://www.3gpp.org/ftp/specs/archive/32_series/32.298/ASN.1/" one of their ASN compilations and tried to compile the files GenericChargingDataTypes.EXP or GPRSChargingDataTypes.EXP using asn1ate.py.
32298-e20 ASN1.zip

It always stops with error, e.g.
python pyasn1gen.py "c:\Users\maja\32298-e20 ASN1\GPRSChargingDataTypes.EXP"
Traceback (most recent call last):
File "pyasn1gen.py", line 588, in
sys.exit(main(sys.argv[1:]))
File "pyasn1gen.py", line 574, in main
parse_tree = parser.parse_asn1(asn1def)
File "C:\Program Files\Python2.7.13\lib\site-packages\asn1ate\parser.py", line
40, in parse_asn1
parse_result = grammar.parseString(asn1_definition)
File "C:\Program Files\Python2.7.13\lib\site-packages\pyparsing.py", line 1632
, in parseString
raise exc
pyparsing.ParseException: Expected "END" (at char 383), (line:13, col:23)

python pyasn1gen.py "c:\Users\maja\Test Automation\32298-e20 ASN1\GenericChargingDataTypes.EXP"
Traceback (most recent call last):
File "pyasn1gen.py", line 588, in
sys.exit(main(sys.argv[1:]))
File "pyasn1gen.py", line 574, in main
parse_tree = parser.parse_asn1(asn1def)
File "C:\Program Files\Python2.7.13\lib\site-packages\asn1ate\parser.py", line
40, in parse_asn1
parse_result = grammar.parseString(asn1_definition)
File "C:\Program Files\Python2.7.13\lib\site-packages\pyparsing.py", line 1632
, in parseString
raise exc
pyparsing.ParseException: Expected "END" (at char 2170), (line:65, col:24)

I found in the testdata/public/ a Huawei CS CDR and thought/hoped that you found a way to compile the 3GPP ASN files for pyasn1.

Kind regards,
Maja

from asn1ate.

kimgr avatar kimgr commented on July 18, 2024

Hello Maja,

Unfortunately I still don't have support for the & syntax (and I don't yet understand what it's used for, and how it might translate into pyasn1.) I'm spending a couple of days working on asn1ate now, so I might get to this before the week is over.

The more you can tell me about the semantics of & and the expected output, the easier this will be for me.

The ASN.1 files under testdata/public are just examples I've found published on the web, and things that would be great if asn1ate could handle, e.g. LDAP, Kerberos, etc. I haven't had a chance to implement everything required for them yet.

from asn1ate.

etingof avatar etingof commented on July 18, 2024

Hi Kim,

Take a look at the RFC-6025 -- it's about how to convert X.680 syntax into X.208 one.

Just my 2c. ;)

from asn1ate.

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.