Closed jwpark0921 closed 2 years ago
I've no idea what V2X library is, what it uses underneath, or how it works.
Having said that, let me take a look at how asn1c
would encoder and decode this integer.
At this point I can only add that not having a small and self-contained code reproducer (should include ASN.1 file, main C file, XER encoding of the problematic PDU, if available - APER encoding of that PDU) to test this, it would be quite difficult for me to proceed.
I've created an ASN.1 file
REQ DEFINITIONS IMPLICIT TAGS ::=
BEGIN
Time64 ::= INTEGER (0..9223372036854775807)
Req ::= SEQUENCE {
currentTime Time64,
expiryTime Time64
}
END
and wrote a small test-program to encode and decode it in APER, using
rc = asn_uint642INTEGER(&pdu->expiryTime, expTime);
to set the values. It works fine:
APER-encoded buffer (14 bytes):
0x6062d7839be00ccccccccccccccc
APER-decoded buffer, consumed 14 bytes:
<Req>
<currentTime>1658291099</currentTime>
<expiryTime>922337203685477580</expiryTime>
</Req>
Please re-open if you have more input.
hello. I found a problem with encoding/decoding 64 bit integers. The ASN definition is as follows:
Request ::= SEQUENCE { channelId ChannelNumber, timeSlot TimeSlot, dataRate DataRate, transmitPowerLevel TXpower, channelLoad Opaque OPTIONAL, infoElementIndicator WaveElementsIncluded, userPriority UserPriority, expiryTime Time64 }
Time64 ::= INTEGER (0..9223372036854775807)
For testing, I put a value in Time64 as below and performed encoding/decoding for BER, DER, OER, and PER.
asn_uint642INTEGER(&request->expiryTime, UINT64_MAX);
As a result of the test, there is a problem that only PER is not performed. Is there any way to solve this problem?
V2X library Test(ATS_BER)
Encoding success.(35bytes) Decoding success.(consumed = 35bytes)
V2X library Test(ATS_DER)
Encoding success.(35bytes) Decoding success.(consumed = 35bytes)
V2X library Test(ATS_BASIC_OER)
Encoding success.(18bytes) Decoding success.(consumed = 18bytes)
V2X library Test(ATS_CANONICAL_OER)
Encoding success.(18bytes) Decoding success.(consumed = 18bytes)
V2X library Test(ATS_UNALIGNED_BASIC_PER)
Encoding failed.(Time64) Decoding failed.(consumed = 0bytes)
V2X library Test(ATS_UNALIGNED_CANONICAL_PER)
Encoding failed.(Time64) Decoding failed.(consumed = 0bytes)
V2X library Test(ATS_ALIGNED_BASIC_PER)
Encoding failed.(Time64) Decoding failed.(consumed = 0bytes)
V2X library Test(ATS_ALIGNED_CANONICAL_PER)
Encoding failed.(Time64) Decoding failed.(consumed = 0bytes)