xrootd
XrdClientMessage.hh
Go to the documentation of this file.
1#ifndef XRC_MESSAGE_H
2#define XRC_MESSAGE_H
3/******************************************************************************/
4/* */
5/* X r d C l i e n t M e s s a g e . h h */
6/* */
7/* Author: Fabrizio Furano (INFN Padova, 2004) */
8/* Adapted from TXNetFile (root.cern.ch) originally done by */
9/* Alvise Dorigo, Fabrizio Furano */
10/* INFN Padova, 2003 */
11/* */
12/* This file is part of the XRootD software suite. */
13/* */
14/* XRootD is free software: you can redistribute it and/or modify it under */
15/* the terms of the GNU Lesser General Public License as published by the */
16/* Free Software Foundation, either version 3 of the License, or (at your */
17/* option) any later version. */
18/* */
19/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
20/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
21/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
22/* License for more details. */
23/* */
24/* You should have received a copy of the GNU Lesser General Public License */
25/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
26/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
27/* */
28/* The copyright holder's institutional names and contributor's names may not */
29/* be used to endorse or promote products derived from this software without */
30/* specific prior written permission of the institution or contributor. */
31/******************************************************************************/
32
34// //
35// A message coming from a physical connection. I.e. a server response //
36// or some kind of error //
37// //
39
42
43#ifndef WIN32
44#include <netinet/in.h>
45#endif
46
48
50
51private:
53 void *fData;
57
58public:
59
60 static kXR_unt16 CharStreamid2Int(kXR_char *charstreamid);
61 static void Int2CharStreamid(kXR_char *charstreamid, short intstreamid);
62
63 enum EXrdMSCStatus { // Some status codes useful
68 };
69
71
74
76
77 bool CreateData();
78
79 inline int DataLen() { return fHdr.dlen; }
80
81 void *DonateData();
82 inline void *GetData() {return fData;}
83 inline int GetStatusCode() { return fStatusCode; }
84
85 inline int HeaderStatus() { return fHdr.status; }
86
88
89 bool IsAttn() { return (HeaderStatus() == kXR_attn); }
90
91 inline bool IsError() { return (fStatusCode != kXrdMSC_ok); };
92
93 inline bool IsMarshalled() { return fMarshalled; }
94 void Marshall();
95 inline bool MatchStreamid(short sid) { return (HeaderSID() == sid);}
97 inline void SetHeaderStatus(kXR_unt16 sts) { fHdr.status = sts; }
98 inline void SetMarshalled(bool m) { fMarshalled = m; }
99 inline void SetStatusCode(kXR_unt16 status) { fStatusCode = status; }
101
102};
103#endif
@ kXR_attn
Definition: XProtocol.hh:301
unsigned short kXR_unt16
Definition: XPtypes.hh:67
unsigned char kXR_char
Definition: XPtypes.hh:65
Definition: XrdClientMessage.hh:49
static kXR_unt16 CharStreamid2Int(kXR_char *charstreamid)
XrdSysRecMutex fMultireadMutex
Definition: XrdClientMessage.hh:56
EXrdMSCStatus
Definition: XrdClientMessage.hh:63
@ kXrdMSC_timeout
Definition: XrdClientMessage.hh:67
@ kXrdMSC_ok
Definition: XrdClientMessage.hh:64
@ kXrdMSC_readerr
Definition: XrdClientMessage.hh:65
@ kXrdMSC_writeerr
Definition: XrdClientMessage.hh:66
bool IsError()
Definition: XrdClientMessage.hh:91
int HeaderStatus()
Definition: XrdClientMessage.hh:85
bool fAllocated
Definition: XrdClientMessage.hh:52
short fStatusCode
Definition: XrdClientMessage.hh:55
XrdClientMessage(ServerResponseHeader header)
int GetStatusCode()
Definition: XrdClientMessage.hh:83
bool MatchStreamid(short sid)
Definition: XrdClientMessage.hh:95
void SetStatusCode(kXR_unt16 status)
Definition: XrdClientMessage.hh:99
static void Int2CharStreamid(kXR_char *charstreamid, short intstreamid)
bool IsMarshalled()
Definition: XrdClientMessage.hh:93
bool IsAttn()
Definition: XrdClientMessage.hh:89
void * DonateData()
ServerResponseHeader fHdr
Definition: XrdClientMessage.hh:70
int DataLen()
Definition: XrdClientMessage.hh:79
void * GetData()
Definition: XrdClientMessage.hh:82
bool fMarshalled
Definition: XrdClientMessage.hh:54
void SetMarshalled(bool m)
Definition: XrdClientMessage.hh:98
int ReadRaw(XrdClientPhyConnection *phy)
kXR_unt16 HeaderSID()
Definition: XrdClientMessage.hh:87
void SetHeaderStatus(kXR_unt16 sts)
Definition: XrdClientMessage.hh:97
void * fData
Definition: XrdClientMessage.hh:53
Definition: XrdClientPhyConnection.hh:69
Definition: XrdSysPthread.hh:240
Definition: XProtocol.hh:711
kXR_unt16 status
Definition: XProtocol.hh:713
kXR_char streamid[2]
Definition: XProtocol.hh:712
kXR_int32 dlen
Definition: XProtocol.hh:714