Minor changes to the raw ifcico protocol
This commit is contained in:
parent
4e6faee53c
commit
5211f77167
@ -24,6 +24,8 @@ v0.37.3 09-Apr-2003.
|
|||||||
Removed some heavy debug code from ttyio functions to increase
|
Removed some heavy debug code from ttyio functions to increase
|
||||||
throughput.
|
throughput.
|
||||||
Standarized raw ifcico protocol logging.
|
Standarized raw ifcico protocol logging.
|
||||||
|
Some minor changes to the raw ifcico protocol, better error
|
||||||
|
checking and a check for buffer overflow.
|
||||||
|
|
||||||
lang:
|
lang:
|
||||||
New language prompt number 17.
|
New language prompt number 17.
|
||||||
|
4
TODO
4
TODO
@ -65,12 +65,8 @@ mbfido:
|
|||||||
N: Remove memory leak during toss. (It's ok for less 5000 messages for
|
N: Remove memory leak during toss. (It's ok for less 5000 messages for
|
||||||
each run).
|
each run).
|
||||||
|
|
||||||
U: GoldED netmail from points, FMPT kludge is missing.
|
|
||||||
|
|
||||||
U: GoldED messages to internet becomes null.
|
U: GoldED messages to internet becomes null.
|
||||||
|
|
||||||
U: E-mail for points get status normal in the outbound.
|
|
||||||
|
|
||||||
N: Process GoldED filerequest netmails with the filereq flag set, we
|
N: Process GoldED filerequest netmails with the filereq flag set, we
|
||||||
should create a .req file with the contents of the subject line.
|
should create a .req file with the contents of the subject line.
|
||||||
|
|
||||||
|
@ -50,13 +50,18 @@
|
|||||||
#include "tcpproto.h"
|
#include "tcpproto.h"
|
||||||
|
|
||||||
|
|
||||||
#define TCP_CMD 0x87
|
#define TCP_CMD 0x87
|
||||||
#define TCP_DATA 0xe1
|
#define TCP_DATA 0xe1
|
||||||
|
#define TCP_BLKSTRT 0xc6
|
||||||
|
#define TCP_BLKEND 0x6c
|
||||||
|
#define TCP_BLKSIZE 2048
|
||||||
|
#define TCP_DATSIZE 1024
|
||||||
|
|
||||||
|
|
||||||
static FILE *fout;
|
static FILE *fout;
|
||||||
static FILE *in;
|
static FILE *in;
|
||||||
static char txbuf[2048];
|
static char txbuf[TCP_BLKSIZE];
|
||||||
static char rxbuf[2048];
|
static char rxbuf[TCP_BLKSIZE];
|
||||||
static int rx_type;
|
static int rx_type;
|
||||||
static long sbytes;
|
static long sbytes;
|
||||||
struct timeval starttime, endtime;
|
struct timeval starttime, endtime;
|
||||||
@ -241,7 +246,7 @@ static int sendtfile(char *ln, char *rn)
|
|||||||
} else
|
} else
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
while ((bufl = fread(&txbuf, 1, 1024, in)) != 0) {
|
while ((bufl = fread(&txbuf, 1, TCP_DATSIZE, in)) != 0) {
|
||||||
if ((rc = tcp_sblk(txbuf, bufl, TCP_DATA)) > 0)
|
if ((rc = tcp_sblk(txbuf, bufl, TCP_DATA)) > 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -367,12 +372,12 @@ static int tcp_sblk(char *buf, int len, int typ)
|
|||||||
else
|
else
|
||||||
Syslog('a', "tcp_sblk: data: %d bytes", len);
|
Syslog('a', "tcp_sblk: data: %d bytes", len);
|
||||||
|
|
||||||
PUTCHAR(0xc6);
|
PUTCHAR(TCP_BLKSTRT);
|
||||||
PUTCHAR(typ);
|
PUTCHAR(typ);
|
||||||
PUTCHAR((len >> 8) & 0x0ff);
|
PUTCHAR((len >> 8) & 0x0ff);
|
||||||
PUTCHAR(len & 0x0ff);
|
PUTCHAR(len & 0x0ff);
|
||||||
PUT(buf, len);
|
PUT(buf, len);
|
||||||
PUTCHAR(0x6c);
|
PUTCHAR(TCP_BLKEND);
|
||||||
FLUSHOUT();
|
FLUSHOUT();
|
||||||
|
|
||||||
if (tty_status)
|
if (tty_status)
|
||||||
@ -394,7 +399,7 @@ static int tcp_rblk(char *buf, int *len)
|
|||||||
c = GETCHAR(180);
|
c = GETCHAR(180);
|
||||||
if (tty_status)
|
if (tty_status)
|
||||||
goto to;
|
goto to;
|
||||||
if (c != 0xc6) {
|
if (c != TCP_BLKSTRT) {
|
||||||
WriteError("tcp_rblk: got %d instead of block header", c);
|
WriteError("tcp_rblk: got %d instead of block header", c);
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
@ -423,7 +428,7 @@ static int tcp_rblk(char *buf, int *len)
|
|||||||
goto to;
|
goto to;
|
||||||
*len += c;
|
*len += c;
|
||||||
|
|
||||||
if (*len > 2048) {
|
if (*len > TCP_BLKSIZE) {
|
||||||
WriteError("TCP: remote sends too large block: %d bytes", len);
|
WriteError("TCP: remote sends too large block: %d bytes", len);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -431,9 +436,13 @@ static int tcp_rblk(char *buf, int *len)
|
|||||||
/*
|
/*
|
||||||
* Get actual data block
|
* Get actual data block
|
||||||
*/
|
*/
|
||||||
GET(buf, *len, 120);
|
if (*len != 0) {
|
||||||
if (tty_status)
|
GET(buf, *len, 120);
|
||||||
goto to;
|
if (tty_status)
|
||||||
|
goto to;
|
||||||
|
} else {
|
||||||
|
WriteError("TCP: remote sends empty frame");
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get block trailer
|
* Get block trailer
|
||||||
@ -441,8 +450,10 @@ static int tcp_rblk(char *buf, int *len)
|
|||||||
c = GETCHAR(120);
|
c = GETCHAR(120);
|
||||||
if (tty_status)
|
if (tty_status)
|
||||||
goto to;
|
goto to;
|
||||||
if (c != 0x6c)
|
if (c != TCP_BLKEND) {
|
||||||
|
WriteError("TCP: got %d instead of block trailer", c);
|
||||||
return c;
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
if (rx_type == TCP_CMD) {
|
if (rx_type == TCP_CMD) {
|
||||||
buf[*len] = '\0';
|
buf[*len] = '\0';
|
||||||
|
Reference in New Issue
Block a user