From: Adam Dickmeiss Date: Tue, 30 Mar 2004 18:14:13 +0000 (+0000) Subject: WIN32 updates X-Git-Tag: YAZPP.0.8~29 X-Git-Url: http://jsfdemo.indexdata.com/cgi-bin?a=commitdiff_plain;h=2193539b01eb9b085af2c2c3e4aa18fe4ae4c5f7;p=yazpp-moved-to-github.git WIN32 updates --- diff --git a/include/yaz++/proxy/proxy.h b/include/yaz++/proxy/proxy.h index 06b33e4..764be3d 100644 --- a/include/yaz++/proxy/proxy.h +++ b/include/yaz++/proxy/proxy.h @@ -1,4 +1,4 @@ -/* $Id: proxy.h,v 1.2 2004-03-30 09:05:53 adam Exp $ +/* $Id: proxy.h,v 1.3 2004-03-30 18:14:13 adam Exp $ Copyright (c) 1998-2004, Index Data. This file is part of the yaz-proxy. @@ -19,7 +19,9 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#if HAVE_GETTIMEOFDAY #include +#endif #include #include #include @@ -277,7 +279,9 @@ class YAZ_EXPORT Yaz_Proxy : public Yaz_Z_Assoc { int m_http_keepalive; const char *m_http_version; Yaz_cql2rpn m_cql2rpn; +#if HAVE_GETTIMEOFDAY struct timeval m_time_tv; +#endif void logtime(); Z_ElementSetNames *mk_esn_from_schema(ODR o, const char *schema); Z_ReferenceId *m_referenceId; diff --git a/proxy/yaz-proxy-main.cpp b/proxy/yaz-proxy-main.cpp index 645dc8b..fece3b3 100644 --- a/proxy/yaz-proxy-main.cpp +++ b/proxy/yaz-proxy-main.cpp @@ -1,4 +1,4 @@ -/* $Id: yaz-proxy-main.cpp,v 1.1 2004-03-29 22:48:31 adam Exp $ +/* $Id: yaz-proxy-main.cpp,v 1.2 2004-03-30 18:14:13 adam Exp $ Copyright (c) 1998-2004, Index Data. This file is part of the yaz-proxy. @@ -19,10 +19,14 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifdef WIN32 +#else #include #include #include +#endif #include + #include #if HAVE_GETRLIMIT @@ -150,7 +154,10 @@ int args(Yaz_Proxy *proxy, int argc, char **argv) static Yaz_Proxy *static_yaz_proxy = 0; static void sighup_handler(int num) { +#if WIN32 +#else signal(SIGHUP, sighup_handler); +#endif if (static_yaz_proxy) static_yaz_proxy->reconfig(); } @@ -163,8 +170,11 @@ static void proxy_xml_error_handler(void *ctx, const char *fmt, ...) va_list ap; va_start(ap, fmt); +#ifdef WIN32 + vsprintf(buf, fmt, ap); +#else vsnprintf(buf, sizeof(buf), fmt, ap); - +#endif yaz_log(LOG_WARN, "%s: %s", (char*) ctx, buf); va_end (ap); @@ -173,14 +183,19 @@ static void proxy_xml_error_handler(void *ctx, const char *fmt, ...) static void child_run(Yaz_SocketManager *m, int run) { +#ifdef WIN32 +#else signal(SIGHUP, sighup_handler); +#endif #if HAVE_XSLT xmlSetGenericErrorFunc((void *) "XML", proxy_xml_error_handler); xsltSetGenericErrorFunc((void *) "XSLT", proxy_xml_error_handler); #endif +#ifdef WIN32 +#else yaz_log(LOG_LOG, "0 proxy run=%d pid=%ld", run, (long) getpid()); - +#endif if (no_limit_files) { #if HAVE_SETRLIMIT @@ -196,6 +211,8 @@ static void child_run(Yaz_SocketManager *m, int run) yaz_log(LOG_WARN, "setrlimit unavablable. Option -n ignored"); #endif } +#ifdef WIN32 +#else if (pid_fname) { FILE *f = fopen(pid_fname, "w"); @@ -229,6 +246,7 @@ static void child_run(Yaz_SocketManager *m, int run) } xfree(uid); } +#endif #if HAVE_GETRLIMIT struct rlimit limit_data; getrlimit(RLIMIT_NOFILE, &limit_data); @@ -258,6 +276,9 @@ int main(int argc, char **argv) args(&proxy, argc, argv); +#ifdef WIN32 + child_run(&mySocketManager, run); +#else if (debug) { child_run(&mySocketManager, run); @@ -327,6 +348,7 @@ int main(int argc, char **argv) sleep(1 + run/5); run++; } +#endif exit (0); return 0; } diff --git a/proxy/yaz-proxy.cpp b/proxy/yaz-proxy.cpp index 25cd9c2..c4db080 100644 --- a/proxy/yaz-proxy.cpp +++ b/proxy/yaz-proxy.cpp @@ -1,4 +1,4 @@ -/* $Id: yaz-proxy.cpp,v 1.3 2004-03-30 14:25:41 adam Exp $ +/* $Id: yaz-proxy.cpp,v 1.4 2004-03-30 18:14:13 adam Exp $ Copyright (c) 1998-2004, Index Data. This file is part of the yaz-proxy. @@ -19,7 +19,11 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifdef WIN32 +#else #include +#endif + #include #include #include @@ -143,8 +147,10 @@ Yaz_Proxy::Yaz_Proxy(IYaz_PDU_Observable *the_PDU_Observable, m_http_version = 0; m_soap_ns = 0; m_s2z_packing = Z_SRW_recordPacking_string; +#if HAVE_GETTIMEOFDAY m_time_tv.tv_sec = 0; m_time_tv.tv_usec = 0; +#endif if (!m_parent) low_socket_open(); } @@ -737,6 +743,7 @@ void Yaz_Proxy::convert_to_marcxml(Z_NamePlusRecordList *p) void Yaz_Proxy::logtime() { +#if HAVE_GETTIMEOFDAY if (m_time_tv.tv_sec) { struct timeval tv; @@ -749,6 +756,7 @@ void Yaz_Proxy::logtime() } m_time_tv.tv_sec = 0; m_time_tv.tv_usec = 0; +#endif } int Yaz_Proxy::send_http_response(int code) @@ -1399,7 +1407,9 @@ void Yaz_Proxy::recv_GDU(Z_GDU *apdu, int len) m_bw_stat.add_bytes(len); m_pdu_stat.add_bytes(1); +#if HAVE_GETTIMEOFDAY gettimeofday(&m_time_tv, 0); +#endif int bw_total = m_bw_stat.get_total(); int pdu_total = m_pdu_stat.get_total(); @@ -2571,17 +2581,23 @@ void Yaz_ProxyClient::recv_Z_PDU(Z_APDU *apdu, int len) void Yaz_Proxy::low_socket_close() { +#if WIN32 +#else int i; for (i = 0; i= 0) ::close(m_lo_fd[i]); +#endif } void Yaz_Proxy::low_socket_open() { +#if WIN32 +#else int i; for (i = 0; i @@ -153,7 +153,7 @@ void Yaz_IR_Assoc::get_elementSetName (const char **elementSetName) void Yaz_IR_Assoc::recv_GDU(Z_GDU *apdu, int len) { if (apdu->which == Z_GDU_Z3950) - return recv_Z_PDU(apdu->u.z3950, len); + recv_Z_PDU(apdu->u.z3950, len); } void Yaz_IR_Assoc::recv_Z_PDU(Z_APDU *apdu, int len) diff --git a/src/yaz-z-server.cpp b/src/yaz-z-server.cpp index 99ef2db..cc78d55 100644 --- a/src/yaz-z-server.cpp +++ b/src/yaz-z-server.cpp @@ -2,7 +2,7 @@ * Copyright (c) 2000-2003, Index Data. * See the file LICENSE for details. * - * $Id: yaz-z-server.cpp,v 1.17 2003-12-16 14:17:01 adam Exp $ + * $Id: yaz-z-server.cpp,v 1.18 2004-03-30 18:14:13 adam Exp $ */ #include @@ -51,7 +51,7 @@ void Yaz_Z_Server::facility_add(IYaz_Server_Facility *facility, void Yaz_Z_Server::recv_GDU (Z_GDU *apdu, int len) { if (apdu->which == Z_GDU_Z3950) - return recv_Z_PDU(apdu->u.z3950, len); + recv_Z_PDU(apdu->u.z3950, len); else delete this; } diff --git a/win/makefile b/win/makefile index bff38de..4964865 100644 --- a/win/makefile +++ b/win/makefile @@ -1,6 +1,6 @@ # Copyright (C) 1993-2004, Index Data ApS # All rights reserved. -# $Id: makefile,v 1.1 2004-03-30 17:42:25 adam Exp $ +# $Id: makefile,v 1.2 2004-03-30 18:14:14 adam Exp $ ########################################################### ############### Parameters @@ -31,7 +31,7 @@ ZLIB_DIR = c:\zlib-1.1.4.win32 default: all -all: dirs dll proxy iconv libxml2 libxslt +all: dirs dll proxy iconv libxml2 libxslt yaz NSIS="c:\program files\nsis\makensis-bz2.exe" @@ -81,6 +81,10 @@ proxy: $(YAZPROXY) YAZ_LIB="$(YAZ_DIR)\lib\yaz.lib" YAZ_DEF=/I"$(YAZ_DIR)\include" +yaz: $(BINDIR)\yaz.dll $(BINDIR)\yaz.dll + +$(BINDIR)\yaz.dll: $(YAZ_DIR)\bin\yaz.dll + copy "$(YAZ_DIR)\bin\yaz.dll" $(BINDIR) !if $(HAVE_ICONV) ICONV_DEF= \ @@ -240,7 +244,7 @@ YAZPP_DLL_OBJS = \ YAZPROXY_DLL_OBJS = \ "$(OBJDIR)\yaz-proxy.obj" \ "$(OBJDIR)\yaz-proxy-config.obj" \ - "$(OBJDIR)\yaz-bw.obj + "$(OBJDIR)\yaz-bw.obj" ########################################################### ############### Compiling @@ -294,16 +298,17 @@ $(YAZPP_DLL) $(YAZPP_IMPLIB): "$(BINDIR)" $(YAZPP_DLL_OBJS) $(DLL_LINK_OPTIONS) $(YAZPP_DLL_OBJS) /out:"$(YAZPP_DLL)" - /implib:$(YAZPP_IMPLIB) + /implib:"$(YAZPP_IMPLIB)" /map:"$(LIBDIR)\yazpp.map" << -$(YAZPROXY_DLL) $(YAZPROXY_IMPLIB): "$(BINDIR)" $(YAZPROXY_DLL_OBJS) +$(YAZPROXY_DLL) $(YAZPROXY_IMPLIB): "$(BINDIR)" $(YAZPROXY_DLL_OBJS) $(YAZPP_IMPLIB) @echo Linking $(YAZPROXY_DLL) $(LINK) @<< $(LNKOPT) $(LINK_LIBS) $(DLL_LINK_OPTIONS) + $(YAZPP_IMPLIB) $(YAZPROXY_DLL_OBJS) /out:$(YAZPROXY_DLL) /implib:"$(YAZPROXY_IMPLIB)"