XRootD
Loading...
Searching...
No Matches
XrdCryptoAux.cc
Go to the documentation of this file.
1
/******************************************************************************/
2
/* */
3
/* X r d C r y p t o A u x . c c */
4
/* */
5
/* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */
6
/* Produced by Geri Ganis for CERN */
7
/* */
8
/* This file is part of the XRootD software suite. */
9
/* */
10
/* XRootD is free software: you can redistribute it and/or modify it under */
11
/* the terms of the GNU Lesser General Public License as published by the */
12
/* Free Software Foundation, either version 3 of the License, or (at your */
13
/* option) any later version. */
14
/* */
15
/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
16
/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
17
/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
18
/* License for more details. */
19
/* */
20
/* You should have received a copy of the GNU Lesser General Public License */
21
/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
22
/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
23
/* */
24
/* The copyright holder's institutional names and contributor's names may not */
25
/* be used to endorse or promote products derived from this software without */
26
/* specific prior written permission of the institution or contributor. */
27
/******************************************************************************/
28
29
#include "
XrdSys/XrdSysLogger.hh
"
30
#include "
XrdSys/XrdSysError.hh
"
31
32
#include "
XrdCrypto/XrdCryptoAux.hh
"
33
#include "
XrdCrypto/XrdCryptoTrace.hh
"
34
35
//
36
// For error logging and tracing
37
static
XrdSysLogger
Logger
;
38
static
XrdSysError
eDest
(0,
"crypto_"
);
39
XrdOucTrace
*
cryptoTrace
= 0;
40
//
41
// Time Zone correction (wrt UTC)
42
static
time_t
TZCorr
= 0;
43
static
bool
TZInitialized
= 0;
44
45
/******************************************************************************/
46
/* X r d C r y p t o S e t T r a c e */
47
/******************************************************************************/
48
//______________________________________________________________________________
49
void
XrdCryptoSetTrace
(
kXR_int32
trace)
50
{
51
// Set trace flags according to 'trace'
52
53
//
54
// Initiate error logging and tracing
55
eDest
.
logger
(&
Logger
);
56
if
(!
cryptoTrace
)
57
cryptoTrace
=
new
XrdOucTrace
(&
eDest
);
58
if
(
cryptoTrace
) {
59
// Set debug mask
60
cryptoTrace
->
What
= 0;
61
// Low level only
62
if
((trace &
cryptoTRACE_Notify
))
63
cryptoTrace
->
What
|=
cryptoTRACE_Notify
;
64
// Medium level
65
if
((trace &
cryptoTRACE_Debug
))
66
cryptoTrace
->
What
|= (
cryptoTRACE_Notify
|
cryptoTRACE_Debug
);
67
// High level
68
if
((trace &
cryptoTRACE_Dump
))
69
cryptoTrace
->
What
|=
cryptoTRACE_ALL
;
70
}
71
}
72
73
/******************************************************************************/
74
/* X r d C r y p t o T i m e G m */
75
/******************************************************************************/
76
//______________________________________________________________________________
77
time_t
XrdCryptoTZCorr
()
78
{
79
// Time Zone correction (wrt UTC)
80
// Assumes no DST, the correction is not expected to change during the year
81
82
if
(!
TZInitialized
) {
83
time_t now = time(0);
84
struct
tm ltn, gtn;
85
if
(localtime_r(&now, <n) != 0 && gmtime_r(&now, >n) != 0) {
86
TZCorr
= time_t(difftime(mktime(<n), mktime(>n)));
87
TZInitialized
= 1;
88
}
89
}
90
// Done
91
return
TZCorr
;
92
}
kXR_int32
int kXR_int32
Definition
XPtypes.hh:89
XrdCryptoSetTrace
void XrdCryptoSetTrace(kXR_int32 trace)
Definition
XrdCryptoAux.cc:49
XrdCryptoTZCorr
time_t XrdCryptoTZCorr()
Definition
XrdCryptoAux.cc:77
cryptoTrace
XrdOucTrace * cryptoTrace
Definition
XrdCryptoAux.cc:39
TZCorr
static time_t TZCorr
Definition
XrdCryptoAux.cc:42
TZInitialized
static bool TZInitialized
Definition
XrdCryptoAux.cc:43
Logger
static XrdSysLogger Logger
Definition
XrdCryptoAux.cc:37
eDest
static XrdSysError eDest(0,"crypto_")
XrdCryptoAux.hh
cryptoTRACE_Notify
#define cryptoTRACE_Notify
Definition
XrdCryptoAux.hh:49
cryptoTRACE_Dump
#define cryptoTRACE_Dump
Definition
XrdCryptoAux.hh:47
cryptoTRACE_Debug
#define cryptoTRACE_Debug
Definition
XrdCryptoAux.hh:48
cryptoTRACE_ALL
#define cryptoTRACE_ALL
Definition
XrdCryptoAux.hh:46
XrdCryptoTrace.hh
XrdSysError.hh
XrdSysLogger.hh
XrdOucTrace
Definition
XrdOucTrace.hh:36
XrdOucTrace::What
int What
Definition
XrdOucTrace.hh:46
XrdSysError
Definition
XrdSysError.hh:90
XrdSysError::logger
XrdSysLogger * logger(XrdSysLogger *lp=0)
Definition
XrdSysError.hh:141
XrdSysLogger
Definition
XrdSysLogger.hh:53
XrdCrypto
XrdCryptoAux.cc
Generated by
1.12.0