Mercurial > gftp.yaz
comparison 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 |
comparison
equal
deleted
inserted
replaced
167:4b767a186810 | 168:c505d9ba9d53 |
---|---|
65 #include <string.h> | 65 #include <string.h> |
66 #else | 66 #else |
67 #include <strings.h> | 67 #include <strings.h> |
68 #endif | 68 #endif |
69 | 69 |
70 #ifdef USE_SSL | |
71 #include <openssl/bio.h> | |
72 #include <openssl/err.h> | |
73 #include <openssl/rand.h> | |
74 #include <openssl/ssl.h> | |
75 #include <openssl/x509v3.h> | |
76 #endif | |
77 | |
70 #ifdef ENABLE_NLS | 78 #ifdef ENABLE_NLS |
71 #include <libintl.h> | 79 #include <libintl.h> |
72 #include <locale.h> | 80 #include <locale.h> |
73 #define _(String) gettext (String) | 81 #define _(String) gettext (String) |
74 #else | 82 #else |
332 | 340 |
333 gftp_logging_func logging_function; | 341 gftp_logging_func logging_function; |
334 void *user_data; | 342 void *user_data; |
335 | 343 |
336 void (*init) ( gftp_request * request ); | 344 void (*init) ( gftp_request * request ); |
345 ssize_t (*read_function) ( gftp_request * request, | |
346 void *ptr, | |
347 size_t size, | |
348 int fd ); | |
349 ssize_t (*write_function) ( gftp_request * request, | |
350 const char *ptr, | |
351 size_t size, | |
352 int fd ); | |
337 void (*destroy) ( gftp_request * request ); | 353 void (*destroy) ( gftp_request * request ); |
338 int (*connect) ( gftp_request * request ); | 354 int (*connect) ( gftp_request * request ); |
355 int (*post_connect) ( gftp_request * request ); | |
339 void (*disconnect) ( gftp_request * request ); | 356 void (*disconnect) ( gftp_request * request ); |
340 off_t (*get_file) ( gftp_request * request, | 357 off_t (*get_file) ( gftp_request * request, |
341 const char *filename, | 358 const char *filename, |
342 int fd, | 359 int fd, |
343 off_t startsize ); | 360 off_t startsize ); |
392 gftp_request * source ); | 409 gftp_request * source ); |
393 | 410 |
394 gftp_config_vars * local_options_vars; | 411 gftp_config_vars * local_options_vars; |
395 int num_local_options_vars; | 412 int num_local_options_vars; |
396 GHashTable * local_options_hash; | 413 GHashTable * local_options_hash; |
414 #ifdef USE_SSL | |
415 SSL * ssl; | |
416 #endif | |
397 }; | 417 }; |
398 | 418 |
399 | 419 |
400 typedef struct gftp_transfer_tag | 420 typedef struct gftp_transfer_tag |
401 { | 421 { |
632 | 652 |
633 char * gftp_gen_ls_string ( gftp_file * fle, | 653 char * gftp_gen_ls_string ( gftp_file * fle, |
634 char *file_prefixstr, | 654 char *file_prefixstr, |
635 char *file_suffixstr ); | 655 char *file_suffixstr ); |
636 | 656 |
657 char * base64_encode ( char *str ); | |
658 | |
637 /* protocols.c */ | 659 /* protocols.c */ |
638 #define GFTP_FTP_NUM 0 | 660 #define GFTP_FTP_NUM 0 |
639 #define GFTP_HTTP_NUM 1 | 661 #define GFTP_HTTP_NUM 1 |
640 #define GFTP_LOCAL_NUM 2 | 662 #define GFTP_HTTPS_NUM 2 |
641 #define GFTP_SSHV2_NUM 3 | 663 #define GFTP_LOCAL_NUM 3 |
642 #define GFTP_BOOKMARK_NUM 4 | 664 #define GFTP_SSHV2_NUM 4 |
665 #define GFTP_BOOKMARK_NUM 5 | |
643 | 666 |
644 #define GFTP_IS_CONNECTED(request) ((request) != NULL && \ | 667 #define GFTP_IS_CONNECTED(request) ((request) != NULL && \ |
645 ((request)->sockfd > 0 || \ | 668 ((request)->sockfd > 0 || \ |
646 (request)->cached || \ | 669 (request)->cached || \ |
647 (request)->always_connected)) | 670 (request)->always_connected)) |
656 int fd ); | 679 int fd ); |
657 | 680 |
658 void rfc2068_init ( gftp_request * request ); | 681 void rfc2068_init ( gftp_request * request ); |
659 | 682 |
660 void rfc2068_register_module ( void ); | 683 void rfc2068_register_module ( void ); |
684 | |
685 void https_init ( gftp_request * request ); | |
686 | |
687 void https_register_module ( void ); | |
661 | 688 |
662 void local_init ( gftp_request * request ); | 689 void local_init ( gftp_request * request ); |
663 | 690 |
664 void local_register_module ( void ); | 691 void local_register_module ( void ); |
665 | 692 |
805 | 832 |
806 void gftp_set_config_options ( gftp_request * request ); | 833 void gftp_set_config_options ( gftp_request * request ); |
807 | 834 |
808 void print_file_list ( GList * list ); | 835 void print_file_list ( GList * list ); |
809 | 836 |
837 | |
810 ssize_t gftp_get_line ( gftp_request * request, | 838 ssize_t gftp_get_line ( gftp_request * request, |
811 gftp_getline_buffer ** rbuf, | 839 gftp_getline_buffer ** rbuf, |
812 char * str, | 840 char * str, |
813 size_t len, | 841 size_t len, |
814 int fd ); | 842 int fd ); |
815 | 843 |
816 ssize_t gftp_read ( gftp_request * request, | 844 ssize_t gftp_fd_read ( gftp_request * request, |
817 void *ptr, | 845 void *ptr, |
818 size_t size, | 846 size_t size, |
819 int fd ); | 847 int fd ); |
820 | 848 |
821 ssize_t gftp_write ( gftp_request * request, | 849 ssize_t gftp_fd_write ( gftp_request * request, |
822 const char *ptr, | 850 const char *ptr, |
823 size_t size, | 851 size_t size, |
824 int fd ); | 852 int fd ); |
825 | 853 |
826 ssize_t gftp_writefmt ( gftp_request * request, | 854 ssize_t gftp_writefmt ( gftp_request * request, |
827 int fd, | 855 int fd, |
828 const char *fmt, | 856 const char *fmt, |
829 ... ); | 857 ... ); |
830 | 858 |
831 int gftp_set_sockblocking ( gftp_request * request, | 859 int gftp_fd_set_sockblocking ( gftp_request * request, |
832 int fd, | 860 int fd, |
833 int non_blocking ); | 861 int non_blocking ); |
834 | 862 |
835 void gftp_swap_socks ( gftp_request * dest, | 863 void gftp_swap_socks ( gftp_request * dest, |
836 gftp_request * source ); | 864 gftp_request * source ); |
846 int *fdm, | 874 int *fdm, |
847 int *fds ); | 875 int *fds ); |
848 | 876 |
849 int tty_raw ( int fd ); | 877 int tty_raw ( int fd ); |
850 | 878 |
851 #endif | 879 #ifdef USE_SSL |
852 | 880 /* sslcommon.c */ |
881 int gftp_ssl_startup ( gftp_request * request ); | |
882 | |
883 int gftp_ssl_session_setup ( gftp_request * request ); | |
884 | |
885 void gftp_ssl_free ( gftp_request * request ); | |
886 | |
887 ssize_t gftp_ssl_read ( gftp_request * request, | |
888 void *ptr, | |
889 size_t size, | |
890 int fd ); | |
891 | |
892 ssize_t gftp_ssl_write ( gftp_request * request, | |
893 const char *ptr, | |
894 size_t size, | |
895 int fd ); | |
896 #endif /* USE_SSL */ | |
897 | |
898 #endif | |
899 |