3 * Copyright (C) 2006-2009 Raffaele Sandrini, Jürg Billeter, Evan Nemerson
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 * Raffaele Sandrini <raffaele@sandrini.ch>
21 * Jürg Billeter <j@bitron.ch>
22 * Evan Nemerson <evan@polussystems.com>
27 [CCode (lower_case_cprefix = "", cheader_filename = "zlib.h")]
29 [CCode (cprefix = "ZLIB_VER_")]
31 [CCode (cname = "ZLIB_VERSION")]
32 public const string STRING;
33 [CCode (cname = "ZLIB_VERNUM")]
34 public const int NUMBER;
35 public const int MAJOR;
36 public const int MINOR;
37 public const int REVISION;
40 [CCode (cprefix = "Z_")]
42 [CCode (cname = "Z_NO_FLUSH")]
43 public const int NONE;
44 [CCode (cname = "Z_SYNC_FLUSH")]
45 public const int SYNC;
46 [CCode (cname = "Z_FULL_FLUSH")]
47 public const int FULL;
48 public const int FINISH;
49 public const int BLOCK;
53 [CCode (cname = "Z_OK")]
55 [CCode (cname = "Z_STREAM_END")]
56 public const int STREAM_END;
57 [CCode (cname = "Z_NEED_DICT")]
58 public const int NEED_DICT;
59 [CCode (cname = "Z_ERRNO")]
60 public const int ERRNO;
61 [CCode (cname = "Z_STREAM_ERROR")]
62 public const int STREAM_ERROR;
63 [CCode (cname = "Z_DATA_ERROR")]
64 public const int DATA_ERROR;
65 [CCode (cname = "Z_MEM_ERROR")]
66 public const int MEM_ERROR;
67 [CCode (cname = "Z_BUF_ERROR")]
68 public const int BUF_ERROR;
69 [CCode (cname = "Z_VERSION_ERROR")]
70 public const int VERSION_ERROR;
73 namespace Compression {
74 [CCode (cname = "Z_NO_COMPRESSION")]
75 public const int NONE;
76 [CCode (cname = "Z_BEST_SPEED")]
77 public const int BEST_SPEED;
78 [CCode (cname = "Z_BEST_COMPRESSION")]
79 public const int BEST_COMPRESSION;
80 [CCode (cname = "Z_DEFAULT_COMPRESSION")]
81 public const int DEFAULT;
84 [CCode (cprefix = "Z_")]
86 public const int FILTERED;
87 public const int HUFFMAN_ONLY;
89 public const int FIXED;
90 [CCode (cname = "Z_DEFAULT_STRATEGY")]
91 public const int DEFAULT;
94 [CCode (cprefix = "Z_")]
96 public const int BINARY;
97 public const int TEXT;
98 public const int ASCII;
99 public const int UNKNOWN;
102 [CCode (cprefix = "Z_")]
103 namespace Algorithm {
104 public const int DEFLATED;
107 [CCode (cname = "z_stream", destroy_function = "deflateEnd")]
108 public struct Stream {
109 public uchar* next_in;
110 public uint avail_in;
111 public ulong total_in;
113 public uchar* next_out;
114 public uint avail_out;
115 public ulong total_out;
119 public int data_type;
123 [CCode (cname = "z_stream", destroy_function = "deflateEnd")]
124 public struct DeflateStream : Stream {
125 [CCode (cname = "deflateInit")]
126 public DeflateStream (int level = Compression.DEFAULT);
127 [CCode (cname = "deflateInit2")]
128 public DeflateStream.full (int level, int method, int windowBits, int memLevel, int strategy);
130 [CCode (cname = "deflate")]
131 public int deflate (int flush);
132 [CCode (cname = "deflateSetDictionary")]
133 public int set_dictionary ([CCode (array_length_type = "guint")] uchar[] dictionary);
134 [CCode (cname = "deflateCopy", instance_pos = 0)]
135 public int copy (DeflateStream dest);
136 [CCode (cname = "deflateReset")]
138 [CCode (cname = "deflateParams")]
139 public int params (int level, int strategy);
140 [CCode (cname = "deflateTune")]
141 public int tune (int good_length, int max_lazy, int nice_length, int max_chain);
142 [CCode (cname = "deflateBound")]
143 public ulong bound (ulong sourceLen);
144 [CCode (cname = "deflatePrime")]
145 public int prime (int bits, int value);
146 [CCode (cname = "deflateSetHeader")]
147 public int set_header (GZHeader head);
150 [CCode (cname = "z_stream", destroy_function = "inflateEnd")]
151 public struct InflateStream : Stream {
152 [CCode (cname = "inflateInit")]
153 public InflateStream ();
154 [CCode (cname = "inflateInit2")]
155 public InflateStream.full (int windowBits);
157 [CCode (cname = "inflate")]
158 public int inflate (int flush);
159 [CCode (cname = "inflateSetDictionary")]
160 public int set_dictionary ([CCode (array_length_type = "guint")] uchar[] dictionary);
161 [CCode (cnmae = "inflateSync")]
164 public int prime (int bits, int value);
165 public int get_header (out GZHeader head);
169 [CCode (cname = "compress2")]
170 public static int compress ([CCode (array_length_type = "gulong")] uchar[] dest, [CCode (array_length_type = "gulong")] uchar[] source, int level = Compression.DEFAULT);
171 [CCode (cname = "compressBound")]
172 public static int compress_bound (ulong sourceLen);
174 public static int uncompress ([CCode (array_length_type = "gulong")] uchar[] dest, [CCode (array_length_type = "gulong")] uchar[] source);
177 [CCode (cname = "gz_header")]
178 public struct GZHeader {
183 [CCode (array_length_name = "extra_len", array_length_type = "guint")]
184 public uchar[] extra;
185 public uint extra_max;
187 public uint name_max;
188 public string comment;
189 [CCode (cname = "comm_max")]
190 public uint comment_max;
195 [CCode (cname = "gzFile", cprefix = "gz", free_function = "gzclose")]
196 public class GZFileStream {
197 public static GZFileStream open (string path, string mode);
198 public static GZFileStream dopen (int fd, string mode);
199 public int setparams (int level, int strategy);
200 public int read (char[] buf);
201 public int write (char[] buf);
203 public int printf (string format, ...);
204 public int puts (string s);
205 public weak string gets (char[] buf);
206 public int flush (int flush);
207 public int rewind ();
209 public bool direct ();