Debian Codegraph @

src/writer.h

raw
1 /* writer.h - internal definitions for the writer object.
2 * Copyright (C) 2001, 2010, 2012 g10 Code GmbH
3 *
4 * This file is part of KSBA.
5 *
6 * KSBA is free software; you can redistribute it and/or modify
7 * it under the terms of either
8 *
9 * - the GNU Lesser General Public License as published by the Free
10 * Software Foundation; either version 3 of the License, or (at
11 * your option) any later version.
12 *
13 * or
14 *
15 * - the GNU General Public License as published by the Free
16 * Software Foundation; either version 2 of the License, or (at
17 * your option) any later version.
18 *
19 * or both in parallel, as here.
20 *
21 * KSBA is distributed in the hope that it will be useful, but WITHOUT
22 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
23 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
24 * License for more details.
25 *
26 * You should have received a copies of the GNU General Public License
27 * and the GNU Lesser General Public License along with this program;
28 * if not, see <http://www.gnu.org/licenses/>.
29 */
30
31 #ifndef WRITER_H
32 #define WRITER_H 1
33
34 #include <stdio.h>
35
36 enum writer_type {
37 WRITER_TYPE_NONE = 0,
38 WRITER_TYPE_FD,
39 WRITER_TYPE_FILE,
40 WRITER_TYPE_CB,
41 WRITER_TYPE_MEM
42 };
43
44
45 struct ksba_writer_s {
46 int error;
47 unsigned long nwritten;
48 enum writer_type type;
49 int ndef_is_open;
50
51 gpg_error_t (*filter)(void*,
52 const void *,size_t, size_t *,
53 void *, size_t, size_t *);
54 void *filter_arg;
55
56 union {
57 int fd; /* for WRITER_TYPE_FD */
58 FILE *file; /* for WRITER_TYPE_FILE */
59 struct {
60 int (*fnc)(void*,const void *,size_t);
61 void *value;
62 } cb; /* for WRITER_TYPE_CB */
63 struct {
64 unsigned char *buffer;
65 size_t size;
66 } mem; /* for WRITER_TYPE_MEM */
67 } u;
68 void (*notify_cb)(void*,ksba_writer_t);
69 void *notify_cb_value;
70 };
71
72
73
74
75 #endif /*WRITER_H*/