+
+
+Structure SilcStreamOps
+
+
+NAME
+
+
+ typedef struct { ... } SilcStreamOps;
+
+
+DESCRIPTION
+
+
+ SILC Stream operations structure. This structure includes callback
+ functions to the actual stream implementation. Any stream that
+ use SILC Stream abstraction must fill this structure with the actual
+ stream implementation.
+
+ Each stream implementation MUST set this structure as the first field
+ in their stream structure. As it is that structure that is passed
+ to the silc_stream_* routines, the SILC Stream API expects that the
+ SilcStream context starts with this structure.
+
+
+EXAMPLE
+
+
+ typedef struct {
+ const SilcStreamOps *ops;
+ ... other stuff ...
+ } *SilcFooStream;
+
+ SilcFooStream foo;
+ silc_stream_write(foo, data, data_len);
+
+
+SOURCE
+
+ typedef struct {
+ /* This is called to read data from the stream. This is called when
+ silc_stream_read function was called. */
+ int (*read)(SilcStream stream, unsigned char *buf, SilcUInt32 buf_len);
+
+ /* This is called when writing data to the stream. This is called when
+ silc_stream_write function was called. */
+ int (*write)(SilcStream stream, const unsigned char *data,
+ SilcUInt32 data_len);
+
+ /* This is called to close the stream. This is called when the
+ silc_stream_close function was called. */
+ SilcBool (*close)(SilcStream stream);
+
+ /* This is called to destroy the stream. This is called when the
+ silc_stream_destroy function was called. */
+ void (*destroy)(SilcStream stream);
+
+ /* This is called to set a notifier callback to the stream and schedule
+ the stream. Stream should not be scheduled before calling this
+ function. If stream does not need scheduler then the scheduler can
+ be ignored. This is called when silc_stream_set_notifier was called.
+ Returns FALSE if the stream could not be scheduled. */
+ SilcBool (*notifier)(SilcStream stream, SilcSchedule schedule,
+ SilcStreamNotifier callback, void *context);
+
+ /* This is called to return the associated scheduler, if set. This is
+ called when silc_stream_get_schedule was called. */
+ SilcSchedule (*get_schedule)(SilcStream stream);
+ } SilcStreamOps;
+
+ |