/[resiprocate]/main/resip/dum/Profile.hxx
ViewVC logotype

Contents of /main/resip/dum/Profile.hxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 7292 - (show annotations) (download)
Thu Oct 4 16:32:08 2007 UTC (12 years, 2 months ago) by sgodin
File MIME type: text/plain
File size: 14925 byte(s)
- implemented a stale re-invite timer 
  - duration is settable via Profile with a default of 40 seconds
  - New onStaleReInviteTimeout callback on InviteSession for applications that are interested
  - default implementation of onStaleReInviteTimeout is to end() the call
  - added new End Reason - StaleReInvite
  - fixes an issues of lingering usages when sending a re-invite, receiving a 1xx response and no final response
- Accept BYE messages in WaitingToTerminate state
- Respond to other requests with a 400 in WaitingToTerminate state

1 #if !defined(RESIP_PROFILE_HXX)
2 #define RESIP_PROFILE_HXX
3
4 #include <iosfwd>
5 #include <set>
6 #include "resip/stack/Headers.hxx"
7 #include "resip/stack/MethodTypes.hxx"
8 #include "rutil/SharedPtr.hxx"
9 #include "resip/stack/MessageDecorator.hxx"
10
11 namespace resip
12 {
13
14 class Data;
15
16 class Profile
17 {
18 public:
19 Profile(); // Default to no base profile
20 Profile(SharedPtr<Profile> baseProfile);
21 virtual ~Profile();
22
23 /// Reset this profile to it's initial state - (same as calling unsetXXX for each setting)
24 /// If no fall through (base) profile was provided as creation time
25 /// - Reset all settings to Default settings
26 /// else
27 /// - Reset all setting to fall through to base profile
28 virtual void reset();
29
30 /// Note:
31 /// setXXXX methods will set this setting internally in this object. If you do not call
32 /// a particular setXXX method on this object then a corresponding getXXXX call will attempt
33 /// to retrieve that value from the BaseProfile (provided in the constructor). This allows
34 /// you to setup a heirarchy of profiles and settings.
35 /// unsetXXX methods are used to re-enable fallthrough after calling a setXXXX method. If
36 /// you call an unsetXXXX method on an object with a NULL BaseProfile the setting will return to
37 /// it's creation time default. Note: Defaults are described below.
38
39 /// This default is used if no value is passed in when creating a registration
40 virtual void setDefaultRegistrationTime(UInt32 secs);
41 virtual UInt32 getDefaultRegistrationTime() const;
42 virtual void unsetDefaultRegistrationTime();
43
44 /// If a registration gets rejected with a 423, then we with the MinExpires value - if it is less than this
45 /// Set to 0 to disable this check and accept any time suggested by the server.
46 virtual void setDefaultMaxRegistrationTime(UInt32 secs);
47 virtual UInt32 getDefaultMaxRegistrationTime() const;
48 virtual void unsetDefaultMaxRegistrationTime();
49
50 /// The time to retry registrations on error responses (if Retry-After header is not present in error)
51 /// Set to 0 to never retry on errors. Note: onRequestRetry is called before this setting is
52 /// checked. Return -1 from onRequestRetry in order to use this setting.
53 virtual void setDefaultRegistrationRetryTime(int secs);
54 virtual int getDefaultRegistrationRetryTime() const;
55 virtual void unsetDefaultRegistrationRetryTime();
56
57 /// This default is used if no value is passed in when creating a subscription
58 virtual void setDefaultSubscriptionTime(UInt32 secs);
59 virtual UInt32 getDefaultSubscriptionTime() const;
60 virtual void unsetDefaultSubscriptionTime();
61
62 /// This default is used if no value is passed in when creating a publication
63 virtual void setDefaultPublicationTime(UInt32 secs);
64 virtual UInt32 getDefaultPublicationTime() const;
65 virtual void unsetDefaultPublicationTime();
66
67 /// Call is stale if UAC gets no final response within the stale call timeout (default 3 minutes)
68 virtual void setDefaultStaleCallTime(int secs);
69 virtual int getDefaultStaleCallTime() const;
70 virtual void unsetDefaultStaleCallTime();
71
72 /// ReInvite is stale if UAC gets no final response within the stale reinvite timeout (default 40 seconds)
73 virtual void setDefaultStaleReInviteTime(int secs);
74 virtual int getDefaultStaleReInviteTime() const;
75 virtual void unsetDefaultStaleReInviteTime();
76
77 /// Only used if timer option tag is set in MasterProfile.
78 /// Note: Value must be higher than 90 (as specified in RFC 4028)
79 virtual void setDefaultSessionTime(UInt32 secs);
80 virtual UInt32 getDefaultSessionTime() const;
81 virtual void unsetDefaultSessionTime();
82
83 /// Only used if timer option tag is set in MasterProfile.
84 /// Set to PreferLocalRefreshes if you prefer that the local UA performs the refreshes.
85 /// Set to PreferRemoteRefreshes if you prefer that the remote UA peforms the refreshes.
86 /// Set to PreferUACRefreshes if you prefer that the UAC (for the session - caller) performs the refreshes.
87 /// Set to PreferUASRefreshes if you prefer that the UAS (for the session - callee) performs the refreshes.
88 /// Note: determining the refresher is a negotiation, so despite this setting the remote
89 /// end may end up enforcing their preference. Also if the remote end doesn't support
90 /// SessionTimers then the refresher will always be local.
91 /// This implementation follows the RECOMMENDED practices from section 7.1 of the draft
92 /// and does not specify a refresher parameter as in UAC requests.
93 typedef enum
94 {
95 PreferLocalRefreshes,
96 PreferRemoteRefreshes,
97 PreferUACRefreshes,
98 PreferUASRefreshes
99 } SessionTimerMode;
100 virtual void setDefaultSessionTimerMode(Profile::SessionTimerMode mode);
101 virtual Profile::SessionTimerMode getDefaultSessionTimerMode() const;
102 virtual void unsetDefaultSessionTimerMode();
103
104 /// The amount of time that can pass before dum will resubmit an unreliable provisional response
105 virtual void set1xxRetransmissionTime(int secs);
106 virtual int get1xxRetransmissionTime() const;
107 virtual void unset1xxRetransmissionTime();
108
109 ///overrides the value used to populate the contact
110 ///?dcm? -- also change via entries? Also, dum currently uses(as a uas)
111 ///the request uri of the dialog constructing request for the local contact
112 ///within that dialog. A transport paramter here could also be used to
113 ///force tcp vs udp vs tls?
114 virtual void setOverrideHostAndPort(const Uri& hostPort);
115 virtual bool hasOverrideHostAndPort() const;
116 virtual const Uri& getOverrideHostAndPort() const;
117 virtual void unsetOverrideHostAndPort();
118
119 ///enable/disable sending of Allow/Supported/Accept-Language/Accept-Encoding headers
120 ///on initial outbound requests (ie. Initial INVITE, REGISTER, etc.) and Invite 200 responses
121 ///Note: Default is to advertise Headers::Allow and Headers::Supported, use clearAdvertisedCapabilities to remove these
122 /// Currently implemented header values are: Headers::Allow,
123 /// Headers::AcceptEncoding, Headers::AcceptLanguage, Headers::Supported
124 virtual void addAdvertisedCapability(const Headers::Type header);
125 virtual bool isAdvertisedCapability(const Headers::Type header) const;
126 virtual void clearAdvertisedCapabilities();
127 virtual void unsetAdvertisedCapabilities();
128
129 /// Use to route all outbound requests through a particular proxy
130 virtual void setOutboundProxy( const Uri& uri );
131 virtual const NameAddr& getOutboundProxy() const;
132 virtual bool hasOutboundProxy() const;
133 virtual void unsetOutboundProxy();
134
135 ///enable/disable rport for requests. rport is enabled by default
136 virtual void setRportEnabled(bool enabled);
137 virtual bool getRportEnabled() const;
138 virtual void unsetRportEnabled();
139
140 ///if set then UserAgent header is added to outbound messages
141 virtual void setUserAgent( const Data& userAgent );
142 virtual const Data& getUserAgent() const;
143 virtual bool hasUserAgent() const;
144 virtual void unsetUserAgent();
145
146 ///if set then ProxyRequires header is added to outbound messages
147 virtual void setProxyRequires( const Tokens& proxyRequires );
148 virtual const Tokens& getProxyRequires() const;
149 virtual bool hasProxyRequires() const;
150 virtual void unsetProxyRequires();
151
152 ///time between CR/LF keepalive messages in seconds. Set to 0 to disable.
153 ///Default is 30 seconds for datagram and 180 seconds for stream.
154 ///Note: You must set a KeepAliveManager on DUM for this to work.
155 virtual void setKeepAliveTimeForDatagram(int keepAliveTime);
156 virtual int getKeepAliveTimeForDatagram() const;
157 virtual void unsetKeepAliveTimeForDatagram();
158 virtual void setKeepAliveTimeForStream(int keepAliveTime);
159 virtual int getKeepAliveTimeForStream() const;
160 virtual void unsetKeepAliveTimeForStream();
161
162 ///If set dum will provide a port in the via for requests sent down to the stack. This
163 ///will tell the transport selector to only look at those transports using this port.
164 ///Default is 0 (Disabled).
165 ///WARNING: Setting this can cause undesirable behaviour in the case when you want
166 /// DNS entries to decided your transport and you are supporting TLS.
167 /// For example: if you add UDP:5060, TCP:5060 and TLS:5061 and setFixedTransportPort
168 /// to 5060 - then the TLS transport cannot be used.
169 virtual void setFixedTransportPort(int fixedTransportPort);
170 virtual int getFixedTransportPort() const;
171 virtual void unsetFixedTransportPort();
172
173 ///If set dum will provide a interface in the via for requests sent down to the stack. This
174 ///will tell the transport selector to only look at those transports using this interface.
175 ///Default is Data::Empty (Disabled).
176 virtual void setFixedTransportInterface(const Data& fixedTransportInterface);
177 virtual const Data& getFixedTransportInterface() const;
178 virtual void unsetFixedTransportInterface();
179
180 ///If enabled then rinstance parameter is added to contacts. The rinstance
181 ///parameter is added by default.
182 virtual void setRinstanceEnabled(bool enabled);
183 virtual bool getRinstanceEnabled() const;
184 virtual void unsetRinstanceEnabled();
185
186 //If set then dum will add this MessageDecorator to all outbound messages
187 virtual void setOutboundDecorator(SharedPtr<MessageDecorator> outboundDecorator);
188 virtual SharedPtr<MessageDecorator> getOutboundDecorator();
189 virtual void unsetOutboundDecorator();
190
191 ///If enabled then methods parameter is added to contacts.
192 virtual void setMethodsParamEnabled(bool enabled) ;
193 virtual bool getMethodsParamEnabled() const;
194 virtual void unsetMethodsParamEnabled();
195
196 ///If enabled, add a route header for the outbound proxy
197 virtual void setExpressOutboundAsRouteSetEnabled(bool enabled) ;
198 virtual bool getExpressOutboundAsRouteSetEnabled() const;
199 virtual void unsetExpressOutboundAsRouteSetEnabled();
200
201
202 private:
203 bool mHasDefaultRegistrationExpires;
204 UInt32 mDefaultRegistrationExpires;
205
206 bool mHasDefaultMaxRegistrationExpires;
207 UInt32 mDefaultMaxRegistrationExpires;
208
209 bool mHasDefaultRegistrationRetryInterval;
210 int mDefaultRegistrationRetryInterval;
211
212 bool mHasDefaultSubscriptionExpires;
213 UInt32 mDefaultSubscriptionExpires;
214
215 bool mHasDefaultPublicationExpires;
216 UInt32 mDefaultPublicationExpires;
217
218 bool mHasDefaultStaleCallTime;
219 int mDefaultStaleCallTime;
220
221 bool mHasDefaultStaleReInviteTime;
222 int mDefaultStaleReInviteTime;
223
224 bool mHasDefaultSessionExpires;
225 UInt32 mDefaultSessionExpires;
226
227 bool mHasDefaultSessionTimerMode;
228 SessionTimerMode mDefaultSessionTimerMode;
229
230 bool mHas1xxRetransmissionTime;
231 int m1xxRetransmissionTime;
232
233 bool mHasOutboundProxy;
234 NameAddr mOutboundProxy;
235
236 bool mHasAdvertisedCapabilities;
237 std::set<Headers::Type> mAdvertisedCapabilities;
238
239 bool mHasRportEnabled;
240 bool mRportEnabled;
241
242 bool mHasUserAgent;
243 Data mUserAgent;
244
245 bool mHasOverrideHostPort;
246 Uri mOverrideHostPort;
247
248 bool mHasKeepAliveTimeForDatagram;
249 int mKeepAliveTimeForDatagram;
250
251 bool mHasKeepAliveTimeForStream;
252 int mKeepAliveTimeForStream;
253
254 bool mHasFixedTransportPort;
255 int mFixedTransportPort;
256
257 bool mHasFixedTransportInterface;
258 Data mFixedTransportInterface;
259
260 bool mHasProxyRequires;
261 Tokens mProxyRequires;
262
263 bool mHasRinstanceEnabled;
264 bool mRinstanceEnabled;
265
266 bool mHasOutboundDecorator;
267 SharedPtr<MessageDecorator> mOutboundDecorator;
268
269 bool mHasMethodsParamEnabled;
270 bool mMethodsParamEnabled;
271
272 bool mHasExpressOutboundAsRouteSetEnabled;
273 bool mExpressOutboundAsRouteSetEnabled;
274
275 SharedPtr<Profile> mBaseProfile; // All non-set settings will fall through to this Profile (if set)
276 };
277
278 }
279
280 #endif
281
282 /* ====================================================================
283 * The Vovida Software License, Version 1.0
284 *
285 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
286 *
287 * Redistribution and use in source and binary forms, with or without
288 * modification, are permitted provided that the following conditions
289 * are met:
290 *
291 * 1. Redistributions of source code must retain the above copyright
292 * notice, this list of conditions and the following disclaimer.
293 *
294 * 2. Redistributions in binary form must reproduce the above copyright
295 * notice, this list of conditions and the following disclaimer in
296 * the documentation and/or other materials provided with the
297 * distribution.
298 *
299 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
300 * and "Vovida Open Communication Application Library (VOCAL)" must
301 * not be used to endorse or promote products derived from this
302 * software without prior written permission. For written
303 * permission, please contact vocal@vovida.org.
304 *
305 * 4. Products derived from this software may not be called "VOCAL", nor
306 * may "VOCAL" appear in their name, without prior written
307 * permission of Vovida Networks, Inc.
308 *
309 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
310 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
311 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
312 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
313 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
314 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
315 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
316 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
317 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
318 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
319 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
320 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
321 * DAMAGE.
322 *
323 * ====================================================================
324 *
325 * This software consists of voluntary contributions made by Vovida
326 * Networks, Inc. and many individuals on behalf of Vovida Networks,
327 * Inc. For more information on Vovida Networks, Inc., please see
328 * <http://www.vovida.org/>.
329 *
330 */

Properties

Name Value
svn:eol-style native
svn:mime-type text/plain

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27