X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=lib%2Fsilcutil%2Fsilcfdstream.h;h=f64d6b53fe5e5d03e3dfc9611cb3ea5de9bd642f;hb=e9374395ec9747bddd3ea0bfd3e5a17717e97b31;hp=3acb8cecaf78a135f1c50ddb05c781d818b5014f;hpb=c27a4ecc3e616e8a5ee09b8ca888ed6ff3e501f7;p=silc.git diff --git a/lib/silcutil/silcfdstream.h b/lib/silcutil/silcfdstream.h index 3acb8cec..f64d6b53 100644 --- a/lib/silcutil/silcfdstream.h +++ b/lib/silcutil/silcfdstream.h @@ -4,7 +4,7 @@ Author: Pekka Riikonen - Copyright (C) 2005 Pekka Riikonen + Copyright (C) 2005 - 2007 Pekka Riikonen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -26,6 +26,9 @@ * interface should be used only with real file descriptors, not with * sockets. Use the SILC Socket Stream for sockets. * + * SILC File Descriptor Stream is not thread-safe. If same stream must be + * used in multithreaded environment concurrency control must be employed. + * ***/ #ifndef SILCFDSTREAM_H @@ -35,7 +38,7 @@ * * SYNOPSIS * - * SilcStream silc_fd_stream_create(int fd, SilcSchedule schedule); + * SilcStream silc_fd_stream_create(int fd); * * DESCRIPTION * @@ -43,15 +46,17 @@ * by `fd'. The stream is closed with the silc_stream_close and destroyed * with the silc_stream_destroy. * + * If the silc_stream_set_notifier is called the stream is set to + * non-blocking mode. + * ***/ -SilcStream silc_fd_stream_create(int fd, SilcSchedule schedule); +SilcStream silc_fd_stream_create(int fd); /****f* silcutil/SilcFDStreamAPI/silc_fd_stream_create2 * * SYNOPSIS * - * SilcStream silc_fd_stream_create2(int read_fd, int write_fd, - * SilcSchedule schedule); + * SilcStream silc_fd_stream_create2(int read_fd, int write_fd); * * DESCRIPTION * @@ -60,9 +65,50 @@ SilcStream silc_fd_stream_create(int fd, SilcSchedule schedule); * and `write_fd' opened for writing. The stream is closed with the * silc_stream_close and destroyed with the silc_stream_destroy. * + * If the silc_stream_set_notifier is called the stream is set to + * non-blocking mode. + * + ***/ +SilcStream silc_fd_stream_create2(int read_fd, int write_fd); + +/****f* silcutil/SilcFDStreamAPI/silc_fd_stream_file + * + * SYNOPSIS + * + * SilcStream silc_fd_stream_file(const char *filename, SilcBool reading, + * SilcBool writing); + * + * DESCRIPTION + * + * Same as silc_fd_stream_create but creates the stream by opening the + * file indicated by `filename'. If the `reading' is TRUE the file is + * opened for reading. If the `writing' is TRUE the file is opened + * for writing. + * + * If the silc_stream_set_notifier is called the stream is set to + * non-blocking mode. + * + ***/ +SilcStream silc_fd_stream_file(const char *filename, SilcBool reading, + SilcBool writing); + +/****f* silcutil/SilcFDStreamAPI/silc_fd_stream_file2 + * + * SYNOPSIS + * + * SilcStream silc_fd_stream_file2(const char *read_file, + * const char *write_file); + * + * DESCRIPTION + * + * Same as silc_fd_stream_file but creates the stream by opening `read_file' + * for reading and `write_file' for writing. + * + * If the silc_stream_set_notifier is called the stream is set to + * non-blocking mode. + * ***/ -SilcStream silc_fd_stream_create2(int read_fd, int write_fd, - SilcSchedule schedule); +SilcStream silc_fd_stream_file2(const char *read_file, const char *write_file); /****f* silcutil/SilcFDStreamAPI/silc_fd_stream_get_info * @@ -78,7 +124,8 @@ SilcStream silc_fd_stream_create2(int read_fd, int write_fd, * function. * ***/ -SilcBool silc_fd_stream_get_info(SilcStream stream, int *read_fd, int *write_fd); +SilcBool silc_fd_stream_get_info(SilcStream stream, + int *read_fd, int *write_fd); /****f* silcutil/SilcFDStreamAPI/silc_fd_stream_get_error *