pdutlv

package
v0.0.0-...-343e30c Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2022 License: MIT Imports: 5 Imported by: 0

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) 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.

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 (
	TagDestAddrSubunit          Tag = 0x0005
	TagDestNetworkType          Tag = 0x0006
	TagDestBearerType           Tag = 0x0007
	TagDestTelematicsID         Tag = 0x0008
	TagSourceAddrSubunit        Tag = 0x000D
	TagSourceNetworkType        Tag = 0x000E
	TagSourceBearerType         Tag = 0x000F
	TagSourceTelematicsID       Tag = 0x0010
	TagQosTimeToLive            Tag = 0x0017
	TagPayloadType              Tag = 0x0019
	TagAdditionalStatusInfoText Tag = 0x001D
	TagReceiptedMessageID       Tag = 0x001E
	TagMsMsgWaitFacilities      Tag = 0x0030
	TagPrivacyIndicator         Tag = 0x0201
	TagSourceSubaddress         Tag = 0x0202
	TagDestSubaddress           Tag = 0x0203
	TagUserMessageReference     Tag = 0x0204
	TagUserResponseCode         Tag = 0x0205
	TagSourcePort               Tag = 0x020A
	TagDestinationPort          Tag = 0x020B
	TagSarMsgRefNum             Tag = 0x020C
	TagLanguageIndicator        Tag = 0x020D
	TagSarTotalSegments         Tag = 0x020E
	TagSarSegmentSeqnum         Tag = 0x020F
	TagCallbackNumPresInd       Tag = 0x0302
	TagCallbackNumAtag          Tag = 0x0303
	TagNumberOfMessages         Tag = 0x0304
	TagCallbackNum              Tag = 0x0381
	TagDpfResult                Tag = 0x0420
	TagSetDpf                   Tag = 0x0421
	TagMsAvailabilityStatus     Tag = 0x0422
	TagNetworkErrorCode         Tag = 0x0423
	TagMessagePayload           Tag = 0x0424
	TagDeliveryFailureReason    Tag = 0x0425
	TagMoreMessagesToSend       Tag = 0x0426
	TagMessageStateOption       Tag = 0x0427
	TagUssdServiceOp            Tag = 0x0501
	TagDisplayTime              Tag = 0x1201
	TagSmsSignal                Tag = 0x1203
	TagMsValidity               Tag = 0x1204
	TagAlertOnMessageDelivery   Tag = 0x130C
	TagItsReplyType             Tag = 0x1380
	TagItsSessionInfo           Tag = 0x1383
)

Common Tag-Length-Value (TLV) tags.

func (Tag) Hex

func (t Tag) Hex() string

Hex returns hexadecimal representation of tag

Jump to

Keyboard shortcuts

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