fiorix / go-smpp

SMPP 3.4 Protocol for the Go programming language
MIT License
218 stars 135 forks source link

wrong decode and encode for pdufield.UDHList #121

Open skill215 opened 6 months ago

skill215 commented 6 months ago

I found that the decode and encode (Bytes(), Len(), SerializeTo()) method for pdufield.UDHList were wrong. According to 3GPP TS 23.040 Section 9.2.3.4. https://www.etsi.org/deliver/etsi_ts/123000_123099/123040/16.00.00_60/ts_123040v160000p.pdf Each IEI data inside the UDH should not have tailing zeros (0x00) So we should change following definition

// UDH is a PDU field used for user data header.
type UDH struct {
    IEI      Fixed
    IELength Fixed
    IEData   Variable
}

To:

 type UDH struct {
    IEI      Fixed
    IELength Fixed
    IEData   Raw
}

And redefine the Raw type

fiorix commented 6 months ago

Happy to review a PR