X-Git-Url: http://git.indexdata.com/?p=yazpp-moved-to-github.git;a=blobdiff_plain;f=src%2Fyaz-ir-assoc.cpp;h=a681bf0db8fcff468e22e0a43cfed927a77cc96e;hp=31689f470cf5c7a19682576b51aa66d0d32ab12f;hb=HEAD;hpb=d508100e993ab5c9a415bd1826b939875dcfe91c diff --git a/src/yaz-ir-assoc.cpp b/src/yaz-ir-assoc.cpp index 31689f4..a681bf0 100644 --- a/src/yaz-ir-assoc.cpp +++ b/src/yaz-ir-assoc.cpp @@ -1,15 +1,17 @@ -/* - * Copyright (c) 1998-2003, Index Data. +/* This file is part of the yazpp toolkit. + * Copyright (C) Index Data * See the file LICENSE for details. - * - * $Id: yaz-ir-assoc.cpp,v 1.28 2007-04-12 15:00:33 adam Exp $ */ +#if HAVE_CONFIG_H +#include +#endif #include #include #include #include +#include using namespace yazpp_1; @@ -94,7 +96,7 @@ void IR_Assoc::set_databaseNames(const char *dblist, const char *sep) void IR_Assoc::set_preferredRecordSyntax (const char *syntax) { xfree(m_preferredRecordSyntax); - m_preferredRecordSyntax = 0; + m_preferredRecordSyntax = 0; if (syntax && *syntax) m_preferredRecordSyntax = xstrdup(syntax); } @@ -164,7 +166,7 @@ void IR_Assoc::recv_Z_PDU(Z_APDU *apdu, int len) recv_searchRequest(apdu->u.searchRequest); break; case Z_APDU_searchResponse: - yaz_log (m_log, "recv searchResponse"); + yaz_log (m_log, "recv searchResponse"); recv_searchResponse(apdu->u.searchResponse); break; case Z_APDU_presentRequest: @@ -205,7 +207,8 @@ int IR_Assoc::send_searchRequest(Yaz_Z_Query *query, assert (req->otherInfo == 0); if (m_cookie) { - set_otherInformationString(&req->otherInfo, OID_STR_COOKIE, 1, m_cookie); + set_otherInformationString(&req->otherInfo, yaz_oid_userinfo_cookie, + 1, m_cookie); assert (req->otherInfo); } @@ -222,10 +225,10 @@ int IR_Assoc::send_searchRequest(Yaz_Z_Query *query, return send_Z_PDU(apdu, 0); } -int IR_Assoc::send_presentRequest(int start, - int number, - char* pResultSetId, - char* pRefId) +int IR_Assoc::send_presentRequest(Odr_int start, + Odr_int number, + char* pResultSetId, + char* pRefId) { Z_APDU *apdu = create_Z_PDU(Z_APDU_presentRequest); Z_PresentRequest *req = apdu->u.presentRequest; @@ -252,7 +255,7 @@ int IR_Assoc::send_presentRequest(int start, } if (m_cookie) - set_otherInformationString(&req->otherInfo, OID_STR_COOKIE, + set_otherInformationString(&req->otherInfo, yaz_oid_userinfo_cookie, 1, m_cookie); if ( pRefId ) @@ -300,9 +303,10 @@ void IR_Assoc::client(const char *addr) delete [] m_host; m_host = new char[strlen(addr)+1]; strcpy(m_host, addr); - const char *dbpart = strchr(m_host, '/'); - if (dbpart) - set_databaseNames (dbpart+1, "+ "); + const char *dbpart = 0; + cs_get_host_args(m_host, &dbpart); + if (dbpart && *dbpart) + set_databaseNames (dbpart, "+ "); Z_Assoc::client(m_proxy ? m_proxy : m_host); } @@ -364,7 +368,7 @@ int IR_Assoc::send_initRequest(char* pRefId) { Z_APDU *apdu = create_Z_PDU(Z_APDU_initRequest); Z_InitRequest *req = apdu->u.initRequest; - + ODR_MASK_SET(req->options, Z_Options_search); ODR_MASK_SET(req->options, Z_Options_present); ODR_MASK_SET(req->options, Z_Options_namedResultSets); @@ -384,9 +388,11 @@ int IR_Assoc::send_initRequest(char* pRefId) } if (m_proxy && m_host) - set_otherInformationString(&req->otherInfo, OID_STR_PROXY, 1, m_host); + set_otherInformationString(&req->otherInfo, yaz_oid_userinfo_proxy, + 1, m_host); if (m_cookie) - set_otherInformationString(&req->otherInfo, OID_STR_COOKIE, 1, m_cookie); + set_otherInformationString(&req->otherInfo, yaz_oid_userinfo_cookie, + 1, m_cookie); return send_Z_PDU(apdu, 0); } @@ -408,16 +414,18 @@ int IR_Assoc::send_deleteResultSetRequest(char* pResultSetId, char* pRefId) { *req->deleteFunction = Z_DeleteResultSetRequest_all; } - + if ( pRefId ) { req->referenceId = getRefID(pRefId); } if (m_proxy && m_host) - set_otherInformationString(&req->otherInfo, OID_STR_PROXY, 1, m_host); + set_otherInformationString(&req->otherInfo, yaz_oid_userinfo_proxy, + 1, m_host); if (m_cookie) - set_otherInformationString(&req->otherInfo, OID_STR_COOKIE, 1, m_cookie); + set_otherInformationString(&req->otherInfo, yaz_oid_userinfo_cookie, + 1, m_cookie); return send_Z_PDU(apdu, 0); } @@ -426,6 +434,7 @@ int IR_Assoc::send_deleteResultSetRequest(char* pResultSetId, char* pRefId) /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil * End: * vim: shiftwidth=4 tabstop=8 expandtab