K2InformaticsGmbH / smpp_parser

A parser for SMPP protocol PDUs
Apache License 2.0
3 stars 1 forks source link

Change in the order of tlvs should not change the encoded hex #13

Closed shamis closed 6 years ago

shamis commented 6 years ago

Decoding the following hex pdu results in

00 00 00 31 00 00 00 04 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 14 01 00 02 03 04 14 00 00 01 02 02 04 00 01 01

image

Encoding the generated json results in the following hex pdu

00 00 00 32 00 00 00 04 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 14 00 00 01 02 14 01 00 02 03 04 02 04 00 02 00 01

Decoding that results in the following json

image

c-bik commented 6 years ago

To reproduce for unpack path

-ifdef(CONSOLE).

f().
P = <<
      "00 00 00 31 00 00 00 04 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "
      "14 00 00 01 02 "     % {5120,1,[2]}
      "14 01 00 02 03 04 "  % {5121,2,[3,4]}
      "14 02 00 01 05 "     % {5122,1,[5]}
    >>.
B = << <<(list_to_integer([B1,B2], 16))>> || <<B1:8, B2:8, " ">> <= P >>.
rp(smpp_operation:unpack(B)).

-endif.