AMPS C/C++ Client Class Reference
AMPS C/C++ Client Version 5.3.5.1
amps_zlib.h
1 //
3 // Copyright (c) 2010-2025 60East Technologies Inc., All Rights Reserved.
4 //
5 // This computer software is owned by 60East Technologies Inc. and is
6 // protected by U.S. copyright laws and other laws and by international
7 // treaties. This computer software is furnished by 60East Technologies
8 // Inc. pursuant to a written license agreement and may be used, copied,
9 // transmitted, and stored only in accordance with the terms of such
10 // license agreement and with the inclusion of the above copyright notice.
11 // This computer software or any other copies thereof may not be provided
12 // or otherwise made available to any other person.
13 //
14 // U.S. Government Restricted Rights. This computer software: (a) was
15 // developed at private expense and is in all respects the proprietary
16 // information of 60East Technologies Inc.; (b) was not developed with
17 // government funds; (c) is a trade secret of 60East Technologies Inc.
18 // for all purposes of the Freedom of Information Act; and (d) is a
19 // commercial item and thus, pursuant to Section 12.212 of the Federal
20 // Acquisition Regulations (FAR) and DFAR Supplement Section 227.7202,
21 // Government's use, duplication or disclosure of the computer software
22 // is subject to the restrictions set forth by 60East Technologies Inc..
23 //
25 #pragma once
26 
27 /*********************************************************
28  * amps_zlib
29  *
30  * This is a simple wrapper around a dynamically-loaded zlib implementation.
31  *********************************************************/
32 
33 #ifdef _cplusplus
34 extern "C"
35 {
36 #endif
37 
38 typedef struct
39 {
40  const char* next_in;
41  unsigned int avail_in;
42  unsigned long total_in;
43 
44  const char* next_out;
45  unsigned int avail_out;
46  unsigned long total_out;
47 
48  const char* msg;
49  void* state;
50 
51  void* zalloc;
52  void* zfree;
53  void* opaque;
54 
55  int data_type;
56  unsigned long adler;
57  unsigned long reserved;
58 } amps_zstream;
59 
60 // Loads zlib dynamic library; returns 0 on success, nonzero on error.
61 extern int amps_zlib_init(const char*);
62 extern char amps_zlib_last_error[];
63 extern int amps_zlib_is_loaded;
64 
65 // Headers/loaders for just the functions we use.
66 typedef const char* (*amps_zlibVersion_t)(void);
67 typedef int (*amps_deflateInit2_t)(amps_zstream*, int, int, int, int, int, const char*, size_t);
68 typedef int (*amps_deflate_t)(amps_zstream*, int);
69 typedef int (*amps_deflate_end_t)(amps_zstream*);
70 typedef int (*amps_inflateInit2_t)(amps_zstream*, int, const char*, size_t);
71 typedef int (*amps_inflate_t)(amps_zstream*, int);
72 typedef int (*amps_inflate_end_t)(amps_zstream*);
73 
74 extern amps_zlibVersion_t amps_zlibVersion;
75 extern amps_deflateInit2_t amps_deflateInit2_;
76 extern amps_deflate_t amps_deflate;
77 extern amps_deflate_end_t amps_deflateEnd;
78 
79 extern amps_inflateInit2_t amps_inflateInit2_;
80 extern amps_inflate_t amps_inflate;
81 extern amps_inflate_end_t amps_inflateEnd;
82 
83 #define amps_deflateInit2(stream, level, method, windowBits, memlevel, strategy) \
84  amps_deflateInit2_(stream, level, method, windowBits, memlevel, strategy, "1.0.1", sizeof(amps_zstream))
85 
86 #define amps_inflateInit2(stream, windowBits) \
87  amps_inflateInit2_(stream, windowBits, "1.0.1", sizeof(amps_zstream));
88 
89 #define AMPS_ZLIB_WANT_READ (-254)
90 #define AMPS_ZLIB_NEED_SPACE (-253)
91 
92 #ifdef _cplusplus
93 }
94 #endif