YAZ  5.23.1
Functions
zoom-z3950.c File Reference

Implements ZOOM Z39.50 handling. More...

#include <assert.h>
#include <string.h>
#include <errno.h>
#include "zoom-p.h"
#include <yaz/yaz-util.h>
#include <yaz/xmalloc.h>
#include <yaz/otherinfo.h>
#include <yaz/log.h>
#include <yaz/pquery.h>
#include <yaz/marcdisp.h>
#include <yaz/diagbib1.h>
#include <yaz/charneg.h>
#include <yaz/ill.h>
#include <yaz/query-charset.h>
#include <yaz/copy_types.h>
#include <yaz/snprintf.h>
#include <yaz/facet.h>
#include <yaz/shptr.h>

Go to the source code of this file.

Functions

static Odr_oidzoom_yaz_str_to_z3950oid (ZOOM_connection c, oid_class oid_class, const char *str)
 
static Z_APDUcreate_es_package (ZOOM_package p, const Odr_oid *oid)
 
static const char * ill_array_lookup (void *clientData, const char *idx)
 
static Z_Externalencode_ill_request (ZOOM_package p)
 
static Z_ItemOrderencode_item_order (ZOOM_package p)
 
Z_APDUcreate_admin_package (ZOOM_package p, int type, Z_ESAdminOriginPartToKeep **toKeepP, Z_ESAdminOriginPartNotToKeep **notToKeepP)
 
static Z_APDUcreate_xmlupdate_package (ZOOM_package p)
 
static Z_APDUcreate_update_package (ZOOM_package p)
 
static void otherInfo_attach (ZOOM_connection c, Z_APDU *a, ODR out)
 
static int encode_APDU (ZOOM_connection c, Z_APDU *a, ODR out)
 
static zoom_ret send_APDU (ZOOM_connection c, Z_APDU *a)
 
zoom_ret ZOOM_connection_Z3950_send_init (ZOOM_connection c)
 
static zoom_ret Z3950_send_search (ZOOM_connection c)
 
zoom_ret ZOOM_connection_Z3950_send_scan (ZOOM_connection c)
 
 ZOOM_package_send (ZOOM_package p, const char *type)
 
static void handle_Z3950_records (ZOOM_connection c, Z_Records *sr, int present_phase)
 
static void response_default_diag (ZOOM_connection c, Z_DefaultDiagFormat *r)
 
static void response_diag (ZOOM_connection c, Z_DiagRec *p)
 
static int es_response_taskpackage_update (ZOOM_connection c, Z_IUUpdateTaskPackage *utp)
 
static int es_response_taskpackage (ZOOM_connection c, Z_TaskPackage *taskPackage)
 
static void handle_Z3950_es_response (ZOOM_connection c, Z_ExtendedServicesResponse *res)
 
static char * get_term_cstr (ODR odr, Z_Term *term)
 
static ZOOM_facet_field get_zoom_facet_field (ODR odr, Z_FacetField *facet)
 
void ZOOM_handle_facet_list (ZOOM_resultset r, Z_FacetList *fl)
 
void ZOOM_handle_facet_result (ZOOM_connection c, ZOOM_resultset r, Z_OtherInformation *o)
 
static void handle_queryExpressionTerm (ZOOM_options opt, const char *name, Z_Term *term)
 
static void handle_queryExpression (ZOOM_options opt, const char *name, Z_QueryExpression *exp)
 
void ZOOM_handle_search_result (ZOOM_connection c, ZOOM_resultset resultset, Z_OtherInformation *o)
 
static void handle_Z3950_search_response (ZOOM_connection c, Z_SearchResponse *sr)
 
static void handle_Z3950_sort_response (ZOOM_connection c, Z_SortResponse *res)
 
static void handle_Z3950_scan_response (ZOOM_connection c, Z_ScanResponse *res)
 
static void handle_Z3950_present_response (ZOOM_connection c, Z_PresentResponse *pr)
 
static void set_init_option (const char *name, void *clientData)
 
zoom_ret send_Z3950_sort (ZOOM_connection c, ZOOM_resultset resultset)
 
static zoom_ret Z3950_send_present (ZOOM_connection c)
 
zoom_ret ZOOM_connection_Z3950_search (ZOOM_connection c)
 
static zoom_ret send_Z3950_sort_present (ZOOM_connection c)
 
void ZOOM_handle_Z3950_apdu (ZOOM_connection c, Z_APDU *apdu)
 

Detailed Description

Implements ZOOM Z39.50 handling.

Definition in file zoom-z3950.c.

Function Documentation

