ROOT  6.06/09
Reference Guide
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 
33 //////////////////////////////////////////////////////////////////////////
34 // //
35 // A message coming from a physical connection. I.e. a server response //
36 // or some kind of error //
37 // //
38 //////////////////////////////////////////////////////////////////////////
39 
40 #include "XProtocol/XProtocol.hh"
41 #include "XrdSys/XrdSysPthread.hh"
42 
43 #ifndef WIN32
44 #include <netinet/in.h>
45 #endif
46 
48 
50 
51 private:
52  bool fAllocated;
53  void *fData;
55  short fStatusCode;
57 
58 public:
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 
70  ServerResponseHeader fHdr;
71 
72  XrdClientMessage(ServerResponseHeader header);
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 
87  inline kXR_unt16 HeaderSID() { return CharStreamid2Int(fHdr.streamid); }
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; }
100  void Unmarshall();
101 
102 };
103 #endif
void SetStatusCode(kXR_unt16 status)
XrdSysRecMutex fMultireadMutex
#define XrdSysRecMutex
Definition: XrdSysToOuc.h:18
ServerResponseHeader fHdr
TAlienJobStatus * status
Definition: TAlienJob.cxx:51
static kXR_unt16 CharStreamid2Int(kXR_char *charstreamid)
int ReadRaw(XrdClientPhyConnection *phy)
void * DonateData()
static void Int2CharStreamid(kXR_char *charstreamid, short intstreamid)
kXR_unt16 HeaderSID()
TMarker * m
Definition: textangle.C:8
void SetMarshalled(bool m)
void SetHeaderStatus(kXR_unt16 sts)
bool MatchStreamid(short sid)