xrootd
Main Page
Namespaces
Classes
Files
File List
File Members
src
XrdSut
XrdSutBuffer.hh
Go to the documentation of this file.
1
// $Id$
2
#ifndef __SUT_BUFFER_H__
3
#define __SUT_BUFFER_H__
4
/******************************************************************************/
5
/* */
6
/* X r d S u t B u f f e r . h h */
7
/* */
8
/* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */
9
/* All Rights Reserved. See XrdInfo.cc for complete License Terms */
10
/* Produced by Andrew Hanushevsky for Stanford University under contract */
11
/* DE-AC03-76-SFO0515 with the Department of Energy */
12
/******************************************************************************/
13
14
#ifndef __SUT_BUCKLIST_H__
15
#include <
XrdSut/XrdSutBuckList.hh
>
16
#endif
17
18
/******************************************************************************/
19
/* */
20
/* Buffer structure for managing exchanged buckets */
21
/* */
22
/******************************************************************************/
23
24
class
XrdOucString
;
25
26
class
XrdSutBuffer
{
27
28
private
:
29
30
XrdSutBuckList
fBuckets
;
31
XrdOucString
fOptions
;
32
XrdOucString
fProtocol
;
33
kXR_int32
fStep
;
34
35
public
:
36
XrdSutBuffer
(
const
char
*prot,
const
char
*
opts
= 0)
37
{
fOptions
=
opts
;
fProtocol
= prot;
fStep
= 0;}
38
XrdSutBuffer
(
const
char
*buffer,
kXR_int32
length);
39
40
virtual
~XrdSutBuffer
();
41
42
int
AddBucket
(
char
*bp=0,
int
sz=0,
int
ty=0)
43
{
XrdSutBucket
*b =
new
XrdSutBucket
(bp,sz,ty);
44
if
(b) {
fBuckets
.
PushBack
(b);
return
0;}
return
-1; }
45
int
AddBucket
(
XrdOucString
s,
int
ty=0)
46
{
XrdSutBucket
*b =
new
XrdSutBucket
(s,ty);
47
if
(b) {
fBuckets
.
PushBack
(b);
return
0;}
return
-1; }
48
int
AddBucket
(
XrdSutBucket
*b)
49
{
if
(b) {
fBuckets
.
PushBack
(b);
return
0;}
return
-1; }
50
51
int
UpdateBucket
(
const
char
*bp,
int
sz,
int
ty);
52
int
UpdateBucket
(
XrdOucString
s,
int
ty);
53
54
// Remove from the list, to avoid destroy by ~XrdSutBuffer
55
void
Remove
(
XrdSutBucket
*b) {
fBuckets
.
Remove
(b); }
56
57
void
Dump
(
const
char
*stepstr = 0);
58
void
Message
(
const
char
*prepose = 0);
59
int
Serialized
(
char
**buffer,
char
opt =
'n'
);
60
61
void
Deactivate
(
kXR_int32
type);
// Deactivate bucket (type=-1 for cleanup)
62
63
// To fill / access buckets containing 4-byte integers (status codes, versions ...)
64
kXR_int32
MarshalBucket
(
kXR_int32
type,
kXR_int32
code
);
65
kXR_int32
UnmarshalBucket
(
kXR_int32
type,
kXR_int32
&
code
);
66
67
XrdSutBucket
*
GetBucket
(
kXR_int32
type,
const
char
*tag = 0);
68
XrdSutBuckList
*
GetBuckList
()
const
{
return
(
XrdSutBuckList
*)&
fBuckets
; }
69
int
GetNBuckets
()
const
{
return
fBuckets
.
Size
(); }
70
const
char
*
GetOptions
()
const
{
return
fOptions
.
c_str
(); }
71
const
char
*
GetProtocol
()
const
{
return
fProtocol
.
c_str
(); }
72
int
GetStep
()
const
{
return
(
int
)
fStep
; }
73
void
SetStep
(
int
s) {
fStep
= (
kXR_int32
)s; }
74
void
IncrementStep
() {
fStep
++; }
75
};
76
77
#endif
78
Generated by
1.8.1.2