--- l2.h 2001/09/04 14:56:25 1.14
+++ l2.h 2001/09/04 15:41:17 1.15
@@ -120,15 +120,22 @@
#define L2_PARAM_END(pa) \
pa.name = NULL
+/* list of handler types */
+typedef enum {
+ L2_CHANNEL_FILTER,
+ L2_CHANNEL_OUTPUT
+} l2_chtype_t;
+
/* channel handler specification structure */
struct l2_handler_st {
- int (*create) (l2_context_t *ctx);
- int (*configure)(l2_context_t *ctx, const char *fmt, va_list ap);
- int (*open) (l2_context_t *ctx, l2_channel_t *downstream);
- int (*write) (l2_context_t *ctx, l2_channel_t *downstream, const char *buf, size_t buf_size);
- int (*flush) (l2_context_t *ctx, l2_channel_t *downstream);
- int (*close) (l2_context_t *ctx, l2_channel_t *downstream);
- int (*destroy) (l2_context_t *ctx);
+ l2_chtype_t type;
+ int (*create) (l2_context_t *ctx, l2_channel_t *ch);
+ int (*configure)(l2_context_t *ctx, l2_channel_t *ch, const char *fmt, va_list ap);
+ int (*open) (l2_context_t *ctx, l2_channel_t *ch);
+ int (*write) (l2_context_t *ctx, l2_channel_t *ch, const char *buf, size_t bufsize);
+ int (*flush) (l2_context_t *ctx, l2_channel_t *ch);
+ int (*close) (l2_context_t *ctx, l2_channel_t *ch);
+ int (*destroy) (l2_context_t *ctx, l2_channel_t *ch);
};
/* type of formatter callback function */
@@ -156,23 +163,25 @@
extern l2_handler_t l2_handler_buffer;
/* channel operations */
-l2_channel_t *l2_channel_create (l2_handler_t *h);
-l2_result_t l2_channel_configure(l2_channel_t *ch, const char *fmt, ...);
-l2_result_t l2_channel_open (l2_channel_t *ch);
-l2_result_t l2_channel_write (l2_channel_t *ch, const char *buf, size_t bufsize);
-l2_result_t l2_channel_flush (l2_channel_t *ch);
-l2_result_t l2_channel_close (l2_channel_t *ch);
-l2_result_t l2_channel_destroy (l2_channel_t *ch);
-l2_result_t l2_channel_stack (l2_channel_t *ch, l2_channel_t *chTop);
+l2_channel_t *l2_channel_create (l2_handler_t *h);
+l2_result_t l2_channel_configure (l2_channel_t *ch, const char *fmt, ...);
+l2_result_t l2_channel_open (l2_channel_t *ch);
+l2_result_t l2_channel_write (l2_channel_t *ch, const char *buf, size_t bufsize);
+l2_result_t l2_channel_flush (l2_channel_t *ch);
+l2_result_t l2_channel_close (l2_channel_t *ch);
+l2_result_t l2_channel_destroy (l2_channel_t *ch);
+l2_result_t l2_channel_stack (l2_channel_t *ch, l2_channel_t *chTop);
+l2_channel_t *l2_channel_downstream (l2_channel_t *ch);
+l2_chtype_t l2_channel_type (l2_channel_t *ch);
/* stream operations */
-l2_stream_t *l2_stream_create (void);
-l2_result_t l2_stream_channel (l2_stream_t *st, l2_channel_t *ch, unsigned int levelmask);
-l2_result_t l2_stream_formatter (l2_stream_t *st, char id, l2_formatter_t cb, l2_context_t *ctx);
-l2_result_t l2_stream_levels (l2_stream_t *st, unsigned int levelmask);
-l2_result_t l2_stream_log (l2_stream_t *st, unsigned int level, const char *fmt, ...);
-l2_result_t l2_stream_vlog (l2_stream_t *st, unsigned int level, const char *fmt, va_list ap);
-l2_result_t l2_stream_destroy (l2_stream_t *st);
+l2_stream_t *l2_stream_create (void);
+l2_result_t l2_stream_channel (l2_stream_t *st, l2_channel_t *ch, unsigned int levelmask);
+l2_result_t l2_stream_formatter (l2_stream_t *st, char id, l2_formatter_t cb, l2_context_t *ctx);
+l2_result_t l2_stream_levels (l2_stream_t *st, unsigned int levelmask);
+l2_result_t l2_stream_log (l2_stream_t *st, unsigned int level, const char *fmt, ...);
+l2_result_t l2_stream_vlog (l2_stream_t *st, unsigned int level, const char *fmt, va_list ap);
+l2_result_t l2_stream_destroy (l2_stream_t *st);
/* utility operations */
l2_result_t l2_util_setparams(l2_param_t p[], const char *fmt, va_list ap);
|