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>
72 lines
2.2 KiB
C++
72 lines
2.2 KiB
C++
#ifndef UDPS_TRANSPORT_I_H_
|
|
#define UDPS_TRANSPORT_I_H_
|
|
|
|
/**
|
|
* @file UDPSTransportI.h
|
|
* @brief Abstract transport seams used by the UDPStreamer / UDPStreamerClient
|
|
* DataSources.
|
|
*
|
|
* The DataSources only ever touch their transport through these few calls, so
|
|
* a different transport (TCP) can be plugged in without duplicating the
|
|
* serialisation, quantisation, publishing and decode logic.
|
|
*/
|
|
|
|
#include "CompilerTypes.h"
|
|
#include "StructuredDataI.h"
|
|
|
|
namespace MARTe {
|
|
|
|
class UDPSClientListener;
|
|
|
|
/**
|
|
* @brief Producer-side transport. NOT thread-safe: every call must come from
|
|
* the owner's sender thread.
|
|
*/
|
|
class UDPSServerI {
|
|
public:
|
|
virtual ~UDPSServerI() {}
|
|
|
|
/** Read the transport configuration. */
|
|
virtual bool Initialise(StructuredDataI &data) = 0;
|
|
/** Open sockets and start accepting clients (idempotent). */
|
|
virtual bool Start() = 0;
|
|
/** Close everything (idempotent). */
|
|
virtual bool Stop() = 0;
|
|
/** Non-blocking housekeeping: accept/evict clients, drain queues. */
|
|
virtual void ServiceClients() = 0;
|
|
/** Publish (and cache) a CONFIG payload. */
|
|
virtual bool SendConfig(const uint8 *payload, uint32 payloadSize) = 0;
|
|
/** Publish a DATA payload. */
|
|
virtual bool SendData(uint32 counter, const uint8 *payload, uint32 payloadSize) = 0;
|
|
/** @return true when at least one client is attached. */
|
|
virtual bool HasClients() const = 0;
|
|
/** @return true when the transport uses multicast. */
|
|
virtual bool IsMulticast() const = 0;
|
|
/** @return the (bound) port. */
|
|
virtual uint16 GetPort() const = 0;
|
|
};
|
|
|
|
/**
|
|
* @brief Consumer-side transport. Delivers through UDPSClientListener.
|
|
*/
|
|
class UDPSClientI {
|
|
public:
|
|
virtual ~UDPSClientI() {}
|
|
|
|
virtual bool Initialise(StructuredDataI &data) = 0;
|
|
/** Must be called before Start(). */
|
|
virtual void SetListener(UDPSClientListener *listener) = 0;
|
|
virtual bool Start() = 0;
|
|
virtual bool Stop() = 0;
|
|
/**
|
|
* @return Packets missing between the previous DATA packet and the one
|
|
* being delivered (valid inside OnUDPSData). 0 when the transport does
|
|
* not track it.
|
|
*/
|
|
virtual uint32 GetLastDataGap() const { return 0u; }
|
|
};
|
|
|
|
} // namespace MARTe
|
|
|
|
#endif // UDPS_TRANSPORT_I_H_
|