pdu

package
v0.0.0-...-5333dff Latest Latest
Warning

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

Go to latest
Published: May 5, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package pdu provide codecs for binary PDU data.

Index

Constants

View Source
const HeaderLen = 16

HeaderLen is the PDU header length.

View Source
const MaxSize = 4096

MaxSize is the maximum size allowed for a PDU.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bind

type Bind struct {
	// contains filtered or unexported fields
}

Bind PDU.

func (Bind) FieldList

func (pdu Bind) FieldList() pdufield.List

FieldList implements the PDU interface.

func (Bind) Fields

func (pdu Bind) Fields() pdufield.Map

Fields implement the PDU interface.

func (Bind) Header

func (pdu Bind) Header() *Header

Header implements the PDU interface.

func (Bind) Len

func (pdu Bind) Len() int

Len implements the PDU interface.

func (Bind) SerializeTo

func (pdu Bind) SerializeTo(w io.Writer) error

SerializeTo implements the PDU interface.

func (Bind) TLVFields

func (pdu Bind) TLVFields() pdutlv.Map

Fields implement the PDU interface.

type BindResp

type BindResp struct {
	// contains filtered or unexported fields
}

BindResp PDU.

func (BindResp) FieldList

func (pdu BindResp) FieldList() pdufield.List

FieldList implements the PDU interface.

func (BindResp) Fields

func (pdu BindResp) Fields() pdufield.Map

Fields implement the PDU interface.

func (BindResp) Header

func (pdu BindResp) Header() *Header

Header implements the PDU interface.

func (BindResp) Len

func (pdu BindResp) Len() int

Len implements the PDU interface.

func (BindResp) SerializeTo

func (pdu BindResp) SerializeTo(w io.Writer) error

SerializeTo implements the PDU interface.

func (BindResp) TLVFields

func (pdu BindResp) TLVFields() pdutlv.Map

Fields implement the PDU interface.

type Body

type Body interface {
	// Header returns the PDU header, decoded. Header fields
	// can be updated (e.g. Seq) before re-serializing the PDU.
	Header() *Header

	// Len returns the length of the PDU binary data, in bytes.
	Len() int

	// FieldList returns a list of mandatory PDU fields for
	// encoding or decoding the PDU. The order in the list
	// dictates how PDUs are decoded and serialized.
	FieldList() pdufield.List

	// Fields return a decoded map of PDU fields. The returned
	// map can be modified before re-serializing the PDU.
	Fields() pdufield.Map

	// Fields return a decoded map of PDU TLV fields.
	TLVFields() pdutlv.Map

	// SerializeTo encodes the PDU to its binary form, including
	// the header and all fields.
	SerializeTo(w io.Writer) error
}

Body is an abstract Protocol Data Unit (PDU) interface for manipulating PDUs.

func Decode

func Decode(r io.Reader) (Body, error)

Decode decodes binary PDU data. It returns a new PDU object, e.g. Bind, with header and all fields decoded. The returned PDU can be modified and re-serialized to its binary form.

func NewBindReceiver

func NewBindReceiver() Body

NewBindReceiver creates a new Bind PDU.

func NewBindReceiverResp

func NewBindReceiverResp() Body

NewBindReceiverResp creates and initializes a new BindResp PDU.

func NewBindTransceiver

func NewBindTransceiver() Body

NewBindTransceiver creates a new Bind PDU.

func NewBindTransceiverResp

func NewBindTransceiverResp() Body

NewBindTransceiverResp creates and initializes a new BindResp PDU.

func NewBindTransmitter

func NewBindTransmitter() Body

NewBindTransmitter creates a new Bind PDU.

func NewBindTransmitterResp

func NewBindTransmitterResp() Body

NewBindTransmitterResp creates and initializes a new BindResp PDU.

func NewDeliverSM

func NewDeliverSM() Body

NewDeliverSM creates and initializes a new DeliverSM PDU.

func NewDeliverSMResp

func NewDeliverSMResp() Body

