Updates for outbound scanning
This commit is contained in:
parent
14ad175e93
commit
ddd8a8353b
@ -84,7 +84,7 @@ taskcomm.o: libs.h ../lib/structs.h taskstat.h taskregs.h taskdisk.h taskinfo.h
|
|||||||
taskinfo.o: libs.h ../lib/structs.h taskinfo.h
|
taskinfo.o: libs.h ../lib/structs.h taskinfo.h
|
||||||
taskstat.o: libs.h ../lib/structs.h taskstat.h callstat.h outstat.h taskutil.h
|
taskstat.o: libs.h ../lib/structs.h taskstat.h callstat.h outstat.h taskutil.h
|
||||||
mbtask.o: libs.h ../lib/structs.h signame.h taskstat.h taskutil.h taskregs.h taskcomm.h callstat.h outstat.h nodelist.h ports.h calllist.h ping.h mbtask.h
|
mbtask.o: libs.h ../lib/structs.h signame.h taskstat.h taskutil.h taskregs.h taskcomm.h callstat.h outstat.h nodelist.h ports.h calllist.h ping.h mbtask.h
|
||||||
outstat.o: libs.h ../lib/structs.h taskutil.h taskstat.h scanout.h nodelist.h callstat.h ports.h outstat.h
|
outstat.o: libs.h ../lib/structs.h taskutil.h taskstat.h scanout.h nodelist.h callstat.h outstat.h
|
||||||
signame.o: signame.h
|
signame.o: signame.h
|
||||||
taskdisk.o: libs.h ../lib/structs.h taskdisk.h taskutil.h
|
taskdisk.o: libs.h ../lib/structs.h taskdisk.h taskutil.h
|
||||||
taskregs.o: libs.h ../lib/structs.h taskstat.h taskregs.h taskutil.h
|
taskregs.o: libs.h ../lib/structs.h taskstat.h taskregs.h taskutil.h
|
||||||
|
@ -35,7 +35,6 @@
|
|||||||
#include "callstat.h"
|
#include "callstat.h"
|
||||||
#include "outstat.h"
|
#include "outstat.h"
|
||||||
#include "mbtask.h"
|
#include "mbtask.h"
|
||||||
#include "ports.h"
|
|
||||||
#include "calllist.h"
|
#include "calllist.h"
|
||||||
|
|
||||||
|
|
||||||
@ -46,12 +45,11 @@
|
|||||||
tocall calllist[MAXTASKS]; /* Array with calllist */
|
tocall calllist[MAXTASKS]; /* Array with calllist */
|
||||||
extern int internet; /* Internet is down */
|
extern int internet; /* Internet is down */
|
||||||
extern int s_scanout; /* Scan outbound sema */
|
extern int s_scanout; /* Scan outbound sema */
|
||||||
extern int s_do_inet; /* Internet wanted */
|
|
||||||
extern _alist_l *alist; /* Nodes to call list */
|
extern _alist_l *alist; /* Nodes to call list */
|
||||||
extern int pots_calls;
|
extern int pots_calls;
|
||||||
extern int isdn_calls;
|
extern int isdn_calls;
|
||||||
extern int inet_calls;
|
extern int inet_calls;
|
||||||
|
extern struct taskrec TCFG;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -83,13 +81,17 @@ int check_calllist(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
check_ports();
|
|
||||||
|
|
||||||
if (pots_calls || isdn_calls || inet_calls) {
|
if (pots_calls || isdn_calls || inet_calls) {
|
||||||
call_work = 0;
|
call_work = 0;
|
||||||
for (tmp = alist; tmp; tmp = tmp->next) {
|
for (tmp = alist; tmp; tmp = tmp->next) {
|
||||||
if (tmp->callmode != CM_NONE) {
|
if (((tmp->callmode == CM_INET) && TCFG.max_tcp) ||
|
||||||
|
((tmp->callmode == CM_ISDN) && TCFG.max_isdn) ||
|
||||||
|
((tmp->callmode == CM_POTS) && TCFG.max_pots)) {
|
||||||
call_work++;
|
call_work++;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check if node is already in the list of systems to call.
|
||||||
|
*/
|
||||||
found = FALSE;
|
found = FALSE;
|
||||||
for (i = 0; i < MAXTASKS; i++) {
|
for (i = 0; i < MAXTASKS; i++) {
|
||||||
if ((calllist[i].addr.zone == tmp->addr.zone) && (calllist[i].addr.net == tmp->addr.net) &&
|
if ((calllist[i].addr.zone == tmp->addr.zone) && (calllist[i].addr.net == tmp->addr.net) &&
|
||||||
@ -101,6 +103,10 @@ int check_calllist(void)
|
|||||||
calllist[i].cst = tmp->cst;
|
calllist[i].cst = tmp->cst;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Node not in the calllist, add node.
|
||||||
|
*/
|
||||||
if (!found) {
|
if (!found) {
|
||||||
for (i = 0; i < MAXTASKS; i++) {
|
for (i = 0; i < MAXTASKS; i++) {
|
||||||
if (!calllist[i].addr.zone) {
|
if (!calllist[i].addr.zone) {
|
||||||
@ -123,17 +129,6 @@ int check_calllist(void)
|
|||||||
sem_set((char *)"scanout", FALSE);
|
sem_set((char *)"scanout", FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Check if we need to remove the do_inet semafore
|
|
||||||
*/
|
|
||||||
if (!inet_calls && internet && s_do_inet) {
|
|
||||||
tasklog('c', "Removing do_inet semafore");
|
|
||||||
s_do_inet = FALSE;
|
|
||||||
if (IsSema((char *)"do_inet")) {
|
|
||||||
RemoveSema((char *)"do_inet");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
call_work = 0;
|
call_work = 0;
|
||||||
for (i = 0; i < MAXTASKS; i++) {
|
for (i = 0; i < MAXTASKS; i++) {
|
||||||
if (calllist[i].addr.zone) {
|
if (calllist[i].addr.zone) {
|
||||||
|
@ -85,7 +85,6 @@ extern int s_index; /* Compile nl semafore */
|
|||||||
extern int s_newnews; /* New news semafore */
|
extern int s_newnews; /* New news semafore */
|
||||||
extern int s_reqindex; /* Create req index sem */
|
extern int s_reqindex; /* Create req index sem */
|
||||||
extern int s_msglink; /* Messages link sem */
|
extern int s_msglink; /* Messages link sem */
|
||||||
extern int s_do_inet; /* Internet wanted */
|
|
||||||
extern int pingresult[2]; /* Ping results */
|
extern int pingresult[2]; /* Ping results */
|
||||||
int masterinit = FALSE; /* Master init needed */
|
int masterinit = FALSE; /* Master init needed */
|
||||||
int ptimer = PAUSETIME; /* Pause timer */
|
int ptimer = PAUSETIME; /* Pause timer */
|
||||||
@ -943,6 +942,7 @@ void scheduler(void)
|
|||||||
*/
|
*/
|
||||||
reg_check();
|
reg_check();
|
||||||
check_sema();
|
check_sema();
|
||||||
|
check_ports();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check the systems load average.
|
* Check the systems load average.
|
||||||
|
498
mbtask/outstat.c
498
mbtask/outstat.c
@ -35,7 +35,6 @@
|
|||||||
#include "scanout.h"
|
#include "scanout.h"
|
||||||
#include "nodelist.h"
|
#include "nodelist.h"
|
||||||
#include "callstat.h"
|
#include "callstat.h"
|
||||||
#include "ports.h"
|
|
||||||
#include "outstat.h"
|
#include "outstat.h"
|
||||||
|
|
||||||
|
|
||||||
@ -47,7 +46,6 @@ int nxt_hour, nxt_min; /* Time of next event */
|
|||||||
int inet_calls; /* Internet calls to make */
|
int inet_calls; /* Internet calls to make */
|
||||||
int isdn_calls; /* ISDN calls to make */
|
int isdn_calls; /* ISDN calls to make */
|
||||||
int pots_calls; /* POTS calls to make */
|
int pots_calls; /* POTS calls to make */
|
||||||
extern pp_list *pl; /* Portlist */
|
|
||||||
_alist_l *alist = NULL; /* Nodes to call list */
|
_alist_l *alist = NULL; /* Nodes to call list */
|
||||||
extern int s_do_inet; /* Internet wanted */
|
extern int s_do_inet; /* Internet wanted */
|
||||||
|
|
||||||
@ -172,276 +170,282 @@ char *callmode(int mode)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Scan outbound, the call status is set in three counters: internet,
|
||||||
|
* ISDN and POTS (analogue modems).
|
||||||
|
* For all systems the CM and Txx flags are checked and for official
|
||||||
|
* FidoNet nodes the Zone Mail Hour wich belongs to the destination
|
||||||
|
* zone.
|
||||||
|
* All nodes are qualified, if there is a way to call them or not on
|
||||||
|
* this moment.
|
||||||
|
* The method how to call a node is decided as well.
|
||||||
|
*/
|
||||||
int outstat()
|
int outstat()
|
||||||
{
|
{
|
||||||
int rc, first = TRUE, T_window, iszmh = FALSE;
|
int rc, first = TRUE, T_window, iszmh = FALSE;
|
||||||
struct _alist *tmp, *old;
|
struct _alist *tmp, *old;
|
||||||
char flstr[13];
|
char flstr[13];
|
||||||
char temp[81];
|
char temp[81];
|
||||||
char as[6], be[6], utc[6];
|
char as[6], be[6], utc[6];
|
||||||
time_t now;
|
time_t now;
|
||||||
struct tm *tm;
|
struct tm *tm;
|
||||||
int uhour, umin, thour, tmin;
|
int uhour, umin, thour, tmin;
|
||||||
pp_list *tpl;
|
|
||||||
|
|
||||||
now = time(NULL);
|
now = time(NULL);
|
||||||
tm = gmtime(&now); /* UTC time */
|
tm = gmtime(&now); /* UTC time */
|
||||||
uhour = tm->tm_hour;
|
uhour = tm->tm_hour;
|
||||||
umin = tm->tm_min;
|
umin = tm->tm_min;
|
||||||
sprintf(utc, "%02d:%02d", uhour, umin);
|
sprintf(utc, "%02d:%02d", uhour, umin);
|
||||||
tasklog('+', "Scanning outbound at %s UTC.", utc);
|
tasklog('+', "Scanning outbound at %s UTC.", utc);
|
||||||
nxt_hour = 24;
|
nxt_hour = 24;
|
||||||
nxt_min = 0;
|
nxt_min = 0;
|
||||||
inet_calls = isdn_calls = pots_calls = 0;
|
inet_calls = isdn_calls = pots_calls = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Clear current table
|
* Clear current table
|
||||||
*/
|
*/
|
||||||
for (tmp = alist; tmp; tmp = old) {
|
for (tmp = alist; tmp; tmp = old) {
|
||||||
old = tmp->next;
|
old = tmp->next;
|
||||||
free(tmp);
|
free(tmp);
|
||||||
}
|
}
|
||||||
alist = NULL;
|
alist = NULL;
|
||||||
|
|
||||||
if ((rc = scanout(each))) {
|
if ((rc = scanout(each))) {
|
||||||
tasklog('?', "Error scanning outbound, aborting");
|
tasklog('?', "Error scanning outbound, aborting");
|
||||||
return rc;
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* During processing the outbound list, determine when the next event will occur,
|
||||||
|
* ie. the time when the callout status of a node changes because of starting a
|
||||||
|
* ZMH, or changeing the time window for Txx flags.
|
||||||
|
*/
|
||||||
|
for (tmp = alist; tmp; tmp = tmp->next) {
|
||||||
|
if (first) {
|
||||||
|
tasklog('+', "Flavor Out Size Online Modem ISDN TCP/IP Calls Status Mode Address");
|
||||||
|
first = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rc = load_node(tmp->addr);
|
||||||
|
tasklog('o', "Load node %s rc=%s, NoCall=%s, NoTCP=%s", ascfnode(tmp->addr, 0x0f), rc?"true":"false",
|
||||||
|
nodes.NoCall?"True":"False", nodes.NoTCP?"True":"False");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* During processing the outbound list, determine when the next event will occur,
|
* Zone Mail Hours, only use Fidonet Hours.
|
||||||
* ie. the time when the callout status of a node changes because of starting a
|
* Other nets use your default ZMH.
|
||||||
* ZMH, or changeing the time window for Txx flags.
|
|
||||||
*/
|
*/
|
||||||
for (tmp = alist; tmp; tmp = tmp->next) {
|
T_window = iszmh = FALSE;
|
||||||
if (first) {
|
switch (tmp->addr.zone) {
|
||||||
tasklog('+', "Flavor Out Size Online Modem ISDN TCP/IP Calls Status Mode Address");
|
case 1: if (uhour == 9)
|
||||||
first = FALSE;
|
iszmh = TRUE;
|
||||||
}
|
set_next(9, 0);
|
||||||
|
set_next(10, 0);
|
||||||
rc = load_node(tmp->addr);
|
break;
|
||||||
tasklog('o', "Load node %s rc=%s, NoCall=%s, NoTCP=%s", ascfnode(tmp->addr, 0x0f), rc?"true":"false",
|
case 2: if (((uhour == 2) && (umin >= 30)) || ((uhour == 3) && (umin < 30)))
|
||||||
nodes.NoCall?"True":"False", nodes.NoTCP?"True":"False");
|
iszmh = TRUE;
|
||||||
|
set_next(2, 30);
|
||||||
|
set_next(3, 30);
|
||||||
|
break;
|
||||||
|
case 3: if (uhour == 18)
|
||||||
|
iszmh = TRUE;
|
||||||
|
set_next(18, 0);
|
||||||
|
set_next(19, 0);
|
||||||
|
break;
|
||||||
|
case 4: if (uhour == 8)
|
||||||
|
iszmh = TRUE;
|
||||||
|
set_next(8, 0);
|
||||||
|
set_next(9, 0);
|
||||||
|
break;
|
||||||
|
case 5: if (uhour == 1)
|
||||||
|
iszmh = TRUE;
|
||||||
|
set_next(1, 0);
|
||||||
|
set_next(2, 0);
|
||||||
|
break;
|
||||||
|
case 6: if (uhour == 20)
|
||||||
|
iszmh = TRUE;
|
||||||
|
set_next(20, 0);
|
||||||
|
set_next(21, 0);
|
||||||
|
break;
|
||||||
|
default: if (get_zmh())
|
||||||
|
iszmh = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tmp->t1 && tmp->t2) {
|
||||||
|
/*
|
||||||
|
* Txx flags, check callwindow
|
||||||
|
*/
|
||||||
|
thour = toupper(tmp->t1) - 'A';
|
||||||
|
if (isupper(tmp->t1))
|
||||||
|
tmin = 0;
|
||||||
|
else
|
||||||
|
tmin = 30;
|
||||||
|
sprintf(as, "%02d:%02d", thour, tmin);
|
||||||
|
set_next(thour, tmin);
|
||||||
|
thour = toupper(tmp->t2) - 'A';
|
||||||
|
if (isupper(tmp->t2))
|
||||||
|
tmin = 0;
|
||||||
|
else
|
||||||
|
tmin = 30;
|
||||||
|
sprintf(be, "%02d:%02d", thour, tmin);
|
||||||
|
set_next(thour, tmin);
|
||||||
|
if (strcmp(as, be) > 0) {
|
||||||
/*
|
/*
|
||||||
* Zone Mail Hours, only use Fidonet Hours.
|
* Time window is passing midnight
|
||||||
* Other nets use your default ZMH.
|
|
||||||
*/
|
*/
|
||||||
T_window = iszmh = FALSE;
|
if ((strcmp(utc, as) >= 0) || (strcmp(utc, be) < 0))
|
||||||
switch (tmp->addr.zone) {
|
T_window = TRUE;
|
||||||
case 1: if (uhour == 9)
|
} else {
|
||||||
iszmh = TRUE;
|
|
||||||
set_next(9, 0);
|
|
||||||
set_next(10, 0);
|
|
||||||
break;
|
|
||||||
case 2: if (((uhour == 2) && (umin >= 30)) || ((uhour == 3) && (umin < 30)))
|
|
||||||
iszmh = TRUE;
|
|
||||||
set_next(2, 30);
|
|
||||||
set_next(3, 30);
|
|
||||||
break;
|
|
||||||
case 3: if (uhour == 18)
|
|
||||||
iszmh = TRUE;
|
|
||||||
set_next(18, 0);
|
|
||||||
set_next(19, 0);
|
|
||||||
break;
|
|
||||||
case 4: if (uhour == 8)
|
|
||||||
iszmh = TRUE;
|
|
||||||
set_next(8, 0);
|
|
||||||
set_next(9, 0);
|
|
||||||
break;
|
|
||||||
case 5: if (uhour == 1)
|
|
||||||
iszmh = TRUE;
|
|
||||||
set_next(1, 0);
|
|
||||||
set_next(2, 0);
|
|
||||||
break;
|
|
||||||
case 6: if (uhour == 20)
|
|
||||||
iszmh = TRUE;
|
|
||||||
set_next(20, 0);
|
|
||||||
set_next(21, 0);
|
|
||||||
break;
|
|
||||||
default: if (get_zmh())
|
|
||||||
iszmh = TRUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tmp->t1 && tmp->t2) {
|
|
||||||
/*
|
|
||||||
* Txx flags, check callwindow
|
|
||||||
*/
|
|
||||||
thour = toupper(tmp->t1) - 'A';
|
|
||||||
if (isupper(tmp->t1))
|
|
||||||
tmin = 0;
|
|
||||||
else
|
|
||||||
tmin = 30;
|
|
||||||
sprintf(as, "%02d:%02d", thour, tmin);
|
|
||||||
set_next(thour, tmin);
|
|
||||||
thour = toupper(tmp->t2) - 'A';
|
|
||||||
if (isupper(tmp->t2))
|
|
||||||
tmin = 0;
|
|
||||||
else
|
|
||||||
tmin = 30;
|
|
||||||
sprintf(be, "%02d:%02d", thour, tmin);
|
|
||||||
set_next(thour, tmin);
|
|
||||||
if (strcmp(as, be) > 0) {
|
|
||||||
/*
|
|
||||||
* Time window is passing midnight
|
|
||||||
*/
|
|
||||||
if ((strcmp(utc, as) >= 0) || (strcmp(utc, be) < 0))
|
|
||||||
T_window = TRUE;
|
|
||||||
} else {
|
|
||||||
/*
|
|
||||||
* Time window is not passing midnight
|
|
||||||
*/
|
|
||||||
if ((strcmp(utc, as) >= 0) && (strcmp(utc, be) < 0))
|
|
||||||
T_window = TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
tasklog('o', "T_window=%s, iszmh=%s", T_window?"true":"false", iszmh?"true":"false");
|
|
||||||
strcpy(flstr,"...... ... ..");
|
|
||||||
/*
|
/*
|
||||||
* If the node has internet and we have internet available, check if we can send
|
* Time window is not passing midnight
|
||||||
* immediatly.
|
|
||||||
*/
|
*/
|
||||||
if (TCFG.max_tcp &&
|
if ((strcmp(utc, as) >= 0) && (strcmp(utc, be) < 0))
|
||||||
(((tmp->flavors) & F_IMM) || ((tmp->flavors) & F_CRASH) || ((tmp->flavors) & F_NORMAL)) &&
|
T_window = TRUE;
|
||||||
((tmp->ipflags & IP_IBN) || (tmp->ipflags & IP_IFC) || (tmp->ipflags & IP_ITN))) {
|
}
|
||||||
/*
|
}
|
||||||
* If connection available, set callflag
|
tasklog('o', "T_window=%s, iszmh=%s", T_window?"true":"false", iszmh?"true":"false");
|
||||||
*/
|
strcpy(flstr,"...... ... ..");
|
||||||
if (internet)
|
|
||||||
tmp->flavors |= F_CALL;
|
|
||||||
}
|
|
||||||
if ((tmp->flavors) & F_IMM ) {
|
|
||||||
flstr[0]='I';
|
|
||||||
/*
|
|
||||||
* Immediate mail, send if node is CM or is in a Txx window or is in ZMH.
|
|
||||||
*/
|
|
||||||
if ((tmp->olflags & OL_CM) || T_window || iszmh) {
|
|
||||||
tmp->flavors |= F_CALL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((tmp->flavors) & F_CRASH ) {
|
|
||||||
flstr[1]='C';
|
|
||||||
/*
|
|
||||||
* Crash mail, send if node is CM or is in a Txx window or is in ZMH.
|
|
||||||
*/
|
|
||||||
if ((tmp->olflags & OL_CM) || T_window || iszmh) {
|
|
||||||
tmp->flavors |= F_CALL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((tmp->flavors) & F_NORMAL)
|
|
||||||
flstr[2]='N';
|
|
||||||
if ((tmp->flavors) & F_HOLD )
|
|
||||||
flstr[3]='H';
|
|
||||||
if ((tmp->flavors) & F_FREQ )
|
|
||||||
flstr[4]='R';
|
|
||||||
if ((tmp->flavors) & F_POLL ) {
|
|
||||||
flstr[5]='P';
|
|
||||||
tmp->flavors |= F_CALL;
|
|
||||||
}
|
|
||||||
if ((tmp->flavors) & F_ISPKT ) {
|
|
||||||
flstr[7]='M';
|
|
||||||
/*
|
|
||||||
* Normal mail, send during ZMH or if node has a Txx window.
|
|
||||||
*/
|
|
||||||
if (iszmh || T_window) {
|
|
||||||
tmp->flavors |= F_CALL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((tmp->flavors) & F_ISFLO )
|
|
||||||
flstr[8]='F';
|
|
||||||
if (tmp->cst.tryno >= 30) {
|
|
||||||
/*
|
|
||||||
* Node is undialable, clear callflag
|
|
||||||
*/
|
|
||||||
tmp->flavors &= ~F_CALL;
|
|
||||||
}
|
|
||||||
if ((tmp->flavors) & F_CALL)
|
|
||||||
flstr[9]='C';
|
|
||||||
if (tmp->t1)
|
|
||||||
flstr[11] = tmp->t1;
|
|
||||||
if (tmp->t2)
|
|
||||||
flstr[12] = tmp->t2;
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If the node has internet and we have internet configured,
|
||||||
|
* check if we can send immediatly.
|
||||||
|
*/
|
||||||
|
if (TCFG.max_tcp && (tmp->olflags & OL_CM) &&
|
||||||
|
(((tmp->flavors) & F_IMM) || ((tmp->flavors) & F_CRASH) || ((tmp->flavors) & F_NORMAL)) &&
|
||||||
|
((tmp->ipflags & IP_IBN) || (tmp->ipflags & IP_IFC) || (tmp->ipflags & IP_ITN))) {
|
||||||
|
tmp->flavors |= F_CALL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((tmp->flavors) & F_IMM) {
|
||||||
|
flstr[0]='I';
|
||||||
|
/*
|
||||||
|
* Immediate mail, send if node is CM or is in a Txx window or is in ZMH.
|
||||||
|
*/
|
||||||
|
if ((tmp->olflags & OL_CM) || T_window || iszmh) {
|
||||||
|
tmp->flavors |= F_CALL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((tmp->flavors) & F_CRASH ) {
|
||||||
|
flstr[1]='C';
|
||||||
|
/*
|
||||||
|
* Crash mail, send if node is CM or is in a Txx window or is in ZMH.
|
||||||
|
*/
|
||||||
|
if ((tmp->olflags & OL_CM) || T_window || iszmh) {
|
||||||
|
tmp->flavors |= F_CALL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((tmp->flavors) & F_NORMAL)
|
||||||
|
flstr[2]='N';
|
||||||
|
if ((tmp->flavors) & F_HOLD )
|
||||||
|
flstr[3]='H';
|
||||||
|
if ((tmp->flavors) & F_FREQ )
|
||||||
|
flstr[4]='R';
|
||||||
|
if ((tmp->flavors) & F_POLL ) {
|
||||||
|
flstr[5]='P';
|
||||||
|
tmp->flavors |= F_CALL;
|
||||||
|
}
|
||||||
|
if ((tmp->flavors) & F_ISPKT ) {
|
||||||
|
flstr[7]='M';
|
||||||
|
/*
|
||||||
|
* Normal mail, send during ZMH or if node has a Txx window.
|
||||||
|
*/
|
||||||
|
if (iszmh || T_window) {
|
||||||
|
tmp->flavors |= F_CALL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((tmp->flavors) & F_ISFLO )
|
||||||
|
flstr[8]='F';
|
||||||
|
|
||||||
|
if (tmp->cst.tryno >= 30) {
|
||||||
|
/*
|
||||||
|
* Node is undialable, clear callflag
|
||||||
|
*/
|
||||||
|
tmp->flavors &= ~F_CALL;
|
||||||
|
}
|
||||||
|
if ((tmp->flavors) & F_CALL)
|
||||||
|
flstr[9]='C';
|
||||||
|
if (tmp->t1)
|
||||||
|
flstr[11] = tmp->t1;
|
||||||
|
if (tmp->t2)
|
||||||
|
flstr[12] = tmp->t2;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If forbidden to call from setup, clear callflag.
|
||||||
|
*/
|
||||||
|
if (nodes.NoCall)
|
||||||
|
tmp->flavors &= ~F_CALL;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If we must call this node, figure out how to call this node.
|
||||||
|
*/
|
||||||
|
if ((tmp->flavors) & F_CALL) {
|
||||||
|
tmp->callmode = CM_NONE;
|
||||||
|
|
||||||
|
if (TCFG.max_tcp && !nodes.NoTCP &&
|
||||||
|
((tmp->ipflags & IP_IBN) || (tmp->ipflags & IP_IFC) || (tmp->ipflags & IP_ITN))) {
|
||||||
|
inet_calls++;
|
||||||
|
tmp->callmode = CM_INET;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((tmp->callmode == CM_NONE) && TCFG.max_isdn) {
|
||||||
/*
|
/*
|
||||||
* If forbidden to call from setup, clear callflag.
|
* ISDN node
|
||||||
*/
|
*/
|
||||||
if (nodes.NoCall)
|
isdn_calls++;
|
||||||
tmp->flavors &= ~F_CALL;
|
tmp->callmode = CM_ISDN;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((tmp->callmode == CM_NONE) && TCFG.max_pots) {
|
||||||
/*
|
/*
|
||||||
* If we must call this node, figure out how to call this node.
|
* POTS node
|
||||||
*/
|
*/
|
||||||
if ((tmp->flavors) & F_CALL) {
|
pots_calls++;
|
||||||
/*
|
tmp->callmode = CM_POTS;
|
||||||
* Get options for this node
|
break;
|
||||||
*/
|
}
|
||||||
|
|
||||||
|
|
||||||
tmp->callmode = CM_NONE;
|
|
||||||
if (internet && TCFG.max_tcp && !nodes.NoTCP &&
|
|
||||||
((tmp->ipflags & IP_IBN) || (tmp->ipflags & IP_IFC) || (tmp->ipflags & IP_ITN))) {
|
|
||||||
inet_calls++;
|
|
||||||
tmp->callmode = CM_INET;
|
|
||||||
}
|
|
||||||
if (!TCFG.ipblocks || (TCFG.ipblocks && !internet)) {
|
|
||||||
/*
|
|
||||||
* If TCP/IP blocks other trafic, (you only have one dialup line),
|
|
||||||
* then don't add normal dial trafic. If not blocking, add lines.
|
|
||||||
*/
|
|
||||||
if ((tmp->callmode == CM_NONE) && TCFG.max_isdn) {
|
|
||||||
/*
|
|
||||||
* ISDN node, check available dialout ports
|
|
||||||
*/
|
|
||||||
for (tpl = pl; tpl; tpl = tpl->next) {
|
|
||||||
if (tpl->dflags & tmp->diflags) {
|
|
||||||
isdn_calls++;
|
|
||||||
tmp->callmode = CM_ISDN;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((tmp->callmode == CM_NONE) && TCFG.max_pots) {
|
|
||||||
/*
|
|
||||||
* POTS node, check available modems
|
|
||||||
*/
|
|
||||||
for (tpl = pl; tpl; tpl = tpl->next) {
|
|
||||||
if (tpl->mflags & tmp->moflags) {
|
|
||||||
pots_calls++;
|
|
||||||
tmp->callmode = CM_POTS;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sprintf(temp, "%s %8s %08x %08x %08x %08x %5d %s %s %s", flstr, size_str(tmp->size),
|
|
||||||
(unsigned int)tmp->olflags, (unsigned int)tmp->moflags,
|
|
||||||
(unsigned int)tmp->diflags, (unsigned int)tmp->ipflags,
|
|
||||||
tmp->cst.tryno, callstatus(tmp->cst.trystat), callmode(tmp->callmode), ascfnode(tmp->addr, 0x0f));
|
|
||||||
tasklog('+', "%s", temp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nxt_hour == 24) {
|
|
||||||
/*
|
|
||||||
* 24:00 hours doesn't exist
|
|
||||||
*/
|
|
||||||
nxt_hour = 0;
|
|
||||||
nxt_min = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Always set semafore do_inet if internet is needed.
|
* Show callresult for this node.
|
||||||
*/
|
*/
|
||||||
if (!s_do_inet && inet_calls) {
|
sprintf(temp, "%s %8s %08x %08x %08x %08x %5d %s %s %s", flstr, size_str(tmp->size),
|
||||||
CreateSema((char *)"do_inet");
|
(unsigned int)tmp->olflags, (unsigned int)tmp->moflags,
|
||||||
s_do_inet = TRUE;
|
(unsigned int)tmp->diflags, (unsigned int)tmp->ipflags,
|
||||||
tasklog('c', "Created semafore do_inet");
|
tmp->cst.tryno, callstatus(tmp->cst.trystat), callmode(tmp->callmode), ascfnode(tmp->addr, 0x0f));
|
||||||
}
|
tasklog('+', "%s", temp);
|
||||||
|
|
||||||
tasklog('o', "Call inet=%d, isdn=%d, pots=%d", inet_calls, isdn_calls, pots_calls);
|
} /* All nodes scanned. */
|
||||||
tasklog('+', "Next event at %02d:%02d UTC", nxt_hour, nxt_min);
|
|
||||||
return 0;
|
if (nxt_hour == 24) {
|
||||||
|
/*
|
||||||
|
* 24:00 hours doesn't exist
|
||||||
|
*/
|
||||||
|
nxt_hour = 0;
|
||||||
|
nxt_min = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Always set/reset semafore do_inet if internet is needed.
|
||||||
|
*/
|
||||||
|
if (!IsSema((char *)"do_inet") && inet_calls) {
|
||||||
|
CreateSema((char *)"do_inet");
|
||||||
|
s_do_inet = TRUE;
|
||||||
|
tasklog('c', "Created semafore do_inet");
|
||||||
|
} else if (IsSema((char *)"do_inet") && !inet_calls) {
|
||||||
|
RemoveSema((char *)"do_inet");
|
||||||
|
s_do_inet = FALSE;
|
||||||
|
tasklog('c', "Removed semafore do_inet");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Log results
|
||||||
|
*/
|
||||||
|
tasklog('+', "Inet=%d, ISDN=%d, POTS=%d, Next event at %02d:%02d UTC",
|
||||||
|
inet_calls, isdn_calls, pots_calls, nxt_hour, nxt_min);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user