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