OSSP CVS Repository

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

Check-in Number: 1416
Date: 2001-Dec-11 12:53:11 (local)
2001-Dec-11 11:53:11 (UTC)
User:thl
Branch:
Comment: switch to latest L2 version
Tickets:
Inspections:
Files:
ossp-pkg/lmtp2nntp/README      1.13 -> 1.14     1 inserted, 1 deleted
ossp-pkg/lmtp2nntp/autogen.sh      1.7 -> 1.8     4 inserted, 4 deleted
ossp-pkg/lmtp2nntp/lmtp2nntp.c      1.98 -> 1.99     37 inserted, 74 deleted
ossp-pkg/lmtp2nntp/lmtp2nntp.h      1.5 -> 1.6     5 inserted, 5 deleted
ossp-pkg/lmtp2nntp/msg.h      1.6 -> 1.7     1 inserted, 1 deleted
ossp-pkg/lmtp2nntp/version.c      1.15 -> 1.16     9 inserted, 9 deleted

ossp-pkg/lmtp2nntp/README 1.13 -> 1.14

--- README       2001/11/14 15:05:39     1.13
+++ README       2001/12/11 11:53:11     1.14
@@ -7,7 +7,7 @@
                   |_|                        |_|    
 
   OSSP lmtp2nntp - Mail to News Gateway
-  Version 1.1.1 (14-Nov-2001)
+  Version 1.2a1 (06-Dec-2001)
 
   ABSTRACT
 


ossp-pkg/lmtp2nntp/autogen.sh 1.7 -> 1.8

--- autogen.sh   2001/11/07 16:21:40     1.7
+++ autogen.sh   2001/12/11 11:53:11     1.8
@@ -67,10 +67,10 @@
 echo "===> str (autogen.sh)"
 (cd str && ./autogen.sh)
 echo "<=== str"
-echo "===> l2 (autogen.sh)"
-(cd l2  && ./autogen.sh)
+echo "===> l2 (devtool"
+(cd l2 && ./devtool autogen)
 echo "<=== l2"
-echo "===> sa (autogen.sh)"
-(cd sa  && ./devtool autogen)
+echo "===> sa (devtool)"
+(cd sa && ./devtool autogen)
 echo "<=== sa"
 


ossp-pkg/lmtp2nntp/lmtp2nntp.c 1.98 -> 1.99

--- lmtp2nntp.c  2001/11/08 10:08:09     1.98
+++ lmtp2nntp.c  2001/12/11 11:53:11     1.99
@@ -123,7 +123,7 @@
     sa_t           *sa;   /* socket abstraction */
     nntp_t         *nntp;
     nntp_rc_t       rc;
-    l2_stream_t    *l2;
+    l2_channel_t   *l2;
 };
 
 struct acl {
@@ -162,7 +162,8 @@
     int             option_veryverbose;
     int             option_childsmax;
     int             active_childs;
-    l2_stream_t    *l2;
+    l2_env_t       *l2_env;
+    l2_channel_t   *l2;
     sa_addr_t      *saaAltio;
     sa_t           *saAltio;
     char           *cpBindh;
@@ -363,7 +364,7 @@
                 return;
             case SIGUSR1:
                 log1(ctx, NOTICE, "caught signal %d - flush logging stream", sig);
-                l2_stream_flush(ctx->l2);
+                l2_channel_flush(ctx->l2);
                 return;
             case SIGHUP:
             case SIGINT:
@@ -373,7 +374,8 @@
             default:
                 log1(ctx, PANIC, "CAUGHT SIGNAL %d - EXIT - NO MORE LOGGING", sig);
         }
-        l2_stream_destroy(ctx->l2);
+        l2_channel_destroy(ctx->l2);
+        l2_env_destroy(ctx->l2_env);
     }
     exit(ERR_EXECUTION);
 }
@@ -396,9 +398,6 @@
     size_t        asACL;
     char         *cpHost;
     char         *cpPort;
-    l2_channel_t *chPrefix;
-    l2_channel_t *chBuf;
-    l2_channel_t *chFile;
     pid_t         pid;
     FILE         *fd;
     char         *cpName;
@@ -453,6 +452,7 @@
     ctx->option_veryverbose = FALSE;
     ctx->option_childsmax = 10;
     ctx->active_childs = 0;
