XRootD
XrdCmsTalk Class Reference

#include <XrdCmsTalk.hh>

+ Collaboration diagram for XrdCmsTalk:

Public Member Functions

 XrdCmsTalk ()
 
 ~XrdCmsTalk ()
 

Static Public Member Functions

static const char * Attend (XrdLink *Link, XrdCms::CmsRRHdr &Hdr, char *buff, int blen, int &rlen, int tmo=5000)
 
static int Complain (XrdLink *Link, int ecode, const char *msg)
 
static const char * Request (XrdLink *Link, XrdCms::CmsRRHdr &Hdr, char *buff, int blen)
 
static const char * Respond (XrdLink *Link, XrdCms::CmsRspCode rcode, char *buff, int blen)
 

Detailed Description

Definition at line 37 of file XrdCmsTalk.hh.

Constructor & Destructor Documentation

◆ XrdCmsTalk()

XrdCmsTalk::XrdCmsTalk ( )
inline

Definition at line 53 of file XrdCmsTalk.hh.

53 {}

◆ ~XrdCmsTalk()

XrdCmsTalk::~XrdCmsTalk ( )
inline

Definition at line 54 of file XrdCmsTalk.hh.

54 {}

Member Function Documentation

◆ Attend()

const char * XrdCmsTalk::Attend ( XrdLink Link,
XrdCms::CmsRRHdr Hdr,
char *  buff,
int  blen,
int &  rlen,
int  tmo = 5000 
)
static

Definition at line 46 of file XrdCmsTalk.cc.

49 {
50 
51 // First obtain the complete header
52 //
53  if (Link->Recv((char *)&Hdr, sizeof(Hdr), TimeOut) != sizeof(Hdr))
54  return "header not sent";
55 
56 // Decode the length and make sure it fits in the buffer
57 //
58  rlen = static_cast<int>(ntohs(Hdr.datalen));
59  if (rlen > blen) return "data too long";
60 
61 // Get the actual data
62 //
63  if (Link->Recv(buff,rlen,TimeOut) != rlen) return "data not received";
64 
65 // All done
66 //
67  return 0;
68 }

References XrdCms::CmsRRHdr::datalen, and XrdLink::Recv().

Referenced by XrdCmsLogin::Admit(), XrdCmsSecurity::Authenticate(), and XrdCmsSecurity::Identify().

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

◆ Complain()

int XrdCmsTalk::Complain ( XrdLink Link,
int  ecode,
const char *  msg 
)
static

Definition at line 74 of file XrdCmsTalk.cc.

75 {
76  static const int xNum = 2;
77 
78  struct iovec Liov[xNum];
79  int mlen = strlen(msg)+1;
80  CmsResponse LEResp={{0, kYR_error, 0, 0}, htonl((unsigned int)ecode)};
81 
82 // Fill out header and iovector
83 //
84  LEResp.Hdr.datalen = htons(static_cast<kXR_unt16>(mlen+sizeof(LEResp.Val)));
85  Liov[0].iov_base = (char *)&LEResp;
86  Liov[0].iov_len = sizeof(LEResp);
87  Liov[1].iov_base = (char *)msg;
88  Liov[1].iov_len = mlen;
89 
90 // Send off the data
91 //
92  Link->Send(Liov, xNum);
93  return 0;
94 }
unsigned short kXR_unt16
Definition: XPtypes.hh:67
kXR_unt16 datalen
Definition: YProtocol.hh:86
@ kYR_error
Definition: YProtocol.hh:142

References XrdCms::CmsRRHdr::datalen, XrdCms::CmsResponse::Hdr, XrdCms::kYR_error, XrdLink::Send(), and XrdCms::CmsResponse::Val.

+ Here is the call graph for this function:

◆ Request()

const char * XrdCmsTalk::Request ( XrdLink Link,
XrdCms::CmsRRHdr Hdr,
char *  buff,
int  blen 
)
static

Definition at line 100 of file XrdCmsTalk.cc.

102 {
103  struct iovec ioV[2] = {{(char *)&Hdr, sizeof(Hdr)},
104  {(char *)buff, (size_t)blen}};
105 
106  Hdr.datalen = htons(static_cast<unsigned short>(blen));
107 
108 // Send the actual data
109 //
110  if (Link->Send(ioV, 2) < 0) return "request not sent";
111  return 0;
112 }

References XrdCms::CmsRRHdr::datalen, and XrdLink::Send().

Referenced by XrdCmsSecurity::Authenticate(), and XrdCmsSecurity::Identify().

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

◆ Respond()

const char * XrdCmsTalk::Respond ( XrdLink Link,
XrdCms::CmsRspCode  rcode,
char *  buff,
int  blen 
)
static

Definition at line 118 of file XrdCmsTalk.cc.

120 {
121  static const unsigned short ovhd = sizeof(kXR_unt32);
122  CmsResponse Resp = {{0, (kXR_char)rcode, 0,
123  htons(static_cast<unsigned short>(blen+ovhd))}, 0};
124  struct iovec ioV[2] = {{(char *)&Resp, sizeof(Resp)},
125  { buff, (size_t)blen}};
126 
127 // Send the actual data
128 //
129  if (Link->Send(ioV, 2) < 0) return "response not sent";
130  return 0;
131 }
unsigned int kXR_unt32
Definition: XPtypes.hh:90
unsigned char kXR_char
Definition: XPtypes.hh:65

References XrdLink::Send().

+ Here is the call graph for this function:

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