Z_APDU* create_admin_package ( ZOOM_package  p,
int  type,
Z_ESAdminOriginPartToKeep **  toKeepP,
Z_ESAdminOriginPartNotToKeep **  notToKeepP 
)
static Z_APDU* create_es_package ( ZOOM_package  p,
const Odr_oid oid 
)
static
static Z_APDU* create_update_package ( ZOOM_package  p)
static

Definition at line 278 of file zoom-z3950.c.

References Z_IUOriginPartToKeep::action, Z_IUOriginPartToKeep::actionQualifier, CLASS_RECSYN, ZOOM_package_p::connection, Z_IUSuppliedRecords_elem::correlationInfo, create_es_package(), Z_IUOriginPartToKeep::databaseName, Z_External::descriptor, Z_External::direct_reference, Z_IUSuppliedRecords::elements, Z_IUOriginPartToKeep::elementSetName, Z_IUUpdate::esRequest, Z_APDU::extendedServicesRequest, Z_IUCorrelationInfo::id, Z_External::indirect_reference, Z_IUCorrelationInfo::note, Z_IUUpdateEsRequest::notToKeep, Z_IUSuppliedRecords::num, Z_IUSuppliedRecords_elem::number, odr_create_Odr_oct(), odr_createmem(), odr_destroy(), odr_intdup(), odr_malloc(), odr_oiddup(), ZOOM_package_p::odr_out, ODR_PRINT, odr_strdup(), odr_strdup_null(), Z_IUSuppliedRecords_elem::opaque, ZOOM_package_p::options, Z_IUSuppliedRecords_elem::record, Z_IUOriginPartToKeep::schema, Z_IUSuppliedRecords_elem::supplementalId, Z_ExtendedServicesRequest::taskSpecificParameters, Z_IUUpdateEsRequest::toKeep, Z_IUUpdate::u, Z_IUSuppliedRecords_elem::u, Z_External::u, Z_APDU::u, Z_External::update, Z_External::which, Z_IUUpdate::which, Z_IUSuppliedRecords_elem::which, yaz_oid_extserv_database_update, yaz_oid_extserv_database_update_first_version, yaz_oid_extserv_database_update_second_version, yaz_oid_std(), yaz_string_to_oid_odr(), z_APDU(), z_ext_record_oid(), z_ext_record_oid_any(), Z_External_update, Z_IUOriginPartToKeep_elementUpdate, Z_IUOriginPartToKeep_recordDelete, Z_IUOriginPartToKeep_recordInsert, Z_IUOriginPartToKeep_recordReplace, Z_IUOriginPartToKeep_specialUpdate, Z_IUSuppliedRecords_elem_number, Z_IUSuppliedRecords_elem_opaque, Z_IUUpdate_esRequest, ZOOM_connection_get_databases(), ZOOM_ERROR_ES_INVALID_ACTION, ZOOM_ERROR_ES_INVALID_SYNTAX, ZOOM_ERROR_ES_INVALID_VERSION, ZOOM_options_get(), ZOOM_options_getl(), and ZOOM_set_error().

Referenced by ZOOM_package_send().

static Z_APDU* create_xmlupdate_package ( ZOOM_package  p)
static
static int encode_APDU ( ZOOM_connection  c,
Z_APDU a,
ODR  out 
)
static
static Z_External* encode_ill_request ( ZOOM_package  p)
static
static Z_ItemOrder* encode_item_order ( ZOOM_package  p)
static
static int es_response_taskpackage ( ZOOM_connection  c,
Z_TaskPackage taskPackage 
)
static
static int es_response_taskpackage_update ( ZOOM_connection  c,
Z_IUUpdateTaskPackage utp 
)
static
static char* get_term_cstr ( ODR  odr,
Z_Term term 
)
static
static ZOOM_facet_field get_zoom_facet_field ( ODR  odr,
Z_FacetField facet 
)
static
static void handle_queryExpression ( ZOOM_options  opt,
const char *  name,
Z_QueryExpression exp 
)
static
static void handle_queryExpressionTerm ( ZOOM_options  opt,
const char *  name,
Z_Term term 
)
static
static void handle_Z3950_es_response ( ZOOM_connection  c,
Z_ExtendedServicesResponse res 
)
static
static void handle_Z3950_present_response ( ZOOM_connection  c,
Z_PresentResponse pr 
)
static

Definition at line 1430 of file zoom-z3950.c.

References handle_Z3950_records(), and Z_PresentResponse::records.

Referenced by ZOOM_handle_Z3950_apdu().

