16 BufferedIO::BufferedIO(
17 u8* txbuff,
unsigned txbytes,
unsigned txpkt,
18 u8* rxbuff,
unsigned rxbytes,
unsigned rxpkt)
21 , m_tx(txbuff, txbytes, txpkt)
22 , m_rx(rxbuff, rxbytes, rxpkt)
39 #if SATCAT5_ALLOW_DELETION
40 BufferedCopy::~BufferedCopy() {
58 , m_max_chunk(max_chunk)
59 , m_min_txnow(min_unsigned(max_chunk, min_txnow))
66 #if SATCAT5_ALLOW_DELETION
67 BufferedStream::~BufferedStream() {
75 if (nread >= m_min_txnow) {
77 ncopy = min_unsigned(nread, m_max_chunk);
78 }
else if (m_tref.
clk) {
81 }
else if (m_timeout_msec) {
83 m_tref = SATCAT5_CLOCK->checkpoint_msec(m_timeout_msec);
94 m_tref = {
nullptr, 0};
110 #if SATCAT5_ALLOW_DELETION
111 BufferedPackets::~BufferedPackets() {
127 satcat5::io::BufferedWriter::BufferedWriter(
129 u8* txbuff,
unsigned txbytes,
unsigned txpkt)
131 , m_buff(txbuff, txbytes, txpkt)
132 , m_copy(&m_buff, dst)
BufferedCopy copies from any Readable source to any Writeable sink.
BufferedCopy(satcat5::io::Readable *src, satcat5::io::Writeable *dst, satcat5::io::CopyMode mode=CopyMode::PACKET)
Create an object that copies data from src to dst.
void data_unlink(satcat5::io::Readable *src) override
Unlink this EventListener from the designated source, because the designated Readable object is being...
satcat5::io::Readable * src()
Other accessors.
void data_rcvd(satcat5::io::Readable *src) override
The data_rcvd() callback is polled whenever data is available.
Extensible transmit and receive buffer.
satcat5::io::PacketBuffer m_tx
Transmit data (user writes, child reads)
satcat5::io::PacketBuffer m_rx
Receive data (user reads, child writes)
Copy packets from a Readable source to a network address.
void data_rcvd(satcat5::io::Readable *src) override
The data_rcvd() callback is polled whenever data is available.
void data_unlink(satcat5::io::Readable *src) override
Unlink this EventListener from the designated source, because the designated Readable object is being...
BufferedPackets(satcat5::io::Readable *src, satcat5::net::Address *dst)
Set source, destination, APID, and chunk-size.
Copy bytes from a Readable source to a network address.
void data_unlink(satcat5::io::Readable *src) override
Unlink this EventListener from the designated source, because the designated Readable object is being...
BufferedStream(satcat5::io::Readable *src, satcat5::net::Address *dst, unsigned max_chunk=512, unsigned min_txnow=UINT_MAX)
Set source, destination, APID, and chunk-size.
void data_rcvd(satcat5::io::Readable *src) override
The data_rcvd() callback is polled whenever data is available.
Limited read of next N bytes.
Abstract API for reading byte-streams and packets.
virtual void read_finalize()
Consume any remaining bytes in this frame, if applicable.
bool copy_and_finalize(satcat5::io::Writeable *dst, satcat5::io::CopyMode mode=CopyMode::PACKET)
Copy data to a Writeable object, then finalize.
virtual void set_callback(satcat5::io::EventListener *callback)
Update registered callback for data_rcvd() events.
virtual unsigned get_read_ready() const =0
How many bytes can be read without blocking?
Wrapper class for forwarding reads to another object.
Abstract API for writing byte-streams and packets.
Wrapper class for forwarding writes to another object.
Defines a generic API for sending data to a specific destination, such as a MAC address,...
virtual satcat5::io::Writeable * open_write(unsigned len)=0
Open a new frame to the designated address and type.
Buffered I/O wrappers for PacketBuffer.
CopyMode
Specify read and write behavior for Readable::copy_and_finalize().
Generic network Address API.
TimeRef * clk
Pointer to the parent time reference.
bool checkpoint_elapsed()
Test if an oven-timer checkpoint has elapsed.
Miscellaneous mathematical utility functions.
constexpr unsigned min_unsigned(unsigned a, unsigned b)
Min and max functions.