From 66767801433aba6cd2ac9fc744a1057867df7fa9 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Mon, 13 Sep 1999 12:53:44 +0000 Subject: [PATCH] Proxy removes OtherInfo Proxy Address and Session ID. Other Otherinfo remains untouched. --- include/yaz-z-assoc.h | 4 +-- src/yaz-proxy.cpp | 13 ++++++--- src/yaz-z-assoc.cpp | 72 ++++++++----------------------------------------- 3 files changed, 23 insertions(+), 66 deletions(-) diff --git a/include/yaz-z-assoc.h b/include/yaz-z-assoc.h index e8c2a1a..f02468d 100644 --- a/include/yaz-z-assoc.h +++ b/include/yaz-z-assoc.h @@ -3,7 +3,7 @@ * See the file LICENSE for details. * Sebastian Hammer, Adam Dickmeiss * - * $Id: yaz-z-assoc.h,v 1.3 1999-04-21 12:09:01 adam Exp $ + * $Id: yaz-z-assoc.h,v 1.4 1999-09-13 12:53:44 adam Exp $ */ #include @@ -55,7 +55,7 @@ class YAZ_EXPORT Yaz_Z_Assoc : public IYaz_PDU_Observer { void get_otherInfoAPDU(Z_APDU *apdu, Z_OtherInformation ***oip); Z_OtherInformationUnit *update_otherInformation ( Z_OtherInformation **otherInformationP, int createFlag, - int *oid, int categoryValue); + int *oid, int categoryValue, int deleteFlag); void set_otherInformationString ( Z_OtherInformation **otherInformationP, int *oid, int categoryValue, diff --git a/src/yaz-proxy.cpp b/src/yaz-proxy.cpp index d90d0d3..a61233e 100644 --- a/src/yaz-proxy.cpp +++ b/src/yaz-proxy.cpp @@ -4,7 +4,11 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: yaz-proxy.cpp,v $ - * Revision 1.8 1999-05-04 10:53:00 adam + * Revision 1.9 1999-09-13 12:53:44 adam + * Proxy removes OtherInfo Proxy Address and Session ID. Other + * Otherinfo remains untouched. + * + * Revision 1.8 1999/05/04 10:53:00 adam * Changed the way the PROXY behaves when lost cookie is received. * * Revision 1.7 1999/04/28 13:31:17 adam @@ -74,7 +78,7 @@ char *Yaz_Proxy::get_cookie(Z_OtherInformation **otherInfo) assert (oid_ent_to_oid (&ent, oid)); if (oid_ent_to_oid (&ent, oid) && - (oi = update_otherInformation(otherInfo, 0, oid, 1)) && + (oi = update_otherInformation(otherInfo, 0, oid, 1, 1)) && oi->which == Z_OtherInfo_characterInfo) return oi->information.characterInfo; return 0; @@ -89,7 +93,7 @@ char *Yaz_Proxy::get_proxy(Z_OtherInformation **otherInfo) ent.oclass = CLASS_USERINFO; ent.value = (oid_value) VAL_PROXY; if (oid_ent_to_oid (&ent, oid) && - (oi = update_otherInformation(otherInfo, 0, oid, 1)) && + (oi = update_otherInformation(otherInfo, 0, oid, 1, 1)) && oi->which == Z_OtherInfo_characterInfo) return oi->information.characterInfo; return 0; @@ -233,9 +237,12 @@ void Yaz_Proxy::recv_Z_PDU(Z_APDU *apdu) } m_client->m_server = this; +#if 0 Z_OtherInformation **oi; get_otherInfoAPDU(apdu, &oi); *oi = 0; +#endif + if (apdu->which == Z_APDU_initRequest) { if (m_client->m_init_flag) diff --git a/src/yaz-z-assoc.cpp b/src/yaz-z-assoc.cpp index c9b4307..b245a3c 100644 --- a/src/yaz-z-assoc.cpp +++ b/src/yaz-z-assoc.cpp @@ -4,7 +4,11 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: yaz-z-assoc.cpp,v $ - * Revision 1.3 1999-04-21 12:09:01 adam + * Revision 1.4 1999-09-13 12:53:44 adam + * Proxy removes OtherInfo Proxy Address and Session ID. Other + * Otherinfo remains untouched. + * + * Revision 1.3 1999/04/21 12:09:01 adam * Many improvements. Modified to proxy server to work with "sessions" * based on cookies. * @@ -237,11 +241,10 @@ void Yaz_Z_Assoc::set_otherInformationString ( void Yaz_Z_Assoc::set_otherInformationString ( Z_OtherInformation **otherInformation, - int *oid, int categoryValue, - const char *str) + int *oid, int categoryValue, const char *str) { Z_OtherInformationUnit *oi = - update_otherInformation(otherInformation, 1, oid, categoryValue); + update_otherInformation(otherInformation, 1, oid, categoryValue, 0); if (!oi) return; oi->information.characterInfo = odr_strdup (odr_encode(), str); @@ -249,63 +252,10 @@ void Yaz_Z_Assoc::set_otherInformationString ( Z_OtherInformationUnit *Yaz_Z_Assoc::update_otherInformation ( Z_OtherInformation **otherInformationP, int createFlag, - int *oid, int categoryValue) + int *oid, int categoryValue, int deleteFlag) { - int i; - Z_OtherInformation *otherInformation = *otherInformationP; - if (!otherInformation) - { - if (!createFlag) - return 0; - otherInformation = *otherInformationP = (Z_OtherInformation *) - odr_malloc (odr_encode(), sizeof(*otherInformation)); - otherInformation->num_elements = 0; - otherInformation->list = (Z_OtherInformationUnit **) - odr_malloc (odr_encode(), 8*sizeof(*otherInformation)); - for (i = 0; i<8; i++) - otherInformation->list[i] = 0; - } - logf (LOG_LOG, "Yaz_Z_Assoc::update_otherInformation num=%d", - otherInformation->num_elements); - for (i = 0; inum_elements; i++) - { - assert (otherInformation->list[i]); - if (!oid) - { - if (!otherInformation->list[i]->category) - return otherInformation->list[i]; - } - else - { - if (otherInformation->list[i]->category && - categoryValue == - *otherInformation->list[i]->category->categoryValue && - !oid_oidcmp (oid, otherInformation->list[i]->category-> - categoryTypeId)) - return otherInformation->list[i]; - } - } - if (!createFlag) - return 0; - otherInformation->list[i] = (Z_OtherInformationUnit*) - odr_malloc (odr_encode(), sizeof(Z_OtherInformationUnit)); - if (oid) - { - otherInformation->list[i]->category = (Z_InfoCategory*) - odr_malloc (odr_encode(), sizeof(Z_InfoCategory)); - otherInformation->list[i]->category->categoryTypeId = (int*) - odr_oiddup (odr_encode(), oid); - otherInformation->list[i]->category->categoryValue = (int*) - odr_malloc (odr_encode(), sizeof(int)); - *otherInformation->list[i]->category->categoryValue = - categoryValue; - } - else - otherInformation->list[i]->category = 0; - otherInformation->list[i]->which = Z_OtherInfo_characterInfo; - otherInformation->list[i]->information.characterInfo = 0; - - otherInformation->num_elements = i+1; - return otherInformation->list[i]; + return yaz_oi_update (otherInformationP, + (createFlag ? odr_encode() : 0), + oid, categoryValue, deleteFlag); } -- 1.7.10.4