Minor changes to the raw ifcico protocol

This commit is contained in:
Michiel Broek 2003-04-13 12:24:37 +00:00
parent 4e6faee53c
commit 5211f77167
3 changed files with 26 additions and 17 deletions

View File

@ -24,6 +24,8 @@ v0.37.3 09-Apr-2003.
Removed some heavy debug code from ttyio functions to increase
throughput.
Standarized raw ifcico protocol logging.
Some minor changes to the raw ifcico protocol, better error
checking and a check for buffer overflow.
lang:
New language prompt number 17.

4
TODO
View File

@ -65,12 +65,8 @@ mbfido:
N: Remove memory leak during toss. (It's ok for less 5000 messages for
each run).
U: GoldED netmail from points, FMPT kludge is missing.
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
should create a .req file with the contents of the subject line.

View File

@ -50,13 +50,18 @@
#include "tcpproto.h"
#define TCP_CMD 0x87
#define TCP_DATA 0xe1
#define TCP_CMD 0x87
#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 *in;
static char txbuf[2048];
static char rxbuf[2048];
static char txbuf[TCP_BLKSIZE];
static char rxbuf[TCP_BLKSIZE];
static int rx_type;
static long sbytes;
struct timeval starttime, endtime;
@ -241,7 +246,7 @@ static int sendtfile(char *ln, char *rn)
} else
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)
break;
}
@ -367,12 +372,12 @@ static int tcp_sblk(char *buf, int len, int typ)
else
Syslog('a', "tcp_sblk: data: %d bytes", len);
PUTCHAR(0xc6);
PUTCHAR(TCP_BLKSTRT);
PUTCHAR(typ);
PUTCHAR((len >> 8) & 0x0ff);
PUTCHAR(len & 0x0ff);
PUT(buf, len);
PUTCHAR(0x6c);
PUTCHAR(TCP_BLKEND);
FLUSHOUT();
if (tty_status)
@ -394,7 +399,7 @@ static int tcp_rblk(char *buf, int *len)
c = GETCHAR(180);
if (tty_status)
goto to;
if (c != 0xc6) {
if (c != TCP_BLKSTRT) {
WriteError("tcp_rblk: got %d instead of block header", c);
return c;
}
@ -423,7 +428,7 @@ static int tcp_rblk(char *buf, int *len)
goto to;
*len += c;
if (*len > 2048) {
if (*len > TCP_BLKSIZE) {
WriteError("TCP: remote sends too large block: %d bytes", len);
return 1;
}
@ -431,9 +436,13 @@ static int tcp_rblk(char *buf, int *len)
/*
* Get actual data block
*/
GET(buf, *len, 120);
if (tty_status)
goto to;
if (*len != 0) {
GET(buf, *len, 120);
if (tty_status)
goto to;
} else {
WriteError("TCP: remote sends empty frame");
}
/*
* Get block trailer
@ -441,8 +450,10 @@ static int tcp_rblk(char *buf, int *len)
c = GETCHAR(120);
if (tty_status)
goto to;
if (c != 0x6c)
if (c != TCP_BLKEND) {
WriteError("TCP: got %d instead of block trailer", c);
return c;
}
if (rx_type == TCP_CMD) {
buf[*len] = '\0';