* Copyright (C) 1995-2005, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: srw.h,v 1.23 2005-11-08 15:08:02 adam Exp $
+ * $Id: srw.h,v 1.24 2005-12-14 14:05:55 adam Exp $
*/
/**
* \file srw.h
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);
+
+YAZ_EXPORT void yaz_add_srw_diagnostic_uri(ODR o, Z_SRW_diagnostic **d,
+ int *num, const char *uri,
+ const char *message,
+ const char *details);
+
+YAZ_EXPORT void yaz_mk_srw_diagnostic(ODR o, Z_SRW_diagnostic *d,
+ const char *uri, const char *message,
+ const char *details);
+
YAZ_END_CDECL
#endif
* Copyright (C) 1995-2005, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: srwutil.c,v 1.33 2005-11-09 17:48:11 adam Exp $
+ * $Id: srwutil.c,v 1.34 2005-12-14 14:05:55 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);
+ return 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);
+ return 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)
{