gen_composition

package
v0.0.0-...-d1ba03b Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Code generated by ndn tlv codegen DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Inner

type Inner struct {
	//+field:natural
	Num uint64 `tlv:"0x01"`
}

func ParseInner

func ParseInner(reader enc.WireView, ignoreCritical bool) (*Inner, error)

Parses wire-encoded data into an Inner structure, optionally ignoring critical fields based on the provided flag.

func (*Inner) Bytes

func (value *Inner) Bytes() []byte

Returns the byte slice formed by encoding the Inner value and concatenating the resulting components.

func (*Inner) Encode

func (value *Inner) Encode() enc.Wire

Encodes the Inner instance into its wire format representation using an InnerEncoder.

type InnerEncoder

type InnerEncoder struct {
	Length uint
}

func (*InnerEncoder) Encode

func (encoder *InnerEncoder) Encode(value *Inner) enc.Wire

Encodes the provided Inner value into a byte slice of the pre-determined length using the encoder's buffer, returning a wire-ready representation for transmission.

func (*InnerEncoder) EncodeInto

func (encoder *InnerEncoder) EncodeInto(value *Inner, buf []byte)

Encodes the `Inner` struct into a binary buffer using NDN's TLV format, writing a fixed type byte (1) followed by the variable-length encoded natural number representation of the `Num` field.

func (*InnerEncoder) Init

func (encoder *InnerEncoder) Init(value *Inner)

Initializes the encoder's total length based on the encoded size of the Num field in the Inner value, including fixed overhead.

type InnerParsingContext

type InnerParsingContext struct {
}

func (*InnerParsingContext) Init

func (context *InnerParsingContext) Init()

Initializes the inner parsing context for subsequent parsing operations.

func (*InnerParsingContext) Parse

func (context *InnerParsingContext) Parse(reader enc.WireView, ignoreCritical bool) (*Inner, error)

Parses a TLV-encoded binary structure into an Inner object, decoding a required 'Num' field as a variable-length unsigned integer and conditionally skipping unrecognized or critical fields based on the ignoreCritical flag.

type InnerWire1

type InnerWire1 struct {
	//+field:wire
	Wire1 enc.Wire `tlv:"0x01"`
	//+field:natural:optional
	Num optional.Optional[uint64] `tlv:"0x02"`
}

+tlv-model:nocopy,private

type InnerWire1Encoder

type InnerWire1Encoder struct {
	Length uint

	Wire1_length uint
	// contains filtered or unexported fields
}

func (*InnerWire1Encoder) Encode

func (encoder *InnerWire1Encoder) Encode(value *InnerWire1) enc.Wire

Encodes an `InnerWire1` value into a pre-allocated byte slice structure defined by the encoder's wire plan, returning a segmented wire representation.

func (*InnerWire1Encoder) EncodeInto

func (encoder *InnerWire1Encoder) EncodeInto(value *InnerWire1, wire enc.Wire)

Encodes an `InnerWire1` struct into a binary wire format using TLV (Type-Length-Value) encoding, handling a slice of wire elements (type 1) and an optional unsigned integer (type 2).

func (*InnerWire1Encoder) Init

func (encoder *InnerWire1Encoder) Init(value *InnerWire1)

Initializes the encoder with the total encoded length and a wire encoding plan for the InnerWire1 structure, accounting for optional fields and nested string lengths.

type InnerWire1ParsingContext

type InnerWire1ParsingContext struct {
}

func (*InnerWire1ParsingContext) Init

func (context *InnerWire1ParsingContext) Init()

Initializes the InnerWire1ParsingContext for parsing NDN packets.

func (*InnerWire1ParsingContext) Parse

func (context *InnerWire1ParsingContext) Parse(reader enc.WireView, ignoreCritical bool) (*InnerWire1, error)

Parses a TLV-encoded binary structure into an `InnerWire1` object, handling specific fields (Wire1 and Num) and skipping or rejecting unknown critical types based on the `ignoreCritical` flag.

type InnerWire2

type InnerWire2 struct {
	//+field:wire
	Wire2 enc.Wire `tlv:"0x03"`
}

+tlv-model:nocopy,private

type InnerWire2Encoder

type InnerWire2Encoder struct {
	Length uint

	Wire2_length uint
	// contains filtered or unexported fields
}

func (*InnerWire2Encoder) Encode

func (encoder *InnerWire2Encoder) Encode(value *InnerWire2) enc.Wire

