From 0898ca10c0109274d24f91453036c065f9f5c056 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Wed, 4 May 2011 16:03:16 +0200 Subject: Implement dynamic loading of GnuTLS on Windows. * lisp/term/w32-win.el (dynamic-library-alist): Add `gnutls'. * nt/INSTALL: Clarify GnuTLS support. * src/callproc.c, src/emacs.c: Include lisp.h before src/w32.h, not after. * src/gnutls.c (Qgnutls_dll): Define. (DEF_GNUTLS_FN, LOAD_GNUTLS_FN): New macros. (gnutls_*): Declare function pointers. (init_gnutls_functions): New function to initialize function pointers. (emacs_gnutls_handshake, Fgnutls_error_string, Fgnutls_deinit) (emacs_gnutls_global_init, Fgnutls_bye): Use function pointers. (emacs_gnutls_record_check_pending, emacs_gnutls_transport_set_errno): Wrappers for gnutls_record_check_pending and gnutls_transport_set_errno. (emacs_gnutls_write, emacs_gnutls_read) (emacs_gnutls_handle_error, Fgnutls_error_fatalp) (Fgnutls_available_p): New function. (Fgnutls_boot): Call Fgnutls_available_p. Use function pointers. (syms_of_gnutls) : Initialize and staticpro it. (syms_of_gnutls) : defsubr it. * src/gnutls.h (GNUTLS_EMACS_ERROR_NOT_LOADED): New macro. (emacs_gnutls_write, emacs_gnutls_read): Mark as extern. (emacs_gnutls_record_check_pending, emacs_gnutls_transport_set_errno): Declare. * src/w32.c (QCloaded_from, Vlibrary_cache): Define. (w32_delayed_load): Move from image.c. When loading a library, record its filename in the :loaded-from property of the library id. (globals_of_w32) : Initialize and staticpro them. (emacs_gnutls_pull, emacs_gnutls_push): Call emacs_gnutls_* functions. * src/image.c: Include w32.h. (Vimage_type_cache): Delete. (syms_of_image) : Don't initialize and staticpro it. (CACHE_IMAGE_TYPE, Finit_image_library): Use Vlibrary_cache instead. (w32_delayed_load): Move to w32.c. * src/process.c: Include lisp.h before src/w32.h, not after. (wait_reading_process_output): Call emacs_gnutls_record_check_pending instead of gnutls_record_check_pending. * src/w32.h (VlibraryCache, QCloaded_from, w32_delayed_load): Declare. --- src/gnutls.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/gnutls.h') diff --git a/src/gnutls.h b/src/gnutls.h index 6c2e4c69523..afe6337fac2 100644 --- a/src/gnutls.h +++ b/src/gnutls.h @@ -42,6 +42,7 @@ typedef enum GNUTLS_STAGE_READY, } gnutls_initstage_t; +#define GNUTLS_EMACS_ERROR_NOT_LOADED GNUTLS_E_APPLICATION_ERROR_MIN + 1 #define GNUTLS_EMACS_ERROR_INVALID_TYPE GNUTLS_E_APPLICATION_ERROR_MIN #define GNUTLS_INITSTAGE(proc) (XPROCESS (proc)->gnutls_initstage) @@ -52,13 +53,16 @@ typedef enum #define GNUTLS_LOG2(level, max, string, extra) if (level <= max) { gnutls_log_function2 (level, "(Emacs) " string, extra); } -EMACS_INT +extern EMACS_INT emacs_gnutls_write (int fildes, struct Lisp_Process *proc, const char *buf, EMACS_INT nbyte); -EMACS_INT +extern EMACS_INT emacs_gnutls_read (int fildes, struct Lisp_Process *proc, char *buf, EMACS_INT nbyte); +extern int emacs_gnutls_record_check_pending (gnutls_session_t state); +extern void emacs_gnutls_transport_set_errno (gnutls_session_t state, int err); + extern void syms_of_gnutls (void); #endif -- cgit v1.2.1