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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 10695 - (show annotations) (download)
Fri Nov 22 23:12:34 2013 UTC (5 years, 11 months ago) by sgodin
File MIME type: text/plain
File size: 17441 byte(s)
-Merged from b-uasprack-20130904
  -added UAS Prack support to DUM!  Original implementation taken from b-uasprack-20091103
  -many changes, fixes and enhancements from original branch
  -MasterProfile setting setUasReliableProvisionalMode is used to enable
  -added mode called SupportedEssential where we will send reliable provisionals only if they
   are a provisional that is carrying an offer or answer  - required for 3GPP IMS flows 
  -added resubmit timer for reliable responses to ensure we send a reliable provisional at least 
   every 2.5 minutes  -new profile setting: set1xxRelResubmitTime to support this
  -updated state diagrams and added new PRACK flow diagrams to dum/doc directory (removed old diagrams)
  -fixed update glare handling for UAC prack 
  -added in support for UAC Prack to be able to send an offer in the first PRACK response 
  (must call provideOffer from onAnswer callback)
  -made a helper method on DialogUsageManager to set advertised capabilities 
  -fixed missing break in ClientInviteSession::dispatchReceivedUpdateEarly 
  

  
  
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 ensure the MinExpires value is less than this before re-registering
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 PreferCallerRefreshes if you prefer that the Caller performs the refreshes.
87 /// Set to PreferCalleeRefreshes if you prefer that the Callee (called party) 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 in UAC requests.
93 typedef enum
94 {
95 PreferLocalRefreshes,
96 PreferRemoteRefreshes,
97 PreferCallerRefreshes,
98 PreferCalleeRefreshes
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 /// The amount of time that can pass before dum will resubmit a reliable provisional response
110 virtual void set1xxRelResubmitTime(int secs);
111 virtual int get1xxRelResubmitTime() const;
112 virtual void unset1xxRelResubmitTime();
113
114 ///overrides the value used to populate the contact
115 ///?dcm? -- also change via entries? Also, dum currently uses(as a uas)
116 ///the request uri of the dialog constructing request for the local contact
117 ///within that dialog. A transport paramter here could also be used to
118 ///force tcp vs udp vs tls?
119 virtual void setOverrideHostAndPort(const Uri& hostPort);
120 virtual bool hasOverrideHostAndPort() const;
121 virtual const Uri& getOverrideHostAndPort() const;
122 virtual void unsetOverrideHostAndPort();
123
124 ///enable/disable sending of Allow/Supported/Accept-Language/Accept-Encoding headers
125 ///on initial outbound requests (ie. Initial INVITE, REGISTER, etc.) and Invite 200 responses
126 ///Note: Default is to advertise Headers::Allow and Headers::Supported, use clearAdvertisedCapabilities to remove these
127 /// Currently implemented header values are: Headers::Allow, Headers::AllowEvents
128 /// Headers::AcceptEncoding, Headers::AcceptLanguage, Headers::Supported
129 virtual void addAdvertisedCapability(const Headers::Type header);
130 virtual bool isAdvertisedCapability(const Headers::Type header) const;
131 virtual void clearAdvertisedCapabilities();
132 virtual void unsetAdvertisedCapabilities();
133
134 /// Use to route all outbound requests through a particular proxy
135 virtual void setOutboundProxy( const Uri& uri );
136 virtual const NameAddr& getOutboundProxy() const;
137 virtual bool hasOutboundProxy() const;
138 virtual void unsetOutboundProxy();
139
140 ///If enabled, forces use of outbound proxy on all requests, including
141 ///mid-dialog requests. WARNING: Using this setting breaks 3261 mid-dialog
142 ///routing and disables any ability to react to target refreshes. However
143 ///there are certain scenarios/endpoints for which this setting may make
144 ///sense - for example: to communicate with an endpoint that never populates
145 ///it's Contact header correctly.
146 virtual void setForceOutboundProxyOnAllRequestsEnabled(bool enabled) ;
147 virtual bool getForceOutboundProxyOnAllRequestsEnabled() const;
148 virtual void unsetForceOutboundProxyOnAllRequestsEnabled();
149
150 ///If enabled, add a route header for the outbound proxy
151 virtual void setExpressOutboundAsRouteSetEnabled(bool enabled) ;
152 virtual bool getExpressOutboundAsRouteSetEnabled() const;
153 virtual void unsetExpressOutboundAsRouteSetEnabled();
154
155 ///enable/disable rport for requests. rport is enabled by default
156 virtual void setRportEnabled(bool enabled);
157 virtual bool getRportEnabled() const;
158 virtual void unsetRportEnabled();
159
160 ///if set then UserAgent header is added to outbound messages
161 virtual void setUserAgent( const Data& userAgent );
162 virtual const Data& getUserAgent() const;
163 virtual bool hasUserAgent() const;
164 virtual void unsetUserAgent();
165
166 ///if set then ProxyRequires header is added to outbound messages
167 virtual void setProxyRequires( const Tokens& proxyRequires );
168 virtual const Tokens& getProxyRequires() const;
169 virtual bool hasProxyRequires() const;
170 virtual void unsetProxyRequires();
171
172 ///time between CR/LF keepalive messages in seconds. Set to 0 to disable.
173 ///Default is 30 seconds for datagram and 180 seconds for stream.
174 ///Note: You must set a KeepAliveManager on DUM for this to work.
175 virtual void setKeepAliveTimeForDatagram(int keepAliveTime);
176 virtual int getKeepAliveTimeForDatagram() const;
177 virtual void unsetKeepAliveTimeForDatagram();
178 virtual void setKeepAliveTimeForStream(int keepAliveTime);
179 virtual int getKeepAliveTimeForStream() const;
180 virtual void unsetKeepAliveTimeForStream();
181
182 ///If set dum will provide a port in the via for requests sent down to the stack. This
183 ///will tell the transport selector to only look at those transports using this port.
184 ///Default is 0 (Disabled).
185 ///WARNING: Setting this can cause undesirable behaviour in the case when you want
186 /// DNS entries to decided your transport and you are supporting TLS.
187 /// For example: if you add UDP:5060, TCP:5060 and TLS:5061 and setFixedTransportPort
188 /// to 5060 - then the TLS transport cannot be used.
189 virtual void setFixedTransportPort(int fixedTransportPort);
190 virtual int getFixedTransportPort() const;
191 virtual void unsetFixedTransportPort();
192
193 ///If set dum will provide a interface in the via for requests sent down to the stack. This
194 ///will tell the transport selector to only look at those transports using this interface.
195 ///Default is Data::Empty (Disabled).
196 virtual void setFixedTransportInterface(const Data& fixedTransportInterface);
197 virtual const Data& getFixedTransportInterface() const;
198 virtual void unsetFixedTransportInterface();
199
200 ///If enabled then rinstance parameter is added to contacts. The rinstance
201 ///parameter is added by default.
202 virtual void setRinstanceEnabled(bool enabled);
203 virtual bool getRinstanceEnabled() const;
204 virtual void unsetRinstanceEnabled();
205
206 //If set then dum will add this MessageDecorator to all outbound messages
207 virtual void setOutboundDecorator(SharedPtr<MessageDecorator> outboundDecorator);
208 virtual SharedPtr<MessageDecorator> getOutboundDecorator();
209 virtual void unsetOutboundDecorator();
210
211 ///If enabled then methods parameter is added to contacts.
212 virtual void setMethodsParamEnabled(bool enabled) ;
213 virtual bool getMethodsParamEnabled() const;
214 virtual void unsetMethodsParamEnabled();
215
216 ///If set, the parameters on the provided NameAddr are used in the contact header
217 ///Example:
218 /// #include <resip/stack/ExtensionParameter.hxx>
219 /// static const resip::ExtensionParameter p_automaton("automaton");
220 /// static const resip::ExtensionParameter p_byeless("+sip.byeless");
221 /// static const resip::ExtensionParameter p_rendering("+sip.rendering");
222 /// ...
223 /// NameAddr capabilities;
224 /// capabilities.param(p_automaton);
225 /// capabilities.param(p_byeless);
226 /// capabilities.param(p_rendering) = "\"no\"";
227 /// profile->setUserAgentCapabilities(capabilities);
228 virtual void setUserAgentCapabilities(const NameAddr& capabilities) ;
229 virtual bool hasUserAgentCapabilities() const;
230 virtual const NameAddr& getUserAgentCapabilities() const;
231 virtual void unsetUserAgentCapabilities();
232
233 ///If enabled then dialog identifying headers are added to SipFrag bodies
234 ///that are generated in an InviteSession
235 virtual void setExtraHeadersInReferNotifySipFragEnabled(bool enabled) ;
236 virtual bool getExtraHeadersInReferNotifySipFragEnabled() const;
237 virtual void unsetExtraHeadersInReferNotifySipFragEnabled();
238
239 private:
240 bool mHasDefaultRegistrationExpires;
241 UInt32 mDefaultRegistrationExpires;
242
243 bool mHasDefaultMaxRegistrationExpires;
244 UInt32 mDefaultMaxRegistrationExpires;
245
246 bool mHasDefaultRegistrationRetryInterval;
247 int mDefaultRegistrationRetryInterval;
248
249 bool mHasDefaultSubscriptionExpires;
250 UInt32 mDefaultSubscriptionExpires;
251
252 bool mHasDefaultPublicationExpires;
253 UInt32 mDefaultPublicationExpires;
254
255 bool mHasDefaultStaleCallTime;
256 int mDefaultStaleCallTime;
257
258 bool mHasDefaultStaleReInviteTime;
259 int mDefaultStaleReInviteTime;
260
261 bool mHasDefaultSessionExpires;
262 UInt32 mDefaultSessionExpires;
263
264 bool mHasDefaultSessionTimerMode;
265 SessionTimerMode mDefaultSessionTimerMode;
266
267 bool mHas1xxRetransmissionTime;
268 int m1xxRetransmissionTime;
269
270 bool mHas1xxRelResubmitTime;
271 int m1xxRelResubmitTime;
272
273 bool mHasOutboundProxy;
274 NameAddr mOutboundProxy;
275
276 bool mHasForceOutboundProxyOnAllRequestsEnabled;
277 bool mForceOutboundProxyOnAllRequestsEnabled;
278
279 bool mHasExpressOutboundAsRouteSetEnabled;
280 bool mExpressOutboundAsRouteSetEnabled;
281
282 bool mHasAdvertisedCapabilities;
283 std::set<Headers::Type> mAdvertisedCapabilities;
284
285 bool mHasRportEnabled;
286 bool mRportEnabled;
287
288 bool mHasUserAgent;
289 Data mUserAgent;
290
291 bool mHasOverrideHostPort;
292 Uri mOverrideHostPort;
293
294 bool mHasKeepAliveTimeForDatagram;
295 int mKeepAliveTimeForDatagram;
296
297 bool mHasKeepAliveTimeForStream;
298 int mKeepAliveTimeForStream;
299
300 bool mHasFixedTransportPort;
301 int mFixedTransportPort;
302
303 bool mHasFixedTransportInterface;
304 Data mFixedTransportInterface;
305
306 bool mHasProxyRequires;
307 Tokens mProxyRequires;
308
309 bool mHasRinstanceEnabled;
310 bool mRinstanceEnabled;
311
312 bool mHasOutboundDecorator;
313 SharedPtr<MessageDecorator> mOutboundDecorator;
314
315 bool mHasMethodsParamEnabled;
316 bool mMethodsParamEnabled;
317
318 bool mHasUserAgentCapabilities;
319 NameAddr mUserAgentCapabilities;
320
321 bool mHasExtraHeadersInReferNotifySipFragEnabled;
322 bool mExtraHeadersInReferNotifySipFragEnabled;
323
324 SharedPtr<Profile> mBaseProfile; // All non-set settings will fall through to this Profile (if set)
325 };
326
327 }
328
329 #endif
330
331 /* ====================================================================
332 * The Vovida Software License, Version 1.0
333 *
334 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
335 *
336 * Redistribution and use in source and binary forms, with or without
337 * modification, are permitted provided that the following conditions
338 * are met:
339 *
340 * 1. Redistributions of source code must retain the above copyright
341 * notice, this list of conditions and the following disclaimer.
342 *
343 * 2. Redistributions in binary form must reproduce the above copyright
344 * notice, this list of conditions and the following disclaimer in
345 * the documentation and/or other materials provided with the
346 * distribution.
347 *
348 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
349 * and "Vovida Open Communication Application Library (VOCAL)" must
350 * not be used to endorse or promote products derived from this
351 * software without prior written permission. For written
352 * permission, please contact vocal@vovida.org.
353 *
354 * 4. Products derived from this software may not be called "VOCAL", nor
355 * may "VOCAL" appear in their name, without prior written
356 * permission of Vovida Networks, Inc.
357 *
358 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
359 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
360 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
361 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
362 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
363 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
364 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
365 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
366 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
367 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
368 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
369 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
370 * DAMAGE.
371 *
372 * ====================================================================
373 *
374 * This software consists of voluntary contributions made by Vovida
375 * Networks, Inc. and many individuals on behalf of Vovida Networks,
376 * Inc. For more information on Vovida Networks, Inc., please see
377 * <http://www.vovida.org/>.
378 *
379 */

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