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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 8852 - (show annotations) (download)
Sun Nov 7 18:54:57 2010 UTC (9 years, 1 month ago) by sgodin
File MIME type: text/plain
File size: 15677 byte(s)
-fixed some comment typo's 
-use testStack as resip_test VS project
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 ///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 ///If enabled, forces use of outbound proxy on all requests, including
136 ///mid-dialog requests. WARNING: Using this setting breaks 3261 mid-dialog
137 ///routing and disables any ability to react to target refreshes. However
138 ///there are certain scenarios/endpoints for which this setting may make
139 ///sense - for example: to communicate with an endpoint that never populates
140 ///it's Contact header correctly.
141 virtual void setForceOutboundProxyOnAllRequestsEnabled(bool enabled) ;
142 virtual bool getForceOutboundProxyOnAllRequestsEnabled() const;
143 virtual void unsetForceOutboundProxyOnAllRequestsEnabled();
144
145 ///If enabled, add a route header for the outbound proxy
146 virtual void setExpressOutboundAsRouteSetEnabled(bool enabled) ;
147 virtual bool getExpressOutboundAsRouteSetEnabled() const;
148 virtual void unsetExpressOutboundAsRouteSetEnabled();
149
150 ///enable/disable rport for requests. rport is enabled by default
151 virtual void setRportEnabled(bool enabled);
152 virtual bool getRportEnabled() const;
153 virtual void unsetRportEnabled();
154
155 ///if set then UserAgent header is added to outbound messages
156 virtual void setUserAgent( const Data& userAgent );
157 virtual const Data& getUserAgent() const;
158 virtual bool hasUserAgent() const;
159 virtual void unsetUserAgent();
160
161 ///if set then ProxyRequires header is added to outbound messages
162 virtual void setProxyRequires( const Tokens& proxyRequires );
163 virtual const Tokens& getProxyRequires() const;
164 virtual bool hasProxyRequires() const;
165 virtual void unsetProxyRequires();
166
167 ///time between CR/LF keepalive messages in seconds. Set to 0 to disable.
168 ///Default is 30 seconds for datagram and 180 seconds for stream.
169 ///Note: You must set a KeepAliveManager on DUM for this to work.
170 virtual void setKeepAliveTimeForDatagram(int keepAliveTime);
171 virtual int getKeepAliveTimeForDatagram() const;
172 virtual void unsetKeepAliveTimeForDatagram();
173 virtual void setKeepAliveTimeForStream(int keepAliveTime);
174 virtual int getKeepAliveTimeForStream() const;
175 virtual void unsetKeepAliveTimeForStream();
176
177 ///If set dum will provide a port in the via for requests sent down to the stack. This
178 ///will tell the transport selector to only look at those transports using this port.
179 ///Default is 0 (Disabled).
180 ///WARNING: Setting this can cause undesirable behaviour in the case when you want
181 /// DNS entries to decided your transport and you are supporting TLS.
182 /// For example: if you add UDP:5060, TCP:5060 and TLS:5061 and setFixedTransportPort
183 /// to 5060 - then the TLS transport cannot be used.
184 virtual void setFixedTransportPort(int fixedTransportPort);
185 virtual int getFixedTransportPort() const;
186 virtual void unsetFixedTransportPort();
187
188 ///If set dum will provide a interface in the via for requests sent down to the stack. This
189 ///will tell the transport selector to only look at those transports using this interface.
190 ///Default is Data::Empty (Disabled).
191 virtual void setFixedTransportInterface(const Data& fixedTransportInterface);
192 virtual const Data& getFixedTransportInterface() const;
193 virtual void unsetFixedTransportInterface();
194
195 ///If enabled then rinstance parameter is added to contacts. The rinstance
196 ///parameter is added by default.
197 virtual void setRinstanceEnabled(bool enabled);
198 virtual bool getRinstanceEnabled() const;
199 virtual void unsetRinstanceEnabled();
200
201 //If set then dum will add this MessageDecorator to all outbound messages
202 virtual void setOutboundDecorator(SharedPtr<MessageDecorator> outboundDecorator);
203 virtual SharedPtr<MessageDecorator> getOutboundDecorator();
204 virtual void unsetOutboundDecorator();
205
206 ///If enabled then methods parameter is added to contacts.
207 virtual void setMethodsParamEnabled(bool enabled) ;
208 virtual bool getMethodsParamEnabled() const;
209 virtual void unsetMethodsParamEnabled();
210
211 private:
212 bool mHasDefaultRegistrationExpires;
213 UInt32 mDefaultRegistrationExpires;
214
215 bool mHasDefaultMaxRegistrationExpires;
216 UInt32 mDefaultMaxRegistrationExpires;
217
218 bool mHasDefaultRegistrationRetryInterval;
219 int mDefaultRegistrationRetryInterval;
220
221 bool mHasDefaultSubscriptionExpires;
222 UInt32 mDefaultSubscriptionExpires;
223
224 bool mHasDefaultPublicationExpires;
225 UInt32 mDefaultPublicationExpires;
226
227 bool mHasDefaultStaleCallTime;
228 int mDefaultStaleCallTime;
229
230 bool mHasDefaultStaleReInviteTime;
231 int mDefaultStaleReInviteTime;
232
233 bool mHasDefaultSessionExpires;
234 UInt32 mDefaultSessionExpires;
235
236 bool mHasDefaultSessionTimerMode;
237 SessionTimerMode mDefaultSessionTimerMode;
238
239 bool mHas1xxRetransmissionTime;
240 int m1xxRetransmissionTime;
241
242 bool mHasOutboundProxy;
243 NameAddr mOutboundProxy;
244
245 bool mHasForceOutboundProxyOnAllRequestsEnabled;
246 bool mForceOutboundProxyOnAllRequestsEnabled;
247
248 bool mHasExpressOutboundAsRouteSetEnabled;
249 bool mExpressOutboundAsRouteSetEnabled;
250
251 bool mHasAdvertisedCapabilities;
252 std::set<Headers::Type> mAdvertisedCapabilities;
253
254 bool mHasRportEnabled;
255 bool mRportEnabled;
256
257 bool mHasUserAgent;
258 Data mUserAgent;
259
260 bool mHasOverrideHostPort;
261 Uri mOverrideHostPort;
262
263 bool mHasKeepAliveTimeForDatagram;
264 int mKeepAliveTimeForDatagram;
265
266 bool mHasKeepAliveTimeForStream;
267 int mKeepAliveTimeForStream;
268
269 bool mHasFixedTransportPort;
270 int mFixedTransportPort;
271
272 bool mHasFixedTransportInterface;
273 Data mFixedTransportInterface;
274
275 bool mHasProxyRequires;
276 Tokens mProxyRequires;
277
278 bool mHasRinstanceEnabled;
279 bool mRinstanceEnabled;
280
281 bool mHasOutboundDecorator;
282 SharedPtr<MessageDecorator> mOutboundDecorator;
283
284 bool mHasMethodsParamEnabled;
285 bool mMethodsParamEnabled;
286
287 SharedPtr<Profile> mBaseProfile; // All non-set settings will fall through to this Profile (if set)
288 };
289
290 }
291
292 #endif
293
294 /* ====================================================================
295 * The Vovida Software License, Version 1.0
296 *
297 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
298 *
299 * Redistribution and use in source and binary forms, with or without
300 * modification, are permitted provided that the following conditions
301 * are met:
302 *
303 * 1. Redistributions of source code must retain the above copyright
304 * notice, this list of conditions and the following disclaimer.
305 *
306 * 2. Redistributions in binary form must reproduce the above copyright
307 * notice, this list of conditions and the following disclaimer in
308 * the documentation and/or other materials provided with the
309 * distribution.
310 *
311 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
312 * and "Vovida Open Communication Application Library (VOCAL)" must
313 * not be used to endorse or promote products derived from this
314 * software without prior written permission. For written
315 * permission, please contact vocal@vovida.org.
316 *
317 * 4. Products derived from this software may not be called "VOCAL", nor
318 * may "VOCAL" appear in their name, without prior written
319 * permission of Vovida Networks, Inc.
320 *
321 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
322 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
323 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
324 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
325 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
326 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
327 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
328 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
329 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
330 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
331 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
332 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
333 * DAMAGE.
334 *
335 * ====================================================================
336 *
337 * This software consists of voluntary contributions made by Vovida
338 * Networks, Inc. and many individuals on behalf of Vovida Networks,
339 * Inc. For more information on Vovida Networks, Inc., please see
340 * <http://www.vovida.org/>.
341 *
342 */

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