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