1
#if !defined(RESIP_CLIENTSUBSCRIPTION_HXX)
2
#define RESIP_CLIENTSUBSCRIPTION_HXX
5
#include "resip/dum/BaseSubscription.hxx"
10
class DialogUsageManager;
12
//!dcm! -- update contact in dialog if required
14
class ClientSubscription: public BaseSubscription
17
ClientSubscription(DialogUsageManager& dum, Dialog& dialog,
18
const SipMessage& request, UInt32 defaultSubExpiration);
20
typedef Handle<ClientSubscription> ClientSubscriptionHandle;
21
ClientSubscriptionHandle getHandle();
23
//.dcm. no adornment for ease of use, can add if there is a use case
24
void acceptUpdate(int statusCode = 200, const char* reason=0);
25
void rejectUpdate(int statusCode = 400, const Data& reasonPhrase = Data::Empty);
26
void requestRefresh(UInt32 expires = 0); // 0 defaults to using original expires value (to remove call end() instead)
28
void end(bool immediate); // If immediate is true then usage is destroyed with no further messaging
29
virtual void reSubscribe(); // forms a new Subscription dialog - reusing the same target and AppDialogSet
31
* Provide asynchronous method access by using command
33
void acceptUpdateCommand(int statusCode = 200, const char* reason=0);
34
void rejectUpdateCommand(int statusCode = 400, const Data& reasonPhrase = Data::Empty);
35
void requestRefreshCommand(UInt32 expires = 0); // 0 defaults to using original expires value (to remove call endCommand() instead)
36
virtual void endCommand(bool immediate=false); // If immediate is true then usage is destroyed with no further messaging
38
virtual EncodeStream& dump(EncodeStream& strm) const;
41
virtual ~ClientSubscription();
42
virtual void dialogDestroyed(const SipMessage& msg);
43
virtual void onReadyToSend(SipMessage& msg);
44
virtual void send(SharedPtr<SipMessage> msg);
45
virtual void flowTerminated();
49
friend class InviteSession;
54
QueuedNotify(const SipMessage& notify, bool outOfOrder)
55
: mNotify(notify), mOutOfOrder(outOfOrder) {}
57
SipMessage& notify() { return mNotify; }
58
bool outOfOrder() { return mOutOfOrder; }
65
typedef std::deque<QueuedNotify*> NotifyQueue;
66
NotifyQueue mQueuedNotifies;
68
typedef std::vector<QueuedNotify*> Dustbin;
71
bool mOnNewSubscriptionCalled;
72
//SipMessage mLastNotify;
74
// .bwc. This is when our next reSUB is scheduled to happen.
75
UInt64 mNextRefreshSecs;
78
// this is the expires value from the 2xx coming from the SUB message
79
UInt32 mDefaultExpires;
82
bool mHaveQueuedRefresh;
83
int mQueuedRefreshInterval;
85
unsigned int mLargestNotifyCSeq;
87
virtual void dispatch(const SipMessage& msg);
88
virtual void dispatch(const DumTimeout& timer);
90
void sendQueuedRefreshRequest();
91
void processNextNotify();
92
void processResponse(const SipMessage& response);
94
void scheduleRefresh(unsigned long refreshInterval);
97
ClientSubscription(const ClientSubscription&);
98
ClientSubscription& operator=(const ClientSubscription&);
105
/* ====================================================================
106
* The Vovida Software License, Version 1.0
108
* Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
110
* Redistribution and use in source and binary forms, with or without
111
* modification, are permitted provided that the following conditions
114
* 1. Redistributions of source code must retain the above copyright
115
* notice, this list of conditions and the following disclaimer.
117
* 2. Redistributions in binary form must reproduce the above copyright
118
* notice, this list of conditions and the following disclaimer in
119
* the documentation and/or other materials provided with the
122
* 3. The names "VOCAL", "Vovida Open Communication Application Library",
123
* and "Vovida Open Communication Application Library (VOCAL)" must
124
* not be used to endorse or promote products derived from this
125
* software without prior written permission. For written
126
* permission, please contact vocal@vovida.org.
128
* 4. Products derived from this software may not be called "VOCAL", nor
129
* may "VOCAL" appear in their name, without prior written
130
* permission of Vovida Networks, Inc.
132
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
133
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
134
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
135
* NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
136
* NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
137
* IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
138
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
139
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
140
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
141
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
142
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
143
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
146
* ====================================================================
148
* This software consists of voluntary contributions made by Vovida
149
* Networks, Inc. and many individuals on behalf of Vovida Networks,
150
* Inc. For more information on Vovida Networks, Inc., please see
151
* <http://www.vovida.org/>.