reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
DialogSet.hxx
Go to the documentation of this file.
1#if !defined(RESIP_CLIENTDIALOGSET_HXX)
2#define RESIP_CLIENTDIALOGSET_HXX
3
4#include <map>
5#include <list>
6
10#include "resip/dum/Handles.hxx"
12
13#include <memory>
14
15namespace resip
16{
17
18class BaseCreator;
19class Dialog;
20class DialogUsageManager;
21class AppDialogSet;
22class ClientOutOfDialogReq;
23class UserProfile;
24
26{
27 public:
29 DialogSet(const SipMessage& request, DialogUsageManager& dum);
30 virtual ~DialogSet();
31
32 DialogSetId getId() const;
33 void addDialog(Dialog*);
34 bool empty() const noexcept;
35 BaseCreator* getCreator() const noexcept;
36
37 std::shared_ptr<UserProfile> getUserProfile() const;
38 void setUserProfile(std::shared_ptr<UserProfile> userProfile);
39
40 void end(const Data& endReason);
41 void end(const ParserContainer<Token>& endReasons);
42 void end();
43 void dispatch(const SipMessage& msg);
44
50
51 bool isDestroying() const noexcept { return mState == Destroying; };
52
53 private:
54 friend class Dialog;
55 friend class DialogUsage;
56 friend class ClientInviteSession;
57 friend class NonDialogUsage;
58 friend class DialogUsageManager;
59 friend class ClientRegistration;
60 friend class ServerRegistration;
63 friend class ClientPublication;
64 friend class RedirectManager;
65 friend class ClientPagerMessage;
66 friend class ServerPagerMessage;
67
68 typedef enum
69 {
70 Initial, // No session setup yet
71 WaitingToEnd,
72 ReceivedProvisional,
73 Established,
74 Terminating,
75 Cancelling, // only used when cancelling and no dialogs exist
76 Destroying
77 } State;
78
79 void possiblyDie();
80
81 void onForkAccepted();
82 bool handledByAuthOrRedirect(const SipMessage& msg);
83
85 void appDissociate()
86 {
87 resip_assert(mAppDialogSet);
88 mAppDialogSet = 0;
89 }
90 friend class AppDialogSet;
91
92 Dialog* findDialog(const SipMessage& msg);
93 Dialog* findDialog(const DialogId id);
94
95 ClientOutOfDialogReq* findMatchingClientOutOfDialogReq(const SipMessage& msg);
96
97 ClientRegistration* makeClientRegistration(const SipMessage& msg);
98 ClientPublication* makeClientPublication( const SipMessage& msg);
99 ClientOutOfDialogReq* makeClientOutOfDialogReq(const SipMessage& msg);
100
101 ServerRegistration* makeServerRegistration(const SipMessage& msg);
102 ServerOutOfDialogReq* makeServerOutOfDialog(const SipMessage& msg);
103
104 ServerPagerMessage* makeServerPagerMessage(const SipMessage& request);
105
106 void dispatchToAllDialogs(const SipMessage& msg);
107
108 void flowTerminated(const Tuple& flow);
109
110 MergedRequestKey mMergeKey;
111 Data mCancelKey;
112 typedef std::map<DialogId,Dialog*> DialogMap;
113 DialogMap mDialogs;
114 BaseCreator* mCreator;
115 DialogSetId mId;
116 DialogUsageManager& mDum;
117 AppDialogSet* mAppDialogSet;
118 State mState;
119 ClientRegistration* mClientRegistration;
120 ServerRegistration* mServerRegistration;
121 ClientPublication* mClientPublication;
122 std::list<ClientOutOfDialogReq*> mClientOutOfDialogRequests;
123 ServerOutOfDialogReq* mServerOutOfDialogRequest;
124
125 ClientPagerMessage* mClientPagerMessage;
126 ServerPagerMessage* mServerPagerMessage;
127 std::shared_ptr<UserProfile> mUserProfile;
128
129 // Used when EndReason(s) are specified
130 Data mEndReason;
131 ParserContainer<Token> mEndReasons;
132 void addEndReasonToMessage(SipMessage& msg);
133
135};
136
139
140}
141
142#endif
143
144/* ====================================================================
145 * The Vovida Software License, Version 1.0
146 *
147 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
148 *
149 * Redistribution and use in source and binary forms, with or without
150 * modification, are permitted provided that the following conditions
151 * are met:
152 *
153 * 1. Redistributions of source code must retain the above copyright
154 * notice, this list of conditions and the following disclaimer.
155 *
156 * 2. Redistributions in binary form must reproduce the above copyright
157 * notice, this list of conditions and the following disclaimer in
158 * the documentation and/or other materials provided with the
159 * distribution.
160 *
161 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
162 * and "Vovida Open Communication Application Library (VOCAL)" must
163 * not be used to endorse or promote products derived from this
164 * software without prior written permission. For written
165 * permission, please contact vocal@vovida.org.
166 *
167 * 4. Products derived from this software may not be called "VOCAL", nor
168 * may "VOCAL" appear in their name, without prior written
169 * permission of Vovida Networks, Inc.
170 *
171 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
172 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
173 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
174 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
175 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
176 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
177 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
178 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
179 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
180 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
181 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
182 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
183 * DAMAGE.
184 *
185 * ====================================================================
186 *
187 * This software consists of voluntary contributions made by Vovida
188 * Networks, Inc. and many individuals on behalf of Vovida Networks,
189 * Inc. For more information on Vovida Networks, Inc., please see
190 * <http://www.vovida.org/>.
191 *
192 */
#define resip_assert(x)
This file needs to work for both C and C++ code.
dcm! – shutdown/deletion API – end?
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
ClientPublicationHandle getClientPublication()
friend EncodeStream & operator<<(EncodeStream &strm, const DialogSet &ds)
void addDialog(Dialog *)
BaseCreator * getCreator() const noexcept
ServerRegistrationHandle getServerRegistration()
ClientOutOfDialogReqHandle getClientOutOfDialog()
ServerOutOfDialogReqHandle getServerOutOfDialog()
void dispatch(const SipMessage &msg)
void setUserProfile(std::shared_ptr< UserProfile > userProfile)
bool empty() const noexcept
ClientRegistrationHandle getClientRegistration()
bool isDestroying() const noexcept
Definition DialogSet.hxx:51
std::shared_ptr< UserProfile > getUserProfile() const
virtual ~DialogSet()
Definition DialogSet.cxx:95
DialogSetId getId() const
dcm! – kill typedef std::list<DialogId> DialogIdSet;
Definition Dialog.hxx:29
Container class for ParserCategory, used by SipMessage to represent multi-valued headers (Contact,...
Represents a SIP message.
Represents a network address.
Definition Tuple.hxx:59
dcm! – add UnusedChecking(_enum) below;
EncodeStream & operator<<(EncodeStream &strm, const BaseException &e)
#define EncodeStream
void list()
Definition userAdmin.cxx:66