reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
PresenceSubscriptionHandler.hxx
Go to the documentation of this file.
1#if !defined(PresenceSubscriptionHandler_hxx)
2#define PresenceSubscriptionHandler_hxx
3
4#include <set>
11
12namespace resip
13{
14class Dispatcher;
15class SipMessage;
16class SecurityAttributes;
17class Data;
18class Contents;
19}
20
21namespace repro
22{
23
24class PresenceSubscriptionHandler;
25
26// This class is used to do an aynchronous check for user existence
28{
29public:
31 bool sendAcceptReject, const resip::Uri& aor) :
32 mDum(dum), mSubscriptionHandler(handler), mServerSubscriptionHandle(h), mSendAcceptReject(sendAcceptReject),
33 mUserExists(false), mAor(aor) { mTu = &dum; }
35 mDum(orig.mDum), mSubscriptionHandler(orig.mSubscriptionHandler), mServerSubscriptionHandle(orig.mServerSubscriptionHandle),
36 mSendAcceptReject(orig.mSendAcceptReject), mUserExists(orig.mUserExists), mAor(orig.mAor) {}
37 virtual PresenceUserExists* clone() const { return new PresenceUserExists(*this); }
38
39 virtual EncodeStream& encode(EncodeStream& ostr) const { ostr << "PresenceUserExists: " << mAor; return ostr; }
40 virtual EncodeStream& encodeBrief(EncodeStream& ostr) const { return encode(ostr); }
41
42 virtual void executeCommand();
43 virtual void setUserExists(bool exists) { mUserExists = exists; }
44 virtual bool getUserExists() { return mUserExists; }
45
46 virtual const resip::Data getUser() { return mAor.user(); }
47 virtual const resip::Data getDomain() { return mAor.host(); }
48
49private:
51 PresenceSubscriptionHandler* mSubscriptionHandler;
52 resip::ServerSubscriptionHandle mServerSubscriptionHandle;
53 bool mSendAcceptReject;
54 bool mUserExists;
55 resip::Uri mAor;
56};
57
58class PresenceServerSubscriptionRegFunctor;
59class PresenceServerSubscriptionFunctor;
60class PresenceServerRegStateChangeCommand;
61class PresenceServerDocStateChangeCommand;
62class PresenceServerCheckDocExpiredCommand;
67{
68public:
74
75 // ServerSubscriptionHandler interfaces
80 const resip::Contents* contents,
84
85 // PublicationPersistenceManager::ETagMerger interface
87
88 // InMemorySyncRegDb handler interface
89 virtual void onAorModified(const resip::Uri& aor, const resip::ContactList& contacts);
90
91 // InMemorySyncPubDb handler interface
93 virtual void onDocumentRemoved(bool sync, const resip::Data& eventType, const resip::Data& documentKey, const resip::Data& eTag, uint64_t lastUpdated);
94
95protected:
113 friend class PresenceUserExists;
114
118 std::set<resip::Uri> mOnlineAors;
119};
120
121}
122
123#endif
124
125/* ====================================================================
126*
127* Copyright (c) 2015 SIP Spectrum, Inc. All rights reserved.
128*
129* Redistribution and use in source and binary forms, with or without
130* modification, are permitted provided that the following conditions
131* are met:
132*
133* 1. Redistributions of source code must retain the above copyright
134* notice, this list of conditions and the following disclaimer.
135*
136* 2. Redistributions in binary form must reproduce the above copyright
137* notice, this list of conditions and the following disclaimer in
138* the documentation and/or other materials provided with the
139* distribution.
140*
141* 3. Neither the name of the author(s) nor the names of any contributors
142* may be used to endorse or promote products derived from this software
143* without specific prior written permission.
144*
145* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
146* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
147* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
148* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
149* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
150* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
151* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
152* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
153* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
154* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
155* SUCH DAMAGE.
156*
157* ====================================================================
158*
159*/
160/*
161* vi: set shiftwidth=3 expandtab:
162*/
virtual bool mergeETag(resip::Contents *eTagDest, resip::Contents *eTagSrc, bool isFirst)
bool checkRegistrationStateChanged(const resip::Uri &aor, bool registered, uint64_t regMaxExpires)
void adjustNotifyExpiresTime(resip::SipMessage &notify, uint64_t regMaxExpires)
virtual void onError(resip::ServerSubscriptionHandle, const resip::SipMessage &msg)
virtual void onNewSubscription(resip::ServerSubscriptionHandle h, const resip::SipMessage &sub)
bool sendPublishedPresence(resip::ServerSubscriptionHandle h, bool sendAcceptReject)
void notifySubscriptions(const resip::Data &documentKey)
virtual void onDocumentRemoved(bool sync, const resip::Data &eventType, const resip::Data &documentKey, const resip::Data &eTag, uint64_t lastUpdated)
void fabricateSimplePresence(resip::ServerSubscriptionHandle h, bool sendAcceptReject, const resip::Uri &aor, bool online, uint64_t regMaxExpires)
void checkExpired(const resip::Data &documentKey, const resip::Data &eTag, uint64_t lastUpdated)
void continueNotifyPresenceAfterUserExistsCheck(resip::ServerSubscriptionHandle h, bool sendAcceptReject, const resip::Uri &aor, bool userExists)
virtual void onDocumentModified(bool sync, const resip::Data &eventType, const resip::Data &documentKey, const resip::Data &eTag, uint64_t expirationTime, uint64_t lastUpdated, const resip::Contents *contents, const resip::SecurityAttributes *securityAttributes)
virtual void onPublished(resip::ServerSubscriptionHandle associated, resip::ServerPublicationHandle publication, const resip::Contents *contents, const resip::SecurityAttributes *attrs)
virtual void onTerminated(resip::ServerSubscriptionHandle)
void notifyPresenceNoPublication(resip::ServerSubscriptionHandle h, bool sendAcceptReject, const resip::Uri &aor, bool isRegistered, uint64_t regMaxExpires)
void notifyPresence(resip::ServerSubscriptionHandle h, bool sendAcceptReject)
virtual void onRefresh(resip::ServerSubscriptionHandle, const resip::SipMessage &sub)
virtual void onAorModified(const resip::Uri &aor, const resip::ContactList &contacts)
virtual void setUserExists(bool exists)
virtual const resip::Data getUser()
virtual EncodeStream & encode(EncodeStream &ostr) const
output the entire message to stream
PresenceUserExists(resip::DialogUsageManager &dum, PresenceSubscriptionHandler *handler, resip::ServerSubscriptionHandle h, bool sendAcceptReject, const resip::Uri &aor)
virtual PresenceUserExists * clone() const
virtual const resip::Data getDomain()
PresenceUserExists(const PresenceUserExists &orig)
virtual EncodeStream & encodeBrief(EncodeStream &ostr) const
output a brief description to stream
Base class for all SIP body types.
Definition Contents.hxx:51
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
A generic thread-bank class.
Implementation of a persistence manager.
Implementation of a persistence manager.
TransactionUser * mTu
Definition Message.hxx:50
Represents a SIP message.
Represents the "SIP-URI" and "SIPS-URI" elements in the RFC 3261 grammar.
Definition Uri.hxx:22
Data & user()
Definition Uri.hxx:42
Data & host()
Definition Uri.hxx:40
This Class is used to implement a primitive form of RPC using loose XML formatting.
dcm! – add UnusedChecking(_enum) below;
std::list< ContactInstanceRecord > ContactList
#define EncodeStream
unsigned __int64 uint64_t
Definition stdint.h:95
void list()
Definition userAdmin.cxx:66