X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=include%2Fyaz%2Fsrw.h;h=766281839233b126cf50c93f0dd1196ecaceeda9;hp=dc721a125657c8a8825edf242f99bdbdad6a6191;hb=c9e4ad355f2f30b98fa129d9f63d00f70b56652d;hpb=1f3fe256d54ab81d998cd622abda89580cc0b3ff diff --git a/include/yaz/srw.h b/include/yaz/srw.h index dc721a1..7662818 100644 --- a/include/yaz/srw.h +++ b/include/yaz/srw.h @@ -1,9 +1,31 @@ /* - * Copyright (C) 1995-2005, Index Data ApS - * See the file LICENSE for details. + * Copyright (c) 1995-2007, Index Data + * All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: * - * $Id: srw.h,v 1.25 2006-03-01 23:24:24 adam Exp $ + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Index Data nor the names of its contributors + * may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/* $Id: srw.h,v 1.36 2007-09-09 05:54:45 adam Exp $ */ + /** * \file srw.h * \brief Header for SRW/SRU @@ -15,17 +37,14 @@ #include #include #include +#include YAZ_BEGIN_CDECL typedef struct { - int type; - char *recordReviewCode; - char *recordReviewNote; - char *recordId; - char *nonDupRecordId; - char *recordLockStatus; - char *recordOldVersion; + char *extraRecordData_buf; + int extraRecordData_len; + char *recordIdentifier; } Z_SRW_extra_record; typedef struct { @@ -133,25 +152,32 @@ typedef struct { typedef struct { + char *versionType; + char *versionValue; +} Z_SRW_recordVersion; + +typedef struct { char *database; char *operation; char *recordId; - char *recordVersion; - char *recordOldVersion; - Z_SRW_record record; + Z_SRW_recordVersion *recordVersions; + int num_recordVersions; + Z_SRW_record *record; Z_SRW_extra_record *extra_record; - char *extraRequestData; + char *extraRequestData_buf; + int extraRequestData_len; char *stylesheet; } Z_SRW_updateRequest; typedef struct { char *operationStatus; char *recordId; - char *recordVersion; - char *recordChecksum; - char *extraResponseData; - Z_SRW_record record; + Z_SRW_recordVersion *recordVersions; + int num_recordVersions; + Z_SRW_record *record; Z_SRW_extra_record *extra_record; + char *extraResponseData_buf; + int extraResponseData_len; Z_SRW_diagnostic *diagnostics; int num_diagnostics; } Z_SRW_updateResponse; @@ -178,6 +204,9 @@ typedef struct { Z_SRW_updateResponse *update_response; } u; char *srw_version; + char *username; /* From HTTP header or request */ + char *password; /* From HTTP header or request */ + char *extra_args; /* For SRU GET/POST only */ } Z_SRW_PDU; YAZ_EXPORT int yaz_srw_codec(ODR o, void * pptr, @@ -186,13 +215,21 @@ YAZ_EXPORT int yaz_srw_codec(ODR o, void * pptr, YAZ_EXPORT int yaz_ucp_codec(ODR o, void * pptr, Z_SRW_PDU **handler_data, void *client_data, const char *ns); +YAZ_EXPORT Z_SRW_PDU *yaz_srw_get_core_v_1_1(ODR o); +YAZ_EXPORT Z_SRW_PDU *yaz_srw_get_pdu(ODR o, int which, const char *version); YAZ_EXPORT Z_SRW_PDU *yaz_srw_get(ODR o, int which); +YAZ_EXPORT Z_SRW_recordVersion *yaz_srw_get_record_versions(ODR o, int num); YAZ_EXPORT Z_SRW_extra_record *yaz_srw_get_extra_record(ODR o); +YAZ_EXPORT Z_SRW_record *yaz_srw_get_record(ODR o); +YAZ_EXPORT Z_SRW_record *yaz_srw_get_records(ODR o, int num); YAZ_EXPORT int yaz_diag_bib1_to_srw (int bib1_code); YAZ_EXPORT int yaz_diag_srw_to_bib1(int srw_code); +YAZ_EXPORT const char *yaz_srw_pack_to_str(int pack); +YAZ_EXPORT int yaz_srw_str_to_pack(const char *str); + YAZ_EXPORT char *yaz_uri_val(const char *path, const char *name, ODR o); YAZ_EXPORT void yaz_uri_val_int(const char *path, const char *name, ODR o, int **intp); @@ -207,6 +244,9 @@ YAZ_EXPORT void yaz_add_srw_diagnostic(ODR o, Z_SRW_diagnostic **d, int *num, int code, const char *addinfo); +YAZ_EXPORT void yaz_add_sru_update_diagnostic(ODR o, Z_SRW_diagnostic **d, + int *num, int code, + const char *addinfo); YAZ_EXPORT void yaz_mk_std_diagnostic(ODR o, Z_SRW_diagnostic *d, int code, const char *details); @@ -221,9 +261,29 @@ YAZ_EXPORT void yaz_mk_srw_diagnostic(ODR o, Z_SRW_diagnostic *d, const char *details); YAZ_EXPORT int yaz_sru_get_encode(Z_HTTP_Request *hreq, Z_SRW_PDU *srw_pdu, - ODR encode, char *charset); + ODR encode, const char *charset); YAZ_EXPORT int yaz_sru_post_encode(Z_HTTP_Request *hreq, Z_SRW_PDU *srw_pdu, - ODR encode, char *charset); + ODR encode, const char *charset); +YAZ_EXPORT int yaz_sru_soap_encode(Z_HTTP_Request *hreq, Z_SRW_PDU *srw_pdu, + ODR odr, const char *charset); + +YAZ_EXPORT char *yaz_negotiate_sru_version(char *input_ver); + +#define YAZ_XMLNS_SRU_v1_0 "http://www.loc.gov/zing/srw/v1.0/" +#define YAZ_XMLNS_SRU_v1_1 "http://www.loc.gov/zing/srw/" +#define YAZ_XMLNS_DIAG_v1_1 "http://www.loc.gov/zing/srw/diagnostic/" +#define YAZ_XMLNS_UPDATE_v0_9 "http://www.loc.gov/zing/srw/update/" + +YAZ_EXPORT +int yaz_srw_check_content_type(Z_HTTP_Response *hres); + +YAZ_EXPORT +int sru_decode_surrogate_diagnostics(const char *buf, size_t len, + Z_SRW_diagnostic **diag, + int *num, ODR odr); + + + YAZ_END_CDECL #endif