ndnitestenv

package
v0.0.0-...-6c4fd92 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: NIST-PD-fallback Imports: 11 Imported by: 0

Documentation

Overview

Package ndnitestenv contains helper functions to construct NDN packets in test code.

Index

Constants

This section is empty.

Variables

MakePacketHeadroom is the mbuf headroom used in MakePacket().

Functions

func MakeData

func MakeData(input any, args ...any) (pkt *ndni.Packet)

MakeData creates a Data packet. input: packet bytes as []byte or HEX, or name URI. args: arguments to ndn.MakeData (valid if input is name URI), or PacketModifiers. Panics if packet constructed from bytes is not Data.

func MakeInterest

func MakeInterest(input any, args ...any) (pkt *ndni.Packet)

MakeInterest creates an Interest packet. input: packet bytes as []byte or HEX, or name URI. args: arguments to ndn.MakeInterest (valid if input is name URI), or PacketModifiers.

func MakeMempools

func MakeMempools() *ndni.Mempools

MakeMempools returns mempools for packet modification.

func MakeNack

func MakeNack(args ...any) (pkt *ndni.Packet)

MakeNack turns an Interest to a Nack. args: arguments to ndn.MakeNack, or PacketModifiers. Note that the Interest must be passed as ndn.Interest instance, not bytes or name.

func MakePacket

func MakePacket(input any, modifiers ...PacketModifier) *ndni.Packet

MakePacket creates a packet. input: packet bytes as []byte or HEX. modifiers: optional PacketModifiers.

Types

type PacketModifier

type PacketModifier interface {
	// contains filtered or unexported methods
}

PacketModifier is a function that modifies a created packet.

func SetActiveFwHint

func SetActiveFwHint(index int) PacketModifier

SetActiveFwHint selects an active forwarding hint delegation. This applies to Interest only.

func SetFace

func SetFace(faceID iface.ID) PacketModifier

SetFace updates ingress faceID of packet.

func SetPitToken

func SetPitToken(token []byte) PacketModifier

SetPitToken updates PIT token of packet.

Jump to

Keyboard shortcuts

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