messages

package
v0.7.5 Latest Latest
Warning

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

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

Documentation

Overview

Package messages provides encoding/decoding feature of GTPv1 protocol.

Index

Constants

View Source
const (
	MsgTypeEchoRequest uint8
	MsgTypeEchoResponse
	MsgTypeVersionNotSupported
	MsgTypeNodeAliveRequest
	MsgTypeNodeAliveResponse
	MsgTypeRedirectionRequest
	MsgTypeRedirectionResponse

	MsgTypeCreatePDPContextRequest // 16
	MsgTypeCreatePDPContextResponse
	MsgTypeUpdatePDPContextRequest
	MsgTypeUpdatePDPContextResponse
	MsgTypeDeletePDPContextRequest
	MsgTypeDeletePDPContextResponse
	MsgTypeCreateAAPDPContextRequest
	MsgTypeCreateAAPDPContextResponse
	MsgTypeDeleteAAPDPContextRequest
	MsgTypeDeleteAAPDPContextResponse
	MsgTypeErrorIndication
	MsgTypePDUNotificationRequest
	MsgTypePDUNotificationResponse
	MsgTypePDUNotificationRejectRequest
	MsgTypePDUNotificationRejectResponse

	MsgTypeSendRoutingInfoRequest
	MsgTypeSendRoutingInfoResponse
	MsgTypeFailureReportRequest
	MsgTypeFailureReportResponse
	MsgTypeNoteMSPresentRequest
	MsgTypeNoteMSPresentResponse

	MsgTypeIdentificationRequest // 48
	MsgTypeIdentificationResponse
	MsgTypeSGSNContextRequest
	MsgTypeSGSNContextResponse
	MsgTypeSGSNContextAcknowledge
	MsgTypeDataRecordTransferRequest  uint8 = 240
	MsgTypeDataRecordTransferResponse uint8 = 241
	MsgTypeTPDU                       uint8 = 255
)

Message Type definitions.

Variables

View Source
var (
	ErrInvalidLength      = errors.New("got invalid length ")
	ErrTooShortToMarshal  = errors.New("too short to serialize")
	ErrTooShortToParse    = errors.New("too short to decode as GTPv1")
	ErrInvalidMessageType = errors.New("got invalid message type")
)

Error definitions.

Functions

func Marshal added in v0.4.2

func Marshal(g Message) ([]byte, error)

Marshal returns the byte sequence generated from a Message instance. Better to use MarshalXxx instead if you know the name of message to be serialized.

func NewHeaderFlags

func NewHeaderFlags(v, p, e, s, n int) uint8

NewHeaderFlags returns a Header Flag built by its components given as arguments.

func Serialize

func Serialize(m Message) ([]byte, error)

Serialize serializes Message into bytes.

DEPRECATED: use Marshal instead.

Types

type CreatePDPContextRequest

type CreatePDPContextRequest struct {
	*Header
	IMSI                               *ies.IE
	RAI                                *ies.IE
	Recovery                           *ies.IE
	SelectionMode                      *ies.IE
	TEIDDataI                          *ies.IE
	TEIDCPlane                         *ies.IE
	NSAPI                              *ies.IE
	LinkedNSAPI                        *ies.IE
	ChargingCharacteristics            *ies.IE
	TraceReference                     *ies.IE
	TraceType                          *ies.IE
	EndUserAddress                     *ies.IE
	APN                                *ies.IE
	PCO                                *ies.IE
	SGSNAddressForSignalling           *ies.IE
	SGSNAddressForUserTraffic          *ies.IE
	MSISDN                             *ies.IE
	QoSProfile                         *ies.IE
	TFT                                *ies.IE
	TriggerID                          *ies.IE
	OMCIdentity                        *ies.IE
	CommonFlags                        *ies.IE
	APNRestriction                     *ies.IE
	RATType                            *ies.IE
	UserLocationInformation            *ies.IE
	MSTimeZone                         *ies.IE
	IMEI                               *ies.IE
	CAMELChargingInformationContainer  *ies.IE
	AdditionalTraceInfo                *ies.IE
	CorrelationID                      *ies.IE
	EvolvedARPI                        *ies.IE
	ExtendedCommonFlags                *ies.IE
	UCI                                *ies.IE
	APNAMBR                            *ies.IE
	SignallingPriorityIndication       *ies.IE
	CNOperatorSelectionEntity          *ies.IE
	MappedUEUsageType                  *ies.IE
	UPFunctionSelectionIndicationFlags *ies.IE
	PrivateExtension                   *ies.IE
	AdditionalIEs                      []*ies.IE
}

CreatePDPContextRequest is a CreatePDPContextRequest Header and its IEs above.

func DecodeCreatePDPContextRequest

func DecodeCreatePDPContextRequest(b []byte) (*CreatePDPContextRequest, error)

DecodeCreatePDPContextRequest decodes bytes as CreatePDPContextRequest.

DEPRECATED: use ParseCreatePDPContextRequest instead.

func NewCreatePDPContextRequest

func NewCreatePDPContextRequest(teid uint32, seq uint16, ie ...*ies.IE) *CreatePDPContextRequest

NewCreatePDPContextRequest creates a new GTPv1 CreatePDPContextRequest.

func ParseCreatePDPContextRequest added in v0.4.2

func ParseCreatePDPContextRequest(b []byte) (*CreatePDPContextRequest, error)

ParseCreatePDPContextRequest decodes a given byte sequence as a CreatePDPContextRequest.

func (*CreatePDPContextRequest) DecodeFromBytes

func (c *CreatePDPContextRequest) DecodeFromBytes(b []byte) error

DecodeFromBytes decodes bytes as CreatePDPContextRequest.

DEPRECATED: use CreatePDPContextRequest.UnmarshalBinary instead.

func (*CreatePDPContextRequest) Len

func (c *CreatePDPContextRequest) Len() int

Len returns the actual length of CreatePDPContextRequest.

DEPRECATED: use CreatePDPContextRequest.MarshalLen instead.

func (*CreatePDPContextRequest) Marshal added in v0.4.2

func (c *CreatePDPContextRequest) Marshal() ([]byte, error)

Marshal returns the byte sequence generated from a CreatePDPContextRequest.

func (*CreatePDPContextRequest) MarshalLen added in v0.4.2

