-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
--- /dev/null
+/*
+ * 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 <yaz++/z-assoc.h>
+#include <yaz++/z-query.h>
+
+/** 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;
+};
--- /dev/null
+/*
+ * 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 <yaz/comstack.h>
+#include <yaz++/socket-observer.h>
+#include <yaz++/pdu-observer.h>
+
+/** 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
+
--- /dev/null
+/*
+ * 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
--- /dev/null
+/*
+ * 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 <yaz++/z-assoc.h>
+#include <yaz++/z-query.h>
+#include <yaz++/z-databases.h>
+
+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; };
+};
+
--- /dev/null
+/*
+ * 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;
+};
+
--- /dev/null
+/*
+ * 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 <yaz++/socket-observer.h>
+#include <time.h>
+
+/** 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
--- /dev/null
+/*
+ * 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:
+ <pre>
+ YAZ_SOCKET_OBSERVE_READ
+ YAZ_SOCKET_OBSERVE_WRITE
+ YAZ_SOCKET_OBSERVE_EXCEPT
+ YAZ_SOCKET_OBSERVE_TIMEOUT
+ </pre>
+ 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
+++ /dev/null
-/*
- * 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 <yaz++/yaz-z-assoc.h>
-#include <yaz++/yaz-z-query.h>
-
-/** 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;
-};
+++ /dev/null
-/*
- * 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 <yaz/comstack.h>
-#include <yaz++/yaz-socket-observer.h>
-#include <yaz++/yaz-pdu-observer.h>
-
-/** 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
-
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * 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 <yaz++/yaz-z-assoc.h>
-#include <yaz++/yaz-z-query.h>
-#include <yaz++/yaz-z-databases.h>
-
-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; };
-};
-
+++ /dev/null
-/*
- * 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;
-};
-
+++ /dev/null
-/*
- * 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 <yaz++/yaz-socket-observer.h>
-#include <time.h>
-
-/** 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
+++ /dev/null
-/*
- * 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:
- <pre>
- YAZ_SOCKET_OBSERVE_READ
- YAZ_SOCKET_OBSERVE_WRITE
- YAZ_SOCKET_OBSERVE_EXCEPT
- YAZ_SOCKET_OBSERVE_TIMEOUT
- </pre>
- 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
+++ /dev/null
-/*
- * 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 <yaz/proto.h>
-#include <yaz/odr.h>
-#include <yaz++/yaz-pdu-observer.h>
-
-/** 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
+++ /dev/null
-/*
- * 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 <yaz/proto.h>
-#include <yaz++/yaz-query.h>
-
-/** 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;
-};
+++ /dev/null
-/*
- * 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 <yaz++/yaz-z-assoc.h>
-#if HAVE_YAZ_URSULA_H
-#include <yaz/zes-ursula.h>
-#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);
-};
--- /dev/null
+/*
+ * 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 <yaz/proto.h>
+#include <yaz/odr.h>
+#include <yaz++/pdu-observer.h>
+
+/** 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
--- /dev/null
+/*
+ * 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 <yaz/proto.h>
+
+/** 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;
+};
--- /dev/null
+/*
+ * 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 <yaz/proto.h>
+#include <yaz++/query.h>
+
+/** 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;
+};
--- /dev/null
+/*
+ * 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 <yaz++/z-assoc.h>
+#if HAVE_YAZ_URSULA_H
+#include <yaz/zes-ursula.h>
+#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);
+};
* 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 <assert.h>
#include <yaz/log.h>
-#include <yaz++/yaz-ir-assoc.h>
+#include <yaz++/ir-assoc.h>
Yaz_IR_Assoc::Yaz_IR_Assoc(IYaz_PDU_Observable *the_PDU_Observable)
: Yaz_Z_Assoc(the_PDU_Observable)
* 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 <yaz++/yaz-z-server.h>
+#include <yaz++/z-server.h>
static char *marc_records[] = {
{
* 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 <yaz/log.h>
#include <yaz/options.h>
#include <yaz/diagbib1.h>
#include <yaz/marcdisp.h>
-#include <yaz++/yaz-ir-assoc.h>
-#include <yaz++/yaz-pdu-assoc.h>
-#include <yaz++/yaz-socket-manager.h>
+#include <yaz++/ir-assoc.h>
+#include <yaz++/pdu-assoc.h>
+#include <yaz++/socket-manager.h>
#if HAVE_YAZ_URSULA_H
#include <yaz/zes-ursula.h>
* 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 <yaz/log.h>
#include <yaz/options.h>
-#include <yaz++/yaz-z-server.h>
-#include <yaz++/yaz-pdu-assoc.h>
-#include <yaz++/yaz-socket-manager.h>
+#include <yaz++/z-server.h>
+#include <yaz++/pdu-assoc.h>
+#include <yaz++/socket-manager.h>
class MyILL : public Yaz_Facility_ILL {
public:
* 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
#include <yaz/log.h>
#include <yaz/tcpip.h>
-#include <yaz++/yaz-pdu-assoc.h>
-#include <yaz++/yaz-socket-manager.h>
+#include <yaz++/pdu-assoc.h>
+#include <yaz++/socket-manager.h>
Yaz_PDU_AssocThread::Yaz_PDU_AssocThread(
IYazSocketObservable *socketObservable)
* 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 <assert.h>
#include <yaz/log.h>
#include <yaz/tcpip.h>
-#include <yaz++/yaz-pdu-assoc.h>
+#include <yaz++/pdu-assoc.h>
void Yaz_PDU_Assoc::init(IYazSocketObservable *socketObservable)
* 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 <yaz/log.h>
#include <yaz/options.h>
-#include <yaz++/yaz-socket-manager.h>
-#include <yaz++/yaz-pdu-assoc.h>
-#include <yaz++/yaz-proxy.h>
+#include <yaz++/socket-manager.h>
+#include <yaz++/pdu-assoc.h>
+#include <yaz++/proxy.h>
void usage(char *prog)
{
* 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 <assert.h>
#include <time.h>
#include <yaz/log.h>
-#include <yaz++/yaz-proxy.h>
+#include <yaz++/proxy.h>
Yaz_Proxy::Yaz_Proxy(IYaz_PDU_Observable *the_PDU_Observable) :
Yaz_Z_Assoc(the_PDU_Observable)
* 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 <assert.h>
#ifdef WIN32
#include <string.h>
#include <yaz/log.h>
-#include <yaz++/yaz-socket-manager.h>
+#include <yaz++/socket-manager.h>
Yaz_SocketManager::YazSocketEntry **Yaz_SocketManager::lookupObserver(
IYazSocketObserver *observer)
* 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 <assert.h>
#include <signal.h>
#include <yaz/log.h>
-#include <yaz++/yaz-z-assoc.h>
+#include <yaz++/z-assoc.h>
#include <yaz/otherinfo.h>
int Yaz_Z_Assoc::yaz_init_func()
* 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 <string.h>
-#include <yaz++/yaz-z-databases.h>
+#include <yaz++/z-databases.h>
Yaz_Z_Databases::Yaz_Z_Databases()
{
* 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 <yaz++/yaz-z-query.h>
+#include <yaz++/z-query.h>
#include <yaz/pquery.h>
Yaz_Z_Query::Yaz_Z_Query()
* 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 <yaz/log.h>
-#include <yaz++/yaz-z-server.h>
+#include <yaz++/z-server.h>
int Yaz_Facility_ILL::init(Yaz_Z_Server *s, Z_InitRequest *initRequest,
Z_InitResponse *initResponse)
* 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 <yaz/log.h>
-#include <yaz++/yaz-z-server.h>
+#include <yaz++/z-server.h>
Z_Records *Yaz_Facility_Retrieval::pack_records (Yaz_Z_Server *s,
const char *resultSetName,
* 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 <yaz/log.h>
-#include <yaz++/yaz-z-server.h>
+#include <yaz++/z-server.h>
int Yaz_Facility_Update::init(Yaz_Z_Server *s, Z_InitRequest *initRequest,
Z_InitResponse *initResponse)
* 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 <yaz/log.h>
-#include <yaz++/yaz-z-server.h>
+#include <yaz++/z-server.h>
Yaz_Z_Server::Yaz_Z_Server(IYaz_PDU_Observable *the_PDU_Observable)
: Yaz_Z_Assoc(the_PDU_Observable)