summaryrefslogtreecommitdiff
path: root/src/gnutls.c
diff options
context:
space:
mode:
authorJuanma Barranquero <lekktu@gmail.com>2010-10-03 06:12:15 +0200
committerJuanma Barranquero <lekktu@gmail.com>2010-10-03 06:12:15 +0200
commit74f1829da3cd153bc49480c8f6f2631fa0669284 (patch)
treee74a3d4faac8a766b1115bdf4df8d221adc55fef /src/gnutls.c
parent0437978e8311503509d18a018762ba37af138efa (diff)
downloademacs-74f1829da3cd153bc49480c8f6f2631fa0669284.tar.gz
src/gnutls.c: Doc fixes. Make some functions static.
(emacs_gnutls_handshake, gnutls_make_error, gnutls_emacs_global_init) (gnutls_emacs_global_deinit): Make static. (Fgnutls_get_initstage, Fgnutls_deinit, Fgnutls_boot, Fgnutls_bye): Fix typos in docstrings. (Fgnutls_error_fatalp, Fgnutls_error_string): Doc fixes. (Fgnutls_errorp): Doc fix; use ERR for the argument name.
Diffstat (limited to 'src/gnutls.c')
-rw-r--r--src/gnutls.c69
1 files changed, 38 insertions, 31 deletions
diff --git a/src/gnutls.c b/src/gnutls.c
index 37b4341d184..d49f0b27655 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -32,7 +32,7 @@ Lisp_Object Qgnutls_e_interrupted, Qgnutls_e_again,
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;
@@ -117,7 +117,8 @@ emacs_gnutls_read (int fildes, struct Lisp_Process *proc, char *buf,
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)
{
@@ -135,9 +136,9 @@ Lisp_Object gnutls_make_error (int 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);
@@ -145,19 +146,21 @@ See also `gnutls-boot'. */)
}
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;
@@ -186,9 +189,10 @@ ERROR is an integer or a symbol with an integer `gnutls-code' property. */)
}
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;
@@ -214,9 +218,9 @@ ERROR is an integer or a symbol with an integer `gnutls-code' property. */)
}
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;
@@ -235,7 +239,8 @@ See also `gnutls-init'. */)
/* 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;
@@ -249,7 +254,8 @@ Lisp_Object gnutls_emacs_global_init (void)
/* 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 ();
@@ -259,17 +265,18 @@ Lisp_Object gnutls_emacs_global_deinit (void)
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).
@@ -283,16 +290,16 @@ Note that the priority is set on the client. The server does not use
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;
@@ -427,9 +434,9 @@ KEYFILE and optionally CALLBACK. */)
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);
@@ -466,11 +473,11 @@ KEYFILE and optionally CALLBACK. */)
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