-/* $Id: proxy.h,v 1.13 2005-02-21 14:27:32 adam Exp $
+/* $Id: proxy.h,v 1.20 2005-06-10 22:54:22 adam Exp $
Copyright (c) 1998-2005, Index Data.
This file is part of the yaz-proxy.
#ifndef YAZ_PROXY_H_INCLUDED
#define YAZ_PROXY_H_INCLUDED
+#include <yaz++/socket-observer.h>
#include <yaz++/z-assoc.h>
#include <yaz++/z-query.h>
#include <yaz++/z-databases.h>
class Yaz_usemarcon;
class Yaz_ProxyConfig;
class Yaz_ProxyClient;
+class Yaz_CharsetConverter;
+
+enum YAZ_Proxy_MARCXML_mode {
+ none,
+ marcxml,
+};
+
+class Msg_Thread;
/// Information Retrieval Proxy Server.
-class YAZ_EXPORT Yaz_Proxy : public Yaz_Z_Assoc {
+class YAZ_EXPORT Yaz_Proxy : public yazpp_1::Z_Assoc {
+ friend class Proxy_Msg;
private:
+ int m_ref_count;
char *get_cookie(Z_OtherInformation **otherInfo);
char *get_proxy(Z_OtherInformation **otherInfo);
void get_charset_and_lang_negotiation(Z_OtherInformation **otherInfo,
const char *proxy_host);
void srw_get_client(const char *db, const char **backend_db);
Z_APDU *result_set_optimize(Z_APDU *apdu);
- void shutdown();
void releaseClient();
Yaz_ProxyClient *m_client;
- IYaz_PDU_Observable *m_PDU_Observable;
+ yazpp_1::IPDU_Observable *m_PDU_Observable;
+ yazpp_1::ISocketObservable *m_socket_observable;
Yaz_ProxyClient *m_clientPool;
Yaz_Proxy *m_parent;
int m_seqno;
Z_GDU *m_bw_hold_PDU;
int m_max_record_retrieve;
void handle_max_record_retrieve(Z_APDU *apdu);
- int handle_authentication(Z_APDU *apdu);
void display_diagrecs(Z_DiagRec **pp, int num);
Z_Records *create_nonSurrogateDiagnostics(ODR o, int error,
const char *addinfo);
Z_APDU *handle_query_validation(Z_APDU *apdu);
Z_APDU *handle_query_transformation(Z_APDU *apdu);
+ Z_APDU *handle_target_charset_conversion(Z_APDU *apdu);
Z_APDU *handle_syntax_validation(Z_APDU *apdu);
Yaz_ProxyConfig *check_reconfigure();
int m_request_no;
int m_invalid_session;
- int m_marcxml_flag;
+ YAZ_Proxy_MARCXML_mode m_marcxml_mode;
void *m_stylesheet_xsp; // Really libxslt's xsltStylesheetPtr
int m_stylesheet_offset;
Z_APDU *m_stylesheet_apdu;
int m_frontend_type;
void convert_to_frontend_type(Z_NamePlusRecordList *p);
void convert_to_marcxml(Z_NamePlusRecordList *p, const char *charset);
+ void convert_records_charset(Z_NamePlusRecordList *p, const char *charset);
int convert_xsl(Z_NamePlusRecordList *p, Z_APDU *apdu);
void convert_xsl_delay();
Z_APDU *m_initRequest_apdu;
Z_DefaultDiagFormat *ddf);
int m_http_keepalive;
const char *m_http_version;
- Yaz_cql2rpn m_cql2rpn;
+ yazpp_1::Yaz_cql2rpn m_cql2rpn;
void *m_time_tv;
void logtime();
Z_ElementSetNames *mk_esn_from_schema(ODR o, const char *schema);
Z_ReferenceId *m_referenceId;
NMEM m_referenceId_mem;
+
#define NO_SPARE_SOLARIS_FD 10
int m_lo_fd[NO_SPARE_SOLARIS_FD];
void low_socket_open();
char *m_usemarcon_ini_stage1;
char *m_usemarcon_ini_stage2;
Yaz_usemarcon *m_usemarcon;
+ Yaz_CharsetConverter *m_charset_converter;
public:
- Yaz_Proxy(IYaz_PDU_Observable *the_PDU_Observable,
+ Yaz_Proxy(yazpp_1::IPDU_Observable *the_PDU_Observable,
+ yazpp_1::ISocketObservable *the_socket_observable,
Yaz_Proxy *parent = 0);
~Yaz_Proxy();
+
+
+ void inc_ref();
+ bool dec_ref();
+
+
+ int handle_authentication(Z_APDU *apdu);
+ void result_authentication(Z_APDU *apdu, int ret);
+ void handle_init(Z_APDU *apdu);
void inc_request_no();
void recv_GDU(Z_GDU *apdu, int len);
void handle_incoming_HTTP(Z_HTTP_Request *req);
void handle_incoming_Z_PDU(Z_APDU *apdu);
- IYaz_PDU_Observer* sessionNotify
- (IYaz_PDU_Observable *the_PDU_Observable, int fd);
+ void handle_incoming_Z_PDU_2(Z_APDU *apdu);
+ IPDU_Observer *sessionNotify(yazpp_1::IPDU_Observable *the_PDU_Observable,
+ int fd);
void failNotify();
void timeoutNotify();
void connectNotify();
const char *option(const char *name, const char *value);
void set_default_target(const char *target);
void set_proxy_negotiation (const char *charset, const char *lang);
+ void set_target_charset(const char *charset);
char *get_proxy_target() { return m_proxyTarget; };
char *get_session_str() { return m_session_str; };
void set_max_clients(int m) { m_max_clients = m; };
int get_log_mask() { return m_log_mask; };
int handle_init_response_for_invalid_session(Z_APDU *apdu);
void set_debug_mode(int mode);
+ Msg_Thread *m_my_thread;
};
#endif