diff --git a/packages/acn/src/pdu/rlp.ts b/packages/acn/src/pdu/rlp.ts index bf8e9dc..3190f4d 100644 --- a/packages/acn/src/pdu/rlp.ts +++ b/packages/acn/src/pdu/rlp.ts @@ -1,4 +1,5 @@ -import { RootLayerPDU } from '../models'; +import pdu from '.'; +import { Protocols, RootLayerPDU, SessionDataTransportPDU } from '../models'; import { toHex } from '../utils'; function decode(bytes: Uint8Array): RootLayerPDU { @@ -49,7 +50,11 @@ function decode(bytes: Uint8Array): RootLayerPDU { const dataOffset = headerOffset + 16; // NOTE(jwetzell): flags/lengthH + lengthL + lengthX + vector + header const dataLength = length - (1 + 1 + (lengthFlag ? 1 : 0) + 4 + 16); - const data = bytes.subarray(dataOffset, dataOffset + dataLength); + let data: SessionDataTransportPDU | Uint8Array = bytes.subarray(dataOffset, dataOffset + dataLength); + + if (vector === Protocols.SDT) { + data = pdu.sdt.decode(data); + } return { vector,