Documentation ¶
Overview ¶
Package sms allows to encode and decode SMS messages into/from PDU format as described in 3GPP TS 23.040.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrUnknownEncoding = errors.New("sms: unsupported encoding") ErrUnknownMessageType = errors.New("sms: unsupported message type") ErrIncorrectSize = errors.New("sms: decoded incorrect size of field") ErrNonRelative = errors.New("sms: non-relative validity period support is not implemented yet") )
Common errors.
var Encodings = struct { Gsm7Bit Encoding UCS2 Encoding }{ 0x00, 0x08, }
Encodings represent the possible encodings of message's text data.
var MessageTypes = struct { Deliver MessageType DeliverReport MessageType StatusReport MessageType Command MessageType Submit MessageType SubmitReport MessageType }{ 0x00, 0x00, 0x02, 0x02, 0x01, 0x01, }
MessageTypes represent the possible message's types (3GPP TS 23.040).
var ValidityPeriodFormats = struct { FieldNotPresent ValidityPeriodFormat Relative ValidityPeriodFormat Enhanced ValidityPeriodFormat Absolute ValidityPeriodFormat }{ 0x00, 0x02, 0x01, 0x03, }
ValidityPeriodFormats represent the possible formats of message's validity period (3GPP TS 23.040).
Functions ¶
This section is empty.
Types ¶
type Message ¶
type Message struct { Type MessageType Encoding Encoding VP ValidityPeriod VPFormat ValidityPeriodFormat ServiceCenterTime Timestamp ServiceCenterAddress PhoneNumber Address PhoneNumber Text string // Advanced MessageReference byte ReplyPathExists bool UserDataStartsWithHeader bool StatusReportIndication bool StatusReportRequest bool MoreMessagesToSend bool LoopPrevention bool RejectDuplicates bool }
Message represents an SMS message, including some advanced fields. This is a user-friendly high-level representation that should be used around. Complies with 3GPP TS 23.040.
type PhoneNumber ¶
type PhoneNumber string
PhoneNumber represents the address in either local or international format.
func (PhoneNumber) PDU ¶
func (p PhoneNumber) PDU() (int, []byte, error)
PDU returns the number of digits in address and octets of semi-octet encoded address.
func (*PhoneNumber) ReadFrom ¶
func (p *PhoneNumber) ReadFrom(octets []byte)
ReadFrom constructs an address from the semi-decoded version in the supplied byte slice.
func (PhoneNumber) Type ¶
func (p PhoneNumber) Type() byte
Type returns the type of address — local or international.
type Timestamp ¶
Timestamp represents message's timestamp.
type ValidityPeriod ¶
ValidityPeriod represents the validity period of message.
func (ValidityPeriod) Octet ¶
func (v ValidityPeriod) Octet() byte
Octet return a one-byte representation of the validity period.
func (*ValidityPeriod) ReadFrom ¶
func (v *ValidityPeriod) ReadFrom(oct byte)
ReadFrom reads the validity period form the given byte.
type ValidityPeriodFormat ¶
type ValidityPeriodFormat byte
ValidityPeriodFormat represents the format of message's validity period.