xrootd
Loading...
Searching...
No Matches
XrdSutBuffer.hh
Go to the documentation of this file.
1#ifndef __SUT_BUFFER_H__
2#define __SUT_BUFFER_H__
3/******************************************************************************/
4/* */
5/* X r d S u t B u f f e r . h h */
6/* */
7/* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */
8/* Produced by Geri Ganis for CERN */
9/* */
10/* This file is part of the XRootD software suite. */
11/* */
12/* XRootD is free software: you can redistribute it and/or modify it under */
13/* the terms of the GNU Lesser General Public License as published by the */
14/* Free Software Foundation, either version 3 of the License, or (at your */
15/* option) any later version. */
16/* */
17/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
18/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
19/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
20/* License for more details. */
21/* */
22/* You should have received a copy of the GNU Lesser General Public License */
23/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
24/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
25/* */
26/* The copyright holder's institutional names and contributor's names may not */
27/* be used to endorse or promote products derived from this software without */
28/* specific prior written permission of the institution or contributor. */
29/******************************************************************************/
30
31#ifndef __SUT_BUCKLIST_H__
33#endif
34
35/******************************************************************************/
36/* */
37/* Buffer structure for managing exchanged buckets */
38/* */
39/******************************************************************************/
40
41class XrdOucString;
42
44
45private:
46
51
52public:
53 XrdSutBuffer(const char *prot, const char *opts = 0)
54 {fOptions = opts; fProtocol = prot; fStep = 0;}
55 XrdSutBuffer(const char *buffer, kXR_int32 length);
56
57 virtual ~XrdSutBuffer();
58
59 int AddBucket(char *bp=0, int sz=0, int ty=0)
60 { XrdSutBucket *b = new XrdSutBucket(bp,sz,ty);
61 if (b) { fBuckets.PushBack(b); return 0;} return -1; }
62 int AddBucket(XrdOucString s, int ty=0)
63 { XrdSutBucket *b = new XrdSutBucket(s,ty);
64 if (b) { fBuckets.PushBack(b); return 0;} return -1; }
66 { if (b) { fBuckets.PushBack(b); return 0;} return -1; }
67
68 int UpdateBucket(const char *bp, int sz, int ty);
69 int UpdateBucket(XrdOucString s, int ty);
70
71 // Remove from the list, to avoid destroy by ~XrdSutBuffer
73
74 void Dump(const char *stepstr = 0, bool all = false);
75 void Message(const char *prepose = 0);
76 int Serialized(char **buffer, char opt = 'n');
77
78 void Deactivate(kXR_int32 type); // Deactivate bucket (type=-1 for cleanup)
79
80 // To fill / access buckets containing 4-byte integers (status codes, versions ...)
83
84 XrdSutBucket *GetBucket(kXR_int32 type, const char *tag = 0);
86 int GetNBuckets() const { return fBuckets.Size(); }
87 const char *GetOptions() const { return fOptions.c_str(); }
88 const char *GetProtocol() const { return fProtocol.c_str(); }
89 int GetStep() const { return (int)fStep; }
90 void SetStep(int s) { fStep = (kXR_int32)s; }
91 void IncrementStep() { fStep++; }
92};
93
94#endif
95
int kXR_int32
Definition XPtypes.hh:89
Definition XrdOucString.hh:254
const char * c_str() const
Definition XrdOucString.hh:280
Definition XrdSutBuckList.hh:61
void Remove(XrdSutBucket *b)
void PushBack(XrdSutBucket *b)
int Size() const
Definition XrdSutBuckList.hh:77
Definition XrdSutBucket.hh:44
Definition XrdSutBuffer.hh:43
int AddBucket(char *bp=0, int sz=0, int ty=0)
Definition XrdSutBuffer.hh:59
int UpdateBucket(const char *bp, int sz, int ty)
kXR_int32 fStep
Definition XrdSutBuffer.hh:50
void Message(const char *prepose=0)
int AddBucket(XrdOucString s, int ty=0)
Definition XrdSutBuffer.hh:62
int Serialized(char **buffer, char opt='n')
int GetNBuckets() const
Definition XrdSutBuffer.hh:86
virtual ~XrdSutBuffer()
void SetStep(int s)
Definition XrdSutBuffer.hh:90
XrdSutBuffer(const char *prot, const char *opts=0)
Definition XrdSutBuffer.hh:53
const char * GetProtocol() const
Definition XrdSutBuffer.hh:88
XrdOucString fProtocol
Definition XrdSutBuffer.hh:49
XrdSutBuckList * GetBuckList() const
Definition XrdSutBuffer.hh:85
void IncrementStep()
Definition XrdSutBuffer.hh:91
void Dump(const char *stepstr=0, bool all=false)
int UpdateBucket(XrdOucString s, int ty)
XrdSutBuffer(const char *buffer, kXR_int32 length)
const char * GetOptions() const
Definition XrdSutBuffer.hh:87
XrdOucString fOptions
Definition XrdSutBuffer.hh:48
XrdSutBuckList fBuckets
Definition XrdSutBuffer.hh:47
int GetStep() const
Definition XrdSutBuffer.hh:89
int AddBucket(XrdSutBucket *b)
Definition XrdSutBuffer.hh:65
XrdSutBucket * GetBucket(kXR_int32 type, const char *tag=0)
kXR_int32 MarshalBucket(kXR_int32 type, kXR_int32 code)
void Remove(XrdSutBucket *b)
Definition XrdSutBuffer.hh:72
void Deactivate(kXR_int32 type)
kXR_int32 UnmarshalBucket(kXR_int32 type, kXR_int32 &code)