]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
replaced NEIGHBOR_ and HELPER_ EBIT calls
authorwessels <>
Tue, 15 Sep 1998 03:58:45 +0000 (03:58 +0000)
committerwessels <>
Tue, 15 Sep 1998 03:58:45 +0000 (03:58 +0000)
13 files changed:
src/authenticate.cc
src/cache_cf.cc
src/dns.cc
src/enums.h
src/fqdncache.cc
src/http.cc
src/ipcache.cc
src/neighbors.cc
src/peer_digest.cc
src/peer_select.cc
src/redirect.cc
src/structs.h
src/typedefs.h

index 28c3419db338c8361c4cba7f6bbe31ecbdb74301..323b6eed52582bbfd1a04d88ff6c569ae6060051 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: authenticate.cc,v 1.3 1998/09/04 23:04:38 wessels Exp $
+ * $Id: authenticate.cc,v 1.4 1998/09/14 21:58:45 wessels Exp $
  *
  * DEBUG: section 29    Authenticator
  * AUTHOR: Duane Wessels
@@ -43,7 +43,7 @@ typedef struct {
 
 typedef struct _authenticator {
     int index;
-    int flags;
+    helper_flags flags;
     int fd;
     char *inbuf;
     unsigned int size;
@@ -100,10 +100,13 @@ authenticateHandleRead(int fd, void *data)
     if (len <= 0) {
        if (len < 0)
            debug(50, 1) ("authenticateHandleRead: FD %d read: %s\n", fd, xstrerror());
-       debug(29, EBIT_TEST(authenticator->flags, HELPER_CLOSING) ? 5 : 1)
+       debug(29, authenticator->flags.closing ? 5 : 1)
            ("FD %d: Connection from Authenticator #%d is closed, disabling\n",
            fd, authenticator->index + 1);
-       authenticator->flags = 0;
+       authenticator->flags.alive = 0;
+       authenticator->flags.busy = 0;
+       authenticator->flags.closing = 0;
+       authenticator->flags.shutdown = 0;
        memFree(MEM_8K_BUF, authenticator->inbuf);
        authenticator->inbuf = NULL;
        comm_close(fd);
@@ -143,7 +146,7 @@ authenticateHandleRead(int fd, void *data)
            }
            authenticateStateFree(r);
            authenticator->authenticateState = NULL;
-           EBIT_CLR(authenticator->flags, HELPER_BUSY);
+           authenticator->flags.busy = 0;
            authenticator->offset = 0;
            n = ++AuthenticateStats.replies;
            AuthenticateStats.avg_svc_time =
@@ -190,9 +193,9 @@ GetFirstAvailable(void)
     authenticator_t *authenticate = NULL;
     for (k = 0; k < NAuthenticators; k++) {
        authenticate = *(authenticate_child_table + k);
-       if (EBIT_TEST(authenticate->flags, HELPER_BUSY))
+       if (authenticate->flags.busy)
            continue;
-       if (!EBIT_TEST(authenticate->flags, HELPER_ALIVE))
+       if (!authenticate->flags.alive)
            continue;
        return authenticate;
     }
@@ -217,7 +220,7 @@ authenticateDispatch(authenticator_t * authenticate, authenticateStateData * r)
        authenticateStateFree(r);
        return;
     }
-    EBIT_SET(authenticate->flags, HELPER_BUSY);
+    authenticate->flags.busy = 1;
     authenticate->authenticateState = r;
     authenticate->dispatch_time = current_time;
     buf = memAllocate(MEM_8K_BUF);
@@ -331,9 +334,9 @@ authenticateOpenServers(void)
            &authenticatesocket);
        if (x < 0) {
            debug(29, 1) ("WARNING: Cannot run '%s' process.\n", prg);
-           EBIT_CLR(authenticate_child_table[k]->flags, HELPER_ALIVE);
+           authenticate_child_table[k]->flags.alive = 0;
        } else {
-           EBIT_SET(authenticate_child_table[k]->flags, HELPER_ALIVE);
+           authenticate_child_table[k]->flags.alive = 1;
            authenticate_child_table[k]->index = k;
            authenticate_child_table[k]->fd = authenticatesocket;
            authenticate_child_table[k]->inbuf = memAllocate(MEM_8K_BUF);
@@ -380,19 +383,19 @@ authenticateShutdownServers(void *unused)
     }
     for (k = 0; k < NAuthenticators; k++) {
        authenticate = *(authenticate_child_table + k);
-       if (!EBIT_TEST(authenticate->flags, HELPER_ALIVE))
+       if (!authenticate->flags.alive)
            continue;
-       if (EBIT_TEST(authenticate->flags, HELPER_CLOSING))
+       if (authenticate->flags.closing)
            continue;
-       if (EBIT_TEST(authenticate->flags, HELPER_BUSY)) {
+       if (authenticate->flags.busy) {
            na++;
            continue;
        }
        debug(29, 3) ("authenticateShutdownServers: closing authenticator #%d, FD %d\n",
            authenticate->index + 1, authenticate->fd);
        comm_close(authenticate->fd);
-       EBIT_SET(authenticate->flags, HELPER_CLOSING);
-       EBIT_SET(authenticate->flags, HELPER_BUSY);
+       authenticate->flags.closing = 1;
+       authenticate->flags.busy = 1;
     }
     if (na)
        eventAdd("authenticateShutdownServers", authenticateShutdownServers, NULL, 1.0, 1);
index c58a6652020c4ca3eb89a44579a06590f05d50bf..b88f1bde446b8194737e259c6f507a67044ffa61 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: cache_cf.cc,v 1.304 1998/09/01 22:12:06 wessels Exp $
+ * $Id: cache_cf.cc,v 1.305 1998/09/14 21:58:46 wessels Exp $
  *
  * DEBUG: section 3     Configuration File Parsing
  * AUTHOR: Harvest Derived
@@ -770,17 +770,17 @@ parse_peer(peer ** head)
     }
     while ((token = strtok(NULL, w_space))) {
        if (!strcasecmp(token, "proxy-only")) {
-           EBIT_SET(p->options, NEIGHBOR_PROXY_ONLY);
+           p->options.proxy_only = 1;
        } else if (!strcasecmp(token, "no-query")) {
-           EBIT_SET(p->options, NEIGHBOR_NO_QUERY);
+           p->options.no_query = 1;
        } else if (!strcasecmp(token, "no-digest")) {
-           EBIT_SET(p->options, NEIGHBOR_NO_DIGEST);
+           p->options.no_digest = 1;
        } else if (!strcasecmp(token, "multicast-responder")) {
-           EBIT_SET(p->options, NEIGHBOR_MCAST_RESPONDER);
+           p->options.mcast_responder = 1;
        } else if (!strncasecmp(token, "weight=", 7)) {
            p->weight = atoi(token + 7);
        } else if (!strcasecmp(token, "closest-only")) {
-           EBIT_SET(p->options, NEIGHBOR_CLOSEST_ONLY);
+           p->options.closest_only = 1;
        } else if (!strncasecmp(token, "ttl=", 4)) {
            p->mcast.ttl = atoi(token + 4);
            if (p->mcast.ttl < 0)
@@ -788,15 +788,15 @@ parse_peer(peer ** head)
            if (p->mcast.ttl > 128)
                p->mcast.ttl = 128;
        } else if (!strcasecmp(token, "default")) {
-           EBIT_SET(p->options, NEIGHBOR_DEFAULT_PARENT);
+           p->options.default_parent = 1;
        } else if (!strcasecmp(token, "round-robin")) {
-           EBIT_SET(p->options, NEIGHBOR_ROUNDROBIN);
+           p->options.roundrobin = 1;
 #if USE_HTCP
        } else if (!strcasecmp(token, "htcp")) {
-           EBIT_SET(p->options, NEIGHBOR_HTCP);
+           p->options.htcp = 1;
 #endif
        } else if (!strcasecmp(token, "no-netdb-exchange")) {
-           EBIT_SET(p->options, NEIGHBOR_NO_NETDB_EXCHANGE);
+           p->options.no_netdb_exchange = 1;
 #if USE_CARP
        } else if (!strncasecmp(token, "carp-load-factor=", 17)) {
            if (p->type != PEER_PARENT)
@@ -806,7 +806,7 @@ parse_peer(peer ** head)
 #endif
 #if DELAY_POOLS
        } else if (!strcasecmp(token, "no-delay")) {
-           EBIT_SET(p->options, NEIGHBOR_NO_DELAY);
+           p->options.no_delay = 1;
 #endif
        } else {
            debug(3, 0) ("parse_peer: token='%s'\n", token);
index 1c7d6f8ebde77ec392fa7081b4da64b5590c6d06..b9eac8429c2ad4f9fcc2af65e916e2e612d2490b 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: dns.cc,v 1.63 1998/07/29 03:57:37 wessels Exp $
+ * $Id: dns.cc,v 1.64 1998/09/14 21:58:47 wessels Exp $
  *
  * DEBUG: section 34    Dnsserver interface
  * AUTHOR: Harvest Derived
@@ -65,11 +65,11 @@ dnsGetFirstAvailable(void)
     dnsserver_t *dns = NULL;
     for (k = 0; k < NDnsServersAlloc; k++) {
        dns = *(dns_child_table + k);
-       if (EBIT_TEST(dns->flags, HELPER_BUSY))
+       if (dns->flags.busy)
            continue;
-       if (EBIT_TEST(dns->flags, HELPER_CLOSING))
+       if (dns->flags.closing)
            continue;
-       if (!EBIT_TEST(dns->flags, HELPER_ALIVE))
+       if (!dns->flags.alive)
            continue;
        return dns;
     }
@@ -131,14 +131,14 @@ dnsOpenServers(void)
            &wfd);
        if (x < 0) {
            debug(34, 1) ("dnsOpenServers: WARNING: Failed to start 'dnsserver' #%d.\n", k + 1);
-           EBIT_CLR(dns_child_table[k]->flags, HELPER_ALIVE);
+           dns_child_table[k]->flags.alive = 0;
            dns_child_table[k]->id = k + 1;
            dns_child_table[k]->inpipe = -1;
            dns_child_table[k]->outpipe = -1;
        } else {
            debug(34, 4) ("dnsOpenServers: FD %d connected to %s #%d.\n",
                wfd, prg, k + 1);
-           EBIT_SET(dns_child_table[k]->flags, HELPER_ALIVE);
+           dns_child_table[k]->flags.alive = 1;
            dns_child_table[k]->id = k + 1;
            dns_child_table[k]->inpipe = rfd;
            dns_child_table[k]->outpipe = wfd;
@@ -196,10 +196,10 @@ dnsStats(StoreEntry * sentry)
            k + 1,
            dns->inpipe,
            DnsStats.hist[k],
-           EBIT_TEST(dns->flags, HELPER_ALIVE) ? 'A' : ' ',
-           EBIT_TEST(dns->flags, HELPER_BUSY) ? 'B' : ' ',
-           EBIT_TEST(dns->flags, HELPER_CLOSING) ? 'C' : ' ',
-           EBIT_TEST(dns->flags, HELPER_SHUTDOWN) ? 'S' : ' ',
+           dns->flags.alive ? 'A' : ' ',
+           dns->flags.busy ? 'B' : ' ',
+           dns->flags.closing ? 'C' : ' ',
+           dns->flags.shutdown ? 'S' : ' ',
            0.001 * tvSubMsec(dns->dispatch_time, current_time),
            (int) dns->offset);
     }