Encodes the provided InnerWire2 value into a pre-allocated byte slice structure based on a predefined wire layout plan, returning the segmented encoded data as an enc.Wire.

func (*InnerWire2Encoder) EncodeInto

func (encoder *InnerWire2Encoder) EncodeInto(value *InnerWire2, wire enc.Wire)

Encodes the `Wire2` field of the provided `InnerWire2` value into the given wire buffer using TLV (Type-Length-Value) encoding, writing a type byte `3`, the length of the `Wire2` slice, and its elements into sequential wire segments.

func (*InnerWire2Encoder) Init

func (encoder *InnerWire2Encoder) Init(value *InnerWire2)

Initializes the encoder with length calculations and encoding plan for the `Wire2` field, accounting for variable-length encoding of its contents.

type InnerWire2ParsingContext

type InnerWire2ParsingContext struct {
}

func (*InnerWire2ParsingContext) Init

func (context *InnerWire2ParsingContext) Init()

Initializes the InnerWire2ParsingContext, preparing it for subsequent parsing operations (currently no implementation).

func (*InnerWire2ParsingContext) Parse

func (context *InnerWire2ParsingContext) Parse(reader enc.WireView, ignoreCritical bool) (*InnerWire2, error)

Parses a TLV-encoded InnerWire2 object from the provided byte stream, extracting the Wire2 field (type 3) and skipping or rejecting unrecognized critical fields based on the ignoreCritical flag.

type IntArray

type IntArray struct {
	//+field:sequence:uint64:natural
	Words []uint64 `tlv:"0x01"`
}

func ParseIntArray

func ParseIntArray(reader enc.WireView, ignoreCritical bool) (*IntArray, error)

Parses a wire-encoded integer array into an IntArray structure, optionally ignoring critical components based on the provided flag.

func (*IntArray) Bytes

func (value *IntArray) Bytes() []byte

Returns the concatenated byte representation of the integer array by encoding each element and joining them.

func (*IntArray) Encode

func (value *IntArray) Encode() enc.Wire

Encodes the integer array into a wire format using an IntArrayEncoder.

type IntArrayEncoder

type IntArrayEncoder struct {
	Length uint

	Words_subencoder []struct {
	}
}

func (*IntArrayEncoder) Encode

func (encoder *IntArrayEncoder) Encode(value *IntArray) enc.Wire

Encodes an IntArray into a byte slice of the specified length and returns it as a Wire structure.

func (*IntArrayEncoder) EncodeInto

func (encoder *IntArrayEncoder) EncodeInto(value *IntArray, buf []byte)

Encodes the elements of an IntArray's Words slice into a binary buffer, with each element prefixed by a type marker (0x01) and variable-length encoded as a uint64.

func (*IntArrayEncoder) Init

func (encoder *IntArrayEncoder) Init(value *IntArray)

Initializes an IntArrayEncoder by calculating the total encoded length of the provided IntArray, accounting for each uint64 word's variable-length encoding and sequence overhead.

type IntArrayParsingContext

type IntArrayParsingContext struct {
}

func (*IntArrayParsingContext) Init

func (context *IntArrayParsingContext) Init()

Initializes the IntArrayParsingContext, preparing it for parsing integer arrays.

func (*IntArrayParsingContext) Parse

func (context *IntArrayParsingContext) Parse(reader enc.WireView, ignoreCritical bool) (*IntArray, error)

Parses a TLV-encoded integer array, extracting sequences of bytes as uint64 words for type 1 fields and skipping or rejecting unrecognized/critical fields based on the ignoreCritical flag.

type NameArray

type NameArray struct {
	//+field:sequence:enc.Name:name
	Names []enc.Name `tlv:"0x07"`
}

func ParseNameArray

func ParseNameArray(reader enc.WireView, ignoreCritical bool) (*NameArray, error)

Parses a NameArray from encoded wire format data, with an option to ignore critical parsing errors.

func (*NameArray) Bytes

func (value *NameArray) Bytes() []byte

Returns the byte representation of the NameArray by encoding each component and joining them into a single byte slice.

func (*NameArray) Encode

func (value *NameArray) Encode() enc.Wire

Encodes the NameArray into a wire-encoded format using a NameArrayEncoder.

type NameArrayEncoder

type NameArrayEncoder struct {
	Length uint

	Names_subencoder []struct {
		Names_length uint
	}
}

