Generated from Manticore v1.1.5 • 201 packages. View on pkg.go.dev

ndr

import "github.com/TheManticoreProject/Manticore/network/dcerpc/v4/internal/ndr"

Package ndr provides a minimal little-endian NDR (NDR 2.0) octet cursor for the connectionless (v4) packages that hand-marshal small, fixed wire shapes (the endpoint mapper and the interface bindings). It is deliberately not the reflection-driven codec in network/dcerpc/ndr: those callers want explicit, golden-testable byte layout, so this cursor just offers length-checked reads and writes of the NDR primitives they need, with alignment taken relative to the start of the stream.

It lives under internal/ so it stays a v4 implementation detail rather than a public API alongside the full NDR package.

Index

type Reader

Reader consumes a little-endian NDR octet stream with bounds checking; the first error is sticky and reported by Err.

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

func NewReader

func NewReader(data []byte) *Reader

NewReader returns a reader over data.

func (*Reader) Align

func (r *Reader) Align(n int)

Align advances to the next multiple of n, relative to the start of the stream.

func (*Reader) Err

func (r *Reader) Err() error

Err returns the first error encountered, or nil.

func (*Reader) Skip

func (r *Reader) Skip(n int)

Skip advances past n octets.

func (*Reader) Take

func (r *Reader) Take(n int) []byte

Take returns the next n octets, or nil and a sticky error if fewer remain.

func (*Reader) U16

func (r *Reader) U16() uint16

U16 reads a little-endian uint16.

func (*Reader) U32

func (r *Reader) U32() uint32

U32 reads a little-endian uint32.

func (*Reader) UUID

func (r *Reader) UUID() guid.GUID

UUID reads a 16-octet DCE uuid_t.

type Writer

Writer accumulates a little-endian NDR octet stream. The zero value is ready to use.

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

func (*Writer) Align

func (w *Writer) Align(n int)

Align pads the stream with zero octets until its length is a multiple of n.

func (*Writer) Bytes

func (w *Writer) Bytes() []byte

Bytes returns the accumulated stream.

func (*Writer) Put

func (w *Writer) Put(b []byte)

Put appends raw octets.

func (*Writer) U32

func (w *Writer) U32(v uint32)

U32 appends a little-endian uint32.