7 #ifndef CPPWAMP_INTERNAL_CLIENTINTERFACE_HPP
8 #define CPPWAMP_INTERNAL_CLIENTINTERFACE_HPP
12 #include "../anyhandler.hpp"
13 #include "../asiodefs.hpp"
14 #include "../chits.hpp"
15 #include "../error.hpp"
16 #include "../peerdata.hpp"
17 #include "../registration.hpp"
18 #include "../subscription.hpp"
19 #include "../variant.hpp"
20 #include "../wampdefs.hpp"
23 #include "challengee.hpp"
24 #include "subscriber.hpp"
32 class RegistrationImpl;
33 class SubscriptionImpl;
38 class ClientInterface :
39 public Callee,
public Caller,
public Subscriber,
public Challengee
42 using Ptr = std::shared_ptr<ClientInterface>;
43 using WeakPtr = std::weak_ptr<ClientInterface>;
44 using EventSlot = AnyReusableHandler<void (Event)>;
45 using CallSlot = AnyReusableHandler<Outcome (Invocation)>;
46 using InterruptSlot = AnyReusableHandler<Outcome (Interruption)>;
47 using LogHandler = AnyReusableHandler<void(std::string)>;
48 using StateChangeHandler = AnyReusableHandler<void(
SessionState)>;
49 using ChallengeHandler = AnyReusableHandler<void(Challenge)>;
50 using OngoingCallHandler = AnyReusableHandler<void(ErrorOr<Result>)>;
52 template <
typename TValue>
55 static const Object& roles();
57 virtual ~ClientInterface() {}
63 virtual void join(Realm&&, CompletionHandler<SessionInfo>&&) = 0;
65 virtual void authenticate(Authentication&& auth) = 0;
67 virtual void leave(Reason&&, CompletionHandler<Reason>&&) = 0;
69 virtual void disconnect() = 0;
71 virtual void terminate() = 0;
73 virtual void subscribe(Topic&&, EventSlot&&,
74 CompletionHandler<Subscription>&&) = 0;
76 virtual void unsubscribe(
const Subscription&) = 0;
78 virtual void unsubscribe(
const Subscription&,
79 CompletionHandler<bool>&&) = 0;
81 virtual void publish(Pub&&) = 0;
83 virtual void publish(Pub&&, CompletionHandler<PublicationId>&&) = 0;
85 virtual void enroll(Procedure&&, CallSlot&&, InterruptSlot&&,
86 CompletionHandler<Registration>&&) = 0;
88 virtual void unregister(
const Registration&) = 0;
90 virtual void unregister(
const Registration&, CompletionHandler<bool>&&) = 0;
92 virtual CallChit oneShotCall(Rpc&&, CompletionHandler<Result>&&) = 0;
94 virtual CallChit ongoingCall(Rpc&&, OngoingCallHandler&&) = 0;
101 LogHandler warningHandler,
102 LogHandler traceHandler,
103 StateChangeHandler stateChangeHandler,
104 ChallengeHandler challengeHandler) = 0;
106 virtual void setWarningHandler(LogHandler) = 0;
108 virtual void setTraceHandler(LogHandler) = 0;
110 virtual void setStateChangeHandler(StateChangeHandler) = 0;
112 virtual void setChallengeHandler(ChallengeHandler) = 0;
115 inline const Object& ClientInterface::roles()
117 static const Object roles =
120 {
"call_canceling",
true},
121 {
"call_timeout",
true},
122 {
"call_trustlevels",
true},
123 {
"caller_identification",
true},
124 {
"pattern_based_registration",
true},
125 {
"progressive_call_results",
true}
128 {
"call_canceling",
true},
129 {
"call_timeout",
true},
130 {
"caller_exclusion",
true},
131 {
"caller_identification",
true},
132 {
"progressive_call_results",
true}
135 {
"publisher_exclusion",
true},
136 {
"publisher_identification",
true},
137 {
"subscriber_blackwhite_listing",
true}
140 {
"pattern_based_subscription",
true},
141 {
"publication_trustlevels",
true},
142 {
"publisher_identification",
true},
153 #endif // CPPWAMP_INTERNAL_CLIENTINTERFACE_HPP