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:
1 parent
5562877c99
commit
50d85363a3
79 files changed
+12348
-138
No files matched your search
@@ -0,0 +1,70 @@
|
||||
#ifndef TCPS_CONN_H_
|
||||
#define TCPS_CONN_H_
|
||||
|
||||
/**
|
||||
* @file TCPSConn.h
|
||||
* @brief One accepted connection of a TCPStreamService (internal).
|
||||
*
|
||||
* Ownership: created by the acceptor thread, then owned and deleted by exactly
|
||||
* one TCPSWorker. `streams` and `closeRequested` are the only fields touched
|
||||
* from other threads; `stream` is guarded by the service topology lock, the
|
||||
* queue by `qMutex`.
|
||||
*/
|
||||
|
||||
#include "CompilerTypes.h"
|
||||
#include "FastPollingMutexSem.h"
|
||||
#include "TCPSFrameQueue.h"
|
||||
#include "TCPStreamService.h"
|
||||
#include "UDPSProtocol.h"
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
namespace MARTe {
|
||||
|
||||
class TCPSWorker;
|
||||
class TCPSServiceStream;
|
||||
|
||||
struct TCPSConn {
|
||||
TCPSConn(int socketFd, TCPSWorker *owner, uint32 queueDepth, uint64 handshakeDeadline)
|
||||
: fd(socketFd), worker(owner), subscribed(false), hsHave(0u),
|
||||
hsWant(UDPS_HEADER_SIZE), hsHeaderOk(false), hsDeadline(handshakeDeadline),
|
||||
numStreams(0u), closeRequested(false) {
|
||||
for (uint32 i = 0u; i < TCPS_MAX_CONN_STREAMS; i++) {
|
||||
streams[i] = NULL_PTR(TCPSServiceStream *);
|
||||
}
|
||||
q.Init(queueDepth);
|
||||
}
|
||||
~TCPSConn() {
|
||||
if (fd >= 0) {
|
||||
(void)close(fd);
|
||||
}
|
||||
}
|
||||
|
||||
int fd;
|
||||
TCPSWorker *worker;
|
||||
|
||||
/* Worker-thread only. */
|
||||
bool subscribed;
|
||||
uint8 hs[UDPS_HEADER_SIZE + TCPS_MAX_SUBSCRIBE_PAYLOAD + 1u];
|
||||
uint32 hsHave;
|
||||
uint32 hsWant;
|
||||
bool hsHeaderOk;
|
||||
uint64 hsDeadline;
|
||||
|
||||
/* Service topology lock. */
|
||||
TCPSServiceStream *streams[TCPS_MAX_CONN_STREAMS]; ///< index = stream index on the wire
|
||||
uint32 numStreams;
|
||||
volatile bool closeRequested;
|
||||
|
||||
/* qMutex. */
|
||||
FastPollingMutexSem qMutex;
|
||||
TCPSFrameQueue q;
|
||||
|
||||
private:
|
||||
TCPSConn(const TCPSConn &);
|
||||
TCPSConn &operator=(const TCPSConn &);
|
||||
};
|
||||
|
||||
} // namespace MARTe
|
||||
|
||||
#endif // TCPS_CONN_H_
|
||||
Reference in new issue
Block a user