xdr

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2017 License: MIT Imports: 3 Imported by: 27

README

This project is not actively maintained

Issues and pull requests on this repository may not be acted on in a timely manner, or at all. You are of course welcome to use it anyway. You are even more welcome to fork it and maintain the results.

Unmaintained

xdr

Build Status Coverage Status API Documentation MIT License

This is an XDR marshalling/unmarshalling library. It uses code generation and not reflection.

Documentation

Overview

Package xdr implements an XDR (RFC 4506) marshaller/unmarshaller.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ElementSizeExceeded

func ElementSizeExceeded(field string, size, limit int) error

ElementSizeExceeded returns an error describing the violated size constraint. This function is used by the generated marshalling code.

func Padding added in v1.1.0

func Padding(l int) int

Pad returns the number of bytes that should be added to an item of length l bytes to conform to the XDR padding standard. This function is used by the generated marshalling code.

func SizeOfSlice added in v1.1.0

func SizeOfSlice(ss interface{}) int

SizeOfSlice returns the XDR encoded size of the given []T. Supported types for T are string, []byte and types implementing XDRSizer. SizeOfSlice panics if the parameter is not a slice or if T is not one of the supported types. This function is used by the generated marshalling code.

Types

type Marshaller added in v1.1.0

type Marshaller struct {
	Data  []byte
	Error error
	// contains filtered or unexported fields
}

The Marshaller is a thin wrapper around a byte buffer. The buffer must be of sufficient size to hold the complete marshalled object, or an io.ErrShortBuffer error will result. The Marshal... methods don't individually return an error - the intention is that multiple fields are marshalled in rapid succession, followed by a check of the Error field on the Marshaller.

func (*Marshaller) MarshalBool added in v1.1.0

func (m *Marshaller) MarshalBool(v bool)

MarshalString appends the bool to the buffer, as an uint32.

func (*Marshaller) MarshalBytes added in v1.1.0

func (m *Marshaller) MarshalBytes(bs []byte)

MarshalString appends the bytes to the buffer, with a size prefix and correct padding.

func (*Marshaller) MarshalRaw added in v1.1.0

func (m *Marshaller) MarshalRaw(bs []byte)

MarshalRaw copies the raw bytes to the buffer, without a size prefix or padding. This is suitable for appending data already in XDR format from another source.

func (*Marshaller) MarshalString added in v1.1.0

func (m *Marshaller) MarshalString(s string)

MarshalString appends the string to the buffer, with a size prefix and correct padding.

func (*Marshaller) MarshalUint16 added in v1.1.0

func (m *Marshaller) MarshalUint16(v uint16)

MarshalString appends the uint16 to the buffer, as an uint32.

func (*Marshaller) MarshalUint32 added in v1.1.0

func (m *Marshaller) MarshalUint32(v uint32)

MarshalString appends the uint32 to the buffer.

func (*Marshaller) MarshalUint64 added in v1.1.0

func (m *Marshaller) MarshalUint64(v uint64)

MarshalString appends the uint64 to the buffer.

func (*Marshaller) MarshalUint8 added in v1.1.0

func (m *Marshaller) MarshalUint8(v uint8)

MarshalString appends the uint8 to the buffer, as an uint32.

type Unmarshaller added in v1.1.0

type Unmarshaller struct {
	Error error
	Data  []byte
}

func (*Unmarshaller) UnmarshalBool added in v1.1.0

func (u *Unmarshaller) UnmarshalBool() bool

func (*Unmarshaller) UnmarshalBytes added in v1.1.0

func (u *Unmarshaller) UnmarshalBytes() []byte

func (*Unmarshaller) UnmarshalBytesMax added in v1.1.0

func (u *Unmarshaller) UnmarshalBytesMax(max int) []byte

func (*Unmarshaller) UnmarshalRaw added in v1.1.0

func (u *Unmarshaller) UnmarshalRaw(l int) []byte

func (*Unmarshaller) UnmarshalString added in v1.1.0

func (u *Unmarshaller) UnmarshalString() string

func (*Unmarshaller) UnmarshalStringMax added in v1.1.0

func (u *Unmarshaller) UnmarshalStringMax(max int) string

func (*Unmarshaller) UnmarshalUint16 added in v1.1.0

func (u *Unmarshaller) UnmarshalUint16() uint16

func (*Unmarshaller) UnmarshalUint32 added in v1.1.0

func (u *Unmarshaller) UnmarshalUint32() uint32

func (*Unmarshaller) UnmarshalUint64 added in v1.1.0

func (u *Unmarshaller) UnmarshalUint64() uint64

func (*Unmarshaller) UnmarshalUint8 added in v1.1.0

func (u *Unmarshaller) UnmarshalUint8() uint8

type XDRSizer added in v1.1.0

type XDRSizer interface {
	XDRSize() int
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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