]> git.saurik.com Git - apple/xnu.git/blame - bsd/dev/random/YarrowCoreLib/src/comp.h
xnu-517.tar.gz
[apple/xnu.git] / bsd / dev / random / YarrowCoreLib / src / comp.h
CommitLineData
0b4e3aa0
A
1/*
2 * Copyright (c) 1999, 2000-2001 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
43866e37 6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
0b4e3aa0 7 *
43866e37
A
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * file.
14 *
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
0b4e3aa0
A
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
43866e37
A
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
0b4e3aa0
A
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25
26/*
27 File: comp.h
28
29 Contains: Glue between core prng code to the Zlib library.
30
31 Written by: Counterpane, Inc.
32
33 Copyright: (c) 2000 by Apple Computer, Inc., all rights reserved.
34
35 Change History (most recent first):
36
37 02/10/99 dpm Created, based on Counterpane source.
38
39*/
40/* comp.h
41
42 Header for the compression routines added to the Counterpane PRNG.
43*/
44
45#ifndef __YARROW_COMP_H__
46#define __YARROW_COMP_H__
47
48#include "smf.h"
49
50/*
51 * Kernel version does NULL compression....
52 */
53#define YARROW_KERNEL
54
55#ifdef YARROW_KERNEL
56/*
57 * Shrink this down to almost nothing to simplify kernel port;
58 * with additional hacking on prng.c, this could go away entirely
59 */
60typedef char COMP_CTX;
61
62/* and define some type3s normally picked up from zlib */
63typedef unsigned char Bytef;
64typedef unsigned uInt;
65
66#else
67
68#include "zlib.h"
69
70/* Top level compression context */
71typedef struct{
72 MMPTR buf;
73 uInt spaceused;
74} COMP_CTX;
75#endif /* YARROW_KERNEL */
76
77typedef enum comp_error_status {
78 COMP_SUCCESS = 0,
79 COMP_ERR_NULL_POINTER,
80 COMP_ERR_LOW_MEMORY,
81 COMP_ERR_LIB
82} comp_error_status;
83
84/* Exported functions from compress.c */
85comp_error_status comp_init(COMP_CTX* ctx);
86comp_error_status comp_add_data(COMP_CTX* ctx,Bytef* inp,uInt inplen);
87comp_error_status comp_end(COMP_CTX* ctx);
88comp_error_status comp_get_ratio(COMP_CTX* ctx,float* out);
89
90#endif