Documentation ¶
Index ¶
- Constants
- func Align(length int) int
- func IsValidCall(b []byte, c Code) bool
- func IsValidData(b []byte, c Code) bool
- func IsValidFlow(b []byte, c Code) bool
- func IsValidInfo(b []byte, c Code) bool
- type Buf
- func ImportCall(b []byte, c Code) (p Buf, err error)
- func Make(code Code, domain Domain, packetSize int) Buf
- func MakeCall(code Code, contentSize int) Buf
- func MakeDataEOF(code Code, id int32) Buf
- func MakeFlow(code Code, id, increment int32) Buf
- func MakeFlowEOF(code Code, id int32) Buf
- func MakeInfo(code Code, contentSize int) Buf
- func MustBeCall(b Buf) Buf
- func MustBeInfo(b Buf) Buf
- func (b Buf) Code() Code
- func (b Buf) Content() []byte
- func (b Buf) Cut(headerSize, prefixLen int) (prefix, unused Buf)
- func (b Buf) Domain() Domain
- func (b Buf) EncodedSize() int
- func (b Buf) Index() uint8
- func (b Buf) SetCode(code Code)
- func (b Buf) SetIndex(i uint8)
- func (b Buf) SetSize()
- func (b Buf) String() (s string)
- func (b Buf) Thunk() Thunk
- type Code
- type DataBuf
- func (b DataBuf) Code() Code
- func (b DataBuf) Cut(dataLen int) (prefix Buf, unused DataBuf)
- func (b DataBuf) Data() []byte
- func (b DataBuf) DataLen() int
- func (b DataBuf) EOF() bool
- func (b DataBuf) ID() int32
- func (b DataBuf) Note() int32
- func (b DataBuf) SetNote(value int32)
- func (b DataBuf) String() string
- func (b DataBuf) Thunk() Thunk
- type Domain
- type FlowBuf
- type Service
- type Thunk
Constants ¶
const ( Alignment = 8 // Packet header OffsetSize = 0 OffsetCode = 4 OffsetDomain = 6 OffsetIndex = 7 HeaderSize = 8 // Services packet header OffsetServicesCount = HeaderSize + 0 ServicesHeaderSize = HeaderSize + 2 // Flow packet header FlowHeaderSize = HeaderSize // Data packet header OffsetDataID = HeaderSize + 0 OffsetDataNote = HeaderSize + 4 DataHeaderSize = HeaderSize + 8 )
Variables ¶
This section is empty.
Functions ¶
func IsValidCall ¶
IsValidCall checks service call packet's or call result packet's header. Packet content is disregarded.
func IsValidData ¶
IsValidData checks stream data packet's header. Data is disregarded.
func IsValidFlow ¶
IsValidFlow checks stream flow packet, including the flow entries.
func IsValidInfo ¶
IsValidInfo checks service info packet's header. Packet content is disregarded.
Types ¶
type Buf ¶
type Buf []byte
Buf holds a packet of at least HeaderSize bytes.
func ImportCall ¶
ImportCall packet, validating it leniently. The buffer is NOT copied.
func MakeDataEOF ¶
func MakeFlowEOF ¶
func MustBeCall ¶
MustBeCall panicks if b is not in the call domain. The value is passed through.
func MustBeInfo ¶
MustBeInfo panicks if b is not in the info domain. The value is passed through.
func (Buf) Cut ¶
Cut a packet into two parts. The headerSize parameter determins how many bytes are initialized in the second part: the header is copied from the first part. The length of the first part is given as the prefixLen parameter. If the buffer is too short for the second part, the length of the second buffer will be zero.
func (Buf) EncodedSize ¶
EncodedSize decodes the packet header field.
type Code ¶
type Code int16
Code represents the source or destination of a packet. It is specific to a program instance.
const (
CodeServices Code = -1
)
type DataBuf ¶
type DataBuf Buf
DataBuf holds a data packet of at least DataHeaderSize bytes.
func ImportData ¶
ImportData packet, validating it leniently. The buffer is NOT copied.
func MustBeData ¶
MustBeData panicks if b is not in the data domain. The value is passed through.
type FlowBuf ¶
type FlowBuf Buf
FlowBuf holds a flow packet of at least FlowHeaderSize bytes.
func MustBeFlow ¶
MustBeFlow panicks if b is not in the flow domain. The value is passed through.