Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-03-13 09:31:03

0001 //------------------------------------------------------------------------------
0002 // Copyright (c) 2011-2012 by European Organization for Nuclear Research (CERN)
0003 // Author: Lukasz Janyst <ljanyst@cern.ch>
0004 //------------------------------------------------------------------------------
0005 // XRootD is free software: you can redistribute it and/or modify
0006 // it under the terms of the GNU Lesser General Public License as published by
0007 // the Free Software Foundation, either version 3 of the License, or
0008 // (at your option) any later version.
0009 //
0010 // XRootD is distributed in the hope that it will be useful,
0011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
0012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0013 // GNU General Public License for more details.
0014 //
0015 // You should have received a copy of the GNU Lesser General Public License
0016 // along with XRootD.  If not, see <http://www.gnu.org/licenses/>.
0017 //------------------------------------------------------------------------------
0018 
0019 #ifndef __XRD_CL_CONSTANTS_HH__
0020 #define __XRD_CL_CONSTANTS_HH__
0021 
0022 #include <cstdint>
0023 #include <unordered_map>
0024 #include <string>
0025 #include <algorithm>
0026 
0027 namespace XrdCl
0028 {
0029   //----------------------------------------------------------------------------
0030   // Log message types
0031   //----------------------------------------------------------------------------
0032   const uint64_t AppMsg             = 0x0000000000000001ULL;
0033   const uint64_t UtilityMsg         = 0x0000000000000002ULL;
0034   const uint64_t FileMsg            = 0x0000000000000004ULL;
0035   const uint64_t PollerMsg          = 0x0000000000000008ULL;
0036   const uint64_t PostMasterMsg      = 0x0000000000000010ULL;
0037   const uint64_t XRootDTransportMsg = 0x0000000000000020ULL;
0038   const uint64_t TaskMgrMsg         = 0x0000000000000040ULL;
0039   const uint64_t XRootDMsg          = 0x0000000000000080ULL;
0040   const uint64_t FileSystemMsg      = 0x0000000000000100ULL;
0041   const uint64_t AsyncSockMsg       = 0x0000000000000200ULL;
0042   const uint64_t JobMgrMsg          = 0x0000000000000400ULL;
0043   const uint64_t PlugInMgrMsg       = 0x0000000000000800ULL;
0044   const uint64_t ExDbgMsg           = 0x0000000000001000ULL; //special type debugging extra-hard problems
0045   const uint64_t TlsMsg             = 0x0000000000002000ULL;
0046   const uint64_t ZipMsg             = 0x0000000000004000ULL;
0047 
0048   //----------------------------------------------------------------------------
0049   // Environment settings
0050   //----------------------------------------------------------------------------
0051   const int DefaultSubStreamsPerChannel    = 1;
0052   const int DefaultConnectionWindow        = 120;
0053   const int DefaultConnectionRetry         = 5;
0054   const int DefaultRequestTimeout          = 1800;
0055   const int DefaultStreamTimeout           = 60;
0056   const int DefaultTimeoutResolution       = 15;
0057   const int DefaultStreamErrorWindow       = 1800;
0058   const int DefaultRunForkHandler          = 1;
0059   const int DefaultRedirectLimit           = 16;
0060   const int DefaultWorkerThreads           = 3;
0061   const int DefaultCPChunkSize             = 8388608;
0062   const int DefaultCPParallelChunks        = 4;
0063   const int DefaultDataServerTTL           = 300;
0064   const int DefaultLoadBalancerTTL         = 1200;
0065   const int DefaultCPInitTimeout           = 600;
0066   const int DefaultCPTPCTimeout            = 1800;
0067   const int DefaultCPTimeout               = 0;
0068   const int DefaultTCPKeepAlive            = 0;
0069   const int DefaultTCPKeepAliveTime        = 7200;
0070   const int DefaultTCPKeepAliveInterval    = 75;
0071   const int DefaultTCPKeepAliveProbes      = 9;
0072   const int DefaultMultiProtocol           = 0;
0073   const int DefaultParallelEvtLoop         = 10;
0074   const int DefaultMetalinkProcessing      = 1;
0075   const int DefaultLocalMetalinkFile       = 0;
0076   const int DefaultXRateThreshold          = 0;
0077   const int DefaultXCpBlockSize            = 134217728; // DefaultCPChunkSize * DefaultCPParallelChunks * 2
0078 #ifdef __APPLE__
0079   // we don't have corking on osx so we cannot turn of nagle
0080   const int DefaultNoDelay                 = 0;
0081 #else
0082   const int DefaultNoDelay                 = 1;
0083 #endif
0084   const int DefaultAioSignal               = 0;
0085   const int DefaultPreferIPv4              = 0;
0086   const int DefaultMaxMetalinkWait         = 60;
0087   const int DefaultPreserveLocateTried     = 1;
0088   const int DefaultNotAuthorizedRetryLimit = 3;
0089   const int DefaultPreserveXAttrs          = 0;
0090   const int DefaultNoTlsOK                 = 0;
0091   const int DefaultTlsNoData               = 0;
0092   const int DefaultTlsMetalink             = 0;
0093   const int DefaultZipMtlnCksum            = 0;
0094   const int DefaultIPNoShuffle             = 0;
0095   const int DefaultWantTlsOnNoPgrw         = 0;
0096   const int DefaultRetryWrtAtLBLimit       = 3;
0097   const int DefaultCpRetry                 = 0;
0098   const int DefaultCpUsePgWrtRd            = 1;
0099 
0100   const char * const DefaultPollerPreference   = "built-in";
0101   const char * const DefaultNetworkStack       = "IPAuto";
0102   const char * const DefaultClientMonitor      = "";
0103   const char * const DefaultClientMonitorParam = "";
0104   const char * const DefaultPlugInConfDir      = "";
0105   const char * const DefaultPlugIn             = "";
0106   const char * const DefaultReadRecovery       = "true";
0107   const char * const DefaultWriteRecovery      = "true";
0108   const char * const DefaultOpenRecovery       = "true";
0109   const char * const DefaultGlfnRedirector     = "";
0110   const char * const DefaultTlsDbgLvl          = "OFF";
0111   const char * const DefaultClConfDir          = "";
0112   const char * const DefaultClConfFile         = "";
0113   const char * const DefaultCpTarget           = "";
0114   const char * const DefaultCpRetryPolicy      = "force";
0115 
0116   inline static std::string to_lower( std::string str )
0117   {
0118     std::transform( str.begin(), str.end(), str.begin(), ::tolower );
0119     return str;
0120   }
0121 
0122   static std::unordered_map<std::string, int> theDefaultInts
0123     {
0124       { to_lower( "SubStreamsPerChannel" ),    DefaultSubStreamsPerChannel },
0125       { to_lower( "ConnectionWindow" ),        DefaultConnectionWindow },
0126       { to_lower( "ConnectionRetry" ),         DefaultConnectionRetry },
0127       { to_lower( "RequestTimeout" ),          DefaultRequestTimeout },
0128       { to_lower( "StreamTimeout" ),           DefaultStreamTimeout },
0129       { to_lower( "TimeoutResolution" ),       DefaultTimeoutResolution },
0130       { to_lower( "StreamErrorWindow" ),       DefaultStreamErrorWindow },
0131       { to_lower( "RunForkHandler" ),          DefaultRunForkHandler },
0132       { to_lower( "RedirectLimit" ),           DefaultRedirectLimit },
0133       { to_lower( "WorkerThreads" ),           DefaultWorkerThreads },
0134       { to_lower( "CPChunkSize" ),             DefaultCPChunkSize },
0135       { to_lower( "CPParallelChunks" ),        DefaultCPParallelChunks },
0136       { to_lower( "DataServerTTL" ),           DefaultDataServerTTL },
0137       { to_lower( "LoadBalancerTTL" ),         DefaultLoadBalancerTTL },
0138       { to_lower( "CPInitTimeout" ),           DefaultCPInitTimeout },
0139       { to_lower( "CPTPCTimeout" ),            DefaultCPTPCTimeout },
0140       { to_lower( "CPTimeout" ),               DefaultCPTimeout },
0141       { to_lower( "TCPKeepAlive" ),            DefaultTCPKeepAlive },
0142       { to_lower( "TCPKeepAliveTime" ),        DefaultTCPKeepAliveTime },
0143       { to_lower( "TCPKeepAliveInterval" ),    DefaultTCPKeepAliveInterval },
0144       { to_lower( "TCPKeepAliveProbes" ),      DefaultTCPKeepAliveProbes },
0145       { to_lower( "MultiProtocol" ),           DefaultMultiProtocol },
0146       { to_lower( "ParallelEvtLoop" ),         DefaultParallelEvtLoop },
0147       { to_lower( "MetalinkProcessing" ),      DefaultMetalinkProcessing },
0148       { to_lower( "LocalMetalinkFile" ),       DefaultLocalMetalinkFile },
0149       { to_lower( "XRateThreshold" ),          DefaultXRateThreshold },
0150       { to_lower( "XCpBlockSize" ),            DefaultXCpBlockSize },
0151       { to_lower( "NoDelay" ),                 DefaultNoDelay },
0152       { to_lower( "AioSignal" ),               DefaultAioSignal },
0153       { to_lower( "PreferIPv4" ),              DefaultPreferIPv4 },
0154       { to_lower( "MaxMetalinkWait" ),         DefaultMaxMetalinkWait },
0155       { to_lower( "PreserveLocateTried" ),     DefaultPreserveLocateTried },
0156       { to_lower( "NotAuthorizedRetryLimit" ), DefaultNotAuthorizedRetryLimit },
0157       { to_lower( "PreserveXAttrs" ),          DefaultPreserveXAttrs },
0158       { to_lower( "NoTlsOK" ),                 DefaultNoTlsOK },
0159       { to_lower( "TlsNoData" ),               DefaultTlsNoData },
0160       { to_lower( "TlsMetalink" ),             DefaultTlsMetalink },
0161       { to_lower( "ZipMtlnCksum" ),            DefaultZipMtlnCksum },
0162       { to_lower( "IPNoShuffle" ),             DefaultIPNoShuffle },
0163       { to_lower( "WantTlsOnNoPgrw" ),         DefaultWantTlsOnNoPgrw },
0164       { to_lower( "RetryWrtAtLBLimit" ),       DefaultRetryWrtAtLBLimit }
0165     };
0166 
0167   static std::unordered_map<std::string, std::string> theDefaultStrs
0168     {
0169       { to_lower( "PollerPreference" ),   DefaultPollerPreference },
0170       { to_lower( "NetworkStack" ),       DefaultNetworkStack },
0171       { to_lower( "ClientMonitor" ),      DefaultClientMonitor },
0172       { to_lower( "ClientMonitorParam" ), DefaultClientMonitorParam },
0173       { to_lower( "PlugInConfDir" ),      DefaultPlugInConfDir },
0174       { to_lower( "PlugIn" ),             DefaultPlugIn },
0175       { to_lower( "ReadRecovery" ),       DefaultReadRecovery },
0176       { to_lower( "WriteRecovery" ),      DefaultWriteRecovery },
0177       { to_lower( "OpenRecovery" ),       DefaultOpenRecovery },
0178       { to_lower( "GlfnRedirector" ),     DefaultGlfnRedirector },
0179       { to_lower( "TlsDbgLvl" ),          DefaultTlsDbgLvl },
0180       { to_lower( "ClConfDir" ),          DefaultClConfDir },
0181       { to_lower( "DefaultClConfFile" ),  DefaultClConfFile },
0182       { to_lower( "CpTarget" ),           DefaultCpTarget }
0183     };
0184 }
0185 
0186 #endif // __XRD_CL_CONSTANTS_HH__