36#ifndef _UTILS_BUFFERPORT_HXX_
37#define _UTILS_BUFFERPORT_HXX_
58 unsigned buffer_bytes,
long long delay_nsec)
92 config_gridconnect_bridge_max_outgoing_packets() <= 1
97 bool opt_flush =
false;
103 if (
msg().data()[0] ==
':' &&
msg().data()[1] ==
'X') {
104 if (
msg().data()[3] ==
'A' ||
msg().data()[3] ==
'D')
109 else if (strncmp(
msg().data() + 3,
"9A28", 4) == 0)
174 b->set_done(
message()->new_child());
212 } bufferTimer_{
this};
217 (unsigned)config_gridconnect_bridge_max_outgoing_packets()};
#define STATE(_fn)
Turns a function name into an argument to be supplied to functions expecting a state.
Timer that triggers the parent flow when expiring.
BufferTimer(BufferPort *parent)
Constructor.
BufferPort * parent_
what to notify upon timeout.
long long timeout() override
Clients of timer should override this function.
A wrapper class around a string-based Hub Port that buffers the outgoing bytes for a specified delay ...
HubPortInterface * downstream_
Where to send output data to.
long long delayNsec_
How long maximum we should buffer the input data.
Action entry() override
Entry into the StateFlow activity.
Action buf_alloc_done()
State when the allocation of output buffer completed.
LimitedPool outputPool_
Pool implementation that limits the number of buffers allocatable to the configuration option.
char * sendBuf_
Temporarily stores outgoing data.
Buffer< HubData > * tgtBuf_
Caches one output buffer to fill in the buffer flush method.
unsigned bufSize_
How many bytes are there in the send buffer.
void timeout()
Callback from the timer.
void flush_buffer()
Sends off any data we may have accumulated in the buffer to the downstream consumer.
unsigned bufEnd_
Offset in sendBuf_ of the first unused byte.
BufferPort(Service *service, HubPortInterface *downstream, unsigned buffer_bytes, long long delay_nsec)
Constructor.
unsigned timerPending_
1 if the timer is running and there will be a timer callback coming in the future.
Base class for all QMember types that hold data in an expandable format.
virtual void send(MessageType *message, unsigned priority=UINT_MAX)=0
Entry point to the flow.
Implementation of a Pool interface that takes memory from mainBufferPool (configurable) but limits th...
Collection of related state machines that pend on incoming messages.
Return type for a state flow callback.
Service * service()
Return a pointer to the service I am bound to.
Action allocate_and_call(FlowInterface< Buffer< T > > *target_flow, Callback c, Pool *pool=nullptr)
Allocates a buffer from a pool and proceed to the next state when allocation is successful.
Buffer< T > * get_allocation_result(FlowInterface< Buffer< T > > *target_flow)
Takes the result of the asynchronous allocation.
Action again()
Call the current state again via call_immediately.
Action exit()
Terminates the processing of this flow.
Action release_and_exit()
Terminates the processing of the current message.
State flow with a given typed input queue.
A timer that can schedule itself to run on an executor at specified times in the future.
@ NONE
Do not restart the timer.
MessageType * transfer_message()
Releases ownership of the current message.
Action call_immediately(Callback c)
Imediately call the next state upon return.
#define HASSERT(x)
Checks that the value of expression x is true, else terminates the current process.