This class implements the IYazSocketObservable interface and is a portable socket wrapper around the select call. This implementation is useful for daemons, command line clients, etc.
#include <yaz++/socket-manager.h> class Yaz_SocketManager : public IYazSocketObservable { 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 processEvent(); Yaz_SocketManager(); virtual ~Yaz_SocketManager(); }; |
This class implements the interfaces IYaz_PDU_Observable and IYazSocketObserver. This object implements a non-blocking client/server channel that transmits BER encoded PDUs (or those offered by YAZ COMSTACK).
#include <yaz++/pdu-assoc.h> class Yaz_PDU_Assoc : public IYaz_PDU_Observable, IYazSocketObserver { 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); }; |
This class implements the interface IYaz_PDU_Obserer. This object implements a Z39.50 client/server channel AKA Z-Association.
#include <yaz++/z-assoc.h> class 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 association 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(); }; |
This object is just a specialization of Yaz_Z_Assoc and provides more facilities for the Z39.50 client role.
#include <yaz++/ir-assoc.h> class Yaz_IR_Assoc : public Yaz_Z_Assoc { ... }; |
The example client, yaz-my-client.cpp, uses this class.
This object is just a specialization of Yaz_Z_Assoc and provides more facilities for the Z39.50 server role.
#include <yaz++/z-server.h> class Yaz_Z_Server : public Yaz_Z_Server { ... }; |
The example server, yaz-my-server.cpp, uses this class.
This object is a specialization of Yaz_Z_Assoc and implements the YAZ proxy.
#include <yaz++/proxy.h> class Yaz_Proxy : public Yaz_Z_Server { ... }; |
The proxy server, yaz-proxy-main.cpp, uses this class.