Add the anonymous_map hasmap to the config struct.

Michael
This commit is contained in:
Michael Adam 2009-12-07 00:06:50 +01:00
parent fa073543c4
commit d0a91c2f9b
2 changed files with 14 additions and 10 deletions

View File

@ -27,11 +27,9 @@
#include "heap.h" #include "heap.h"
#include "log.h" #include "log.h"
static hashmap_t anonymous_map = NULL;
short int is_anonymous_enabled (void) short int is_anonymous_enabled (void)
{ {
return (anonymous_map != NULL) ? 1 : 0; return (config.anonymous_map != NULL) ? 1 : 0;
} }
/* /*
@ -41,9 +39,9 @@ short int is_anonymous_enabled (void)
int anonymous_search (const char *s) int anonymous_search (const char *s)
{ {
assert (s != NULL); assert (s != NULL);
assert (anonymous_map != NULL); assert (config.anonymous_map != NULL);
return hashmap_search (anonymous_map, s); return hashmap_search (config.anonymous_map, s);
} }
/* /*
@ -58,17 +56,17 @@ int anonymous_insert (const char *s)
assert (s != NULL); assert (s != NULL);
if (!anonymous_map) { if (!config.anonymous_map) {
anonymous_map = hashmap_create (32); config.anonymous_map = hashmap_create (32);
if (!anonymous_map) if (!config.anonymous_map)
return -1; return -1;
} }
if (hashmap_search (anonymous_map, s) > 0) { if (hashmap_search (config.anonymous_map, s) > 0) {
/* The key was already found, so return a positive number. */ /* The key was already found, so return a positive number. */
return 0; return 0;
} }
/* Insert the new key */ /* Insert the new key */
return hashmap_insert (anonymous_map, s, &data, sizeof (data)); return hashmap_insert (config.anonymous_map, s, &data, sizeof (data));
} }

View File

@ -96,6 +96,12 @@ struct config_s {
* Store the list of port allowed by CONNECT. * Store the list of port allowed by CONNECT.
*/ */
vector_t connect_ports; vector_t connect_ports;
/*
* Map of headers which should be let through when the
* anonymous feature is turned on.
*/
hashmap_t anonymous_map;
}; };
/* Global Structures used in the program */ /* Global Structures used in the program */