|
SatCat5
|
A multi-source, multi-sink packet buffer.
Definition at line 198 of file multi_buffer.h.
#include <multi_buffer.h>
Public Member Functions | |
| MultiBuffer (u8 *buff, unsigned nbytes) | |
| Configure this object and link to the working buffer. | |
| bool | consistency () const |
| Internal consistency self-test (Optional). | |
| unsigned | get_free_bytes () const |
| Query remaining buffer capacity. | |
| u16 | get_pcount () |
| Current value of the packet counter. | |
| bool | enqueue (satcat5::io::MultiPacket *packet) |
| Queue an incoming packet for deferred processing. More... | |
| void | free_packet (satcat5::io::MultiPacket *packet) |
| Immediately free memory associated with this packet. More... | |
Protected Member Functions | |
| satcat5::io::MultiPacket * | dequeue () |
| Event handler for deferred packet delivery. | |
| void | poll_demand () override |
| Deferred event handler, called after request(). More... | |
| virtual unsigned | deliver (satcat5::io::MultiPacket *packet) |
| Deliver a complete packet to any number of output port(s). More... | |
| void | request_poll () |
| Call this method to request polling at a later time. More... | |
| void | request_cancel () |
| Call this method to cancel a previous request_poll(). | |
| satcat5::io::MultiChunk * | new_chunk () |
| Memory allocation. | |
| satcat5::io::MultiPacket * | new_packet () |
| Memory allocation. | |
Static Protected Member Functions | |
| static unsigned | count_ondemand () |
| Count queued objects of this type (i.e., non-idle). | |
Protected Attributes | |
| unsigned | m_free_bytes |
| u16 | m_pcount |
| satcat5::util::List< satcat5::io::MultiChunk > | m_free_chunks |
| satcat5::util::List< satcat5::io::MultiReader > | m_read_ports |
| satcat5::util::List< satcat5::io::MultiPacket > | m_rcvd_packets |
Private Attributes | |
| satcat5::poll::OnDemand * | m_next |
| bool | m_idle |
|
protectedvirtual |
Deliver a complete packet to any number of output port(s).
Default implementation broadcasts the packet to every port. Users MAY override this function to adjust this behavior.
Reimplemented in satcat5::router2::Dispatch, and satcat5::eth::SwitchCore.
Definition at line 208 of file multi_buffer.cc.
| bool MultiBuffer::enqueue | ( | satcat5::io::MultiPacket * | packet | ) |
Queue an incoming packet for deferred processing.
Note: This method SHOULD only be called from MultiWriter or its children. This method is public only for to allow flexibility in mutual "friend" inheritance rules.
Definition at line 176 of file multi_buffer.cc.
| void MultiBuffer::free_packet | ( | satcat5::io::MultiPacket * | packet | ) |
Immediately free memory associated with this packet.
This is usually called by MultiReader::read_finalize().
Definition at line 243 of file multi_buffer.cc.
|
overrideprotectedvirtual |
Deferred event handler, called after request().
Child class MUST override this method. (Call "request_poll" to enqueue a callback to this method.)
Implements satcat5::poll::OnDemand.
Definition at line 195 of file multi_buffer.cc.
|
inherited |
Call this method to request polling at a later time.
Safe to stack requests, but only one call to poll().
Definition at line 208 of file polling.cc.