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