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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6159 - (hide annotations) (download)
Tue Apr 18 19:51:36 2006 UTC (13 years, 7 months ago) by moetje
File MIME type: text/plain
File size: 13866 byte(s)
Added the ability to dum to specify a MessageDecorator object in a profile that is automatically added by dum to each outgoing messsage (addOutboundDecorator). This is required to be able to change the via headers because the message decorator is executed after transport selection.
1 jason 3613 #if !defined(RESIP_PROFILE_HXX)
2     #define RESIP_PROFILE_HXX
3    
4     #include <iosfwd>
5     #include <set>
6 derek 5283 #include "resip/stack/Headers.hxx"
7     #include "resip/stack/MethodTypes.hxx"
8 jason 5276 #include "rutil/SharedPtr.hxx"
9 moetje 6159 #include "resip/stack/messagedecorator.hxx"
10 jason 3613
11     namespace resip
12     {
13    
14     class Data;
15    
16     class Profile
17     {
18 jason 4010 public:
19 sgodin 4778 Profile(); // Default to no base profile
20     Profile(SharedPtr<Profile> baseProfile);
21 jason 4010 virtual ~Profile();
22 jason 3613
23 sgodin 5840 /// 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 sgodin 5640 /// 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 sgodin 5840 /// 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 sgodin 4618
39 sgodin 5640 /// This default is used if no value is passed in when creating a registration
40 jason 4010 virtual void setDefaultRegistrationTime(int secs);
41     virtual int getDefaultRegistrationTime() const;
42 sgodin 4618 virtual void unsetDefaultRegistrationTime();
43 jason 3613
44 sgodin 5640 /// 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 jason 4010 virtual void setDefaultMaxRegistrationTime(int secs);
47     virtual int getDefaultMaxRegistrationTime() const;
48 sgodin 4618 virtual void unsetDefaultMaxRegistrationTime();
49 jason 3613
50 sgodin 5640 /// 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 jason 4010 virtual void setDefaultRegistrationRetryTime(int secs);
54     virtual int getDefaultRegistrationRetryTime() const;
55 sgodin 4618 virtual void unsetDefaultRegistrationRetryTime();
56 jason 3613
57 sgodin 5640 /// This default is used if no value is passed in when creating a subscription
58 jason 4010 virtual void setDefaultSubscriptionTime(int secs);
59     virtual int getDefaultSubscriptionTime() const;
60 sgodin 4618 virtual void unsetDefaultSubscriptionTime();
61 jason 3613
62 sgodin 5640 /// This default is used if no value is passed in when creating a publication
63 jason 4010 virtual void setDefaultPublicationTime(int secs);
64     virtual int getDefaultPublicationTime() const;
65 sgodin 4618 virtual void unsetDefaultPublicationTime();
66 jason 4010
67 jason 3613 /// Call is stale if UAC gets no final response within the stale call timeout (default 3 minutes)
68 jason 4010 virtual void setDefaultStaleCallTime(int secs);
69     virtual int getDefaultStaleCallTime() const;
70 sgodin 4618 virtual void unsetDefaultStaleCallTime();
71 jason 3613
72 sgodin 5640 /// Only used if timer option tag is set in MasterProfile.
73     /// Note: Value must be higher than 90 (as specified in RFC 4028)
74 jason 4010 virtual void setDefaultSessionTime(int secs);
75     virtual int getDefaultSessionTime() const;
76 sgodin 4618 virtual void unsetDefaultSessionTime();
77 jason 4010
78 sgodin 5640 /// 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 jason 4010 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 sgodin 4618 virtual void unsetDefaultSessionTimerMode();
98 jason 4010
99 sgodin 5640 /// The amount of time that can pass before dum will resubmit an unreliable provisional response
100 jason 4010 virtual void set1xxRetransmissionTime(int secs);
101     virtual int get1xxRetransmissionTime() const;
102 sgodin 4618 virtual void unset1xxRetransmissionTime();
103 jason 4010
104 sgodin 5640 ///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 jason 4010 virtual void setOverrideHostAndPort(const Uri& hostPort);
110     virtual bool hasOverrideHostAndPort() const;
111     virtual const Uri& getOverrideHostAndPort() const;
112 sgodin 4618 virtual void unsetOverrideHostAndPort();
113 jason 3613
114 sgodin 5640 ///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 jason 4335 virtual void addAdvertisedCapability(const Headers::Type header);
120 jason 4010 virtual bool isAdvertisedCapability(const Headers::Type header) const;
121 sgodin 4618 virtual void clearAdvertisedCapabilities();
122     virtual void unsetAdvertisedCapabilities();
123 jason 4335
124 sgodin 5640 /// Use to route all outbound requests through a particular proxy
125 jason 4010 virtual void setOutboundProxy( const Uri& uri );
126     virtual const NameAddr& getOutboundProxy() const;
127     virtual bool hasOutboundProxy() const;
128 sgodin 4618 virtual void unsetOutboundProxy();
129 jason 3613
130 sgodin 5640 ///enable/disable rport for requests. rport is enabled by default
131 jason 4010 virtual void setRportEnabled(bool enabled);
132     virtual bool getRportEnabled() const;
133 sgodin 4618 virtual void unsetRportEnabled();
134 jason 3613
135 sgodin 5640 ///if set then UserAgent header is added to outbound messages
136 jason 4010 virtual void setUserAgent( const Data& userAgent );
137     virtual const Data& getUserAgent() const;
138     virtual bool hasUserAgent() const;
139 sgodin 4618 virtual void unsetUserAgent();
140 jason 3613
141 sgodin 5640 ///if set then ProxyRequires header is added to outbound messages
142 derek 5540 virtual void setProxyRequires( const Tokens& proxyRequires );
143     virtual const Tokens& getProxyRequires() const;
144     virtual bool hasProxyRequires() const;
145     virtual void unsetProxyRequires();
146    
147 sgodin 5640 ///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 daniel 5599 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 sgodin 4113
157 sgodin 5640 ///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 sgodin 4512 virtual void setFixedTransportPort(int fixedTransportPort);
165     virtual int getFixedTransportPort() const;
166 sgodin 4618 virtual void unsetFixedTransportPort();
167 sgodin 4512
168 sgodin 5640 ///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 sgodin 5607 virtual void setFixedTransportInterface(const Data& fixedTransportInterface);
172 derek 5606 virtual const Data& getFixedTransportInterface() const;
173     virtual void unsetFixedTransportInterface();
174    
175 sgodin 5840 ///If enabled then rinstance parameter is added to contacts. The rinstance
176 daniel 5837 ///parameter is added by default.
177     virtual void setRinstanceEnabled(bool enabled);
178     virtual bool getRinstanceEnabled() const;
179     virtual void unsetRinstanceEnabled();
180    
181 moetje 6159 //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 jason 4010 private:
187 jason 4335 bool mHasDefaultRegistrationExpires;
188 jason 4010 int mDefaultRegistrationExpires;
189 jason 4335
190 jason 4010 bool mHasDefaultMaxRegistrationExpires;
191     int mDefaultMaxRegistrationExpires;
192 jason 3613
193 jason 4010 bool mHasDefaultRegistrationRetryInterval;
194     int mDefaultRegistrationRetryInterval;
195 jason 3613
196 jason 4010 bool mHasDefaultSubscriptionExpires;
197     int mDefaultSubscriptionExpires;
198 jason 3613
199 jason 4010 bool mHasDefaultPublicationExpires;
200     int mDefaultPublicationExpires;
201 jason 3613
202 jason 4010 bool mHasDefaultStaleCallTime;
203     int mDefaultStaleCallTime;
204 jason 3613
205 jason 4010 bool mHasDefaultSessionExpires;
206 jason 3613 int mDefaultSessionExpires;
207    
208 jason 4010 bool mHasDefaultSessionTimerMode;
209     SessionTimerMode mDefaultSessionTimerMode;
210    
211     bool mHas1xxRetransmissionTime;
212     int m1xxRetransmissionTime;
213    
214 jason 3613 bool mHasOutboundProxy;
215     NameAddr mOutboundProxy;
216 jason 4335
217     bool mHasAdvertisedCapabilities;
218     std::set<Headers::Type> mAdvertisedCapabilities;
219    
220     bool mHasRportEnabled;
221 jason 4010 bool mRportEnabled;
222 jason 4335
223 jason 4010 bool mHasUserAgent;
224 jason 3613 Data mUserAgent;
225 jason 4335
226 jason 4010 bool mHasOverrideHostPort;
227 jason 3613 Uri mOverrideHostPort;
228 jason 4335
229 daniel 5599 bool mHasKeepAliveTimeForDatagram;
230     int mKeepAliveTimeForDatagram;
231 sgodin 4512
232 daniel 5599 bool mHasKeepAliveTimeForStream;
233     int mKeepAliveTimeForStream;
234    
235 sgodin 4512 bool mHasFixedTransportPort;
236     int mFixedTransportPort;
237 derek 5606
238     bool mHasFixedTransportInterface;
239     Data mFixedTransportInterface;
240 derek 5540
241     bool mHasProxyRequires;
242     Tokens mProxyRequires;
243 daniel 5837
244     bool mHasRinstanceEnabled;
245     bool mRinstanceEnabled;
246 jason 4335
247 moetje 6159 bool mHasOutboundDecorator;
248     SharedPtr<MessageDecorator> mOutboundDecorator;
249    
250 sgodin 4778 SharedPtr<Profile> mBaseProfile; // All non-set settings will fall through to this Profile (if set)
251 jason 3613 };
252 jason 4010
253 jason 3613 }
254    
255     #endif
256 jason 4010
257     /* ====================================================================
258     * The Vovida Software License, Version 1.0
259     *
260     * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
261     *
262     * Redistribution and use in source and binary forms, with or without
263     * modification, are permitted provided that the following conditions
264     * are met:
265     *
266     * 1. Redistributions of source code must retain the above copyright
267     * notice, this list of conditions and the following disclaimer.
268     *
269     * 2. Redistributions in binary form must reproduce the above copyright
270     * notice, this list of conditions and the following disclaimer in
271     * the documentation and/or other materials provided with the
272     * distribution.
273     *
274     * 3. The names "VOCAL", "Vovida Open Communication Application Library",
275     * and "Vovida Open Communication Application Library (VOCAL)" must
276     * not be used to endorse or promote products derived from this
277     * software without prior written permission. For written
278     * permission, please contact vocal@vovida.org.
279     *
280     * 4. Products derived from this software may not be called "VOCAL", nor
281     * may "VOCAL" appear in their name, without prior written
282     * permission of Vovida Networks, Inc.
283     *
284     * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
285     * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
286     * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
287     * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
288     * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
289     * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
290     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
291     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
292     * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
293     * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
294     * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
295     * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
296     * DAMAGE.
297     *
298     * ====================================================================
299     *
300     * This software consists of voluntary contributions made by Vovida
301     * Networks, Inc. and many individuals on behalf of Vovida Networks,
302     * Inc. For more information on Vovida Networks, Inc., please see
303     * <http://www.vovida.org/>.
304     *
305     */

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