|
||||
File indexing completed on 2025-01-18 10:15:40
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_STATUS_HH__ 0020 #define __XRD_CL_STATUS_HH__ 0021 0022 #include <cstdint> 0023 #include <cerrno> 0024 #include <sstream> 0025 0026 namespace XrdCl 0027 { 0028 //---------------------------------------------------------------------------- 0029 // Constants 0030 //---------------------------------------------------------------------------- 0031 const uint16_t stOK = 0x0000; //!< Everything went OK 0032 const uint16_t stError = 0x0001; //!< An error occurred that could potentially be retried 0033 const uint16_t stFatal = 0x0003; //!< Fatal error, it's still an error 0034 0035 //---------------------------------------------------------------------------- 0036 // Additional info for the stOK status 0037 //---------------------------------------------------------------------------- 0038 const uint16_t suDone = 0; 0039 const uint16_t suContinue = 1; 0040 const uint16_t suRetry = 2; 0041 const uint16_t suPartial = 3; 0042 const uint16_t suAlreadyDone = 4; 0043 const uint16_t suNotStarted = 5; 0044 0045 //---------------------------------------------------------------------------- 0046 // Generic errors 0047 //---------------------------------------------------------------------------- 0048 const uint16_t errNone = 0; //!< No error 0049 const uint16_t errRetry = 1; //!< Try again for whatever reason 0050 const uint16_t errUnknown = 2; //!< Unknown error 0051 const uint16_t errInvalidOp = 3; //!< The operation cannot be performed in the 0052 //!< given circumstances 0053 const uint16_t errFcntl = 4; //!< failed manipulate file descriptor 0054 const uint16_t errPoll = 5; //!< error while polling descriptors 0055 const uint16_t errConfig = 6; //!< System misconfigured 0056 const uint16_t errInternal = 7; //!< Internal error 0057 const uint16_t errUnknownCommand = 8; 0058 const uint16_t errInvalidArgs = 9; 0059 const uint16_t errInProgress = 10; 0060 const uint16_t errUninitialized = 11; 0061 const uint16_t errOSError = 12; 0062 const uint16_t errNotSupported = 13; 0063 const uint16_t errDataError = 14; //!< data is corrupted 0064 const uint16_t errNotImplemented = 15; //!< Operation is not implemented 0065 const uint16_t errNoMoreReplicas = 16; //!< No more replicas to try 0066 const uint16_t errPipelineFailed = 17; //!< Pipeline failed and operation couldn't be executed 0067 0068 //---------------------------------------------------------------------------- 0069 // Socket related errors 0070 //---------------------------------------------------------------------------- 0071 const uint16_t errInvalidAddr = 101; 0072 const uint16_t errSocketError = 102; 0073 const uint16_t errSocketTimeout = 103; 0074 const uint16_t errSocketDisconnected = 104; 0075 const uint16_t errPollerError = 105; 0076 const uint16_t errSocketOptError = 106; 0077 const uint16_t errStreamDisconnect = 107; 0078 const uint16_t errConnectionError = 108; 0079 const uint16_t errInvalidSession = 109; 0080 const uint16_t errTlsError = 110; 0081 0082 //---------------------------------------------------------------------------- 0083 // Post Master related errors 0084 //---------------------------------------------------------------------------- 0085 const uint16_t errInvalidMessage = 201; 0086 const uint16_t errHandShakeFailed = 202; 0087 const uint16_t errLoginFailed = 203; 0088 const uint16_t errAuthFailed = 204; 0089 const uint16_t errQueryNotSupported = 205; 0090 const uint16_t errOperationExpired = 206; 0091 const uint16_t errOperationInterrupted = 207; 0092 const uint16_t errThresholdExceeded = 208; 0093 0094 //---------------------------------------------------------------------------- 0095 // XRootD related errors 0096 //---------------------------------------------------------------------------- 0097 const uint16_t errNoMoreFreeSIDs = 301; 0098 const uint16_t errInvalidRedirectURL = 302; 0099 const uint16_t errInvalidResponse = 303; 0100 const uint16_t errNotFound = 304; 0101 const uint16_t errCheckSumError = 305; 0102 const uint16_t errRedirectLimit = 306; 0103 const uint16_t errCorruptedHeader = 307; 0104 0105 const uint16_t errErrorResponse = 400; 0106 const uint16_t errRedirect = 401; 0107 const uint16_t errLocalError = 402; 0108 0109 const uint16_t errResponseNegative = 500; //!< Query response was negative 0110 0111 //---------------------------------------------------------------------------- 0112 //! Procedure execution status 0113 //---------------------------------------------------------------------------- 0114 struct Status 0115 { 0116 //-------------------------------------------------------------------------- 0117 //! Constructor 0118 //-------------------------------------------------------------------------- 0119 Status( uint16_t st = stOK, uint16_t cod = errNone, uint32_t errN = 0 ): 0120 status(st), code(cod), errNo( errN ) {} 0121 0122 bool IsError() const { return status & stError; } //!< Error 0123 bool IsFatal() const { return (status&0x0002) & stFatal; } //!< Fatal error 0124 bool IsOK() const { return status == stOK; } //!< We're fine 0125 0126 //-------------------------------------------------------------------------- 0127 //! Get the status code that may be returned to the shell 0128 //-------------------------------------------------------------------------- 0129 int GetShellCode() const 0130 { 0131 if( IsOK() ) 0132 return 0; 0133 return (code/100)+50; 0134 } 0135 0136 inline static bool IsSocketError( uint16_t code ) 0137 { 0138 return int( code / 100 ) == 1; 0139 } 0140 0141 //-------------------------------------------------------------------------- 0142 //! Create a string representation 0143 //-------------------------------------------------------------------------- 0144 std::string ToString() const; 0145 0146 uint16_t status; //!< Status of the execution 0147 uint16_t code; //!< Error type, or additional hints on what to do 0148 uint32_t errNo; //!< Errno, if any 0149 }; 0150 } 0151 0152 #endif // __XRD_CL_STATUS_HH__
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |