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
30#include "XrdSys/XrdSysError.hh"
31
34
35//
36// For error logging and tracing
38static XrdSysError eDest(0,"crypto_");
40//
41// Time Zone correction (wrt UTC)
42static time_t TZCorr = 0;
43static 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//______________________________________________________________________________
50{
51 // Set trace flags according to 'trace'
52
53 //
54 // Initiate error logging and tracing
55 eDest.logger(&Logger);
56 if (!cryptoTrace)
58 if (cryptoTrace) {
59 // Set debug mask
60 cryptoTrace->What = 0;
61 // Low level only
62 if ((trace & cryptoTRACE_Notify))
64 // Medium level
65 if ((trace & cryptoTRACE_Debug))
67 // High level
68 if ((trace & cryptoTRACE_Dump))
70 }
71}
72
73/******************************************************************************/
74/* X r d C r y p t o T i m e G m */
75/******************************************************************************/
76//______________________________________________________________________________
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, &ltn) != 0 && gmtime_r(&now, &gtn) != 0) {
86 TZCorr = time_t(difftime(mktime(&ltn), mktime(&gtn)));
87 TZInitialized = 1;
88 }
89 }
90 // Done
91 return TZCorr;
92}
int kXR_int32
Definition XPtypes.hh:89
void XrdCryptoSetTrace(kXR_int32 trace)
time_t XrdCryptoTZCorr()
XrdOucTrace * cryptoTrace
static time_t TZCorr
static bool TZInitialized
static XrdSysLogger Logger
static XrdSysError eDest(0,"crypto_")
#define cryptoTRACE_Notify
#define cryptoTRACE_Dump
#define cryptoTRACE_Debug
#define cryptoTRACE_ALL