Made error code consistent with the other text parsing functions.
[gnutls.git] / lib / opencdk / filters.h
blob2ff305fd4d16f9c86fb6cdef700555cd4d79d48b
1 /* filters.h - Filter structs
2 * Copyright (C) 2002-2012 Free Software Foundation, Inc.
4 * Author: Timo Schulz
6 * This file is part of OpenCDK.
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 3 of
11 * the License, or (at your option) any later version.
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.
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>
23 #ifndef CDK_FILTERS_H
24 #define CDK_FILTERS_H
26 enum
28 STREAMCTL_READ = 0,
29 STREAMCTL_WRITE = 1,
30 STREAMCTL_FREE = 2
33 typedef struct
35 cipher_hd_st hd;
36 digest_hd_st mdc;
37 int mdc_method;
38 u32 datalen;
39 struct
41 size_t on;
42 off_t size;
43 off_t nleft;
44 } blkmode;
45 cdk_stream_t s;
46 } cipher_filter_t;
48 typedef struct
50 int digest_algo;
51 digest_hd_st md;
52 int md_initialized;
53 } md_filter_t;
55 typedef struct
57 const char *le; /* line endings */
58 const char *hdrlines;
59 u32 crc;
60 int crc_okay;
61 int idx, idx2;
62 } armor_filter_t;
64 typedef struct
66 cdk_lit_format_t mode;
67 char *orig_filename; /* This original name of the input file. */
68 char *filename;
69 digest_hd_st md;
70 int md_initialized;
71 struct
73 size_t on;
74 off_t size;
75 } blkmode;
76 } literal_filter_t;
78 typedef struct
80 size_t inbufsize;
81 byte inbuf[8192];
82 size_t outbufsize;
83 byte outbuf[8192];
84 int algo; /* compress algo */
85 int level;
86 } compress_filter_t;
88 typedef struct
90 const char *lf;
91 } text_filter_t;
94 /*-- armor.c -*/
95 int _cdk_filter_armor (void *uint8_t, int ctl, FILE * in, FILE * out);
97 /*-- cipher.c --*/
98 cdk_error_t _cdk_filter_hash (void *uint8_t, int ctl, FILE * in, FILE * out);
99 cdk_error_t _cdk_filter_cipher (void *uint8_t, int ctl, FILE * in, FILE * out);
101 /*-- literal.c --*/
102 int _cdk_filter_literal (void *uint8_t, int ctl, FILE * in, FILE * out);
103 int _cdk_filter_text (void *uint8_t, int ctl, FILE * in, FILE * out);
105 /*-- compress.c --*/
106 cdk_error_t _cdk_filter_compress (void *uint8_t, int ctl,
107 FILE * in, FILE * out);
109 #endif /* CDK_FILTERS_H */