reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
UserAgentCmds.hxx
Go to the documentation of this file.
1#if !defined(ConversationManagerCmds_hxx)
2#define ConversationManagerCmds_hxx
3
5
6#include "UserAgent.hxx"
7
8#include <memory>
9#include <utility>
10
11namespace recon
12{
13
24{
25 public:
28 virtual void executeCommand()
29 {
30 mUserAgent->shutdownImpl();
31 }
32 resip::Message* clone() const { resip_assert(0); return 0; }
33 EncodeStream& encode(EncodeStream& strm) const { strm << " UserAgentShutdownCmd: "; return strm; }
35 private:
36 UserAgent* mUserAgent;
37};
38
40{
41 public:
44 std::shared_ptr<ConversationProfile> conversationProfile,
45 bool defaultOutgoing)
46 : mUserAgent(userAgent),
47 mHandle(handle),
48 mConversationProfile(conversationProfile),
49 mDefaultOutgoing(defaultOutgoing) {}
50 virtual void executeCommand()
51 {
52 mUserAgent->addConversationProfileImpl(mHandle, mConversationProfile, mDefaultOutgoing);
53 }
54 resip::Message* clone() const { resip_assert(0); return 0; }
55 EncodeStream& encode(EncodeStream& strm) const { strm << " AddConversationProfileCmd: "; return strm; }
57 private:
58 UserAgent* mUserAgent;
60 std::shared_ptr<ConversationProfile> mConversationProfile;
61 bool mDefaultOutgoing;
62};
63
65{
66 public:
71 virtual void executeCommand()
72 {
74 }
75 resip::Message* clone() const { resip_assert(0); return 0; }
76 EncodeStream& encode(EncodeStream& strm) const { strm << " SetDefaultOutgoingConversationProfileCmd: "; return strm; }
78 private:
79 UserAgent* mUserAgent;
81};
82
84{
85 public:
88 : mUserAgent(userAgent),
89 mHandle(handle) {}
90 virtual void executeCommand()
91 {
92 mUserAgent->destroyConversationProfileImpl(mHandle);
93 }
94 resip::Message* clone() const { resip_assert(0); return 0; }
95 EncodeStream& encode(EncodeStream& strm) const { strm << " DestroyConversationProfileCmd: "; return strm; }
97 private:
98 UserAgent* mUserAgent;
100};
101
103{
104 public:
105 UserAgentTimeout(UserAgent& userAgent, unsigned int timerId, std::chrono::duration<double> duration, unsigned int seqNumber) :
106 mUserAgent(userAgent), mTimerId(timerId), mDuration(duration), mSeqNumber(seqNumber) {}
108 mUserAgent(rhs.mUserAgent), mTimerId(rhs.mTimerId), mDuration(rhs.mDuration), mSeqNumber(rhs.mSeqNumber) {}
110
111 void executeCommand() { mUserAgent.onApplicationTimer(mTimerId, mDuration, mSeqNumber); }
112
113 resip::Message* clone() const { return new UserAgentTimeout(*this); }
114 EncodeStream& encode(EncodeStream& strm) const { strm << "UserAgentTimeout: id=" << mTimerId << ", duration=" << std::chrono::duration_cast<std::chrono::milliseconds>(mDuration).count() << "ms, seq=" << mSeqNumber; return strm; }
116
117 unsigned int id() const { return mTimerId; }
118 unsigned int seqNumber() const { return mSeqNumber; }
119 std::chrono::duration<double> duration() const { return mDuration; }
120
121 private:
122 UserAgent& mUserAgent;
123 unsigned int mTimerId;
124 std::chrono::duration<double> mDuration;
125 unsigned int mSeqNumber;
126};
127
129{
130 public:
132 SubscriptionHandle handle,
133 const resip::Data& eventType,
134 const resip::NameAddr& target,
135 unsigned int subscriptionTime,
136 const resip::Mime& mimeType)
137 : mUserAgent(userAgent),
138 mHandle(handle),
139 mEventType(eventType),
140 mTarget(target),
141 mSubscriptionTime(subscriptionTime),
142 mMimeType(mimeType) {}
143 virtual void executeCommand()
144 {
145 mUserAgent->createSubscriptionImpl(mHandle, mEventType, mTarget, mSubscriptionTime, mMimeType);
146 }
147 resip::Message* clone() const { resip_assert(0); return 0; }
148 EncodeStream& encode(EncodeStream& strm) const { strm << " CreateSubscriptionCmd: "; return strm; }
150 private:
151 UserAgent* mUserAgent;
152 SubscriptionHandle mHandle;
153 resip::Data mEventType;
154 resip::NameAddr mTarget;
155 unsigned int mSubscriptionTime;
156 resip::Mime mMimeType;
157};
158
160{
161 public:
163 SubscriptionHandle handle)
164 : mUserAgent(userAgent),
165 mHandle(handle) {}
166 virtual void executeCommand()
167 {
168 mUserAgent->destroySubscriptionImpl(mHandle);
169 }
170 resip::Message* clone() const { resip_assert(0); return 0; }
171 EncodeStream& encode(EncodeStream& strm) const { strm << " DestroySubscriptionCmd: "; return strm; }
173 private:
174 UserAgent* mUserAgent;
175 SubscriptionHandle mHandle;
176};
177
179{
180 public:
182 PublicationHandle handle,
183 const resip::Data& status,
184 const resip::Data& eventType,
185 const resip::NameAddr& target,
186 unsigned int publicationTime,
187 const resip::Mime& mimeType)
188 : mUserAgent(userAgent),
189 mHandle(handle),
190 mStatus(status),
191 mEventType(eventType),
192 mTarget(target),
193 mPublicationTime(publicationTime),
194 mMimeType(mimeType) {}
195 virtual void executeCommand()
196 {
197 mUserAgent->createPublicationImpl(mHandle, mStatus, mEventType, mTarget, mPublicationTime, mMimeType);
198 }
199 resip::Message* clone() const { resip_assert(0); return 0; }
200 EncodeStream& encode(EncodeStream& strm) const { strm << " CreatePublicationCmd: "; return strm; }
202 private:
203 UserAgent* mUserAgent;
204 PublicationHandle mHandle;
205 resip::Data mStatus;
206 resip::Data mEventType;
207 resip::NameAddr mTarget;
208 unsigned int mPublicationTime;
209 resip::Mime mMimeType;
210};
211
213{
214 public:
216 PublicationHandle handle)
217 : mUserAgent(userAgent),
218 mHandle(handle) {}
219 virtual void executeCommand()
220 {
221 mUserAgent->destroyPublicationImpl(mHandle);
222 }
223 resip::Message* clone() const { resip_assert(0); return 0; }
224 EncodeStream& encode(EncodeStream& strm) const { strm << " DestroyPublicationCmd: "; return strm; }
226 private:
227 UserAgent* mUserAgent;
228 PublicationHandle mHandle;
229};
230
231}
232
233#endif
234
235
236/* ====================================================================
237
238 Copyright (c) 2007-2008, Plantronics, Inc.
239 All rights reserved.
240
241 Redistribution and use in source and binary forms, with or without
242 modification, are permitted provided that the following conditions are
243 met:
244
245 1. Redistributions of source code must retain the above copyright
246 notice, this list of conditions and the following disclaimer.
247
248 2. Redistributions in binary form must reproduce the above copyright
249 notice, this list of conditions and the following disclaimer in the
250 documentation and/or other materials provided with the distribution.
251
252 3. Neither the name of Plantronics nor the names of its contributors
253 may be used to endorse or promote products derived from this
254 software without specific prior written permission.
255
256 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
257 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
258 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
259 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
260 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
261 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
262 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
263 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
264 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
265 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
266 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
267
268 ==================================================================== */
#define resip_assert(x)
This file needs to work for both C and C++ code.
EncodeStream & encodeBrief(EncodeStream &strm) const
output a brief description to stream
resip::Message * clone() const
AddConversationProfileCmd(UserAgent *userAgent, ConversationProfileHandle handle, std::shared_ptr< ConversationProfile > conversationProfile, bool defaultOutgoing)
EncodeStream & encode(EncodeStream &strm) const
output the entire message to stream
resip::Message * clone() const
CreatePublicationCmd(UserAgent *userAgent, PublicationHandle handle, const resip::Data &status, const resip::Data &eventType, const resip::NameAddr &target, unsigned int publicationTime, const resip::Mime &mimeType)
EncodeStream & encodeBrief(EncodeStream &strm) const
output a brief description to stream
EncodeStream & encode(EncodeStream &strm) const
output the entire message to stream
resip::Message * clone() const
CreateSubscriptionCmd(UserAgent *userAgent, SubscriptionHandle handle, const resip::Data &eventType, const resip::NameAddr &target, unsigned int subscriptionTime, const resip::Mime &mimeType)
EncodeStream & encode(EncodeStream &strm) const
output the entire message to stream
EncodeStream & encodeBrief(EncodeStream &strm) const
output a brief description to stream
EncodeStream & encodeBrief(EncodeStream &strm) const
output a brief description to stream
DestroyConversationProfileCmd(UserAgent *userAgent, ConversationProfileHandle handle)
EncodeStream & encode(EncodeStream &strm) const
output the entire message to stream
EncodeStream & encode(EncodeStream &strm) const
output the entire message to stream
EncodeStream & encodeBrief(EncodeStream &strm) const
output a brief description to stream
resip::Message * clone() const
DestroyPublicationCmd(UserAgent *userAgent, PublicationHandle handle)
EncodeStream & encodeBrief(EncodeStream &strm) const
output a brief description to stream
EncodeStream & encode(EncodeStream &strm) const
output the entire message to stream
DestroySubscriptionCmd(UserAgent *userAgent, SubscriptionHandle handle)
resip::Message * clone() const
EncodeStream & encodeBrief(EncodeStream &strm) const
output a brief description to stream
SetDefaultOutgoingConversationProfileCmd(UserAgent *userAgent, ConversationProfileHandle handle)
EncodeStream & encode(EncodeStream &strm) const
output the entire message to stream
The classes defined here are used to pass commands from the application thread to the UserAgent threa...
resip::Message * clone() const
EncodeStream & encodeBrief(EncodeStream &strm) const
output a brief description to stream
UserAgentShutdownCmd(UserAgent *userAgent)
EncodeStream & encode(EncodeStream &strm) const
output the entire message to stream
UserAgentTimeout(const UserAgentTimeout &rhs)
unsigned int id() const
std::chrono::duration< double > duration() const
unsigned int seqNumber() const
resip::Message * clone() const
UserAgentTimeout(UserAgent &userAgent, unsigned int timerId, std::chrono::duration< double > duration, unsigned int seqNumber)
EncodeStream & encode(EncodeStream &strm) const
output the entire message to stream
EncodeStream & encodeBrief(EncodeStream &strm) const
output a brief description to stream
This class is one of two main classes of concern to an application using the UserAgent library.
Definition UserAgent.hxx:56
virtual void onApplicationTimer(unsigned int timerId, std::chrono::duration< double > duration, unsigned int seqNumber)
Callback used when an application timer expires.
void addConversationProfileImpl(ConversationProfileHandle handle, std::shared_ptr< ConversationProfile > conversationProfile, bool defaultOutgoing=true)
void destroySubscriptionImpl(SubscriptionHandle handle)
void setDefaultOutgoingConversationProfileImpl(ConversationProfileHandle handle)
void createPublicationImpl(PublicationHandle handle, const resip::Data &status, const resip::Data &eventType, const resip::NameAddr &target, unsigned int publicationTime, const resip::Mime &mimeType)
void destroyPublicationImpl(PublicationHandle handle)
void createSubscriptionImpl(SubscriptionHandle handle, const resip::Data &eventType, const resip::NameAddr &target, unsigned int subscriptionTime, const resip::Mime &mimeType)
void destroyConversationProfileImpl(ConversationProfileHandle handle)
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
The base-class used for message-passing.
Definition Message.hxx:21
Represents the "media-type" element in the RFC 3261 grammar.
Definition Mime.hxx:20
Represents the "name-addr" and the "addr-spec" elements in the RFC 3261 grammar.
Definition NameAddr.hxx:19
unsigned int ConversationProfileHandle
unsigned int SubscriptionHandle
unsigned int PublicationHandle
#define EncodeStream
void list()
Definition userAdmin.cxx:66