2005-02-11 19:05:13 +01:00
|
|
|
/* curl-shim.h
|
2009-05-28 18:20:49 +02:00
|
|
|
* Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
|
2005-02-11 19:05:13 +01:00
|
|
|
*
|
|
|
|
* This file is part of GNUPG.
|
|
|
|
*
|
|
|
|
* GNUPG is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
2007-07-04 21:49:40 +02:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2005-02-11 19:05:13 +01:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* GNUPG is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2007-07-04 21:49:40 +02:00
|
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
2005-02-11 19:05:13 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _CURL_SHIM_H_
|
|
|
|
#define _CURL_SHIM_H_
|
|
|
|
|
2009-05-28 18:20:49 +02:00
|
|
|
#include "util.h"
|
2005-02-11 19:05:13 +01:00
|
|
|
#include "http.h"
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
CURLE_OK=0,
|
2005-07-20 23:48:28 +02:00
|
|
|
CURLE_UNSUPPORTED_PROTOCOL=1,
|
2005-04-17 03:39:24 +02:00
|
|
|
CURLE_COULDNT_CONNECT=7,
|
|
|
|
CURLE_FTP_COULDNT_RETR_FILE=19,
|
|
|
|
CURLE_HTTP_RETURNED_ERROR=22,
|
|
|
|
CURLE_WRITE_ERROR=23
|
2005-02-11 19:05:13 +01:00
|
|
|
} CURLcode;
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
CURLOPT_URL,
|
2005-06-23 06:44:20 +02:00
|
|
|
CURLOPT_USERPWD,
|
2005-02-11 19:05:13 +01:00
|
|
|
CURLOPT_WRITEFUNCTION,
|
|
|
|
CURLOPT_FILE,
|
|
|
|
CURLOPT_ERRORBUFFER,
|
|
|
|
CURLOPT_FOLLOWLOCATION,
|
|
|
|
CURLOPT_MAXREDIRS,
|
|
|
|
CURLOPT_STDERR,
|
|
|
|
CURLOPT_VERBOSE,
|
|
|
|
CURLOPT_SSL_VERIFYPEER,
|
2005-02-12 04:15:02 +01:00
|
|
|
CURLOPT_PROXY,
|
2005-04-17 03:39:24 +02:00
|
|
|
CURLOPT_CAINFO,
|
|
|
|
CURLOPT_POST,
|
|
|
|
CURLOPT_POSTFIELDS,
|
2009-05-28 06:25:25 +02:00
|
|
|
CURLOPT_FAILONERROR,
|
2009-05-28 18:20:49 +02:00
|
|
|
CURLOPT_HTTPHEADER,
|
2009-05-28 06:25:25 +02:00
|
|
|
CURLOPT_SRVTAG_GPG_HACK
|
2005-02-11 19:05:13 +01:00
|
|
|
} CURLoption;
|
|
|
|
|
|
|
|
typedef size_t (*write_func)(char *buffer,size_t size,
|
|
|
|
size_t nitems,void *outstream);
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
char *url;
|
2005-06-23 06:44:20 +02:00
|
|
|
char *auth;
|
2005-02-11 19:05:13 +01:00
|
|
|
char *errorbuffer;
|
|
|
|
char *proxy;
|
|
|
|
write_func writer;
|
|
|
|
void *file;
|
2005-04-17 03:39:24 +02:00
|
|
|
char *postfields;
|
2009-05-28 06:25:25 +02:00
|
|
|
char *srvtag;
|
2005-04-17 03:39:24 +02:00
|
|
|
unsigned int status;
|
2006-02-22 03:11:35 +01:00
|
|
|
FILE *errors;
|
2009-05-28 18:20:49 +02:00
|
|
|
struct curl_slist *headers;
|
2005-04-17 03:39:24 +02:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
unsigned int post:1;
|
|
|
|
unsigned int failonerror:1;
|
2006-02-21 17:16:09 +01:00
|
|
|
unsigned int verbose:1;
|
2005-04-17 03:39:24 +02:00
|
|
|
} flags;
|
2006-08-16 12:47:53 +02:00
|
|
|
http_t hd;
|
2005-02-11 19:05:13 +01:00
|
|
|
} CURL;
|
|
|
|
|
2007-03-14 05:24:55 +01:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
const char **protocols;
|
2013-11-18 14:09:47 +01:00
|
|
|
} curl_version_info_data;
|
2007-03-14 05:24:55 +01:00
|
|
|
|
2005-02-11 19:05:13 +01:00
|
|
|
#define CURL_ERROR_SIZE 256
|
|
|
|
#define CURL_GLOBAL_DEFAULT 0
|
2007-03-14 05:24:55 +01:00
|
|
|
#define CURLVERSION_NOW 0
|
2005-02-11 19:05:13 +01:00
|
|
|
|
|
|
|
CURLcode curl_global_init(long flags);
|
|
|
|
void curl_global_cleanup(void);
|
|
|
|
CURL *curl_easy_init(void);
|
|
|
|
CURLcode curl_easy_setopt(CURL *curl,CURLoption option,...);
|
|
|
|
CURLcode curl_easy_perform(CURL *curl);
|
|
|
|
void curl_easy_cleanup(CURL *curl);
|
2005-04-17 00:21:28 +02:00
|
|
|
char *curl_escape(char *str,int len);
|
2007-03-14 05:24:55 +01:00
|
|
|
#define curl_free(x) free(x)
|
2013-11-18 14:09:47 +01:00
|
|
|
#define curl_version() GNUPG_NAME" curl-shim"
|
2007-03-14 05:24:55 +01:00
|
|
|
curl_version_info_data *curl_version_info(int type);
|
2005-02-11 19:05:13 +01:00
|
|
|
|
2009-05-28 18:20:49 +02:00
|
|
|
struct curl_slist
|
|
|
|
{
|
|
|
|
strlist_t list;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct curl_slist *curl_slist_append(struct curl_slist *list,
|
|
|
|
const char *string);
|
|
|
|
void curl_slist_free_all(struct curl_slist *list);
|
|
|
|
|
2005-02-11 19:05:13 +01:00
|
|
|
#endif /* !_CURL_SHIM_H_ */
|