2 * Copyright (C) 2004, 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,
26 #include <curl/curl.h>
28 #include "curl-shim.h"
31 /* MAX_LINE must be at least 1 larger than the largest item we expect
32 to receive, including the name tag ("COMMAND", "PORT", etc) and
33 space between. In practice, that means it should be
34 strlen("OPAQUE")+1+sizeof_opaque+1 */
35 #define MAX_LINE (6+1+1024+1)
38 #define MAX_OPTION 256
40 #define MAX_OPAQUE 1024
44 #define URLMAX_PATH 1024
46 #define MAX_URL (MAX_SCHEME+1+3+MAX_AUTH+1+1+MAX_HOST+1+1 \
47 +MAX_PORT+1+1+URLMAX_PATH+1+50)
49 #define STRINGIFY(x) #x
50 #define MKSTRING(x) STRINGIFY(x)
52 #define BEGIN "-----BEGIN PGP PUBLIC KEY BLOCK-----"
53 #define END "-----END PGP PUBLIC KEY BLOCK-----"
56 #define HTTP_PROXY_ENV "GnuPG$HttpProxy"
58 #define HTTP_PROXY_ENV "http_proxy"
67 /* 2 minutes seems reasonable */
68 #define DEFAULT_KEYSERVER_TIMEOUT 120
70 unsigned int set_timeout(unsigned int seconds
);
71 int register_timeout(void);
73 enum ks_action
{KS_UNKNOWN
=0,KS_GET
,KS_GETNAME
,KS_SEND
,KS_SEARCH
};
75 enum ks_search_type
{KS_SEARCH_SUBSTR
,KS_SEARCH_EXACT
,
76 KS_SEARCH_MAIL
,KS_SEARCH_MAILSUB
,
77 KS_SEARCH_KEYID_LONG
,KS_SEARCH_KEYID_SHORT
};
81 enum ks_action action
;
90 unsigned int include_disabled
:1;
91 unsigned int include_revoked
:1;
92 unsigned int include_subkeys
:1;
93 unsigned int check_cert
:1;
101 struct ks_options
*init_ks_options(void);
102 void free_ks_options(struct ks_options
*opt
);
103 int parse_ks_options(char *line
,struct ks_options
*opt
);
104 const char *ks_action_to_string(enum ks_action action
);
105 void print_nocr(FILE *stream
,const char *str
);
106 enum ks_search_type
classify_ks_search(const char **search
);
108 int curl_err_to_gpg_err(CURLcode error
);
110 struct curl_writer_ctx
114 unsigned int initialized
:1;
115 unsigned int begun
:1;
117 unsigned int armor
:1;
121 unsigned char armor_ctx
[3];
122 int markeridx
,linelen
;
127 size_t curl_writer(const void *ptr
,size_t size
,size_t nmemb
,void *cw_ctx
);
128 void curl_writer_finalize(struct curl_writer_ctx
*ctx
);
130 #endif /* !_KSUTIL_H_ */