Change wording ot YAZ license the 'Revised BSD License'. YAZ has used a
[yaz-moved-to-github.git] / include / yaz / proto.h
1 /*
2  * Copyright (c) 1995-2006, Index Data
3  * All rights reserved.
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *
7  *     * Redistributions of source code must retain the above copyright
8  *       notice, this list of conditions and the following disclaimer.
9  *     * Redistributions in binary form must reproduce the above copyright
10  *       notice, this list of conditions and the following disclaimer in the
11  *       documentation and/or other materials provided with the distribution.
12  *     * Neither the name of Index Data nor the names of its contributors
13  *       may be used to endorse or promote products derived from this
14  *       software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
17  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19  * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
20  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 /* $Id: proto.h,v 1.23 2006-10-09 21:02:41 adam Exp $ */
28
29 /*
30  * Copyright (C) 1995-2005, Index Data ApS
31  * See the file LICENSE for details.
32  *
33  * $Id: proto.h,v 1.23 2006-10-09 21:02:41 adam Exp $
34  */
35 /**
36  * \file proto.h
37  * \brief Header for Z39.50 Protocol
38  */
39 #ifndef Z_PROTO_H
40 #define Z_PROTO_H
41
42 #define Z_95 1
43 #define ASN_COMPILED 1
44
45 #include <yaz/yaz-version.h>
46 #include <yaz/z-accdes1.h>
47 #include <yaz/z-accform1.h>
48 #include <yaz/z-acckrb1.h>
49 #include <yaz/z-core.h>
50 #include <yaz/z-diag1.h>
51 #include <yaz/z-espec1.h>
52 #include <yaz/z-estask.h>
53 #include <yaz/z-exp.h>
54 #include <yaz/z-grs.h>
55 #include <yaz/z-opac.h>
56 #include <yaz/z-rrf1.h>
57 #include <yaz/z-rrf2.h>
58 #include <yaz/z-sum.h>
59 #include <yaz/z-sutrs.h>
60 #include <yaz/z-uifr1.h>
61 #include <yaz/zes-expi.h>
62 #include <yaz/zes-exps.h>
63 #include <yaz/zes-order.h>
64 #include <yaz/zes-pquery.h>
65 #include <yaz/zes-psched.h>
66 #include <yaz/zes-pset.h>
67 #include <yaz/zes-update.h>
68 #include <yaz/zes-admin.h>
69 #include <yaz/z-date.h>
70 #include <yaz/z-univ.h>
71 #include <yaz/zes-update0.h>
72 #include <yaz/z-charneg.h>
73 #include <yaz/z-mterm2.h>
74 #include <yaz/oid.h>
75 #include <yaz/wrbuf.h>
76 #include <yaz/zgdu.h>
77 #include <yaz/z-oclcui.h>
78
79 #include <yaz/marcdisp.h>
80 YAZ_BEGIN_CDECL
81
82 #if 1
83 #define Z_PRES_SUCCESS   Z_PresentStatus_success
84 #define Z_PRES_PARTIAL_1 Z_PresentStatus_partial_1
85 #define Z_PRES_PARTIAL_2 Z_PresentStatus_partial_2
86 #define Z_PRES_PARTIAL_3 Z_PresentStatus_partial_3
87 #define Z_PRES_PARTIAL_4 Z_PresentStatus_partial_4
88 #define Z_PRES_FAILURE   Z_PresentStatus_failure
89
90 #define Z_RES_SUBSET  Z_SearchResponse_subset
91 #define Z_RES_INTERIM Z_SearchResponse_interim
92 #define Z_RES_NONE    Z_SearchResponse_none
93
94 #define Z_SortStatus_success Z_SortResponse_success 
95 #define Z_SortStatus_partial_1 Z_SortResponse_partial_1
96 #define Z_SortStatus_failure Z_SortResponse_failure
97
98 #define Z_SortRelation_ascending            Z_SortKeySpec_ascending 
99 #define Z_SortRelation_descending           Z_SortKeySpec_descending
100 #define Z_SortRelation_ascendingByFreq      Z_SortKeySpec_ascendingByFrequency
101 #define Z_SortRelation_descendingByFreq     Z_SortKeySpec_descendingByfrequency 
102
103 #define Z_SortCase_caseSensitive            Z_SortKeySpec_caseSensitive
104 #define Z_SortCase_caseInsensitive          Z_SortKeySpec_caseInsensitive
105
106 #define Z_TriggerResourceCtrl_resourceReport Z_TriggerResourceControlRequest_resourceReport
107 #define Z_TriggerResourceCtrl_resourceControl  Z_TriggerResourceControlRequest_resourceControl
108 #define Z_TriggerResourceCtrl_cancel Z_TriggerResourceControlRequest_cancel
109
110 #define Z_DeleteRequest_list    Z_DeleteResultSetRequest_list
111 #define Z_DeleteRequest_all     Z_DeleteResultSetRequest_all
112
113 #define Z_AccessRequest_simpleForm Z_AccessControlRequest_simpleForm
114 #define Z_AccessRequest_externallyDefined Z_AccessControlRequest_externallyDefined
115
116 #define Z_AccessResponse_simpleForm Z_AccessControlResponse_simpleForm
117 #define Z_AccessResponse_externallyDefined Z_AccessControlResponse_externallyDefined
118
119 #define Z_ResourceReportStatus_success   Z_ResourceReportResponse_success
120 #define Z_ResourceReportStatus_partial   Z_ResourceReportResponse_partial
121 #define Z_ResourceReportStatus_failure_1 Z_ResourceReportResponse_failure_1
122 #define Z_ResourceReportStatus_failure_2 Z_ResourceReportResponse_failure_2
123 #define Z_ResourceReportStatus_failure_3 Z_ResourceReportResponse_failure_3
124 #define Z_ResourceReportStatus_failure_4 Z_ResourceReportResponse_failure_4
125 #define Z_ResourceReportStatus_failure_5 Z_ResourceReportResponse_failure_5
126 #define Z_ResourceReportStatus_failure_6 Z_ResourceReportResponse_failure_6
127
128 #define Z_SortResultSetStatus_empty       Z_SortResponse_empty
129 #define Z_SortResultSetStatus_interim     Z_SortResponse_interim
130 #define Z_SortResultSetStatus_unchanged   Z_SortResponse_unchanged
131 #define Z_SortResultSetStatus_none        Z_SortResponse_none
132 #endif
133
134 typedef Z_External Z_DatabaseRecord;
135 typedef struct Z_IOItemOrder Z_ItemOrder;
136
137 YAZ_EXPORT Z_APDU *zget_APDU(ODR o, int which);
138 YAZ_EXPORT Z_Close *zget_Close (ODR o);
139 YAZ_EXPORT Odr_oid *yaz_oidval_to_z3950oid (ODR o, int oid_class,
140                                             int oid_value);
141 YAZ_EXPORT Odr_oid *yaz_str_to_z3950oid (ODR o, int oid_class,
142                                          const char *str);
143 YAZ_EXPORT const char *yaz_z3950oid_to_str (Odr_oid *oid, int *oid_class);
144
145 YAZ_EXPORT const char* yaz_z3950_oid_value_to_str(oid_value ov, oid_class oc);
146
147 /** \brief Performs "pretty" display of GRS-1 record to WRBUF */
148 YAZ_EXPORT void yaz_display_grs1(WRBUF wrbuf, Z_GenericRecord *r, int flags);
149
150 /** \brief Performs "pretty" display of OPAC record to WRBUF */
151 YAZ_EXPORT void yaz_display_OPAC(WRBUF wrbuf, Z_OPACRecord *r, int flags);
152
153 /** \brief Performs "pretty" display of OPAC record to WRBUF using marc_t */
154 YAZ_EXPORT void yaz_opac_decode_wrbuf(yaz_marc_t mt, Z_OPACRecord *r, WRBUF wrbuf);
155
156 /** \brief Encodes Z39.50 Init OPtions based on string mnemonics */
157 YAZ_EXPORT int yaz_init_opt_encode(Z_Options *opt, const char *opt_str,
158                                    int *error_pos);
159
160 /** \brief Decodes Z39.50 Init Options - for printing */
161 YAZ_EXPORT void yaz_init_opt_decode(Z_Options *opt,
162                                     void (*pr)(const char *name,
163                                                void *clientData),
164                                     void *clientData);
165 /** \brief Creates Default Diag Format Diagnostic */
166 YAZ_EXPORT
167 Z_DefaultDiagFormat *zget_DefaultDiagFormat(ODR o, int error,
168                                             const char *addinfo);
169
170 /** \brief Creates Surrogate Diagnostic Records */
171 YAZ_EXPORT
172 Z_NamePlusRecord *zget_surrogateDiagRec(ODR o, const char *dbname,
173                                         int error, const char *addinfo);
174
175 /** \brief Creates Initialize Response diagnostics */
176 YAZ_EXPORT
177 Z_External *zget_init_diagnostics(ODR odr, int error, const char *addinfo);
178
179 /** \brief Creates Initialize Response diagnostics (Octet-aligned EXTERNAL) */
180 YAZ_EXPORT
181 Z_External *zget_init_diagnostics_octet(ODR odr, int error, const char *addinfo);
182
183 /** \brief Creates Diagnostic record - Z_DiagRecs type */
184 YAZ_EXPORT
185 Z_DiagRecs *zget_DiagRecs(ODR o, int error, const char *addinfo);
186
187 /** \brief Creates Diagnostic record - Z_DiagRecs type */
188 YAZ_EXPORT
189 Z_DiagRec *zget_DiagRec(ODR o, int error, const char *addinfo);
190
191 YAZ_END_CDECL
192
193 #include <yaz/prt-ext.h>
194
195 #endif
196 /*
197  * Local variables:
198  * c-basic-offset: 4
199  * indent-tabs-mode: nil
200  * End:
201  * vim: shiftwidth=4 tabstop=8 expandtab
202  */
203