CppWAMP
C++11 client library for the WAMP protocol
|
Go to the documentation of this file.
7 #ifndef CPPWAMP_PEERDATA_HPP
8 #define CPPWAMP_PEERDATA_HPP
12 #include <initializer_list>
24 #include "./internal/passkey.hpp"
39 class CPPWAMP_API
Abort :
public Options<Abort, internal::AbortMessage>
53 Abort(internal::PassKey, internal::AbortMessage&& msg);
59 class CPPWAMP_API
Realm :
public Options<Realm, internal::HelloMessage>
78 Realm& withAuthMethods(std::vector<String> methods);
87 Abort* abort_ =
nullptr;
90 Abort* abort(internal::PassKey);
98 internal::WelcomeMessage>
117 const String& realm()
const;
125 String agentString()
const;
137 bool supportsRoles(
const RoleSet& roles)
const;
140 bool supportsFeatures(
const FeatureMap& features)
const;
170 internal::WelcomeMessage&& msg);
173 CPPWAMP_API std::ostream& operator<<(std::ostream& out,
188 const String& uri()
const;
195 Reason(internal::PassKey, internal::GoodbyeMessage&& msg);
206 internal::AuthenticateMessage>
216 const String& signature()
const;
224 Authentication& withChannelBinding(std::string type, std::string data);
231 namespace internal {
class Challengee; }
241 internal::ChallengeMessage>
249 bool challengeeHasExpired()
const;
252 const String& method()
const;
277 using ChallengeePtr = std::weak_ptr<internal::Challengee>;
278 Challenge(internal::PassKey, ChallengeePtr challengee,
279 internal::ChallengeMessage&& msg);
284 ChallengeePtr challengee_;
292 class CPPWAMP_API
Error :
public Payload<Error, internal::ErrorMessage>
309 explicit operator bool()
const;
312 const String& reason()
const;
319 Error(internal::PassKey, internal::ErrorMessage&& msg);
321 internal::ErrorMessage& errorMessage(internal::PassKey,
322 internal::WampMsgType reqType,
331 class CPPWAMP_API
Topic :
public Options<Topic, internal::SubscribeMessage>
344 Topic& usingPrefixMatch();
348 Topic& usingWildcardMatch();
352 const String& uri()
const;
363 class CPPWAMP_API
Pub :
public Payload<Pub, internal::PublishMessage>
379 Pub& withExcludedSessions(
Array sessionIds);
382 Pub& withExcludedAuthIds(
Array authIds);
385 Pub& withExcludedAuthRoles(
Array authRoles);
389 Pub& withEligibleSessions(
Array sessionIds);
392 Pub& withEligibleAuthIds(
Array authIds);
395 Pub& withEligibleAuthRoles(
Array authRoles);
405 Pub& withExcludeMe(
bool excluded =
true);
415 Pub& withDiscloseMe(
bool disclosed =
true);
427 class CPPWAMP_API
Event :
public Payload<Event, internal::EventMessage>
482 internal::EventMessage&& msg);
485 CPPWAMP_API std::ostream& operator<<(std::ostream& out,
const Event& event);
493 internal::RegisterMessage>
500 const String& uri()
const;
523 Procedure& withDiscloseCaller(
bool disclosed =
true);
535 class CPPWAMP_API
Rpc :
public Payload<Rpc, internal::CallMessage>
550 const String& procedure()
const;
562 Rpc& withProgressiveResults(
bool enabled =
true);
565 bool progressiveResultsAreEnabled()
const;
576 Rpc& withDealerTimeout(
UInt milliseconds);
580 template <
typename R,
typename P>
583 using namespace std::chrono;
584 auto ms = duration_cast<milliseconds>(timeout).count();
585 return withDealerTimeout(
static_cast<Int>(ms));
590 Rpc& withCallerTimeout(
UInt milliseconds);
594 template <
typename R,
typename P>
597 using namespace std::chrono;
598 setCallerTimeout(duration_cast<CallerTimeoutDuration>(timeout));
603 CallerTimeoutDuration callerTimeout()
const;
614 Rpc& withDiscloseMe(
bool disclosed =
true);
630 void setCallerTimeout(CallerTimeoutDuration duration);
632 Error* error_ =
nullptr;
633 CallerTimeoutDuration callerTimeout_ = {};
635 bool progressiveResultsEnabled_ =
false;
638 Error* error(internal::PassKey);
654 Result(std::initializer_list<Variant> list);
665 Result& withProgress(
bool progressive =
true);
668 bool isProgressive()
const;
677 Result(internal::PassKey, internal::ResultMessage&& msg);
679 internal::YieldMessage& yieldMessage(internal::PassKey,
RequestId reqId)
681 message().setRequestId(reqId);
682 return message().transformToYield();
686 CPPWAMP_API std::ostream& operator<<(std::ostream& out,
const Result& result);
696 constexpr
Deferment() noexcept =
default;
723 CPPWAMP_DEPRECATED
static Outcome deferred();
733 Outcome(std::initializer_list<Variant> args);
754 const Result& asResult() const &;
760 const
Error& asError() const &;
763 Error&& asError() &&;
772 CPPWAMP_HIDDEN explicit
Outcome(std::nullptr_t);
773 CPPWAMP_HIDDEN
void copyFrom(const
Outcome& other);
774 CPPWAMP_HIDDEN
void moveFrom(
Outcome&& other);
775 CPPWAMP_HIDDEN
void destruct();
779 union CPPWAMP_HIDDEN Value
790 namespace internal {
class Callee; }
800 internal::InvocationMessage>
812 bool calleeHasExpired()
const;
824 void yield(
Error error)
const;
832 bool isProgressive()
const;
865 using CalleePtr = std::weak_ptr<internal::Callee>;
867 internal::InvocationMessage&& msg);
878 CPPWAMP_API std::ostream& operator<<(std::ostream& out,
const Invocation& inv);
917 internal::InterruptMessage>
929 bool calleeHasExpired()
const;
941 void yield(
Error error)
const;
945 using CalleePtr = std::weak_ptr<internal::Callee>;
947 internal::InterruptMessage&& msg);
956 CPPWAMP_API std::ostream& operator<<(std::ostream& out,
961 #ifndef CPPWAMP_COMPILED_LIB
962 #include "./internal/peerdata.ipp"
965 #endif // CPPWAMP_PEERDATA_HPP
Base class for exceptions involving invalid Variant types.
Definition: error.hpp:89
std::set< String > RoleSet
A set of role strings.
Definition: peerdata.hpp:102
Provides the reason URI and other options contained within GOODBYE messages.
Definition: peerdata.hpp:181
int64_t RequestId
Ephemeral ID associated with a WAMP request.
Definition: wampdefs.hpp:23
Rpc & withDealerTimeout(std::chrono::duration< R, P > timeout)
Requests that the dealer cancel the call after the specified timeout duration.
Definition: peerdata.hpp:581
boost::asio::any_io_executor AnyIoExecutor
Polymorphic executor for all I/O objects.
Definition: asiodefs.hpp:27
Realm URI and other options contained within WAMP HELLO messages.
Definition: peerdata.hpp:59
std::uint64_t UInt
Variant bound type for unsigned integers.
Definition: variantdefs.hpp:48
Contains the request ID and options contained within WAMP CANCEL messages.
Definition: peerdata.hpp:885
Discriminated union container that represents a JSON value.
Definition: variant.hpp:134
Provides the Signature and Extra dictionary contained within WAMP AUTHENTICATE messages.
Definition: peerdata.hpp:205
int64_t SessionId
Ephemeral ID associated with a WAMP session.
Definition: wampdefs.hpp:22
Defines macros related to exporting/importing APIs.
Contains details within WAMP INTERRUPT messages.
Definition: peerdata.hpp:916
Wrapper around a WAMP message containing payload arguments and an options dictionary.
Definition: payload.hpp:33
std::map< String, Variant > Object
Variant bound type for maps of variants.
Definition: variantdefs.hpp:52
Provides the reason URI, options, and payload arguments contained within WAMP ERROR messages.
Definition: peerdata.hpp:292
Provides the topic URI and other options contained within WAMP ‘SUBSCRIBE’ messages.
Definition: peerdata.hpp:331
Provides the reason URI and other options contained within ABORT messages.
Definition: peerdata.hpp:39
std::map< String, FeatureSet > FeatureMap
A dictionary of feature sets to be supported by each role.
Definition: peerdata.hpp:108
Contains the procedure URI and other options contained within WAMP REGISTER messages.
Definition: peerdata.hpp:492
int64_t SubscriptionId
Ephemeral ID associated with an topic subscription.
Definition: wampdefs.hpp:24
Wrapper around a call coroutine slot which automatically unpacks positional payload arguments.
Definition: corounpacker.hpp:169
Common type definitions used by transports that rely on Boost.Asio.
std::set< String > FeatureSet
A set of feature strings.
Definition: peerdata.hpp:105
constexpr Deferment deferment
Convenient value of the wamp::Deferment tag type that can be passed to the wamp::Outcome constructor.
Definition: peerdata.hpp:703
Definition: anyhandler.hpp:36
Type
Enumerators representing the type of outcome being held by this object.
Definition: peerdata.hpp:714
std::vector< Variant > Array
Variant bound type for arrays of variants.
Definition: variantdefs.hpp:51
Wrapper around a WAMP message containing an options dictionary.
Definition: options.hpp:29
std::int64_t Int
Variant bound type for signed integers.
Definition: variantdefs.hpp:47
Contains the procedure URI, options, and payload contained within WAMP CALL messages.
Definition: peerdata.hpp:535
Contains the declaration of the Options class.
Contains the outcome of an RPC invocation.
Definition: peerdata.hpp:709
Provides the AuthMethod and Extra dictionary contained within WAMP CHALLENGE messages.
Definition: peerdata.hpp:240
int64_t PublicationId
Ephemeral ID associated with an event publication.
Definition: wampdefs.hpp:25
Provides the topic URI, options, and payload contained within WAMP PUBLISH messages.
Definition: peerdata.hpp:363
Contains the remote procedure result options/payload within WAMP RESULT and YIELD messages.
Definition: peerdata.hpp:646
Rpc & withCallerTimeout(std::chrono::duration< R, P > timeout)
Requests that the dealer cancel the call after the specified timeout duration.
Definition: peerdata.hpp:595
Session information contained within WAMP WELCOME messages.
Definition: peerdata.hpp:97
Contains the declaration of Variant and other closely related types/functions.
Contains type definitions related to WAMP IDs and sessions.
Contains the declaration of Payload, which bundles together Variant arguments.
Tag type that can be passed to wamp::Outcome to construct a deferred outcome.
Definition: peerdata.hpp:694
Contains payload arguments and other options within WAMP INVOCATION messages.
Definition: peerdata.hpp:799
Provides the subscription/publication ids, options, and payload contained within WAMP EVENT messages.
Definition: peerdata.hpp:427
@ kill
INTERRUPT sent to callee; RESULT or ERROR returned, depending on callee.
std::string String
Variant bound type for text strings.
Definition: variantdefs.hpp:50
std::chrono::steady_clock::duration CallerTimeoutDuration
The duration type used for caller-initiated timeouts.
Definition: peerdata.hpp:539
CallCancelMode
Enumerates the possible call cancelling modes.
Definition: wampdefs.hpp:49