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