func (c *CreatePDPContextRequest) MarshalLen() int

MarshalLen returns the serial length of Data.

func (*CreatePDPContextRequest) MarshalTo added in v0.4.2

func (c *CreatePDPContextRequest) MarshalTo(b []byte) error

MarshalTo puts the byte sequence in the byte array given as b.

func (*CreatePDPContextRequest) MessageTypeName

func (c *CreatePDPContextRequest) MessageTypeName() string

MessageTypeName returns the name of protocol.

func (*CreatePDPContextRequest) Serialize

func (c *CreatePDPContextRequest) Serialize() ([]byte, error)

Serialize serializes CreatePDPContextRequest into bytes.

DEPRECATED: use CreatePDPContextRequest.Marshal instead.

func (*CreatePDPContextRequest) SerializeTo

func (c *CreatePDPContextRequest) SerializeTo(b []byte) error

SerializeTo serializes CreatePDPContextRequest into bytes given as b.

DEPRECATED: use CreatePDPContextRequest.MarshalTo instead.

func (*CreatePDPContextRequest) SetLength

func (c *CreatePDPContextRequest) SetLength()

SetLength sets the length in Length field.

func (*CreatePDPContextRequest) TEID

func (c *CreatePDPContextRequest) TEID() uint32

TEID returns the TEID in human-readable string.

func (*CreatePDPContextRequest) UnmarshalBinary added in v0.4.2

func (c *CreatePDPContextRequest) UnmarshalBinary(b []byte) error

UnmarshalBinary decodes a given byte sequence as a CreatePDPContextRequest.

type CreatePDPContextResponse

type CreatePDPContextResponse struct {
	*Header
	Cause                         *ies.IE
	ReorderingRequired            *ies.IE
	Recovery                      *ies.IE
	TEIDDataI                     *ies.IE
	TEIDCPlane                    *ies.IE
	NSAPI                         *ies.IE
	ChargingID                    *ies.IE
	EndUserAddress                *ies.IE
	PCO                           *ies.IE
	GGSNAddressForCPlane          *ies.IE
	GGSNAddressForUserTraffic     *ies.IE
	AltGGSNAddressForCPlane       *ies.IE
	AltGGSNAddressForUserTraffic  *ies.IE
	QoSProfile                    *ies.IE
	ChargingGatewayAddress        *ies.IE
	AltChargingGatewayAddress     *ies.IE
	CommonFlags                   *ies.IE
	APNRestriction                *ies.IE
	MSInfoChangeReportingAction   *ies.IE
	BearerControlMode             *ies.IE
	EvolvedARPI                   *ies.IE
	ExtendedCommonFlag            *ies.IE
	CSGInformationReportingAction *ies.IE
	APNAMBR                       *ies.IE
	GGSNBackOffTime               *ies.IE
	ExtendedCommonFlagsII         *ies.IE
	PrivateExtension              *ies.IE
	AdditionalIEs                 []*ies.IE
}

CreatePDPContextResponse is a CreatePDPContextResponse Header and its IEs above.

func DecodeCreatePDPContextResponse

func DecodeCreatePDPContextResponse(b []byte) (*CreatePDPContextResponse, error)

DecodeCreatePDPContextResponse decodes bytes as CreatePDPContextResponse.

DEPRECATED: use ParseCreatePDPContextResponse instead.

func NewCreatePDPContextResponse

func NewCreatePDPContextResponse(teid uint32, seq uint16, ie ...*ies.IE) *CreatePDPContextResponse

NewCreatePDPContextResponse creates a new GTPv1 CreatePDPContextResponse.

func ParseCreatePDPContextResponse added in v0.4.2

func ParseCreatePDPContextResponse(b []byte) (*CreatePDPContextResponse, error)

ParseCreatePDPContextResponse decodes a given byte sequence as a CreatePDPContextResponse.

func (*CreatePDPContextResponse) DecodeFromBytes

func (c *CreatePDPContextResponse) DecodeFromBytes(b []byte) error

DecodeFromBytes decodes bytes as CreatePDPContextResponse.

DEPRECATED: use CreatePDPContextResponse.UnmarshalBinary instead.

func (*CreatePDPContextResponse) Len

func (c *CreatePDPContextResponse) Len() int

Len returns the actual length of CreatePDPContextResponse.

DEPRECATED: use CreatePDPContextResponse.MarshalLen instead.

func (*CreatePDPContextResponse) Marshal added in v0.4.2

func (c *CreatePDPContextResponse) Marshal() ([]byte, error)

Marshal returns the byte sequence generated from a CreatePDPContextResponse.

func (*CreatePDPContextResponse) MarshalLen added in v0.4.2

func (c *CreatePDPContextResponse) MarshalLen() int

MarshalLen returns the serial length of Data.

func (*CreatePDPContextResponse) MarshalTo added in v0.4.2

func (c *CreatePDPContextResponse) MarshalTo(b []byte) error

MarshalTo puts the byte sequence in the byte array given as b.

func (*CreatePDPContextResponse) MessageTypeName

func (c *CreatePDPContextResponse) MessageTypeName() string

MessageTypeName returns the name of protocol.

func (*CreatePDPContextResponse) Serialize

func (c *CreatePDPContextResponse) Serialize() ([]byte, error)

Serialize serializes CreatePDPContextResponse into bytes.

DEPRECATED: use CreatePDPContextResponse.Marshal instead.

func (*CreatePDPContextResponse) SerializeTo

func (c *CreatePDPContextResponse) SerializeTo(b []byte) error

SerializeTo serializes CreatePDPContextResponse into bytes given as b.

DEPRECATED: use CreatePDPContextResponse.MarshalTo instead.

func (*CreatePDPContextResponse) SetLength

func (c *CreatePDPContextResponse) SetLength()

SetLength sets the length in Length field.

func (*CreatePDPContextResponse) TEID

func (c *CreatePDPContextResponse) TEID() uint32

TEID returns the TEID in human-readable string.

func (*CreatePDPContextResponse) UnmarshalBinary added in v0.4.2

func (c *CreatePDPContextResponse) UnmarshalBinary(b []byte) error

UnmarshalBinary decodes a given byte sequence as a CreatePDPContextResponse.

