GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: usr.sbin/smtpd/smtpd/../compress_backend.c Lines: 0 7 0.0 %
Date: 2017-11-07 Branches: 0 2 0.0 %

Line Branch Exec Source
1
/*	$OpenBSD: compress_backend.c,v 1.9 2015/01/20 17:37:54 deraadt Exp $	*/
2
3
/*
4
 * Copyright (c) 2012 Charles Longeau <chl@openbsd.org>
5
 * Copyright (c) 2012 Gilles Chehade <gilles@poolp.org>
6
 *
7
 * Permission to use, copy, modify, and distribute this software for any
8
 * purpose with or without fee is hereby granted, provided that the above
9
 * copyright notice and this permission notice appear in all copies.
10
 *
11
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18
 */
19
20
#include <sys/types.h>
21
#include <sys/queue.h>
22
#include <sys/tree.h>
23
#include <sys/socket.h>
24
#include <sys/stat.h>
25
26
#include <imsg.h>
27
#include <stdio.h>
28
#include <stdlib.h>
29
#include <string.h>
30
#include <unistd.h>
31
#include <limits.h>
32
33
#include "smtpd.h"
34
35
#define	BUFFER_SIZE	16364
36
37
extern struct compress_backend compress_gzip;
38
39
struct compress_backend *
40
compress_backend_lookup(const char *name)
41
{
42
	if (!strcmp(name, "gzip"))
43
		return &compress_gzip;
44
45
	return NULL;
46
}
47
48
size_t
49
compress_chunk(void *ib, size_t ibsz, void *ob, size_t obsz)
50
{
51
	return (env->sc_comp->compress_chunk(ib, ibsz, ob, obsz));
52
}
53
54
size_t
55
uncompress_chunk(void *ib, size_t ibsz, void *ob, size_t obsz)
56
{
57
	return (env->sc_comp->uncompress_chunk(ib, ibsz, ob, obsz));
58
}
59
60
int
61
compress_file(FILE *ifile, FILE *ofile)
62
{
63
	return (env->sc_comp->compress_file(ifile, ofile));
64
}
65
66
int
67
uncompress_file(FILE *ifile, FILE *ofile)
68
{
69
	return (env->sc_comp->uncompress_file(ifile, ofile));
70
}