+    ctx->l2_env = NULL;
     ctx->l2 = NULL;
     ctx->saaAltio = NULL;
     ctx->saAltio = NULL;
@@ -962,100 +962,62 @@
         }
     }
 
-    if ((ctx->l2 = l2_stream_create()) == NULL) {
-        fprintf(stderr, "%s:Error: logging failed to create stream\n", ctx->progname);
-        CU(ERR_EXECUTION);
-    }
-    if (l2_stream_levels(ctx->l2, L2_LEVEL_UPTO(L2_LEVEL_DEBUG), L2_LEVEL_NONE) != L2_OK) {
-        fprintf(stderr, "%s:Error: logging failed to set global logging level\n", ctx->progname);
+    /* create L2 environment */
+    if (l2_env_create(&ctx->l2_env) != L2_OK) {
+        fprintf(stderr, "%s:Error: failed to create L2 environment\n", ctx->progname);
         CU(ERR_EXECUTION);
     }
 
-    if (l2_stream_formatter(ctx->l2, 'P', formatter_prefix, &ctx->ctx) != L2_OK) {
+    /* register custom L2 formatters */
+    if (l2_env_formatter(ctx->l2_env, 'P', formatter_prefix, &ctx->ctx) != L2_OK) {
         fprintf(stderr, "%s:Error: logging failed to register prefix formatter\n", ctx->progname);
         CU(ERR_EXECUTION);
     }
-    if (l2_stream_formatter(ctx->l2, 'D', l2_util_fmt_dump, NULL) != L2_OK) {
+    if (l2_env_formatter(ctx->l2_env, 'D', l2_util_fmt_dump, NULL) != L2_OK) {
         fprintf(stderr, "%s:Error: logging failed to register dump formatter\n", ctx->progname);
         CU(ERR_EXECUTION);
     }
-    if (l2_stream_formatter(ctx->l2, 'S', l2_util_fmt_string, NULL) != L2_OK) {
+    if (l2_env_formatter(ctx->l2_env, 'S', l2_util_fmt_string, NULL) != L2_OK) {
         fprintf(stderr, "%s:Error: logging failed to register string formatter\n", ctx->progname);
         CU(ERR_EXECUTION);
     }
-    if (l2_stream_formatter(ctx->l2, 'm', formatter_errno, NULL) != L2_OK) {
+    if (l2_env_formatter(ctx->l2_env, 'm', formatter_errno, NULL) != L2_OK) {
         fprintf(stderr, "%s:Error: logging failed to register errno formatter\n", ctx->progname);
         CU(ERR_EXECUTION);
     }
 
-    if((ctx->option_levelmask != L2_LEVEL_NONE) && (ctx->option_logfile != NULL)) {
-        if ((chPrefix  = l2_channel_create(&l2_handler_prefix)) == NULL) {
-            fprintf(stderr, "%s:Error: logging failed to create prefix channel\n", ctx->progname);
-            CU(ERR_EXECUTION);
-        }
-        if (l2_channel_configure(chPrefix, "prefix,timezone", "%b %d %H:%M:%S <%L> lmtp2nntp[%P]: ", "local") != L2_OK) {
-            fprintf(stderr, "%s:Error: logging failed to configure prefix channel\n", ctx->progname);
-            CU(ERR_EXECUTION);
-        }
-
-        if (!ctx->option_veryverbose) {
-            if ((chBuf  = l2_channel_create(&l2_handler_buffer)) == NULL) {
-                fprintf(stderr, "%s:Error: logging failed to create buffer channel\n", ctx->progname);
-                CU(ERR_EXECUTION);
-            }
-            if (l2_channel_configure(chBuf, "size", 65536) != L2_OK) {
-                fprintf(stderr, "%s:Error: logging failed to configure buffer channel\n", ctx->progname);
-                CU(ERR_EXECUTION);
-            }
-        }
+    /* create channel stream */
+    if (ctx->option_levelmask != L2_LEVEL_NONE && ctx->option_logfile != NULL) {
+        if (ctx->option_veryverbose)
+            rc = l2_spec(&ctx->l2, ctx->l2_env, 
+                         "prefix(prefix=\"%%b %%d %%H:%%M:%%S <%%L> lmtp2nntp[%%P]: \",timezone=local)"
+                         "  -> buffer(size=65536)"
+                         "  -> file(path=%s,append=1,perm=%d)",
+                         ctx->option_logfile, 0644);
         else
-            chBuf = NULL;
-
-        if ((chFile = l2_channel_create(&l2_handler_file)) == NULL) {
-            fprintf(stderr, "%s:Error: logging failed to create file channel\n", ctx->progname);
+            rc = l2_spec(&ctx->l2, ctx->l2_env, 
+                         "prefix(prefix=\"%%b %%d %%H:%%M:%%S <%%L> lmtp2nntp[%%P]: \",timezone=local)"
+                         "  -> file(path=%s,append=1,perm=%d)",
+                         ctx->option_logfile, 0644);
+        if (rc != L2_OK) {
+            fprintf(stderr, "%s:Error: logging failed to create stream\n", ctx->progname);
             CU(ERR_EXECUTION);
         }
-        if (l2_channel_configure(chFile, "path,append,perm", ctx->option_logfile, TRUE, 0644) != L2_OK) {
-            fprintf(stderr, "%s:Error: logging failed to configure file channel\n", ctx->progname);
+        if (l2_channel_levels(ctx->l2, ctx->option_levelmask, L2_LEVEL_NONE) != L2_OK) {
+            fprintf(stderr, "%s:Error: logging failed to set global logging level\n", ctx->progname);
             CU(ERR_EXECUTION);
         }
-
-        if (!ctx->option_veryverbose) {
-            if (l2_channel_stack(chFile, chBuf) != L2_OK) {
-                fprintf(stderr, "%s:Error: logging failed to stack buffer channel on top of file channel\n", ctx->progname);
-                CU(ERR_EXECUTION);
-            }
-            if (l2_channel_stack(chBuf, chPrefix) != L2_OK) {
-                fprintf(stderr, "%s:Error: logging failed to stack prefix channel on top of buffer channel\n", ctx->progname);
-                CU(ERR_EXECUTION);
-            }
-        }
-        else {
-            if (l2_channel_stack(chFile, chPrefix) != L2_OK) {
-                fprintf(stderr, "%s:Error: logging failed to stack prefix channel on top of buffer channel\n", ctx->progname);
-                CU(ERR_EXECUTION);
-            }
-        }
-
-        if (l2_channel_open(chPrefix) != L2_OK) {
-            fprintf(stderr, "%s:Error: logging failed to open buffer channel\n", ctx->progname);
-            CU(ERR_EXECUTION);
-        }
-
-        if (l2_stream_channel(ctx->l2, chPrefix, ctx->option_levelmask, L2_LEVEL_NONE) != L2_OK) {
-            fprintf(stderr, "%s:Error: logging failed to attach channel into stream\n", ctx->progname);
+        if (l2_channel_open(ctx->l2) != L2_OK) {
+            fprintf(stderr, "%s:Error: logging failed to open channel stream\n", ctx->progname);
             CU(ERR_EXECUTION);
         }
     }
 
-    if (log1(ctx, NOTICE, "startup, version %s", lmtp2nntp_version.v_gnu) != L2_OK) {
-        fprintf(stderr, "%s:Error: logging failed to log startup message to stream\n", ctx->progname);
-        CU(ERR_EXECUTION);
-    }
     /* from this point on logging is up and running and fprintf(stderr, ...)
      * should not be used in the remainder of the code
      */
 
+    log1(ctx, NOTICE, "startup, version %s", lmtp2nntp_version.v_gnu);
     if (ctx->option_veryverbose)
         log0(ctx, NOTICE, "logging very verbose (unbuffered)");
 
@@ -1219,7 +1181,7 @@
 
             /* logging buffer must be empty before fork otherwise content is
              * duplicated and written twice on next flush */
-            l2_stream_flush(ctx->l2);
+            l2_channel_flush(ctx->l2);
             pid = fork();
             if (pid == -1) {
                 log0(ctx, ERROR, "daemon cannot spawn child %m");
@@ -1280,7 +1242,8 @@
     /* graceful shutdown */
     CUS:
     log0(ctx, NOTICE, "graceful shutdown shortly before exit - no more logging");
-    l2_stream_destroy(ctx->l2);
+    l2_channel_destroy(ctx->l2);
+    l2_env_destroy(ctx->l2_env);
     if (ctx->saAltio)
         sa_destroy(ctx->saAltio);
     if (ctx->saaAltio)


ossp-pkg/lmtp2nntp/lmtp2nntp.h 1.5 -> 1.6

--- lmtp2nntp.h  2001/09/11 13:41:22     1.5
+++ lmtp2nntp.h  2001/12/11 11:53:11     1.6
@@ -35,15 +35,15 @@
 #endif
 
 #define log0(ctx,level,msg) \
-    l2_stream_log((ctx)->l2, L2_LEVEL_##level, "%P" msg)
+    l2_channel_log((ctx)->l2, L2_LEVEL_##level, "%P" msg)
 #define log1(ctx,level,msg,a1) \
-    l2_stream_log((ctx)->l2, L2_LEVEL_##level, "%P" msg, a1)
+    l2_channel_log((ctx)->l2, L2_LEVEL_##level, "%P" msg, a1)
 #define log2(ctx,level,msg,a1,a2) \
-    l2_stream_log((ctx)->l2, L2_LEVEL_##level, "%P" msg, a1, a2)
+    l2_channel_log((ctx)->l2, L2_LEVEL_##level, "%P" msg, a1, a2)
 #define log3(ctx,level,msg,a1,a2,a3) \
-    l2_stream_log((ctx)->l2, L2_LEVEL_##level, "%P" msg, a1, a2, a3)
+    l2_channel_log((ctx)->l2, L2_LEVEL_##level, "%P" msg, a1, a2, a3)
 #define log4(ctx,level,msg,a1,a2,a3,a4) \
-    l2_stream_log((ctx)->l2, L2_LEVEL_##level, "%P" msg, a1, a2, a3, a4)
+    l2_channel_log((ctx)->l2, L2_LEVEL_##level, "%P" msg, a1, a2, a3, a4)
 
 #define STMT(stuff) do { stuff } while (0)
 #define CU(returncode) STMT( rc = returncode; goto CUS; )


ossp-pkg/lmtp2nntp/msg.h 1.6 -> 1.7

--- msg.h        2001/09/11 13:41:22     1.6
+++ msg.h        2001/12/11 11:53:11     1.7
@@ -45,7 +45,7 @@
     size_t  asRcpt;
     char   *azNewsgroups;
     size_t  asNewsgroups;
-    l2_stream_t *l2;
+    l2_channel_t *l2;
 } msg_t;
 
 #define WRAPAT 120          /* join wraps header lines when exceeding this value */


ossp-pkg/lmtp2nntp/version.c 1.15 -> 1.16

--- version.c    2001/11/14 15:05:39     1.15
+++ version.c    2001/12/11 11:53:11     1.16
@@ -8,7 +8,7 @@
 #ifndef _VERSION_C_
 #define _VERSION_C_
 
-#define LMTP2NNTP_VERSION 0x101201
+#define LMTP2NNTP_VERSION 0x102001
 
 typedef struct {
     const int   v_hex;
@@ -32,14 +32,14 @@
 #undef  _VERSION_C_AS_HEADER_
 
 lmtp2nntp_version_t lmtp2nntp_version = {
-    0x101201,
-    "1.1.1",
-    "1.1.1 (14-Nov-2001)",
-    "This is lmtp2nntp, Version 1.1.1 (14-Nov-2001)",
-    "lmtp2nntp 1.1.1 (14-Nov-2001)",
-    "lmtp2nntp/1.1.1",
-    "@(#)lmtp2nntp 1.1.1 (14-Nov-2001)",
-    "$Id: lmtp2nntp 1.1.1 (14-Nov-2001) $"
+    0x102001,
+    "1.2a1",
+    "1.2a1 (06-Dec-2001)",
+    "This is lmtp2nntp, Version 1.2a1 (06-Dec-2001)",
+    "lmtp2nntp 1.2a1 (06-Dec-2001)",
+    "lmtp2nntp/1.2a1",
+    "@(#)lmtp2nntp 1.2a1 (06-Dec-2001)",
+    "$Id: lmtp2nntp 1.2a1 (06-Dec-2001) $"
 };
 
 #endif /* _VERSION_C_AS_HEADER_ */

CVSTrac 2.0.1