Files
logos-cpp-sdk/cpp/logos_transport_factory.h
Dario Lipicar 25c88f4d48 support non-local remote transports (#57)
* support non-local remote transports

* fix LogosResult

* allow getting client over specific transport

* fix ssl

* investiage ssl error

* pr comments

* allow transport set configuration on any module

* pr comments

* add docs

* pr comments

* propagate only non-qt dependencies

* restore ABI compatibility
2026-05-07 12:27:14 -03:00

60 lines
2.1 KiB
C++

#ifndef LOGOS_TRANSPORT_FACTORY_H
#define LOGOS_TRANSPORT_FACTORY_H
#include "logos_transport_config.h"
#include <memory>
#include <QString>
class LogosTransportHost;
class LogosTransportConnection;
namespace LogosTransportFactory {
/**
* @brief Create a transport host for `cfg`, honoring the process-wide
* LogosMode.
*
* Resolution rule:
* - LogosMode::Mock → MockTransportHost (cfg ignored)
* - LogosMode::Local → LocalTransportHost (cfg ignored)
* - LogosMode::Remote + LocalSocket → RemoteTransportHost (QRO)
* - LogosMode::Remote + Tcp/TcpSsl → PlainTransportHost(cfg)
*
* Mode wins over `cfg.protocol` so test fixtures that switch the
* process into Mock/Local always get the test transport, regardless
* of which overload (or which LogosAPIProvider constructor) was
* used. In Remote mode, `cfg` chooses the wire protocol and
* carries the bind/dial address + TLS material.
*/
std::unique_ptr<LogosTransportHost>
createHost(const LogosTransportConfig& cfg,
const QString& registryUrl);
/**
* @brief Convenience: createHost using the process-global default
* LogosTransportConfig. Equivalent to
* `createHost(LogosTransportConfigGlobal::getDefault(), registryUrl)`.
*/
std::unique_ptr<LogosTransportHost> createHost(const QString& registryUrl);
/**
* @brief Create a transport connection for `cfg`, honoring the
* process-wide LogosMode. Same resolution rule as createHost — see
* its doc-comment for the full table.
*/
std::unique_ptr<LogosTransportConnection>
createConnection(const LogosTransportConfig& cfg,
const QString& registryUrl);
/**
* @brief Convenience: createConnection using the process-global default
* LogosTransportConfig. Equivalent to
* `createConnection(LogosTransportConfigGlobal::getDefault(), registryUrl)`.
*/
std::unique_ptr<LogosTransportConnection> createConnection(const QString& registryUrl);
}
#endif // LOGOS_TRANSPORT_FACTORY_H