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

Supports marshaling of nested IEs #18

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

linouxis9
Copy link
Contributor

Depends on #17

WIP, unit tests to be fixed.

@linouxis9 linouxis9 marked this pull request as ready for review March 27, 2024 10:54
@linouxis9
Copy link
Contributor Author

@wmnsk
Issues found with units tests were fixed.
Thanks! :-)

Copy link
Owner

@wmnsk wmnsk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you provide the example of payload that this PR will make it possible to handle? 💯 if you can add it to the test case in codec_test.go.

What is the point in returning "Decoded Length is not equal to..." error? In which situation would it happen, and can it be avoided somehow?

@linouxis9
Copy link
Contributor Author

linouxis9 commented Apr 1, 2024

Can you provide the example of payload that this PR will make it possible to handle? 💯 if you can add it to the test case in codec_test.go.

Yes, I'll add an example as a test case! But basically it allows you to construct a tree of IEs (IEs containing other IEs) and then marshaling them, without having to manually inject the inner IEs encoded into the outer IEs's Value field.
It's pretty handy to construct a TCAP with a MAP payload out of tcap.IE for instance.

What is the point in returning "Decoded Length is not equal to..." error? In which situation would it happen, and can it be avoided somehow?
There are two cases where this error can be triggered:

  • Internal parsing issue where the IEs were incorrectly decoded: while developing this PR, some times, I mistakenly decoded multi IEs into a single IE with some fields being lost, this helped catching the issue
  • The message being parsed is invalid, for example: the IE TLV's length is not equal to the size of its child IEs + the headers: this helped me caught a few marshaling issues when trying to unmarshal a message marshaled with go-tcap.

This error helped me while developing this PR, and I'm sure it could help us catch parsing errors in the wild, and could make potentiel bug reports a bit more readable of what happened in case of issues.

Thanks a lot for your time on such a niche but awesome library :-)

@linouxis9
Copy link
Contributor Author

linouxis9 commented Apr 4, 2024

Test case added and rebased upon new commit of PR #17, thanks a lot!

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

Successfully merging this pull request may close these issues.

2 participants