diff options
| author | Juanma Barranquero | 2010-10-03 06:12:15 +0200 |
|---|---|---|
| committer | Juanma Barranquero | 2010-10-03 06:12:15 +0200 |
| commit | 74f1829da3cd153bc49480c8f6f2631fa0669284 (patch) | |
| tree | e74a3d4faac8a766b1115bdf4df8d221adc55fef | |
| parent | 0437978e8311503509d18a018762ba37af138efa (diff) | |
| download | emacs-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/ChangeLog | 9 | ||||
| -rw-r--r-- | src/gnutls.c | 69 |
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 @@ | |||
| 1 | 2010-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 | |||
| 1 | 2010-10-03 Chong Yidong <cyd@stupidchicken.com> | 10 | 2010-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; |
| 33 | int global_initialized; | 33 | int global_initialized; |
| 34 | 34 | ||
| 35 | void | 35 | static void |
| 36 | emacs_gnutls_handshake (struct Lisp_Process *proc) | 36 | emacs_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. */ |
| 120 | Lisp_Object gnutls_make_error (int error) | 120 | static Lisp_Object |
| 121 | gnutls_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 | ||
| 137 | DEFUN ("gnutls-get-initstage", Fgnutls_get_initstage, Sgnutls_get_initstage, 1, 1, 0, | 138 | DEFUN ("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. |
| 139 | See also `gnutls-boot'. */) | 140 | See 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 | ||
| 147 | DEFUN ("gnutls-errorp", Fgnutls_errorp, Sgnutls_errorp, 1, 1, 0, | 148 | DEFUN ("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. |
| 149 | indicates a GnuTLS problem. */) | 150 | ERROR is an integer or a symbol with an integer `gnutls-code' property. |
| 150 | (Lisp_Object error) | 151 | usage: (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 | ||
| 157 | DEFUN ("gnutls-error-fatalp", Fgnutls_error_fatalp, Sgnutls_error_fatalp, 1, 1, 0, | 159 | DEFUN ("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. |
| 159 | ERROR is an integer or a symbol with an integer `gnutls-code' property. */) | 161 | ERROR is an integer or a symbol with an integer `gnutls-code' property. |
| 160 | (Lisp_Object err) | 162 | usage: (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 | ||
| 188 | DEFUN ("gnutls-error-string", Fgnutls_error_string, Sgnutls_error_string, 1, 1, 0, | 191 | DEFUN ("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. |
| 190 | ERROR is an integer or a symbol with an integer `gnutls-code' property. */) | 193 | ERROR is an integer or a symbol with an integer `gnutls-code' property. |
| 191 | (Lisp_Object err) | 194 | usage: (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 | ||
| 216 | DEFUN ("gnutls-deinit", Fgnutls_deinit, Sgnutls_deinit, 1, 1, 0, | 220 | DEFUN ("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. |
| 218 | See also `gnutls-init'. */) | 222 | See 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. |
| 236 | Call `gnutls-global-deinit' when GNU TLS usage is no longer needed. | 240 | Call `gnutls-global-deinit' when GNU TLS usage is no longer needed. |
| 237 | Returns zero on success. */ | 241 | Returns zero on success. */ |
| 238 | Lisp_Object gnutls_emacs_global_init (void) | 242 | static Lisp_Object |
| 243 | gnutls_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. |
| 251 | See also `gnutls-global-init'. */ | 256 | See also `gnutls-global-init'. */ |
| 252 | Lisp_Object gnutls_emacs_global_deinit (void) | 257 | static Lisp_Object |
| 258 | gnutls_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 | ||
| 262 | static void gnutls_log_function (int level, const char* string) | 268 | static void |
| 269 | gnutls_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 | ||
| 267 | DEFUN ("gnutls-boot", Fgnutls_boot, Sgnutls_boot, 3, 7, 0, | 274 | DEFUN ("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. |
| 269 | Currently only client mode is supported. Returns a success/failure | 276 | Currently only client mode is supported. Returns a success/failure |
| 270 | value you can check with `gnutls-errorp'. | 277 | value you can check with `gnutls-errorp'. |
| 271 | 278 | ||
| 272 | PRIORITY_STRING is a string describing the priority. | 279 | PRIORITY-STRING is a string describing the priority. |
| 273 | TYPE is either `gnutls-anon' or `gnutls-x509pki'. | 280 | TYPE is either `gnutls-anon' or `gnutls-x509pki'. |
| 274 | TRUSTFILE is a PEM encoded trust file for `gnutls-x509pki'. | 281 | TRUSTFILE is a PEM encoded trust file for `gnutls-x509pki'. |
| 275 | KEYFILE is ... for `gnutls-x509pki' (TODO). | 282 | KEYFILE is ... for `gnutls-x509pki' (TODO). |
| @@ -283,16 +290,16 @@ Note that the priority is set on the client. The server does not use | |||
| 283 | the protocols's priority except for disabling protocols that were not | 290 | the protocols's priority except for disabling protocols that were not |
| 284 | specified. | 291 | specified. |
| 285 | 292 | ||
| 286 | Processes must be initialized with this function before other GNU TLS | 293 | Processes must be initialized with this function before other GnuTLS |
| 287 | functions are used. This function allocates resources which can only | 294 | functions are used. This function allocates resources which can only |
| 288 | be deallocated by calling `gnutls-deinit' or by calling it again. | 295 | be deallocated by calling `gnutls-deinit' or by calling it again. |
| 289 | 296 | ||
| 290 | Each authentication type may need additional information in order to | 297 | Each authentication type may need additional information in order to |
| 291 | work. For X.509 PKI (`gnutls-x509pki'), you need TRUSTFILE and | 298 | work. For X.509 PKI (`gnutls-x509pki'), you need TRUSTFILE and |
| 292 | KEYFILE and optionally CALLBACK. */) | 299 | KEYFILE 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 | ||
| 467 | DEFUN ("gnutls-bye", Fgnutls_bye, | 474 | DEFUN ("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. |
| 470 | The connection should have been initiated using `gnutls-handshake'. | 477 | The connection should have been initiated using `gnutls-handshake'. |
| 471 | 478 | ||
| 472 | If CONT is not nil the TLS connection gets terminated and further | 479 | If CONT is not nil the TLS connection gets terminated and further |
| 473 | receives and sends will be disallowed. If the return value is zero you | 480 | receives and sends will be disallowed. If the return value is zero you |
| 474 | may continue using the connection. If CONT is nil, GnuTLS actually | 481 | may continue using the connection. If CONT is nil, GnuTLS actually |
| 475 | sends an alert containing a close request and waits for the peer to | 482 | sends an alert containing a close request and waits for the peer to |
| 476 | reply with the same message. In order to reuse the connection you | 483 | reply with the same message. In order to reuse the connection you |