-/*
- * Copyright (c) 1995-2007, Index Data
+/* This file is part of the YAZ toolkit.
+ * Copyright (C) 1995-2009 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:
* (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.37 2008-01-28 09:51:02 adam Exp $ */
/**
* \file srw.h
#define Z_SRW_recordPacking_URL 2
char *recordData_buf;
int recordData_len;
- int *recordPosition;
+ Odr_int *recordPosition;
} Z_SRW_record;
typedef struct {
char *sortKeys;
char *xSortKeys;
} sort;
- int *startRecord;
- int *maximumRecords;
+ Odr_int *startRecord;
+ Odr_int *maximumRecords;
char *recordSchema;
char *recordPacking;
char *recordXPath;
char *database;
char *stylesheet;
- int *resultSetTTL;
+ Odr_int *resultSetTTL;
} Z_SRW_searchRetrieveRequest;
typedef struct {
- int * numberOfRecords;
+ Odr_int *numberOfRecords;
char * resultSetId;
- int * resultSetIdleTime;
+ Odr_int *resultSetIdleTime;
Z_SRW_record *records;
int num_records;
Z_SRW_diagnostic *diagnostics;
int num_diagnostics;
- int *nextRecordPosition;
+ Odr_int *nextRecordPosition;
Z_SRW_extra_record **extra_records; /* of size num_records */
} Z_SRW_searchRetrieveResponse;
char *xcql;
char *pqf;
} scanClause;
- int *responsePosition;
- int *maximumTerms;
+ Odr_int *responsePosition;
+ Odr_int *maximumTerms;
char *stylesheet;
char *database;
} Z_SRW_scanRequest;
typedef struct {
char *value;
- int *numberOfRecords;
+ Odr_int *numberOfRecords;
char *displayTerm;
char *whereInList;
} Z_SRW_scanTerm;
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,
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, int **intp);
+ 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_SRW_diagnostic **diag,
int *num, ODR odr);
-
+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
/*
* Local variables:
* c-basic-offset: 4
+ * c-file-style: "Stroustrup"
* indent-tabs-mode: nil
* End:
* vim: shiftwidth=4 tabstop=8 expandtab