NewDeliverSMResp creates and initializes a new DeliverSMResp PDU.

func NewDeliverSMRespSeq

func NewDeliverSMRespSeq(seq uint32) Body

NewDeliverSMRespSeq creates and initializes a new DeliverSMResp PDU for a specific seq.

func NewEnquireLink() Body

NewEnquireLink creates and initializes a EnquireLink PDU.

func NewEnquireLinkResp

func NewEnquireLinkResp() Body

NewEnquireLinkResp creates and initializes a EnquireLinkResp PDU.

func NewEnquireLinkRespSeq

func NewEnquireLinkRespSeq(seq uint32) Body

NewEnquireLinkRespSeq creates and initializes a EnquireLinkResp PDU for a specific seq.

func NewGenericNACK

func NewGenericNACK() Body

NewGenericNACK creates and initializes a GenericNACK PDU.

func NewQuerySM

func NewQuerySM() Body

NewQuerySM creates and initializes a new QuerySM PDU.

func NewQuerySMResp

func NewQuerySMResp() Body

NewQuerySMResp creates and initializes a new QuerySMResp PDU.

func NewSubmitMulti

func NewSubmitMulti(fields pdutlv.Fields) Body

NewSubmitMulti creates and initializes a new SubmitMulti PDU.

func NewSubmitMultiResp

func NewSubmitMultiResp() Body

NewSubmitMultiResp creates and initializes a new SubmitMultiResp PDU.

func NewSubmitSM

func NewSubmitSM(fields pdutlv.Fields) Body

NewSubmitSM creates and initializes a new SubmitSM PDU.

func NewSubmitSMResp

func NewSubmitSMResp() Body

NewSubmitSMResp creates and initializes a new SubmitSMResp PDU.

func NewUnbind

func NewUnbind() Body

NewUnbind creates and initializes a Unbind PDU.

func NewUnbindResp

func NewUnbindResp() Body

NewUnbindResp creates and initializes a UnbindResp PDU.

type DeliverSM

type DeliverSM struct {
	// contains filtered or unexported fields
}

DeliverSM PDU.

func (DeliverSM) FieldList

func (pdu DeliverSM) FieldList() pdufield.List

FieldList implements the PDU interface.

func (DeliverSM) Fields

func (pdu DeliverSM) Fields() pdufield.Map

Fields implement the PDU interface.

func (DeliverSM) Header

func (pdu DeliverSM) Header() *Header

Header implements the PDU interface.

func (DeliverSM) Len

func (pdu DeliverSM) Len() int

Len implements the PDU interface.

func (DeliverSM) SerializeTo

func (pdu DeliverSM) SerializeTo(w io.Writer) error

SerializeTo implements the PDU interface.

func (DeliverSM) TLVFields

func (pdu DeliverSM) TLVFields() pdutlv.Map

Fields implement the PDU interface.

type DeliverSMResp

type DeliverSMResp struct {
	// contains filtered or unexported fields
}

DeliverSMResp PDU.

func (DeliverSMResp) FieldList

func (pdu DeliverSMResp) FieldList() pdufield.List

FieldList implements the PDU interface.

func (DeliverSMResp) Fields

func (pdu DeliverSMResp) Fields() pdufield.Map

Fields implement the PDU interface.

func (DeliverSMResp) Header

func (pdu DeliverSMResp) Header() *Header

Header implements the PDU interface.

func (DeliverSMResp) Len

func (pdu DeliverSMResp) Len() int

Len implements the PDU interface.

func (DeliverSMResp) SerializeTo

func (pdu DeliverSMResp) SerializeTo(w io.Writer) error

SerializeTo implements the PDU interface.

func (DeliverSMResp) TLVFields

func (pdu DeliverSMResp) TLVFields() pdutlv.Map

Fields implement the PDU interface.

type EnquireLink struct {
	// contains filtered or unexported fields
}

EnquireLink PDU.

func (EnquireLink) FieldList

func (pdu EnquireLink) FieldList() pdufield.List

FieldList implements the PDU interface.

