Added missing C decl macros for soap.h and srw.h.
[yaz-moved-to-github.git] / include / yaz / srw.h
1 /*
2  * Copyright (c) 2002-2003, Index Data.
3  * See the file LICENSE for details.
4  *
5  * $Id: srw.h,v 1.8 2003-12-09 12:51:16 adam Exp $
6  */
7
8 #ifndef YAZ_SRW_H
9 #define YAZ_SRW_H
10
11 #include <yaz/soap.h>
12
13 YAZ_BEGIN_CDECL
14
15 typedef struct {
16     char *recordSchema;
17     int recordPacking;
18 #define Z_SRW_recordPacking_string 0
19 #define Z_SRW_recordPacking_XML 1
20     char *recordData_buf;
21     int recordData_len;
22     int *recordPosition;
23 } Z_SRW_record;
24
25 typedef struct {
26     int  *code;
27     char *details;
28 } Z_SRW_diagnostic;
29     
30 typedef struct {
31
32 #define Z_SRW_query_type_cql  1
33 #define Z_SRW_query_type_xcql 2
34 #define Z_SRW_query_type_pqf  3
35     int query_type;
36     union {
37         char *cql;
38         char *xcql;
39         char *pqf;
40     } query;
41
42 #define Z_SRW_sort_type_none 1
43 #define Z_SRW_sort_type_sort 2
44 #define Z_SRW_sort_type_xSort 3
45     int sort_type;
46     union {
47         char *none;
48         char *sortKeys;
49         char *xSortKeys;
50     } sort;
51     int *startRecord;
52     int  *maximumRecords;
53     char *recordSchema;
54     char *recordPacking;
55     char *database;
56 } Z_SRW_searchRetrieveRequest;
57
58 typedef struct {
59     int * numberOfRecords;
60     char * resultSetId;
61     int * resultSetIdleTime;
62     
63     Z_SRW_record *records;
64     int num_records;
65
66     Z_SRW_diagnostic *diagnostics;
67     int num_diagnostics;
68     int *nextRecordPosition;
69 } Z_SRW_searchRetrieveResponse;
70
71 typedef struct {
72     int dummy;
73 } Z_SRW_explainRequest;
74
75 typedef struct {
76     int explainPacking;
77     char *explainData_buf;
78     int explainData_len;
79 } Z_SRW_explainResponse;
80     
81 #define Z_SRW_searchRetrieve_request  1
82 #define Z_SRW_searchRetrieve_response 2
83 #define Z_SRW_explain_request 3
84 #define Z_SRW_explain_response 4
85
86 typedef struct {
87     int which;
88     union {
89         Z_SRW_searchRetrieveRequest *request;
90         Z_SRW_searchRetrieveResponse *response;
91         Z_SRW_explainRequest *explain_request;
92         Z_SRW_explainResponse *explain_response;
93     } u;
94 } Z_SRW_PDU;
95
96 YAZ_EXPORT int yaz_srw_codec(ODR o, void * pptr,
97                              Z_SRW_PDU **handler_data,
98                              void *client_data, const char *ns);
99 YAZ_EXPORT Z_SRW_PDU *yaz_srw_get(ODR o, int which);
100
101 YAZ_EXPORT const char *yaz_diag_srw_str (int code);
102
103 YAZ_EXPORT int yaz_diag_bib1_to_srw (int bib1_code);
104
105 YAZ_EXPORT int yaz_diag_srw_to_bib1(int srw_code);
106
107 YAZ_END_CDECL
108
109 #endif