/********************************************************/
#include <dirent.h>
#include <string.h>
+#include <uuid/uuid.h>
#include "subrou.h"
#include "unieml.h"
*/
/********************************************************/
/* */
+/* Procedure to duplicate TRATYP structure */
+/* */
+/********************************************************/
+PUBLIC TRATYP *eml_duptra(TRATYP *trans)
+
+{
+TRATYP *dup;
+
+dup=(TRATYP *)0;
+if (trans!=(TRATYP *)0) {
+ dup=(TRATYP *)calloc(1,sizeof(TRATYP));
+ dup->code=trans->code;
+ dup->date=trans->date;
+ dup->delay=trans->delay;
+ dup->rcptto=strdup(trans->rcptto);
+ dup->mailfrom=strdup(trans->mailfrom);
+ dup->sessid=strdup(trans->sessid);
+ }
+return dup;
+}
+/*
+\f
+*/
+/********************************************************/
+/* */
/* Procedure to scan the a qfile and build a */
/* list of email transport directive. */
/* */
{
#define OPEP "geseml.c:eml_todoqfile,"
-#define EXTOBE "tobedone"
REFTYP **domlist;
(void) free(domlist);
}
-#undef EXTOBE
#undef OPEP
}
/*
#define OPEP "geseml.c:eml_doneqfile,"
SIDTYP **sids;
+TRATYP **next;
sids=(SIDTYP **)0;
+next=(TRATYP **)0;
(void) rou_alert(0,"%s JMPDBG trying check",OPEP);
if (list!=(TRATYP **)0) {
TRATYP **ptr;
case 'C' : //completed
break;
default :
+ next=(TRATYP **)rou_addlist((void **)next,(void *)eml_duptra(*ptr));
found->count++;
break;
}
}
sids=eml_freesid(sids);
}
-
+if (next!=(TRATYP **)0) {
+ FILE *qfile;
+ uuid_t id;
+ char qname[150];
+ char struuid[40];
+ int phase;
+ _Bool proceed;
+
+ qfile=(FILE *)0;
+ (void) uuid_generate(id);
+ (void) uuid_unparse(id,struuid);
+ (void) snprintf(qname,sizeof(qname),"%s-%s-%04d",struuid,"redo",0);
+ phase=0;
+ proceed=true;
+ while (proceed==true) {
+ switch (phase) {
+ case 0 : //Opening qfile
+ if ((qfile=eml_createqfile(qname,EXTOBE))==(FILE *)0)
+ phase=999; //Trouble trouble
+ break;
+ case 1 : //dumping TRANS data to file
+ (void) eml_dumptra(qfile,next);
+ break;
+ case 2 : //Closing file
+ (void) eml_closeqfile(qfile);
+ break;
+ case 3 : //file ready, renaming file,
+ (void) eml_renameqfile(qname,EXTOBE,EXTRANS);
+ break;
+ default : //SAFE Guard
+ proceed=false;
+ break;
+ }
+ phase++;
+ }
+ next=(TRATYP **)rou_freelist((void **)next,(genfree_t)eml_freetra);
+ }
#undef OPEP
}
/*
#include <stdlib.h>
#include <stdio.h>
+#define EXTOBE "tobedone" //directive enxtension in progress
+
//structure to define an email transport directive
typedef struct {
char code; //Transaction code
//procedure to fee memory used by a TRATYP structure
extern TRATYP *eml_freetra(TRATYP *tra);
+//procedure to duplicate a TRATYP structure
+extern TRATYP *eml_duptra(TRATYP *tra);
+
//procedure to open a specific qfile
extern TRATYP **eml_scanqfile(TRATYP **list,FILE *qfile);
//procedure to Free one recipient info
extern RCPTYP *eml_freerecipient(RCPTYP *info);
-//get a session unique id
-extern char *eml_getmainsesid();
-
-//procedure to add recipient to a recipient list
-//adding an session ID to a list of session
-extern SIDTYP *eml_addsid(SIDTYP ***list,char *sessid);
-
-//procedure to Free one recipient info
-extern RCPTYP *eml_freerecipient(RCPTYP *info);
-
-//get a session unique id
-extern char *eml_getmainsesid();
-
//procedure to add recipient to a recipient list
extern _Bool eml_addrecipient(RCPTYP ***list,RCPTYP *rcpt);