model

package
v0.0.0-...-297abb6 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2022 License: BSD-2-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CONNECT     = 1 << 4
	CONNACK     = 2 << 4
	PUBLISH     = 3 << 4
	PUBACK      = 4 << 4
	PUBREC      = 5 << 4
	PUBREL      = 6 << 4
	PUBCOMP     = 7 << 4
	SUBSCRIBE   = 8 << 4
	SUBACK      = 9 << 4
	UNSUBSCRIBE = 10 << 4
	UNSUBACK    = 11 << 4
	PINGREQ     = 12 << 4
	PINGRESP    = 13 << 4
	DISCONNECT  = 14 << 4

	PUBRELSend = PUBREL | 2
)

Control Packets

View Source
const (
	NormalDisconnection             = 0
	DisconnectWithWill              = 4
	UnspecifiedError                = 128
	MalformedPacket                 = 129
	ProtocolError                   = 130
	UnsupportedProtocolVersion      = 132
	NotAuthorized                   = 135
	ServerShuttingDown              = 139
	KeepAliveTimeout                = 141
	SessionTakenOver                = 142
	PayloadFormatInvalid            = 153
	SharedSubscriptionsNotSupported = 158
)

Reason Codes

View Source
const (
	PayloadFormatIndicator     = 1
	MessageExpiryInterval      = 2
	ContentType                = 3
	ResponseTopic              = 8
	CorrelationData            = 9
	SubscriptionIdentifier     = 11
	SessionExpiryInterval      = 17
	AssignedClientIdentifier   = 18
	ServerKeepAlive            = 19
	AuthenticationMethod       = 21
	AuthenticationData         = 22
	RequestProblemInformation  = 23
	RequestResponseInformation = 25
	ResponseInformation        = 26
	ServerReference            = 28
	ReasonString               = 31
	ReceiveMaximum             = 33
	TopicAliasMaximum          = 34
	TopicAlias                 = 35
	UserProperty               = 38
	MaximumPacketSize          = 39
)

Properties

Variables

This section is empty.

Functions

func LengthToNumberOfVariableLengthBytes

func LengthToNumberOfVariableLengthBytes(l int) int

func VariableLengthEncode

func VariableLengthEncode(packet []byte, l int) []byte

func VariableLengthEncodeNoAlloc

func VariableLengthEncodeNoAlloc(l int, f func(eb byte) error)

Types

type PubMessage

type PubMessage struct {
	Expiry int64

	// flags + topicUTF8 + payload
	// byte 0: publish flags, i.e. DUP, QoS, Retain
	// byte 1: topicUTF8
	// byte 3+topicLen: payload
	B []byte

	Props []byte // Properties to be forwarded as is

	Publisher string // ClientId
	// contains filtered or unexported fields
}

PubMessage represents a PUBLISH packet and its content.

func NewPub

func NewPub(requiredBLen int) (p *PubMessage)

func NewPubOld

func NewPubOld(flags uint8, topicUTF8, payload []byte) (p *PubMessage)

func (*PubMessage) AddUser

func (p *PubMessage) AddUser()

func (*PubMessage) Duplicate

func (p *PubMessage) Duplicate() bool

func (*PubMessage) FreeIfLastUser

func (p *PubMessage) FreeIfLastUser()

func (*PubMessage) RxQoS

func (p *PubMessage) RxQoS() uint8

func (*PubMessage) ToRetain

func (p *PubMessage) ToRetain() bool

Jump to

Keyboard shortcuts

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