Initial drop of dashboard instrumentation - enabled with
[privoxy.git] / src / loadcfg.c
index d4560c1..9772ef6 100644 (file)
@@ -1,4 +1,4 @@
-const char loadcfg_rcs[] = "$Id: loadcfg.c,v 2.2 2002/09/04 15:48:33 oes Exp $";
+const char loadcfg_rcs[] = "$Id: loadcfg.c,v 2.3 2002/09/19 03:48:29 iwanttokeepanon Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/src/loadcfg.c,v $
@@ -35,6 +35,9 @@ const char loadcfg_rcs[] = "$Id: loadcfg.c,v 2.2 2002/09/04 15:48:33 oes Exp $";
  *
  * Revisions   :
  *    $Log: loadcfg.c,v $
+ *    Revision 2.3  2002/09/19 03:48:29  iwanttokeepanon
+ *    Just moved "int i" up 3 lines in function unload_configfile, out of the "ifdef FEATURE_ACL" clause.  I disable ACL and it was not compiling because "int i" was ifdef(d) out.  I noticed this in the past, but am just now in a spot where I can change/commit stuff ... long live broadband!
+ *
  *    Revision 2.2  2002/09/04 15:48:33  oes
  *    Synced with the stable branch:
  *        Revision 1.48.2.1  2002/08/21 17:58:05  oes
@@ -421,42 +424,43 @@ static struct file_list *current_configfile = NULL;
  * console and GUI specific options last).
  */
 
-#define hash_actions_file              1196306641ul /**< "actionsfile" */
-#define hash_admin_address             4112573064ul /**< "admin-address" */
-#define hash_buffer_limit              1881726070ul /**< "buffer-limit */
-#define hash_confdir                      1978389ul /**< "confdir" */
-#define hash_debug                          78263ul /**< "debug" */
-#define hash_deny_access               1227333715ul /**< "deny-access" */
-#define hash_enable_edit_actions       2517097536ul /**< "enable-edit-actions" */
-#define hash_enable_remote_toggle      2979744683ul /**< "enable-remote-toggle" */
-#define hash_filterfile                 250887266ul /**< "filterfile" */
-#define hash_forward                      2029845ul /**< "forward" */
-#define hash_forward_socks4            3963965521ul /**< "forward-socks4" */
-#define hash_forward_socks4a           2639958518ul /**< "forward-socks4a" */
-#define hash_jarfile                      2046641ul /**< "jarfile" */
-#define hash_listen_address            1255650842ul /**< "listen-address" */
-#define hash_logdir                        422889ul /**< "logdir" */
-#define hash_logfile                      2114766ul /**< "logfile" */
-#define hash_permit_access             3587953268ul /**< "permit-access" */
-#define hash_proxy_info_url            3903079059ul /**< "proxy-info-url" */
-#define hash_single_threaded           4250084780ul /**< "single-threaded" */
-#define hash_suppress_blocklists       1948693308ul /**< "suppress-blocklists" */
-#define hash_toggle                        447966ul /**< "toggle" */
-#define hash_trust_info_url             430331967ul /**< "trust-info-url" */
-#define hash_trustfile                   56494766ul /**< "trustfile" */
-#define hash_usermanual                1416668518ul /**< "user-manual" */
-
-#define hash_activity_animation        1817904738ul /**< "activity-animation" */
-#define hash_close_button_minimizes    3651284693ul /**< "close-button-minimizes" */
-#define hash_hide_console              2048809870ul /**< "hide-console" */
-#define hash_log_buffer_size           2918070425ul /**< "log-buffer-size" */
-#define hash_log_font_name             2866730124ul /**< "log-font-name" */
-#define hash_log_font_size             2866731014ul /**< "log-font-size" */
-#define hash_log_highlight_messages    4032101240ul /**< "log-highlight-messages" */
-#define hash_log_max_lines             2868344173ul /**< "log-max-lines" */
-#define hash_log_messages              2291744899ul /**< "log-messages" */
-#define hash_show_on_task_bar           215410365ul /**< "show-on-task-bar" */
-
+#define hash_actions_file                  1196306641ul /**< "actionsfile" */
+#define hash_activity_console_address        18904208ul /**< "activity-console-address" */
+#define hash_activity_console_update_freq  3442780376ul /**< "activity-console-update-freq" */
+#define hash_admin_address                 4112573064ul /**< "admin-address" */
+#define hash_buffer_limit                  1881726070ul /**< "buffer-limit */
+#define hash_confdir                          1978389ul /**< "confdir" */
+#define hash_debug                              78263ul /**< "debug" */
+#define hash_deny_access                   1227333715ul /**< "deny-access" */
+#define hash_enable_edit_actions           2517097536ul /**< "enable-edit-actions" */
+#define hash_enable_remote_toggle          2979744683ul /**< "enable-remote-toggle" */
+#define hash_filterfile                     250887266ul /**< "filterfile" */
+#define hash_forward                          2029845ul /**< "forward" */
+#define hash_forward_socks4                3963965521ul /**< "forward-socks4" */
+#define hash_forward_socks4a               2639958518ul /**< "forward-socks4a" */
+#define hash_jarfile                          2046641ul /**< "jarfile" */
+#define hash_listen_address                1255650842ul /**< "listen-address" */
+#define hash_logdir                            422889ul /**< "logdir" */
+#define hash_logfile                          2114766ul /**< "logfile" */
+#define hash_permit_access                 3587953268ul /**< "permit-access" */
+#define hash_proxy_info_url                3903079059ul /**< "proxy-info-url" */
+#define hash_single_threaded               4250084780ul /**< "single-threaded" */
+#define hash_suppress_blocklists           1948693308ul /**< "suppress-blocklists" */
+#define hash_toggle                            447966ul /**< "toggle" */
+#define hash_trust_info_url                 430331967ul /**< "trust-info-url" */
+#define hash_trustfile                       56494766ul /**< "trustfile" */
+#define hash_usermanual                    1416668518ul /**< "user-manual" */
+
+#define hash_activity_animation            1817904738ul /**< "activity-animation" */
+#define hash_close_button_minimizes        3651284693ul /**< "close-button-minimizes" */
+#define hash_hide_console                  2048809870ul /**< "hide-console" */
+#define hash_log_buffer_size               2918070425ul /**< "log-buffer-size" */
+#define hash_log_font_name                 2866730124ul /**< "log-font-name" */
+#define hash_log_font_size                 2866731014ul /**< "log-font-size" */
+#define hash_log_highlight_messages        4032101240ul /**< "log-highlight-messages" */
+#define hash_log_max_lines                 2868344173ul /**< "log-max-lines" */
+#define hash_log_messages                  2291744899ul /**< "log-messages" */
+#define hash_show_on_task_bar               215410365ul /**< "show-on-task-bar" */
 
 static void savearg(char *command, char *argument, struct configuration_spec * config);
 
