0

In my kernel code I need to parse a number of TLV-like attributes rtattr. Is there a way to validate that length is correct, i.e. it has to be even. Is there a macro for this?

Mark
  • 6,052
  • 8
  • 61
  • 129

1 Answers1

0

In BER-TLV data, L-value can be dynamically changed length. In case in 1-st byte bit 8 is 1 is meant that the L-length param is used several bytes. The rest of 1-st, byte masked with 0x7F, will show you the amount of bytes used for Length definition.

For sample 0x820102 will describe: the 1-st byte bit 8 set to 1 and the Length part with dynamic length the rest of 1-st byte which is 0x02 show the amount of bytes used for length. The 0x0102 the hexadecimal Length itself equal 258 bytes.

iso8583.info support
  • 2,130
  • 14
  • 18