X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fzoom-z3950.c;h=bea312553f3db7d72aab717b09dbf8278a33fef5;hb=5ae2f74ba9b27bb7e926d5908471ac79371f7823;hp=cf1b12f9cc3edc74866a454c9c8453d334b479dd;hpb=5242cb5a8634bfa38b9333ff7f903e718ac6e292;p=yaz-moved-to-github.git diff --git a/src/zoom-z3950.c b/src/zoom-z3950.c index cf1b12f..bea3125 100644 --- a/src/zoom-z3950.c +++ b/src/zoom-z3950.c @@ -1,5 +1,5 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2012 Index Data + * Copyright (C) 1995-2013 Index Data * See the file LICENSE for details. */ /** @@ -959,7 +959,6 @@ ZOOM_API(void) } } - static void handle_Z3950_records(ZOOM_connection c, Z_Records *sr, int present_phase); @@ -1085,35 +1084,6 @@ static int handle_Z3950_es_response(ZOOM_connection c, return 1; } -static void interpret_init_diag(ZOOM_connection c, - Z_DiagnosticFormat *diag) -{ - if (diag->num > 0) - { - Z_DiagnosticFormat_s *ds = diag->elements[0]; - if (ds->which == Z_DiagnosticFormat_s_defaultDiagRec) - response_default_diag(c, ds->u.defaultDiagRec); - } -} - - -static void interpret_otherinformation_field(ZOOM_connection c, - Z_OtherInformation *ui) -{ - int i; - for (i = 0; i < ui->num_elements; i++) - { - Z_OtherInformationUnit *unit = ui->list[i]; - if (unit->which == Z_OtherInfo_externallyDefinedInfo && - unit->information.externallyDefinedInfo && - unit->information.externallyDefinedInfo->which == - Z_External_diag1) - { - interpret_init_diag(c, unit->information.externallyDefinedInfo->u.diag1); - } - } -} - static char *get_term_cstr(ODR odr, Z_Term *term) { switch (term->which) { @@ -1147,7 +1117,8 @@ static ZOOM_facet_field get_zoom_facet_field(ODR odr, Z_FacetField *facet) { } /* Can be share with SOLR/SRU/SRW requests */ -void handle_facet_list(ZOOM_resultset r, Z_FacetList *fl) { +void ZOOM_handle_facet_list(ZOOM_resultset r, Z_FacetList *fl) +{ int j; r->num_facets = fl->num; yaz_log(YLOG_DEBUG, "Facets found: %d", fl->num); @@ -1173,7 +1144,7 @@ static void handle_facet_result(ZOOM_connection c, ZOOM_resultset r, Z_External *ext = o->list[i]->information.externallyDefinedInfo; if (ext->which == Z_External_userFacets) { - handle_facet_list(r, ext->u.facetList); + ZOOM_handle_facet_list(r, ext->u.facetList); } } } @@ -1680,12 +1651,11 @@ void ZOOM_handle_Z3950_apdu(ZOOM_connection c, Z_APDU *apdu) if (!*initrs->result) { - Z_External *uif = initrs->userInformationField; - - ZOOM_set_error(c, ZOOM_ERROR_INIT, 0); /* default error */ - - if (uif && uif->which == Z_External_userInfo1) - interpret_otherinformation_field(c, uif->u.userInfo1); + Z_DefaultDiagFormat *df = yaz_decode_init_diag(0, initrs); + if (df) + response_default_diag(c, df); + else + ZOOM_set_error(c, ZOOM_ERROR_INIT, 0); /* default error */ } else {