GDAL
|
00001 /****************************************************************************** 00002 * $Id: cpl_http.h 27044 2014-03-16 23:41:27Z 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; 00067 int nDataAlloc; 00068 00070 GByte *pabyData; 00071 00073 char **papszHeaders; 00074 00076 int nMimePartCount; 00077 00079 CPLMimePart *pasMimePart; 00080 00081 } CPLHTTPResult; 00082 00083 int CPL_DLL CPLHTTPEnabled( void ); 00084 CPLHTTPResult CPL_DLL *CPLHTTPFetch( const char *pszURL, char **papszOptions); 00085 void CPL_DLL CPLHTTPCleanup( void ); 00086 void CPL_DLL CPLHTTPDestroyResult( CPLHTTPResult *psResult ); 00087 int CPL_DLL CPLHTTPParseMultipartMime( CPLHTTPResult *psResult ); 00088 00089 /* -------------------------------------------------------------------- */ 00090 /* The following is related to OAuth2 authorization around */ 00091 /* google services like fusion tables, and potentially others */ 00092 /* in the future. Code in cpl_google_oauth2.cpp. */ 00093 /* */ 00094 /* These services are built on CPL HTTP services. */ 00095 /* -------------------------------------------------------------------- */ 00096 00097 char CPL_DLL *GOA2GetAuthorizationURL( const char *pszScope ); 00098 char CPL_DLL *GOA2GetRefreshToken( const char *pszAuthToken, 00099 const char *pszScope ); 00100 char CPL_DLL *GOA2GetAccessToken( const char *pszRefreshToken, 00101 const char *pszScope ); 00102 00103 CPL_C_END 00104 00105 #endif /* ndef CPL_HTTP_H_INCLUDED */