xrootd
XrdClientMessage.hh
Go to the documentation of this file.
1 
2 // //
3 // XrdClientMessage //
4 // //
5 // Author: Fabrizio Furano (INFN Padova, 2004) //
6 // Adapted from TXNetFile (root.cern.ch) originally done by //
7 // Alvise Dorigo, Fabrizio Furano //
8 // INFN Padova, 2003 //
9 // //
10 // A message coming from a physical connection. I.e. a server response //
11 // or some kind of error //
12 // //
14 
15 // $Id$
16 
17 #ifndef XRC_MESSAGE_H
18 #define XRC_MESSAGE_H
19 
22 #include "XrdSys/XrdSysPthread.hh"
23 
24 #ifndef WIN32
25 #include <netinet/in.h>
26 #endif
27 
29 
31 
32 private:
33  bool fAllocated;
34  void *fData;
36  short fStatusCode;
38 
39 public:
40 
41  static kXR_unt16 CharStreamid2Int(kXR_char *charstreamid);
42  static void Int2CharStreamid(kXR_char *charstreamid, short intstreamid);
43 
44  enum EXrdMSCStatus { // Some status codes useful
49  };
50 
52 
55 
57 
58  bool CreateData();
59 
60  inline int DataLen() { return fHdr.dlen; }
61 
62  void *DonateData();
63  inline void *GetData() {return fData;}
64  inline int GetStatusCode() { return fStatusCode; }
65 
66  inline int HeaderStatus() { return fHdr.status; }
67 
69 
70  bool IsAttn() { return (HeaderStatus() == kXR_attn); }
71 
72  inline bool IsError() { return (fStatusCode != kXrdMSC_ok); };
73 
74  inline bool IsMarshalled() { return fMarshalled; }
75  void Marshall();
76  inline bool MatchStreamid(short sid) { return (HeaderSID() == sid);}
78  inline void SetHeaderStatus(kXR_unt16 sts) { fHdr.status = sts; }
79  inline void SetMarshalled(bool m) { fMarshalled = m; }
80  inline void SetStatusCode(kXR_unt16 status) { fStatusCode = status; }
81  void Unmarshall();
82 
83 };
84 
85 #endif