103 #include <type_traits>
125 template <
typename ReqT,
typename RespT = Traits::EmptyType, SecurityType SecT = SecurityType::kWithoutSecurity>
128 using UniquePtr = std::unique_ptr<Server<ReqT, RespT, SecT>>;
129 using SharedPtr = std::shared_ptr<Server<ReqT, RespT, SecT>>;
144 static constexpr
bool kHasResp = !std::is_same_v<RespT, Traits::EmptyType>;
181 template <
typename ConfT,
typename = std::enable_if_t<std::is_base_of_v<Conf, ConfT>>>
245 bool reply(uint64_t req_id,
const RespT& resp);
248 [[nodiscard]]
bool has_clients()
const;
252 template <
bool HasPtrT>
253 bool reply_bytes(uint64_t req_id,
const Bytes& resp_data,
bool is_sync,
Bytes* resp_data_ptr =
nullptr);
268 template <
typename ReqT,
typename RespT = Traits::EmptyType>
271 using UniquePtr = std::unique_ptr<SecurityServer<ReqT, RespT>>;
272 using SharedPtr = std::shared_ptr<SecurityServer<ReqT, RespT>>;
284 template <
typename SecurityConfigT = Security::Config>
298 template <
typename SecurityConfigT = Security::Config>
312 template <
typename ConfT,
typename SecurityConfigT = Security::Config,
313 typename = std::enable_if_t<std::is_base_of_v<Conf, ConfT>>>
331 template <
typename SecurityConfigT = Security::Config>
332 explicit SecurityServer(
const std::string& url_str, SecurityConfigT&& sec_cfg = {},
Fixed-size 128-byte buffer holder with SBO, five ownership modes and integrated codecs.
Definition: bytes.h:120
Copyable type-erased callable analogue of std::function with a tunable SBO and pool spill.
Definition: functional.h:131
Transport-agnostic CRTP base for all VLink communication primitives.
Definition: node.h:164
Convenience alias of Server with per-message encryption enabled.
Definition: server.h:269
std::shared_ptr< SecurityServer< ReqT, RespT > > SharedPtr
Owning shared-pointer alias.
Definition: server.h:272
std::unique_ptr< SecurityServer< ReqT, RespT > > UniquePtr
Owning unique-pointer alias.
Definition: server.h:271
static UniquePtr create_unique(const std::string &url_str, SecurityConfigT &&sec_cfg={}, InitType type=InitType::kWithInit)
Heap-allocates a SecurityServer and wraps it in a std::unique_ptr.
Definition: server-inl.h:350
static SharedPtr create_shared(const std::string &url_str, SecurityConfigT &&sec_cfg={}, InitType type=InitType::kWithInit)
Heap-allocates a SecurityServer and wraps it in a std::shared_ptr.
Definition: server-inl.h:360
SecurityServer(const ConfT &conf, SecurityConfigT &&sec_cfg={}, InitType type=InitType::kWithInit)
Constructs a SecurityServer from a typed configuration object.
Definition: server-inl.h:370
Type-safe RPC handler for the VLink method communication model.
Definition: server.h:126
bool reply(uint64_t req_id, const RespT &resp)
Emits the asynchronous response for a previously received request.
Definition: server-inl.h:228
static constexpr ImplType kImplType
Node role tag (kServer).
Definition: server.h:143
static SharedPtr create_shared(const std::string &url_str, InitType type=InitType::kWithInit)
Heap-allocates a Server and wraps it in a std::shared_ptr.
Definition: server-inl.h:45
static UniquePtr create_unique(const std::string &url_str, InitType type=InitType::kWithInit)
Heap-allocates a Server and wraps it in a std::unique_ptr.
Definition: server-inl.h:39
Server(const ConfT &conf, InitType type=InitType::kWithInit)
Constructs a server from a typed transport configuration object.
Definition: server-inl.h:52
std::shared_ptr< Server< ReqT, RespT, SecT > > SharedPtr
Owning shared-pointer alias.
Definition: server.h:129
static constexpr bool kHasResp
true when response produced.
Definition: server.h:144
static constexpr Serializer::Type kRespType
Codec for the response.
Definition: server.h:146
bool listen(ReqCallback &&callback)
Installs a fire-and-forget request handler.
Definition: server-inl.h:110
static constexpr Serializer::Type kReqType
Codec for the request.
Definition: server.h:145
bool listen_for_reply(ReqAsyncRespCallback &&callback)
Installs a handler that defers the reply via reply().
Definition: server-inl.h:200
std::unique_ptr< Server< ReqT, RespT, SecT > > UniquePtr
Owning unique-pointer alias.
Definition: server.h:128
Pool-backed type-erased callables: copyable vlink::Function and move-only vlink::MoveFunction.
Type
Identifies the codec to use for a given C++ message type.
Definition: serializer.h:154
constexpr bool is_supported(Type type) noexcept
Reports whether type identifies a usable codec.
Definition: serializer-inl.h:160
InitType
Selects between immediate and deferred node initialisation.
Definition: types.h:154
@ kWithInit
Initialise immediately in the constructor.
ImplType
Bitmask identifying the role of a VLink node implementation.
Definition: types.h:110
@ kServer
Method server (RPC responder).
Definition: types.h:112
Common CRTP base for every VLink communication primitive.
Transport-neutral base class for every method-model server implementation.