deflate.c (37010) | deflate.c (37019) |
---|---|
1/*- 2 * Copyright (c) 1997 Brian Somers <brian@Awfulhak.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 1997 Brian Somers <brian@Awfulhak.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $Id: deflate.c,v 1.8 1998/05/21 21:45:00 brian Exp $ | 26 * $Id: deflate.c,v 1.9 1998/06/15 19:06:39 brian Exp $ |
27 */ 28 29#include <sys/types.h> 30 31#include <stdio.h> 32#include <stdlib.h> 33#include <zlib.h> 34 --- 73 unchanged lines hidden (view full) --- 108 state->cx.avail_in = mi->cnt; 109 flush = Z_NO_FLUSH; 110 111 olen = 0; 112 while (1) { 113 if ((res = deflate(&state->cx, flush)) != Z_OK) { 114 if (res == Z_STREAM_END) 115 break; /* Done */ | 27 */ 28 29#include <sys/types.h> 30 31#include <stdio.h> 32#include <stdlib.h> 33#include <zlib.h> 34 --- 73 unchanged lines hidden (view full) --- 108 state->cx.avail_in = mi->cnt; 109 flush = Z_NO_FLUSH; 110 111 olen = 0; 112 while (1) { 113 if ((res = deflate(&state->cx, flush)) != Z_OK) { 114 if (res == Z_STREAM_END) 115 break; /* Done */ |
116 log_Printf(LogERROR, "DeflateOutput: deflate returned %d (%s)\n", | 116 log_Printf(LogWARN, "DeflateOutput: deflate returned %d (%s)\n", |
117 res, state->cx.msg ? state->cx.msg : ""); 118 mbuf_Free(mo_head); 119 mbuf_FreeSeg(mi_head); 120 state->seqno--; 121 return 1; /* packet dropped */ 122 } 123 124 if (flush == Z_SYNC_FLUSH && state->cx.avail_out != 0) --- 91 unchanged lines hidden (view full) --- 216 if (seq <= state->uncomp_rec) 217 /* 218 * So the peer's started at zero again - fine ! If we're wrong, 219 * inflate() will fail. This is better than getting into a loop 220 * trying to get a ResetReq to a busy sender. 221 */ 222 state->seqno = seq; 223 else { | 117 res, state->cx.msg ? state->cx.msg : ""); 118 mbuf_Free(mo_head); 119 mbuf_FreeSeg(mi_head); 120 state->seqno--; 121 return 1; /* packet dropped */ 122 } 123 124 if (flush == Z_SYNC_FLUSH && state->cx.avail_out != 0) --- 91 unchanged lines hidden (view full) --- 216 if (seq <= state->uncomp_rec) 217 /* 218 * So the peer's started at zero again - fine ! If we're wrong, 219 * inflate() will fail. This is better than getting into a loop 220 * trying to get a ResetReq to a busy sender. 221 */ 222 state->seqno = seq; 223 else { |
224 log_Printf(LogERROR, "DeflateInput: Seq error: Got %d, expected %d\n", | 224 log_Printf(LogWARN, "DeflateInput: Seq error: Got %d, expected %d\n", |
225 seq, state->seqno); 226 mbuf_Free(mi_head); 227 ccp_SendResetReq(&ccp->fsm); 228 return NULL; 229 } 230 } 231 state->seqno++; 232 state->uncomp_rec = 0; --- 19 unchanged lines hidden (view full) --- 252 flush = mi->next ? Z_NO_FLUSH : Z_SYNC_FLUSH; 253 first = 1; 254 olen = 0; 255 256 while (1) { 257 if ((res = inflate(&state->cx, flush)) != Z_OK) { 258 if (res == Z_STREAM_END) 259 break; /* Done */ | 225 seq, state->seqno); 226 mbuf_Free(mi_head); 227 ccp_SendResetReq(&ccp->fsm); 228 return NULL; 229 } 230 } 231 state->seqno++; 232 state->uncomp_rec = 0; --- 19 unchanged lines hidden (view full) --- 252 flush = mi->next ? Z_NO_FLUSH : Z_SYNC_FLUSH; 253 first = 1; 254 olen = 0; 255 256 while (1) { 257 if ((res = inflate(&state->cx, flush)) != Z_OK) { 258 if (res == Z_STREAM_END) 259 break; /* Done */ |
260 log_Printf(LogERROR, "DeflateInput: inflate returned %d (%s)\n", | 260 log_Printf(LogWARN, "DeflateInput: inflate returned %d (%s)\n", |
261 res, state->cx.msg ? state->cx.msg : ""); 262 mbuf_Free(mo_head); 263 mbuf_Free(mi); 264 ccp_SendResetReq(&ccp->fsm); 265 return NULL; 266 } 267 268 if (flush == Z_SYNC_FLUSH && state->cx.avail_out != 0) --- 27 unchanged lines hidden (view full) --- 296 } 297 } 298 } 299 300 if (mi != NULL) 301 mbuf_Free(mi); 302 303 if (first) { | 261 res, state->cx.msg ? state->cx.msg : ""); 262 mbuf_Free(mo_head); 263 mbuf_Free(mi); 264 ccp_SendResetReq(&ccp->fsm); 265 return NULL; 266 } 267 268 if (flush == Z_SYNC_FLUSH && state->cx.avail_out != 0) --- 27 unchanged lines hidden (view full) --- 296 } 297 } 298 } 299 300 if (mi != NULL) 301 mbuf_Free(mi); 302 303 if (first) { |
304 log_Printf(LogERROR, "DeflateInput: Length error\n"); | 304 log_Printf(LogWARN, "DeflateInput: Length error\n"); |
305 mbuf_Free(mo_head); 306 ccp_SendResetReq(&ccp->fsm); 307 return NULL; 308 } 309 310 olen += (mo->cnt = DEFLATE_CHUNK_LEN - state->cx.avail_out); 311 312 *proto = ((u_short)wp[0] << 8) | wp[1]; --- 280 unchanged lines hidden --- | 305 mbuf_Free(mo_head); 306 ccp_SendResetReq(&ccp->fsm); 307 return NULL; 308 } 309 310 olen += (mo->cnt = DEFLATE_CHUNK_LEN - state->cx.avail_out); 311 312 *proto = ((u_short)wp[0] << 8) | wp[1]; --- 280 unchanged lines hidden --- |