/[winpt]/trunk/Include/wptKeyserver.h
ViewVC logotype

Annotation of /trunk/Include/wptKeyserver.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 186 - (hide annotations)
Mon Mar 20 12:49:11 2006 UTC (18 years, 11 months ago) by twoaday
File MIME type: text/plain
File size: 4336 byte(s)


1 werner 37 /* wptKeyserver.h - Keyserver headerfile
2 twoaday 146 * Copyright (C) 2000-2006 Timo Schulz
3 werner 37 *
4     * This file is part of WinPT.
5     *
6     * WinPT is free software; you can redistribute it and/or
7     * modify it under the terms of the GNU General Public License
8     * as published by the Free Software Foundation; either version 2
9     * of the License, or (at your option) any later version.
10     *
11     * WinPT 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 GNU
14     * General Public License for more details.
15     *
16     * You should have received a copy of the GNU General Public License
17     * along with WinPT; if not, write to the Free Software Foundation,
18     * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19     */
20    
21     #ifndef WPT_KEYSERVER_H
22     #define WPT_KEYSERVER_H
23    
24     #define HKP_PORT 11371 /* Horowitz Keyserver Protocol */
25     #define FINGER_PORT 79 /* Finger Protocol */
26    
27     /* Default keyserver URL. */
28     #define DEF_HKP_KEYSERVER "http://subkeys.pgp.net"
29    
30 twoaday 180 /* Valid proxy protocols. */
31     enum proxy_proto_t {
32 twoaday 186 PROXY_PROTO_NONE = 0,
33     PROXY_PROTO_HTTP,
34 twoaday 180 PROXY_PROTO_SOCKS4,
35     PROXY_PROTO_SOCKS5
36 werner 37 };
37    
38 twoaday 180 /* Valid proxy authentications. */
39     enum proxy_auth_t {
40     PROXY_AUTH_NONE = 0,
41     PROXY_AUTH_PLAIN = 2
42     };
43    
44 werner 37 /* Valid key server protocols. */
45     enum ksproto_t {
46     KSPROTO_HTTP = 0,
47     KSPROTO_LDAP = 1,
48     KSPROTO_FINGER = 2
49     };
50     #define KSPROTO_HKP 0 /* alias for http */
51    
52     struct keyserver_ctx {
53     const char *name;
54     unsigned short port;
55     const char *pattern;
56     };
57    
58     struct keyserver {
59     char *name; /* name of the keyserver. */
60     int port; /* used tcp port. */
61     int used; /* 1=entry will be used. */
62     int proto; /* protocol (0..2). */
63     };
64    
65 twoaday 180 /* Proxy configuration context. */
66     struct keyserver_proxy_s {
67     int proto; /* protocol. */
68     int port; /* server port. */
69     char *host; /* server host. */
70     int auth_mode; /* authentication mode. */
71     char *user; /* user. */
72     char *base64_user; /* base64 encoded user. */
73     char *pass; /* password. */
74 werner 37 };
75 twoaday 180 typedef struct keyserver_proxy_s *keyserver_proxy_t;
76 werner 37
77     #define MAX_KEYSERVERS 32
78     extern keyserver server[MAX_KEYSERVERS]; /* runtime initialized */
79 twoaday 115 extern char *default_keyserver;
80 twoaday 146 extern WORD default_keyserver_port;
81 twoaday 180 extern keyserver_proxy_s proxy;
82 werner 37
83     struct keyserver_key {
84     int bits; /* length of the key. */
85     char keyid[8+1]; /* keyid of the key. */
86     char date[10+1]; /* date of creation. */
87     char uid[384]; /* primary user-id. */
88     };
89    
90    
91 twoaday 180 /*-- wptSOCKS.cpp --*/
92     int socks_handshake (keyserver_proxy_t ctx, int conn_fd,
93     const char *hostname, WORD port);
94    
95 werner 37 /*-- Winsock2 support --*/
96     int wsock_init (void);
97     void wsock_end (void);
98     const char* wsock_strerror (void);
99    
100     /*-- Keyserver config --*/
101     int kserver_load_conf (const char *conf);
102 twoaday 151 int kserver_save_conf (const char *conf);
103 werner 37 const char* kserver_check_keyid (const char *keyid);
104 twoaday 180 void kserver_proxy_release (keyserver_proxy_t ctx);
105 twoaday 146 const char* kserver_get_hostname (int idx, int type, unsigned short *port);
106 werner 37 void keyserver_set_default (const char *hostname, unsigned short port);
107 twoaday 182 void kserver_set_socket_timeout (int nsec);
108 werner 37
109     /*-- General --*/
110     int check_IP_or_hostname (const char *name);
111 twoaday 146 const char* kserver_strerror (void);
112 werner 37 int kserver_check_inet_connection (void);
113 twoaday 146 int kserver_connect (const char *hostname, WORD port, int *conn_fd);
114     int kserver_sendkey (const char *hostname, WORD port,
115 twoaday 115 const char *pubkey, int len);
116 twoaday 146 int kserver_recvkey (const char *hostname, WORD port,
117 werner 37 const char *keyid, char *key, int maxkeylen);
118    
119 twoaday 186 int kserver_search_begin (const char *hostname, WORD port,
120     const char *pattern, int *conn_fd);
121     int kserver_search_next (int conn_fd, keyserver_key *key);
122     void kserver_search_end (int conn_fd);
123 werner 37
124     /*-- Finger/LDAP Protocol --*/
125     int ldap_recvkey (const char *hostname, const char *keyid, char *key,
126     int maxkeylen);
127     int finger_recvkey (const char * host, const char * user, char * key,
128     int maxkeylen);
129    
130     /*-- Dialog support --*/
131 twoaday 115 int hkp_send_key (HWND dlg, const char *kserver, unsigned short port,
132     const char *pattern);
133     int hkp_recv_key (HWND dlg, const char *kserver, unsigned short port,
134     const char *pattern, int proto, int flags);
135 werner 37
136 twoaday 115 #endif /* WPT_KEYSERVER_H */

Properties

Name Value
svn:eol-style native

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26