]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Data is sent it remote server, remote accept data
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Wed, 7 May 2025 17:32:13 +0000 (13:32 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Wed, 7 May 2025 17:32:13 +0000 (13:32 -0400)
Makefile
app/feeder.c
data-tst/xxfeed.tst
lib/devsoc.c
lib/gestcp.c
lib/gestcp.h
lib/lvleml.c

index 6e234f2ff311c8824fc9989122ce8d36fef1435a..6dfbe0b90fe58716e2f13f330dc2ca687115a767 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -54,13 +54,14 @@ extfeed     :       debug
                        $(DATATST)/extfeed00.tst
 
 onefeed        :  debug
-          @ bin/feeder                                 \
+           bin/feeder                                  \
                        -f                              \
                        -d2                             \
                        -c ./conf/feeder.conf.dvl       \
                        $(TESTIP)                       \
                        $(TESTPORT)                     \
                        $(DATATST)/xxfeed.tst
+
 #                      # -i 127.63.31.15
 
 #direct test
index 75dda15bda8321f815d086d77a4ab53cae99b608..187d32a4338dc0a7dd240874978d8ddb085e7211 100644 (file)
@@ -164,7 +164,7 @@ while (proceed==true) {
         phase=999;      //Unable to send STARTTLS sequence 
       break;
     case 1      :       //Get STARTTLS command status
-      if (tcp_getline(fd->socptr,WRESP,&line)<=0)
+      if (tcp_getline(fd->socptr,WRESP,&line)<0)
         phase=999;      //Didn't get signon
       break;
     case 2      :       //did we received the Proper "proceed" acknoledge
@@ -181,9 +181,7 @@ while (proceed==true) {
     case 3      :       //
       while (fgets(data,sizeof(data),fd->datatst)!=(char *)0) {
         (void) eml_removecrlf(data);
-        (void) rou_alert(0,"JMPDBG got <%s>",data);
         (void) dooutgoing(fd->socptr,data);
-        (void) rou_alert(0,"JMPDBG sent <%s>",data);
         if ((empty==true)&&(strcmp(data,".")==0)) {
           phase++;      //Eveything is fine
           break;
@@ -634,6 +632,8 @@ while (proceed==true) {
     }
   phase++;
   }
+if (status==true)
+  (void) rou_alert(0,"Scanning file <%s> complted OK",filename);
 return status;
 }
 /********************************************************/
index c3e26f31c38709517e9fcadfdb716abe54a0075f..26ffce3d44e1c79d95a3b37cef60aa2a2faef83f 100644 (file)
@@ -21,6 +21,6 @@ SECOND Line
 LAST Line
 
 .
-R:250 Message accepted for delivery
+R:250 3.5.3 Message accepted for delivery
 S:QUIT
 R:221 2.0.0 Bye, closing connection...
index 96a9a2b8626a48bb31bef5094c0fb847c88030eb..fe5b1128fef8172f5555cb0fcbb278bd74124039 100644 (file)
@@ -331,6 +331,69 @@ while (proceed==true) {
 */
 /********************************************************/
 /*                                                      */
+/*     Procedure to extract next line from the socket  */
+/*      incoming pile.                                  */
+/*      Return the number of character, zero if the     */
+/*      line is empty, -1 if now char available.        */
+/*                                                      */
+/********************************************************/
+static int doextract(SOCTYP *soc,char **lineptr)
+
+{
+#define OPEP    "devsoc.c:doextract,"
+
+int got;
+char *eol;
+int phase;
+_Bool proceed;
+
+*lineptr=(char *)0;
+got=-1;
+eol=(char *)0;
+phase=0;
+proceed=true;
+while (proceed==true) {
+  //(void) rou_alert(0,"JMPDBG %s phase='%d'",OPEP,phase);
+  switch (phase) {
+    case 0      :       //Do we have dat in carpile
+      if (soc->carin==0)
+        phase=999;      //No char,no need to check for line
+      break;
+    case 1      :       //Do we have a CRLF
+      eol=strstr(soc->carpile,soc->EOL);
+      if (eol==(char *)0) 
+        phase=999;      //No End Of Line yet
+      break;
+    case 2      :       //duplicating carpile
+      *lineptr=calloc(soc->carin+1,sizeof(char));
+      *eol='\000';
+      (void) strcpy(*lineptr,soc->carpile);
+      got=strlen(*lineptr);
+      break;
+    case 3      :       //managing carpile
+      soc->carin-=(got+strlen(soc->EOL));
+      if (soc->carin>0) {
+        int delta;
+
+        delta=got+strlen(soc->EOL);
+        (void) memmove(soc->carpile,soc->carpile+delta,soc->carin);
+        }
+      soc->carpile[soc->carin]='\000';
+      break;
+    default     :       //SAFE guard
+      proceed=false;
+      break;
+    }
+  phase++;
+  }
+return got;
+#undef  OPEP
+}
+/*
+\f
+*/
+/********************************************************/
+/*                                                      */
 /*     Procedure to wait and get a new handle          */
 /*                                                      */
 /********************************************************/
@@ -962,6 +1025,9 @@ return status;
 /*                                                     */
 /*      Procedure to return the next available line     */
 /*      within the socket carpile.                      */
+/*      return the number of char within line           */
+/*      Return  0 if line is 'empty'                    */
+/*      Return -1 if no characater available            */
 /*                                                     */
 /********************************************************/
 PUBLIC int soc_getnextline(SOCPTR *socptr,char **lineptr)
@@ -971,48 +1037,31 @@ PUBLIC int soc_getnextline(SOCPTR *socptr,char **lineptr)
 
 int got;
 register SOCTYP *soc;
-char *eol;
 int phase;
 _Bool proceed;
 
 *lineptr=(char *)0;
-got=0;
-eol=(char *)0;
+got=-1;
 soc=(SOCTYP *)socptr;
 phase=0;
 proceed=true;
 while (proceed==true) {
+  //(void) rou_alert(0,"JMPDBG %s phase='%d'",OPEP,phase);
   switch (phase) {
     case 0      :       //Do we have dat in carpile
       if (soc==(SOCTYP *)0) {
         (void) rou_alert(0,"%s, socket binding reference is NULL (Bug!?)",OPEP);
         phase=999;      //no need to go further
         }
-    case 1      :       //Do we have char available in carpile
-      (void) soc_receive(socptr);
-      if (soc->carin==0)
-        phase=999;      //No char,no need to check for line
-      break;
-    case 2      :       //Do we have a CRLF
-      eol=strstr(soc->carpile,soc->EOL);
-      if (eol==(char *)0) 
-        phase=999;      //No End Of Line yet
       break;
-    case 3      :       //duplicating carpile
-      *lineptr=calloc(soc->carin+1,sizeof(char));
-      *eol='\000';
-      (void) strcpy(*lineptr,soc->carpile);
-      got=strlen(*lineptr);
+    case 1      :       //Do we have char available in carpile
+      got=doextract(soc,lineptr);
+      if (got>=0)       //we have line
+        phase=999;      //no need to go further
       break;
-    case 4      :       //managing carpile
-      soc->carin-=(got+strlen(soc->EOL));
-      if (soc->carin>0) {
-        int delta;
-
-        delta=got+strlen(soc->EOL);
-        (void) memmove(soc->carpile,soc->carpile+delta,soc->carin);
-        }
-      soc->carpile[soc->carin]='\000';
+    case 2      :       //lets wait for char
+      if (soc_receive(socptr)>0)        //we have char
+        phase=0;        //Let try to read line
       break;
     default     :       //SAFE guard
       proceed=false;
index 5531085b26b76fcfcd027bb79a29c3df0b45c719..6aa72f3dc6ca0b4fe6499055505c1ba776dbf275 100644 (file)
@@ -56,7 +56,7 @@ while (proceed==true) {
         }
       break;
     case 1      :       //get nextline if ready
-      if ((got=soc_getnextline(socptr,lineptr))>0)
+      if ((got=soc_getnextline(socptr,lineptr))>=0)
         phase=999;      //we got a line.
       break;
     case 2      :       //lets wait secwait*1000 millisec for input 
index b0df0572d4154f7e53ec05cef477b44e2126d1ab..6962c50dc466194057c1f07d48d96ec769f08763 100644 (file)
@@ -13,7 +13,7 @@
 #include        "devlog.h"
 #include        "devsoc.h"
 
-#define         WAITLINE        10      //full line waiting time
+#define         WAITLINE        30      //full line waiting time
 
 //read a line from contact up to CRLF
 extern int tcp_getline(SOCPTR *socptr,u_int secwait,char **lineptr);
index 4003f4c5f0883e9beadf5266b57ba51ee1b2c9b6..3417d6abff20d6ba846c5ac02365e5dd01475609 100644 (file)
@@ -192,7 +192,7 @@ got=0;
 phase=0;
 proceed=true;
 while (proceed==true) {
-  (void) rou_alert(0,"JMPDBG %s phase='%d' empty='%d'",OPEP,phase,empty);
+  //(void) rou_alert(0,"JMPDBG %s phase='%d' empty='%d'",OPEP,phase,empty);
   switch (phase) {
     case 0      :       //Do we have a parameter
       (void) transmit(contact,"%d 3.5.0 %s",
@@ -204,7 +204,6 @@ while (proceed==true) {
         }
       break;
     case 2      :       //just display line
-      (void) rou_alert(0,"%s, data=<%s>",OPEP,line);
       if ((empty==false)||(strcmp(line,".")!=0))
         phase=0;        //Wait for next line
       empty=false;
@@ -213,9 +212,9 @@ while (proceed==true) {
       line=rou_freestr(line);
       break;
     case 3      :       //got all data
-      (void) rou_alert(0,"JMPDBG transmit OK");
       (void) transmit(contact,"%d 3.5.3 %s",
                               CMDOK,"Message accepted for delivery");
+      done=true;
       break;
     default     :       //SAFE guard
       proceed=false;