Mercurial > hg > xemacs-beta
comparison src/lstream.h @ 5922:4b055de36bb9 cygwin
merging heads 2
author | Henry Thompson <ht@markup.co.uk> |
---|---|
date | Fri, 27 Feb 2015 17:47:15 +0000 |
parents | a216b3c2b09e |
children |
comparison
equal
deleted
inserted
replaced
5921:68639fb08af8 | 5922:4b055de36bb9 |
---|---|
21 | 21 |
22 /* Written by Ben Wing. */ | 22 /* Written by Ben Wing. */ |
23 | 23 |
24 #ifndef INCLUDED_lstream_h_ | 24 #ifndef INCLUDED_lstream_h_ |
25 #define INCLUDED_lstream_h_ | 25 #define INCLUDED_lstream_h_ |
26 | |
27 #include "tls.h" | |
26 | 28 |
27 /************************************************************************/ | 29 /************************************************************************/ |
28 /* definition of Lstream object */ | 30 /* definition of Lstream object */ |
29 /************************************************************************/ | 31 /************************************************************************/ |
30 | 32 |
172 Bytecount size); | 174 Bytecount size); |
173 /* Return non-zero if the last write operation on the stream resulted | 175 /* Return non-zero if the last write operation on the stream resulted |
174 in an attempt to block (EWOULDBLOCK). If this method does not | 176 in an attempt to block (EWOULDBLOCK). If this method does not |
175 exists, the implementation returns 0 */ | 177 exists, the implementation returns 0 */ |
176 int (*was_blocked_p) (Lstream *stream); | 178 int (*was_blocked_p) (Lstream *stream); |
179 /* If the reader or writer method returned LSTREAM_ERROR, the errno | |
180 associated with the error, or zero if there was no system error or this | |
181 method is not implemented. */ | |
182 int (*error) (Lstream *stream); | |
177 /* Rewind the stream. If this is NULL, the stream is not seekable. */ | 183 /* Rewind the stream. If this is NULL, the stream is not seekable. */ |
178 int (*rewinder) (Lstream *stream); | 184 int (*rewinder) (Lstream *stream); |
179 /* Indicate whether this stream is seekable -- i.e. it can be rewound. | 185 /* Indicate whether this stream is seekable -- i.e. it can be rewound. |
180 This method is ignored if the stream does not have a rewind | 186 This method is ignored if the stream does not have a rewind |
181 method. If this method is not present, the result is determined | 187 method. If this method is not present, the result is determined |
202 Lstream_close(). Called only once (NOT called at disksave time). */ | 208 Lstream_close(). Called only once (NOT called at disksave time). */ |
203 void (*finalizer) (Lstream *stream); | 209 void (*finalizer) (Lstream *stream); |
204 /* Mark this object for garbage collection. Same semantics as | 210 /* Mark this object for garbage collection. Same semantics as |
205 a standard Lisp_Object marker. This function can be NULL. */ | 211 a standard Lisp_Object marker. This function can be NULL. */ |
206 Lisp_Object (*marker) (Lisp_Object lstream); | 212 Lisp_Object (*marker) (Lisp_Object lstream); |
213 /* Return nonzero if this stream is using a TLS connection */ | |
214 int (*tls_p) (Lstream *stream); | |
215 /* Perform STARTTLS negotiation on a pair of streams, one for input and one | |
216 for output. Both are transformed if negotiation is successful. */ | |
217 int (*tls_negotiater) (Lstream *instream, Lstream *outstream, | |
218 const Extbyte *host, Lisp_Object keylist); | |
207 } Lstream_implementation; | 219 } Lstream_implementation; |
208 | 220 |
209 #define DEFINE_LSTREAM_IMPLEMENTATION(name, c_name) \ | 221 #define DEFINE_LSTREAM_IMPLEMENTATION(name, c_name) \ |
210 Lstream_implementation lstream_##c_name[1] = \ | 222 Lstream_implementation lstream_##c_name[1] = \ |
211 { { (name), sizeof (struct c_name##_stream), \ | 223 { { (name), sizeof (struct c_name##_stream), \ |
304 void Lstream_fungetc (Lstream *lstr, int c); | 316 void Lstream_fungetc (Lstream *lstr, int c); |
305 Bytecount Lstream_read (Lstream *lstr, void *data, Bytecount size); | 317 Bytecount Lstream_read (Lstream *lstr, void *data, Bytecount size); |
306 Charcount Lstream_character_tell (Lstream *); | 318 Charcount Lstream_character_tell (Lstream *); |
307 int Lstream_write (Lstream *lstr, const void *data, | 319 int Lstream_write (Lstream *lstr, const void *data, |
308 Bytecount size); | 320 Bytecount size); |
321 int Lstream_errno (Lstream *lstr); | |
309 int Lstream_was_blocked_p (Lstream *lstr); | 322 int Lstream_was_blocked_p (Lstream *lstr); |
310 void Lstream_unread (Lstream *lstr, const void *data, Bytecount size); | 323 void Lstream_unread (Lstream *lstr, const void *data, Bytecount size); |
311 int Lstream_rewind (Lstream *lstr); | 324 int Lstream_rewind (Lstream *lstr); |
312 int Lstream_seekable_p (Lstream *lstr); | 325 int Lstream_seekable_p (Lstream *lstr); |
313 int Lstream_close (Lstream *lstr); | 326 int Lstream_close (Lstream *lstr); |
314 int Lstream_close_noflush (Lstream *lstr); | 327 int Lstream_close_noflush (Lstream *lstr); |
328 | |
329 int Lstream_tls_p (Lstream *lstr); | |
330 int Lstream_tls_negotiate (Lstream *instr, Lstream *outstr, | |
331 const Extbyte *host, Lisp_Object keylist); | |
315 | 332 |
316 void Lstream_delete (Lstream *lstr); | 333 void Lstream_delete (Lstream *lstr); |
317 void Lstream_set_character_mode (Lstream *str); | 334 void Lstream_set_character_mode (Lstream *str); |
318 void Lstream_unset_character_mode (Lstream *lstr); | 335 void Lstream_unset_character_mode (Lstream *lstr); |
319 | 336 |
457 #define LSTR_BLOCKED_OK 8 | 474 #define LSTR_BLOCKED_OK 8 |
458 | 475 |
459 Lisp_Object make_stdio_input_stream (FILE *stream, int flags); | 476 Lisp_Object make_stdio_input_stream (FILE *stream, int flags); |
460 Lisp_Object make_stdio_output_stream (FILE *stream, int flags); | 477 Lisp_Object make_stdio_output_stream (FILE *stream, int flags); |
461 Lisp_Object make_filedesc_input_stream (int filedesc, int offset, int count, | 478 Lisp_Object make_filedesc_input_stream (int filedesc, int offset, int count, |
462 int flags); | 479 int flags, tls_state_t *state); |
463 Lisp_Object make_filedesc_output_stream (int filedesc, int offset, int count, | 480 Lisp_Object make_filedesc_output_stream (int filedesc, int offset, int count, |
464 int flags); | 481 int flags, tls_state_t *state); |
465 void filedesc_stream_set_pty_flushing (Lstream *stream, | 482 void filedesc_stream_set_pty_flushing (Lstream *stream, |
466 int pty_max_bytes, | 483 int pty_max_bytes, |
467 Ibyte eof_char); | 484 Ibyte eof_char); |
468 int filedesc_stream_fd (Lstream *stream); | 485 int filedesc_stream_fd (Lstream *stream); |
469 Lisp_Object make_lisp_string_input_stream (Lisp_Object string, | 486 Lisp_Object make_lisp_string_input_stream (Lisp_Object string, |