ndr

package
v4.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package ndr is a partial implementation of NDR encoding: http://pubs.opengroup.org/onlinepubs/9629399/chap14.htm

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadBool

func ReadBool(b *[]byte, p *int) bool

ReadBool reads bytes representing a boolean.

func ReadBytes

func ReadBytes(b *[]byte, p *int, s int, e *binary.ByteOrder) (r []byte)

ReadBytes reads the number of bytes specified.

func ReadConformantVaryingString

func ReadConformantVaryingString(b *[]byte, p *int, e *binary.ByteOrder) (string, error)

ReadConformantVaryingString reads a Conformant and Varying String from the bytes slice. A conformant and varying string is a string in which the maximum number of elements is not known beforehand and therefore is included in the representation of the string. NDR represents a conformant and varying string as an ordered sequence of representations of the string elements, preceded by three unsigned long integers. The first integer gives the maximum number of elements in the string, including the terminator. The second integer gives the offset from the first index of the string to the first index of the actual subset being passed. The third integer gives the actual number of elements being passed, including the terminator.

func ReadHeaders

func ReadHeaders(b *[]byte) (CommonHeader, PrivateHeader, int, error)

ReadHeaders processes the bytes to return the NDR Common and Private headers.

func ReadIEEEfloat32

func ReadIEEEfloat32(b *[]byte, p *int, e *binary.ByteOrder) float32

ReadIEEEfloat32 reads bytes representing a IEEE formatted 32 bit float.

func ReadIEEEfloat64

func ReadIEEEfloat64(b *[]byte, p *int, e *binary.ByteOrder) float64

ReadIEEEfloat64 reads bytes representing a IEEE formatted 64 bit float.

func ReadUint16

func ReadUint16(b *[]byte, p *int, e *binary.ByteOrder) (i uint16)

ReadUint16 reads bytes representing a thirty two bit integer.

func ReadUint32

func ReadUint32(b *[]byte, p *int, e *binary.ByteOrder) (i uint32)

ReadUint32 reads bytes representing a thirty two bit integer.

func ReadUint64

func ReadUint64(b *[]byte, p *int, e *binary.ByteOrder) (i uint64)

ReadUint64 reads bytes representing a thirty two bit integer.

func ReadUint8

func ReadUint8(b *[]byte, p *int) (i uint8)

ReadUint8 reads bytes representing a thirty two bit integer.

func ReadUniDimensionalConformantArrayHeader

func ReadUniDimensionalConformantArrayHeader(b *[]byte, p *int, e *binary.ByteOrder) int

ReadUniDimensionalConformantArrayHeader reads a UniDimensionalConformantArrayHeader from the bytes slice.

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

func GetCommonHeader

func GetCommonHeader(b *[]byte) (CommonHeader, int, error)

GetCommonHeader processes the bytes to return the NDR Common header.

type Malformed

type Malformed struct {
	EText string
}

Malformed implements the error interface for malformed NDR encoding errors.

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

func GetPrivateHeader

func GetPrivateHeader(b *[]byte, p *int, bo *binary.ByteOrder) (PrivateHeader, error)

GetPrivateHeader processes the bytes to return the NDR Private header.

Jump to

Keyboard shortcuts

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