2006-09-06 Marcus Brinkmann <marcus@g10code.de>
[gnupg.git] / keyserver / curl-shim.h
blobe942ec710872bc8f33aaaf30617597d0625fe48d
1 /* curl-shim.h
2 * Copyright (C) 2005, 2006 Free Software Foundation, Inc.
4 * This file is part of GNUPG.
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 2 of the License, or
9 * (at your option) any later version.
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.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
19 * USA.
22 #ifndef _CURL_SHIM_H_
23 #define _CURL_SHIM_H_
25 #include "http.h"
27 typedef enum
29 CURLE_OK=0,
30 CURLE_UNSUPPORTED_PROTOCOL=1,
31 CURLE_COULDNT_CONNECT=7,
32 CURLE_FTP_COULDNT_RETR_FILE=19,
33 CURLE_HTTP_RETURNED_ERROR=22,
34 CURLE_WRITE_ERROR=23
35 } CURLcode;
37 typedef enum
39 CURLOPT_URL,
40 CURLOPT_USERPWD,
41 CURLOPT_WRITEFUNCTION,
42 CURLOPT_FILE,
43 CURLOPT_ERRORBUFFER,
44 CURLOPT_FOLLOWLOCATION,
45 CURLOPT_MAXREDIRS,
46 CURLOPT_STDERR,
47 CURLOPT_VERBOSE,
48 CURLOPT_SSL_VERIFYPEER,
49 CURLOPT_PROXY,
50 CURLOPT_CAINFO,
51 CURLOPT_POST,
52 CURLOPT_POSTFIELDS,
53 CURLOPT_FAILONERROR
54 } CURLoption;
56 typedef size_t (*write_func)(char *buffer,size_t size,
57 size_t nitems,void *outstream);
59 typedef struct
61 char *url;
62 char *auth;
63 char *errorbuffer;
64 char *proxy;
65 write_func writer;
66 void *file;
67 char *postfields;
68 unsigned int status;
69 FILE *errors;
70 struct
72 unsigned int post:1;
73 unsigned int failonerror:1;
74 unsigned int verbose:1;
75 } flags;
76 http_t hd;
77 } CURL;
79 #define CURL_ERROR_SIZE 256
80 #define CURL_GLOBAL_DEFAULT 0
82 CURLcode curl_global_init(long flags);
83 void curl_global_cleanup(void);
84 CURL *curl_easy_init(void);
85 CURLcode curl_easy_setopt(CURL *curl,CURLoption option,...);
86 CURLcode curl_easy_perform(CURL *curl);
87 void curl_easy_cleanup(CURL *curl);
88 char *curl_escape(char *str,int len);
89 void curl_free(char *ptr);
90 #define curl_version() "GnuPG curl-shim "VERSION
92 #endif /* !_CURL_SHIM_H_ */