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

Annotation of /trunk/Include/wptKeyserver.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 37 - (hide annotations)
Thu Oct 27 19:12:40 2005 UTC (19 years, 4 months ago) by werner
File MIME type: text/plain
File size: 4363 byte(s)
Added 2 dummy files, chnaged eol-style property

1 werner 37 /* wptKeyserver.h - Keyserver headerfile
2     * Copyright (C) 2000-2005 Timo Schulz
3     *
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     enum proxy_t {
31     PROXY_USER = 0,
32     PROXY_PASS = 1,
33     };
34    
35     /* Valid key server protocols. */
36     enum ksproto_t {
37     KSPROTO_HTTP = 0,
38     KSPROTO_LDAP = 1,
39     KSPROTO_FINGER = 2
40     };
41     #define KSPROTO_HKP 0 /* alias for http */
42    
43     struct keyserver_ctx {
44     const char *name;
45     unsigned short port;
46     const char *pattern;
47     };
48    
49     struct keyserver {
50     char *name; /* name of the keyserver. */
51     int port; /* used tcp port. */
52     int used; /* 1=entry will be used. */
53     int proto; /* protocol (0..2). */
54     };
55    
56     struct keyserver_proxy_ctx {
57     int port; /* proxy server port. */
58     char *host; /* proxy server host. */
59     char *user; /* proxy user. */
60     char *base64_user; /* base64 encoded proxy user. */
61     char *pass; /* proxy password. */
62     };
63    
64     struct keyserver_node {
65     keyserver_node * next;
66     keyserver host;
67     int used;
68     };
69    
70     struct keyserver_cfgfile {
71     keyserver_node * list;
72     keyserver_proxy_ctx proxy;
73     int nlist;
74     };
75    
76     #define MAX_KEYSERVERS 32
77     extern keyserver server[MAX_KEYSERVERS]; /* runtime initialized */
78     extern char * default_keyserver;
79     extern unsigned short default_keyserver_port;
80    
81     struct keyserver_key {
82     int bits; /* length of the key. */
83     char keyid[8+1]; /* keyid of the key. */
84     char date[10+1]; /* date of creation. */
85     char uid[384]; /* primary user-id. */
86     };
87    
88     const char* kserver_strerror (void);
89    
90     /*-- Winsock2 support --*/
91     int wsock_init (void);
92     void wsock_end (void);
93     const char* wsock_strerror (void);
94    
95     /*-- Keyserver config --*/
96     int kserver_load_conf (const char *conf);
97     const char* kserver_check_keyid (const char *keyid);
98     const char* kserver_get_proxy (int *r_port);
99     const char* kserver_get_proxy_info (int id);
100    
101     int kserver_read_config( const char *fname, keyserver_cfgfile **ret_cfg );
102     int kserver_write_config( const char *fname, keyserver_cfgfile *cfg );
103     void kserver_cfgfile_release( keyserver_cfgfile *cfg );
104     void kserver_change_proxy( keyserver_proxy_ctx *ctx );
105     void proxy_release( keyserver_proxy_ctx *ctx );
106     const char * kserver_get_hostname (int idx, int type, unsigned short *port);
107     void keyserver_set_default (const char *hostname, unsigned short port);
108     void set_default_kserver (void);
109    
110     /*-- General --*/
111     int check_IP_or_hostname (const char *name);
112     int kserver_check_inet_connection (void);
113     int kserver_connect (const char *hostname, unsigned short port, int *conn_fd);
114     int kserver_sendkey (const char *hostname, unsigned short port, const char *pubkey, int len);
115     int kserver_recvkey (const char *hostname, unsigned short port,
116     const char *keyid, char *key, int maxkeylen);
117    
118     int kserver_search_init(const char *hostname, unsigned short port, const char *keyid, int *conn_fd);
119     int kserver_search_chkresp (int conn_fd);
120     int kserver_search (int conn_fd, keyserver_key *key);
121    
122     /*-- Finger/LDAP Protocol --*/
123     int ldap_recvkey (const char *hostname, const char *keyid, char *key,
124     int maxkeylen);
125     int finger_recvkey (const char * host, const char * user, char * key,
126     int maxkeylen);
127    
128     /*-- Dialog support --*/
129     int hkp_send_key (HWND dlg, const char *kserver, unsigned short port, const char *pattern);
130     int hkp_recv_key (HWND dlg, const char *kserver, unsigned short port, const char *pattern,
131     int proto, int flags);
132    
133     #endif /* WPT_KEYSERVER_H_ */

Properties

Name Value
svn:eol-style native

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26