aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuanma Barranquero2010-10-03 06:12:15 +0200
committerJuanma Barranquero2010-10-03 06:12:15 +0200
commit74f1829da3cd153bc49480c8f6f2631fa0669284 (patch)
treee74a3d4faac8a766b1115bdf4df8d221adc55fef
parent0437978e8311503509d18a018762ba37af138efa (diff)
downloademacs-74f1829da3cd153bc49480c8f6f2631fa0669284.tar.gz
emacs-74f1829da3cd153bc49480c8f6f2631fa0669284.zip
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.
-rw-r--r--src/ChangeLog9
-rw-r--r--src/gnutls.c69
2 files changed, 47 insertions, 31 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index ee022b78ddd..fda33c8db17 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,12 @@
12010-10-03 Juanma Barranquero <lekktu@gmail.com>
2
3 * gnutls.c (emacs_gnutls_handshake, gnutls_make_error)
4 (gnutls_emacs_global_init, gnutls_emacs_global_deinit): Make static.
5 (Fgnutls_get_initstage, Fgnutls_deinit, Fgnutls_boot, Fgnutls_bye):
6 Fix typos in docstrings.
7 (Fgnutls_error_fatalp, Fgnutls_error_string): Doc fixes.
8 (Fgnutls_errorp): Doc fix; use ERR for the argument name.
9
12010-10-03 Chong Yidong <cyd@stupidchicken.com> 102010-10-03 Chong Yidong <cyd@stupidchicken.com>
2 11
3 * keyboard.c (command_loop_1): Make sure the mark is really alive 12 * keyboard.c (command_loop_1): Make sure the mark is really alive
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,
32 Qgnutls_e_invalid_session, Qgnutls_e_not_ready_for_handshake; 32 Qgnutls_e_invalid_session, Qgnutls_e_not_ready_for_handshake;
33int global_initialized; 33int global_initialized;
34 34
35void 35static void
36emacs_gnutls_handshake (struct Lisp_Process *proc) 36emacs_gnutls_handshake (struct Lisp_Process *proc)
37{ 37{
38 gnutls_session_t state = proc->gnutls_state; 38 gnutls_session_t state = proc->gnutls_state;
@@ -117,7 +117,8 @@ emacs_gnutls_read (int fildes, struct Lisp_Process *proc, char *buf,
117 known symbol like `gnutls_e_interrupted' and `gnutls_e_again' or 117 known symbol like `gnutls_e_interrupted' and `gnutls_e_again' or
118 simply the integer value of the error. GNUTLS_E_SUCCESS is mapped 118 simply the integer value of the error. GNUTLS_E_SUCCESS is mapped
119 to Qt. */ 119 to Qt. */
120Lisp_Object gnutls_make_error (int error) 120static Lisp_Object
121gnutls_make_error (int error)
121{ 122{
122 switch (error) 123 switch (error)
123 { 124 {
@@ -135,9 +136,9 @@ Lisp_Object gnutls_make_error (int error)
135} 136}
136 137
137DEFUN ("gnutls-get-initstage", Fgnutls_get_initstage, Sgnutls_get_initstage, 1, 1, 0, 138DEFUN ("gnutls-get-initstage", Fgnutls_get_initstage, Sgnutls_get_initstage, 1, 1, 0,
138 doc: /* Return the GnuTLS init stage of PROCESS. 139 doc: /* Return the GnuTLS init stage of process PROC.
139See also `gnutls-boot'. */) 140See also `gnutls-boot'. */)
140 (Lisp_Object proc) 141 (Lisp_Object proc)
141{ 142{
142 CHECK_PROCESS (proc); 143 CHECK_PROCESS (proc);
143 144
@@ -145,19 +146,21 @@ See also `gnutls-boot'. */)
145} 146}
146 147
147DEFUN ("gnutls-errorp", Fgnutls_errorp, Sgnutls_errorp, 1, 1, 0, 148DEFUN ("gnutls-errorp", Fgnutls_errorp, Sgnutls_errorp, 1, 1, 0,
148 doc: /* Returns t if ERROR (as generated by gnutls_make_error) 149 doc: /* Return t if ERROR indicates a GnuTLS problem.
149indicates a GnuTLS problem. */) 150ERROR is an integer or a symbol with an integer `gnutls-code' property.
150 (Lisp_Object error) 151usage: (gnutls-errorp ERROR) */)
152 (Lisp_Object err)
151{ 153{
152 if (EQ (error, Qt)) return Qnil; 154 if (EQ (err, Qt)) return Qnil;
153 155
154 return Qt; 156 return Qt;
155} 157}
156 158
157DEFUN ("gnutls-error-fatalp", Fgnutls_error_fatalp, Sgnutls_error_fatalp, 1, 1, 0, 159DEFUN ("gnutls-error-fatalp", Fgnutls_error_fatalp, Sgnutls_error_fatalp, 1, 1, 0,
158 doc: /* Checks if ERROR is fatal. 160 doc: /* Check if ERROR is fatal.
159ERROR is an integer or a symbol with an integer `gnutls-code' property. */) 161ERROR is an integer or a symbol with an integer `gnutls-code' property.
160 (Lisp_Object err) 162usage: (gnutls-error-fatalp ERROR) */)
163 (Lisp_Object err)
161{ 164{
162 Lisp_Object code; 165 Lisp_Object code;
163 166
@@ -186,9 +189,10 @@ ERROR is an integer or a symbol with an integer `gnutls-code' property. */)
186} 189}
187 190
188DEFUN ("gnutls-error-string", Fgnutls_error_string, Sgnutls_error_string, 1, 1, 0, 191DEFUN ("gnutls-error-string", Fgnutls_error_string, Sgnutls_error_string, 1, 1, 0,
189 doc: /* Returns a description of ERROR. 192 doc: /* Return a description of ERROR.
190ERROR is an integer or a symbol with an integer `gnutls-code' property. */) 193ERROR is an integer or a symbol with an integer `gnutls-code' property.
191 (Lisp_Object err) 194usage: (gnutls-error-string ERROR) */)
195 (Lisp_Object err)
192{ 196{
193 Lisp_Object code; 197 Lisp_Object code;
194 198
@@ -214,9 +218,9 @@ ERROR is an integer or a symbol with an integer `gnutls-code' property. */)
214} 218}
215 219
216DEFUN ("gnutls-deinit", Fgnutls_deinit, Sgnutls_deinit, 1, 1, 0, 220DEFUN ("gnutls-deinit", Fgnutls_deinit, Sgnutls_deinit, 1, 1, 0,
217 doc: /* Deallocate GNU TLS resources associated with PROCESS. 221 doc: /* Deallocate GNU TLS resources associated with process PROC.
218See also `gnutls-init'. */) 222See also `gnutls-init'. */)
219 (Lisp_Object proc) 223 (Lisp_Object proc)
220{ 224{
221 gnutls_session_t state; 225 gnutls_session_t state;
222 226
@@ -235,7 +239,8 @@ See also `gnutls-init'. */)
235/* Initializes global GNU TLS state to defaults. 239/* Initializes global GNU TLS state to defaults.
236Call `gnutls-global-deinit' when GNU TLS usage is no longer needed. 240Call `gnutls-global-deinit' when GNU TLS usage is no longer needed.
237Returns zero on success. */ 241Returns zero on success. */
238Lisp_Object gnutls_emacs_global_init (void) 242static Lisp_Object
243gnutls_emacs_global_init (void)
239{ 244{
240 int ret = GNUTLS_E_SUCCESS; 245 int ret = GNUTLS_E_SUCCESS;
241 246
@@ -249,7 +254,8 @@ Lisp_Object gnutls_emacs_global_init (void)
249 254
250/* Deinitializes global GNU TLS state. 255/* Deinitializes global GNU TLS state.
251See also `gnutls-global-init'. */ 256See also `gnutls-global-init'. */
252Lisp_Object gnutls_emacs_global_deinit (void) 257static Lisp_Object
258gnutls_emacs_global_deinit (void)
253{ 259{
254 if (global_initialized) 260 if (global_initialized)
255 gnutls_global_deinit (); 261 gnutls_global_deinit ();
@@ -259,17 +265,18 @@ Lisp_Object gnutls_emacs_global_deinit (void)
259 return gnutls_make_error (GNUTLS_E_SUCCESS); 265 return gnutls_make_error (GNUTLS_E_SUCCESS);
260} 266}
261 267
262static void gnutls_log_function (int level, const char* string) 268static void
269gnutls_log_function (int level, const char* string)
263{ 270{
264 message("gnutls.c: [%d] %s", level, string); 271 message ("gnutls.c: [%d] %s", level, string);
265} 272}
266 273
267DEFUN ("gnutls-boot", Fgnutls_boot, Sgnutls_boot, 3, 7, 0, 274DEFUN ("gnutls-boot", Fgnutls_boot, Sgnutls_boot, 3, 7, 0,
268 doc: /* Initializes client-mode GnuTLS for process PROC. 275 doc: /* Initialize client-mode GnuTLS for process PROC.
269Currently only client mode is supported. Returns a success/failure 276Currently only client mode is supported. Returns a success/failure
270value you can check with `gnutls-errorp'. 277value you can check with `gnutls-errorp'.
271 278
272PRIORITY_STRING is a string describing the priority. 279PRIORITY-STRING is a string describing the priority.
273TYPE is either `gnutls-anon' or `gnutls-x509pki'. 280TYPE is either `gnutls-anon' or `gnutls-x509pki'.
274TRUSTFILE is a PEM encoded trust file for `gnutls-x509pki'. 281TRUSTFILE is a PEM encoded trust file for `gnutls-x509pki'.
275KEYFILE is ... for `gnutls-x509pki' (TODO). 282KEYFILE is ... for `gnutls-x509pki' (TODO).
@@ -283,16 +290,16 @@ Note that the priority is set on the client. The server does not use
283the protocols's priority except for disabling protocols that were not 290the protocols's priority except for disabling protocols that were not
284specified. 291specified.
285 292
286Processes must be initialized with this function before other GNU TLS 293Processes must be initialized with this function before other GnuTLS
287functions are used. This function allocates resources which can only 294functions are used. This function allocates resources which can only
288be deallocated by calling `gnutls-deinit' or by calling it again. 295be deallocated by calling `gnutls-deinit' or by calling it again.
289 296
290Each authentication type may need additional information in order to 297Each authentication type may need additional information in order to
291work. For X.509 PKI (`gnutls-x509pki'), you need TRUSTFILE and 298work. For X.509 PKI (`gnutls-x509pki'), you need TRUSTFILE and
292KEYFILE and optionally CALLBACK. */) 299KEYFILE and optionally CALLBACK. */)
293 (Lisp_Object proc, Lisp_Object priority_string, Lisp_Object type, 300 (Lisp_Object proc, Lisp_Object priority_string, Lisp_Object type,
294 Lisp_Object trustfile, Lisp_Object keyfile, Lisp_Object callback, 301 Lisp_Object trustfile, Lisp_Object keyfile, Lisp_Object callback,
295 Lisp_Object loglevel) 302 Lisp_Object loglevel)
296{ 303{
297 int ret = GNUTLS_E_SUCCESS; 304 int ret = GNUTLS_E_SUCCESS;
298 305
@@ -427,9 +434,9 @@ KEYFILE and optionally CALLBACK. */)
427 434
428 GNUTLS_LOG (1, max_log_level, "setting the priority string"); 435 GNUTLS_LOG (1, max_log_level, "setting the priority string");
429 436
430 ret = gnutls_priority_set_direct(state, 437 ret = gnutls_priority_set_direct (state,
431 (char*) SDATA (priority_string), 438 (char*) SDATA (priority_string),
432 NULL); 439 NULL);
433 440
434 if (ret < GNUTLS_E_SUCCESS) 441 if (ret < GNUTLS_E_SUCCESS)
435 return gnutls_make_error (ret); 442 return gnutls_make_error (ret);
@@ -466,11 +473,11 @@ KEYFILE and optionally CALLBACK. */)
466 473
467DEFUN ("gnutls-bye", Fgnutls_bye, 474DEFUN ("gnutls-bye", Fgnutls_bye,
468 Sgnutls_bye, 2, 2, 0, 475 Sgnutls_bye, 2, 2, 0,
469 doc: /* Terminate current GNU TLS connection for PROCESS. 476 doc: /* Terminate current GnuTLS connection for process PROC.
470The connection should have been initiated using `gnutls-handshake'. 477The connection should have been initiated using `gnutls-handshake'.
471 478
472If CONT is not nil the TLS connection gets terminated and further 479If CONT is not nil the TLS connection gets terminated and further
473receives and sends will be disallowed. If the return value is zero you 480receives and sends will be disallowed. If the return value is zero you
474may continue using the connection. If CONT is nil, GnuTLS actually 481may continue using the connection. If CONT is nil, GnuTLS actually
475sends an alert containing a close request and waits for the peer to 482sends an alert containing a close request and waits for the peer to
476reply with the same message. In order to reuse the connection you 483reply with the same message. In order to reuse the connection you