func (*NameArrayEncoder) Encode

func (encoder *NameArrayEncoder) Encode(value *NameArray) enc.Wire

Encodes a NameArray into a TLV wire format by allocating a buffer of the encoder's specified length and populating it with the encoded array data.

func (*NameArrayEncoder) EncodeInto

func (encoder *NameArrayEncoder) EncodeInto(value *NameArray, buf []byte)

Encodes a sequence of names from a NameArray into a binary buffer using TLV (Type-Length-Value) format, where each name is prefixed by a type byte (7), its length, and then its encoded components.

func (*NameArrayEncoder) Init

func (encoder *NameArrayEncoder) Init(value *NameArray)

Initializes the NameArrayEncoder by computing the total encoded length of the provided NameArray, including TLV header overhead and individual name component lengths.

type NameArrayParsingContext

type NameArrayParsingContext struct {
}

func (*NameArrayParsingContext) Init

func (context *NameArrayParsingContext) Init()

Initializes the `NameArrayParsingContext`, setting up its state to begin parsing name arrays.

func (*NameArrayParsingContext) Parse

func (context *NameArrayParsingContext) Parse(reader enc.WireView, ignoreCritical bool) (*NameArray, error)

Parses a TLV-encoded NameArray from a wire format, extracting Name components (type 7) into a slice and skipping or rejecting unknown critical types based on the ignoreCritical flag.

type Nested

type Nested struct {
	//+field:struct:Inner
	Val *Inner `tlv:"0x02"`
}

func ParseNested

func ParseNested(reader enc.WireView, ignoreCritical bool) (*Nested, error)

Parses a nested structure from the provided wire format data, using the given parsing context and optionally ignoring critical elements.

func (*Nested) Bytes

func (value *Nested) Bytes() []byte

**Returns the byte slice representing the wire-format encoding of the Nested value.**

func (*Nested) Encode

func (value *Nested) Encode() enc.Wire

Encodes the Nested value into a wire format using a NestedEncoder.

type NestedEncoder

type NestedEncoder struct {
	Length uint

	Val_encoder InnerEncoder
}

func (*NestedEncoder) Encode

func (encoder *NestedEncoder) Encode(value *Nested) enc.Wire

Encodes a Nested object into a byte slice using the encoder's pre-allocated buffer size and returns it as a single-element Wire slice.

func (*NestedEncoder) EncodeInto

func (encoder *NestedEncoder) EncodeInto(value *Nested, buf []byte)

Encodes a Nested object into a TLV (Type-Length-Value) format in the provided buffer, handling the presence of the Val field with a type indicator (byte 2), length encoding, and value serialization.

func (*NestedEncoder) Init

func (encoder *NestedEncoder) Init(value *Nested)

Initializes the NestedEncoder with the provided Nested value, calculating its encoded length by summing the type byte, encoded length field size, and the length of the nested value's content.

type NestedParsingContext

type NestedParsingContext struct {
	Val_context InnerParsingContext
}

func (*NestedParsingContext) Init

func (context *NestedParsingContext) Init()

Initializes the internal Val_context component of the NestedParsingContext by calling its Init method.

func (*NestedParsingContext) Parse

func (context *NestedParsingContext) Parse(reader enc.WireView, ignoreCritical bool) (*Nested, error)

Parses a TLV-encoded Nested structure from the provided wire reader, handling the "Val" field with the associated context and skipping or rejecting unrecognized critical fields based on the ignoreCritical flag.

type NestedSeq

type NestedSeq struct {
	//+field:sequence:*Inner:struct:Inner
	Vals []*Inner `tlv:"0x03"`
}

func ParseNestedSeq

func ParseNestedSeq(reader enc.WireView, ignoreCritical bool) (*NestedSeq, error)

Parses a nested TLV sequence from the provided wire format data into a `NestedSeq` structure, using the given parsing context and optionally ignoring critical elements based on the `ignoreCritical` flag.

func (*NestedSeq) Bytes

func (value *NestedSeq) Bytes() []byte

Encodes the NestedSeq into a contiguous byte slice by joining its encoded components.

func (*NestedSeq) Encode

func (value *NestedSeq) Encode() enc.Wire

Encodes the NestedSeq value into a wire format using a NestedSeqEncoder for serialization.

type NestedSeqEncoder

