Index: ossp-pkg/l2/TODO RCS File: /v/ossp/cvs/ossp-pkg/l2/TODO,v rcsdiff -q -kk '-r1.42' '-r1.43' -u '/v/ossp/cvs/ossp-pkg/l2/TODO,v' 2>/dev/null --- TODO 2001/11/10 14:04:05 1.42 +++ TODO 2001/11/16 19:40:55 1.43 @@ -91,6 +91,7 @@ This leads to easy reimplementation of the prefix channel (asynchronous) MS: +- netcat can probably replace l2_sockmon, remove from build and add netcat - pipe channel may need a big overhaul if we redesign it around the asynch channel principle - review pipe handler for dangling descriptors @@ -100,12 +101,21 @@ - consider adding options such as PCRE_CASELESS to filter channel - implement "action" channel, can be based on pipe channel - correct problem with multiple buffer channels using the timer + can be solved by running a signal handler at the environment level, then + approximating the (multiple) user-chosen timer intervals by setting the + environment timer to expire at the time of the least common denominator of + the configured timer intervals + ie: tmr1 9secs; tmr2 6secs; envtmr will expire every lcd(9,6) = 3secs + alarm and setitimer methods are using different param types! Fixit. + review newly introduced timer code for L2_OK and L2_OK_PASS inconsistency - solve problem with buffer (timer), irc (ping), and buffer (autoflush), by creating sleep/ping threads. The disadvantage is that we must depend on a pth installation, and force the parent app to be multithreaded. Alternatively, we can spawn a management process in l2_stream_create(), who owns management resources globally available to all channels. Or write the l2 mini-protocol :-( +- split all timer server code out of L2 and into new multiplexed timer object + probably must use callbacks, unless user signal space is occupied ISSUES ------ Index: ossp-pkg/l2/l2.h.in RCS File: /v/ossp/cvs/ossp-pkg/l2/l2.h.in,v rcsdiff -q -kk '-r1.21' '-r1.22' -u '/v/ossp/cvs/ossp-pkg/l2/l2.h.in,v' 2>/dev/null --- l2.h.in 2001/11/07 16:17:09 1.21 +++ l2.h.in 2001/11/16 19:40:55 1.22 @@ -208,6 +208,7 @@ l2_result_t l2_env_handler (l2_env_t *env, l2_handler_t *h); l2_result_t l2_env_errorinfo (l2_env_t *env, l2_result_t rv, const char *fmt, ...); char *l2_env_strerror (l2_env_t *env, l2_result_t rv); +l2_result_t l2_env_settimer (l2_env_t *env, int iInterval) /* channel operations */ l2_result_t l2_channel_create (l2_channel_t **ch, l2_env_t *env, const char *name); Index: ossp-pkg/l2/l2_p.h RCS File: /v/ossp/cvs/ossp-pkg/l2/l2_p.h,v rcsdiff -q -kk '-r1.30' '-r1.31' -u '/v/ossp/cvs/ossp-pkg/l2/l2_p.h,v' 2>/dev/null --- l2_p.h 2001/11/07 11:37:18 1.30 +++ l2_p.h 2001/11/16 19:40:55 1.31 @@ -42,6 +42,10 @@ #include "l2_ut_pcre.h" #include "l2_ut_sa.h" +#ifdef HAVE_SYS_TIME_H /* must come after include l2_config.h */ +#include +#endif + /* assertion and tracing support */ #ifndef DEBUG #define NDEBUG @@ -67,9 +71,11 @@ cu(value) /* some hard-coded sizes :-( */ -#define L2_MAX_MSGSIZE 4096 -#define L2_MAX_FORMATTERS 128 -#define L2_MAX_HANDLERS 128 +#define L2_MAX_MSGSIZE 4096 +#define L2_MAX_FORMATTERS 128 +#define L2_MAX_HANDLERS 128 +#define L2_BROKEN_TIMER -1 +#define L2_BUFFER_TIMER ITIMER_REAL /* for [s|g]etitimer() and alarm() */ /* internal channel state */ typedef enum { @@ -101,6 +107,7 @@ struct l2_env_st { unsigned int levelmask; unsigned int flushmask; + int interval; l2_formatter_entry_t formatters[L2_MAX_FORMATTERS]; l2_handler_t *handlers[L2_MAX_HANDLERS]; char message[L2_MAX_MSGSIZE]; Index: ossp-pkg/l2/l2_test.c RCS File: /v/ossp/cvs/ossp-pkg/l2/l2_test.c,v rcsdiff -q -kk '-r1.46' '-r1.47' -u '/v/ossp/cvs/ossp-pkg/l2/l2_test.c,v' 2>/dev/null --- l2_test.c 2001/11/08 21:58:00 1.46 +++ l2_test.c 2001/11/16 19:40:55 1.47 @@ -80,12 +80,15 @@ die(env, rv, "failed to configure formatter for %%x"); if ((rv = l2_env_formatter(env, 'S', l2_util_fmt_dump, NULL)) != L2_OK) die(env, rv, "failed to configure formatter for %%S"); + if ((rv = l2_env_settimer(env, 20)) != L2_OK) + die(env, rv, "failed to configure timer"); #if 1 spec = "noop -> {" " filter(regex=hecking, negate=0)" " -> prefix(prefix=\"[%d-%m-%Y/%H:%M:%S] %L test[%P]: \", timezone=local)" " -> buffer(size=800)" +/* " -> buffer(size=800, timer=on)"*/ " -> file(path=l2_test.log, append=1, perm=420) ;" " syslog(ident=L2-Test, facility=user, " " remotehost=en1, logpid=1, target=remote)"