|
GDAL
|
00001 /****************************************************************************** 00002 * $Id: cpl_http.h 37645 2017-03-08 00:15:33Z rouault $ 00003 * 00004 * Project: Common Portability Library 00005 * Purpose: Function wrapper for libcurl HTTP access. 00006 * Author: Frank Warmerdam, warmerdam@pobox.com 00007 * 00008 ****************************************************************************** 00009 * Copyright (c) 2006, Frank Warmerdam 00010 * Copyright (c) 2009, Even Rouault <even dot rouault at mines-paris dot org> 00011 * 00012 * Permission is hereby granted, free of charge, to any person obtaining a 00013 * copy of this software and associated documentation files (the "Software"), 00014 * to deal in the Software without restriction, including without limitation 00015 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 00016 * and/or sell copies of the Software, and to permit persons to whom the 00017 * Software is furnished to do so, subject to the following conditions: 00018 * 00019 * The above copyright notice and this permission notice shall be included 00020 * in all copies or substantial portions of the Software. 00021 * 00022 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00023 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00024 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 00025 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00026 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 00027 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 00028 * DEALINGS IN THE SOFTWARE. 00029 ****************************************************************************/ 00030 00031 #ifndef CPL_HTTP_H_INCLUDED 00032 #define CPL_HTTP_H_INCLUDED 00033 00034 #include "cpl_conv.h" 00035 #include "cpl_string.h" 00036 #include "cpl_vsi.h" 00037 00044 CPL_C_START 00045 00047 typedef struct { char **papszHeaders; 00049 GByte *pabyData; int nDataLen; 00052 } CPLMimePart; 00053 00055 typedef struct { 00057 int nStatus; 00058 00060 char *pszContentType; 00061 00063 char *pszErrBuf; 00064 00066 int nDataLen; 00068 int nDataAlloc; 00069 00071 GByte *pabyData; 00072 00074 char **papszHeaders; 00075 00077 int nMimePartCount; 00078 00080 CPLMimePart *pasMimePart; 00081 00082 } CPLHTTPResult; 00083 00084 int CPL_DLL CPLHTTPEnabled( void ); 00085 CPLHTTPResult CPL_DLL *CPLHTTPFetch( const char *pszURL, char **papszOptions); 00086 void CPL_DLL CPLHTTPCleanup( void ); 00087 void CPL_DLL CPLHTTPDestroyResult( CPLHTTPResult *psResult ); 00088 int CPL_DLL CPLHTTPParseMultipartMime( CPLHTTPResult *psResult ); 00089 00090 /* -------------------------------------------------------------------- */ 00091 /* The following is related to OAuth2 authorization around */ 00092 /* google services like fusion tables, and potentially others */ 00093 /* in the future. Code in cpl_google_oauth2.cpp. */ 00094 /* */ 00095 /* These services are built on CPL HTTP services. */ 00096 /* -------------------------------------------------------------------- */ 00097 00098 char CPL_DLL *GOA2GetAuthorizationURL( const char *pszScope ); 00099 char CPL_DLL *GOA2GetRefreshToken( const char *pszAuthToken, 00100 const char *pszScope ); 00101 char CPL_DLL *GOA2GetAccessToken( const char *pszRefreshToken, 00102 const char *pszScope ); 00103 00104 CPL_C_END 00105 00106 #ifdef __cplusplus 00107 00108 // Not sure if this belong here, used in cpl_http.cpp, cpl_vsil_curl.cpp and frmts/wms/gdalhttp.cpp 00109 void* CPLHTTPSetOptions(void *pcurl, const char * const* papszOptions); 00110 char** CPLHTTPGetOptionsFromEnv(); 00112 #endif // __cplusplus 00113 00114 #endif /* ndef CPL_HTTP_H_INCLUDED */
1.7.6.1.