OSSP CVS Repository

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

Check-in Number: 1069
Date: 2001-Oct-04 14:53:54 (local)
2001-Oct-04 12:53:54 (UTC)
User:ms
Branch:
Comment: Pipe and socket channel configuration-time parameter improvements.
Tickets:
Inspections:
Files:
ossp-pkg/l2/l2_ch_pipe.c      1.24 -> 1.25     9 inserted, 9 deleted
ossp-pkg/l2/l2_test.c      1.28 -> 1.29     9 inserted, 12 deleted

ossp-pkg/l2/l2_ch_pipe.c 1.24 -> 1.25

--- l2_ch_pipe.c 2001/10/04 12:34:41     1.24
+++ l2_ch_pipe.c 2001/10/04 12:53:54     1.25
@@ -37,7 +37,7 @@
 
 #define L2_PIPE_EXECMODE_DIRECT    1 /* direct command execution             */
 #define L2_PIPE_EXECMODE_SHELL     2 /* shell  command execution             */
-#define L2_PIPE_RUNTIME_RELIABLE   3 /* reliable pipe command processing     */
+#define L2_PIPE_RUNTIME_CONTINU    3 /* continuous pipe command processing   */
 #define L2_PIPE_RUNTIME_ONESHOT    4 /* oneshot  pipe command processing     */
 #define L2_PIPE_WRITEFAIL          6 /* how long before failure occurs       */
 #define L2_PIPE_MAXARGS          256 /* how many args can piped command have */
@@ -49,7 +49,7 @@
     int              piFd[2];    /* pipe file descriptor                 */
     int              iNulldev;   /* null device file descriptor          */
     int              iMode;      /* execution mode direct or shell       */
-    int              iRtme;      /* runtime mode reliable or oneshot     */
+    int              iRtme;      /* runtime mode continuous or oneshot   */
     char            *szCmdpath;  /* path to command and arguments        */
     struct sigaction sigchld;    /* initial state of chld signal handler */
     struct sigaction sigpipe;    /* initial state of pipe signal handler */
@@ -78,7 +78,7 @@
 /* 
  * The lifecycle of the command executed by the pipe channel handler
  * depends on the runtime option selected during configuration. The
- * option 'reliable' describes subsequent behavior which rebuilds an
+ * option 'continuous' describes subsequent behavior which rebuilds an
  * (un)intentionally severed child-controlled pipe. In this case, when
  * the pipe handler encounters a failed write operation, it will attempt
  * the reconnection a user-defined number of times until failure is assumed.
@@ -178,9 +178,9 @@
     char *szRel  = NULL;
 
     /* feed and call generic parameter parsing engine */
-    L2_PARAM_SET(pa[0], execmode, CHARPTR, &szMode); /* mode direct or shell */
-    L2_PARAM_SET(pa[1], runtime,  CHARPTR, &szRel);  /* reliable or oneshot  */
-    L2_PARAM_SET(pa[2], path,     STRING,  &cfg->szCmdpath); /* path of cmd  */
+    L2_PARAM_SET(pa[0], execmode, CHARPTR, &szMode); /* mode direct or shell  */
+    L2_PARAM_SET(pa[1], runtime,  CHARPTR, &szRel);  /* continuous or oneshot */
+    L2_PARAM_SET(pa[2], path,     STRING,  &cfg->szCmdpath); /* path of cmd   */
     L2_PARAM_END(pa[3]);
     if ((rv = l2_util_setparams(pa, fmt, ap)) != L2_OK)
         return rv;
@@ -195,9 +195,9 @@
     }
 
     if (szRel != NULL) {
-        if (strcmp(szRel, "reliable") == 0)
-            cfg->iRtme = L2_PIPE_RUNTIME_RELIABLE;
-        else if (strcmp(szMode, "oneshot") == 0)
+        if (strncmp(szRel, "continuous", strlen("cont")) == 0)
+            cfg->iRtme = L2_PIPE_RUNTIME_CONTINU;
+        else if (strncmp(szMode, "oneshot", strlen("one")) == 0)
             cfg->iRtme = L2_PIPE_RUNTIME_ONESHOT;
         else
             return L2_ERR_ARG;


ossp-pkg/l2/l2_test.c 1.28 -> 1.29

--- l2_test.c    2001/09/28 14:28:41     1.28
+++ l2_test.c    2001/10/04 12:53:54     1.29
@@ -29,12 +29,6 @@
 
 #include <stdio.h>
 
-#include <sys/types.h>   /* following group of includes are for */
-#include <sys/socket.h>  /* socket testing only                 */
-#include <netinet/in.h>
-#include <netdb.h>       /* TODO: probably can be removed */
-#include <syslog.h>      /* TODO: probably can be removed */
-
 #include "l2.h"
 
 static void die(char *fmt, ...)
@@ -150,8 +144,11 @@
         die("failed to configure pipe channel");
 #endif
 
-    if (l2_channel_configure(chPipe, "mode,path", "shell", "$CRONOLOGDIR/cronolog -o $HOME/tmp/crono.log") != L2_OK)
-        die("failed to configure pipe channel");
+    if (l2_channel_configure(chPipe, "execmode,path", "shell", "$CRONOLOGDIR/cronolog -o $HOME/tmp/crono.log") != L2_OK)
+        die("failed to configure pipe channel due to mode and path parameters");
+
+    if (l2_channel_configure(chPipe, "runtime", "continuous") != L2_OK)
+        die("failed to configure pipe channel due to continuous parameter");
 
     if (l2_channel_open(chPipe) != L2_OK)
         die("failed to open pipe channel");
@@ -168,12 +165,12 @@
         die("failed to create socket channel");
 
     if (l2_channel_configure(chSock, "protocol,ipversion,host,port",\
-        IPPROTO_TCP, AF_INET, "localhost", 2002) != L2_OK)
-        die("failed to configure socket ipv4 channel");
+        "tcp", "ipv4", "localhost", 2002) != L2_OK)
+        die("failed to configure socket tcp/ipv4 channel");
 #if 0
     if (l2_channel_configure(chSock, "protocol,ipversion,host,port",\
-          IPPROTO_TCP, AF_INET6, "0:0:0:0:0:0:0:1", 2002) != L2_OK)
-          die("failed to configure socket ipv6 channel");
+          "tcp", "ipv6", "0:0:0:0:0:0:0:1", 2002) != L2_OK)
+          die("failed to configure socket tcp/ipv6 channel");
 #endif
     if (l2_channel_open(chSock) != L2_OK)
         die("failed to open socket channel");

CVSTrac 2.0.1