Tizen 2.0 Release
[external/libgnutls26.git] / lib / opencdk / filters.h
1 /* filters.h - Filter structs
2  * Copyright (C) 2002, 2003, 2008, 2010 Free Software Foundation, Inc.
3  *
4  * Author: Timo Schulz
5  *
6  * This file is part of OpenCDK.
7  *
8  * The OpenCDK library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation; either version 2.1 of
11  * the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
21  * USA
22  *
23  */
24 #ifndef CDK_FILTERS_H
25 #define CDK_FILTERS_H
26
27 enum
28 {
29   STREAMCTL_READ = 0,
30   STREAMCTL_WRITE = 1,
31   STREAMCTL_FREE = 2
32 };
33
34 typedef struct
35 {
36   cipher_hd_st hd;
37   digest_hd_st mdc;
38   int mdc_method;
39   u32 datalen;
40   struct
41   {
42     size_t on;
43     off_t size;
44     off_t nleft;
45   } blkmode;
46   cdk_stream_t s;
47 } cipher_filter_t;
48
49 typedef struct
50 {
51   int digest_algo;
52   digest_hd_st md;
53   int md_initialized;
54 } md_filter_t;
55
56 typedef struct
57 {
58   const char *le;               /* line endings */
59   const char *hdrlines;
60   u32 crc;
61   int crc_okay;
62   int idx, idx2;
63 } armor_filter_t;
64
65 typedef struct
66 {
67   cdk_lit_format_t mode;
68   char *orig_filename;          /* This original name of the input file. */
69   char *filename;
70   digest_hd_st md;
71   int md_initialized;
72   struct
73   {
74     size_t on;
75     off_t size;
76   } blkmode;
77 } literal_filter_t;
78
79 typedef struct
80 {
81   size_t inbufsize;
82   byte inbuf[8192];
83   size_t outbufsize;
84   byte outbuf[8192];
85   int algo;                     /* compress algo */
86   int level;
87 } compress_filter_t;
88
89 typedef struct
90 {
91   const char *lf;
92 } text_filter_t;
93
94
95 /*-- armor.c -*/
96 int _cdk_filter_armor (void *opaque, int ctl, FILE * in, FILE * out);
97
98 /*-- cipher.c --*/
99 cdk_error_t _cdk_filter_hash (void *opaque, int ctl, FILE * in, FILE * out);
100 cdk_error_t _cdk_filter_cipher (void *opaque, int ctl, FILE * in, FILE * out);
101
102 /*-- literal.c --*/
103 int _cdk_filter_literal (void *opaque, int ctl, FILE * in, FILE * out);
104 int _cdk_filter_text (void *opaque, int ctl, FILE * in, FILE * out);
105
106 /*-- compress.c --*/
107 cdk_error_t _cdk_filter_compress (void *opaque, int ctl,
108                                   FILE * in, FILE * out);
109
110 #endif /* CDK_FILTERS_H */