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