Support for binkp GET command

This commit is contained in:
Michiel Broek 2002-03-18 16:22:01 +00:00
parent 6b9c309bb9
commit f30d5dc3dc
2 changed files with 19 additions and 6 deletions

View File

@ -4693,6 +4693,8 @@ v0.33.20 10-Feb-2002
Remove some obsolete code that is handled by mbtask. Remove some obsolete code that is handled by mbtask.
Added some debug logmessages in ttyio. Added some debug logmessages in ttyio.
Disabled creation of .spl files dusing mail sessions for test. Disabled creation of .spl files dusing mail sessions for test.
Added experimental support for binkp GET command frame, under
test now.
mbout: mbout:
The status display has now 9 digits for the outbound size. The status display has now 9 digits for the outbound size.

View File

@ -816,12 +816,12 @@ int binkp_batch(file_list *to_send)
int sverr, cmd = FALSE, GotFrame = FALSE; int sverr, cmd = FALSE, GotFrame = FALSE;
int blklen = 0, c, Found = FALSE; int blklen = 0, c, Found = FALSE;
unsigned short header = 0; unsigned short header = 0;
char *rname, *lname; char *rname, *lname, *gname;
long rsize, roffs, lsize; long rsize, roffs, lsize, gsize, goffset;
time_t rtime, ltime; time_t rtime, ltime, gtime;
off_t rxbytes; off_t rxbytes;
long written; long written;
binkp_list *bll = NULL, *tmp, *cursend = NULL; binkp_list *bll = NULL, *tmp, *tmpg, *cursend = NULL;
file_list *tsl; file_list *tsl;
batchnr++; batchnr++;
@ -830,6 +830,7 @@ int binkp_batch(file_list *to_send)
rxbuf = calloc(MAX_BLKSIZE + 3, sizeof(unsigned char)); rxbuf = calloc(MAX_BLKSIZE + 3, sizeof(unsigned char));
rname = calloc(512, sizeof(char)); rname = calloc(512, sizeof(char));
lname = calloc(512, sizeof(char)); lname = calloc(512, sizeof(char));
gname = calloc(512, sizeof(char));
TfState = Switch; TfState = Switch;
RxState = RxWaitFile; RxState = RxWaitFile;
TxState = TxGetNextFile; TxState = TxGetNextFile;
@ -1064,9 +1065,19 @@ int binkp_batch(file_list *to_send)
break; break;
case MM_SKIP: Syslog('+', "Got SKIP frame"); case MM_SKIP: Syslog('+', "Got SKIP frame");
Syslogp('+', printable(rxbuf+1, 0));
break; break;
case MM_GET: Syslog('+', "Got GET frame"); case MM_GET: Syslog('+', "Got GET frame");
sscanf(rxbuf+1, "%s %ld %ld %ld", gname, &gsize, &gtime, &goffset);
for (tmpg = bll; tmpg; tmpg = tmpg->next) {
if (strcasecmp(tmpg->remote, gname) == 0) {
tmpg->state = NoState;
tmpg->offset = goffset;
Syslog('+', "Remote wants %s again, offset %ld", gname, goffset);
TxState = TxGetNextFile;
}
}
break; break;
case MM_GOT: sscanf(rxbuf+1, "%s %ld %ld", lname, &lsize, &ltime); case MM_GOT: sscanf(rxbuf+1, "%s %ld %ld", lname, &lsize, &ltime);
@ -1074,8 +1085,7 @@ int binkp_batch(file_list *to_send)
for (tmp = bll; tmp; tmp = tmp->next) for (tmp = bll; tmp; tmp = tmp->next)
if ((strcmp(lname, tmp->remote) == 0) && if ((strcmp(lname, tmp->remote) == 0) &&
(lsize == tmp->size) && (ltime == tmp->date)) { (lsize == tmp->size) && (ltime == tmp->date)) {
Syslog('+', "Binkp: remote GOT \"%s\"", Syslog('+', "Binkp: remote GOT \"%s\"", tmp->remote);
tmp->remote);
tmp->state = Got; tmp->state = Got;
Found = TRUE; Found = TRUE;
} }
@ -1217,6 +1227,7 @@ int binkp_batch(file_list *to_send)
free(rxbuf); free(rxbuf);
free(rname); free(rname);
free(lname); free(lname);
free(gname);
Syslog('+', "Binkp: batch %d completed rc=%d", batchnr, rc); Syslog('+', "Binkp: batch %d completed rc=%d", batchnr, rc);
return rc; return rc;
} }