uniprc.h: \
subrou.h
+unitls.h: \
+ subafn.h
+
#--------------------------------------------------------------------
toremake: Makefile
/* definition. */
/* */
/********************************************************/
-PUBLIC SOCPTR **soc_mkbindinf(SOCPTR **socptr,PROTYP proto,
- const char *ip,const char *port,int iteration)
+PUBLIC SOCPTR **soc_mkbindinf(SOCPTR **socptr,LISTYP *bind)
{
SOCTYP *soc;
soc=newsocket();
-soc->proto=proto;
-soc->ip=strdup(ip);
-soc->port=strdup(port);
-soc->iteration=iteration;
+soc->proto=bind->proto;
+soc->ip=strdup(bind->afn->strnumip);
+soc->port=strdup(bind->port);
+soc->iteration=bind->iteration;
socptr=(SOCPTR **)rou_addlist((void **)socptr,(void *)soc);
return socptr;
}
*/
/********************************************************/
/* */
-/* Procedure to return the addrename or port */
+/* Procedure to return the address, name or port */
/* for local or remote socket. */
/* */
/********************************************************/
//procedure to assign memory to be used by a TCP socket
//definition
-extern SOCPTR **soc_mkbindinf(SOCPTR **s,PROTYP proto,
- const char *ip,const char *port,int iteration);
+extern SOCPTR **soc_mkbindinf(SOCPTR **s,LISTYP *bind);
//procedure to open one exchange socket
//to connect a remote smtp server
{
#define OPEP "modrec.c:prepbinding"
-LISTYP **l;
+LISTYP **bind;
*bindings=(SOCPTR **)0;
-if ((l=tls_get_bind_data())==(LISTYP **)0) {
+if ((bind=tls_get_bind_data())==(LISTYP **)0) {
(void) rou_alert(0,"%s SMTPPORTS data fully missing (config?, bug?)",OPEP);
(void) exit(-1);
}
-while (*l!=(LISTYP *)0) {
- *bindings=soc_mkbindinf(*bindings,(*l)->proto,(*l)->ipnum,(*l)->port,(*l)->iter);
- l++;
+while (*bind!=(LISTYP *)0) {
+ *bindings=soc_mkbindinf(*bindings,*bind);
+ bind++;
}
return rou_nbrlist(*bindings);
#undef OPEP
{
if (listen!=(LISTYP *)0) {
- listen->ipnum=rou_freestr(listen->ipnum);
+ listen->afn=afn_freeipnum(listen->afn);
listen->port=rou_freestr(listen->port);
(void) free(listen);
listen=(LISTYP *)0;
while (seq!=(char *)0) {
LISTYP *list;
PROTYP proto;
- char *ipnum;
+ AFNTYP *afn;
char *port;
- int iter;
+ int iteration;
char *ptr;
proto=pro_smtp;
- ipnum=DIP;
+ afn=(AFNTYP *)0;
port=DPORT;
- iter=2;
+ iteration=2;
if ((ptr=strchr(seq,','))!=(char *)0) {
*ptr='\000';
ptr++;
}
break;
case 1 :
- if (strlen(seq)>0)
- ipnum=seq;
+ if (strlen(seq)==0)
+ seq=DIP;
+ if ((afn=afn_getipnum(seq))==(AFNTYP *)0)
+ (void) rou_alert(0,"%s, Not valid IP <%s> config",OPEP,seq);
break;
case 2 :
if (strlen(seq)>0)
port=seq;
if (strlen(sofar)>0)
- iter=atoi(sofar);
+ iteration=atoi(sofar);
break;
}
seq=sofar;
}
- list=(LISTYP *)calloc(1,sizeof(LISTYP));
- list->proto=proto;
- list->ipnum=strdup(ipnum);;
- list->port=strdup(port);;
- list->iter=iter;
- binds=(LISTYP **)rou_addlist((void **)binds,(void *)list);
+ if (afn!=(AFNTYP *)0) {
+ list=(LISTYP *)calloc(1,sizeof(LISTYP));
+ list->proto=proto;
+ list->port=strdup(port);;
+ list->iteration=iteration;
+ list->afn=afn;
+ binds=(LISTYP **)rou_addlist((void **)binds,(void *)list);
+ }
seq=ptr;
}
break;
#include <stdbool.h>
#include <openssl/ssl.h>
+#include "subafn.h"
+
//defining email protocol value.
typedef enum {
pro_smtp, //text SMTP protocol, in clear mode
typedef struct { //structure about listening port
PROTYP proto; //Protocol to be used
- char *ipnum; //binding IP number
char *port; //binding port number
- int iter; //Number of binding iteration
+ int iteration; //Number of binding iteration
+ AFNTYP *afn; //Information about the IP
}LISTYP;
typedef struct {