prototcp

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: 7 Imported by: 1

Documentation

Overview

Package prototcp implements the TCPROS protocol.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

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

Conn is a TCPROS connection.

func NewClient

func NewClient(address string) (*Conn, error)

NewClient connects to a TCPROS server and returns a Conn.

func NewClientContext

func NewClientContext(ctx context.Context, address string) (*Conn, error)

NewClientContext connects to a TCPROS server and returns a Conn. It allows to set a context that can be used to terminate the function.

func (*Conn) Close

func (c *Conn) Close() error

Close closes the connection.

func (*Conn) NetConn

func (c *Conn) NetConn() net.Conn

NetConn returns the underlying net.Conn.

func (*Conn) ReadHeaderRaw

func (c *Conn) ReadHeaderRaw() (protocommon.HeaderRaw, error)

ReadHeaderRaw reads an HeaderRaw.

func (*Conn) ReadMessage

func (c *Conn) ReadMessage(msg interface{}, timeout bool) error

ReadMessage reads a message.

func (*Conn) ReadServiceResponse

func (c *Conn) ReadServiceResponse(msg interface{}) (bool, error)

ReadServiceResponse reads the response of a service request.

func (*Conn) WriteHeader

func (c *Conn) WriteHeader(header protocommon.Header) error

WriteHeader writes an header.

func (*Conn) WriteMessage

func (c *Conn) WriteMessage(msg interface{}) error

WriteMessage writes a message.

func (*Conn) WriteServiceResponse

func (c *Conn) WriteServiceResponse(state bool, res interface{}) error

WriteServiceResponse writes the response of a service request.

type HeaderError

type HeaderError struct {
	Error string
}

HeaderError is the header returned in case of errors.

type HeaderPublisher

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

HeaderPublisher is a publisher header.

type HeaderServiceClient

type HeaderServiceClient struct {
	Callerid   string
	Md5sum     string
	Service    string
	Persistent int
}

HeaderServiceClient is a service client header.

type HeaderServiceProvider

type HeaderServiceProvider struct {
	Callerid     string
	Md5sum       string
	RequestType  string
	ResponseType string
	Type         string
}

HeaderServiceProvider is a service provider event.

type HeaderSubscriber

type HeaderSubscriber struct {
	Callerid          string
	Topic             string
	Type              string
	Md5sum            string
	MessageDefinition string
	TcpNodelay        int //nolint:revive
}

HeaderSubscriber is a subscriber header.

type Server

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

Server is a TCPROS server.

func NewServer

func NewServer(address string, nodeIP net.IP, nodeZone string) (*Server, error)

NewServer allocates a Server.

func (*Server) Accept

func (s *Server) Accept() (*Conn, error)

Accept accepts clients.

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) URL

func (s *Server) URL() string

URL returns the server URL.

Jump to

Keyboard shortcuts

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