COMPRESS(3)

NAME
compress - compress and decompress a PGP packet

SYNOPSIS
#include <pgplib.h>
#include <zlib.h>
int
compress_buffer(u_char *in, int inlen, u_char **out, int *outlen);
int
decompress_buffer(u_char *in, int inlen, u_char **out, int *outlen);

DESCRIPTION
The buffer specified by in (which is inlen bytes long), is compressed (or decompressed) and the result written into allocated memory returned in out which is (at least) outlen bytes long. The memory is allocated by means of malloc and the caller is responsible for freeing it. When compressing, in addition to the actual compression, a PGP packet is also created. When decompressing, the buffer pointed to by in must be compatible with RFC1991.

Compression and decompression is actually done by zlib.

RETURN VALUES
If no errors occurs, 0 is returned, On failure, -1 is returned.

SEE ALSO
free(3) malloc(3) PGPlib(3)

BUGS
compress_buffer() will actually compress anything, not only PGP packets. This should be changed. PGPlib also has a function decompress_file() in order to gracefully handle files. It should not be used since it leaves data on disk (as PGP does).

HISTORY
Written by Tage Stabell-Kulų. First appeared in PGPlib 0.1

STANDARDS
The packet in out will be compatible with RFC1991. Compression is done as specified in RFC1950, RFC1951, and RFC1952 (zlib format).