Mercurial > gftp.yaz
diff lib/gftp.h @ 168:c505d9ba9d53
2003-6-6 Brian Masney <masneyb@gftp.org>
* lib/gftp.h - if USE_SSL is defined, include the OpenSSL headers.
Added read_function, write_function and post_connect function pointers
to gftp_request structure. Added SSL object to gftp_request structure
if USE_SSL is defined. Added protocol number and init function
declarations for the HTTPS protocol
* lib/options.h - added HTTPS to the list of supported protocols
* lib/protocols.c lib/cache.c lib/rfc2068.c lib/rfc959.c lib/sshv2.c -
renamed gftp_read(), gftp_write() and gftp_set_sockblocking() to
gftp_fd_read(), gftp_fd_write() and gftp_fd_set_sockblocking()
respectively
* lib/bookmark.c lib/local.c
* lib/misc.c lib/rfc2068.c - moved base64_encode() to misc.c
* lib/protocols.c - improved parsing of URLs. Rather than calling
gftp_read() or gftp_write() directly, call the read_function or
write_function that is set in the request structure. Expanded tabs
to spaces. Cleanup for parsing of timestamps. In
gftp_connect_server(), if a post_connect function pointer is set,
call it after we are connected to the server. Improvements to
gftp_get_line ().
* lib/httpcommon.h lib/rfc2068.c - moved rfc2068_params structure to
httpcommon.h. Fix for chunked file transfers, they were not handled
at all before. Made the I/O calls a little more generic so that we can
read from either a socket or a SSL connection.
* lib/sslcommon.c - added generic SSL layer
* lib/https.c - added support for the HTTPS protocol. It piggy backs
off of the existing HTTP support and uses the generic SSL layer
* src/gtk/bookmarks.c src/gtk/chmod_dialog.c src/gtk/gftp-gtk.c
src/gtk/menu-items.c src/gtk/misc-gtk.c src/gtk/options_dialog.c
src/gtk/view_dialog.c - set the window icon name to the gFTP <version>
* configure.in - added lib back to SUBDIRS (oops)
* lib/Makefile.am - added https.c, sslcommon.c and httpcommon.h
author | masneyb |
---|---|
date | Sun, 08 Jun 2003 15:04:40 +0000 |
parents | 2f15b3000dbc |
children | d40f9db52cdf |
line wrap: on
line diff
--- a/lib/gftp.h Wed May 28 18:37:28 2003 +0000 +++ b/lib/gftp.h Sun Jun 08 15:04:40 2003 +0000 @@ -67,6 +67,14 @@ #include <strings.h> #endif +#ifdef USE_SSL +#include <openssl/bio.h> +#include <openssl/err.h> +#include <openssl/rand.h> +#include <openssl/ssl.h> +#include <openssl/x509v3.h> +#endif + #ifdef ENABLE_NLS #include <libintl.h> #include <locale.h> @@ -334,8 +342,17 @@ void *user_data; void (*init) ( gftp_request * request ); + ssize_t (*read_function) ( gftp_request * request, + void *ptr, + size_t size, + int fd ); + ssize_t (*write_function) ( gftp_request * request, + const char *ptr, + size_t size, + int fd ); void (*destroy) ( gftp_request * request ); int (*connect) ( gftp_request * request ); + int (*post_connect) ( gftp_request * request ); void (*disconnect) ( gftp_request * request ); off_t (*get_file) ( gftp_request * request, const char *filename, @@ -394,6 +411,9 @@ gftp_config_vars * local_options_vars; int num_local_options_vars; GHashTable * local_options_hash; +#ifdef USE_SSL + SSL * ssl; +#endif }; @@ -634,12 +654,15 @@ char *file_prefixstr, char *file_suffixstr ); +char * base64_encode ( char *str ); + /* protocols.c */ #define GFTP_FTP_NUM 0 #define GFTP_HTTP_NUM 1 -#define GFTP_LOCAL_NUM 2 -#define GFTP_SSHV2_NUM 3 -#define GFTP_BOOKMARK_NUM 4 +#define GFTP_HTTPS_NUM 2 +#define GFTP_LOCAL_NUM 3 +#define GFTP_SSHV2_NUM 4 +#define GFTP_BOOKMARK_NUM 5 #define GFTP_IS_CONNECTED(request) ((request) != NULL && \ ((request)->sockfd > 0 || \ @@ -659,6 +682,10 @@ void rfc2068_register_module ( void ); +void https_init ( gftp_request * request ); + +void https_register_module ( void ); + void local_init ( gftp_request * request ); void local_register_module ( void ); @@ -807,18 +834,19 @@ void print_file_list ( GList * list ); + ssize_t gftp_get_line ( gftp_request * request, gftp_getline_buffer ** rbuf, char * str, size_t len, int fd ); -ssize_t gftp_read ( gftp_request * request, +ssize_t gftp_fd_read ( gftp_request * request, void *ptr, size_t size, int fd ); -ssize_t gftp_write ( gftp_request * request, +ssize_t gftp_fd_write ( gftp_request * request, const char *ptr, size_t size, int fd ); @@ -828,7 +856,7 @@ const char *fmt, ... ); -int gftp_set_sockblocking ( gftp_request * request, +int gftp_fd_set_sockblocking ( gftp_request * request, int fd, int non_blocking ); @@ -848,5 +876,24 @@ int tty_raw ( int fd ); +#ifdef USE_SSL +/* sslcommon.c */ +int gftp_ssl_startup ( gftp_request * request ); + +int gftp_ssl_session_setup ( gftp_request * request ); + +void gftp_ssl_free ( gftp_request * request ); + +ssize_t gftp_ssl_read ( gftp_request * request, + void *ptr, + size_t size, + int fd ); + +ssize_t gftp_ssl_write ( gftp_request * request, + const char *ptr, + size_t size, + int fd ); +#endif /* USE_SSL */ + #endif