static void handle_Z3950_records ( ZOOM_connection  c,
Z_Records sr,
int  present_phase 
)
static
static void handle_Z3950_scan_response ( ZOOM_connection  c,
Z_ScanResponse res 
)
static
static void handle_Z3950_search_response ( ZOOM_connection  c,
Z_SearchResponse sr 
)
static
static void handle_Z3950_sort_response ( ZOOM_connection  c,
Z_SortResponse res 
)
static
static const char* ill_array_lookup ( void *  clientData,
const char *  idx 
)
static

Definition at line 91 of file zoom-z3950.c.

References ZOOM_package_p::options, and ZOOM_options_get().

Referenced by encode_ill_request().

static void otherInfo_attach ( ZOOM_connection  c,
Z_APDU a,
ODR  out 
)
static
static void response_default_diag ( ZOOM_connection  c,
Z_DefaultDiagFormat r 
)
static
static void response_diag ( ZOOM_connection  c,
Z_DiagRec p 
)
static
static zoom_ret send_APDU ( ZOOM_connection  c,
Z_APDU a 
)
static
zoom_ret send_Z3950_sort ( ZOOM_connection  c,
ZOOM_resultset  resultset 
)
static zoom_ret send_Z3950_sort_present ( ZOOM_connection  c)
static
static void set_init_option ( const char *  name,
void *  clientData 
)
static

Definition at line 1436 of file zoom-z3950.c.

References ZOOM_connection_option_set().

Referenced by ZOOM_handle_Z3950_apdu().

static zoom_ret Z3950_send_present ( ZOOM_connection  c)
static
static zoom_ret Z3950_send_search ( ZOOM_connection  c)
static

Definition at line 637 of file zoom-z3950.c.

References Z_SearchRequest::additionalSearchInfo, CLASS_RECSYN, ZOOM_resultset_p::databaseNames, Z_SearchRequest::databaseNames, Z_ElementSetNames::generic, Z_SearchRequest::largeSetLowerBound, ZOOM_connection_p::log_details, Z_SearchRequest::mediumSetElementSetNames, Z_SearchRequest::mediumSetPresentNumber, ZOOM_resultset_p::next, ZOOM_resultset_p::num_databaseNames, Z_SearchRequest::num_databaseNames, ZOOM_resultset_p::odr, odr_malloc(), ZOOM_connection_p::odr_out, odr_strdup(), ZOOM_resultset_p::options, ZOOM_resultset_p::piggyback, Z_SearchRequest::preferredRecordSyntax, ZOOM_resultset_p::query, Z_SearchRequest::query, ZOOM_resultset_p::r_sort_spec, ZOOM_resultset_p::req_facets, Z_SearchRequest::resultSetName, ZOOM_connection_p::resultsets, ZOOM_task_p::search, Z_APDU::searchRequest, send_APDU(), ZOOM_resultset_p::setname, Z_SearchRequest::smallSetElementSetNames, Z_SearchRequest::smallSetUpperBound, ZOOM_resultset_p::step, ZOOM_connection_p::support_named_resultsets, ZOOM_connection_p::tasks, Z_Query::type_1, ZOOM_task_p::u, Z_APDU::u, Z_Query::u, Z_ElementSetNames::u, ZOOM_task_p::which, Z_Query::which, Z_ElementSetNames::which, yaz_copy_Z_Query(), yaz_iconv_close(), yaz_iconv_open(), yaz_log(), yaz_oi_set_facetlist(), yaz_pqf_parse_facet_list(), yaz_query_charset_convert_rpnquery_check(), YLOG_WARN, Z_APDU_searchRequest, Z_ElementSetNames_generic, Z_Query_type_1, Z_Query_type_101, zget_APDU(), zoom_complete, ZOOM_ERROR_INVALID_QUERY, ZOOM_options_get(), ZOOM_options_get_int(), ZOOM_options_set(), ZOOM_query_get_Z_Query(), ZOOM_set_error(), ZOOM_TASK_SEARCH, and zoom_yaz_str_to_z3950oid().

Referenced by ZOOM_connection_Z3950_search().

zoom_ret ZOOM_connection_Z3950_search ( ZOOM_connection  c)
zoom_ret ZOOM_connection_Z3950_send_init ( ZOOM_connection  c)

Definition at line 559 of file zoom-z3950.c.

