diff --git a/pdu/pdu.go b/pdu/pdu.go index 9a51c00..0f4c15b 100644 --- a/pdu/pdu.go +++ b/pdu/pdu.go @@ -10,6 +10,7 @@ type ( EncodeInto(*[]uint8) Encode() []uint8 Decode([]uint8) + // Size in bytes Size() uint32 } diff --git a/pdu/submit.go b/pdu/submit.go index a205cfd..8e572ef 100644 --- a/pdu/submit.go +++ b/pdu/submit.go @@ -66,5 +66,25 @@ func (p *SUBMIT_SM) EncodeInto(buf *[]byte) { func (p *SUBMIT_SM) Decode(data []byte) { } func (p *SUBMIT_SM) Size() uint32 { - return 0 + var size uint32 + size += 16 // header + size += uint32(len(p.service_type) * 1) + size += 1 // source_addr_ton + size += 1 // source_addr_npi + size += uint32(len(p.source_addr) * 1) + size += 1 // dest_addr_ton + size += 1 // dest_addr_npi + size += uint32(len(p.destination_addr) * 1) + size += 1 // esm_class + size += 1 // protocol_id + size += 1 // priority_flag + size += uint32(len(p.schedule_delivery_time) * 1) + size += uint32(len(p.validity_period) * 1) + size += 1 // registered_delivery + size += 1 // replace_if_present + size += 1 // data_coding + size += 1 // sm_default_msg_id + size += 1 // sm_length + size += uint32(len(p.short_message) * 1) + return size }