Documentation ¶
Overview ¶
Package ndnitestenv contains helper functions to construct NDN packets in test code.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var MakePacketHeadroom mbuftestenv.Headroom = pktmbuf.DefaultHeadroom + ndni.LpHeaderHeadroom
MakePacketHeadroom is the mbuf headroom used in MakePacket().
Functions ¶
func MakeData ¶
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 ¶
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 ¶
MakeMempools returns mempools for packet modification.
func MakeNack ¶
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.