Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 2005 - 2007 Pekka Riikonen
+ Copyright (C) 2005 - 2008 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
*/
-/****h* silcutil/SILC File Descriptor Stream Interface
+/****h* silcutil/Fd Stream Interface
*
* DESCRIPTION
*
#ifndef SILCFDSTREAM_H
#define SILCFDSTREAM_H
-/****f* silcutil/SilcFDStreamAPI/silc_fd_stream_create
+/****f* silcutil/silc_fd_stream_create
*
* SYNOPSIS
*
*
* Creates file descriptor stream for the open file descriptor indicated
* by `fd'. The stream is closed with the silc_stream_close and destroyed
- * with the silc_stream_destroy.
+ * with the silc_stream_destroy. Returns NULL if system is out of memory.
*
* If the silc_stream_set_notifier is called the stream is set to
* non-blocking mode.
***/
SilcStream silc_fd_stream_create(int fd, SilcStack stack);
-/****f* silcutil/SilcFDStreamAPI/silc_fd_stream_create2
+/****f* silcutil/silc_fd_stream_create2
*
* SYNOPSIS
*
* Creates file descriptor stream for the open file descriptors indicated
* by `read_fd' and `write_fd'. The `read_fd' must be opened for reading
* and `write_fd' opened for writing. The stream is closed with the
- * silc_stream_close and destroyed with the silc_stream_destroy.
+ * silc_stream_close and destroyed with the silc_stream_destroy. Returns
+ * NULL if system is out of memory.
*
* 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, SilcStack stack);
-/****f* silcutil/SilcFDStreamAPI/silc_fd_stream_file
+/****f* silcutil/silc_fd_stream_file
*
* SYNOPSIS
*
* 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.
+ * for writing. Returns NULL if system is out of memory.
*
* 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, SilcStack stack);
-/****f* silcutil/SilcFDStreamAPI/silc_fd_stream_file2
+/****f* silcutil/silc_fd_stream_file2
*
* SYNOPSIS
*
* DESCRIPTION
*
* Same as silc_fd_stream_file but creates the stream by opening `read_file'
- * for reading and `write_file' for writing.
+ * for reading and `write_file' for writing. Returns NULL if system is
+ * out of memory.
*
* If the silc_stream_set_notifier is called the stream is set to
* non-blocking mode.
SilcStream silc_fd_stream_file2(const char *read_file, const char *write_file,
SilcStack stack);
-/****f* silcutil/SilcFDStreamAPI/silc_fd_stream_get_info
+/****f* silcutil/silc_fd_stream_get_info
*
* SYNOPSIS
*
*
* Returns the file descriptors associated with the stream. The 'write_fd'
* is available only if the stream was created with silc_fd_stream_create2
- * function.
+ * function. Returns FALSE if the information is not available.
*
***/
SilcBool silc_fd_stream_get_info(SilcStream stream,
int *read_fd, int *write_fd);
-/****f* silcutil/SilcFDStreamAPI/silc_fd_stream_get_error
- *
- * SYNOPSIS
- *
- * int silc_fd_stream_get_error(SilcStream stream);
- *
- * DESCRIPTION
- *
- * If error occurred during file descriptor stream operations, this
- * function can be used to retrieve the error number that occurred.
- *
- ***/
-int silc_fd_stream_get_error(SilcStream stream);
+/* Backwards support */
+#define silc_fd_stream_get_error(stream) silc_errno
#endif /* SILCFDSTREAM_H */