/[resiprocate]/main/sip/resiprocate/dum/Dialog.hxx
ViewVC logotype

Contents of /main/sip/resiprocate/dum/Dialog.hxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2867 - (show annotations) (download)
Sun May 30 16:38:27 2004 UTC (15 years, 7 months ago) by derek
File size: 6565 byte(s)


1 #if !defined(RESIP_CLIENTDIALOG_HXX)
2 #define RESIP_CLIENTDIALOG_HXX
3
4 #include <vector>
5 #include "resiprocate/dum/DialogId.hxx"
6 #include "resiprocate/dum/InviteSession.hxx"
7 #include "resiprocate/dum/ClientSubscription.hxx"
8 #include "resiprocate/dum/ServerSubscription.hxx"
9 #include "resiprocate/dum/ClientRegistration.hxx"
10 #include "resiprocate/dum/ServerRegistration.hxx"
11 #include "resiprocate/dum/ServerPublication.hxx"
12 #include "resiprocate/dum/ClientPublication.hxx"
13 #include "resiprocate/dum/ServerOutOfDialogReq.hxx"
14 #include "resiprocate/dum/ClientOutOfDialogReq.hxx"
15 #include "resiprocate/ParserCategories.hxx"
16
17 namespace resip
18 {
19 class BaseUsage;
20 class UsageSet;
21 class SipMessage;
22 class DialogUsageManager;
23 class DialogSet;
24
25 //!dcm! -- kill typedef std::list<DialogId> DialogIdSet;
26
27 class Dialog
28 {
29 public:
30 class Exception : BaseException
31 {
32 public:
33 Exception(const Data& msg, const Data& file, int line);
34 virtual const char* name() const {return "Dialog::Exception";}
35 };
36
37 // different behavior from request vs. response
38 // (request creates to tag)
39 Dialog(DialogUsageManager& dum, const SipMessage& msg, DialogSet& ds);
40
41 DialogId getId() const;
42
43 // void makeBye(SipMessage& proto);
44 // void makeInvite(SipMessage& proto);
45 // void makeAck(SipMessage& proto);
46 // void makePrack(SipMessage& proto);
47 void makeRequest(SipMessage& request, MethodTypes method);
48 void makeResponse(const SipMessage& request, SipMessage& response, int responseCode);
49
50 void update(const SipMessage& msg);
51 //void setLocalContact(const NameAddr& localContact);
52 //void setRemoteTarget(const NameAddr& remoteTarget);
53
54 std::vector<ClientSubscription::Handle> findClientSubscriptions();
55 ServerSubscription::Handle findServerSubscription();
56 InviteSession::Handle findInviteSession();
57 ClientRegistration::Handle findClientRegistration();
58 ServerRegistration::Handle findServerRegistration();
59 ClientPublication::Handle findClientPublication();
60 ServerPublication::Handle findServerPublication();
61 ClientOutOfDialogReq::Handle findClientOutOfDialog();
62 ServerOutOfDialogReq::Handle findServerOutOfDialog();
63
64 void dispatch(const SipMessage& msg);
65 bool shouldMerge(const SipMessage& request) const;
66 void processNotify(const SipMessage& notify);
67
68 private:
69 virtual ~Dialog();
70 friend class BaseUsage;
71 friend class DialogSet;
72
73 friend class ClientSubscription;
74 friend class InviteSession;
75 friend class ServerSubscription;
76 friend class ClientRegistration;
77 friend class ServerRegistration;
78 friend class ClientPublication;
79 friend class ServerPublication;
80 friend class ClientOutOfDialogReq;
81 friend class ServerOutOfDialogReq;
82
83 void possiblyDie();
84
85 ClientOutOfDialogReq* findMatchingClientOutOfDialogReq(const SipMessage& msg);
86 ClientSubscription* findMatchingClientSub(const SipMessage& msg);
87
88 DialogId mId;
89 DialogUsageManager& mDum;
90 DialogSet& mDialogSet;
91
92 std::list<ClientSubscription*> mClientSubscriptions;
93 ServerSubscription* mServerSubscription;
94 InviteSession* mInviteSession;
95 ClientRegistration* mClientRegistration;
96 ServerRegistration* mServerRegistration;
97 ClientPublication* mClientPublication;
98 ServerPublication* mServerPublication;
99 std::list<ClientOutOfDialogReq*> mClientOutOfDialogRequests;
100 ServerOutOfDialogReq* mServerOutOfDialogRequest;
101
102 //invariants
103 typedef enum // need to add
104 {
105 Invitation, // INVITE dialog
106 Subscription, // Created by a SUBSCRIBE / NOTIFY / REFER
107 Fake // Not really a dialog (e.g. created by a REGISTER)
108 } DialogType;
109
110 DialogType mType; // !jf! is this necessary?
111 Data mLocalTag;
112 Data mRemoteTag;
113 CallID mCallId;
114 NameAddrs mRouteSet;
115
116 //variants
117 NameAddr mLocalContact;
118 unsigned long mLocalCSeq;
119 unsigned long mRemoteCSeq;
120 NameAddr mRemoteTarget;
121
122 };
123
124 }
125
126 #endif
127
128 /* ====================================================================
129 * The Vovida Software License, Version 1.0
130 *
131 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
132 *
133 * Redistribution and use in source and binary forms, with or without
134 * modification, are permitted provided that the following conditions
135 * are met:
136 *
137 * 1. Redistributions of source code must retain the above copyright
138 * notice, this list of conditions and the following disclaimer.
139 *
140 * 2. Redistributions in binary form must reproduce the above copyright
141 * notice, this list of conditions and the following disclaimer in
142 * the documentation and/or other materials provided with the
143 * distribution.
144 *
145 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
146 * and "Vovida Open Communication Application Library (VOCAL)" must
147 * not be used to endorse or promote products derived from this
148 * software without prior written permission. For written
149 * permission, please contact vocal@vovida.org.
150 *
151 * 4. Products derived from this software may not be called "VOCAL", nor
152 * may "VOCAL" appear in their name, without prior written
153 * permission of Vovida Networks, Inc.
154 *
155 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
156 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
157 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
158 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
159 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
160 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
161 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
162 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
163 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
164 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
165 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
166 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
167 * DAMAGE.
168 *
169 * ====================================================================
170 *
171 * This software consists of voluntary contributions made by Vovida
172 * Networks, Inc. and many individuals on behalf of Vovida Networks,
173 * Inc. For more information on Vovida Networks, Inc., please see
174 * <http://www.vovida.org/>.
175 *
176 */

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27