From: Adam Dickmeiss Date: Wed, 8 Jun 2005 13:28:05 +0000 (+0000) Subject: Removed prefix Yaz_ from several class - and interface names now X-Git-Tag: YAZPP.ERE2~8 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=eea2caea1263bed0aae268f72d985cbb1822ac30;p=yazpp-moved-to-github.git Removed prefix Yaz_ from several class - and interface names now that a namespace encapsulates the API. --- diff --git a/include/yaz++/ir-assoc.h b/include/yaz++/ir-assoc.h index a0e7712..eac8d05 100644 --- a/include/yaz++/ir-assoc.h +++ b/include/yaz++/ir-assoc.h @@ -1,8 +1,8 @@ /* - * Copyright (c) 1998-2000, Index Data. + * Copyright (c) 1998-2005, Index Data. * See the file LICENSE for details. * - * $Id: ir-assoc.h,v 1.4 2005-06-02 06:40:21 adam Exp $ + * $Id: ir-assoc.h,v 1.5 2005-06-08 13:28:05 adam Exp $ */ #include @@ -13,12 +13,12 @@ namespace yazpp_1 { This object implements the client - and server role of a generic Z39.50 Association. */ -class YAZ_EXPORT Yaz_IR_Assoc: public Yaz_Z_Assoc { +class YAZ_EXPORT IR_Assoc: public Z_Assoc { public: /// Create object using the PDU Observer specified - Yaz_IR_Assoc(IYaz_PDU_Observable *the_PDU_Observable); + IR_Assoc(IPDU_Observable *the_PDU_Observable); /// Destroy assocation and close PDU Observer - virtual ~Yaz_IR_Assoc(); + virtual ~IR_Assoc(); /// Receive Z39.50 PDU void recv_Z_PDU(Z_APDU *apdu, int len); void recv_GDU(Z_GDU *apdu, int len); diff --git a/include/yaz++/pdu-assoc.h b/include/yaz++/pdu-assoc.h index e9ea4fb..33875cc 100644 --- a/include/yaz++/pdu-assoc.h +++ b/include/yaz++/pdu-assoc.h @@ -1,8 +1,8 @@ /* - * Copyright (c) 1998-2003, Index Data. + * Copyright (c) 1998-2005, Index Data. * See the file LICENSE for details. * - * $Id: pdu-assoc.h,v 1.6 2005-06-02 06:40:21 adam Exp $ + * $Id: pdu-assoc.h,v 1.7 2005-06-08 13:28:05 adam Exp $ */ #ifndef YAZ_PDU_ASSOC_INCLUDED @@ -19,8 +19,8 @@ namespace yazpp_1 { the method connect. The server role is initiated by using the listen method. */ -class YAZ_EXPORT Yaz_PDU_Assoc : public IYaz_PDU_Observable, yazpp_1::IYazSocketObserver { - friend class Yaz_PDU_AssocThread; +class YAZ_EXPORT PDU_Assoc : public IPDU_Observable, yazpp_1::ISocketObserver { + friend class PDU_AssocThread; private: enum { Connecting, @@ -38,38 +38,38 @@ class YAZ_EXPORT Yaz_PDU_Assoc : public IYaz_PDU_Observable, yazpp_1::IYazSocket int m_len; PDU_Queue *m_next; }; - Yaz_PDU_Assoc *m_parent; - Yaz_PDU_Assoc *m_children; - Yaz_PDU_Assoc *m_next; + PDU_Assoc *m_parent; + PDU_Assoc *m_children; + PDU_Assoc *m_next; COMSTACK m_cs; - yazpp_1::IYazSocketObservable *m_socketObservable; - IYaz_PDU_Observer *m_PDU_Observer; + yazpp_1::ISocketObservable *m_socketObservable; + IPDU_Observer *m_PDU_Observer; char *m_input_buf; int m_input_len; PDU_Queue *m_queue_out; PDU_Queue *m_queue_in; - int Yaz_PDU_Assoc::flush_PDU(); + int PDU_Assoc::flush_PDU(); int *m_destroyed; int m_idleTime; int m_log; - void init(yazpp_1::IYazSocketObservable *socketObservable); + void init(yazpp_1::ISocketObservable *socketObservable); public: COMSTACK comstack(const char *type_and_host, void **vp); /// Create object using specified socketObservable - Yaz_PDU_Assoc(yazpp_1::IYazSocketObservable *socketObservable); + PDU_Assoc(yazpp_1::ISocketObservable *socketObservable); /// Create Object using existing comstack - Yaz_PDU_Assoc(yazpp_1::IYazSocketObservable *socketObservable, + PDU_Assoc(yazpp_1::ISocketObservable *socketObservable, COMSTACK cs); /// Close socket and destroy object. - /// virtual ~Yaz_PDU_Assoc(); + /// virtual ~PDU_Assoc(); /// Clone the object - IYaz_PDU_Observable *clone(); + IPDU_Observable *clone(); /// Send PDU int send_PDU(const char *buf, int len); /// connect to server (client role) - int connect(IYaz_PDU_Observer *observer, const char *addr); + int connect(IPDU_Observer *observer, const char *addr); /// listen for clients (server role) - int listen(IYaz_PDU_Observer *observer, const char *addr); + int listen(IPDU_Observer *observer, const char *addr); /// Socket notification void socketNotify(int event); /// Close socket @@ -83,9 +83,9 @@ class YAZ_EXPORT Yaz_PDU_Assoc : public IYaz_PDU_Observable, yazpp_1::IYazSocket const char *getpeername(); }; -class YAZ_EXPORT Yaz_PDU_AssocThread : public Yaz_PDU_Assoc { +class YAZ_EXPORT PDU_AssocThread : public PDU_Assoc { public: - Yaz_PDU_AssocThread(yazpp_1::IYazSocketObservable *socketObservable); + PDU_AssocThread(yazpp_1::ISocketObservable *socketObservable); private: void childNotify(COMSTACK cs); diff --git a/include/yaz++/pdu-observer.h b/include/yaz++/pdu-observer.h index e135da4..bdb6b87 100644 --- a/include/yaz++/pdu-observer.h +++ b/include/yaz++/pdu-observer.h @@ -1,8 +1,8 @@ /* - * Copyright (c) 1998-2000, Index Data. + * Copyright (c) 1998-2005, Index Data. * See the file LICENSE for details. * - * $Id: pdu-observer.h,v 1.5 2005-06-02 06:40:21 adam Exp $ + * $Id: pdu-observer.h,v 1.6 2005-06-08 13:28:05 adam Exp $ */ #ifndef YAZ_PDU_OBSERVER_H @@ -10,26 +10,26 @@ namespace yazpp_1 { -class IYaz_PDU_Observer; +class IPDU_Observer; /** Protocol Data Unit Observable. This interface implements a Protocol Data Unit (PDU) network driver. The PDU's is not encoded/decoded by this interface. They are simply transmitted/received over the network. To use this interface the - IYaz_PDU_Observer interface must be implemented. + IPDU_Observer interface must be implemented. */ -class YAZ_EXPORT IYaz_PDU_Observable { +class YAZ_EXPORT IPDU_Observable { public: /// Send encoded PDU buffer of specified length virtual int send_PDU(const char *buf, int len) = 0; /// Connect with server specified by addr. - virtual int connect(IYaz_PDU_Observer *observer, const char *addr) = 0; + virtual int connect(IPDU_Observer *observer, const char *addr) = 0; /// Listen on address addr. - virtual int listen(IYaz_PDU_Observer *observer, const char *addr) = 0; + virtual int listen(IPDU_Observer *observer, const char *addr) = 0; /// Close connection virtual void close() = 0; /// Make clone of this object using this interface - virtual IYaz_PDU_Observable *clone() = 0; + virtual IPDU_Observable *clone() = 0; /// Destroy completely virtual void destroy() = 0; /// Set Idle Time @@ -39,10 +39,10 @@ class YAZ_EXPORT IYaz_PDU_Observable { }; /** Protocol Data Unit Observer. - This interface is used together with the IYaz_PDU_Observable interface + This interface is used together with the IPDU_Observable interface and acts as a callback interface for it. */ -class YAZ_EXPORT IYaz_PDU_Observer { +class YAZ_EXPORT IPDU_Observer { public: /// A PDU has been received virtual void recv_PDU(const char *buf, int len) = 0; @@ -52,9 +52,9 @@ class YAZ_EXPORT IYaz_PDU_Observer { virtual void failNotify() = 0; /// Called whenever there is a timeout virtual void timeoutNotify() = 0; - /// Make clone of observer using IYaz_PDU_Observable interface - virtual IYaz_PDU_Observer *sessionNotify( - IYaz_PDU_Observable *the_PDU_Observable, int fd) = 0; + /// Make clone of observer using IPDU_Observable interface + virtual IPDU_Observer *sessionNotify( + IPDU_Observable *the_PDU_Observable, int fd) = 0; }; }; diff --git a/include/yaz++/record-cache.h b/include/yaz++/record-cache.h index 174da53..36543c7 100644 --- a/include/yaz++/record-cache.h +++ b/include/yaz++/record-cache.h @@ -2,7 +2,7 @@ * Copyright (c) 2002-2004, Index Data. * See the file LICENSE for details. * - * $Id: record-cache.h,v 1.2 2005-06-02 06:40:21 adam Exp $ + * $Id: record-cache.h,v 1.3 2005-06-08 13:28:05 adam Exp $ */ @@ -10,12 +10,12 @@ #include namespace yazpp_1 { -class Yaz_RecordCache_Entry; +class RecordCache_Entry; -class YAZ_EXPORT Yaz_RecordCache { +class YAZ_EXPORT RecordCache { public: - Yaz_RecordCache (); - ~Yaz_RecordCache (); + RecordCache (); + ~RecordCache (); void add (ODR o, Z_NamePlusRecordList *npr, int start, int hits); int lookup (ODR o, Z_NamePlusRecordList **npr, int start, int num, @@ -27,10 +27,10 @@ class YAZ_EXPORT Yaz_RecordCache { void set_max_size(int sz); private: NMEM m_mem; - Yaz_RecordCache_Entry *m_entries; + RecordCache_Entry *m_entries; Z_SearchRequest *m_searchRequest; Z_PresentRequest *m_presentRequest; - int match (Yaz_RecordCache_Entry *entry, + int match (RecordCache_Entry *entry, Odr_oid *syntax, int offset, Z_RecordComposition *comp); int m_max_size; diff --git a/include/yaz++/socket-manager.h b/include/yaz++/socket-manager.h index d86297c..cd3cff3 100644 --- a/include/yaz++/socket-manager.h +++ b/include/yaz++/socket-manager.h @@ -1,8 +1,8 @@ /* - * Copyright (c) 1998-2004, Index Data. + * Copyright (c) 1998-2005, Index Data. * See the file LICENSE for details. * - * $Id: socket-manager.h,v 1.4 2005-06-02 06:40:21 adam Exp $ + * $Id: socket-manager.h,v 1.5 2005-06-08 13:28:05 adam Exp $ */ #ifndef YAZ_SOCKET_MANAGER_INCLUDED @@ -17,49 +17,49 @@ namespace yazpp_1 { Implements a stand-alone simple model that uses select(2) to observe socket events. */ -class YAZ_EXPORT Yaz_SocketManager : public IYazSocketObservable { +class YAZ_EXPORT SocketManager : public ISocketObservable { private: - struct YazSocketEntry { - IYazSocketObserver *observer; + struct SocketEntry { + ISocketObserver *observer; int fd; unsigned mask; int timeout; int timeout_this; time_t last_activity; - YazSocketEntry *next; + SocketEntry *next; }; - YazSocketEntry *m_observers; // all registered observers - struct YazSocketEvent { - IYazSocketObserver *observer; + SocketEntry *m_observers; // all registered observers + struct SocketEvent { + ISocketObserver *observer; int event; - YazSocketEvent *next; // front in queue - YazSocketEvent *prev; // back in queue + SocketEvent *next; // front in queue + SocketEvent *prev; // back in queue }; - YazSocketEvent *m_queue_front; - YazSocketEvent *m_queue_back; + SocketEvent *m_queue_front; + SocketEvent *m_queue_back; - YazSocketEntry **Yaz_SocketManager::lookupObserver - (IYazSocketObserver *observer); - YazSocketEvent *Yaz_SocketManager::getEvent(); - void putEvent(YazSocketEvent *event); - void removeEvent(IYazSocketObserver *observer); + SocketEntry **SocketManager::lookupObserver + (ISocketObserver *observer); + SocketEvent *SocketManager::getEvent(); + void putEvent(SocketEvent *event); + void removeEvent(ISocketObserver *observer); int m_log; public: /// Add an observer - virtual void addObserver(int fd, IYazSocketObserver *observer); + virtual void addObserver(int fd, ISocketObserver *observer); /// Delete an observer - virtual void deleteObserver(IYazSocketObserver *observer); + virtual void deleteObserver(ISocketObserver *observer); /// Delete all observers virtual void deleteObservers(); /// Set event mask for observer - virtual void maskObserver(IYazSocketObserver *observer, int mask); + virtual void maskObserver(ISocketObserver *observer, int mask); /// Set timeout - virtual void timeoutObserver(IYazSocketObserver *observer, + virtual void timeoutObserver(ISocketObserver *observer, int timeout); /// Process one event. return > 0 if event could be processed; int processEvent(); - Yaz_SocketManager(); - virtual ~Yaz_SocketManager(); + SocketManager(); + virtual ~SocketManager(); }; }; diff --git a/include/yaz++/socket-observer.h b/include/yaz++/socket-observer.h index b4291aa..42e7be0 100644 --- a/include/yaz++/socket-observer.h +++ b/include/yaz++/socket-observer.h @@ -1,65 +1,67 @@ /* - * Copyright (c) 1998-2000, Index Data. + * Copyright (c) 1998-2005, Index Data. * See the file LICENSE for details. * - * $Id: socket-observer.h,v 1.4 2005-06-02 06:40:21 adam Exp $ + * $Id: socket-observer.h,v 1.5 2005-06-08 13:28:05 adam Exp $ */ #ifndef YAZ_SOCKET_OBSERVER_H #define YAZ_SOCKET_OBSERVER_H -#define YAZ_SOCKET_OBSERVE_READ 1 -#define YAZ_SOCKET_OBSERVE_WRITE 2 -#define YAZ_SOCKET_OBSERVE_EXCEPT 4 -#define YAZ_SOCKET_OBSERVE_TIMEOUT 8 - #include namespace yazpp_1 { + + enum SocketObserve { + SOCKET_OBSERVE_READ=1, + SOCKET_OBSERVE_WRITE=2, + SOCKET_OBSERVE_EXCEPT=4, + SOCKET_OBSERVE_TIMEOUT=8 + }; /** Forward reference - */ -class IYazSocketObserver; - +*/ + class ISocketObserver; + /** Socket Observable. - This interface implements notification of socket events. - The module interested in (observing) the sockets - must implement the IYazSocketObserver interface. The - IYazSocketObserver only have to implement one function, so it's - quite simple to observe sockets change state. - The socket events below specifies read, write, exception, - and timeout respectively: -
-    YAZ_SOCKET_OBSERVE_READ
-    YAZ_SOCKET_OBSERVE_WRITE
-    YAZ_SOCKET_OBSERVE_EXCEPT
-    YAZ_SOCKET_OBSERVE_TIMEOUT
+    This interface implements notification of socket events.
+    The module interested in (observing) the sockets
+    must implement the ISocketObserver interface. The
+    ISocketObserver only have to implement one function, so it's
+    quite simple to observe sockets change state.
+    The socket events below specifies read, write, exception,
+    and timeout respectively:
+    
+    SOCKET_OBSERVE_READ
+    SOCKET_OBSERVE_WRITE
+    SOCKET_OBSERVE_EXCEPT
+    SOCKET_OBSERVE_TIMEOUT
     
