pdutlv

package
v0.0.0-...-3c0c265 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2018 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Body

type Body interface {
	Len() int
	Raw() interface{}
	String() string
	Bytes() []byte
	SerializeTo(w io.Writer) error
}

Body is an interface for manipulating binary PDU Tag-Length-Value field data.

func NewTLV

func NewTLV(tag Tag, value []byte) Body

NewTLV parses the given binary data and returns a Data object, or nil if the field Name is unknown.

type CString

type CString string

CString is a text string that is automatically null-terminated (e.g., final 00 byte at the end).

type Field

type Field struct {
	Tag  Tag
	Data []byte
}

Field is a PDU Tag-Length-Value (TLV) field

func (*Field) Bytes

func (t *Field) Bytes() []byte

Bytes implements the Data interface.

func (*Field) Len

func (t *Field) Len() int

Len implements the Data interface.

func (*Field) Raw

func (t *Field) Raw() interface{}

Raw implements the Data interface.

func (*Field) SerializeTo

func (t *Field) SerializeTo(w io.Writer) error

SerializeTo implements the Data interface.

func (*Field) String

func (t *Field) String() string

String implements the Data interface.

type Fields

type Fields map[Tag]interface{}

Fields is a map of tagged TLV fields

type Map

type Map map[Tag]Body

Map is a collection of PDU TLV field data indexed by tag.

func DecodeTLV

func DecodeTLV(r *bytes.Buffer) (Map, error)

DecodeTLV scans the given byte slice to build a Map from binary data.

func (Map) MarshalJSON

func (m Map) MarshalJSON() ([]byte, error)

func (Map) Set

func (m Map) Set(t Tag, v interface{}) error

Set updates the PDU map with the given tag and value, and returns error if the value cannot be converted to type Data.

This is a shortcut for m[t] = NewTLV(t, v) converting v properly.

func (*Map) UnmarshalJSON

func (m *Map) UnmarshalJSON(b []byte) error

type MessageStateType

type MessageStateType uint8
const (
	Enroute       MessageStateType = 1 // The message is in enroute
	Delivered     MessageStateType = 2 // Message is delivered
	Expired       MessageStateType = 3 // Message validity period has expired
	Deleted       MessageStateType = 4 // Message has been deleted
	Undeliverable MessageStateType = 5 // Message is undeliverable
	Accepted      MessageStateType = 6 // Message is in accepted state
	Unknown       MessageStateType = 7 // Message is in invalid state
	Rejected      MessageStateType = 8 // Message is in a rejected state
)

func (MessageStateType) String

func (m MessageStateType) String() string

type String

type String string

String is a text string that is not null-terminated.

type Tag

type Tag uint16

Tag is the tag of a Tag-Length-Value (TLV) field.

const (
	DestAddrSubunit          Tag = 0x0005
	DestNetworkType          Tag = 0x0006
	DestBearerType           Tag = 0x0007
	DestTelematicsID         Tag = 0x0008
	SourceAddrSubunit        Tag = 0x000D
	SourceNetworkType        Tag = 0x000E
	SourceBearerType         Tag = 0x000F
	SourceTelematicsID       Tag = 0x0010
	QosTimeToLive            Tag = 0x0017
	PayloadType              Tag = 0x0019
	AdditionalStatusInfoText Tag = 0x001D
	ReceiptedMessageID       Tag = 0x001E
	MsMsgWaitFacilities      Tag = 0x0030
	PrivacyIndicator         Tag = 0x0201
	SourceSubaddress         Tag = 0x0202
	DestSubaddress           Tag = 0x0203
	UserMessageReference     Tag = 0x0204
	UserResponseCode         Tag = 0x0205
	SourcePort               Tag = 0x020A
	DestinationPort          Tag = 0x020B
	SarMsgRefNum             Tag = 0x020C
	LanguageIndicator        Tag = 0x020D
	SarTotalSegments         Tag = 0x020E
	SarSegmentSeqnum         Tag = 0x020F
	CallbackNumPresInd       Tag = 0x0302
	CallbackNumAtag          Tag = 0x0303
	NumberOfMessages         Tag = 0x0304
	CallbackNum              Tag = 0x0381
	DpfResult                Tag = 0x0420
	SetDpf                   Tag = 0x0421
	MsAvailabilityStatus     Tag = 0x0422
	NetworkErrorCode         Tag = 0x0423
	MessagePayload           Tag = 0x0424
	DeliveryFailureReason    Tag = 0x0425
	MoreMessagesToSend       Tag = 0x0426
	MessageStateOption       Tag = 0x0427
	UssdServiceOp            Tag = 0x0501
	DisplayTime              Tag = 0x1201
	SmsSignal                Tag = 0x1203
	MsValidity               Tag = 0x1204
	AlertOnMessageDelivery   Tag = 0x130C
	ItsReplyType             Tag = 0x1380
	ItsSessionInfo           Tag = 0x1383
)

Common Tag-Length-Value (TLV) tags.

func (Tag) Hex

func (t Tag) Hex() string

Hex returns hexadecimal representation of tag

func (Tag) String

func (t Tag) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL