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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6173 - (show annotations) (download)
Fri Apr 21 20:05:12 2006 UTC (13 years, 7 months ago) by cisco
File MIME type: text/plain
File size: 14164 byte(s)
Added support for the methods parameter in the register message
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(int secs);
41 virtual int 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(int secs);
47 virtual int 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(int secs);
59 virtual int 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(int secs);
64 virtual int 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 /// Only used if timer option tag is set in MasterProfile.
73 /// Note: Value must be higher than 90 (as specified in RFC 4028)
74 virtual void setDefaultSessionTime(int secs);
75 virtual int getDefaultSessionTime() const;
76 virtual void unsetDefaultSessionTime();
77
78 /// Only used if timer option tag is set in MasterProfile.
79 /// Set to PreferLocalRefreshes if you prefer that the local UA performs the refreshes.
80 /// Set to PreferRemoteRefreshes if you prefer that the remote UA peforms the refreshes.
81 /// Set to PreferUACRefreshes if you prefer that the UAC (for the session - caller) performs the refreshes.
82 /// Set to PreferUASRefreshes if you prefer that the UAS (for the session - callee) performs the refreshes.
83 /// Note: determining the refresher is a negotiation, so despite this setting the remote
84 /// end may end up enforcing their preference. Also if the remote end doesn't support
85 /// SessionTimers then the refresher will always be local.
86 /// This implementation follows the RECOMMENDED practices from section 7.1 of the draft
87 /// and does not specify a refresher parameter as in UAC requests.
88 typedef enum
89 {
90 PreferLocalRefreshes,
91 PreferRemoteRefreshes,
92 PreferUACRefreshes,
93 PreferUASRefreshes
94 } SessionTimerMode;
95 virtual void setDefaultSessionTimerMode(Profile::SessionTimerMode mode);
96 virtual Profile::SessionTimerMode getDefaultSessionTimerMode() const;
97 virtual void unsetDefaultSessionTimerMode();
98
99 /// The amount of time that can pass before dum will resubmit an unreliable provisional response
100 virtual void set1xxRetransmissionTime(int secs);
101 virtual int get1xxRetransmissionTime() const;
102 virtual void unset1xxRetransmissionTime();
103
104 ///overrides the value used to populate the contact
105 ///?dcm? -- also change via entries? Also, dum currently uses(as a uas)
106 ///the request uri of the dialog constructing request for the local contact
107 ///within that dialog. A transport paramter here could also be used to
108 ///force tcp vs udp vs tls?
109 virtual void setOverrideHostAndPort(const Uri& hostPort);
110 virtual bool hasOverrideHostAndPort() const;
111 virtual const Uri& getOverrideHostAndPort() const;
112 virtual void unsetOverrideHostAndPort();
113
114 ///enable/disable sending of Allow/Supported/Accept-Language/Accept-Encoding headers
115 ///on initial outbound requests (ie. Initial INVITE, REGISTER, etc.) and Invite 200 responses
116 ///Note: Default is to advertise Headers::Allow and Headers::Supported, use clearAdvertisedCapabilities to remove these
117 /// Currently implemented header values are: Headers::Allow,
118 /// Headers::AcceptEncoding, Headers::AcceptLanguage, Headers::Supported
119 virtual void addAdvertisedCapability(const Headers::Type header);
120 virtual bool isAdvertisedCapability(const Headers::Type header) const;
121 virtual void clearAdvertisedCapabilities();
122 virtual void unsetAdvertisedCapabilities();
123
124 /// Use to route all outbound requests through a particular proxy
125 virtual void setOutboundProxy( const Uri& uri );
126 virtual const NameAddr& getOutboundProxy() const;
127 virtual bool hasOutboundProxy() const;
128 virtual void unsetOutboundProxy();
129
130 ///enable/disable rport for requests. rport is enabled by default
131 virtual void setRportEnabled(bool enabled);
132 virtual bool getRportEnabled() const;
133 virtual void unsetRportEnabled();
134
135 ///if set then UserAgent header is added to outbound messages
136 virtual void setUserAgent( const Data& userAgent );
137 virtual const Data& getUserAgent() const;
138 virtual bool hasUserAgent() const;
139 virtual void unsetUserAgent();
140
141 ///if set then ProxyRequires header is added to outbound messages
142 virtual void setProxyRequires( const Tokens& proxyRequires );
143 virtual const Tokens& getProxyRequires() const;
144 virtual bool hasProxyRequires() const;
145 virtual void unsetProxyRequires();
146
147 ///time between CR/LF keepalive messages in seconds. Set to 0 to disable.
148 ///Default is 30 seconds for datagram and 180 seconds for stream.
149 ///Note: You must set a KeepAliveManager on DUM for this to work.
150 virtual void setKeepAliveTimeForDatagram(int keepAliveTime);
151 virtual int getKeepAliveTimeForDatagram() const;
152 virtual void unsetKeepAliveTimeForDatagram();
153 virtual void setKeepAliveTimeForStream(int keepAliveTime);
154 virtual int getKeepAliveTimeForStream() const;
155 virtual void unsetKeepAliveTimeForStream();
156
157 ///If set dum will provide a port in the via for requests sent down to the stack. This
158 ///will tell the transport selector to only look at those transports using this port.
159 ///Default is 0 (Disabled).
160 ///WARNING: Setting this can cause undesirable behaviour in the case when you want
161 /// DNS entries to decided your transport and you are supporting TLS.
162 /// For example: if you add UDP:5060, TCP:5060 and TLS:5061 and setFixedTransportPort
163 /// to 5060 - then the TLS transport cannot be used.
164 virtual void setFixedTransportPort(int fixedTransportPort);
165 virtual int getFixedTransportPort() const;
166 virtual void unsetFixedTransportPort();
167
168 ///If set dum will provide a interface in the via for requests sent down to the stack. This
169 ///will tell the transport selector to only look at those transports using this interface.
170 ///Default is Data::Empty (Disabled).
171 virtual void setFixedTransportInterface(const Data& fixedTransportInterface);
172 virtual const Data& getFixedTransportInterface() const;
173 virtual void unsetFixedTransportInterface();
174
175 ///If enabled then rinstance parameter is added to contacts. The rinstance
176 ///parameter is added by default.
177 virtual void setRinstanceEnabled(bool enabled);
178 virtual bool getRinstanceEnabled() const;
179 virtual void unsetRinstanceEnabled();
180
181 //If set then dum will add this MessageDecorator to all outbound messages
182 virtual void setOutboundDecorator(SharedPtr<MessageDecorator> outboundDecorator);
183 virtual SharedPtr<MessageDecorator> getOutboundDecorator();
184 virtual void unsetOutboundDecorator();
185
186 ///If enabled then methods parameter is added to contacts.
187 virtual void setMethodsParamEnabled(bool enabled) ;
188 virtual bool getMethodsParamEnabled() const;
189 virtual void unsetMethodsParamEnabled();
190
191 private:
192 bool mHasDefaultRegistrationExpires;
193 int mDefaultRegistrationExpires;
194
195 bool mHasDefaultMaxRegistrationExpires;
196 int mDefaultMaxRegistrationExpires;
197
198 bool mHasDefaultRegistrationRetryInterval;
199 int mDefaultRegistrationRetryInterval;
200
201 bool mHasDefaultSubscriptionExpires;
202 int mDefaultSubscriptionExpires;
203
204 bool mHasDefaultPublicationExpires;
205 int mDefaultPublicationExpires;
206
207 bool mHasDefaultStaleCallTime;
208 int mDefaultStaleCallTime;
209
210 bool mHasDefaultSessionExpires;
211 int mDefaultSessionExpires;
212
213 bool mHasDefaultSessionTimerMode;
214 SessionTimerMode mDefaultSessionTimerMode;
215
216 bool mHas1xxRetransmissionTime;
217 int m1xxRetransmissionTime;
218
219 bool mHasOutboundProxy;
220 NameAddr mOutboundProxy;
221
222 bool mHasAdvertisedCapabilities;
223 std::set<Headers::Type> mAdvertisedCapabilities;
224
225 bool mHasRportEnabled;
226 bool mRportEnabled;
227
228 bool mHasUserAgent;
229 Data mUserAgent;
230
231 bool mHasOverrideHostPort;
232 Uri mOverrideHostPort;
233
234 bool mHasKeepAliveTimeForDatagram;
235 int mKeepAliveTimeForDatagram;
236
237 bool mHasKeepAliveTimeForStream;
238 int mKeepAliveTimeForStream;
239
240 bool mHasFixedTransportPort;
241 int mFixedTransportPort;
242
243 bool mHasFixedTransportInterface;
244 Data mFixedTransportInterface;
245
246 bool mHasProxyRequires;
247 Tokens mProxyRequires;
248
249 bool mHasRinstanceEnabled;
250 bool mRinstanceEnabled;
251
252 bool mHasOutboundDecorator;
253 SharedPtr<MessageDecorator> mOutboundDecorator;
254
255 bool mHasMethodsParamEnabled;
256 bool mMethodsParamEnabled;
257
258 SharedPtr<Profile> mBaseProfile; // All non-set settings will fall through to this Profile (if set)
259 };
260
261 }
262
263 #endif
264
265 /* ====================================================================
266 * The Vovida Software License, Version 1.0
267 *
268 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
269 *
270 * Redistribution and use in source and binary forms, with or without
271 * modification, are permitted provided that the following conditions
272 * are met:
273 *
274 * 1. Redistributions of source code must retain the above copyright
275 * notice, this list of conditions and the following disclaimer.
276 *
277 * 2. Redistributions in binary form must reproduce the above copyright
278 * notice, this list of conditions and the following disclaimer in
279 * the documentation and/or other materials provided with the
280 * distribution.
281 *
282 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
283 * and "Vovida Open Communication Application Library (VOCAL)" must
284 * not be used to endorse or promote products derived from this
285 * software without prior written permission. For written
286 * permission, please contact vocal@vovida.org.
287 *
288 * 4. Products derived from this software may not be called "VOCAL", nor
289 * may "VOCAL" appear in their name, without prior written
290 * permission of Vovida Networks, Inc.
291 *
292 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
293 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
294 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
295 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
296 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
297 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
298 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
299 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
300 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
301 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
302 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
303 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
304 * DAMAGE.
305 *
306 * ====================================================================
307 *
308 * This software consists of voluntary contributions made by Vovida
309 * Networks, Inc. and many individuals on behalf of Vovida Networks,
310 * Inc. For more information on Vovida Networks, Inc., please see
311 * <http://www.vovida.org/>.
312 *
313 */

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