1 /* reader.h - internl definitions for the reder object.
2 * Copyright (C) 2001, 2010, 2012 g10 Code GmbH
4 * This file is part of KSBA.
6 * KSBA is free software; you can redistribute it and/or modify
7 * it under the terms of either
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.
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.
19 * or both in parallel, as here.
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.
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/>.
45 struct ksba_reader_s {
47 int error; /* If an error occured, takes the value of errno. */
51 size_t size; /* allocated size */
52 size_t length; /* used size */
53 size_t readpos; /* offset where to start the next read */
55 enum reader_type type;
58 unsigned char *buffer;
61 } mem; /* for READER_TYPE_MEM */
62 int fd; /* for READER_TYPE_FD */
63 FILE *file; /* for READER_TYPE_FILE */
65 int (*fnc)(void*,char *,size_t,size_t*);
67 } cb; /* for READER_TYPE_CB */
69 void (*notify_cb)(void*,ksba_reader_t);
70 void *notify_cb_value;