OSSP CVS Repository

ossp - Check-in [5217]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 5217
Date: 2005-Oct-03 10:08:11 (local)
2005-Oct-03 08:08:11 (UTC)
User:rse
Branch:
Comment: Adjust copyright messages for new year 2005.
Tickets:
Inspections:
Files:
ossp-pkg/l2/LICENSE      1.6 -> 1.7     3 inserted, 3 deleted
ossp-pkg/l2/Makefile.in      1.48 -> 1.49     3 inserted, 3 deleted
ossp-pkg/l2/README      1.22 -> 1.23     3 inserted, 3 deleted
ossp-pkg/l2/aclocal.m4      1.17 -> 1.18     3 inserted, 3 deleted
ossp-pkg/l2/configure.ac      added-> 1.31
ossp-pkg/l2/devtool.conf      1.21 -> 1.22     3 inserted, 3 deleted
ossp-pkg/l2/devtool.func      1.6 -> 1.7     1 inserted, 1 deleted
ossp-pkg/l2/l2-config.in      1.8 -> 1.9     3 inserted, 3 deleted
ossp-pkg/l2/l2-config.pod      1.8 -> 1.9     3 inserted, 3 deleted
ossp-pkg/l2/l2.h.in      1.33 -> 1.34     3 inserted, 3 deleted
ossp-pkg/l2/l2.m4      1.7 -> 1.8     3 inserted, 3 deleted
ossp-pkg/l2/l2.pod      1.17 -> 1.18     3 inserted, 3 deleted
ossp-pkg/l2/l2_ch_buffer.c      added-> 1.41
ossp-pkg/l2/l2_ch_fd.c      1.18 -> 1.19     3 inserted, 3 deleted
ossp-pkg/l2/l2_ch_file.c      1.32 -> 1.33     3 inserted, 3 deleted
ossp-pkg/l2/l2_ch_filter.c      added-> 1.21
ossp-pkg/l2/l2_ch_irc.c      1.9 -> 1.10     3 inserted, 3 deleted
ossp-pkg/l2/l2_ch_noop.c      1.6 -> 1.7     3 inserted, 3 deleted
ossp-pkg/l2/l2_ch_null.c      1.14 -> 1.15     3 inserted, 3 deleted
ossp-pkg/l2/l2_ch_pipe.c      1.33 -> 1.34     3 inserted, 3 deleted
ossp-pkg/l2/l2_ch_prefix.c      1.26 -> 1.27     3 inserted, 3 deleted
ossp-pkg/l2/l2_ch_smtp.c      1.12 -> 1.13     3 inserted, 3 deleted
ossp-pkg/l2/l2_ch_socket.c      1.39 -> 1.40     3 inserted, 3 deleted
ossp-pkg/l2/l2_ch_syslog.c      1.34 -> 1.35     3 inserted, 3 deleted
ossp-pkg/l2/l2_channel.c      1.34 -> 1.35     3 inserted, 3 deleted
ossp-pkg/l2/l2_env.c      1.11 -> 1.12     3 inserted, 3 deleted
ossp-pkg/l2/l2_p.h      1.36 -> 1.37     3 inserted, 3 deleted
ossp-pkg/l2/l2_spec.c      1.11 -> 1.12     3 inserted, 3 deleted
ossp-pkg/l2/l2_spec.h      1.5 -> 1.6     3 inserted, 3 deleted
ossp-pkg/l2/l2_spec_parse.y      1.12 -> 1.13     3 inserted, 3 deleted
ossp-pkg/l2/l2_spec_scan.l      1.15 -> 1.16     3 inserted, 3 deleted
ossp-pkg/l2/l2_test.c      1.55 -> 1.56     3 inserted, 3 deleted
ossp-pkg/l2/l2_ut_fmtcb.c      1.8 -> 1.9     3 inserted, 3 deleted
ossp-pkg/l2/l2_ut_format.h      1.5 -> 1.6     3 inserted, 3 deleted
ossp-pkg/l2/l2_ut_level.c      added-> 1.11
ossp-pkg/l2/l2_ut_param.c      1.12 -> 1.13     3 inserted, 3 deleted
ossp-pkg/l2/l2tool.c      1.7 -> 1.8     3 inserted, 3 deleted
ossp-pkg/l2/l2tool.pod      1.5 -> 1.6     3 inserted, 3 deleted

ossp-pkg/l2/LICENSE 1.6 -> 1.7

--- LICENSE      2005/01/24 15:03:17     1.6
+++ LICENSE      2005/10/03 08:08:11     1.7
@@ -1,9 +1,9 @@
 
   OSSP l2 - Flexible Logging
 
-  Copyright (c) 2001-2004 Cable & Wireless <http://www.cw.com/>
-  Copyright (c) 2001-2004 The OSSP Project <http://www.ossp.org/>
-  Copyright (c) 2001-2004 Ralf S. Engelschall <rse@engelschall.com>
+  Copyright (c) 2001-2005 Cable & Wireless <http://www.cw.com/>
+  Copyright (c) 2001-2005 The OSSP Project <http://www.ossp.org/>
+  Copyright (c) 2001-2005 Ralf S. Engelschall <rse@engelschall.com>
 
   This file is part of OSSP l2, a flexible logging library which
   can be found at http://www.ossp.org/pkg/lib/l2/.


ossp-pkg/l2/Makefile.in 1.48 -> 1.49

--- Makefile.in  2005/01/24 15:03:17     1.48
+++ Makefile.in  2005/10/03 08:08:11     1.49
@@ -1,8 +1,8 @@
 ##
 ##  OSSP l2 - Flexible Logging
-##  Copyright (c) 2001-2004 Cable & Wireless <http://www.cw.com/>
-##  Copyright (c) 2001-2004 The OSSP Project <http://www.ossp.org/>
-##  Copyright (c) 2001-2004 Ralf S. Engelschall <rse@engelschall.com>
+##  Copyright (c) 2001-2005 Cable & Wireless <http://www.cw.com/>
+##  Copyright (c) 2001-2005 The OSSP Project <http://www.ossp.org/>
+##  Copyright (c) 2001-2005 Ralf S. Engelschall <rse@engelschall.com>
 ##
 ##  This file is part of OSSP l2, a flexible logging library which
 ##  can be found at http://www.ossp.org/pkg/lib/l2/.


ossp-pkg/l2/README 1.22 -> 1.23

--- README       2005/10/03 07:58:48     1.22
+++ README       2005/10/03 08:08:11     1.23
@@ -32,9 +32,9 @@
 
   COPYRIGHT AND LICENSE
 
-  Copyright (c) 2001-2004 Cable & Wireless <http://www.cw.com/>
-  Copyright (c) 2001-2004 The OSSP Project <http://www.ossp.org/>
-  Copyright (c) 2001-2004 Ralf S. Engelschall <rse@engelschall.com>
+  Copyright (c) 2001-2005 Cable & Wireless <http://www.cw.com/>
+  Copyright (c) 2001-2005 The OSSP Project <http://www.ossp.org/>
+  Copyright (c) 2001-2005 Ralf S. Engelschall <rse@engelschall.com>
 
   This file is part of OSSP l2, a flexible logging library which
   can be found at http://www.ossp.org/pkg/lib/l2/.


ossp-pkg/l2/aclocal.m4 1.17 -> 1.18

--- aclocal.m4   2005/02/03 09:40:34     1.17
+++ aclocal.m4   2005/10/03 08:08:11     1.18
@@ -1,8 +1,8 @@
 dnl ##
 dnl ##  OSSP l2 - Flexible Logging
-dnl ##  Copyright (c) 2001-2004 Cable & Wireless <http://www.cw.com/>
-dnl ##  Copyright (c) 2001-2004 The OSSP Project <http://www.ossp.org/>
-dnl ##  Copyright (c) 2001-2004 Ralf S. Engelschall <rse@engelschall.com>
+dnl ##  Copyright (c) 2001-2005 Cable & Wireless <http://www.cw.com/>
+dnl ##  Copyright (c) 2001-2005 The OSSP Project <http://www.ossp.org/>
+dnl ##  Copyright (c) 2001-2005 Ralf S. Engelschall <rse@engelschall.com>
 dnl ##
 dnl ##  This file is part of OSSP l2, a flexible logging library which
 dnl ##  can be found at http://www.ossp.org/pkg/lib/l2/.


ossp-pkg/l2/configure.ac -> 1.31

