43#include <StormByte/crypto/tls/session.hxx>
48#include <StormByte/safe/atomic.hxx>
49#include <StormByte/safe/function.hxx>
50#include <StormByte/safe/mutex.hxx>
51#include <StormByte/safe/pointers.hxx>
52#include <StormByte/safe/string.hxx>
103 class TLSConfiguration;
187 bool Connect(const
Connection::Protocol& protocol,
std::string_view address, const
unsigned short& port) override;
202 unsigned short port,
std::chrono::milliseconds timeout);
215 unsigned short port,
std::chrono::milliseconds timeout,
Safe::String& detail);
236 bool refresh_validation_time = true) noexcept;
247 Safe::String& detail,
bool refresh_validation_time = true);
286 std::chrono::milliseconds timeout,
321 StormByte::
Safe::String& address,
unsigned short& port) const noexcept;
360 void DropConnection() noexcept;
362 Safe::Mutex m_operation_mutex;
363 mutable
Safe::Mutex m_state_mutex;
364 Safe::Atomic<
bool> m_cancelled{
false};
STORMBYTE_DECLARE_MAYBE_SAFE(StormByte::Buffer::Bridge)
Cumulative telemetry owned by one Client instance.
Definition client_telemetry.hxx:71
Abstract application client.
Definition client.hxx:124
void Disconnect() noexcept override
Cancel I/O and disconnect if connected.
PacketPointer Send(const Transport::Packet &packet) noexcept
Send packet and return the response (or nullptr).
virtual ~Client() noexcept
Disconnect and release Safe owners inside Network.
RemoteFileWriterHandle CreateRemoteFileWriter(const RemoteFileMount &mount) noexcept
Attach a writer to an application-authorized exclusive remote mount.
StormByte::Safe::Shared< ClientTelemetry > Telemetry() const noexcept
Shared live telemetry for this Client instance only.
bool ConfigureTLS(const Crypto::TLS::ClientConfiguration &configuration, bool refresh_validation_time=true) noexcept
Require TLS for subsequent application and remote-file connections.
bool DisableTLS() noexcept
Restore plaintext for future connections while disconnected.
Client(const Client &other)=delete
Copy constructor (deleted).
bool Discover(const Connection::Protocol &protocol, unsigned short discovery_port, std::chrono::milliseconds timeout, StormByte::Safe::Function< bool(const DiscoveryReply &)> on_reply) noexcept
Send a discovery query and invoke on_reply for each response.
Error
Explicit request/connect failures; failed streams are never replayed.
Definition client.hxx:129
virtual bool InterpretDiscoveryReply(const StormByte::Safe::Binary &reply, StormByte::Safe::String &address, unsigned short &port) const noexcept
Interpret a discovery reply into a TCP endpoint.
Client(Client &&other) noexcept
Transfer Safe owners inside Network without moving the mutex.
Client(DeserializePacketFunction deserialize_packet_function, StormByte::Safe::Shared< Logger::Log > logger)
Construct with a packet factory and a logger.
RemoteFileReaderHandle CreateRemoteFileReader(const RemoteFileMount &mount) noexcept
Attach a reader to an application-authorized remote file mount.
virtual StormByte::Safe::Binary MakeDiscoveryQuery() const noexcept
Build the opaque discovery query.
Connection::Status Status() const noexcept override
Current connection status.
void Cancel() noexcept
Cancel the active operation and invalidate its application stream.
virtual bool AllowOutgoingOpcode(std::string_view uuid, Transport::Packet::OpcodeType opcode) const noexcept
Admit an outgoing opcode before applying the output pipeline.
bool Connect(const Connection::Protocol &protocol, std::string_view address, const unsigned short &port) override
Connect to a remote host with a ten-second total default budget.
virtual bool AllowIncomingOpcode(std::string_view uuid, Transport::Packet::OpcodeType opcode) const noexcept
Admit a received opcode before transformation and deserialization.
Caller-owned callback that builds a packet from opcode and payload.
Definition typedefs.hxx:143
Endpoint(DeserializePacketFunction deserialize_packet_function, StormByte::Safe::Shared< Logger::Log > logger) noexcept
Construct with a packet factory and a logger.
Public, validated descriptor for attaching to one remote file channel.
Definition remote_file_mount.hxx:69
Protocol
Address family for sockets.
Definition protocol.hxx:60
@ IPv4
IPv4 (AF_INET).
Definition protocol.hxx:61
Private native transport implementation.
Network module of the StormByte suite.
StormByte::Safe::Unique< BufferedRemoteFileReader > RemoteFileReaderHandle
Base-heap owner movable to Unique<Buffer::IO::BufferedLocationReader> without slicing.
Definition remote_file.hxx:387
StormByte::Safe::Unique< BufferedRemoteFileWriter > RemoteFileWriterHandle
Base-heap owner movable to Unique<Buffer::IO::BufferedLocationWriter> without slicing.
Definition remote_file.hxx:392
StormByte::Safe::Shared< Transport::Packet > PacketPointer
Base-heap shared packet pointer.
Definition typedefs.hxx:132
Root namespace of the StormByte suite.
std::conditional_t< Type::Reference< T >, std::expected< std::reference_wrapper< std::remove_reference_t< T > >, Safe::Shared< E > >, std::expected< T, Safe::Shared< E > > > Expected
One datagram received during discovery.
Definition discovery.hxx:65
#define STORMBYTE_NETWORK_PUBLIC
Definition visibility.h:51