* http.h, http.c (send_request): Pass in srvtag and make its presence
[gnupg.git] / keyserver / curl-shim.h
1 /* curl-shim.h
2  * Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
3  *
4  * This file is part of GNUPG.
5  *
6  * GNUPG is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * GNUPG is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, see <http://www.gnu.org/licenses/>.
18  */
19
20 #ifndef _CURL_SHIM_H_
21 #define _CURL_SHIM_H_
22
23 #include "http.h"
24
25 typedef enum
26   {
27     CURLE_OK=0,
28     CURLE_UNSUPPORTED_PROTOCOL=1,
29     CURLE_COULDNT_CONNECT=7,
30     CURLE_FTP_COULDNT_RETR_FILE=19,
31     CURLE_HTTP_RETURNED_ERROR=22,
32     CURLE_WRITE_ERROR=23
33   } CURLcode;
34
35 typedef enum
36   {
37     CURLOPT_URL,
38     CURLOPT_USERPWD,
39     CURLOPT_WRITEFUNCTION,
40     CURLOPT_FILE,
41     CURLOPT_ERRORBUFFER,
42     CURLOPT_FOLLOWLOCATION,
43     CURLOPT_MAXREDIRS,
44     CURLOPT_STDERR,
45     CURLOPT_VERBOSE,
46     CURLOPT_SSL_VERIFYPEER,
47     CURLOPT_PROXY,
48     CURLOPT_CAINFO,
49     CURLOPT_POST,
50     CURLOPT_POSTFIELDS,
51     CURLOPT_FAILONERROR,
52     CURLOPT_SRVTAG_GPG_HACK
53   } CURLoption;
54
55 typedef size_t (*write_func)(char *buffer,size_t size,
56                              size_t nitems,void *outstream);
57
58 typedef struct
59 {
60   char *url;
61   char *auth;
62   char *errorbuffer;
63   char *proxy;
64   write_func writer;
65   void *file;
66   char *postfields;
67   char *srvtag;
68   unsigned int status;
69   FILE *errors;
70   struct
71   {
72     unsigned int post:1;
73     unsigned int failonerror:1;
74     unsigned int verbose:1;
75   } flags;
76   http_t hd;
77 } CURL;
78
79 typedef struct
80 {
81   const char **protocols;
82 } curl_version_info_data; 
83
84 #define CURL_ERROR_SIZE 256
85 #define CURL_GLOBAL_DEFAULT 0
86 #define CURLVERSION_NOW 0
87
88 CURLcode curl_global_init(long flags);
89 void curl_global_cleanup(void);
90 CURL *curl_easy_init(void);
91 CURLcode curl_easy_setopt(CURL *curl,CURLoption option,...);
92 CURLcode curl_easy_perform(CURL *curl);
93 void curl_easy_cleanup(CURL *curl);
94 char *curl_escape(char *str,int len);
95 #define curl_free(x) free(x)
96 #define curl_version() "GnuPG curl-shim"
97 curl_version_info_data *curl_version_info(int type);
98
99 #endif /* !_CURL_SHIM_H_ */