X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fyaz-z-assoc.cpp;h=e268248d6060b17a080d65ec61a890c0d176af94;hb=bed85d2160500f57db63f4ab9d5533e0225cce15;hp=f97838a765430bed7c0a9df3eacd01c0b855fd01;hpb=fa96bc0dcc16f6ac3e33b5144664e51cb7d09874;p=yazpp-moved-to-github.git diff --git a/src/yaz-z-assoc.cpp b/src/yaz-z-assoc.cpp index f97838a..e268248 100644 --- a/src/yaz-z-assoc.cpp +++ b/src/yaz-z-assoc.cpp @@ -1,10 +1,11 @@ -/* - * Copyright (c) 1998-2007, 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.42 2007-04-16 21:54:23 adam Exp $ */ +#if HAVE_CONFIG_H +#include +#endif #include #include @@ -95,7 +96,7 @@ void Z_Assoc::recv_PDU(const char *buf, int len) } else { - close(); + m_PDU_Observable->shutdown(); failNotify(); } } @@ -217,7 +218,15 @@ Z_GDU *Z_Assoc::decode_GDU(const char *buf, int len) yaz_log(YLOG_LOG, "PDU decode failed '%s' near byte %ld. Element %s", odr_errmsg(odr_geterror(m_odr_in)), (long) odr_offset(m_odr_in), - element ? element : "unknown"); + element && *element ? element : "unknown"); + yaz_log(YLOG_LOG, "Buffer length: %d", (int) len); + if (len > 0) + { + WRBUF w = wrbuf_alloc(); + wrbuf_write_escaped(w, buf, len > 1024 ? 1024 : len); + yaz_log(YLOG_LOG, "Buffer bytes: %s", wrbuf_cstr(w)); + wrbuf_destroy(w); + } yaz_log(YLOG_LOG, "PDU dump:"); odr_dumpBER(yaz_log_file(), buf, len); return 0; @@ -292,7 +301,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) @@ -376,7 +385,7 @@ void Z_Assoc::get_otherInfoAPDU(Z_APDU *apdu, Z_OtherInformation ***oip) void Z_Assoc::set_otherInformationString( Z_APDU *apdu, - const int *oid, int categoryValue, const char *str) + const Odr_oid *oid, int categoryValue, const char *str) { Z_OtherInformation **otherInformation; get_otherInfoAPDU(apdu, &otherInformation); @@ -388,7 +397,7 @@ void Z_Assoc::set_otherInformationString( void Z_Assoc::set_otherInformationString ( Z_OtherInformation **otherInformation, - const 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); @@ -399,7 +408,7 @@ void Z_Assoc::set_otherInformationString ( Z_OtherInformationUnit *Z_Assoc::update_otherInformation ( Z_OtherInformation **otherInformationP, int createFlag, - const int *oid, int categoryValue, int deleteFlag) + const Odr_oid *oid, int categoryValue, int deleteFlag) { return yaz_oi_update (otherInformationP, (createFlag ? odr_encode() : 0), @@ -422,6 +431,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