Updated calling methods in mbtask and mbcico
This commit is contained in:
parent
4a7252d7b5
commit
5fc848598c
@ -4664,17 +4664,20 @@ v0.33.20 10-Feb-2002
|
|||||||
Creates the semafore is_inet when the internet connections is
|
Creates the semafore is_inet when the internet connections is
|
||||||
available, and removes it when it is down.
|
available, and removes it when it is down.
|
||||||
Added test for ISDN/modem lines in use.
|
Added test for ISDN/modem lines in use.
|
||||||
Lost of code cleanup.
|
Lots of code cleanup.
|
||||||
No setup setting anymore for maximum POTS and ISDN lines, this
|
No setup setting anymore for maximum POTS and ISDN lines, this
|
||||||
is now automatic.
|
is now automatic.
|
||||||
mbtask will now update internal counters how many ISDN and POTS
|
mbtask will now update internal counters how many ISDN and POTS
|
||||||
lines are free to use for dialout.
|
lines are free to use for dialout.
|
||||||
|
For ISDN and POTS calls, mbtask now decides which tty to use,
|
||||||
|
mbcico gets the tty to use as option on the commandline.
|
||||||
|
|
||||||
mbcico:
|
mbcico:
|
||||||
Fixed binkp driver to accept incoming unprotected sessions.
|
Fixed binkp driver to accept incoming unprotected sessions.
|
||||||
Temporary added extra password handling logs.
|
Temporary added extra password handling logs.
|
||||||
If a binkp session comes in and there already is a session
|
If a binkp session comes in and there already is a session
|
||||||
with that node, mbcico stopts the binkp session with an error.
|
with that node, mbcico stopts the binkp session with an error.
|
||||||
|
Remove some obsolete code that is handled by mbtask.
|
||||||
|
|
||||||
mbout:
|
mbout:
|
||||||
The status display has now 9 digits for the outbound size.
|
The status display has now 9 digits for the outbound size.
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* Purpose ...............: Fidonet mailer
|
* Purpose ...............: Fidonet mailer
|
||||||
*
|
*
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
* Copyright (C) 1997-2001
|
* Copyright (C) 1997-2002
|
||||||
*
|
*
|
||||||
* Michiel Broek FIDO: 2:280/2802
|
* Michiel Broek FIDO: 2:280/2802
|
||||||
* Beekmansbos 10
|
* Beekmansbos 10
|
||||||
@ -69,8 +69,8 @@ int checkretry(callstat *st)
|
|||||||
|
|
||||||
int portopen(faddr *addr)
|
int portopen(faddr *addr)
|
||||||
{
|
{
|
||||||
char *p, *q;
|
char *p;
|
||||||
int rc, speed;
|
int rc;
|
||||||
pp_list *pl = NULL, *tmp;
|
pp_list *pl = NULL, *tmp;
|
||||||
|
|
||||||
if (inetaddr) {
|
if (inetaddr) {
|
||||||
@ -87,27 +87,15 @@ int portopen(faddr *addr)
|
|||||||
if (forcedline) {
|
if (forcedline) {
|
||||||
Syslog('d', "portopen forcedline %s", forcedline);
|
Syslog('d', "portopen forcedline %s", forcedline);
|
||||||
p = forcedline;
|
p = forcedline;
|
||||||
if ((q = strchr(p, ':'))) { /* Note: DIT KAN WEG ! */
|
|
||||||
*q++ = '\0';
|
|
||||||
if ((*q == 'l') || (*q == 'L'))
|
|
||||||
speed=atoi(++q);
|
|
||||||
else {
|
|
||||||
speed = atoi(q);
|
|
||||||
if (nlent->speed < speed)
|
|
||||||
speed = nlent->speed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (load_port(p)) {
|
if (load_port(p)) {
|
||||||
speed = ttyinfo.portspeed;
|
if ((rc = openport(p, ttyinfo.portspeed))) {
|
||||||
rc = openport(p,speed);
|
|
||||||
if (rc) {
|
|
||||||
Syslog('+', "Cannot open port %s",p);
|
Syslog('+', "Cannot open port %s",p);
|
||||||
nodeulock(addr);
|
nodeulock(addr);
|
||||||
putstatus(addr, 10, ST_PORTERR);
|
putstatus(addr, 10, ST_PORTERR);
|
||||||
return ST_PORTERR;
|
return ST_PORTERR;
|
||||||
}
|
}
|
||||||
return 0;
|
return ST_PORTOK;
|
||||||
} else {
|
} else {
|
||||||
nodeulock(addr);
|
nodeulock(addr);
|
||||||
putstatus(addr, 0, ST_PORTERR);
|
putstatus(addr, 0, ST_PORTERR);
|
||||||
@ -115,6 +103,8 @@ int portopen(faddr *addr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WriteError("call.c portopen(): should not be here");
|
||||||
|
|
||||||
if (make_portlist(nlent, &pl) == 0) {
|
if (make_portlist(nlent, &pl) == 0) {
|
||||||
WriteError("No matching ports defined");
|
WriteError("No matching ports defined");
|
||||||
nodeulock(addr);
|
nodeulock(addr);
|
||||||
@ -126,8 +116,7 @@ int portopen(faddr *addr)
|
|||||||
if (load_port(tmp->tty)) {
|
if (load_port(tmp->tty)) {
|
||||||
Syslog('+', "Port %s at %ld, modem %s", ttyinfo.tty, ttyinfo.portspeed, modem.modem);
|
Syslog('+', "Port %s at %ld, modem %s", ttyinfo.tty, ttyinfo.portspeed, modem.modem);
|
||||||
p = xstrcpy(tmp->tty);
|
p = xstrcpy(tmp->tty);
|
||||||
speed = ttyinfo.portspeed;
|
rc = openport(p, ttyinfo.portspeed);
|
||||||
rc = openport(p, speed);
|
|
||||||
free(p);
|
free(p);
|
||||||
if (rc == 0) {
|
if (rc == 0) {
|
||||||
tidy_pplist(&pl);
|
tidy_pplist(&pl);
|
||||||
@ -146,7 +135,7 @@ int portopen(faddr *addr)
|
|||||||
|
|
||||||
int call(faddr *addr)
|
int call(faddr *addr)
|
||||||
{
|
{
|
||||||
int i, j, rc = 1;
|
int i, rc = 1;
|
||||||
callstat *st;
|
callstat *st;
|
||||||
struct hostent *he;
|
struct hostent *he;
|
||||||
|
|
||||||
@ -261,12 +250,12 @@ int call(faddr *addr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (((nlent->oflags & OL_CM) == 0) && (!IsZMH())) {
|
if (((nlent->oflags & OL_CM) == 0) && (!IsZMH())) {
|
||||||
if (!forcedcalls) {
|
// if (!forcedcalls) {
|
||||||
Syslog('d', "Node is ZMH only and it is not ZMH");
|
// Syslog('d', "Node is ZMH only and it is not ZMH");
|
||||||
nodeulock(addr);
|
// nodeulock(addr);
|
||||||
putstatus(addr,0,ST_NOTZMH);
|
// putstatus(addr,0,ST_NOTZMH);
|
||||||
return ST_NOTZMH;
|
// return ST_NOTZMH;
|
||||||
}
|
// }
|
||||||
Syslog('?', "Warning: calling MO system outside ZMH");
|
Syslog('?', "Warning: calling MO system outside ZMH");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -280,26 +269,26 @@ int call(faddr *addr)
|
|||||||
* Over TCP/IP we don't do a delay because the node we are
|
* Over TCP/IP we don't do a delay because the node we are
|
||||||
* connecting can't be busy. Also forced calls don't delay.
|
* connecting can't be busy. Also forced calls don't delay.
|
||||||
*/
|
*/
|
||||||
Syslog('d', "delay=%d inetaddr=%s immediatecall=%s",
|
// Syslog('d', "delay=%d inetaddr=%s immediatecall=%s",
|
||||||
CFG.dialdelay, inetaddr?"true":"false", immediatecall?"true":"false");
|
// CFG.dialdelay, inetaddr?"true":"false", immediatecall?"true":"false");
|
||||||
if ((CFG.dialdelay > 10) && (!inetaddr) && (!immediatecall)) {
|
// if ((CFG.dialdelay > 10) && (!inetaddr) && (!immediatecall)) {
|
||||||
/*
|
// /*
|
||||||
* Generate a random number between CFG.dialdelay and
|
// * Generate a random number between CFG.dialdelay and
|
||||||
* CFG.dialdelay / 10, minimum value is 10.
|
// * CFG.dialdelay / 10, minimum value is 10.
|
||||||
*/
|
// */
|
||||||
srand(getpid());
|
// srand(getpid());
|
||||||
while (TRUE) {
|
// while (TRUE) {
|
||||||
j = 1+(int) (1.0 * CFG.dialdelay * rand() / (RAND_MAX + 1.0));
|
// j = 1+(int) (1.0 * CFG.dialdelay * rand() / (RAND_MAX + 1.0));
|
||||||
if ((j > (CFG.dialdelay / 10)) && (j > 9))
|
// if ((j > (CFG.dialdelay / 10)) && (j > 9))
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
Syslog('d', "Dial delay %d seconds", j);
|
// Syslog('d', "Dial delay %d seconds", j);
|
||||||
|
//
|
||||||
for (i = j; i > 0; i--) {
|
// for (i = j; i > 0; i--) {
|
||||||
IsDoing("Delay %d seconds", i);
|
// IsDoing("Delay %d seconds", i);
|
||||||
sleep(1);
|
// sleep(1);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (nodelock(addr)) {
|
if (nodelock(addr)) {
|
||||||
Syslog('+', "System %s is locked", ascfnode(addr, 0x1f));
|
Syslog('+', "System %s is locked", ascfnode(addr, 0x1f));
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
|
/* $Id$ */
|
||||||
|
|
||||||
#ifndef CALLSTAT_H
|
#ifndef CALLSTAT_H
|
||||||
#define CALLSTAT_H
|
#define CALLSTAT_H
|
||||||
|
|
||||||
|
|
||||||
|
#define ST_PORTOK 0
|
||||||
#define ST_PORTERR 1
|
#define ST_PORTERR 1
|
||||||
#define ST_NOCONN 2
|
#define ST_NOCONN 2
|
||||||
#define ST_MDMERR 3
|
#define ST_MDMERR 3
|
||||||
|
@ -247,6 +247,7 @@ int main(int argc, char *argv[])
|
|||||||
usage();
|
usage();
|
||||||
die(101);
|
die(101);
|
||||||
}
|
}
|
||||||
|
WriteError("commandline option -r is obsolete");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'l': forcedline = optarg;
|
case 'l': forcedline = optarg;
|
||||||
@ -372,8 +373,11 @@ int main(int argc, char *argv[])
|
|||||||
if (!diskfree(CFG.freespace))
|
if (!diskfree(CFG.freespace))
|
||||||
die(101);
|
die(101);
|
||||||
|
|
||||||
if (callist == NULL)
|
if (callist == NULL) {
|
||||||
callist = callall();
|
WriteError("Calling mbcico without node address not supported anymore");
|
||||||
|
die(101);
|
||||||
|
}
|
||||||
|
// callist = callall();
|
||||||
|
|
||||||
for (tmpl = &callist; *tmpl; tmpl = &((*tmpl)->next)) {
|
for (tmpl = &callist; *tmpl; tmpl = &((*tmpl)->next)) {
|
||||||
callno++;
|
callno++;
|
||||||
@ -387,9 +391,9 @@ int main(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (callist == NULL)
|
// if (callist == NULL)
|
||||||
if (IsSema((char *)"scanout"))
|
// if (IsSema((char *)"scanout"))
|
||||||
RemoveSema((char *)"scanout");
|
// RemoveSema((char *)"scanout");
|
||||||
} else {
|
} else {
|
||||||
/* slave */
|
/* slave */
|
||||||
if (!answermode && tcp_mode == TCPMODE_IBN)
|
if (!answermode && tcp_mode == TCPMODE_IBN)
|
||||||
|
@ -100,6 +100,7 @@ extern int pots_lines; /* POTS lines available */
|
|||||||
extern int isdn_lines; /* ISDN lines available */
|
extern int isdn_lines; /* ISDN lines available */
|
||||||
extern int pots_free; /* POTS lines free */
|
extern int pots_free; /* POTS lines free */
|
||||||
extern int isdn_free; /* ISDN lines free */
|
extern int isdn_free; /* ISDN lines free */
|
||||||
|
extern pp_list *pl; /* List of tty ports */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -836,7 +837,7 @@ void scheduler(void)
|
|||||||
struct passwd *pw;
|
struct passwd *pw;
|
||||||
int running = 0, rc, i, rlen, found;
|
int running = 0, rc, i, rlen, found;
|
||||||
static int LOADhi = FALSE, oldmin = 70, olddo = 70, oldsec = 70;
|
static int LOADhi = FALSE, oldmin = 70, olddo = 70, oldsec = 70;
|
||||||
char *cmd = NULL, opts[41];
|
char *cmd = NULL, opts[41], port[21];
|
||||||
static char doing[32], buf[2048];
|
static char doing[32], buf[2048];
|
||||||
time_t now;
|
time_t now;
|
||||||
struct tm *tm, *utm;
|
struct tm *tm, *utm;
|
||||||
@ -847,6 +848,7 @@ void scheduler(void)
|
|||||||
int call_work = 0;
|
int call_work = 0;
|
||||||
static int call_entry = MAXTASKS;
|
static int call_entry = MAXTASKS;
|
||||||
double loadavg[3];
|
double loadavg[3];
|
||||||
|
pp_list *tpl;
|
||||||
|
|
||||||
InitFidonet();
|
InitFidonet();
|
||||||
|
|
||||||
@ -1147,17 +1149,14 @@ void scheduler(void)
|
|||||||
call_entry = 0;
|
call_entry = 0;
|
||||||
else
|
else
|
||||||
call_entry++;
|
call_entry++;
|
||||||
// tasklog('c', "Call entry rotaded to %d", call_entry);
|
|
||||||
/*
|
/*
|
||||||
* If a valid entry, and not yet calling, and the retry time is reached,
|
* If a valid entry, and not yet calling, and the retry time is reached,
|
||||||
* then launch a callprocess for this node.
|
* then launch a callprocess for this node.
|
||||||
*/
|
*/
|
||||||
// if (calllist[call_entry].addr.zone && !calllist[call_entry].calling) {
|
|
||||||
// tasklog('o', "trytime %lu, now %lu", calllist[call_entry].cst.trytime, now);
|
|
||||||
// }
|
|
||||||
if (calllist[call_entry].addr.zone && !calllist[call_entry].calling &&
|
if (calllist[call_entry].addr.zone && !calllist[call_entry].calling &&
|
||||||
(calllist[call_entry].cst.trytime < now)) {
|
(calllist[call_entry].cst.trytime < now)) {
|
||||||
if ((calllist[call_entry].callmode == CM_INET) && (runtasktype(CM_INET) < TCFG.max_tcp)) {
|
if ((calllist[call_entry].callmode == CM_INET) && (runtasktype(CM_INET) < TCFG.max_tcp) && internet) {
|
||||||
found = TRUE;
|
found = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1170,6 +1169,7 @@ void scheduler(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Safety counter, if all systems are already calling, we should
|
* Safety counter, if all systems are already calling, we should
|
||||||
* never break out of this loop anymore.
|
* never break out of this loop anymore.
|
||||||
@ -1179,15 +1179,30 @@ void scheduler(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (found) {
|
if (found) {
|
||||||
// tasklog('c', "Should launch slot %d node %s", call_entry, ascfnode(calllist[call_entry].addr, 0x1f));
|
|
||||||
/*
|
|
||||||
* FIXME: here we should check if there are multiple ISDN or POTS lines which of the
|
|
||||||
* lines matches the flags to call that node and use the most simple device.
|
|
||||||
* The mbcico should be called with the instruction which line to use.
|
|
||||||
*/
|
|
||||||
cmd = xstrcpy(pw->pw_dir);
|
cmd = xstrcpy(pw->pw_dir);
|
||||||
cmd = xstrcat(cmd, (char *)"/bin/mbcico");
|
cmd = xstrcat(cmd, (char *)"/bin/mbcico");
|
||||||
sprintf(opts, "f%u.n%u.z%u", calllist[call_entry].addr.node, calllist[call_entry].addr.net,
|
/*
|
||||||
|
* For ISDN or POTS, select a free tty device.
|
||||||
|
*/
|
||||||
|
switch (calllist[call_entry].callmode) {
|
||||||
|
case CM_ISDN: for (tpl = pl; tpl; tpl = tpl->next) {
|
||||||
|
if (!tpl->locked && (tpl->dflags & calllist[call_entry].diflags)) {
|
||||||
|
sprintf(port, "-l %s ", tpl->tty);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case CM_POTS: for (tpl = pl; tpl; tpl = tpl->next) {
|
||||||
|
if (!tpl->locked && (tpl->mflags & calllist[call_entry].moflags)) {
|
||||||
|
sprintf(port, "-l %s ", tpl->tty);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default: port[0] = '\0';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
sprintf(opts, "%sf%u.n%u.z%u", port, calllist[call_entry].addr.node, calllist[call_entry].addr.net,
|
||||||
calllist[call_entry].addr.zone);
|
calllist[call_entry].addr.zone);
|
||||||
calllist[call_entry].taskpid = launch(cmd, opts, (char *)"mbcico", calllist[call_entry].callmode);
|
calllist[call_entry].taskpid = launch(cmd, opts, (char *)"mbcico", calllist[call_entry].callmode);
|
||||||
if (calllist[call_entry].taskpid)
|
if (calllist[call_entry].taskpid)
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#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"
|
||||||
|
|
||||||
|
|
||||||
@ -50,6 +51,7 @@ _alist_l *alist = NULL; /* Nodes to call list */
|
|||||||
extern int s_do_inet; /* Internet wanted */
|
extern int s_do_inet; /* Internet wanted */
|
||||||
extern int pots_lines; /* POTS lines available */
|
extern int pots_lines; /* POTS lines available */
|
||||||
extern int isdn_lines; /* ISDN lines available */
|
extern int isdn_lines; /* ISDN lines available */
|
||||||
|
extern pp_list *pl; /* Available ports */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -192,6 +194,7 @@ int outstat()
|
|||||||
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 */
|
||||||
@ -393,27 +396,36 @@ int outstat()
|
|||||||
|
|
||||||
if ((tmp->callmode == CM_NONE) && isdn_lines) {
|
if ((tmp->callmode == CM_NONE) && isdn_lines) {
|
||||||
/*
|
/*
|
||||||
* ISDN node
|
* If any matching port found, mark node ISDN
|
||||||
*/
|
*/
|
||||||
|
for (tpl = pl; tpl; tpl = tpl->next) {
|
||||||
|
if (tmp->diflags & tpl->dflags) {
|
||||||
isdn_calls++;
|
isdn_calls++;
|
||||||
tmp->callmode = CM_ISDN;
|
tmp->callmode = CM_ISDN;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ((tmp->callmode == CM_NONE) && pots_lines) {
|
if ((tmp->callmode == CM_NONE) && pots_lines) {
|
||||||
/*
|
/*
|
||||||
* POTS node
|
* If any matching ports found, mark node POTS
|
||||||
*/
|
*/
|
||||||
|
for (tpl = pl; tpl; tpl = tpl->next) {
|
||||||
|
if (tmp->moflags & tpl->mflags) {
|
||||||
pots_calls++;
|
pots_calls++;
|
||||||
tmp->callmode = CM_POTS;
|
tmp->callmode = CM_POTS;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Here we are out of options.
|
* Here we are out of options, clear callflag.
|
||||||
*/
|
*/
|
||||||
if (tmp->callmode == CM_NONE) {
|
if (tmp->callmode == CM_NONE) {
|
||||||
tasklog('!', "No method to call %s available", ascfnode(tmp->addr, 0x0f));
|
tasklog('!', "No method to call %s available", ascfnode(tmp->addr, 0x0f));
|
||||||
|
tmp->flavors &= ~F_CALL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user