tcpmessage

package
v0.0.0-...-84331e2 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	STATUS_PENDING statusRaw = iota
	STATUS_TRANSMITED
	STATUS_DROPPED
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Status

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

func (*Status) SetStatus

func (s *Status) SetStatus(value statusRaw)

func (*Status) Status

func (s *Status) Status() statusRaw

func (*Status) String

func (status *Status) String() string

type TCPMessage

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

func New

func New(transmittionDirection TransmittionDirection, content []byte) *TCPMessage

func (*TCPMessage) Content

func (message *TCPMessage) Content() []byte

func (*TCPMessage) Drop

func (message *TCPMessage) Drop() error

func (*TCPMessage) MarkAsTransmited

func (message *TCPMessage) MarkAsTransmited() error

MarkAsTransmited marks the message as transmited without notifying anobody waiting for transmittion. Use only when nobody is waiting for transmittion. no calls to Transmit/MarkAsTransmited will be possible after this call.

func (*TCPMessage) SetContent

func (message *TCPMessage) SetContent(newContent []byte) error

func (*TCPMessage) String

func (message *TCPMessage) String() string

func (*TCPMessage) Transmit

func (message *TCPMessage) Transmit() error

Transmit marks the packet as transmited and notifies everybody waiting with WaitForTransmittion about the transmittion.

func (*TCPMessage) WaitForTransmittion

func (message *TCPMessage) WaitForTransmittion() (transmit bool)

WaitForTransmittion waits for a signal to transmit. If the signal is true, the message content shall be transmitted. Otherwise, it shall be dropped.

type TransmittionDirection

type TransmittionDirection int
const (
	TRANSMITTION_DIRECTION_TO_SERVER TransmittionDirection = iota
	TRANSMITTION_DIRECTION_TO_CLIENT
)

func (TransmittionDirection) String

func (direction TransmittionDirection) String() string

Jump to

Keyboard shortcuts

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