The maskObserver method specifies which of these events the observer is intertested in. */ -class YAZ_EXPORT IYazSocketObservable { +class YAZ_EXPORT ISocketObservable { public: /// Add an observer interested in socket fd - virtual void addObserver(int fd, IYazSocketObserver *observer) = 0; + virtual void addObserver(int fd, ISocketObserver *observer) = 0; /// Delete an observer - virtual void deleteObserver(IYazSocketObserver *observer) = 0; + virtual void deleteObserver(ISocketObserver *observer) = 0; /// Delete all observers virtual void deleteObservers() = 0; /// Specify the events that the observer is intersted in. - virtual void maskObserver(IYazSocketObserver *observer, int mask) = 0; + virtual void maskObserver(ISocketObserver *observer, int mask) = 0; /// Specify timeout - virtual void timeoutObserver(IYazSocketObserver *observer, + virtual void timeoutObserver(ISocketObserver *observer, int timeout)=0; }; /** Socket Observer. - The IYazSocketObserver interface implements a module interested + The ISocketObserver interface implements a module interested socket events. Look for objects that implements the - IYazSocketObservable interface! + ISocketObservable interface! */ -class YAZ_EXPORT IYazSocketObserver { +class YAZ_EXPORT ISocketObserver { public: /// Notify the observer that something happened to socket virtual void socketNotify(int event) = 0; diff --git a/include/yaz++/z-assoc.h b/include/yaz++/z-assoc.h index f025945..40bdb68 100644 --- a/include/yaz++/z-assoc.h +++ b/include/yaz++/z-assoc.h @@ -2,7 +2,7 @@ * Copyright (c) 1998-2000, Index Data. * See the file LICENSE for details. * - * $Id: z-assoc.h,v 1.7 2005-06-02 06:40:21 adam Exp $ + * $Id: z-assoc.h,v 1.8 2005-06-08 13:28:05 adam Exp $ */ #ifndef YAZ_Z_ASSOC_INCLUDED @@ -18,12 +18,12 @@ namespace yazpp_1 { This object implements the client - and server role of a generic Z39.50 Association. */ -class YAZ_EXPORT Yaz_Z_Assoc : public IYaz_PDU_Observer { +class YAZ_EXPORT Z_Assoc : public IPDU_Observer { public: /// Create object using the PDU Observer specified - Yaz_Z_Assoc(IYaz_PDU_Observable *the_PDU_Observable); + Z_Assoc(IPDU_Observable *the_PDU_Observable); /// Destroy assocation and close PDU Observer - virtual ~Yaz_Z_Assoc(); + virtual ~Z_Assoc(); /// Receive PDU void recv_PDU(const char *buf, int len); /// Connect notification @@ -88,7 +88,7 @@ class YAZ_EXPORT Yaz_Z_Assoc : public IYaz_PDU_Observer { private: static int yaz_init_flag; static int yaz_init_func(); - IYaz_PDU_Observable *m_PDU_Observable; + IPDU_Observable *m_PDU_Observable; ODR m_odr_in; ODR m_odr_out; ODR m_odr_print; diff --git a/include/yaz++/z-server.h b/include/yaz++/z-server.h index 335da7e..bbb1db5 100644 --- a/include/yaz++/z-server.h +++ b/include/yaz++/z-server.h @@ -1,17 +1,17 @@ /* - * Copyright (c) 2000-2001, Index Data. + * Copyright (c) 2000-2005, Index Data. * See the file LICENSE for details. * - * $Id: z-server.h,v 1.6 2005-06-02 06:40:21 adam Exp $ + * $Id: z-server.h,v 1.7 2005-06-08 13:28:05 adam Exp $ */ #include namespace yazpp_1 { -class Yaz_Z_Server; +class Z_Server; -class YAZ_EXPORT Yaz_Z_ServerUtility { +class YAZ_EXPORT Z_ServerUtility { public: void create_databaseRecord (ODR odr, Z_NamePlusRecord *rec, const char *dbname, int format, @@ -23,32 +23,32 @@ class YAZ_EXPORT Yaz_Z_ServerUtility { Z_Records *create_nonSurrogateDiagnostics (ODR odr, int error, const char *addinfo); - void Yaz_Z_ServerUtility::create_diagnostics ( + void Z_ServerUtility::create_diagnostics ( ODR odr, int error, const char *addinfo, Z_DiagRec ***dreca, int *num); }; -class YAZ_EXPORT IYaz_Server_Facility { +class YAZ_EXPORT IServer_Facility { public: - virtual int init(Yaz_Z_Server *server, + virtual int init(Z_Server *server, Z_InitRequest *initRequest, Z_InitResponse *initResponse) = 0; - virtual int recv(Yaz_Z_Server *server, Z_APDU *apdu) = 0; + virtual int recv(Z_Server *server, Z_APDU *apdu) = 0; }; -class YAZ_EXPORT Yaz_Facility_ILL : public IYaz_Server_Facility { +class YAZ_EXPORT Yaz_Facility_ILL : public IServer_Facility { public: virtual void ill_service (Z_ExtendedServicesRequest *req, Z_ItemOrder *io, Z_ExtendedServicesResponse *res) = 0; - int init(Yaz_Z_Server *server, + int init(Z_Server *server, Z_InitRequest *initRequest, Z_InitResponse *initResponse); - int recv(Yaz_Z_Server *server, Z_APDU *apdu); + int recv(Z_Server *server, Z_APDU *apdu); }; -class YAZ_EXPORT Yaz_Facility_Update : public IYaz_Server_Facility { +class YAZ_EXPORT Yaz_Facility_Update : public IServer_Facility { public: virtual void update_service (Z_ExtendedServicesRequest *req, Z_IUUpdate *io, @@ -58,15 +58,15 @@ class YAZ_EXPORT Yaz_Facility_Update : public IYaz_Server_Facility { Z_IU0Update *io, Z_ExtendedServicesResponse *res) = 0; - int init(Yaz_Z_Server *server, + int init(Z_Server *server, Z_InitRequest *initRequest, Z_InitResponse *initResponse); - int recv(Yaz_Z_Server *server, Z_APDU *apdu); + int recv(Z_Server *server, Z_APDU *apdu); }; -class YAZ_EXPORT Yaz_Facility_Retrieval : public IYaz_Server_Facility, - public Yaz_Z_ServerUtility { +class YAZ_EXPORT Yaz_Facility_Retrieval : public IServer_Facility, + public Z_ServerUtility { public: virtual int sr_init (Z_InitRequest *initRequest, @@ -81,25 +81,25 @@ class YAZ_EXPORT Yaz_Facility_Retrieval : public IYaz_Server_Facility, Z_RecordComposition *comp, Z_NamePlusRecord *namePlusRecord, Z_Records *diagnostics) = 0; - int init(Yaz_Z_Server *server, + int init(Z_Server *server, Z_InitRequest *initRequest, Z_InitResponse *initResponse); - int recv(Yaz_Z_Server *server, Z_APDU *apdu); + int recv(Z_Server *server, Z_APDU *apdu); ODR odr_encode(); ODR odr_decode(); private: - Z_Records *pack_records (Yaz_Z_Server *s, + Z_Records *pack_records (Z_Server *s, const char *resultSetName, int start, int num, Z_RecordComposition *comp, int *next, int *pres, int *oid); - void fetch_via_piggyback (Yaz_Z_Server *s, + void fetch_via_piggyback (Z_Server *s, Z_SearchRequest *searchRequest, Z_SearchResponse *searchResponse); - void fetch_via_present (Yaz_Z_Server *s, + void fetch_via_present (Z_Server *s, Z_PresentRequest *req, Z_PresentResponse *res); int m_preferredMessageSize; @@ -108,27 +108,27 @@ class YAZ_EXPORT Yaz_Facility_Retrieval : public IYaz_Server_Facility, ODR m_odr_decode; }; -class YAZ_EXPORT Yaz_Z_Server_Facility_Info { - friend class Yaz_Z_Server; - IYaz_Server_Facility *m_facility; +class YAZ_EXPORT Z_Server_Facility_Info { + friend class Z_Server; + IServer_Facility *m_facility; char *m_name; - Yaz_Z_Server_Facility_Info *m_next; + Z_Server_Facility_Info *m_next; }; -class YAZ_EXPORT Yaz_Z_Server : public Yaz_Z_Assoc { +class YAZ_EXPORT Z_Server : public Z_Assoc { public: - Yaz_Z_Server(IYaz_PDU_Observable *the_PDU_Observable); - virtual ~Yaz_Z_Server(); + Z_Server(IPDU_Observable *the_PDU_Observable); + virtual ~Z_Server(); void recv_Z_PDU(Z_APDU *apdu, int len); virtual void recv_GDU(Z_GDU *apdu, int len); - void facility_add(IYaz_Server_Facility *facility, const char *name); + void facility_add(IServer_Facility *facility, const char *name); void facility_reset (); private: - Yaz_Z_Server_Facility_Info *m_facilities; + Z_Server_Facility_Info *m_facilities; }; class YAZ_EXPORT Yaz_USMARC { diff --git a/src/yaz-ir-assoc.cpp b/src/yaz-ir-assoc.cpp index b38b3fd..02b061a 100644 --- a/src/yaz-ir-assoc.cpp +++ b/src/yaz-ir-assoc.cpp @@ -2,7 +2,7 @@ * Copyright (c) 1998-2003, Index Data. * See the file LICENSE for details. * - * $Id: yaz-ir-assoc.cpp,v 1.24 2005-06-02 06:40:21 adam Exp $ + * $Id: yaz-ir-assoc.cpp,v 1.25 2005-06-08 13:28:05 adam Exp $ */ #include @@ -12,8 +12,8 @@ using namespace yazpp_1; -Yaz_IR_Assoc::Yaz_IR_Assoc(IYaz_PDU_Observable *the_PDU_Observable) - : Yaz_Z_Assoc(the_PDU_Observable) +IR_Assoc::IR_Assoc(IPDU_Observable *the_PDU_Observable) + : Z_Assoc(the_PDU_Observable) { m_num_databaseNames = 0; m_databaseNames = 0; @@ -28,7 +28,7 @@ Yaz_IR_Assoc::Yaz_IR_Assoc(IYaz_PDU_Observable *the_PDU_Observable) set_databaseNames(1, &db); } -Yaz_IR_Assoc::~Yaz_IR_Assoc() +IR_Assoc::~IR_Assoc() { if (m_elementSetNames) delete [] m_elementSetNames->u.generic; @@ -38,17 +38,17 @@ Yaz_IR_Assoc::~Yaz_IR_Assoc() delete [] m_cookie; } -void Yaz_IR_Assoc::get_databaseNames (int *num, char ***list) +void IR_Assoc::get_databaseNames (int *num, char ***list) { *num = m_num_databaseNames; *list = m_databaseNames; } typedef char *charp; -void Yaz_IR_Assoc::set_databaseNames (int num, const char **list) +void IR_Assoc::set_databaseNames (int num, const char **list) { int i; - yaz_log (m_log, "Yaz_IR_Assoc::set_databaseNames num=%d", num); + yaz_log (m_log, "IR_Assoc::set_databaseNames num=%d", num); for (i = 0; idesc : ""; } -void Yaz_IR_Assoc::set_elementSetName (const char *elementSetName) +void IR_Assoc::set_elementSetName (const char *elementSetName) { if (m_elementSetNames) delete [] m_elementSetNames->u.generic; @@ -135,12 +135,12 @@ void Yaz_IR_Assoc::set_elementSetName (const char *elementSetName) } } -void Yaz_IR_Assoc::get_elementSetName (Z_ElementSetNames **elementSetNames) +void IR_Assoc::get_elementSetName (Z_ElementSetNames **elementSetNames) { *elementSetNames = m_elementSetNames; } -void Yaz_IR_Assoc::get_elementSetName (const char **elementSetName) +void IR_Assoc::get_elementSetName (const char **elementSetName) { if (!m_elementSetNames || m_elementSetNames->which != Z_ElementSetNames_generic) @@ -152,13 +152,13 @@ void Yaz_IR_Assoc::get_elementSetName (const char **elementSetName) } -void Yaz_IR_Assoc::recv_GDU(Z_GDU *apdu, int len) +void IR_Assoc::recv_GDU(Z_GDU *apdu, int len) { if (apdu->which == Z_GDU_Z3950) recv_Z_PDU(apdu->u.z3950, len); } -void Yaz_IR_Assoc::recv_Z_PDU(Z_APDU *apdu, int len) +void IR_Assoc::recv_Z_PDU(Z_APDU *apdu, int len) { yaz_log (m_log, "recv_Z_PDU %d bytes", len); m_lastReceived = apdu->which; @@ -195,7 +195,7 @@ void Yaz_IR_Assoc::recv_Z_PDU(Z_APDU *apdu, int len) } } -int Yaz_IR_Assoc::send_searchRequest(Yaz_Z_Query *query, +int IR_Assoc::send_searchRequest(Yaz_Z_Query *query, char* pResultSetId, char* pRefId) { @@ -239,7 +239,7 @@ int Yaz_IR_Assoc::send_searchRequest(Yaz_Z_Query *query, return send_Z_PDU(apdu, 0); } -int Yaz_IR_Assoc::send_presentRequest(int start, +int IR_Assoc::send_presentRequest(int start, int number, char* pResultSetId, char* pRefId) @@ -288,7 +288,7 @@ int Yaz_IR_Assoc::send_presentRequest(int start, return send_Z_PDU(apdu, 0); } -void Yaz_IR_Assoc::set_proxy(const char *str) +void IR_Assoc::set_proxy(const char *str) { delete [] m_proxy; m_proxy = 0; @@ -299,7 +299,7 @@ void Yaz_IR_Assoc::set_proxy(const char *str) } } -void Yaz_IR_Assoc::set_cookie(const char *str) +void IR_Assoc::set_cookie(const char *str) { delete [] m_cookie; m_cookie = 0; @@ -310,12 +310,12 @@ void Yaz_IR_Assoc::set_cookie(const char *str) } } -const char *Yaz_IR_Assoc::get_cookie() +const char *IR_Assoc::get_cookie() { return m_cookie; } -void Yaz_IR_Assoc::client(const char *addr) +void IR_Assoc::client(const char *addr) { delete [] m_host; m_host = new char[strlen(addr)+1]; @@ -323,64 +323,64 @@ void Yaz_IR_Assoc::client(const char *addr) const char *dbpart = strchr(m_host, '/'); if (dbpart) set_databaseNames (dbpart+1, "+ "); - Yaz_Z_Assoc::client(m_proxy ? m_proxy : m_host); + Z_Assoc::client(m_proxy ? m_proxy : m_host); } -const char *Yaz_IR_Assoc::get_proxy() +const char *IR_Assoc::get_proxy() { return m_proxy; } -const char *Yaz_IR_Assoc::get_host() +const char *IR_Assoc::get_host() { return m_host; } -void Yaz_IR_Assoc::recv_searchRequest(Z_SearchRequest *searchRequest) +void IR_Assoc::recv_searchRequest(Z_SearchRequest *searchRequest) { Z_APDU *apdu = create_Z_PDU(Z_APDU_searchResponse); send_Z_PDU(apdu, 0); } -void Yaz_IR_Assoc::recv_presentRequest(Z_PresentRequest *presentRequest) +void IR_Assoc::recv_presentRequest(Z_PresentRequest *presentRequest) { Z_APDU *apdu = create_Z_PDU(Z_APDU_presentResponse); send_Z_PDU(apdu, 0); } -void Yaz_IR_Assoc::recv_initRequest(Z_InitRequest *initRequest) +void IR_Assoc::recv_initRequest(Z_InitRequest *initRequest) { Z_APDU *apdu = create_Z_PDU(Z_APDU_initResponse); send_Z_PDU(apdu, 0); } -void Yaz_IR_Assoc::recv_searchResponse (Z_SearchResponse *searchResponse) +void IR_Assoc::recv_searchResponse (Z_SearchResponse *searchResponse) { } -void Yaz_IR_Assoc::recv_presentResponse (Z_PresentResponse *presentResponse) +void IR_Assoc::recv_presentResponse (Z_PresentResponse *presentResponse) { } -void Yaz_IR_Assoc::recv_initResponse(Z_InitResponse *initResponse) +void IR_Assoc::recv_initResponse(Z_InitResponse *initResponse) { } -void Yaz_IR_Assoc::recv_extendedServicesResponse(Z_ExtendedServicesResponse *ExtendedServicesResponse) +void IR_Assoc::recv_extendedServicesResponse(Z_ExtendedServicesResponse *ExtendedServicesResponse) { } -int Yaz_IR_Assoc::get_lastReceived() +int IR_Assoc::get_lastReceived() { return m_lastReceived; } -void Yaz_IR_Assoc::set_lastReceived(int lastReceived) +void IR_Assoc::set_lastReceived(int lastReceived) { m_lastReceived = lastReceived; } -int Yaz_IR_Assoc::send_initRequest(char* pRefId) +int IR_Assoc::send_initRequest(char* pRefId) { Z_APDU *apdu = create_Z_PDU(Z_APDU_initRequest); Z_InitRequest *req = apdu->u.initRequest; @@ -410,7 +410,7 @@ int Yaz_IR_Assoc::send_initRequest(char* pRefId) return send_Z_PDU(apdu, 0); } -int Yaz_IR_Assoc::send_deleteResultSetRequest(char* pResultSetId, char* pRefId) +int IR_Assoc::send_deleteResultSetRequest(char* pResultSetId, char* pRefId) { char* ResultSetIds[1]; diff --git a/src/yaz-my-client.cpp b/src/yaz-my-client.cpp index 0f1cc7f..203f16e 100644 --- a/src/yaz-my-client.cpp +++ b/src/yaz-my-client.cpp @@ -2,7 +2,7 @@ * Copyright (c) 1998-2004, Index Data. * See the file LICENSE for details. * - * $Id: yaz-my-client.cpp,v 1.19 2005-06-02 06:40:21 adam Exp $ + * $Id: yaz-my-client.cpp,v 1.20 2005-06-08 13:28:06 adam Exp $ */ #include @@ -25,20 +25,20 @@ extern "C" { using namespace yazpp_1; -class YAZ_EXPORT MyClient : public Yaz_IR_Assoc { +class YAZ_EXPORT MyClient : public IR_Assoc { private: int m_interactive_flag; char m_thisCommand[1024]; char m_lastCommand[1024]; int m_setOffset; - Yaz_SocketManager *m_socketManager; + SocketManager *m_socketManager; public: - MyClient(IYaz_PDU_Observable *the_PDU_Observable, - Yaz_SocketManager *the_SocketManager); - IYaz_PDU_Observer *sessionNotify( - IYaz_PDU_Observable *the_PDU_Observable, int fd); - int args(Yaz_SocketManager *socketManager, int argc, char **argv); - int interactive(Yaz_SocketManager *socketManager); + MyClient(IPDU_Observable *the_PDU_Observable, + SocketManager *the_SocketManager); + IPDU_Observer *sessionNotify( + IPDU_Observable *the_PDU_Observable, int fd); + int args(SocketManager *socketManager, int argc, char **argv); + int interactive(SocketManager *socketManager); int wait(); void recv_initResponse(Z_InitResponse *initResponse); void recv_searchResponse(Z_SearchResponse *searchResponse); @@ -89,15 +89,15 @@ void MyClient::failNotify() set_lastReceived(-1); } -IYaz_PDU_Observer *MyClient::sessionNotify( - IYaz_PDU_Observable *the_PDU_Observable, int fd) +IPDU_Observer *MyClient::sessionNotify(IPDU_Observable *the_PDU_Observable, + int fd) { return new MyClient(the_PDU_Observable, m_socketManager); } -MyClient::MyClient(IYaz_PDU_Observable *the_PDU_Observable, - Yaz_SocketManager *the_socketManager) : - Yaz_IR_Assoc (the_PDU_Observable) +MyClient::MyClient(IPDU_Observable *the_PDU_Observable, + SocketManager *the_socketManager) : + IR_Assoc (the_PDU_Observable) { m_setOffset = 1; m_interactive_flag = 1; @@ -619,7 +619,7 @@ const char *MyClient::getCommand() return m_lastCommand; } -int MyClient::interactive(Yaz_SocketManager *socketManager) +int MyClient::interactive(SocketManager *socketManager) { const char *cmd; if (!m_interactive_flag) @@ -632,7 +632,7 @@ int MyClient::interactive(Yaz_SocketManager *socketManager) return 0; } -int MyClient::args(Yaz_SocketManager *socketManager, int argc, char **argv) +int MyClient::args(SocketManager *socketManager, int argc, char **argv) { char *host = 0; char *proxy = 0; @@ -688,8 +688,8 @@ int MyClient::args(Yaz_SocketManager *socketManager, int argc, char **argv) int main(int argc, char **argv) { - Yaz_SocketManager mySocketManager; - Yaz_PDU_Assoc *some = new Yaz_PDU_Assoc(&mySocketManager); + SocketManager mySocketManager; + PDU_Assoc *some = new PDU_Assoc(&mySocketManager); MyClient z(some, &mySocketManager); diff --git a/src/yaz-my-server.cpp b/src/yaz-my-server.cpp index b636088..421aa4d 100644 --- a/src/yaz-my-server.cpp +++ b/src/yaz-my-server.cpp @@ -2,7 +2,7 @@ * Copyright (c) 1998-2001, Index Data. * See the file LICENSE for details. * - * $Id: yaz-my-server.cpp,v 1.17 2005-06-02 06:40:21 adam Exp $ + * $Id: yaz-my-server.cpp,v 1.18 2005-06-08 13:28:06 adam Exp $ */ #include @@ -49,12 +49,12 @@ public: Z_Records *records); }; -class MyServer : public Yaz_Z_Server { +class MyServer : public Z_Server { public: ~MyServer(); - MyServer(IYaz_PDU_Observable *the_PDU_Observable); - IYaz_PDU_Observer* sessionNotify(IYaz_PDU_Observable *the_PDU_Observable, - int fd); + MyServer(IPDU_Observable *the_PDU_Observable); + IPDU_Observer* sessionNotify(IPDU_Observable *the_PDU_Observable, + int fd); void failNotify(); void timeoutNotify(); void connectNotify(); @@ -142,8 +142,8 @@ MyServer::~MyServer() { } -IYaz_PDU_Observer *MyServer::sessionNotify( - IYaz_PDU_Observable *the_PDU_Observable, int fd) +IPDU_Observer *MyServer::sessionNotify( + IPDU_Observable *the_PDU_Observable, int fd) { MyServer *new_server; m_no++; @@ -157,8 +157,8 @@ IYaz_PDU_Observer *MyServer::sessionNotify( return new_server; } -MyServer::MyServer(IYaz_PDU_Observable *the_PDU_Observable) : - Yaz_Z_Server (the_PDU_Observable) +MyServer::MyServer(IPDU_Observable *the_PDU_Observable) : + Z_Server (the_PDU_Observable) { m_no = 0; } @@ -193,9 +193,9 @@ int main(int argc, char **argv) const char *addr = "tcp:@:9999"; char *apdu_log = 0; - Yaz_SocketManager mySocketManager; + SocketManager mySocketManager; - Yaz_PDU_Assoc *my_PDU_Assoc = 0; + PDU_Assoc *my_PDU_Assoc = 0; MyServer *z = 0; int ret; @@ -223,11 +223,11 @@ int main(int argc, char **argv) } #if YAZ_POSIX_THREADS if (thread_flag) - my_PDU_Assoc = new Yaz_PDU_AssocThread(&mySocketManager); + my_PDU_Assoc = new PDU_AssocThread(&mySocketManager); else - my_PDU_Assoc = new Yaz_PDU_Assoc(&mySocketManager); + my_PDU_Assoc = new PDU_Assoc(&mySocketManager); #else - my_PDU_Assoc = new Yaz_PDU_Assoc(&mySocketManager); + my_PDU_Assoc = new PDU_Assoc(&mySocketManager); #endif z = new MyServer(my_PDU_Assoc); diff --git a/src/yaz-pdu-assoc-thread.cpp b/src/yaz-pdu-assoc-thread.cpp index 54d2cf0..207a68b 100644 --- a/src/yaz-pdu-assoc-thread.cpp +++ b/src/yaz-pdu-assoc-thread.cpp @@ -2,7 +2,7 @@ * Copyright (c) 1998-2004, Index Data. * See the file LICENSE for details. * - * $Id: yaz-pdu-assoc-thread.cpp,v 1.10 2005-06-02 06:40:21 adam Exp $ + * $Id: yaz-pdu-assoc-thread.cpp,v 1.11 2005-06-08 13:28:06 adam Exp $ */ #ifdef WIN32 @@ -35,9 +35,9 @@ using namespace yazpp_1; -Yaz_PDU_AssocThread::Yaz_PDU_AssocThread( - IYazSocketObservable *socketObservable) - : Yaz_PDU_Assoc(socketObservable) +PDU_AssocThread::PDU_AssocThread( + ISocketObservable *socketObservable) + : PDU_Assoc(socketObservable) { } @@ -49,7 +49,7 @@ void * #endif events(void *p) { - Yaz_SocketManager *s = (Yaz_SocketManager *) p; + SocketManager *s = (SocketManager *) p; yaz_log (YLOG_LOG, "thread started"); while (s->processEvent() > 0) @@ -61,10 +61,10 @@ events(void *p) #endif } -void Yaz_PDU_AssocThread::childNotify(COMSTACK cs) +void PDU_AssocThread::childNotify(COMSTACK cs) { - Yaz_SocketManager *socket_observable = new Yaz_SocketManager; - Yaz_PDU_Assoc *new_observable = new Yaz_PDU_Assoc (socket_observable, cs); + SocketManager *socket_observable = new SocketManager; + PDU_Assoc *new_observable = new PDU_Assoc (socket_observable, cs); new_observable->m_next = m_children; m_children = new_observable; diff --git a/src/yaz-pdu-assoc.cpp b/src/yaz-pdu-assoc.cpp index 9efedd3..ffa85c2 100644 --- a/src/yaz-pdu-assoc.cpp +++ b/src/yaz-pdu-assoc.cpp @@ -2,7 +2,7 @@ * Copyright (c) 1998-2004, Index Data. * See the file LICENSE for details. * - * $Id: yaz-pdu-assoc.cpp,v 1.40 2005-06-02 06:40:21 adam Exp $ + * $Id: yaz-pdu-assoc.cpp,v 1.41 2005-06-08 13:28:06 adam Exp $ */ #include @@ -14,7 +14,7 @@ using namespace yazpp_1; -void Yaz_PDU_Assoc::init(IYazSocketObservable *socketObservable) +void PDU_Assoc::init(ISocketObservable *socketObservable) { m_state = Closed; m_cs = 0; @@ -32,21 +32,21 @@ void Yaz_PDU_Assoc::init(IYazSocketObservable *socketObservable) m_log = YLOG_DEBUG; } -Yaz_PDU_Assoc::Yaz_PDU_Assoc(IYazSocketObservable *socketObservable) +PDU_Assoc::PDU_Assoc(ISocketObservable *socketObservable) { init (socketObservable); } -Yaz_PDU_Assoc::Yaz_PDU_Assoc(IYazSocketObservable *socketObservable, +PDU_Assoc::PDU_Assoc(ISocketObservable *socketObservable, COMSTACK cs) { init(socketObservable); m_cs = cs; unsigned mask = 0; if (cs->io_pending & CS_WANT_WRITE) - mask |= YAZ_SOCKET_OBSERVE_WRITE; + mask |= SOCKET_OBSERVE_WRITE; if (cs->io_pending & CS_WANT_READ) - mask |= YAZ_SOCKET_OBSERVE_READ; + mask |= SOCKET_OBSERVE_READ; m_socketObservable->addObserver(cs_fileno(cs), this); if (!mask) { @@ -62,28 +62,28 @@ Yaz_PDU_Assoc::Yaz_PDU_Assoc(IYazSocketObservable *socketObservable, m_socketObservable->addObserver(cs_fileno(cs), this); yaz_log(m_log, "maskObserver 1"); m_socketObservable->maskObserver(this, - mask |YAZ_SOCKET_OBSERVE_EXCEPT); + mask |SOCKET_OBSERVE_EXCEPT); } } -IYaz_PDU_Observable *Yaz_PDU_Assoc::clone() +IPDU_Observable *PDU_Assoc::clone() { - Yaz_PDU_Assoc *copy = new Yaz_PDU_Assoc(m_socketObservable); + PDU_Assoc *copy = new PDU_Assoc(m_socketObservable); return copy; } -void Yaz_PDU_Assoc::socketNotify(int event) +void PDU_Assoc::socketNotify(int event) { - yaz_log (m_log, "Yaz_PDU_Assoc::socketNotify p=%p state=%d event = %d", + yaz_log (m_log, "PDU_Assoc::socketNotify p=%p state=%d event = %d", this, m_state, event); - if (event & YAZ_SOCKET_OBSERVE_EXCEPT) + if (event & SOCKET_OBSERVE_EXCEPT) { close(); m_PDU_Observer->failNotify(); return; } - else if (event & YAZ_SOCKET_OBSERVE_TIMEOUT) + else if (event & SOCKET_OBSERVE_TIMEOUT) { m_PDU_Observer->timeoutNotify(); return; @@ -93,7 +93,7 @@ void Yaz_PDU_Assoc::socketNotify(int event) case Accepting: if (!cs_accept (m_cs)) { - yaz_log (m_log, "Yaz_PDU_Assoc::cs_accept failed"); + yaz_log (m_log, "PDU_Assoc::cs_accept failed"); m_cs = 0; close(); m_PDU_Observer->failNotify(); @@ -102,9 +102,9 @@ void Yaz_PDU_Assoc::socketNotify(int event) { unsigned mask = 0; if (m_cs->io_pending & CS_WANT_WRITE) - mask |= YAZ_SOCKET_OBSERVE_WRITE; + mask |= SOCKET_OBSERVE_WRITE; if (m_cs->io_pending & CS_WANT_READ) - mask |= YAZ_SOCKET_OBSERVE_READ; + mask |= SOCKET_OBSERVE_READ; if (!mask) { // accept is complete. turn to ready state and write if needed m_state = Ready; @@ -114,13 +114,13 @@ void Yaz_PDU_Assoc::socketNotify(int event) { // accept still incomplete. yaz_log(m_log, "maskObserver 2"); m_socketObservable->maskObserver(this, - mask|YAZ_SOCKET_OBSERVE_EXCEPT); + mask|SOCKET_OBSERVE_EXCEPT); } } break; case Connecting: - if (event & YAZ_SOCKET_OBSERVE_READ && - event & YAZ_SOCKET_OBSERVE_WRITE) + if (event & SOCKET_OBSERVE_READ && + event & SOCKET_OBSERVE_WRITE) { // For Unix: if both read and write is set, then connect failed. close(); @@ -132,11 +132,11 @@ void Yaz_PDU_Assoc::socketNotify(int event) int res = cs_rcvconnect (m_cs); if (res == 1) { - unsigned mask = YAZ_SOCKET_OBSERVE_EXCEPT; + unsigned mask = SOCKET_OBSERVE_EXCEPT; if (m_cs->io_pending & CS_WANT_WRITE) - mask |= YAZ_SOCKET_OBSERVE_WRITE; + mask |= SOCKET_OBSERVE_WRITE; if (m_cs->io_pending & CS_WANT_READ) - mask |= YAZ_SOCKET_OBSERVE_READ; + mask |= SOCKET_OBSERVE_READ; yaz_log(m_log, "maskObserver 3"); m_socketObservable->maskObserver(this, mask); } @@ -150,7 +150,7 @@ void Yaz_PDU_Assoc::socketNotify(int event) } break; case Listen: - if (event & YAZ_SOCKET_OBSERVE_READ) + if (event & SOCKET_OBSERVE_READ) { int res; COMSTACK new_line; @@ -176,29 +176,29 @@ void Yaz_PDU_Assoc::socketNotify(int event) } break; case Writing: - if (event & (YAZ_SOCKET_OBSERVE_READ|YAZ_SOCKET_OBSERVE_WRITE)) + if (event & (SOCKET_OBSERVE_READ|SOCKET_OBSERVE_WRITE)) flush_PDU(); break; case Ready: - if (event & (YAZ_SOCKET_OBSERVE_READ|YAZ_SOCKET_OBSERVE_WRITE)) + if (event & (SOCKET_OBSERVE_READ|SOCKET_OBSERVE_WRITE)) { do { int res = cs_get (m_cs, &m_input_buf, &m_input_len); if (res == 1) { - unsigned mask = YAZ_SOCKET_OBSERVE_EXCEPT; + unsigned mask = SOCKET_OBSERVE_EXCEPT; if (m_cs->io_pending & CS_WANT_WRITE) - mask |= YAZ_SOCKET_OBSERVE_WRITE; + mask |= SOCKET_OBSERVE_WRITE; if (m_cs->io_pending & CS_WANT_READ) - mask |= YAZ_SOCKET_OBSERVE_READ; + mask |= SOCKET_OBSERVE_READ; yaz_log(m_log, "maskObserver 4"); m_socketObservable->maskObserver(this, mask); return; } else if (res <= 0) { - yaz_log (m_log, "Yaz_PDU_Assoc::Connection closed by peer"); + yaz_log (m_log, "PDU_Assoc::Connection closed by peer"); close(); if (m_PDU_Observer) m_PDU_Observer->failNotify(); // problem here.. @@ -227,8 +227,8 @@ void Yaz_PDU_Assoc::socketNotify(int event) { yaz_log(m_log, "maskObserver 5"); m_socketObservable->maskObserver(this, - YAZ_SOCKET_OBSERVE_EXCEPT| - YAZ_SOCKET_OBSERVE_READ); + SOCKET_OBSERVE_EXCEPT| + SOCKET_OBSERVE_READ); } } break; @@ -244,9 +244,9 @@ void Yaz_PDU_Assoc::socketNotify(int event) } } -void Yaz_PDU_Assoc::close() +void PDU_Assoc::close() { - Yaz_PDU_Assoc *ch; + PDU_Assoc *ch; for (ch = m_children; ch; ch = ch->m_next) ch->close(); @@ -254,7 +254,7 @@ void Yaz_PDU_Assoc::close() m_state = Closed; if (m_cs) { - yaz_log (m_log, "Yaz_PDU_Assoc::close fd=%d", cs_fileno(m_cs)); + yaz_log (m_log, "PDU_Assoc::close fd=%d", cs_fileno(m_cs)); cs_close (m_cs); } m_cs = 0; @@ -269,13 +269,13 @@ void Yaz_PDU_Assoc::close() m_input_len = 0; } -void Yaz_PDU_Assoc::destroy() +void PDU_Assoc::destroy() { close(); if (m_destroyed) *m_destroyed = 1; - Yaz_PDU_Assoc **c; + PDU_Assoc **c; // delete from parent's child list (if any) if (m_parent) @@ -292,15 +292,15 @@ void Yaz_PDU_Assoc::destroy() c = &m_children; while (*c) { - Yaz_PDU_Assoc *here = *c; + PDU_Assoc *here = *c; *c = (*c)->m_next; here->m_parent = 0; delete here; } - yaz_log (m_log, "Yaz_PDU_Assoc::destroy this=%p", this); + yaz_log (m_log, "PDU_Assoc::destroy this=%p", this); } -Yaz_PDU_Assoc::PDU_Queue::PDU_Queue(const char *buf, int len) +PDU_Assoc::PDU_Queue::PDU_Queue(const char *buf, int len) { m_buf = (char *) xmalloc (len); memcpy (m_buf, buf, len); @@ -308,12 +308,12 @@ Yaz_PDU_Assoc::PDU_Queue::PDU_Queue(const char *buf, int len) m_next = 0; } -Yaz_PDU_Assoc::PDU_Queue::~PDU_Queue() +PDU_Assoc::PDU_Queue::~PDU_Queue() { xfree (m_buf); } -int Yaz_PDU_Assoc::flush_PDU() +int PDU_Assoc::flush_PDU() { int r; @@ -328,36 +328,36 @@ int Yaz_PDU_Assoc::flush_PDU() m_state = Ready; yaz_log (m_log, "YAZ_PDU_Assoc::flush_PDU queue empty"); yaz_log(m_log, "maskObserver 6"); - m_socketObservable->maskObserver(this, YAZ_SOCKET_OBSERVE_READ| - YAZ_SOCKET_OBSERVE_WRITE| - YAZ_SOCKET_OBSERVE_EXCEPT); + m_socketObservable->maskObserver(this, SOCKET_OBSERVE_READ| + SOCKET_OBSERVE_WRITE| + SOCKET_OBSERVE_EXCEPT); return 0; } r = cs_put (m_cs, q->m_buf, q->m_len); if (r < 0) { - yaz_log (m_log, "Yaz_PDU_Assoc::flush_PDU cs_put failed"); + yaz_log (m_log, "PDU_Assoc::flush_PDU cs_put failed"); close(); m_PDU_Observer->failNotify(); return r; } if (r == 1) { - unsigned mask = YAZ_SOCKET_OBSERVE_EXCEPT; + unsigned mask = SOCKET_OBSERVE_EXCEPT; m_state = Writing; if (m_cs->io_pending & CS_WANT_WRITE) - mask |= YAZ_SOCKET_OBSERVE_WRITE; + mask |= SOCKET_OBSERVE_WRITE; if (m_cs->io_pending & CS_WANT_READ) - mask |= YAZ_SOCKET_OBSERVE_READ; + mask |= SOCKET_OBSERVE_READ; - mask |= YAZ_SOCKET_OBSERVE_WRITE; + mask |= SOCKET_OBSERVE_WRITE; yaz_log(m_log, "maskObserver 7"); m_socketObservable->maskObserver(this, mask); - yaz_log (m_log, "Yaz_PDU_Assoc::flush_PDU cs_put %d bytes fd=%d (inc)", + yaz_log (m_log, "PDU_Assoc::flush_PDU cs_put %d bytes fd=%d (inc)", q->m_len, cs_fileno(m_cs)); return r; } - yaz_log (m_log, "Yaz_PDU_Assoc::flush_PDU cs_put %d bytes", q->m_len); + yaz_log (m_log, "PDU_Assoc::flush_PDU cs_put %d bytes", q->m_len); // whole packet sent... delete this and proceed to next ... m_queue_out = q->m_next; delete q; @@ -366,21 +366,21 @@ int Yaz_PDU_Assoc::flush_PDU() { m_state = Ready; yaz_log(m_log, "maskObserver 8"); - m_socketObservable->maskObserver(this, YAZ_SOCKET_OBSERVE_READ| - YAZ_SOCKET_OBSERVE_EXCEPT); + m_socketObservable->maskObserver(this, SOCKET_OBSERVE_READ| + SOCKET_OBSERVE_EXCEPT); } return r; } -int Yaz_PDU_Assoc::send_PDU(const char *buf, int len) +int PDU_Assoc::send_PDU(const char *buf, int len) { - yaz_log (m_log, "Yaz_PDU_Assoc::send_PDU"); + yaz_log (m_log, "PDU_Assoc::send_PDU"); PDU_Queue **pq = &m_queue_out; int is_idle = (*pq ? 0 : 1); if (!m_cs) { - yaz_log (m_log, "Yaz_PDU_Assoc::send_PDU failed, m_cs == 0"); + yaz_log (m_log, "PDU_Assoc::send_PDU failed, m_cs == 0"); return -1; } while (*pq) @@ -389,18 +389,17 @@ int Yaz_PDU_Assoc::send_PDU(const char *buf, int len) if (is_idle) return flush_PDU (); else - yaz_log (m_log, "Yaz_PDU_Assoc::cannot send_PDU fd=%d", + yaz_log (m_log, "PDU_Assoc::cannot send_PDU fd=%d", cs_fileno(m_cs)); return 0; } -COMSTACK Yaz_PDU_Assoc::comstack(const char *type_and_host, void **vp) +COMSTACK PDU_Assoc::comstack(const char *type_and_host, void **vp) { return cs_create_host(type_and_host, 2, vp); } -int Yaz_PDU_Assoc::listen(IYaz_PDU_Observer *observer, - const char *addr) +int PDU_Assoc::listen(IPDU_Observer *observer, const char *addr) { close(); @@ -414,24 +413,23 @@ int Yaz_PDU_Assoc::listen(IYaz_PDU_Observer *observer, return -2; m_socketObservable->addObserver(cs_fileno(m_cs), this); yaz_log(m_log, "maskObserver 9"); - m_socketObservable->maskObserver(this, YAZ_SOCKET_OBSERVE_READ| - YAZ_SOCKET_OBSERVE_EXCEPT); - yaz_log (m_log, "Yaz_PDU_Assoc::listen ok fd=%d", cs_fileno(m_cs)); + m_socketObservable->maskObserver(this, SOCKET_OBSERVE_READ| + SOCKET_OBSERVE_EXCEPT); + yaz_log (m_log, "PDU_Assoc::listen ok fd=%d", cs_fileno(m_cs)); m_state = Listen; return 0; } -void Yaz_PDU_Assoc::idleTime(int idleTime) +void PDU_Assoc::idleTime(int idleTime) { m_idleTime = idleTime; - yaz_log (m_log, "Yaz_PDU_Assoc::idleTime(%d)", idleTime); + yaz_log (m_log, "PDU_Assoc::idleTime(%d)", idleTime); m_socketObservable->timeoutObserver(this, m_idleTime); } -int Yaz_PDU_Assoc::connect(IYaz_PDU_Observer *observer, - const char *addr) +int PDU_Assoc::connect(IPDU_Observer *observer, const char *addr) { - yaz_log (m_log, "Yaz_PDU_Assoc::connect %s", addr); + yaz_log (m_log, "PDU_Assoc::connect %s", addr); close(); m_PDU_Observer = observer; void *ap; @@ -439,27 +437,27 @@ int Yaz_PDU_Assoc::connect(IYaz_PDU_Observer *observer, if (!m_cs) return -1; int res = cs_connect (m_cs, ap); - yaz_log (m_log, "Yaz_PDU_Assoc::connect fd=%d res=%d", cs_fileno(m_cs), + yaz_log (m_log, "PDU_Assoc::connect fd=%d res=%d", cs_fileno(m_cs), res); m_socketObservable->addObserver(cs_fileno(m_cs), this); if (res == 0) { // Connect complete m_state = Connecting; - unsigned mask = YAZ_SOCKET_OBSERVE_EXCEPT; - mask |= YAZ_SOCKET_OBSERVE_WRITE; - mask |= YAZ_SOCKET_OBSERVE_READ; + unsigned mask = SOCKET_OBSERVE_EXCEPT; + mask |= SOCKET_OBSERVE_WRITE; + mask |= SOCKET_OBSERVE_READ; yaz_log(m_log, "maskObserver 11"); m_socketObservable->maskObserver(this, mask); } else if (res > 0) { // Connect pending m_state = Connecting; - unsigned mask = YAZ_SOCKET_OBSERVE_EXCEPT; + unsigned mask = SOCKET_OBSERVE_EXCEPT; if (m_cs->io_pending & CS_WANT_WRITE) - mask |= YAZ_SOCKET_OBSERVE_WRITE; + mask |= SOCKET_OBSERVE_WRITE; if (m_cs->io_pending & CS_WANT_READ) - mask |= YAZ_SOCKET_OBSERVE_READ; + mask |= SOCKET_OBSERVE_READ; yaz_log(m_log, "maskObserver 11"); m_socketObservable->maskObserver(this, mask); } @@ -468,17 +466,17 @@ int Yaz_PDU_Assoc::connect(IYaz_PDU_Observer *observer, // Since m_state is Closed we can distinguish this case from // normal connect in socketNotify handler yaz_log(m_log, "maskObserver 12"); - m_socketObservable->maskObserver(this, YAZ_SOCKET_OBSERVE_WRITE| - YAZ_SOCKET_OBSERVE_EXCEPT); + m_socketObservable->maskObserver(this, SOCKET_OBSERVE_WRITE| + SOCKET_OBSERVE_EXCEPT); } return 0; } // Single-threaded... Only useful for non-blocking handlers -void Yaz_PDU_Assoc::childNotify(COMSTACK cs) +void PDU_Assoc::childNotify(COMSTACK cs) { - Yaz_PDU_Assoc *new_observable = - new Yaz_PDU_Assoc (m_socketObservable, cs); + PDU_Assoc *new_observable = + new PDU_Assoc (m_socketObservable, cs); new_observable->m_next = m_children; m_children = new_observable; @@ -489,7 +487,7 @@ void Yaz_PDU_Assoc::childNotify(COMSTACK cs) (new_observable, cs_fileno(cs)); } -const char*Yaz_PDU_Assoc::getpeername() +const char*PDU_Assoc::getpeername() { return cs_addrstr(m_cs); } diff --git a/src/yaz-socket-manager.cpp b/src/yaz-socket-manager.cpp index 42d8745..cc26b97 100644 --- a/src/yaz-socket-manager.cpp +++ b/src/yaz-socket-manager.cpp @@ -2,7 +2,7 @@ * Copyright (c) 1998-2005, Index Data. * See the file LICENSE for details. * - * $Id: yaz-socket-manager.cpp,v 1.32 2005-06-02 06:40:21 adam Exp $ + * $Id: yaz-socket-manager.cpp,v 1.33 2005-06-08 13:28:06 adam Exp $ */ #ifdef WIN32 #include @@ -27,10 +27,10 @@ using namespace yazpp_1; -Yaz_SocketManager::YazSocketEntry **Yaz_SocketManager::lookupObserver( - IYazSocketObserver *observer) +SocketManager::SocketEntry **SocketManager::lookupObserver( + ISocketObserver *observer) { - YazSocketEntry **se; + SocketEntry **se; for (se = &m_observers; *se; se = &(*se)->next) if ((*se)->observer == observer) @@ -38,14 +38,14 @@ Yaz_SocketManager::YazSocketEntry **Yaz_SocketManager::lookupObserver( return se; } -void Yaz_SocketManager::addObserver(int fd, IYazSocketObserver *observer) +void SocketManager::addObserver(int fd, ISocketObserver *observer) { - YazSocketEntry *se; + SocketEntry *se; se = *lookupObserver(observer); if (!se) { - se = new YazSocketEntry; + se = new SocketEntry; se->next= m_observers; m_observers = se; se->observer = observer; @@ -56,61 +56,61 @@ void Yaz_SocketManager::addObserver(int fd, IYazSocketObserver *observer) se->timeout = -1; } -void Yaz_SocketManager::deleteObserver(IYazSocketObserver *observer) +void SocketManager::deleteObserver(ISocketObserver *observer) { - YazSocketEntry **se = lookupObserver(observer); + SocketEntry **se = lookupObserver(observer); if (*se) { removeEvent (observer); - YazSocketEntry *se_tmp = *se; + SocketEntry *se_tmp = *se; *se = (*se)->next; delete se_tmp; } } -void Yaz_SocketManager::deleteObservers() +void SocketManager::deleteObservers() { - YazSocketEntry *se = m_observers; + SocketEntry *se = m_observers; while (se) { - YazSocketEntry *se_next = se->next; + SocketEntry *se_next = se->next; delete se; se = se_next; } m_observers = 0; } -void Yaz_SocketManager::maskObserver(IYazSocketObserver *observer, int mask) +void SocketManager::maskObserver(ISocketObserver *observer, int mask) { - YazSocketEntry *se; + SocketEntry *se; yaz_log(m_log, "obs=%p read=%d write=%d except=%d", observer, - mask & YAZ_SOCKET_OBSERVE_READ, - mask & YAZ_SOCKET_OBSERVE_WRITE, - mask & YAZ_SOCKET_OBSERVE_EXCEPT); + mask & SOCKET_OBSERVE_READ, + mask & SOCKET_OBSERVE_WRITE, + mask & SOCKET_OBSERVE_EXCEPT); se = *lookupObserver(observer); if (se) se->mask = mask; } -void Yaz_SocketManager::timeoutObserver(IYazSocketObserver *observer, +void SocketManager::timeoutObserver(ISocketObserver *observer, int timeout) { - YazSocketEntry *se; + SocketEntry *se; se = *lookupObserver(observer); if (se) se->timeout = timeout; } -int Yaz_SocketManager::processEvent() +int SocketManager::processEvent() { - YazSocketEntry *p; - YazSocketEvent *event = getEvent(); + SocketEntry *p; + SocketEvent *event = getEvent(); int timeout = -1; - yaz_log (m_log, "Yaz_SocketManager::processEvent manager=%p", this); + yaz_log (m_log, "SocketManager::processEvent manager=%p", this); if (event) { event->observer->socketNotify(event->event); @@ -133,25 +133,25 @@ int Yaz_SocketManager::processEvent() int fd = p->fd; if (p->mask) no++; - if (p->mask & YAZ_SOCKET_OBSERVE_READ) + if (p->mask & SOCKET_OBSERVE_READ) { - yaz_log (m_log, "Yaz_SocketManager::select fd=%d read", fd); + yaz_log (m_log, "SocketManager::select fd=%d read", fd); FD_SET(fd, &in); } - if (p->mask & YAZ_SOCKET_OBSERVE_WRITE) + if (p->mask & SOCKET_OBSERVE_WRITE) { - yaz_log (m_log, "Yaz_SocketManager::select fd=%d write", fd); + yaz_log (m_log, "SocketManager::select fd=%d write", fd); FD_SET(fd, &out); } - if (p->mask & YAZ_SOCKET_OBSERVE_EXCEPT) + if (p->mask & SOCKET_OBSERVE_EXCEPT) { - yaz_log (m_log, "Yaz_SocketManager::select fd=%d except", fd); + yaz_log (m_log, "SocketManager::select fd=%d except", fd); FD_SET(fd, &except); } if (fd > max) max = fd; if (p->timeout > 0 || - (p->timeout == 0 && (p->mask & YAZ_SOCKET_OBSERVE_WRITE) == 0)) + (p->timeout == 0 && (p->mask & SOCKET_OBSERVE_WRITE) == 0)) { int timeout_this; timeout_this = p->timeout; @@ -164,7 +164,7 @@ int Yaz_SocketManager::processEvent() if (timeout == -1 || timeout_this < timeout) timeout = timeout_this; p->timeout_this = timeout_this; - yaz_log (m_log, "Yaz_SocketManager::select timeout_this=%d", + yaz_log (m_log, "SocketManager::select timeout_this=%d", p->timeout_this); } } @@ -180,7 +180,7 @@ int Yaz_SocketManager::processEvent() to.tv_sec = timeout; to.tv_usec = 0; - yaz_log (m_log, "Yaz_SocketManager::select begin no=%d timeout=%d", + yaz_log (m_log, "SocketManager::select begin no=%d timeout=%d", no, timeout); int pass = 0; while ((res = select(max + 1, &in, &out, &except, @@ -200,17 +200,17 @@ int Yaz_SocketManager::processEvent() int fd = p->fd; int mask = 0; if (FD_ISSET(fd, &in)) - mask |= YAZ_SOCKET_OBSERVE_READ; + mask |= SOCKET_OBSERVE_READ; if (FD_ISSET(fd, &out)) - mask |= YAZ_SOCKET_OBSERVE_WRITE; + mask |= SOCKET_OBSERVE_WRITE; if (FD_ISSET(fd, &except)) - mask |= YAZ_SOCKET_OBSERVE_EXCEPT; + mask |= SOCKET_OBSERVE_EXCEPT; if (mask) { - YazSocketEvent *event = new YazSocketEvent; + SocketEvent *event = new SocketEvent; p->last_activity = now; event->observer = p->observer; event->event = mask; @@ -220,13 +220,13 @@ int Yaz_SocketManager::processEvent() } else if (res == 0 && p->timeout_this == timeout) { - YazSocketEvent *event = new YazSocketEvent; + SocketEvent *event = new SocketEvent; assert (p->last_activity); yaz_log (m_log, "putEvent timeout fd=%d, now = %ld last_activity=%ld timeout=%d", p->fd, now, p->last_activity, p->timeout); p->last_activity = now; event->observer = p->observer; - event->event = YAZ_SOCKET_OBSERVE_TIMEOUT; + event->event = SOCKET_OBSERVE_TIMEOUT; putEvent (event); } } @@ -244,7 +244,7 @@ int Yaz_SocketManager::processEvent() // n p n p ...... n p n p // front back -void Yaz_SocketManager::putEvent(YazSocketEvent *event) +void SocketManager::putEvent(SocketEvent *event) { // put in back of queue if (m_queue_back) @@ -262,10 +262,10 @@ void Yaz_SocketManager::putEvent(YazSocketEvent *event) m_queue_back = event; } -Yaz_SocketManager::YazSocketEvent *Yaz_SocketManager::getEvent() +SocketManager::SocketEvent *SocketManager::getEvent() { // get from front of queue - YazSocketEvent *event = m_queue_front; + SocketEvent *event = m_queue_front; if (!event) return 0; assert (m_queue_back); @@ -280,12 +280,12 @@ Yaz_SocketManager::YazSocketEvent *Yaz_SocketManager::getEvent() return event; } -void Yaz_SocketManager::removeEvent(IYazSocketObserver *observer) +void SocketManager::removeEvent(ISocketObserver *observer) { - YazSocketEvent *ev = m_queue_back; + SocketEvent *ev = m_queue_back; while (ev) { - YazSocketEvent *ev_next = ev->next; + SocketEvent *ev_next = ev->next; if (observer == ev->observer) { if (ev->prev) @@ -302,7 +302,7 @@ void Yaz_SocketManager::removeEvent(IYazSocketObserver *observer) } } -Yaz_SocketManager::Yaz_SocketManager() +SocketManager::SocketManager() { m_observers = 0; m_queue_front = 0; @@ -310,7 +310,7 @@ Yaz_SocketManager::Yaz_SocketManager() m_log = YLOG_DEBUG; } -Yaz_SocketManager::~Yaz_SocketManager() +SocketManager::~SocketManager() { deleteObservers(); } diff --git a/src/yaz-z-assoc.cpp b/src/yaz-z-assoc.cpp index 9180475..6e75c30 100644 --- a/src/yaz-z-assoc.cpp +++ b/src/yaz-z-assoc.cpp @@ -2,7 +2,7 @@ * Copyright (c) 1998-2004, Index Data. * See the file LICENSE for details. * - * $Id: yaz-z-assoc.cpp,v 1.36 2005-06-02 06:40:21 adam Exp $ + * $Id: yaz-z-assoc.cpp,v 1.37 2005-06-08 13:28:06 adam Exp $ */ #include @@ -14,7 +14,7 @@ using namespace yazpp_1; -int Yaz_Z_Assoc::yaz_init_func() +int Z_Assoc::yaz_init_func() { #ifndef WIN32 signal (SIGPIPE, SIG_IGN); @@ -22,9 +22,9 @@ int Yaz_Z_Assoc::yaz_init_func() return 1; } -int Yaz_Z_Assoc::yaz_init_flag = Yaz_Z_Assoc::yaz_init_func(); +int Z_Assoc::yaz_init_flag = Z_Assoc::yaz_init_func(); -Yaz_Z_Assoc::Yaz_Z_Assoc(IYaz_PDU_Observable *the_PDU_Observable) +Z_Assoc::Z_Assoc(IPDU_Observable *the_PDU_Observable) { m_PDU_Observable = the_PDU_Observable; m_odr_in = odr_createmem (ODR_DECODE); @@ -37,7 +37,7 @@ Yaz_Z_Assoc::Yaz_Z_Assoc(IYaz_PDU_Observable *the_PDU_Observable) m_APDU_yazlog = 0; } -void Yaz_Z_Assoc::set_APDU_log(const char *fname) +void Z_Assoc::set_APDU_log(const char *fname) { if (m_APDU_file && m_APDU_file != stderr) { @@ -61,19 +61,19 @@ void Yaz_Z_Assoc::set_APDU_log(const char *fname) } } -int Yaz_Z_Assoc::set_APDU_yazlog(int v) +int Z_Assoc::set_APDU_yazlog(int v) { int old = m_APDU_yazlog; m_APDU_yazlog = v; return old; } -const char *Yaz_Z_Assoc::get_APDU_log() +const char *Z_Assoc::get_APDU_log() { return m_APDU_fname; } -Yaz_Z_Assoc::~Yaz_Z_Assoc() +Z_Assoc::~Z_Assoc() { m_PDU_Observable->destroy(); delete m_PDU_Observable; @@ -84,7 +84,7 @@ Yaz_Z_Assoc::~Yaz_Z_Assoc() delete [] m_hostname; } -void Yaz_Z_Assoc::recv_PDU(const char *buf, int len) +void Z_Assoc::recv_PDU(const char *buf, int len) { yaz_log (m_log, "recv_PDU len=%d", len); Z_GDU *apdu = decode_GDU (buf, len); @@ -99,7 +99,7 @@ void Yaz_Z_Assoc::recv_PDU(const char *buf, int len) } } -Z_APDU *Yaz_Z_Assoc::create_Z_PDU(int type) +Z_APDU *Z_Assoc::create_Z_PDU(int type) { Z_APDU *apdu = zget_APDU(m_odr_out, type); if (apdu->which == Z_APDU_initRequest) @@ -113,7 +113,7 @@ Z_APDU *Yaz_Z_Assoc::create_Z_PDU(int type) return apdu; } -Z_ReferenceId **Yaz_Z_Assoc::get_referenceIdP(Z_APDU *apdu) +Z_ReferenceId **Z_Assoc::get_referenceIdP(Z_APDU *apdu) { switch (apdu->which) { @@ -167,7 +167,7 @@ Z_ReferenceId **Yaz_Z_Assoc::get_referenceIdP(Z_APDU *apdu) return 0; } -void Yaz_Z_Assoc::transfer_referenceId(Z_APDU *from, Z_APDU *to) +void Z_Assoc::transfer_referenceId(Z_APDU *from, Z_APDU *to) { Z_ReferenceId **id_from = get_referenceIdP(from); Z_ReferenceId **id_to = get_referenceIdP(to); @@ -182,7 +182,7 @@ 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 *plen) +int Z_Assoc::send_Z_PDU(Z_APDU *apdu, int *plen) { Z_GDU *gdu = (Z_GDU*) odr_malloc(odr_encode(), sizeof(*gdu)); gdu->which = Z_GDU_Z3950; @@ -190,7 +190,7 @@ int Yaz_Z_Assoc::send_Z_PDU(Z_APDU *apdu, int *plen) return send_GDU(gdu, plen); } -int Yaz_Z_Assoc::send_GDU(Z_GDU *apdu, int *plen) +int Z_Assoc::send_GDU(Z_GDU *apdu, int *plen) { char *buf; int len; @@ -203,7 +203,7 @@ int Yaz_Z_Assoc::send_GDU(Z_GDU *apdu, int *plen) return -1; } -Z_GDU *Yaz_Z_Assoc::decode_GDU(const char *buf, int len) +Z_GDU *Z_Assoc::decode_GDU(const char *buf, int len) { Z_GDU *apdu; @@ -241,7 +241,7 @@ Z_GDU *Yaz_Z_Assoc::decode_GDU(const char *buf, int len) } } -int Yaz_Z_Assoc::encode_GDU(Z_GDU *apdu, char **buf, int *len) +int Z_Assoc::encode_GDU(Z_GDU *apdu, char **buf, int *len) { const char *element = 0; int r = z_GDU(m_odr_out, &apdu, 0, 0); @@ -276,12 +276,12 @@ int Yaz_Z_Assoc::encode_GDU(Z_GDU *apdu, char **buf, int *len) return *len; } -const char *Yaz_Z_Assoc::get_hostname() +const char *Z_Assoc::get_hostname() { return m_hostname; } -int Yaz_Z_Assoc::client(const char *addr) +int Z_Assoc::client(const char *addr) { delete [] m_hostname; m_hostname = new char[strlen(addr)+1]; @@ -289,12 +289,12 @@ int Yaz_Z_Assoc::client(const char *addr) return m_PDU_Observable->connect (this, addr); } -void Yaz_Z_Assoc::close() +void Z_Assoc::close() { m_PDU_Observable->close (); } -int Yaz_Z_Assoc::server(const char *addr) +int Z_Assoc::server(const char *addr) { delete [] m_hostname; m_hostname = new char[strlen(addr)+1]; @@ -302,26 +302,26 @@ int Yaz_Z_Assoc::server(const char *addr) return m_PDU_Observable->listen (this, addr); } -ODR Yaz_Z_Assoc::odr_encode() +ODR Z_Assoc::odr_encode() { return m_odr_out; } -ODR Yaz_Z_Assoc::odr_decode() +ODR Z_Assoc::odr_decode() { return m_odr_in; } -ODR Yaz_Z_Assoc::odr_print() +ODR Z_Assoc::odr_print() { return m_odr_print; } -void Yaz_Z_Assoc::timeout(int timeout) +void Z_Assoc::timeout(int timeout) { m_PDU_Observable->idleTime(timeout); } -void Yaz_Z_Assoc::get_otherInfoAPDU(Z_APDU *apdu, Z_OtherInformation ***oip) +void Z_Assoc::get_otherInfoAPDU(Z_APDU *apdu, Z_OtherInformation ***oip) { switch (apdu->which) { @@ -373,7 +373,7 @@ void Yaz_Z_Assoc::get_otherInfoAPDU(Z_APDU *apdu, Z_OtherInformation ***oip) } } -void Yaz_Z_Assoc::set_otherInformationString ( +void Z_Assoc::set_otherInformationString ( Z_APDU *apdu, int oidval, int categoryValue, const char *str) @@ -385,7 +385,7 @@ void Yaz_Z_Assoc::set_otherInformationString ( set_otherInformationString(otherInformation, oidval, categoryValue, str); } -void Yaz_Z_Assoc::set_otherInformationString ( +void Z_Assoc::set_otherInformationString ( Z_OtherInformation **otherInformation, int oidval, int categoryValue, const char *str) @@ -400,7 +400,7 @@ void Yaz_Z_Assoc::set_otherInformationString ( set_otherInformationString(otherInformation, oid, categoryValue, str); } -void Yaz_Z_Assoc::set_otherInformationString ( +void Z_Assoc::set_otherInformationString ( Z_OtherInformation **otherInformation, int *oid, int categoryValue, const char *str) { @@ -411,7 +411,7 @@ void Yaz_Z_Assoc::set_otherInformationString ( oi->information.characterInfo = odr_strdup (odr_encode(), str); } -Z_OtherInformationUnit *Yaz_Z_Assoc::update_otherInformation ( +Z_OtherInformationUnit *Z_Assoc::update_otherInformation ( Z_OtherInformation **otherInformationP, int createFlag, int *oid, int categoryValue, int deleteFlag) { @@ -420,7 +420,7 @@ Z_OtherInformationUnit *Yaz_Z_Assoc::update_otherInformation ( oid, categoryValue, deleteFlag); } -Z_ReferenceId* Yaz_Z_Assoc::getRefID(char* str) +Z_ReferenceId* Z_Assoc::getRefID(char* str) { Z_ReferenceId* id = NULL; diff --git a/src/yaz-z-cache.cpp b/src/yaz-z-cache.cpp index 011ba99..366d19b 100644 --- a/src/yaz-z-cache.cpp +++ b/src/yaz-z-cache.cpp @@ -2,7 +2,7 @@ * Copyright (c) 2002-2004, Index Data. * See the file LICENSE for details. * - * $Id: yaz-z-cache.cpp,v 1.12 2005-06-02 06:40:21 adam Exp $ + * $Id: yaz-z-cache.cpp,v 1.13 2005-06-08 13:28:06 adam Exp $ */ #include @@ -11,14 +11,14 @@ using namespace yazpp_1; -struct yazpp_1::Yaz_RecordCache_Entry { +struct yazpp_1::RecordCache_Entry { int m_offset; Z_NamePlusRecord *m_record; Z_RecordComposition *m_comp; - Yaz_RecordCache_Entry *m_next; + RecordCache_Entry *m_next; }; -Yaz_RecordCache::Yaz_RecordCache () +RecordCache::RecordCache () { m_mem = nmem_create(); m_entries = 0; @@ -27,17 +27,17 @@ Yaz_RecordCache::Yaz_RecordCache () m_max_size = 200000; } -Yaz_RecordCache::~Yaz_RecordCache () +RecordCache::~RecordCache () { nmem_destroy(m_mem); } -void Yaz_RecordCache::set_max_size(int sz) +void RecordCache::set_max_size(int sz) { m_max_size = sz; } -void Yaz_RecordCache::clear () +void RecordCache::clear () { nmem_destroy(m_mem); m_mem = nmem_create(); @@ -46,7 +46,7 @@ void Yaz_RecordCache::clear () m_searchRequest = 0; } -void Yaz_RecordCache::copy_searchRequest(Z_SearchRequest *sr) +void RecordCache::copy_searchRequest(Z_SearchRequest *sr) { ODR encode = odr_createmem(ODR_ENCODE); ODR decode = odr_createmem(ODR_DECODE); @@ -66,7 +66,7 @@ void Yaz_RecordCache::copy_searchRequest(Z_SearchRequest *sr) odr_destroy(decode); } -void Yaz_RecordCache::copy_presentRequest(Z_PresentRequest *pr) +void RecordCache::copy_presentRequest(Z_PresentRequest *pr) { ODR encode = odr_createmem(ODR_ENCODE); ODR decode = odr_createmem(ODR_DECODE); @@ -86,7 +86,7 @@ void Yaz_RecordCache::copy_presentRequest(Z_PresentRequest *pr) odr_destroy(decode); } -void Yaz_RecordCache::add (ODR o, Z_NamePlusRecordList *npr, int start, +void RecordCache::add (ODR o, Z_NamePlusRecordList *npr, int start, int hits) { if (nmem_total(m_mem) > m_max_size) @@ -117,7 +117,7 @@ void Yaz_RecordCache::add (ODR o, Z_NamePlusRecordList *npr, int start, int i; for (i = 0; inum_records; i++) { - Yaz_RecordCache_Entry *entry = (Yaz_RecordCache_Entry *) + RecordCache_Entry *entry = (RecordCache_Entry *) nmem_malloc(m_mem, sizeof(*entry)); entry->m_record = (Z_NamePlusRecord *) nmem_malloc(m_mem, sizeof(*entry->m_record)); @@ -131,7 +131,7 @@ void Yaz_RecordCache::add (ODR o, Z_NamePlusRecordList *npr, int start, } } -int Yaz_RecordCache::match (Yaz_RecordCache_Entry *entry, +int RecordCache::match (RecordCache_Entry *entry, Odr_oid *syntax, int offset, Z_RecordComposition *comp) { @@ -176,7 +176,7 @@ int Yaz_RecordCache::match (Yaz_RecordCache_Entry *entry, return 0; } -int Yaz_RecordCache::lookup (ODR o, Z_NamePlusRecordList **npr, +int RecordCache::lookup (ODR o, Z_NamePlusRecordList **npr, int start, int num, Odr_oid *syntax, Z_RecordComposition *comp) @@ -186,7 +186,7 @@ int Yaz_RecordCache::lookup (ODR o, Z_NamePlusRecordList **npr, for (i = 0; im_next) if (match(entry, syntax, start+i, comp)) break; @@ -199,7 +199,7 @@ int Yaz_RecordCache::lookup (ODR o, Z_NamePlusRecordList **npr, odr_malloc(o, num * sizeof(Z_NamePlusRecord *)); for (i = 0; im_next) if (match(entry, syntax, start+i, comp)) break; diff --git a/src/yaz-z-server-ill.cpp b/src/yaz-z-server-ill.cpp index 4022006..aa6ca38 100644 --- a/src/yaz-z-server-ill.cpp +++ b/src/yaz-z-server-ill.cpp @@ -2,7 +2,7 @@ * Copyright (c) 2000-2004, Index Data. * See the file LICENSE for details. * - * $Id: yaz-z-server-ill.cpp,v 1.12 2005-06-02 06:40:21 adam Exp $ + * $Id: yaz-z-server-ill.cpp,v 1.13 2005-06-08 13:28:06 adam Exp $ */ #include @@ -10,7 +10,7 @@ using namespace yazpp_1; -int Yaz_Facility_ILL::init(Yaz_Z_Server *s, Z_InitRequest *initRequest, +int Yaz_Facility_ILL::init(Z_Server *s, Z_InitRequest *initRequest, Z_InitResponse *initResponse) { Z_Options *req = initRequest->options; @@ -21,7 +21,7 @@ int Yaz_Facility_ILL::init(Yaz_Z_Server *s, Z_InitRequest *initRequest, return 1; } -int Yaz_Facility_ILL::recv(Yaz_Z_Server *s, Z_APDU *apdu_request) +int Yaz_Facility_ILL::recv(Z_Server *s, Z_APDU *apdu_request) { Z_APDU *apdu_response; diff --git a/src/yaz-z-server-sr.cpp b/src/yaz-z-server-sr.cpp index 1dce4bd..fdddaa5 100644 --- a/src/yaz-z-server-sr.cpp +++ b/src/yaz-z-server-sr.cpp @@ -2,7 +2,7 @@ * Copyright (c) 2000-2004, Index Data. * See the file LICENSE for details. * - * $Id: yaz-z-server-sr.cpp,v 1.9 2005-06-02 06:40:21 adam Exp $ + * $Id: yaz-z-server-sr.cpp,v 1.10 2005-06-08 13:28:06 adam Exp $ * */ @@ -11,7 +11,7 @@ using namespace yazpp_1; -Z_Records *Yaz_Facility_Retrieval::pack_records (Yaz_Z_Server *s, +Z_Records *Yaz_Facility_Retrieval::pack_records (Z_Server *s, const char *resultSetName, int start, int xnum, Z_RecordComposition *comp, @@ -105,7 +105,7 @@ Z_Records *Yaz_Facility_Retrieval::pack_records (Yaz_Z_Server *s, return records; } -void Yaz_Facility_Retrieval::fetch_via_piggyback (Yaz_Z_Server *s, +void Yaz_Facility_Retrieval::fetch_via_piggyback (Z_Server *s, Z_SearchRequest *req, Z_SearchResponse *res) { @@ -165,7 +165,7 @@ void Yaz_Facility_Retrieval::fetch_via_piggyback (Yaz_Z_Server *s, } } -void Yaz_Facility_Retrieval::fetch_via_present (Yaz_Z_Server *s, +void Yaz_Facility_Retrieval::fetch_via_present (Z_Server *s, Z_PresentRequest *req, Z_PresentResponse *res) { @@ -181,7 +181,7 @@ void Yaz_Facility_Retrieval::fetch_via_present (Yaz_Z_Server *s, res->records->u.databaseOrSurDiagnostics->num_records; } -int Yaz_Facility_Retrieval::init(Yaz_Z_Server *s, Z_InitRequest *initRequest, +int Yaz_Facility_Retrieval::init(Z_Server *s, Z_InitRequest *initRequest, Z_InitResponse *initResponse) { Z_Options *req = initRequest->options; @@ -206,7 +206,7 @@ ODR Yaz_Facility_Retrieval::odr_decode() return m_odr_decode; } -int Yaz_Facility_Retrieval::recv(Yaz_Z_Server *s, Z_APDU *apdu_request) +int Yaz_Facility_Retrieval::recv(Z_Server *s, Z_APDU *apdu_request) { Z_APDU *apdu_response; m_odr_encode = s->odr_encode(); diff --git a/src/yaz-z-server-update.cpp b/src/yaz-z-server-update.cpp index bef9f9d..81b0530 100644 --- a/src/yaz-z-server-update.cpp +++ b/src/yaz-z-server-update.cpp @@ -2,7 +2,7 @@ * Copyright (c) 2000-2004, Index Data. * See the file LICENSE for details. * - * $Id: yaz-z-server-update.cpp,v 1.9 2005-06-02 06:40:21 adam Exp $ + * $Id: yaz-z-server-update.cpp,v 1.10 2005-06-08 13:28:06 adam Exp $ */ #include @@ -10,7 +10,7 @@ using namespace yazpp_1; -int Yaz_Facility_Update::init(Yaz_Z_Server *s, Z_InitRequest *initRequest, +int Yaz_Facility_Update::init(Z_Server *s, Z_InitRequest *initRequest, Z_InitResponse *initResponse) { Z_Options *req = initRequest->options; @@ -21,7 +21,7 @@ int Yaz_Facility_Update::init(Yaz_Z_Server *s, Z_InitRequest *initRequest, return 1; } -int Yaz_Facility_Update::recv(Yaz_Z_Server *s, Z_APDU *apdu_request) +int Yaz_Facility_Update::recv(Z_Server *s, Z_APDU *apdu_request) { Z_APDU *apdu_response; diff --git a/src/yaz-z-server.cpp b/src/yaz-z-server.cpp index ecd4095..06992b7 100644 --- a/src/yaz-z-server.cpp +++ b/src/yaz-z-server.cpp @@ -2,7 +2,7 @@ * Copyright (c) 2000-2004, Index Data. * See the file LICENSE for details. * - * $Id: yaz-z-server.cpp,v 1.21 2005-06-02 06:40:21 adam Exp $ + * $Id: yaz-z-server.cpp,v 1.22 2005-06-08 13:28:06 adam Exp $ */ #include @@ -10,23 +10,23 @@ using namespace yazpp_1; -Yaz_Z_Server::Yaz_Z_Server(IYaz_PDU_Observable *the_PDU_Observable) - : Yaz_Z_Assoc(the_PDU_Observable) +Z_Server::Z_Server(IPDU_Observable *the_PDU_Observable) + : Z_Assoc(the_PDU_Observable) { m_facilities = 0; } -Yaz_Z_Server::~Yaz_Z_Server() +Z_Server::~Z_Server() { facility_reset(); } -void Yaz_Z_Server::facility_reset () +void Z_Server::facility_reset () { - Yaz_Z_Server_Facility_Info *p = m_facilities; + Z_Server_Facility_Info *p = m_facilities; while (p) { - Yaz_Z_Server_Facility_Info *p_next = p->m_next; + Z_Server_Facility_Info *p_next = p->m_next; delete [] p->m_name; delete p; @@ -35,14 +35,14 @@ void Yaz_Z_Server::facility_reset () m_facilities = 0; } -void Yaz_Z_Server::facility_add(IYaz_Server_Facility *facility, - const char *name) +void Z_Server::facility_add(IServer_Facility *facility, + const char *name) { - Yaz_Z_Server_Facility_Info **p = &m_facilities; + Z_Server_Facility_Info **p = &m_facilities; while (*p) p = &(*p)->m_next; - *p = new Yaz_Z_Server_Facility_Info; + *p = new Z_Server_Facility_Info; (*p)->m_next = 0; (*p)->m_name = new char [strlen(name)+1]; @@ -50,7 +50,7 @@ void Yaz_Z_Server::facility_add(IYaz_Server_Facility *facility, (*p)->m_facility = facility; } -void Yaz_Z_Server::recv_GDU (Z_GDU *apdu, int len) +void Z_Server::recv_GDU (Z_GDU *apdu, int len) { if (apdu->which == Z_GDU_Z3950) recv_Z_PDU(apdu->u.z3950, len); @@ -58,9 +58,9 @@ void Yaz_Z_Server::recv_GDU (Z_GDU *apdu, int len) delete this; } -void Yaz_Z_Server::recv_Z_PDU (Z_APDU *apdu_request, int len) +void Z_Server::recv_Z_PDU (Z_APDU *apdu_request, int len) { - Yaz_Z_Server_Facility_Info *f = m_facilities; + Z_Server_Facility_Info *f = m_facilities; if (apdu_request->which == Z_APDU_initRequest) { @@ -111,7 +111,7 @@ void Yaz_Z_Server::recv_Z_PDU (Z_APDU *apdu_request, int len) /* * database record. */ -void Yaz_Z_ServerUtility::create_databaseRecord ( +void Z_ServerUtility::create_databaseRecord ( ODR odr, Z_NamePlusRecord *rec, const char *dbname, int format, const void *buf, int len) { @@ -124,7 +124,7 @@ void Yaz_Z_ServerUtility::create_databaseRecord ( /* * surrogate diagnostic. */ -void Yaz_Z_ServerUtility::create_surrogateDiagnostics( +void Z_ServerUtility::create_surrogateDiagnostics( ODR odr, Z_NamePlusRecord *rec, const char *dbname, int error, char *const addinfo) { @@ -148,7 +148,7 @@ void Yaz_Z_ServerUtility::create_surrogateDiagnostics( dr->u.v2Addinfo = odr_strdup (odr, addinfo ? addinfo : ""); } -Z_Records *Yaz_Z_ServerUtility::create_nonSurrogateDiagnostics ( +Z_Records *Z_ServerUtility::create_nonSurrogateDiagnostics ( ODR odr, int error, const char *addinfo) { Z_Records *rec = (Z_Records *) @@ -172,7 +172,7 @@ Z_Records *Yaz_Z_ServerUtility::create_nonSurrogateDiagnostics ( return rec; } -void Yaz_Z_ServerUtility::create_diagnostics ( +void Z_ServerUtility::create_diagnostics ( ODR odr, int error, const char *addinfo, Z_DiagRec ***dreca, int *num) { diff --git a/zlint/main.cpp b/zlint/main.cpp index a01b500..7e34e64 100644 --- a/zlint/main.cpp +++ b/zlint/main.cpp @@ -7,8 +7,8 @@ int main(int argc, char **argv) { - Yaz_SocketManager mySocketManager; - Zlint z(new Yaz_PDU_Assoc(&mySocketManager)); + SocketManager mySocketManager; + Zlint z(new PDU_Assoc(&mySocketManager)); if (argc > 1) z.set_host(argv[1]); diff --git a/zlint/zlint.cpp b/zlint/zlint.cpp index 5c2719d..46cbf8e 100644 --- a/zlint/zlint.cpp +++ b/zlint/zlint.cpp @@ -2,7 +2,7 @@ * Copyright (c) 2004, Index Data. * See the file LICENSE for details. * - * $Id: zlint.cpp,v 1.9 2005-05-17 20:33:57 adam Exp $ + * $Id: zlint.cpp,v 1.10 2005-06-08 13:28:06 adam Exp $ */ #include @@ -29,8 +29,8 @@ private: int m_test_reported; }; -Zlint::Zlint(IYaz_PDU_Observable *the_PDU_Observable) : - Yaz_Z_Assoc(the_PDU_Observable) +Zlint::Zlint(IPDU_Observable *the_PDU_Observable) : + Z_Assoc(the_PDU_Observable) { m_PDU_Observable = the_PDU_Observable; @@ -135,8 +135,8 @@ void Zlint::close_goto_next() timeout(30); } -IYaz_PDU_Observer *Zlint::sessionNotify( - IYaz_PDU_Observable *the_PDU_Observable, int fd) +IPDU_Observer *Zlint::sessionNotify( + IPDU_Observable *the_PDU_Observable, int fd) { return 0; } diff --git a/zlint/zlint.h b/zlint/zlint.h index 49d7b84..d9dbca6 100644 --- a/zlint/zlint.h +++ b/zlint/zlint.h @@ -2,7 +2,7 @@ * Copyright (c) 2004, Index Data. * See the file LICENSE for details. * - * $Id: zlint.h,v 1.2 2005-06-02 06:40:21 adam Exp $ + * $Id: zlint.h,v 1.3 2005-06-08 13:28:06 adam Exp $ */ #include @@ -18,9 +18,9 @@ enum Zlint_code { class Zlint_test; class Zlint_t; -class Zlint : public Yaz_Z_Assoc { +class Zlint : public Z_Assoc { public: - Zlint(IYaz_PDU_Observable *the_PDU_Observable); + Zlint(IPDU_Observable *the_PDU_Observable); ~Zlint(); void add_test(Zlint_test *i); void set_host(const char *cp); @@ -37,9 +37,8 @@ private: void timeoutNotify(); void failNotify(); void recv_GDU(Z_GDU *apdu, int len); - IYaz_PDU_Observable *m_PDU_Observable; - IYaz_PDU_Observer *sessionNotify( - IYaz_PDU_Observable *the_PDU_Observable, int fd); + IPDU_Observable *m_PDU_Observable; + IPDU_Observer *sessionNotify(IPDU_Observable *the_PDU_Observable, int fd); Zlint_t *m_tests; Zlint_t *m_cur_test; char *m_host;