williamr@2
|
1 |
/*
|
williamr@2
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
|
williamr@2
|
3 |
|
williamr@2
|
4 |
* Redistribution and use in source and binary forms, with or without
|
williamr@2
|
5 |
* modification, are permitted provided that the following conditions are met:
|
williamr@2
|
6 |
|
williamr@2
|
7 |
* Redistributions of source code must retain the above copyright notice, this
|
williamr@2
|
8 |
* list of conditions and the following disclaimer.
|
williamr@2
|
9 |
* Redistributions in binary form must reproduce the above copyright notice,
|
williamr@2
|
10 |
* this list of conditions and the following disclaimer in the documentation
|
williamr@2
|
11 |
* and/or other materials provided with the distribution.
|
williamr@2
|
12 |
* Neither the name of Nokia Corporation nor the names of its contributors
|
williamr@2
|
13 |
* may be used to endorse or promote products derived from this software
|
williamr@2
|
14 |
* without specific prior written permission.
|
williamr@2
|
15 |
|
williamr@2
|
16 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
williamr@2
|
17 |
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
williamr@2
|
18 |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
williamr@2
|
19 |
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
williamr@2
|
20 |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
williamr@2
|
21 |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
williamr@2
|
22 |
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
williamr@2
|
23 |
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
williamr@2
|
24 |
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
williamr@2
|
25 |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
williamr@2
|
26 |
*
|
williamr@2
|
27 |
* Description:
|
williamr@2
|
28 |
*
|
williamr@2
|
29 |
*/
|
williamr@2
|
30 |
|
williamr@2
|
31 |
|
williamr@2
|
32 |
#ifndef HEADER_COMP_H
|
williamr@2
|
33 |
#define HEADER_COMP_H
|
williamr@2
|
34 |
|
williamr@2
|
35 |
#if (defined(__SYMBIAN32__) && !defined(SYMBIAN))
|
williamr@2
|
36 |
#define SYMBIAN
|
williamr@2
|
37 |
#endif
|
williamr@2
|
38 |
|
williamr@2
|
39 |
#ifdef SYMBIAN
|
williamr@2
|
40 |
#include <e32def.h>
|
williamr@2
|
41 |
#endif
|
williamr@2
|
42 |
#include <openssl/crypto.h>
|
williamr@2
|
43 |
|
williamr@2
|
44 |
#ifdef __cplusplus
|
williamr@2
|
45 |
extern "C" {
|
williamr@2
|
46 |
#endif
|
williamr@2
|
47 |
#ifdef SYMBIAN
|
williamr@2
|
48 |
#include <e32def.h>
|
williamr@2
|
49 |
#endif
|
williamr@2
|
50 |
typedef struct comp_ctx_st COMP_CTX;
|
williamr@2
|
51 |
|
williamr@2
|
52 |
typedef struct comp_method_st
|
williamr@2
|
53 |
{
|
williamr@2
|
54 |
int type; /* NID for compression library */
|
williamr@2
|
55 |
const char *name; /* A text string to identify the library */
|
williamr@2
|
56 |
int (*init)(COMP_CTX *ctx);
|
williamr@2
|
57 |
void (*finish)(COMP_CTX *ctx);
|
williamr@2
|
58 |
int (*compress)(COMP_CTX *ctx,
|
williamr@2
|
59 |
unsigned char *out, unsigned int olen,
|
williamr@2
|
60 |
unsigned char *in, unsigned int ilen);
|
williamr@2
|
61 |
int (*expand)(COMP_CTX *ctx,
|
williamr@2
|
62 |
unsigned char *out, unsigned int olen,
|
williamr@2
|
63 |
unsigned char *in, unsigned int ilen);
|
williamr@2
|
64 |
/* The following two do NOTHING, but are kept for backward compatibility */
|
williamr@2
|
65 |
long (*ctrl)(void);
|
williamr@2
|
66 |
long (*callback_ctrl)(void);
|
williamr@2
|
67 |
} COMP_METHOD;
|
williamr@2
|
68 |
|
williamr@2
|
69 |
struct comp_ctx_st
|
williamr@2
|
70 |
{
|
williamr@2
|
71 |
COMP_METHOD *meth;
|
williamr@2
|
72 |
unsigned long compress_in;
|
williamr@2
|
73 |
unsigned long compress_out;
|
williamr@2
|
74 |
unsigned long expand_in;
|
williamr@2
|
75 |
unsigned long expand_out;
|
williamr@2
|
76 |
|
williamr@2
|
77 |
CRYPTO_EX_DATA ex_data;
|
williamr@2
|
78 |
};
|
williamr@2
|
79 |
|
williamr@2
|
80 |
|
williamr@2
|
81 |
IMPORT_C COMP_CTX *COMP_CTX_new(COMP_METHOD *meth);
|
williamr@2
|
82 |
IMPORT_C void COMP_CTX_free(COMP_CTX *ctx);
|
williamr@2
|
83 |
IMPORT_C int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen,
|
williamr@2
|
84 |
unsigned char *in, int ilen);
|
williamr@2
|
85 |
IMPORT_C int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen,
|
williamr@2
|
86 |
unsigned char *in, int ilen);
|
williamr@2
|
87 |
IMPORT_C COMP_METHOD *COMP_rle(void );
|
williamr@2
|
88 |
IMPORT_C COMP_METHOD *COMP_zlib(void );
|
williamr@2
|
89 |
|
williamr@2
|
90 |
/* BEGIN ERROR CODES */
|
williamr@2
|
91 |
/* The following lines are auto generated by the script mkerr.pl. Any changes
|
williamr@2
|
92 |
* made after this point may be overwritten when the script is next run.
|
williamr@2
|
93 |
*/
|
williamr@2
|
94 |
IMPORT_C void ERR_load_COMP_strings(void);
|
williamr@2
|
95 |
|
williamr@2
|
96 |
/* Error codes for the COMP functions. */
|
williamr@2
|
97 |
|
williamr@2
|
98 |
/* Function codes. */
|
williamr@2
|
99 |
|
williamr@2
|
100 |
/* Reason codes. */
|
williamr@2
|
101 |
|
williamr@2
|
102 |
#ifdef __cplusplus
|
williamr@2
|
103 |
}
|
williamr@2
|
104 |
#endif
|
williamr@2
|
105 |
#endif
|