OGR
cpl_swift.h
1 /**********************************************************************
2  * Project: CPL - Common Portability Library
3  * Purpose: OpenStack Swift Object Storage routines
4  * Author: Even Rouault <even.rouault at spatialys.com>
5  *
6  **********************************************************************
7  * Copyright (c) 2018, Even Rouault <even.rouault at spatialys.com>
8  *
9  * Permission is hereby granted, free of charge, to any person obtaining a
10  * copy of this software and associated documentation files (the "Software"),
11  * to deal in the Software without restriction, including without limitation
12  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13  * and/or sell copies of the Software, and to permit persons to whom the
14  * Software is furnished to do so, subject to the following conditions:
15  *
16  * The above copyright notice and this permission notice shall be included
17  * in all copies or substantial portions of the Software.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25  * DEALINGS IN THE SOFTWARE.
26  ****************************************************************************/
27 
28 #ifndef CPL_SWIFT_INCLUDED_H
29 #define CPL_SWIFT_INCLUDED_H
30 
31 #ifndef DOXYGEN_SKIP
32 
33 #ifdef HAVE_CURL
34 
35 #include <curl/curl.h>
36 #include "cpl_http.h"
37 #include "cpl_aws.h"
38 #include <map>
39 
40 class VSISwiftHandleHelper final: public IVSIS3LikeHandleHelper
41 {
42  CPLString m_osURL;
43  CPLString m_osStorageURL;
44  CPLString m_osAuthToken;
45  CPLString m_osBucket;
46  CPLString m_osObjectKey;
47 
48  static bool GetConfiguration(CPLString& osStorageURL,
49  CPLString& osAuthToken);
50 
51  static CPLString BuildURL(const CPLString& osStorageURL,
52  const CPLString& osBucket,
53  const CPLString& osObjectKey);
54 
55  void RebuildURL() override;
56 
57  public:
58  VSISwiftHandleHelper(const CPLString& osStorageURL,
59  const CPLString& osAuthToken,
60  const CPLString& osBucket,
61  const CPLString& osObjectKey);
62  ~VSISwiftHandleHelper();
63 
64  static VSISwiftHandleHelper* BuildFromURI(const char* pszURI,
65  const char* pszFSPrefix);
66 
67  struct curl_slist* GetCurlHeaders(const CPLString& osVerbosVerb,
68  const struct curl_slist* psExistingHeaders,
69  const void *pabyDataContent = nullptr,
70  size_t nBytesContent = 0) const override;
71 
72  const CPLString& GetURL() const override { return m_osURL; }
73 
74  static void CleanMutex();
75  static void ClearCache();
76 };
77 
78 
79 #endif /* HAVE_CURL */
80 
81 #endif /* #ifndef DOXYGEN_SKIP */
82 
83 #endif /* CPL_SWIFT_INCLUDED_H */
CPLStrtodDelim
double CPLStrtodDelim(const char *, char **, char)
Definition: cpl_strtod.cpp:231
CPLHTTPFetch
CPLHTTPResult * CPLHTTPFetch(const char *pszURL, CSLConstList papszOptions)
Fetch a document from an url and return in a string.
Definition: cpl_http.cpp:648
CPLHTTPDestroyResult
void CPLHTTPDestroyResult(CPLHTTPResult *psResult)
Clean the memory associated with the return value of CPLHTTPFetch()
Definition: cpl_http.cpp:2080
CSLFetchNameValueDef
const char * CSLFetchNameValueDef(CSLConstList papszStrList, const char *pszName, const char *pszDefault)
Definition: cpl_string.cpp:1646
CSLSetNameValue
char ** CSLSetNameValue(char **papszStrList, const char *pszName, const char *pszValue)
Definition: cpl_string.cpp:1877
CPLString
Convenient string class based on std::string.
Definition: cpl_string.h:329
CPLAtofM
double CPLAtofM(const char *)
Definition: cpl_strtod.cpp:142
cpl_http.h
CPLHTTPResult
Definition: cpl_http.h:66
CPLHTTPResult::pabyData
GByte * pabyData
Definition: cpl_http.h:82
CPLDebug
void CPLDebug(const char *, const char *,...)
Definition: cpl_error.cpp:602
STARTS_WITH
#define STARTS_WITH(a, b)
Definition: cpl_port.h:578
CPLHTTPResult::papszHeaders
char ** papszHeaders
Definition: cpl_http.h:85
cpl_conv.h
CPLSPrintf
const char * CPLSPrintf(const char *fmt,...)
Definition: cpl_string.cpp:977
CPLStrtof
float CPLStrtof(const char *, char **)
Definition: cpl_strtod.cpp:397
CPLMutexHolder
Definition: cpl_multiproc.h:139
CSLDestroy
void CSLDestroy(char **papszStrList)
Definition: cpl_string.cpp:200
cpl_port.h
CPLStrdup
char * CPLStrdup(const char *)
Definition: cpl_conv.cpp:293
CPLAtof
double CPLAtof(const char *)
Definition: cpl_strtod.cpp:117
CPLStrtofDelim
float CPLStrtofDelim(const char *, char **, char)
Definition: cpl_strtod.cpp:347
CPLAtofDelim
double CPLAtofDelim(const char *, char)
Definition: cpl_strtod.cpp:73
CPLFree
#define CPLFree
Definition: cpl_conv.h:81
CPLStrtod
double CPLStrtod(const char *, char **)
Definition: cpl_strtod.cpp:321
CPLGetConfigOption
const char * CPLGetConfigOption(const char *, const char *)
Definition: cpl_conv.cpp:1692
STARTS_WITH_CI
#define STARTS_WITH_CI(a, b)
Definition: cpl_port.h:580

Generated for GDAL by doxygen 1.8.17.