/[resiprocate]/branches/b-directory-reorg/sip/resiprocate/DeprecatedDialog.hxx
ViewVC logotype

Contents of /branches/b-directory-reorg/sip/resiprocate/DeprecatedDialog.hxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5271 - (show annotations) (download)
Thu Aug 18 23:43:07 2005 UTC (14 years, 3 months ago) by jason
File size: 7523 byte(s)
new directory reorg proposal
1 #if !defined(RESIP_DIALOG_HXX)
2 #define RESIP_DIALOG_HXX
3
4 #include <iosfwd>
5 #include "resiprocate/MethodTypes.hxx"
6 #include "resiprocate/NameAddr.hxx"
7 #include "resiprocate/Uri.hxx"
8 #include "resiprocate/CallId.hxx"
9 #include "resiprocate/os/BaseException.hxx"
10 #include "resiprocate/os/Timer.hxx"
11
12 namespace resip
13 {
14
15 class SipMessage;
16 class NameAddr;
17 class CallID;
18
19 class DeprecatedDialog
20 {
21 public:
22 class Exception : public BaseException
23 {
24 public:
25 Exception( const resip::Data& msg,
26 const resip::Data& file,
27 const int line): BaseException(msg,file,line){}
28 const char* name() const { return "Dialog::Exception"; }
29 };
30
31 // pass in a contact for this location e.g. "sip:local@domain:5060"
32 DeprecatedDialog(const NameAddr& localContact);
33
34 // If a dialog is not yet created, make a dialog or early dialog as
35 // follows. Otherwise, just make response from the dialog state
36 // Used by the UAS to create a dialog or early dialog, will return a 1xx(code)
37 // UAS should call this upon receiving the invite/subscribe.
38 // This should not be called twice if the UAS sends back a 180 and a 200,
39 // it should call it for the 180 and then use Dialog::makeResponse to make
40 // the 200
41 SipMessage* makeResponse(const SipMessage& request, int code=200);
42
43 // This happens when a dialog gets created on a UAC when
44 // a UAC receives a response that creates a dialog. Also works for NOTIFY
45 // requests which create a dialog
46 void createDialogAsUAC(const SipMessage& response);
47
48 // Called when a 2xx response is received in an existing dialog
49 // Replace the _remoteTarget with uri from Contact header in response
50 void targetRefreshResponse(const SipMessage& response);
51
52 // Called when a request is received in an existing dialog
53 // return status code of response to generate - 0 if ok
54 int targetRefreshRequest(const SipMessage& request);
55
56 // given a template of a request, update the relevant fields based on this
57 void updateRequest(SipMessage& msg);
58
59 // For UAS, make a response and create the dialog if necessary
60 void makeResponse(const SipMessage& request, SipMessage& response, int code=200);
61
62 bool isCreated() const { return mCreated; }
63 bool isEarly() const { return mEarly; }
64
65 static Data dialogId(const SipMessage& msg);
66 const Data dialogId() const;
67 const CallID& getCallId() const { return mCallId; }
68 const NameAddr& getRemoteTarget() const { return mRemoteTarget; }
69 //const Data& getLocalTag() const { return mLocalTag; }
70 const Data& getRemoteTag() const { return mRemoteTag; }
71
72 // For creating request which do not form a dialog but whose response
73 // might create a dialog
74 SipMessage* makeInitialRegister(const NameAddr& registrar, const NameAddr& from);
75 SipMessage* makeInitialSubscribe(const NameAddr& target, const NameAddr& from);
76 SipMessage* makeInitialPublish(const NameAddr& target, const NameAddr& from);
77 SipMessage* makeInitialInvite(const NameAddr& target, const NameAddr& from);
78 SipMessage* makeInitialMessage(const NameAddr& target, const NameAddr& from);
79
80 // For creating requests within a dialog
81 SipMessage* makeInvite();
82 SipMessage* makeRegister();
83 SipMessage* makeSubscribe();
84 SipMessage* makeBye();
85 SipMessage* makeRefer(const NameAddr& referTo);
86 SipMessage* makeNotify();
87 SipMessage* makeOptions();
88 SipMessage* makePublish();
89 SipMessage* makeAck();
90 SipMessage* makeAck(const SipMessage& request);
91 SipMessage* makeCancel(const SipMessage& request);
92 SipMessage* makeRequest(MethodTypes method);
93 CallID makeReplaces();
94
95 // resets to an empty dialog with no state
96 void clear();
97
98 // set how many seconds in the futre this dialog will expire
99 void setExpirySeconds( int secondsInFuture );
100 int getExpirySeconds(); // get number Seconds till this expires, it can
101 // be negative
102
103
104 private:
105 SipMessage* makeRequestInternal(MethodTypes method);
106 void incrementCSeq(SipMessage& request);
107 void copyCSeq(SipMessage& request);
108
109 NameAddr mContact; // for this UA
110
111 // Dialog State
112 bool mCreated;
113 bool mEarly;
114
115 Uri mRequestUri;
116
117 NameAddrs mRouteSet;
118 NameAddr mRemoteTarget;
119
120 unsigned long mRemoteSequence;
121 bool mRemoteEmpty;
122 unsigned long mLocalSequence;
123 bool mLocalEmpty;
124
125 CallID mCallId;
126 Data mLocalTag;
127 Data mRemoteTag;
128 CallID mDialogId;
129
130 NameAddr mRemoteUri;
131 NameAddr mLocalUri;
132
133 bool secure; // indicates the messages in this Dialog must use TLS
134
135 UInt64 expireyTimeAbsoluteMs;
136
137 friend std::ostream& operator<<(std::ostream&, const DeprecatedDialog&);
138 };
139
140 std::ostream&
141 operator<<(std::ostream& strm, const DeprecatedDialog& d);
142
143 } // namespace Cathay
144
145 #endif
146
147 /* ====================================================================
148 * The Vovida Software License, Version 1.0
149 *
150 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
151 *
152 * Redistribution and use in source and binary forms, with or without
153 * modification, are permitted provided that the following conditions
154 * are met:
155 *
156 * 1. Redistributions of source code must retain the above copyright
157 * notice, this list of conditions and the following disclaimer.
158 *
159 * 2. Redistributions in binary form must reproduce the above copyright
160 * notice, this list of conditions and the following disclaimer in
161 * the documentation and/or other materials provided with the
162 * distribution.
163 *
164 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
165 * and "Vovida Open Communication Application Library (VOCAL)" must
166 * not be used to endorse or promote products derived from this
167 * software without prior written permission. For written
168 * permission, please contact vocal@vovida.org.
169 *
170 * 4. Products derived from this software may not be called "VOCAL", nor
171 * may "VOCAL" appear in their name, without prior written
172 * permission of Vovida Networks, Inc.
173 *
174 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
175 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
176 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
177 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
178 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
179 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
180 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
181 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
182 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
183 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
184 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
185 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
186 * DAMAGE.
187 *
188 * ====================================================================
189 *
190 * This software consists of voluntary contributions made by Vovida
191 * Networks, Inc. and many individuals on behalf of Vovida Networks,
192 * Inc. For more information on Vovida Networks, Inc., please see
193 * <http://www.vovida.org/>.
194 *
195 */

Properties

Name Value
svn:eol-style LF

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27