Livt packages

Livt.Net

Version 1.4.1

Ethernet, IPv4, TCP, UDP, ARP, TFTP, and Telnet networking components for Livt hardware.

Published files (163)

src/packet/IPacketData.lvt

namespace Livt.Net

/**
 * Result of a checked packet-data operation. Failed read output is not data.
 */
enum PacketDataResult
{
	Success
	NotReady
	Busy
	Invalid
}

/**
 * Scheduled read-only access to a stable, published byte prefix.
 * One serialized owner in the same clock/reset context. The owner must keep
 * the source published and unchanged until all dependent regions are closed.
 * Protocol identity, declared length and wire-length knowledge are separate.
 */
interface IPacketData
{
	/**
	 * Reports a published, readable prefix; this snapshot does not reserve or borrow it.
	 */
	fn IsReady() bool

	/**
	 * Returns the currently readable prefix length in bytes, or zero when unavailable.
	 * This is a captured/prepared bound, not a protocol-declared or wire length.
	 */
	fn GetAvailableLength() int

	/**
	 * Performs a scheduled read at a zero-based byte index within the available
	 * prefix. Success makes value valid; failure output is not data. NotReady
	 * means unavailable and Invalid means outside the bound. The owner must keep
	 * the source stable until this call and all dependent reads have finished.
	 */
	fn TryRead(index: int, value: out byte) PacketDataResult
}