Documentation ¶
Overview ¶
Package pdu provide codecs for binary PDU data.
Index ¶
- Constants
- type Bind
- type BindResp
- type Body
- func Decode(r io.Reader) (Body, error)
- func NewBindReceiver() Body
- func NewBindReceiverResp() Body
- func NewBindReceiverRespSeq(seq uint32) Body
- func NewBindTransceiver() Body
- func NewBindTransceiverResp() Body
- func NewBindTransceiverRespSeq(seq uint32) Body
- func NewBindTransmitter() Body
- func NewBindTransmitterResp() Body
- func NewBindTransmitterRespSeq(seq uint32) Body
- func NewDeliverSM() Body
- func NewDeliverSMResp() Body
- func NewDeliverSMRespSeq(seq uint32) Body
- func NewEnquireLink() Body
- func NewEnquireLinkResp() Body
- func NewEnquireLinkRespSeq(seq uint32) Body
- func NewGenericNACK() Body
- func NewQuerySM() Body
- func NewQuerySMResp() Body
- func NewQuerySMRespSeq(seq uint32) Body
- func NewSubmitMulti() Body
- func NewSubmitMultiResp() Body
- func NewSubmitMultiRespSeq(seq uint32) Body
- func NewSubmitSM() Body
- func NewSubmitSMResp() Body
- func NewSubmitSMRespSeq(seq uint32) Body
- func NewUnbind() Body
- func NewUnbindResp() Body
- func NewUnbindRespSeq(seq uint32) Body
- type Codec
- func (pdu *Codec) FieldList() pdufield.List
- func (pdu *Codec) Fields() pdufield.Map
- func (pdu *Codec) Header() *Header
- func (pdu *Codec) Len() int
- func (c *Codec) MarshalJSON() ([]byte, error)
- func (pdu *Codec) SerializeTo(w io.Writer) error
- func (pdu *Codec) TLVFields() pdutlv.Map
- func (c *Codec) UnmarshalJSON(b []byte) error
- type CodecJSON
- type DeliverSM
- type DeliverSMResp
- type EnquireLink
- type EnquireLinkResp
- type Factory
- type GenericNACK
- type Header
- type ID
- type QuerySM
- type QuerySMResp
- type Status
- type SubmitMulti
- type SubmitMultiResp
- type SubmitSM
- type SubmitSMResp
- type Unbind
- type UnbindResp
Constants ¶
const HeaderLen = 16
HeaderLen is the PDU header length.
const MaxSize = 4096
MaxSize is the maximum size allowed for a PDU.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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 ¶
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 NewBindReceiverResp ¶
func NewBindReceiverResp() Body
NewBindReceiverResp creates and initializes a new BindResp PDU.
func NewBindReceiverRespSeq ¶
NewBindReceiverRespSeq creates and initializes a new BindResp PDU.
func NewBindTransceiverResp ¶
func NewBindTransceiverResp() Body
NewBindTransceiverResp creates and initializes a new BindResp PDU.
func NewBindTransceiverRespSeq ¶
NewBindTransceiverRespSeq creates and initializes a new BindResp PDU.
func NewBindTransmitterResp ¶
func NewBindTransmitterResp() Body
NewBindTransmitterResp creates and initializes a new BindResp PDU.
func NewBindTransmitterRespSeq ¶
NewBindTransmitterRespSeq 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 ¶
NewDeliverSMRespSeq creates and initializes a new DeliverSMResp PDU for a specific seq.
func NewEnquireLink ¶
func NewEnquireLink() Body
NewEnquireLink creates and initializes a EnquireLink PDU.
func NewEnquireLinkResp ¶
func NewEnquireLinkResp() Body
NewEnquireLinkResp creates and initializes a EnquireLinkResp PDU.
func NewEnquireLinkRespSeq ¶
NewEnquireLinkRespSeq creates and initializes a EnquireLinkResp PDU for a specific seq.
func NewGenericNACK ¶
func NewGenericNACK() Body
NewGenericNACK creates and initializes a GenericNACK PDU.
func NewQuerySMResp ¶
func NewQuerySMResp() Body
NewQuerySMResp creates and initializes a new QuerySMResp PDU.
func NewQuerySMRespSeq ¶
NewQuerySMRespSeq creates and initializes a new QuerySMResp PDU.
func NewSubmitMulti ¶
func NewSubmitMulti() Body
NewSubmitMulti creates and initializes a new SubmitMulti PDU.
func NewSubmitMultiResp ¶
func NewSubmitMultiResp() Body
NewSubmitMultiResp creates and initializes a new SubmitMultiResp PDU.
func NewSubmitMultiRespSeq ¶
NewSubmitMultiRespSeq creates and initializes a new SubmitMultiResp PDU.
func NewSubmitSMResp ¶
func NewSubmitSMResp() Body
NewSubmitSMResp creates and initializes a new SubmitSMResp PDU.
func NewSubmitSMRespSeq ¶
NewSubmitSMRespSeq creates and initializes a new SubmitSMResp PDU.
func NewUnbindResp ¶
func NewUnbindResp() Body
NewUnbindResp creates and initializes a UnbindResp PDU.
func NewUnbindRespSeq ¶
NewUnbindRespSeq creates and initializes a UnbindResp PDU.
type Codec ¶
type Codec struct {
// contains filtered or unexported fields
}
Codec is the base type of all PDUs. It implements the PDU interface and provides a generic encoder.
func (*Codec) MarshalJSON ¶
func (*Codec) SerializeTo ¶
SerializeTo implements the PDU interface.
func (*Codec) UnmarshalJSON ¶
Since Codec is a private struct, we expose the Unmarshal function for other packages to use it
type Factory ¶
type Factory interface { CreatePDU(id ID) (Body, error) CreatePDUResp(id ID, seq uint32) (Body, error) }
Factory is used to instantiate PDUs in a more controllable fashion. Its main purpose is to handle sequence number generation in a contained way and without it being a global variable in the package
func NewFactory ¶
func NewFactory() Factory
type Header ¶
Header is a PDU header.
func DecodeHeader ¶
DecodeHeader decodes binary PDU header data.
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.
type Status ¶
type Status uint32
Status is a property of the PDU header.
const ( OK Status = 0x00000000 InvalidMessageLength Status = 0x00000001 InvalidCommandLength Status = 0x00000002 InvalidCommandID Status = 0x00000003 IncorrectBindStatus Status = 0x00000004 AlreadyInBoundState Status = 0x00000005 InvalidPriorityFlag Status = 0x00000006 InvalidRegisteredDeliveryFlag Status = 0x00000007 SystemError Status = 0x00000008 InvalidSourceAddress Status = 0x0000000a InvalidDestinationAddress Status = 0x0000000b InvalidMessagID Status = 0x0000000c BindFailed Status = 0x0000000d InvalidPassword Status = 0x0000000e InvalidSystemID Status = 0x0000000f CancelSMFailed Status = 0x00000011 ReplaceSMFailed Status = 0x00000013 MessageQueueFull Status = 0x00000014 InvalidServiceType Status = 0x00000015 InvalidNumberDestinations Status = 0x00000033 InvalidDistributionListName Status = 0x00000034 InvalidDestinationFlag Status = 0x00000040 InvalidSubmitWithReplaceRequest Status = 0x00000042 InvalidESMEClassFieldData Status = 0x00000043 CannotSubmitToDistributionList Status = 0x00000044 SubmitSMFailed Status = 0x00000045 InvalidSourceAddressTon Status = 0x00000048 InvalidSourceAddressNpi Status = 0x00000049 InvalidDestinationAddressTon Status = 0x00000050 InvalidDestinationAddressNpi Status = 0x00000051 InvalidSytsemTypeField Status = 0x00000053 InvalidReplaceIFPresentFlag Status = 0x00000054 InvalidNumberOfMessages Status = 0x00000055 ThrottlingError Status = 0x00000058 InvalidScheduledDeliveryTime Status = 0x00000061 InvalidMessageValidityPeriord Status = 0x00000062 PredefinedMessageInvalid Status = 0x00000063 ESMEReceiverTemporaryAppError Status = 0x00000064 ESMEReceiverPermanetAPPError Status = 0x00000065 ESMEReceiberRejectMessageError Status = 0x00000066 QuerySMRequestFailed Status = 0x00000067 ErrorOptionalPartPDUBody Status = 0x000000c0 OptionalParameterNotAllowed Status = 0x000000c1 InvalidParameterLength Status = 0x000000c2 ExpectedOptionalParameterMissing Status = 0x000000c3 InvalidOptionalParameterValue Status = 0x000000c4 DeliveryFailure Status = 0x000000fe UnkownError Status = 0x000000ff )