From: Adam Dickmeiss Date: Wed, 9 Oct 2002 12:50:26 +0000 (+0000) Subject: Rename yaz++ header files X-Git-Tag: YAZPP.0.5~54 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=ceb226cb18d96a6b3aa2dd6cff94aa27850362cf;p=yazpp-moved-to-github.git Rename yaz++ header files --- diff --git a/include/yaz++/Makefile.am b/include/yaz++/Makefile.am index 01d4cb4..70f83d7 100644 --- a/include/yaz++/Makefile.am +++ b/include/yaz++/Makefile.am @@ -1,5 +1,13 @@ -pkginclude_HEADERS = yaz-ir-assoc.h yaz-pdu-assoc.h \ - yaz-pdu-observer.h yaz-proxy.h yaz-query.h \ - yaz-socket-manager.h yaz-socket-observer.h yaz-z-assoc.h \ - yaz-z-query.h yaz-z-server.h yaz-z-databases.h +pkginclude_HEADERS = \ + ir-assoc.h \ + pdu-assoc.h \ + pdu-observer.h \ + proxy.h \ + query.h \ + socket-manager.h \ + socket-observer.h \ + assoc.h \ + z-query.h \ + z-server.h \ + z-databases.h diff --git a/include/yaz++/ir-assoc.h b/include/yaz++/ir-assoc.h new file mode 100644 index 0000000..408f31f --- /dev/null +++ b/include/yaz++/ir-assoc.h @@ -0,0 +1,79 @@ +/* + * Copyright (c) 1998-2000, Index Data. + * See the file LICENSE for details. + * + * $Id: ir-assoc.h,v 1.1 2002-10-09 12:50:26 adam Exp $ + */ + +#include +#include + +/** Information Retrieval Assocation. + This object implements the client - and server role of a generic + Z39.50 Association. +*/ +class YAZ_EXPORT Yaz_IR_Assoc: public Yaz_Z_Assoc { + public: + /// Create object using the PDU Observer specified + Yaz_IR_Assoc(IYaz_PDU_Observable *the_PDU_Observable); + /// Destroy assocation and close PDU Observer + virtual ~Yaz_IR_Assoc(); + /// Receive Z39.50 PDU + void recv_Z_PDU(Z_APDU *apdu); + /// Set Database Names + void set_databaseNames (int num, const char **list); + void set_databaseNames(const char *dblist, const char *sep); + /// Get Database Names + void get_databaseNames (int *num, char ***list); + + void client(const char *addr); + + /// Set Preferred Record Syntax + void set_preferredRecordSyntax (int value); + void set_preferredRecordSyntax (const char *syntax); + /// Get Preferred Record Syntax + void get_preferredRecordSyntax (int *val); + void get_preferredRecordSyntax (const char **syntax); + + /// Set ElementSetName + void set_elementSetName (const char *elementSetName); + /// Get ElementSetName + void get_elementSetName (const char **elementSetName); + void get_elementSetName (Z_ElementSetNames **elementSetNames); + + int get_lastReceived(); + void set_lastReceived(int lastReceived); + + /// Settings + void set_proxy(const char *str); + const char *get_proxy(); + const char *get_host(); + + void set_cookie(const char *str); + const char *get_cookie(); + + /// Send Services + int send_initRequest(char* pRefId=NULL); + int send_searchRequest(Yaz_Z_Query *query, char* pResultSetId = NULL, char* pRefId = NULL); + int send_presentRequest(int start, int number, char* pResultSetId = NULL, char* pRefId = NULL); + int send_deleteResultSetRequest(char* pResultSetId = 0, char* pRefId = 0); + + /// Recv Services + virtual void recv_initRequest(Z_InitRequest *initRequest); + virtual void recv_initResponse(Z_InitResponse *initResponse); + virtual void recv_searchRequest(Z_SearchRequest *searchRequest); + virtual void recv_presentRequest(Z_PresentRequest *presentRequest); + virtual void recv_searchResponse(Z_SearchResponse *searchResponse); + virtual void recv_presentResponse(Z_PresentResponse *presentResponse); + virtual void recv_extendedServicesResponse(Z_ExtendedServicesResponse *extendedServicesResponse); + private: + char *m_proxy; + char *m_host; + char *m_cookie; + int m_num_databaseNames; + char **m_databaseNames; + int m_preferredRecordSyntax; + Z_ElementSetNames *m_elementSetNames; + int m_lastReceived; + int m_log; +}; diff --git a/include/yaz++/pdu-assoc.h b/include/yaz++/pdu-assoc.h new file mode 100644 index 0000000..e16c19f --- /dev/null +++ b/include/yaz++/pdu-assoc.h @@ -0,0 +1,91 @@ +/* + * Copyright (c) 1998-2000, Index Data. + * See the file LICENSE for details. + * + * $Id: pdu-assoc.h,v 1.1 2002-10-09 12:50:26 adam Exp $ + */ + +#ifndef YAZ_PDU_ASSOC_INCLUDED +#define YAZ_PDU_ASSOC_INCLUDED + +#include +#include +#include + +/** Simple Protocol Data Unit Assocation. + This object sends - and receives PDU's using the COMSTACK + network utility. To use the association in client role, use + the method connect. The server role is initiated by using the + listen method. + */ +class YAZ_EXPORT Yaz_PDU_Assoc : public IYaz_PDU_Observable, IYazSocketObserver { + friend class Yaz_PDU_AssocThread; + private: + enum { + Connecting, + Listen, + Ready, + Closed, + Writing, + Accepting + } m_state; + class PDU_Queue { + public: + PDU_Queue(const char *buf, int len); + PDU_Queue::~PDU_Queue(); + char *m_buf; + int m_len; + PDU_Queue *m_next; + }; + Yaz_PDU_Assoc *m_parent; + Yaz_PDU_Assoc *m_children; + Yaz_PDU_Assoc *m_next; + COMSTACK m_cs; + IYazSocketObservable *m_socketObservable; + IYaz_PDU_Observer *m_PDU_Observer; + char *m_input_buf; + int m_input_len; + PDU_Queue *m_queue_out; + int Yaz_PDU_Assoc::flush_PDU(); + int *m_destroyed; + int m_idleTime; + int m_log; + void init(IYazSocketObservable *socketObservable); + public: + COMSTACK comstack(const char *type_and_host, void **vp); + /// Create object using specified socketObservable + Yaz_PDU_Assoc(IYazSocketObservable *socketObservable); + /// Create Object using existing comstack + Yaz_PDU_Assoc(IYazSocketObservable *socketObservable, + COMSTACK cs); + /// Close socket and destroy object. + /// virtual ~Yaz_PDU_Assoc(); + /// Clone the object + IYaz_PDU_Observable *clone(); + /// Send PDU + int send_PDU(const char *buf, int len); + /// connect to server (client role) + void connect(IYaz_PDU_Observer *observer, const char *addr); + /// listen for clients (server role) + void listen(IYaz_PDU_Observer *observer, const char *addr); + /// Socket notification + void socketNotify(int event); + /// Close socket + void close(); + /// Close and destroy + void destroy(); + /// Set Idle Time + void idleTime (int timeout); + /// Child start... + virtual void childNotify(COMSTACK cs); +}; + +class YAZ_EXPORT Yaz_PDU_AssocThread : public Yaz_PDU_Assoc { + public: + Yaz_PDU_AssocThread(IYazSocketObservable *socketObservable); + private: + void childNotify(COMSTACK cs); + +}; +#endif + diff --git a/include/yaz++/pdu-observer.h b/include/yaz++/pdu-observer.h new file mode 100644 index 0000000..02b5fe8 --- /dev/null +++ b/include/yaz++/pdu-observer.h @@ -0,0 +1,56 @@ +/* + * Copyright (c) 1998-2000, Index Data. + * See the file LICENSE for details. + * + * $Id: pdu-observer.h,v 1.1 2002-10-09 12:50:26 adam Exp $ + */ + +#ifndef YAZ_PDU_OBSERVER_H +#define YAZ_PDU_OBSERVER_H + +class IYaz_PDU_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. + */ +class YAZ_EXPORT IYaz_PDU_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 void connect(IYaz_PDU_Observer *observer, const char *addr) = 0; + /// Listen on address addr. + virtual void listen(IYaz_PDU_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; + /// Destroy completely + virtual void destroy() = 0; + /// Set Idle Time + virtual void idleTime (int timeout) = 0; +}; + +/** Protocol Data Unit Observer. + This interface is used together with the IYaz_PDU_Observable interface + and acts as a callback interface for it. + */ +class YAZ_EXPORT IYaz_PDU_Observer { + public: + /// A PDU has been received + virtual void recv_PDU(const char *buf, int len) = 0; + /// Called when Iyaz_PDU_Observable::connect was successful. + virtual void connectNotify() = 0; + /// Called whenever the connection was closed + 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; +}; + +#endif diff --git a/include/yaz++/proxy.h b/include/yaz++/proxy.h new file mode 100644 index 0000000..e385812 --- /dev/null +++ b/include/yaz++/proxy.h @@ -0,0 +1,78 @@ +/* + * Copyright (c) 1998-2000, Index Data. + * See the file LICENSE for details. + * + * $Id: proxy.h,v 1.1 2002-10-09 12:50:26 adam Exp $ + */ + +#include +#include +#include + +class Yaz_Proxy; + +/// Private class +class YAZ_EXPORT Yaz_ProxyClient : public Yaz_Z_Assoc { + friend Yaz_Proxy; + Yaz_ProxyClient(IYaz_PDU_Observable *the_PDU_Observable); + ~Yaz_ProxyClient(); + void recv_Z_PDU(Z_APDU *apdu); + IYaz_PDU_Observer* sessionNotify + (IYaz_PDU_Observable *the_PDU_Observable, int fd); + void shutdown(); + Yaz_Proxy *m_server; + void failNotify(); + void timeoutNotify(); + void connectNotify(); + char m_cookie[32]; + Yaz_ProxyClient *m_next; + Yaz_ProxyClient **m_prev; + int m_init_flag; + Yaz_Z_Query *m_last_query; + Yaz_Z_Databases m_last_databases; + char *m_last_resultSetId; + int m_last_ok; + int m_last_resultCount; + int m_sr_transform; + int m_seqno; + int m_waiting; + ODR m_init_odr; + Z_APDU *m_initResponse; +}; + +/// Information Retrieval Proxy Server. +class YAZ_EXPORT Yaz_Proxy : public Yaz_Z_Assoc { + private: + char *get_cookie(Z_OtherInformation **otherInfo); + char *get_proxy(Z_OtherInformation **otherInfo); + Yaz_ProxyClient *get_client(Z_APDU *apdu); + Z_APDU *result_set_optimize(Z_APDU *apdu); + void shutdown(); + + Yaz_ProxyClient *m_client; + IYaz_PDU_Observable *m_PDU_Observable; + Yaz_ProxyClient *m_clientPool; + Yaz_Proxy *m_parent; + int m_seqno; + int m_max_clients; + int m_keepalive; + char *m_proxyTarget; + char *m_proxy_authentication; + long m_seed; + char *m_optimize; + public: + Yaz_Proxy(IYaz_PDU_Observable *the_PDU_Observable); + ~Yaz_Proxy(); + void recv_Z_PDU(Z_APDU *apdu); + IYaz_PDU_Observer* sessionNotify + (IYaz_PDU_Observable *the_PDU_Observable, int fd); + void failNotify(); + void timeoutNotify(); + void connectNotify(); + const char *option(const char *name, const char *value); + void set_proxy_target(const char *target); + void set_proxy_authentication (const char *auth); + char *get_proxy_target() { return m_proxyTarget; }; + void set_max_clients(int m) { m_max_clients = m; }; +}; + diff --git a/include/yaz++/query.h b/include/yaz++/query.h new file mode 100644 index 0000000..8d2e42f --- /dev/null +++ b/include/yaz++/query.h @@ -0,0 +1,17 @@ +/* + * Copyright (c) 1998-2000, Index Data. + * See the file LICENSE for details. + * + * $Id: query.h,v 1.1 2002-10-09 12:50:26 adam Exp $ + */ + + +/** Query + Generic Query. +*/ +class YAZ_EXPORT Yaz_Query { + public: + /// Print query in buffer described by str and len + virtual void print (char *str, int len) = 0; +}; + diff --git a/include/yaz++/socket-manager.h b/include/yaz++/socket-manager.h new file mode 100644 index 0000000..b293965 --- /dev/null +++ b/include/yaz++/socket-manager.h @@ -0,0 +1,64 @@ +/* + * Copyright (c) 1998-2000, Index Data. + * See the file LICENSE for details. + * + * $Id: socket-manager.h,v 1.1 2002-10-09 12:50:26 adam Exp $ + */ + +#ifndef YAZ_SOCKET_MANAGER_INCLUDED +#define YAZ_SOCKET_MANAGER_INCLUDED + +#include +#include + +/** Simple Socket Manager. + Implements a stand-alone simple model that uses select(2) to + observe socket events. +*/ +class YAZ_EXPORT Yaz_SocketManager : public IYazSocketObservable { + private: + struct YazSocketEntry { + IYazSocketObserver *observer; + int fd; + unsigned mask; + unsigned timeout; + unsigned timeout_this; + time_t last_activity; + YazSocketEntry *next; + }; + YazSocketEntry *m_observers; // all registered observers + struct YazSocketEvent { + IYazSocketObserver *observer; + int event; + YazSocketEvent *next; // front in queue + YazSocketEvent *prev; // back in queue + }; + YazSocketEvent *m_queue_front; + YazSocketEvent *m_queue_back; + + YazSocketEntry **Yaz_SocketManager::lookupObserver + (IYazSocketObserver *observer); + YazSocketEvent *Yaz_SocketManager::getEvent(); + void putEvent(YazSocketEvent *event); + void removeEvent(IYazSocketObserver *observer); + int m_log; + public: + /// Add an observer + virtual void addObserver(int fd, IYazSocketObserver *observer); + /// Delete an observer + virtual void deleteObserver(IYazSocketObserver *observer); + /// Delete all observers + virtual void deleteObservers(); + /// Set event mask for observer + virtual void maskObserver(IYazSocketObserver *observer, int mask); + /// Set timeout + virtual void timeoutObserver(IYazSocketObserver *observer, + unsigned timeout); + /// Process one event. return > 0 if event could be processed; + int Yaz_SocketManager::processEvent(); + Yaz_SocketManager(); + virtual ~Yaz_SocketManager(); +}; + + +#endif diff --git a/include/yaz++/socket-observer.h b/include/yaz++/socket-observer.h new file mode 100644 index 0000000..3644893 --- /dev/null +++ b/include/yaz++/socket-observer.h @@ -0,0 +1,64 @@ +/* + * Copyright (c) 1998-2000, Index Data. + * See the file LICENSE for details. + * + * $Id: socket-observer.h,v 1.1 2002-10-09 12:50:26 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 + +/** + Forward reference + */ +class IYazSocketObserver; + +/** 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
+    
+ The maskObserver method specifies which of these events the + observer is intertested in. +*/ +class YAZ_EXPORT IYazSocketObservable { + public: + /// Add an observer interested in socket fd + virtual void addObserver(int fd, IYazSocketObserver *observer) = 0; + /// Delete an observer + virtual void deleteObserver(IYazSocketObserver *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; + /// Specify timeout + virtual void timeoutObserver(IYazSocketObserver *observer, + unsigned timeout)=0; +}; + +/** Socket Observer. + The IYazSocketObserver interface implements a module interested + socket events. Look for objects that implements the + IYazSocketObservable interface! +*/ +class YAZ_EXPORT IYazSocketObserver { + public: + /// Notify the observer that something happened to socket + virtual void socketNotify(int event) = 0; +}; + +#endif diff --git a/include/yaz++/yaz-ir-assoc.h b/include/yaz++/yaz-ir-assoc.h deleted file mode 100644 index cdd2211..0000000 --- a/include/yaz++/yaz-ir-assoc.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 1998-2000, Index Data. - * See the file LICENSE for details. - * - * $Id: yaz-ir-assoc.h,v 1.2 2001-04-26 12:17:49 heikki Exp $ - */ - -#include -#include - -/** Information Retrieval Assocation. - This object implements the client - and server role of a generic - Z39.50 Association. -*/ -class YAZ_EXPORT Yaz_IR_Assoc: public Yaz_Z_Assoc { - public: - /// Create object using the PDU Observer specified - Yaz_IR_Assoc(IYaz_PDU_Observable *the_PDU_Observable); - /// Destroy assocation and close PDU Observer - virtual ~Yaz_IR_Assoc(); - /// Receive Z39.50 PDU - void recv_Z_PDU(Z_APDU *apdu); - /// Set Database Names - void set_databaseNames (int num, const char **list); - void set_databaseNames(const char *dblist, const char *sep); - /// Get Database Names - void get_databaseNames (int *num, char ***list); - - void client(const char *addr); - - /// Set Preferred Record Syntax - void set_preferredRecordSyntax (int value); - void set_preferredRecordSyntax (const char *syntax); - /// Get Preferred Record Syntax - void get_preferredRecordSyntax (int *val); - void get_preferredRecordSyntax (const char **syntax); - - /// Set ElementSetName - void set_elementSetName (const char *elementSetName); - /// Get ElementSetName - void get_elementSetName (const char **elementSetName); - void get_elementSetName (Z_ElementSetNames **elementSetNames); - - int get_lastReceived(); - void set_lastReceived(int lastReceived); - - /// Settings - void set_proxy(const char *str); - const char *get_proxy(); - const char *get_host(); - - void set_cookie(const char *str); - const char *get_cookie(); - - /// Send Services - int send_initRequest(char* pRefId=NULL); - int send_searchRequest(Yaz_Z_Query *query, char* pResultSetId = NULL, char* pRefId = NULL); - int send_presentRequest(int start, int number, char* pResultSetId = NULL, char* pRefId = NULL); - int send_deleteResultSetRequest(char* pResultSetId = 0, char* pRefId = 0); - - /// Recv Services - virtual void recv_initRequest(Z_InitRequest *initRequest); - virtual void recv_initResponse(Z_InitResponse *initResponse); - virtual void recv_searchRequest(Z_SearchRequest *searchRequest); - virtual void recv_presentRequest(Z_PresentRequest *presentRequest); - virtual void recv_searchResponse(Z_SearchResponse *searchResponse); - virtual void recv_presentResponse(Z_PresentResponse *presentResponse); - virtual void recv_extendedServicesResponse(Z_ExtendedServicesResponse *extendedServicesResponse); - private: - char *m_proxy; - char *m_host; - char *m_cookie; - int m_num_databaseNames; - char **m_databaseNames; - int m_preferredRecordSyntax; - Z_ElementSetNames *m_elementSetNames; - int m_lastReceived; - int m_log; -}; diff --git a/include/yaz++/yaz-pdu-assoc.h b/include/yaz++/yaz-pdu-assoc.h deleted file mode 100644 index c3b2b35..0000000 --- a/include/yaz++/yaz-pdu-assoc.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 1998-2000, Index Data. - * See the file LICENSE for details. - * - * $Id: yaz-pdu-assoc.h,v 1.2 2001-03-26 14:43:49 adam Exp $ - */ - -#ifndef YAZ_PDU_ASSOC_INCLUDED -#define YAZ_PDU_ASSOC_INCLUDED - -#include -#include -#include - -/** Simple Protocol Data Unit Assocation. - This object sends - and receives PDU's using the COMSTACK - network utility. To use the association in client role, use - the method connect. The server role is initiated by using the - listen method. - */ -class YAZ_EXPORT Yaz_PDU_Assoc : public IYaz_PDU_Observable, IYazSocketObserver { - friend class Yaz_PDU_AssocThread; - private: - enum { - Connecting, - Listen, - Ready, - Closed, - Writing, - Accepting - } m_state; - class PDU_Queue { - public: - PDU_Queue(const char *buf, int len); - PDU_Queue::~PDU_Queue(); - char *m_buf; - int m_len; - PDU_Queue *m_next; - }; - Yaz_PDU_Assoc *m_parent; - Yaz_PDU_Assoc *m_children; - Yaz_PDU_Assoc *m_next; - COMSTACK m_cs; - IYazSocketObservable *m_socketObservable; - IYaz_PDU_Observer *m_PDU_Observer; - char *m_input_buf; - int m_input_len; - PDU_Queue *m_queue_out; - int Yaz_PDU_Assoc::flush_PDU(); - int *m_destroyed; - int m_idleTime; - int m_log; - void init(IYazSocketObservable *socketObservable); - public: - COMSTACK comstack(const char *type_and_host, void **vp); - /// Create object using specified socketObservable - Yaz_PDU_Assoc(IYazSocketObservable *socketObservable); - /// Create Object using existing comstack - Yaz_PDU_Assoc(IYazSocketObservable *socketObservable, - COMSTACK cs); - /// Close socket and destroy object. - /// virtual ~Yaz_PDU_Assoc(); - /// Clone the object - IYaz_PDU_Observable *clone(); - /// Send PDU - int send_PDU(const char *buf, int len); - /// connect to server (client role) - void connect(IYaz_PDU_Observer *observer, const char *addr); - /// listen for clients (server role) - void listen(IYaz_PDU_Observer *observer, const char *addr); - /// Socket notification - void socketNotify(int event); - /// Close socket - void close(); - /// Close and destroy - void destroy(); - /// Set Idle Time - void idleTime (int timeout); - /// Child start... - virtual void childNotify(COMSTACK cs); -}; - -class YAZ_EXPORT Yaz_PDU_AssocThread : public Yaz_PDU_Assoc { - public: - Yaz_PDU_AssocThread(IYazSocketObservable *socketObservable); - private: - void childNotify(COMSTACK cs); - -}; -#endif - diff --git a/include/yaz++/yaz-pdu-observer.h b/include/yaz++/yaz-pdu-observer.h deleted file mode 100644 index 61daf78..0000000 --- a/include/yaz++/yaz-pdu-observer.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 1998-2000, Index Data. - * See the file LICENSE for details. - * - * $Id: yaz-pdu-observer.h,v 1.3 2001-03-26 14:43:49 adam Exp $ - */ - -#ifndef YAZ_PDU_OBSERVER_H -#define YAZ_PDU_OBSERVER_H - -class IYaz_PDU_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. - */ -class YAZ_EXPORT IYaz_PDU_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 void connect(IYaz_PDU_Observer *observer, const char *addr) = 0; - /// Listen on address addr. - virtual void listen(IYaz_PDU_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; - /// Destroy completely - virtual void destroy() = 0; - /// Set Idle Time - virtual void idleTime (int timeout) = 0; -}; - -/** Protocol Data Unit Observer. - This interface is used together with the IYaz_PDU_Observable interface - and acts as a callback interface for it. - */ -class YAZ_EXPORT IYaz_PDU_Observer { - public: - /// A PDU has been received - virtual void recv_PDU(const char *buf, int len) = 0; - /// Called when Iyaz_PDU_Observable::connect was successful. - virtual void connectNotify() = 0; - /// Called whenever the connection was closed - 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; -}; - -#endif diff --git a/include/yaz++/yaz-proxy.h b/include/yaz++/yaz-proxy.h deleted file mode 100644 index 0595e51..0000000 --- a/include/yaz++/yaz-proxy.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 1998-2000, Index Data. - * See the file LICENSE for details. - * - * $Id: yaz-proxy.h,v 1.7 2002-09-10 13:01:14 adam Exp $ - */ - -#include -#include -#include - -class Yaz_Proxy; - -/// Private class -class YAZ_EXPORT Yaz_ProxyClient : public Yaz_Z_Assoc { - friend Yaz_Proxy; - Yaz_ProxyClient(IYaz_PDU_Observable *the_PDU_Observable); - ~Yaz_ProxyClient(); - void recv_Z_PDU(Z_APDU *apdu); - IYaz_PDU_Observer* sessionNotify - (IYaz_PDU_Observable *the_PDU_Observable, int fd); - void shutdown(); - Yaz_Proxy *m_server; - void failNotify(); - void timeoutNotify(); - void connectNotify(); - char m_cookie[32]; - Yaz_ProxyClient *m_next; - Yaz_ProxyClient **m_prev; - int m_init_flag; - Yaz_Z_Query *m_last_query; - Yaz_Z_Databases m_last_databases; - char *m_last_resultSetId; - int m_last_ok; - int m_last_resultCount; - int m_sr_transform; - int m_seqno; - int m_waiting; - ODR m_init_odr; - Z_APDU *m_initResponse; -}; - -/// Information Retrieval Proxy Server. -class YAZ_EXPORT Yaz_Proxy : public Yaz_Z_Assoc { - private: - char *get_cookie(Z_OtherInformation **otherInfo); - char *get_proxy(Z_OtherInformation **otherInfo); - Yaz_ProxyClient *get_client(Z_APDU *apdu); - Z_APDU *result_set_optimize(Z_APDU *apdu); - void shutdown(); - - Yaz_ProxyClient *m_client; - IYaz_PDU_Observable *m_PDU_Observable; - Yaz_ProxyClient *m_clientPool; - Yaz_Proxy *m_parent; - int m_seqno; - int m_max_clients; - int m_keepalive; - char *m_proxyTarget; - char *m_proxy_authentication; - long m_seed; - char *m_optimize; - public: - Yaz_Proxy(IYaz_PDU_Observable *the_PDU_Observable); - ~Yaz_Proxy(); - void recv_Z_PDU(Z_APDU *apdu); - IYaz_PDU_Observer* sessionNotify - (IYaz_PDU_Observable *the_PDU_Observable, int fd); - void failNotify(); - void timeoutNotify(); - void connectNotify(); - const char *option(const char *name, const char *value); - void set_proxy_target(const char *target); - void set_proxy_authentication (const char *auth); - char *get_proxy_target() { return m_proxyTarget; }; - void set_max_clients(int m) { m_max_clients = m; }; -}; - diff --git a/include/yaz++/yaz-query.h b/include/yaz++/yaz-query.h deleted file mode 100644 index 107d290..0000000 --- a/include/yaz++/yaz-query.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) 1998-2000, Index Data. - * See the file LICENSE for details. - * - * $Id: yaz-query.h,v 1.1 2000-10-11 11:58:16 adam Exp $ - */ - - -/** Query - Generic Query. -*/ -class YAZ_EXPORT Yaz_Query { - public: - /// Print query in buffer described by str and len - virtual void print (char *str, int len) = 0; -}; - diff --git a/include/yaz++/yaz-socket-manager.h b/include/yaz++/yaz-socket-manager.h deleted file mode 100644 index 73b00d2..0000000 --- a/include/yaz++/yaz-socket-manager.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 1998-2000, Index Data. - * See the file LICENSE for details. - * - * $Id: yaz-socket-manager.h,v 1.2 2001-11-04 22:36:21 adam Exp $ - */ - -#ifndef YAZ_SOCKET_MANAGER_INCLUDED -#define YAZ_SOCKET_MANAGER_INCLUDED - -#include -#include - -/** Simple Socket Manager. - Implements a stand-alone simple model that uses select(2) to - observe socket events. -*/ -class YAZ_EXPORT Yaz_SocketManager : public IYazSocketObservable { - private: - struct YazSocketEntry { - IYazSocketObserver *observer; - int fd; - unsigned mask; - unsigned timeout; - unsigned timeout_this; - time_t last_activity; - YazSocketEntry *next; - }; - YazSocketEntry *m_observers; // all registered observers - struct YazSocketEvent { - IYazSocketObserver *observer; - int event; - YazSocketEvent *next; // front in queue - YazSocketEvent *prev; // back in queue - }; - YazSocketEvent *m_queue_front; - YazSocketEvent *m_queue_back; - - YazSocketEntry **Yaz_SocketManager::lookupObserver - (IYazSocketObserver *observer); - YazSocketEvent *Yaz_SocketManager::getEvent(); - void putEvent(YazSocketEvent *event); - void removeEvent(IYazSocketObserver *observer); - int m_log; - public: - /// Add an observer - virtual void addObserver(int fd, IYazSocketObserver *observer); - /// Delete an observer - virtual void deleteObserver(IYazSocketObserver *observer); - /// Delete all observers - virtual void deleteObservers(); - /// Set event mask for observer - virtual void maskObserver(IYazSocketObserver *observer, int mask); - /// Set timeout - virtual void timeoutObserver(IYazSocketObserver *observer, - unsigned timeout); - /// Process one event. return > 0 if event could be processed; - int Yaz_SocketManager::processEvent(); - Yaz_SocketManager(); - virtual ~Yaz_SocketManager(); -}; - - -#endif diff --git a/include/yaz++/yaz-socket-observer.h b/include/yaz++/yaz-socket-observer.h deleted file mode 100644 index 4c643bf..0000000 --- a/include/yaz++/yaz-socket-observer.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 1998-2000, Index Data. - * See the file LICENSE for details. - * - * $Id: yaz-socket-observer.h,v 1.1 2000-10-11 11:58:16 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 - -/** - Forward reference - */ -class IYazSocketObserver; - -/** 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
-    
- The maskObserver method specifies which of these events the - observer is intertested in. -*/ -class YAZ_EXPORT IYazSocketObservable { - public: - /// Add an observer interested in socket fd - virtual void addObserver(int fd, IYazSocketObserver *observer) = 0; - /// Delete an observer - virtual void deleteObserver(IYazSocketObserver *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; - /// Specify timeout - virtual void timeoutObserver(IYazSocketObserver *observer, - unsigned timeout)=0; -}; - -/** Socket Observer. - The IYazSocketObserver interface implements a module interested - socket events. Look for objects that implements the - IYazSocketObservable interface! -*/ -class YAZ_EXPORT IYazSocketObserver { - public: - /// Notify the observer that something happened to socket - virtual void socketNotify(int event) = 0; -}; - -#endif diff --git a/include/yaz++/yaz-z-assoc.h b/include/yaz++/yaz-z-assoc.h deleted file mode 100644 index 490a046..0000000 --- a/include/yaz++/yaz-z-assoc.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 1998-2000, Index Data. - * See the file LICENSE for details. - * - * $Id: yaz-z-assoc.h,v 1.2 2001-04-25 18:59:30 adam Exp $ - */ - -#ifndef YAZ_Z_ASSOC_INCLUDED -#define YAZ_Z_ASSOC_INCLUDED - -#include -#include -#include - -/** Z39.50 Assocation. - This object implements the client - and server role of a generic - Z39.50 Association. -*/ -class YAZ_EXPORT Yaz_Z_Assoc : public IYaz_PDU_Observer { - public: - /// Create object using the PDU Observer specified - Yaz_Z_Assoc(IYaz_PDU_Observable *the_PDU_Observable); - /// Destroy assocation and close PDU Observer - virtual ~Yaz_Z_Assoc(); - /// Receive PDU - void recv_PDU(const char *buf, int len); - /// Connect notification - virtual void connectNotify() = 0; - /// Failure notification - virtual void failNotify() = 0; - /// Timeout notification - virtual void timeoutNotify() = 0; - /// Timeout specify - void timeout(int timeout); - /// Begin Z39.50 client role - void client(const char *addr); - /// Begin Z39.50 server role - void server(const char *addr); - /// Close connection - void close(); - /// Decode Z39.50 PDU. - Z_APDU *decode_Z_PDU(const char *buf, int len); - /// Encode Z39.50 PDU. - int encode_Z_PDU(Z_APDU *apdu, char **buf, int *len); - /// Send Z39.50 PDU - int send_Z_PDU(Z_APDU *apdu); - /// Receive Z39.50 PDU - virtual void recv_Z_PDU(Z_APDU *apdu) = 0; - /// Create Z39.50 PDU with reasonable defaults - Z_APDU *create_Z_PDU(int type); - /// Request Alloc - ODR odr_encode (); - ODR odr_decode (); - ODR odr_print (); - - void set_APDU_log(const char *fname); - const char *get_APDU_log(); - - /// OtherInformation - void get_otherInfoAPDU(Z_APDU *apdu, Z_OtherInformation ***oip); - Z_OtherInformationUnit *update_otherInformation ( - Z_OtherInformation **otherInformationP, int createFlag, - int *oid, int categoryValue, int deleteFlag); - void set_otherInformationString ( - Z_OtherInformation **otherInformationP, - int *oid, int categoryValue, - const char *str); - void set_otherInformationString ( - Z_OtherInformation **otherInformation, - int oidval, int categoryValue, - const char *str); - void set_otherInformationString ( - Z_APDU *apdu, - int oidval, int categoryValue, - const char *str); - - Z_ReferenceId *getRefID(char* str); - Z_ReferenceId **get_referenceIdP(Z_APDU *apdu); - void transfer_referenceId(Z_APDU *from, Z_APDU *to); - - const char *get_hostname(); - - private: - static int yaz_init_flag; - static int yaz_init_func(); - IYaz_PDU_Observable *m_PDU_Observable; - ODR m_odr_in; - ODR m_odr_out; - ODR m_odr_print; - int m_log; - FILE *m_APDU_file; - char *m_APDU_fname; - char *m_hostname; -}; - -#endif diff --git a/include/yaz++/yaz-z-query.h b/include/yaz++/yaz-z-query.h deleted file mode 100644 index 65c25f8..0000000 --- a/include/yaz++/yaz-z-query.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 1998-2000, Index Data. - * See the file LICENSE for details. - * - * $Id: yaz-z-query.h,v 1.1 2000-10-11 11:58:16 adam Exp $ - */ - -#include -#include - -/** Z39.50 Query - RPN, etc. -*/ -class YAZ_EXPORT Yaz_Z_Query : public Yaz_Query { - public: - /// Make Query from rpn string - Yaz_Z_Query(); - /// Delete Query - virtual ~Yaz_Z_Query(); - /// Set RPN - int set_rpn (const char *rpn); - /// Set Z Query - void set_Z_Query (Z_Query *z_query); - /// Get Z Query - Z_Query *get_Z_Query (); - /// print query - void print(char *str, int len); - /// match query - int match(Yaz_Z_Query *other); - private: - char *buf; - int len; - ODR odr_decode; - ODR odr_encode; - ODR odr_print; -}; diff --git a/include/yaz++/yaz-z-server.h b/include/yaz++/yaz-z-server.h deleted file mode 100644 index f91970c..0000000 --- a/include/yaz++/yaz-z-server.h +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (c) 2000-2001, Index Data. - * See the file LICENSE for details. - * - * $Id: yaz-z-server.h,v 1.11 2002-04-24 12:21:03 adam Exp $ - */ - -#include -#if HAVE_YAZ_URSULA_H -#include -#endif - -class Yaz_Z_Server; - -class YAZ_EXPORT Yaz_Z_ServerUtility { - public: - void create_databaseRecord (ODR odr, Z_NamePlusRecord *rec, - const char *dbname, int format, - const void *buf, int len); - void create_surrogateDiagnostics(ODR odr, Z_NamePlusRecord *rec, - const char *dbname, int error, - char *const addinfo); - - Z_Records *create_nonSurrogateDiagnostics (ODR odr, int error, - const char *addinfo); - - void Yaz_Z_ServerUtility::create_diagnostics ( - ODR odr, int error, const char *addinfo, - Z_DiagRec ***dreca, int *num); -}; - -class YAZ_EXPORT IYaz_Server_Facility { - public: - virtual int init(Yaz_Z_Server *server, - Z_InitRequest *initRequest, - Z_InitResponse *initResponse) = 0; - virtual int recv(Yaz_Z_Server *server, Z_APDU *apdu) = 0; -}; - - -#if HAVE_YAZ_URSULA_H -class YAZ_EXPORT Yaz_Facility_Ursula : public IYaz_Server_Facility { - public: -// virtual void ursula_service (Z_ExtendedServicesRequest *req, -// Z_UrsPDU *u, -// Z_ExtendedServicesResponse *res) = 0; - virtual void ursula_service (Z_ExtendedServicesRequest *req, - Z_UrsPDU *u_req, - Z_ExtendedServicesResponse *res, - Z_UrsPDU *u_res) =0; - - int init(Yaz_Z_Server *server, - Z_InitRequest *initRequest, - Z_InitResponse *initResponse); - int recv(Yaz_Z_Server *server, Z_APDU *apdu); -}; -#endif - -class YAZ_EXPORT Yaz_Facility_ILL : public IYaz_Server_Facility { - public: - virtual void ill_service (Z_ExtendedServicesRequest *req, - Z_ItemOrder *io, - Z_ExtendedServicesResponse *res) = 0; - - int init(Yaz_Z_Server *server, - Z_InitRequest *initRequest, - Z_InitResponse *initResponse); - int recv(Yaz_Z_Server *server, Z_APDU *apdu); -}; - -class YAZ_EXPORT Yaz_Facility_Update : public IYaz_Server_Facility { - public: - virtual void update_service (Z_ExtendedServicesRequest *req, - Z_IUUpdate *io, - Z_ExtendedServicesResponse *res) = 0; - - virtual void update_service0 (Z_ExtendedServicesRequest *req, - Z_IU0Update *io, - Z_ExtendedServicesResponse *res) = 0; - - int init(Yaz_Z_Server *server, - Z_InitRequest *initRequest, - Z_InitResponse *initResponse); - int recv(Yaz_Z_Server *server, Z_APDU *apdu); -}; - - -class YAZ_EXPORT Yaz_Facility_Retrieval : public IYaz_Server_Facility, - public Yaz_Z_ServerUtility { - public: - - virtual int sr_init (Z_InitRequest *initRequest, - Z_InitResponse *initResponse) = 0; - virtual void sr_search (Z_SearchRequest *searchRequest, - Z_SearchResponse *searchResponse) = 0; - virtual void sr_present (Z_PresentRequest *presentRequest, - Z_PresentResponse *presentResponse) = 0; - virtual void sr_record (const char *resultSetName, - int position, - int *format, - Z_RecordComposition *comp, - Z_NamePlusRecord *namePlusRecord, - Z_Records *diagnostics) = 0; - int init(Yaz_Z_Server *server, - Z_InitRequest *initRequest, - Z_InitResponse *initResponse); - int recv(Yaz_Z_Server *server, Z_APDU *apdu); - - ODR odr_encode(); - ODR odr_decode(); - private: - Z_Records *pack_records (Yaz_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, - Z_SearchRequest *searchRequest, - Z_SearchResponse *searchResponse); - void fetch_via_present (Yaz_Z_Server *s, - Z_PresentRequest *req, Z_PresentResponse *res); - - int m_preferredMessageSize; - int m_maximumRecordSize; - ODR m_odr_encode; - ODR m_odr_decode; -}; - -class YAZ_EXPORT Yaz_Z_Server_Facility_Info { - friend class Yaz_Z_Server; - IYaz_Server_Facility *m_facility; - char *m_name; - Yaz_Z_Server_Facility_Info *m_next; -}; - - - -class YAZ_EXPORT Yaz_Z_Server : public Yaz_Z_Assoc { -public: - Yaz_Z_Server(IYaz_PDU_Observable *the_PDU_Observable); - virtual ~Yaz_Z_Server(); - virtual void recv_Z_PDU(Z_APDU *apdu); - void facility_add(IYaz_Server_Facility *facility, const char *name); - void facility_reset (); - - - private: - Yaz_Z_Server_Facility_Info *m_facilities; -}; - -class YAZ_EXPORT Yaz_USMARC { - public: - const char *get_record(int position); -}; diff --git a/include/yaz++/z-assoc.h b/include/yaz++/z-assoc.h new file mode 100644 index 0000000..02c7302 --- /dev/null +++ b/include/yaz++/z-assoc.h @@ -0,0 +1,96 @@ +/* + * Copyright (c) 1998-2000, Index Data. + * See the file LICENSE for details. + * + * $Id: z-assoc.h,v 1.1 2002-10-09 12:50:26 adam Exp $ + */ + +#ifndef YAZ_Z_ASSOC_INCLUDED +#define YAZ_Z_ASSOC_INCLUDED + +#include +#include +#include + +/** Z39.50 Assocation. + This object implements the client - and server role of a generic + Z39.50 Association. +*/ +class YAZ_EXPORT Yaz_Z_Assoc : public IYaz_PDU_Observer { + public: + /// Create object using the PDU Observer specified + Yaz_Z_Assoc(IYaz_PDU_Observable *the_PDU_Observable); + /// Destroy assocation and close PDU Observer + virtual ~Yaz_Z_Assoc(); + /// Receive PDU + void recv_PDU(const char *buf, int len); + /// Connect notification + virtual void connectNotify() = 0; + /// Failure notification + virtual void failNotify() = 0; + /// Timeout notification + virtual void timeoutNotify() = 0; + /// Timeout specify + void timeout(int timeout); + /// Begin Z39.50 client role + void client(const char *addr); + /// Begin Z39.50 server role + void server(const char *addr); + /// Close connection + void close(); + /// Decode Z39.50 PDU. + Z_APDU *decode_Z_PDU(const char *buf, int len); + /// Encode Z39.50 PDU. + int encode_Z_PDU(Z_APDU *apdu, char **buf, int *len); + /// Send Z39.50 PDU + int send_Z_PDU(Z_APDU *apdu); + /// Receive Z39.50 PDU + virtual void recv_Z_PDU(Z_APDU *apdu) = 0; + /// Create Z39.50 PDU with reasonable defaults + Z_APDU *create_Z_PDU(int type); + /// Request Alloc + ODR odr_encode (); + ODR odr_decode (); + ODR odr_print (); + + void set_APDU_log(const char *fname); + const char *get_APDU_log(); + + /// OtherInformation + void get_otherInfoAPDU(Z_APDU *apdu, Z_OtherInformation ***oip); + Z_OtherInformationUnit *update_otherInformation ( + Z_OtherInformation **otherInformationP, int createFlag, + int *oid, int categoryValue, int deleteFlag); + void set_otherInformationString ( + Z_OtherInformation **otherInformationP, + int *oid, int categoryValue, + const char *str); + void set_otherInformationString ( + Z_OtherInformation **otherInformation, + int oidval, int categoryValue, + const char *str); + void set_otherInformationString ( + Z_APDU *apdu, + int oidval, int categoryValue, + const char *str); + + Z_ReferenceId *getRefID(char* str); + Z_ReferenceId **get_referenceIdP(Z_APDU *apdu); + void transfer_referenceId(Z_APDU *from, Z_APDU *to); + + const char *get_hostname(); + + private: + static int yaz_init_flag; + static int yaz_init_func(); + IYaz_PDU_Observable *m_PDU_Observable; + ODR m_odr_in; + ODR m_odr_out; + ODR m_odr_print; + int m_log; + FILE *m_APDU_file; + char *m_APDU_fname; + char *m_hostname; +}; + +#endif diff --git a/include/yaz++/z-databases.h b/include/yaz++/z-databases.h new file mode 100644 index 0000000..9ca035a --- /dev/null +++ b/include/yaz++/z-databases.h @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2001, Index Data. + * See the file LICENSE for details. + * + * $Id: z-databases.h,v 1.1 2002-10-09 12:50:26 adam Exp $ + */ + +#include + +/** Z39.50 Databases list + */ +class YAZ_EXPORT Yaz_Z_Databases { +public: +/// Make Query from rpn string + Yaz_Z_Databases(); + ~Yaz_Z_Databases(); + void set (int num, const char **db); + void get (NMEM n, int *num, char ***db); + void get (ODR o, int *num, char ***db); + int match (Yaz_Z_Databases &db); + int match (int num, const char **db); + private: + char **m_list; + int m_num; + NMEM nmem; +}; diff --git a/include/yaz++/z-query.h b/include/yaz++/z-query.h new file mode 100644 index 0000000..ddc092d --- /dev/null +++ b/include/yaz++/z-query.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 1998-2000, Index Data. + * See the file LICENSE for details. + * + * $Id: z-query.h,v 1.1 2002-10-09 12:50:26 adam Exp $ + */ + +#include +#include + +/** Z39.50 Query + RPN, etc. +*/ +class YAZ_EXPORT Yaz_Z_Query : public Yaz_Query { + public: + /// Make Query from rpn string + Yaz_Z_Query(); + /// Delete Query + virtual ~Yaz_Z_Query(); + /// Set RPN + int set_rpn (const char *rpn); + /// Set Z Query + void set_Z_Query (Z_Query *z_query); + /// Get Z Query + Z_Query *get_Z_Query (); + /// print query + void print(char *str, int len); + /// match query + int match(Yaz_Z_Query *other); + private: + char *buf; + int len; + ODR odr_decode; + ODR odr_encode; + ODR odr_print; +}; diff --git a/include/yaz++/z-server.h b/include/yaz++/z-server.h new file mode 100644 index 0000000..10d7523 --- /dev/null +++ b/include/yaz++/z-server.h @@ -0,0 +1,156 @@ +/* + * Copyright (c) 2000-2001, Index Data. + * See the file LICENSE for details. + * + * $Id: z-server.h,v 1.1 2002-10-09 12:50:26 adam Exp $ + */ + +#include +#if HAVE_YAZ_URSULA_H +#include +#endif + +class Yaz_Z_Server; + +class YAZ_EXPORT Yaz_Z_ServerUtility { + public: + void create_databaseRecord (ODR odr, Z_NamePlusRecord *rec, + const char *dbname, int format, + const void *buf, int len); + void create_surrogateDiagnostics(ODR odr, Z_NamePlusRecord *rec, + const char *dbname, int error, + char *const addinfo); + + Z_Records *create_nonSurrogateDiagnostics (ODR odr, int error, + const char *addinfo); + + void Yaz_Z_ServerUtility::create_diagnostics ( + ODR odr, int error, const char *addinfo, + Z_DiagRec ***dreca, int *num); +}; + +class YAZ_EXPORT IYaz_Server_Facility { + public: + virtual int init(Yaz_Z_Server *server, + Z_InitRequest *initRequest, + Z_InitResponse *initResponse) = 0; + virtual int recv(Yaz_Z_Server *server, Z_APDU *apdu) = 0; +}; + + +#if HAVE_YAZ_URSULA_H +class YAZ_EXPORT Yaz_Facility_Ursula : public IYaz_Server_Facility { + public: +// virtual void ursula_service (Z_ExtendedServicesRequest *req, +// Z_UrsPDU *u, +// Z_ExtendedServicesResponse *res) = 0; + virtual void ursula_service (Z_ExtendedServicesRequest *req, + Z_UrsPDU *u_req, + Z_ExtendedServicesResponse *res, + Z_UrsPDU *u_res) =0; + + int init(Yaz_Z_Server *server, + Z_InitRequest *initRequest, + Z_InitResponse *initResponse); + int recv(Yaz_Z_Server *server, Z_APDU *apdu); +}; +#endif + +class YAZ_EXPORT Yaz_Facility_ILL : public IYaz_Server_Facility { + public: + virtual void ill_service (Z_ExtendedServicesRequest *req, + Z_ItemOrder *io, + Z_ExtendedServicesResponse *res) = 0; + + int init(Yaz_Z_Server *server, + Z_InitRequest *initRequest, + Z_InitResponse *initResponse); + int recv(Yaz_Z_Server *server, Z_APDU *apdu); +}; + +class YAZ_EXPORT Yaz_Facility_Update : public IYaz_Server_Facility { + public: + virtual void update_service (Z_ExtendedServicesRequest *req, + Z_IUUpdate *io, + Z_ExtendedServicesResponse *res) = 0; + + virtual void update_service0 (Z_ExtendedServicesRequest *req, + Z_IU0Update *io, + Z_ExtendedServicesResponse *res) = 0; + + int init(Yaz_Z_Server *server, + Z_InitRequest *initRequest, + Z_InitResponse *initResponse); + int recv(Yaz_Z_Server *server, Z_APDU *apdu); +}; + + +class YAZ_EXPORT Yaz_Facility_Retrieval : public IYaz_Server_Facility, + public Yaz_Z_ServerUtility { + public: + + virtual int sr_init (Z_InitRequest *initRequest, + Z_InitResponse *initResponse) = 0; + virtual void sr_search (Z_SearchRequest *searchRequest, + Z_SearchResponse *searchResponse) = 0; + virtual void sr_present (Z_PresentRequest *presentRequest, + Z_PresentResponse *presentResponse) = 0; + virtual void sr_record (const char *resultSetName, + int position, + int *format, + Z_RecordComposition *comp, + Z_NamePlusRecord *namePlusRecord, + Z_Records *diagnostics) = 0; + int init(Yaz_Z_Server *server, + Z_InitRequest *initRequest, + Z_InitResponse *initResponse); + int recv(Yaz_Z_Server *server, Z_APDU *apdu); + + ODR odr_encode(); + ODR odr_decode(); + private: + Z_Records *pack_records (Yaz_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, + Z_SearchRequest *searchRequest, + Z_SearchResponse *searchResponse); + void fetch_via_present (Yaz_Z_Server *s, + Z_PresentRequest *req, Z_PresentResponse *res); + + int m_preferredMessageSize; + int m_maximumRecordSize; + ODR m_odr_encode; + ODR m_odr_decode; +}; + +class YAZ_EXPORT Yaz_Z_Server_Facility_Info { + friend class Yaz_Z_Server; + IYaz_Server_Facility *m_facility; + char *m_name; + Yaz_Z_Server_Facility_Info *m_next; +}; + + + +class YAZ_EXPORT Yaz_Z_Server : public Yaz_Z_Assoc { +public: + Yaz_Z_Server(IYaz_PDU_Observable *the_PDU_Observable); + virtual ~Yaz_Z_Server(); + virtual void recv_Z_PDU(Z_APDU *apdu); + void facility_add(IYaz_Server_Facility *facility, const char *name); + void facility_reset (); + + + private: + Yaz_Z_Server_Facility_Info *m_facilities; +}; + +class YAZ_EXPORT Yaz_USMARC { + public: + const char *get_record(int position); +}; diff --git a/src/yaz-ir-assoc.cpp b/src/yaz-ir-assoc.cpp index 68f7012..f8ca2d0 100644 --- a/src/yaz-ir-assoc.cpp +++ b/src/yaz-ir-assoc.cpp @@ -2,13 +2,13 @@ * Copyright (c) 1998-2000, Index Data. * See the file LICENSE for details. * - * $Id: yaz-ir-assoc.cpp,v 1.17 2001-11-04 22:36:21 adam Exp $ + * $Id: yaz-ir-assoc.cpp,v 1.18 2002-10-09 12:50:26 adam Exp $ */ #include #include -#include +#include Yaz_IR_Assoc::Yaz_IR_Assoc(IYaz_PDU_Observable *the_PDU_Observable) : Yaz_Z_Assoc(the_PDU_Observable) diff --git a/src/yaz-marc-sample.cpp b/src/yaz-marc-sample.cpp index 5ad5bd6..bb542ac 100644 --- a/src/yaz-marc-sample.cpp +++ b/src/yaz-marc-sample.cpp @@ -2,10 +2,10 @@ * Copyright (c) 2000-2001, Index Data. * See the file LICENSE for details. * - * $Id: yaz-marc-sample.cpp,v 1.2 2001-11-04 22:36:21 adam Exp $ + * $Id: yaz-marc-sample.cpp,v 1.3 2002-10-09 12:50:26 adam Exp $ */ -#include +#include static char *marc_records[] = { { diff --git a/src/yaz-my-client.cpp b/src/yaz-my-client.cpp index 6bb36eb..bda730f 100644 --- a/src/yaz-my-client.cpp +++ b/src/yaz-my-client.cpp @@ -2,16 +2,16 @@ * Copyright (c) 1998-2001, Index Data. * See the file LICENSE for details. * - * $Id: yaz-my-client.cpp,v 1.10 2001-11-04 22:36:21 adam Exp $ + * $Id: yaz-my-client.cpp,v 1.11 2002-10-09 12:50:26 adam Exp $ */ #include #include #include #include -#include -#include -#include +#include +#include +#include #if HAVE_YAZ_URSULA_H #include diff --git a/src/yaz-my-server.cpp b/src/yaz-my-server.cpp index 38a3bc7..9449289 100644 --- a/src/yaz-my-server.cpp +++ b/src/yaz-my-server.cpp @@ -2,14 +2,14 @@ * Copyright (c) 1998-2001, Index Data. * See the file LICENSE for details. * - * $Id: yaz-my-server.cpp,v 1.9 2001-11-06 17:08:05 adam Exp $ + * $Id: yaz-my-server.cpp,v 1.10 2002-10-09 12:50:26 adam Exp $ */ #include #include -#include -#include -#include +#include +#include +#include class MyILL : public Yaz_Facility_ILL { public: diff --git a/src/yaz-pdu-assoc-thread.cpp b/src/yaz-pdu-assoc-thread.cpp index aadcca1..ea63b6a 100644 --- a/src/yaz-pdu-assoc-thread.cpp +++ b/src/yaz-pdu-assoc-thread.cpp @@ -2,7 +2,7 @@ * Copyright (c) 1998-2001, Index Data. * See the file LICENSE for details. * - * $Id: yaz-pdu-assoc-thread.cpp,v 1.5 2001-11-06 17:08:05 adam Exp $ + * $Id: yaz-pdu-assoc-thread.cpp,v 1.6 2002-10-09 12:50:26 adam Exp $ */ #ifdef WIN32 @@ -26,8 +26,8 @@ #include #include -#include -#include +#include +#include Yaz_PDU_AssocThread::Yaz_PDU_AssocThread( IYazSocketObservable *socketObservable) diff --git a/src/yaz-pdu-assoc.cpp b/src/yaz-pdu-assoc.cpp index d571844..203ba34 100644 --- a/src/yaz-pdu-assoc.cpp +++ b/src/yaz-pdu-assoc.cpp @@ -2,7 +2,7 @@ * Copyright (c) 1998-2001, Index Data. * See the file LICENSE for details. * - * $Id: yaz-pdu-assoc.cpp,v 1.27 2002-01-21 21:51:06 adam Exp $ + * $Id: yaz-pdu-assoc.cpp,v 1.28 2002-10-09 12:50:26 adam Exp $ */ #include @@ -10,7 +10,7 @@ #include #include -#include +#include void Yaz_PDU_Assoc::init(IYazSocketObservable *socketObservable) diff --git a/src/yaz-proxy-main.cpp b/src/yaz-proxy-main.cpp index 1a23020..9afdc32 100644 --- a/src/yaz-proxy-main.cpp +++ b/src/yaz-proxy-main.cpp @@ -2,15 +2,15 @@ * Copyright (c) 1998-2001, Index Data. * See the file LICENSE for details. * - * $Id: yaz-proxy-main.cpp,v 1.16 2002-01-14 12:01:28 adam Exp $ + * $Id: yaz-proxy-main.cpp,v 1.17 2002-10-09 12:50:26 adam Exp $ */ #include #include -#include -#include -#include +#include +#include +#include void usage(char *prog) { diff --git a/src/yaz-proxy.cpp b/src/yaz-proxy.cpp index 217b660..b0ac802 100644 --- a/src/yaz-proxy.cpp +++ b/src/yaz-proxy.cpp @@ -2,14 +2,14 @@ * Copyright (c) 1998-2001, Index Data. * See the file LICENSE for details. * - * $Id: yaz-proxy.cpp,v 1.35 2002-09-10 13:00:58 adam Exp $ + * $Id: yaz-proxy.cpp,v 1.36 2002-10-09 12:50:26 adam Exp $ */ #include #include #include -#include +#include Yaz_Proxy::Yaz_Proxy(IYaz_PDU_Observable *the_PDU_Observable) : Yaz_Z_Assoc(the_PDU_Observable) diff --git a/src/yaz-socket-manager.cpp b/src/yaz-socket-manager.cpp index 1eb8c5c..536c5b6 100644 --- a/src/yaz-socket-manager.cpp +++ b/src/yaz-socket-manager.cpp @@ -2,7 +2,7 @@ * Copyright (c) 1998-2001, Index Data. * See the file LICENSE for details. * - * $Id: yaz-socket-manager.cpp,v 1.18 2001-12-21 10:50:22 adam Exp $ + * $Id: yaz-socket-manager.cpp,v 1.19 2002-10-09 12:50:26 adam Exp $ */ #include #ifdef WIN32 @@ -16,7 +16,7 @@ #include #include -#include +#include Yaz_SocketManager::YazSocketEntry **Yaz_SocketManager::lookupObserver( IYazSocketObserver *observer) diff --git a/src/yaz-z-assoc.cpp b/src/yaz-z-assoc.cpp index d28ae94..2761220 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.25 2002-10-09 12:50:26 adam Exp $ */ #include #include #include -#include +#include #include int Yaz_Z_Assoc::yaz_init_func() diff --git a/src/yaz-z-databases.cpp b/src/yaz-z-databases.cpp index 1f12bb4..52b6a31 100644 --- a/src/yaz-z-databases.cpp +++ b/src/yaz-z-databases.cpp @@ -2,12 +2,12 @@ * Copyright (c) 2001, Index Data. * See the file LICENSE for details. * - * $Id: yaz-z-databases.cpp,v 1.3 2002-04-24 13:16:47 heikki Exp $ + * $Id: yaz-z-databases.cpp,v 1.4 2002-10-09 12:50:26 adam Exp $ */ #include -#include +#include Yaz_Z_Databases::Yaz_Z_Databases() { diff --git a/src/yaz-z-query.cpp b/src/yaz-z-query.cpp index c94bd11..8e2fb3c 100644 --- a/src/yaz-z-query.cpp +++ b/src/yaz-z-query.cpp @@ -2,10 +2,10 @@ * Copyright (c) 1998-2001, Index Data. * See the file LICENSE for details. * - * $Id: yaz-z-query.cpp,v 1.10 2001-11-04 22:36:21 adam Exp $ + * $Id: yaz-z-query.cpp,v 1.11 2002-10-09 12:50:26 adam Exp $ */ -#include +#include #include Yaz_Z_Query::Yaz_Z_Query() diff --git a/src/yaz-z-server-ill.cpp b/src/yaz-z-server-ill.cpp index 1751933..3c42fb7 100644 --- a/src/yaz-z-server-ill.cpp +++ b/src/yaz-z-server-ill.cpp @@ -2,11 +2,11 @@ * Copyright (c) 2000-2001, Index Data. * See the file LICENSE for details. * - * $Id: yaz-z-server-ill.cpp,v 1.7 2001-11-04 22:36:21 adam Exp $ + * $Id: yaz-z-server-ill.cpp,v 1.8 2002-10-09 12:50:26 adam Exp $ */ #include -#include +#include int Yaz_Facility_ILL::init(Yaz_Z_Server *s, Z_InitRequest *initRequest, Z_InitResponse *initResponse) diff --git a/src/yaz-z-server-sr.cpp b/src/yaz-z-server-sr.cpp index 105f777..cb0671b 100644 --- a/src/yaz-z-server-sr.cpp +++ b/src/yaz-z-server-sr.cpp @@ -2,12 +2,12 @@ * Copyright (c) 2000-2001, Index Data. * See the file LICENSE for details. * - * $Id: yaz-z-server-sr.cpp,v 1.4 2001-11-04 22:36:21 adam Exp $ + * $Id: yaz-z-server-sr.cpp,v 1.5 2002-10-09 12:50:26 adam Exp $ * */ #include -#include +#include Z_Records *Yaz_Facility_Retrieval::pack_records (Yaz_Z_Server *s, const char *resultSetName, diff --git a/src/yaz-z-server-update.cpp b/src/yaz-z-server-update.cpp index fa7101d..ddd30f8 100644 --- a/src/yaz-z-server-update.cpp +++ b/src/yaz-z-server-update.cpp @@ -2,11 +2,11 @@ * Copyright (c) 2000-2001, Index Data. * See the file LICENSE for details. * - * $Id: yaz-z-server-update.cpp,v 1.3 2001-11-04 22:36:21 adam Exp $ + * $Id: yaz-z-server-update.cpp,v 1.4 2002-10-09 12:50:26 adam Exp $ */ #include -#include +#include int Yaz_Facility_Update::init(Yaz_Z_Server *s, Z_InitRequest *initRequest, Z_InitResponse *initResponse) diff --git a/src/yaz-z-server.cpp b/src/yaz-z-server.cpp index 0af5836..10aba4d 100644 --- a/src/yaz-z-server.cpp +++ b/src/yaz-z-server.cpp @@ -2,11 +2,11 @@ * Copyright (c) 2000-2001, Index Data. * See the file LICENSE for details. * - * $Id: yaz-z-server.cpp,v 1.14 2002-04-24 12:21:03 adam Exp $ + * $Id: yaz-z-server.cpp,v 1.15 2002-10-09 12:50:26 adam Exp $ */ #include -#include +#include Yaz_Z_Server::Yaz_Z_Server(IYaz_PDU_Observable *the_PDU_Observable) : Yaz_Z_Assoc(the_PDU_Observable)