xrootd
Main Page
Namespaces
Classes
Files
File List
File Members
src
XrdCks
XrdCksXAttr.hh
Go to the documentation of this file.
1
#ifndef __XRDCKSXATTR_HH__
2
#define __XRDCKSXATTR_HH__
3
/******************************************************************************/
4
/* */
5
/* X r d C k s X A t t r . h h */
6
/* */
7
/* (c) 2011 by the Board of Trustees of the Leland Stanford, Jr., University */
8
/* All Rights Reserved */
9
/* Produced by Andrew Hanushevsky for Stanford University under contract */
10
/* DE-AC02-76-SFO0515 with the Department of Energy */
11
/******************************************************************************/
12
13
#include <sys/types.h>
14
#include <inttypes.h>
15
#include <netinet/in.h>
16
#include <sys/types.h>
17
18
#include "
XrdCks/XrdCksData.hh
"
19
#include "
XrdSys/XrdSysPlatform.hh
"
20
21
/* XrdCksXAttr encapsulates the extended attributes needed to save a checksum.
22
*/
23
24
class
XrdCksXAttr
25
{
26
public
:
27
28
XrdCksData
Cks
;
// Check sum information
29
30
/* postGet() will put fmTime and csTime in host byte order (see preSet()).
31
*/
32
int
postGet
(
int
Result)
33
{
if
(Result > 0)
34
{
Cks
.
fmTime
= ntohll(
Cks
.
fmTime
);
35
Cks
.
csTime
= ntohl (
Cks
.
csTime
);
36
}
37
return
Result;
38
}
39
40
/* preSet() will put fmTime and csTime in network byte order to allow the
41
attribute to be copied to different architectures and still work.
42
*/
43
XrdCksXAttr
*
preSet
(
XrdCksXAttr
&tmp)
44
{memcpy(&tmp.
Cks
, &
Cks
,
sizeof
(
Cks
));
45
tmp.
Cks
.
fmTime
= htonll(
Cks
.
fmTime
);
46
tmp.
Cks
.
csTime
= htonl (
Cks
.
csTime
);
47
return
&tmp;
48
}
49
50
/* Name() returns the extended attribute name for this object.
51
*/
52
const
char
*
Name
() {
if
(!(*
VarName
))
//01234567
53
{strcpy(
VarName
,
"XrdCks."
);
54
strcpy(
VarName
+7,
Cks
.
Name
);
55
}
56
return
VarName
;
57
}
58
59
/* sizeGet() and sizeSet() return the actual size of the object is used.
60
*/
61
int
sizeGet
() {
return
sizeof
(
Cks
);}
62
int
sizeSet
() {
return
sizeof
(
Cks
);}
63
64
XrdCksXAttr
() {*
VarName
= 0;}
65
~XrdCksXAttr
() {}
66
67
private
:
68
69
char
VarName
[
XrdCksData::NameSize
+8];
70
};
71
#endif
Generated by
1.8.1.2