packet

package
v0.0.0-...-6fdabb0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const ASSIGNED_CLIENT_IDENTIFIER = 0x12
View Source
const AUTHENTICATION_DATA = 0x16
View Source
const AUTHENTICATION_METHOD = 0x15
View Source
const CONNECT_OK = 0

connect response

View Source
const CONTENT_TYPE = 0x03
View Source
const CORRELATION_DATA = 0x09
View Source
const MALFORMED_PACKET = 0x81
View Source
const MAXIMUM_PACKET_SIZE = 0x27
View Source
const MAXIMUM_QOS = 0x24
View Source
const MESSAGE_EXPIRY_INTERVAL = 0x02
View Source
const PACKET_MAX_SIZE = 65000
View Source
const PACKET_TYPE_CONNACK = 2
View Source
const PACKET_TYPE_CONNECT = 1
View Source
const PACKET_TYPE_DISCONNECT = 14
View Source
const PACKET_TYPE_PINGREQ = 12
View Source
const PACKET_TYPE_PINGRES = 13
View Source
const PACKET_TYPE_PUBACK = 4
View Source
const PACKET_TYPE_PUBCOMP = 7
View Source
const PACKET_TYPE_PUBLISH = 3
View Source
const PACKET_TYPE_PUBREC = 5
View Source
const PACKET_TYPE_PUBREL = 6
View Source
const PACKET_TYPE_SUBACK = 9
View Source
const PACKET_TYPE_SUBSCRIBE = 8
View Source
const PACKET_TYPE_UNSUBACK = 11
View Source
const PACKET_TYPE_UNSUBSCRIBE = 10
View Source
const PAYLOAD_FORMAT_INDICATOR = 0x01
View Source
const PUBACK_NOT_AUTHORIZED = 0x87
View Source
const PUBACK_NO_MATCHING_SUBSCRIBERS = 0x10
View Source
const PUBACK_SUCCESS = 0x00

publish ack in QoS 1

View Source
const PUBCOMP_SUCCESS = 0x00

publish in QoS 2

View Source
const PUBREC_NOT_AUTHORIZED = 0x87
View Source
const PUBREC_SUCCESS = 0x00
View Source
const PUBREL_SUCCESS = 0x00
View Source
const REASON_STRING = 0x1F
View Source
const RECEIVE_MAXIMUM = 0x21
View Source
const REQUEST_PROBLEM_INFORMATION = 0x17
View Source
const REQUEST_RESPONSE_INFORMATION = 0x19
View Source
const RESPONSE_INFORMATION = 0x1A
View Source
const RESPONSE_TOPIC = 0x08
View Source
const RETAIN_AVAILABLE = 0x25
View Source
const SERVER_KEEP_ALIVE = 0x13
View Source
const SERVER_REFERENCE = 0x1C
View Source
const SESSION_EXPIRY_INTERVAL = 0x11
View Source
const SESSION_TAKEN_OVER = 0x8E
View Source
const SHARED_SUBSCRIPTION_AVAILABLE = 0x2A
View Source
const SUBSCRIPTION_IDENTIFIER = 0x0B
View Source
const SUBSCRIPTION_IDENTIFIER_AVAILABLE = 0x29
View Source
const TOPIC_ALIAS = 0x23
View Source
const TOPIC_ALIAS_MAXIMUM = 0x22
View Source
const UNSPECIFIED_ERROR = 0x80
View Source
const UNSUPPORTED_PROTOCOL_VERSION = 0x84
View Source
const USER_PROPERTY = 0x26
View Source
const WILDCARD_SUBSCRIPTION_AVAILABLE = 0x28
View Source
const WILL_DELAY_INTERVAL = 0x18

Variables

This section is empty.

Functions

func NewPacketIdentifier

func NewPacketIdentifier() int

func Read2BytesInt

func Read2BytesInt(a []byte, i int) int

func Read4BytesInt

func Read4BytesInt(a []byte) uint32

func ReadFromByteSlice

func ReadFromByteSlice(buff []byte) ([]byte, error)

func ReadVarInt

func ReadVarInt(props []byte) (int, int, error)

func Write2BytesInt

func Write2BytesInt(i int) []byte

func WriteVarInt

func WriteVarInt(x int) []byte

Types

type Packet

type Packet struct {

	// CONNACK, PUBACK, PUBREC, PUBREL, PUBCOMP, DISCONNECT
	ReasonCode uint8

	// metadata
	Subscriptions []model.Subscription
	Topic         string
	// contains filtered or unexported fields
}

func Connack

func Connack(sessionPresent bool, ReasonCode uint8, protocolVersion uint8) Packet

func Connect

func Connect() Packet

ATTENTION: partial implementation only for testing

func PacketParse

func PacketParse(session *model.RunningSession, buf []byte) (Packet, error)

func PingResp

func PingResp() Packet

func Puback

func Puback(packetIdentifier int, ReasonCode uint8, protocolVersion uint8) Packet

func Pubcomp

func Pubcomp(packetIdentifier int, ReasonCode uint8, protocolVersion uint8) Packet

func Publish

func Publish(protocolVersion uint8, qos uint8, retain bool, topic string, packetIdentifier int, payload []byte) Packet

func Pubrec

func Pubrec(packetIdentifier int, ReasonCode uint8, protocolVersion uint8) Packet

func Pubrel

func Pubrel(packetIdentifier int, ReasonCode uint8, protocolVersion uint8) Packet

func Start

func Start(buff []byte) (Packet, error)

func Suback

func Suback(packetIdentifier int, ReasonCodes []uint8, protocolVersion uint8) Packet

func Unsuback

func Unsuback(packetIdentifier int, ReasonCodes []uint8, protocolVersion uint8) Packet

func (*Packet) ApplicationMessage

func (p *Packet) ApplicationMessage() []byte

func (*Packet) CompletePacket

func (p *Packet) CompletePacket(buff []byte) int

func (*Packet) Dup

func (p *Packet) Dup() bool

func (*Packet) Flags

func (p *Packet) Flags() byte

func (*Packet) PacketComplete

func (p *Packet) PacketComplete() bool

func (*Packet) PacketIdentifier

func (p *Packet) PacketIdentifier() int

func (*Packet) PacketLength

func (p *Packet) PacketLength() int

func (*Packet) PacketType

func (p *Packet) PacketType() byte

func (*Packet) Parse

func (p *Packet) Parse(session *model.RunningSession) int

func (*Packet) Payload

func (p *Packet) Payload() []byte

func (*Packet) PublishTopic

func (p *Packet) PublishTopic() []byte

func (*Packet) QoS

func (p *Packet) QoS() byte

func (*Packet) RemainingBytes

func (p *Packet) RemainingBytes() []byte

func (*Packet) Retain

func (p *Packet) Retain() bool

func (*Packet) SessionExpiryInterval

func (p *Packet) SessionExpiryInterval() int64

func (*Packet) ToByteSlice

func (p *Packet) ToByteSlice() []byte

type Properties

type Properties map[int]Property

type Property

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

Jump to

Keyboard shortcuts

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