@@ -627,6 +631,10 @@ struct configuration_spec * load_config(void)
    config->buffer_limit      = 4096 * 1024;
    config->usermanual        = strdup(USER_MANUAL_URL);
    config->proxy_args        = strdup("");
+#ifdef FEATURE_ACTIVITY_CONSOLE
+   config->activity_port     = ACTIVTY_ADDR_PORT;
+   config->activity_freq     = 5;
+#endif /* def FEATURE_ACTIVITY_CONSOLE */
 
    if ((configfp = fopen(configfile, "r")) == NULL)
    {
@@ -717,6 +725,27 @@ struct configuration_spec * load_config(void)
             free(p);
             continue;
 
+/* *************************************************************************
+ * activity-console-address [ip][:port]
+ * *************************************************************************/
+#ifdef FEATURE_ACTIVITY_CONSOLE
+         case hash_activity_console_address :
+            freez(config->activity_address);
+            config->activity_address = strdup(arg);
+            continue;
+#endif /* def FEATURE_ACTIVITY_CONSOLE */
+
+/* *************************************************************************
+ * activity-console-update-freq
+ * *************************************************************************/
+#ifdef FEATURE_ACTIVITY_CONSOLE
+         case hash_activity_console_update_freq :
+            config->activity_freq = atoi(arg);
+            if (config->activity_freq < 1)
+              config->activity_freq = 5;
+            continue;
+#endif /* def FEATURE_ACTIVITY_CONSOLE */
+
 /* *************************************************************************
  * admin-address email-address
  * *************************************************************************/
@@ -1436,6 +1465,36 @@ struct configuration_spec * load_config(void)
    }
 #endif /* def FEATURE_COOKIE_JAR */
 
+#ifdef FEATURE_ACTIVITY_CONSOLE
+   if ( NULL == config->activity_address )
+   {
+      config->activity_address = strdup( ACTIVTY_ADDR_DEFAULT );
+   }
+
+   if ( NULL != config->activity_address )
+   {
+      if (NULL != (p = strchr(config->activity_address, ':')))
+      {
+         *p++ = '\0';
+         if (*p)
+         {
+            config->activity_port = atoi(p);
+         }
+      }
+
+      if (config->activity_port <= 0)
+      {
+         *--p = ':';
+         log_error(LOG_LEVEL_ERROR, "invalid activity port spec %s", config->activity_address);
+      }
+      if (*config->activity_address == '\0')
+      {
+         config->activity_address = NULL;
+      }
+   }
+   log_error(LOG_LEVEL_INFO, "Sending statistics updates to %s, port %d.", config->activity_address, config->activity_port);
+#endif /* def FEATURE_ACTIVITY_CONSOLE */
+
    if ( NULL == config->haddr )
    {
       config->haddr = strdup( HADDR_DEFAULT );