reSIProcate/stack  9694
InteropHelper.hxx
Go to the documentation of this file.
00001 #ifndef INTEROP_HELPER_HXX
00002 #define INTEROP_HELPER_HXX
00003 
00004 namespace resip
00005 {
00006 
00012 class InteropHelper
00013 {
00014    public:
00015       static int getOutboundVersion() {return theOutboundVersion;}
00016       static void setOutboundVersion(int version) {theOutboundVersion=version;}
00017       static bool getOutboundSupported() {return isOutboundSupported;}
00018       static void setOutboundSupported(bool supported) {isOutboundSupported=supported;}
00019 
00020       // If this value is set, then DUM/repro will populate a Flow-Timer header in a 
00021       // successful registration reponse
00022       static unsigned int getFlowTimerSeconds() {return flowTimerSeconds;}
00023       static void setFlowTimerSeconds(unsigned int seconds) {flowTimerSeconds=seconds;}
00024 
00025       // Only relevant if setFlowTimerSeconds is set to value greater than 0.
00026       // Specifies the amount of time beyond the FlowTimer time, before the stack
00027       // will consider any Flow-Timer based connection to be in a bad state.  This
00028       // is used by the ConnectionManager garbage collection logic to cleanup
00029       // flow-timer based connections for which we are no-longer receiving keepalives.
00030       static unsigned int getFlowTimerGracePeriodSeconds() {return flowTimerGracePeriodSeconds;}
00031       static void setFlowTimerGracePeriodSeconds(unsigned int seconds) {flowTimerGracePeriodSeconds=seconds;}
00032       
00033       // .bwc. If this is enabled, we will record-route with flow tokens 
00034       // whenever possible. This will make things work with endpoints that don't
00035       // use NAT traversal tricks. However, this will break several things:
00036       // 1) Target-refreshes won't work.
00037       // 2) Proxies that do not record-route may be implicitly included in the
00038       //    route-set by this proxy, because a flow token may point to them.
00039       // 3) Third-party registrations won't work.
00040       static bool getRRTokenHackEnabled(){return useRRTokenHack;}
00041       static void setRRTokenHackEnabled(bool enabled) {useRRTokenHack=enabled;}
00042       
00043       enum ClientNATDetectionMode
00044       {
00045          ClientNATDetectionDisabled,
00046          ClientNATDetectionEnabled,
00047          ClientNATDetectionPrivateToPublicOnly
00048       };
00049 
00050       // If this is enabled, and we have clients not explicitly supporting outbound
00051       // that we detect to be behind a NAT device, we will record-route with flow tokens 
00052       // whenever possible. However, this will break several things:
00053       // 1) Target-refreshes won't work.
00054       // 2) Proxies that do not record-route may be implicitly included in the
00055       //    route-set by this proxy, because a flow token may point to them.
00056       // 3) Third-party registrations won't work.
00057       static InteropHelper::ClientNATDetectionMode getClientNATDetectionMode(){return clientNATDetection;}
00058       static void setClientNATDetectionMode(InteropHelper::ClientNATDetectionMode mode) {clientNATDetection=mode;}
00059 
00060       // There are cases where the first hop in a particular network supports the concept of outbound
00061       // and ensures all messaging for a client is delivered over the same connection used for
00062       // registration.  This could be a SBC or other NAT traversal aid router that uses the Path 
00063       // header.  However such endpoints may not be 100% compliant with outbound RFC and may not 
00064       // include a ;ob parameter in the path header.  This parameter is required in order for repro
00065       // to have knowledge that the first hop does support outbound, and it will reject registrations
00066       // that appear to be using outboud (ie. instanceId and regId) with a 439 (First Hop Lacks Outbound
00067       // Support).  In this case it can be desirable when using repro as the registrar to not reject
00068       // REGISTRATION requests that contain an instanceId and regId with a 439.
00069       // If this setting is enabled, then repro will assume the first hop supports outbound 
00070       // and not return this error.
00071       static bool getAssumeFirstHopSupportsOutboundEnabled(){return assumeFirstHopSupportsOutbound;}
00072       static void setAssumeFirstHopSupportsOutboundEnabled(bool enabled) {assumeFirstHopSupportsOutbound=enabled;}
00073 
00074    private:
00075       InteropHelper();
00076       ~InteropHelper();
00077       
00078       static int theOutboundVersion;
00079       static bool isOutboundSupported;
00080       static unsigned int flowTimerSeconds;
00081       static unsigned int flowTimerGracePeriodSeconds;
00082       static bool useRRTokenHack;
00083       static ClientNATDetectionMode clientNATDetection;
00084       static bool assumeFirstHopSupportsOutbound;
00085 };
00086 }
00087 
00088 #endif
00089 
00090 /* ====================================================================
00091  * The Vovida Software License, Version 1.0 
00092  * 
00093  * Copyright (c) 2000
00094  * 
00095  * Redistribution and use in source and binary forms, with or without
00096  * modification, are permitted provided that the following conditions
00097  * are met:
00098  * 
00099  * 1. Redistributions of source code must retain the above copyright
00100  *    notice, this list of conditions and the following disclaimer.
00101  * 
00102  * 2. Redistributions in binary form must reproduce the above copyright
00103  *    notice, this list of conditions and the following disclaimer in
00104  *    the documentation and/or other materials provided with the
00105  *    distribution.
00106  * 
00107  * 3. The names "VOCAL", "Vovida Open Communication Application Library",
00108  *    and "Vovida Open Communication Application Library (VOCAL)" must
00109  *    not be used to endorse or promote products derived from this
00110  *    software without prior written permission. For written
00111  *    permission, please contact vocal@vovida.org.
00112  *
00113  * 4. Products derived from this software may not be called "VOCAL", nor
00114  *    may "VOCAL" appear in their name, without prior written
00115  *    permission of Vovida Networks, Inc.
00116  * 
00117  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
00118  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00119  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
00120  * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA
00121  * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
00122  * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
00123  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00124  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00125  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00126  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00127  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00128  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
00129  * DAMAGE.
00130  * 
00131  * ====================================================================
00132  * 
00133  * This software consists of voluntary contributions made by Vovida
00134  * Networks, Inc. and many individuals on behalf of Vovida Networks,
00135  * Inc.  For more information on Vovida Networks, Inc., please see
00136  * <http://www.vovida.org/>.
00137  *
00138  */
00139