blob: a9d06fc05b5520c1141adc2b9f27c12a2daf0bd4 [file] [log] [blame]
Damien Millerd4a8b7e1999-10-27 13:42:43 +10001/*
Damien Miller95def091999-11-25 00:26:21 +11002 * Author: Tatu Ylonen <ylo@cs.hut.fi>
Damien Miller95def091999-11-25 00:26:21 +11003 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
4 * All rights reserved
Damien Miller95def091999-11-25 00:26:21 +11005 * Interface to packet compression for ssh.
Damien Miller4af51302000-04-16 11:18:38 +10006 *
Damien Millere4340be2000-09-16 13:29:08 +11007 * As far as I am concerned, the code I have written for this software
8 * can be used freely for any purpose. Any derived versions of this
9 * software must be clearly marked as such, and if the derived work is
10 * incompatible with the protocol description in the RFC file, it must be
11 * called by a name other than "ssh" or "Secure Shell".
Damien Miller95def091999-11-25 00:26:21 +110012 */
Damien Millerd4a8b7e1999-10-27 13:42:43 +100013
Ben Lindstrom16ae3d02001-07-04 04:02:36 +000014/* RCSID("$OpenBSD: compress.h,v 1.9 2001/06/26 06:32:50 itojun Exp $"); */
Damien Millerd4a8b7e1999-10-27 13:42:43 +100015
16#ifndef COMPRESS_H
17#define COMPRESS_H
18
Damien Miller5428f641999-11-25 11:54:57 +110019/*
20 * Initializes compression; level is compression level from 1 to 9 (as in
21 * gzip).
22 */
Ben Lindstrom16ae3d02001-07-04 04:02:36 +000023void buffer_compress_init_send(int);
Ben Lindstromfb50cdf2001-04-05 23:20:46 +000024void buffer_compress_init_recv(void);
Damien Millerd4a8b7e1999-10-27 13:42:43 +100025
26/* Frees any data structures allocated by buffer_compress_init. */
Kevin Stevese7652402000-12-28 22:16:00 +000027void buffer_compress_uninit(void);
Damien Millerd4a8b7e1999-10-27 13:42:43 +100028
Damien Miller5428f641999-11-25 11:54:57 +110029/*
30 * Compresses the contents of input_buffer into output_buffer. All packets
31 * compressed using this function will form a single compressed data stream;
32 * however, data will be flushed at the end of every call so that each
33 * output_buffer can be decompressed independently (but in the appropriate
34 * order since they together form a single compression stream) by the
35 * receiver. This appends the compressed data to the output buffer.
36 */
Ben Lindstrom16ae3d02001-07-04 04:02:36 +000037void buffer_compress(Buffer *, Buffer *);
Damien Millerd4a8b7e1999-10-27 13:42:43 +100038
Damien Miller5428f641999-11-25 11:54:57 +110039/*
40 * Uncompresses the contents of input_buffer into output_buffer. All packets
41 * uncompressed using this function will form a single compressed data
42 * stream; however, data will be flushed at the end of every call so that
43 * each output_buffer. This must be called for the same size units that the
44 * buffer_compress was called, and in the same order that buffers compressed
45 * with that. This appends the uncompressed data to the output buffer.
46 */
Ben Lindstrom16ae3d02001-07-04 04:02:36 +000047void buffer_uncompress(Buffer *, Buffer *);
Damien Millerd4a8b7e1999-10-27 13:42:43 +100048
Damien Miller95def091999-11-25 00:26:21 +110049#endif /* COMPRESS_H */