X-Git-Url: http://git.indexdata.com/?p=yazpp-moved-to-github.git;a=blobdiff_plain;f=src%2Fyaz-z-assoc.cpp;h=24b60d03d99ed139ba4155a5acac9d51dfdeca19;hp=bf8297032d190214ebca0e554af0b88064669921;hb=0084c40d8bc6babaeb0b833b12d9cd625c807525;hpb=0cc824e02bc2c69986bec8c9dd9ff53f07a0cd3d diff --git a/src/yaz-z-assoc.cpp b/src/yaz-z-assoc.cpp index bf82970..24b60d0 100644 --- a/src/yaz-z-assoc.cpp +++ b/src/yaz-z-assoc.cpp @@ -1,16 +1,18 @@ -/* - * Copyright (c) 1998-2004, Index Data. +/* This file is part of the yazpp toolkit. + * Copyright (C) 1998-2012 Index Data and Mike Taylor * See the file LICENSE for details. - * - * $Id: yaz-z-assoc.cpp,v 1.39 2006-03-29 13:14:18 adam Exp $ */ +#if HAVE_CONFIG_H +#include +#endif #include #include #include #include #include +#include using namespace yazpp_1; @@ -94,7 +96,7 @@ void Z_Assoc::recv_PDU(const char *buf, int len) } else { - close(); + m_PDU_Observable->shutdown(); failNotify(); } } @@ -213,9 +215,9 @@ Z_GDU *Z_Assoc::decode_GDU(const char *buf, int len) if (!z_GDU(m_odr_in, &apdu, 0, 0)) { const char *element = odr_getelement(m_odr_in); - yaz_log(YLOG_LOG, "PDU decode failed '%s' near byte %d. Element %s", + yaz_log(YLOG_LOG, "PDU decode failed '%s' near byte %ld. Element %s", odr_errmsg(odr_geterror(m_odr_in)), - odr_offset(m_odr_in), + (long) odr_offset(m_odr_in), element ? element : "unknown"); yaz_log(YLOG_LOG, "PDU dump:"); odr_dumpBER(yaz_log_file(), buf, len); @@ -291,7 +293,7 @@ int Z_Assoc::client(const char *addr) void Z_Assoc::close() { - m_PDU_Observable->close (); + m_PDU_Observable->close_session(); } int Z_Assoc::server(const char *addr) @@ -373,36 +375,21 @@ void Z_Assoc::get_otherInfoAPDU(Z_APDU *apdu, Z_OtherInformation ***oip) } } -void Z_Assoc::set_otherInformationString ( +void Z_Assoc::set_otherInformationString( Z_APDU *apdu, - int oidval, int categoryValue, - const char *str) + const Odr_oid *oid, int categoryValue, const char *str) { Z_OtherInformation **otherInformation; get_otherInfoAPDU(apdu, &otherInformation); if (!otherInformation) return; - set_otherInformationString(otherInformation, oidval, categoryValue, str); -} - -void Z_Assoc::set_otherInformationString ( - Z_OtherInformation **otherInformation, - int oidval, int categoryValue, - const char *str) -{ - int oid[OID_SIZE]; - struct oident ent; - ent.proto = PROTO_Z3950; - ent.oclass = CLASS_USERINFO; - ent.value = (oid_value) oidval; - if (!oid_ent_to_oid (&ent, oid)) - return ; set_otherInformationString(otherInformation, oid, categoryValue, str); } + void Z_Assoc::set_otherInformationString ( Z_OtherInformation **otherInformation, - int *oid, int categoryValue, const char *str) + const Odr_oid *oid, int categoryValue, const char *str) { Z_OtherInformationUnit *oi = update_otherInformation(otherInformation, 1, oid, categoryValue, 0); @@ -413,7 +400,7 @@ void Z_Assoc::set_otherInformationString ( Z_OtherInformationUnit *Z_Assoc::update_otherInformation ( Z_OtherInformation **otherInformationP, int createFlag, - int *oid, int categoryValue, int deleteFlag) + const Odr_oid *oid, int categoryValue, int deleteFlag) { return yaz_oi_update (otherInformationP, (createFlag ? odr_encode() : 0), @@ -436,6 +423,7 @@ Z_ReferenceId* Z_Assoc::getRefID(char* str) /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil * End: * vim: shiftwidth=4 tabstop=8 expandtab