]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Added routines for parsing ICAP configuration directives.
authorwessels <>
Tue, 22 Nov 2005 06:10:22 +0000 (06:10 +0000)
committerwessels <>
Tue, 22 Nov 2005 06:10:22 +0000 (06:10 +0000)
src/ConfigParser.h
src/cache_cf.cc

index 78cd412bcc5c0cf7c67ef844e67d1d06019f5303..17f5d5068b74863a129ed3c1491d6c73e46bbbc5 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ConfigParser.h,v 1.1 2003/03/08 09:43:49 robertc Exp $
+ * $Id: ConfigParser.h,v 1.2 2005/11/21 23:10:22 wessels Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -41,6 +41,10 @@ class ConfigParser
 
 public:
     static void ParseUShort(u_short *var);
+    static void ParseBool(bool *var);
+    static void ParseString(char **var);
+    static void ParseString(String *var);
+    static void ParseWordList(wordlist **list);
 };
 
 #endif /* SQUID_CONFIGPARSER_H_ */
index 6ba72a80670c6b4e1be2abd042b2fc0f5d8c1ac0..2a982de1ef35d6e45ee8367deedfa47fab0e20c7 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: cache_cf.cc,v 1.485 2005/11/04 20:27:31 wessels Exp $
+ * $Id: cache_cf.cc,v 1.486 2005/11/21 23:10:22 wessels Exp $
  *
  * DEBUG: section 3     Configuration File Parsing
  * AUTHOR: Harvest Derived
 #include "ESIParser.h"
 #endif
 
+#if ICAP_CLIENT
+#include "ICAP/ICAPConfig.h"
+extern ICAPConfig TheICAPConfig;       // for cf_parser.h
+
+static void parse_icap_service_type(ICAPConfig *);
+static void dump_icap_service_type(StoreEntry *, const char *, ICAPConfig );
+static void free_icap_service_type(ICAPConfig *);
+static void parse_icap_class_type(ICAPConfig *);
+static void dump_icap_class_type(StoreEntry *, const char *, ICAPConfig );
+static void free_icap_class_type(ICAPConfig *);
+static void parse_icap_access_type(ICAPConfig *);
+static void dump_icap_access_type(StoreEntry *, const char *, ICAPConfig );
+static void free_icap_access_type(ICAPConfig *);
+
+#endif
+
 CBDATA_TYPE(peer);
 
 static const char *const T_SECOND_STR = "second";
@@ -80,9 +96,6 @@ static void dump_access_log(StoreEntry * entry, const char *name, customlog * de
 static void free_logformat(logformat ** definitions);
 static void free_access_log(customlog ** definitions);
 
-
-
-
 static void update_maxobjsize(void);
 static void configDoConfigure(void);
 static void parse_refreshpattern(refresh_t **);
@@ -1291,7 +1304,6 @@ free_http_header_replace(header_mangler header[])
 
 #endif
 
-
 static void
 dump_cachedir(StoreEntry * entry, const char *name, _SquidConfig::_cacheSwap swap)
 {
@@ -1307,7 +1319,6 @@ dump_cachedir(StoreEntry * entry, const char *name, _SquidConfig::_cacheSwap swa
     }
 }
 
-
 static int
 check_null_cachedir(_SquidConfig::_cacheSwap swap)
 {
@@ -1400,7 +1411,6 @@ parse_cachedir(_SquidConfig::_cacheSwap * swap)
     if ((path_str = strtok(NULL, w_space)) == NULL)
         self_destruct();
 
-
     fs = find_fstype(type_str);
 
     if (fs < 0)
@@ -2312,6 +2322,23 @@ parse_string(char **var)
     *var = xstrdup(token);
 }
 
+void
+ConfigParser::ParseString(char **var)
+{
+    parse_string(var);
+}
+
+void
+ConfigParser::ParseString(String *var)
+{
+    char *token = strtok(NULL, w_space);
+
+    if (token == NULL)
+        self_destruct();
+
+    var->reset(token);
+}
+
 static void
 free_string(char **var)
 {
@@ -2449,6 +2476,19 @@ ConfigParser::ParseUShort(u_short *var)
     *var = (u_short) i;
 }
 
+void
+ConfigParser::ParseBool(bool *var)
+{
+    int i = GetInteger();
+
+    if (0 == i)
+        *var = false;
+    else if (1 == i)
+        *var = true;
+    else
+        self_destruct();
+}
+
 static void
 dump_wordlist(StoreEntry * entry, const char *name, wordlist * list)
 {
@@ -2458,6 +2498,12 @@ dump_wordlist(StoreEntry * entry, const char *name, wordlist * list)
     }
 }
 
+void
+ConfigParser::ParseWordList(wordlist ** list)
+{
+    parse_wordlist(list);
+}
+
 void
 parse_wordlist(wordlist ** list)
 {
@@ -2506,7 +2552,6 @@ parse_uri_whitespace(int *var)
         self_destruct();
 }
 
-
 static void
 dump_uri_whitespace(StoreEntry * entry, const char *name, int var)
 {
@@ -2569,7 +2614,6 @@ dump_removalpolicy(StoreEntry * entry, const char *name, RemovalPolicySettings *
     storeAppendPrintf(entry, "\n");
 }
 
-
 #include "cf_parser.h"
 
 peer_t
@@ -2778,7 +2822,6 @@ cbdataFree_http_port(void *data)
     free_generic_http_port_data((http_port_list *)data);
 }
 
-
 static http_port_list *
 create_http_port(char *portspec)
 {
@@ -3310,3 +3353,61 @@ free_access_log(customlog ** definitions)
         xfree(log);
     }
 }
+
+#if ICAP_CLIENT
+
+static void
+parse_icap_service_type(ICAPConfig * cfg)
+{
+    cfg->parseICAPService();
+}
+
+static void
+free_icap_service_type(ICAPConfig * cfg)
+{
+    cfg->freeICAPService();
+}
+
+static void
+dump_icap_service_type(StoreEntry * entry, const char *name, ICAPConfig cfg)
+{
+    cfg.dumpICAPService(entry, name);
+}
+
+static void
+parse_icap_class_type(ICAPConfig * cfg)
+{
+    cfg->parseICAPClass();
+}
+
+static void
+free_icap_class_type(ICAPConfig * cfg)
+{
+    cfg->freeICAPClass();
+}
+
+static void
+dump_icap_class_type(StoreEntry * entry, const char *name, ICAPConfig cfg)
+{
+    cfg.dumpICAPClass(entry, name);
+}
+
+static void
+parse_icap_access_type(ICAPConfig * cfg)
+{
+    cfg->parseICAPAccess();
+}
+
+static void
+free_icap_access_type(ICAPConfig * cfg)
+{
+    cfg->freeICAPAccess();
+}
+
+static void
+dump_icap_access_type(StoreEntry * entry, const char *name, ICAPConfig cfg)
+{
+    cfg.dumpICAPAccess(entry, name);
+}
+
+#endif