example

package
v0.0.0-...-4ab5c82 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package example is 100% generated. If you edit this file, you will lose your changes at the next build cycle. DO NOT MAKE ANY CHANGES YOU WISH TO KEEP.

The correct places for commits are:

  • The XML model used for this code generation: zproto_example.xml
  • The code generation script that built this file: zproto_codec_go

Index

Constants

View Source
const (
	// Signature is put into every protocol message and lets us filter bogus
	// or unknown protocols. It is a 4-bit number from 0 to 15. Use a unique value
	// for each protocol you write, at least.
	Signature uint16 = 0xAAA0 | 0
	Version          = 1
)
View Source
const (
	LogID        uint8 = 1
	StructuresID uint8 = 2
	BinaryID     uint8 = 3
	TypesID      uint8 = 4
)

Definition of message IDs

Variables

This section is empty.

Functions

This section is empty.

Types

type Binary

type Binary struct {
	Flags      []byte
	PublicKey  []byte
	Identifier []byte
	Address    []byte
	Content    []byte
	// contains filtered or unexported fields
}

Binary struct Deliver a multi-part message.

func NewBinary

func NewBinary() *Binary

NewBinary creates new Binary message.

func (*Binary) Marshal

func (b *Binary) Marshal() ([]byte, error)

Marshal serializes the message.

func (*Binary) RoutingID

func (b *Binary) RoutingID() []byte

RoutingID returns the routingID for this message, routingID should be set whenever talking to a ROUTER.

func (*Binary) Send

func (b *Binary) Send(sock *goczmq.Sock) (err error)

Send sends marshaled data through 0mq socket.

func (*Binary) Sequence

func (b *Binary) Sequence() uint16

Sequence returns the sequence.

func (*Binary) SetRoutingID

func (b *Binary) SetRoutingID(routingID []byte)

SetRoutingID sets the routingID for this message, routingID should be set whenever talking to a ROUTER.

func (*Binary) SetSequence

func (b *Binary) SetSequence(sequence uint16)

SetSequence sets the sequence.

func (*Binary) String

func (b *Binary) String() string

String returns print friendly name.

func (*Binary) Unmarshal

func (b *Binary) Unmarshal(frames ...[]byte) error

Unmarshal unmarshals the message.

type Log

type Log struct {
	Version uint16
	Level   byte
	Event   byte
	Node    uint16
	Peer    uint16
	Time    uint64
	Host    string
	Data    string
	// contains filtered or unexported fields
}

Log struct Log an event.

func NewLog

func NewLog() *Log

NewLog creates new Log message.

func (*Log) Marshal

func (l *Log) Marshal() ([]byte, error)

Marshal serializes the message.

func (*Log) RoutingID

func (l *Log) RoutingID() []byte

RoutingID returns the routingID for this message, routingID should be set whenever talking to a ROUTER.

func (*Log) Send

func (l *Log) Send(sock *goczmq.Sock) (err error)

Send sends marshaled data through 0mq socket.

func (*Log) Sequence

func (l *Log) Sequence() uint16

Sequence returns the sequence.

func (*Log) SetRoutingID

func (l *Log) SetRoutingID(routingID []byte)

SetRoutingID sets the routingID for this message, routingID should be set whenever talking to a ROUTER.

func (*Log) SetSequence

func (l *Log) SetSequence(sequence uint16)

SetSequence sets the sequence.

func (*Log) String

func (l *Log) String() string

String returns print friendly name.

func (*Log) Unmarshal

func (l *Log) Unmarshal(frames ...[]byte) error

Unmarshal unmarshals the message.

type Structures

type Structures struct {
	Aliases []string
	Headers map[string]string
	// contains filtered or unexported fields
}

Structures struct This message contains a list and a hash.

func NewStructures

func NewStructures() *Structures

NewStructures creates new Structures message.

func (*Structures) Marshal

func (s *Structures) Marshal() ([]byte, error)

Marshal serializes the message.

func (*Structures) RoutingID

func (s *Structures) RoutingID() []byte

RoutingID returns the routingID for this message, routingID should be set whenever talking to a ROUTER.

func (*Structures) Send

func (s *Structures) Send(sock *goczmq.Sock) (err error)

Send sends marshaled data through 0mq socket.

func (*Structures) Sequence

func (s *Structures) Sequence() uint16

Sequence returns the sequence.

func (*Structures) SetRoutingID

func (s *Structures) SetRoutingID(routingID []byte)

SetRoutingID sets the routingID for this message, routingID should be set whenever talking to a ROUTER.

func (*Structures) SetSequence

func (s *Structures) SetSequence(sequence uint16)

SetSequence sets the sequence.

func (*Structures) String

func (s *Structures) String() string

String returns print friendly name.

func (*Structures) Unmarshal

func (s *Structures) Unmarshal(frames ...[]byte) error

Unmarshal unmarshals the message.

type Transit

type Transit interface {
	Marshal() ([]byte, error)
	Unmarshal(...[]byte) error
	String() string
	Send(*goczmq.Sock) error
	SetRoutingID([]byte)
	RoutingID() []byte
	SetSequence(uint16)
	Sequence() uint16
}

Transit is a codec interface

func Clone

func Clone(t Transit) Transit

Clone clones a message.

func Recv

func Recv(sock *goczmq.Sock) (t Transit, err error)

Recv receives marshaled data from a 0mq socket.

func RecvNoWait

func RecvNoWait(sock *goczmq.Sock) (t Transit, err error)

RecvNoWait receives marshaled data from 0mq socket. It won't wait for input.

func Unmarshal

func Unmarshal(frames ...[]byte) (t Transit, err error)

Unmarshal unmarshals data from raw frames.

type Types

type Types struct {
	ClientForename   string
	ClientSurname    string
	ClientMobile     string
	ClientEmail      string
	SupplierForename string
	SupplierSurname  string
	SupplierMobile   string
	SupplierEmail    string
	// contains filtered or unexported fields
}

Types struct Demonstrate custom-defined types

func NewTypes

func NewTypes() *Types

NewTypes creates new Types message.

func (*Types) Marshal

func (t *Types) Marshal() ([]byte, error)

Marshal serializes the message.

func (*Types) RoutingID

func (t *Types) RoutingID() []byte

RoutingID returns the routingID for this message, routingID should be set whenever talking to a ROUTER.

func (*Types) Send

func (t *Types) Send(sock *goczmq.Sock) (err error)

Send sends marshaled data through 0mq socket.

func (*Types) Sequence

func (t *Types) Sequence() uint16

Sequence returns the sequence.

func (*Types) SetRoutingID

func (t *Types) SetRoutingID(routingID []byte)

SetRoutingID sets the routingID for this message, routingID should be set whenever talking to a ROUTER.

func (*Types) SetSequence

func (t *Types) SetSequence(sequence uint16)

SetSequence sets the sequence.

func (*Types) String

func (t *Types) String() string

String returns print friendly name.

func (*Types) Unmarshal

func (t *Types) Unmarshal(frames ...[]byte) error

Unmarshal unmarshals the message.

Jump to

Keyboard shortcuts

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