* Copyright (C) 1995-2005, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: srwutil.c,v 1.32 2005-11-08 15:08:03 adam Exp $
+ * $Id: srwutil.c,v 1.35 2006-02-01 20:28:44 adam Exp $
*/
/**
* \file srwutil.c
*intp = odr_intdup(o, atoi(v));
}
-void yaz_mk_std_diagnostic(ODR o, Z_SRW_diagnostic *d,
- int code, const char *details)
+void yaz_mk_srw_diagnostic(ODR o, Z_SRW_diagnostic *d,
+ const char *uri, const char *message,
+ const char *details)
{
- d->uri = (char *) odr_malloc(o, 50);
- sprintf(d->uri, "info:srw/diagnostic/1/%d", code);
- d->message = 0;
+ d->uri = odr_strdup(o, uri);
+ if (message)
+ d->message = odr_strdup(o, message);
+ else
+ d->message = 0;
if (details)
d->details = odr_strdup(o, details);
else
d->details = 0;
}
-void yaz_add_srw_diagnostic(ODR o, Z_SRW_diagnostic **d,
- int *num, int code, const char *addinfo)
+void yaz_mk_std_diagnostic(ODR o, Z_SRW_diagnostic *d,
+ int code, const char *details)
+{
+ char uri[40];
+
+ sprintf(uri, "info:srw/diagnostic/1/%d", code);
+ yaz_mk_srw_diagnostic(o, d, uri, 0, details);
+}
+
+void yaz_add_srw_diagnostic_uri(ODR o, Z_SRW_diagnostic **d,
+ int *num, const char *uri,
+ const char *message, const char *details)
{
Z_SRW_diagnostic *d_new;
d_new = (Z_SRW_diagnostic *) odr_malloc (o, (*num + 1)* sizeof(**d));
memcpy (d_new, *d, *num *sizeof(**d));
*d = d_new;
- yaz_mk_std_diagnostic(o, *d + *num, code, addinfo);
+ yaz_mk_srw_diagnostic(o, *d + *num, uri, message, details);
(*num)++;
}
+void yaz_add_srw_diagnostic(ODR o, Z_SRW_diagnostic **d,
+ int *num, int code, const char *addinfo)
+{
+ char uri[40];
+
+ sprintf(uri, "info:srw/diagnostic/1/%d", code);
+ yaz_add_srw_diagnostic_uri(o, d, num, uri, 0, addinfo);
+}
+
int yaz_srw_decode(Z_HTTP_Request *hreq, Z_SRW_PDU **srw_pdu,
Z_SOAP **soap_package, ODR decode, char **charset)
{
219, 1, /* bad map */
220, 1, /* bad map */
221, 1, /* bad map */
- 222, 1, /* bad map */
+ 222, 3,
223, 1, /* bad map */
224, 1, /* bad map */
225, 1, /* bad map */