libksba  1.6.0
About: KSBA is a library to make the tasks of working with X.509 certificates, CMS data and related objects more easy.
  Fossies Dox: libksba-1.6.0.tar.bz2  ("unofficial" and yet experimental doxygen-generated source code documentation)  

reader.h
Go to the documentation of this file.
1 /* reader.h - internl definitions for the reder 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 READER_H
32 #define READER_H 1
33 
34 #include <stdio.h>
35 
42 };
43 
44 
45 struct ksba_reader_s {
46  int eof;
47  int error; /* If an error occured, takes the value of errno. */
48  unsigned long nread;
49  struct {
50  unsigned char *buf;
51  size_t size; /* allocated size */
52  size_t length; /* used size */
53  size_t readpos; /* offset where to start the next read */
54  } unread;
55  enum reader_type type;
56  union {
57  struct {
58  unsigned char *buffer;
59  size_t size;
60  size_t readpos;
61  } mem; /* for READER_TYPE_MEM */
62  int fd; /* for READER_TYPE_FD */
63  FILE *file; /* for READER_TYPE_FILE */
64  struct {
65  int (*fnc)(void*,char *,size_t,size_t*);
66  void *value;
67  } cb; /* for READER_TYPE_CB */
68  } u;
69  void (*notify_cb)(void*,ksba_reader_t);
71 };
72 
73 
74 
75 
76 #endif /*READER_H*/
struct ksba_reader_s * ksba_reader_t
Definition: ksba.h:247
reader_type
Definition: reader.h:36
@ READER_TYPE_NONE
Definition: reader.h:37
@ READER_TYPE_CB
Definition: reader.h:41
@ READER_TYPE_FILE
Definition: reader.h:40
@ READER_TYPE_FD
Definition: reader.h:39
@ READER_TYPE_MEM
Definition: reader.h:38
struct ksba_reader_s::@31::@33 cb
size_t readpos
Definition: reader.h:53
FILE * file
Definition: reader.h:63
unsigned char * buf
Definition: reader.h:50
void(* notify_cb)(void *, ksba_reader_t)
Definition: reader.h:69
unsigned long nread
Definition: reader.h:48
enum reader_type type
Definition: reader.h:55
size_t size
Definition: reader.h:51
int(* fnc)(void *, char *, size_t, size_t *)
Definition: reader.h:65
struct ksba_reader_s::@31::@32 mem
struct ksba_reader_s::@30 unread
void * notify_cb_value
Definition: reader.h:70
void * value
Definition: reader.h:66
unsigned char * buffer
Definition: reader.h:58
size_t length
Definition: reader.h:52
union ksba_reader_s::@31 u
int error
Definition: reader.h:47