Changed handshake and EMSI timers
This commit is contained in:
parent
c519afe9dc
commit
4bd3c7dcde
15
ChangeLog
15
ChangeLog
@ -3,7 +3,15 @@ $Id$
|
||||
WARNING !! WARNING !! WARNING !! WARNING !! WARNING !! WARNING !! WARNING !!
|
||||
|
||||
Inbound file handling is changed, this version is under test and should NOT
|
||||
be used on production systems
|
||||
be used on production systems if you don't want to help debugging.
|
||||
Handshake and EMSI is changed, please run this version with debugging on,
|
||||
mbsetup 1.14.1 turn 5, 11 and 18 on at least. Report any problems and include
|
||||
a piece of the logfile.
|
||||
|
||||
Before installing, make a copy of /opt/mbse/bin/mbcico so you can go back
|
||||
if you experience any problems.
|
||||
|
||||
As far as I have tested, there should be no problems with this version.
|
||||
|
||||
WARNING !! WARNING !! WARNING !! WARNING !! WARNING !! WARNING !! WARNING !!
|
||||
|
||||
@ -29,6 +37,11 @@ v0.37.6 10-Aug-2003
|
||||
systems.
|
||||
Fixed the binkp escape sequence which is wrong in the FSP.
|
||||
A light improvement in session handshake setup timers.
|
||||
Added EMSI handshake timers, this gives a more relaxed EMSI
|
||||
handshake.
|
||||
Set the EMSI receive failure count to 20 instead of 6, we can
|
||||
now even accept buggy maindoor sessions and still display a
|
||||
banner.
|
||||
|
||||
|
||||
v0.37.5 12-Jul-2003 - 10-Aug-2003
|
||||
|
@ -271,6 +271,7 @@ int tx_emsi(char *data)
|
||||
|
||||
SM_DECL(rxemsi,(char *)"rxemsi")
|
||||
SM_STATES
|
||||
init,
|
||||
waitpkt,
|
||||
waitchar,
|
||||
checkemsi,
|
||||
@ -280,6 +281,7 @@ SM_STATES
|
||||
sendnak,
|
||||
sendack
|
||||
SM_NAMES
|
||||
(char *)"init",
|
||||
(char *)"waitpkt",
|
||||
(char *)"waitchar",
|
||||
(char *)"checkemsi",
|
||||
@ -300,24 +302,40 @@ SM_EDECL
|
||||
p = buf;
|
||||
databuf = xstrcpy(intro);
|
||||
|
||||
SM_START(checkpkt)
|
||||
Syslog('i', "RXEMSI: start");
|
||||
SM_START(init)
|
||||
|
||||
SM_STATE(init)
|
||||
|
||||
Syslog('i', "RXEMSI: init");
|
||||
RESETTIMERS();
|
||||
SETTIMER(0, 60);
|
||||
SETTIMER(1, 20);
|
||||
SM_PROCEED(checkpkt);
|
||||
|
||||
SM_STATE(waitpkt)
|
||||
|
||||
Syslog('i', "RXEMSI: waitpkt");
|
||||
standby = 0;
|
||||
SETTIMER(1, 20);
|
||||
SM_PROCEED(waitchar);
|
||||
|
||||
SM_STATE(waitchar)
|
||||
|
||||
c = GETCHAR(5);
|
||||
if (c == TIMEOUT) {
|
||||
if (++tries > 9) {
|
||||
Syslog('+', "Too many tries waiting EMSI handshake");
|
||||
Syslog('i', "RXEMSI: waitchar, tries=%d", tries);
|
||||
|
||||
if (EXPIRED(0)) {
|
||||
Syslog('+', "EMSI receive 60 seconds timeout");
|
||||
SM_ERROR;
|
||||
} else {
|
||||
}
|
||||
|
||||
if (EXPIRED(1)) {
|
||||
Syslog('s', "20 sec timeout");
|
||||
SM_PROCEED(sendnak);
|
||||
}
|
||||
|
||||
c = GETCHAR(1);
|
||||
if (c == TIMEOUT) {
|
||||
SM_PROCEED(waitchar);
|
||||
} else if (c < 0) {
|
||||
SM_ERROR;
|
||||
} else if ((c >= ' ') && (c <= '~')) {
|
||||
@ -334,7 +352,8 @@ SM_STATE(waitchar)
|
||||
SM_PROCEED(checkemsi);
|
||||
}
|
||||
}
|
||||
} else switch(c) {
|
||||
} else {
|
||||
switch(c) {
|
||||
case DC1: break;
|
||||
case '\n':
|
||||
case '\r': standby = 0;
|
||||
@ -342,7 +361,7 @@ SM_STATE(waitchar)
|
||||
default: standby = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
SM_PROCEED(waitchar);
|
||||
|
||||
SM_STATE(checkemsi)
|
||||
@ -391,6 +410,8 @@ SM_STATE(getdat)
|
||||
|
||||
SM_STATE(checkpkt)
|
||||
|
||||
Syslog('i', "RXEMSI: checkpkt");
|
||||
|
||||
if (strncasecmp(databuf,"EMSI_DAT",8) == 0) {
|
||||
SM_PROCEED(checkdat);
|
||||
}
|
||||
@ -435,7 +456,12 @@ SM_STATE(checkdat)
|
||||
|
||||
SM_STATE(sendnak)
|
||||
|
||||
if (++tries > 9) {
|
||||
/*
|
||||
* The FSC-0059 says 6 attempts, but to accept maindoor sessions
|
||||
* we seem to need about 11, we set it to 20 since we also have
|
||||
* a global 60 seconds timer running.
|
||||
*/
|
||||
if (++tries > 19) {
|
||||
Syslog('+', "Too many tries getting EMSI_DAT");
|
||||
SM_ERROR;
|
||||
} if (caller) {
|
||||
@ -491,6 +517,9 @@ SM_EDECL
|
||||
p = buf;
|
||||
memset(&buf, 0, sizeof(buf));
|
||||
strncpy(buf, intro, sizeof(buf) - 1);
|
||||
RESETTIMERS();
|
||||
SETTIMER(0, 60);
|
||||
Syslog('i', "TXEMSI: 60 seconds timer set");
|
||||
|
||||
SM_START(senddata)
|
||||
Syslog('i', "TXEMSI: start");
|
||||
@ -505,6 +534,7 @@ SM_STATE(senddata)
|
||||
PUTSTR(trailer);
|
||||
Syslog('i', "TXEMSI: send **%s%04X", p, crc16xmodem(p, strlen(p)));
|
||||
free(p);
|
||||
SETTIMER(1, 20);
|
||||
SM_PROCEED(waitpkt);
|
||||
|
||||
SM_STATE(waitpkt)
|
||||
@ -514,14 +544,24 @@ SM_STATE(waitpkt)
|
||||
|
||||
SM_STATE(waitchar)
|
||||
|
||||
c = GETCHAR(8);
|
||||
if (c == TIMEOUT) {
|
||||
if (++tries > 9) {
|
||||
if (EXPIRED(0)) {
|
||||
Syslog('+', "EMSI transmit 60 seconds timeout");
|
||||
SM_ERROR;
|
||||
}
|
||||
|
||||
if (EXPIRED(1)) {
|
||||
Syslog('i', "TXEMSI: 20 seconds timeout");
|
||||
if (++tries > 19) {
|
||||
Syslog('+', "too many tries sending EMSI");
|
||||
SM_ERROR;
|
||||
} else {
|
||||
SM_PROCEED(senddata);
|
||||
}
|
||||
}
|
||||
|
||||
c = GETCHAR(1);
|
||||
if (c == TIMEOUT) {
|
||||
SM_PROCEED(waitchar);
|
||||
} else if (c < 0) {
|
||||
SM_ERROR;
|
||||
} else if ((c >= ' ') && (c <= '~')) {
|
||||
@ -538,7 +578,8 @@ SM_STATE(waitchar)
|
||||
SM_PROCEED(checkpkt);
|
||||
}
|
||||
}
|
||||
} else switch(c) {
|
||||
} else
|
||||
switch(c) {
|
||||
case DC1: SM_PROCEED(waitchar);
|
||||
break;
|
||||
case '\n':
|
||||
|
@ -388,12 +388,14 @@ SM_RETURN
|
||||
SM_DECL(rx_define_type,(char *)"rx_define_type")
|
||||
SM_STATES
|
||||
sendintro,
|
||||
settimer,
|
||||
waitchar,
|
||||
nextchar,
|
||||
checkemsi,
|
||||
getdat
|
||||
SM_NAMES
|
||||
(char *)"sendintro",
|
||||
(char *)"settimer",
|
||||
(char *)"waitchar",
|
||||
(char *)"nextchar",
|
||||
(char *)"checkemsi",
|
||||
@ -413,17 +415,19 @@ SM_EDECL
|
||||
ep=ebuf;
|
||||
RESETTIMERS();
|
||||
SETTIMER(0, 60);
|
||||
SETTIMER(1, 20);
|
||||
|
||||
SM_START(sendintro)
|
||||
|
||||
SM_STATE(sendintro)
|
||||
|
||||
Syslog('s', "rxdefine_type SENDINTRO count=%d", count);
|
||||
if (count++ > 6) {
|
||||
Syslog('+', "Too many tries to get anything from the caller");
|
||||
SM_ERROR;
|
||||
}
|
||||
|
||||
Syslog('s', "rxdefine_type SENDINTRO count=%d", count);
|
||||
|
||||
standby = 0;
|
||||
ep = ebuf;
|
||||
ebuf[0] = '\0';
|
||||
@ -447,9 +451,15 @@ SM_STATE(sendintro)
|
||||
if (STATUS) {
|
||||
SM_ERROR;
|
||||
} else {
|
||||
SM_PROCEED(waitchar);
|
||||
SM_PROCEED(settimer);
|
||||
}
|
||||
|
||||
SM_STATE(settimer)
|
||||
|
||||
Syslog('s', "Set 20 secs timer");
|
||||
SETTIMER(1, 20);
|
||||
SM_PROCEED(waitchar);
|
||||
|
||||
SM_STATE(waitchar)
|
||||
|
||||
if (EXPIRED(0)) {
|
||||
@ -457,8 +467,13 @@ SM_STATE(waitchar)
|
||||
SM_ERROR;
|
||||
}
|
||||
|
||||
if ((c = GETCHAR(20)) == TIMEOUT) {
|
||||
if (EXPIRED(1)) {
|
||||
Syslog('s', "20 sec timer timeout");
|
||||
SM_PROCEED(sendintro);
|
||||
}
|
||||
|
||||
if ((c = GETCHAR(1)) == TIMEOUT) {
|
||||
SM_PROCEED(waitchar);
|
||||
} else if (c < 0) {
|
||||
Syslog('+', "Session setup error");
|
||||
SM_ERROR;
|
||||
@ -515,7 +530,18 @@ SM_STATE(nextchar)
|
||||
if (ebuf[0]) {
|
||||
SM_PROCEED(checkemsi);
|
||||
} else {
|
||||
/*
|
||||
* If the 20 second timer is expired or after the
|
||||
* first sendintro, send the intro again. After
|
||||
* that take it easy.
|
||||
*/
|
||||
if (EXPIRED(1) || (count == 1)) {
|
||||
Syslog('s', "sendintro after eol char");
|
||||
SM_PROCEED(sendintro);
|
||||
} else {
|
||||
Syslog('s', "waitchar after eol char");
|
||||
SM_PROCEED(waitchar);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default: standby = 0;
|
||||
@ -532,6 +558,7 @@ SM_STATE(checkemsi)
|
||||
Syslog('i', "check \"%s\" for being EMSI inquery or data",ebuf);
|
||||
|
||||
if (localoptions & NOEMSI) {
|
||||
Syslog('s', "Force sendintro");
|
||||
SM_PROCEED(sendintro);
|
||||
}
|
||||
|
||||
@ -543,11 +570,11 @@ SM_STATE(checkemsi)
|
||||
standby = 0;
|
||||
ep = ebuf;
|
||||
ebuf[0] = '\0';
|
||||
SM_PROCEED(waitchar);
|
||||
SM_PROCEED(settimer);
|
||||
} else if (strncasecmp(ebuf, "EMSI_DAT", 8) == 0) {
|
||||
SM_PROCEED(getdat);
|
||||
} else {
|
||||
SM_PROCEED(sendintro);
|
||||
SM_PROCEED(settimer);
|
||||
}
|
||||
|
||||
SM_STATE(getdat)
|
||||
@ -569,6 +596,7 @@ SM_STATE(getdat)
|
||||
*p= '\0';
|
||||
}
|
||||
if (c == TIMEOUT) {
|
||||
Syslog('s', "c = TIMEOUT -> sendintro");
|
||||
SM_PROCEED(sendintro);
|
||||
} else if (c < 0) {
|
||||
Syslog('+', "Error while reading EMSI_DAT from the caller");
|
||||
|
Reference in New Issue
Block a user