codec

package
v0.0.0-...-c7b5b61 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const MagicNumber = 0xFADABEDA
View Source
const MagicNumberHeaderless = 0xCEBAFE4A
View Source
const PreambleSize = 4 + 4 + 4 + 4

Size of the preamble: 4 bytes magic number, 4 bytes total message size, 4 bytes header size, 4 bytes message size

Variables

This section is empty.

Functions

func AppendMessageTo

func AppendMessageTo(buf []byte, hdr *types.Header, msg proto.Message) ([]byte, error)

func DecodeMessage

func DecodeMessage(data []byte, interests map[string]dndm.Route) (*types.Header, proto.Message, error)

DecodeMessage assumes the data array is already of correct size and preamble size field is removed

func EncodeMessage

func EncodeMessage(msg proto.Message, route dndm.Route) ([]byte, error)

EncodeMessage encodes any proto message into stream bytes. It adds a header and packet part sizes.

func PacketSize

func PacketSize(hdr *types.Header, msg proto.Message) int

func ReadMessage

func ReadMessage(r io.Reader) ([]byte, uint64, error)

func RegisterType

func RegisterType(t types.Type, msg proto.Message)

func Release

func Release(b []byte)

Types

This section is empty.

Jump to

Keyboard shortcuts

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