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