X-Git-Url: http://sru.miketaylor.org.uk/?a=blobdiff_plain;f=src%2Fyaz-z-assoc.cpp;h=1990698e3620baabd88e6b15952b6300d13b21c2;hb=d7ed1a9024ed29911ac5ce2a58fb4996de63bf46;hp=d28ae9480f3f1dce2a3e7ed3dce28b2858947248;hpb=0e4148ba1e09e25bea2fa1403bf720860a308082;p=yazpp-moved-to-github.git diff --git a/src/yaz-z-assoc.cpp b/src/yaz-z-assoc.cpp index d28ae94..1990698 100644 --- a/src/yaz-z-assoc.cpp +++ b/src/yaz-z-assoc.cpp @@ -2,14 +2,14 @@ * Copyright (c) 1998-2001, Index Data. * See the file LICENSE for details. * - * $Id: yaz-z-assoc.cpp,v 1.24 2002-09-10 11:30:37 adam Exp $ + * $Id: yaz-z-assoc.cpp,v 1.27 2003-10-10 12:37:26 adam Exp $ */ #include #include #include -#include +#include #include int Yaz_Z_Assoc::yaz_init_func() @@ -78,7 +78,7 @@ void Yaz_Z_Assoc::recv_PDU(const char *buf, int len) Z_APDU *apdu = decode_Z_PDU (buf, len); if (apdu) { - recv_Z_PDU (apdu); + recv_Z_PDU (apdu, len); } else { @@ -169,12 +169,16 @@ void Yaz_Z_Assoc::transfer_referenceId(Z_APDU *from, Z_APDU *to) *id_to = 0; } -int Yaz_Z_Assoc::send_Z_PDU(Z_APDU *apdu) +int Yaz_Z_Assoc::send_Z_PDU(Z_APDU *apdu, int *plen) { char *buf; int len; if (encode_Z_PDU(apdu, &buf, &len) > 0) + { + if (plen) + *plen = len; return m_PDU_Observable->send_PDU(buf, len); + } return -1; } @@ -229,12 +233,12 @@ const char *Yaz_Z_Assoc::get_hostname() return m_hostname; } -void Yaz_Z_Assoc::client(const char *addr) +int Yaz_Z_Assoc::client(const char *addr) { delete [] m_hostname; m_hostname = new char[strlen(addr)+1]; strcpy (m_hostname, addr); - m_PDU_Observable->connect (this, addr); + return m_PDU_Observable->connect (this, addr); } void Yaz_Z_Assoc::close()