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 Stream Interface
+/****h* silcutil/Stream Interface
*
* DESCRIPTION
*
* 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. See examples in
+ * silcsocketstream.h and silcfdstream.h.
+ *
* Note that stream implementations usually are not thread-safe. Always
* verify whether a stream implementation is thread-safe by checking their
* corresponding documentation.
#ifndef SILCSTREAM_H
#define SILCSTREAM_H
-/****s* silcutil/SilcStreamAPI/SilcStream
+/****s* silcutil/SilcStream
*
* NAME
*
***/
typedef void *SilcStream;
-/****d* silcutil/SilcStreamAPI/SilcStreamStatus
+/****d* silcutil/SilcStreamStatus
*
* NAME
*
} SilcStreamStatus;
/***/
-/****f* silcutil/SilcStreamAPI/SilcStreamNotifier
+/****f* silcutil/SilcStreamNotifier
*
* SYNOPSIS
*
SilcStreamStatus status,
void *context);
-/****s* silcutil/SilcStreamAPI/SilcStreamOps
+/****s* silcutil/SilcStreamOps
*
* NAME
*
* } *SilcFooStream;
*
* SilcFooStream foo;
- * silc_stream_write(foo, data, data_len);
+ * silc_stream_write((SilcStream)foo, data, data_len);
*
* SOURCE
*/
} SilcStreamOps;
/***/
-/****f* silcutil/SilcStreamAPI/silc_stream_read
+/****f* silcutil/silc_stream_read
*
* SYNOPSIS
*
int silc_stream_read(SilcStream stream, unsigned char *buf,
SilcUInt32 buf_len);
-/****f* silcutil/SilcStreamAPI/silc_stream_write
+/****f* silcutil/silc_stream_write
*
* SYNOPSIS
*
int silc_stream_write(SilcStream stream, const unsigned char *data,
SilcUInt32 data_len);
-/****f* silcutil/SilcStreamAPI/silc_stream_close
+/****f* silcutil/silc_stream_close
*
* SYNOPSIS
*
***/
SilcBool silc_stream_close(SilcStream stream);
-/****f* silcutil/SilcStreamAPI/silc_stream_destroy
+/****f* silcutil/silc_stream_destroy
*
* SYNOPSIS
*
***/
void silc_stream_destroy(SilcStream stream);
-/****f* silcutil/SilcStreamAPI/silc_stream_set_notifier
+/****f* silcutil/silc_stream_set_notifier
*
* SYNOPSIS
*
* 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,
SilcStreamNotifier notifier, void *context);
-/****f* silcutil/SilcStreamAPI/silc_stream_get_schedule
+/****f* silcutil/silc_stream_get_schedule
*
* SYNOPSIS
*