~ubuntu-branches/ubuntu/saucy/resiprocate/saucy-proposed

« back to all changes in this revision

Viewing changes to resip/dum/Profile.hxx

  • Committer: Package Import Robot
  • Author(s): Daniel Pocock
  • Date: 2012-05-17 19:29:59 UTC
  • Revision ID: package-import@ubuntu.com-20120517192959-vv00m77isztdy64q
Tags: upstream-1.8.2
ImportĀ upstreamĀ versionĀ 1.8.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
      ///If set, the parameters on the provided NameAddr are used in the contact header
 
212
      ///Example: 
 
213
      ///  #include <resip/stack/ExtensionParameter.hxx>
 
214
      ///  static const resip::ExtensionParameter p_automaton("automaton");
 
215
      ///  static const resip::ExtensionParameter p_byeless("+sip.byeless");
 
216
      ///  static const resip::ExtensionParameter p_rendering("+sip.rendering");
 
217
      ///  ...
 
218
      ///  NameAddr capabilities;
 
219
      ///  capabilities.param(p_automaton); 
 
220
      ///  capabilities.param(p_byeless);
 
221
      ///  capabilities.param(p_rendering) = "\"no\"";
 
222
      ///  profile->setUserAgentCapabilities(capabilities);
 
223
      virtual void setUserAgentCapabilities(const NameAddr& capabilities) ;
 
224
      virtual bool hasUserAgentCapabilities() const;
 
225
      virtual const NameAddr& getUserAgentCapabilities() const;
 
226
      virtual void unsetUserAgentCapabilities();
 
227
 
 
228
      ///If enabled then dialog identifying headers are added to SipFrag bodies 
 
229
      ///that are generated in an InviteSession
 
230
      virtual void setExtraHeadersInReferNotifySipFragEnabled(bool enabled) ;
 
231
      virtual bool getExtraHeadersInReferNotifySipFragEnabled() const;
 
232
      virtual void unsetExtraHeadersInReferNotifySipFragEnabled();
 
233
 
 
234
   private:
 
235
      bool mHasDefaultRegistrationExpires;
 
236
      UInt32 mDefaultRegistrationExpires;
 
237
      
 
238
      bool mHasDefaultMaxRegistrationExpires;
 
239
      UInt32 mDefaultMaxRegistrationExpires;
 
240
 
 
241
      bool mHasDefaultRegistrationRetryInterval;
 
242
      int  mDefaultRegistrationRetryInterval;
 
243
 
 
244
      bool mHasDefaultSubscriptionExpires;
 
245
      UInt32 mDefaultSubscriptionExpires;
 
246
 
 
247
      bool mHasDefaultPublicationExpires;
 
248
      UInt32 mDefaultPublicationExpires;
 
249
 
 
250
      bool mHasDefaultStaleCallTime;
 
251
      int mDefaultStaleCallTime;
 
252
 
 
253
      bool mHasDefaultStaleReInviteTime;
 
254
      int mDefaultStaleReInviteTime;
 
255
 
 
256
      bool mHasDefaultSessionExpires;
 
257
      UInt32 mDefaultSessionExpires;
 
258
 
 
259
      bool mHasDefaultSessionTimerMode;
 
260
      SessionTimerMode mDefaultSessionTimerMode;
 
261
 
 
262
      bool mHas1xxRetransmissionTime;
 
263
      int m1xxRetransmissionTime;
 
264
 
 
265
      bool mHasOutboundProxy;
 
266
      NameAddr mOutboundProxy;
 
267
      
 
268
      bool mHasForceOutboundProxyOnAllRequestsEnabled;
 
269
      bool mForceOutboundProxyOnAllRequestsEnabled;
 
270
 
 
271
      bool mHasExpressOutboundAsRouteSetEnabled;
 
272
      bool mExpressOutboundAsRouteSetEnabled;
 
273
 
 
274
      bool mHasAdvertisedCapabilities;
 
275
      std::set<Headers::Type> mAdvertisedCapabilities;
 
276
      
 
277
      bool mHasRportEnabled;
 
278
      bool mRportEnabled;
 
279
      
 
280
      bool mHasUserAgent;            
 
281
      Data mUserAgent;
 
282
      
 
283
      bool mHasOverrideHostPort;
 
284
      Uri  mOverrideHostPort;
 
285
      
 
286
      bool mHasKeepAliveTimeForDatagram;
 
287
      int  mKeepAliveTimeForDatagram;
 
288
 
 
289
      bool mHasKeepAliveTimeForStream;
 
290
      int  mKeepAliveTimeForStream;
 
291
 
 
292
      bool mHasFixedTransportPort;
 
293
      int  mFixedTransportPort;
 
294
      
 
295
      bool mHasFixedTransportInterface;
 
296
      Data mFixedTransportInterface;
 
297
 
 
298
      bool mHasProxyRequires;
 
299
      Tokens mProxyRequires;
 
300
 
 
301
      bool mHasRinstanceEnabled;
 
302
      bool mRinstanceEnabled;
 
303
      
 
304
      bool mHasOutboundDecorator;
 
305
      SharedPtr<MessageDecorator> mOutboundDecorator;
 
306
      
 
307
      bool mHasMethodsParamEnabled;
 
308
      bool mMethodsParamEnabled;
 
309
 
 
310
      bool mHasUserAgentCapabilities;
 
311
      NameAddr mUserAgentCapabilities;
 
312
 
 
313
      bool mHasExtraHeadersInReferNotifySipFragEnabled;
 
314
      bool mExtraHeadersInReferNotifySipFragEnabled;
 
315
 
 
316
      SharedPtr<Profile> mBaseProfile;  // All non-set settings will fall through to this Profile (if set)
 
317
};
 
318
 
 
319
}
 
320
 
 
321
#endif
 
322
 
 
323
/* ====================================================================
 
324
 * The Vovida Software License, Version 1.0 
 
325
 * 
 
326
 * Copyright (c) 2000 Vovida Networks, Inc.  All rights reserved.
 
327
 * 
 
328
 * Redistribution and use in source and binary forms, with or without
 
329
 * modification, are permitted provided that the following conditions
 
330
 * are met:
 
331
 * 
 
332
 * 1. Redistributions of source code must retain the above copyright
 
333
 *    notice, this list of conditions and the following disclaimer.
 
334
 * 
 
335
 * 2. Redistributions in binary form must reproduce the above copyright
 
336
 *    notice, this list of conditions and the following disclaimer in
 
337
 *    the documentation and/or other materials provided with the
 
338
 *    distribution.
 
339
 * 
 
340
 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
 
341
 *    and "Vovida Open Communication Application Library (VOCAL)" must
 
342
 *    not be used to endorse or promote products derived from this
 
343
 *    software without prior written permission. For written
 
344
 *    permission, please contact vocal@vovida.org.
 
345
 *
 
346
 * 4. Products derived from this software may not be called "VOCAL", nor
 
347
 *    may "VOCAL" appear in their name, without prior written
 
348
 *    permission of Vovida Networks, Inc.
 
349
 * 
 
350
 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
 
351
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 
352
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
 
353
 * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA
 
354
 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
 
355
 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
 
356
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 
357
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 
358
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 
359
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 
360
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
 
361
 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
 
362
 * DAMAGE.
 
363
 * 
 
364
 * ====================================================================
 
365
 * 
 
366
 * This software consists of voluntary contributions made by Vovida
 
367
 * Networks, Inc. and many individuals on behalf of Vovida Networks,
 
368
 * Inc.  For more information on Vovida Networks, Inc., please see
 
369
 * <http://www.vovida.org/>.
 
370
 *
 
371
 */