package ndr

import "github.com/jcmturner/rpc/v2/ndr"

Package ndr provides the ability to unmarshal NDR encoded byte steams into Go data structures

Index

Constants

const (
	TagConformant = "conformant"
	TagVarying    = "varying"
	TagPointer    = "pointer"
	TagPipe       = "pipe"
)

Struct tag values

const (
	SizeBool   = 1
	SizeChar   = 1
	SizeUint8  = 1
	SizeUint16 = 2
	SizeUint32 = 4
	SizeUint64 = 8
	SizeEnum   = 2
	SizeSingle = 4
	SizeDouble = 8
	SizePtr    = 4
)

Byte sizes of primitive types

const (
	TagEncapsulated = "encapsulated"
	TagUnionTag     = "unionTag"
	TagUnionField   = "unionField"
)

Union related constants such as struct tag values

Types

type CommonHeader

type CommonHeader struct {
	Version             uint8
	Endianness          binary.ByteOrder
	CharacterEncoding   uint8
	FloatRepresentation uint8
	HeaderLength        uint16
	Filler              []byte
}

CommonHeader implements the NDR common header: https://msdn.microsoft.com/en-us/library/cc243889.aspx

type Decoder

type Decoder struct {
	// contains filtered or unexported fields
}

Decoder unmarshals NDR byte stream data into a Go struct representation

func NewDecoder

func NewDecoder(r io.Reader) *Decoder

NewDecoder creates a new instance of a NDR Decoder.

func (*Decoder) Decode

func (dec *Decoder) Decode(s interface{}) error

Decode unmarshals the NDR encoded bytes into the pointer of a struct provided.

type Malformed

type Malformed struct {
	EText string
}

Malformed implements the error interface for malformed NDR encoding errors.

func Errorf

func Errorf(format string, a ...interface{}) Malformed

Errorf formats an error message into a malformed NDR error.

func (Malformed) Error

func (e Malformed) Error() string

Error implements the error interface on the Malformed struct.

type PrivateHeader

type PrivateHeader struct {
	ObjectBufferLength uint32
	Filler             []byte
}

PrivateHeader implements the NDR private header: https://msdn.microsoft.com/en-us/library/cc243919.aspx

type RawBytes

type RawBytes interface {
	Size(interface{}) int
}

RawBytes interface should be implemented if reading just a number of bytes from the NDR stream

type Union

type Union interface {
	SwitchFunc(t interface{}) string
}

Union interface must be implemented by structs that will be unmarshaled into from the NDR byte stream union representation. The union's discriminating tag will be passed to the SwitchFunc method. The discriminating tag field must have the struct tag: `ndr:"unionTag"` If the union is encapsulated the discriminating tag field must have the struct tag: `ndr:"encapsulated"` The possible value fields that can be selected from must have the struct tag: `ndr:"unionField"`

Source Files

arrays.go decoder.go error.go header.go pipe.go primitives.go rawbytes.go strings.go tags.go union.go

Version
v2.0.3 (latest)
Published
Nov 12, 2020
Platform
windows/amd64
Imports
10 packages
Last checked
now

Tools for package owners.