func (EnquireLink) Fields

func (pdu EnquireLink) Fields() pdufield.Map

Fields implement the PDU interface.

func (EnquireLink) Header

func (pdu EnquireLink) Header() *Header

Header implements the PDU interface.

func (EnquireLink) Len

func (pdu EnquireLink) Len() int

Len implements the PDU interface.

func (EnquireLink) SerializeTo

func (pdu EnquireLink) SerializeTo(w io.Writer) error

SerializeTo implements the PDU interface.

func (EnquireLink) TLVFields

func (pdu EnquireLink) TLVFields() pdutlv.Map

Fields implement the PDU interface.

type EnquireLinkResp

type EnquireLinkResp struct {
	// contains filtered or unexported fields
}

EnquireLinkResp PDU.

func (EnquireLinkResp) FieldList

func (pdu EnquireLinkResp) FieldList() pdufield.List

FieldList implements the PDU interface.

func (EnquireLinkResp) Fields

func (pdu EnquireLinkResp) Fields() pdufield.Map

Fields implement the PDU interface.

func (EnquireLinkResp) Header

func (pdu EnquireLinkResp) Header() *Header

Header implements the PDU interface.

func (EnquireLinkResp) Len

func (pdu EnquireLinkResp) Len() int

Len implements the PDU interface.

func (EnquireLinkResp) SerializeTo

func (pdu EnquireLinkResp) SerializeTo(w io.Writer) error

SerializeTo implements the PDU interface.

func (EnquireLinkResp) TLVFields

func (pdu EnquireLinkResp) TLVFields() pdutlv.Map

Fields implement the PDU interface.

type GenericNACK

type GenericNACK struct {
	// contains filtered or unexported fields
}

GenericNACK PDU.

func (GenericNACK) FieldList

func (pdu GenericNACK) FieldList() pdufield.List

FieldList implements the PDU interface.

func (GenericNACK) Fields

func (pdu GenericNACK) Fields() pdufield.Map

Fields implement the PDU interface.

func (GenericNACK) Header

func (pdu GenericNACK) Header() *Header

Header implements the PDU interface.

func (GenericNACK) Len

func (pdu GenericNACK) Len() int

Len implements the PDU interface.

func (GenericNACK) SerializeTo

func (pdu GenericNACK) SerializeTo(w io.Writer) error

SerializeTo implements the PDU interface.

func (GenericNACK) TLVFields

func (pdu GenericNACK) TLVFields() pdutlv.Map

Fields implement the PDU interface.

type Header struct {
	Len    uint32
	ID     ID
	Status Status
	Seq    uint32 // Sequence number.
}

Header is a PDU header.

func DecodeHeader

func DecodeHeader(r io.Reader) (*Header, error)

DecodeHeader decodes binary PDU header data.

func (*Header) SerializeTo

func (h *Header) SerializeTo(w io.Writer) error

SerializeTo serializes the Header to its binary form to the given writer.

type ID

type ID uint32

ID of the PDU header.

const (
	GenericNACKID         ID = 0x80000000
	BindReceiverID        ID = 0x00000001
	BindReceiverRespID    ID = 0x80000001
	BindTransmitterID     ID = 0x00000002
	BindTransmitterRespID ID = 0x80000002
	QuerySMID             ID = 0x00000003
	QuerySMRespID         ID = 0x80000003
	SubmitSMID            ID = 0x00000004
	SubmitSMRespID        ID = 0x80000004
	DeliverSMID           ID = 0x00000005
	DeliverSMRespID       ID = 0x80000005
	UnbindID              ID = 0x00000006
	UnbindRespID          ID = 0x80000006
	ReplaceSMID           ID = 0x00000007
	ReplaceSMRespID       ID = 0x80000007
	CancelSMID            ID = 0x00000008
	CancelSMRespID        ID = 0x80000008
	BindTransceiverID     ID = 0x00000009
	BindTransceiverRespID ID = 0x80000009
	OutbindID             ID = 0x0000000B
	EnquireLinkID         ID = 0x00000015
	EnquireLinkRespID     ID = 0x80000015
	SubmitMultiID         ID = 0x00000021
	SubmitMultiRespID     ID = 0x80000021
	AlertNotificationID   ID = 0x00000102
	DataSMID              ID = 0x00000103
	DataSMRespID          ID = 0x80000103
)

