reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
AppDialogSet.hxx
Go to the documentation of this file.
1#if !defined(RESIP_APPDIALOGSET_HXX)
2#define RESIP_APPDIALOGSET_HXX
3
10
11#include <memory>
12
13namespace resip
14{
15
16class SipMessage;
17class DialogUsageManager;
18
19class AppDialogSet : public Handled
20{
21 public:
22
23 // by default, dum calls the destructor. application can override this if it
24 // wants to manage memory on its own.
25 virtual void destroy();
26
27 virtual void end();
28 virtual void end(const Data& endReason); // Adds a Reason (RFC3326) header if this results in a BYE or CANCEL
29 virtual void end(const ParserContainer<Token>& endReasons); // Adds Reason (RFC3326) header(s) if this results in a BYE or CANCEL
30
31 // Asynchronously calls end() through a DUM command
32 virtual void endCommand();
33 virtual void endCommand(const Data& reason); // Adds a Reason (RFC3326) header if this results in a BYE or CANCEL
34 virtual void endCommand(const ParserContainer<Token>& endReasons); // Adds Reason (RFC3326) header(s) if this results in a BYE or CANCEL
35
36 virtual std::shared_ptr<UserProfile> getUserProfile();
37
38 virtual AppDialog* createAppDialog(const SipMessage&);
39
42
43 virtual const Data getClassName();
44
45 virtual EncodeStream& dump(EncodeStream& strm) const;
46
47 protected:
48
50 {
51 public:
52 AppDialogSetEndCommand(const AppDialogSetHandle& dialogSet, const Data& userEndReason = Data::Empty, ParserContainer<Token> userEndReasons = ParserContainer<Token>())
53 : mAppDialogSet(dialogSet),
54 mUserEndReason(userEndReason),
55 mUserEndReasons(userEndReasons)
56 {
57 }
58
59 virtual void executeCommand()
60 {
61 if(mAppDialogSet.isValid())
62 {
63 if (mUserEndReasons.size() > 0)
64 {
65 mAppDialogSet->end(mUserEndReasons);
66 }
67 else if(mUserEndReason.size() > 0)
68 {
69 mAppDialogSet->end(mUserEndReason);
70 }
71 else
72 {
73 mAppDialogSet->end();
74 }
75 }
76 }
77
79 {
80 return strm << "AppDialogSetEndCommand";
81 }
82 private:
83 AppDialogSetHandle mAppDialogSet;
84 Data mUserEndReason;
85 ParserContainer<Token> mUserEndReasons;
86 };
87
89
91 virtual ~AppDialogSet();
92 // This is called by the DialogUsageManager to select an userProfile to assign to a UAS DialogSet.
93 // The application should not call this directly, but should override it, in order to assign
94 // an userProfile other than the MasterProfile
95 virtual std::shared_ptr<UserProfile> selectUASUserProfile(const SipMessage&);
96
97 private:
101 AppDialogSet* reuse();
102 bool isReUsed() const;
103
104 friend class DialogUsageManager;
106 friend class ClientSubscription;
107
108 DialogSet* mDialogSet;
109 bool mIsReUsed;
110};
111
112}
113
114#endif
115
116/* ====================================================================
117 * The Vovida Software License, Version 1.0
118 *
119 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
120 *
121 * Redistribution and use in source and binary forms, with or without
122 * modification, are permitted provided that the following conditions
123 * are met:
124 *
125 * 1. Redistributions of source code must retain the above copyright
126 * notice, this list of conditions and the following disclaimer.
127 *
128 * 2. Redistributions in binary form must reproduce the above copyright
129 * notice, this list of conditions and the following disclaimer in
130 * the documentation and/or other materials provided with the
131 * distribution.
132 *
133 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
134 * and "Vovida Open Communication Application Library (VOCAL)" must
135 * not be used to endorse or promote products derived from this
136 * software without prior written permission. For written
137 * permission, please contact vocal@vovida.org.
138 *
139 * 4. Products derived from this software may not be called "VOCAL", nor
140 * may "VOCAL" appear in their name, without prior written
141 * permission of Vovida Networks, Inc.
142 *
143 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
144 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
145 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
146 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
147 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
148 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
149 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
150 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
151 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
152 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
153 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
154 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
155 * DAMAGE.
156 *
157 * ====================================================================
158 *
159 * This software consists of voluntary contributions made by Vovida
160 * Networks, Inc. and many individuals on behalf of Vovida Networks,
161 * Inc. For more information on Vovida Networks, Inc., please see
162 * <http://www.vovida.org/>.
163 *
164 */
virtual EncodeStream & encodeBrief(EncodeStream &strm) const
output a brief description to stream
AppDialogSetEndCommand(const AppDialogSetHandle &dialogSet, const Data &userEndReason=Data::Empty, ParserContainer< Token > userEndReasons=ParserContainer< Token >())
virtual void end()
DialogUsageManager & mDum
virtual void destroy()
virtual AppDialog * createAppDialog(const SipMessage &)
AppDialogSetHandle getHandle()
virtual std::shared_ptr< UserProfile > getUserProfile()
virtual void endCommand()
DialogSetId getDialogSetId()
virtual const Data getClassName()
virtual EncodeStream & dump(EncodeStream &strm) const
virtual std::shared_ptr< UserProfile > selectUASUserProfile(const SipMessage &)
dcm! – update contact in dialog if required
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
static const Data Empty
Constant that represents a zero-length data.
Definition Data.hxx:882
size_type size() const noexcept
Returns the number of bytes in this Data.
Definition Data.hxx:599
bool isValid() const
Definition Handle.hxx:25
size_t size() const
return the size of the mParsers vector
Container class for ParserCategory, used by SipMessage to represent multi-valued headers (Contact,...
Represents a SIP message.
dcm! – add UnusedChecking(_enum) below;
#define EncodeStream