-/* $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.
02111-1307, USA.
*/
+#if HAVE_GETTIMEOFDAY
#include <sys/time.h>
+#endif
#include <yaz++/z-assoc.h>
#include <yaz++/z-query.h>
#include <yaz++/z-databases.h>
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;
-/* $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.
02111-1307, USA.
*/
+#ifdef WIN32
+#else
#include <signal.h>
#include <unistd.h>
#include <pwd.h>
+#endif
#include <sys/types.h>
+
#include <stdarg.h>
#if HAVE_GETRLIMIT
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();
}
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);
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
yaz_log(LOG_WARN, "setrlimit unavablable. Option -n ignored");
#endif
}
+#ifdef WIN32
+#else
if (pid_fname)
{
FILE *f = fopen(pid_fname, "w");
}
xfree(uid);
}
+#endif
#if HAVE_GETRLIMIT
struct rlimit limit_data;
getrlimit(RLIMIT_NOFILE, &limit_data);
args(&proxy, argc, argv);
+#ifdef WIN32
+ child_run(&mySocketManager, run);
+#else
if (debug)
{
child_run(&mySocketManager, run);
sleep(1 + run/5);
run++;
}
+#endif
exit (0);
return 0;
}
-/* $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.
02111-1307, USA.
*/
+#ifdef WIN32
+#else
#include <unistd.h>
+#endif
+
#include <assert.h>
#include <time.h>
#include <sys/types.h>
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();
}
void Yaz_Proxy::logtime()
{
+#if HAVE_GETTIMEOFDAY
if (m_time_tv.tv_sec)
{
struct timeval tv;
}
m_time_tv.tv_sec = 0;
m_time_tv.tv_usec = 0;
+#endif
}
int Yaz_Proxy::send_http_response(int code)
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();
void Yaz_Proxy::low_socket_close()
{
+#if WIN32
+#else
int i;
for (i = 0; i<NO_SPARE_SOLARIS_FD; i++)
if (m_lo_fd[i] >= 0)
::close(m_lo_fd[i]);
+#endif
}
void Yaz_Proxy::low_socket_open()
{
+#if WIN32
+#else
int i;
for (i = 0; i<NO_SPARE_SOLARIS_FD; i++)
m_lo_fd[i] = open("/dev/null", O_RDONLY);
+#endif
}
int Yaz_Proxy::server(const char *addr)
int r = Yaz_Z_Assoc::server(addr);
if (!r)
{
- yaz_log(LOG_LOG, "%sStarted proxy " VERSION " on %s", m_session_str, addr);
+ yaz_log(LOG_LOG, "%sStarted proxy "
+#ifdef VERSION
+ VERSION
+#endif
+ " on %s", m_session_str, addr);
timeout(1);
}
return r;
* Copyright (c) 1998-2003, Index Data.
* See the file LICENSE for details.
*
- * $Id: yaz-ir-assoc.cpp,v 1.20 2003-12-16 14:17:01 adam Exp $
+ * $Id: yaz-ir-assoc.cpp,v 1.21 2004-03-30 18:14:13 adam Exp $
*/
#include <assert.h>
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)
* 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 <yaz/log.h>
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;
}
# 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
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"
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= \
YAZPROXY_DLL_OBJS = \
"$(OBJDIR)\yaz-proxy.obj" \
"$(OBJDIR)\yaz-proxy-config.obj" \
- "$(OBJDIR)\yaz-bw.obj
+ "$(OBJDIR)\yaz-bw.obj"
###########################################################
############### Compiling
$(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)"