xrootd
Main Page
Namespaces
Classes
Files
File List
File Members
src
XrdCl
XrdClStatus.hh
Go to the documentation of this file.
1
//------------------------------------------------------------------------------
2
// Copyright (c) 2011-2012 by European Organization for Nuclear Research (CERN)
3
// Author: Lukasz Janyst <ljanyst@cern.ch>
4
//------------------------------------------------------------------------------
5
// XRootD is free software: you can redistribute it and/or modify
6
// it under the terms of the GNU Lesser General Public License as published by
7
// the Free Software Foundation, either version 3 of the License, or
8
// (at your option) any later version.
9
//
10
// XRootD is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
// GNU General Public License for more details.
14
//
15
// You should have received a copy of the GNU Lesser General Public License
16
// along with XRootD. If not, see <http://www.gnu.org/licenses/>.
17
//------------------------------------------------------------------------------
18
19
#ifndef __XRD_CL_STATUS_HH__
20
#define __XRD_CL_STATUS_HH__
21
22
#include <stdint.h>
23
#include <errno.h>
24
#include <sstream>
25
26
namespace
XrdCl
27
{
28
//----------------------------------------------------------------------------
29
// Constants
30
//----------------------------------------------------------------------------
31
const
uint16_t
stOK
= 0x0000;
32
const
uint16_t
stError
= 0x0001;
33
const
uint16_t
stFatal
= 0x0003;
34
35
//----------------------------------------------------------------------------
36
// Additional info for the stOK status
37
//----------------------------------------------------------------------------
38
const
uint16_t
suDone
= 0;
39
const
uint16_t
suContinue
= 1;
40
const
uint16_t
suRetry
= 2;
41
const
uint16_t
suPartial
= 3;
42
const
uint16_t
suAlreadyDone
= 4;
43
44
//----------------------------------------------------------------------------
45
// Generic errors
46
//----------------------------------------------------------------------------
47
const
uint16_t
errNone
= 0;
48
const
uint16_t
errRetry
= 1;
49
const
uint16_t
errUnknown
= 2;
50
const
uint16_t
errInvalidOp
= 3;
51
52
const
uint16_t
errFcntl
= 4;
53
const
uint16_t
errPoll
= 5;
54
const
uint16_t
errConfig
= 6;
55
const
uint16_t
errInternal
= 7;
56
const
uint16_t
errUnknownCommand
= 8;
57
const
uint16_t
errInvalidArgs
= 9;
58
const
uint16_t
errInProgress
= 10;
59
const
uint16_t
errUninitialized
= 11;
60
const
uint16_t
errOSError
= 12;
61
const
uint16_t
errNotSupported
= 13;
62
const
uint16_t
errDataError
= 14;
63
const
uint16_t
errNotImplemented
= 15;
64
65
//----------------------------------------------------------------------------
66
// Socket related errors
67
//----------------------------------------------------------------------------
68
const
uint16_t
errInvalidAddr
= 101;
69
const
uint16_t
errSocketError
= 102;
70
const
uint16_t
errSocketTimeout
= 103;
71
const
uint16_t
errSocketDisconnected
= 104;
72
const
uint16_t
errPollerError
= 105;
73
const
uint16_t
errSocketOptError
= 106;
74
const
uint16_t
errStreamDisconnect
= 107;
75
const
uint16_t
errConnectionError
= 108;
76
const
uint16_t
errInvalidSession
= 109;
77
78
//----------------------------------------------------------------------------
79
// Post Master related errors
80
//----------------------------------------------------------------------------
81
const
uint16_t
errInvalidMessage
= 201;
82
const
uint16_t
errHandShakeFailed
= 202;
83
const
uint16_t
errLoginFailed
= 203;
84
const
uint16_t
errAuthFailed
= 204;
85
const
uint16_t
errQueryNotSupported
= 205;
86
const
uint16_t
errOperationExpired
= 206;
87
88
//----------------------------------------------------------------------------
89
// XRootD related errors
90
//----------------------------------------------------------------------------
91
const
uint16_t
errNoMoreFreeSIDs
= 301;
92
const
uint16_t
errInvalidRedirectURL
= 302;
93
const
uint16_t
errInvalidResponse
= 303;
94
const
uint16_t
errNotFound
= 304;
95
const
uint16_t
errCheckSumError
= 305;
96
const
uint16_t
errRedirectLimit
= 306;
97
98
const
uint16_t
errErrorResponse
= 400;
99
const
uint16_t
errRedirect
= 401;
100
101
const
uint16_t
errResponseNegative
= 500;
102
103
//----------------------------------------------------------------------------
105
//----------------------------------------------------------------------------
106
struct
Status
107
{
108
//--------------------------------------------------------------------------
110
//--------------------------------------------------------------------------
111
Status
( uint16_t st =
stOK
, uint16_t cod =
errNone
, uint32_t errN = 0 ):
112
status
(st),
code
(cod),
errNo
( errN ) {}
113
114
bool
IsError
()
const
{
return
status
&
stError
; }
115
bool
IsFatal
()
const
{
return
(
status
&0x0002) &
stFatal
; }
116
bool
IsOK
()
const
{
return
status
==
stOK
; }
117
118
//--------------------------------------------------------------------------
120
//--------------------------------------------------------------------------
121
int
GetShellCode
()
const
122
{
123
if
(
IsOK
() )
124
return
0;
125
return
(
code
/100)+50;
126
}
127
128
//--------------------------------------------------------------------------
130
//--------------------------------------------------------------------------
131
std::string
ToString
()
const
;
132
133
uint16_t
status
;
134
uint16_t
code
;
135
uint32_t
errNo
;
136
};
137
}
138
139
#endif // __XRD_CL_STATUS_HH__
Generated by
1.8.3.1