X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=include%2Fyaz%2Fsrw.h;h=e7b92ffbfd58d7e934b6b7ad9d3ab89f03b8bc22;hp=1a074182af82a658bc1e0eb8e0a329b614470ebd;hb=869d0e8acb79984b9191576c566cb7753f653ea8;hpb=8356ea58313ee1f350226172cf99bfb0b7c5583c diff --git a/include/yaz/srw.h b/include/yaz/srw.h index 1a07418..e7b92ff 100644 --- a/include/yaz/srw.h +++ b/include/yaz/srw.h @@ -1,5 +1,5 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2009 Index Data. + * Copyright (C) 1995-2010 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: @@ -37,6 +37,7 @@ #include #include #include +#include "facet.h" YAZ_BEGIN_CDECL @@ -92,6 +93,7 @@ typedef struct { char *database; char *stylesheet; Odr_int *resultSetTTL; + Z_FacetList *facet_list; } Z_SRW_searchRetrieveRequest; typedef struct { @@ -107,6 +109,7 @@ typedef struct { Odr_int *nextRecordPosition; Z_SRW_extra_record **extra_records; /* of size num_records */ + Z_FacetList *facet_list; } Z_SRW_searchRetrieveResponse; typedef struct { @@ -212,7 +215,9 @@ typedef struct { char *srw_version; char *username; /* From HTTP header or request */ char *password; /* From HTTP header or request */ - Z_SRW_extra_arg *extra_args; /* only used for SRU GET/POST */ + Z_SRW_extra_arg *extra_args; /* extraRequestData SRU GET/POST */ + char *extraResponseData_buf; + int extraResponseData_len; } Z_SRW_PDU; YAZ_EXPORT int yaz_srw_codec(ODR o, void * pptr, @@ -236,16 +241,51 @@ 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); +/** \brief deprecated */ YAZ_EXPORT char *yaz_uri_val(const char *path, const char *name, ODR o); + +/** \brief deprecated */ YAZ_EXPORT void yaz_uri_val_int(const char *path, const char *name, ODR o, Odr_int **intp); + +YAZ_EXPORT int yaz_uri_to_array(const char *path, ODR o, + char ***name, char ***val); +YAZ_EXPORT void yaz_array_to_uri(char **path, ODR o, + char **name, char **value); + +/** \brief encodes URI component + \param dst destination string (should be at least 3*strlen(uri)+1) + \param uri URI component C-string (source) +*/ +YAZ_EXPORT void yaz_encode_uri_component(char *dst, const char *uri); + +/** \brief decodes URI component + \param dst destination string (should be at least strlen(uri)+1) + \param uri URI component buffer (source) + \param len number of bytes to decode from uri +*/ +YAZ_EXPORT void yaz_decode_uri_component(char *dst, const char *uri, + size_t len); + YAZ_EXPORT int yaz_srw_decode(Z_HTTP_Request *hreq, Z_SRW_PDU **srw_pdu, Z_SOAP **soap_package, ODR decode, char **charset); + YAZ_EXPORT int yaz_sru_decode(Z_HTTP_Request *hreq, Z_SRW_PDU **srw_pdu, Z_SOAP **soap_package, ODR decode, char **charset, Z_SRW_diagnostic **, int *num_diagnostic); +/** \brief decode SOLR response (HTTP) + \param o ODR for result + \param hres HTTP response to be decoded + \param pdup SRW response pointer (set if successful) + \retval -1 fail + \retval 0 OK +*/ +YAZ_EXPORT int yaz_solr_decode_response(ODR o, Z_HTTP_Response *hres, + Z_SRW_PDU **pdup); + + YAZ_EXPORT void yaz_add_srw_diagnostic(ODR o, Z_SRW_diagnostic **d, int *num, int code, const char *addinfo); @@ -273,6 +313,17 @@ YAZ_EXPORT int yaz_sru_post_encode(Z_HTTP_Request *hreq, Z_SRW_PDU *srw_pdu, YAZ_EXPORT int yaz_sru_soap_encode(Z_HTTP_Request *hreq, Z_SRW_PDU *srw_pdu, ODR odr, const char *charset); +/** \brief encode SOLR request (HTTP) + \param hreq HTTP request to be modified (with encoded request) + \param srw_pdu SRW request + \param encode ODR for result + \param charset character set for request (may be NULL) + \retval -1 fail + \retval 0 OK +*/ +YAZ_EXPORT int yaz_solr_encode_request(Z_HTTP_Request *hreq, Z_SRW_PDU *srw_pdu, + ODR encode, const char *charset); + YAZ_EXPORT char *yaz_negotiate_sru_version(char *input_ver); YAZ_EXPORT @@ -295,7 +346,23 @@ int sru_decode_surrogate_diagnostics(const char *buf, size_t len, YAZ_EXPORT void yaz_mk_sru_surrogate(ODR o, Z_SRW_record *record, int pos, int code, const char *details); - + +/** \brief encode SRU database for HTTP path + \param out memory handle for resulting encoded database string + \param db source database + \returns encoded database path (includes leading /) +*/ +YAZ_EXPORT +char *yaz_encode_sru_dbpath_odr(ODR out, const char *db); + +/** \brief encode SRU database for HTTP path + \param dst destination buffer (should be at least strlen(db) +2 in size) + \param db source database + + The resulting database (dst) includes a leading / +*/ +YAZ_EXPORT +void yaz_encode_sru_dbpath_buf(char *dst, const char *db); YAZ_END_CDECL