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

Diff of /trunk/Include/wptKeyserver.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 133 by twoaday, Mon Jan 9 09:15:29 2006 UTC revision 214 by twoaday, Sun May 14 18:40:36 2006 UTC
# Line 1  Line 1 
1  /* wptKeyserver.h - Keyserver headerfile  /* wptKeyserver.h - Keyserver headerfile
2   *      Copyright (C) 2000-2005 Timo Schulz   *      Copyright (C) 2000-2006 Timo Schulz
3   *   *
4   * This file is part of WinPT.   * This file is part of WinPT.
5   *   *
# Line 27  Line 27 
27  /* Default keyserver URL. */  /* Default keyserver URL. */
28  #define DEF_HKP_KEYSERVER "http://subkeys.pgp.net"  #define DEF_HKP_KEYSERVER "http://subkeys.pgp.net"
29    
30  enum proxy_t {  /* Valid proxy protocols. */
31      PROXY_USER = 0,     /* proxy username */  enum proxy_proto_t {
32      PROXY_PASS = 1,     /* proxy password */      PROXY_PROTO_NONE = 0,
33        PROXY_PROTO_HTTP,
34        PROXY_PROTO_SOCKS4,
35        PROXY_PROTO_SOCKS5
36    };
37    
38    /* Valid proxy authentications. */
39    enum proxy_auth_t {
40        PROXY_AUTH_NONE = 0,
41        PROXY_AUTH_PLAIN = 2
42  };  };
43    
44  /* Valid key server protocols. */  /* Valid key server protocols. */
# Line 53  struct keyserver { Line 62  struct keyserver {
62      int   proto;    /* protocol (0..2). */      int   proto;    /* protocol (0..2). */
63  };  };
64    
65  struct keyserver_proxy_ctx {  /* Proxy configuration context. */
66      int   port;         /* proxy server port. */  struct keyserver_proxy_s {
67      char *host;         /* proxy server host. */      int   proto;        /* protocol. */
68      char *user;         /* proxy user. */      int   port;         /* server port. */
69      char *base64_user;  /* base64 encoded proxy user. */      char *host;         /* server host. */
70      char *pass;         /* proxy password. */      int   auth_mode;    /* authentication mode. */
71  };      char *user;         /* user. */
72        char *base64_user;  /* base64 encoded user. */
73  struct keyserver_node {      char *pass;         /* password. */
     keyserver_node *    next;  
     keyserver           host;  
     int                 used;  
 };  
   
 struct keyserver_cfgfile {  
     keyserver_node *    list;  
     keyserver_proxy_ctx proxy;  
     int                 nlist;  
74  };  };
75    typedef struct keyserver_proxy_s *keyserver_proxy_t;
76    
77  #define MAX_KEYSERVERS 32  #define MAX_KEYSERVERS 32
78  extern keyserver server[MAX_KEYSERVERS]; /* runtime initialized */  extern keyserver server[MAX_KEYSERVERS]; /* runtime initialized */
79  extern char *default_keyserver;  extern char *default_keyserver;
80  extern unsigned short default_keyserver_port;  extern WORD default_keyserver_port;
81    extern keyserver_proxy_s proxy;
82    
83    
84  struct keyserver_key {  struct keyserver_uid_s {
85      int     bits;           /* length of the key. */      struct keyserver_uid_s *next;
86      char    keyid[8+1];     /* keyid of the key. */      long creation;
87      char    date[10+1];     /* date of creation. */      long expires;
88      char    uid[384];       /* primary user-id. */      char *uid;
89  };  };
90    
91  const char* kserver_strerror (void);  struct keyserver_key_s {
92        int    algo;                    /* pubkey algorithm. */
93        int    bits;                    /* length of the key. */
94        char   *keyid;                  /* keyid of the key. */
95        long   creation;                /* creation date. */
96        long   expires;
97        struct keyserver_uid_s *uids;   /* list ofuser-ids. */
98        const struct keyserver_uid_s *main_uid;
99    };
100    
101    
102    /*-- wptSOCKS.cpp --*/
103    int socks_handshake (keyserver_proxy_t ctx, int conn_fd,
104                         const char *hostname, WORD port);
105    
106  /*-- Winsock2 support --*/  /*-- Winsock2 support --*/
107  int wsock_init (void);  int wsock_init (void);
# Line 94  const char* wsock_strerror (void); Line 110  const char* wsock_strerror (void);
110    
111  /*-- Keyserver config --*/  /*-- Keyserver config --*/
112  int kserver_load_conf (const char *conf);  int kserver_load_conf (const char *conf);
113    int kserver_save_conf (const char *conf);
114  const char* kserver_check_keyid (const char *keyid);  const char* kserver_check_keyid (const char *keyid);
115  const char* kserver_get_proxy (int *r_port);  void kserver_proxy_release (keyserver_proxy_t ctx);
116  const char* kserver_get_proxy_info (int id);  const char* kserver_get_hostname (int idx, int type, unsigned short *port);
   
 int kserver_read_config( const char *fname, keyserver_cfgfile **ret_cfg );  
 int kserver_write_config( const char *fname, keyserver_cfgfile *cfg );  
 void kserver_cfgfile_release( keyserver_cfgfile *cfg );  
 void kserver_change_proxy( keyserver_proxy_ctx *ctx );  
 void proxy_release( keyserver_proxy_ctx *ctx );  
 const char * kserver_get_hostname (int idx, int type, unsigned short *port);  
