Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:04:12

0001 /*
0002  * This File is part of Davix, The IO library for HTTP based protocols
0003  * Copyright (C) CERN 2013
0004  * Author: Adrien Devresse <adrien.devresse@cern.ch>
0005  *
0006  * This library is free software; you can redistribute it and/or
0007  * modify it under the terms of the GNU Lesser General Public
0008  * License as published by the Free Software Foundation; either
0009  * version 2.1 of the License, or (at your option) any later version.
0010  *
0011  * This library is distributed in the hope that it will be useful,
0012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0014  * Lesser General Public License for more details.
0015  *
0016  * You should have received a copy of the GNU Lesser General Public
0017  * License along with this library; if not, write to the Free Software
0018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
0019  *
0020 */
0021 
0022 #ifndef DAVIX_S3_UTILS_HPP
0023 #define DAVIX_S3_UTILS_HPP
0024 
0025 #include <params/davixrequestparams.hpp>
0026 
0027 namespace Davix{
0028 
0029 namespace S3{
0030 
0031 Uri signURIv4(const RequestParams & params, const std::string & method, const Uri & url, const HeaderVec headers, const time_t expirationTime);
0032 Uri signURI(const RequestParams & params, const std::string & method, const Uri & url, HeaderVec headers, const time_t expirationTime);
0033 
0034 void signRequest(const RequestParams & params, const std::string & method, const Uri & url, HeaderVec & headers);
0035 
0036 Uri tokenizeRequest(const RequestParams & params, const std::string & method, const Uri & url, HeaderVec & headers, time_t expirationTime);
0037 
0038 Uri s3UriTransformer(const Uri & original_url, const RequestParams & params, const bool addDelimiter);
0039 
0040 time_t s3TimeConverter(std::string &s3time);
0041 
0042 std::string hexPrinter(const unsigned char* data, dav_size_t nbytes);
0043 
0044 // MD5 from string
0045 int calculateMD5(std::string &input, std::string &output);
0046 
0047 // MD5 from fd
0048 int calculateMD5(int fd, std::string &output);
0049 
0050 // extract bucket and path information from a bucket
0051 std::string extract_s3_provider(const Uri & uri);
0052 std::string extract_s3_bucket(const Uri & uri, bool aws_alternate=false);
0053 std::string extract_s3_path(const Uri & uri, bool aws_alternate=false);
0054 
0055 std::string detect_region(const Uri &uri);
0056 
0057 } // S3
0058 
0059 
0060 } // Davix
0061 
0062 
0063 #endif // DAVIX_S3_UTILS_HPP