Extract uses file descriptors instead of FILE pointers.
[idzebra-moved-to-github.git] / include / recctrl.h
1 /*
2  * Copyright (C) 1994-1995, Index Data I/S 
3  * All rights reserved.
4  * Sebastian Hammer, Adam Dickmeiss
5  *
6  * $Log: recctrl.h,v $
7  * Revision 1.8  1995-10-02 15:43:35  adam
8  * Extract uses file descriptors instead of FILE pointers.
9  *
10  * Revision 1.7  1995/10/02  15:18:09  adam
11  * Minor changes.
12  *
13  * Revision 1.6  1995/10/02  15:05:26  quinn
14  * Added a few fields.
15  *
16  * Revision 1.5  1995/10/02  14:55:52  quinn
17  * *** empty log message ***
18  *
19  * Revision 1.4  1995/09/27  16:17:29  adam
20  * More work on retrieve.
21  *
22  * Revision 1.3  1995/09/27  12:21:25  adam
23  * New function: recType_byName.
24  *
25  * Revision 1.2  1995/09/15  14:45:03  adam
26  * Retrieve control.
27  *
28  * Revision 1.1  1995/09/14  07:48:13  adam
29  * Record control management.
30  *
31  */
32
33 #ifndef RECCTRL_H
34 #define RECCTRL_H
35
36 #include <oid.h>
37 #include <odr.h>
38
39 /* single word entity */
40 typedef struct {
41     int  attrSet;
42     int  attrUse;
43     enum {
44         Word_String,
45         Word_Numeric
46     } which;
47     union {
48         char *string;
49         int  numeric;
50     } u;
51     int seqno;
52 } RecWord;
53
54 /* Extract record control */
55 struct recExtractCtrl {
56     int        fd;                     /* File descriptor and read function */
57     int       (*readf)(int fd, char *buf, size_t count);
58     char *subType;
59     void (*init)(RecWord *p);
60     void (*add)(const RecWord *p);
61 };
62
63 /* Retrieve record control */
64 struct recRetrieveCtrl {
65     /* Input parameters ... */
66     ODR        odr;                    /* ODR used to create response */
67     int        fd;                     /* File descriptor and read function */
68     int       (*readf)(int fd, char *buf, size_t count);
69     oid_value  input_format;           /* Preferred record syntax */
70     
71     /* response */
72     oid_value  output_format;
73     void       *rec_buf;
74     size_t     rec_len;
75     int        diagnostic;
76     char *message;
77 };
78
79 typedef struct recType
80 {
81     char *name;                        /* Name of record type */
82     void (*init)(void);                /* Init function - called once */
83     int  (*extract)(struct recExtractCtrl *ctrl);     /* Extract proc */
84     int  (*retrieve)(struct recRetrieveCtrl *ctrl);   /* Retrieve proc */
85 } *RecType;
86
87 RecType recType_byName (const char *name);
88
89 #endif