* Copyright (c) 2000-2001, Index Data.
* See the file LICENSE for details.
*
- * $Id: yaz-z-server.h,v 1.10 2001-05-17 14:18:03 adam Exp $
+ * $Id: yaz-z-server.h,v 1.11 2002-04-24 12:21:03 adam Exp $
*/
#include <yaz++/yaz-z-assoc.h>
Z_Records *create_nonSurrogateDiagnostics (ODR odr, int error,
const char *addinfo);
+
+ void Yaz_Z_ServerUtility::create_diagnostics (
+ ODR odr, int error, const char *addinfo,
+ Z_DiagRec ***dreca, int *num);
};
class YAZ_EXPORT IYaz_Server_Facility {
* Copyright (c) 2000-2001, Index Data.
* See the file LICENSE for details.
*
- * $Id: yaz-z-server.cpp,v 1.13 2001-11-04 22:36:21 adam Exp $
+ * $Id: yaz-z-server.cpp,v 1.14 2002-04-24 12:21:03 adam Exp $
*/
#include <yaz/log.h>
ODR odr, Z_NamePlusRecord *rec, const char *dbname,
int error, char *const addinfo)
{
- int oid[OID_SIZE];
int *err = (int *)odr_malloc (odr, sizeof(*err));
- oident bib1;
Z_DiagRec *drec = (Z_DiagRec *)odr_malloc (odr, sizeof(*drec));
Z_DefaultDiagFormat *dr = (Z_DefaultDiagFormat *)
odr_malloc (odr, sizeof(*dr));
- bib1.proto = PROTO_Z3950;
- bib1.oclass = CLASS_DIAGSET;
- bib1.value = VAL_BIB1;
-
yaz_log(LOG_DEBUG, "SurrogateDiagnotic: %d -- %s", error, addinfo);
*err = error;
rec->databaseName = dbname ? odr_strdup (odr, dbname) : 0;
rec->u.surrogateDiagnostic = drec;
drec->which = Z_DiagRec_defaultFormat;
drec->u.defaultFormat = dr;
- dr->diagnosticSetId = odr_oiddup (odr,
- oid_ent_to_oid(&bib1, oid));
+ dr->diagnosticSetId =
+ yaz_oidval_to_z3950oid (odr, CLASS_DIAGSET, VAL_BIB1);
+
dr->condition = err;
dr->which = Z_DefaultDiagFormat_v2Addinfo;
dr->u.v2Addinfo = odr_strdup (odr, addinfo ? addinfo : "");
Z_Records *Yaz_Z_ServerUtility::create_nonSurrogateDiagnostics (
ODR odr, int error, const char *addinfo)
{
- int oid[OID_SIZE];
Z_Records *rec = (Z_Records *)
odr_malloc (odr, sizeof(*rec));
- oident bib1;
int *err = (int *)
odr_malloc (odr, sizeof(*err));
Z_DiagRec *drec = (Z_DiagRec *)
Z_DefaultDiagFormat *dr = (Z_DefaultDiagFormat *)
odr_malloc (odr, sizeof(*dr));
- bib1.proto = PROTO_Z3950;
- bib1.oclass = CLASS_DIAGSET;
- bib1.value = VAL_BIB1;
-
*err = error;
rec->which = Z_Records_NSD;
rec->u.nonSurrogateDiagnostic = dr;
dr->diagnosticSetId =
- odr_oiddup (odr, oid_ent_to_oid(&bib1, oid));
+ yaz_oidval_to_z3950oid (odr, CLASS_DIAGSET, VAL_BIB1);
+
dr->condition = err;
dr->which = Z_DefaultDiagFormat_v2Addinfo;
dr->u.v2Addinfo = odr_strdup (odr, addinfo ? addinfo : "");
return rec;
}
+
+void Yaz_Z_ServerUtility::create_diagnostics (
+ ODR odr, int error, const char *addinfo,
+ Z_DiagRec ***dreca, int *num)
+{
+ Z_DiagRec *drec = (Z_DiagRec *) odr_malloc (odr, sizeof(*drec));
+ Z_DefaultDiagFormat *dr = (Z_DefaultDiagFormat *)
+ odr_malloc (odr, sizeof(*dr));
+
+ *num = 1;
+ *dreca = (Z_DiagRec **) odr_malloc (odr, sizeof(*dreca));
+ (*dreca)[0] = drec;
+
+ drec->which = Z_DiagRec_defaultFormat;
+ drec->u.defaultFormat = dr;
+ dr->diagnosticSetId =
+ yaz_oidval_to_z3950oid (odr, CLASS_DIAGSET, VAL_BIB1);
+ dr->condition = odr_intdup (odr, error);
+ dr->which = Z_DefaultDiagFormat_v2Addinfo;
+ dr->u.v2Addinfo = odr_strdup (odr, addinfo ? addinfo : "");
+}