nlenc

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2023 License: MIT Imports: 5 Imported by: 82

Documentation

Overview

Package nlenc implements encoding and decoding functions for netlink messages and attributes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bytes

func Bytes(s string) []byte

Bytes returns a null-terminated byte slice with the contents of s.

func Int32

func Int32(b []byte) int32

Int32 decodes an int32 from b using the host machine's native endianness. If b is not exactly 4 bytes in length, Int32 will panic.

func Int32Bytes

func Int32Bytes(v int32) []byte

Int32Bytes encodes a int32 into a newly-allocated byte slice using the host machine's native endianness. It is a shortcut for allocating a new byte slice and filling it using PutInt32.

func NativeEndian

func NativeEndian() binary.ByteOrder

NativeEndian returns the native byte order of this system.

func PutInt32

func PutInt32(b []byte, v int32)

PutInt32 encodes a int32 into b using the host machine's native endianness. If b is not exactly 4 bytes in length, PutInt32 will panic.

func PutUint16

func PutUint16(b []byte, v uint16)

PutUint16 encodes a uint16 into b using the host machine's native endianness. If b is not exactly 2 bytes in length, PutUint16 will panic.

func PutUint32

func PutUint32(b []byte, v uint32)

PutUint32 encodes a uint32 into b using the host machine's native endianness. If b is not exactly 4 bytes in length, PutUint32 will panic.

func PutUint64

func PutUint64(b []byte, v uint64)

PutUint64 encodes a uint64 into b using the host machine's native endianness. If b is not exactly 8 bytes in length, PutUint64 will panic.

func PutUint8

func PutUint8(b []byte, v uint8)

PutUint8 encodes a uint8 into b. If b is not exactly 1 byte in length, PutUint8 will panic.

func String

func String(b []byte) string

String returns a string with the contents of b from a null-terminated byte slice.

func Uint16

func Uint16(b []byte) uint16

Uint16 decodes a uint16 from b using the host machine's native endianness. If b is not exactly 2 bytes in length, Uint16 will panic.

func Uint16Bytes

func Uint16Bytes(v uint16) []byte

Uint16Bytes encodes a uint16 into a newly-allocated byte slice using the host machine's native endianness. It is a shortcut for allocating a new byte slice and filling it using PutUint16.

func Uint32

func Uint32(b []byte) uint32

Uint32 decodes a uint32 from b using the host machine's native endianness. If b is not exactly 4 bytes in length, Uint32 will panic.

func Uint32Bytes

func Uint32Bytes(v uint32) []byte

Uint32Bytes encodes a uint32 into a newly-allocated byte slice using the host machine's native endianness. It is a shortcut for allocating a new byte slice and filling it using PutUint32.

func Uint64

func Uint64(b []byte) uint64

Uint64 decodes a uint64 from b using the host machine's native endianness. If b is not exactly 8 bytes in length, Uint64 will panic.

func Uint64Bytes

func Uint64Bytes(v uint64) []byte

Uint64Bytes encodes a uint64 into a newly-allocated byte slice using the host machine's native endianness. It is a shortcut for allocating a new byte slice and filling it using PutUint64.

func Uint8

func Uint8(b []byte) uint8

Uint8 decodes a uint8 from b. If b is not exactly 1 byte in length, Uint8 will panic.

func Uint8Bytes

func Uint8Bytes(v uint8) []byte

Uint8Bytes encodes a uint8 into a newly-allocated byte slice. It is a shortcut for allocating a new byte slice and filling it using PutUint8.

Types

This section is empty.

Jump to

Keyboard shortcuts

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