feat(tcp): TCPStreamer DataSources, in-process TCPStreamService, stream multiplexing and TCPStreamJoin

Add TCPStreamer/TCPStreamerClient (TCP transport behind the UDPSServerI/UDPSClientI
seam), an optional single in-process TCPStreamService serving many streams over
worker threads, multiplexed SUBSCRIBE (comma list, stream index in fragmentIdx),
and TCPStreamJoin, which merges several streams into one sample-and-hold stream
paced by a master. StreamHub takes a comma list of streams over one connection.
Includes GTests, E2E scenarios s58-s73 and docs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Martino FerrariandClaude Opus 4.6 committed 2026-11-06 13:41:27 +01:00
1 parent 5562877c99
commit 50d85363a3
79 files changed
+12348 -138

No files matched your search

@@ -0,0 +1,68 @@
#ifndef TCPS_WORKER_H_
#define TCPS_WORKER_H_
/**
* @file TCPSWorker.h
* @brief One I/O thread of a TCPStreamService (internal).
*
* Owns a set of connections, polls them (plus a self-pipe used by producers to
* announce new frames), performs the SUBSCRIBE handshake, flushes the bounded
* queues and evicts stalled / dead peers.
*/
#include "EmbeddedServiceMethodBinderI.h"
#include "ExecutionInfo.h"
#include "FastPollingMutexSem.h"
#include "SingleThreadService.h"
#include <poll.h>
namespace MARTe {
class TCPStreamService;
struct TCPSConn;
class TCPSWorker : public EmbeddedServiceMethodBinderI {
public:
TCPSWorker(TCPStreamService &owner, uint32 maxConns);
virtual ~TCPSWorker();
bool Start(uint32 cpuMask, uint32 stackSize);
void Stop();
/** Hand a freshly accepted connection to this worker (acceptor thread). */
bool AddIncoming(TCPSConn *c);
/** Interrupt the poll so queued data is flushed now (any thread, cheap). */
void Wake();
/** @return connections currently assigned (approximate). */
int32 Load() const;
virtual ErrorManagement::ErrorType Execute(ExecutionInfo &info);
private:
void AdoptIncoming();
bool HandshakeStep(TCPSConn &c);
bool Drain(TCPSConn &c);
void CloseConn(TCPSConn *c);
void CloseAll();
TCPStreamService &service;
uint32 maxConns;
SingleThreadService thread;
int wakeFd[2];
FastPollingMutexSem incomingMutex;
TCPSConn **incoming;
uint32 numIncoming;
TCPSConn **conns;
uint32 numConns;
struct pollfd *pfds;
volatile int32 load;
};
} // namespace MARTe
#endif // TCPS_WORKER_H_