protoudp

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2022 License: MIT Imports: 5 Imported by: 1

Documentation

Overview

Package protoudp implements the UDPROS protocol.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Frame

type Frame struct {
	ConnectionID uint32
	Opcode       Opcode
	MessageID    uint8
	BlockID      uint16
	Payload      []byte
}

Frame is a UDPROS frame.

func FramesForPayload

func FramesForPayload(connID uint32, messageID uint8, payload []byte) []*Frame

FramesForPayload generates frames for the given payload.

type HeaderPublisher

type HeaderPublisher struct {
	Callerid          string
	Topic             string
	Type              string
	Md5sum            string
	MessageDefinition string
}

HeaderPublisher is a publisher header.

type HeaderSubscriber

type HeaderSubscriber struct {
	Callerid          string
	Topic             string
	Type              string
	Md5sum            string
	MessageDefinition string
}

HeaderSubscriber is a subscriber header.

type Opcode

type Opcode uint8

Opcode is the opcode of a Frame.

const (
	Data0 Opcode = 0
	DataN Opcode = 1
	Ping  Opcode = 2
	Error Opcode = 3
)

Standard opcodes.

type Server

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

Server is a UDPROS server.

func NewServer

func NewServer(address string) (*Server, error)

NewServer allocates a Server.

func (*Server) Close

func (s *Server) Close() error

Close closes the server.

func (*Server) Port

func (s *Server) Port() int

Port returns the server port.

func (*Server) ReadFrame

func (s *Server) ReadFrame() (*Frame, *net.UDPAddr, error)

ReadFrame reads a frame.

func (*Server) WriteFrame

func (s *Server) WriteFrame(f *Frame, dest *net.UDPAddr) error

WriteFrame writes a frame.

func (*Server) WriteMessage

func (s *Server) WriteMessage(pubID int, messageID uint8, msg interface{}, dest *net.UDPAddr) error

WriteMessage writes a message.

Jump to

Keyboard shortcuts

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