type DeletePDPContextRequest

type DeletePDPContextRequest struct {
	*Header
	Cause               *ies.IE
	TeardownInd         *ies.IE
	NSAPI               *ies.IE
	PCO                 *ies.IE
	ULI                 *ies.IE
	MSTimeZone          *ies.IE
	ExtendedCommonFlags *ies.IE
	ULITimestamp        *ies.IE
	PrivateExtension    *ies.IE
	AdditionalIEs       []*ies.IE
}

DeletePDPContextRequest is a DeletePDPContextRequest Header and its IEs above.

func DecodeDeletePDPContextRequest

func DecodeDeletePDPContextRequest(b []byte) (*DeletePDPContextRequest, error)

DecodeDeletePDPContextRequest decodes bytes as DeletePDPContextRequest.

DEPRECATED: use ParseDeletePDPContextRequest instead.

func NewDeletePDPContextRequest

func NewDeletePDPContextRequest(teid uint32, seq uint16, ie ...*ies.IE) *DeletePDPContextRequest

NewDeletePDPContextRequest creates a new GTPv1 DeletePDPContextRequest.

func ParseDeletePDPContextRequest added in v0.4.2

func ParseDeletePDPContextRequest(b []byte) (*DeletePDPContextRequest, error)

ParseDeletePDPContextRequest decodes a given byte sequence as a DeletePDPContextRequest.

func (*DeletePDPContextRequest) DecodeFromBytes

func (d *DeletePDPContextRequest) DecodeFromBytes(b []byte) error

DecodeFromBytes decodes bytes as DeletePDPContextRequest.

DEPRECATED: use DeletePDPContextRequest.UnmarshalBinary instead.

func (*DeletePDPContextRequest) Len

func (d *DeletePDPContextRequest) Len() int

Len returns the actual length of DeletePDPContextRequest.

DEPRECATED: use DeletePDPContextRequest.MarshalLen instead.

func (*DeletePDPContextRequest) Marshal added in v0.4.2

func (d *DeletePDPContextRequest) Marshal() ([]byte, error)

Marshal returns the byte sequence generated from a DeletePDPContextRequest.

func (*DeletePDPContextRequest) MarshalLen added in v0.4.2

func (d *DeletePDPContextRequest) MarshalLen() int

MarshalLen returns the serial length of Data.

func (*DeletePDPContextRequest) MarshalTo added in v0.4.2

func (d *DeletePDPContextRequest) MarshalTo(b []byte) error

MarshalTo puts the byte sequence in the byte array given as b.

func (*DeletePDPContextRequest) MessageTypeName

func (d *DeletePDPContextRequest) MessageTypeName() string

MessageTypeName returns the name of protocol.

func (*DeletePDPContextRequest) Serialize

func (d *DeletePDPContextRequest) Serialize() ([]byte, error)

Serialize serializes DeletePDPContextRequest into bytes.

DEPRECATED: use DeletePDPContextRequest.Marshal instead.

func (*DeletePDPContextRequest) SerializeTo

func (d *DeletePDPContextRequest) SerializeTo(b []byte) error

SerializeTo serializes DeletePDPContextRequest into bytes given as b.

DEPRECATED: use DeletePDPContextRequest.MarshalTo instead.

func (*DeletePDPContextRequest) SetLength

func (d *DeletePDPContextRequest) SetLength()

SetLength sets the length in Length field.

func (*DeletePDPContextRequest) TEID

func (d *DeletePDPContextRequest) TEID() uint32

TEID returns the TEID in human-readable string.

func (*DeletePDPContextRequest) UnmarshalBinary added in v0.4.2

func (d *DeletePDPContextRequest) UnmarshalBinary(b []byte) error

UnmarshalBinary decodes a given byte sequence as a DeletePDPContextRequest.

type DeletePDPContextResponse

type DeletePDPContextResponse struct {
	*Header
	Cause            *ies.IE
	PCO              *ies.IE
	ULI              *ies.IE
	MSTimeZone       *ies.IE
	ULITimestamp     *ies.IE
	PrivateExtension *ies.IE
	AdditionalIEs    []*ies.IE
}

DeletePDPContextResponse is a DeletePDPContextResponse Header and its IEs above.

func DecodeDeletePDPContextResponse

func DecodeDeletePDPContextResponse(b []byte) (*DeletePDPContextResponse, error)

DecodeDeletePDPContextResponse decodes bytes as DeletePDPContextResponse.

DEPRECATED: use ParseDeletePDPContextResponse instead.

func NewDeletePDPContextResponse

func NewDeletePDPContextResponse(teid uint32, seq uint16, ie ...*ies.IE) *DeletePDPContextResponse

NewDeletePDPContextResponse creates a new GTPv1 DeletePDPContextResponse.

func ParseDeletePDPContextResponse added in v0.4.2

func ParseDeletePDPContextResponse(b []byte) (*DeletePDPContextResponse, error)

ParseDeletePDPContextResponse decodes a given byte sequence as a DeletePDPContextResponse.

func (*DeletePDPContextResponse) DecodeFromBytes

func (d *DeletePDPContextResponse) DecodeFromBytes(b []byte) error

DecodeFromBytes decodes bytes as DeletePDPContextResponse.

DEPRECATED: use DeletePDPContextResponse.UnmarshalBinary instead.

func (*DeletePDPContextResponse) Len

func (d *DeletePDPContextResponse) Len() int

Len returns the actual length of DeletePDPContextResponse.

DEPRECATED: use DeletePDPContextResponse.MarshalLen instead.

func (*DeletePDPContextResponse) Marshal added in v0.4.2

func (d *DeletePDPContextResponse) Marshal() ([]byte, error)

Marshal returns the byte sequence generated from a DeletePDPContextResponse.

func (*DeletePDPContextResponse) MarshalLen added in v0.4.2

func (d *DeletePDPContextResponse) MarshalLen() int

MarshalLen returns the serial length of Data.

func (*DeletePDPContextResponse) MarshalTo added in v0.4.2

func (d *DeletePDPContextResponse) MarshalTo(b []byte) error

MarshalTo puts the byte sequence in the byte array given as b.

func (*DeletePDPContextResponse) MessageTypeName

func (d *DeletePDPContextResponse) MessageTypeName() string

