From aff4ffe070435521bcbcb1b7c68ca345c75811f3 Mon Sep 17 00:00:00 2001 From: PhatPhuckDave <> Date: Tue, 23 Jul 2024 13:41:20 +0200 Subject: [PATCH] update --- jstester/smppClient.js | 2 +- pdu/pdu.go | 31 +++++++++++++++++++++++++++++++ pdu/pdu_test.go | 1 + 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/jstester/smppClient.js b/jstester/smppClient.js index 35e02dc..f395f37 100644 --- a/jstester/smppClient.js +++ b/jstester/smppClient.js @@ -3,7 +3,7 @@ const smpp = require("smpp"); let message_id = 0; const session = smpp.connect( { - url: "smpp://0.0.0.0:6001", + url: "smpp://0.0.0.0:2775", auto_enquire_link_period: 10000, debug: true, }, diff --git a/pdu/pdu.go b/pdu/pdu.go index 47fd6a5..1cef575 100644 --- a/pdu/pdu.go +++ b/pdu/pdu.go @@ -25,6 +25,37 @@ type ( header PDU_HEADER } ) +// Hmm the header can be partially encoded +// As in command_status can just be null +// So not 0s, null, non existent, not encoded +// So we'll have to maybe set them to nil or something... +// Wireshark dump of a submit_sm +// See header: 00 00 00 3e (size, 62 bytes), 00 00 00 04 (command_id), status and sequence number are 0 +// So they are not encoded +// Here the header is 8 bytes, not 16 +// 0000 02 00 00 00 45 00 00 66 6f ff 40 00 80 06 00 00 ....E..fo.@..... +// 0010 7f 00 00 01 7f 00 00 01 31 4f 0a d7 e8 b0 b1 b5 ........1O...... +// 0020 3e 91 d9 dc 50 18 20 fa 2a 1f 00 00 00 00 00 3e >...P. .*......> +// 0030 00 00 00 04 00 00 00 00 00 00 00 02 00 00 00 73 ...............s +// 0040 6d 70 70 5f 74 65 73 74 5f 31 00 00 00 31 32 33 mpp_test_1...123 +// 0050 31 32 33 31 32 33 31 32 33 00 00 00 00 00 00 00 123123123....... +// 0060 00 c0 00 06 48 65 6c 6c 6f 21 ....Hello! +// I AM NOT RIGHT +// Beyond the size and command_id, command_status and sequence_number here are: +// 00 00 00 00 (0) 00 00 00 02 (2) +// +// Another example - bind_transciever: +// 0000 02 00 00 00 45 00 00 47 6f fb 40 00 80 06 00 00 ....E..Go.@..... +// 0010 7f 00 00 01 7f 00 00 01 31 4f 0a d7 e8 b0 b1 96 ........1O...... +// 0020 3e 91 d9 cb 50 18 20 fa df ab 00 00 00 00 00 1f >...P. ......... +// 0030 00 00 00 09 00 00 00 00 00 00 00 01 74 65 73 74 ............test +// 0040 00 74 65 73 74 00 00 50 00 00 00 .test..P... +// 00 00 00 1f - 00 00 00 09 - 00 00 00 00 - 00 00 00 01 (header) +// 74 65 73 74 00 - 74 65 73 74 00 - 00 50 00 00 00 +// ^system_id ^password ^interface_version +// What are the other 0s? +// Don't know + func (p *PDU_HEADER) Encode() (*[]uint8, error) { buf := ByteBufferPool.GetBuffer(uint(p.Size())) diff --git a/pdu/pdu_test.go b/pdu/pdu_test.go index 21114dc..f3e6561 100644 --- a/pdu/pdu_test.go +++ b/pdu/pdu_test.go @@ -292,6 +292,7 @@ func TestEncodeIntoWithBoundaryValues(t *testing.T) { } } + // region decode func TestDecodeHandlesShortByteSlice(t *testing.T) { var p PDU_HEADER