Yaz_ProxyModules keeps track of number of open modules.
[yazproxy-moved-to-github.git] / src / yaz-proxy-main.cpp
index e64b4c9..b8a26d1 100644 (file)
@@ -1,5 +1,5 @@
-/* $Id: yaz-proxy-main.cpp,v 1.7 2004-12-13 20:52:33 adam Exp $
-   Copyright (c) 1998-2004, Index Data.
+/* $Id: yaz-proxy-main.cpp,v 1.15 2005-06-08 13:29:03 adam Exp $
+   Copyright (c) 1998-2005, Index Data.
 
 This file is part of the yaz-proxy.
 
@@ -19,20 +19,28 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 02111-1307, USA.
  */
 
-#ifdef WIN32
-#else
 #include <signal.h>
+#if HAVE_UNISTD_H
 #include <unistd.h>
-#include <pwd.h>
 #endif
+#if HAVE_SYS_TYPES_H
 #include <sys/types.h>
-
-#include <stdarg.h>
-
-#if HAVE_GETRLIMIT
+#endif
+#if HAVE_SYS_TIME_H
 #include <sys/time.h>
+#endif
+#if HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
+#if HAVE_SYS_RESOURCE_H
 #include <sys/resource.h>
 #endif
+#if HAVE_PWD_H
+#include <pwd.h>
+#endif
+
+#include <stdarg.h>
+#include <stdlib.h>
 
 #include <yaz/log.h>
 #include <yaz/options.h>
@@ -48,6 +56,8 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include <libxslt/transform.h>
 #endif
 
+using namespace yazpp_1;
+
 void usage(char *prog)
 {
     fprintf (stderr, "%s: [-c config] [-l log] [-a log] [-v level] [-t target] "
@@ -68,7 +78,7 @@ int args(Yaz_Proxy *proxy, int argc, char **argv)
     char *prog = argv[0];
     int ret;
 
-    while ((ret = options("o:a:t:v:c:u:i:m:l:T:p:U:n:X",
+    while ((ret = options("o:a:t:v:c:u:i:m:l:T:p:n:X",
                          argv, argc, &arg)) != -2)
     {
        int err;
@@ -86,7 +96,7 @@ int args(Yaz_Proxy *proxy, int argc, char **argv)
            err = proxy->set_config(arg);
            if (err == -2)
            {
-               fprintf(stderr, "Config file support not enabled (proxy not compiled with libxml2 support)\n");
+               fprintf(stderr, "Config file support not enabled (not using libxslt & libxml2)\n");
                exit(1);
            }
            else if (err == -1)
@@ -101,9 +111,6 @@ int args(Yaz_Proxy *proxy, int argc, char **argv)
         case 't':
            proxy->set_default_target(arg);
            break;
-        case 'U':
-            proxy->set_proxy_authentication(arg);
-            break;
         case 'o':
            proxy->option("optimize", arg);
            break;
@@ -127,6 +134,7 @@ int args(Yaz_Proxy *proxy, int argc, char **argv)
            no_limit_files = atoi(arg);
            break;
        case 'X':
+           proxy->set_debug_mode(1);
            debug = 1;
            break;
        case 'p':
@@ -188,7 +196,7 @@ static void proxy_xml_error_handler(void *ctx, const char *fmt, ...)
 }
 #endif
 
-static void child_run(Yaz_SocketManager *m, int run)
+static void child_run(SocketManager *m, int run)
 {
 #ifdef WIN32
 #else
@@ -276,8 +284,8 @@ int main(int argc, char **argv)
 #endif
     int cont = 1;
     int run = 1;
-    Yaz_SocketManager mySocketManager;
-    Yaz_Proxy proxy(new Yaz_PDU_Assoc(&mySocketManager));
+    SocketManager mySocketManager;
+    Yaz_Proxy proxy(new PDU_Assoc(&mySocketManager), &mySocketManager);
 
     static_yaz_proxy = &proxy;