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

uper_encode() failed to encode ASN1 Message #474

Open
akmalns opened this issue Mar 24, 2023 · 0 comments
Open

uper_encode() failed to encode ASN1 Message #474

akmalns opened this issue Mar 24, 2023 · 0 comments

Comments

@akmalns
Copy link

akmalns commented Mar 24, 2023

I tried to encode the following NZP_CSI_RS_Resource type :

/* NZP-CSI-RS-Resource */
 typedef struct NZP_CSI_RS_Resource {
	NZP_CSI_RS_ResourceId_t	 nzp_CSI_RS_ResourceId;
	CSI_RS_ResourceMapping_t	 resourceMapping;
	long	 powerControlOffset;
	long	*powerControlOffsetSS;	/* OPTIONAL */
	ScramblingId_t	 scramblingID;
	struct CSI_ResourcePeriodicityAndOffset	*periodicityAndOffset;	/* OPTIONAL */
	TCI_StateId_t	*qcl_InfoPeriodicCSI_RS;	/* OPTIONAL */
	/*
	 * This type is extensible,
	 * possible extensions are below.
	 */
	
	/* Context for parsing across buffer boundaries */
	asn_struct_ctx_t _asn_ctx;
} NZP_CSI_RS_Resource_t;

This is the code I used to encode the data structure:

      xer_fprint(stdout, &asn_DEF_NZP_CSI_RS_Resource, item);
      memset(encBuf, 0, ENC_BUF_MAX_LEN);
      encBufSize = 0;
      encRetVal = uper_encode(&asn_DEF_NZP_CSI_RS_Resource, 0, item, PrepFinalEncBuf, encBuf);
      /* Encode results */
      if(encRetVal.encoded == ENCODE_FAIL)
      {
         DU_LOG( "\nERROR  --> ENCODE UNIT TEST : Could not encode NZP CSI RESOURCE (at %s)\n",\
               encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
         DU_LOG( "\nERROR  --> ENCODE UNIT TEST : Could not encode NZP CSI RESOURCE (at %s)\n",\
               encRetVal.failed_type ? encRetVal.failed_type->xml_tag : "unknown");
         DU_LOG( "\nERROR  --> ENCODE UNIT TEST : Could not encode NZP CSI RESOURCE (at %d)\n",\
               encRetVal.failed_type ? encRetVal.failed_type->tags_count : "unknown");
         DU_LOG( "\nERROR  --> ENCODE UNIT TEST : Could not encode NZP CSI RESOURCE (at %d)\n",\
               encRetVal.failed_type ? encRetVal.failed_type->elements_count : "unknown");
      }
      else
      {
         DU_LOG("\nDEBUG   -->  ENCODE UNIT TEST : Created APER encoded buffer for NZP CSI RESOURCE\n");
      }

Assume all of the data type needed for encoding already declared (encRetVal, encBufSize, encBuf, etc).
When I run this code, I got the following message on the terminal :

<NZP-CSI-RS-Resource>
    <nzp-CSI-RS-ResourceId>0</nzp-CSI-RS-ResourceId>
    <resourceMapping>
        <frequencyDomainAllocation>
            <row2>
                010000000000
            </row2>
        </frequencyDomainAllocation>
        <nrofPorts><p1/></nrofPorts>
        <firstOFDMSymbolInTimeDomain>13</firstOFDMSymbolInTimeDomain>
        <cdm-Type><noCDM/></cdm-Type>
        <density>
            <one></one>
        </density>
        <freqBand>
            <startingRB>0</startingRB>
            <nrofRBs>4</nrofRBs>
        </freqBand>
    </resourceMapping>
    <powerControlOffset>1</powerControlOffset>
    <powerControlOffsetSS><db0/></powerControlOffsetSS>
    <scramblingID>1</scramblingID>
    <periodicityAndOffset>
        <slots4>2</slots4>
    </periodicityAndOffset>
</NZP-CSI-RS-Resource>

ERROR  --> ENCODE UNIT TEST : Could not encode NZP CSI RESOURCE (at INTEGER)

ERROR  --> ENCODE UNIT TEST : Could not encode NZP CSI RESOURCE (at INTEGER)

ERROR  --> ENCODE UNIT TEST : Could not encode NZP CSI RESOURCE (at 1)

ERROR  --> ENCODE UNIT TEST : Could not encode NZP CSI RESOURCE (at 0)

It is very strange that the error name is INTEGER while in the data structure, there is no variable/structure related with INTEGER. Most of the data use long data type

Can you see what might be the problem here @velichkov @vlm ?

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

1 participant