MessageTypeName returns the name of protocol.

func (*DeletePDPContextResponse) Serialize

func (d *DeletePDPContextResponse) Serialize() ([]byte, error)

Serialize serializes DeletePDPContextResponse into bytes.

DEPRECATED: use DeletePDPContextResponse.Marshal instead.

func (*DeletePDPContextResponse) SerializeTo

func (d *DeletePDPContextResponse) SerializeTo(b []byte) error

SerializeTo serializes DeletePDPContextResponse into bytes given as b.

DEPRECATED: use DeletePDPContextResponse.MarshalTo instead.

func (*DeletePDPContextResponse) SetLength

func (d *DeletePDPContextResponse) SetLength()

SetLength sets the length in Length field.

func (*DeletePDPContextResponse) TEID

func (d *DeletePDPContextResponse) TEID() uint32

TEID returns the TEID in human-readable string.

func (*DeletePDPContextResponse) UnmarshalBinary added in v0.4.2

func (d *DeletePDPContextResponse) UnmarshalBinary(b []byte) error

UnmarshalBinary decodes a given byte sequence as a DeletePDPContextResponse.

type EchoRequest

type EchoRequest struct {
	*Header
	PrivateExtension *ies.IE
	AdditionalIEs    []*ies.IE
}

EchoRequest is a EchoRequest Header and its IEs above.

func DecodeEchoRequest

func DecodeEchoRequest(b []byte) (*EchoRequest, error)

DecodeEchoRequest decodes bytes as EchoRequest.

DEPRECATED: use ParseEchoRequest instead.

func NewEchoRequest

func NewEchoRequest(seq uint16, ie ...*ies.IE) *EchoRequest

NewEchoRequest creates a new GTP.

func ParseEchoRequest added in v0.4.2

func ParseEchoRequest(b []byte) (*EchoRequest, error)

ParseEchoRequest decodes a given byte sequence as a EchoRequest.

func (*EchoRequest) DecodeFromBytes

func (e *EchoRequest) DecodeFromBytes(b []byte) error

DecodeFromBytes decodes bytes as EchoRequest.

DEPRECATED: use EchoRequest.UnmarshalBinary instead.

func (*EchoRequest) Len

func (e *EchoRequest) Len() int

Len returns the actual length of EchoRequest.

DEPRECATED: use EchoRequest.MarshalLen instead.

func (*EchoRequest) Marshal added in v0.4.2

func (e *EchoRequest) Marshal() ([]byte, error)

Marshal returns the byte sequence generated from a EchoRequest.

func (*EchoRequest) MarshalLen added in v0.4.2

func (e *EchoRequest) MarshalLen() int

MarshalLen returns the serial length of Data.

func (*EchoRequest) MarshalTo added in v0.4.2

func (e *EchoRequest) MarshalTo(b []byte) error

MarshalTo puts the byte sequence in the byte array given as b.

func (*EchoRequest) MessageTypeName

func (e *EchoRequest) MessageTypeName() string

MessageTypeName returns the name of protocol.

func (*EchoRequest) Serialize

func (e *EchoRequest) Serialize() ([]byte, error)

Serialize serializes EchoRequest into bytes.

DEPRECATED: use EchoRequest.Marshal instead.

func (*EchoRequest) SerializeTo

func (e *EchoRequest) SerializeTo(b []byte) error

SerializeTo serializes EchoRequest into bytes given as b.

DEPRECATED: use EchoRequest.MarshalTo instead.

func (*EchoRequest) SetLength

func (e *EchoRequest) SetLength()

SetLength sets the length in Length field.

func (*EchoRequest) TEID

func (e *EchoRequest) TEID() uint32

TEID returns the TEID in human-readable string.

func (*EchoRequest) UnmarshalBinary added in v0.4.2

func (e *EchoRequest) UnmarshalBinary(b []byte) error

UnmarshalBinary decodes a given byte sequence as a EchoRequest.

type EchoResponse

type EchoResponse struct {
	*Header
	Recovery         *ies.IE
	PrivateExtension *ies.IE
	AdditionalIEs    []*ies.IE
}

EchoResponse is a EchoResponse Header and its IEs above.

func DecodeEchoResponse

func DecodeEchoResponse(b []byte) (*EchoResponse, error)

DecodeEchoResponse decodes bytes as EchoResponse.

DEPRECATED: use ParseEchoResponse instead.

func NewEchoResponse

func NewEchoResponse(seq uint16, ie ...*ies.IE) *EchoResponse

NewEchoResponse creates a new GTPv1 EchoResponse.

func ParseEchoResponse added in v0.4.2

func ParseEchoResponse(b []byte) (*EchoResponse, error)

ParseEchoResponse decodes a given byte sequence as a EchoResponse.

func (*EchoResponse) DecodeFromBytes

func (e *EchoResponse) DecodeFromBytes(b []byte) error

DecodeFromBytes decodes bytes as EchoResponse.

DEPRECATED: use EchoResponse.UnmarshalBinary instead.

func (*EchoResponse) Len

func (e *EchoResponse) Len() int

Len returns the actual length of EchoResponse.

DEPRECATED: use EchoResponse.MarshalLen instead.

func (*EchoResponse) Marshal added in v0.4.2

func (e *EchoResponse) Marshal() ([]byte, error)

Marshal returns the byte sequence generated from a EchoResponse.

func (*EchoResponse) MarshalLen added in v0.4.2

func (e *EchoResponse) MarshalLen() int

MarshalLen returns the serial length of Data.

func (*EchoResponse) MarshalTo added in v0.4.2

func (e *EchoResponse) MarshalTo(b []byte) error

MarshalTo puts the byte sequence in the byte array given as b.

func (*EchoResponse) MessageTypeName

func (e *EchoResponse) MessageTypeName() string

MessageTypeName returns the name of protocol.

func (*EchoResponse) Serialize

func (e *EchoResponse) Serialize() ([]byte, error)

Serialize serializes EchoResponse into bytes.

DEPRECATED: use EchoResponse.Marshal instead.

func (*EchoResponse) SerializeTo

func (e *EchoResponse) SerializeTo(b []byte) error

SerializeTo serializes EchoResponse into bytes given as b.

DEPRECATED: use EchoResponse.MarshalTo instead.

