Binkp compression GZ and BZ2 depends on configure --enable-experiment
This commit is contained in:
parent
28161e0997
commit
6361b47af5
@ -11,6 +11,8 @@ v0.71.5 18-Aug-2005
|
|||||||
Only disallow GZ/BZ2 compression by default if both zlib and
|
Only disallow GZ/BZ2 compression by default if both zlib and
|
||||||
bzlib are not present.
|
bzlib are not present.
|
||||||
Fixed crash on received m_get command.
|
Fixed crash on received m_get command.
|
||||||
|
The binkp compression methods FZ and BZ2 are only compiled in
|
||||||
|
if configured with --enable-experiment.
|
||||||
|
|
||||||
mbfido:
|
mbfido:
|
||||||
Removed debug logging for solved crash.
|
Removed debug logging for solved crash.
|
||||||
|
102
mbcico/binkp.c
102
mbcico/binkp.c
@ -83,12 +83,18 @@ typedef enum {Ok, Failure, Continue} TrType;
|
|||||||
typedef enum {No, WeCan, WeWant, TheyWant, Active} OptionState;
|
typedef enum {No, WeCan, WeWant, TheyWant, Active} OptionState;
|
||||||
typedef enum {NoState, Sending, IsSent, Got, Skipped, Get} FileState;
|
typedef enum {NoState, Sending, IsSent, Got, Skipped, Get} FileState;
|
||||||
typedef enum {InitTransfer, Switch, Receive, Transmit, DeinitTransfer} FtType;
|
typedef enum {InitTransfer, Switch, Receive, Transmit, DeinitTransfer} FtType;
|
||||||
|
#ifdef USE_EXPERIMENT
|
||||||
typedef enum {CompNone, CompGZ, CompBZ2, CompPLZ} CompType;
|
typedef enum {CompNone, CompGZ, CompBZ2, CompPLZ} CompType;
|
||||||
|
#else
|
||||||
|
typedef enum {CompNone, CompPLZ} CompType;
|
||||||
|
#endif
|
||||||
|
|
||||||
static char *rxstate[] = { (char *)"RxWaitF", (char *)"RxAccF", (char *)"RxReceD",
|
static char *rxstate[] = { (char *)"RxWaitF", (char *)"RxAccF", (char *)"RxReceD",
|
||||||
(char *)"RxWriteD", (char *)"RxEOB", (char *)"RxDone" };
|
(char *)"RxWriteD", (char *)"RxEOB", (char *)"RxDone" };
|
||||||
static char *opstate[] = { (char *)"No", (char *)"WeCan", (char *)"WeWant", (char *)"TheyWant", (char *)"Active" };
|
static char *opstate[] = { (char *)"No", (char *)"WeCan", (char *)"WeWant", (char *)"TheyWant", (char *)"Active" };
|
||||||
|
#ifdef USE_EXPERIMENT
|
||||||
static char *cpstate[] = { (char *)"No", (char *)"GZ", (char *)"BZ2", (char *)"PLZ" };
|
static char *cpstate[] = { (char *)"No", (char *)"GZ", (char *)"BZ2", (char *)"PLZ" };
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static time_t Timer;
|
static time_t Timer;
|
||||||
@ -106,6 +112,7 @@ struct timeval rxtvstart; /* Receiver start time */
|
|||||||
struct timeval rxtvend; /* Receiver end time */
|
struct timeval rxtvend; /* Receiver end time */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef USE_EXPERIMENT
|
||||||
#if defined(HAVE_ZLIB_H) || defined(HAVE_BZLIB_H)
|
#if defined(HAVE_ZLIB_H) || defined(HAVE_BZLIB_H)
|
||||||
|
|
||||||
int compress_init(int type);
|
int compress_init(int type);
|
||||||
@ -120,6 +127,7 @@ int decompress_abort(int type, void *data);
|
|||||||
#define ZBLKSIZE 1024 /* read/write file buffer size */
|
#define ZBLKSIZE 1024 /* read/write file buffer size */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
struct binkprec {
|
struct binkprec {
|
||||||
@ -155,7 +163,9 @@ struct binkprec {
|
|||||||
int rxpos; /* Receiver position */
|
int rxpos; /* Receiver position */
|
||||||
int rxcompressed; /* Receiver compressed bytes */
|
int rxcompressed; /* Receiver compressed bytes */
|
||||||
char *ropts; /* Receiver M_FILE optional args */
|
char *ropts; /* Receiver M_FILE optional args */
|
||||||
|
#ifdef USE_EXPERIMENT
|
||||||
int rmode; /* Receiver compression mode */
|
int rmode; /* Receiver compression mode */
|
||||||
|
#endif
|
||||||
|
|
||||||
struct timezone tz; /* Timezone */
|
struct timezone tz; /* Timezone */
|
||||||
int DidSendGET; /* Receiver send GET status */
|
int DidSendGET; /* Receiver send GET status */
|
||||||
@ -166,7 +176,9 @@ struct binkprec {
|
|||||||
int txpos; /* Transmitter position */
|
int txpos; /* Transmitter position */
|
||||||
int stxpos; /* Transmitter start position */
|
int stxpos; /* Transmitter start position */
|
||||||
int txcompressed; /* Transmitter compressed bytes */
|
int txcompressed; /* Transmitter compressed bytes */
|
||||||
|
#ifdef USE_EXPERIMENT
|
||||||
int tmode; /* Transmitter compression mode */
|
int tmode; /* Transmitter compression mode */
|
||||||
|
#endif
|
||||||
long tfsize; /* Transmitter filesize */
|
long tfsize; /* Transmitter filesize */
|
||||||
|
|
||||||
int local_EOB; /* Local EOB sent */
|
int local_EOB; /* Local EOB sent */
|
||||||
@ -181,6 +193,7 @@ struct binkprec {
|
|||||||
int buggyIrex; /* Buggy Irex detected */
|
int buggyIrex; /* Buggy Irex detected */
|
||||||
|
|
||||||
int txcpos; /* Transmitter compressed position */
|
int txcpos; /* Transmitter compressed position */
|
||||||
|
#ifdef USE_EXPERIMENT
|
||||||
#if defined(HAVE_ZLIB_H) || defined(HAVE_BZLIB2_H)
|
#if defined(HAVE_ZLIB_H) || defined(HAVE_BZLIB2_H)
|
||||||
int extcmd; /* EXTCMD flag */
|
int extcmd; /* EXTCMD flag */
|
||||||
#endif
|
#endif
|
||||||
@ -190,12 +203,15 @@ struct binkprec {
|
|||||||
#ifdef HAVE_BZLIB_H
|
#ifdef HAVE_BZLIB_H
|
||||||
int BZ2flag; /* BZ2 compression flag */
|
int BZ2flag; /* BZ2 compression flag */
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef USE_EXPERIMENT
|
||||||
void *z_idata = NULL; /* Data for zstream */
|
void *z_idata = NULL; /* Data for zstream */
|
||||||
void *z_odata = NULL; /* Data for zstream */
|
void *z_odata = NULL; /* Data for zstream */
|
||||||
char *z_obuf; /* Compression buffer */
|
char *z_obuf; /* Compression buffer */
|
||||||
|
#endif
|
||||||
|
|
||||||
struct binkprec bp; /* Global structure */
|
struct binkprec bp; /* Global structure */
|
||||||
|
|
||||||
@ -260,19 +276,23 @@ int binkp(int role)
|
|||||||
bp.PLZflag = No;
|
bp.PLZflag = No;
|
||||||
else
|
else
|
||||||
bp.PLZflag = WeCan;
|
bp.PLZflag = WeCan;
|
||||||
|
#ifdef USE_EXPERIMENT
|
||||||
z_obuf = calloc(MAX_BLKSIZE + 3, sizeof(unsigned char));
|
z_obuf = calloc(MAX_BLKSIZE + 3, sizeof(unsigned char));
|
||||||
if (localoptions & NOGZBZ2)
|
if (localoptions & NOGZBZ2)
|
||||||
bp.GZflag = No;
|
bp.GZflag = No;
|
||||||
else
|
else
|
||||||
bp.GZflag = WeCan;
|
bp.GZflag = WeCan;
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
bp.PLZflag = No;
|
bp.PLZflag = No;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef USE_EXPERIMENT
|
||||||
#ifdef HAVE_BZLIB_H
|
#ifdef HAVE_BZLIB_H
|
||||||
if (localoptions & NOGZBZ2)
|
if (localoptions & NOGZBZ2)
|
||||||
bp.BZ2flag = No;
|
bp.BZ2flag = No;
|
||||||
else
|
else
|
||||||
bp.BZ2flag = WeCan;
|
bp.BZ2flag = WeCan;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
bp.buggyIrex = FALSE;
|
bp.buggyIrex = FALSE;
|
||||||
|
|
||||||
@ -319,6 +339,7 @@ binkpend:
|
|||||||
free(bp.txbuf);
|
free(bp.txbuf);
|
||||||
if (bp.ropts)
|
if (bp.ropts)
|
||||||
free(bp.ropts);
|
free(bp.ropts);
|
||||||
|
#ifdef USE_EXPERIMENT
|
||||||
#if defined(HAVE_ZLIB_H) || defined(HAVE_BZLIB_H)
|
#if defined(HAVE_ZLIB_H) || defined(HAVE_BZLIB_H)
|
||||||
if ((bp.rmode != CompNone) && z_idata)
|
if ((bp.rmode != CompNone) && z_idata)
|
||||||
decompress_deinit(bp.rmode, z_idata);
|
decompress_deinit(bp.rmode, z_idata);
|
||||||
@ -326,6 +347,7 @@ binkpend:
|
|||||||
compress_deinit(bp.tmode, z_odata);
|
compress_deinit(bp.tmode, z_odata);
|
||||||
if (z_obuf)
|
if (z_obuf)
|
||||||
free(z_obuf);
|
free(z_obuf);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
rc = abs(rc);
|
rc = abs(rc);
|
||||||
|
|
||||||
@ -599,6 +621,7 @@ SM_STATE(WaitOk)
|
|||||||
SM_STATE(Opts)
|
SM_STATE(Opts)
|
||||||
|
|
||||||
IsDoing("Binkp to %s", ascfnode(remote->addr, 0xf));
|
IsDoing("Binkp to %s", ascfnode(remote->addr, 0xf));
|
||||||
|
#ifdef USE_EXPERIMENT
|
||||||
Syslog('b', "Binkp: check for extcmd, current %d", bp.extcmd);
|
Syslog('b', "Binkp: check for extcmd, current %d", bp.extcmd);
|
||||||
if (bp.extcmd) {
|
if (bp.extcmd) {
|
||||||
#ifdef HAVE_BZLIB_H
|
#ifdef HAVE_BZLIB_H
|
||||||
@ -614,6 +637,7 @@ SM_STATE(Opts)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#ifdef HAVE_ZLIB_H
|
#ifdef HAVE_ZLIB_H
|
||||||
if (bp.PLZflag == TheyWant) {
|
if (bp.PLZflag == TheyWant) {
|
||||||
bp.PLZflag = Active;
|
bp.PLZflag = Active;
|
||||||
@ -891,6 +915,8 @@ SM_STATE(PwdAck)
|
|||||||
SM_STATE(Opts)
|
SM_STATE(Opts)
|
||||||
|
|
||||||
IsDoing("Binkp from %s", ascfnode(remote->addr, 0xf));
|
IsDoing("Binkp from %s", ascfnode(remote->addr, 0xf));
|
||||||
|
|
||||||
|
#ifdef USE_EXPERIMENT
|
||||||
Syslog('b', "Binkp: check for extcmd, current %d", bp.extcmd);
|
Syslog('b', "Binkp: check for extcmd, current %d", bp.extcmd);
|
||||||
if (bp.extcmd) {
|
if (bp.extcmd) {
|
||||||
|
|
||||||
@ -914,6 +940,8 @@ SM_STATE(Opts)
|
|||||||
bp.BZ2flag = No;
|
bp.BZ2flag = No;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_ZLIB_H
|
#ifdef HAVE_ZLIB_H
|
||||||
if (bp.PLZflag == TheyWant) {
|
if (bp.PLZflag == TheyWant) {
|
||||||
bp.PLZflag = Active;
|
bp.PLZflag = Active;
|
||||||
@ -1032,13 +1060,15 @@ int file_transfer(void)
|
|||||||
|
|
||||||
TrType binkp_receiver(void)
|
TrType binkp_receiver(void)
|
||||||
{
|
{
|
||||||
int bcmd, rc = 0;
|
|
||||||
struct statfs sfs;
|
struct statfs sfs;
|
||||||
long written;
|
long written;
|
||||||
off_t rxbytes;
|
off_t rxbytes;
|
||||||
int rc1 = 0, nget = bp.blklen, zavail, nput;
|
int bcmd, rc = 0;
|
||||||
char zbuf[ZBLKSIZE];
|
#ifdef USE_EXPERIMENT
|
||||||
char *buf = bp.rxbuf;
|
int rc1 = 0, nget = bp.blklen, zavail, nput;
|
||||||
|
char zbuf[ZBLKSIZE];
|
||||||
|
char *buf = bp.rxbuf;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (bp.RxState == RxWaitF) {
|
if (bp.RxState == RxWaitF) {
|
||||||
|
|
||||||
@ -1106,22 +1136,26 @@ TrType binkp_receiver(void)
|
|||||||
}
|
}
|
||||||
} else if (bp.RxState == RxAccF) {
|
} else if (bp.RxState == RxAccF) {
|
||||||
|
|
||||||
|
#ifdef USE_EXPERIMENT
|
||||||
if (((bp.rmode == CompGZ) || (bp.rmode == CompBZ2)) && z_idata) {
|
if (((bp.rmode == CompGZ) || (bp.rmode == CompBZ2)) && z_idata) {
|
||||||
decompress_deinit(bp.rmode, z_idata);
|
decompress_deinit(bp.rmode, z_idata);
|
||||||
z_idata = NULL;
|
z_idata = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bp.rmode = CompNone;
|
bp.rmode = CompNone;
|
||||||
|
#endif
|
||||||
if (strlen(bp.rxbuf) < 512) {
|
if (strlen(bp.rxbuf) < 512) {
|
||||||
snprintf(bp.rname, 512, "%s", strtok(bp.rxbuf+1, " \n\r"));
|
snprintf(bp.rname, 512, "%s", strtok(bp.rxbuf+1, " \n\r"));
|
||||||
bp.rsize = atoi(strtok(NULL, " \n\r"));
|
bp.rsize = atoi(strtok(NULL, " \n\r"));
|
||||||
bp.rtime = atoi(strtok(NULL, " \n\r"));
|
bp.rtime = atoi(strtok(NULL, " \n\r"));
|
||||||
bp.roffs = atoi(strtok(NULL, " \n\r"));
|
bp.roffs = atoi(strtok(NULL, " \n\r"));
|
||||||
snprintf(bp.ropts, 512, "%s", printable(strtok(NULL, " \n\r\0"), 0));
|
snprintf(bp.ropts, 512, "%s", printable(strtok(NULL, " \n\r\0"), 0));
|
||||||
|
#ifdef USE_EXPERIMENT
|
||||||
if (strcmp((char *)"GZ", bp.ropts) == 0)
|
if (strcmp((char *)"GZ", bp.ropts) == 0)
|
||||||
bp.rmode = CompGZ;
|
bp.rmode = CompGZ;
|
||||||
else if (strcmp((char *)"BZ2", bp.ropts) == 0)
|
else if (strcmp((char *)"BZ2", bp.ropts) == 0)
|
||||||
bp.rmode = CompBZ2;
|
bp.rmode = CompBZ2;
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* Corrupted command, in case this was serious, send the M_GOT back so it's
|
* Corrupted command, in case this was serious, send the M_GOT back so it's
|
||||||
@ -1135,8 +1169,13 @@ TrType binkp_receiver(void)
|
|||||||
else
|
else
|
||||||
return Ok;
|
return Ok;
|
||||||
}
|
}
|
||||||
|
#ifdef USE_EXPERIMENT
|
||||||
Syslog('+', "Binkp: receive file \"%s\" date %s size %ld offset %ld comp %s",
|
Syslog('+', "Binkp: receive file \"%s\" date %s size %ld offset %ld comp %s",
|
||||||
bp.rname, date(bp.rtime), bp.rsize, bp.roffs, cpstate[bp.rmode]);
|
bp.rname, date(bp.rtime), bp.rsize, bp.roffs, cpstate[bp.rmode]);
|
||||||
|
#else
|
||||||
|
Syslog('+', "Binkp: receive file \"%s\" date %s size %ld offset %ld",
|
||||||
|
bp.rname, date(bp.rtime), bp.rsize, bp.roffs);
|
||||||
|
#endif
|
||||||
(void)binkp2unix(bp.rname);
|
(void)binkp2unix(bp.rname);
|
||||||
rxbytes = bp.rxbytes;
|
rxbytes = bp.rxbytes;
|
||||||
bp.rxfp = openfile(binkp2unix(bp.rname), bp.rtime, bp.rsize, &rxbytes, binkp_resync);
|
bp.rxfp = openfile(binkp2unix(bp.rname), bp.rtime, bp.rsize, &rxbytes, binkp_resync);
|
||||||
@ -1261,6 +1300,7 @@ TrType binkp_receiver(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
written = 0;
|
written = 0;
|
||||||
|
#ifdef USE_EXPERIMENT
|
||||||
if ((bp.rmode == CompBZ2) || (bp.rmode == CompGZ)) {
|
if ((bp.rmode == CompBZ2) || (bp.rmode == CompGZ)) {
|
||||||
/*
|
/*
|
||||||
* Receive stream compressed data
|
* Receive stream compressed data
|
||||||
@ -1304,8 +1344,11 @@ TrType binkp_receiver(void)
|
|||||||
z_idata = NULL;
|
z_idata = NULL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
#endif
|
||||||
written = fwrite(bp.rxbuf, 1, bp.blklen, bp.rxfp);
|
written = fwrite(bp.rxbuf, 1, bp.blklen, bp.rxfp);
|
||||||
|
#ifdef USE_EXPERIMENT
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bp.GotFrame = FALSE;
|
bp.GotFrame = FALSE;
|
||||||
bp.rxlen = 0;
|
bp.rxlen = 0;
|
||||||
@ -1394,8 +1437,12 @@ TrType binkp_receiver(void)
|
|||||||
|
|
||||||
TrType binkp_transmitter(void)
|
TrType binkp_transmitter(void)
|
||||||
{
|
{
|
||||||
int rc = 0, eof = FALSE, sz, rc1 = 0;
|
int rc = 0, eof = FALSE;
|
||||||
char *nonhold_mail, *extra;
|
#ifdef USE_EXPERIMENT
|
||||||
|
int sz, rc1 = 0;
|
||||||
|
char *extra;
|
||||||
|
#endif
|
||||||
|
char *nonhold_mail;
|
||||||
fa_list *eff_remote;
|
fa_list *eff_remote;
|
||||||
file_list *tsl;
|
file_list *tsl;
|
||||||
static binkp_list *tmp;
|
static binkp_list *tmp;
|
||||||
@ -1473,6 +1520,7 @@ TrType binkp_transmitter(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef USE_EXPERIMENT
|
||||||
bp.tmode = CompNone;
|
bp.tmode = CompNone;
|
||||||
extra = (char *)"";
|
extra = (char *)"";
|
||||||
|
|
||||||
@ -1491,15 +1539,23 @@ TrType binkp_transmitter(void)
|
|||||||
Syslog('b', "Binkp: compress_init ok, extra=%s", extra);
|
Syslog('b', "Binkp: compress_init ok, extra=%s", extra);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bp.txpos = bp.txcpos = bp.stxpos = tmp->offset;
|
bp.txpos = bp.txcpos = bp.stxpos = tmp->offset;
|
||||||
bp.txcompressed = 0;
|
bp.txcompressed = 0;
|
||||||
bp.tfsize = tmp->size;
|
bp.tfsize = tmp->size;
|
||||||
Syslog('+', "Binkp: send \"%s\" as \"%s\"", MBSE_SS(tmp->local), MBSE_SS(tmp->remote));
|
Syslog('+', "Binkp: send \"%s\" as \"%s\"", MBSE_SS(tmp->local), MBSE_SS(tmp->remote));
|
||||||
|
#ifdef USE_EXPERIMENT
|
||||||
Syslog('+', "Binkp: size %lu bytes, dated %s, comp %s",
|
Syslog('+', "Binkp: size %lu bytes, dated %s, comp %s",
|
||||||
(unsigned long)tmp->size, date(tmp->date), cpstate[bp.tmode]);
|
(unsigned long)tmp->size, date(tmp->date), cpstate[bp.tmode]);
|
||||||
rc = binkp_send_command(MM_FILE, "%s %lu %ld %ld%s", MBSE_SS(tmp->remote),
|
rc = binkp_send_command(MM_FILE, "%s %lu %ld %ld%s", MBSE_SS(tmp->remote),
|
||||||
(unsigned long)tmp->size, (long)tmp->date, (unsigned long)tmp->offset, extra);
|
(unsigned long)tmp->size, (long)tmp->date, (unsigned long)tmp->offset, extra);
|
||||||
|
#else
|
||||||
|
Syslog('+', "Binkp: size %lu bytes, dated %s",
|
||||||
|
(unsigned long)tmp->size, date(tmp->date));
|
||||||
|
rc = binkp_send_command(MM_FILE, "%s %lu %ld %ld", MBSE_SS(tmp->remote),
|
||||||
|
(unsigned long)tmp->size, (long)tmp->date, (unsigned long)tmp->offset);
|
||||||
|
#endif
|
||||||
if (rc) {
|
if (rc) {
|
||||||
bp.TxState = TxDone;
|
bp.TxState = TxDone;
|
||||||
return Failure;
|
return Failure;
|
||||||
@ -1541,7 +1597,7 @@ TrType binkp_transmitter(void)
|
|||||||
} else if (bp.TxState == TxReadS) {
|
} else if (bp.TxState == TxReadS) {
|
||||||
|
|
||||||
bp.TxState = TxTryR;
|
bp.TxState = TxTryR;
|
||||||
|
#ifdef USE_EXPERIMENT
|
||||||
#if defined(HAVE_ZLIB_H) || defined(HAVE_BZLIB_H)
|
#if defined(HAVE_ZLIB_H) || defined(HAVE_BZLIB_H)
|
||||||
if ((bp.tmode == CompBZ2) || (bp.tmode == CompGZ)) {
|
if ((bp.tmode == CompBZ2) || (bp.tmode == CompGZ)) {
|
||||||
int nput = 0; /* number of compressed bytes */
|
int nput = 0; /* number of compressed bytes */
|
||||||
@ -1594,6 +1650,7 @@ TrType binkp_transmitter(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* Send uncompressed block
|
* Send uncompressed block
|
||||||
@ -1615,8 +1672,10 @@ TrType binkp_transmitter(void)
|
|||||||
return Failure;
|
return Failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef USE_EXPERIMENT
|
||||||
#if defined(HAVE_ZLIB_H) || defined(HAVE_BZLIB_H)
|
#if defined(HAVE_ZLIB_H) || defined(HAVE_BZLIB_H)
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((bp.txlen == 0) || eof) {
|
if ((bp.txlen == 0) || eof) {
|
||||||
@ -1643,12 +1702,14 @@ TrType binkp_transmitter(void)
|
|||||||
Syslog('+', "Binkp: transmitter skipped file after %ld seconds", txtvend.tv_sec - txtvstart.tv_sec);
|
Syslog('+', "Binkp: transmitter skipped file after %ld seconds", txtvend.tv_sec - txtvstart.tv_sec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef USE_EXPERIMENT
|
||||||
if ((bp.tmode == CompBZ2) || (bp.tmode == CompGZ)) {
|
if ((bp.tmode == CompBZ2) || (bp.tmode == CompGZ)) {
|
||||||
compress_deinit(bp.tmode, z_odata);
|
compress_deinit(bp.tmode, z_odata);
|
||||||
z_odata = NULL;
|
z_odata = NULL;
|
||||||
bp.tmode = CompNone;
|
bp.tmode = CompNone;
|
||||||
Syslog('b', "Binkp: compress_deinit done");
|
Syslog('b', "Binkp: compress_deinit done");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
cursend->state = IsSent;
|
cursend->state = IsSent;
|
||||||
cursend = NULL;
|
cursend = NULL;
|
||||||
@ -1781,7 +1842,11 @@ int binkp_send_frame(int cmd, char *buf, int len)
|
|||||||
* might send some blocks compressed. The receiver needs to deal
|
* might send some blocks compressed. The receiver needs to deal
|
||||||
* with this if it showed PLZ, GZ and BZ2 options.
|
* with this if it showed PLZ, GZ and BZ2 options.
|
||||||
*/
|
*/
|
||||||
|
#ifdef USE_EXPERIMENT
|
||||||
if ((bp.PLZflag == Active) && (len > 20) && (!cmd) && (bp.tmode != CompGZ) && (bp.tmode != CompBZ2)) {
|
if ((bp.PLZflag == Active) && (len > 20) && (!cmd) && (bp.tmode != CompGZ) && (bp.tmode != CompBZ2)) {
|
||||||
|
#else
|
||||||
|
if ((bp.PLZflag == Active) && (len > 20) && (!cmd)) {
|
||||||
|
#endif
|
||||||
zbuf = calloc(BINKP_ZIPBUFLEN, sizeof(char));
|
zbuf = calloc(BINKP_ZIPBUFLEN, sizeof(char));
|
||||||
zlen = BINKP_PLZ_BLOCK -1;
|
zlen = BINKP_PLZ_BLOCK -1;
|
||||||
rcz = compress2(zbuf, &zlen, buf, len, 9);
|
rcz = compress2(zbuf, &zlen, buf, len, 9);
|
||||||
@ -2080,6 +2145,7 @@ void parse_m_nul(char *msg)
|
|||||||
free(bp.MD_Challenge);
|
free(bp.MD_Challenge);
|
||||||
bp.MD_Challenge = MD_getChallenge(q, NULL);
|
bp.MD_Challenge = MD_getChallenge(q, NULL);
|
||||||
}
|
}
|
||||||
|
#ifdef USE_EXPERIMENT
|
||||||
} else if (strncmp(q, (char *)"EXTCMD", 6) == 0) {
|
} else if (strncmp(q, (char *)"EXTCMD", 6) == 0) {
|
||||||
bp.extcmd = TRUE;
|
bp.extcmd = TRUE;
|
||||||
Syslog('b', "Binkp: remote supports EXTCMD mode");
|
Syslog('b', "Binkp: remote supports EXTCMD mode");
|
||||||
@ -2102,6 +2168,7 @@ void parse_m_nul(char *msg)
|
|||||||
Syslog('b', "GZflag is %s and received GZ option", opstate[bp.GZflag]);
|
Syslog('b', "GZflag is %s and received GZ option", opstate[bp.GZflag]);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#ifdef HAVE_ZLIB_H
|
#ifdef HAVE_ZLIB_H
|
||||||
} else if (strncmp(q, (char *)"PLZ", 3) == 0) {
|
} else if (strncmp(q, (char *)"PLZ", 3) == 0) {
|
||||||
if (bp.PLZflag == WeCan) {
|
if (bp.PLZflag == WeCan) {
|
||||||
@ -2168,7 +2235,11 @@ int binkp_poll_frame(void)
|
|||||||
if (bp.rxlen == 1) {
|
if (bp.rxlen == 1) {
|
||||||
bp.cmd = bp.header & BINKP_CONTROL_BLOCK;
|
bp.cmd = bp.header & BINKP_CONTROL_BLOCK;
|
||||||
#ifdef HAVE_ZLIB_H
|
#ifdef HAVE_ZLIB_H
|
||||||
|
#ifdef USE_EXPERIMENT
|
||||||
if ((bp.PLZflag == Active) && (bp.rmode == CompNone)) {
|
if ((bp.PLZflag == Active) && (bp.rmode == CompNone)) {
|
||||||
|
#else
|
||||||
|
if (bp.PLZflag == Active) {
|
||||||
|
#endif
|
||||||
bp.blklen = bp.header & 0x3fff;
|
bp.blklen = bp.header & 0x3fff;
|
||||||
} else {
|
} else {
|
||||||
bp.blklen = bp.header & 0x7fff;
|
bp.blklen = bp.header & 0x7fff;
|
||||||
@ -2183,7 +2254,11 @@ int binkp_poll_frame(void)
|
|||||||
/*
|
/*
|
||||||
* Got a PLZ compressed block
|
* Got a PLZ compressed block
|
||||||
*/
|
*/
|
||||||
|
#ifdef USE_EXPERIMENT
|
||||||
if ((bp.PLZflag == Active) && (bp.header & BINKP_PLZ_BLOCK) && (bp.rmode == CompNone) && bp.blklen) {
|
if ((bp.PLZflag == Active) && (bp.header & BINKP_PLZ_BLOCK) && (bp.rmode == CompNone) && bp.blklen) {
|
||||||
|
#else
|
||||||
|
if ((bp.PLZflag == Active) && (bp.header & BINKP_PLZ_BLOCK) && bp.blklen) {
|
||||||
|
#endif
|
||||||
zbuf = calloc(BINKP_ZIPBUFLEN, sizeof(char));
|
zbuf = calloc(BINKP_ZIPBUFLEN, sizeof(char));
|
||||||
zlen = BINKP_PLZ_BLOCK -1;
|
zlen = BINKP_PLZ_BLOCK -1;
|
||||||
rc = uncompress(zbuf, &zlen, bp.rxbuf, bp.rxlen -1);
|
rc = uncompress(zbuf, &zlen, bp.rxbuf, bp.rxlen -1);
|
||||||
@ -2278,17 +2353,22 @@ int binkp_process_messages(void)
|
|||||||
loffs = atoi(strtok(NULL, " \n\r"));
|
loffs = atoi(strtok(NULL, " \n\r"));
|
||||||
snprintf(ropts, 512, "%s", printable(strtok(NULL, " \n\r\0"), 0));
|
snprintf(ropts, 512, "%s", printable(strtok(NULL, " \n\r\0"), 0));
|
||||||
Syslog('b', "Binkp: m_file options \"%s\"", ropts);
|
Syslog('b', "Binkp: m_file options \"%s\"", ropts);
|
||||||
|
#ifdef USE_EXPERIMENT
|
||||||
if (strcmp((char *)"GZ", ropts) == 0)
|
if (strcmp((char *)"GZ", ropts) == 0)
|
||||||
rmode = CompGZ;
|
rmode = CompGZ;
|
||||||
else if (strcmp((char *)"BZ2", ropts) == 0)
|
else if (strcmp((char *)"BZ2", ropts) == 0)
|
||||||
rmode = CompBZ2;
|
rmode = CompBZ2;
|
||||||
else if (strcmp((char *)"NZ", ropts) == 0) {
|
else
|
||||||
|
#endif
|
||||||
|
if (strcmp((char *)"NZ", ropts) == 0) {
|
||||||
rmode = CompNone;
|
rmode = CompNone;
|
||||||
|
#ifdef USE_EXPERIMENT
|
||||||
#ifdef HAVE_ZLIB_H
|
#ifdef HAVE_ZLIB_H
|
||||||
bp.GZflag = No;
|
bp.GZflag = No;
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_BZLIB_H
|
#ifdef HAVE_BZLIB_H
|
||||||
bp.BZ2flag = No;
|
bp.BZ2flag = No;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
Syslog('+', "Binkp: received NZ on M_GET command, compression turned off");
|
Syslog('+', "Binkp: received NZ on M_GET command, compression turned off");
|
||||||
}
|
}
|
||||||
@ -2584,8 +2664,10 @@ void fill_binkp_list(binkp_list **bkll, file_list *fal, off_t offs)
|
|||||||
binkp_list **tmpl;
|
binkp_list **tmpl;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
struct stat tstat;
|
struct stat tstat;
|
||||||
|
#ifdef USE_EXPERIMENT
|
||||||
int comp;
|
int comp;
|
||||||
char *unp;
|
char *unp;
|
||||||
|
#endif
|
||||||
|
|
||||||
for (tmpl = bkll; *tmpl; tmpl = &((*tmpl)->next));
|
for (tmpl = bkll; *tmpl; tmpl = &((*tmpl)->next));
|
||||||
*tmpl = (binkp_list *)malloc(sizeof(binkp_list));
|
*tmpl = (binkp_list *)malloc(sizeof(binkp_list));
|
||||||
@ -2614,6 +2696,7 @@ void fill_binkp_list(binkp_list **bkll, file_list *fal, off_t offs)
|
|||||||
(*tmpl)->date = tstat.st_mtime;
|
(*tmpl)->date = tstat.st_mtime;
|
||||||
(*tmpl)->compress = CompNone;
|
(*tmpl)->compress = CompNone;
|
||||||
|
|
||||||
|
#ifdef USE_EXPERIMENT
|
||||||
/*
|
/*
|
||||||
* Search compression method, but only if GZ or BZ2 compression is active.
|
* Search compression method, but only if GZ or BZ2 compression is active.
|
||||||
*/
|
*/
|
||||||
@ -2662,6 +2745,7 @@ void fill_binkp_list(binkp_list **bkll, file_list *fal, off_t offs)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
Syslog('+', "Binkp: compressor select internal error");
|
Syslog('+', "Binkp: compressor select internal error");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2711,6 +2795,7 @@ void binkp_clear_filelist(int rc)
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef USE_EXPERIMENT
|
||||||
|
|
||||||
int compress_init(int type)
|
int compress_init(int type)
|
||||||
{
|
{
|
||||||
@ -2957,4 +3042,5 @@ int decompress_abort(int type, void *data)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user