|
|
|||
File indexing completed on 2026-01-08 10:33:35
0001 #ifndef __XRDCKSASSIST_HH__ 0002 #define __XRDCKSASSIST_HH__ 0003 /******************************************************************************/ 0004 /* */ 0005 /* X r d C k s A s s i s t . h h */ 0006 /* */ 0007 /* (c) 2017 by the Board of Trustees of the Leland Stanford, Jr., University */ 0008 /* All Rights Reserved */ 0009 /* Produced by Andrew Hanushevsky for Stanford University under contract */ 0010 /* DE-AC02-76-SFO0515 with the Department of Energy */ 0011 /* */ 0012 /* This file is part of the XRootD software suite. */ 0013 /* */ 0014 /* XRootD is free software: you can redistribute it and/or modify it under */ 0015 /* the terms of the GNU Lesser General Public License as published by the */ 0016 /* Free Software Foundation, either version 3 of the License, or (at your */ 0017 /* option) any later version. */ 0018 /* */ 0019 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */ 0020 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ 0021 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ 0022 /* License for more details. */ 0023 /* */ 0024 /* You should have received a copy of the GNU Lesser General Public License */ 0025 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ 0026 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */ 0027 /* */ 0028 /* The copyright holder's institutional names and contributor's names may not */ 0029 /* be used to endorse or promote products derived from this software without */ 0030 /* specific prior written permission of the institution or contributor. */ 0031 /******************************************************************************/ 0032 0033 #include <string> 0034 #include <vector> 0035 0036 #include <time.h> 0037 0038 //------------------------------------------------------------------------------ 0039 //! This header file defines linkages to various XRootD checksum assistants. 0040 //! The functions described here are located in libXrdUtils.so. 0041 //------------------------------------------------------------------------------ 0042 0043 //------------------------------------------------------------------------------ 0044 //! Generate the extended attribute data for a particular checksum that can 0045 //! be used to set the corresponding checksum attribute variable. 0046 //! 0047 //! @param cstype A null terminated string holding the checksum type 0048 //! (e.g. "adler32", "md5", "sha2", etc). 0049 //! @param csval A null terminated string holding the corresonding 0050 //! checksum value. This must be an ASCII hex representation 0051 //! of the value and must be of appropriate length. 0052 //! @param mtime The subject file's modification time. 0053 //! 0054 //! @return A vector of bytes that should be usedto set the attribute variable. 0055 //! If the size of the vector is zero, then the supplied parameters 0056 //! were incorrect and valid data cannot be generated; errno is: 0057 //! EINVAL - csval length is incorrect for checksum type or 0058 //! contains a non-hex digit. 0059 //! ENAMETOOLONG - checksum type is too long. 0060 //! EOVERFLOW - csval could not be represented in the data. 0061 //------------------------------------------------------------------------------ 0062 0063 extern std::vector<char> XrdCksAttrData(const char *cstype, 0064 const char *csval, time_t mtime); 0065 0066 //------------------------------------------------------------------------------ 0067 //! Generate the extended attribute variable name for a particular checksum. 0068 //! 0069 //! @param cstype A null terminated string holding the checksum type 0070 //! (e.g. "adler32", "md5", "sha2", etc). 0071 //! @param nspfx Is the namespace prefix to add to the variable name. 0072 //! By default no prefix os used. Certain platforms and/or 0073 //! filesystems require that user attributes start with a 0074 //! particular prefix (e.g. Linux requires 'user.') others 0075 //! do not. If your are going to use the variable name to get 0076 //! or set an attribute you should specify any required 0077 //! prefix. If specified and it does not end with a dot, a 0078 //! dot is automatically added to the nspfx. 0079 //! 0080 //! @return A string holding the variable name that should be used to get or 0081 //! set the extended attribute holding the correspnding checksum. If 0082 //! a null string is returned, the variable could not be generated; 0083 //! errno is set to: 0084 //! ENAMETOOLONG - checksum type is too long. 0085 //------------------------------------------------------------------------------ 0086 0087 extern std::string XrdCksAttrName(const char *cstype, const char *nspfx=""); 0088 0089 //------------------------------------------------------------------------------ 0090 //! Extract th checksum value from checksum extended attribute data. 0091 //! 0092 //! @param cstype A null terminated string holding the checksum type 0093 //! (e.g. "adler32", "md5", "sha2", etc). 0094 //! @param csbuff A pointer to a buffer hlding the checksum data. 0095 //! @param csblen The length of the checksum data (i.e. the length of the 0096 //! retrieved extended attribute). 0097 //! 0098 //! @return A string holding the ASCII hexstring correspoding to the checksum 0099 //! value. If a null string is returned then the checksum data was 0100 //! invalid or did not correspond to the specified checksum type, the 0101 //! errno is set to: 0102 //! EINVAL - the checksum length in csbuff is incorrect. 0103 //! EMSGSIZE - csblen was not the expected value. 0104 //! ENOENT - the specified cstype did not match the one in csbuff. 0105 //! EOVERFLOW - checksum value could not be generated from csbuff. 0106 //------------------------------------------------------------------------------ 0107 0108 extern std::string XrdCksAttrValue(const char *cstype, 0109 const char *csbuff, int csblen); 0110 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|