@@ -218,17 +218,17 @@ dnsShutdownServers(void *notused)
     debug(34, 3) ("dnsShutdownServers:\n");
     for (k = 0; k < NDnsServersAlloc; k++) {
        dns = *(dns_child_table + k);
-       if (!EBIT_TEST(dns->flags, HELPER_ALIVE)) {
+       if (!dns->flags.alive) {
            debug(34, 3) ("dnsShutdownServers: #%d is NOT ALIVE.\n", dns->id);
            continue;
        }
-       if (EBIT_TEST(dns->flags, HELPER_BUSY)) {
+       if (dns->flags.busy) {
            debug(34, 3) ("dnsShutdownServers: #%d is BUSY.\n", dns->id);
-           EBIT_SET(dns->flags, HELPER_SHUTDOWN);
+           dns->flags.shutdown = 1;
            na++;
            continue;
        }
-       if (EBIT_TEST(dns->flags, HELPER_CLOSING)) {
+       if (dns->flags.closing) {
            debug(34, 3) ("dnsShutdownServers: #%d is CLOSING.\n", dns->id);
            continue;
        }
@@ -266,18 +266,21 @@ dnsShutdownServer(dnsserver_t * dns)
        dnsShutdownRead,
        dns,
        0);
-    EBIT_SET(dns->flags, HELPER_CLOSING);
+    dns->flags.closing = 1;
 }
 
 static void
 dnsShutdownRead(int fd, void *data)
 {
     dnsserver_t *dns = data;
-    debug(14, EBIT_TEST(dns->flags, HELPER_CLOSING) ? 5 : 1)
+    debug(14, dns->flags.closing ? 5 : 1)
        ("FD %d: Connection from DNSSERVER #%d is closed, disabling\n",
        fd,
        dns->id);
-    dns->flags = 0;
+    dns->flags.alive = 0;
+    dns->flags.busy = 0;
+    dns->flags.closing = 0;
+    dns->flags.shutdown = 0;
     commSetSelect(fd, COMM_SELECT_WRITE, NULL, NULL, 0);
     cbdataUnlock(dns);
     comm_close(fd);
index 15676fb02e0804554908d50e4d3b8264177d6091..2f054933ce1bf4eafc80ea8055a01591bd17529f 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: enums.h,v 1.127 1998/09/14 21:28:01 wessels Exp $
+ * $Id: enums.h,v 1.128 1998/09/14 21:58:47 wessels Exp $
  *
  *
  * SQUID Internet Object Cache  http://squid.nlanr.net/Squid/
@@ -445,31 +445,6 @@ enum {
     ERR_FLAG_CBDATA
 };
 
-enum {
-    HELPER_ALIVE,
-    HELPER_BUSY,
-    HELPER_CLOSING,
-    HELPER_SHUTDOWN
-};
-
-enum {
-    NEIGHBOR_PROXY_ONLY,
-    NEIGHBOR_NO_QUERY,
-    NEIGHBOR_NO_DIGEST,
-    NEIGHBOR_DEFAULT_PARENT,
-    NEIGHBOR_ROUNDROBIN,
-    NEIGHBOR_MCAST_RESPONDER,
-    NEIGHBOR_CLOSEST_ONLY,
-#if USE_HTCP
-    NEIGHBOR_HTCP,
-#endif
-    NEIGHBOR_NO_NETDB_EXCHANGE,
-#if DELAY_POOLS
-    NEIGHBOR_NO_DELAY,
-#endif
-    NEIGHBOR_END
-};
-
 typedef enum {
     ACCESS_DENIED,
     ACCESS_ALLOWED,
index 17f3dc3e979d4bd2f2464ca52cb57371d0543a02..d7ef8d5bf903f46121d6bdc6fa50d639add4009d 100644 (file)
@@ -1,7 +1,7 @@
 
 
 /*
- * $Id: fqdncache.cc,v 1.114 1998/09/04 23:04:44 wessels Exp $
+ * $Id: fqdncache.cc,v 1.115 1998/09/14 21:58:48 wessels Exp $
  *
  * DEBUG: section 35    FQDN Cache
  * AUTHOR: Harvest Derived
@@ -359,10 +359,13 @@ fqdncache_dnsHandleRead(int fd, void *data)
                dnsData, 0);
            return;
        }
-       debug(35, EBIT_TEST(dnsData->flags, HELPER_CLOSING) ? 5 : 1)
+       debug(35, dnsData->flags.closing ? 5 : 1)
            ("FD %d: Connection from DNSSERVER #%d is closed, disabling\n",
            fd, dnsData->id);
-       dnsData->flags = 0;
+       dnsData->flags.alive = 0;
+       dnsData->flags.busy = 0;
+       dnsData->flags.closing = 0;
+       dnsData->flags.shutdown = 0;
        commSetSelect(fd,
            COMM_SELECT_WRITE,
            NULL,
@@ -406,8 +409,8 @@ fqdncache_dnsHandleRead(int fd, void *data)
     }
     if (dnsData->offset == 0) {
        dnsData->data = NULL;
-       EBIT_CLR(dnsData->flags, HELPER_BUSY);
-       if (EBIT_TEST(dnsData->flags, HELPER_SHUTDOWN))
+       dnsData->flags.busy = 0;
+       if (dnsData->flags.shutdown)
            dnsShutdownServer(dnsData);
        cbdataUnlock(dnsData);
     }
@@ -499,7 +502,7 @@ static void
 fqdncache_dnsDispatch(dnsserver_t * dns, fqdncache_entry * f)
 {
     char *buf = NULL;
-    assert(EBIT_TEST(dns->flags, HELPER_ALIVE));
+    assert(dns->flags.alive);
     if (!fqdncacheHasPending(f)) {
        debug(35, 0) ("fqdncache_dnsDispatch: skipping '%s' because no handler.\n",
            f->name);
@@ -511,7 +514,7 @@ fqdncache_dnsDispatch(dnsserver_t * dns, fqdncache_entry * f)
        debug_trap("fqdncache_dnsDispatch: status != FQDN_PENDING");
     buf = xcalloc(1, 256);
     snprintf(buf, 256, "%s\n", f->name);
-    EBIT_SET(dns->flags, HELPER_BUSY);
+    dns->flags.busy = 1;
     dns->data = f;
     f->status = FQDN_DISPATCHED;
     comm_write(dns->outpipe,
index d6ef68c5ab80e45b4470c51f92b177b6e91a015f..f216be4a522c3a126a57fa1bf125d8aa0ad7a802 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: http.cc,v 1.317 1998/09/14 21:28:05 wessels Exp $
+ * $Id: http.cc,v 1.318 1998/09/14 21:58:49 wessels Exp $
  *
  * DEBUG: section 11    Hypertext Transfer Protocol (HTTP)
  * AUTHOR: Harvest Derived
@@ -795,10 +795,10 @@ httpStart(FwdState * fwdState, int fd)
         * We might end up getting the object from somewhere else if,
         * for example, the request to this neighbor fails.
         */
-       if (EBIT_TEST(httpState->peer->options, NEIGHBOR_PROXY_ONLY))
+       if (httpState->peer->options.proxy_only)
            storeReleaseRequest(httpState->entry);
 #if DELAY_POOLS
-       if (EBIT_TEST(httpState->peer->options, NEIGHBOR_NO_DELAY)) {
+       if (httpState->peer->options.no_delay) {
            proxy_req->delay_id = 0;
        } else {
            proxy_req->delay_id = orig_req->delay_id;
index e7ac8d1c06816cd8da2845a72b59e2ce31a69e87..b0ce85ce2a4b04980d5d08fd3b6b66ef890697af 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ipcache.cc,v 1.200 1998/09/04 23:04:54 wessels Exp $
+ * $Id: ipcache.cc,v 1.201 1998/09/14 21:58:50 wessels Exp $
  *
  * DEBUG: section 14    IP Cache
  * AUTHOR: Harvest Derived
@@ -409,10 +409,13 @@ ipcache_dnsHandleRead(int fd, void *data)
                0);
            return;
        }
-       debug(14, EBIT_TEST(dnsData->flags, HELPER_CLOSING) ? 5 : 1)
+       debug(14, dnsData->flags.closing ? 5 : 1)
            ("FD %d: Connection from DNSSERVER #%d is closed, disabling\n",
            fd, dnsData->id);
-       dnsData->flags = 0;
+       dnsData->flags.alive = 0;
+       dnsData->flags.busy = 0;
+       dnsData->flags.closing = 0;
+       dnsData->flags.shutdown = 0;
        commSetSelect(fd, COMM_SELECT_WRITE, NULL, NULL, 0);
        comm_close(fd);
        return;
@@ -450,8 +453,8 @@ ipcache_dnsHandleRead(int fd, void *data)
     }
     if (dnsData->offset == 0) {
        dnsData->data = NULL;
-       EBIT_CLR(dnsData->flags, HELPER_BUSY);
-       if (EBIT_TEST(dnsData->flags, HELPER_SHUTDOWN))
+       dnsData->flags.busy = 0;
+       if (dnsData->flags.shutdown)
            dnsShutdownServer(dnsData);
        cbdataUnlock(dnsData);
     }
@@ -545,7 +548,7 @@ static void
 ipcache_dnsDispatch(dnsserver_t * dns, ipcache_entry * i)
 {
     char *buf = NULL;
-    assert(EBIT_TEST(dns->flags, HELPER_ALIVE));
+    assert(dns->flags.alive);
     if (!ipcacheHasPending(i)) {
        debug(14, 3) ("Skipping lookup of '%s' because client(s) disappeared.\n",
            i->name);
@@ -556,7 +559,7 @@ ipcache_dnsDispatch(dnsserver_t * dns, ipcache_entry * i)
     assert(i->status == IP_PENDING);
     buf = xcalloc(1, 256);
     snprintf(buf, 256, "%s\n", i->name);
-    EBIT_SET(dns->flags, HELPER_BUSY);
+    dns->flags.busy = 1;
     dns->data = i;
     i->status = IP_DISPATCHED;
     cbdataLock(dns);
index 701a386c8b401812e37da4391b3336aa8a1c1b17..b7bddd252910217c7a9decf946f1b074385cf2ce 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: neighbors.cc,v 1.246 1998/09/14 21:28:06 wessels Exp $
+ * $Id: neighbors.cc,v 1.247 1998/09/14 21:58:51 wessels Exp $
  *
  * DEBUG: section 15    Neighbor Routines
  * AUTHOR: Harvest Derived
@@ -153,9 +153,9 @@ peerWouldBePinged(const peer * p, request_t * request)
 {
     if (!peerAllowedToUse(p, request))
        return 0;
-    if (EBIT_TEST(p->options, NEIGHBOR_NO_QUERY))
+    if (p->options.no_query)
        return 0;
-    if (EBIT_TEST(p->options, NEIGHBOR_MCAST_RESPONDER))
+    if (p->options.mcast_responder)
        return 0;
     /* the case below seems strange, but can happen if the
      * URL host is on the other side of a firewall */
@@ -207,7 +207,7 @@ getSingleParent(request_t * request)
            return NULL;        /* oops, found second parent */
        p = q;
     }
-    if (p != NULL && !EBIT_TEST(p->options, NEIGHBOR_NO_QUERY))
+    if (p != NULL && !p->options.no_query)
        return NULL;
     debug(15, 3) ("getSingleParent: returning %s\n", p ? p->host : "NULL");
     return p;
@@ -236,7 +236,7 @@ getRoundRobinParent(request_t * request)
     peer *p;
     peer *q = NULL;
     for (p = Config.peers; p; p = p->next) {
-       if (!EBIT_TEST(p->options, NEIGHBOR_ROUNDROBIN))
+       if (!p->options.roundrobin)
            continue;
        if (neighborType(p, request) != PEER_PARENT)
            continue;
@@ -259,7 +259,7 @@ getDefaultParent(request_t * request)
     for (p = Config.peers; p; p = p->next) {
        if (neighborType(p, request) != PEER_PARENT)
            continue;
-       if (!EBIT_TEST(p->options, NEIGHBOR_DEFAULT_PARENT))
+       if (!p->options.default_parent)
            continue;
        if (!peerHTTPOkay(p, request))
            continue;
@@ -376,7 +376,7 @@ neighborsUdpPing(request_t * request,
        debug(15, 3) ("neighborsUdpPing: reqnum = %d\n", reqnum);
 
 #if USE_HTCP
-       if (EBIT_TEST(p->options, NEIGHBOR_HTCP)) {
+       if (p->options.htcp) {
            debug(15, 3) ("neighborsUdpPing: sending HTCP query\n");
            htcpQuery(entry, request, p);
        } else
@@ -684,7 +684,7 @@ ignoreMulticastReply(peer * p, MemObject * mem)
 {
     if (p == NULL)
        return 0;
-    if (!EBIT_TEST(p->options, NEIGHBOR_MCAST_RESPONDER))
+    if (!p->options.mcast_responder)
        return 0;
     if (peerHTTPOkay(p, mem->request))
        return 0;
@@ -882,7 +882,7 @@ peerDNSConfigure(const ipcache_addrs * ia, void *data)
     if (p->type == PEER_MULTICAST)
        peerCountMcastPeersSchedule(p, 10);
     if (p->type != PEER_MULTICAST)
-       if (!EBIT_TEST(p->options, NEIGHBOR_NO_NETDB_EXCHANGE))
+       if (!p->options.no_netdb_exchange)
            eventAddIsh("netdbExchangeStart", netdbExchangeStart, p, 30.0, 1);
 }
 
@@ -1068,28 +1068,28 @@ neighborDumpNonPeers(StoreEntry * sentry)
 void
 dump_peer_options(StoreEntry * sentry, peer * p)
 {
-    if (EBIT_TEST(p->options, NEIGHBOR_PROXY_ONLY))
+    if (p->options.proxy_only)
        storeAppendPrintf(sentry, " proxy-only");
-    if (EBIT_TEST(p->options, NEIGHBOR_NO_QUERY))
+    if (p->options.no_query)
        storeAppendPrintf(sentry, " no-query");
-    if (EBIT_TEST(p->options, NEIGHBOR_NO_DIGEST))
+    if (p->options.no_digest)
        storeAppendPrintf(sentry, " no-digest");
-    if (EBIT_TEST(p->options, NEIGHBOR_DEFAULT_PARENT))
+    if (p->options.default_parent)
        storeAppendPrintf(sentry, " default");
-    if (EBIT_TEST(p->options, NEIGHBOR_ROUNDROBIN))
+    if (p->options.roundrobin)
        storeAppendPrintf(sentry, " round-robin");
-    if (EBIT_TEST(p->options, NEIGHBOR_MCAST_RESPONDER))
+    if (p->options.mcast_responder)
        storeAppendPrintf(sentry, " multicast-responder");
-    if (EBIT_TEST(p->options, NEIGHBOR_CLOSEST_ONLY))
+    if (p->options.closest_only)
        storeAppendPrintf(sentry, " closest-only");
 #if USE_HTCP
-    if (EBIT_TEST(p->options, NEIGHBOR_HTCP))
+    if (p->options.htcp)
        storeAppendPrintf(sentry, " htcp");
 #endif
-    if (EBIT_TEST(p->options, NEIGHBOR_NO_NETDB_EXCHANGE))
+    if (p->options.no_netdb_exchange)
        storeAppendPrintf(sentry, " no-netdb-exchange");
 #if DELAY_POOLS
-    if (EBIT_TEST(p->options, NEIGHBOR_NO_DELAY))
+    if (p->options.no_delay)
        storeAppendPrintf(sentry, " no-delay");
 #endif
     if (p->mcast.ttl > 0)
@@ -1138,7 +1138,7 @@ dump_peers(StoreEntry * sentry, peer * peers)
            percent(e->stats.ignored_replies, e->stats.pings_acked));
        storeAppendPrintf(sentry, "Histogram of PINGS ACKED:\n");
 #if USE_HTCP
-       if (EBIT_TEST(e->options, NEIGHBOR_HTCP)) {
+       if (e->options.htcp) {
            storeAppendPrintf(sentry, "\tMisses\t%8d %3d%%\n",
                e->htcp.counts[0],
                percent(e->htcp.counts[0], e->stats.pings_acked));
index aee9fbfa7512ff33a7e0e3210f3ebc8e27412f58..74855f9cf60cd8eab9605b555d64ffd51c858489 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: peer_digest.cc,v 1.48 1998/09/14 21:28:07 wessels Exp $
+ * $Id: peer_digest.cc,v 1.49 1998/09/14 21:58:52 wessels Exp $
  *
  * DEBUG: section 72    Peer Digest Routines
  * AUTHOR: Alex Rousskov
@@ -78,7 +78,7 @@ peerDigestInit(void *data)
     assert(p->digest.flags == (1 << PD_INIT_PENDING));
     assert(!p->digest.cd);
     assert(SM_PAGE_SIZE == 4096);      /* we use MEM_4K_BUF */
-    if (EBIT_TEST(p->options, NEIGHBOR_NO_DIGEST)) {
+    if (p->options.no_digest) {
        peerDigestDisable(p);
     } else {
        cbdataLock(p);
index 3af49ea12bd8db04e1d9fb5641db8edd051c955e..1a0a7cb82ca04375b7f80bc262d9ee4c1672dcf6 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: peer_select.cc,v 1.80 1998/09/14 21:28:08 wessels Exp $
+ * $Id: peer_select.cc,v 1.81 1998/09/14 21:58:52 wessels Exp $
  *
  * DEBUG: section 44    Peer Selection Algorithm
  * AUTHOR: Duane Wessels
@@ -433,7 +433,7 @@ peerIcpParentMiss(peer * p, icp_common_t * header, ps_state * ps)
        }
     }
     /* if closest-only is set, then don't allow FIRST_PARENT_MISS */
-    if (EBIT_TEST(p->options, NEIGHBOR_CLOSEST_ONLY))
+    if (p->options.closest_only)
        return;
     /* set FIRST_MISS if there is no CLOSEST parent */
     if (ps->closest_parent_miss.sin_addr.s_addr != any_addr.s_addr)
@@ -526,7 +526,7 @@ peerHtcpParentMiss(peer * p, htcpReplyData * htcp, ps_state * ps)
        }
     }
     /* if closest-only is set, then don't allow FIRST_PARENT_MISS */
-    if (EBIT_TEST(p->options, NEIGHBOR_CLOSEST_ONLY))
+    if (p->options.closest_only)
        return;
     /* set FIRST_MISS if there is no CLOSEST parent */
     if (ps->closest_parent_miss.sin_addr.s_addr != any_addr.s_addr)
index 10a9c315de32d2f9a91180f640091c42046ae022..d0785cd0b693158ca3a19bd4bdc45683f932f5bd 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: redirect.cc,v 1.65 1998/09/04 23:04:58 wessels Exp $
+ * $Id: redirect.cc,v 1.66 1998/09/14 21:58:53 wessels Exp $
  *
  * DEBUG: section 29    Redirector
  * AUTHOR: Duane Wessels
@@ -46,7 +46,7 @@ typedef struct {
 
 typedef struct _redirector {
     int index;
-    int flags;
+    helper_flags flags;
     int fd;
     char *inbuf;
     unsigned int size;
@@ -103,10 +103,13 @@ redirectHandleRead(int fd, void *data)
     if (len <= 0) {
        if (len < 0)
            debug(50, 1) ("redirectHandleRead: FD %d read: %s\n", fd, xstrerror());
-       debug(29, EBIT_TEST(redirector->flags, HELPER_CLOSING) ? 5 : 1)
+       debug(29, redirector->flags.closing ? 5 : 1)
            ("FD %d: Connection from Redirector #%d is closed, disabling\n",
            fd, redirector->index + 1);
-       redirector->flags = 0;
+       redirector->flags.alive = 0;
+       redirector->flags.busy = 0;
+       redirector->flags.closing = 0;
+       redirector->flags.shutdown = 0;
        memFree(MEM_8K_BUF, redirector->inbuf);
        redirector->inbuf = NULL;
        comm_close(fd);
@@ -146,7 +149,7 @@ redirectHandleRead(int fd, void *data)
            }
            redirectStateFree(r);
            redirector->redirectState = NULL;
-           EBIT_CLR(redirector->flags, HELPER_BUSY);
+           redirector->flags.busy = 0;
            redirector->offset = 0;
            n = ++RedirectStats.replies;
            RedirectStats.avg_svc_time =
@@ -193,9 +196,9 @@ GetFirstAvailable(void)
     redirector_t *redirect = NULL;
     for (k = 0; k < NRedirectors; k++) {
        redirect = *(redirect_child_table + k);
-       if (EBIT_TEST(redirect->flags, HELPER_BUSY))
+       if (redirect->flags.busy)
            continue;
-       if (!EBIT_TEST(redirect->flags, HELPER_ALIVE))
+       if (!redirect->flags.alive)
            continue;
        return redirect;
     }
@@ -222,7 +225,7 @@ redirectDispatch(redirector_t * redirect, redirectStateData * r)
        redirectStateFree(r);
        return;
     }
-    EBIT_SET(redirect->flags, HELPER_BUSY);
+    redirect->flags.busy = 1;
     redirect->redirectState = r;
     redirect->dispatch_time = current_time;
     if ((fqdn = fqdncache_gethostbyaddr(r->client_addr, 0)) == NULL)
@@ -337,9 +340,9 @@ redirectOpenServers(void)
            &redirectsocket);
        if (x < 0) {
            debug(29, 1) ("WARNING: Cannot run '%s' process.\n", prg);
-           EBIT_CLR(redirect_child_table[k]->flags, HELPER_ALIVE);
+           redirect_child_table[k]->flags.alive = 0;
        } else {
-           EBIT_SET(redirect_child_table[k]->flags, HELPER_ALIVE);
+           redirect_child_table[k]->flags.alive = 1;
            redirect_child_table[k]->index = k;
            redirect_child_table[k]->fd = redirectsocket;
            redirect_child_table[k]->inbuf = memAllocate(MEM_8K_BUF);
@@ -386,19 +389,19 @@ redirectShutdownServers(void *unused)
     }
     for (k = 0; k < NRedirectors; k++) {
        redirect = *(redirect_child_table + k);
-       if (!EBIT_TEST(redirect->flags, HELPER_ALIVE))
+       if (!redirect->flags.alive)
            continue;
-       if (EBIT_TEST(redirect->flags, HELPER_CLOSING))
+       if (redirect->flags.closing)
            continue;
-       if (EBIT_TEST(redirect->flags, HELPER_BUSY)) {
+       if (redirect->flags.busy) {
            na++;
            continue;
        }
        debug(29, 3) ("redirectShutdownServers: closing redirector #%d, FD %d\n",
            redirect->index + 1, redirect->fd);
        comm_close(redirect->fd);
-       EBIT_SET(redirect->flags, HELPER_CLOSING);
-       EBIT_SET(redirect->flags, HELPER_BUSY);
+       redirect->flags.closing = 1;
+       redirect->flags.busy = 1;
     }
     if (na)
        eventAdd("redirectShutdownServers", redirectShutdownServers, NULL, 1.0, 1);
index 34071bba3793c112656a3cce87b468707cf31f96..243a5fa238cdbae72652e7d8a5cd9aba51c05eac 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: structs.h,v 1.221 1998/09/14 21:28:17 wessels Exp $
+ * $Id: structs.h,v 1.222 1998/09/14 21:58:54 wessels Exp $
  *
  *
  * SQUID Internet Object Cache  http://squid.nlanr.net/Squid/
@@ -456,9 +456,16 @@ struct _dread_ctrl {
     void *client_data;
 };
 
+struct _helper_flags {
+    int alive:1;
+    int busy:1;
+    int closing:1;
+    int shutdown:1;
+};
+
 struct _dnsserver_t {
     int id;
-    int flags;
+    helper_flags flags;
     int inpipe;
     int outpipe;
     time_t answer;
@@ -988,7 +995,22 @@ struct _peer {
     domain_ping *pinglist;
     domain_type *typelist;
     acl_access *access;
-    int options;
+    struct {
+       int proxy_only:1;
+       int no_query:1;
+       int no_digest:1;
+       int default_parent:1;
+       int roundrobin:1;
+       int mcast_responder:1;
+       int closest_only:1;
+#if USE_HTCP
+       int htcp:1;
+#endif
+       int no_netdb_exchange:1;
+#if DELAY_POOLS
+       int no_delay:1;
+#endif
+    } options;
     int weight;
     struct {
        double avg_n_members;
index e03bc95269436cac179d75be78b5acdabef810e8..e24fb91b00bcbae6b00aace2851b0aa925119a44 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: typedefs.h,v 1.74 1998/09/14 21:28:18 wessels Exp $
+ * $Id: typedefs.h,v 1.75 1998/09/14 21:58:55 wessels Exp $
  *
  *
  * SQUID Internet Object Cache  http://squid.nlanr.net/Squid/
@@ -132,6 +132,7 @@ typedef struct _StoreEntry StoreEntry;
 typedef struct _SwapDir SwapDir;
 typedef struct _request_flags request_flags;
 typedef struct _store_flags store_flags;
+typedef struct _helper_flags helper_flags;
 typedef struct _request_t request_t;
 typedef struct _AccessLogEntry AccessLogEntry;
 typedef struct _cachemgr_passwd cachemgr_passwd;