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

Fix version brackets in CHOICE #199

Open
wants to merge 1 commit into
base: vlm_master
Choose a base branch
from

Conversation

johvik
Copy link

@johvik johvik commented Sep 26, 2024

Quote from Rec. ITU-T X.691 (02/2021) end of section 23: "NOTE – Version brackets in the definition of choice extension additions have no effect on how "ExtensionAdditionAlternatives" are encoded."

In other words elements inside version brackets should not be grouped together for CHOICE (as opposed to how its done for SEQUENCE).

Quote from Rec. ITU-T X.691 (02/2021) end of section 23:
"NOTE – Version brackets in the definition of choice extension
additions have no effect on how "ExtensionAdditionAlternatives"
are encoded."

In other words elements inside version brackets should not be grouped
together for CHOICE (as opposed to how its done for SEQUENCE).
@mouse07410
Copy link
Owner

First, apologies for delayed response.

Could you give an example or two of what the current situation is, and how it would look after your PR is merged?

@johvik
Copy link
Author

johvik commented Dec 3, 2024

I will use the test I added (tests/tests-asn1c-compiler/165-choice-extended-group-OK.asn1) as an example.

Before this change it produced this struct:

typedef struct Choice {
	Choice_PR present;
	union Choice_u {
		long	 a;
		/*
		 * This type is extensible,
		 * possible extensions are below.
		 */
		long	 b;
		struct ext1 {
			long	 c;
			
			/* Context for parsing across buffer boundaries */
			asn_struct_ctx_t _asn_ctx;
		} *ext1;
		struct ext2 {
			long	 d;
			long	 e;
			
			/* Context for parsing across buffer boundaries */
			asn_struct_ctx_t _asn_ctx;
		} *ext2;
		struct ext3 {
			long	 f;
			long	 g;
			
			/* Context for parsing across buffer boundaries */
			asn_struct_ctx_t _asn_ctx;
		} *ext3;
	} choice;
	
	/* Context for parsing across buffer boundaries */
	asn_struct_ctx_t _asn_ctx;
} Choice_t;

After this change it produces this struct:

typedef struct Choice {
	Choice_PR present;
	union Choice_u {
		long	 a;
		/*
		 * This type is extensible,
		 * possible extensions are below.
		 */
		long	 b;
		long	 c;
		long	 d;
		long	 e;
		long	 f;
		long	 g;
	} choice;
	
	/* Context for parsing across buffer boundaries */
	asn_struct_ctx_t _asn_ctx;
} Choice_t;

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