117  void keyserver_set_default (const char *hostname, unsigned short port);  void keyserver_set_default (const char *hostname, unsigned short port);
118  void set_default_kserver (void);  void kserver_set_socket_timeout (int nsec);
119    
120  /*-- General --*/  /*-- General --*/
121  int check_IP_or_hostname (const char *name);  int check_IP_or_hostname (const char *name);
122    const char* kserver_strerror (void);
123  int kserver_check_inet_connection (void);  int kserver_check_inet_connection (void);
124  int kserver_connect (const char *hostname, unsigned short port, int *conn_fd);  int kserver_connect (const char *hostname, WORD port, int *conn_fd);
125  int kserver_sendkey (const char *hostname, unsigned short port,  int kserver_sendkey (const char *hostname, WORD port,
126                       const char *pubkey, int len);                       const char *pubkey, int len);
127  int kserver_recvkey (const char *hostname, unsigned short port,  int kserver_recvkey (const char *hostname, WORD port,
128                       const char *keyid, char *key, int maxkeylen);                       const char *keyid, char **r_key, int *r_keylen);
129    int kserver_search_begin (const char *hostname, WORD port,
130  int kserver_search_init(const char *hostname, unsigned short port,                            const char *pattern, int *conn_fd, int *nkeys);
131                          const char *keyid, int *conn_fd);  int kserver_search_next (int conn_fd, keyserver_key_s **r_key);
132  int kserver_search_chkresp (int conn_fd);  void kserver_search_end (int conn_fd);
133  int kserver_search (int conn_fd, keyserver_key *key);  void kserver_release_key (keyserver_key_s *key);
134    
135  /*-- Finger/LDAP Protocol --*/  /*-- Finger/LDAP Protocol --*/
136  int  ldap_recvkey (const char *hostname, const char *keyid, char *key,  int  ldap_recvkey (const char *hostname, const char *keyid,
137                     int maxkeylen);                     char **r_key, int *r_keylen);
138  int finger_recvkey (const char * host, const char * user, char * key,  int finger_recvkey (const char *host, const char *user,
139                      int maxkeylen);                      char **r_key, int *r_keylen);
140    
141  /*-- Dialog support --*/  /*-- Dialog support --*/
142  int hkp_send_key (HWND dlg, const char *kserver, unsigned short port,  int hkp_send_key (HWND dlg, const char *kserver, unsigned short port,

Legend:
Removed from v.133  
changed lines
  Added in v.214

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26