From bc7be1fb3b6263dc5d987516554c586733d21356 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Sun, 25 Jan 2004 15:16:11 +0000 Subject: [PATCH] Added binkp PLZ option for test --- ChangeLog | 3 +++ mbcico/binkp.c | 19 +++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6105863a..d7abfa02 100644 --- a/ChangeLog +++ b/ChangeLog @@ -35,6 +35,9 @@ v0.39.7 14-Jan-2004 session close delay time. During binkp handshake increased the timer of the receiver to avoid handshake timeouts. + Added PLZ compression option to binkp. Not yet 100% finished + but it seems to work. Not yet tested against latest Radius beta. + Be carefull! mbfido: Removed sync calls that are now in execute. diff --git a/mbcico/binkp.c b/mbcico/binkp.c index 98ece4a5..c80dcc0f 100644 --- a/mbcico/binkp.c +++ b/mbcico/binkp.c @@ -1892,6 +1892,7 @@ void parse_m_nul(char *msg) * 0 = Nothing yet * 1 = Got a frame * 2 = Frame not processed + * 3 = Uncompress error */ int binkp_poll_frame(void) { @@ -1950,13 +1951,19 @@ int binkp_poll_frame(void) if (plz) { Syslog('b', "Binkp: rcvd compressed block %d bytes", bp.rxlen -1); zbuf = calloc(BINKP_ZIPBUFLEN, sizeof(char)); - memmove(zbuf, bp.rxbuf, bp.rxlen -1); - zlen = 0; - rc = uncompress(bp.rxbuf, &zlen, zbuf, bp.rxlen -1); - free(zbuf); + rc = uncompress(zbuf, &zlen, bp.rxbuf, bp.rxlen -1); Syslog('b', "Binkp: uncompress rc=%d %d => %d", rc, bp.rxlen -1, zlen); - bp.rxlen = zlen +1; - bp.blklen = zlen; + if (rc == Z_OK) { + bp.rxcompressed = (zlen - (bp.rxlen -1)); + memmove(bp.rxbuf, zbuf, zlen); + bp.rxlen = zlen +1; + bp.blklen = zlen; + } else { + free(zbuf); + Syslog('!', "Binkp: uncompress error"); + return 3; + } + free(zbuf); } #endif Syslog('b', "Binkp: bp.rxlen=%d bp.blklen=%d", bp.rxlen, bp.blklen);