message

package
v2.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2022 License: Apache-2.0 Imports: 9 Imported by: 3 modules, 7 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMessageTruncated      = errors.New("message is truncated")
	ErrMessageInvalidVersion = errors.New("message has invalid version")
)

Functions

func GetMID

func GetMID() uint16

GetMID generates a message id for UDP-coap

func RandMID added in v2.5.0

func RandMID() uint16

Types

type Message

type Message struct {
	Token   message.Token
	Payload []byte

	Options message.Options //Options must be sorted by ID
	Code    codes.Code

	MessageID uint16
	Type      Type
}

TcpMessage is a CoAP MessageBase that can encode itself for Message transport.

func (Message) Marshal

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

func (Message) MarshalTo

func (m Message) MarshalTo(buf []byte) (int, error)

func (Message) Size

func (m Message) Size() (int, error)

func (*Message) Unmarshal

func (m *Message) Unmarshal(data []byte) (int, error)

type Type

type Type uint8

Type represents the message type. It's only part of CoAP UDP messages. Reliable transports like TCP do not have a type.

const (
	// Confirmable messages require acknowledgements.
	Confirmable Type = 0
	// NonConfirmable messages do not require acknowledgements.
	NonConfirmable Type = 1
	// Acknowledgement is a message indicating a response to confirmable message.
	Acknowledgement Type = 2
	// Reset indicates a permanent negative acknowledgement.
	Reset Type = 3
)

func (Type) String

func (t Type) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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