respool

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package respool contains the Dispatcher's pool of free buffers/packets.

FIXME(scrye): Currently the pools are elastic, but this is not ideal for traffic bursts. Consider converting these to fixed-size lists.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBuffer

func GetBuffer() []byte

func PutBuffer

func PutBuffer(b []byte)

Types

type Packet

type Packet struct {
	UnderlayRemote *net.UDPAddr

	SCION slayers.SCION
	UDP   slayers.UDP
	SCMP  slayers.SCMP

	// L4 indicates what type is at layer 4.
	L4 gopacket.LayerType
	// contains filtered or unexported fields
}

Packet describes a SCION packet. Fields might reference each other (including hidden fields), so callers should only write to freshly created packets, and readers should take care never to mutate data.

func GetPacket

func GetPacket() *Packet

func (*Packet) CopyTo

func (pkt *Packet) CopyTo(p []byte) int

CopyTo copies the buffer into the provided bytearray. Returns number of bytes copied.

func (*Packet) DecodeFromConn

func (pkt *Packet) DecodeFromConn(conn net.PacketConn) error

func (*Packet) DecodeFromReliableConn

func (pkt *Packet) DecodeFromReliableConn(conn net.PacketConn) error

func (*Packet) Dup

func (pkt *Packet) Dup()

Dup increases pkt's reference count.

Dup panics if it is called after the packet has been freed (i.e., it's reference count reached 0).

Modifying a packet after the first call to Dup is racy, and callers should use external locking for it.

func (*Packet) Free

func (pkt *Packet) Free()

Free releases a reference to the packet. Free is safe to use from concurrent goroutines.

func (*Packet) Len

func (p *Packet) Len() int

Len returns the length of the packet.

func (*Packet) SendOnConn

func (pkt *Packet) SendOnConn(conn net.PacketConn, address net.Addr) (int, error)

Jump to

Keyboard shortcuts

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