PDU Types.

func (ID) String

func (id ID) String() string

String returns the PDU type as a string.

type QuerySM

type QuerySM struct {
	// contains filtered or unexported fields
}

QuerySM PDU.

func (QuerySM) FieldList

func (pdu QuerySM) FieldList() pdufield.List

FieldList implements the PDU interface.

func (QuerySM) Fields

func (pdu QuerySM) Fields() pdufield.Map

Fields implement the PDU interface.

func (QuerySM) Header

func (pdu QuerySM) Header() *Header

Header implements the PDU interface.

func (QuerySM) Len

func (pdu QuerySM) Len() int

Len implements the PDU interface.

func (QuerySM) SerializeTo

func (pdu QuerySM) SerializeTo(w io.Writer) error

SerializeTo implements the PDU interface.

func (QuerySM) TLVFields

func (pdu QuerySM) TLVFields() pdutlv.Map

Fields implement the PDU interface.

type QuerySMResp

type QuerySMResp struct {
	// contains filtered or unexported fields
}

QuerySMResp PDU.

func (QuerySMResp) FieldList

func (pdu QuerySMResp) FieldList() pdufield.List

FieldList implements the PDU interface.

func (QuerySMResp) Fields

func (pdu QuerySMResp) Fields() pdufield.Map

Fields implement the PDU interface.

func (QuerySMResp) Header

func (pdu QuerySMResp) Header() *Header

Header implements the PDU interface.

func (QuerySMResp) Len

func (pdu QuerySMResp) Len() int

Len implements the PDU interface.

func (QuerySMResp) SerializeTo

func (pdu QuerySMResp) SerializeTo(w io.Writer) error

SerializeTo implements the PDU interface.

func (QuerySMResp) TLVFields

func (pdu QuerySMResp) TLVFields() pdutlv.Map

Fields implement the PDU interface.

type Status

type Status uint32

Status is a property of the PDU header.

func (Status) Error

func (s Status) Error() string

Error implements the Error interface.

type SubmitMulti

type SubmitMulti struct {
	// contains filtered or unexported fields
}

SubmitMulti PDU.

func (SubmitMulti) FieldList

func (pdu SubmitMulti) FieldList() pdufield.List

FieldList implements the PDU interface.

func (SubmitMulti) Fields

func (pdu SubmitMulti) Fields() pdufield.Map

Fields implement the PDU interface.

func (SubmitMulti) Header

func (pdu SubmitMulti) Header() *Header

Header implements the PDU interface.

func (SubmitMulti) Len

func (pdu SubmitMulti) Len() int

Len implements the PDU interface.

func (SubmitMulti) SerializeTo

func (pdu SubmitMulti) SerializeTo(w io.Writer) error

SerializeTo implements the PDU interface.

func (SubmitMulti) TLVFields

func (pdu SubmitMulti) TLVFields() pdutlv.Map

Fields implement the PDU interface.

type SubmitMultiResp

type SubmitMultiResp struct {
	// contains filtered or unexported fields
}

SubmitMultiResp PDU.

func (SubmitMultiResp) FieldList

func (pdu SubmitMultiResp) FieldList() pdufield.List

FieldList implements the PDU interface.

func (SubmitMultiResp) Fields

func (pdu SubmitMultiResp) Fields() pdufield.Map

Fields implement the PDU interface.

func (SubmitMultiResp) Header

func (pdu SubmitMultiResp) Header() *Header

Header implements the PDU interface.

func (SubmitMultiResp) Len

func (pdu SubmitMultiResp) Len() int

Len implements the PDU interface.

func (SubmitMultiResp) SerializeTo

func (pdu SubmitMultiResp) SerializeTo(w io.Writer) error

