107template <
typename ReqT,
typename RespT = Traits::EmptyType, SecurityType SecT = SecurityType::kWithoutSecurity>
111 using UniquePtr = std::unique_ptr<Server<ReqT, RespT, SecT>>;
114 using SharedPtr = std::shared_ptr<Server<ReqT, RespT, SecT>>;
135 static constexpr bool kHasResp = !std::is_same_v<RespT, Traits::EmptyType>;
176 template <
typename ConfT,
typename = std::enable_if_t<std::is_base_of_v<Conf, ConfT>>>
239 bool reply(uint64_t req_id,
const RespT& resp);
242 [[nodiscard]]
bool has_clients()
const;
246 template <
bool HasPtrT>
247 bool reply_bytes(uint64_t req_id,
const Bytes& resp_data,
bool is_sync,
Bytes* resp_data_ptr =
nullptr);
262template <
typename ReqT,
typename RespT = Traits::EmptyType>
Versatile 128-byte byte buffer with SBO, five ownership modes and compression helpers.
Definition bytes.h:113
std::function< void(uint64_t, const Bytes &, Bytes *)> ReqRespCallback
Callback for ServerImpl request/response processing.
Definition node_impl.h:170
Node()
Definition node-inl.h:322
Convenience alias for Server with message security enabled.
Definition server.h:263
bool reply(uint64_t req_id, const RespT &resp)
Sends an asynchronous response for a previously received request.
Definition server-inl.h:229
std::unique_ptr< Server< ReqT, RespT, SecT > > UniquePtr
Unique-pointer alias.
Definition server.h:111
static constexpr ImplType kImplType
Node role identifier (kServer).
Definition server.h:132
static SharedPtr create_shared(const std::string &url_str, InitType type=InitType::kWithInit)
Creates a Server on the heap wrapped in a shared_ptr.
Definition server-inl.h:45
static UniquePtr create_unique(const std::string &url_str, InitType type=InitType::kWithInit)
Creates a Server on the heap wrapped in a unique_ptr.
Definition server-inl.h:39
std::function< void(const ReqT &, RespT &)> ReqRespCallback
Synchronous callback – response filled in-place inside the callback.
Definition server.h:120
Server(const ConfT &conf, InitType type=InitType::kWithInit)
Constructs a server from a typed transport configuration object.
Definition server-inl.h:52
static constexpr bool kHasResp
true when RespT is not EmptyType (server has a response).
Definition server.h:135
static constexpr Serializer::Type kRespType
Serializer type for RespT.
Definition server.h:141
std::function< void(uint64_t, const ReqT &)> ReqAsyncRespCallback
Asynchronous callback – response sent later via reply(req_id, resp).
Definition server.h:129
std::shared_ptr< Server< ReqT, RespT, SecT > > SharedPtr
Shared-pointer alias.
Definition server.h:114
std::function< void(const ReqT &)> ReqCallback
Fire-and-forget callback – no response (RespT must be EmptyType).
Definition server.h:117
bool listen(ReqCallback &&callback)
Registers a fire-and-forget request callback (no response).
Definition server-inl.h:111
static constexpr Serializer::Type kReqType
Serializer type for ReqT.
Definition server.h:138
bool listen_for_reply(ReqAsyncRespCallback &&callback)
Registers an asynchronous request callback (reply sent later).
Definition server-inl.h:201
constexpr Type get_type_of() noexcept
Deduces the Type enumerator for T at compile time.
Definition serializer-inl.h:160
Type
Identifies the serialisation codec to use for a given C++ type.
Definition serializer.h:123
constexpr bool is_supported(Type type) noexcept
Returns true when type identifies a supported serializer.
Definition serializer-inl.h:157
InitType
Controls whether a node is initialised immediately at construction.
Definition types.h:132
@ kWithInit
Initialise immediately in the constructor.
Definition types.h:134
ImplType
Bitmask identifying the role of a VLink node implementation.
Definition types.h:89
@ kServer
Method server (RPC responder).
Definition types.h:91
@ kWithSecurity
Encrypted and authenticated transport.
Definition types.h:150
Base CRTP template for all VLink communication nodes.
Abstract base class for all transport-specific server (RPC responder) implementations.