in delay_pools and ARP acl code.
/*
- * $Id: acl.cc,v 1.289 2002/10/13 20:34:57 robertc Exp $
+ * $Id: acl.cc,v 1.290 2002/10/13 23:48:23 hno Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
aclParseArpData(const char *t)
{
LOCAL_ARRAY(char, eth, 256);
- acl_arp_data *q = xcalloc(1, sizeof(acl_arp_data));
+ acl_arp_data *q = (acl_arp_data *)xcalloc(1, sizeof(acl_arp_data));
debug(28, 5) ("aclParseArpData: %s\n", t);
if (sscanf(t, "%[0-9a-fA-F:]", eth) != 1) {
debug(28, 0) ("aclParseArpData: Bad ethernet address: '%s'\n", t);
aclParseArpList(void *curlist)
{
char *t = NULL;
- splayNode **Top = curlist;
+ splayNode **Top = (splayNode **)curlist;
acl_arp_data *q = NULL;
while ((t = strtokFile())) {
if ((q = aclParseArpData(t)) == NULL)
struct ifconf ifc;
struct ifreq *ifr;
int offset;
- splayNode **Top = dataptr;
+ splayNode **Top = (splayNode **)dataptr;
/*
* The linux kernel 2.2 maintains per interface ARP caches and
* thus requires an interface name when doing ARP queries.
}
/* lookup list of interface names */
ifc.ifc_len = sizeof(ifbuffer);
- ifc.ifc_buf = ifbuffer;
+ ifc.ifc_buf = (char *)ifbuffer;
if (ioctl(HttpSockets[0], SIOCGIFCONF, &ifc) < 0) {
debug(28, 1) ("Attempt to retrieve interface list failed: %s\n",
xstrerror());
return 0;
}
- if (ifc.ifc_len > sizeof(ifbuffer)) {
+ if (ifc.ifc_len > (int)sizeof(ifbuffer)) {
debug(28, 1) ("Interface list too long - %d\n", ifc.ifc_len);
return 0;
}
aclArpCompare(const void *a, const void *b)
{
#if defined(_SQUID_LINUX_)
- const unsigned short *d1 = a;
- const unsigned short *d2 = b;
+ const unsigned short *d1 = (const unsigned short *)a;
+ const unsigned short *d2 = (const unsigned short *)b;
if (d1[0] != d2[0])
return (d1[0] > d2[0]) ? 1 : -1;
if (d1[1] != d2[1])
if (d1[2] != d2[2])
return (d1[2] > d2[2]) ? 1 : -1;
#elif defined(_SQUID_SOLARIS_)
- const unsigned char *d1 = a;
- const unsigned char *d2 = b;
+ const unsigned char *d1 = (const unsigned char *)a;
+ const unsigned char *d2 = (const unsigned char *)b;
if (d1[0] != d2[0])
return (d1[0] > d2[0]) ? 1 : -1;
if (d1[1] != d2[1])
static void
aclDumpArpListWalkee(void *node, void *state)
{
- acl_arp_data *arp = node;
- wordlist **W = state;
+ acl_arp_data *arp = (acl_arp_data *)node;
static char buf[24];
- while (*W != NULL)
- W = &(*W)->next;
snprintf(buf, sizeof(buf), "%02x:%02x:%02x:%02x:%02x:%02x",
arp->eth[0], arp->eth[1], arp->eth[2], arp->eth[3],
arp->eth[4], arp->eth[5]);
- wordlistAdd(state, buf);
+ wordlistAdd((wordlist **)state, buf);
}
static wordlist *
aclDumpArpList(void *data)
{
wordlist *w = NULL;
- splay_walk(data, aclDumpArpListWalkee, &w);
+ splay_walk((splayNode *)data, aclDumpArpListWalkee, &w);
return w;
}
/*
- * $Id: cache_cf.cc,v 1.417 2002/10/13 20:34:58 robertc Exp $
+ * $Id: cache_cf.cc,v 1.418 2002/10/13 23:48:23 hno Exp $
*
* DEBUG: section 3 Configuration File Parsing
* AUTHOR: Harvest Derived
if (!cfg->pools)
return;
for (i = 0; i < cfg->pools; i++) {
- if (cfg->class[i]) {
+ if (cfg->delay_class[i]) {
delayFreeDelayPool(i);
safe_free(cfg->rates[i]);
}
aclDestroyAccessList(&cfg->access[i]);
}
delayFreeDelayData(cfg->pools);
- xfree(cfg->class);
+ xfree(cfg->delay_class);
xfree(cfg->rates);
xfree(cfg->access);
memset(cfg, 0, sizeof(*cfg));
parse_ushort(&cfg->pools);
if (cfg->pools) {
delayInitDelayData(cfg->pools);
- cfg->class = xcalloc(cfg->pools, sizeof(u_char));
+ cfg->delay_class = xcalloc(cfg->pools, sizeof(u_char));
cfg->rates = xcalloc(cfg->pools, sizeof(delaySpecSet *));
cfg->access = xcalloc(cfg->pools, sizeof(acl_access *));
}
return;
}
pool--;
- if (cfg->class[pool]) {
+ if (cfg->delay_class[pool]) {
delayFreeDelayPool(pool);
safe_free(cfg->rates[pool]);
}
cfg->rates[pool] = xmalloc(class * sizeof(delaySpec));
- cfg->class[pool] = class;
+ cfg->delay_class[pool] = class;
cfg->rates[pool]->aggregate.restore_bps = cfg->rates[pool]->aggregate.max_bytes = -1;
- if (cfg->class[pool] >= 3)
+ if (cfg->delay_class[pool] >= 3)
cfg->rates[pool]->network.restore_bps = cfg->rates[pool]->network.max_bytes = -1;
- if (cfg->class[pool] >= 2)
+ if (cfg->delay_class[pool] >= 2)
cfg->rates[pool]->individual.restore_bps = cfg->rates[pool]->individual.max_bytes = -1;
delayCreateDelayPool(pool, class);
}
return;
}
pool--;
- class = cfg->class[pool];
+ class = cfg->delay_class[pool];
if (class == 0) {
debug(3, 0) ("parse_delay_pool_rates: Ignoring pool %d attempt to set rates with class not set\n", pool + 1);
return;
ptr->max_bytes = i;
ptr++;
}
- class = cfg->class[pool];
+ class = cfg->delay_class[pool];
/* if class is 3, swap around network and individual */
if (class == 3) {
delaySpec tmp;
/*
- * $Id: delay_pools.cc,v 1.26 2002/09/24 21:29:31 robertc Exp $
+ * $Id: delay_pools.cc,v 1.27 2002/10/13 23:48:24 hno Exp $
*
* DEBUG: section 77 Delay Pools
* AUTHOR: David Luyer <david@luyer.net>
#include "StoreClient.h"
struct _class1DelayPool {
- int class;
+ int delay_class;
int aggregate;
};
#define IND_MAP_SZ 256
struct _class2DelayPool {
- int class;
+ int delay_class;
int aggregate;
/* OK: -1 is terminator. individual[255] is always host 255. */
/* 255 entries + 1 terminator byte */
#define C3_IND_SZ (NET_MAP_SZ*IND_MAP_SZ)
struct _class3DelayPool {
- int class;
+ int delay_class;
int aggregate;
/* OK: -1 is terminator. network[255] is always host 255. */
/* 255 entries + 1 terminator byte */
}
void
-delayCreateDelayPool(unsigned short pool, u_char class)
+delayCreateDelayPool(unsigned short pool, u_char delay_class)
{
- switch (class) {
+ switch (delay_class) {
case 1:
delay_data[pool].class1 = xmalloc(sizeof(class1DelayPool));
- delay_data[pool].class1->class = 1;
+ delay_data[pool].class1->delay_class = 1;
memory_used += sizeof(class1DelayPool);
break;
case 2:
delay_data[pool].class2 = xmalloc(sizeof(class2DelayPool));
- delay_data[pool].class1->class = 2;
+ delay_data[pool].class1->delay_class = 2;
memory_used += sizeof(class2DelayPool);
break;
case 3:
delay_data[pool].class3 = xmalloc(sizeof(class3DelayPool));
- delay_data[pool].class1->class = 3;
+ delay_data[pool].class1->delay_class = 3;
memory_used += sizeof(class3DelayPool);
break;
default:
}
void
-delayInitDelayPool(unsigned short pool, u_char class, delaySpecSet * rates)
+delayInitDelayPool(unsigned short pool, u_char delay_class, delaySpecSet * rates)
{
/* delaySetSpec may be pointer to partial structure so MUST pass by
* reference.
*/
- switch (class) {
+ switch (delay_class) {
case 1:
delay_data[pool].class1->aggregate = (int) (((double) rates->aggregate.max_bytes *
Config.Delay.initial) / 100);
delayFreeDelayPool(unsigned short pool)
{
/* this is a union - and all free() cares about is the pointer location */
- switch (delay_data[pool].class1->class) {
+ switch (delay_data[pool].class1->delay_class) {
case 1:
memory_used -= sizeof(class1DelayPool);
break;
break;
default:
debug(77, 1) ("delayFreeDelayPool: bad class %d\n",
- delay_data[pool].class1->class);
+ delay_data[pool].class1->delay_class);
}
safe_free(delay_data[pool].class1);
}
int j;
unsigned int host;
unsigned short pool, position;
- unsigned char class, net;
+ unsigned char delay_class, net;
assert(http);
r = http->request;
}
if (pool == Config.Delay.pools)
return delayId(0, 0);
- class = Config.Delay.class[pool];
- if (class == 0)
+ delay_class = Config.Delay.delay_class[pool];
+ if (delay_class == 0)
return delayId(0, 0);
- if (class == 1)
+ if (delay_class == 1)
return delayId(pool + 1, 0);
- if (class == 2) {
+ if (delay_class == 2) {
host = ntohl(ch.src_addr.s_addr) & 0xff;
if (host == 255) {
if (!delay_data[pool].class2->individual_255_used) {
{
int incr = squid_curtime - delay_pools_last_update;
unsigned short i;
- unsigned char class;
+ unsigned char delay_class;
if (!Config.Delay.pools)
return;
eventAdd("delayPoolsUpdate", delayPoolsUpdate, NULL, 1.0, 1);
return;
delay_pools_last_update = squid_curtime;
for (i = 0; i < Config.Delay.pools; i++) {
- class = Config.Delay.class[i];
- if (!class)
+ delay_class = Config.Delay.delay_class[i];
+ if (!delay_class)
continue;
- switch (class) {
+ switch (delay_class) {
case 1:
delayUpdateClass1(delay_data[i].class1, Config.Delay.rates[i], incr);
break;
{
unsigned short position = d & 0xFFFF;
unsigned short pool = (d >> 16) - 1;
- unsigned char class = (pool == 0xFFFF) ? 0 : Config.Delay.class[pool];
+ unsigned char delay_class = (pool == 0xFFFF) ? 0 : Config.Delay.delay_class[pool];
int nbytes = max;
- switch (class) {
+ switch (delay_class) {
case 0:
break;
break;
default:
- fatalf("delayBytesWanted: Invalid class %d\n", class);
+ fatalf("delayBytesWanted: Invalid class %d\n", delay_class);
break;
}
nbytes = XMAX(min, nbytes);
{
unsigned short position = d & 0xFFFF;
unsigned short pool = (d >> 16) - 1;
- unsigned char class;
+ unsigned char delay_class;
if (pool == 0xFFFF)
return;
- class = Config.Delay.class[pool];
- switch (class) {
+ delay_class = Config.Delay.delay_class[pool];
+ switch (delay_class) {
case 1:
delay_data[pool].class1->aggregate -= qty;
return;
delay_data[pool].class3->individual[position] -= qty;
return;
}
- fatalf("delayBytesWanted: Invalid class %d\n", class);
+ fatalf("delayBytesWanted: Invalid class %d\n", delay_class);
assert(0);
}
storeAppendPrintf(sentry, "Delay pools configured: %d\n\n", Config.Delay.pools);
for (i = 0; i < Config.Delay.pools; i++) {
- switch (Config.Delay.class[i]) {
+ switch (Config.Delay.delay_class[i]) {
case 0:
storeAppendPrintf(sentry, "Pool: %d\n\tClass: 0\n\n", i + 1);
storeAppendPrintf(sentry, "\tMisconfigured pool.\n\n");
/*
- * $Id: protos.h,v 1.452 2002/10/13 20:35:03 robertc Exp $
+ * $Id: protos.h,v 1.453 2002/10/13 23:48:24 hno Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
SQUIDCEXTERN void delayPoolsInit(void);
SQUIDCEXTERN void delayInitDelayData(unsigned short pools);
SQUIDCEXTERN void delayFreeDelayData(unsigned short pools);
-SQUIDCEXTERN void delayCreateDelayPool(unsigned short pool, u_char class);
-SQUIDCEXTERN void delayInitDelayPool(unsigned short pool, u_char class, delaySpecSet * rates);
+SQUIDCEXTERN void delayCreateDelayPool(unsigned short pool, u_char delay_class);
+SQUIDCEXTERN void delayInitDelayPool(unsigned short pool, u_char delay_class, delaySpecSet * rates);
SQUIDCEXTERN void delayFreeDelayPool(unsigned short pool);
SQUIDCEXTERN void delayPoolsReconfigure(void);
SQUIDCEXTERN void delaySetNoDelay(int fd);
/*
- * $Id: structs.h,v 1.433 2002/10/13 20:35:05 robertc Exp $
+ * $Id: structs.h,v 1.434 2002/10/13 23:48:24 hno Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
struct _delayConfig {
unsigned short pools;
unsigned short initial;
- unsigned char *class;
+ unsigned char *delay_class;
delaySpecSet **rates;
acl_access **access;
};