Merge from vendor branch GCC:
[dragonfly.git] / sys / net / ppp_layer / ppp_deflate.c
1 /* $FreeBSD: src/sys/net/ppp_deflate.c,v 1.12.2.1 2002/04/14 21:41:48 luigi Exp $       */
2 /* $DragonFly: src/sys/net/ppp_layer/ppp_deflate.c,v 1.6 2004/06/02 14:42:59 eirikn Exp $       */
3
4 /*
5  * ppp_deflate.c - interface the zlib procedures for Deflate compression
6  * and decompression (as used by gzip) to the PPP code.
7  * This version is for use with mbufs on BSD-derived systems.
8  *
9  * Copyright (c) 1994 The Australian National University.
10  * All rights reserved.
11  *
12  * Permission to use, copy, modify, and distribute this software and its
13  * documentation is hereby granted, provided that the above copyright
14  * notice appears in all copies.  This software is provided without any
15  * warranty, express or implied. The Australian National University
16  * makes no representations about the suitability of this software for
17  * any purpose.
18  *
19  * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
20  * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
21  * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
22  * THE AUSTRALIAN NATIONAL UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY
23  * OF SUCH DAMAGE.
24  *
25  * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
26  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
27  * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
28  * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
29  * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
30  * OR MODIFICATIONS.
31  */
32
33 #include <sys/param.h>
34 #include <sys/systm.h>
35 #include <sys/malloc.h>
36 #include <sys/mbuf.h>
37 #include "ppp_defs.h"
38 #include <net/zlib.h>
39
40 #define PACKETPTR       struct mbuf *
41 #include "ppp_comp.h"
42
43 #if DO_DEFLATE
44
45 #define DEFLATE_DEBUG   1
46
47 /*
48  * State for a Deflate (de)compressor.
49  */
50 struct deflate_state {
51     int         seqno;
52     int         w_size;
53     int         unit;
54     int         hdrlen;
55     int         mru;
56     int         debug;
57     z_stream    strm;
58     struct compstat stats;
59 };
60
61 #define DEFLATE_OVHD    2               /* Deflate overhead/packet */
62
63 static void     *z_alloc (void *, u_int items, u_int size);
64 static void     z_free (void *, void *ptr);
65 static void     *z_comp_alloc (u_char *options, int opt_len);
66 static void     *z_decomp_alloc (u_char *options, int opt_len);
67 static void     z_comp_free (void *state);
68 static void     z_decomp_free (void *state);
69 static int      z_comp_init (void *state, u_char *options, int opt_len,
70                                  int unit, int hdrlen, int debug);
71 static int      z_decomp_init (void *state, u_char *options, int opt_len,
72                                      int unit, int hdrlen, int mru, int debug);
73 static int      z_compress (void *state, struct mbuf **mret,
74                                   struct mbuf *mp, int slen, int maxolen);
75 static void     z_incomp (void *state, struct mbuf *dmsg);
76 static int      z_decompress (void *state, struct mbuf *cmp,
77                                     struct mbuf **dmpp);
78 static void     z_comp_reset (void *state);
79 static void     z_decomp_reset (void *state);
80 static void     z_comp_stats (void *state, struct compstat *stats);
81
82 /*
83  * Procedures exported to if_ppp.c.
84  */
85 struct compressor ppp_deflate = {
86     CI_DEFLATE,                 /* compress_proto */
87     z_comp_alloc,               /* comp_alloc */
88     z_comp_free,                /* comp_free */
89     z_comp_init,                /* comp_init */
90     z_comp_reset,               /* comp_reset */
91     z_compress,                 /* compress */
92     z_comp_stats,               /* comp_stat */
93     z_decomp_alloc,             /* decomp_alloc */
94     z_decomp_free,              /* decomp_free */
95     z_decomp_init,              /* decomp_init */
96     z_decomp_reset,             /* decomp_reset */
97     z_decompress,               /* decompress */
98     z_incomp,                   /* incomp */
99     z_comp_stats,               /* decomp_stat */
100 };
101
102 struct compressor ppp_deflate_draft = {
103     CI_DEFLATE_DRAFT,           /* compress_proto */
104     z_comp_alloc,               /* comp_alloc */
105     z_comp_free,                /* comp_free */
106     z_comp_init,                /* comp_init */
107     z_comp_reset,               /* comp_reset */
108     z_compress,                 /* compress */
109     z_comp_stats,               /* comp_stat */
110     z_decomp_alloc,             /* decomp_alloc */
111     z_decomp_free,              /* decomp_free */
112     z_decomp_init,              /* decomp_init */
113     z_decomp_reset,             /* decomp_reset */
114     z_decompress,               /* decompress */
115     z_incomp,                   /* incomp */
116     z_comp_stats,               /* decomp_stat */
117 };
118
119 /*
120  * Space allocation and freeing routines for use by zlib routines.
121  */
122 void *
123 z_alloc(notused, items, size)
124     void *notused;
125     u_int items, size;
126 {
127     void *ptr;
128
129     MALLOC(ptr, void *, items * size, M_DEVBUF, M_WAITOK);
130     return ptr;
131 }
132
133 void
134 z_free(notused, ptr)
135     void *notused;
136     void *ptr;
137 {
138     free(ptr, M_DEVBUF);
139 }
140
141 /*
142  * Allocate space for a compressor.
143  */
144 static void *
145 z_comp_alloc(options, opt_len)
146     u_char *options;
147     int opt_len;
148 {
149     struct deflate_state *state;
150     int w_size;
151
152     if (opt_len != CILEN_DEFLATE
153         || (options[0] != CI_DEFLATE && options[0] != CI_DEFLATE_DRAFT)
154         || options[1] != CILEN_DEFLATE
155         || DEFLATE_METHOD(options[2]) != DEFLATE_METHOD_VAL
156         || options[3] != DEFLATE_CHK_SEQUENCE)
157         return NULL;
158     w_size = DEFLATE_SIZE(options[2]);
159     if (w_size < DEFLATE_MIN_SIZE || w_size > DEFLATE_MAX_SIZE)
160         return NULL;
161
162     MALLOC(state, struct deflate_state *, sizeof(struct deflate_state),
163            M_DEVBUF, M_WAITOK);
164
165     state->strm.next_in = NULL;
166     state->strm.zalloc = z_alloc;
167     state->strm.zfree = z_free;
168     if (deflateInit2(&state->strm, Z_DEFAULT_COMPRESSION, DEFLATE_METHOD_VAL,
169                      -w_size, 8, Z_DEFAULT_STRATEGY) != Z_OK) {
170         free(state, M_DEVBUF);
171         return NULL;
172     }
173
174     state->w_size = w_size;
175     bzero(&state->stats, sizeof(state->stats));
176     return (void *) state;
177 }
178
179 static void
180 z_comp_free(arg)
181     void *arg;
182 {
183     struct deflate_state *state = (struct deflate_state *) arg;
184
185     deflateEnd(&state->strm);
186     free(state, M_DEVBUF);
187 }
188
189 static int
190 z_comp_init(arg, options, opt_len, unit, hdrlen, debug)
191     void *arg;
192     u_char *options;
193     int opt_len, unit, hdrlen, debug;
194 {
195     struct deflate_state *state = (struct deflate_state *) arg;
196
197     if (opt_len < CILEN_DEFLATE
198         || (options[0] != CI_DEFLATE && options[0] != CI_DEFLATE_DRAFT)
199         || options[1] != CILEN_DEFLATE
200         || DEFLATE_METHOD(options[2]) != DEFLATE_METHOD_VAL
201         || DEFLATE_SIZE(options[2]) != state->w_size
202         || options[3] != DEFLATE_CHK_SEQUENCE)
203         return 0;
204
205     state->seqno = 0;
206     state->unit = unit;
207     state->hdrlen = hdrlen;
208     state->debug = debug;
209
210     deflateReset(&state->strm);
211
212     return 1;
213 }
214
215 static void
216 z_comp_reset(arg)
217     void *arg;
218 {
219     struct deflate_state *state = (struct deflate_state *) arg;
220
221     state->seqno = 0;
222     deflateReset(&state->strm);
223 }
224
225 int
226 z_compress(arg, mret, mp, orig_len, maxolen)
227     void *arg;
228     struct mbuf **mret;         /* compressed packet (out) */
229     struct mbuf *mp;            /* uncompressed packet (in) */
230     int orig_len, maxolen;
231 {
232     struct deflate_state *state = (struct deflate_state *) arg;
233     u_char *rptr, *wptr;
234     int proto, olen, wspace, r, flush;
235     struct mbuf *m;
236
237     /*
238      * Check that the protocol is in the range we handle.
239      */
240     rptr = mtod(mp, u_char *);
241     proto = PPP_PROTOCOL(rptr);
242     if (proto > 0x3fff || proto == 0xfd || proto == 0xfb) {
243         *mret = NULL;
244         return orig_len;
245     }
246
247     /* Allocate one mbuf initially. */
248     if (maxolen > orig_len)
249         maxolen = orig_len;
250     MGET(m, MB_DONTWAIT, MT_DATA);
251     *mret = m;
252     if (m != NULL) {
253         m->m_len = 0;
254         if (maxolen + state->hdrlen > MLEN)
255             MCLGET(m, MB_DONTWAIT);
256         wspace = M_TRAILINGSPACE(m);
257         if (state->hdrlen + PPP_HDRLEN + 2 < wspace) {
258             m->m_data += state->hdrlen;
259             wspace -= state->hdrlen;
260         }
261         wptr = mtod(m, u_char *);
262
263         /*
264          * Copy over the PPP header and store the 2-byte sequence number.
265          */
266         wptr[0] = PPP_ADDRESS(rptr);
267         wptr[1] = PPP_CONTROL(rptr);
268         wptr[2] = PPP_COMP >> 8;
269         wptr[3] = PPP_COMP;
270         wptr += PPP_HDRLEN;
271         wptr[0] = state->seqno >> 8;
272         wptr[1] = state->seqno;
273         wptr += 2;
274         state->strm.next_out = wptr;
275         state->strm.avail_out = wspace - (PPP_HDRLEN + 2);
276     } else {
277         state->strm.next_out = NULL;
278         state->strm.avail_out = 1000000;
279         wptr = NULL;
280         wspace = 0;
281     }
282     ++state->seqno;
283
284     rptr += (proto > 0xff)? 2: 3;       /* skip 1st proto byte if 0 */
285     state->strm.next_in = rptr;
286     state->strm.avail_in = mtod(mp, u_char *) + mp->m_len - rptr;
287     mp = mp->m_next;
288     flush = (mp == NULL)? Z_PACKET_FLUSH: Z_NO_FLUSH;
289     olen = 0;
290     for (;;) {
291         r = deflate(&state->strm, flush);
292         if (r != Z_OK) {
293             printf("z_compress: deflate returned %d (%s)\n",
294                    r, (state->strm.msg? state->strm.msg: ""));
295             break;
296         }
297         if (flush != Z_NO_FLUSH && state->strm.avail_out != 0)
298             break;              /* all done */
299         if (state->strm.avail_in == 0 && mp != NULL) {
300             state->strm.next_in = mtod(mp, u_char *);
301             state->strm.avail_in = mp->m_len;
302             mp = mp->m_next;
303             if (mp == NULL)
304                 flush = Z_PACKET_FLUSH;
305         }
306         if (state->strm.avail_out == 0) {
307             if (m != NULL) {
308                 m->m_len = wspace;
309                 olen += wspace;
310                 MGET(m->m_next, MB_DONTWAIT, MT_DATA);
311                 m = m->m_next;
312                 if (m != NULL) {
313                     m->m_len = 0;
314                     if (maxolen - olen > MLEN)
315                         MCLGET(m, MB_DONTWAIT);
316                     state->strm.next_out = mtod(m, u_char *);
317                     state->strm.avail_out = wspace = M_TRAILINGSPACE(m);
318                 }
319             }
320             if (m == NULL) {
321                 state->strm.next_out = NULL;
322                 state->strm.avail_out = 1000000;
323             }
324         }
325     }
326     if (m != NULL)
327         olen += (m->m_len = wspace - state->strm.avail_out);
328
329     /*
330      * See if we managed to reduce the size of the packet.
331      */
332     if (m != NULL && olen < orig_len) {
333         state->stats.comp_bytes += olen;
334         state->stats.comp_packets++;
335     } else {
336         if (*mret != NULL) {
337             m_freem(*mret);
338             *mret = NULL;
339         }
340         state->stats.inc_bytes += orig_len;
341         state->stats.inc_packets++;
342         olen = orig_len;
343     }
344     state->stats.unc_bytes += orig_len;
345     state->stats.unc_packets++;
346
347     return olen;
348 }
349
350 static void
351 z_comp_stats(arg, stats)
352     void *arg;
353     struct compstat *stats;
354 {
355     struct deflate_state *state = (struct deflate_state *) arg;
356     u_int out;
357
358     *stats = state->stats;
359     stats->ratio = stats->unc_bytes;
360     out = stats->comp_bytes + stats->inc_bytes;
361     if (stats->ratio <= 0x7ffffff)
362         stats->ratio <<= 8;
363     else
364         out >>= 8;
365     if (out != 0)
366         stats->ratio /= out;
367 }
368
369 /*
370  * Allocate space for a decompressor.
371  */
372 static void *
373 z_decomp_alloc(options, opt_len)
374     u_char *options;
375     int opt_len;
376 {
377     struct deflate_state *state;
378     int w_size;
379
380     if (opt_len != CILEN_DEFLATE
381         || (options[0] != CI_DEFLATE && options[0] != CI_DEFLATE_DRAFT)
382         || options[1] != CILEN_DEFLATE
383         || DEFLATE_METHOD(options[2]) != DEFLATE_METHOD_VAL
384         || options[3] != DEFLATE_CHK_SEQUENCE)
385         return NULL;
386     w_size = DEFLATE_SIZE(options[2]);
387     if (w_size < DEFLATE_MIN_SIZE || w_size > DEFLATE_MAX_SIZE)
388         return NULL;
389
390     MALLOC(state, struct deflate_state *, sizeof(struct deflate_state),
391            M_DEVBUF, M_WAITOK);
392
393     state->strm.next_out = NULL;
394     state->strm.zalloc = z_alloc;
395     state->strm.zfree = z_free;
396     if (inflateInit2(&state->strm, -w_size) != Z_OK) {
397         free(state, M_DEVBUF);
398         return NULL;
399     }
400
401     state->w_size = w_size;
402     bzero(&state->stats, sizeof(state->stats));
403     return (void *) state;
404 }
405
406 static void
407 z_decomp_free(arg)
408     void *arg;
409 {
410     struct deflate_state *state = (struct deflate_state *) arg;
411
412     inflateEnd(&state->strm);
413     free(state, M_DEVBUF);
414 }
415
416 static int
417 z_decomp_init(arg, options, opt_len, unit, hdrlen, mru, debug)
418     void *arg;
419     u_char *options;
420     int opt_len, unit, hdrlen, mru, debug;
421 {
422     struct deflate_state *state = (struct deflate_state *) arg;
423
424     if (opt_len < CILEN_DEFLATE
425         || (options[0] != CI_DEFLATE && options[0] != CI_DEFLATE_DRAFT)
426         || options[1] != CILEN_DEFLATE
427         || DEFLATE_METHOD(options[2]) != DEFLATE_METHOD_VAL
428         || DEFLATE_SIZE(options[2]) != state->w_size
429         || options[3] != DEFLATE_CHK_SEQUENCE)
430         return 0;
431
432     state->seqno = 0;
433     state->unit = unit;
434     state->hdrlen = hdrlen;
435     state->debug = debug;
436     state->mru = mru;
437
438     inflateReset(&state->strm);
439
440     return 1;
441 }
442
443 static void
444 z_decomp_reset(arg)
445     void *arg;
446 {
447     struct deflate_state *state = (struct deflate_state *) arg;
448
449     state->seqno = 0;
450     inflateReset(&state->strm);
451 }
452
453 /*
454  * Decompress a Deflate-compressed packet.
455  *
456  * Because of patent problems, we return DECOMP_ERROR for errors
457  * found by inspecting the input data and for system problems, but
458  * DECOMP_FATALERROR for any errors which could possibly be said to
459  * be being detected "after" decompression.  For DECOMP_ERROR,
460  * we can issue a CCP reset-request; for DECOMP_FATALERROR, we may be
461  * infringing a patent of Motorola's if we do, so we take CCP down
462  * instead.
463  *
464  * Given that the frame has the correct sequence number and a good FCS,
465  * errors such as invalid codes in the input most likely indicate a
466  * bug, so we return DECOMP_FATALERROR for them in order to turn off
467  * compression, even though they are detected by inspecting the input.
468  */
469 int
470 z_decompress(arg, mi, mop)
471     void *arg;
472     struct mbuf *mi, **mop;
473 {
474     struct deflate_state *state = (struct deflate_state *) arg;
475     struct mbuf *mo, *mo_head;
476     u_char *rptr, *wptr;
477     int rlen, olen, ospace;
478     int seq, i, flush, r, decode_proto;
479     u_char hdr[PPP_HDRLEN + DEFLATE_OVHD];
480
481     *mop = NULL;
482     rptr = mtod(mi, u_char *);
483     rlen = mi->m_len;
484     for (i = 0; i < PPP_HDRLEN + DEFLATE_OVHD; ++i) {
485         while (rlen <= 0) {
486             mi = mi->m_next;
487             if (mi == NULL)
488                 return DECOMP_ERROR;
489             rptr = mtod(mi, u_char *);
490             rlen = mi->m_len;
491         }
492         hdr[i] = *rptr++;
493         --rlen;
494     }
495
496     /* Check the sequence number. */
497     seq = (hdr[PPP_HDRLEN] << 8) + hdr[PPP_HDRLEN+1];
498     if (seq != state->seqno) {
499         if (state->debug)
500             printf("z_decompress%d: bad seq # %d, expected %d\n",
501                    state->unit, seq, state->seqno);
502         return DECOMP_ERROR;
503     }
504     ++state->seqno;
505
506     /* Allocate an output mbuf. */
507     MGETHDR(mo, MB_DONTWAIT, MT_DATA);
508     if (mo == NULL)
509         return DECOMP_ERROR;
510     mo_head = mo;
511     mo->m_len = 0;
512     mo->m_next = NULL;
513     MCLGET(mo, MB_DONTWAIT);
514     ospace = M_TRAILINGSPACE(mo);
515     if (state->hdrlen + PPP_HDRLEN < ospace) {
516         mo->m_data += state->hdrlen;
517         ospace -= state->hdrlen;
518     }
519
520     /*
521      * Fill in the first part of the PPP header.  The protocol field
522      * comes from the decompressed data.
523      */
524     wptr = mtod(mo, u_char *);
525     wptr[0] = PPP_ADDRESS(hdr);
526     wptr[1] = PPP_CONTROL(hdr);
527     wptr[2] = 0;
528
529     /*
530      * Set up to call inflate.  We set avail_out to 1 initially so we can
531      * look at the first byte of the output and decide whether we have
532      * a 1-byte or 2-byte protocol field.
533      */
534     state->strm.next_in = rptr;
535     state->strm.avail_in = rlen;
536     mi = mi->m_next;
537     flush = (mi == NULL)? Z_PACKET_FLUSH: Z_NO_FLUSH;
538     rlen += PPP_HDRLEN + DEFLATE_OVHD;
539     state->strm.next_out = wptr + 3;
540     state->strm.avail_out = 1;
541     decode_proto = 1;
542     olen = PPP_HDRLEN;
543
544     /*
545      * Call inflate, supplying more input or output as needed.
546      */
547     for (;;) {
548         r = inflate(&state->strm, flush);
549         if (r != Z_OK) {
550 #if !DEFLATE_DEBUG
551             if (state->debug)
552 #endif
553                 printf("z_decompress%d: inflate returned %d (%s)\n",
554                        state->unit, r, (state->strm.msg? state->strm.msg: ""));
555             m_freem(mo_head);
556             return DECOMP_FATALERROR;
557         }
558         if (flush != Z_NO_FLUSH && state->strm.avail_out != 0)
559             break;              /* all done */
560         if (state->strm.avail_in == 0 && mi != NULL) {
561             state->strm.next_in = mtod(mi, u_char *);
562             state->strm.avail_in = mi->m_len;
563             rlen += mi->m_len;
564             mi = mi->m_next;
565             if (mi == NULL)
566                 flush = Z_PACKET_FLUSH;
567         }
568         if (state->strm.avail_out == 0) {
569             if (decode_proto) {
570                 state->strm.avail_out = ospace - PPP_HDRLEN;
571                 if ((wptr[3] & 1) == 0) {
572                     /* 2-byte protocol field */
573                     wptr[2] = wptr[3];
574                     --state->strm.next_out;
575                     ++state->strm.avail_out;
576                     --olen;
577                 }
578                 decode_proto = 0;
579             } else {
580                 mo->m_len = ospace;
581                 olen += ospace;
582                 MGET(mo->m_next, MB_DONTWAIT, MT_DATA);
583                 mo = mo->m_next;
584                 if (mo == NULL) {
585                     m_freem(mo_head);
586                     return DECOMP_ERROR;
587                 }
588                 MCLGET(mo, MB_DONTWAIT);
589                 state->strm.next_out = mtod(mo, u_char *);
590                 state->strm.avail_out = ospace = M_TRAILINGSPACE(mo);
591             }
592         }
593     }
594     if (decode_proto) {
595         m_freem(mo_head);
596         return DECOMP_ERROR;
597     }
598     olen += (mo->m_len = ospace - state->strm.avail_out);
599 #if DEFLATE_DEBUG
600     if (state->debug && olen > state->mru + PPP_HDRLEN)
601         printf("ppp_deflate%d: exceeded mru (%d > %d)\n",
602                state->unit, olen, state->mru + PPP_HDRLEN);
603 #endif
604
605     state->stats.unc_bytes += olen;
606     state->stats.unc_packets++;
607     state->stats.comp_bytes += rlen;
608     state->stats.comp_packets++;
609
610     *mop = mo_head;
611     return DECOMP_OK;
612 }
613
614 /*
615  * Incompressible data has arrived - add it to the history.
616  */
617 static void
618 z_incomp(arg, mi)
619     void *arg;
620     struct mbuf *mi;
621 {
622     struct deflate_state *state = (struct deflate_state *) arg;
623     u_char *rptr;
624     int rlen, proto, r;
625
626     /*
627      * Check that the protocol is one we handle.
628      */
629     rptr = mtod(mi, u_char *);
630     proto = PPP_PROTOCOL(rptr);
631     if (proto > 0x3fff || proto == 0xfd || proto == 0xfb)
632         return;
633
634     ++state->seqno;
635
636     /*
637      * Iterate through the mbufs, adding the characters in them
638      * to the decompressor's history.  For the first mbuf, we start
639      * at the either the 1st or 2nd byte of the protocol field,
640      * depending on whether the protocol value is compressible.
641      */
642     rlen = mi->m_len;
643     state->strm.next_in = rptr + 3;
644     state->strm.avail_in = rlen - 3;
645     if (proto > 0xff) {
646         --state->strm.next_in;
647         ++state->strm.avail_in;
648     }
649     for (;;) {
650         r = inflateIncomp(&state->strm);
651         if (r != Z_OK) {
652             /* gak! */
653 #if !DEFLATE_DEBUG
654             if (state->debug)
655 #endif
656                 printf("z_incomp%d: inflateIncomp returned %d (%s)\n",
657                        state->unit, r, (state->strm.msg? state->strm.msg: ""));
658             return;
659         }
660         mi = mi->m_next;
661         if (mi == NULL)
662             break;
663         state->strm.next_in = mtod(mi, u_char *);
664         state->strm.avail_in = mi->m_len;
665         rlen += mi->m_len;
666     }
667
668     /*
669      * Update stats.
670      */
671     state->stats.inc_bytes += rlen;
672     state->stats.inc_packets++;
673     state->stats.unc_bytes += rlen;
674     state->stats.unc_packets++;
675 }
676
677 #endif /* DO_DEFLATE */