XRootD
XrdSsiUtils Class Reference

#include <XrdSsiUtils.hh>

+ Collaboration diagram for XrdSsiUtils:

Public Member Functions

 XrdSsiUtils ()
 
 ~XrdSsiUtils ()
 

Static Public Member Functions

static char * b2x (const char *ibuff, int ilen, char *obuff, int olen, char xbuff[4])
 
static int Emsg (const char *pfx, int ecode, const char *op, const char *path, XrdOucErrInfo &eDest)
 
static int GetErr (XrdCl::XRootDStatus &Status, std::string &eText)
 
static int MapErr (int xEnum)
 
static void RetErr (XrdSsiRequest &reqP, const char *eTxt, int eNum)
 
static void SetErr (XrdCl::XRootDStatus &Status, XrdSsiErrInfo &eInfo)
 

Detailed Description

Definition at line 40 of file XrdSsiUtils.hh.

Constructor & Destructor Documentation

◆ XrdSsiUtils()

XrdSsiUtils::XrdSsiUtils ( )
inline

Definition at line 61 of file XrdSsiUtils.hh.

61 {}

◆ ~XrdSsiUtils()

XrdSsiUtils::~XrdSsiUtils ( )
inline

Definition at line 62 of file XrdSsiUtils.hh.

62 {}

Member Function Documentation

◆ b2x()

char * XrdSsiUtils::b2x ( const char *  ibuff,
int  ilen,
char *  obuff,
int  olen,
char  xbuff[4] 
)
static

Definition at line 116 of file XrdSsiUtils.cc.

118 {
119  static char hv[] = "0123456789abcdef";
120  char *oP = obuff;
121 
122  // Gaurd against too short of an output buffer (minimum if 3 bytes)
123  //
124  if (olen < 3)
125  {*obuff = 0;
126  strcpy(xbuff, "...");
127  return obuff;
128  }
129 
130  // Make sure we have something to format
131  //
132  if (ilen < 1)
133  {*obuff = 0;
134  *xbuff = 0;
135  return obuff;
136  }
137 
138  // Do length adjustment, as needed
139  //
140  if (ilen*2 < olen) *xbuff = 0;
141  else {ilen = (olen-1)/2;
142  strcpy(xbuff, "...");
143  }
144 
145  // Format the data. We know it will fit with a trailing null byte.
146  //
147  for (int i = 0; i < ilen; i++) {
148  *oP++ = hv[(ibuff[i] >> 4) & 0x0f];
149  *oP++ = hv[ ibuff[i] & 0x0f];
150  }
151  *oP = '\0';
152  return obuff;
153 }

◆ Emsg()

int XrdSsiUtils::Emsg ( const char *  pfx,
int  ecode,
const char *  op,
const char *  path,
XrdOucErrInfo eDest 
)
static

Definition at line 159 of file XrdSsiUtils.cc.

164 {
165  char buffer[2048];
166 
167 // Get correct error code and path
168 //
169  if (ecode < 0) ecode = -ecode;
170  if (!path) path = "???";
171 
172 // Format the error message
173 //
174  XrdOucERoute::Format(buffer, sizeof(buffer), ecode, op, path);
175 
176 // Put the message in the log
177 //
178  Log.Emsg(pfx, eDest.getErrUser(), buffer);
179 
180 // Place the error message in the error object and return
181 //
182  eDest.setErrInfo(ecode, buffer);
183  return SFS_ERROR;
184 }
static XrdSysError eDest(0,"crypto_")
#define SFS_ERROR
static int Format(char *buff, int blen, int ecode, const char *etxt1, const char *etxt2=0)
Definition: XrdOucERoute.cc:44
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
Definition: XrdSysError.cc:95
XrdSysError Log
Definition: XrdConfig.cc:112

References eDest, XrdSysError::Emsg(), XrdOucERoute::Format(), XrdSsi::Log, and SFS_ERROR.

