GDAL

- Main Page
- Related Pages
- Classes
- Files

- File List
- File Members

cpl_http.h
Go to the documentation of this file.
1 /******************************************************************************
2 * $Id: cpl_http.h 33666 2016-03-07 05:21:07Z goatbar $
3 *
4 * Project: Common Portability Library
5 * Purpose: Function wrapper for libcurl HTTP access.
6 * Author: Frank Warmerdam, warmerdam@pobox.com
7 *
8 ******************************************************************************
9 * Copyright (c) 2006, Frank Warmerdam
10 * Copyright (c) 2009, Even Rouault <even dot rouault at mines-paris dot org>
11 *
12 * Permission is hereby granted, free of charge, to any person obtaining a
13 * copy of this software and associated documentation files (the "Software"),
14 * to deal in the Software without restriction, including without limitation
15 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16 * and/or sell copies of the Software, and to permit persons to whom the
17 * Software is furnished to do so, subject to the following conditions:
18 *
19 * The above copyright notice and this permission notice shall be included
20 * in all copies or substantial portions of the Software.
21 *
22 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
23 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
25 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
28 * DEALINGS IN THE SOFTWARE.
29 ****************************************************************************/
30
31 #ifndef CPL_HTTP_H_INCLUDED
32 #define CPL_HTTP_H_INCLUDED
33
34 #include "cpl_conv.h"
35 #include "cpl_string.h"
36 #include "cpl_vsi.h"
37
44 CPL_C_START
45
47 typedef struct { char **papszHeaders;
49 GByte *pabyData; int nDataLen;
52 } CPLMimePart;
53
55 typedef struct {
57 int nStatus;
58
60 char *pszContentType;
61
63 char *pszErrBuf;
64
66 int nDataLen;
67 int nDataAlloc;
68
70 GByte *pabyData;
71
73 char **papszHeaders;
74
76 int nMimePartCount;
77
79 CPLMimePart *pasMimePart;
80
81 } CPLHTTPResult;
82
83 int CPL_DLL CPLHTTPEnabled( void );
84 CPLHTTPResult CPL_DLL *CPLHTTPFetch( const char *pszURL, char **papszOptions);
85 void CPL_DLL CPLHTTPCleanup( void );
86 void CPL_DLL CPLHTTPDestroyResult( CPLHTTPResult *psResult );
87 int CPL_DLL CPLHTTPParseMultipartMime( CPLHTTPResult *psResult );
88
89 /* -------------------------------------------------------------------- */
90 /* The following is related to OAuth2 authorization around */
91 /* google services like fusion tables, and potentially others */
92 /* in the future. Code in cpl_google_oauth2.cpp. */
93 /* */
94 /* These services are built on CPL HTTP services. */
95 /* -------------------------------------------------------------------- */
96
97 char CPL_DLL *GOA2GetAuthorizationURL( const char *pszScope );
98 char CPL_DLL *GOA2GetRefreshToken( const char *pszAuthToken,
99 const char *pszScope );
100 char CPL_DLL *GOA2GetAccessToken( const char *pszRefreshToken,
101 const char *pszScope );
102
103 CPL_C_END
104
105 #endif /* ndef CPL_HTTP_H_INCLUDED */
CPLHTTPResult::pasMimePart
CPLMimePart * pasMimePart
Definition: cpl_http.h:79
cpl_vsi.h
Standard C Covers.
CPLHTTPCleanup
void CPLHTTPCleanup(void)
Cleanup function to call at application termination.
Definition: cpl_http.cpp:698
CPLHTTPResult::pszContentType
char * pszContentType
Definition: cpl_http.h:60
CPLHTTPParseMultipartMime
int CPLHTTPParseMultipartMime(CPLHTTPResult *psResult)
Parses a MIME multipart message.
Definition: cpl_http.cpp:765
CPLHTTPDestroyResult
void CPLHTTPDestroyResult(CPLHTTPResult *psResult)
Clean the memory associated with the return value of CPLHTTPFetch()
Definition: cpl_http.cpp:732
CPLHTTPResult::papszHeaders
char ** papszHeaders
Definition: cpl_http.h:73
GOA2GetAccessToken
char * GOA2GetAccessToken(const char *pszRefreshToken, const char *pszScope)
Fetch access token using refresh token.
Definition: cpl_google_oauth2.cpp:273
cpl_string.h
Various convenience functions for working with strings and string lists.
CPLHTTPEnabled
int CPLHTTPEnabled(void)
Return if CPLHTTP services can be useful.
Definition: cpl_http.cpp:681
CPLHTTPResult::nMimePartCount
int nMimePartCount
Definition: cpl_http.h:76
CPLHTTPFetch
CPLHTTPResult * CPLHTTPFetch(const char *pszURL, char **papszOptions)
Fetch a document from an url and return in a string.
Definition: cpl_http.cpp:163
CPLHTTPResult::nDataLen
int nDataLen
Definition: cpl_http.h:66
cpl_conv.h
Various convenience functions for CPL.
CPLHTTPResult
Definition: cpl_http.h:55
CPLHTTPResult::nStatus
int nStatus
Definition: cpl_http.h:57
CPLHTTPResult::pabyData
GByte * pabyData
Definition: cpl_http.h:70
CPLMimePart
Definition: cpl_http.h:47
CPLHTTPResult::pszErrBuf
char * pszErrBuf
Definition: cpl_http.h:63
GOA2GetRefreshToken
char * GOA2GetRefreshToken(const char *pszAuthToken, const char *pszScope)
Turn Auth Token into a Refresh Token.
Definition: cpl_google_oauth2.cpp:152
GOA2GetAuthorizationURL
char * GOA2GetAuthorizationURL(const char *pszScope)
Return authorization url for a given scope.
Definition: cpl_google_oauth2.cpp:117

Generated for GDAL by 1.8.8.