Mercurial > emacs
comparison src/process.c @ 110584:9d94d76ce611
Set up GnuTLS support.
* configure.in: Set up GnuTLS.
* lisp/net/gnutls.el: GnuTLS glue code to set up a connection.
* src/Makefile.in (LIBGNUTLS_LIBS, LIBGNUTLS_CFLAGS, ALL_CFLAGS)
(obj, LIBES): Set up GnuTLS support.
* src/config.in: Set up GnuTLS support.
* src/emacs.c: Set up GnuTLS support and call syms_of_gnutls.
* src/gnutls.c: The source code for GnuTLS support in Emacs.
* src/gnutls.h: The GnuTLS glue for Emacs, macros and enums.
* src/process.c (make_process, Fstart_process)
(read_process_output, send_process): Set up GnuTLS support for
process input/output file descriptors.
* src/process.h: Set up GnuTLS support.
author | Ted Zlatanov <tzz@lifelogs.com> |
---|---|
date | Sun, 26 Sep 2010 01:06:28 -0500 |
parents | ea50a897140e |
children | c06958da83b5 |
comparison
equal
deleted
inserted
replaced
110583:b6d2a63ad993 | 110584:9d94d76ce611 |
---|---|
103 #include "composite.h" | 103 #include "composite.h" |
104 #include "atimer.h" | 104 #include "atimer.h" |
105 #include "sysselect.h" | 105 #include "sysselect.h" |
106 #include "syssignal.h" | 106 #include "syssignal.h" |
107 #include "syswait.h" | 107 #include "syswait.h" |
108 #ifdef HAVE_GNUTLS | |
109 #include "gnutls.h" | |
110 #endif | |
108 | 111 |
109 #if defined (USE_GTK) || defined (HAVE_GCONF) | 112 #if defined (USE_GTK) || defined (HAVE_GCONF) |
110 #include "xgselect.h" | 113 #include "xgselect.h" |
111 #endif /* defined (USE_GTK) || defined (HAVE_GCONF) */ | 114 #endif /* defined (USE_GTK) || defined (HAVE_GCONF) */ |
112 #ifdef HAVE_NS | 115 #ifdef HAVE_NS |
581 p->adaptive_read_buffering = 0; | 584 p->adaptive_read_buffering = 0; |
582 p->read_output_delay = 0; | 585 p->read_output_delay = 0; |
583 p->read_output_skip = 0; | 586 p->read_output_skip = 0; |
584 #endif | 587 #endif |
585 | 588 |
589 #ifdef HAVE_GNUTLS | |
590 p->gnutls_initstage = GNUTLS_STAGE_EMPTY; | |
591 #endif | |
592 | |
586 /* If name is already in use, modify it until it is unused. */ | 593 /* If name is already in use, modify it until it is unused. */ |
587 | 594 |
588 name1 = name; | 595 name1 = name; |
589 for (i = 1; ; i++) | 596 for (i = 1; ; i++) |
590 { | 597 { |
1523 XPROCESS (proc)->type = Qreal; | 1530 XPROCESS (proc)->type = Qreal; |
1524 XPROCESS (proc)->buffer = buffer; | 1531 XPROCESS (proc)->buffer = buffer; |
1525 XPROCESS (proc)->sentinel = Qnil; | 1532 XPROCESS (proc)->sentinel = Qnil; |
1526 XPROCESS (proc)->filter = Qnil; | 1533 XPROCESS (proc)->filter = Qnil; |
1527 XPROCESS (proc)->command = Flist (nargs - 2, args + 2); | 1534 XPROCESS (proc)->command = Flist (nargs - 2, args + 2); |
1535 | |
1536 #ifdef HAVE_GNUTLS | |
1537 /* AKA GNUTLS_INITSTAGE(proc). */ | |
1538 XPROCESS (proc)->gnutls_initstage = GNUTLS_STAGE_EMPTY; | |
1539 XPROCESS (proc)->gnutls_cred_type = Qnil; | |
1540 #endif | |
1528 | 1541 |
1529 #ifdef ADAPTIVE_READ_BUFFERING | 1542 #ifdef ADAPTIVE_READ_BUFFERING |
1530 XPROCESS (proc)->adaptive_read_buffering | 1543 XPROCESS (proc)->adaptive_read_buffering |
1531 = (NILP (Vprocess_adaptive_read_buffering) ? 0 | 1544 = (NILP (Vprocess_adaptive_read_buffering) ? 0 |
1532 : EQ (Vprocess_adaptive_read_buffering, Qt) ? 1 : 2); | 1545 : EQ (Vprocess_adaptive_read_buffering, Qt) ? 1 : 2); |
5097 } | 5110 } |
5098 else | 5111 else |
5099 #endif | 5112 #endif |
5100 if (proc_buffered_char[channel] < 0) | 5113 if (proc_buffered_char[channel] < 0) |
5101 { | 5114 { |
5102 nbytes = emacs_read (channel, chars + carryover, readmax); | 5115 #ifdef HAVE_GNUTLS |
5116 if (NETCONN_P(proc) && GNUTLS_PROCESS_USABLE (proc)) | |
5117 nbytes = emacs_gnutls_read (channel, XPROCESS (proc)->gnutls_state, | |
5118 chars + carryover, readmax); | |
5119 else | |
5120 #endif | |
5121 nbytes = emacs_read (channel, chars + carryover, readmax); | |
5103 #ifdef ADAPTIVE_READ_BUFFERING | 5122 #ifdef ADAPTIVE_READ_BUFFERING |
5104 if (nbytes > 0 && p->adaptive_read_buffering) | 5123 if (nbytes > 0 && p->adaptive_read_buffering) |
5105 { | 5124 { |
5106 int delay = p->read_output_delay; | 5125 int delay = p->read_output_delay; |
5107 if (nbytes < 256) | 5126 if (nbytes < 256) |
5130 } | 5149 } |
5131 else | 5150 else |
5132 { | 5151 { |
5133 chars[carryover] = proc_buffered_char[channel]; | 5152 chars[carryover] = proc_buffered_char[channel]; |
5134 proc_buffered_char[channel] = -1; | 5153 proc_buffered_char[channel] = -1; |
5135 nbytes = emacs_read (channel, chars + carryover + 1, readmax - 1); | 5154 #ifdef HAVE_GNUTLS |
5155 if (NETCONN_P(proc) && GNUTLS_PROCESS_USABLE (proc)) | |
5156 nbytes = emacs_gnutls_read (channel, XPROCESS (proc)->gnutls_state, | |
5157 chars + carryover + 1, readmax - 1); | |
5158 else | |
5159 #endif | |
5160 nbytes = emacs_read (channel, chars + carryover + 1, readmax - 1); | |
5136 if (nbytes < 0) | 5161 if (nbytes < 0) |
5137 nbytes = 1; | 5162 nbytes = 1; |
5138 else | 5163 else |
5139 nbytes = nbytes + 1; | 5164 nbytes = nbytes + 1; |
5140 } | 5165 } |
5540 } | 5565 } |
5541 } | 5566 } |
5542 else | 5567 else |
5543 #endif | 5568 #endif |
5544 { | 5569 { |
5545 rv = emacs_write (outfd, (char *) buf, this); | 5570 #ifdef HAVE_GNUTLS |
5571 if (NETCONN_P(proc) && GNUTLS_PROCESS_USABLE (proc)) | |
5572 rv = emacs_gnutls_write (outfd, | |
5573 XPROCESS (proc)->gnutls_state, | |
5574 (char *) buf, this); | |
5575 else | |
5576 #endif | |
5577 rv = emacs_write (outfd, (char *) buf, this); | |
5546 #ifdef ADAPTIVE_READ_BUFFERING | 5578 #ifdef ADAPTIVE_READ_BUFFERING |
5547 if (p->read_output_delay > 0 | 5579 if (p->read_output_delay > 0 |
5548 && p->adaptive_read_buffering == 1) | 5580 && p->adaptive_read_buffering == 1) |
5549 { | 5581 { |
5550 p->read_output_delay = 0; | 5582 p->read_output_delay = 0; |