Created SILC Runtime Toolkit git repository Part II.
[runtime.git] / lib / silcutil / silcstream.h
index 3067313ba946d5a04ff4b84235497fc65d6309d6..d88efa9243a05e2e0182d64fb289cbdafeacce19 100644 (file)
@@ -4,7 +4,7 @@
 
   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
@@ -26,6 +26,9 @@
  * other stream API derived from this API can use this same interface for
  * reading and writing.
  *
+ * The SilcStream is an abstraction.  It can represent any stream, socket
+ * stream, file descriptor stream, packet stream, etc.
+ *
  * Note that stream implementations usually are not thread-safe.  Always
  * verify whether a stream implementation is thread-safe by checking their
  * corresponding documentation.
@@ -68,11 +71,6 @@ typedef void *SilcStream;
 typedef enum {
   SILC_STREAM_CAN_READ,                /* Data available for reading */
   SILC_STREAM_CAN_WRITE,       /* Stream ready for writing */
-  SILC_STREAM_EOS,             /* End of stream */
-  SILC_STREAM_CLOSED,          /* Stream is closed */
-  SILC_STREAM_INVALID,         /* Stream is invalid */
-  SILC_STREAM_NO_MEMORY,       /* System out of memory */
-  SILC_STREAM_ERROR,           /* Unknown error */
 } SilcStreamStatus;
 /***/
 
@@ -174,6 +172,8 @@ typedef struct {
  *    the notifier callback will later be called with SILC_STREAM_CAN_READ
  *    status when stream is again ready for reading.
  *
+ *    If error occurred the error code can be retrieved with silc_errno.
+ *
  ***/
 int silc_stream_read(SilcStream stream, unsigned char *buf,
                     SilcUInt32 buf_len);
@@ -194,6 +194,8 @@ int silc_stream_read(SilcStream stream, unsigned char *buf,
  *    notifier callback will later be called with SILC_STREAM_CAN_WRITE
  *    status when stream is again ready for writing.
  *
+ *    If error occurred the error code can be retrieved with silc_errno.
+ *
  ***/
 int silc_stream_write(SilcStream stream, const unsigned char *data,
                      SilcUInt32 data_len);
@@ -252,9 +254,8 @@ void silc_stream_destroy(SilcStream stream);
  *    If `notifier' is set to NULL no callback will be called for the stream,
  *    and the stream is not scheduled anymore.
  *
- *    This function returns FALSE if the `schedule' was provided and the
- *    stream could not be scheduled.  The actual API for `stream' may provide
- *    access to the actual error information.  Returns TRUE on success.
+ *    This function returns FALSE if the stream could not be scheduled.
+ *    Returns TRUE on success.  The `schedule' must always be non-NULL.
  *
  ***/
 SilcBool silc_stream_set_notifier(SilcStream stream, SilcSchedule schedule,