package abstract
import "github.com/hlandau/parazmq/abstract"
Index ¶
- Constants
- func DeserializeCommand(d []byte) (cmdName string, cmdData []byte, err error)
- func DeserializeError(cmdData []byte) string
- func FCReceiveCommand(rs FrameConn) (cmdName string, cmdData []byte, err error)
- func FCSendCommand(rs FrameConn, cmdName string, cmdData []byte) error
- func FCSendErrorCommand(rs FrameConn, errMsg string) error
- func FCSendMessage(rs FrameConn, msg [][]byte) error
- func SerializeCommand(cmdName string, cmdData []byte) []byte
- type FrameConn
- type ZMTPFlags
- type ZMTPVersion
Constants ¶
const ( ZF_None ZMTPFlags = 0 ZF_More = 1 << 0 // Set if the frame is not the last frame in the message. ZF_Command = 1 << 2 // Set if the frame is a command. )
Functions ¶
func DeserializeCommand ¶
Deserializes command message data into the command name and command data.
func DeserializeError ¶
Deserializes error message data into the error message string.
func FCReceiveCommand ¶
Receives a command message from a FrameConn. The command message is deserialized and the command name and command data are returned.
If the next frame received from the FrameConn is not a command, an error occurs.
func FCSendCommand ¶
Sends a command message. A command message is a single frame with the command bit set, with the frame data being the serialization of the tuple (cmdName, cmdData) as defined in the ZMTP specification. cmdName shall be a string between 1 and 255 bytes in length inclusive. cmdData shall be a sequence of zero or more bytes.
func FCSendErrorCommand ¶
Sends an error message. An error message is a command message with a command name of "ERROR" and command data encoding an error message string as specified in the ZMTP specification.
func FCSendMessage ¶
Sends a message. A message is either a sequence of one or more frames, none of which have the command bit set, or exactly one frame with the command bit set. This function is used to send a non-command message. A message may not consist of zero frames. If zero frames are passed, this function does nothing.
func SerializeCommand ¶
Serializes the (cmdName, cmdData) tuple as specified by the ZMTP specification.
Types ¶
type FrameConn ¶
type FrameConn interface { // Closes the FrameConn. If this FrameConn has an underlying FrameConn, // it shall be considered to own that FrameConn and so will close it as well. Close() error // Send a ZMTP frame across the connection. SendFrame(data []byte, flags ZMTPFlags) error // Receive a ZMTP frame from the connection. ReceiveFrame() ([]byte, ZMTPFlags, error) // Gets the remote metadata, if any. RemoteMetadata() map[string]string }
An ordered bidirectional reliable frame stream. A frame is a sequence of zero or more bytes plus the two metadata bits 'More' and 'Command'.
type ZMTPFlags ¶
type ZMTPFlags byte
Flags used by the ZMTP framing protocol.
func (ZMTPFlags) SendValid ¶
Are the flags valid for an outgoing frame?
func (ZMTPFlags) Valid ¶
Are the flags valid?
type ZMTPVersion ¶
type ZMTPVersion uint
const ( ZMTP3_0 ZMTPVersion = 0x0300 ZMTP3_1 = 0x0301 )
Source Files ¶
- Version
- v0.0.0-20210323063629-d55c8d2d05c8 (latest)
- Published
- Mar 23, 2021
- Platform
- linux/amd64
- Imports
- 1 packages
- Last checked
- 1 month ago –
Tools for package owners.