diff options
author | des <des@FreeBSD.org> | 2002-06-05 10:05:03 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2002-06-05 10:05:03 +0000 |
commit | e07ac3bab378d02dca475f92e0592bb4ecd5f018 (patch) | |
tree | 2d0745a2b622f4f25fdcff8a8d2ce1eeea0b7447 /lib/libfetch/common.h | |
parent | 306d84207e66a03a612bdc2511115dfd7c673ef3 (diff) | |
download | FreeBSD-src-e07ac3bab378d02dca475f92e0592bb4ecd5f018.zip FreeBSD-src-e07ac3bab378d02dca475f92e0592bb4ecd5f018.tar.gz |
First step towards SSL support: wrap connections in a 'struct connection'
which contains the socket descriptor, the input buffer and (yet unused)
SSL state variables. This has the neat side effect of greatly improving
reentrance (though we're not *quite* there yet) and opening the door to
HTTP connection caching.
This commit is inspired by email conversations with and patches from
Henry Whincup <henry@techiebod.com> last fall.
Diffstat (limited to 'lib/libfetch/common.h')
-rw-r--r-- | lib/libfetch/common.h | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/lib/libfetch/common.h b/lib/libfetch/common.h index 7d93d96..45c90bc 100644 --- a/lib/libfetch/common.h +++ b/lib/libfetch/common.h @@ -36,6 +36,28 @@ #define FTP_DEFAULT_PROXY_PORT 21 #define HTTP_DEFAULT_PROXY_PORT 3128 +#include <openssl/crypto.h> +#include <openssl/x509.h> +#include <openssl/pem.h> +#include <openssl/ssl.h> +#include <openssl/err.h> + +/* Connection */ +typedef struct fetchconn conn_t; +struct fetchconn { + char *host; /* host name */ + int port; /* port */ + int af; /* address family */ + int sd; /* socket descriptor */ + char *buf; /* buffer */ + size_t bufsize; /* buffer size */ + size_t buflen; /* length of buffer contents */ + int err; /* last protocol reply code */ + SSL *ssl_ctx; /* SSL context if needed */ + X509 *ssl_cert; /* server certificate */ + SSL_METHOD *ssl_meth; /* SSL method */ +}; + /* Structure used for error message lists */ struct fetcherr { const int num; @@ -48,9 +70,10 @@ void _fetch_syserr(void); void _fetch_info(const char *, ...); int _fetch_default_port(const char *); int _fetch_default_proxy_port(const char *); -int _fetch_connect(const char *, int, int, int); -int _fetch_getln(int, char **, size_t *, size_t *); -int _fetch_putln(int, const char *, size_t); +conn_t *_fetch_connect(const char *, int, int, int); +int _fetch_getln(conn_t *); +int _fetch_putln(conn_t *, const char *, size_t); +int _fetch_close(conn_t *); int _fetch_add_entry(struct url_ent **, int *, int *, const char *, struct url_stat *); |