Allow client-ip to be logged for each log entry. Speciy
[yazproxy-moved-to-github.git] / src / yaz-proxy-main.cpp
index 01209d3..75d31bc 100644 (file)
@@ -1,7 +1,7 @@
-/* $Id: yaz-proxy-main.cpp,v 1.16 2005-06-25 15:58:33 adam Exp $
-   Copyright (c) 1998-2005, Index Data.
+/* $Id: yaz-proxy-main.cpp,v 1.19 2006-03-30 10:32:16 adam Exp $
+   Copyright (c) 1998-2006, Index Data.
 
-This file is part of the yaz-proxy.
+This file is part of the yazproxy.
 
 YAZ proxy is free software; you can redistribute it and/or modify it under
 the terms of the GNU General Public License as published by the Free
@@ -45,8 +45,8 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include <yaz/log.h>
 #include <yaz/options.h>
 
-#include <yaz++/socket-manager.h>
-#include <yaz++/pdu-assoc.h>
+#include <yazpp/socket-manager.h>
+#include <yazpp/pdu-assoc.h>
 #include <yazproxy/proxy.h>
 
 #if HAVE_XSLT
@@ -60,8 +60,10 @@ using namespace yazpp_1;
 
 void usage(char *prog)
 {
-    fprintf (stderr, "%s: [-c config] [-l log] [-a log] [-v level] [-t target] "
-             "[-u uid] [-p pidfile] @:port\n", prog);
+    fprintf (stderr, "%s: [-a log] [-c config]\n"
+             " [-i sec] [-l log] [-m num] [-n num] [-p pidfile]"
+             " [-t target] [-T sec] [-u uid]\n"
+             " [-v level] [-X] @:port\n", prog);
     exit (1);
 }
 
@@ -92,6 +94,9 @@ int args(Yaz_Proxy *proxy, int argc, char **argv)
             }
             addr = arg;
             break;
+        case 'a':
+            proxy->set_APDU_log(arg);
+            break;
         case 'c':
             err = proxy->set_config(arg);
             if (err == -2)
@@ -105,17 +110,8 @@ int args(Yaz_Proxy *proxy, int argc, char **argv)
                 exit(1);
             }
             break;
-        case 'a':
-            proxy->set_APDU_log(arg);
-            break;
-        case 't':
-            proxy->set_default_target(arg);
-            break;
-        case 'o':
-            proxy->option("optimize", arg);
-            break;
-        case 'v':
-            yaz_log_init_level (yaz_log_mask_str(arg));
+        case 'i':
+            proxy->set_client_idletime(atoi(arg));
             break;
         case 'l':
             yaz_log_init_file (arg);
@@ -124,27 +120,33 @@ int args(Yaz_Proxy *proxy, int argc, char **argv)
         case 'm':
             proxy->set_max_clients(atoi(arg));
             break;
-        case 'i':
-            proxy->set_client_idletime(atoi(arg));
-            break;
-        case 'T':
-            proxy->set_target_idletime(atoi(arg));
-            break;
         case 'n':
             no_limit_files = atoi(arg);
             break;
-        case 'X':
-            proxy->set_debug_mode(1);
-            debug = 1;
+        case 'o':
+            proxy->option("optimize", arg);
             break;
         case 'p':
             if (!pid_fname)
                 pid_fname = xstrdup(arg);
             break;
+        case 't':
+            proxy->set_default_target(arg);
+            break;
+        case 'T':
+            proxy->set_target_idletime(atoi(arg));
+            break;
         case 'u':
             if (!uid)
                 uid = xstrdup(arg);
             break;
+        case 'v':
+            yaz_log_init_level (yaz_log_mask_str(arg));
+            break;
+        case 'X':
+            proxy->set_debug_mode(1);
+            debug = 1;
+            break;
         default:
             usage(prog);
             return 1;