func (*EchoResponse) SetLength

func (e *EchoResponse) SetLength()

SetLength sets the length in Length field.

func (*EchoResponse) TEID

func (e *EchoResponse) TEID() uint32

TEID returns the TEID in human-readable string.

func (*EchoResponse) UnmarshalBinary added in v0.4.2

func (e *EchoResponse) UnmarshalBinary(b []byte) error

UnmarshalBinary decodes a given byte sequence as a EchoResponse.

type ErrorIndication

type ErrorIndication struct {
	*Header
	TEIDDataI        *ies.IE
	GTPUPeerAddress  *ies.IE
	PrivateExtension *ies.IE
	AdditionalIEs    []*ies.IE
}

ErrorIndication is a ErrorIndication Header and its IEs above.

func DecodeErrorIndication

func DecodeErrorIndication(b []byte) (*ErrorIndication, error)

DecodeErrorIndication decodes bytes as ErrorIndication.

DEPRECATED: use ParseErrorIndication instead.

func NewErrorIndication

func NewErrorIndication(teid uint32, seq uint16, ie ...*ies.IE) *ErrorIndication

NewErrorIndication creates a new GTPv1 NewErrorIndication.

func ParseErrorIndication added in v0.4.2

func ParseErrorIndication(b []byte) (*ErrorIndication, error)

ParseErrorIndication decodes a given byte sequence as a ErrorIndication.

func (*ErrorIndication) DecodeFromBytes

func (e *ErrorIndication) DecodeFromBytes(b []byte) error

DecodeFromBytes decodes bytes as ErrorIndication.

DEPRECATED: use ErrorIndication.UnmarshalBinary instead.

func (*ErrorIndication) Len

func (e *ErrorIndication) Len() int

Len returns the actual length of ErrorIndication.

DEPRECATED: use ErrorIndication.MarshalLen instead.

func (*ErrorIndication) Marshal added in v0.4.2

func (e *ErrorIndication) Marshal() ([]byte, error)

Marshal returns the byte sequence generated from a ErrorIndication.

func (*ErrorIndication) MarshalLen added in v0.4.2

func (e *ErrorIndication) MarshalLen() int

MarshalLen returns the serial length of Data.

func (*ErrorIndication) MarshalTo added in v0.4.2

func (e *ErrorIndication) MarshalTo(b []byte) error

MarshalTo puts the byte sequence in the byte array given as b.

func (*ErrorIndication) MessageTypeName

func (e *ErrorIndication) MessageTypeName() string

MessageTypeName returns the name of protocol.

func (*ErrorIndication) Serialize

func (e *ErrorIndication) Serialize() ([]byte, error)

Serialize serializes ErrorIndication into bytes.

DEPRECATED: use ErrorIndication.Marshal instead.

func (*ErrorIndication) SerializeTo

func (e *ErrorIndication) SerializeTo(b []byte) error

SerializeTo serializes ErrorIndication into bytes given as b.

DEPRECATED: use ErrorIndication.MarshalTo instead.

func (*ErrorIndication) SetLength

func (e *ErrorIndication) SetLength()

SetLength sets the length in Length field.

func (*ErrorIndication) TEID

func (e *ErrorIndication) TEID() uint32

TEID returns the TEID in human-readable string.

func (*ErrorIndication) UnmarshalBinary added in v0.4.2

func (e *ErrorIndication) UnmarshalBinary(b []byte) error

UnmarshalBinary decodes a given byte sequence as a ErrorIndication.

type Generic

type Generic struct {
	*Header
	IEs []*ies.IE
}

Generic is a Generic Header and its IEs above. This is for handling a non-implemented type of message.

func DecodeGeneric

func DecodeGeneric(b []byte) (*Generic, error)

DecodeGeneric decodes bytes as Generic.

DEPRECATED: use ParseGeneric instead.

func NewGeneric

func NewGeneric(msgType uint8, teid uint32, seq uint16, ie ...*ies.IE) *Generic

NewGeneric creates a new GTPv1 Generic.

func ParseGeneric added in v0.4.2

func ParseGeneric(b []byte) (*Generic, error)

ParseGeneric decodes a given byte sequence as a Generic.

func (*Generic) AddIE

func (g *Generic) AddIE(ie ...*ies.IE)

AddIE add IEs to Generic type of GTPv2 message and update Length field.

func (*Generic) DecodeFromBytes

func (g *Generic) DecodeFromBytes(b []byte) error

DecodeFromBytes decodes bytes as Generic.

DEPRECATED: use Generic.UnmarshalBinary instead.

func (*Generic) Len

func (g *Generic) Len() int

Len returns the actual length of Generic.

DEPRECATED: use Generic.MarshalLen instead.

func (*Generic) Marshal added in v0.4.2

func (g *Generic) Marshal() ([]byte, error)

Marshal returns the byte sequence generated from a Generic.

func (*Generic) MarshalLen added in v0.4.2

func (g *Generic) MarshalLen() int

MarshalLen returns the serial length of Data.

func (*Generic) MarshalTo added in v0.4.2

func (g *Generic) MarshalTo(b []byte) error

MarshalTo puts the byte sequence in the byte array given as b.

func (*Generic) MessageTypeName

func (g *Generic) MessageTypeName() string

MessageTypeName returns the name of protocol.

func (*Generic) Serialize

func (g *Generic) Serialize() ([]byte, error)

Serialize serializes Generic into bytes.

DEPRECATED: use Generic.Marshal instead.

func (*Generic) SerializeTo

func (g *Generic) SerializeTo(b []byte) error

SerializeTo serializes Generic into bytes given as b.

DEPRECATED: use Generic.MarshalTo instead.

func (*Generic) SetLength

func (g *Generic) SetLength()

SetLength sets the length in Length field.

func (*Generic) TEID

func (g *Generic) TEID() uint32

TEID returns the TEID in human-readable string.

func (*Generic) UnmarshalBinary added in v0.4.2

func (g *Generic) UnmarshalBinary(b []byte) error

UnmarshalBinary decodes a given byte sequence as a Generic.

type Header struct {
	Flags          uint8
	Type           uint8
	Length         uint16
	TEID           uint32
	SequenceNumber uint16
	Reserved       uint16
	Payload        []byte
}