Referenced by XrdSsiDir::autoStat(), XrdSsiDir::close(), XrdSsiFile::fctl(), XrdSsiFileSess::fctl(), XrdSsiDir::FName(), XrdSsiDir::nextEntry(), XrdSsiDir::open(), XrdSsiFileSess::open(), XrdSsiFile::open(), XrdSsiFileSess::read(), XrdSsiFile::readv(), XrdSsiFileSess::SendData(), XrdSsiFile::sync(), XrdSsiFileSess::truncate(), and XrdSsiFileSess::write().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetErr()

int XrdSsiUtils::GetErr ( XrdCl::XRootDStatus Status,
std::string &  eText 
)
static

Definition at line 191 of file XrdSsiUtils.cc.

192 {
193 
194 // If this is an xrootd error then get the xrootd generated error
195 //
196  if (Status.code == XrdCl::errErrorResponse)
197  {eText = Status.GetErrorMessage();
198  return MapErr(Status.errNo);
199  }
200 
201 // Internal error, we will need to copy strings here
202 //
203  eText = Status.ToStr();
204  return (Status.errNo ? Status.errNo : EFAULT);
205 }
const std::string & GetErrorMessage() const
Get error message.
std::string ToStr() const
Convert to string.
static int MapErr(int xEnum)
Definition: XrdSsiUtils.cc:211
const uint16_t errErrorResponse
Definition: XrdClStatus.hh:105
uint16_t code
Error type, or additional hints on what to do.
Definition: XrdClStatus.hh:147
uint32_t errNo
Errno, if any.
Definition: XrdClStatus.hh:148

References XrdCl::Status::code, XrdCl::errErrorResponse, XrdCl::Status::errNo, XrdCl::XRootDStatus::GetErrorMessage(), and XrdCl::XRootDStatus::ToStr().

Referenced by XrdSsiSessReal::Provision().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MapErr()

int XrdSsiUtils::MapErr ( int  xEnum)
static

Definition at line 211 of file XrdSsiUtils.cc.

212 {
213  return XProtocol::mapError(xEnum);
214 }
static int mapError(int rc)
Definition: XProtocol.hh:1361

References XProtocol::mapError().

+ Here is the call graph for this function:

◆ RetErr()

void XrdSsiUtils::RetErr ( XrdSsiRequest reqP,
const char *  eTxt,
int  eNum 
)
static

Definition at line 220 of file XrdSsiUtils.cc.

221 {
222 
223 // Schedule an error callback
224 //
225  XrdSsi::schedP->Schedule(new PostError(&reqP, strdup(eTxt), eNum));
226 }
void Schedule(XrdJob *jp)
XrdScheduler * schedP
Definition: XrdSsiClient.cc:74

References XrdSsi::schedP, and XrdScheduler::Schedule().

Referenced by XrdSsiServReal::ProcessRequest(), and XrdSsiSessReal::Provision().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetErr()

void XrdSsiUtils::SetErr ( XrdCl::XRootDStatus Status,
XrdSsiErrInfo eInfo 
)
static

Definition at line 232 of file XrdSsiUtils.cc.

233 {
234 
235 // If this is an xrootd error then get the xrootd generated error
236 //
237  if (Status.code == XrdCl::errErrorResponse)
238  {eInfo.Set(Status.GetErrorMessage().c_str(), MapErr(Status.errNo));
239  } else {
240  eInfo.Set(Status.ToStr().c_str(), (Status.errNo ? Status.errNo:EFAULT));
241  }
242 }
void Set(const char *eMsg=0, int eNum=0, int eArg=0)

References XrdCl::Status::code, XrdCl::errErrorResponse, XrdCl::Status::errNo, XrdCl::XRootDStatus::GetErrorMessage(), XrdSsiErrInfo::Set(), and XrdCl::XRootDStatus::ToStr().

Referenced by XrdSsiTaskReal::SendRequest(), XrdSsiTaskReal::SetBuff(), XrdSsiSessReal::XeqEvent(), and XrdSsiTaskReal::XeqEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this class was generated from the following files: