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