Header is a GTPv1 common header.

func DecodeHeader

func DecodeHeader(b []byte) (*Header, error)

DecodeHeader decodes bytes as Header.

DEPRECATED: use ParseHeader instead.

func NewHeader

func NewHeader(flags, mtype uint8, teid uint32, seqnum uint16, payload []byte) *Header

NewHeader creates a new Header.

func ParseHeader added in v0.4.2

func ParseHeader(b []byte) (*Header, error)

ParseHeader decodes given byte sequence as a GTPv1 header.

func (*Header) DecodeFromBytes

func (h *Header) DecodeFromBytes(b []byte) error

DecodeFromBytes decodes bytes as Header.

DEPRECATED: use Header.UnmarshalBinary instead.

func (*Header) HasSequence

func (h *Header) HasSequence() bool

HasSequence determines whether a GTP Header has TEID inside by checking the flag.

func (*Header) Len

func (h *Header) Len() int

Len returns the actual length of Header.

DEPRECATED: use Header.MarshalLen instead.

func (*Header) Marshal added in v0.4.2

func (h *Header) Marshal() ([]byte, error)

Marshal returns the byte sequence generated from an IE instance.

func (*Header) MarshalLen added in v0.4.2

func (h *Header) MarshalLen() int

MarshalLen returns the serial length of Header.

func (*Header) MarshalTo added in v0.4.2

func (h *Header) MarshalTo(b []byte) error

MarshalTo puts the byte sequence in the byte array given as b.

func (*Header) MessageType

func (h *Header) MessageType() uint8

MessageType returns the type of message.

func (*Header) Sequence

func (h *Header) Sequence() uint16

Sequence returns SequenceNumber in uint16.

func (*Header) Serialize

func (h *Header) Serialize() ([]byte, error)

Serialize serializes Header into bytes.

DEPRECATED: use Header.Marshal instead.

func (*Header) SerializeTo

func (h *Header) SerializeTo(b []byte) error

SerializeTo serializes Header into bytes given as b.

DEPRECATED: use Header.MarshalTo instead.

func (*Header) SetLength

func (h *Header) SetLength()

SetLength sets the length in Length field.

func (*Header) SetSequenceNumber

func (h *Header) SetSequenceNumber(seq uint16)

SetSequenceNumber sets the SequenceNumber in Header.

func (*Header) SetTEID

func (h *Header) SetTEID(teid uint32)

SetTEID sets the TEIDFlag to 1 and puts the TEID given into TEID field.

func (*Header) String

func (h *Header) String() string

String returns the GTPv1 header values in human readable format.

func (*Header) UnmarshalBinary added in v0.4.2

func (h *Header) UnmarshalBinary(b []byte) error

UnmarshalBinary sets the values retrieved from byte sequence in GTPv1 header.

func (*Header) Version

func (h *Header) Version() int

Version returns GTP version in int.

type Message

type Message interface {
	MarshalTo([]byte) error
	UnmarshalBinary(b []byte) error
	MarshalLen() int
	Version() int
	MessageType() uint8
	MessageTypeName() string
	TEID() uint32
	SetTEID(uint32)
	Sequence() uint16
	SetSequenceNumber(uint16)

	// deprecated
	SerializeTo([]byte) error
	DecodeFromBytes(b []byte) error
}

Message is an interface that defines Message messages.

func Decode

func Decode(b []byte) (Message, error)

Decode decodes bytes as Message.

DEPRECATED: use Parse instead.

func Parse added in v0.4.2

func Parse(b []byte) (Message, error)

Parse decodes the given bytes as Message.

type TPDU

type TPDU struct {
	*Header
}

TPDU is a TPDU.

func DecodeTPDU

func DecodeTPDU(b []byte) (*TPDU, error)

DecodeTPDU decodes bytes as TPDU.

DEPRECATED: use ParseTPDU instead.

func NewTPDU

func NewTPDU(teid uint32, payload []byte) *TPDU

NewTPDU creates a new G-PDU message.

func NewTPDUWithSequence

func NewTPDUWithSequence(teid uint32, seq uint16, payload []byte) *TPDU

NewTPDUWithSequence creates a new G-PDU message.

func ParseTPDU added in v0.4.2

func ParseTPDU(b []byte) (*TPDU, error)

ParseTPDU decodes a given byte sequence as a TPDU.

func (*TPDU) Decapsulate

func (t *TPDU) Decapsulate() []byte

Decapsulate returns payload as raw []byte.

func (*TPDU) DecodeFromBytes

func (t *TPDU) DecodeFromBytes(b []byte) error

DecodeFromBytes decodes bytes as TPDU.

DEPRECATED: use TPDU.UnmarshalBinary instead.

func (*TPDU) Len

func (t *TPDU) Len() int

Len returns the actual length of TPDU.

DEPRECATED: use TPDU.MarshalLen instead.

func (*TPDU) Marshal added in v0.4.2

func (t *TPDU) Marshal() ([]byte, error)

Marshal returns the byte sequence generated from a TPDU.

func (*TPDU) MarshalLen added in v0.4.2

func (t *TPDU) MarshalLen() int

MarshalLen returns the serial length of Data.

func (*TPDU) MarshalTo added in v0.4.2

func (t *TPDU) MarshalTo(b []byte) error

MarshalTo puts the byte sequence in the byte array given as b.

func (*TPDU) MessageTypeName

func (t *TPDU) MessageTypeName() string

MessageTypeName returns the name of protocol.

func (*TPDU) Serialize

func (t *TPDU) Serialize() ([]byte, error)

Serialize serializes TPDU into bytes.

DEPRECATED: use TPDU.Marshal instead.

func (*TPDU) SerializeTo

func (t *TPDU) SerializeTo(b []byte) error

SerializeTo serializes TPDU into bytes given as b.

DEPRECATED: use TPDU.MarshalTo instead.

func (*TPDU) SetLength

func (t *TPDU) SetLength()

SetLength sets the length in Length field.

func (*TPDU) TEID

func (t *TPDU) TEID() uint32

TEID returns the TEID in human-readable string.

func (*TPDU) UnmarshalBinary added in v0.4.2

func (t *TPDU) UnmarshalBinary(b []byte) error

UnmarshalBinary decodes a given byte sequence as a TPDU.

