|
SatCat5
|
MultiBuffer with heap allocation.
Definition at line 117 of file posix_utils.h.
#include <posix_utils.h>
Public Member Functions | |
| MultiBufferHeap (unsigned nbytes=65536) | |
| 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 | |
| u8 *const | m_buffptr |
| Pointer to the underlying buffer. | |
| 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 |
|
protectedvirtualinherited |
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.
|
inherited |
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.
|
inherited |
Immediately free memory associated with this packet.
This is usually called by MultiReader::read_finalize().
Definition at line 243 of file multi_buffer.cc.
|
overrideprotectedvirtualinherited |
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.