Qgnutls_e_invalid_session, Qgnutls_e_not_ready_for_handshake;
int global_initialized;
-void
+static void
emacs_gnutls_handshake (struct Lisp_Process *proc)
{
gnutls_session_t state = proc->gnutls_state;
known symbol like `gnutls_e_interrupted' and `gnutls_e_again' or
simply the integer value of the error. GNUTLS_E_SUCCESS is mapped
to Qt. */
-Lisp_Object gnutls_make_error (int error)
+static Lisp_Object
+gnutls_make_error (int error)
{
switch (error)
{
}
DEFUN ("gnutls-get-initstage", Fgnutls_get_initstage, Sgnutls_get_initstage, 1, 1, 0,
- doc: /* Return the GnuTLS init stage of PROCESS.
+ doc: /* Return the GnuTLS init stage of process PROC.
See also `gnutls-boot'. */)
- (Lisp_Object proc)
+ (Lisp_Object proc)
{
CHECK_PROCESS (proc);
}
DEFUN ("gnutls-errorp", Fgnutls_errorp, Sgnutls_errorp, 1, 1, 0,
- doc: /* Returns t if ERROR (as generated by gnutls_make_error)
-indicates a GnuTLS problem. */)
- (Lisp_Object error)
+ doc: /* Return t if ERROR indicates a GnuTLS problem.
+ERROR is an integer or a symbol with an integer `gnutls-code' property.
+usage: (gnutls-errorp ERROR) */)
+ (Lisp_Object err)
{
- if (EQ (error, Qt)) return Qnil;
+ if (EQ (err, Qt)) return Qnil;
return Qt;
}
DEFUN ("gnutls-error-fatalp", Fgnutls_error_fatalp, Sgnutls_error_fatalp, 1, 1, 0,
- doc: /* Checks if ERROR is fatal.
-ERROR is an integer or a symbol with an integer `gnutls-code' property. */)
- (Lisp_Object err)
+ doc: /* Check if ERROR is fatal.
+ERROR is an integer or a symbol with an integer `gnutls-code' property.
+usage: (gnutls-error-fatalp ERROR) */)
+ (Lisp_Object err)
{
Lisp_Object code;
}
DEFUN ("gnutls-error-string", Fgnutls_error_string, Sgnutls_error_string, 1, 1, 0,
- doc: /* Returns a description of ERROR.
-ERROR is an integer or a symbol with an integer `gnutls-code' property. */)
- (Lisp_Object err)
+ doc: /* Return a description of ERROR.
+ERROR is an integer or a symbol with an integer `gnutls-code' property.
+usage: (gnutls-error-string ERROR) */)
+ (Lisp_Object err)
{
Lisp_Object code;
}
DEFUN ("gnutls-deinit", Fgnutls_deinit, Sgnutls_deinit, 1, 1, 0,
- doc: /* Deallocate GNU TLS resources associated with PROCESS.
+ doc: /* Deallocate GNU TLS resources associated with process PROC.
See also `gnutls-init'. */)
- (Lisp_Object proc)
+ (Lisp_Object proc)
{
gnutls_session_t state;
/* Initializes global GNU TLS state to defaults.
Call `gnutls-global-deinit' when GNU TLS usage is no longer needed.
Returns zero on success. */
-Lisp_Object gnutls_emacs_global_init (void)
+static Lisp_Object
+gnutls_emacs_global_init (void)
{
int ret = GNUTLS_E_SUCCESS;
/* Deinitializes global GNU TLS state.
See also `gnutls-global-init'. */
-Lisp_Object gnutls_emacs_global_deinit (void)
+static Lisp_Object
+gnutls_emacs_global_deinit (void)
{
if (global_initialized)
gnutls_global_deinit ();
return gnutls_make_error (GNUTLS_E_SUCCESS);
}
-static void gnutls_log_function (int level, const char* string)
+static void
+gnutls_log_function (int level, const char* string)
{
- message("gnutls.c: [%d] %s", level, string);
+ message ("gnutls.c: [%d] %s", level, string);
}
DEFUN ("gnutls-boot", Fgnutls_boot, Sgnutls_boot, 3, 7, 0,
- doc: /* Initializes client-mode GnuTLS for process PROC.
+ doc: /* Initialize client-mode GnuTLS for process PROC.
Currently only client mode is supported. Returns a success/failure
value you can check with `gnutls-errorp'.
-PRIORITY_STRING is a string describing the priority.
+PRIORITY-STRING is a string describing the priority.
TYPE is either `gnutls-anon' or `gnutls-x509pki'.
TRUSTFILE is a PEM encoded trust file for `gnutls-x509pki'.
KEYFILE is ... for `gnutls-x509pki' (TODO).
the protocols's priority except for disabling protocols that were not
specified.
-Processes must be initialized with this function before other GNU TLS
+Processes must be initialized with this function before other GnuTLS
functions are used. This function allocates resources which can only
be deallocated by calling `gnutls-deinit' or by calling it again.
Each authentication type may need additional information in order to
work. For X.509 PKI (`gnutls-x509pki'), you need TRUSTFILE and
KEYFILE and optionally CALLBACK. */)
- (Lisp_Object proc, Lisp_Object priority_string, Lisp_Object type,
- Lisp_Object trustfile, Lisp_Object keyfile, Lisp_Object callback,
- Lisp_Object loglevel)
+ (Lisp_Object proc, Lisp_Object priority_string, Lisp_Object type,
+ Lisp_Object trustfile, Lisp_Object keyfile, Lisp_Object callback,
+ Lisp_Object loglevel)
{
int ret = GNUTLS_E_SUCCESS;
GNUTLS_LOG (1, max_log_level, "setting the priority string");
- ret = gnutls_priority_set_direct(state,
- (char*) SDATA (priority_string),
- NULL);
+ ret = gnutls_priority_set_direct (state,
+ (char*) SDATA (priority_string),
+ NULL);
if (ret < GNUTLS_E_SUCCESS)
return gnutls_make_error (ret);
DEFUN ("gnutls-bye", Fgnutls_bye,
Sgnutls_bye, 2, 2, 0,
- doc: /* Terminate current GNU TLS connection for PROCESS.
+ doc: /* Terminate current GnuTLS connection for process PROC.
The connection should have been initiated using `gnutls-handshake'.
If CONT is not nil the TLS connection gets terminated and further
-receives and sends will be disallowed. If the return value is zero you
+receives and sends will be disallowed. If the return value is zero you
may continue using the connection. If CONT is nil, GnuTLS actually
sends an alert containing a close request and waits for the peer to
reply with the same message. In order to reuse the connection you