12 SocketCore::SocketCore(
14 u8* txbuff,
unsigned txbytes,
unsigned txpkt,
15 u8* rxbuff,
unsigned rxbytes,
unsigned rxpkt)
16 : satcat5::io::BufferedIO(
17 txbuff, txbytes, txpkt,
18 rxbuff, rxbytes, rxpkt)
25 #if SATCAT5_ALLOW_DELETION
69 unsigned zlen = satcat5::util::min_unsigned(rem,
m_rx.
zcw_maxlen());
satcat5::io::PacketBuffer m_tx
Transmit data (user writes, child reads)
satcat5::io::PacketBuffer m_rx
Receive data (user reads, child writes)
Limited read of next N bytes.
bool read_bytes(unsigned nbytes, void *dst) override
Read 0 or more bytes into a buffer.
unsigned get_read_ready() const override
How many bytes can be read without blocking?
const u8 * peek(unsigned nbytes) const
Peek nbytes into the circular buffer.
unsigned get_peek_ready() const
Find the longest available contiguous segment that can be requested by peek().
bool write_finalize() override
Mark end of frame and release temporary working data.
unsigned get_write_space() const override
How many bytes can be written without blocking?
void zcw_write(unsigned nbytes)
Zero-copy write (zcw) mode, required for UART interface.
unsigned get_read_ready() const override
How many bytes can be read without blocking?
unsigned get_buff_size() const
Accessor for children that need to delete underlying buffer.
unsigned zcw_maxlen() const
Max contiguous write length (ZCW).
void read_finalize() override
Consume any remaining bytes in this frame, if applicable.
u8 * zcw_start()
Pointer to a contiguous buffer (ZCW).
Abstract API for reading byte-streams and packets.
Abstract API for writing byte-streams and packets.
virtual void write_bytes(unsigned nbytes, const void *src)
Write 0 or more bytes from a buffer.
virtual bool write_finalize()
Mark end of frame and release temporary working data.
Defines a generic API for sending data to a specific destination, such as a MAC address,...
virtual bool ready() const =0
Is this address object ready for use? Child MUST override this method.
virtual satcat5::net::Dispatch * iface() const =0
Fetch a pointer to the underlying interface.
virtual satcat5::io::Writeable * open_write(unsigned len)=0
Open a new frame to the designated address and type.
virtual void close()=0
Close any open connections and revert to idle.
void add(satcat5::net::Protocol *proto)
Register a Protocol object.
void remove(satcat5::net::Protocol *proto)
Unregister a Protocol object.
A net::Protocol is the counterpart to net::Dispatch that handles a particular data stream,...
satcat5::net::Type m_filter
Incoming packet filter.
Buffered I/O for sending and receiving messages over a network.
bool ready_tx() const
Ready to transmit data?
satcat5::net::Address *const m_addr_ptr
Generic handler for a specific protocol and address.
~SocketCore() SATCAT5_OPTIONAL_DTOR
Constructor and destructor are only accessible to child class.
void frame_rcvd(satcat5::io::LimitedRead &src) override
Required event handlers.
bool ready_rx() const
Ready to receive data?
void close()
Close any open connections.
void data_rcvd(satcat5::io::Readable *src) override
Required event handlers.
Buffered wrappers for generic network communication.
constexpr satcat5::net::Type TYPE_NONE
The TYPE_NONE mask blocks all incoming frames.
Multipurpose filter for matching fields in network packets.
bool bound() const
Is this Type actively filtering or is it TYPE_NONE?
Miscellaneous mathematical utility functions.