]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/test_cache_digest.cc
Renamed squid.h to squid-old.h and config.h to squid.h
[thirdparty/squid.git] / src / test_cache_digest.cc
index 459813fc2bb2d02c3dee7713ea8a9825a7c1b72c..3498eedcef841ff10fbc9d2c7a307e50938f1c6e 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: test_cache_digest.cc,v 1.33 2004/12/20 16:30:36 robertc Exp $
+ * $Id$
  *
  * AUTHOR: Alex Rousskov
  *
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
- *  
+ *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
- *  
+ *
  *  You should have received a copy of the GNU General Public License
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
  * Test-suite for playing with cache digests
  */
 
-#include "squid.h"
+#include "squid-old.h"
 
-typedef struct
-{
+typedef struct {
     int query_count;
     int true_hit_count;
     int true_miss_count;
     int false_hit_count;
     int false_miss_count;
-}
-
-CacheQueryStats;
+} CacheQueryStats;
 
 typedef struct _Cache Cache;
 
-struct _Cache
-{
+struct _Cache {
     const char *name;
     hash_table *hash;
     CacheDigest *digest;
@@ -65,27 +61,21 @@ struct _Cache
 };
 
 
-typedef struct _CacheEntry
-{
+typedef struct _CacheEntry {
     const cache_key *key;
 
     struct _CacheEntry *next;
-    unsigned char key_arr[MD5_DIGEST_CHARS];
+    unsigned char key_arr[SQUID_MD5_DIGEST_LENGTH];
     /* storeSwapLogData s; */
-}
-
-CacheEntry;
+} CacheEntry;
 
 /* parsed access log entry */
 
-typedef struct
-{
-    cache_key key[MD5_DIGEST_CHARS];
+typedef struct {
+    cache_key key[SQUID_MD5_DIGEST_LENGTH];
     time_t timestamp;
     short int use_icp;         /* true/false */
-}
-
-RawAccessLogEntry;
+} RawAccessLogEntry;
 
 typedef enum {
     frError = -2, frMore = -1, frEof = 0, frOk = 1
@@ -94,8 +84,7 @@ typedef enum {
 typedef struct _FileIterator FileIterator;
 typedef fr_result(*FI_READER) (FileIterator * fi);
 
-struct _FileIterator
-{
+struct _FileIterator {
     const char *fname;
     FILE *file;
     time_t inner_time;         /* timestamp of the current entry */
@@ -111,20 +100,19 @@ struct _FileIterator
 static time_t cur_time = -1;   /* timestamp of the current log entry */
 
 /* copied from url.c */
-const char *RequestMethodStr[] =
-    {
-        "NONE",
-        "GET",
-        "POST",
-        "PUT",
-        "HEAD",
-        "CONNECT",
-        "TRACE",
-        "PURGE"
-    };
+const char *RequestMethodStr[] = {
+    "NONE",
+    "GET",
+    "POST",
+    "PUT",
+    "HEAD",
+    "CONNECT",
+    "TRACE",
+    "PURGE"
+};
 
 /* copied from url.c */
-static method_t
+static HttpRequestMethod
 methodStrToId(const char *s)
 {
     if (strcasecmp(s, "GET") == 0) {
@@ -237,7 +225,7 @@ cacheEntryCreate(const storeSwapLogData * s)
     CacheEntry *e = (CacheEntry *)xcalloc(1, sizeof(CacheEntry));
     assert(s);
     /* e->s = *s; */
-    xmemcpy(e->key_arr, s->key, MD5_DIGEST_CHARS);
+    memcpy(e->key_arr, s->key, SQUID_MD5_DIGEST_LENGTH);
     e->key = &e->key_arr[0];
     return e;
 }
@@ -431,7 +419,7 @@ accessLogReader(FileIterator * fi)
     RawAccessLogEntry *entry;
     char *url;
     char *method;
-    method_t method_id = METHOD_NONE;
+    HttpRequestMethod method_id = METHOD_NONE;
     char *hier = NULL;
 
     assert(fi);
@@ -503,7 +491,7 @@ accessLogReader(FileIterator * fi)
      * strcmp(hier, "SSL_PARENT_MISS") &&
      * strcmp(hier, "DEFAULT_PARENT");
      */
-    xmemcpy(entry->key, storeKeyPublic(url, method_id), sizeof(entry->key));
+    memcpy(entry->key, storeKeyPublic(url, method_id), sizeof(entry->key));
 
     /*fprintf(stdout, "%s:%d: %s %s %s %s\n",
      * fname, count, method, storeKeyText(entry->key), url, hier); */