encoder

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

The original encoder package implemented only the minimal viable encoder/decoder

to support login with smb dialect 2.1 and perform a tree connect. It has been extended to handle many more cases, but it is far from complete. Many of the structs that can be serialized correctly cannot be deserialized and the other way around. Furthermore, a few cases has been added that have yet to be used anywhere and as such the code is untested.

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromUnicode

func FromUnicode(d []byte) ([]byte, error)

func FromUnicodeString

func FromUnicodeString(d []byte) (string, error)

func Marshal

func Marshal(v interface{}) ([]byte, error)

func ToUnicode

func ToUnicode(s string) []byte

func Unmarshal

func Unmarshal(buf []byte, v interface{}) error

func Utf16ToUtf8

func Utf16ToUtf8(in []uint16) []byte

func Utf8ToUtf16

func Utf8ToUtf16(in []byte) ([]uint16, error)

Types

type BinaryMarshallable

type BinaryMarshallable interface {
	MarshalBinary(*Metadata) ([]byte, error)
	UnmarshalBinary([]byte, *Metadata) error
}

type Metadata

type Metadata struct {
	Tags       *TagMap
	Lens       map[string]uint64
	Offsets    map[string]uint64
	Counts     map[string]uint64
	Parent     interface{}
	ParentBuf  []byte
	CurrOffset uint64
	CurrField  string
}

type TagMap

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

func (TagMap) Get

func (t TagMap) Get(key string) interface{}

func (TagMap) GetInt

func (t TagMap) GetInt(key string) (int, error)

func (TagMap) GetString

func (t TagMap) GetString(key string) (string, error)

func (TagMap) Has

func (t TagMap) Has(key string) bool

func (TagMap) Set

func (t TagMap) Set(key string, val interface{})

Jump to

Keyboard shortcuts

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