reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
ServerSubscription.hxx
Go to the documentation of this file.
1#if !defined(RESIP_SERVERSUBSCRIPTION_HXX)
2#define RESIP_SERVERSUBSCRIPTION_HXX
3
6
7namespace resip
8{
9
10class DialogUsageManager;
11class ServerSubscriptionHandler;
12
15{
16 public:
18
21
24
26
27 const Data& getSubscriber() const noexcept { return mSubscriber; }
29
30 //only 200 and 202 are permissible. SubscriptionState is not affected.
31 //currently must be called for a refresh as well as initial creation.
32 std::shared_ptr<SipMessage> accept(int statusCode = 202);
33 std::shared_ptr<SipMessage> reject(int responseCode);
34 bool isResponsePending() { return mLastResponse.get() != 0; } // Note: mLastResponse is cleared out when send is called
35
36 //used to accept a refresh when there is no useful state to convey to the
37 //client
38 std::shared_ptr<SipMessage> neutralNotify();
39
41
42 std::shared_ptr<SipMessage> update(const Contents* document);
43 void end(TerminateReason reason, const Contents* document = 0, int retryAfter = 0);
44
45 void end() override;
46 void send(std::shared_ptr<SipMessage> msg) override;
47
48 void sendCommand(std::shared_ptr<SipMessage> msg) override
49 {
51 }
52
53// void setTerminationState(TerminateReason reason);
54// void setCurrentEventDocument(const Contents* document);
55
56 void dispatch(const SipMessage& msg) override;
57 void dispatch(const DumTimeout& timer) override;
58
59 EncodeStream& dump(EncodeStream& strm) const override;
60
61 protected:
62 virtual ~ServerSubscription();
63 virtual void onReadyToSend(SipMessage& msg) override;
64 virtual void flowTerminated();
65
66 private:
67 friend class Dialog;
68
70
71 void makeNotifyExpires();
72 void makeNotify();
73
74 bool shouldDestroyAfterSendingFailure(const SipMessage& msg);
75
76 void terminateSubscription(ServerSubscriptionHandler* handler);
77
78 Data mSubscriber;
79 uint32_t mExpires;
80
81 uint64_t mAbsoluteExpiry;
82};
83
84}
85
86#endif
87
88/* ====================================================================
89 * The Vovida Software License, Version 1.0
90 *
91 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
92 *
93 * Redistribution and use in source and binary forms, with or without
94 * modification, are permitted provided that the following conditions
95 * are met:
96 *
97 * 1. Redistributions of source code must retain the above copyright
98 * notice, this list of conditions and the following disclaimer.
99 *
100 * 2. Redistributions in binary form must reproduce the above copyright
101 * notice, this list of conditions and the following disclaimer in
102 * the documentation and/or other materials provided with the
103 * distribution.
104 *
105 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
106 * and "Vovida Open Communication Application Library (VOCAL)" must
107 * not be used to endorse or promote products derived from this
108 * software without prior written permission. For written
109 * permission, please contact vocal@vovida.org.
110 *
111 * 4. Products derived from this software may not be called "VOCAL", nor
112 * may "VOCAL" appear in their name, without prior written
113 * permission of Vovida Networks, Inc.
114 *
115 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
116 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
117 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
118 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
119 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
120 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
121 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
122 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
123 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
124 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
125 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
126 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
127 * DAMAGE.
128 *
129 * ====================================================================
130 *
131 * This software consists of voluntary contributions made by Vovida
132 * Networks, Inc. and many individuals on behalf of Vovida Networks,
133 * Inc. For more information on Vovida Networks, Inc., please see
134 * <http://www.vovida.org/>.
135 *
136 */
dcm! – update contact in dialog if required
std::shared_ptr< SipMessage > mLastResponse
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
virtual void sendCommand(std::shared_ptr< SipMessage > msg)
dcm! – kill typedef std::list<DialogId> DialogIdSet;
Definition Dialog.hxx:29
dcm! – no Subscription State expires parameter generation yet.
void dispatch(const SipMessage &msg) override
std::shared_ptr< SipMessage > neutralNotify()
void setSubscriptionState(SubscriptionState state)
ServerSubscriptionHandle getHandle() const
std::shared_ptr< SipMessage > update(const Contents *document)
ServerSubscription(ServerSubscription &&)=delete
EncodeStream & dump(EncodeStream &strm) const override
const Data & getSubscriber() const noexcept
std::shared_ptr< SipMessage > accept(int statusCode=202)
ServerSubscription & operator=(const ServerSubscription &)=delete
void send(std::shared_ptr< SipMessage > msg) override
std::shared_ptr< SipMessage > reject(int responseCode)
virtual void onReadyToSend(SipMessage &msg) override
ServerSubscription & operator=(ServerSubscription &&)=delete
ServerSubscription(const ServerSubscription &)=delete
void sendCommand(std::shared_ptr< SipMessage > msg) override
Handle< ServerSubscription > ServerSubscriptionHandle
Represents a SIP message.
dcm! – add UnusedChecking(_enum) below;
unsigned long long uint64_t
Definition Stun.hxx:39
unsigned int uint32_t
Definition Stun.hxx:34
#define EncodeStream
void list()
Definition userAdmin.cxx:66