References ZOOM_connection_p::charset, Z_OtherInformationUnit::externallyDefinedInfo, ZOOM_connection_p::group, Z_IdPass::groupId, ZOOM_connection_p::host_port, Z_InitRequest::idAuthentication, Z_IdAuthentication::idPass, Z_InitRequest::implementationId, Z_InitRequest::implementationName, Z_InitRequest::implementationVersion, Z_OtherInformationUnit::information, Z_APDU::initRequest, ZOOM_connection_p::lang, ZOOM_connection_p::maximum_record_size, Z_InitRequest::maximumRecordSize, odr_malloc(), ODR_MASK_SET, ZOOM_connection_p::odr_out, odr_prepend(), odr_strdup(), odr_strdup_null(), Z_IdAuthentication::open, ZOOM_connection_p::options, Z_InitRequest::options, Z_InitRequest::otherInfo, ZOOM_connection_p::password, Z_IdPass::password, ZOOM_connection_p::preferred_message_size, Z_InitRequest::preferredMessageSize, Z_InitRequest::protocolVersion, ZOOM_connection_p::proxy_mode, send_APDU(), Z_APDU::u, Z_IdAuthentication::u, ZOOM_connection_p::user, Z_IdPass::userId, Z_IdAuthentication::which, Z_OtherInformationUnit::which, yaz_oi_APDU(), yaz_oi_set_string_oid(), yaz_oi_update(), yaz_oid_userinfo_proxy, yaz_set_proposal_charneg_list(), Z_APDU_initRequest, Z_IdAuthentication_idPass, Z_IdAuthentication_open, Z_Options_extendedServices, Z_Options_namedResultSets, Z_Options_negotiationModel, Z_Options_present, Z_Options_scan, Z_Options_search, Z_Options_sort, Z_OtherInfo_externallyDefinedInfo, Z_ProtocolVersion_1, Z_ProtocolVersion_2, Z_ProtocolVersion_3, zget_APDU(), and ZOOM_options_get().

Referenced by do_connect_host(), and ZOOM_connection_do_io().

zoom_ret ZOOM_connection_Z3950_send_scan ( ZOOM_connection  c)
void ZOOM_handle_facet_list ( ZOOM_resultset  r,
Z_FacetList fl 
)
void ZOOM_handle_facet_result ( ZOOM_connection  c,
ZOOM_resultset  r,
Z_OtherInformation o 
)
void ZOOM_handle_search_result ( ZOOM_connection  c,
ZOOM_resultset  resultset,
Z_OtherInformation o 
)
void ZOOM_handle_Z3950_apdu ( ZOOM_connection  c,
Z_APDU apdu 
)

Definition at line 1627 of file zoom-z3950.c.

References Z_APDU::close, ZOOM_connection_p::cookie_in, Z_Close::diagnosticInformation, Z_APDU::extendedServicesResponse, handle_Z3950_es_response(), handle_Z3950_present_response(), handle_Z3950_scan_response(), handle_Z3950_search_response(), handle_Z3950_sort_response(), ZOOM_connection_p::host_port, Z_InitResponse::implementationId, Z_InitResponse::implementationName, Z_InitResponse::implementationVersion, Z_APDU::initResponse, ZOOM_connection_p::log_api, ZOOM_connection_p::log_details, nmem_create(), nmem_destroy(), ODR_MASK_GET, Z_InitResponse::options, Z_InitResponse::otherInfo, Z_APDU::presentResponse, Z_InitResponse::protocolVersion, response_default_diag(), Z_InitResponse::result, Z_APDU::scanResponse, Z_APDU::searchResponse, send_Z3950_sort_present(), set_init_option(), Z_APDU::sortResponse, ZOOM_connection_p::support_named_resultsets, ZOOM_connection_p::tasks, Z_APDU::u, ZOOM_task_p::which, Z_APDU::which, xfree, xstrdup, yaz_decode_init_diag(), yaz_get_charneg_record(), yaz_get_response_charneg(), yaz_init_opt_decode(), yaz_log(), yaz_oi_get_string_oid(), yaz_oid_userinfo_cookie, Z_APDU_close, Z_APDU_extendedServicesResponse, Z_APDU_initResponse, Z_APDU_presentResponse, Z_APDU_scanResponse, Z_APDU_searchResponse, Z_APDU_sortResponse, Z_Options_namedResultSets, Z_Options_negotiationModel, Z_ProtocolVersion_3, zoom_complete, ZOOM_connection_close(), ZOOM_connection_exec_task(), ZOOM_connection_option_set(), ZOOM_connection_remove_task(), ZOOM_connection_set_mask(), ZOOM_connection_Z3950_search(), ZOOM_ERROR_CONNECTION_LOST, ZOOM_ERROR_DECODE, ZOOM_ERROR_INIT, ZOOM_set_dset_error(), ZOOM_set_error(), ZOOM_TASK_CONNECT, and ZOOM_test_reconnect().

Referenced by do_read().

ZOOM_package_send ( ZOOM_package  p,
const char *  type 
)
static Odr_oid* zoom_yaz_str_to_z3950oid ( ZOOM_connection  c,
oid_class  oid_class,
const char *  str 
)
static