|
VLink
2.1.0
A high-performance communication middleware
|
Convenience alias of Client with per-message encryption enabled.
More...
#include <client.h>
Public Types | |
| using | UniquePtr = std::unique_ptr< SecurityClient< ReqT, RespT > > |
| Owning unique-pointer alias. More... | |
| using | SharedPtr = std::shared_ptr< SecurityClient< ReqT, RespT > > |
| Owning shared-pointer alias. More... | |
Public Types inherited from vlink::Client< ReqT, Traits::EmptyType, SecurityType::kWithSecurity > | |
| using | UniquePtr = std::unique_ptr< Client< ReqT, Traits::EmptyType, SecT > > |
| Owning unique-pointer alias. More... | |
| using | SharedPtr = std::shared_ptr< Client< ReqT, Traits::EmptyType, SecT > > |
| Owning shared-pointer alias. More... | |
| using | ConnectCallback = NodeImpl::ConnectCallback |
| Callback type for server presence transitions. More... | |
| using | RespCallback = Function< void(const Traits::EmptyType &)> |
| Callback signature for asynchronous responses. More... | |
Public Types inherited from vlink::Node< ImplT, SecT > | |
| using | StatusCallback = NodeImpl::StatusCallback |
| Handler signature for status-change notifications. More... | |
Public Member Functions | |
| template<typename ConfT , typename SecurityConfigT = Security::Config, typename = std::enable_if_t<std::is_base_of_v<Conf, ConfT>>> | |
| SecurityClient (const ConfT &conf, SecurityConfigT &&sec_cfg={}, InitType type=InitType::kWithInit) | |
Constructs a SecurityClient from a typed configuration object. More... | |
| template<typename SecurityConfigT = Security::Config> | |
| SecurityClient (const std::string &url_str, SecurityConfigT &&sec_cfg={}, InitType type=InitType::kWithInit) | |
Constructs a SecurityClient from a URL string and installs the security configuration. More... | |
Public Member Functions inherited from vlink::Client< ReqT, Traits::EmptyType, SecurityType::kWithSecurity > | |
| Client (const ConfT &conf, InitType type=InitType::kWithInit) | |
| Constructs a client from a typed transport configuration object. More... | |
| Client (const std::string &url_str, InitType type=InitType::kWithInit) | |
| Constructs a client from a URL string. More... | |
| ~Client () override | |
| Destroys the client and tears down outstanding promises. More... | |
| void | detect_connected (ConnectCallback &&callback) |
| Registers a callback invoked when the server-presence state changes. More... | |
| bool | wait_for_connected (std::chrono::milliseconds timeout=Timeout::kDefaultInterval) |
Blocks until a server is discovered or timeout expires. More... | |
| bool | is_connected () const |
| Non-blocking query of server presence. More... | |
| bool | invoke (const ReqT &req, Traits::EmptyType &resp, std::chrono::milliseconds timeout=Timeout::kDefaultInterval) |
| Synchronous request/response invocation with an output parameter. More... | |
| std::optional< Traits::EmptyType > | invoke (const ReqT &req, std::chrono::milliseconds timeout=Timeout::kDefaultInterval) |
Synchronous request/response invocation returning a std::optional. More... | |
| bool | invoke (const ReqT &req, RespCallback &&callback) |
| Asynchronous callback-based invocation. More... | |
| std::future< Traits::EmptyType > | async_invoke (const ReqT &req) |
| Asynchronous future-based invocation. More... | |
| bool | send (const ReqT &req) |
| Fire-and-forget request emission. More... | |
Public Member Functions inherited from vlink::Node< ImplT, SecT > | |
| virtual bool | init () |
| Initialises the node and its transport back-end. More... | |
| virtual bool | deinit () |
| Tears the node down and releases all transport resources. More... | |
| virtual void | interrupt () |
| Aborts any blocking wait on this node. More... | |
| bool | has_inited () const |
Reports whether init() has been successfully called. More... | |
| bool | is_support_loan () const |
| Reports whether the transport supports zero-copy loaned buffers. More... | |
| Bytes | loan (int64_t size) |
| Allocates a loaned buffer from the transport memory pool. More... | |
| bool | return_loan (const Bytes &bytes) |
| Returns a previously loaned buffer to the transport pool. More... | |
| bool | suspend () |
| Suspends message delivery on this node. More... | |
| bool | resume () |
Resumes message delivery after a prior suspend(). More... | |
| bool | is_suspend () const |
| Reports whether the node is currently suspended. More... | |
| bool | attach (class MessageLoop *message_loop) |
Attaches the node to a MessageLoop for callback dispatch. More... | |
| bool | detach () |
Detaches the node from its current MessageLoop. More... | |
| class MessageLoop * | get_message_loop () const |
Returns the MessageLoop this node is currently attached to. More... | |
| const AbstractNode * | get_abstract_node () const |
| Returns the abstract-graph handle for runtime topology inspection. More... | |
| Status::BasePtr | get_status (Status::Type type) const |
| Retrieves the current status object for the requested category. More... | |
| void | register_status_handler (StatusCallback &&callback) |
| Registers a handler invoked whenever the node's status changes. More... | |
| void | set_property (const std::string &prop, const std::string &value) |
| Sets a transport-specific string-keyed property. More... | |
| std::string | get_property (const std::string &prop) const |
| Retrieves a previously set transport-specific property value. More... | |
| TransportType | get_transport_type () const |
Returns the TransportType this node is bound to. More... | |
| const std::string & | get_url () const |
| Returns the URL string used to construct this node. More... | |
| void | set_record_path (const std::string &path) |
| Enables recording of inbound or outbound messages to a bag file. More... | |
| void | set_ser_type (const std::string &ser_type, SchemaType schema_type=SchemaType::kUnknown) |
| Overrides the runtime wire-metadata identifiers for this node. More... | |
| const std::string & | get_ser_type () const |
| Returns the current concrete runtime type identifier. More... | |
| SchemaType | get_schema_type () const |
| Returns the current coarse schema family. More... | |
| void | set_discovery_enabled (bool enable) |
| Toggles peer-discovery on this node. More... | |
| bool | get_discovery_enabled () const |
| Reports whether peer-discovery is currently enabled. More... | |
| void | bind_proto_arena (void *proto_arena) |
| Binds a Protobuf Arena for arena-allocated message objects. More... | |
| double | get_cpu_usage () const |
| Returns the cumulative CPU-usage ratio sampled by the profiler. More... | |
| bool | get_safety_quit () const |
| Reports whether safe-quit mode is currently active. More... | |
| void | set_safety_quit (bool safety_quit) |
| Enables or disables safe-quit mode. More... | |
| void | set_ssl_options (const SslOptions &options) |
| Configures transport-layer SSL/TLS encryption for this node. More... | |
Static Public Member Functions | |
| template<typename SecurityConfigT = Security::Config> | |
| static UniquePtr | create_unique (const std::string &url_str, SecurityConfigT &&sec_cfg={}, InitType type=InitType::kWithInit) |
Heap-allocates a SecurityClient and wraps it in a std::unique_ptr. More... | |
| template<typename SecurityConfigT = Security::Config> | |
| static SharedPtr | create_shared (const std::string &url_str, SecurityConfigT &&sec_cfg={}, InitType type=InitType::kWithInit) |
Heap-allocates a SecurityClient and wraps it in a std::shared_ptr. More... | |
Static Public Member Functions inherited from vlink::Client< ReqT, Traits::EmptyType, SecurityType::kWithSecurity > | |
| static UniquePtr | create_unique (const std::string &url_str, InitType type=InitType::kWithInit) |
Heap-allocates a Client and wraps it in a std::unique_ptr. More... | |
| static SharedPtr | create_shared (const std::string &url_str, InitType type=InitType::kWithInit) |
Heap-allocates a Client and wraps it in a std::shared_ptr. More... | |
Additional Inherited Members | |
Static Public Attributes inherited from vlink::Client< ReqT, Traits::EmptyType, SecurityType::kWithSecurity > | |
| static constexpr ImplType | kImplType |
Node role tag (kClient). More... | |
| static constexpr bool | kHasResp |
true when response expected. More... | |
| static constexpr Serializer::Type | kReqType |
| Codec for the request. More... | |
| static constexpr Serializer::Type | kRespType |
| Codec for the response. More... | |
Protected Member Functions inherited from vlink::Node< ImplT, SecT > | |
| Node () | |
| virtual | ~Node () |
| bool | enable_security (const Security::Config &cfg) |
Installs a Security configuration before transport initialisation. More... | |
| bool | enable_security (Security::Config &&cfg) |
| Move overload for construction-time security installation. More... | |
| template<typename CallbackT , typename... ArgsT> | |
| void | invoke_callback (const CallbackT &callback, ArgsT &&... args) |
| template<typename TypeT > | |
| TypeT | get_default_value () |
Protected Attributes inherited from vlink::Node< ImplT, SecT > | |
| void * | proto_arena_ {nullptr} |
| bool | is_support_loan_ {false} |
| std::atomic_bool | has_inited_ {false} |
| std::optional< std::mutex > | quit_mtx_ |
| std::unique_ptr< ImplT > | impl_ |
Convenience alias of Client with per-message encryption enabled.
Equivalent to Client<ReqT, RespT, SecurityType::kWithSecurity>. Each outgoing request is encrypted before transmission and each incoming response is decrypted before codec dispatch.
| ReqT | Request message type. |
| RespT | Response message type. Defaults to Traits::EmptyType. |
| using vlink::SecurityClient< ReqT, RespT >::SharedPtr = std::shared_ptr<SecurityClient<ReqT, RespT> > |
Owning shared-pointer alias.
| using vlink::SecurityClient< ReqT, RespT >::UniquePtr = std::unique_ptr<SecurityClient<ReqT, RespT> > |
Owning unique-pointer alias.
|
inlineexplicit |
Constructs a SecurityClient from a typed configuration object.
| ConfT | Configuration type derived from Conf. |
| SecurityConfigT | Forwardable Security::Config compatible type. |
| conf | Populated configuration aggregate. |
| sec_cfg | Security configuration; empty uses the default symmetric slot. |
| type | Whether to call init() inline; default is InitType::kWithInit. |
|
inlineexplicit |
Constructs a SecurityClient from a URL string and installs the security configuration.
Builds the base Client in kWithoutInit mode, installs sec_cfg via enable_security(), then calls init() unless deferred. When enable_security() fails to produce a usable NodeImpl::security the subsequent init() will fail.
| SecurityConfigT | Forwardable Security::Config compatible type. |
| url_str | Service URL string. |
| sec_cfg | Security configuration; empty uses the default symmetric slot. |
| type | Whether to call init() inline; default is InitType::kWithInit. |
|
inlinestatic |
Heap-allocates a SecurityClient and wraps it in a std::shared_ptr.
| SecurityConfigT | Forwardable Security::Config compatible type. |
| url_str | Service URL string. |
| sec_cfg | Security configuration; empty uses the default symmetric slot. |
| type | Whether to call init() inline; default is InitType::kWithInit. |
SharedPtr to the new secure client.
|
inlinestatic |
Heap-allocates a SecurityClient and wraps it in a std::unique_ptr.
| SecurityConfigT | Forwardable Security::Config compatible type. |
| url_str | Service URL string. |
| sec_cfg | Security configuration; empty uses the default symmetric slot. |
| type | Whether to call init() inline; default is InitType::kWithInit. |
UniquePtr to the new secure client.