SatCat5
satcat5::io::MultiBufferHeap Class Reference

Detailed Description

MultiBuffer with heap allocation.

Definition at line 117 of file posix_utils.h.

#include <posix_utils.h>

Inheritance diagram for satcat5::io::MultiBufferHeap:
[legend]
Collaboration diagram for satcat5::io::MultiBufferHeap:
[legend]

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::MultiPacketdequeue ()
 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::MultiChunknew_chunk ()
 Memory allocation.
 
satcat5::io::MultiPacketnew_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::MultiChunkm_free_chunks
 
satcat5::util::List< satcat5::io::MultiReaderm_read_ports
 
satcat5::util::List< satcat5::io::MultiPacketm_rcvd_packets
 

Private Attributes

satcat5::poll::OnDemandm_next
 
bool m_idle
 

Member Function Documentation

◆ deliver()

unsigned MultiBuffer::deliver ( satcat5::io::MultiPacket packet)
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.

Returns
The number of ports that accept the incoming packet.

Reimplemented in satcat5::router2::Dispatch, and satcat5::eth::SwitchCore.

Definition at line 208 of file multi_buffer.cc.

◆ enqueue()

bool MultiBuffer::enqueue ( satcat5::io::MultiPacket packet)
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.

◆ free_packet()

void MultiBuffer::free_packet ( satcat5::io::MultiPacket packet)
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.

◆ poll_demand()

void MultiBuffer::poll_demand ( )
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.

◆ request_poll()

void satcat5::poll::OnDemand::request_poll ( )
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.


The documentation for this class was generated from the following files: