that a namespace encapsulates the API.
/*
- * Copyright (c) 1998-2000, Index Data.
+ * Copyright (c) 1998-2005, Index Data.
* See the file LICENSE for details.
*
- * $Id: ir-assoc.h,v 1.4 2005-06-02 06:40:21 adam Exp $
+ * $Id: ir-assoc.h,v 1.5 2005-06-08 13:28:05 adam Exp $
*/
#include <yaz++/z-assoc.h>
This object implements the client - and server role of a generic
Z39.50 Association.
*/
-class YAZ_EXPORT Yaz_IR_Assoc: public Yaz_Z_Assoc {
+class YAZ_EXPORT IR_Assoc: public Z_Assoc {
public:
/// Create object using the PDU Observer specified
- Yaz_IR_Assoc(IYaz_PDU_Observable *the_PDU_Observable);
+ IR_Assoc(IPDU_Observable *the_PDU_Observable);
/// Destroy assocation and close PDU Observer
- virtual ~Yaz_IR_Assoc();
+ virtual ~IR_Assoc();
/// Receive Z39.50 PDU
void recv_Z_PDU(Z_APDU *apdu, int len);
void recv_GDU(Z_GDU *apdu, int len);
/*
- * Copyright (c) 1998-2003, Index Data.
+ * Copyright (c) 1998-2005, Index Data.
* See the file LICENSE for details.
*
- * $Id: pdu-assoc.h,v 1.6 2005-06-02 06:40:21 adam Exp $
+ * $Id: pdu-assoc.h,v 1.7 2005-06-08 13:28:05 adam Exp $
*/
#ifndef YAZ_PDU_ASSOC_INCLUDED
the method connect. The server role is initiated by using the
listen method.
*/
-class YAZ_EXPORT Yaz_PDU_Assoc : public IYaz_PDU_Observable, yazpp_1::IYazSocketObserver {
- friend class Yaz_PDU_AssocThread;
+class YAZ_EXPORT PDU_Assoc : public IPDU_Observable, yazpp_1::ISocketObserver {
+ friend class PDU_AssocThread;
private:
enum {
Connecting,
int m_len;
PDU_Queue *m_next;
};
- Yaz_PDU_Assoc *m_parent;
- Yaz_PDU_Assoc *m_children;
- Yaz_PDU_Assoc *m_next;
+ PDU_Assoc *m_parent;
+ PDU_Assoc *m_children;
+ PDU_Assoc *m_next;
COMSTACK m_cs;
- yazpp_1::IYazSocketObservable *m_socketObservable;
- IYaz_PDU_Observer *m_PDU_Observer;
+ yazpp_1::ISocketObservable *m_socketObservable;
+ IPDU_Observer *m_PDU_Observer;
char *m_input_buf;
int m_input_len;
PDU_Queue *m_queue_out;
PDU_Queue *m_queue_in;
- int Yaz_PDU_Assoc::flush_PDU();
+ int PDU_Assoc::flush_PDU();
int *m_destroyed;
int m_idleTime;
int m_log;
- void init(yazpp_1::IYazSocketObservable *socketObservable);
+ void init(yazpp_1::ISocketObservable *socketObservable);
public:
COMSTACK comstack(const char *type_and_host, void **vp);
/// Create object using specified socketObservable
- Yaz_PDU_Assoc(yazpp_1::IYazSocketObservable *socketObservable);
+ PDU_Assoc(yazpp_1::ISocketObservable *socketObservable);
/// Create Object using existing comstack
- Yaz_PDU_Assoc(yazpp_1::IYazSocketObservable *socketObservable,
+ PDU_Assoc(yazpp_1::ISocketObservable *socketObservable,
COMSTACK cs);
/// Close socket and destroy object.
- /// virtual ~Yaz_PDU_Assoc();
+ /// virtual ~PDU_Assoc();
/// Clone the object
- IYaz_PDU_Observable *clone();
+ IPDU_Observable *clone();
/// Send PDU
int send_PDU(const char *buf, int len);
/// connect to server (client role)
- int connect(IYaz_PDU_Observer *observer, const char *addr);
+ int connect(IPDU_Observer *observer, const char *addr);
/// listen for clients (server role)
- int listen(IYaz_PDU_Observer *observer, const char *addr);
+ int listen(IPDU_Observer *observer, const char *addr);
/// Socket notification
void socketNotify(int event);
/// Close socket
const char *getpeername();
};
-class YAZ_EXPORT Yaz_PDU_AssocThread : public Yaz_PDU_Assoc {
+class YAZ_EXPORT PDU_AssocThread : public PDU_Assoc {
public:
- Yaz_PDU_AssocThread(yazpp_1::IYazSocketObservable *socketObservable);
+ PDU_AssocThread(yazpp_1::ISocketObservable *socketObservable);
private:
void childNotify(COMSTACK cs);
/*
- * Copyright (c) 1998-2000, Index Data.
+ * Copyright (c) 1998-2005, Index Data.
* See the file LICENSE for details.
*
- * $Id: pdu-observer.h,v 1.5 2005-06-02 06:40:21 adam Exp $
+ * $Id: pdu-observer.h,v 1.6 2005-06-08 13:28:05 adam Exp $
*/
#ifndef YAZ_PDU_OBSERVER_H
namespace yazpp_1 {
-class IYaz_PDU_Observer;
+class IPDU_Observer;
/** Protocol Data Unit Observable.
This interface implements a Protocol Data Unit (PDU) network driver.
The PDU's is not encoded/decoded by this interface. They are simply
transmitted/received over the network. To use this interface the
- IYaz_PDU_Observer interface must be implemented.
+ IPDU_Observer interface must be implemented.
*/
-class YAZ_EXPORT IYaz_PDU_Observable {
+class YAZ_EXPORT IPDU_Observable {
public:
/// Send encoded PDU buffer of specified length
virtual int send_PDU(const char *buf, int len) = 0;
/// Connect with server specified by addr.
- virtual int connect(IYaz_PDU_Observer *observer, const char *addr) = 0;
+ virtual int connect(IPDU_Observer *observer, const char *addr) = 0;
/// Listen on address addr.
- virtual int listen(IYaz_PDU_Observer *observer, const char *addr) = 0;
+ virtual int listen(IPDU_Observer *observer, const char *addr) = 0;
/// Close connection
virtual void close() = 0;
/// Make clone of this object using this interface
- virtual IYaz_PDU_Observable *clone() = 0;
+ virtual IPDU_Observable *clone() = 0;
/// Destroy completely
virtual void destroy() = 0;
/// Set Idle Time
};
/** Protocol Data Unit Observer.
- This interface is used together with the IYaz_PDU_Observable interface
+ This interface is used together with the IPDU_Observable interface
and acts as a callback interface for it.
*/
-class YAZ_EXPORT IYaz_PDU_Observer {
+class YAZ_EXPORT IPDU_Observer {
public:
/// A PDU has been received
virtual void recv_PDU(const char *buf, int len) = 0;
virtual void failNotify() = 0;
/// Called whenever there is a timeout
virtual void timeoutNotify() = 0;
- /// Make clone of observer using IYaz_PDU_Observable interface
- virtual IYaz_PDU_Observer *sessionNotify(
- IYaz_PDU_Observable *the_PDU_Observable, int fd) = 0;
+ /// Make clone of observer using IPDU_Observable interface
+ virtual IPDU_Observer *sessionNotify(
+ IPDU_Observable *the_PDU_Observable, int fd) = 0;
};
};
* Copyright (c) 2002-2004, Index Data.
* See the file LICENSE for details.
*
- * $Id: record-cache.h,v 1.2 2005-06-02 06:40:21 adam Exp $
+ * $Id: record-cache.h,v 1.3 2005-06-08 13:28:05 adam Exp $
*/
#include <yaz/z-core.h>
namespace yazpp_1 {
-class Yaz_RecordCache_Entry;
+class RecordCache_Entry;
-class YAZ_EXPORT Yaz_RecordCache {
+class YAZ_EXPORT RecordCache {
public:
- Yaz_RecordCache ();
- ~Yaz_RecordCache ();
+ RecordCache ();
+ ~RecordCache ();
void add (ODR o, Z_NamePlusRecordList *npr, int start, int hits);
int lookup (ODR o, Z_NamePlusRecordList **npr, int start, int num,
void set_max_size(int sz);
private:
NMEM m_mem;
- Yaz_RecordCache_Entry *m_entries;
+ RecordCache_Entry *m_entries;
Z_SearchRequest *m_searchRequest;
Z_PresentRequest *m_presentRequest;
- int match (Yaz_RecordCache_Entry *entry,
+ int match (RecordCache_Entry *entry,
Odr_oid *syntax, int offset,
Z_RecordComposition *comp);
int m_max_size;
/*
- * Copyright (c) 1998-2004, Index Data.
+ * Copyright (c) 1998-2005, Index Data.
* See the file LICENSE for details.
*
- * $Id: socket-manager.h,v 1.4 2005-06-02 06:40:21 adam Exp $
+ * $Id: socket-manager.h,v 1.5 2005-06-08 13:28:05 adam Exp $
*/
#ifndef YAZ_SOCKET_MANAGER_INCLUDED
Implements a stand-alone simple model that uses select(2) to
observe socket events.
*/
-class YAZ_EXPORT Yaz_SocketManager : public IYazSocketObservable {
+class YAZ_EXPORT SocketManager : public ISocketObservable {
private:
- struct YazSocketEntry {
- IYazSocketObserver *observer;
+ struct SocketEntry {
+ ISocketObserver *observer;
int fd;
unsigned mask;
int timeout;
int timeout_this;
time_t last_activity;
- YazSocketEntry *next;
+ SocketEntry *next;
};
- YazSocketEntry *m_observers; // all registered observers
- struct YazSocketEvent {
- IYazSocketObserver *observer;
+ SocketEntry *m_observers; // all registered observers
+ struct SocketEvent {
+ ISocketObserver *observer;
int event;
- YazSocketEvent *next; // front in queue
- YazSocketEvent *prev; // back in queue
+ SocketEvent *next; // front in queue
+ SocketEvent *prev; // back in queue
};
- YazSocketEvent *m_queue_front;
- YazSocketEvent *m_queue_back;
+ SocketEvent *m_queue_front;
+ SocketEvent *m_queue_back;
- YazSocketEntry **Yaz_SocketManager::lookupObserver
- (IYazSocketObserver *observer);
- YazSocketEvent *Yaz_SocketManager::getEvent();
- void putEvent(YazSocketEvent *event);
- void removeEvent(IYazSocketObserver *observer);
+ SocketEntry **SocketManager::lookupObserver
+ (ISocketObserver *observer);
+ SocketEvent *SocketManager::getEvent();
+ void putEvent(SocketEvent *event);
+ void removeEvent(ISocketObserver *observer);
int m_log;
public:
/// Add an observer
- virtual void addObserver(int fd, IYazSocketObserver *observer);
+ virtual void addObserver(int fd, ISocketObserver *observer);
/// Delete an observer
- virtual void deleteObserver(IYazSocketObserver *observer);
+ virtual void deleteObserver(ISocketObserver *observer);
/// Delete all observers
virtual void deleteObservers();
/// Set event mask for observer
- virtual void maskObserver(IYazSocketObserver *observer, int mask);
+ virtual void maskObserver(ISocketObserver *observer, int mask);
/// Set timeout
- virtual void timeoutObserver(IYazSocketObserver *observer,
+ virtual void timeoutObserver(ISocketObserver *observer,
int timeout);
/// Process one event. return > 0 if event could be processed;
int processEvent();
- Yaz_SocketManager();
- virtual ~Yaz_SocketManager();
+ SocketManager();
+ virtual ~SocketManager();
};
};
/*
- * Copyright (c) 1998-2000, Index Data.
+ * Copyright (c) 1998-2005, Index Data.
* See the file LICENSE for details.
*
- * $Id: socket-observer.h,v 1.4 2005-06-02 06:40:21 adam Exp $
+ * $Id: socket-observer.h,v 1.5 2005-06-08 13:28:05 adam Exp $
*/
#ifndef YAZ_SOCKET_OBSERVER_H
#define YAZ_SOCKET_OBSERVER_H
-#define YAZ_SOCKET_OBSERVE_READ 1
-#define YAZ_SOCKET_OBSERVE_WRITE 2
-#define YAZ_SOCKET_OBSERVE_EXCEPT 4
-#define YAZ_SOCKET_OBSERVE_TIMEOUT 8
-
#include <yaz/yconfig.h>
namespace yazpp_1 {
+
+ enum SocketObserve {
+ SOCKET_OBSERVE_READ=1,
+ SOCKET_OBSERVE_WRITE=2,
+ SOCKET_OBSERVE_EXCEPT=4,
+ SOCKET_OBSERVE_TIMEOUT=8
+ };
/**
Forward reference
- */
-class IYazSocketObserver;
-
+*/
+ class ISocketObserver;
+
/** Socket Observable.
- This interface implements notification of socket events.
- The module interested in (observing) the sockets
- must implement the IYazSocketObserver interface. The
- IYazSocketObserver only have to implement one function, so it's
- quite simple to observe sockets change state.
- The socket events below specifies read, write, exception,
- and timeout respectively:
- <pre>
- YAZ_SOCKET_OBSERVE_READ
- YAZ_SOCKET_OBSERVE_WRITE
- YAZ_SOCKET_OBSERVE_EXCEPT
- YAZ_SOCKET_OBSERVE_TIMEOUT
+ This interface implements notification of socket events.
+ The module interested in (observing) the sockets
+ must implement the ISocketObserver interface. The
+ ISocketObserver only have to implement one function, so it's
+ quite simple to observe sockets change state.
+ The socket events below specifies read, write, exception,
+ and timeout respectively:
+ <pre>
+ SOCKET_OBSERVE_READ
+ SOCKET_OBSERVE_WRITE
+ SOCKET_OBSERVE_EXCEPT
+ SOCKET_OBSERVE_TIMEOUT
</pre>
The maskObserver method specifies which of these events the
observer is intertested in.
*/
-class YAZ_EXPORT IYazSocketObservable {
+class YAZ_EXPORT ISocketObservable {
public:
/// Add an observer interested in socket fd
- virtual void addObserver(int fd, IYazSocketObserver *observer) = 0;
+ virtual void addObserver(int fd, ISocketObserver *observer) = 0;
/// Delete an observer
- virtual void deleteObserver(IYazSocketObserver *observer) = 0;
+ virtual void deleteObserver(ISocketObserver *observer) = 0;
/// Delete all observers
virtual void deleteObservers() = 0;
/// Specify the events that the observer is intersted in.
- virtual void maskObserver(IYazSocketObserver *observer, int mask) = 0;
+ virtual void maskObserver(ISocketObserver *observer, int mask) = 0;
/// Specify timeout
- virtual void timeoutObserver(IYazSocketObserver *observer,
+ virtual void timeoutObserver(ISocketObserver *observer,
int timeout)=0;
};
/** Socket Observer.
- The IYazSocketObserver interface implements a module interested
+ The ISocketObserver interface implements a module interested
socket events. Look for objects that implements the
- IYazSocketObservable interface!
+ ISocketObservable interface!
*/
-class YAZ_EXPORT IYazSocketObserver {
+class YAZ_EXPORT ISocketObserver {
public:
/// Notify the observer that something happened to socket
virtual void socketNotify(int event) = 0;
* Copyright (c) 1998-2000, Index Data.
* See the file LICENSE for details.
*
- * $Id: z-assoc.h,v 1.7 2005-06-02 06:40:21 adam Exp $
+ * $Id: z-assoc.h,v 1.8 2005-06-08 13:28:05 adam Exp $
*/
#ifndef YAZ_Z_ASSOC_INCLUDED
This object implements the client - and server role of a generic
Z39.50 Association.
*/
-class YAZ_EXPORT Yaz_Z_Assoc : public IYaz_PDU_Observer {
+class YAZ_EXPORT Z_Assoc : public IPDU_Observer {
public:
/// Create object using the PDU Observer specified
- Yaz_Z_Assoc(IYaz_PDU_Observable *the_PDU_Observable);
+ Z_Assoc(IPDU_Observable *the_PDU_Observable);
/// Destroy assocation and close PDU Observer
- virtual ~Yaz_Z_Assoc();
+ virtual ~Z_Assoc();
/// Receive PDU
void recv_PDU(const char *buf, int len);
/// Connect notification
private:
static int yaz_init_flag;
static int yaz_init_func();
- IYaz_PDU_Observable *m_PDU_Observable;
+ IPDU_Observable *m_PDU_Observable;
ODR m_odr_in;
ODR m_odr_out;
ODR m_odr_print;
/*
- * Copyright (c) 2000-2001, Index Data.
+ * Copyright (c) 2000-2005, Index Data.
* See the file LICENSE for details.
*
- * $Id: z-server.h,v 1.6 2005-06-02 06:40:21 adam Exp $
+ * $Id: z-server.h,v 1.7 2005-06-08 13:28:05 adam Exp $
*/
#include <yaz++/z-assoc.h>
namespace yazpp_1 {
-class Yaz_Z_Server;
+class Z_Server;
-class YAZ_EXPORT Yaz_Z_ServerUtility {
+class YAZ_EXPORT Z_ServerUtility {
public:
void create_databaseRecord (ODR odr, Z_NamePlusRecord *rec,
const char *dbname, int format,
Z_Records *create_nonSurrogateDiagnostics (ODR odr, int error,
const char *addinfo);
- void Yaz_Z_ServerUtility::create_diagnostics (
+ void Z_ServerUtility::create_diagnostics (
ODR odr, int error, const char *addinfo,
Z_DiagRec ***dreca, int *num);
};
-class YAZ_EXPORT IYaz_Server_Facility {
+class YAZ_EXPORT IServer_Facility {
public:
- virtual int init(Yaz_Z_Server *server,
+ virtual int init(Z_Server *server,
Z_InitRequest *initRequest,
Z_InitResponse *initResponse) = 0;
- virtual int recv(Yaz_Z_Server *server, Z_APDU *apdu) = 0;
+ virtual int recv(Z_Server *server, Z_APDU *apdu) = 0;
};
-class YAZ_EXPORT Yaz_Facility_ILL : public IYaz_Server_Facility {
+class YAZ_EXPORT Yaz_Facility_ILL : public IServer_Facility {
public:
virtual void ill_service (Z_ExtendedServicesRequest *req,
Z_ItemOrder *io,
Z_ExtendedServicesResponse *res) = 0;
- int init(Yaz_Z_Server *server,
+ int init(Z_Server *server,
Z_InitRequest *initRequest,
Z_InitResponse *initResponse);
- int recv(Yaz_Z_Server *server, Z_APDU *apdu);
+ int recv(Z_Server *server, Z_APDU *apdu);
};
-class YAZ_EXPORT Yaz_Facility_Update : public IYaz_Server_Facility {
+class YAZ_EXPORT Yaz_Facility_Update : public IServer_Facility {
public:
virtual void update_service (Z_ExtendedServicesRequest *req,
Z_IUUpdate *io,
Z_IU0Update *io,
Z_ExtendedServicesResponse *res) = 0;
- int init(Yaz_Z_Server *server,
+ int init(Z_Server *server,
Z_InitRequest *initRequest,
Z_InitResponse *initResponse);
- int recv(Yaz_Z_Server *server, Z_APDU *apdu);
+ int recv(Z_Server *server, Z_APDU *apdu);
};
-class YAZ_EXPORT Yaz_Facility_Retrieval : public IYaz_Server_Facility,
- public Yaz_Z_ServerUtility {
+class YAZ_EXPORT Yaz_Facility_Retrieval : public IServer_Facility,
+ public Z_ServerUtility {
public:
virtual int sr_init (Z_InitRequest *initRequest,
Z_RecordComposition *comp,
Z_NamePlusRecord *namePlusRecord,
Z_Records *diagnostics) = 0;
- int init(Yaz_Z_Server *server,
+ int init(Z_Server *server,
Z_InitRequest *initRequest,
Z_InitResponse *initResponse);
- int recv(Yaz_Z_Server *server, Z_APDU *apdu);
+ int recv(Z_Server *server, Z_APDU *apdu);
ODR odr_encode();
ODR odr_decode();
private:
- Z_Records *pack_records (Yaz_Z_Server *s,
+ Z_Records *pack_records (Z_Server *s,
const char *resultSetName,
int start, int num,
Z_RecordComposition *comp,
int *next, int *pres,
int *oid);
- void fetch_via_piggyback (Yaz_Z_Server *s,
+ void fetch_via_piggyback (Z_Server *s,
Z_SearchRequest *searchRequest,
Z_SearchResponse *searchResponse);
- void fetch_via_present (Yaz_Z_Server *s,
+ void fetch_via_present (Z_Server *s,
Z_PresentRequest *req, Z_PresentResponse *res);
int m_preferredMessageSize;
ODR m_odr_decode;
};
-class YAZ_EXPORT Yaz_Z_Server_Facility_Info {
- friend class Yaz_Z_Server;
- IYaz_Server_Facility *m_facility;
+class YAZ_EXPORT Z_Server_Facility_Info {
+ friend class Z_Server;
+ IServer_Facility *m_facility;
char *m_name;
- Yaz_Z_Server_Facility_Info *m_next;
+ Z_Server_Facility_Info *m_next;
};
-class YAZ_EXPORT Yaz_Z_Server : public Yaz_Z_Assoc {
+class YAZ_EXPORT Z_Server : public Z_Assoc {
public:
- Yaz_Z_Server(IYaz_PDU_Observable *the_PDU_Observable);
- virtual ~Yaz_Z_Server();
+ Z_Server(IPDU_Observable *the_PDU_Observable);
+ virtual ~Z_Server();
void recv_Z_PDU(Z_APDU *apdu, int len);
virtual void recv_GDU(Z_GDU *apdu, int len);
- void facility_add(IYaz_Server_Facility *facility, const char *name);
+ void facility_add(IServer_Facility *facility, const char *name);
void facility_reset ();
private:
- Yaz_Z_Server_Facility_Info *m_facilities;
+ Z_Server_Facility_Info *m_facilities;
};
class YAZ_EXPORT Yaz_USMARC {
* Copyright (c) 1998-2003, Index Data.
* See the file LICENSE for details.
*
- * $Id: yaz-ir-assoc.cpp,v 1.24 2005-06-02 06:40:21 adam Exp $
+ * $Id: yaz-ir-assoc.cpp,v 1.25 2005-06-08 13:28:05 adam Exp $
*/
#include <assert.h>
using namespace yazpp_1;
-Yaz_IR_Assoc::Yaz_IR_Assoc(IYaz_PDU_Observable *the_PDU_Observable)
- : Yaz_Z_Assoc(the_PDU_Observable)
+IR_Assoc::IR_Assoc(IPDU_Observable *the_PDU_Observable)
+ : Z_Assoc(the_PDU_Observable)
{
m_num_databaseNames = 0;
m_databaseNames = 0;
set_databaseNames(1, &db);
}
-Yaz_IR_Assoc::~Yaz_IR_Assoc()
+IR_Assoc::~IR_Assoc()
{
if (m_elementSetNames)
delete [] m_elementSetNames->u.generic;
delete [] m_cookie;
}
-void Yaz_IR_Assoc::get_databaseNames (int *num, char ***list)
+void IR_Assoc::get_databaseNames (int *num, char ***list)
{
*num = m_num_databaseNames;
*list = m_databaseNames;
}
typedef char *charp;
-void Yaz_IR_Assoc::set_databaseNames (int num, const char **list)
+void IR_Assoc::set_databaseNames (int num, const char **list)
{
int i;
- yaz_log (m_log, "Yaz_IR_Assoc::set_databaseNames num=%d", num);
+ yaz_log (m_log, "IR_Assoc::set_databaseNames num=%d", num);
for (i = 0; i<m_num_databaseNames; i++)
delete [] m_databaseNames[i];
delete [] m_databaseNames;
}
}
-void Yaz_IR_Assoc::set_databaseNames(const char *dblist, const char *sep)
+void IR_Assoc::set_databaseNames(const char *dblist, const char *sep)
{
const char **list = new const char* [strlen(dblist)];
char *dbtmp = new char[strlen(dblist)+1];
delete [] list;
}
-void Yaz_IR_Assoc::set_preferredRecordSyntax (int value)
+void IR_Assoc::set_preferredRecordSyntax (int value)
{
m_preferredRecordSyntax = value;
}
-void Yaz_IR_Assoc::set_preferredRecordSyntax (const char *syntax)
+void IR_Assoc::set_preferredRecordSyntax (const char *syntax)
{
m_preferredRecordSyntax = VAL_NONE;
if (syntax && *syntax)
m_preferredRecordSyntax = oid_getvalbyname (syntax);
}
-void Yaz_IR_Assoc::get_preferredRecordSyntax (int *value)
+void IR_Assoc::get_preferredRecordSyntax (int *value)
{
*value = m_preferredRecordSyntax;
}
-void Yaz_IR_Assoc::get_preferredRecordSyntax (const char **dst)
+void IR_Assoc::get_preferredRecordSyntax (const char **dst)
{
struct oident ent;
ent.proto = PROTO_Z3950;
*dst = entp ? entp->desc : "";
}
-void Yaz_IR_Assoc::set_elementSetName (const char *elementSetName)
+void IR_Assoc::set_elementSetName (const char *elementSetName)
{
if (m_elementSetNames)
delete [] m_elementSetNames->u.generic;
}
}
-void Yaz_IR_Assoc::get_elementSetName (Z_ElementSetNames **elementSetNames)
+void IR_Assoc::get_elementSetName (Z_ElementSetNames **elementSetNames)
{
*elementSetNames = m_elementSetNames;
}
-void Yaz_IR_Assoc::get_elementSetName (const char **elementSetName)
+void IR_Assoc::get_elementSetName (const char **elementSetName)
{
if (!m_elementSetNames ||
m_elementSetNames->which != Z_ElementSetNames_generic)
}
-void Yaz_IR_Assoc::recv_GDU(Z_GDU *apdu, int len)
+void IR_Assoc::recv_GDU(Z_GDU *apdu, int len)
{
if (apdu->which == Z_GDU_Z3950)
recv_Z_PDU(apdu->u.z3950, len);
}
-void Yaz_IR_Assoc::recv_Z_PDU(Z_APDU *apdu, int len)
+void IR_Assoc::recv_Z_PDU(Z_APDU *apdu, int len)
{
yaz_log (m_log, "recv_Z_PDU %d bytes", len);
m_lastReceived = apdu->which;
}
}
-int Yaz_IR_Assoc::send_searchRequest(Yaz_Z_Query *query,
+int IR_Assoc::send_searchRequest(Yaz_Z_Query *query,
char* pResultSetId,
char* pRefId)
{
return send_Z_PDU(apdu, 0);
}
-int Yaz_IR_Assoc::send_presentRequest(int start,
+int IR_Assoc::send_presentRequest(int start,
int number,
char* pResultSetId,
char* pRefId)
return send_Z_PDU(apdu, 0);
}
-void Yaz_IR_Assoc::set_proxy(const char *str)
+void IR_Assoc::set_proxy(const char *str)
{
delete [] m_proxy;
m_proxy = 0;
}
}
-void Yaz_IR_Assoc::set_cookie(const char *str)
+void IR_Assoc::set_cookie(const char *str)
{
delete [] m_cookie;
m_cookie = 0;
}
}
-const char *Yaz_IR_Assoc::get_cookie()
+const char *IR_Assoc::get_cookie()
{
return m_cookie;
}
-void Yaz_IR_Assoc::client(const char *addr)
+void IR_Assoc::client(const char *addr)
{
delete [] m_host;
m_host = new char[strlen(addr)+1];
const char *dbpart = strchr(m_host, '/');
if (dbpart)
set_databaseNames (dbpart+1, "+ ");
- Yaz_Z_Assoc::client(m_proxy ? m_proxy : m_host);
+ Z_Assoc::client(m_proxy ? m_proxy : m_host);
}
-const char *Yaz_IR_Assoc::get_proxy()
+const char *IR_Assoc::get_proxy()
{
return m_proxy;
}
-const char *Yaz_IR_Assoc::get_host()
+const char *IR_Assoc::get_host()
{
return m_host;
}
-void Yaz_IR_Assoc::recv_searchRequest(Z_SearchRequest *searchRequest)
+void IR_Assoc::recv_searchRequest(Z_SearchRequest *searchRequest)
{
Z_APDU *apdu = create_Z_PDU(Z_APDU_searchResponse);
send_Z_PDU(apdu, 0);
}
-void Yaz_IR_Assoc::recv_presentRequest(Z_PresentRequest *presentRequest)
+void IR_Assoc::recv_presentRequest(Z_PresentRequest *presentRequest)
{
Z_APDU *apdu = create_Z_PDU(Z_APDU_presentResponse);
send_Z_PDU(apdu, 0);
}
-void Yaz_IR_Assoc::recv_initRequest(Z_InitRequest *initRequest)
+void IR_Assoc::recv_initRequest(Z_InitRequest *initRequest)
{
Z_APDU *apdu = create_Z_PDU(Z_APDU_initResponse);
send_Z_PDU(apdu, 0);
}
-void Yaz_IR_Assoc::recv_searchResponse (Z_SearchResponse *searchResponse)
+void IR_Assoc::recv_searchResponse (Z_SearchResponse *searchResponse)
{
}
-void Yaz_IR_Assoc::recv_presentResponse (Z_PresentResponse *presentResponse)
+void IR_Assoc::recv_presentResponse (Z_PresentResponse *presentResponse)
{
}
-void Yaz_IR_Assoc::recv_initResponse(Z_InitResponse *initResponse)
+void IR_Assoc::recv_initResponse(Z_InitResponse *initResponse)
{
}
-void Yaz_IR_Assoc::recv_extendedServicesResponse(Z_ExtendedServicesResponse *ExtendedServicesResponse)
+void IR_Assoc::recv_extendedServicesResponse(Z_ExtendedServicesResponse *ExtendedServicesResponse)
{
}
-int Yaz_IR_Assoc::get_lastReceived()
+int IR_Assoc::get_lastReceived()
{
return m_lastReceived;
}
-void Yaz_IR_Assoc::set_lastReceived(int lastReceived)
+void IR_Assoc::set_lastReceived(int lastReceived)
{
m_lastReceived = lastReceived;
}
-int Yaz_IR_Assoc::send_initRequest(char* pRefId)
+int IR_Assoc::send_initRequest(char* pRefId)
{
Z_APDU *apdu = create_Z_PDU(Z_APDU_initRequest);
Z_InitRequest *req = apdu->u.initRequest;
return send_Z_PDU(apdu, 0);
}
-int Yaz_IR_Assoc::send_deleteResultSetRequest(char* pResultSetId, char* pRefId)
+int IR_Assoc::send_deleteResultSetRequest(char* pResultSetId, char* pRefId)
{
char* ResultSetIds[1];
* Copyright (c) 1998-2004, Index Data.
* See the file LICENSE for details.
*
- * $Id: yaz-my-client.cpp,v 1.19 2005-06-02 06:40:21 adam Exp $
+ * $Id: yaz-my-client.cpp,v 1.20 2005-06-08 13:28:06 adam Exp $
*/
#include <stdlib.h>
using namespace yazpp_1;
-class YAZ_EXPORT MyClient : public Yaz_IR_Assoc {
+class YAZ_EXPORT MyClient : public IR_Assoc {
private:
int m_interactive_flag;
char m_thisCommand[1024];
char m_lastCommand[1024];
int m_setOffset;
- Yaz_SocketManager *m_socketManager;
+ SocketManager *m_socketManager;
public:
- MyClient(IYaz_PDU_Observable *the_PDU_Observable,
- Yaz_SocketManager *the_SocketManager);
- IYaz_PDU_Observer *sessionNotify(
- IYaz_PDU_Observable *the_PDU_Observable, int fd);
- int args(Yaz_SocketManager *socketManager, int argc, char **argv);
- int interactive(Yaz_SocketManager *socketManager);
+ MyClient(IPDU_Observable *the_PDU_Observable,
+ SocketManager *the_SocketManager);
+ IPDU_Observer *sessionNotify(
+ IPDU_Observable *the_PDU_Observable, int fd);
+ int args(SocketManager *socketManager, int argc, char **argv);
+ int interactive(SocketManager *socketManager);
int wait();
void recv_initResponse(Z_InitResponse *initResponse);
void recv_searchResponse(Z_SearchResponse *searchResponse);
set_lastReceived(-1);
}
-IYaz_PDU_Observer *MyClient::sessionNotify(
- IYaz_PDU_Observable *the_PDU_Observable, int fd)
+IPDU_Observer *MyClient::sessionNotify(IPDU_Observable *the_PDU_Observable,
+ int fd)
{
return new MyClient(the_PDU_Observable, m_socketManager);
}
-MyClient::MyClient(IYaz_PDU_Observable *the_PDU_Observable,
- Yaz_SocketManager *the_socketManager) :
- Yaz_IR_Assoc (the_PDU_Observable)
+MyClient::MyClient(IPDU_Observable *the_PDU_Observable,
+ SocketManager *the_socketManager) :
+ IR_Assoc (the_PDU_Observable)
{
m_setOffset = 1;
m_interactive_flag = 1;
return m_lastCommand;
}
-int MyClient::interactive(Yaz_SocketManager *socketManager)
+int MyClient::interactive(SocketManager *socketManager)
{
const char *cmd;
if (!m_interactive_flag)
return 0;
}
-int MyClient::args(Yaz_SocketManager *socketManager, int argc, char **argv)
+int MyClient::args(SocketManager *socketManager, int argc, char **argv)
{
char *host = 0;
char *proxy = 0;
int main(int argc, char **argv)
{
- Yaz_SocketManager mySocketManager;
- Yaz_PDU_Assoc *some = new Yaz_PDU_Assoc(&mySocketManager);
+ SocketManager mySocketManager;
+ PDU_Assoc *some = new PDU_Assoc(&mySocketManager);
MyClient z(some, &mySocketManager);
* Copyright (c) 1998-2001, Index Data.
* See the file LICENSE for details.
*
- * $Id: yaz-my-server.cpp,v 1.17 2005-06-02 06:40:21 adam Exp $
+ * $Id: yaz-my-server.cpp,v 1.18 2005-06-08 13:28:06 adam Exp $
*/
#include <stdlib.h>
Z_Records *records);
};
-class MyServer : public Yaz_Z_Server {
+class MyServer : public Z_Server {
public:
~MyServer();
- MyServer(IYaz_PDU_Observable *the_PDU_Observable);
- IYaz_PDU_Observer* sessionNotify(IYaz_PDU_Observable *the_PDU_Observable,
- int fd);
+ MyServer(IPDU_Observable *the_PDU_Observable);
+ IPDU_Observer* sessionNotify(IPDU_Observable *the_PDU_Observable,
+ int fd);
void failNotify();
void timeoutNotify();
void connectNotify();
{
}
-IYaz_PDU_Observer *MyServer::sessionNotify(
- IYaz_PDU_Observable *the_PDU_Observable, int fd)
+IPDU_Observer *MyServer::sessionNotify(
+ IPDU_Observable *the_PDU_Observable, int fd)
{
MyServer *new_server;
m_no++;
return new_server;
}
-MyServer::MyServer(IYaz_PDU_Observable *the_PDU_Observable) :
- Yaz_Z_Server (the_PDU_Observable)
+MyServer::MyServer(IPDU_Observable *the_PDU_Observable) :
+ Z_Server (the_PDU_Observable)
{
m_no = 0;
}
const char *addr = "tcp:@:9999";
char *apdu_log = 0;
- Yaz_SocketManager mySocketManager;
+ SocketManager mySocketManager;
- Yaz_PDU_Assoc *my_PDU_Assoc = 0;
+ PDU_Assoc *my_PDU_Assoc = 0;
MyServer *z = 0;
int ret;
}
#if YAZ_POSIX_THREADS
if (thread_flag)
- my_PDU_Assoc = new Yaz_PDU_AssocThread(&mySocketManager);
+ my_PDU_Assoc = new PDU_AssocThread(&mySocketManager);
else
- my_PDU_Assoc = new Yaz_PDU_Assoc(&mySocketManager);
+ my_PDU_Assoc = new PDU_Assoc(&mySocketManager);
#else
- my_PDU_Assoc = new Yaz_PDU_Assoc(&mySocketManager);
+ my_PDU_Assoc = new PDU_Assoc(&mySocketManager);
#endif
z = new MyServer(my_PDU_Assoc);
* Copyright (c) 1998-2004, Index Data.
* See the file LICENSE for details.
*
- * $Id: yaz-pdu-assoc-thread.cpp,v 1.10 2005-06-02 06:40:21 adam Exp $
+ * $Id: yaz-pdu-assoc-thread.cpp,v 1.11 2005-06-08 13:28:06 adam Exp $
*/
#ifdef WIN32
using namespace yazpp_1;
-Yaz_PDU_AssocThread::Yaz_PDU_AssocThread(
- IYazSocketObservable *socketObservable)
- : Yaz_PDU_Assoc(socketObservable)
+PDU_AssocThread::PDU_AssocThread(
+ ISocketObservable *socketObservable)
+ : PDU_Assoc(socketObservable)
{
}
#endif
events(void *p)
{
- Yaz_SocketManager *s = (Yaz_SocketManager *) p;
+ SocketManager *s = (SocketManager *) p;
yaz_log (YLOG_LOG, "thread started");
while (s->processEvent() > 0)
#endif
}
-void Yaz_PDU_AssocThread::childNotify(COMSTACK cs)
+void PDU_AssocThread::childNotify(COMSTACK cs)
{
- Yaz_SocketManager *socket_observable = new Yaz_SocketManager;
- Yaz_PDU_Assoc *new_observable = new Yaz_PDU_Assoc (socket_observable, cs);
+ SocketManager *socket_observable = new SocketManager;
+ PDU_Assoc *new_observable = new PDU_Assoc (socket_observable, cs);
new_observable->m_next = m_children;
m_children = new_observable;
* Copyright (c) 1998-2004, Index Data.
* See the file LICENSE for details.
*
- * $Id: yaz-pdu-assoc.cpp,v 1.40 2005-06-02 06:40:21 adam Exp $
+ * $Id: yaz-pdu-assoc.cpp,v 1.41 2005-06-08 13:28:06 adam Exp $
*/
#include <assert.h>
using namespace yazpp_1;
-void Yaz_PDU_Assoc::init(IYazSocketObservable *socketObservable)
+void PDU_Assoc::init(ISocketObservable *socketObservable)
{
m_state = Closed;
m_cs = 0;
m_log = YLOG_DEBUG;
}
-Yaz_PDU_Assoc::Yaz_PDU_Assoc(IYazSocketObservable *socketObservable)
+PDU_Assoc::PDU_Assoc(ISocketObservable *socketObservable)
{
init (socketObservable);
}
-Yaz_PDU_Assoc::Yaz_PDU_Assoc(IYazSocketObservable *socketObservable,
+PDU_Assoc::PDU_Assoc(ISocketObservable *socketObservable,
COMSTACK cs)
{
init(socketObservable);
m_cs = cs;
unsigned mask = 0;
if (cs->io_pending & CS_WANT_WRITE)
- mask |= YAZ_SOCKET_OBSERVE_WRITE;
+ mask |= SOCKET_OBSERVE_WRITE;
if (cs->io_pending & CS_WANT_READ)
- mask |= YAZ_SOCKET_OBSERVE_READ;
+ mask |= SOCKET_OBSERVE_READ;
m_socketObservable->addObserver(cs_fileno(cs), this);
if (!mask)
{
m_socketObservable->addObserver(cs_fileno(cs), this);
yaz_log(m_log, "maskObserver 1");
m_socketObservable->maskObserver(this,
- mask |YAZ_SOCKET_OBSERVE_EXCEPT);
+ mask |SOCKET_OBSERVE_EXCEPT);
}
}
-IYaz_PDU_Observable *Yaz_PDU_Assoc::clone()
+IPDU_Observable *PDU_Assoc::clone()
{
- Yaz_PDU_Assoc *copy = new Yaz_PDU_Assoc(m_socketObservable);
+ PDU_Assoc *copy = new PDU_Assoc(m_socketObservable);
return copy;
}
-void Yaz_PDU_Assoc::socketNotify(int event)
+void PDU_Assoc::socketNotify(int event)
{
- yaz_log (m_log, "Yaz_PDU_Assoc::socketNotify p=%p state=%d event = %d",
+ yaz_log (m_log, "PDU_Assoc::socketNotify p=%p state=%d event = %d",
this, m_state, event);
- if (event & YAZ_SOCKET_OBSERVE_EXCEPT)
+ if (event & SOCKET_OBSERVE_EXCEPT)
{
close();
m_PDU_Observer->failNotify();
return;
}
- else if (event & YAZ_SOCKET_OBSERVE_TIMEOUT)
+ else if (event & SOCKET_OBSERVE_TIMEOUT)
{
m_PDU_Observer->timeoutNotify();
return;
case Accepting:
if (!cs_accept (m_cs))
{
- yaz_log (m_log, "Yaz_PDU_Assoc::cs_accept failed");
+ yaz_log (m_log, "PDU_Assoc::cs_accept failed");
m_cs = 0;
close();
m_PDU_Observer->failNotify();
{
unsigned mask = 0;
if (m_cs->io_pending & CS_WANT_WRITE)
- mask |= YAZ_SOCKET_OBSERVE_WRITE;
+ mask |= SOCKET_OBSERVE_WRITE;
if (m_cs->io_pending & CS_WANT_READ)
- mask |= YAZ_SOCKET_OBSERVE_READ;
+ mask |= SOCKET_OBSERVE_READ;
if (!mask)
{ // accept is complete. turn to ready state and write if needed
m_state = Ready;
{ // accept still incomplete.
yaz_log(m_log, "maskObserver 2");
m_socketObservable->maskObserver(this,
- mask|YAZ_SOCKET_OBSERVE_EXCEPT);
+ mask|SOCKET_OBSERVE_EXCEPT);
}
}
break;
case Connecting:
- if (event & YAZ_SOCKET_OBSERVE_READ &&
- event & YAZ_SOCKET_OBSERVE_WRITE)
+ if (event & SOCKET_OBSERVE_READ &&
+ event & SOCKET_OBSERVE_WRITE)
{
// For Unix: if both read and write is set, then connect failed.
close();
int res = cs_rcvconnect (m_cs);
if (res == 1)
{
- unsigned mask = YAZ_SOCKET_OBSERVE_EXCEPT;
+ unsigned mask = SOCKET_OBSERVE_EXCEPT;
if (m_cs->io_pending & CS_WANT_WRITE)
- mask |= YAZ_SOCKET_OBSERVE_WRITE;
+ mask |= SOCKET_OBSERVE_WRITE;
if (m_cs->io_pending & CS_WANT_READ)
- mask |= YAZ_SOCKET_OBSERVE_READ;
+ mask |= SOCKET_OBSERVE_READ;
yaz_log(m_log, "maskObserver 3");
m_socketObservable->maskObserver(this, mask);
}
}
break;
case Listen:
- if (event & YAZ_SOCKET_OBSERVE_READ)
+ if (event & SOCKET_OBSERVE_READ)
{
int res;
COMSTACK new_line;
}
break;
case Writing:
- if (event & (YAZ_SOCKET_OBSERVE_READ|YAZ_SOCKET_OBSERVE_WRITE))
+ if (event & (SOCKET_OBSERVE_READ|SOCKET_OBSERVE_WRITE))
flush_PDU();
break;
case Ready:
- if (event & (YAZ_SOCKET_OBSERVE_READ|YAZ_SOCKET_OBSERVE_WRITE))
+ if (event & (SOCKET_OBSERVE_READ|SOCKET_OBSERVE_WRITE))
{
do
{
int res = cs_get (m_cs, &m_input_buf, &m_input_len);
if (res == 1)
{
- unsigned mask = YAZ_SOCKET_OBSERVE_EXCEPT;
+ unsigned mask = SOCKET_OBSERVE_EXCEPT;
if (m_cs->io_pending & CS_WANT_WRITE)
- mask |= YAZ_SOCKET_OBSERVE_WRITE;
+ mask |= SOCKET_OBSERVE_WRITE;
if (m_cs->io_pending & CS_WANT_READ)
- mask |= YAZ_SOCKET_OBSERVE_READ;
+ mask |= SOCKET_OBSERVE_READ;
yaz_log(m_log, "maskObserver 4");
m_socketObservable->maskObserver(this, mask);
return;
}
else if (res <= 0)
{
- yaz_log (m_log, "Yaz_PDU_Assoc::Connection closed by peer");
+ yaz_log (m_log, "PDU_Assoc::Connection closed by peer");
close();
if (m_PDU_Observer)
m_PDU_Observer->failNotify(); // problem here..
{
yaz_log(m_log, "maskObserver 5");
m_socketObservable->maskObserver(this,
- YAZ_SOCKET_OBSERVE_EXCEPT|
- YAZ_SOCKET_OBSERVE_READ);
+ SOCKET_OBSERVE_EXCEPT|
+ SOCKET_OBSERVE_READ);
}
}
break;
}
}
-void Yaz_PDU_Assoc::close()
+void PDU_Assoc::close()
{
- Yaz_PDU_Assoc *ch;
+ PDU_Assoc *ch;
for (ch = m_children; ch; ch = ch->m_next)
ch->close();
m_state = Closed;
if (m_cs)
{
- yaz_log (m_log, "Yaz_PDU_Assoc::close fd=%d", cs_fileno(m_cs));
+ yaz_log (m_log, "PDU_Assoc::close fd=%d", cs_fileno(m_cs));
cs_close (m_cs);
}
m_cs = 0;
m_input_len = 0;
}
-void Yaz_PDU_Assoc::destroy()
+void PDU_Assoc::destroy()
{
close();
if (m_destroyed)
*m_destroyed = 1;
- Yaz_PDU_Assoc **c;
+ PDU_Assoc **c;
// delete from parent's child list (if any)
if (m_parent)
c = &m_children;
while (*c)
{
- Yaz_PDU_Assoc *here = *c;
+ PDU_Assoc *here = *c;
*c = (*c)->m_next;
here->m_parent = 0;
delete here;
}
- yaz_log (m_log, "Yaz_PDU_Assoc::destroy this=%p", this);
+ yaz_log (m_log, "PDU_Assoc::destroy this=%p", this);
}
-Yaz_PDU_Assoc::PDU_Queue::PDU_Queue(const char *buf, int len)
+PDU_Assoc::PDU_Queue::PDU_Queue(const char *buf, int len)
{
m_buf = (char *) xmalloc (len);
memcpy (m_buf, buf, len);
m_next = 0;
}
-Yaz_PDU_Assoc::PDU_Queue::~PDU_Queue()
+PDU_Assoc::PDU_Queue::~PDU_Queue()
{
xfree (m_buf);
}
-int Yaz_PDU_Assoc::flush_PDU()
+int PDU_Assoc::flush_PDU()
{
int r;
m_state = Ready;
yaz_log (m_log, "YAZ_PDU_Assoc::flush_PDU queue empty");
yaz_log(m_log, "maskObserver 6");
- m_socketObservable->maskObserver(this, YAZ_SOCKET_OBSERVE_READ|
- YAZ_SOCKET_OBSERVE_WRITE|
- YAZ_SOCKET_OBSERVE_EXCEPT);
+ m_socketObservable->maskObserver(this, SOCKET_OBSERVE_READ|
+ SOCKET_OBSERVE_WRITE|
+ SOCKET_OBSERVE_EXCEPT);
return 0;
}
r = cs_put (m_cs, q->m_buf, q->m_len);
if (r < 0)
{
- yaz_log (m_log, "Yaz_PDU_Assoc::flush_PDU cs_put failed");
+ yaz_log (m_log, "PDU_Assoc::flush_PDU cs_put failed");
close();
m_PDU_Observer->failNotify();
return r;
}
if (r == 1)
{
- unsigned mask = YAZ_SOCKET_OBSERVE_EXCEPT;
+ unsigned mask = SOCKET_OBSERVE_EXCEPT;
m_state = Writing;
if (m_cs->io_pending & CS_WANT_WRITE)
- mask |= YAZ_SOCKET_OBSERVE_WRITE;
+ mask |= SOCKET_OBSERVE_WRITE;
if (m_cs->io_pending & CS_WANT_READ)
- mask |= YAZ_SOCKET_OBSERVE_READ;
+ mask |= SOCKET_OBSERVE_READ;
- mask |= YAZ_SOCKET_OBSERVE_WRITE;
+ mask |= SOCKET_OBSERVE_WRITE;
yaz_log(m_log, "maskObserver 7");
m_socketObservable->maskObserver(this, mask);
- yaz_log (m_log, "Yaz_PDU_Assoc::flush_PDU cs_put %d bytes fd=%d (inc)",
+ yaz_log (m_log, "PDU_Assoc::flush_PDU cs_put %d bytes fd=%d (inc)",
q->m_len, cs_fileno(m_cs));
return r;
}
- yaz_log (m_log, "Yaz_PDU_Assoc::flush_PDU cs_put %d bytes", q->m_len);
+ yaz_log (m_log, "PDU_Assoc::flush_PDU cs_put %d bytes", q->m_len);
// whole packet sent... delete this and proceed to next ...
m_queue_out = q->m_next;
delete q;
{
m_state = Ready;
yaz_log(m_log, "maskObserver 8");
- m_socketObservable->maskObserver(this, YAZ_SOCKET_OBSERVE_READ|
- YAZ_SOCKET_OBSERVE_EXCEPT);
+ m_socketObservable->maskObserver(this, SOCKET_OBSERVE_READ|
+ SOCKET_OBSERVE_EXCEPT);
}
return r;
}
-int Yaz_PDU_Assoc::send_PDU(const char *buf, int len)
+int PDU_Assoc::send_PDU(const char *buf, int len)
{
- yaz_log (m_log, "Yaz_PDU_Assoc::send_PDU");
+ yaz_log (m_log, "PDU_Assoc::send_PDU");
PDU_Queue **pq = &m_queue_out;
int is_idle = (*pq ? 0 : 1);
if (!m_cs)
{
- yaz_log (m_log, "Yaz_PDU_Assoc::send_PDU failed, m_cs == 0");
+ yaz_log (m_log, "PDU_Assoc::send_PDU failed, m_cs == 0");
return -1;
}
while (*pq)
if (is_idle)
return flush_PDU ();
else
- yaz_log (m_log, "Yaz_PDU_Assoc::cannot send_PDU fd=%d",
+ yaz_log (m_log, "PDU_Assoc::cannot send_PDU fd=%d",
cs_fileno(m_cs));
return 0;
}
-COMSTACK Yaz_PDU_Assoc::comstack(const char *type_and_host, void **vp)
+COMSTACK PDU_Assoc::comstack(const char *type_and_host, void **vp)
{
return cs_create_host(type_and_host, 2, vp);
}
-int Yaz_PDU_Assoc::listen(IYaz_PDU_Observer *observer,
- const char *addr)
+int PDU_Assoc::listen(IPDU_Observer *observer, const char *addr)
{
close();
return -2;
m_socketObservable->addObserver(cs_fileno(m_cs), this);
yaz_log(m_log, "maskObserver 9");
- m_socketObservable->maskObserver(this, YAZ_SOCKET_OBSERVE_READ|
- YAZ_SOCKET_OBSERVE_EXCEPT);
- yaz_log (m_log, "Yaz_PDU_Assoc::listen ok fd=%d", cs_fileno(m_cs));
+ m_socketObservable->maskObserver(this, SOCKET_OBSERVE_READ|
+ SOCKET_OBSERVE_EXCEPT);
+ yaz_log (m_log, "PDU_Assoc::listen ok fd=%d", cs_fileno(m_cs));
m_state = Listen;
return 0;
}
-void Yaz_PDU_Assoc::idleTime(int idleTime)
+void PDU_Assoc::idleTime(int idleTime)
{
m_idleTime = idleTime;
- yaz_log (m_log, "Yaz_PDU_Assoc::idleTime(%d)", idleTime);
+ yaz_log (m_log, "PDU_Assoc::idleTime(%d)", idleTime);
m_socketObservable->timeoutObserver(this, m_idleTime);
}
-int Yaz_PDU_Assoc::connect(IYaz_PDU_Observer *observer,
- const char *addr)
+int PDU_Assoc::connect(IPDU_Observer *observer, const char *addr)
{
- yaz_log (m_log, "Yaz_PDU_Assoc::connect %s", addr);
+ yaz_log (m_log, "PDU_Assoc::connect %s", addr);
close();
m_PDU_Observer = observer;
void *ap;
if (!m_cs)
return -1;
int res = cs_connect (m_cs, ap);
- yaz_log (m_log, "Yaz_PDU_Assoc::connect fd=%d res=%d", cs_fileno(m_cs),
+ yaz_log (m_log, "PDU_Assoc::connect fd=%d res=%d", cs_fileno(m_cs),
res);
m_socketObservable->addObserver(cs_fileno(m_cs), this);
if (res == 0)
{ // Connect complete
m_state = Connecting;
- unsigned mask = YAZ_SOCKET_OBSERVE_EXCEPT;
- mask |= YAZ_SOCKET_OBSERVE_WRITE;
- mask |= YAZ_SOCKET_OBSERVE_READ;
+ unsigned mask = SOCKET_OBSERVE_EXCEPT;
+ mask |= SOCKET_OBSERVE_WRITE;
+ mask |= SOCKET_OBSERVE_READ;
yaz_log(m_log, "maskObserver 11");
m_socketObservable->maskObserver(this, mask);
}
else if (res > 0)
{ // Connect pending
m_state = Connecting;
- unsigned mask = YAZ_SOCKET_OBSERVE_EXCEPT;
+ unsigned mask = SOCKET_OBSERVE_EXCEPT;
if (m_cs->io_pending & CS_WANT_WRITE)
- mask |= YAZ_SOCKET_OBSERVE_WRITE;
+ mask |= SOCKET_OBSERVE_WRITE;
if (m_cs->io_pending & CS_WANT_READ)
- mask |= YAZ_SOCKET_OBSERVE_READ;
+ mask |= SOCKET_OBSERVE_READ;
yaz_log(m_log, "maskObserver 11");
m_socketObservable->maskObserver(this, mask);
}
// Since m_state is Closed we can distinguish this case from
// normal connect in socketNotify handler
yaz_log(m_log, "maskObserver 12");
- m_socketObservable->maskObserver(this, YAZ_SOCKET_OBSERVE_WRITE|
- YAZ_SOCKET_OBSERVE_EXCEPT);
+ m_socketObservable->maskObserver(this, SOCKET_OBSERVE_WRITE|
+ SOCKET_OBSERVE_EXCEPT);
}
return 0;
}
// Single-threaded... Only useful for non-blocking handlers
-void Yaz_PDU_Assoc::childNotify(COMSTACK cs)
+void PDU_Assoc::childNotify(COMSTACK cs)
{
- Yaz_PDU_Assoc *new_observable =
- new Yaz_PDU_Assoc (m_socketObservable, cs);
+ PDU_Assoc *new_observable =
+ new PDU_Assoc (m_socketObservable, cs);
new_observable->m_next = m_children;
m_children = new_observable;
(new_observable, cs_fileno(cs));
}
-const char*Yaz_PDU_Assoc::getpeername()
+const char*PDU_Assoc::getpeername()
{
return cs_addrstr(m_cs);
}
* Copyright (c) 1998-2005, Index Data.
* See the file LICENSE for details.
*
- * $Id: yaz-socket-manager.cpp,v 1.32 2005-06-02 06:40:21 adam Exp $
+ * $Id: yaz-socket-manager.cpp,v 1.33 2005-06-08 13:28:06 adam Exp $
*/
#ifdef WIN32
#include <winsock.h>
using namespace yazpp_1;
-Yaz_SocketManager::YazSocketEntry **Yaz_SocketManager::lookupObserver(
- IYazSocketObserver *observer)
+SocketManager::SocketEntry **SocketManager::lookupObserver(
+ ISocketObserver *observer)
{
- YazSocketEntry **se;
+ SocketEntry **se;
for (se = &m_observers; *se; se = &(*se)->next)
if ((*se)->observer == observer)
return se;
}
-void Yaz_SocketManager::addObserver(int fd, IYazSocketObserver *observer)
+void SocketManager::addObserver(int fd, ISocketObserver *observer)
{
- YazSocketEntry *se;
+ SocketEntry *se;
se = *lookupObserver(observer);
if (!se)
{
- se = new YazSocketEntry;
+ se = new SocketEntry;
se->next= m_observers;
m_observers = se;
se->observer = observer;
se->timeout = -1;
}
-void Yaz_SocketManager::deleteObserver(IYazSocketObserver *observer)
+void SocketManager::deleteObserver(ISocketObserver *observer)
{
- YazSocketEntry **se = lookupObserver(observer);
+ SocketEntry **se = lookupObserver(observer);
if (*se)
{
removeEvent (observer);
- YazSocketEntry *se_tmp = *se;
+ SocketEntry *se_tmp = *se;
*se = (*se)->next;
delete se_tmp;
}
}
-void Yaz_SocketManager::deleteObservers()
+void SocketManager::deleteObservers()
{
- YazSocketEntry *se = m_observers;
+ SocketEntry *se = m_observers;
while (se)
{
- YazSocketEntry *se_next = se->next;
+ SocketEntry *se_next = se->next;
delete se;
se = se_next;
}
m_observers = 0;
}
-void Yaz_SocketManager::maskObserver(IYazSocketObserver *observer, int mask)
+void SocketManager::maskObserver(ISocketObserver *observer, int mask)
{
- YazSocketEntry *se;
+ SocketEntry *se;
yaz_log(m_log, "obs=%p read=%d write=%d except=%d", observer,
- mask & YAZ_SOCKET_OBSERVE_READ,
- mask & YAZ_SOCKET_OBSERVE_WRITE,
- mask & YAZ_SOCKET_OBSERVE_EXCEPT);
+ mask & SOCKET_OBSERVE_READ,
+ mask & SOCKET_OBSERVE_WRITE,
+ mask & SOCKET_OBSERVE_EXCEPT);
se = *lookupObserver(observer);
if (se)
se->mask = mask;
}
-void Yaz_SocketManager::timeoutObserver(IYazSocketObserver *observer,
+void SocketManager::timeoutObserver(ISocketObserver *observer,
int timeout)
{
- YazSocketEntry *se;
+ SocketEntry *se;
se = *lookupObserver(observer);
if (se)
se->timeout = timeout;
}
-int Yaz_SocketManager::processEvent()
+int SocketManager::processEvent()
{
- YazSocketEntry *p;
- YazSocketEvent *event = getEvent();
+ SocketEntry *p;
+ SocketEvent *event = getEvent();
int timeout = -1;
- yaz_log (m_log, "Yaz_SocketManager::processEvent manager=%p", this);
+ yaz_log (m_log, "SocketManager::processEvent manager=%p", this);
if (event)
{
event->observer->socketNotify(event->event);
int fd = p->fd;
if (p->mask)
no++;
- if (p->mask & YAZ_SOCKET_OBSERVE_READ)
+ if (p->mask & SOCKET_OBSERVE_READ)
{
- yaz_log (m_log, "Yaz_SocketManager::select fd=%d read", fd);
+ yaz_log (m_log, "SocketManager::select fd=%d read", fd);
FD_SET(fd, &in);
}
- if (p->mask & YAZ_SOCKET_OBSERVE_WRITE)
+ if (p->mask & SOCKET_OBSERVE_WRITE)
{
- yaz_log (m_log, "Yaz_SocketManager::select fd=%d write", fd);
+ yaz_log (m_log, "SocketManager::select fd=%d write", fd);
FD_SET(fd, &out);
}
- if (p->mask & YAZ_SOCKET_OBSERVE_EXCEPT)
+ if (p->mask & SOCKET_OBSERVE_EXCEPT)
{
- yaz_log (m_log, "Yaz_SocketManager::select fd=%d except", fd);
+ yaz_log (m_log, "SocketManager::select fd=%d except", fd);
FD_SET(fd, &except);
}
if (fd > max)
max = fd;
if (p->timeout > 0 ||
- (p->timeout == 0 && (p->mask & YAZ_SOCKET_OBSERVE_WRITE) == 0))
+ (p->timeout == 0 && (p->mask & SOCKET_OBSERVE_WRITE) == 0))
{
int timeout_this;
timeout_this = p->timeout;
if (timeout == -1 || timeout_this < timeout)
timeout = timeout_this;
p->timeout_this = timeout_this;
- yaz_log (m_log, "Yaz_SocketManager::select timeout_this=%d",
+ yaz_log (m_log, "SocketManager::select timeout_this=%d",
p->timeout_this);
}
}
to.tv_sec = timeout;
to.tv_usec = 0;
- yaz_log (m_log, "Yaz_SocketManager::select begin no=%d timeout=%d",
+ yaz_log (m_log, "SocketManager::select begin no=%d timeout=%d",
no, timeout);
int pass = 0;
while ((res = select(max + 1, &in, &out, &except,
int fd = p->fd;
int mask = 0;
if (FD_ISSET(fd, &in))
- mask |= YAZ_SOCKET_OBSERVE_READ;
+ mask |= SOCKET_OBSERVE_READ;
if (FD_ISSET(fd, &out))
- mask |= YAZ_SOCKET_OBSERVE_WRITE;
+ mask |= SOCKET_OBSERVE_WRITE;
if (FD_ISSET(fd, &except))
- mask |= YAZ_SOCKET_OBSERVE_EXCEPT;
+ mask |= SOCKET_OBSERVE_EXCEPT;
if (mask)
{
- YazSocketEvent *event = new YazSocketEvent;
+ SocketEvent *event = new SocketEvent;
p->last_activity = now;
event->observer = p->observer;
event->event = mask;
}
else if (res == 0 && p->timeout_this == timeout)
{
- YazSocketEvent *event = new YazSocketEvent;
+ SocketEvent *event = new SocketEvent;
assert (p->last_activity);
yaz_log (m_log, "putEvent timeout fd=%d, now = %ld last_activity=%ld timeout=%d",
p->fd, now, p->last_activity, p->timeout);
p->last_activity = now;
event->observer = p->observer;
- event->event = YAZ_SOCKET_OBSERVE_TIMEOUT;
+ event->event = SOCKET_OBSERVE_TIMEOUT;
putEvent (event);
}
}
// n p n p ...... n p n p
// front back
-void Yaz_SocketManager::putEvent(YazSocketEvent *event)
+void SocketManager::putEvent(SocketEvent *event)
{
// put in back of queue
if (m_queue_back)
m_queue_back = event;
}
-Yaz_SocketManager::YazSocketEvent *Yaz_SocketManager::getEvent()
+SocketManager::SocketEvent *SocketManager::getEvent()
{
// get from front of queue
- YazSocketEvent *event = m_queue_front;
+ SocketEvent *event = m_queue_front;
if (!event)
return 0;
assert (m_queue_back);
return event;
}
-void Yaz_SocketManager::removeEvent(IYazSocketObserver *observer)
+void SocketManager::removeEvent(ISocketObserver *observer)
{
- YazSocketEvent *ev = m_queue_back;
+ SocketEvent *ev = m_queue_back;
while (ev)
{
- YazSocketEvent *ev_next = ev->next;
+ SocketEvent *ev_next = ev->next;
if (observer == ev->observer)
{
if (ev->prev)
}
}
-Yaz_SocketManager::Yaz_SocketManager()
+SocketManager::SocketManager()
{
m_observers = 0;
m_queue_front = 0;
m_log = YLOG_DEBUG;
}
-Yaz_SocketManager::~Yaz_SocketManager()
+SocketManager::~SocketManager()
{
deleteObservers();
}
* Copyright (c) 1998-2004, Index Data.
* See the file LICENSE for details.
*
- * $Id: yaz-z-assoc.cpp,v 1.36 2005-06-02 06:40:21 adam Exp $
+ * $Id: yaz-z-assoc.cpp,v 1.37 2005-06-08 13:28:06 adam Exp $
*/
#include <assert.h>
using namespace yazpp_1;
-int Yaz_Z_Assoc::yaz_init_func()
+int Z_Assoc::yaz_init_func()
{
#ifndef WIN32
signal (SIGPIPE, SIG_IGN);
return 1;
}
-int Yaz_Z_Assoc::yaz_init_flag = Yaz_Z_Assoc::yaz_init_func();
+int Z_Assoc::yaz_init_flag = Z_Assoc::yaz_init_func();
-Yaz_Z_Assoc::Yaz_Z_Assoc(IYaz_PDU_Observable *the_PDU_Observable)
+Z_Assoc::Z_Assoc(IPDU_Observable *the_PDU_Observable)
{
m_PDU_Observable = the_PDU_Observable;
m_odr_in = odr_createmem (ODR_DECODE);
m_APDU_yazlog = 0;
}
-void Yaz_Z_Assoc::set_APDU_log(const char *fname)
+void Z_Assoc::set_APDU_log(const char *fname)
{
if (m_APDU_file && m_APDU_file != stderr)
{
}
}
-int Yaz_Z_Assoc::set_APDU_yazlog(int v)
+int Z_Assoc::set_APDU_yazlog(int v)
{
int old = m_APDU_yazlog;
m_APDU_yazlog = v;
return old;
}
-const char *Yaz_Z_Assoc::get_APDU_log()
+const char *Z_Assoc::get_APDU_log()
{
return m_APDU_fname;
}
-Yaz_Z_Assoc::~Yaz_Z_Assoc()
+Z_Assoc::~Z_Assoc()
{
m_PDU_Observable->destroy();
delete m_PDU_Observable;
delete [] m_hostname;
}
-void Yaz_Z_Assoc::recv_PDU(const char *buf, int len)
+void Z_Assoc::recv_PDU(const char *buf, int len)
{
yaz_log (m_log, "recv_PDU len=%d", len);
Z_GDU *apdu = decode_GDU (buf, len);
}
}
-Z_APDU *Yaz_Z_Assoc::create_Z_PDU(int type)
+Z_APDU *Z_Assoc::create_Z_PDU(int type)
{
Z_APDU *apdu = zget_APDU(m_odr_out, type);
if (apdu->which == Z_APDU_initRequest)
return apdu;
}
-Z_ReferenceId **Yaz_Z_Assoc::get_referenceIdP(Z_APDU *apdu)
+Z_ReferenceId **Z_Assoc::get_referenceIdP(Z_APDU *apdu)
{
switch (apdu->which)
{
return 0;
}
-void Yaz_Z_Assoc::transfer_referenceId(Z_APDU *from, Z_APDU *to)
+void Z_Assoc::transfer_referenceId(Z_APDU *from, Z_APDU *to)
{
Z_ReferenceId **id_from = get_referenceIdP(from);
Z_ReferenceId **id_to = get_referenceIdP(to);
*id_to = 0;
}
-int Yaz_Z_Assoc::send_Z_PDU(Z_APDU *apdu, int *plen)
+int Z_Assoc::send_Z_PDU(Z_APDU *apdu, int *plen)
{
Z_GDU *gdu = (Z_GDU*) odr_malloc(odr_encode(), sizeof(*gdu));
gdu->which = Z_GDU_Z3950;
return send_GDU(gdu, plen);
}
-int Yaz_Z_Assoc::send_GDU(Z_GDU *apdu, int *plen)
+int Z_Assoc::send_GDU(Z_GDU *apdu, int *plen)
{
char *buf;
int len;
return -1;
}
-Z_GDU *Yaz_Z_Assoc::decode_GDU(const char *buf, int len)
+Z_GDU *Z_Assoc::decode_GDU(const char *buf, int len)
{
Z_GDU *apdu;
}
}
-int Yaz_Z_Assoc::encode_GDU(Z_GDU *apdu, char **buf, int *len)
+int Z_Assoc::encode_GDU(Z_GDU *apdu, char **buf, int *len)
{
const char *element = 0;
int r = z_GDU(m_odr_out, &apdu, 0, 0);
return *len;
}
-const char *Yaz_Z_Assoc::get_hostname()
+const char *Z_Assoc::get_hostname()
{
return m_hostname;
}
-int Yaz_Z_Assoc::client(const char *addr)
+int Z_Assoc::client(const char *addr)
{
delete [] m_hostname;
m_hostname = new char[strlen(addr)+1];
return m_PDU_Observable->connect (this, addr);
}
-void Yaz_Z_Assoc::close()
+void Z_Assoc::close()
{
m_PDU_Observable->close ();
}
-int Yaz_Z_Assoc::server(const char *addr)
+int Z_Assoc::server(const char *addr)
{
delete [] m_hostname;
m_hostname = new char[strlen(addr)+1];
return m_PDU_Observable->listen (this, addr);
}
-ODR Yaz_Z_Assoc::odr_encode()
+ODR Z_Assoc::odr_encode()
{
return m_odr_out;
}
-ODR Yaz_Z_Assoc::odr_decode()
+ODR Z_Assoc::odr_decode()
{
return m_odr_in;
}
-ODR Yaz_Z_Assoc::odr_print()
+ODR Z_Assoc::odr_print()
{
return m_odr_print;
}
-void Yaz_Z_Assoc::timeout(int timeout)
+void Z_Assoc::timeout(int timeout)
{
m_PDU_Observable->idleTime(timeout);
}
-void Yaz_Z_Assoc::get_otherInfoAPDU(Z_APDU *apdu, Z_OtherInformation ***oip)
+void Z_Assoc::get_otherInfoAPDU(Z_APDU *apdu, Z_OtherInformation ***oip)
{
switch (apdu->which)
{
}
}
-void Yaz_Z_Assoc::set_otherInformationString (
+void Z_Assoc::set_otherInformationString (
Z_APDU *apdu,
int oidval, int categoryValue,
const char *str)
set_otherInformationString(otherInformation, oidval, categoryValue, str);
}
-void Yaz_Z_Assoc::set_otherInformationString (
+void Z_Assoc::set_otherInformationString (
Z_OtherInformation **otherInformation,
int oidval, int categoryValue,
const char *str)
set_otherInformationString(otherInformation, oid, categoryValue, str);
}
-void Yaz_Z_Assoc::set_otherInformationString (
+void Z_Assoc::set_otherInformationString (
Z_OtherInformation **otherInformation,
int *oid, int categoryValue, const char *str)
{
oi->information.characterInfo = odr_strdup (odr_encode(), str);
}
-Z_OtherInformationUnit *Yaz_Z_Assoc::update_otherInformation (
+Z_OtherInformationUnit *Z_Assoc::update_otherInformation (
Z_OtherInformation **otherInformationP, int createFlag,
int *oid, int categoryValue, int deleteFlag)
{
oid, categoryValue, deleteFlag);
}
-Z_ReferenceId* Yaz_Z_Assoc::getRefID(char* str)
+Z_ReferenceId* Z_Assoc::getRefID(char* str)
{
Z_ReferenceId* id = NULL;
* Copyright (c) 2002-2004, Index Data.
* See the file LICENSE for details.
*
- * $Id: yaz-z-cache.cpp,v 1.12 2005-06-02 06:40:21 adam Exp $
+ * $Id: yaz-z-cache.cpp,v 1.13 2005-06-08 13:28:06 adam Exp $
*/
#include <yaz/log.h>
using namespace yazpp_1;
-struct yazpp_1::Yaz_RecordCache_Entry {
+struct yazpp_1::RecordCache_Entry {
int m_offset;
Z_NamePlusRecord *m_record;
Z_RecordComposition *m_comp;
- Yaz_RecordCache_Entry *m_next;
+ RecordCache_Entry *m_next;
};
-Yaz_RecordCache::Yaz_RecordCache ()
+RecordCache::RecordCache ()
{
m_mem = nmem_create();
m_entries = 0;
m_max_size = 200000;
}
-Yaz_RecordCache::~Yaz_RecordCache ()
+RecordCache::~RecordCache ()
{
nmem_destroy(m_mem);
}
-void Yaz_RecordCache::set_max_size(int sz)
+void RecordCache::set_max_size(int sz)
{
m_max_size = sz;
}
-void Yaz_RecordCache::clear ()
+void RecordCache::clear ()
{
nmem_destroy(m_mem);
m_mem = nmem_create();
m_searchRequest = 0;
}
-void Yaz_RecordCache::copy_searchRequest(Z_SearchRequest *sr)
+void RecordCache::copy_searchRequest(Z_SearchRequest *sr)
{
ODR encode = odr_createmem(ODR_ENCODE);
ODR decode = odr_createmem(ODR_DECODE);
odr_destroy(decode);
}
-void Yaz_RecordCache::copy_presentRequest(Z_PresentRequest *pr)
+void RecordCache::copy_presentRequest(Z_PresentRequest *pr)
{
ODR encode = odr_createmem(ODR_ENCODE);
ODR decode = odr_createmem(ODR_DECODE);
odr_destroy(decode);
}
-void Yaz_RecordCache::add (ODR o, Z_NamePlusRecordList *npr, int start,
+void RecordCache::add (ODR o, Z_NamePlusRecordList *npr, int start,
int hits)
{
if (nmem_total(m_mem) > m_max_size)
int i;
for (i = 0; i<npr->num_records; i++)
{
- Yaz_RecordCache_Entry *entry = (Yaz_RecordCache_Entry *)
+ RecordCache_Entry *entry = (RecordCache_Entry *)
nmem_malloc(m_mem, sizeof(*entry));
entry->m_record = (Z_NamePlusRecord *)
nmem_malloc(m_mem, sizeof(*entry->m_record));
}
}
-int Yaz_RecordCache::match (Yaz_RecordCache_Entry *entry,
+int RecordCache::match (RecordCache_Entry *entry,
Odr_oid *syntax, int offset,
Z_RecordComposition *comp)
{
return 0;
}
-int Yaz_RecordCache::lookup (ODR o, Z_NamePlusRecordList **npr,
+int RecordCache::lookup (ODR o, Z_NamePlusRecordList **npr,
int start, int num,
Odr_oid *syntax,
Z_RecordComposition *comp)
for (i = 0; i<num; i++)
{
- Yaz_RecordCache_Entry *entry = m_entries;
+ RecordCache_Entry *entry = m_entries;
for(; entry; entry = entry->m_next)
if (match(entry, syntax, start+i, comp))
break;
odr_malloc(o, num * sizeof(Z_NamePlusRecord *));
for (i = 0; i<num; i++)
{
- Yaz_RecordCache_Entry *entry = m_entries;
+ RecordCache_Entry *entry = m_entries;
for(; entry; entry = entry->m_next)
if (match(entry, syntax, start+i, comp))
break;
* Copyright (c) 2000-2004, Index Data.
* See the file LICENSE for details.
*
- * $Id: yaz-z-server-ill.cpp,v 1.12 2005-06-02 06:40:21 adam Exp $
+ * $Id: yaz-z-server-ill.cpp,v 1.13 2005-06-08 13:28:06 adam Exp $
*/
#include <yaz/log.h>
using namespace yazpp_1;
-int Yaz_Facility_ILL::init(Yaz_Z_Server *s, Z_InitRequest *initRequest,
+int Yaz_Facility_ILL::init(Z_Server *s, Z_InitRequest *initRequest,
Z_InitResponse *initResponse)
{
Z_Options *req = initRequest->options;
return 1;
}
-int Yaz_Facility_ILL::recv(Yaz_Z_Server *s, Z_APDU *apdu_request)
+int Yaz_Facility_ILL::recv(Z_Server *s, Z_APDU *apdu_request)
{
Z_APDU *apdu_response;
* Copyright (c) 2000-2004, Index Data.
* See the file LICENSE for details.
*
- * $Id: yaz-z-server-sr.cpp,v 1.9 2005-06-02 06:40:21 adam Exp $
+ * $Id: yaz-z-server-sr.cpp,v 1.10 2005-06-08 13:28:06 adam Exp $
*
*/
using namespace yazpp_1;
-Z_Records *Yaz_Facility_Retrieval::pack_records (Yaz_Z_Server *s,
+Z_Records *Yaz_Facility_Retrieval::pack_records (Z_Server *s,
const char *resultSetName,
int start, int xnum,
Z_RecordComposition *comp,
return records;
}
-void Yaz_Facility_Retrieval::fetch_via_piggyback (Yaz_Z_Server *s,
+void Yaz_Facility_Retrieval::fetch_via_piggyback (Z_Server *s,
Z_SearchRequest *req,
Z_SearchResponse *res)
{
}
}
-void Yaz_Facility_Retrieval::fetch_via_present (Yaz_Z_Server *s,
+void Yaz_Facility_Retrieval::fetch_via_present (Z_Server *s,
Z_PresentRequest *req,
Z_PresentResponse *res)
{
res->records->u.databaseOrSurDiagnostics->num_records;
}
-int Yaz_Facility_Retrieval::init(Yaz_Z_Server *s, Z_InitRequest *initRequest,
+int Yaz_Facility_Retrieval::init(Z_Server *s, Z_InitRequest *initRequest,
Z_InitResponse *initResponse)
{
Z_Options *req = initRequest->options;
return m_odr_decode;
}
-int Yaz_Facility_Retrieval::recv(Yaz_Z_Server *s, Z_APDU *apdu_request)
+int Yaz_Facility_Retrieval::recv(Z_Server *s, Z_APDU *apdu_request)
{
Z_APDU *apdu_response;
m_odr_encode = s->odr_encode();
* Copyright (c) 2000-2004, Index Data.
* See the file LICENSE for details.
*
- * $Id: yaz-z-server-update.cpp,v 1.9 2005-06-02 06:40:21 adam Exp $
+ * $Id: yaz-z-server-update.cpp,v 1.10 2005-06-08 13:28:06 adam Exp $
*/
#include <yaz/log.h>
using namespace yazpp_1;
-int Yaz_Facility_Update::init(Yaz_Z_Server *s, Z_InitRequest *initRequest,
+int Yaz_Facility_Update::init(Z_Server *s, Z_InitRequest *initRequest,
Z_InitResponse *initResponse)
{
Z_Options *req = initRequest->options;
return 1;
}
-int Yaz_Facility_Update::recv(Yaz_Z_Server *s, Z_APDU *apdu_request)
+int Yaz_Facility_Update::recv(Z_Server *s, Z_APDU *apdu_request)
{
Z_APDU *apdu_response;
* Copyright (c) 2000-2004, Index Data.
* See the file LICENSE for details.
*
- * $Id: yaz-z-server.cpp,v 1.21 2005-06-02 06:40:21 adam Exp $
+ * $Id: yaz-z-server.cpp,v 1.22 2005-06-08 13:28:06 adam Exp $
*/
#include <yaz/log.h>
using namespace yazpp_1;
-Yaz_Z_Server::Yaz_Z_Server(IYaz_PDU_Observable *the_PDU_Observable)
- : Yaz_Z_Assoc(the_PDU_Observable)
+Z_Server::Z_Server(IPDU_Observable *the_PDU_Observable)
+ : Z_Assoc(the_PDU_Observable)
{
m_facilities = 0;
}
-Yaz_Z_Server::~Yaz_Z_Server()
+Z_Server::~Z_Server()
{
facility_reset();
}
-void Yaz_Z_Server::facility_reset ()
+void Z_Server::facility_reset ()
{
- Yaz_Z_Server_Facility_Info *p = m_facilities;
+ Z_Server_Facility_Info *p = m_facilities;
while (p)
{
- Yaz_Z_Server_Facility_Info *p_next = p->m_next;
+ Z_Server_Facility_Info *p_next = p->m_next;
delete [] p->m_name;
delete p;
m_facilities = 0;
}
-void Yaz_Z_Server::facility_add(IYaz_Server_Facility *facility,
- const char *name)
+void Z_Server::facility_add(IServer_Facility *facility,
+ const char *name)
{
- Yaz_Z_Server_Facility_Info **p = &m_facilities;
+ Z_Server_Facility_Info **p = &m_facilities;
while (*p)
p = &(*p)->m_next;
- *p = new Yaz_Z_Server_Facility_Info;
+ *p = new Z_Server_Facility_Info;
(*p)->m_next = 0;
(*p)->m_name = new char [strlen(name)+1];
(*p)->m_facility = facility;
}
-void Yaz_Z_Server::recv_GDU (Z_GDU *apdu, int len)
+void Z_Server::recv_GDU (Z_GDU *apdu, int len)
{
if (apdu->which == Z_GDU_Z3950)
recv_Z_PDU(apdu->u.z3950, len);
delete this;
}
-void Yaz_Z_Server::recv_Z_PDU (Z_APDU *apdu_request, int len)
+void Z_Server::recv_Z_PDU (Z_APDU *apdu_request, int len)
{
- Yaz_Z_Server_Facility_Info *f = m_facilities;
+ Z_Server_Facility_Info *f = m_facilities;
if (apdu_request->which == Z_APDU_initRequest)
{
/*
* database record.
*/
-void Yaz_Z_ServerUtility::create_databaseRecord (
+void Z_ServerUtility::create_databaseRecord (
ODR odr, Z_NamePlusRecord *rec, const char *dbname, int format,
const void *buf, int len)
{
/*
* surrogate diagnostic.
*/
-void Yaz_Z_ServerUtility::create_surrogateDiagnostics(
+void Z_ServerUtility::create_surrogateDiagnostics(
ODR odr, Z_NamePlusRecord *rec, const char *dbname,
int error, char *const addinfo)
{
dr->u.v2Addinfo = odr_strdup (odr, addinfo ? addinfo : "");
}
-Z_Records *Yaz_Z_ServerUtility::create_nonSurrogateDiagnostics (
+Z_Records *Z_ServerUtility::create_nonSurrogateDiagnostics (
ODR odr, int error, const char *addinfo)
{
Z_Records *rec = (Z_Records *)
return rec;
}
-void Yaz_Z_ServerUtility::create_diagnostics (
+void Z_ServerUtility::create_diagnostics (
ODR odr, int error, const char *addinfo,
Z_DiagRec ***dreca, int *num)
{
int main(int argc, char **argv)
{
- Yaz_SocketManager mySocketManager;
- Zlint z(new Yaz_PDU_Assoc(&mySocketManager));
+ SocketManager mySocketManager;
+ Zlint z(new PDU_Assoc(&mySocketManager));
if (argc > 1)
z.set_host(argv[1]);
* Copyright (c) 2004, Index Data.
* See the file LICENSE for details.
*
- * $Id: zlint.cpp,v 1.9 2005-05-17 20:33:57 adam Exp $
+ * $Id: zlint.cpp,v 1.10 2005-06-08 13:28:06 adam Exp $
*/
#include <stdio.h>
int m_test_reported;
};
-Zlint::Zlint(IYaz_PDU_Observable *the_PDU_Observable) :
- Yaz_Z_Assoc(the_PDU_Observable)
+Zlint::Zlint(IPDU_Observable *the_PDU_Observable) :
+ Z_Assoc(the_PDU_Observable)
{
m_PDU_Observable = the_PDU_Observable;
timeout(30);
}
-IYaz_PDU_Observer *Zlint::sessionNotify(
- IYaz_PDU_Observable *the_PDU_Observable, int fd)
+IPDU_Observer *Zlint::sessionNotify(
+ IPDU_Observable *the_PDU_Observable, int fd)
{
return 0;
}
* Copyright (c) 2004, Index Data.
* See the file LICENSE for details.
*
- * $Id: zlint.h,v 1.2 2005-06-02 06:40:21 adam Exp $
+ * $Id: zlint.h,v 1.3 2005-06-08 13:28:06 adam Exp $
*/
#include <yaz++/z-assoc.h>
class Zlint_test;
class Zlint_t;
-class Zlint : public Yaz_Z_Assoc {
+class Zlint : public Z_Assoc {
public:
- Zlint(IYaz_PDU_Observable *the_PDU_Observable);
+ Zlint(IPDU_Observable *the_PDU_Observable);
~Zlint();
void add_test(Zlint_test *i);
void set_host(const char *cp);
void timeoutNotify();
void failNotify();
void recv_GDU(Z_GDU *apdu, int len);
- IYaz_PDU_Observable *m_PDU_Observable;
- IYaz_PDU_Observer *sessionNotify(
- IYaz_PDU_Observable *the_PDU_Observable, int fd);
+ IPDU_Observable *m_PDU_Observable;
+ IPDU_Observer *sessionNotify(IPDU_Observable *the_PDU_Observable, int fd);
Zlint_t *m_tests;
Zlint_t *m_cur_test;
char *m_host;