*** /dev/null    Sat Nov 23 01:31:01 2024
--- -    Sat Nov 23 01:31:03 2024
***************
*** 0 ****
--- 1,80 ----
+ dnl ##
+ dnl ##  OSSP l2 - Flexible Logging
+ dnl ##  Copyright (c) 2001-2005 Cable & Wireless <http://www.cw.com/>
+ dnl ##  Copyright (c) 2001-2005 The OSSP Project <http://www.ossp.org/>
+ dnl ##  Copyright (c) 2001-2005 Ralf S. Engelschall <rse@engelschall.com>
+ dnl ##
+ dnl ##  This file is part of OSSP l2, a flexible logging library which
+ dnl ##  can be found at http://www.ossp.org/pkg/lib/l2/.
+ dnl ##
+ dnl ##  Permission to use, copy, modify, and distribute this software for
+ dnl ##  any purpose with or without fee is hereby granted, provided that
+ dnl ##  the above copyright notice and this permission notice appear in all
+ dnl ##  copies.
+ dnl ##
+ dnl ##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ dnl ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ dnl ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ dnl ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+ dnl ##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ dnl ##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ dnl ##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ dnl ##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ dnl ##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ dnl ##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ dnl ##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ dnl ##  SUCH DAMAGE.
+ dnl ##
+ dnl ##  configure.in: Autoconf specification
+ dnl ##
+ 
+ AC_PREREQ(2.57)
+ AC_INIT
+ AC_HEADLINE(dnl
+ OSSP l2, Flexible Logging, dnl
+ L2_VERSION, l2_version.c, dnl
+ [Copyright (c) 2001-2005 The OSSP Project <http://www.ossp.org/>
+ Copyright (c) 2001-2005 Ralf S. Engelschall (rse@engelschall.com)
+ Copyright (c) 2001-2005 Cable & Wireless <http://www.cw.com/>])
+ AC_PREFIX_DEFAULT(/usr/local)
+ AC_PLATFORM(PLATFORM)
+ 
+ AC_PROG_MAKE_SET
+ AC_PROG_CC
+ AC_PROG_CPP
+ AC_CHECK_DEBUGGING
+ AC_CHECK_MAINTAINER
+ AC_CONFIGURE_LIBTOOL
+ 
+ AC_CHECK_BISON(BISON, 1.875d, [1.[[8-9]][[0-9]]|1.[[8-9]][[0-9]][[0-9]]]|[2.[[0-9]]])
+ AC_CHECK_FLEX(FLEX, 2.5.31, [2.5.1[[0-9]]|2.5.[[2-9]][[0-9]]|2.[[6-9]].*])
+ 
+ AC_CHECK_LIB(nsl, gethostname)
+ if test ".`echo $LIBS | grep nsl`" = . ;then
+     AC_CHECK_LIB(nsl, gethostbyname)
+ fi
+ AC_CHECK_LIB(socket, accept)
+ 
+ AC_CHECK_HEADERS(sys/time.h)
+ 
+ AC_CHECK_FUNCS(inet_aton inet_pton inet_ntoa inet_ntop snprintf vsnprintf setitimer isnan isinf)
+ 
+ CHECK_VA_COPY
+ 
+ case $PLATFORM in
+     *-*-solaris2.[[6-8]]* )
+         AC_DEFINE(HAVE_VSYSLOG_USVALIST, 1, [Define to 1 if vsyslog has underscored va_list])
+         ;;
+ esac
+ 
+ sinclude(l2_ut_sa.ac)
+ SA_CHECK_ALL
+ 
+ AC_CHECK_EXTLIB([Dmalloc], dmalloc, dmalloc_debug, dmalloc.h,
+                 [AC_DEFINE(WITH_DMALLOC, 1, [Define to 1 if building with Dmalloc])])
+ 
+ AC_CONFIG_HEADERS(l2_config.h)
+ AC_CONFIG_FILES([Makefile l2.h l2-config])
+ AC_CONFIG_COMMANDS([adjustment], [chmod a+x l2-config])
+ AC_OUTPUT
+ 


ossp-pkg/l2/devtool.conf 1.21 -> 1.22

--- devtool.conf 2005/10/03 08:02:10     1.21
+++ devtool.conf 2005/10/03 08:08:11     1.22
@@ -1,8 +1,8 @@
 ##
 ##  OSSP l2 - Flexible Logging
-##  Copyright (c) 2001-2004 Cable & Wireless <http://www.cw.com/>
-##  Copyright (c) 2001-2004 The OSSP Project <http://www.ossp.org/>
-##  Copyright (c) 2001-2004 Ralf S. Engelschall <rse@engelschall.com>
+##  Copyright (c) 2001-2005 Cable & Wireless <http://www.cw.com/>
+##  Copyright (c) 2001-2005 The OSSP Project <http://www.ossp.org/>
+##  Copyright (c) 2001-2005 Ralf S. Engelschall <rse@engelschall.com>
 ##
 ##  This file is part of OSSP l2, a flexible logging library which
 ##  can be found at http://www.ossp.org/pkg/lib/l2/.


ossp-pkg/l2/devtool.func 1.6 -> 1.7

--- devtool.func 2005/01/24 15:03:17     1.6
+++ devtool.func 2005/10/03 08:08:11     1.7
@@ -1,6 +1,6 @@
 ##
 ##  devtool.func -- Development Tool Functions
-##  Copyright (c) 2001-2004 Ralf S. Engelschall <rse@engelschall.com>
+##  Copyright (c) 2001-2005 Ralf S. Engelschall <rse@engelschall.com>
 ##
 
 devtool_require () {


ossp-pkg/l2/l2-config.in 1.8 -> 1.9

--- l2-config.in 2005/01/24 15:03:17     1.8
+++ l2-config.in 2005/10/03 08:08:11     1.9
@@ -1,9 +1,9 @@
 #!/bin/sh
 ##
 ##  OSSP l2 - Flexible Logging
-##  Copyright (c) 2001-2004 Cable & Wireless <http://www.cw.com/>
-##  Copyright (c) 2001-2004 The OSSP Project <http://www.ossp.org/>
-##  Copyright (c) 2001-2004 Ralf S. Engelschall <rse@engelschall.com>
+##  Copyright (c) 2001-2005 Cable & Wireless <http://www.cw.com/>
+##  Copyright (c) 2001-2005 The OSSP Project <http://www.ossp.org/>
+##  Copyright (c) 2001-2005 Ralf S. Engelschall <rse@engelschall.com>
 ##
 ##  This file is part of OSSP l2, a flexible logging library which
 ##  can be found at http://www.ossp.org/pkg/lib/l2/.


ossp-pkg/l2/l2-config.pod 1.8 -> 1.9

--- l2-config.pod        2005/01/24 15:03:17     1.8
+++ l2-config.pod        2005/10/03 08:08:11     1.9
@@ -1,8 +1,8 @@
 ##
 ##  OSSP l2 - Flexible Logging
-##  Copyright (c) 2001-2004 Cable & Wireless <http://www.cw.com/>
-##  Copyright (c) 2001-2004 The OSSP Project <http://www.ossp.org/>
-##  Copyright (c) 2001-2004 Ralf S. Engelschall <rse@engelschall.com>
+##  Copyright (c) 2001-2005 Cable & Wireless <http://www.cw.com/>
+##  Copyright (c) 2001-2005 The OSSP Project <http://www.ossp.org/>
+##  Copyright (c) 2001-2005 Ralf S. Engelschall <rse@engelschall.com>
 ##
 ##  This file is part of OSSP l2, a flexible logging library which
 ##  can be found at http://www.ossp.org/pkg/lib/l2/.


ossp-pkg/l2/l2.h.in 1.33 -> 1.34

--- l2.h.in      2005/01/24 15:03:17     1.33
+++ l2.h.in      2005/10/03 08:08:11     1.34
@@ -1,8 +1,8 @@
 /*
 **  OSSP l2 - Flexible Logging
-**  Copyright (c) 2001-2004 Cable & Wireless <http://www.cw.com/>
-**  Copyright (c) 2001-2004 The OSSP Project <http://www.ossp.org/>
-**  Copyright (c) 2001-2004 Ralf S. Engelschall <rse@engelschall.com>
+**  Copyright (c) 2001-2005 Cable & Wireless <http://www.cw.com/>
+**  Copyright (c) 2001-2005 The OSSP Project <http://www.ossp.org/>
+**  Copyright (c) 2001-2005 Ralf S. Engelschall <rse@engelschall.com>
 **
 **  This file is part of OSSP l2, a flexible logging library which
 **  can be found at http://www.ossp.org/pkg/lib/l2/.


ossp-pkg/l2/l2.m4 1.7 -> 1.8

--- l2.m4        2005/01/24 15:03:17     1.7
+++ l2.m4        2005/10/03 08:08:11     1.8
@@ -1,8 +1,8 @@
 dnl ##
 dnl ##  OSSP l2 - Flexible Logging
-dnl ##  Copyright (c) 2001-2004 Cable & Wireless <http://www.cw.com/>
-dnl ##  Copyright (c) 2001-2004 The OSSP Project <http://www.ossp.org/>
-dnl ##  Copyright (c) 2001-2004 Ralf S. Engelschall <rse@engelschall.com>
+dnl ##  Copyright (c) 2001-2005 Cable & Wireless <http://www.cw.com/>
+dnl ##  Copyright (c) 2001-2005 The OSSP Project <http://www.ossp.org/>
+dnl ##  Copyright (c) 2001-2005 Ralf S. Engelschall <rse@engelschall.com>
 dnl ##
 dnl ##  This file is part of OSSP l2, a flexible logging library which
 dnl ##  can be found at http://www.ossp.org/pkg/lib/l2/.


ossp-pkg/l2/l2.pod 1.17 -> 1.18

--- l2.pod       2005/01/24 15:03:17     1.17
+++ l2.pod       2005/10/03 08:08:11     1.18
@@ -1,8 +1,8 @@
 ##
 ##  OSSP l2 - Flexible Logging
-##  Copyright (c) 2001-2004 Cable & Wireless <http://www.cw.com/>
-##  Copyright (c) 2001-2004 The OSSP Project <http://www.ossp.org/>
-##  Copyright (c) 2001-2004 Ralf S. Engelschall <rse@engelschall.com>
+##  Copyright (c) 2001-2005 Cable & Wireless <http://www.cw.com/>
+##  Copyright (c) 2001-2005 The OSSP Project <http://www.ossp.org/>
+##  Copyright (c) 2001-2005 Ralf S. Engelschall <rse@engelschall.com>
 ##
 ##  This file is part of OSSP l2, a flexible logging library which
 ##  can be found at http://www.ossp.org/pkg/lib/l2/.


ossp-pkg/l2/l2_ch_buffer.c -> 1.41

*** /dev/null    Sat Nov 23 01:31:01 2024
--- -    Sat Nov 23 01:31:03 2024
***************
*** 0 ****
--- 1,355 ----
+ /*
+ **  OSSP l2 - Flexible Logging
+ **  Copyright (c) 2001-2005 Cable & Wireless <http://www.cw.com/>
+ **  Copyright (c) 2001-2005 The OSSP Project <http://www.ossp.org/>
+ **  Copyright (c) 2001-2005 Ralf S. Engelschall <rse@engelschall.com>
+ **
+ **  This file is part of OSSP l2, a flexible logging library which
+ **  can be found at http://www.ossp.org/pkg/lib/l2/.
+ **
+ **  Permission to use, copy, modify, and distribute this software for
+ **  any purpose with or without fee is hereby granted, provided that
+ **  the above copyright notice and this permission notice appear in all
+ **  copies.
+ **
+ **  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ **  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ **  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ **  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+ **  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ **  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ **  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ **  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ **  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ **  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ **  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ **  SUCH DAMAGE.
+ **
+ **  l2_ch_buffer.c: buffering channel implementation
+ */
+ 
+ #include "l2.h"
+ #include "l2_p.h"     /* for TRACE macro              */
+ 
+ #include <string.h>
+ #include <unistd.h>   /* for alarm(3)                 */
+ #include <signal.h>   /* for sigaction(2) and SIGALRM */
+ 
+ #ifdef HAVE_SYS_TIME_H
+ #include <sys/time.h> /* for setitimer(2)             */
+ #endif
+ 
+ #define L2_BUFFER_TIMER ITIMER_REAL /* calls to [s|g]etitimer() and alarm() */
+ 
+ /* declare private channel configuration */
+ typedef struct {
+     char       *buf;
+     int         bufpos;
+     int         bufsize;
+     long        bufinterval;
+     struct      sigaction sigalrm;
+ #if defined(HAVE_SETITIMER) && defined(HAVE_SYS_TIME_H)
+     struct      itimerval valprev;
+ #endif
+     int         levelflush;
+     l2_level_t  level;
+ } l2_ch_buffer_t;
+ 
+ /* Sets the VIRTUAL timer to preconfigured value in cfg */
+ static int set_alarm(l2_ch_buffer_t *cfg)
+ {
+ #if defined(HAVE_SETITIMER) && defined(HAVE_SYS_TIME_H)
+     struct itimerval valtest, valnew;
+ 
+     /* initialize auto vars before using them */
+     memset(&valnew, 0, sizeof(valnew));
+ 
+     valnew.it_interval.tv_sec = cfg->bufinterval;
+     valnew.it_interval.tv_usec = 0;
+     valnew.it_value.tv_sec = cfg->bufinterval;
+     valnew.it_value.tv_usec = 0;
+     if  ((getitimer(L2_BUFFER_TIMER, &valtest) == 0) &&
+         ((valtest.it_value.tv_sec | valtest.it_value.tv_usec |
+         valtest.it_interval.tv_sec | valtest.it_interval.tv_usec) == 0))
+         return setitimer(L2_BUFFER_TIMER, &valnew, &cfg->valprev);
+     else {
+         cfg->bufinterval = -1L; /* mark this timer as broken */
+         assert(FALSE);
+         return 1; /* to make the compiler happy */
+     }
+ #else
+     unsigned int uiAlarmed = 0;
+ 
+     assert(uiAlarmed = alarm(cfg->bufinterval));
+     if (uiAlarmed) {            /* check if SIGALRM is occupied          */
+         alarm(uiAlarmed);       /* ...if so, then hack in the old value  */
+         cfg->bufinterval = -1L; /* ...mark this timer as broken          */
+     }
+     return 0;
+ #endif
+ }
+ 
+ /* Resets the VIRTUAL timer to preconfigured value in cfg */
+ static int reset_alarm(l2_ch_buffer_t *cfg)
+ {
+ #if defined(HAVE_SETITIMER) && defined(HAVE_SYS_TIME_H)
+     struct itimerval valnew;
+ 
+     /* initialize auto vars before using them */
+     memset(&valnew, 0, sizeof(valnew));
+ 
+     valnew.it_interval.tv_sec = cfg->bufinterval;
+     valnew.it_interval.tv_usec = 0;
+     valnew.it_value.tv_sec = cfg->bufinterval;
+     valnew.it_value.tv_usec = 0;
+     return setitimer(L2_BUFFER_TIMER, &valnew, 0);
+ #else
+     alarm(cfg->bufinterval);
+     return 0;
+ #endif
+ }
+ 
+ static void catchsignal(int sig, ...)
+ {
+     va_list ap;
+     static  l2_channel_t   *ch  = NULL;
+     static  l2_ch_buffer_t *cfg = NULL;
+ 
+     if (sig == 0) {
+         va_start(ap, sig);
+         ch  = va_arg(ap, l2_channel_t   *); /* init the handler just like */
+         cfg = va_arg(ap, l2_ch_buffer_t *); /* Thomas Lotterer does       */
+         va_end(ap);
+     }
+     else if (sig == SIGALRM) {
+         TRACE("SIGALRM caught");
+         l2_channel_flush(ch);
+         reset_alarm(cfg); /* alarm(3) doesn't auto-reset like setitime(2) */
+     }
+ }
+ 
+ /* create channel */
+ static l2_result_t hook_create(l2_context_t *ctx, l2_channel_t *ch)
+ {
+     l2_ch_buffer_t *cfg;
+ 
+     /* allocate private channel configuration */
+     if ((cfg = (l2_ch_buffer_t *)malloc(sizeof(l2_ch_buffer_t))) == NULL)
+         return L2_ERR_MEM;
+ 
+     /* initialize configuration with reasonable defaults */
+     cfg->buf         = NULL;
+     cfg->bufpos      = 0;
+     cfg->bufsize     = 4096;
+     cfg->bufinterval = 0;
+     cfg->levelflush  = 0;
+     cfg->level       = L2_LEVEL_NONE;
+     memset(&cfg->sigalrm, 0, sizeof(cfg->sigalrm));
+ #if defined(HAVE_SETITIMER) && defined(HAVE_SYS_TIME_H)
+     memset(&cfg->valprev, 0, sizeof(cfg->valprev));
+ #endif
+ 
+     /* link private channel configuration into channel context */
+     ctx->vp = cfg;
+ 
+     return L2_OK;
+ }
+ 
+ /* configure channel */
+ static l2_result_t hook_configure(l2_context_t *ctx, l2_channel_t *ch, const char *fmt, va_list ap)
+ {
+     l2_ch_buffer_t *cfg = (l2_ch_buffer_t *)ctx->vp;
+     l2_param_t pa[4];
+     l2_result_t rv;
+     l2_env_t *env;
+ 
+     /* feed and call generic parameter parsing engine */
+     L2_PARAM_SET(pa[0], size,       INT, &cfg->bufsize);
+     L2_PARAM_SET(pa[1], interval,   INT, &cfg->bufinterval);
+     L2_PARAM_SET(pa[2], levelflush, INT, &cfg->levelflush);
+     L2_PARAM_END(pa[3]);
+     l2_channel_env(ch, &env);
+     rv = l2_util_setparams(env, pa, fmt, ap);
+     if (cfg->bufinterval == -1L) /* -1 is reserved by L2 */
+         return L2_ERR_ARG;       /* set_alarm() uses it  */
+ 
+     if (cfg->bufsize < 0)
+         return L2_ERR_ARG;
+ 
+     return rv;
+ }
+ 
+ /* open channel */
+ static l2_result_t hook_open(l2_context_t *ctx, l2_channel_t *ch)
+ {
+     l2_ch_buffer_t *cfg = (l2_ch_buffer_t *)ctx->vp;
+     struct sigaction locact;
+ 
+     if ((cfg->bufinterval != 0) && (cfg->bufinterval != -1L)) {
+         /* initialize auto vars before using them */
+         memset(&locact, 0, sizeof(locact));
+ 
+         locact.sa_handler = (void(*)(int))catchsignal;
+         sigemptyset(&locact.sa_mask);
+         locact.sa_flags = 0;
+ 
+         catchsignal(0, ch, (l2_ch_buffer_t *)ctx->vp);
+         /* save old signal context before replacing with our own */
+         if (sigaction(SIGALRM, &locact, &cfg->sigalrm) < 0)
+             return L2_ERR_SYS;
+ 
+         if (set_alarm(cfg))      /* this is our own L2 set_alarm */
+             return L2_ERR_SYS;
+     }
+ 
+     /* open channel buffer */
+     if (cfg->bufsize > 0) {
+         if ((cfg->buf = malloc(cfg->bufsize)) == NULL)
+             return L2_ERR_MEM;
+         cfg->bufpos = 0;
+     }
+ 
+     return L2_OK_PASS;
+ }
+ 
+ /* write to channel */
+ static l2_result_t hook_write(l2_context_t *ctx, l2_channel_t *ch,
+                               l2_level_t level, const char *buf, size_t buf_size)
+ {
+     l2_ch_buffer_t *cfg = (l2_ch_buffer_t *)ctx->vp;
+     l2_channel_t *downstream;
+     l2_result_t rv;
+ 
+     if (buf_size > (cfg->bufsize - cfg->bufpos)) {
+         /* flush buffer if necessary */
+         if (cfg->bufpos > 0) {
+             downstream = NULL;
+             while ((rv = l2_channel_downstream(ch, &downstream)) == L2_OK)
+                 if ((rv = l2_channel_write(downstream, cfg->level, cfg->buf, cfg->bufpos)) != L2_OK)
+                     return rv;
+             cfg->bufpos = 0;
+             cfg->level  = L2_LEVEL_NONE;
+         }
+         /* pass through immediately to downstream if still too large */
+         if (buf_size > cfg->bufsize) {
+             downstream = NULL;
+             while ((rv = l2_channel_downstream(ch, &downstream)) == L2_OK)
+                 if ((rv = l2_channel_write(downstream, level, buf, buf_size)) != L2_OK)
+                     return rv;
+             return L2_OK;
+         }
+     }
+ 
+     /* flush if incoming message level differs from those already in buffer */
+     if (   (cfg->levelflush)        /* if different levels force a flush    */
+         && (cfg->bufpos > 0)        /* and there is something in the buffer */
+         && (cfg->level != L2_LEVEL_NONE) /* and a remembered level is known */
+         && (level != cfg->level)         /* and the levels really differ    */)
+     {
+         downstream = NULL;
+         while (l2_channel_downstream(ch, &downstream) == L2_OK)
+             if ((rv = l2_channel_write(downstream, cfg->level, cfg->buf, cfg->bufpos)) != L2_OK)
+                 return rv;
+         cfg->bufpos = 0;
+         cfg->level  = L2_LEVEL_NONE;
+     }
+ 
+     /* finally write incoming message to channel buffer */
+     memcpy(cfg->buf+cfg->bufpos, buf, buf_size);
+     cfg->bufpos += buf_size;
+     cfg->level = level;
+ 
+     return L2_OK;
+ }
+ 
+ /* flush channel */
+ static l2_result_t hook_flush(l2_context_t *ctx, l2_channel_t *ch)
+ {
+     l2_ch_buffer_t *cfg = (l2_ch_buffer_t *)ctx->vp;
+     l2_channel_t *downstream;
+     l2_result_t rv;
+ 
+     /* write the buffer contents downstream */
+ TRACE("l2_ch_buffer hook_flush called\n");
+     if (cfg->bufpos > 0) {
+         downstream = NULL;
+         while (l2_channel_downstream(ch, &downstream) == L2_OK)
+             if ((rv = l2_channel_write(downstream, cfg->level, cfg->buf, cfg->bufpos)) != L2_OK)
+                 return rv;
+         cfg->bufpos = 0;
+         cfg->level  = L2_LEVEL_NONE; /* reset this->context->level */
+     }
+ 
+     /* reset the flush alarm timer to synchronize the buffer */
+     if ((cfg->bufinterval != 0) && (cfg->bufinterval != -1L))
+         if (reset_alarm(cfg))
+             return L2_ERR_SYS;
+ 
+     return L2_OK_PASS;
+ }
+ 
+ /* close channel */
+ static l2_result_t hook_close(l2_context_t *ctx, l2_channel_t *ch)
+ {
+     l2_ch_buffer_t *cfg = (l2_ch_buffer_t *)ctx->vp;
+     l2_channel_t *downstream;
+     l2_result_t rv;
+ 
+     if ((cfg->bufinterval != 0) && (cfg->bufinterval != -1L)) {
+ #if defined(HAVE_SETITIMER) && defined(HAVE_SYS_TIME_H)
+         if (setitimer(L2_BUFFER_TIMER, &cfg->valprev, 0)) /* restore timer */
+             return L2_ERR_SYS;
+ #else
+         alarm(0);
+ #endif
+         /* restore previous signal context if previously saved & replaced  */
+         if (&cfg->sigalrm.sa_handler)
+             if (sigaction(SIGALRM, &cfg->sigalrm, 0) < 0)
+                 rv = L2_ERR_SYS;
+     }
+ 
+     /* write pending data before closing down */
+     if (cfg->bufpos > 0) {
+         downstream = NULL;
+         while (l2_channel_downstream(ch, &downstream) == L2_OK)
+             if ((rv = l2_channel_write(downstream, cfg->level, cfg->buf, cfg->bufpos)) != L2_OK)
+                 return rv;
+         cfg->bufpos = 0;
+         cfg->level  = L2_LEVEL_NONE; /* reset this->context->level */
+     }
+ 
+     /* close channel buffer */
+     if (cfg->buf != NULL) {
+         free(cfg->buf);
+         cfg->buf = NULL;
+     }
+ 
+     return L2_OK_PASS;
+ }
+ 
+ /* destroy channel */
+ static l2_result_t hook_destroy(l2_context_t *ctx, l2_channel_t *ch)
+ {
+     l2_ch_buffer_t *cfg = (l2_ch_buffer_t *)ctx->vp;
+ 
+     /* destroy channel configuration */
+     if (cfg->buf != NULL)
+         free(cfg->buf);
+     free(cfg);
+ 
+     return L2_OK_PASS;
+ }
+ 
+ /* exported channel handler structure */
+ l2_handler_t l2_handler_buffer = {
+     "buffer",
+     L2_CHANNEL_FILTER,
+     hook_create,
+     hook_configure,
+     hook_open,
+     hook_write,
+     hook_flush,
+     hook_close,
+     hook_destroy
+ };
+ 


ossp-pkg/l2/l2_ch_fd.c 1.18 -> 1.19

--- l2_ch_fd.c   2005/01/24 15:03:17     1.18
+++ l2_ch_fd.c   2005/10/03 08:08:11     1.19
@@ -1,8 +1,8 @@
 /*
 **  OSSP l2 - Flexible Logging
-**  Copyright (c) 2001-2004 Cable & Wireless <http://www.cw.com/>
-**  Copyright (c) 2001-2004 The OSSP Project <http://www.ossp.org/>
-**  Copyright (c) 2001-2004 Ralf S. Engelschall <rse@engelschall.com>
+**  Copyright (c) 2001-2005 Cable & Wireless <http://www.cw.com/>
+**  Copyright (c) 2001-2005 The OSSP Project <http://www.ossp.org/>
+**  Copyright (c) 2001-2005 Ralf S. Engelschall <rse@engelschall.com>
 **
 **  This file is part of OSSP l2, a flexible logging library which
 **  can be found at http://www.ossp.org/pkg/lib/l2/.


ossp-pkg/l2/l2_ch_file.c 1.32 -> 1.33

--- l2_ch_file.c 2005/01/24 15:03:17     1.32
+++ l2_ch_file.c 2005/10/03 08:08:11     1.33
@@ -1,8 +1,8 @@
 /*
 **  OSSP l2 - Flexible Logging
-**  Copyright (c) 2001-2004 Cable & Wireless <http://www.cw.com/>
-**  Copyright (c) 2001-2004 The OSSP Project <http://www.ossp.org/>
-**  Copyright (c) 2001-2004 Ralf S. Engelschall <rse@engelschall.com>
+**  Copyright (c) 2001-2005 Cable & Wireless <http://www.cw.com/>
+**  Copyright (c) 2001-2005 The OSSP Project <http://www.ossp.org/>
+**  Copyright (c) 2001-2005 Ralf S. Engelschall <rse@engelschall.com>
 **
 **  This file is part of OSSP l2, a flexible logging library which
 **  can be found at http://www.ossp.org/pkg/lib/l2/.


ossp-pkg/l2/l2_ch_filter.c -> 1.21

*** /dev/null    Sat Nov 23 01:31:01 2024
--- -    Sat Nov 23 01:31:03 2024
***************
*** 0 ****
--- 1,158 ----
+ /*
+ **  OSSP l2 - Flexible Logging
+ **  Copyright (c) 2001-2005 Cable & Wireless <http://www.cw.com/>
+ **  Copyright (c) 2001-2005 The OSSP Project <http://www.ossp.org/>
+ **  Copyright (c) 2001-2005 Ralf S. Engelschall <rse@engelschall.com>
+ **
+ **  This file is part of OSSP l2, a flexible logging library which
+ **  can be found at http://www.ossp.org/pkg/lib/l2/.
+ **
+ **  Permission to use, copy, modify, and distribute this software for
+ **  any purpose with or without fee is hereby granted, provided that
+ **  the above copyright notice and this permission notice appear in all
+ **  copies.
+ **
+ **  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ **  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ **  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ **  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+ **  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ **  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ **  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ **  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ **  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ **  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ **  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ **  SUCH DAMAGE.
+ **
+ **  l2_ch_filter.c: filtering channel implementation
+ */
+ 
+ #include "l2.h"
+ #include "l2_ut_pcre.h"
+ 
+ /* declare private channel configuration */
+ typedef struct {
+     char *szRegex;
+     int   bNegate;
+     int   bNoCase;
+     pcre *pcreRegex;
+     pcre_extra *pcreExtra;
+ } l2_ch_filter_t;
+ 
+ /* create channel */
+ static l2_result_t hook_create(l2_context_t *ctx, l2_channel_t *ch)
+ {
+     l2_ch_filter_t *cfg;
+ 
+     /* allocate private channel configuration */
+     if ((cfg = (l2_ch_filter_t *)malloc(sizeof(l2_ch_filter_t))) == NULL)
+         return L2_ERR_MEM;
+ 
+     /* initialize configuration with reasonable defaults */
+     cfg->szRegex   = NULL;
+     cfg->bNegate   = FALSE;
+     cfg->bNoCase   = FALSE;
+     cfg->pcreRegex = NULL;
+     cfg->pcreExtra = NULL;
+ 
+     /* link private channel configuration into channel context */
+     ctx->vp = cfg;
+ 
+     return L2_OK;
+ }
+ 
+ /* configure channel */
+ static l2_result_t hook_configure(l2_context_t *ctx, l2_channel_t *ch, const char *fmt, va_list ap)
+ {
+     l2_ch_filter_t *cfg = (l2_ch_filter_t *)ctx->vp;
+     l2_env_t *env;
+     l2_param_t pa[4];
+     l2_result_t rv;
+     const char *szError;
+     int nErrorOffset;
+     int opt;
+ 
+     /* feed and call generic parameter parsing engine */
+     L2_PARAM_SET(pa[0], regex,  STR, &cfg->szRegex);
+     L2_PARAM_SET(pa[1], negate, INT, &cfg->bNegate);
+     L2_PARAM_SET(pa[2], nocase, INT, &cfg->bNoCase);
+     L2_PARAM_END(pa[3]);
+     l2_channel_env(ch, &env);
+     if ((rv = l2_util_setparams(env, pa, fmt, ap)) != L2_OK)
+         return rv;
+ 
+     /* translate regular expression into finite state machine */
+     if (cfg->szRegex != NULL) {
+         /* compile regular expression into FSM */
+         opt = 0;
+         if (cfg->bNoCase)
+             opt |= PCRE_CASELESS;
+         if ((cfg->pcreRegex = pcre_compile(cfg->szRegex, opt, &szError, &nErrorOffset, NULL)) == NULL) {
+             l2_env_errorinfo(env, L2_ERR_ARG, "%s ('%c')", szError, cfg->szRegex[nErrorOffset]);
+             return L2_ERR_ARG;
+         }
+         /* study FSM for more performance */
+         cfg->pcreExtra = pcre_study(cfg->pcreRegex, 0, &szError);
+         if (szError != NULL) {
+             free(cfg->pcreRegex);
+             cfg->pcreRegex = NULL;
+             l2_env_errorinfo(env, L2_ERR_ARG, "%s", szError);
+             return L2_ERR_ARG;
+         }
+     }
+ 
+     return L2_OK;
+ }
+ 
+ /* write to channel */
+ static l2_result_t hook_write(l2_context_t *ctx, l2_channel_t *ch,
+                               l2_level_t level, const char *buf, size_t buf_size)
+ {
+     l2_ch_filter_t *cfg = (l2_ch_filter_t *)ctx->vp;
+     int bPass, iCheck;
+ 
+     bPass = TRUE;
+ 
+     /* apply filter */
+     if (cfg->pcreRegex != NULL) {
+        iCheck = pcre_exec(cfg->pcreRegex, cfg->pcreExtra, buf, buf_size, 0, 0, NULL, 0);
+        if (iCheck >= 0)
+            bPass = TRUE;
+        else
+            bPass = FALSE;
+        if (cfg->bNegate)
+            bPass = !bPass;
+     }
+ 
+     return (bPass ? L2_OK_PASS : L2_OK);
+ }
+ 
+ static l2_result_t hook_destroy(l2_context_t *ctx, l2_channel_t *ch)
+ {
+     l2_ch_filter_t *cfg = (l2_ch_filter_t *)ctx->vp;
+ 
+     /* destroy channel configuration */
+     if (cfg->szRegex != NULL)
+         free(cfg->szRegex);
+     if (cfg->pcreRegex != NULL)
+         free(cfg->pcreRegex);
+     if (cfg->pcreExtra != NULL)
+         free(cfg->pcreExtra);
+     free(cfg);
+ 
+     return L2_OK_PASS;
+ }
+ 
+ l2_handler_t l2_handler_filter = {
+     "filter",
+     L2_CHANNEL_FILTER,
+     hook_create,
+     hook_configure,
+     NULL,
+     hook_write,
+     NULL,
+     NULL,
+     hook_destroy
+ };
+ 


ossp-pkg/l2/l2_ch_irc.c 1.9 -> 1.10

--- l2_ch_irc.c  2005/01/24 15:03:17     1.9
+++ l2_ch_irc.c  2005/10/03 08:08:11     1.10
@@ -1,8 +1,8 @@
 /*
 **  OSSP l2 - Flexible Logging
-**  Copyright (c) 2001-2004 Cable & Wireless <http://www.cw.com/>
-**  Copyright (c) 2001-2004 The OSSP Project <http://www.ossp.org/>
-**  Copyright (c) 2001-2004 Ralf S. Engelschall <rse@engelschall.com>
+**  Copyright (c) 2001-2005 Cable & Wireless <http://www.cw.com/>
+**  Copyright (c) 2001-2005 The OSSP Project <http://www.ossp.org/>
+**  Copyright (c) 2001-2005 Ralf S. Engelschall <rse@engelschall.com>
 **
 **  This file is part of OSSP l2, a flexible logging library which
 **  can be found at http://www.ossp.org/pkg/lib/l2/.


ossp-pkg/l2/l2_ch_noop.c 1.6 -> 1.7

--- l2_ch_noop.c 2005/01/24 15:03:17     1.6
+++ l2_ch_noop.c 2005/10/03 08:08:11     1.7
@@ -1,8 +1,8 @@
 /*
 **  OSSP l2 - Flexible Logging
-**  Copyright (c) 2001-2004 Cable & Wireless <http://www.cw.com/>
-**  Copyright (c) 2001-2004 The OSSP Project <http://www.ossp.org/>
-**  Copyright (c) 2001-2004 Ralf S. Engelschall <rse@engelschall.com>
+**  Copyright (c) 2001-2005 Cable & Wireless <http://www.cw.com/>
+**  Copyright (c) 2001-2005 The OSSP Project <http://www.ossp.org/>
+**  Copyright (c) 2001-2005 Ralf S. Engelschall <rse@engelschall.com>
 **
 **  This file is part of OSSP l2, a flexible logging library which
 **  can be found at http://www.ossp.org/pkg/lib/l2/.


ossp-pkg/l2/l2_ch_null.c 1.14 -> 1.15

--- l2_ch_null.c 2005/01/24 15:03:17     1.14
+++ l2_ch_null.c 2005/10/03 08:08:11     1.15
@@ -1,8 +1,8 @@
 /*
 **  OSSP l2 - Flexible Logging
-**  Copyright (c) 2001-2004 Cable & Wireless <http://www.cw.com/>
-**  Copyright (c) 2001-2004 The OSSP Project <http://www.ossp.org/>
-**  Copyright (c) 2001-2004 Ralf S. Engelschall <rse@engelschall.com>
+**  Copyright (c) 2001-2005 Cable & Wireless <http://www.cw.com/>
+**  Copyright (c) 2001-2005 The OSSP Project <http://www.ossp.org/>
+**  Copyright (c) 2001-2005 Ralf S. Engelschall <rse@engelschall.com>
 **
 **  This file is part of OSSP l2, a flexible logging library which
 **  can be found at http://www.ossp.org/pkg/lib/l2/.


ossp-pkg/l2/l2_ch_pipe.c 1.33 -> 1.34

--- l2_ch_pipe.c 2005/02/03 09:41:38     1.33
+++ l2_ch_pipe.c 2005/10/03 08:08:11     1.34
@@ -1,8 +1,8 @@
 /*
 **  OSSP l2 - Flexible Logging
-**  Copyright (c) 2001-2004 Cable & Wireless <http://www.cw.com/>
-**  Copyright (c) 2001-2004 The OSSP Project <http://www.ossp.org/>
-**  Copyright (c) 2001-2004 Ralf S. Engelschall <rse@engelschall.com>
+**  Copyright (c) 2001-2005 Cable & Wireless <http://www.cw.com/>
+**  Copyright (c) 2001-2005 The OSSP Project <http://www.ossp.org/>
+**  Copyright (c) 2001-2005 Ralf S. Engelschall <rse@engelschall.com>
 **
 **  This file is part of OSSP l2, a flexible logging library which
 **  can be found at http://www.ossp.org/pkg/lib/l2/.


ossp-pkg/l2/l2_ch_prefix.c 1.26 -> 1.27

--- l2_ch_prefix.c       2005/01/24 15:03:17     1.26
+++ l2_ch_prefix.c       2005/10/03 08:08:11     1.27
@@ -1,8 +1,8 @@
 /*
 **  OSSP l2 - Flexible Logging
-**  Copyright (c) 2001-2004 Cable & Wireless <http://www.cw.com/>
-**  Copyright (c) 2001-2004 The OSSP Project <http://www.ossp.org/>
-**  Copyright (c) 2001-2004 Ralf S. Engelschall <rse@engelschall.com>
+**  Copyright (c) 2001-2005 Cable & Wireless <http://www.cw.com/>
+**  Copyright (c) 2001-2005 The OSSP Project <http://www.ossp.org/>
+**  Copyright (c) 2001-2005 Ralf S. Engelschall <rse@engelschall.com>
 **
 **  This file is part of OSSP l2, a flexible logging library which
 **  can be found at http://www.ossp.org/pkg/lib/l2/.


ossp-pkg/l2/l2_ch_smtp.c 1.12 -> 1.13

--- l2_ch_smtp.c 2005/01/24 15:03:17     1.12
+++ l2_ch_smtp.c 2005/10/03 08:08:11     1.13
@@ -1,8 +1,8 @@
 /*
 **  OSSP l2 - Flexible Logging
-**  Copyright (c) 2001-2004 Cable & Wireless <http://www.cw.com/>
-**  Copyright (c) 2001-2004 The OSSP Project <http://www.ossp.org/>
-**  Copyright (c) 2001-2004 Ralf S. Engelschall <rse@engelschall.com>
+**  Copyright (c) 2001-2005 Cable & Wireless <http://www.cw.com/>
+**  Copyright (c) 2001-2005 The OSSP Project <http://www.ossp.org/>
+**  Copyright (c) 2001-2005 Ralf S. Engelschall <rse@engelschall.com>
 **
 **  This file is part of OSSP l2, a flexible logging library which
 **  can be found at http://www.ossp.org/pkg/lib/l2/.


ossp-pkg/l2/l2_ch_socket.c 1.39 -> 1.40

--- l2_ch_socket.c       2005/01/24 15:03:17     1.39
+++ l2_ch_socket.c       2005/10/03 08:08:11     1.40
@@ -1,8 +1,8 @@
 /*
 **  OSSP l2 - Flexible Logging
-**  Copyright (c) 2001-2004 Cable & Wireless <http://www.cw.com/>
-**  Copyright (c) 2001-2004 The OSSP Project <http://www.ossp.org/>
-**  Copyright (c) 2001-2004 Ralf S. Engelschall <rse@engelschall.com>
+**  Copyright (c) 2001-2005 Cable & Wireless <http://www.cw.com/>
+**  Copyright (c) 2001-2005 The OSSP Project <http://www.ossp.org/>
+**  Copyright (c) 2001-2005 Ralf S. Engelschall <rse@engelschall.com>
 **
 **  This file is part of OSSP l2, a flexible logging library which
 **  can be found at http://www.ossp.org/pkg/lib/l2/.


ossp-pkg/l2/l2_ch_syslog.c 1.34 -> 1.35

--- l2_ch_syslog.c       2005/01/24 15:03:17     1.34
+++ l2_ch_syslog.c       2005/10/03 08:08:11     1.35
@@ -1,8 +1,8 @@
 /*
 **  OSSP l2 - Flexible Logging
-**  Copyright (c) 2001-2004 Cable & Wireless <http://www.cw.com/>
-**  Copyright (c) 2001-2004 The OSSP Project <http://www.ossp.org/>
-**  Copyright (c) 2001-2004 Ralf S. Engelschall <rse@engelschall.com>
+**  Copyright (c) 2001-2005 Cable & Wireless <http://www.cw.com/>
+**  Copyright (c) 2001-2005 The OSSP Project <http://www.ossp.org/>
+**  Copyright (c) 2001-2005 Ralf S. Engelschall <rse@engelschall.com>
 **
 **  This file is part of OSSP l2, a flexible logging library which
 **  can be found at http://www.ossp.org/pkg/lib/l2/.


ossp-pkg/l2/l2_channel.c 1.34 -> 1.35

--- l2_channel.c 2005/01/24 15:03:17     1.34
+++ l2_channel.c 2005/10/03 08:08:11     1.35
@@ -1,8 +1,8 @@
 /*
 **  OSSP l2 - Flexible Logging
-**  Copyright (c) 2001-2004 Cable & Wireless <http://www.cw.com/>
-**  Copyright (c) 2001-2004 The OSSP Project <http://www.ossp.org/>
-**  Copyright (c) 2001-2004 Ralf S. Engelschall <rse@engelschall.com>
+**  Copyright (c) 2001-2005 Cable & Wireless <http://www.cw.com/>
+**  Copyright (c) 2001-2005 The OSSP Project <http://www.ossp.org/>
+**  Copyright (c) 2001-2005 Ralf S. Engelschall <rse@engelschall.com>
 **
 **  This file is part of OSSP l2, a flexible logging library which
 **  can be found at http://www.ossp.org/pkg/lib/l2/.


ossp-pkg/l2/l2_env.c 1.11 -> 1.12

--- l2_env.c     2005/01/24 15:03:17     1.11
+++ l2_env.c     2005/10/03 08:08:11     1.12
@@ -1,8 +1,8 @@
 /*
 **  OSSP l2 - Flexible Logging
-**  Copyright (c) 2001-2004 Cable & Wireless <http://www.cw.com/>
-**  Copyright (c) 2001-2004 The OSSP Project <http://www.ossp.org/>
-**  Copyright (c) 2001-2004 Ralf S. Engelschall <rse@engelschall.com>
+**  Copyright (c) 2001-2005 Cable & Wireless <http://www.cw.com/>
+**  Copyright (c) 2001-2005 The OSSP Project <http://www.ossp.org/>
+**  Copyright (c) 2001-2005 Ralf S. Engelschall <rse@engelschall.com>
 **
 **  This file is part of OSSP l2, a flexible logging library which
 **  can be found at http://www.ossp.org/pkg/lib/l2/.


ossp-pkg/l2/l2_p.h 1.36 -> 1.37

--- l2_p.h       2005/01/24 15:03:17     1.36
+++ l2_p.h       2005/10/03 08:08:11     1.37
@@ -1,8 +1,8 @@
 /*
 **  OSSP l2 - Flexible Logging
-**  Copyright (c) 2001-2004 Cable & Wireless <http://www.cw.com/>
-**  Copyright (c) 2001-2004 The OSSP Project <http://www.ossp.org/>
-**  Copyright (c) 2001-2004 Ralf S. Engelschall <rse@engelschall.com>
+**  Copyright (c) 2001-2005 Cable & Wireless <http://www.cw.com/>
+**  Copyright (c) 2001-2005 The OSSP Project <http://www.ossp.org/>
+**  Copyright (c) 2001-2005 Ralf S. Engelschall <rse@engelschall.com>
 **
 **  This file is part of OSSP l2, a flexible logging library which
 **  can be found at http://www.ossp.org/pkg/lib/l2/.


ossp-pkg/l2/l2_spec.c 1.11 -> 1.12

--- l2_spec.c    2005/01/24 15:03:17     1.11
+++ l2_spec.c    2005/10/03 08:08:11     1.12
@@ -1,8 +1,8 @@
 /*
 **  OSSP l2 - Flexible Logging
-**  Copyright (c) 2001-2004 Cable & Wireless <http://www.cw.com/>
-**  Copyright (c) 2001-2004 The OSSP Project <http://www.ossp.org/>
-**  Copyright (c) 2001-2004 Ralf S. Engelschall <rse@engelschall.com>
+**  Copyright (c) 2001-2005 Cable & Wireless <http://www.cw.com/>
+**  Copyright (c) 2001-2005 The OSSP Project <http://www.ossp.org/>
+**  Copyright (c) 2001-2005 Ralf S. Engelschall <rse@engelschall.com>
 **
 **  This file is part of OSSP l2, a flexible logging library which
 **  can be found at http://www.ossp.org/pkg/lib/l2/.


ossp-pkg/l2/l2_spec.h 1.5 -> 1.6

--- l2_spec.h    2005/01/24 15:03:18     1.5
+++ l2_spec.h    2005/10/03 08:08:11     1.6
@@ -1,8 +1,8 @@
 /*
 **  OSSP l2 - Flexible Logging
-**  Copyright (c) 2001-2004 Cable & Wireless <http://www.cw.com/>
-**  Copyright (c) 2001-2004 The OSSP Project <http://www.ossp.org/>
-**  Copyright (c) 2001-2004 Ralf S. Engelschall <rse@engelschall.com>
+**  Copyright (c) 2001-2005 Cable & Wireless <http://www.cw.com/>
+**  Copyright (c) 2001-2005 The OSSP Project <http://www.ossp.org/>
+**  Copyright (c) 2001-2005 Ralf S. Engelschall <rse@engelschall.com>
 **
 **  This file is part of OSSP l2, a flexible logging library which
 **  can be found at http://www.ossp.org/pkg/lib/l2/.


ossp-pkg/l2/l2_spec_parse.y 1.12 -> 1.13

--- l2_spec_parse.y      2005/01/24 15:03:18     1.12
+++ l2_spec_parse.y      2005/10/03 08:08:11     1.13
@@ -1,9 +1,9 @@
 %{
 /*
 **  OSSP l2 - Flexible Logging
-**  Copyright (c) 2001-2004 Cable & Wireless <http://www.cw.com/>
-**  Copyright (c) 2001-2004 The OSSP Project <http://www.ossp.org/>
-**  Copyright (c) 2001-2004 Ralf S. Engelschall <rse@engelschall.com>
+**  Copyright (c) 2001-2005 Cable & Wireless <http://www.cw.com/>
+**  Copyright (c) 2001-2005 The OSSP Project <http://www.ossp.org/>
+**  Copyright (c) 2001-2005 Ralf S. Engelschall <rse@engelschall.com>
 **
 **  This file is part of OSSP l2, a flexible logging library which
 **  can be found at http://www.ossp.org/pkg/lib/l2/.


ossp-pkg/l2/l2_spec_scan.l 1.15 -> 1.16

--- l2_spec_scan.l       2005/02/03 09:42:36     1.15
+++ l2_spec_scan.l       2005/10/03 08:08:11     1.16
@@ -1,9 +1,9 @@
 %{
 /*
 **  OSSP l2 - Flexible Logging
-**  Copyright (c) 2001-2004 Cable & Wireless <http://www.cw.com/>
-**  Copyright (c) 2001-2004 The OSSP Project <http://www.ossp.org/>
-**  Copyright (c) 2001-2004 Ralf S. Engelschall <rse@engelschall.com>
+**  Copyright (c) 2001-2005 Cable & Wireless <http://www.cw.com/>
+**  Copyright (c) 2001-2005 The OSSP Project <http://www.ossp.org/>
+**  Copyright (c) 2001-2005 Ralf S. Engelschall <rse@engelschall.com>
 **
 **  This file is part of OSSP l2, a flexible logging library which
 **  can be found at http://www.ossp.org/pkg/lib/l2/.


ossp-pkg/l2/l2_test.c 1.55 -> 1.56

--- l2_test.c    2005/01/24 15:03:18     1.55
+++ l2_test.c    2005/10/03 08:08:11     1.56
@@ -1,8 +1,8 @@
 /*
 **  OSSP l2 - Flexible Logging
-**  Copyright (c) 2001-2004 Cable & Wireless <http://www.cw.com/>
-**  Copyright (c) 2001-2004 The OSSP Project <http://www.ossp.org/>
-**  Copyright (c) 2001-2004 Ralf S. Engelschall <rse@engelschall.com>
+**  Copyright (c) 2001-2005 Cable & Wireless <http://www.cw.com/>
+**  Copyright (c) 2001-2005 The OSSP Project <http://www.ossp.org/>
+**  Copyright (c) 2001-2005 Ralf S. Engelschall <rse@engelschall.com>
 **
 **  This file is part of OSSP l2, a flexible logging library which
 **  can be found at http://www.ossp.org/pkg/lib/l2/.


ossp-pkg/l2/l2_ut_fmtcb.c 1.8 -> 1.9

--- l2_ut_fmtcb.c        2005/01/24 15:03:18     1.8
+++ l2_ut_fmtcb.c        2005/10/03 08:08:11     1.9
@@ -1,8 +1,8 @@
 /*
 **  OSSP l2 - Flexible Logging
-**  Copyright (c) 2001-2004 Cable & Wireless <http://www.cw.com/>
-**  Copyright (c) 2001-2004 The OSSP Project <http://www.ossp.org/>
-**  Copyright (c) 2001-2004 Ralf S. Engelschall <rse@engelschall.com>
+**  Copyright (c) 2001-2005 Cable & Wireless <http://www.cw.com/>
+**  Copyright (c) 2001-2005 The OSSP Project <http://www.ossp.org/>
+**  Copyright (c) 2001-2005 Ralf S. Engelschall <rse@engelschall.com>
 **
 **  This file is part of OSSP l2, a flexible logging library which
 **  can be found at http://www.ossp.org/pkg/lib/l2/.


ossp-pkg/l2/l2_ut_format.h 1.5 -> 1.6

--- l2_ut_format.h       2005/01/24 15:03:18     1.5
+++ l2_ut_format.h       2005/10/03 08:08:11     1.6
@@ -1,8 +1,8 @@
 /*
 **  OSSP l2 - Flexible Logging
-**  Copyright (c) 2001-2004 Cable & Wireless <http://www.cw.com/>
-**  Copyright (c) 2001-2004 The OSSP Project <http://www.ossp.org/>
-**  Copyright (c) 2001-2004 Ralf S. Engelschall <rse@engelschall.com>
+**  Copyright (c) 2001-2005 Cable & Wireless <http://www.cw.com/>
+**  Copyright (c) 2001-2005 The OSSP Project <http://www.ossp.org/>
+**  Copyright (c) 2001-2005 Ralf S. Engelschall <rse@engelschall.com>
 **
 **  This file is part of OSSP l2, a flexible logging library which
 **  can be found at http://www.ossp.org/pkg/lib/l2/.


ossp-pkg/l2/l2_ut_level.c -> 1.11

*** /dev/null    Sat Nov 23 01:31:01 2024
--- -    Sat Nov 23 01:31:04 2024
***************
*** 0 ****
--- 1,147 ----
+ /*
+ **  OSSP l2 - Flexible Logging
+ **  Copyright (c) 2001-2005 Cable & Wireless <http://www.cw.com/>
+ **  Copyright (c) 2001-2005 The OSSP Project <http://www.ossp.org/>
+ **  Copyright (c) 2001-2005 Ralf S. Engelschall <rse@engelschall.com>
+ **
+ **  This file is part of OSSP l2, a flexible logging library which
+ **  can be found at http://www.ossp.org/pkg/lib/l2/.
+ **
+ **  Permission to use, copy, modify, and distribute this software for
+ **  any purpose with or without fee is hereby granted, provided that
+ **  the above copyright notice and this permission notice appear in all
+ **  copies.
+ **
+ **  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ **  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ **  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ **  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+ **  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ **  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ **  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ **  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ **  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ **  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ **  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ **  SUCH DAMAGE.
+ **
+ **  l2_ut_level.c: level mask transformations
+ */
+ 
+ #include "l2.h"
+ #include "l2_p.h"
+ 
+ #include <string.h>
+ #include <ctype.h>
+ 
+ static struct {
+     l2_level_t level;
+     char *string;
+ } l2s_table[] = {
+     { L2_LEVEL_PANIC,    "panic"    },
+     { L2_LEVEL_CRITICAL, "critical" },
+     { L2_LEVEL_ERROR,    "error"    },
+     { L2_LEVEL_WARNING,  "warning"  },
+     { L2_LEVEL_NOTICE,   "notice"   },
+     { L2_LEVEL_INFO,     "info"     },
+     { L2_LEVEL_TRACE,    "trace"    },
+     { L2_LEVEL_DEBUG,    "debug"    },
+     { 0,                 NULL       }
+ };
+ 
+ l2_result_t l2_util_l2s(char *string, size_t maxlen, int sep, unsigned int levelmask)
+ {
+     char hexbuf[2+(sizeof(unsigned int)*2)+1];
+     int len;
+     int i;
+     int l;
+ 
+     len = maxlen;
+     string[0] = '\0';
+     for (i = 0; l2s_table[i].level != 0; i++) {
+         if (levelmask & l2s_table[i].level) {
+             levelmask &= ~(l2s_table[i].level);
+             l = strlen(l2s_table[i].string) + 1;
+             if (len < l)
+                 return L2_ERR_MEM;
+             sprintf(string+(maxlen-len), "%s%c", l2s_table[i].string, sep);
+             len -= l;
+         }
+     }
+     if (levelmask != 0) {
+         sprintf(hexbuf, "0x%x", levelmask);
+         l = strlen(hexbuf) + 1;
+         if (len < l)
+             return L2_ERR_MEM;
+         sprintf(string+(maxlen-len), "%s%c", hexbuf, sep);
+         len -= l;
+     }
+     /* remove trailing comma */
+     if ((maxlen-len) > 0)
+         string[(maxlen-len)-1] = '\0';
+ 
+     return L2_OK;
+ }
+ 
+ static unsigned int hexval(const char *cpB, const char *cpE)
+ {
+     unsigned int hv;
+     unsigned int nibble;
+ 
+     hv = 0;
+     while (cpB < cpE) {
+         nibble = tolower((unsigned int)(*cpB++));
+         if (isdigit(nibble))
+             nibble = nibble - '0';
+         else
+             nibble = nibble - 'a';
+         hv = ((hv << 4) | nibble);
+     }
+     return hv;
+ }
+ 
+ static int myishexnumber(int c)
+ {
+     if (isdigit(c) || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'))
+         return 1;
+     return 0;
+ }
+ 
+ l2_result_t l2_util_s2l(const char *string, size_t maxlen, int sep, unsigned int *levelmask)
+ {
+     const char *cpB;
+     const char *cpE;
+     int bFound;
+     int i;
+ 
+     *levelmask = 0;
+     cpE = string;
+     while (1) {
+         cpB = cpE;
+         if (cpB >= (string+maxlen))
+             break;
+         if ((int)(*cpB) == sep)
+             cpB++;
+         for (cpE = cpB; cpE < (string+maxlen) && (int)(*cpE) != sep; cpE++)
+             ;
+         if (cpE > (string+maxlen))
+             break;
+         bFound = 0;
+         for (i = 0; l2s_table[i].level != 0; i++) {
+             if (strncasecmp(cpB, l2s_table[i].string, cpE-cpB) == 0) {
+                 *levelmask |= l2s_table[i].level;
+                 bFound = 1;
+                 break;
+             }
+         }
+         if (!bFound) {
+             if ((cpE > cpB+2) && strncasecmp(cpB, "0x", 2) == 0 && myishexnumber((int)(*(cpB+2)))) {
+                 *levelmask |= hexval(cpB+2, cpE);
+             }
+             else
+                 return L2_ERR_ARG;
+         }
+     }
+     return L2_OK;
+ }
+ 


ossp-pkg/l2/l2_ut_param.c 1.12 -> 1.13

--- l2_ut_param.c        2005/01/24 15:03:18     1.12
+++ l2_ut_param.c        2005/10/03 08:08:11     1.13
@@ -1,8 +1,8 @@
 /*
 **  OSSP l2 - Flexible Logging
-**  Copyright (c) 2001-2004 Cable & Wireless <http://www.cw.com/>
-**  Copyright (c) 2001-2004 The OSSP Project <http://www.ossp.org/>
-**  Copyright (c) 2001-2004 Ralf S. Engelschall <rse@engelschall.com>
+**  Copyright (c) 2001-2005 Cable & Wireless <http://www.cw.com/>
+**  Copyright (c) 2001-2005 The OSSP Project <http://www.ossp.org/>
+**  Copyright (c) 2001-2005 Ralf S. Engelschall <rse@engelschall.com>
 **
 **  This file is part of OSSP l2, a flexible logging library which
 **  can be found at http://www.ossp.org/pkg/lib/l2/.


ossp-pkg/l2/l2tool.c 1.7 -> 1.8

--- l2tool.c     2005/02/03 09:43:52     1.7
+++ l2tool.c     2005/10/03 08:08:11     1.8
@@ -1,8 +1,8 @@
 /*
 **  OSSP l2 - Flexible Logging
-**  Copyright (c) 2001-2004 Cable & Wireless <http://www.cw.com/>
-**  Copyright (c) 2001-2004 The OSSP Project <http://www.ossp.org/>
-**  Copyright (c) 2001-2004 Ralf S. Engelschall <rse@engelschall.com>
+**  Copyright (c) 2001-2005 Cable & Wireless <http://www.cw.com/>
+**  Copyright (c) 2001-2005 The OSSP Project <http://www.ossp.org/>
+**  Copyright (c) 2001-2005 Ralf S. Engelschall <rse@engelschall.com>
 **
 **  This file is part of OSSP l2, a flexible logging library which
 **  can be found at http://www.ossp.org/pkg/lib/l2/.


ossp-pkg/l2/l2tool.pod 1.5 -> 1.6

--- l2tool.pod   2005/01/24 15:03:18     1.5
+++ l2tool.pod   2005/10/03 08:08:11     1.6
@@ -1,8 +1,8 @@
 ##
 ##  OSSP l2 - Flexible Logging
-##  Copyright (c) 2001-2004 Cable & Wireless <http://www.cw.com/>
-##  Copyright (c) 2001-2004 The OSSP Project <http://www.ossp.org/>
-##  Copyright (c) 2001-2004 Ralf S. Engelschall <rse@engelschall.com>
+##  Copyright (c) 2001-2005 Cable & Wireless <http://www.cw.com/>
+##  Copyright (c) 2001-2005 The OSSP Project <http://www.ossp.org/>
+##  Copyright (c) 2001-2005 Ralf S. Engelschall <rse@engelschall.com>
 ##
 ##  This file is part of OSSP l2, a flexible logging library which
 ##  can be found at http://www.ossp.org/pkg/lib/l2/.

CVSTrac 2.0.1