Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

decode functions PER #1

Closed
ezor1 opened this issue Sep 29, 2017 · 15 comments
Closed

decode functions PER #1

ezor1 opened this issue Sep 29, 2017 · 15 comments

Comments

@ezor1
Copy link
Contributor

ezor1 commented Sep 29, 2017

Dear eerimoq,

I'd like to use your tool for PER encoding/decoding. Do you know when the corresponding functions will be implemented?
Are you still working on it?

Thanks in advance

@eerimoq
Copy link
Owner

eerimoq commented Sep 29, 2017

Hello!

asn1tools is a side project of mine that doesn't have any planning or schedule. Features are added whenever I find the project interesting, and a user request for additional functionality is certainly a good motivator. I wont promise anything, but I might have a look at it soon.

Is there any particular feature (as in ASN1 type) that you need?

@ezor1
Copy link
Contributor Author

ezor1 commented Sep 29, 2017

Thanks for your answer.
I've tryed to do it by myself but I can't work out how functions works (I'm quite new in Python)
However I could probably find out a solution if you implement one of them (let say the class Enumerate in per.py file for instance). Of course it's up to you.
Anyway, I don't want to be rude by putting pressure on you.

Thanks again,

Regards,

@eerimoq
Copy link
Owner

eerimoq commented Sep 29, 2017

@eerimoq
Copy link
Owner

eerimoq commented Sep 30, 2017

I implemented decode of the enumerated type in per.py. Not very well tested, but might work =)

@ezor1
Copy link
Contributor Author

ezor1 commented Oct 2, 2017

Many thanks errimoq. I'll try to use it and let you know if I find anything wrong (even if I'm sure it would work perfectly !)

@ezor1
Copy link
Contributor Author

ezor1 commented Oct 3, 2017

Hi,
Could you tell me wether the PER codec is the aligned or unaligned version? Cause I'm using asn1c and what your tools return does not match what I'm supposed to get (even if this is not completely different).

Thanks in advance

@eerimoq
Copy link
Owner

eerimoq commented Oct 3, 2017

It's aligned PER. Unaligned PER may be implemented eventually, but first I'll finalize aligned PER.

@eerimoq
Copy link
Owner

eerimoq commented Oct 3, 2017

Okay, I couldn't resist, I started on the UPER codec as well.

See https://github.com/eerimoq/asn1tools/blob/master/tests/test_uper.py for tests.

@eerimoq
Copy link
Owner

eerimoq commented Oct 7, 2017

The UPER decoder now successfully decodes a couple ASN.1 types; SEQUENCE, CHOICE, BIT STRING, OCTET STRING, ENUMERATION, BOOLEAN and INTEGER. The implementation is by no means complete, but should generally work.

Would be nice if you can create a pull request with one or more test cases of your ASN.1 specification. It's expected that some of the test cases will fail, and that's fine.

Adding test cases will ensure that your types and be encoded and decoded. Add test cases in https://github.com/eerimoq/asn1tools/blob/master/tests/test_uper.py.

@ezor1
Copy link
Contributor Author

ezor1 commented Oct 9, 2017

I'll see what I can do

@ezor1
Copy link
Contributor Author

ezor1 commented Oct 11, 2017

Dear Eerimoq,

I've push a very simple script to test multiple modules case (I'll try to make something more comprehensive soon). It seems that it works here
Maybe it will be better/easier to allow compile_file() to use as first argument a list of files, each one containing a module and store all of them temporarily to deals with dependencies (IMPORTS/EXPORT types).

EDIT : my bad, it's quite easy to do what I described above thanks to compile_string().

The others tests I've performed on all types let me think your tools does the job pretty well though ;)

PS : I'm not very skilled in github, please let me know if the pull request you have is correct (especially if the syntax in Spec.asn is ok or not) cause I made two requests but I'm not sure if the second one has been taken into account.

@eerimoq
Copy link
Owner

eerimoq commented Oct 11, 2017

Hello,

I think it's a good idea to accept either a single file or a list of files as first argument of compile_file(). It's probably a common use case.

I think the pull request (PR) includes your latest changes. I'll make a code review of the PR and eventually merge it.

@ezor1
Copy link
Contributor Author

ezor1 commented Oct 12, 2017

I'll make another PR to improve compile_file().

@eerimoq
Copy link
Owner

eerimoq commented Oct 12, 2017

I already implemented compile_file() to allow one or more files. I also renamed the function to compile_files(). :)

@eerimoq
Copy link
Owner

eerimoq commented Oct 12, 2017

Okay, I merged the first PR and styled the code to my liking. Anything else, or should we close this issue and open new issues if there are other features missing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants