Rebuild for configurable nodelists handling

This commit is contained in:
Michiel Broek
2002-12-30 22:13:33 +00:00
parent fbe81bfa68
commit 3dfe32df94
20 changed files with 1143 additions and 736 deletions

View File

@@ -591,6 +591,13 @@ int checktasks(int onsig)
if (task[i].tasktype == CM_POTS || task[i].tasktype == CM_ISDN || task[i].tasktype == CM_INET)
rescan = TRUE;
ptimer = PAUSETIME;
/*
* If a nodelist compiler is ready, reload the nodelists configuration
*/
if (task[i].tasktype == MBINDEX) {
deinitnl();
initnl();
}
}
if (first && task[i].rc) {
@@ -699,6 +706,7 @@ void die(int onsig)
else
Syslog('+', "Good, no more tasks running");
deinitnl();
ulocktask();
if (sock != -1)
close(sock);
@@ -1034,6 +1042,8 @@ void scheduler(void)
Syslog('+', "Ports configuration changed, reloading");
load_ports();
check_ports();
deinitnl();
initnl();
sem_set((char *)"scanout", TRUE);
}
@@ -1305,8 +1315,8 @@ int main(int argc, char **argv)
memset(&reginfo, 0, sizeof(reginfo));
memset(&calllist, 0, sizeof(calllist));
sprintf(spath, "%s/tmp/mbtask", getenv("MBSE_ROOT"));
sprintf(ttyfn, "%s/etc/ttyinfo.data", getenv("MBSE_ROOT"));
initnl();
load_ports();
check_ports();

View File

@@ -202,7 +202,18 @@ int outstat()
struct dirent *de;
struct stat sb;
struct passwd *pw;
unsigned long cmmask, ibnmask = 0, ifcmask = 0, itnmask = 0;
nodelist_modem **tmpm;
cmmask = getCMmask();
for (tmpm = &nl_tcpip; *tmpm; tmpm=&((*tmpm)->next)) {
if (strcmp((*tmpm)->name, "IBN") == 0)
ibnmask = (*tmpm)->mask;
if (strcmp((*tmpm)->name, "IFC") == 0)
ifcmask = (*tmpm)->mask;
if (strcmp((*tmpm)->name, "ITN") == 0)
itnmask = (*tmpm)->mask;
}
now = time(NULL);
tm = gmtime(&now); /* UTC time */
uhour = tm->tm_hour;
@@ -406,9 +417,9 @@ int outstat()
* If the node has internet and we have internet configured,
* check if we can send immediatly.
*/
if (TCFG.max_tcp && (tmp->olflags & OL_CM) &&
if (TCFG.max_tcp && (tmp->olflags & cmmask) &&
(((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->ipflags & ibnmask) || (tmp->ipflags & ifcmask) || (tmp->ipflags & itnmask))) {
tmp->flavors |= F_CALL;
}
@@ -417,7 +428,7 @@ int outstat()
/*
* 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) {
if ((tmp->olflags & cmmask) || T_window || iszmh) {
tmp->flavors |= F_CALL;
}
}
@@ -427,7 +438,7 @@ int outstat()
/*
* 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) {
if ((tmp->olflags & cmmask) || T_window || iszmh) {
tmp->flavors |= F_CALL;
}
}
@@ -480,8 +491,7 @@ int outstat()
if ((tmp->flavors) & F_CALL) {
tmp->callmode = CM_NONE;
if (TCFG.max_tcp && !(nodes.NoIBN && nodes.NoIFC && nodes.NoITN) &&
((tmp->ipflags & IP_IBN) || (tmp->ipflags & IP_IFC) || (tmp->ipflags & IP_ITN))) {
if (TCFG.max_tcp && ((tmp->ipflags & ibnmask) || (tmp->ipflags & ifcmask) || (tmp->ipflags & itnmask))) {
inet_calls++;
tmp->callmode = CM_INET;
}

View File

@@ -109,11 +109,12 @@ void fill_portlist(pp_list **fdp, pp_list *new)
*/
void load_ports()
{
FILE *fp;
pp_list new;
int j, stdflag;
char *p, *q;
FILE *fp;
pp_list new;
int stdflag;
char *p, *q;
nodelist_modem **tmpm;
tidy_portlist(&pl);
if ((fp = fopen(ttyfn, "r")) == NULL) {
Syslog('?', "$Can't open %s", ttyfn);
@@ -142,12 +143,12 @@ void load_ports()
if ((strncasecmp(p, "U", 1) == 0) && (strlen(p) == 1)) {
stdflag = FALSE;
} else {
for (j = 0; fkey[j].key; j++)
if (strcasecmp(p, fkey[j].key) == 0)
new.mflags |= fkey[j].flag;
for (j = 0; dkey[j].key; j++)
if (strcasecmp(p, dkey[j].key) == 0)
new.dflags |= dkey[j].flag;
for (tmpm = &nl_pots; *tmpm; tmpm=&((*tmpm)->next))
if (strcasecmp(p, (*tmpm)->name) == 0)
new.mflags |= (*tmpm)->value;
for (tmpm = &nl_isdn; *tmpm; tmpm=&((*tmpm)->next))
if (strcasecmp(p, (*tmpm)->name) == 0)
new.dflags |= (*tmpm)->value;
}
}