SerializeTo implements the PDU interface.

func (SubmitMultiResp) TLVFields

func (pdu SubmitMultiResp) TLVFields() pdutlv.Map

Fields implement the PDU interface.

type SubmitSM

type SubmitSM struct {
	// contains filtered or unexported fields
}

SubmitSM PDU.

func (SubmitSM) FieldList

func (pdu SubmitSM) FieldList() pdufield.List

FieldList implements the PDU interface.

func (SubmitSM) Fields

func (pdu SubmitSM) Fields() pdufield.Map

Fields implement the PDU interface.

func (SubmitSM) Header

func (pdu SubmitSM) Header() *Header

Header implements the PDU interface.

func (SubmitSM) Len

func (pdu SubmitSM) Len() int

Len implements the PDU interface.

func (SubmitSM) SerializeTo

func (pdu SubmitSM) SerializeTo(w io.Writer) error

SerializeTo implements the PDU interface.

func (SubmitSM) TLVFields

func (pdu SubmitSM) TLVFields() pdutlv.Map

Fields implement the PDU interface.

type SubmitSMResp

type SubmitSMResp struct {
	// contains filtered or unexported fields
}

SubmitSMResp PDU.

func (SubmitSMResp) FieldList

func (pdu SubmitSMResp) FieldList() pdufield.List

FieldList implements the PDU interface.

func (SubmitSMResp) Fields

func (pdu SubmitSMResp) Fields() pdufield.Map

Fields implement the PDU interface.

func (SubmitSMResp) Header

func (pdu SubmitSMResp) Header() *Header

Header implements the PDU interface.

func (SubmitSMResp) Len

func (pdu SubmitSMResp) Len() int

Len implements the PDU interface.

func (SubmitSMResp) SerializeTo

func (pdu SubmitSMResp) SerializeTo(w io.Writer) error

SerializeTo implements the PDU interface.

func (SubmitSMResp) TLVFields

func (pdu SubmitSMResp) TLVFields() pdutlv.Map

Fields implement the PDU interface.

type Unbind

type Unbind struct {
	// contains filtered or unexported fields
}

Unbind PDU.

func (Unbind) FieldList

func (pdu Unbind) FieldList() pdufield.List

FieldList implements the PDU interface.

func (Unbind) Fields

func (pdu Unbind) Fields() pdufield.Map

Fields implement the PDU interface.

func (Unbind) Header

func (pdu Unbind) Header() *Header

Header implements the PDU interface.

func (Unbind) Len

func (pdu Unbind) Len() int

Len implements the PDU interface.

func (Unbind) SerializeTo

func (pdu Unbind) SerializeTo(w io.Writer) error

SerializeTo implements the PDU interface.

func (Unbind) TLVFields

func (pdu Unbind) TLVFields() pdutlv.Map

Fields implement the PDU interface.

type UnbindResp

type UnbindResp struct {
	// contains filtered or unexported fields
}

UnbindResp PDU.

func (UnbindResp) FieldList

func (pdu UnbindResp) FieldList() pdufield.List

FieldList implements the PDU interface.

func (UnbindResp) Fields

func (pdu UnbindResp) Fields() pdufield.Map

Fields implement the PDU interface.

func (UnbindResp) Header

func (pdu UnbindResp) Header() *Header

Header implements the PDU interface.

func (UnbindResp) Len

func (pdu UnbindResp) Len() int

Len implements the PDU interface.

func (UnbindResp) SerializeTo

func (pdu UnbindResp) SerializeTo(w io.Writer) error

SerializeTo implements the PDU interface.

func (UnbindResp) TLVFields

func (pdu UnbindResp) TLVFields() pdutlv.Map

Fields implement the PDU interface.

Directories

Path Synopsis
Package pdufield provides PDU field codecs and utilities.
Package pdufield provides PDU field codecs and utilities.
Package pdutext provides text conversion for PDU fields.
Package pdutext provides text conversion for PDU fields.

Jump to

Keyboard shortcuts

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