|
xrootd
|
00001 //------------------------------------------------------------------------------ 00002 // Copyright (c) 2011-2012 by European Organization for Nuclear Research (CERN) 00003 // Author: Lukasz Janyst <ljanyst@cern.ch> 00004 //------------------------------------------------------------------------------ 00005 // XRootD is free software: you can redistribute it and/or modify 00006 // it under the terms of the GNU Lesser General Public License as published by 00007 // the Free Software Foundation, either version 3 of the License, or 00008 // (at your option) any later version. 00009 // 00010 // XRootD is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public License 00016 // along with XRootD. If not, see <http://www.gnu.org/licenses/>. 00017 //------------------------------------------------------------------------------ 00018 00019 #ifndef __XRD_CL_STATUS_HH__ 00020 #define __XRD_CL_STATUS_HH__ 00021 00022 #include <stdint.h> 00023 #include <errno.h> 00024 #include <sstream> 00025 00026 namespace XrdCl 00027 { 00028 //---------------------------------------------------------------------------- 00029 // Constants 00030 //---------------------------------------------------------------------------- 00031 const uint16_t stOK = 0x0000; 00032 const uint16_t stError = 0x0001; 00033 const uint16_t stFatal = 0x0003; 00034 00035 //---------------------------------------------------------------------------- 00036 // Additional info for the stOK status 00037 //---------------------------------------------------------------------------- 00038 const uint16_t suDone = 0; 00039 const uint16_t suContinue = 1; 00040 const uint16_t suRetry = 2; 00041 const uint16_t suPartial = 3; 00042 const uint16_t suAlreadyDone = 4; 00043 00044 const uint16_t suXRDRedirect = 101; 00045 00046 //---------------------------------------------------------------------------- 00047 // Generic errors 00048 //---------------------------------------------------------------------------- 00049 const uint16_t errNone = 0; 00050 const uint16_t errRetry = 1; 00051 const uint16_t errUnknown = 2; 00052 const uint16_t errInvalidOp = 3; 00053 00054 const uint16_t errFcntl = 4; 00055 const uint16_t errPoll = 5; 00056 const uint16_t errConfig = 6; 00057 const uint16_t errInternal = 7; 00058 const uint16_t errUnknownCommand = 8; 00059 const uint16_t errInvalidArgs = 9; 00060 const uint16_t errInProgress = 10; 00061 const uint16_t errUninitialized = 11; 00062 const uint16_t errOSError = 12; 00063 const uint16_t errNotSupported = 13; 00064 00065 //---------------------------------------------------------------------------- 00066 // Socket related errors 00067 //---------------------------------------------------------------------------- 00068 const uint16_t errInvalidAddr = 101; 00069 const uint16_t errSocketError = 102; 00070 const uint16_t errSocketTimeout = 103; 00071 const uint16_t errSocketDisconnected = 104; 00072 const uint16_t errPollerError = 105; 00073 const uint16_t errSocketOptError = 106; 00074 const uint16_t errStreamDisconnect = 107; 00075 const uint16_t errConnectionError = 108; 00076 const uint16_t errInvalidSession = 109; 00077 00078 //---------------------------------------------------------------------------- 00079 // Post Master related errors 00080 //---------------------------------------------------------------------------- 00081 const uint16_t errInvalidMessage = 201; 00082 const uint16_t errHandShakeFailed = 202; 00083 const uint16_t errLoginFailed = 203; 00084 const uint16_t errAuthFailed = 204; 00085 const uint16_t errQueryNotSupported = 205; 00086 const uint16_t errOperationExpired = 206; 00087 00088 //---------------------------------------------------------------------------- 00089 // XRootD related errors 00090 //---------------------------------------------------------------------------- 00091 const uint16_t errNoMoreFreeSIDs = 301; 00092 const uint16_t errInvalidRedirectURL = 302; 00093 const uint16_t errInvalidResponse = 303; 00094 const uint16_t errNotFound = 304; 00095 const uint16_t errCheckSumError = 305; 00096 const uint16_t errRedirectLimit = 306; 00097 00098 const uint16_t errErrorResponse = 400; 00099 00100 //---------------------------------------------------------------------------- 00102 //---------------------------------------------------------------------------- 00103 struct Status 00104 { 00105 //-------------------------------------------------------------------------- 00107 //-------------------------------------------------------------------------- 00108 Status( uint16_t st = stOK, uint16_t cod = errNone, uint32_t errN = 0 ): 00109 status(st), code(cod), errNo( errN ) {} 00110 00111 bool IsError() const { return status & stError; } 00112 bool IsFatal() const { return (status&0x0002) & stFatal; } 00113 bool IsOK() const { return status == stOK; } 00114 00115 //-------------------------------------------------------------------------- 00117 //-------------------------------------------------------------------------- 00118 int GetShellCode() const 00119 { 00120 if( IsOK() ) 00121 return 0; 00122 return (code/100)+50; 00123 } 00124 00125 //-------------------------------------------------------------------------- 00127 //-------------------------------------------------------------------------- 00128 std::string ToString() const; 00129 00130 uint16_t status; 00131 uint16_t code; 00132 uint32_t errNo; 00133 }; 00134 } 00135 00136 #endif // __XRD_CL_STATUS_HH__
1.7.6.1