/*
- * $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;
};
-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
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 */
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) {
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;
}
RawAccessLogEntry *entry;
char *url;
char *method;
- method_t method_id = METHOD_NONE;
+ HttpRequestMethod method_id = METHOD_NONE;
char *hier = NULL;
assert(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); */