type NestedSeqEncoder struct {
	Length uint

	Vals_subencoder []struct {
		Vals_encoder InnerEncoder
	}
}

func (*NestedSeqEncoder) Encode

func (encoder *NestedSeqEncoder) Encode(value *NestedSeq) enc.Wire

Encodes the given NestedSeq value into a binary wire format using the pre-determined length of the encoder.

func (*NestedSeqEncoder) EncodeInto

func (encoder *NestedSeqEncoder) EncodeInto(value *NestedSeq, buf []byte)

Encodes a sequence of values from a NestedSeq structure into a binary buffer using a TLV (Type-Length-Value) format, with each element encoded by its corresponding subencoder.

func (*NestedSeqEncoder) Init

func (encoder *NestedSeqEncoder) Init(value *NestedSeq)

Initializes sub-encoders for each element in a nested sequence structure and computes the total encoded length, including TLV encoding overhead, to prepare for efficient NDN data encoding.

type NestedSeqParsingContext

type NestedSeqParsingContext struct {
	Vals_context InnerParsingContext
}

func (*NestedSeqParsingContext) Init

func (context *NestedSeqParsingContext) Init()

Initializes the internal Vals_context within the NestedSeqParsingContext to prepare for parsing operations.

func (*NestedSeqParsingContext) Parse

func (context *NestedSeqParsingContext) Parse(reader enc.WireView, ignoreCritical bool) (*NestedSeq, error)

Parses a TLV-encoded NestedSeq structure from the provided wire reader, using the Vals_context to decode the Vals field and handling critical/unrecognized fields according to the ignoreCritical flag.

type NestedWire

type NestedWire struct {
	//+field:struct:InnerWire1:nocopy
	W1 *InnerWire1 `tlv:"0x04"`
	//+field:natural
	N uint64 `tlv:"0x05"`
	//+field:struct:InnerWire2:nocopy
	W2 *InnerWire2 `tlv:"0x06"`
}

+tlv-model:nocopy

func ParseNestedWire

func ParseNestedWire(reader enc.WireView, ignoreCritical bool) (*NestedWire, error)

Parses a nested wire-encoded structure into a NestedWire object, optionally ignoring critical elements that cannot be processed.

func (*NestedWire) Bytes

func (value *NestedWire) Bytes() []byte

Returns the encoded byte representation of the NestedWire value by encoding its components and joining them into a single byte slice.

func (*NestedWire) Encode

func (value *NestedWire) Encode() enc.Wire

Encodes the NestedWire value into a wire format using a NestedWireEncoder.

type NestedWireEncoder

type NestedWireEncoder struct {
	Length uint

	W1_encoder InnerWire1Encoder

	W2_encoder InnerWire2Encoder
	// contains filtered or unexported fields
}

func (*NestedWireEncoder) Encode

func (encoder *NestedWireEncoder) Encode(value *NestedWire) enc.Wire

Encodes a NestedWire value into a pre-allocated, segmented byte slice structure according to the encoder's wire plan, returning the structured wire representation.

func (*NestedWireEncoder) EncodeInto

func (encoder *NestedWireEncoder) EncodeInto(value *NestedWire, wire enc.Wire)

Encodes a NestedWire structure into a binary wire format using TLV encoding, handling nested fields (W1, W2) by delegating to sub-encoders and managing buffer layout with type markers, length fields, and value serialization.

func (*NestedWireEncoder) Init

func (encoder *NestedWireEncoder) Init(value *NestedWire)

Initializes the NestedWireEncoder with the provided NestedWire structure, calculates the total encoded length, and constructs a wire plan detailing the encoding offsets for each component (W1, N, W2) to facilitate structured wire format serialization.

type NestedWireParsingContext

type NestedWireParsingContext struct {
	W1_context InnerWire1ParsingContext

	W2_context InnerWire2ParsingContext
}

func (*NestedWireParsingContext) Init

func (context *NestedWireParsingContext) Init()

Initializes the nested wire parsing context by initializing its internal W1 and W2 sub-contexts for wire parsing operations.

func (*NestedWireParsingContext) Parse

func (context *NestedWireParsingContext) Parse(reader enc.WireView, ignoreCritical bool) (*NestedWire, error)

Parses a binary TLV-encoded structure into a NestedWire object, handling nested W1 and W2 fields, a required uint64 N field, and managing critical vs non-critical TLV types based on the ignoreCritical flag.

Jump to

Keyboard shortcuts

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