type UpdatePDPContextRequest

type UpdatePDPContextRequest struct {
	*Header
	IMSI                                 *ies.IE
	RAI                                  *ies.IE
	Recovery                             *ies.IE
	TEIDDataI                            *ies.IE
	TEIDCPlane                           *ies.IE
	NSAPI                                *ies.IE
	TraceReference                       *ies.IE
	TraceType                            *ies.IE
	PCO                                  *ies.IE
	SGSNAddressForCPlane                 *ies.IE
	SGSNAddressForUserTraffic            *ies.IE
	AlternativeSGSNAddressForCPlane      *ies.IE
	AlternativeSGSNAddressForUserTraffic *ies.IE
	QoSProfile                           *ies.IE
	TFT                                  *ies.IE
	TriggerID                            *ies.IE
	OMCIdentity                          *ies.IE
	CommonFlags                          *ies.IE
	RATType                              *ies.IE
	ULI                                  *ies.IE
	MSTimeZone                           *ies.IE
	AdditionalTraceInfo                  *ies.IE
	DirectTunnelFlags                    *ies.IE
	EvolvedARPI                          *ies.IE
	ExtendedCommonFlags                  *ies.IE
	UCI                                  *ies.IE
	APNAMBR                              *ies.IE
	SignallingPriorityIndication         *ies.IE
	CNOperatorSelectionEntity            *ies.IE
	IMEI                                 *ies.IE
	PrivateExtension                     *ies.IE
	AdditionalIEs                        []*ies.IE
}

UpdatePDPContextRequest is a UpdatePDPContextRequest Header and its IEs above.

func DecodeUpdatePDPContextRequest

func DecodeUpdatePDPContextRequest(b []byte) (*UpdatePDPContextRequest, error)

DecodeUpdatePDPContextRequest decodes bytes as UpdatePDPContextRequest.

DEPRECATED: use ParseUpdatePDPContextRequest instead.

func NewUpdatePDPContextRequest

func NewUpdatePDPContextRequest(teid uint32, seq uint16, ie ...*ies.IE) *UpdatePDPContextRequest

NewUpdatePDPContextRequest creates a new GTPv1 UpdatePDPContextRequest.

func ParseUpdatePDPContextRequest added in v0.4.2

func ParseUpdatePDPContextRequest(b []byte) (*UpdatePDPContextRequest, error)

ParseUpdatePDPContextRequest decodes a given byte sequence as a UpdatePDPContextRequest.

func (*UpdatePDPContextRequest) DecodeFromBytes

func (u *UpdatePDPContextRequest) DecodeFromBytes(b []byte) error

DecodeFromBytes decodes bytes as UpdatePDPContextRequest.

DEPRECATED: use UpdatePDPContextRequest.UnmarshalBinary instead.

func (*UpdatePDPContextRequest) Len

func (u *UpdatePDPContextRequest) Len() int

Len returns the actual length of UpdatePDPContextRequest.

DEPRECATED: use UpdatePDPContextRequest.MarshalLen instead.

func (*UpdatePDPContextRequest) Marshal added in v0.4.2

func (u *UpdatePDPContextRequest) Marshal() ([]byte, error)

Marshal returns the byte sequence generated from a UpdatePDPContextRequest.

func (*UpdatePDPContextRequest) MarshalLen added in v0.4.2

func (u *UpdatePDPContextRequest) MarshalLen() int

MarshalLen returns the serial length of Data.

func (*UpdatePDPContextRequest) MarshalTo added in v0.4.2

func (u *UpdatePDPContextRequest) MarshalTo(b []byte) error

MarshalTo puts the byte sequence in the byte array given as b.

func (*UpdatePDPContextRequest) MessageTypeName

func (u *UpdatePDPContextRequest) MessageTypeName() string

MessageTypeName returns the name of protocol.

func (*UpdatePDPContextRequest) Serialize

func (u *UpdatePDPContextRequest) Serialize() ([]byte, error)

Serialize serializes UpdatePDPContextRequest into bytes.

DEPRECATED: use UpdatePDPContextRequest.Marshal instead.

func (*UpdatePDPContextRequest) SerializeTo

func (u *UpdatePDPContextRequest) SerializeTo(b []byte) error

SerializeTo serializes UpdatePDPContextRequest into bytes given as b.

DEPRECATED: use UpdatePDPContextRequest.MarshalTo instead.

func (*UpdatePDPContextRequest) SetLength

func (u *UpdatePDPContextRequest) SetLength()

SetLength sets the length in Length field.

func (*UpdatePDPContextRequest) TEID

func (u *UpdatePDPContextRequest) TEID() uint32

TEID returns the TEID in human-readable string.

func (*UpdatePDPContextRequest) UnmarshalBinary added in v0.4.2

func (u *UpdatePDPContextRequest) UnmarshalBinary(b []byte) error

UnmarshalBinary decodes a given byte sequence as a UpdatePDPContextRequest.

type UpdatePDPContextResponse

type UpdatePDPContextResponse struct {
	*Header
	Cause                         *ies.IE
	Recovery                      *ies.IE
	TEIDDataI                     *ies.IE
	TEIDCPlane                    *ies.IE
	ChargingID                    *ies.IE
	PCO                           *ies.IE
	GGSNAddressForCPlane          *ies.IE
	GGSNAddressForUserTraffic     *ies.IE
	AltGGSNAddressForCPlane       *ies.IE
	AltGGSNAddressForUserTraffic  *ies.IE
	QoSProfile                    *ies.IE
	ChargingGatewayAddress        *ies.IE
	AltChargingGatewayAddress     *ies.IE
	CommonFlags                   *ies.IE
	APNRestriction                *ies.IE
	BearerControlMode             *ies.IE
	MSInfoChangeReportingAction   *ies.IE
	EvolvedARPI                   *ies.IE
	CSGInformationReportingAction *ies.IE
	APNAMBR                       *ies.IE
	PrivateExtension              *ies.IE
	AdditionalIEs                 []*ies.IE
}

UpdatePDPContextResponse is a UpdatePDPContextResponse Header and its IEs above.

func DecodeUpdatePDPContextResponse

func DecodeUpdatePDPContextResponse(b []byte) (*UpdatePDPContextResponse, error)

DecodeUpdatePDPContextResponse decodes bytes as UpdatePDPContextResponse.

DEPRECATED: use ParseUpdatePDPContextResponse instead.

func NewUpdatePDPContextResponse

func NewUpdatePDPContextResponse(teid uint32, seq uint16, ie ...*ies.IE) *UpdatePDPContextResponse

NewUpdatePDPContextResponse creates a new GTPv1 UpdatePDPContextResponse.

func ParseUpdatePDPContextResponse added in v0.4.2

func ParseUpdatePDPContextResponse(b []byte) (*UpdatePDPContextResponse, error)

ParseUpdatePDPContextResponse decodes a given byte sequence as a UpdatePDPContextResponse.

func (*UpdatePDPContextResponse) DecodeFromBytes

func (u *UpdatePDPContextResponse) DecodeFromBytes(b []byte) error

DecodeFromBytes decodes bytes as UpdatePDPContextResponse.

DEPRECATED: use UpdatePDPContextResponse.UnmarshalBinary instead.

func (*UpdatePDPContextResponse) Len

func (u *UpdatePDPContextResponse) Len() int

Len returns the actual length of UpdatePDPContextResponse.

DEPRECATED: use UpdatePDPContextResponse.MarshalLen instead.

func (*UpdatePDPContextResponse) Marshal added in v0.4.2

func (u *UpdatePDPContextResponse) Marshal() ([]byte, error)

Marshal returns the byte sequence generated from a UpdatePDPContextResponse.

func (*UpdatePDPContextResponse) MarshalLen added in v0.4.2

func (u *UpdatePDPContextResponse) MarshalLen() int

MarshalLen returns the serial length of Data.

func (*UpdatePDPContextResponse) MarshalTo added in v0.4.2

func (u *UpdatePDPContextResponse) MarshalTo(b []byte) error

MarshalTo puts the byte sequence in the byte array given as b.

func (*UpdatePDPContextResponse) MessageTypeName

func (u *UpdatePDPContextResponse) MessageTypeName() string

MessageTypeName returns the name of protocol.

func (*UpdatePDPContextResponse) Serialize

func (u *UpdatePDPContextResponse) Serialize() ([]byte, error)

Serialize serializes UpdatePDPContextResponse into bytes.

DEPRECATED: use UpdatePDPContextResponse.Marshal instead.

func (*UpdatePDPContextResponse) SerializeTo

func (u *UpdatePDPContextResponse) SerializeTo(b []byte) error

SerializeTo serializes UpdatePDPContextResponse into bytes given as b.

DEPRECATED: use UpdatePDPContextResponse.MarshalTo instead.

func (*UpdatePDPContextResponse) SetLength

func (u *UpdatePDPContextResponse) SetLength()

SetLength sets the length in Length field.

func (*UpdatePDPContextResponse) TEID

func (u *UpdatePDPContextResponse) TEID() uint32

TEID returns the TEID in human-readable string.

func (*UpdatePDPContextResponse) UnmarshalBinary added in v0.4.2

func (u *UpdatePDPContextResponse) UnmarshalBinary(b []byte) error

UnmarshalBinary decodes a given byte sequence as a UpdatePDPContextResponse.

type VersionNotSupported

type VersionNotSupported struct {
	*Header
	AdditionalIEs []*ies.IE
}

VersionNotSupported is a VersionNotSupported Header and its IEs above.

func DecodeVersionNotSupported

func DecodeVersionNotSupported(b []byte) (*VersionNotSupported, error)

DecodeVersionNotSupported decodes bytes as VersionNotSupported.

DEPRECATED: use ParseVersionNotSupported instead.

func NewVersionNotSupported

func NewVersionNotSupported(teid uint32, seq uint16, ie ...*ies.IE) *VersionNotSupported

NewVersionNotSupported creates a new GTPv1 VersionNotSupported.

func ParseVersionNotSupported added in v0.4.2

func ParseVersionNotSupported(b []byte) (*VersionNotSupported, error)

ParseVersionNotSupported decodes a given byte sequence as a VersionNotSupported.

func (*VersionNotSupported) DecodeFromBytes

func (v *VersionNotSupported) DecodeFromBytes(b []byte) error

DecodeFromBytes decodes bytes as VersionNotSupported.

DEPRECATED: use VersionNotSupported.UnmarshalBinary instead.

func (*VersionNotSupported) Len

func (v *VersionNotSupported) Len() int

Len returns the actual length of VersionNotSupported.

DEPRECATED: use VersionNotSupported.MarshalLen instead.

func (*VersionNotSupported) Marshal added in v0.4.2

func (v *VersionNotSupported) Marshal() ([]byte, error)

Marshal returns the byte sequence generated from a VersionNotSupported.

func (*VersionNotSupported) MarshalLen added in v0.4.2

func (v *VersionNotSupported) MarshalLen() int

MarshalLen returns the serial length of Data.

func (*VersionNotSupported) MarshalTo added in v0.4.2

func (v *VersionNotSupported) MarshalTo(b []byte) error

MarshalTo puts the byte sequence in the byte array given as b.

func (*VersionNotSupported) MessageTypeName

func (v *VersionNotSupported) MessageTypeName() string

MessageTypeName returns the name of protocol.

func (*VersionNotSupported) Serialize

func (v *VersionNotSupported) Serialize() ([]byte, error)

Serialize serializes VersionNotSupported into bytes.

DEPRECATED: use VersionNotSupported.Marshal instead.

func (*VersionNotSupported) SerializeTo

func (v *VersionNotSupported) SerializeTo(b []byte) error

SerializeTo serializes VersionNotSupported into bytes given as b.

DEPRECATED: use VersionNotSupported.MarshalTo instead.

func (*VersionNotSupported) SetLength

func (v *VersionNotSupported) SetLength()

SetLength sets the length in Length field.

func (*VersionNotSupported) TEID

func (v *VersionNotSupported) TEID() uint32

TEID returns the TEID in human-readable string.

func (*VersionNotSupported) UnmarshalBinary added in v0.4.2

func (v *VersionNotSupported) UnmarshalBinary(b []byte) error

UnmarshalBinary decodes a given byte sequence as a VersionNotSupported.

Jump to

Keyboard shortcuts

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